aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig16
-rw-r--r--arch/alpha/kernel/alpha_ksyms.c2
-rw-r--r--arch/alpha/kernel/irq.c630
-rw-r--r--arch/alpha/kernel/machvec_impl.h2
-rw-r--r--arch/alpha/kernel/osf_sys.c2
-rw-r--r--arch/alpha/kernel/pci-noop.c1
-rw-r--r--arch/alpha/kernel/process.c34
-rw-r--r--arch/alpha/kernel/ptrace.c71
-rw-r--r--arch/alpha/kernel/smp.c2
-rw-r--r--arch/alpha/kernel/sys_alcor.c3
-rw-r--r--arch/alpha/kernel/sys_sio.c6
-rw-r--r--arch/alpha/mm/init.c1
-rw-r--r--arch/arm/Kconfig70
-rw-r--r--arch/arm/Makefile24
-rw-r--r--arch/arm/boot/Makefile2
-rw-r--r--arch/arm/boot/compressed/Makefile8
-rw-r--r--arch/arm/boot/compressed/head-at91rm9200.S57
-rw-r--r--arch/arm/boot/compressed/head-epxa10db.S5
-rw-r--r--arch/arm/boot/compressed/head.S48
-rw-r--r--arch/arm/common/Kconfig10
-rw-r--r--arch/arm/common/Makefile3
-rw-r--r--arch/arm/common/amba.c359
-rw-r--r--arch/arm/common/locomo.c4
-rw-r--r--arch/arm/common/rtctime.c16
-rw-r--r--arch/arm/common/sa1111.c4
-rw-r--r--arch/arm/common/scoop.c3
-rw-r--r--arch/arm/common/sharpsl_pm.c839
-rw-r--r--arch/arm/common/vic.c92
-rw-r--r--arch/arm/configs/assabet_defconfig1
-rw-r--r--arch/arm/configs/at91rm9200dk_defconfig1009
-rw-r--r--arch/arm/configs/at91rm9200ek_defconfig998
-rw-r--r--arch/arm/configs/badge4_defconfig1
-rw-r--r--arch/arm/configs/bast_defconfig1
-rw-r--r--arch/arm/configs/cerfcube_defconfig1
-rw-r--r--arch/arm/configs/clps7500_defconfig1
-rw-r--r--arch/arm/configs/collie_defconfig1
-rw-r--r--arch/arm/configs/corgi_defconfig1
-rw-r--r--arch/arm/configs/csb337_defconfig1136
-rw-r--r--arch/arm/configs/csb637_defconfig1116
-rw-r--r--arch/arm/configs/ebsa110_defconfig1
-rw-r--r--arch/arm/configs/edb7211_defconfig1
-rw-r--r--arch/arm/configs/enp2611_defconfig1
-rw-r--r--arch/arm/configs/ep80219_defconfig2
-rw-r--r--arch/arm/configs/footbridge_defconfig1
-rw-r--r--arch/arm/configs/fortunet_defconfig1
-rw-r--r--arch/arm/configs/h3600_defconfig1
-rw-r--r--arch/arm/configs/h7201_defconfig1
-rw-r--r--arch/arm/configs/h7202_defconfig1
-rw-r--r--arch/arm/configs/hackkit_defconfig1
-rw-r--r--arch/arm/configs/integrator_defconfig1
-rw-r--r--arch/arm/configs/iq31244_defconfig2
-rw-r--r--arch/arm/configs/iq80321_defconfig2
-rw-r--r--arch/arm/configs/iq80331_defconfig2
-rw-r--r--arch/arm/configs/iq80332_defconfig2
-rw-r--r--arch/arm/configs/ixdp2400_defconfig1
-rw-r--r--arch/arm/configs/ixdp2401_defconfig1
-rw-r--r--arch/arm/configs/ixdp2800_defconfig1
-rw-r--r--arch/arm/configs/ixdp2801_defconfig1
-rw-r--r--arch/arm/configs/ixp4xx_defconfig85
-rw-r--r--arch/arm/configs/jornada720_defconfig1
-rw-r--r--arch/arm/configs/lart_defconfig1
-rw-r--r--arch/arm/configs/lpd7a400_defconfig1
-rw-r--r--arch/arm/configs/lpd7a404_defconfig1
-rw-r--r--arch/arm/configs/lubbock_defconfig1
-rw-r--r--arch/arm/configs/lusl7200_defconfig1
-rw-r--r--arch/arm/configs/mainstone_defconfig1
-rw-r--r--arch/arm/configs/mx1ads_defconfig1
-rw-r--r--arch/arm/configs/neponset_defconfig1
-rw-r--r--arch/arm/configs/netwinder_defconfig1
-rw-r--r--arch/arm/configs/omap_h2_1610_defconfig1
-rw-r--r--arch/arm/configs/pleb_defconfig1
-rw-r--r--arch/arm/configs/pxa255-idp_defconfig1
-rw-r--r--arch/arm/configs/realview_defconfig1
-rw-r--r--arch/arm/configs/rpc_defconfig1
-rw-r--r--arch/arm/configs/s3c2410_defconfig1
-rw-r--r--arch/arm/configs/shannon_defconfig1
-rw-r--r--arch/arm/configs/shark_defconfig1
-rw-r--r--arch/arm/configs/simpad_defconfig1
-rw-r--r--arch/arm/configs/smdk2410_defconfig1
-rw-r--r--arch/arm/configs/spitz_defconfig20
-rw-r--r--arch/arm/configs/versatile_defconfig1
-rw-r--r--arch/arm/kernel/Makefile6
-rw-r--r--arch/arm/kernel/apm.c20
-rw-r--r--arch/arm/kernel/armksyms.c22
-rw-r--r--arch/arm/kernel/asm-offsets.c9
-rw-r--r--arch/arm/kernel/calls.S65
-rw-r--r--arch/arm/kernel/dma-isa.c22
-rw-r--r--arch/arm/kernel/dma.c73
-rw-r--r--arch/arm/kernel/ecard.c21
-rw-r--r--arch/arm/kernel/entry-armv.S80
-rw-r--r--arch/arm/kernel/entry-common.S160
-rw-r--r--arch/arm/kernel/entry-header.S1
-rw-r--r--arch/arm/kernel/fiq.c4
-rw-r--r--arch/arm/kernel/head.S9
-rw-r--r--arch/arm/kernel/irq.c17
-rw-r--r--arch/arm/kernel/module.c2
-rw-r--r--arch/arm/kernel/process.c16
-rw-r--r--arch/arm/kernel/ptrace.c61
-rw-r--r--arch/arm/kernel/semaphore.c17
-rw-r--r--arch/arm/kernel/setup.c17
-rw-r--r--arch/arm/kernel/signal.c29
-rw-r--r--arch/arm/kernel/signal.h2
-rw-r--r--arch/arm/kernel/smp.c4
-rw-r--r--arch/arm/kernel/sys_arm.c2
-rw-r--r--arch/arm/kernel/sys_oabi-compat.c339
-rw-r--r--arch/arm/kernel/time.c3
-rw-r--r--arch/arm/kernel/traps.c7
-rw-r--r--arch/arm/kernel/vmlinux.lds.S12
-rw-r--r--arch/arm/lib/ashldi3.S1
-rw-r--r--arch/arm/lib/ashrdi3.S1
-rw-r--r--arch/arm/lib/csumpartialcopy.S6
-rw-r--r--arch/arm/lib/csumpartialcopygeneric.S6
-rw-r--r--arch/arm/lib/csumpartialcopyuser.S8
-rw-r--r--arch/arm/lib/lib1funcs.S27
-rw-r--r--arch/arm/lib/lshrdi3.S1
-rw-r--r--arch/arm/lib/muldi3.S1
-rw-r--r--arch/arm/lib/ucmpdi2.S14
-rw-r--r--arch/arm/mach-aaec2000/aaed2000.c1
-rw-r--r--arch/arm/mach-aaec2000/clock.c28
-rw-r--r--arch/arm/mach-aaec2000/core.c2
-rw-r--r--arch/arm/mach-aaec2000/core.h2
-rw-r--r--arch/arm/mach-at91rm9200/Kconfig54
-rw-r--r--arch/arm/mach-at91rm9200/Makefile27
-rw-r--r--arch/arm/mach-at91rm9200/Makefile.boot9
-rw-r--r--arch/arm/mach-at91rm9200/board-csb337.c142
-rw-r--r--arch/arm/mach-at91rm9200/board-csb637.c115
-rw-r--r--arch/arm/mach-at91rm9200/board-dk.c137
-rw-r--r--arch/arm/mach-at91rm9200/board-ek.c130
-rw-r--r--arch/arm/mach-at91rm9200/clock.c620
-rw-r--r--arch/arm/mach-at91rm9200/common.c115
-rw-r--r--arch/arm/mach-at91rm9200/devices.c291
-rw-r--r--arch/arm/mach-at91rm9200/generic.h18
-rw-r--r--arch/arm/mach-at91rm9200/gpio.c302
-rw-r--r--arch/arm/mach-at91rm9200/irq.c170
-rw-r--r--arch/arm/mach-at91rm9200/time.c127
-rw-r--r--arch/arm/mach-clps711x/autcpu12.c1
-rw-r--r--arch/arm/mach-clps711x/cdb89712.c1
-rw-r--r--arch/arm/mach-clps711x/ceiva.c1
-rw-r--r--arch/arm/mach-clps711x/clep7312.c1
-rw-r--r--arch/arm/mach-clps711x/dma.c27
-rw-r--r--arch/arm/mach-clps711x/edb7211-arch.c1
-rw-r--r--arch/arm/mach-clps711x/fortunet.c1
-rw-r--r--arch/arm/mach-clps711x/p720t.c1
-rw-r--r--arch/arm/mach-clps7500/core.c1
-rw-r--r--arch/arm/mach-ebsa110/core.c1
-rw-r--r--arch/arm/mach-epxa10db/Kconfig23
-rw-r--r--arch/arm/mach-epxa10db/Makefile11
-rw-r--r--arch/arm/mach-epxa10db/Makefile.boot2
-rw-r--r--arch/arm/mach-epxa10db/arch.c74
-rw-r--r--arch/arm/mach-epxa10db/dma.c28
-rw-r--r--arch/arm/mach-epxa10db/irq.c82
-rw-r--r--arch/arm/mach-epxa10db/mm.c71
-rw-r--r--arch/arm/mach-epxa10db/time.c78
-rw-r--r--arch/arm/mach-footbridge/cats-hw.c1
-rw-r--r--arch/arm/mach-footbridge/co285.c1
-rw-r--r--arch/arm/mach-footbridge/dma.c1
-rw-r--r--arch/arm/mach-footbridge/ebsa285.c1
-rw-r--r--arch/arm/mach-footbridge/netwinder-hw.c2
-rw-r--r--arch/arm/mach-footbridge/personal.c1
-rw-r--r--arch/arm/mach-h720x/h7201-eval.c1
-rw-r--r--arch/arm/mach-h720x/h7202-eval.c1
-rw-r--r--arch/arm/mach-imx/mx1ads.c56
-rw-r--r--arch/arm/mach-integrator/clock.c28
-rw-r--r--arch/arm/mach-integrator/core.c2
-rw-r--r--arch/arm/mach-integrator/dma.c35
-rw-r--r--arch/arm/mach-integrator/impd1.c4
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c5
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c7
-rw-r--r--arch/arm/mach-integrator/lm.c36
-rw-r--r--arch/arm/mach-integrator/time.c7
-rw-r--r--arch/arm/mach-iop3xx/iop321-setup.c2
-rw-r--r--arch/arm/mach-iop3xx/iop331-setup.c96
-rw-r--r--arch/arm/mach-ixp2000/core.c10
-rw-r--r--arch/arm/mach-ixp2000/enp2611.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2400.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2800.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x01.c2
-rw-r--r--arch/arm/mach-ixp4xx/Kconfig8
-rw-r--r--arch/arm/mach-ixp4xx/Makefile1
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c23
-rw-r--r--arch/arm/mach-ixp4xx/common.c21
-rw-r--r--arch/arm/mach-ixp4xx/coyote-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c12
-rw-r--r--arch/arm/mach-ixp4xx/gtwx5715-setup.c16
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-pci.c5
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c19
-rw-r--r--arch/arm/mach-ixp4xx/ixdpg425-pci.c3
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-pci.c71
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-power.c67
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c134
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-pci.c8
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-power.c3
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c1
-rw-r--r--arch/arm/mach-l7200/core.c1
-rw-r--r--arch/arm/mach-lh7a40x/arch-kev7a400.c1
-rw-r--r--arch/arm/mach-lh7a40x/arch-lpd7a40x.c2
-rw-r--r--arch/arm/mach-omap1/board-generic.c1
-rw-r--r--arch/arm/mach-omap1/board-h2.c1
-rw-r--r--arch/arm/mach-omap1/board-h3.c1
-rw-r--r--arch/arm/mach-omap1/board-innovator.c1
-rw-r--r--arch/arm/mach-omap1/board-netstar.c1
-rw-r--r--arch/arm/mach-omap1/board-osk.c1
-rw-r--r--arch/arm/mach-omap1/board-palmte.c3
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c3
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c1
-rw-r--r--arch/arm/mach-omap1/clock.c46
-rw-r--r--arch/arm/mach-omap1/clock.h168
-rw-r--r--arch/arm/mach-omap1/serial.c11
-rw-r--r--arch/arm/mach-omap2/board-generic.c1
-rw-r--r--arch/arm/mach-omap2/board-h4.c1
-rw-r--r--arch/arm/mach-omap2/clock.c34
-rw-r--r--arch/arm/mach-omap2/clock.h12
-rw-r--r--arch/arm/mach-omap2/serial.c14
-rw-r--r--arch/arm/mach-omap2/timer-gp.c5
-rw-r--r--arch/arm/mach-pxa/Kconfig4
-rw-r--r--arch/arm/mach-pxa/akita-ioexp.c7
-rw-r--r--arch/arm/mach-pxa/corgi.c10
-rw-r--r--arch/arm/mach-pxa/corgi_pm.c44
-rw-r--r--arch/arm/mach-pxa/idp.c1
-rw-r--r--arch/arm/mach-pxa/lubbock.c1
-rw-r--r--arch/arm/mach-pxa/mainstone.c28
-rw-r--r--arch/arm/mach-pxa/pm.c9
-rw-r--r--arch/arm/mach-pxa/poodle.c8
-rw-r--r--arch/arm/mach-pxa/pxa27x.c6
-rw-r--r--arch/arm/mach-pxa/sharpsl.h101
-rw-r--r--arch/arm/mach-pxa/sharpsl_pm.c824
-rw-r--r--arch/arm/mach-pxa/spitz.c45
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c46
-rw-r--r--arch/arm/mach-pxa/ssp.c17
-rw-r--r--arch/arm/mach-pxa/tosa.c1
-rw-r--r--arch/arm/mach-realview/Kconfig1
-rw-r--r--arch/arm/mach-realview/clock.c28
-rw-r--r--arch/arm/mach-realview/core.c4
-rw-r--r--arch/arm/mach-realview/core.h3
-rw-r--r--arch/arm/mach-realview/localtimer.c1
-rw-r--r--arch/arm/mach-realview/realview_eb.c3
-rw-r--r--arch/arm/mach-rpc/dma.c19
-rw-r--r--arch/arm/mach-rpc/riscpc.c1
-rw-r--r--arch/arm/mach-s3c2410/clock.c235
-rw-r--r--arch/arm/mach-s3c2410/clock.h1
-rw-r--r--arch/arm/mach-s3c2410/mach-anubis.c1
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c1
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c1
-rw-r--r--arch/arm/mach-s3c2410/mach-n30.c1
-rw-r--r--arch/arm/mach-s3c2410/mach-nexcoder.c1
-rw-r--r--arch/arm/mach-s3c2410/mach-otom.c1
-rw-r--r--arch/arm/mach-s3c2410/mach-rx3715.c1
-rw-r--r--arch/arm/mach-s3c2410/mach-smdk2410.c1
-rw-r--r--arch/arm/mach-s3c2410/mach-smdk2440.c1
-rw-r--r--arch/arm/mach-s3c2410/mach-vr1000.c1
-rw-r--r--arch/arm/mach-s3c2410/s3c2440-clock.c3
-rw-r--r--arch/arm/mach-s3c2410/s3c2440.c2
-rw-r--r--arch/arm/mach-s3c2410/time.c3
-rw-r--r--arch/arm/mach-s3c2410/usb-simtec.c6
-rw-r--r--arch/arm/mach-sa1100/assabet.c1
-rw-r--r--arch/arm/mach-sa1100/badge4.c1
-rw-r--r--arch/arm/mach-sa1100/cerf.c1
-rw-r--r--arch/arm/mach-sa1100/collie.c1
-rw-r--r--arch/arm/mach-sa1100/h3600.c3
-rw-r--r--arch/arm/mach-sa1100/hackkit.c1
-rw-r--r--arch/arm/mach-sa1100/jornada720.c1
-rw-r--r--arch/arm/mach-sa1100/lart.c1
-rw-r--r--arch/arm/mach-sa1100/pleb.c1
-rw-r--r--arch/arm/mach-sa1100/pm.c18
-rw-r--r--arch/arm/mach-sa1100/shannon.c1
-rw-r--r--arch/arm/mach-sa1100/simpad.c1
-rw-r--r--arch/arm/mach-shark/core.c1
-rw-r--r--arch/arm/mach-versatile/Kconfig1
-rw-r--r--arch/arm/mach-versatile/clock.c28
-rw-r--r--arch/arm/mach-versatile/core.c62
-rw-r--r--arch/arm/mach-versatile/core.h2
-rw-r--r--arch/arm/mach-versatile/versatile_ab.c3
-rw-r--r--arch/arm/mach-versatile/versatile_pb.c3
-rw-r--r--arch/arm/mm/Kconfig8
-rw-r--r--arch/arm/mm/consistent.c54
-rw-r--r--arch/arm/mm/discontig.c4
-rw-r--r--arch/arm/mm/flush.c7
-rw-r--r--arch/arm/mm/ioremap.c49
-rw-r--r--arch/arm/mm/mm-armv.c1
-rw-r--r--arch/arm/nwfpe/fpa11.h4
-rw-r--r--arch/arm/plat-omap/Kconfig3
-rw-r--r--arch/arm/plat-omap/clock.c58
-rw-r--r--arch/arm/plat-omap/common.c2
-rw-r--r--arch/arm/plat-omap/cpu-omap.c3
-rw-r--r--arch/arm/plat-omap/dma.c2
-rw-r--r--arch/arm/plat-omap/gpio.c8
-rw-r--r--arch/arm/plat-omap/mcbsp.c15
-rw-r--r--arch/arm/plat-omap/ocpi.c6
-rw-r--r--arch/arm/tools/mach-types30
-rw-r--r--arch/arm26/Kconfig4
-rw-r--r--arch/arm26/kernel/armksyms.c1
-rw-r--r--arch/arm26/kernel/asm-offsets.c7
-rw-r--r--arch/arm26/kernel/irq.c3
-rw-r--r--arch/arm26/kernel/process.c5
-rw-r--r--arch/arm26/kernel/ptrace.c29
-rw-r--r--arch/arm26/kernel/traps.c8
-rw-r--r--arch/arm26/nwfpe/fpmodule.c3
-rw-r--r--arch/cris/Kconfig4
-rw-r--r--arch/cris/arch-v10/drivers/ds1302.c1
-rw-r--r--arch/cris/arch-v10/drivers/pcf8563.c1
-rw-r--r--arch/cris/arch-v10/kernel/kgdb.c6
-rw-r--r--arch/cris/arch-v10/kernel/process.c4
-rw-r--r--arch/cris/arch-v10/kernel/ptrace.c4
-rw-r--r--arch/cris/arch-v32/kernel/process.c6
-rw-r--r--arch/cris/arch-v32/kernel/ptrace.c6
-rw-r--r--arch/cris/arch-v32/kernel/smp.c4
-rw-r--r--arch/cris/arch-v32/mm/tlb.c4
-rw-r--r--arch/cris/kernel/crisksyms.c2
-rw-r--r--arch/cris/kernel/process.c28
-rw-r--r--arch/frv/Kconfig27
-rw-r--r--arch/frv/Kconfig.debug22
-rw-r--r--arch/frv/Makefile6
-rw-r--r--arch/frv/boot/Makefile4
-rw-r--r--arch/frv/kernel/Makefile2
-rw-r--r--arch/frv/kernel/entry.S2
-rw-r--r--arch/frv/kernel/frv_ksyms.c27
-rw-r--r--arch/frv/kernel/futex.c242
-rw-r--r--arch/frv/kernel/irq.c17
-rw-r--r--arch/frv/kernel/module.c80
-rw-r--r--arch/frv/kernel/pm.c2
-rw-r--r--arch/frv/kernel/process.c26
-rw-r--r--arch/frv/kernel/setup.c2
-rw-r--r--arch/frv/kernel/signal.c239
-rw-r--r--arch/frv/kernel/time.c3
-rw-r--r--arch/frv/kernel/traps.c3
-rw-r--r--arch/frv/kernel/uaccess.c7
-rw-r--r--arch/frv/kernel/vmlinux.lds.S1
-rw-r--r--arch/frv/lib/Makefile2
-rw-r--r--arch/frv/lib/__ucmpdi2.S45
-rw-r--r--arch/frv/lib/atomic-ops.S92
-rw-r--r--arch/frv/lib/checksum.c31
-rw-r--r--arch/frv/mb93090-mb00/Makefile2
-rw-r--r--arch/frv/mb93090-mb00/pci-dma-nommu.c8
-rw-r--r--arch/frv/mb93090-mb00/pci-dma.c10
-rw-r--r--arch/frv/mb93090-mb00/pci-frv.c8
-rw-r--r--arch/frv/mb93090-mb00/pci-iomap.c29
-rw-r--r--arch/frv/mb93090-mb00/pci-irq.c4
-rw-r--r--arch/frv/mm/cache-page.c5
-rw-r--r--arch/frv/mm/extable.c34
-rw-r--r--arch/frv/mm/highmem.c8
-rw-r--r--arch/h8300/Kconfig4
-rw-r--r--arch/h8300/kernel/gpio.c4
-rw-r--r--arch/h8300/kernel/h8300_ksyms.c7
-rw-r--r--arch/h8300/kernel/process.c30
-rw-r--r--arch/h8300/mm/memory.c13
-rw-r--r--arch/h8300/platform/h8300h/ptrace_h8300h.c12
-rw-r--r--arch/h8300/platform/h8s/ints.c4
-rw-r--r--arch/h8300/platform/h8s/ints_h8s.c4
-rw-r--r--arch/i386/Kconfig86
-rw-r--r--arch/i386/Kconfig.cpu14
-rw-r--r--arch/i386/Kconfig.debug10
-rw-r--r--arch/i386/Makefile16
-rw-r--r--arch/i386/Makefile.cpu10
-rw-r--r--arch/i386/boot/Makefile4
-rw-r--r--arch/i386/boot/compressed/misc.c2
-rw-r--r--arch/i386/boot/install.sh14
-rw-r--r--arch/i386/boot/video.S5
-rw-r--r--arch/i386/crypto/aes-i586-asm.S40
-rw-r--r--arch/i386/crypto/aes.c56
-rw-r--r--arch/i386/defconfig2
-rw-r--r--arch/i386/kernel/Makefile7
-rw-r--r--arch/i386/kernel/acpi/Makefile2
-rw-r--r--arch/i386/kernel/acpi/boot.c15
-rw-r--r--arch/i386/kernel/acpi/cstate.c58
-rw-r--r--arch/i386/kernel/acpi/processor.c75
-rw-r--r--arch/i386/kernel/apic.c131
-rw-r--r--arch/i386/kernel/apm.c102
-rw-r--r--arch/i386/kernel/cpu/amd.c14
-rw-r--r--arch/i386/kernel/cpu/changelog63
-rw-r--r--arch/i386/kernel/cpu/common.c27
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c76
-rw-r--r--arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c3
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c54
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.h9
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c17
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h25
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-ich.c47
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-lib.c32
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-lib.h1
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-smi.c1
-rw-r--r--arch/i386/kernel/cpu/cyrix.c27
-rw-r--r--arch/i386/kernel/cpu/intel.c5
-rw-r--r--arch/i386/kernel/cpu/mtrr/changelog229
-rw-r--r--arch/i386/kernel/cpu/mtrr/if.c1
-rw-r--r--arch/i386/kernel/cpu/proc.c33
-rw-r--r--arch/i386/kernel/cpuid.c3
-rw-r--r--arch/i386/kernel/crash.c50
-rw-r--r--arch/i386/kernel/crash_dump.c74
-rw-r--r--arch/i386/kernel/dmi_scan.c16
-rw-r--r--arch/i386/kernel/entry.S3
-rw-r--r--arch/i386/kernel/head.S27
-rw-r--r--arch/i386/kernel/i386_ksyms.c3
-rw-r--r--arch/i386/kernel/init_task.c2
-rw-r--r--arch/i386/kernel/io_apic.c6
-rw-r--r--arch/i386/kernel/ioport.c1
-rw-r--r--arch/i386/kernel/irq.c2
-rw-r--r--arch/i386/kernel/kprobes.c25
-rw-r--r--arch/i386/kernel/microcode.c5
-rw-r--r--arch/i386/kernel/mpparse.c34
-rw-r--r--arch/i386/kernel/msr.c3
-rw-r--r--arch/i386/kernel/process.c41
-rw-r--r--arch/i386/kernel/ptrace.c9
-rw-r--r--arch/i386/kernel/quirks.c9
-rw-r--r--arch/i386/kernel/reboot.c13
-rw-r--r--arch/i386/kernel/scx200.c2
-rw-r--r--arch/i386/kernel/setup.c14
-rw-r--r--arch/i386/kernel/signal.c109
-rw-r--r--arch/i386/kernel/smpboot.c13
-rw-r--r--arch/i386/kernel/syscall_table.S17
-rw-r--r--arch/i386/kernel/time.c6
-rw-r--r--arch/i386/kernel/time_hpet.c2
-rw-r--r--arch/i386/kernel/timers/timer_tsc.c2
-rw-r--r--arch/i386/kernel/traps.c150
-rw-r--r--arch/i386/kernel/vm86.c5
-rw-r--r--arch/i386/mm/init.c26
-rw-r--r--arch/i386/mm/ioremap.c37
-rw-r--r--arch/i386/mm/pageattr.c31
-rw-r--r--arch/i386/pci/Makefile2
-rw-r--r--arch/i386/pci/acpi.c2
-rw-r--r--arch/i386/pci/direct.c4
-rw-r--r--arch/i386/pci/fixup.c23
-rw-r--r--arch/i386/pci/irq.c44
-rw-r--r--arch/i386/pci/mmconfig.c65
-rw-r--r--arch/i386/pci/pci.h7
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/ia64/Makefile7
-rw-r--r--arch/ia64/configs/gensparse_defconfig3
-rw-r--r--arch/ia64/configs/sn2_defconfig156
-rw-r--r--arch/ia64/configs/tiger_defconfig75
-rw-r--r--arch/ia64/configs/zx1_defconfig1
-rw-r--r--arch/ia64/defconfig1
-rw-r--r--arch/ia64/hp/sim/simserial.c12
-rw-r--r--arch/ia64/ia32/Makefile4
-rw-r--r--arch/ia64/ia32/binfmt_elf32.c2
-rw-r--r--arch/ia64/ia32/elfcore32.h3
-rw-r--r--arch/ia64/ia32/ia32_entry.S2
-rw-r--r--arch/ia64/ia32/ia32_ioctl.c45
-rw-r--r--arch/ia64/ia32/ia32_signal.c4
-rw-r--r--arch/ia64/ia32/ia32_support.c4
-rw-r--r--arch/ia64/ia32/ia32priv.h1
-rw-r--r--arch/ia64/ia32/sys_ia32.c85
-rw-r--r--arch/ia64/kernel/Makefile5
-rw-r--r--arch/ia64/kernel/acpi-ext.c22
-rw-r--r--arch/ia64/kernel/acpi-processor.c67
-rw-r--r--arch/ia64/kernel/acpi.c6
-rw-r--r--arch/ia64/kernel/cpufreq/Makefile1
-rw-r--r--arch/ia64/kernel/cpufreq/acpi-cpufreq.c51
-rw-r--r--arch/ia64/kernel/efi.c160
-rw-r--r--arch/ia64/kernel/entry.S1
-rw-r--r--arch/ia64/kernel/fsys.S1
-rw-r--r--arch/ia64/kernel/head.S2
-rw-r--r--arch/ia64/kernel/ia64_ksyms.c2
-rw-r--r--arch/ia64/kernel/jprobes.S27
-rw-r--r--arch/ia64/kernel/kprobes.c70
-rw-r--r--arch/ia64/kernel/mca.c4
-rw-r--r--arch/ia64/kernel/mca_asm.S2
-rw-r--r--arch/ia64/kernel/perfmon.c46
-rw-r--r--arch/ia64/kernel/perfmon_montecito.h269
-rw-r--r--arch/ia64/kernel/process.c17
-rw-r--r--arch/ia64/kernel/ptrace.c33
-rw-r--r--arch/ia64/kernel/salinfo.c173
-rw-r--r--arch/ia64/kernel/setup.c26
-rw-r--r--arch/ia64/kernel/signal.c10
-rw-r--r--arch/ia64/kernel/sys_ia64.c2
-rw-r--r--arch/ia64/kernel/time.c29
-rw-r--r--arch/ia64/kernel/traps.c26
-rw-r--r--arch/ia64/kernel/uncached.c7
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S3
-rw-r--r--arch/ia64/mm/discontig.c4
-rw-r--r--arch/ia64/mm/init.c36
-rw-r--r--arch/ia64/mm/tlb.c2
-rw-r--r--arch/ia64/oprofile/backtrace.c2
-rw-r--r--arch/ia64/pci/pci.c31
-rw-r--r--arch/ia64/sn/include/xtalk/hubdev.h35
-rw-r--r--arch/ia64/sn/include/xtalk/xbow.h206
-rw-r--r--arch/ia64/sn/include/xtalk/xwidgetdev.h46
-rw-r--r--arch/ia64/sn/kernel/bte_error.c58
-rw-r--r--arch/ia64/sn/kernel/huberror.c9
-rw-r--r--arch/ia64/sn/kernel/io_init.c299
-rw-r--r--arch/ia64/sn/kernel/irq.c10
-rw-r--r--arch/ia64/sn/kernel/mca.c7
-rw-r--r--arch/ia64/sn/kernel/sn2/ptc_deadlock.S8
-rw-r--r--arch/ia64/sn/kernel/sn2/sn2_smp.c2
-rw-r--r--arch/ia64/sn/kernel/tiocx.c37
-rw-r--r--arch/ia64/sn/kernel/xp_main.c17
-rw-r--r--arch/ia64/sn/kernel/xpc.h1273
-rw-r--r--arch/ia64/sn/kernel/xpc_channel.c58
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c206
-rw-r--r--arch/ia64/sn/kernel/xpc_partition.c10
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_ate.c16
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_dma.c76
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_provider.c44
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_reg.c72
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c48
-rw-r--r--arch/ia64/sn/pci/tioce_provider.c68
-rw-r--r--arch/m32r/Kconfig30
-rw-r--r--arch/m32r/boot/compressed/head.S5
-rw-r--r--arch/m32r/boot/setup.S24
-rw-r--r--arch/m32r/kernel/Makefile1
-rw-r--r--arch/m32r/kernel/entry.S19
-rw-r--r--arch/m32r/kernel/io_m32104ut.c298
-rw-r--r--arch/m32r/kernel/io_m32700ut.c24
-rw-r--r--arch/m32r/kernel/io_mappi.c2
-rw-r--r--arch/m32r/kernel/io_mappi2.c24
-rw-r--r--arch/m32r/kernel/io_mappi3.c51
-rw-r--r--arch/m32r/kernel/io_oaks32r.c2
-rw-r--r--arch/m32r/kernel/io_opsput.c6
-rw-r--r--arch/m32r/kernel/m32r_ksyms.c3
-rw-r--r--arch/m32r/kernel/process.c17
-rw-r--r--arch/m32r/kernel/ptrace.c47
-rw-r--r--arch/m32r/kernel/setup.c7
-rw-r--r--arch/m32r/kernel/setup_m32104ut.c156
-rw-r--r--arch/m32r/kernel/setup_m32700ut.c8
-rw-r--r--arch/m32r/kernel/setup_mappi.c6
-rw-r--r--arch/m32r/kernel/setup_mappi2.c6
-rw-r--r--arch/m32r/kernel/setup_mappi3.c6
-rw-r--r--arch/m32r/kernel/setup_oaks32r.c6
-rw-r--r--arch/m32r/kernel/setup_opsput.c8
-rw-r--r--arch/m32r/kernel/setup_usrv.c6
-rw-r--r--arch/m32r/kernel/smpboot.c2
-rw-r--r--arch/m32r/kernel/time.c4
-rw-r--r--arch/m32r/m32104ut/defconfig.m32104ut (renamed from arch/arm/configs/epxa10db_defconfig)511
-rw-r--r--arch/m32r/mm/cache.c36
-rw-r--r--arch/m68k/Kconfig4
-rw-r--r--arch/m68k/amiga/amiints.c46
-rw-r--r--arch/m68k/amiga/amisound.c2
-rw-r--r--arch/m68k/amiga/cia.c8
-rw-r--r--arch/m68k/amiga/config.c27
-rw-r--r--arch/m68k/apollo/config.c3
-rw-r--r--arch/m68k/atari/config.c9
-rw-r--r--arch/m68k/bvme6000/rtc.c7
-rw-r--r--arch/m68k/hp300/config.c3
-rw-r--r--arch/m68k/kernel/asm-offsets.c2
-rw-r--r--arch/m68k/kernel/head.S2
-rw-r--r--arch/m68k/kernel/m68k_ksyms.c2
-rw-r--r--arch/m68k/kernel/process.c7
-rw-r--r--arch/m68k/kernel/setup.c19
-rw-r--r--arch/m68k/kernel/signal.c62
-rw-r--r--arch/m68k/kernel/sys_m68k.c40
-rw-r--r--arch/m68k/kernel/traps.c38
-rw-r--r--arch/m68k/kernel/vmlinux-std.lds1
-rw-r--r--arch/m68k/kernel/vmlinux-sun3.lds3
-rw-r--r--arch/m68k/lib/checksum.c2
-rw-r--r--arch/m68k/mac/config.c3
-rw-r--r--arch/m68k/mac/iop.c4
-rw-r--r--arch/m68k/mac/misc.c326
-rw-r--r--arch/m68k/math-emu/multi_arith.h2
-rw-r--r--arch/m68k/mm/kmap.c12
-rw-r--r--arch/m68k/mvme16x/rtc.c7
-rw-r--r--arch/m68k/q40/config.c5
-rw-r--r--arch/m68k/sun3/config.c3
-rw-r--r--arch/m68k/sun3x/config.c4
-rw-r--r--arch/m68knommu/Kconfig4
-rw-r--r--arch/m68knommu/Makefile1
-rw-r--r--arch/m68knommu/kernel/m68k_ksyms.c4
-rw-r--r--arch/m68knommu/kernel/process.c51
-rw-r--r--arch/m68knommu/kernel/ptrace.c2
-rw-r--r--arch/m68knommu/kernel/setup.c2
-rw-r--r--arch/m68knommu/kernel/signal.c8
-rw-r--r--arch/m68knommu/kernel/vmlinux.lds.S2
-rw-r--r--arch/mips/Kconfig14
-rw-r--r--arch/mips/Makefile1
-rw-r--r--arch/mips/au1000/db1x00/board_setup.c7
-rw-r--r--arch/mips/au1000/db1x00/init.c12
-rw-r--r--arch/mips/configs/atlas_defconfig142
-rw-r--r--arch/mips/configs/bigsur_defconfig150
-rw-r--r--arch/mips/configs/capcella_defconfig143
-rw-r--r--arch/mips/configs/cobalt_defconfig132
-rw-r--r--arch/mips/configs/db1000_defconfig144
-rw-r--r--arch/mips/configs/db1100_defconfig144
-rw-r--r--arch/mips/configs/db1200_defconfig147
-rw-r--r--arch/mips/configs/db1500_defconfig143
-rw-r--r--arch/mips/configs/db1550_defconfig143
-rw-r--r--arch/mips/configs/ddb5476_defconfig132
-rw-r--r--arch/mips/configs/ddb5477_defconfig132
-rw-r--r--arch/mips/configs/decstation_defconfig146
-rw-r--r--arch/mips/configs/e55_defconfig144
-rw-r--r--arch/mips/configs/ev64120_defconfig144
-rw-r--r--arch/mips/configs/ev96100_defconfig145
-rw-r--r--arch/mips/configs/ip22_defconfig146
-rw-r--r--arch/mips/configs/ip27_defconfig147
-rw-r--r--arch/mips/configs/ip32_defconfig132
-rw-r--r--arch/mips/configs/it8172_defconfig147
-rw-r--r--arch/mips/configs/ivr_defconfig146
-rw-r--r--arch/mips/configs/jaguar-atx_defconfig140
-rw-r--r--arch/mips/configs/jmr3927_defconfig131
-rw-r--r--arch/mips/configs/lasat200_defconfig144
-rw-r--r--arch/mips/configs/malta_defconfig148
-rw-r--r--arch/mips/configs/mipssim_defconfig145
-rw-r--r--arch/mips/configs/mpc30x_defconfig143
-rw-r--r--arch/mips/configs/ocelot_3_defconfig146
-rw-r--r--arch/mips/configs/ocelot_c_defconfig130
-rw-r--r--arch/mips/configs/ocelot_defconfig133
-rw-r--r--arch/mips/configs/ocelot_g_defconfig130
-rw-r--r--arch/mips/configs/pb1100_defconfig144
-rw-r--r--arch/mips/configs/pb1500_defconfig143
-rw-r--r--arch/mips/configs/pb1550_defconfig143
-rw-r--r--arch/mips/configs/pnx8550-jbs_defconfig145
-rw-r--r--arch/mips/configs/pnx8550-v2pci_defconfig144
-rw-r--r--arch/mips/configs/qemu_defconfig129
-rw-r--r--arch/mips/configs/rbhma4500_defconfig144
-rw-r--r--arch/mips/configs/rm200_defconfig149
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig146
-rw-r--r--arch/mips/configs/sead_defconfig125
-rw-r--r--arch/mips/configs/tb0226_defconfig143
-rw-r--r--arch/mips/configs/tb0229_defconfig143
-rw-r--r--arch/mips/configs/workpad_defconfig144
-rw-r--r--arch/mips/configs/yosemite_defconfig146
-rw-r--r--arch/mips/defconfig146
-rw-r--r--arch/mips/jmr3927/rbhma3100/irq.c28
-rw-r--r--arch/mips/jmr3927/rbhma3100/setup.c2
-rw-r--r--arch/mips/kernel/Makefile3
-rw-r--r--arch/mips/kernel/cpu-probe.c43
-rw-r--r--arch/mips/kernel/ioctl32.c50
-rw-r--r--arch/mips/kernel/irixsig.c4
-rw-r--r--arch/mips/kernel/linux32.c4
-rw-r--r--arch/mips/kernel/process.c12
-rw-r--r--arch/mips/kernel/ptrace.c22
-rw-r--r--arch/mips/kernel/ptrace32.c44
-rw-r--r--arch/mips/kernel/reset.c6
-rw-r--r--arch/mips/kernel/scall32-o32.S18
-rw-r--r--arch/mips/kernel/scall64-64.S18
-rw-r--r--arch/mips/kernel/scall64-n32.S4
-rw-r--r--arch/mips/kernel/scall64-o32.S4
-rw-r--r--arch/mips/kernel/signal.c2
-rw-r--r--arch/mips/kernel/signal32.c4
-rw-r--r--arch/mips/kernel/smp_mt.c7
-rw-r--r--arch/mips/kernel/syscall.c3
-rw-r--r--arch/mips/kernel/sysirix.c1
-rw-r--r--arch/mips/kernel/time.c32
-rw-r--r--arch/mips/kernel/traps.c7
-rw-r--r--arch/mips/kernel/vpe.c11
-rw-r--r--arch/mips/lib/iomap.c2
-rw-r--r--arch/mips/math-emu/dp_fint.c2
-rw-r--r--arch/mips/math-emu/dp_flong.c2
-rw-r--r--arch/mips/math-emu/sp_fint.c2
-rw-r--r--arch/mips/math-emu/sp_flong.c2
-rw-r--r--arch/mips/mips-boards/generic/time.c33
-rw-r--r--arch/mips/mm/c-r4k.c4
-rw-r--r--arch/mips/mm/init.c4
-rw-r--r--arch/mips/oprofile/common.c3
-rw-r--r--arch/mips/oprofile/op_impl.h4
-rw-r--r--arch/mips/oprofile/op_model_mipsxx.c22
-rw-r--r--arch/mips/pci/fixup-capcella.c2
-rw-r--r--arch/mips/pci/fixup-mpc30x.c2
-rw-r--r--arch/mips/pci/fixup-tb0219.c2
-rw-r--r--arch/mips/pci/fixup-tb0226.c2
-rw-r--r--arch/mips/pci/fixup-tb0287.c2
-rw-r--r--arch/mips/pci/ops-vr41xx.c2
-rw-r--r--arch/mips/pci/pci-vr41xx.c2
-rw-r--r--arch/mips/pci/pci-vr41xx.h2
-rw-r--r--arch/mips/pmc-sierra/yosemite/smp.c4
-rw-r--r--arch/mips/qemu/q-firmware.c13
-rw-r--r--arch/mips/sgi-ip27/ip27-berr.c1
-rw-r--r--arch/mips/sgi-ip27/ip27-smp.c4
-rw-r--r--arch/mips/sibyte/cfe/smp.c2
-rw-r--r--arch/mips/vr41xx/casio-e55/setup.c2
-rw-r--r--arch/mips/vr41xx/common/bcu.c4
-rw-r--r--arch/mips/vr41xx/common/cmu.c4
-rw-r--r--arch/mips/vr41xx/common/icu.c4
-rw-r--r--arch/mips/vr41xx/common/init.c2
-rw-r--r--arch/mips/vr41xx/common/int-handler.S2
-rw-r--r--arch/mips/vr41xx/common/irq.c2
-rw-r--r--arch/mips/vr41xx/common/pmu.c2
-rw-r--r--arch/mips/vr41xx/common/type.c2
-rw-r--r--arch/mips/vr41xx/common/vrc4173.c4
-rw-r--r--arch/mips/vr41xx/ibm-workpad/setup.c2
-rw-r--r--arch/parisc/Kconfig3
-rw-r--r--arch/parisc/configs/a500_defconfig1
-rw-r--r--arch/parisc/configs/c3000_defconfig1
-rw-r--r--arch/parisc/hpux/sys_hpux.c1
-rw-r--r--arch/parisc/kernel/Makefile3
-rw-r--r--arch/parisc/kernel/cache.c20
-rw-r--r--arch/parisc/kernel/drivers.c17
-rw-r--r--arch/parisc/kernel/firmware.c2
-rw-r--r--arch/parisc/kernel/hardware.c1
-rw-r--r--arch/parisc/kernel/inventory.c6
-rw-r--r--arch/parisc/kernel/ioctl32.c60
-rw-r--r--arch/parisc/kernel/pci-dma.c6
-rw-r--r--arch/parisc/kernel/pdc_chassis.c13
-rw-r--r--arch/parisc/kernel/perf.c7
-rw-r--r--arch/parisc/kernel/process.c8
-rw-r--r--arch/parisc/kernel/processor.c8
-rw-r--r--arch/parisc/kernel/setup.c10
-rw-r--r--arch/parisc/kernel/smp.c18
-rw-r--r--arch/parisc/kernel/time.c4
-rw-r--r--arch/parisc/kernel/topology.c3
-rw-r--r--arch/parisc/kernel/unaligned.c2
-rw-r--r--arch/parisc/kernel/unwind.c2
-rw-r--r--arch/parisc/kernel/vmlinux.lds.S15
-rw-r--r--arch/parisc/mm/init.c29
-rw-r--r--arch/parisc/mm/ioremap.c100
-rw-r--r--arch/powerpc/Kconfig94
-rw-r--r--arch/powerpc/Kconfig.debug42
-rw-r--r--arch/powerpc/Makefile15
-rw-r--r--arch/powerpc/boot/.gitignore20
-rw-r--r--arch/powerpc/boot/Makefile98
-rw-r--r--arch/powerpc/boot/crt0.S21
-rw-r--r--arch/powerpc/boot/dummy.c4
-rw-r--r--arch/powerpc/boot/hack-coff.c84
-rw-r--r--arch/powerpc/boot/main.c46
-rw-r--r--arch/powerpc/boot/prom.c538
-rw-r--r--arch/powerpc/boot/prom.h36
-rw-r--r--arch/powerpc/boot/rs6000.h243
-rw-r--r--arch/powerpc/boot/stdio.c325
-rw-r--r--arch/powerpc/boot/stdio.h6
-rw-r--r--arch/powerpc/boot/string.S20
-rw-r--r--arch/powerpc/boot/zImage.coff.lds46
-rw-r--r--arch/powerpc/configs/cell_defconfig8
-rw-r--r--arch/powerpc/configs/g5_defconfig10
-rw-r--r--arch/powerpc/configs/iseries_defconfig8
-rw-r--r--arch/powerpc/configs/maple_defconfig11
-rw-r--r--arch/powerpc/configs/mpc834x_sys_defconfig911
-rw-r--r--arch/powerpc/configs/pmac32_defconfig1744
-rw-r--r--arch/powerpc/configs/ppc64_defconfig12
-rw-r--r--arch/powerpc/configs/pseries_defconfig8
-rw-r--r--arch/powerpc/kernel/Makefile32
-rw-r--r--arch/powerpc/kernel/asm-offsets.c8
-rw-r--r--arch/powerpc/kernel/btext.c136
-rw-r--r--arch/powerpc/kernel/cpu_setup_power4.S4
-rw-r--r--arch/powerpc/kernel/cputable.c278
-rw-r--r--arch/powerpc/kernel/crash.c197
-rw-r--r--arch/powerpc/kernel/crash_dump.c111
-rw-r--r--arch/powerpc/kernel/dma_64.c9
-rw-r--r--arch/powerpc/kernel/entry_32.S173
-rw-r--r--arch/powerpc/kernel/entry_64.S233
-rw-r--r--arch/powerpc/kernel/fpu.S10
-rw-r--r--arch/powerpc/kernel/head_32.S56
-rw-r--r--arch/powerpc/kernel/head_64.S137
-rw-r--r--arch/powerpc/kernel/ibmebus.c396
-rw-r--r--arch/powerpc/kernel/idle_power4.S8
-rw-r--r--arch/powerpc/kernel/ioctl32.c45
-rw-r--r--arch/powerpc/kernel/irq.c77
-rw-r--r--arch/powerpc/kernel/kprobes.c29
-rw-r--r--arch/powerpc/kernel/legacy_serial.c557
-rw-r--r--arch/powerpc/kernel/lparcfg.c13
-rw-r--r--arch/powerpc/kernel/lparmap.c12
-rw-r--r--arch/powerpc/kernel/machine_kexec.c61
-rw-r--r--arch/powerpc/kernel/machine_kexec_32.c65
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c43
-rw-r--r--arch/powerpc/kernel/misc_32.S117
-rw-r--r--arch/powerpc/kernel/misc_64.S10
-rw-r--r--arch/powerpc/kernel/nvram_64.c106
-rw-r--r--arch/powerpc/kernel/of_device.c4
-rw-r--r--arch/powerpc/kernel/paca.c47
-rw-r--r--arch/powerpc/kernel/pci_32.c1897
-rw-r--r--arch/powerpc/kernel/pci_64.c97
-rw-r--r--arch/powerpc/kernel/pmc.c5
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c9
-rw-r--r--arch/powerpc/kernel/process.c22
-rw-r--r--arch/powerpc/kernel/prom.c577
-rw-r--r--arch/powerpc/kernel/prom_init.c69
-rw-r--r--arch/powerpc/kernel/prom_parse.c548
-rw-r--r--arch/powerpc/kernel/ptrace-common.h4
-rw-r--r--arch/powerpc/kernel/ptrace32.c28
-rw-r--r--arch/powerpc/kernel/rtas.c111
-rw-r--r--arch/powerpc/kernel/rtas_pci.c51
-rw-r--r--arch/powerpc/kernel/setup-common.c138
-rw-r--r--arch/powerpc/kernel/setup_32.c34
-rw-r--r--arch/powerpc/kernel/setup_64.c277
-rw-r--r--arch/powerpc/kernel/signal_32.c149
-rw-r--r--arch/powerpc/kernel/signal_64.c93
-rw-r--r--arch/powerpc/kernel/smp.c35
-rw-r--r--arch/powerpc/kernel/sys_ppc32.c56
-rw-r--r--arch/powerpc/kernel/syscalls.c30
-rw-r--r--arch/powerpc/kernel/systbl.S24
-rw-r--r--arch/powerpc/kernel/time.c6
-rw-r--r--arch/powerpc/kernel/traps.c25
-rw-r--r--arch/powerpc/kernel/udbg.c52
-rw-r--r--arch/powerpc/kernel/udbg_16550.c71
-rw-r--r--arch/powerpc/kernel/vdso32/.gitignore1
-rw-r--r--arch/powerpc/kernel/vdso64/.gitignore1
-rw-r--r--arch/powerpc/kernel/vio.c10
-rw-r--r--arch/powerpc/lib/locks.c8
-rw-r--r--arch/powerpc/mm/fault.c7
-rw-r--r--arch/powerpc/mm/hash_utils_64.c13
-rw-r--r--arch/powerpc/mm/hugetlbpage.c137
-rw-r--r--arch/powerpc/mm/imalloc.c2
-rw-r--r--arch/powerpc/mm/init_32.c5
-rw-r--r--arch/powerpc/mm/mem.c13
-rw-r--r--arch/powerpc/mm/numa.c141
-rw-r--r--arch/powerpc/mm/pgtable_64.c2
-rw-r--r--arch/powerpc/mm/slb.c16
-rw-r--r--arch/powerpc/mm/slb_low.S6
-rw-r--r--arch/powerpc/mm/stab.c23
-rw-r--r--arch/powerpc/mm/tlb_64.c2
-rw-r--r--arch/powerpc/oprofile/Makefile1
-rw-r--r--arch/powerpc/oprofile/common.c83
-rw-r--r--arch/powerpc/oprofile/op_model_7450.c206
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c4
-rw-r--r--arch/powerpc/oprofile/op_model_rs64.c3
-rw-r--r--arch/powerpc/platforms/83xx/Kconfig27
-rw-r--r--arch/powerpc/platforms/83xx/Makefile4
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_sys.c243
-rw-r--r--arch/powerpc/platforms/83xx/mpc834x_sys.h23
-rw-r--r--arch/powerpc/platforms/83xx/mpc83xx.h14
-rw-r--r--arch/powerpc/platforms/83xx/pci.c99
-rw-r--r--arch/powerpc/platforms/Makefile1
-rw-r--r--arch/powerpc/platforms/cell/Kconfig13
-rw-r--r--arch/powerpc/platforms/cell/Makefile8
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c42
-rw-r--r--arch/powerpc/platforms/cell/interrupt.h1
-rw-r--r--arch/powerpc/platforms/cell/iommu.c225
-rw-r--r--arch/powerpc/platforms/cell/pervasive.c229
-rw-r--r--arch/powerpc/platforms/cell/pervasive.h62
-rw-r--r--arch/powerpc/platforms/cell/setup.c95
-rw-r--r--arch/powerpc/platforms/cell/smp.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c711
-rw-r--r--arch/powerpc/platforms/cell/spu_priv1.c133
-rw-r--r--arch/powerpc/platforms/cell/spu_syscalls.c88
-rw-r--r--arch/powerpc/platforms/cell/spufs/Makefile54
-rw-r--r--arch/powerpc/platforms/cell/spufs/backing_ops.c308
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c167
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c794
-rw-r--r--arch/powerpc/platforms/cell/spufs/hw_ops.c255
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c486
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c131
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c461
-rw-r--r--arch/powerpc/platforms/cell/spufs/spu_restore.c336
-rw-r--r--arch/powerpc/platforms/cell/spufs/spu_restore_crt0.S116
-rw-r--r--arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped231
-rw-r--r--arch/powerpc/platforms/cell/spufs/spu_save.c195
-rw-r--r--arch/powerpc/platforms/cell/spufs/spu_save_crt0.S102
-rw-r--r--arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped191
-rw-r--r--arch/powerpc/platforms/cell/spufs/spu_utils.h160
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h163
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c2204
-rw-r--r--arch/powerpc/platforms/cell/spufs/syscalls.c103
-rw-r--r--arch/powerpc/platforms/chrp/pci.c27
-rw-r--r--arch/powerpc/platforms/chrp/setup.c23
-rw-r--r--arch/powerpc/platforms/chrp/time.c7
-rw-r--r--arch/powerpc/platforms/embedded6xx/Kconfig18
-rw-r--r--arch/powerpc/platforms/iseries/Makefile4
-rw-r--r--arch/powerpc/platforms/iseries/iommu.c2
-rw-r--r--arch/powerpc/platforms/iseries/iommu.h35
-rw-r--r--arch/powerpc/platforms/iseries/irq.c346
-rw-r--r--arch/powerpc/platforms/iseries/irq.h1
-rw-r--r--arch/powerpc/platforms/iseries/lpardata.c12
-rw-r--r--arch/powerpc/platforms/iseries/lpevents.c12
-rw-r--r--arch/powerpc/platforms/iseries/mf.c16
-rw-r--r--arch/powerpc/platforms/iseries/misc.S3
-rw-r--r--arch/powerpc/platforms/iseries/pci.c1
-rw-r--r--arch/powerpc/platforms/iseries/setup.c55
-rw-r--r--arch/powerpc/platforms/iseries/smp.c2
-rw-r--r--arch/powerpc/platforms/iseries/vio.c2
-rw-r--r--arch/powerpc/platforms/iseries/viopath.c12
-rw-r--r--arch/powerpc/platforms/maple/pci.c1
-rw-r--r--arch/powerpc/platforms/maple/setup.c110
-rw-r--r--arch/powerpc/platforms/maple/time.c23
-rw-r--r--arch/powerpc/platforms/powermac/Makefile7
-rw-r--r--arch/powerpc/platforms/powermac/bootx_init.c547
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_64.c498
-rw-r--r--arch/powerpc/platforms/powermac/feature.c356
-rw-r--r--arch/powerpc/platforms/powermac/low_i2c.c1414
-rw-r--r--arch/powerpc/platforms/powermac/nvram.c53
-rw-r--r--arch/powerpc/platforms/powermac/pci.c299
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_base.c405
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_core.c989
-rw-r--r--arch/powerpc/platforms/powermac/pic.c474
-rw-r--r--arch/powerpc/platforms/powermac/pmac.h6
-rw-r--r--arch/powerpc/platforms/powermac/setup.c109
-rw-r--r--arch/powerpc/platforms/powermac/smp.c382
-rw-r--r--arch/powerpc/platforms/powermac/time.c15
-rw-r--r--arch/powerpc/platforms/powermac/udbg_adb.c221
-rw-r--r--arch/powerpc/platforms/powermac/udbg_scc.c (renamed from arch/powerpc/kernel/udbg_scc.c)68
-rw-r--r--arch/powerpc/platforms/pseries/Makefile4
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c516
-rw-r--r--arch/powerpc/platforms/pseries/eeh_cache.c316
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c376
-rw-r--r--arch/powerpc/platforms/pseries/eeh_event.c39
-rw-r--r--arch/powerpc/platforms/pseries/hvcserver.c4
-rw-r--r--arch/powerpc/platforms/pseries/iommu.c25
-rw-r--r--arch/powerpc/platforms/pseries/lpar.c92
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c174
-rw-r--r--arch/powerpc/platforms/pseries/ras.c11
-rw-r--r--arch/powerpc/platforms/pseries/ras.h9
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c100
-rw-r--r--arch/powerpc/platforms/pseries/scanlog.c4
-rw-r--r--arch/powerpc/platforms/pseries/setup.c77
-rw-r--r--arch/powerpc/platforms/pseries/smp.c6
-rw-r--r--arch/powerpc/platforms/pseries/xics.c25
-rw-r--r--arch/powerpc/sysdev/Makefile4
-rw-r--r--arch/powerpc/sysdev/dart.h41
-rw-r--r--arch/powerpc/sysdev/dart_iommu.c (renamed from arch/powerpc/sysdev/u3_iommu.c)174
-rw-r--r--arch/powerpc/sysdev/fsl_soc.c317
-rw-r--r--arch/powerpc/sysdev/fsl_soc.h8
-rw-r--r--arch/powerpc/sysdev/ipic.c (renamed from arch/ppc/syslib/ipic.c)0
-rw-r--r--arch/powerpc/sysdev/ipic.h (renamed from arch/ppc/syslib/ipic.h)0
-rw-r--r--arch/powerpc/sysdev/mpic.c247
-rw-r--r--arch/powerpc/xmon/Makefile8
-rw-r--r--arch/powerpc/xmon/start.c (renamed from arch/powerpc/xmon/start_64.c)0
-rw-r--r--arch/powerpc/xmon/start_32.c441
-rw-r--r--arch/powerpc/xmon/start_8xx.c44
-rw-r--r--arch/powerpc/xmon/xmon.c22
-rw-r--r--arch/ppc/4xx_io/serial_sicc.c2
-rw-r--r--arch/ppc/Kconfig80
-rw-r--r--arch/ppc/Makefile3
-rw-r--r--arch/ppc/amiga/amiints.c40
-rw-r--r--arch/ppc/amiga/cia.c8
-rw-r--r--arch/ppc/amiga/config.c24
-rw-r--r--arch/ppc/boot/Makefile2
-rw-r--r--arch/ppc/boot/common/util.S6
-rw-r--r--arch/ppc/boot/images/Makefile2
-rw-r--r--arch/ppc/boot/openfirmware/Makefile96
-rw-r--r--arch/ppc/boot/openfirmware/coffmain.c101
-rw-r--r--arch/ppc/boot/openfirmware/newworldmain.c94
-rw-r--r--arch/ppc/boot/simple/Makefile6
-rw-r--r--arch/ppc/configs/TQM8540_defconfig973
-rw-r--r--arch/ppc/configs/TQM8541_defconfig986
-rw-r--r--arch/ppc/configs/TQM8555_defconfig983
-rw-r--r--arch/ppc/configs/TQM8560_defconfig992
-rw-r--r--arch/ppc/configs/bamboo_defconfig1
-rw-r--r--arch/ppc/configs/katana_defconfig1
-rw-r--r--arch/ppc/configs/mpc834x_sys_defconfig1
-rw-r--r--arch/ppc/configs/power3_defconfig1
-rw-r--r--arch/ppc/kernel/Makefile5
-rw-r--r--arch/ppc/kernel/asm-offsets.c2
-rw-r--r--arch/ppc/kernel/entry.S167
-rw-r--r--arch/ppc/kernel/head_8xx.S77
-rw-r--r--arch/ppc/kernel/idle.c4
-rw-r--r--arch/ppc/kernel/machine_kexec.c6
-rw-r--r--arch/ppc/kernel/misc.S78
-rw-r--r--arch/ppc/kernel/pci.c289
-rw-r--r--arch/ppc/kernel/ppc_htab.c1
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c15
-rw-r--r--arch/ppc/kernel/process.c851
-rw-r--r--arch/ppc/kernel/setup.c35
-rw-r--r--arch/ppc/kernel/smp.c8
-rw-r--r--arch/ppc/kernel/traps.c13
-rw-r--r--arch/ppc/mm/init.c29
-rw-r--r--arch/ppc/platforms/4xx/ibm440gx.c2
-rw-r--r--arch/ppc/platforms/4xx/ibm440sp.c1
-rw-r--r--arch/ppc/platforms/83xx/mpc834x_sys.c10
-rw-r--r--arch/ppc/platforms/85xx/Kconfig28
-rw-r--r--arch/ppc/platforms/85xx/Makefile4
-rw-r--r--arch/ppc/platforms/85xx/mpc8540_ads.c14
-rw-r--r--arch/ppc/platforms/85xx/mpc8560_ads.c11
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.c30
-rw-r--r--arch/ppc/platforms/85xx/sbc8560.c10
-rw-r--r--arch/ppc/platforms/85xx/stx_gp3.c10
-rw-r--r--arch/ppc/platforms/85xx/tqm85xx.c415
-rw-r--r--arch/ppc/platforms/85xx/tqm85xx.h56
-rw-r--r--arch/ppc/platforms/Makefile11
-rw-r--r--arch/ppc/platforms/apus_setup.c30
-rw-r--r--arch/ppc/platforms/chrp_pci.c2
-rw-r--r--arch/ppc/platforms/chrp_setup.c74
-rw-r--r--arch/ppc/platforms/chrp_time.c64
-rw-r--r--arch/ppc/platforms/lite5200.c2
-rw-r--r--arch/ppc/platforms/mpc5200.c53
-rw-r--r--arch/ppc/platforms/pmac_backlight.c202
-rw-r--r--arch/ppc/platforms/pmac_cache.S359
-rw-r--r--arch/ppc/platforms/pmac_cpufreq.c735
-rw-r--r--arch/ppc/platforms/pmac_feature.c3013
-rw-r--r--arch/ppc/platforms/pmac_low_i2c.c511
-rw-r--r--arch/ppc/platforms/pmac_nvram.c584
-rw-r--r--arch/ppc/platforms/pmac_pci.c1124
-rw-r--r--arch/ppc/platforms/pmac_pic.c693
-rw-r--r--arch/ppc/platforms/pmac_pic.h11
-rw-r--r--arch/ppc/platforms/pmac_setup.c745
-rw-r--r--arch/ppc/platforms/pmac_sleep.S396
-rw-r--r--arch/ppc/platforms/pmac_smp.c692
-rw-r--r--arch/ppc/platforms/pmac_time.c291
-rw-r--r--arch/ppc/platforms/prep_setup.c2
-rw-r--r--arch/ppc/syslib/Makefile4
-rw-r--r--arch/ppc/syslib/m82xx_pci.c3
-rw-r--r--arch/ppc/syslib/m8xx_setup.c15
-rw-r--r--arch/ppc/syslib/m8xx_wdt.c92
-rw-r--r--arch/ppc/syslib/m8xx_wdt.h4
-rw-r--r--arch/ppc/syslib/mpc52xx_pci.c95
-rw-r--r--arch/ppc/syslib/mpc52xx_setup.c6
-rw-r--r--arch/ppc/syslib/mpc83xx_devices.c10
-rw-r--r--arch/ppc/syslib/mpc85xx_devices.c10
-rw-r--r--arch/ppc/syslib/ocp.c4
-rw-r--r--arch/ppc/syslib/ppc4xx_dma.c1
-rw-r--r--arch/ppc/syslib/prom.c21
-rw-r--r--arch/ppc/xmon/start.c161
-rw-r--r--arch/ppc/xmon/xmon.c15
-rw-r--r--arch/s390/Kconfig37
-rw-r--r--arch/s390/Makefile6
-rw-r--r--arch/s390/appldata/appldata_base.c8
-rw-r--r--arch/s390/appldata/appldata_os.c14
-rw-r--r--arch/s390/crypto/Makefile8
-rw-r--r--arch/s390/crypto/aes_s390.c276
-rw-r--r--arch/s390/crypto/crypt_s390.h (renamed from arch/s390/crypto/crypt_z990.h)267
-rw-r--r--arch/s390/crypto/crypt_s390_query.c129
-rw-r--r--arch/s390/crypto/crypt_z990_query.c111
-rw-r--r--arch/s390/crypto/des_s390.c466
-rw-r--r--arch/s390/crypto/des_z990.c284
-rw-r--r--arch/s390/crypto/sha1_s390.c (renamed from arch/s390/crypto/sha1_z990.c)32
-rw-r--r--arch/s390/crypto/sha256_s390.c166
-rw-r--r--arch/s390/defconfig65
-rw-r--r--arch/s390/kernel/Makefile18
-rw-r--r--arch/s390/kernel/binfmt_elf32.c2
-rw-r--r--arch/s390/kernel/compat_ioctl.c81
-rw-r--r--arch/s390/kernel/compat_linux.c35
-rw-r--r--arch/s390/kernel/compat_signal.c2
-rw-r--r--arch/s390/kernel/compat_wrapper.S2
-rw-r--r--arch/s390/kernel/cpcmd.c16
-rw-r--r--arch/s390/kernel/crash.c2
-rw-r--r--arch/s390/kernel/entry64.S18
-rw-r--r--arch/s390/kernel/head.S4
-rw-r--r--arch/s390/kernel/machine_kexec.c2
-rw-r--r--arch/s390/kernel/module.c12
-rw-r--r--arch/s390/kernel/process.c59
-rw-r--r--arch/s390/kernel/ptrace.c79
-rw-r--r--arch/s390/kernel/reipl_diag.c2
-rw-r--r--arch/s390/kernel/s390_ksyms.c1
-rw-r--r--arch/s390/kernel/setup.c25
-rw-r--r--arch/s390/kernel/signal.c8
-rw-r--r--arch/s390/kernel/smp.c16
-rw-r--r--arch/s390/kernel/sys_s390.c12
-rw-r--r--arch/s390/kernel/time.c4
-rw-r--r--arch/s390/kernel/traps.c16
-rw-r--r--arch/s390/kernel/vmlinux.lds.S2
-rw-r--r--arch/s390/kernel/vtime.c27
-rw-r--r--arch/s390/lib/Makefile4
-rw-r--r--arch/s390/lib/spinlock.c9
-rw-r--r--arch/s390/mm/extmem.c2
-rw-r--r--arch/s390/mm/fault.c18
-rw-r--r--arch/s390/mm/init.c8
-rw-r--r--arch/s390/mm/mmap.c2
-rw-r--r--arch/s390/oprofile/Makefile2
-rw-r--r--arch/s390/oprofile/backtrace.c79
-rw-r--r--arch/s390/oprofile/init.c4
-rw-r--r--arch/sh/Kconfig541
-rw-r--r--arch/sh/Kconfig.debug2
-rw-r--r--arch/sh/Makefile60
-rw-r--r--arch/sh/boards/hp6xx/Makefile6
-rw-r--r--arch/sh/boards/hp6xx/hp620/Makefile6
-rw-r--r--arch/sh/boards/hp6xx/hp620/mach.c52
-rw-r--r--arch/sh/boards/hp6xx/hp620/setup.c45
-rw-r--r--arch/sh/boards/hp6xx/hp680/Makefile6
-rw-r--r--arch/sh/boards/hp6xx/hp690/Makefile6
-rw-r--r--arch/sh/boards/hp6xx/hp690/mach.c48
-rw-r--r--arch/sh/boards/hp6xx/mach.c (renamed from arch/sh/boards/hp6xx/hp680/mach.c)15
-rw-r--r--arch/sh/boards/hp6xx/setup.c (renamed from arch/sh/boards/hp6xx/hp680/setup.c)18
-rw-r--r--arch/sh/boards/overdrive/Makefile2
-rw-r--r--arch/sh/boards/overdrive/setup.c6
-rw-r--r--arch/sh/boards/overdrive/time.c119
-rw-r--r--arch/sh/configs/hp6xx_defconfig (renamed from arch/sh/configs/hp680_defconfig)333
-rw-r--r--arch/sh/drivers/dma/dma-api.c51
-rw-r--r--arch/sh/drivers/dma/dma-g2.c3
-rw-r--r--arch/sh/drivers/dma/dma-isa.c20
-rw-r--r--arch/sh/drivers/dma/dma-pvr2.c3
-rw-r--r--arch/sh/drivers/dma/dma-sh.c134
-rw-r--r--arch/sh/drivers/dma/dma-sh.h44
-rw-r--r--arch/sh/drivers/dma/dma-sysfs.c31
-rw-r--r--arch/sh/kernel/Makefile4
-rw-r--r--arch/sh/kernel/cpu/Makefile9
-rw-r--r--arch/sh/kernel/cpu/bus.c36
-rw-r--r--arch/sh/kernel/cpu/clock.c287
-rw-r--r--arch/sh/kernel/cpu/irq/Makefile7
-rw-r--r--arch/sh/kernel/cpu/irq/imask.c (renamed from arch/sh/kernel/cpu/irq_imask.c)16
-rw-r--r--arch/sh/kernel/cpu/irq/intc2.c284
-rw-r--r--arch/sh/kernel/cpu/irq/ipr.c (renamed from arch/sh/kernel/cpu/irq_ipr.c)217
-rw-r--r--arch/sh/kernel/cpu/irq/pint.c169
-rw-r--r--arch/sh/kernel/cpu/sh3/Makefile7
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh3.c89
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7300.c78
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7705.c84
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7709.c96
-rw-r--r--arch/sh/kernel/cpu/sh4/Makefile11
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh4-202.c179
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh4.c80
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh73180.c81
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh7770.c73
-rw-r--r--arch/sh/kernel/cpu/sh4/clock-sh7780.c126
-rw-r--r--arch/sh/kernel/cpu/sh4/irq_intc2.c222
-rw-r--r--arch/sh/kernel/io.c41
-rw-r--r--arch/sh/kernel/io_generic.c192
-rw-r--r--arch/sh/kernel/irq.c64
-rw-r--r--arch/sh/kernel/machine_kexec.c112
-rw-r--r--arch/sh/kernel/process.c76
-rw-r--r--arch/sh/kernel/ptrace.c14
-rw-r--r--arch/sh/kernel/relocate_kernel.S102
-rw-r--r--arch/sh/kernel/sh_ksyms.c2
-rw-r--r--arch/sh/kernel/smp.c2
-rw-r--r--arch/sh/kernel/time.c518
-rw-r--r--arch/sh/kernel/timers/Makefile8
-rw-r--r--arch/sh/kernel/timers/timer-tmu.c229
-rw-r--r--arch/sh/kernel/timers/timer.c50
-rw-r--r--arch/sh/mm/Kconfig233
-rw-r--r--arch/sh/mm/ioremap.c99
-rw-r--r--arch/sh/tools/mach-types5
-rw-r--r--arch/sh64/Kconfig4
-rw-r--r--arch/sh64/kernel/process.c24
-rw-r--r--arch/sh64/kernel/sh_ksyms.c2
-rw-r--r--arch/sh64/kernel/time.c7
-rw-r--r--arch/sh64/lib/dbg.c2
-rw-r--r--arch/sparc/Kconfig8
-rw-r--r--arch/sparc/Makefile2
-rw-r--r--arch/sparc/kernel/ebus.c24
-rw-r--r--arch/sparc/kernel/entry.S56
-rw-r--r--arch/sparc/kernel/led.c2
-rw-r--r--arch/sparc/kernel/pcic.c2
-rw-r--r--arch/sparc/kernel/process.c12
-rw-r--r--arch/sparc/kernel/ptrace.c39
-rw-r--r--arch/sparc/kernel/rtrap.S9
-rw-r--r--arch/sparc/kernel/signal.c117
-rw-r--r--arch/sparc/kernel/sparc_ksyms.c4
-rw-r--r--arch/sparc/kernel/sun4d_smp.c2
-rw-r--r--arch/sparc/kernel/sun4m_smp.c2
-rw-r--r--arch/sparc/kernel/sys_sunos.c3
-rw-r--r--arch/sparc/kernel/systbls.S10
-rw-r--r--arch/sparc/kernel/time.c4
-rw-r--r--arch/sparc/kernel/traps.c4
-rw-r--r--arch/sparc/kernel/vmlinux.lds.S18
-rw-r--r--arch/sparc/lib/atomic32.c1
-rw-r--r--arch/sparc/mm/iommu.c13
-rw-r--r--arch/sparc/mm/sun4c.c2
-rw-r--r--arch/sparc64/Kconfig11
-rw-r--r--arch/sparc64/Makefile5
-rw-r--r--arch/sparc64/defconfig2077
-rw-r--r--arch/sparc64/kernel/Makefile4
-rw-r--r--arch/sparc64/kernel/binfmt_aout32.c2
-rw-r--r--arch/sparc64/kernel/ebus.c15
-rw-r--r--arch/sparc64/kernel/entry.S30
-rw-r--r--arch/sparc64/kernel/ioctl32.c39
-rw-r--r--arch/sparc64/kernel/kprobes.c20
-rw-r--r--arch/sparc64/kernel/power.c4
-rw-r--r--arch/sparc64/kernel/process.c14
-rw-r--r--arch/sparc64/kernel/ptrace.c80
-rw-r--r--arch/sparc64/kernel/rtrap.S33
-rw-r--r--arch/sparc64/kernel/setup.c4
-rw-r--r--arch/sparc64/kernel/signal.c151
-rw-r--r--arch/sparc64/kernel/signal32.c122
-rw-r--r--arch/sparc64/kernel/smp.c2
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c6
-rw-r--r--arch/sparc64/kernel/sys_sparc32.c41
-rw-r--r--arch/sparc64/kernel/sys_sunos32.c3
-rw-r--r--arch/sparc64/kernel/systbls.S25
-rw-r--r--arch/sparc64/kernel/time.c22
-rw-r--r--arch/sparc64/kernel/traps.c4
-rw-r--r--arch/sparc64/kernel/vmlinux.lds.S18
-rw-r--r--arch/sparc64/prom/console.c8
-rw-r--r--arch/sparc64/solaris/entry64.S2
-rw-r--r--arch/sparc64/solaris/fs.c1
-rw-r--r--arch/sparc64/solaris/misc.c2
-rw-r--r--arch/um/Kconfig43
-rw-r--r--arch/um/Kconfig.i3866
-rw-r--r--arch/um/Makefile28
-rw-r--r--arch/um/Makefile-x86_644
-rw-r--r--arch/um/drivers/chan_kern.c275
-rw-r--r--arch/um/drivers/daemon_kern.c4
-rw-r--r--arch/um/drivers/daemon_user.c6
-rw-r--r--arch/um/drivers/fd.c1
-rw-r--r--arch/um/drivers/line.c298
-rw-r--r--arch/um/drivers/mconsole_kern.c232
-rw-r--r--arch/um/drivers/mconsole_user.c12
-rw-r--r--arch/um/drivers/net_kern.c29
-rw-r--r--arch/um/drivers/ssl.c47
-rw-r--r--arch/um/drivers/stdio_console.c33
-rw-r--r--arch/um/drivers/ubd_kern.c96
-rw-r--r--arch/um/include/chan_kern.h25
-rw-r--r--arch/um/include/choose-mode.h3
-rw-r--r--arch/um/include/irq_user.h13
-rw-r--r--arch/um/include/kern.h13
-rw-r--r--arch/um/include/kern_util.h23
-rw-r--r--arch/um/include/line.h37
-rw-r--r--arch/um/include/longjmp.h19
-rw-r--r--arch/um/include/mconsole.h8
-rw-r--r--arch/um/include/mode_kern.h15
-rw-r--r--arch/um/include/os.h91
-rw-r--r--arch/um/include/signal_user.h28
-rw-r--r--arch/um/include/skas/mm_id.h (renamed from arch/um/kernel/skas/include/mm_id.h)0
-rw-r--r--arch/um/include/skas/mmu-skas.h24
-rw-r--r--arch/um/include/skas/mode-skas.h19
-rw-r--r--arch/um/include/skas/mode_kern_skas.h (renamed from arch/um/kernel/skas/include/mode_kern-skas.h)12
-rw-r--r--arch/um/include/skas/proc_mm.h (renamed from arch/um/kernel/skas/include/proc_mm.h)17
-rw-r--r--arch/um/include/skas/skas.h26
-rw-r--r--arch/um/include/skas/stub-data.h (renamed from arch/um/kernel/skas/include/stub-data.h)0
-rw-r--r--arch/um/include/skas/uaccess-skas.h (renamed from arch/um/kernel/skas/include/uaccess-skas.h)12
-rw-r--r--arch/um/include/sysdep-i386/checksum.h4
-rw-r--r--arch/um/include/sysdep-i386/kernel-offsets.h (renamed from arch/um/sys-i386/kernel-offsets.c)5
-rw-r--r--arch/um/include/sysdep-i386/stub.h29
-rw-r--r--arch/um/include/sysdep-x86_64/kernel-offsets.h (renamed from arch/um/sys-x86_64/kernel-offsets.c)2
-rw-r--r--arch/um/include/sysdep-x86_64/stub.h30
-rw-r--r--arch/um/include/time_user.h19
-rw-r--r--arch/um/include/tt/debug.h (renamed from arch/um/kernel/tt/include/debug.h)2
-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.h41
-rw-r--r--arch/um/include/tt/tt.h (renamed from arch/um/kernel/tt/include/tt.h)12
-rw-r--r--arch/um/include/tt/uaccess-tt.h (renamed from arch/um/kernel/tt/include/uaccess-tt.h)11
-rw-r--r--arch/um/include/um_uaccess.h2
-rw-r--r--arch/um/include/user.h1
-rw-r--r--arch/um/include/user_util.h29
-rw-r--r--arch/um/kernel/Makefile7
-rw-r--r--arch/um/kernel/asm-offsets.c2
-rw-r--r--arch/um/kernel/exec_kern.c1
-rw-r--r--arch/um/kernel/irq_user.c49
-rw-r--r--arch/um/kernel/process_kern.c29
-rw-r--r--arch/um/kernel/reboot.c2
-rw-r--r--arch/um/kernel/sigio_user.c85
-rw-r--r--arch/um/kernel/signal_kern.c92
-rw-r--r--arch/um/kernel/signal_user.c157
-rw-r--r--arch/um/kernel/skas/Makefile8
-rw-r--r--arch/um/kernel/skas/clone.c23
-rw-r--r--arch/um/kernel/skas/include/mmu-skas.h35
-rw-r--r--arch/um/kernel/skas/include/mode-skas.h33
-rw-r--r--arch/um/kernel/skas/include/skas.h50
-rw-r--r--arch/um/kernel/skas/mmu.c8
-rw-r--r--arch/um/kernel/skas/process.c16
-rw-r--r--arch/um/kernel/skas/process_kern.c40
-rw-r--r--arch/um/kernel/skas/uaccess.c2
-rw-r--r--arch/um/kernel/syscall.c4
-rw-r--r--arch/um/kernel/time.c9
-rw-r--r--arch/um/kernel/time_kern.c132
-rw-r--r--arch/um/kernel/trap_kern.c25
-rw-r--r--arch/um/kernel/trap_user.c98
-rw-r--r--arch/um/kernel/tt/exec_kern.c4
-rw-r--r--arch/um/kernel/tt/gdb.c1
-rw-r--r--arch/um/kernel/tt/include/mmu-tt.h23
-rw-r--r--arch/um/kernel/tt/process_kern.c10
-rw-r--r--arch/um/kernel/tt/ptproxy/ptrace.c1
-rw-r--r--arch/um/kernel/tt/ptproxy/sysdep.c1
-rw-r--r--arch/um/kernel/tt/tracer.c1
-rw-r--r--arch/um/kernel/tt/trap_user.c21
-rw-r--r--arch/um/kernel/um_arch.c15
-rw-r--r--arch/um/kernel/umid.c323
-rw-r--r--arch/um/os-Linux/Makefile8
-rw-r--r--arch/um/os-Linux/aio.c467
-rw-r--r--arch/um/os-Linux/helper.c4
-rw-r--r--arch/um/os-Linux/main.c14
-rw-r--r--arch/um/os-Linux/process.c31
-rw-r--r--arch/um/os-Linux/signal.c246
-rw-r--r--arch/um/os-Linux/skas/Makefile10
-rw-r--r--arch/um/os-Linux/skas/mem.c (renamed from arch/um/kernel/skas/mem_user.c)202
-rw-r--r--arch/um/os-Linux/skas/process.c566
-rw-r--r--arch/um/os-Linux/skas/trap.c (renamed from arch/um/kernel/skas/trap_user.c)49
-rw-r--r--arch/um/os-Linux/start_up.c24
-rw-r--r--arch/um/os-Linux/time.c131
-rw-r--r--arch/um/os-Linux/trap.c41
-rw-r--r--arch/um/os-Linux/tt.c64
-rw-r--r--arch/um/os-Linux/uaccess.c4
-rw-r--r--arch/um/os-Linux/umid.c335
-rw-r--r--arch/um/os-Linux/user_syms.c5
-rw-r--r--arch/um/os-Linux/util.c (renamed from arch/um/kernel/user_util.c)69
-rw-r--r--arch/um/scripts/Makefile.rules5
-rw-r--r--arch/um/sys-i386/Makefile8
-rw-r--r--arch/um/sys-i386/ldt.c26
-rw-r--r--arch/um/sys-i386/signal.c1
-rw-r--r--arch/um/sys-x86_64/Makefile5
-rw-r--r--arch/v850/Kconfig3
-rw-r--r--arch/v850/kernel/process.c26
-rw-r--r--arch/v850/kernel/ptrace.c2
-rw-r--r--arch/v850/kernel/v850_ksyms.c2
-rw-r--r--arch/x86_64/Kconfig90
-rw-r--r--arch/x86_64/Kconfig.debug10
-rw-r--r--arch/x86_64/Makefile12
-rw-r--r--arch/x86_64/boot/.gitignore3
-rw-r--r--arch/x86_64/boot/Makefile2
-rw-r--r--arch/x86_64/boot/compressed/misc.c2
-rw-r--r--arch/x86_64/boot/compressed/miscsetup.h39
-rw-r--r--arch/x86_64/boot/install.sh40
-rw-r--r--arch/x86_64/boot/tools/.gitignore1
-rw-r--r--arch/x86_64/crypto/aes.c25
-rw-r--r--arch/x86_64/defconfig132
-rw-r--r--arch/x86_64/ia32/Makefile7
-rw-r--r--arch/x86_64/ia32/ia32_binfmt.c25
-rw-r--r--arch/x86_64/ia32/ia32_ioctl.c79
-rw-r--r--arch/x86_64/ia32/ia32_signal.c26
-rw-r--r--arch/x86_64/ia32/ia32entry.S56
-rw-r--r--arch/x86_64/ia32/mmap32.c78
-rw-r--r--arch/x86_64/ia32/ptrace32.c59
-rw-r--r--arch/x86_64/ia32/sys_ia32.c19
-rw-r--r--arch/x86_64/ia32/vsyscall-sigreturn.S1
-rw-r--r--arch/x86_64/ia32/vsyscall-syscall.S1
-rw-r--r--arch/x86_64/ia32/vsyscall-sysenter.S1
-rw-r--r--arch/x86_64/kernel/Makefile9
-rw-r--r--arch/x86_64/kernel/acpi/Makefile5
-rw-r--r--arch/x86_64/kernel/acpi/processor.c72
-rw-r--r--arch/x86_64/kernel/aperture.c3
-rw-r--r--arch/x86_64/kernel/apic.c198
-rw-r--r--arch/x86_64/kernel/asm-offsets.c4
-rw-r--r--arch/x86_64/kernel/crash.c156
-rw-r--r--arch/x86_64/kernel/crash_dump.c47
-rw-r--r--arch/x86_64/kernel/e820.c21
-rw-r--r--arch/x86_64/kernel/early_printk.c4
-rw-r--r--arch/x86_64/kernel/entry.S42
-rw-r--r--arch/x86_64/kernel/genapic_cluster.c5
-rw-r--r--arch/x86_64/kernel/genapic_flat.c10
-rw-r--r--arch/x86_64/kernel/head.S122
-rw-r--r--arch/x86_64/kernel/head64.c5
-rw-r--r--arch/x86_64/kernel/i387.c2
-rw-r--r--arch/x86_64/kernel/i8259.c5
-rw-r--r--arch/x86_64/kernel/init_task.c2
-rw-r--r--arch/x86_64/kernel/io_apic.c177
-rw-r--r--arch/x86_64/kernel/ioport.c1
-rw-r--r--arch/x86_64/kernel/irq.c6
-rw-r--r--arch/x86_64/kernel/kprobes.c18
-rw-r--r--arch/x86_64/kernel/mce.c35
-rw-r--r--arch/x86_64/kernel/mce_amd.c6
-rw-r--r--arch/x86_64/kernel/mce_intel.c6
-rw-r--r--arch/x86_64/kernel/mpparse.c8
-rw-r--r--arch/x86_64/kernel/nmi.c8
-rw-r--r--arch/x86_64/kernel/pci-dma.c286
-rw-r--r--arch/x86_64/kernel/pci-gart.c413
-rw-r--r--arch/x86_64/kernel/pci-nommu.c145
-rw-r--r--arch/x86_64/kernel/pci-swiotlb.c42
-rw-r--r--arch/x86_64/kernel/process.c87
-rw-r--r--arch/x86_64/kernel/ptrace.c19
-rw-r--r--arch/x86_64/kernel/reboot.c10
-rw-r--r--arch/x86_64/kernel/setup.c116
-rw-r--r--arch/x86_64/kernel/setup64.c48
-rw-r--r--arch/x86_64/kernel/smp.c7
-rw-r--r--arch/x86_64/kernel/smpboot.c63
-rw-r--r--arch/x86_64/kernel/suspend.c2
-rw-r--r--arch/x86_64/kernel/syscall.c2
-rw-r--r--arch/x86_64/kernel/time.c127
-rw-r--r--arch/x86_64/kernel/trampoline.S11
-rw-r--r--arch/x86_64/kernel/traps.c164
-rw-r--r--arch/x86_64/kernel/vmlinux.lds.S4
-rw-r--r--arch/x86_64/kernel/vsmp.c45
-rw-r--r--arch/x86_64/kernel/vsyscall.c14
-rw-r--r--arch/x86_64/kernel/x8664_ksyms.c33
-rw-r--r--arch/x86_64/lib/copy_user.S244
-rw-r--r--arch/x86_64/lib/delay.c2
-rw-r--r--arch/x86_64/lib/usercopy.c12
-rw-r--r--arch/x86_64/mm/Makefile2
-rw-r--r--arch/x86_64/mm/fault.c54
-rw-r--r--arch/x86_64/mm/init.c208
-rw-r--r--arch/x86_64/mm/ioremap.c37
-rw-r--r--arch/x86_64/mm/mmap.c30
-rw-r--r--arch/x86_64/mm/numa.c79
-rw-r--r--arch/x86_64/mm/pageattr.c9
-rw-r--r--arch/x86_64/mm/srat.c67
-rw-r--r--arch/x86_64/pci/Makefile2
-rw-r--r--arch/x86_64/pci/Makefile-BUS22
-rw-r--r--arch/x86_64/pci/mmconfig.c65
-rw-r--r--arch/xtensa/Kconfig4
-rw-r--r--arch/xtensa/kernel/process.c4
-rw-r--r--arch/xtensa/kernel/ptrace.c12
-rw-r--r--arch/xtensa/kernel/time.c2
1334 files changed, 60349 insertions, 37546 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 786491f9ceb2..eedf41bf7057 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -18,9 +18,6 @@ config MMU
18 bool 18 bool
19 default y 19 default y
20 20
21config UID16
22 bool
23
24config RWSEM_GENERIC_SPINLOCK 21config RWSEM_GENERIC_SPINLOCK
25 bool 22 bool
26 23
@@ -40,6 +37,19 @@ config GENERIC_IOMAP
40 bool 37 bool
41 default n 38 default n
42 39
40config GENERIC_HARDIRQS
41 bool
42 default y
43
44config GENERIC_IRQ_PROBE
45 bool
46 default y
47
48config AUTO_IRQ_AFFINITY
49 bool
50 depends on SMP
51 default y
52
43source "init/Kconfig" 53source "init/Kconfig"
44 54
45 55
diff --git a/arch/alpha/kernel/alpha_ksyms.c b/arch/alpha/kernel/alpha_ksyms.c
index 24ae9a366073..1898ea79d0e2 100644
--- a/arch/alpha/kernel/alpha_ksyms.c
+++ b/arch/alpha/kernel/alpha_ksyms.c
@@ -40,7 +40,6 @@
40#include <asm/unistd.h> 40#include <asm/unistd.h>
41 41
42extern struct hwrpb_struct *hwrpb; 42extern struct hwrpb_struct *hwrpb;
43extern void dump_thread(struct pt_regs *, struct user *);
44extern spinlock_t rtc_lock; 43extern spinlock_t rtc_lock;
45 44
46/* these are C runtime functions with special calling conventions: */ 45/* these are C runtime functions with special calling conventions: */
@@ -175,7 +174,6 @@ EXPORT_SYMBOL(up);
175 */ 174 */
176 175
177#ifdef CONFIG_SMP 176#ifdef CONFIG_SMP
178EXPORT_SYMBOL(synchronize_irq);
179EXPORT_SYMBOL(flush_tlb_mm); 177EXPORT_SYMBOL(flush_tlb_mm);
180EXPORT_SYMBOL(flush_tlb_range); 178EXPORT_SYMBOL(flush_tlb_range);
181EXPORT_SYMBOL(flush_tlb_page); 179EXPORT_SYMBOL(flush_tlb_page);
diff --git a/arch/alpha/kernel/irq.c b/arch/alpha/kernel/irq.c
index b6114f5c0d2b..76be5cf0de13 100644
--- a/arch/alpha/kernel/irq.c
+++ b/arch/alpha/kernel/irq.c
@@ -32,214 +32,25 @@
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34 34
35/*
36 * Controller mappings for all interrupt sources:
37 */
38irq_desc_t irq_desc[NR_IRQS] __cacheline_aligned = {
39 [0 ... NR_IRQS-1] = {
40 .handler = &no_irq_type,
41 .lock = SPIN_LOCK_UNLOCKED
42 }
43};
44
45static void register_irq_proc(unsigned int irq);
46
47volatile unsigned long irq_err_count; 35volatile unsigned long irq_err_count;
48 36
49/* 37void ack_bad_irq(unsigned int irq)
50 * Special irq handlers.
51 */
52
53irqreturn_t no_action(int cpl, void *dev_id, struct pt_regs *regs)
54{
55 return IRQ_NONE;
56}
57
58/*
59 * Generic no controller code
60 */
61
62static void no_irq_enable_disable(unsigned int irq) { }
63static unsigned int no_irq_startup(unsigned int irq) { return 0; }
64
65static void
66no_irq_ack(unsigned int irq)
67{ 38{
68 irq_err_count++; 39 irq_err_count++;
69 printk(KERN_CRIT "Unexpected IRQ trap at vector %u\n", irq); 40 printk(KERN_CRIT "Unexpected IRQ trap at vector %u\n", irq);
70} 41}
71 42
72struct hw_interrupt_type no_irq_type = {
73 .typename = "none",
74 .startup = no_irq_startup,
75 .shutdown = no_irq_enable_disable,
76 .enable = no_irq_enable_disable,
77 .disable = no_irq_enable_disable,
78 .ack = no_irq_ack,
79 .end = no_irq_enable_disable,
80};
81
82int
83handle_IRQ_event(unsigned int irq, struct pt_regs *regs,
84 struct irqaction *action)
85{
86 int status = 1; /* Force the "do bottom halves" bit */
87 int ret;
88
89 do {
90 if (!(action->flags & SA_INTERRUPT))
91 local_irq_enable();
92 else
93 local_irq_disable();
94
95 ret = action->handler(irq, action->dev_id, regs);
96 if (ret == IRQ_HANDLED)
97 status |= action->flags;
98 action = action->next;
99 } while (action);
100 if (status & SA_SAMPLE_RANDOM)
101 add_interrupt_randomness(irq);
102 local_irq_disable();
103
104 return status;
105}
106
107/*
108 * Generic enable/disable code: this just calls
109 * down into the PIC-specific version for the actual
110 * hardware disable after having gotten the irq
111 * controller lock.
112 */
113void inline
114disable_irq_nosync(unsigned int irq)
115{
116 irq_desc_t *desc = irq_desc + irq;
117 unsigned long flags;
118
119 spin_lock_irqsave(&desc->lock, flags);
120 if (!desc->depth++) {
121 desc->status |= IRQ_DISABLED;
122 desc->handler->disable(irq);
123 }
124 spin_unlock_irqrestore(&desc->lock, flags);
125}
126
127/*
128 * Synchronous version of the above, making sure the IRQ is
129 * no longer running on any other IRQ..
130 */
131void
132disable_irq(unsigned int irq)
133{
134 disable_irq_nosync(irq);
135 synchronize_irq(irq);
136}
137
138void
139enable_irq(unsigned int irq)
140{
141 irq_desc_t *desc = irq_desc + irq;
142 unsigned long flags;
143
144 spin_lock_irqsave(&desc->lock, flags);
145 switch (desc->depth) {
146 case 1: {
147 unsigned int status = desc->status & ~IRQ_DISABLED;
148 desc->status = status;
149 if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
150 desc->status = status | IRQ_REPLAY;
151 hw_resend_irq(desc->handler,irq);
152 }
153 desc->handler->enable(irq);
154 /* fall-through */
155 }
156 default:
157 desc->depth--;
158 break;
159 case 0:
160 printk(KERN_ERR "enable_irq() unbalanced from %p\n",
161 __builtin_return_address(0));
162 }
163 spin_unlock_irqrestore(&desc->lock, flags);
164}
165
166int
167setup_irq(unsigned int irq, struct irqaction * new)
168{
169 int shared = 0;
170 struct irqaction *old, **p;
171 unsigned long flags;
172 irq_desc_t *desc = irq_desc + irq;
173
174 if (desc->handler == &no_irq_type)
175 return -ENOSYS;
176
177 /*
178 * Some drivers like serial.c use request_irq() heavily,
179 * so we have to be careful not to interfere with a
180 * running system.
181 */
182 if (new->flags & SA_SAMPLE_RANDOM) {
183 /*
184 * This function might sleep, we want to call it first,
185 * outside of the atomic block.
186 * Yes, this might clear the entropy pool if the wrong
187 * driver is attempted to be loaded, without actually
188 * installing a new handler, but is this really a problem,
189 * only the sysadmin is able to do this.
190 */
191 rand_initialize_irq(irq);
192 }
193
194 /*
195 * The following block of code has to be executed atomically
196 */
197 spin_lock_irqsave(&desc->lock,flags);
198 p = &desc->action;
199 if ((old = *p) != NULL) {
200 /* Can't share interrupts unless both agree to */
201 if (!(old->flags & new->flags & SA_SHIRQ)) {
202 spin_unlock_irqrestore(&desc->lock,flags);
203 return -EBUSY;
204 }
205
206 /* add new interrupt at end of irq queue */
207 do {
208 p = &old->next;
209 old = *p;
210 } while (old);
211 shared = 1;
212 }
213
214 *p = new;
215
216 if (!shared) {
217 desc->depth = 0;
218 desc->status &=
219 ~(IRQ_DISABLED|IRQ_AUTODETECT|IRQ_WAITING|IRQ_INPROGRESS);
220 desc->handler->startup(irq);
221 }
222 spin_unlock_irqrestore(&desc->lock,flags);
223
224 return 0;
225}
226
227static struct proc_dir_entry * root_irq_dir;
228static struct proc_dir_entry * irq_dir[NR_IRQS];
229
230#ifdef CONFIG_SMP 43#ifdef CONFIG_SMP
231static struct proc_dir_entry * smp_affinity_entry[NR_IRQS];
232static char irq_user_affinity[NR_IRQS]; 44static char irq_user_affinity[NR_IRQS];
233static cpumask_t irq_affinity[NR_IRQS] = { [0 ... NR_IRQS-1] = CPU_MASK_ALL };
234 45
235static void 46int
236select_smp_affinity(int irq) 47select_smp_affinity(unsigned int irq)
237{ 48{
238 static int last_cpu; 49 static int last_cpu;
239 int cpu = last_cpu + 1; 50 int cpu = last_cpu + 1;
240 51
241 if (! irq_desc[irq].handler->set_affinity || irq_user_affinity[irq]) 52 if (!irq_desc[irq].handler->set_affinity || irq_user_affinity[irq])
242 return; 53 return 1;
243 54
244 while (!cpu_possible(cpu)) 55 while (!cpu_possible(cpu))
245 cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0); 56 cpu = (cpu < (NR_CPUS-1) ? cpu + 1 : 0);
@@ -247,208 +58,10 @@ select_smp_affinity(int irq)
247 58
248 irq_affinity[irq] = cpumask_of_cpu(cpu); 59 irq_affinity[irq] = cpumask_of_cpu(cpu);
249 irq_desc[irq].handler->set_affinity(irq, cpumask_of_cpu(cpu)); 60 irq_desc[irq].handler->set_affinity(irq, cpumask_of_cpu(cpu));
61 return 0;
250} 62}
251
252static int
253irq_affinity_read_proc (char *page, char **start, off_t off,
254 int count, int *eof, void *data)
255{
256 int len = cpumask_scnprintf(page, count, irq_affinity[(long)data]);
257 if (count - len < 2)
258 return -EINVAL;
259 len += sprintf(page + len, "\n");
260 return len;
261}
262
263static int
264irq_affinity_write_proc(struct file *file, const char __user *buffer,
265 unsigned long count, void *data)
266{
267 int irq = (long) data, full_count = count, err;
268 cpumask_t new_value;
269
270 if (!irq_desc[irq].handler->set_affinity)
271 return -EIO;
272
273 err = cpumask_parse(buffer, count, new_value);
274
275 /* The special value 0 means release control of the
276 affinity to kernel. */
277 cpus_and(new_value, new_value, cpu_online_map);
278 if (cpus_empty(new_value)) {
279 irq_user_affinity[irq] = 0;
280 select_smp_affinity(irq);
281 }
282 /* Do not allow disabling IRQs completely - it's a too easy
283 way to make the system unusable accidentally :-) At least
284 one online CPU still has to be targeted. */
285 else {
286 irq_affinity[irq] = new_value;
287 irq_user_affinity[irq] = 1;
288 irq_desc[irq].handler->set_affinity(irq, new_value);
289 }
290
291 return full_count;
292}
293
294#endif /* CONFIG_SMP */ 63#endif /* CONFIG_SMP */
295 64
296#define MAX_NAMELEN 10
297
298static void
299register_irq_proc (unsigned int irq)
300{
301 char name [MAX_NAMELEN];
302
303 if (!root_irq_dir || (irq_desc[irq].handler == &no_irq_type) ||
304 irq_dir[irq])
305 return;
306
307 memset(name, 0, MAX_NAMELEN);
308 sprintf(name, "%d", irq);
309
310 /* create /proc/irq/1234 */
311 irq_dir[irq] = proc_mkdir(name, root_irq_dir);
312
313#ifdef CONFIG_SMP
314 if (irq_desc[irq].handler->set_affinity) {
315 struct proc_dir_entry *entry;
316 /* create /proc/irq/1234/smp_affinity */
317 entry = create_proc_entry("smp_affinity", 0600, irq_dir[irq]);
318
319 if (entry) {
320 entry->nlink = 1;
321 entry->data = (void *)(long)irq;
322 entry->read_proc = irq_affinity_read_proc;
323 entry->write_proc = irq_affinity_write_proc;
324 }
325
326 smp_affinity_entry[irq] = entry;
327 }
328#endif
329}
330
331void
332init_irq_proc (void)
333{
334 int i;
335
336 /* create /proc/irq */
337 root_irq_dir = proc_mkdir("irq", NULL);
338
339#ifdef CONFIG_SMP
340 /* create /proc/irq/prof_cpu_mask */
341 create_prof_cpu_mask(root_irq_dir);
342#endif
343
344 /*
345 * Create entries for all existing IRQs.
346 */
347 for (i = 0; i < ACTUAL_NR_IRQS; i++) {
348 if (irq_desc[i].handler == &no_irq_type)
349 continue;
350 register_irq_proc(i);
351 }
352}
353
354int
355request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
356 unsigned long irqflags, const char * devname, void *dev_id)
357{
358 int retval;
359 struct irqaction * action;
360
361 if (irq >= ACTUAL_NR_IRQS)
362 return -EINVAL;
363 if (!handler)
364 return -EINVAL;
365
366#if 1
367 /*
368 * Sanity-check: shared interrupts should REALLY pass in
369 * a real dev-ID, otherwise we'll have trouble later trying
370 * to figure out which interrupt is which (messes up the
371 * interrupt freeing logic etc).
372 */
373 if ((irqflags & SA_SHIRQ) && !dev_id) {
374 printk(KERN_ERR
375 "Bad boy: %s (at %p) called us without a dev_id!\n",
376 devname, __builtin_return_address(0));
377 }
378#endif
379
380 action = (struct irqaction *)
381 kmalloc(sizeof(struct irqaction), GFP_KERNEL);
382 if (!action)
383 return -ENOMEM;
384
385 action->handler = handler;
386 action->flags = irqflags;
387 cpus_clear(action->mask);
388 action->name = devname;
389 action->next = NULL;
390 action->dev_id = dev_id;
391
392#ifdef CONFIG_SMP
393 select_smp_affinity(irq);
394#endif
395
396 retval = setup_irq(irq, action);
397 if (retval)
398 kfree(action);
399 return retval;
400}
401
402EXPORT_SYMBOL(request_irq);
403
404void
405free_irq(unsigned int irq, void *dev_id)
406{
407 irq_desc_t *desc;
408 struct irqaction **p;
409 unsigned long flags;
410
411 if (irq >= ACTUAL_NR_IRQS) {
412 printk(KERN_CRIT "Trying to free IRQ%d\n", irq);
413 return;
414 }
415
416 desc = irq_desc + irq;
417 spin_lock_irqsave(&desc->lock,flags);
418 p = &desc->action;
419 for (;;) {
420 struct irqaction * action = *p;
421 if (action) {
422 struct irqaction **pp = p;
423 p = &action->next;
424 if (action->dev_id != dev_id)
425 continue;
426
427 /* Found - now remove it from the list of entries. */
428 *pp = action->next;
429 if (!desc->action) {
430 desc->status |= IRQ_DISABLED;
431 desc->handler->shutdown(irq);
432 }
433 spin_unlock_irqrestore(&desc->lock,flags);
434
435#ifdef CONFIG_SMP
436 /* Wait to make sure it's not being used on
437 another CPU. */
438 while (desc->status & IRQ_INPROGRESS)
439 barrier();
440#endif
441 kfree(action);
442 return;
443 }
444 printk(KERN_ERR "Trying to free free IRQ%d\n",irq);
445 spin_unlock_irqrestore(&desc->lock,flags);
446 return;
447 }
448}
449
450EXPORT_SYMBOL(free_irq);
451
452int 65int
453show_interrupts(struct seq_file *p, void *v) 66show_interrupts(struct seq_file *p, void *v)
454{ 67{
@@ -531,10 +144,6 @@ handle_irq(int irq, struct pt_regs * regs)
531 * 0 return value means that this irq is already being 144 * 0 return value means that this irq is already being
532 * handled by some other CPU. (or is disabled) 145 * handled by some other CPU. (or is disabled)
533 */ 146 */
534 int cpu = smp_processor_id();
535 irq_desc_t *desc = irq_desc + irq;
536 struct irqaction * action;
537 unsigned int status;
538 static unsigned int illegal_count=0; 147 static unsigned int illegal_count=0;
539 148
540 if ((unsigned) irq > ACTUAL_NR_IRQS && illegal_count < MAX_ILLEGAL_IRQS ) { 149 if ((unsigned) irq > ACTUAL_NR_IRQS && illegal_count < MAX_ILLEGAL_IRQS ) {
@@ -546,229 +155,8 @@ handle_irq(int irq, struct pt_regs * regs)
546 } 155 }
547 156
548 irq_enter(); 157 irq_enter();
549 kstat_cpu(cpu).irqs[irq]++; 158 local_irq_disable();
550 spin_lock_irq(&desc->lock); /* mask also the higher prio events */ 159 __do_IRQ(irq, regs);
551 desc->handler->ack(irq); 160 local_irq_enable();
552 /*
553 * REPLAY is when Linux resends an IRQ that was dropped earlier.
554 * WAITING is used by probe to mark irqs that are being tested.
555 */
556 status = desc->status & ~(IRQ_REPLAY | IRQ_WAITING);
557 status |= IRQ_PENDING; /* we _want_ to handle it */
558
559 /*
560 * If the IRQ is disabled for whatever reason, we cannot
561 * use the action we have.
562 */
563 action = NULL;
564 if (!(status & (IRQ_DISABLED | IRQ_INPROGRESS))) {
565 action = desc->action;
566 status &= ~IRQ_PENDING; /* we commit to handling */
567 status |= IRQ_INPROGRESS; /* we are handling it */
568 }
569 desc->status = status;
570
571 /*
572 * If there is no IRQ handler or it was disabled, exit early.
573 * Since we set PENDING, if another processor is handling
574 * a different instance of this same irq, the other processor
575 * will take care of it.
576 */
577 if (!action)
578 goto out;
579
580 /*
581 * Edge triggered interrupts need to remember pending events.
582 * This applies to any hw interrupts that allow a second
583 * instance of the same irq to arrive while we are in handle_irq
584 * or in the handler. But the code here only handles the _second_
585 * instance of the irq, not the third or fourth. So it is mostly
586 * useful for irq hardware that does not mask cleanly in an
587 * SMP environment.
588 */
589 for (;;) {
590 spin_unlock(&desc->lock);
591 handle_IRQ_event(irq, regs, action);
592 spin_lock(&desc->lock);
593
594 if (!(desc->status & IRQ_PENDING)
595 || (desc->status & IRQ_LEVEL))
596 break;
597 desc->status &= ~IRQ_PENDING;
598 }
599 desc->status &= ~IRQ_INPROGRESS;
600out:
601 /*
602 * The ->end() handler has to deal with interrupts which got
603 * disabled while the handler was running.
604 */
605 desc->handler->end(irq);
606 spin_unlock(&desc->lock);
607
608 irq_exit(); 161 irq_exit();
609} 162}
610
611/*
612 * IRQ autodetection code..
613 *
614 * This depends on the fact that any interrupt that
615 * comes in on to an unassigned handler will get stuck
616 * with "IRQ_WAITING" cleared and the interrupt
617 * disabled.
618 */
619unsigned long
620probe_irq_on(void)
621{
622 int i;
623 irq_desc_t *desc;
624 unsigned long delay;
625 unsigned long val;
626
627 /* Something may have generated an irq long ago and we want to
628 flush such a longstanding irq before considering it as spurious. */
629 for (i = NR_IRQS-1; i >= 0; i--) {
630 desc = irq_desc + i;
631
632 spin_lock_irq(&desc->lock);
633 if (!irq_desc[i].action)
634 irq_desc[i].handler->startup(i);
635 spin_unlock_irq(&desc->lock);
636 }
637
638 /* Wait for longstanding interrupts to trigger. */
639 for (delay = jiffies + HZ/50; time_after(delay, jiffies); )
640 /* about 20ms delay */ barrier();
641
642 /* enable any unassigned irqs (we must startup again here because
643 if a longstanding irq happened in the previous stage, it may have
644 masked itself) first, enable any unassigned irqs. */
645 for (i = NR_IRQS-1; i >= 0; i--) {
646 desc = irq_desc + i;
647
648 spin_lock_irq(&desc->lock);
649 if (!desc->action) {
650 desc->status |= IRQ_AUTODETECT | IRQ_WAITING;
651 if (desc->handler->startup(i))
652 desc->status |= IRQ_PENDING;
653 }
654 spin_unlock_irq(&desc->lock);
655 }
656
657 /*
658 * Wait for spurious interrupts to trigger
659 */
660 for (delay = jiffies + HZ/10; time_after(delay, jiffies); )
661 /* about 100ms delay */ barrier();
662
663 /*
664 * Now filter out any obviously spurious interrupts
665 */
666 val = 0;
667 for (i=0; i<NR_IRQS; i++) {
668 irq_desc_t *desc = irq_desc + i;
669 unsigned int status;
670
671 spin_lock_irq(&desc->lock);
672 status = desc->status;
673
674 if (status & IRQ_AUTODETECT) {
675 /* It triggered already - consider it spurious. */
676 if (!(status & IRQ_WAITING)) {
677 desc->status = status & ~IRQ_AUTODETECT;
678 desc->handler->shutdown(i);
679 } else
680 if (i < 32)
681 val |= 1 << i;
682 }
683 spin_unlock_irq(&desc->lock);
684 }
685
686 return val;
687}
688
689EXPORT_SYMBOL(probe_irq_on);
690
691/*
692 * Return a mask of triggered interrupts (this
693 * can handle only legacy ISA interrupts).
694 */
695unsigned int
696probe_irq_mask(unsigned long val)
697{
698 int i;
699 unsigned int mask;
700
701 mask = 0;
702 for (i = 0; i < NR_IRQS; i++) {
703 irq_desc_t *desc = irq_desc + i;
704 unsigned int status;
705
706 spin_lock_irq(&desc->lock);
707 status = desc->status;
708
709 if (status & IRQ_AUTODETECT) {
710 /* We only react to ISA interrupts */
711 if (!(status & IRQ_WAITING)) {
712 if (i < 16)
713 mask |= 1 << i;
714 }
715
716 desc->status = status & ~IRQ_AUTODETECT;
717 desc->handler->shutdown(i);
718 }
719 spin_unlock_irq(&desc->lock);
720 }
721
722 return mask & val;
723}
724
725/*
726 * Get the result of the IRQ probe.. A negative result means that
727 * we have several candidates (but we return the lowest-numbered
728 * one).
729 */
730
731int
732probe_irq_off(unsigned long val)
733{
734 int i, irq_found, nr_irqs;
735
736 nr_irqs = 0;
737 irq_found = 0;
738 for (i=0; i<NR_IRQS; i++) {
739 irq_desc_t *desc = irq_desc + i;
740 unsigned int status;
741
742 spin_lock_irq(&desc->lock);
743 status = desc->status;
744
745 if (status & IRQ_AUTODETECT) {
746 if (!(status & IRQ_WAITING)) {
747 if (!nr_irqs)
748 irq_found = i;
749 nr_irqs++;
750 }
751 desc->status = status & ~IRQ_AUTODETECT;
752 desc->handler->shutdown(i);
753 }
754 spin_unlock_irq(&desc->lock);
755 }
756
757 if (nr_irqs > 1)
758 irq_found = -irq_found;
759 return irq_found;
760}
761
762EXPORT_SYMBOL(probe_irq_off);
763
764#ifdef CONFIG_SMP
765void synchronize_irq(unsigned int irq)
766{
767 /* is there anything to synchronize with? */
768 if (!irq_desc[irq].action)
769 return;
770
771 while (irq_desc[irq].status & IRQ_INPROGRESS)
772 barrier();
773}
774#endif
diff --git a/arch/alpha/kernel/machvec_impl.h b/arch/alpha/kernel/machvec_impl.h
index 4959b7a3e1e6..11f996f24fde 100644
--- a/arch/alpha/kernel/machvec_impl.h
+++ b/arch/alpha/kernel/machvec_impl.h
@@ -41,7 +41,7 @@
41#define CAT1(x,y) x##y 41#define CAT1(x,y) x##y
42#define CAT(x,y) CAT1(x,y) 42#define CAT(x,y) CAT1(x,y)
43 43
44#define DO_DEFAULT_RTC rtc_port: 0x70 44#define DO_DEFAULT_RTC .rtc_port = 0x70
45 45
46#define DO_EV4_MMU \ 46#define DO_EV4_MMU \
47 .max_asn = EV4_MAX_ASN, \ 47 .max_asn = EV4_MAX_ASN, \
diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 01fe990d3e54..7fb14f42a125 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -960,7 +960,7 @@ osf_utimes(char __user *filename, struct timeval32 __user *tvs)
960 return -EFAULT; 960 return -EFAULT;
961 } 961 }
962 962
963 return do_utimes(filename, tvs ? ktvs : NULL); 963 return do_utimes(AT_FDCWD, filename, tvs ? ktvs : NULL);
964} 964}
965 965
966#define MAX_SELECT_SECONDS \ 966#define MAX_SELECT_SECONDS \
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index 9903e3a79102..fff5cf93e816 100644
--- a/arch/alpha/kernel/pci-noop.c
+++ b/arch/alpha/kernel/pci-noop.c
@@ -7,6 +7,7 @@
7#include <linux/pci.h> 7#include <linux/pci.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/bootmem.h> 9#include <linux/bootmem.h>
10#include <linux/capability.h>
10#include <linux/mm.h> 11#include <linux/mm.h>
11#include <linux/errno.h> 12#include <linux/errno.h>
12#include <linux/sched.h> 13#include <linux/sched.h>
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index a8682612abc0..9924fd07743a 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -43,6 +43,11 @@
43#include "proto.h" 43#include "proto.h"
44#include "pci_impl.h" 44#include "pci_impl.h"
45 45
46/*
47 * Power off function, if any
48 */
49void (*pm_power_off)(void) = machine_power_off;
50
46void 51void
47cpu_idle(void) 52cpu_idle(void)
48{ 53{
@@ -271,7 +276,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
271{ 276{
272 extern void ret_from_fork(void); 277 extern void ret_from_fork(void);
273 278
274 struct thread_info *childti = p->thread_info; 279 struct thread_info *childti = task_thread_info(p);
275 struct pt_regs * childregs; 280 struct pt_regs * childregs;
276 struct switch_stack * childstack, *stack; 281 struct switch_stack * childstack, *stack;
277 unsigned long stack_offset, settls; 282 unsigned long stack_offset, settls;
@@ -280,7 +285,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
280 if (!(regs->ps & 8)) 285 if (!(regs->ps & 8))
281 stack_offset = (PAGE_SIZE-1) & (unsigned long) regs; 286 stack_offset = (PAGE_SIZE-1) & (unsigned long) regs;
282 childregs = (struct pt_regs *) 287 childregs = (struct pt_regs *)
283 (stack_offset + PAGE_SIZE + (long) childti); 288 (stack_offset + PAGE_SIZE + task_stack_page(p));
284 289
285 *childregs = *regs; 290 *childregs = *regs;
286 settls = regs->r20; 291 settls = regs->r20;
@@ -423,30 +428,15 @@ dump_elf_thread(elf_greg_t *dest, struct pt_regs *pt, struct thread_info *ti)
423int 428int
424dump_elf_task(elf_greg_t *dest, struct task_struct *task) 429dump_elf_task(elf_greg_t *dest, struct task_struct *task)
425{ 430{
426 struct thread_info *ti; 431 dump_elf_thread(dest, task_pt_regs(task), task_thread_info(task));
427 struct pt_regs *pt;
428
429 ti = task->thread_info;
430 pt = (struct pt_regs *)((unsigned long)ti + 2*PAGE_SIZE) - 1;
431
432 dump_elf_thread(dest, pt, ti);
433
434 return 1; 432 return 1;
435} 433}
436 434
437int 435int
438dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task) 436dump_elf_task_fp(elf_fpreg_t *dest, struct task_struct *task)
439{ 437{
440 struct thread_info *ti; 438 struct switch_stack *sw = (struct switch_stack *)task_pt_regs(task) - 1;
441 struct pt_regs *pt;
442 struct switch_stack *sw;
443
444 ti = task->thread_info;
445 pt = (struct pt_regs *)((unsigned long)ti + 2*PAGE_SIZE) - 1;
446 sw = (struct switch_stack *)pt - 1;
447
448 memcpy(dest, sw->fp, 32 * 8); 439 memcpy(dest, sw->fp, 32 * 8);
449
450 return 1; 440 return 1;
451} 441}
452 442
@@ -487,8 +477,8 @@ out:
487unsigned long 477unsigned long
488thread_saved_pc(task_t *t) 478thread_saved_pc(task_t *t)
489{ 479{
490 unsigned long base = (unsigned long)t->thread_info; 480 unsigned long base = (unsigned long)task_stack_page(t);
491 unsigned long fp, sp = t->thread_info->pcb.ksp; 481 unsigned long fp, sp = task_thread_info(t)->pcb.ksp;
492 482
493 if (sp > base && sp+6*8 < base + 16*1024) { 483 if (sp > base && sp+6*8 < base + 16*1024) {
494 fp = ((unsigned long*)sp)[6]; 484 fp = ((unsigned long*)sp)[6];
@@ -518,7 +508,7 @@ get_wchan(struct task_struct *p)
518 508
519 pc = thread_saved_pc(p); 509 pc = thread_saved_pc(p);
520 if (in_sched_functions(pc)) { 510 if (in_sched_functions(pc)) {
521 schedule_frame = ((unsigned long *)p->thread_info->pcb.ksp)[6]; 511 schedule_frame = ((unsigned long *)task_thread_info(p)->pcb.ksp)[6];
522 return ((unsigned long *)schedule_frame)[12]; 512 return ((unsigned long *)schedule_frame)[12];
523 } 513 }
524 return pc; 514 return pc;
diff --git a/arch/alpha/kernel/ptrace.c b/arch/alpha/kernel/ptrace.c
index bbd37536d14e..0cd060598f9a 100644
--- a/arch/alpha/kernel/ptrace.c
+++ b/arch/alpha/kernel/ptrace.c
@@ -72,6 +72,13 @@ enum {
72 REG_R0 = 0, REG_F0 = 32, REG_FPCR = 63, REG_PC = 64 72 REG_R0 = 0, REG_F0 = 32, REG_FPCR = 63, REG_PC = 64
73}; 73};
74 74
75#define PT_REG(reg) \
76 (PAGE_SIZE*2 - sizeof(struct pt_regs) + offsetof(struct pt_regs, reg))
77
78#define SW_REG(reg) \
79 (PAGE_SIZE*2 - sizeof(struct pt_regs) - sizeof(struct switch_stack) \
80 + offsetof(struct switch_stack, reg))
81
75static int regoff[] = { 82static int regoff[] = {
76 PT_REG( r0), PT_REG( r1), PT_REG( r2), PT_REG( r3), 83 PT_REG( r0), PT_REG( r1), PT_REG( r2), PT_REG( r3),
77 PT_REG( r4), PT_REG( r5), PT_REG( r6), PT_REG( r7), 84 PT_REG( r4), PT_REG( r5), PT_REG( r6), PT_REG( r7),
@@ -103,14 +110,14 @@ get_reg_addr(struct task_struct * task, unsigned long regno)
103 unsigned long *addr; 110 unsigned long *addr;
104 111
105 if (regno == 30) { 112 if (regno == 30) {
106 addr = &task->thread_info->pcb.usp; 113 addr = &task_thread_info(task)->pcb.usp;
107 } else if (regno == 65) { 114 } else if (regno == 65) {
108 addr = &task->thread_info->pcb.unique; 115 addr = &task_thread_info(task)->pcb.unique;
109 } else if (regno == 31 || regno > 65) { 116 } else if (regno == 31 || regno > 65) {
110 zero = 0; 117 zero = 0;
111 addr = &zero; 118 addr = &zero;
112 } else { 119 } else {
113 addr = (void *)task->thread_info + regoff[regno]; 120 addr = task_stack_page(task) + regoff[regno];
114 } 121 }
115 return addr; 122 return addr;
116} 123}
@@ -125,7 +132,7 @@ get_reg(struct task_struct * task, unsigned long regno)
125 if (regno == 63) { 132 if (regno == 63) {
126 unsigned long fpcr = *get_reg_addr(task, regno); 133 unsigned long fpcr = *get_reg_addr(task, regno);
127 unsigned long swcr 134 unsigned long swcr
128 = task->thread_info->ieee_state & IEEE_SW_MASK; 135 = task_thread_info(task)->ieee_state & IEEE_SW_MASK;
129 swcr = swcr_update_status(swcr, fpcr); 136 swcr = swcr_update_status(swcr, fpcr);
130 return fpcr | swcr; 137 return fpcr | swcr;
131 } 138 }
@@ -139,8 +146,8 @@ static int
139put_reg(struct task_struct *task, unsigned long regno, unsigned long data) 146put_reg(struct task_struct *task, unsigned long regno, unsigned long data)
140{ 147{
141 if (regno == 63) { 148 if (regno == 63) {
142 task->thread_info->ieee_state 149 task_thread_info(task)->ieee_state
143 = ((task->thread_info->ieee_state & ~IEEE_SW_MASK) 150 = ((task_thread_info(task)->ieee_state & ~IEEE_SW_MASK)
144 | (data & IEEE_SW_MASK)); 151 | (data & IEEE_SW_MASK));
145 data = (data & FPCR_DYN_MASK) | ieee_swcr_to_fpcr(data); 152 data = (data & FPCR_DYN_MASK) | ieee_swcr_to_fpcr(data);
146 } 153 }
@@ -188,35 +195,35 @@ ptrace_set_bpt(struct task_struct * child)
188 * branch (emulation can be tricky for fp branches). 195 * branch (emulation can be tricky for fp branches).
189 */ 196 */
190 displ = ((s32)(insn << 11)) >> 9; 197 displ = ((s32)(insn << 11)) >> 9;
191 child->thread_info->bpt_addr[nsaved++] = pc + 4; 198 task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
192 if (displ) /* guard against unoptimized code */ 199 if (displ) /* guard against unoptimized code */
193 child->thread_info->bpt_addr[nsaved++] 200 task_thread_info(child)->bpt_addr[nsaved++]
194 = pc + 4 + displ; 201 = pc + 4 + displ;
195 DBG(DBG_BPT, ("execing branch\n")); 202 DBG(DBG_BPT, ("execing branch\n"));
196 } else if (op_code == 0x1a) { 203 } else if (op_code == 0x1a) {
197 reg_b = (insn >> 16) & 0x1f; 204 reg_b = (insn >> 16) & 0x1f;
198 child->thread_info->bpt_addr[nsaved++] = get_reg(child, reg_b); 205 task_thread_info(child)->bpt_addr[nsaved++] = get_reg(child, reg_b);
199 DBG(DBG_BPT, ("execing jump\n")); 206 DBG(DBG_BPT, ("execing jump\n"));
200 } else { 207 } else {
201 child->thread_info->bpt_addr[nsaved++] = pc + 4; 208 task_thread_info(child)->bpt_addr[nsaved++] = pc + 4;
202 DBG(DBG_BPT, ("execing normal insn\n")); 209 DBG(DBG_BPT, ("execing normal insn\n"));
203 } 210 }
204 211
205 /* install breakpoints: */ 212 /* install breakpoints: */
206 for (i = 0; i < nsaved; ++i) { 213 for (i = 0; i < nsaved; ++i) {
207 res = read_int(child, child->thread_info->bpt_addr[i], 214 res = read_int(child, task_thread_info(child)->bpt_addr[i],
208 (int *) &insn); 215 (int *) &insn);
209 if (res < 0) 216 if (res < 0)
210 return res; 217 return res;
211 child->thread_info->bpt_insn[i] = insn; 218 task_thread_info(child)->bpt_insn[i] = insn;
212 DBG(DBG_BPT, (" -> next_pc=%lx\n", 219 DBG(DBG_BPT, (" -> next_pc=%lx\n",
213 child->thread_info->bpt_addr[i])); 220 task_thread_info(child)->bpt_addr[i]));
214 res = write_int(child, child->thread_info->bpt_addr[i], 221 res = write_int(child, task_thread_info(child)->bpt_addr[i],
215 BREAKINST); 222 BREAKINST);
216 if (res < 0) 223 if (res < 0)
217 return res; 224 return res;
218 } 225 }
219 child->thread_info->bpt_nsaved = nsaved; 226 task_thread_info(child)->bpt_nsaved = nsaved;
220 return 0; 227 return 0;
221} 228}
222 229
@@ -227,9 +234,9 @@ ptrace_set_bpt(struct task_struct * child)
227int 234int
228ptrace_cancel_bpt(struct task_struct * child) 235ptrace_cancel_bpt(struct task_struct * child)
229{ 236{
230 int i, nsaved = child->thread_info->bpt_nsaved; 237 int i, nsaved = task_thread_info(child)->bpt_nsaved;
231 238
232 child->thread_info->bpt_nsaved = 0; 239 task_thread_info(child)->bpt_nsaved = 0;
233 240
234 if (nsaved > 2) { 241 if (nsaved > 2) {
235 printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved); 242 printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved);
@@ -237,8 +244,8 @@ ptrace_cancel_bpt(struct task_struct * child)
237 } 244 }
238 245
239 for (i = 0; i < nsaved; ++i) { 246 for (i = 0; i < nsaved; ++i) {
240 write_int(child, child->thread_info->bpt_addr[i], 247 write_int(child, task_thread_info(child)->bpt_addr[i],
241 child->thread_info->bpt_insn[i]); 248 task_thread_info(child)->bpt_insn[i]);
242 } 249 }
243 return (nsaved != 0); 250 return (nsaved != 0);
244} 251}
@@ -265,30 +272,16 @@ do_sys_ptrace(long request, long pid, long addr, long data,
265 lock_kernel(); 272 lock_kernel();
266 DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n", 273 DBG(DBG_MEM, ("request=%ld pid=%ld addr=0x%lx data=0x%lx\n",
267 request, pid, addr, data)); 274 request, pid, addr, data));
268 ret = -EPERM;
269 if (request == PTRACE_TRACEME) { 275 if (request == PTRACE_TRACEME) {
270 /* are we already being traced? */ 276 ret = ptrace_traceme();
271 if (current->ptrace & PT_PTRACED)
272 goto out_notsk;
273 ret = security_ptrace(current->parent, current);
274 if (ret)
275 goto out_notsk;
276 /* set the ptrace bit in the process ptrace flags. */
277 current->ptrace |= PT_PTRACED;
278 ret = 0;
279 goto out_notsk; 277 goto out_notsk;
280 } 278 }
281 if (pid == 1) /* you may not mess with init */
282 goto out_notsk;
283 279
284 ret = -ESRCH; 280 child = ptrace_get_task_struct(pid);
285 read_lock(&tasklist_lock); 281 if (IS_ERR(child)) {
286 child = find_task_by_pid(pid); 282 ret = PTR_ERR(child);
287 if (child)
288 get_task_struct(child);
289 read_unlock(&tasklist_lock);
290 if (!child)
291 goto out_notsk; 283 goto out_notsk;
284 }
292 285
293 if (request == PTRACE_ATTACH) { 286 if (request == PTRACE_ATTACH) {
294 ret = ptrace_attach(child); 287 ret = ptrace_attach(child);
@@ -369,7 +362,7 @@ do_sys_ptrace(long request, long pid, long addr, long data,
369 if (!valid_signal(data)) 362 if (!valid_signal(data))
370 break; 363 break;
371 /* Mark single stepping. */ 364 /* Mark single stepping. */
372 child->thread_info->bpt_nsaved = -1; 365 task_thread_info(child)->bpt_nsaved = -1;
373 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE); 366 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
374 child->exit_code = data; 367 child->exit_code = data;
375 wake_up_process(child); 368 wake_up_process(child);
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index da0be3465791..4b873527ce1c 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -302,7 +302,7 @@ secondary_cpu_start(int cpuid, struct task_struct *idle)
302 + hwrpb->processor_offset 302 + hwrpb->processor_offset
303 + cpuid * hwrpb->processor_size); 303 + cpuid * hwrpb->processor_size);
304 hwpcb = (struct pcb_struct *) cpu->hwpcb; 304 hwpcb = (struct pcb_struct *) cpu->hwpcb;
305 ipcb = &idle->thread_info->pcb; 305 ipcb = &task_thread_info(idle)->pcb;
306 306
307 /* Initialize the CPU's HWPCB to something just good enough for 307 /* Initialize the CPU's HWPCB to something just good enough for
308 us to get started. Immediately after starting, we'll swpctx 308 us to get started. Immediately after starting, we'll swpctx
diff --git a/arch/alpha/kernel/sys_alcor.c b/arch/alpha/kernel/sys_alcor.c
index 145dcde143ae..d7f0e97fe56f 100644
--- a/arch/alpha/kernel/sys_alcor.c
+++ b/arch/alpha/kernel/sys_alcor.c
@@ -254,7 +254,7 @@ alcor_init_pci(void)
254 * motherboard, by looking for a 21040 TULIP in slot 6, which is 254 * motherboard, by looking for a 21040 TULIP in slot 6, which is
255 * built into XLT and BRET/MAVERICK, but not available on ALCOR. 255 * built into XLT and BRET/MAVERICK, but not available on ALCOR.
256 */ 256 */
257 dev = pci_find_device(PCI_VENDOR_ID_DEC, 257 dev = pci_get_device(PCI_VENDOR_ID_DEC,
258 PCI_DEVICE_ID_DEC_TULIP, 258 PCI_DEVICE_ID_DEC_TULIP,
259 NULL); 259 NULL);
260 if (dev && dev->devfn == PCI_DEVFN(6,0)) { 260 if (dev && dev->devfn == PCI_DEVFN(6,0)) {
@@ -262,6 +262,7 @@ alcor_init_pci(void)
262 printk(KERN_INFO "%s: Detected AS500 or XLT motherboard.\n", 262 printk(KERN_INFO "%s: Detected AS500 or XLT motherboard.\n",
263 __FUNCTION__); 263 __FUNCTION__);
264 } 264 }
265 pci_dev_put(dev);
265} 266}
266 267
267 268
diff --git a/arch/alpha/kernel/sys_sio.c b/arch/alpha/kernel/sys_sio.c
index 47df48a6ddb7..131a2d9f79d3 100644
--- a/arch/alpha/kernel/sys_sio.c
+++ b/arch/alpha/kernel/sys_sio.c
@@ -105,7 +105,7 @@ sio_collect_irq_levels(void)
105 struct pci_dev *dev = NULL; 105 struct pci_dev *dev = NULL;
106 106
107 /* Iterate through the devices, collecting IRQ levels. */ 107 /* Iterate through the devices, collecting IRQ levels. */
108 while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 108 for_each_pci_dev(dev) {
109 if ((dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) && 109 if ((dev->class >> 16 == PCI_BASE_CLASS_BRIDGE) &&
110 (dev->class >> 8 != PCI_CLASS_BRIDGE_PCMCIA)) 110 (dev->class >> 8 != PCI_CLASS_BRIDGE_PCMCIA))
111 continue; 111 continue;
@@ -229,8 +229,8 @@ alphabook1_init_pci(void)
229 */ 229 */
230 230
231 dev = NULL; 231 dev = NULL;
232 while ((dev = pci_find_device(PCI_VENDOR_ID_NCR, PCI_ANY_ID, dev))) { 232 while ((dev = pci_get_device(PCI_VENDOR_ID_NCR, PCI_ANY_ID, dev))) {
233 if (dev->device == PCI_DEVICE_ID_NCR_53C810 233 if (dev->device == PCI_DEVICE_ID_NCR_53C810
234 || dev->device == PCI_DEVICE_ID_NCR_53C815 234 || dev->device == PCI_DEVICE_ID_NCR_53C815
235 || dev->device == PCI_DEVICE_ID_NCR_53C820 235 || dev->device == PCI_DEVICE_ID_NCR_53C820
236 || dev->device == PCI_DEVICE_ID_NCR_53C825) { 236 || dev->device == PCI_DEVICE_ID_NCR_53C825) {
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 90752f6d8867..486d7945583d 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -7,6 +7,7 @@
7/* 2.3.x zone allocator, 1999 Andrea Arcangeli <andrea@suse.de> */ 7/* 2.3.x zone allocator, 1999 Andrea Arcangeli <andrea@suse.de> */
8 8
9#include <linux/config.h> 9#include <linux/config.h>
10#include <linux/pagemap.h>
10#include <linux/signal.h> 11#include <linux/signal.h>
11#include <linux/sched.h> 12#include <linux/sched.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4b15f5f1e254..5959e36c3b4c 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -46,10 +46,6 @@ config MCA
46 <file:Documentation/mca.txt> (and especially the web page given 46 <file:Documentation/mca.txt> (and especially the web page given
47 there) before attempting to build an MCA bus kernel. 47 there) before attempting to build an MCA bus kernel.
48 48
49config UID16
50 bool
51 default y
52
53config RWSEM_GENERIC_SPINLOCK 49config RWSEM_GENERIC_SPINLOCK
54 bool 50 bool
55 default y 51 default y
@@ -103,13 +99,6 @@ config ARCH_EBSA110
103 Ethernet interface, two PCMCIA sockets, two serial ports and a 99 Ethernet interface, two PCMCIA sockets, two serial ports and a
104 parallel port. 100 parallel port.
105 101
106config ARCH_CAMELOT
107 bool "Epxa10db"
108 help
109 This enables support for Altera's Excalibur XA10 development board.
110 If you would like to build your kernel to run on one of these boards
111 then you must say 'Y' here. Otherwise say 'N'
112
113config ARCH_FOOTBRIDGE 102config ARCH_FOOTBRIDGE
114 bool "FootBridge" 103 bool "FootBridge"
115 select FOOTBRIDGE 104 select FOOTBRIDGE
@@ -154,6 +143,7 @@ config ARCH_RPC
154 select FIQ 143 select FIQ
155 select TIMER_ACORN 144 select TIMER_ACORN
156 select ARCH_MAY_HAVE_PC_FDC 145 select ARCH_MAY_HAVE_PC_FDC
146 select ISA_DMA_API
157 help 147 help
158 On the Acorn Risc-PC, Linux can support the internal IDE disk and 148 On the Acorn Risc-PC, Linux can support the internal IDE disk and
159 CD-ROM interface, serial and parallel port, and the floppy drive. 149 CD-ROM interface, serial and parallel port, and the floppy drive.
@@ -190,6 +180,7 @@ config ARCH_OMAP
190config ARCH_VERSATILE 180config ARCH_VERSATILE
191 bool "Versatile" 181 bool "Versatile"
192 select ARM_AMBA 182 select ARM_AMBA
183 select ARM_VIC
193 select ICST307 184 select ICST307
194 help 185 help
195 This enables support for ARM Ltd Versatile board. 186 This enables support for ARM Ltd Versatile board.
@@ -206,6 +197,7 @@ config ARCH_IMX
206 197
207config ARCH_H720X 198config ARCH_H720X
208 bool "Hynix-HMS720x-based" 199 bool "Hynix-HMS720x-based"
200 select ISA_DMA_API
209 help 201 help
210 This enables support for systems based on the Hynix HMS720x 202 This enables support for systems based on the Hynix HMS720x
211 203
@@ -215,12 +207,16 @@ config ARCH_AAEC2000
215 help 207 help
216 This enables support for systems based on the Agilent AAEC-2000 208 This enables support for systems based on the Agilent AAEC-2000
217 209
210config ARCH_AT91RM9200
211 bool "AT91RM9200"
212 help
213 Say Y here if you intend to run this kernel on an AT91RM9200-based
214 board.
215
218endchoice 216endchoice
219 217
220source "arch/arm/mach-clps711x/Kconfig" 218source "arch/arm/mach-clps711x/Kconfig"
221 219
222source "arch/arm/mach-epxa10db/Kconfig"
223
224source "arch/arm/mach-footbridge/Kconfig" 220source "arch/arm/mach-footbridge/Kconfig"
225 221
226source "arch/arm/mach-integrator/Kconfig" 222source "arch/arm/mach-integrator/Kconfig"
@@ -255,6 +251,8 @@ source "arch/arm/mach-aaec2000/Kconfig"
255 251
256source "arch/arm/mach-realview/Kconfig" 252source "arch/arm/mach-realview/Kconfig"
257 253
254source "arch/arm/mach-at91rm9200/Kconfig"
255
258# Definitions to make life easier 256# Definitions to make life easier
259config ARCH_ACORN 257config ARCH_ACORN
260 bool 258 bool
@@ -290,12 +288,14 @@ config ISA
290 (MCA) or VESA. ISA is an older system, now being displaced by PCI; 288 (MCA) or VESA. ISA is an older system, now being displaced by PCI;
291 newer boards don't support it. If you have ISA, say Y, otherwise N. 289 newer boards don't support it. If you have ISA, say Y, otherwise N.
292 290
291# Select ISA DMA controller support
293config ISA_DMA 292config ISA_DMA
294 bool 293 bool
294 select ISA_DMA_API
295 295
296# Select ISA DMA interface
296config ISA_DMA_API 297config ISA_DMA_API
297 bool 298 bool
298 default y
299 299
300config PCI 300config PCI
301 bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB 301 bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB
@@ -401,6 +401,38 @@ config NO_IDLE_HZ
401 Currently at least OMAP, PXA2xx and SA11x0 platforms are known 401 Currently at least OMAP, PXA2xx and SA11x0 platforms are known
402 to have accurate timekeeping with dynamic tick. 402 to have accurate timekeeping with dynamic tick.
403 403
404config AEABI
405 bool "Use the ARM EABI to compile the kernel"
406 help
407 This option allows for the kernel to be compiled using the latest
408 ARM ABI (aka EABI). This is only useful if you are using a user
409 space environment that is also compiled with EABI.
410
411 Since there are major incompatibilities between the legacy ABI and
412 EABI, especially with regard to structure member alignment, this
413 option also changes the kernel syscall calling convention to
414 disambiguate both ABIs and allow for backward compatibility support
415 (selected with CONFIG_OABI_COMPAT).
416
417 To use this you need GCC version 4.0.0 or later.
418
419config OABI_COMPAT
420 bool "Allow old ABI binaries to run with this kernel"
421 depends on AEABI
422 default y
423 help
424 This option preserves the old syscall interface along with the
425 new (ARM EABI) one. It also provides a compatibility layer to
426 intercept syscalls that have structure arguments which layout
427 in memory differs between the legacy ABI and the new ARM EABI
428 (only for non "thumb" binaries). This option adds a tiny
429 overhead to all syscalls and produces a slightly larger kernel.
430 If you know you'll be using only pure EABI user space then you
431 can say N here. If this option is not selected and you attempt
432 to execute a legacy ABI binary then the result will be
433 UNPREDICTABLE (in fact it can be predicted that it won't work
434 at all). If in doubt say Y.
435
404config ARCH_DISCONTIGMEM_ENABLE 436config ARCH_DISCONTIGMEM_ENABLE
405 bool 437 bool
406 default (ARCH_LH7A40X && !LH7A40X_CONTIGMEM) 438 default (ARCH_LH7A40X && !LH7A40X_CONTIGMEM)
@@ -418,7 +450,8 @@ config LEDS
418 ARCH_EBSA285 || ARCH_IMX || ARCH_INTEGRATOR || \ 450 ARCH_EBSA285 || ARCH_IMX || ARCH_INTEGRATOR || \
419 ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \ 451 ARCH_LUBBOCK || MACH_MAINSTONE || ARCH_NETWINDER || \
420 ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \ 452 ARCH_OMAP || ARCH_P720T || ARCH_PXA_IDP || \
421 ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE 453 ARCH_SA1100 || ARCH_SHARK || ARCH_VERSATILE || \
454 ARCH_AT91RM9200
422 help 455 help
423 If you say Y here, the LEDs on your machine will be used 456 If you say Y here, the LEDs on your machine will be used
424 to provide useful information about your current system status. 457 to provide useful information about your current system status.
@@ -586,6 +619,7 @@ comment "At least one emulation must be selected"
586 619
587config FPE_NWFPE 620config FPE_NWFPE
588 bool "NWFPE math emulation" 621 bool "NWFPE math emulation"
622 depends on !AEABI || OABI_COMPAT
589 ---help--- 623 ---help---
590 Say Y to include the NWFPE floating point emulator in the kernel. 624 Say Y to include the NWFPE floating point emulator in the kernel.
591 This is necessary to run most binaries. Linux does not currently 625 This is necessary to run most binaries. Linux does not currently
@@ -609,7 +643,7 @@ config FPE_NWFPE_XP
609 643
610config FPE_FASTFPE 644config FPE_FASTFPE
611 bool "FastFPE math emulation (EXPERIMENTAL)" 645 bool "FastFPE math emulation (EXPERIMENTAL)"
612 depends on !CPU_32v3 && EXPERIMENTAL 646 depends on (!AEABI || OABI_COMPAT) && !CPU_32v3 && EXPERIMENTAL
613 ---help--- 647 ---help---
614 Say Y here to include the FAST floating point emulator in the kernel. 648 Say Y here to include the FAST floating point emulator in the kernel.
615 This is an experimental much faster emulator which now also has full 649 This is an experimental much faster emulator which now also has full
@@ -641,6 +675,7 @@ source "fs/Kconfig.binfmt"
641 675
642config ARTHUR 676config ARTHUR
643 tristate "RISC OS personality" 677 tristate "RISC OS personality"
678 depends on !AEABI
644 help 679 help
645 Say Y here to include the kernel code necessary if you want to run 680 Say Y here to include the kernel code necessary if you want to run
646 Acorn RISC OS/Arthur binaries under Linux. This code is still very 681 Acorn RISC OS/Arthur binaries under Linux. This code is still very
@@ -656,7 +691,6 @@ source "kernel/power/Kconfig"
656 691
657config APM 692config APM
658 tristate "Advanced Power Management Emulation" 693 tristate "Advanced Power Management Emulation"
659 depends on PM_LEGACY
660 ---help--- 694 ---help---
661 APM is a BIOS specification for saving power using several different 695 APM is a BIOS specification for saving power using several different
662 techniques. This is mostly useful for battery powered laptops with 696 techniques. This is mostly useful for battery powered laptops with
@@ -730,6 +764,8 @@ source "drivers/char/Kconfig"
730 764
731source "drivers/i2c/Kconfig" 765source "drivers/i2c/Kconfig"
732 766
767source "drivers/spi/Kconfig"
768
733source "drivers/hwmon/Kconfig" 769source "drivers/hwmon/Kconfig"
734 770
735#source "drivers/l3/Kconfig" 771#source "drivers/l3/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 81bd2193fe6d..fbfc14a56b96 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -8,7 +8,7 @@
8# Copyright (C) 1995-2001 by Russell King 8# Copyright (C) 1995-2001 by Russell King
9 9
10LDFLAGS_vmlinux :=-p --no-undefined -X 10LDFLAGS_vmlinux :=-p --no-undefined -X
11CPPFLAGS_vmlinux.lds = -DKERNEL_RAM_ADDR=$(TEXTADDR) 11CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
12OBJCOPYFLAGS :=-O binary -R .note -R .comment -S 12OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
13GZFLAGS :=-9 13GZFLAGS :=-9
14#CFLAGS +=-pipe 14#CFLAGS +=-pipe
@@ -56,8 +56,13 @@ tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100
56tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale 56tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
57tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) 57tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
58 58
59# Need -Uarm for gcc < 3.x 59ifeq ($(CONFIG_AEABI),y)
60CFLAGS_ABI :=-mabi=aapcs -mno-thumb-interwork
61else
60CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,) 62CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
63endif
64
65# Need -Uarm for gcc < 3.x
61CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm 66CFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) $(call cc-option,-mshort-load-bytes,$(call cc-option,-malignment-traps,)) -msoft-float -Uarm
62AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float 67AFLAGS +=$(CFLAGS_ABI) $(arch-y) $(tune-y) -msoft-float
63 68
@@ -65,7 +70,7 @@ CHECKFLAGS += -D__arm__
65 70
66#Default value 71#Default value
67head-y := arch/arm/kernel/head.o arch/arm/kernel/init_task.o 72head-y := arch/arm/kernel/head.o arch/arm/kernel/init_task.o
68textaddr-y := 0xC0008000 73textofs-y := 0x00008000
69 74
70 machine-$(CONFIG_ARCH_RPC) := rpc 75 machine-$(CONFIG_ARCH_RPC) := rpc
71 machine-$(CONFIG_ARCH_EBSA110) := ebsa110 76 machine-$(CONFIG_ARCH_EBSA110) := ebsa110
@@ -73,22 +78,19 @@ textaddr-y := 0xC0008000
73 incdir-$(CONFIG_ARCH_CLPS7500) := cl7500 78 incdir-$(CONFIG_ARCH_CLPS7500) := cl7500
74 machine-$(CONFIG_FOOTBRIDGE) := footbridge 79 machine-$(CONFIG_FOOTBRIDGE) := footbridge
75 incdir-$(CONFIG_FOOTBRIDGE) := ebsa285 80 incdir-$(CONFIG_FOOTBRIDGE) := ebsa285
76textaddr-$(CONFIG_ARCH_CO285) := 0x60008000
77 machine-$(CONFIG_ARCH_CO285) := footbridge 81 machine-$(CONFIG_ARCH_CO285) := footbridge
78 incdir-$(CONFIG_ARCH_CO285) := ebsa285 82 incdir-$(CONFIG_ARCH_CO285) := ebsa285
79 machine-$(CONFIG_ARCH_SHARK) := shark 83 machine-$(CONFIG_ARCH_SHARK) := shark
80 machine-$(CONFIG_ARCH_SA1100) := sa1100 84 machine-$(CONFIG_ARCH_SA1100) := sa1100
81ifeq ($(CONFIG_ARCH_SA1100),y) 85ifeq ($(CONFIG_ARCH_SA1100),y)
82# SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory 86# SA1111 DMA bug: we don't want the kernel to live in precious DMA-able memory
83textaddr-$(CONFIG_SA1111) := 0xc0208000 87 textofs-$(CONFIG_SA1111) := 0x00208000
84endif 88endif
85 machine-$(CONFIG_ARCH_PXA) := pxa 89 machine-$(CONFIG_ARCH_PXA) := pxa
86 machine-$(CONFIG_ARCH_L7200) := l7200 90 machine-$(CONFIG_ARCH_L7200) := l7200
87 machine-$(CONFIG_ARCH_INTEGRATOR) := integrator 91 machine-$(CONFIG_ARCH_INTEGRATOR) := integrator
88 machine-$(CONFIG_ARCH_CAMELOT) := epxa10db 92 textofs-$(CONFIG_ARCH_CLPS711X) := 0x00028000
89textaddr-$(CONFIG_ARCH_CLPS711X) := 0xc0028000
90 machine-$(CONFIG_ARCH_CLPS711X) := clps711x 93 machine-$(CONFIG_ARCH_CLPS711X) := clps711x
91textaddr-$(CONFIG_ARCH_FORTUNET) := 0xc0008000
92 machine-$(CONFIG_ARCH_IOP3XX) := iop3xx 94 machine-$(CONFIG_ARCH_IOP3XX) := iop3xx
93 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx 95 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
94 machine-$(CONFIG_ARCH_IXP2000) := ixp2000 96 machine-$(CONFIG_ARCH_IXP2000) := ixp2000
@@ -102,6 +104,7 @@ textaddr-$(CONFIG_ARCH_FORTUNET) := 0xc0008000
102 machine-$(CONFIG_ARCH_H720X) := h720x 104 machine-$(CONFIG_ARCH_H720X) := h720x
103 machine-$(CONFIG_ARCH_AAEC2000) := aaec2000 105 machine-$(CONFIG_ARCH_AAEC2000) := aaec2000
104 machine-$(CONFIG_ARCH_REALVIEW) := realview 106 machine-$(CONFIG_ARCH_REALVIEW) := realview
107 machine-$(CONFIG_ARCH_AT91RM9200) := at91rm9200
105 108
106ifeq ($(CONFIG_ARCH_EBSA110),y) 109ifeq ($(CONFIG_ARCH_EBSA110),y)
107# This is what happens if you forget the IOCS16 line. 110# This is what happens if you forget the IOCS16 line.
@@ -110,7 +113,8 @@ CFLAGS_3c589_cs.o :=-DISA_SIXTEEN_BIT_PERIPHERAL
110export CFLAGS_3c589_cs.o 113export CFLAGS_3c589_cs.o
111endif 114endif
112 115
113TEXTADDR := $(textaddr-y) 116# The byte offset of the kernel image in RAM from the start of RAM.
117TEXT_OFFSET := $(textofs-y)
114 118
115ifeq ($(incdir-y),) 119ifeq ($(incdir-y),)
116incdir-y := $(machine-y) 120incdir-y := $(machine-y)
@@ -123,7 +127,7 @@ else
123MACHINE := 127MACHINE :=
124endif 128endif
125 129
126export TEXTADDR GZFLAGS 130export TEXT_OFFSET GZFLAGS
127 131
128# Do we have FASTFPE? 132# Do we have FASTFPE?
129FASTFPE :=arch/arm/fastfpe 133FASTFPE :=arch/arm/fastfpe
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 937a353bc37c..a174d63395ea 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -15,7 +15,7 @@ include $(srctree)/$(MACHINE)/Makefile.boot
15endif 15endif
16 16
17# Note: the following conditions must always be true: 17# Note: the following conditions must always be true:
18# ZRELADDR == virt_to_phys(TEXTADDR) 18# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
19# PARAMS_PHYS must be within 4MB of ZRELADDR 19# PARAMS_PHYS must be within 4MB of ZRELADDR
20# INITRD_PHYS must be in RAM 20# INITRD_PHYS must be in RAM
21ZRELADDR := $(zreladdr-y) 21ZRELADDR := $(zreladdr-y)
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 6b505ce41a75..35ffe0f4ece7 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -21,10 +21,6 @@ ifeq ($(CONFIG_ARCH_SHARK),y)
21OBJS += head-shark.o ofw-shark.o 21OBJS += head-shark.o ofw-shark.o
22endif 22endif
23 23
24ifeq ($(CONFIG_ARCH_CAMELOT),y)
25OBJS += head-epxa10db.o
26endif
27
28ifeq ($(CONFIG_ARCH_L7200),y) 24ifeq ($(CONFIG_ARCH_L7200),y)
29OBJS += head-l7200.o 25OBJS += head-l7200.o
30endif 26endif
@@ -50,6 +46,10 @@ ifeq ($(CONFIG_PXA_SHARPSL),y)
50OBJS += head-sharpsl.o 46OBJS += head-sharpsl.o
51endif 47endif
52 48
49ifeq ($(CONFIG_ARCH_AT91RM9200),y)
50OBJS += head-at91rm9200.o
51endif
52
53ifeq ($(CONFIG_DEBUG_ICEDCC),y) 53ifeq ($(CONFIG_DEBUG_ICEDCC),y)
54OBJS += ice-dcc.o 54OBJS += ice-dcc.o
55endif 55endif
diff --git a/arch/arm/boot/compressed/head-at91rm9200.S b/arch/arm/boot/compressed/head-at91rm9200.S
new file mode 100644
index 000000000000..2119ea62b547
--- /dev/null
+++ b/arch/arm/boot/compressed/head-at91rm9200.S
@@ -0,0 +1,57 @@
1/*
2 * linux/arch/arm/boot/compressed/head-at91rm9200.S
3 *
4 * Copyright (C) 2003 SAN People
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12#include <asm/mach-types.h>
13
14 .section ".start", "ax"
15
16 @ Atmel AT91RM9200-DK : 262
17 mov r3, #(MACH_TYPE_AT91RM9200DK & 0xff)
18 orr r3, r3, #(MACH_TYPE_AT91RM9200DK & 0xff00)
19 cmp r7, r3
20 beq 99f
21
22 @ Cogent CSB337 : 399
23 mov r3, #(MACH_TYPE_CSB337 & 0xff)
24 orr r3, r3, #(MACH_TYPE_CSB337 & 0xff00)
25 cmp r7, r3
26 beq 99f
27
28 @ Cogent CSB637 : 648
29 mov r3, #(MACH_TYPE_CSB637 & 0xff)
30 orr r3, r3, #(MACH_TYPE_CSB637 & 0xff00)
31 cmp r7, r3
32 beq 99f
33
34 @ Atmel AT91RM9200-EK : 705
35 mov r3, #(MACH_TYPE_AT91RM9200EK & 0xff)
36 orr r3, r3, #(MACH_TYPE_AT91RM9200EK & 0xff00)
37 cmp r7, r3
38 beq 99f
39
40 @ Conitec Carmeva : 769
41 mov r3, #(MACH_TYPE_CARMEVA & 0xff)
42 orr r3, r3, #(MACH_TYPE_CARMEVA & 0xff00)
43 cmp r7, r3
44 beq 99f
45
46 @ KwikByte KB920x : 612
47 mov r3, #(MACH_TYPE_KB9200 & 0xff)
48 orr r3, r3, #(MACH_TYPE_KB9200 & 0xff00)
49 cmp r7, r3
50 beq 99f
51
52 @ Unknown board, use the AT91RM9200DK board
53 @ mov r7, #MACH_TYPE_AT91RM9200
54 mov r7, #(MACH_TYPE_AT91RM9200DK & 0xff)
55 orr r7, r7, #(MACH_TYPE_AT91RM9200DK & 0xff00)
56
5799:
diff --git a/arch/arm/boot/compressed/head-epxa10db.S b/arch/arm/boot/compressed/head-epxa10db.S
deleted file mode 100644
index 757681f12a39..000000000000
--- a/arch/arm/boot/compressed/head-epxa10db.S
+++ /dev/null
@@ -1,5 +0,0 @@
1#include <asm/mach-types.h>
2#include <asm/arch/excalibur.h>
3
4 .section ".start", "ax"
5 mov r7, #MACH_TYPE_CAMELOT
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index 6abafb6f1844..db3389d8e027 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -84,7 +84,7 @@
84 kputc #'\n' 84 kputc #'\n'
85 kphex r5, 8 /* decompressed kernel start */ 85 kphex r5, 8 /* decompressed kernel start */
86 kputc #'-' 86 kputc #'-'
87 kphex r8, 8 /* decompressed kernel end */ 87 kphex r9, 8 /* decompressed kernel end */
88 kputc #'>' 88 kputc #'>'
89 kphex r4, 8 /* kernel execution address */ 89 kphex r4, 8 /* kernel execution address */
90 kputc #'\n' 90 kputc #'\n'
@@ -116,7 +116,7 @@ start:
116 .word start @ absolute load/run zImage address 116 .word start @ absolute load/run zImage address
117 .word _edata @ zImage end address 117 .word _edata @ zImage end address
1181: mov r7, r1 @ save architecture ID 1181: mov r7, r1 @ save architecture ID
119 mov r8, #0 @ save r0 119 mov r8, r2 @ save atags pointer
120 120
121#ifndef __ARM_ARCH_2__ 121#ifndef __ARM_ARCH_2__
122 /* 122 /*
@@ -144,7 +144,7 @@ not_angel:
144 144
145 /* 145 /*
146 * some architecture specific code can be inserted 146 * some architecture specific code can be inserted
147 * by the linker here, but it should preserve r7 and r8. 147 * by the linker here, but it should preserve r7, r8, and r9.
148 */ 148 */
149 149
150 .text 150 .text
@@ -249,16 +249,17 @@ not_relocated: mov r0, #0
249 * r5 = decompressed kernel start 249 * r5 = decompressed kernel start
250 * r6 = processor ID 250 * r6 = processor ID
251 * r7 = architecture ID 251 * r7 = architecture ID
252 * r8-r14 = unused 252 * r8 = atags pointer
253 * r9-r14 = corrupted
253 */ 254 */
254 add r1, r5, r0 @ end of decompressed kernel 255 add r1, r5, r0 @ end of decompressed kernel
255 adr r2, reloc_start 256 adr r2, reloc_start
256 ldr r3, LC1 257 ldr r3, LC1
257 add r3, r2, r3 258 add r3, r2, r3
2581: ldmia r2!, {r8 - r13} @ copy relocation code 2591: ldmia r2!, {r9 - r14} @ copy relocation code
259 stmia r1!, {r8 - r13} 260 stmia r1!, {r9 - r14}
260 ldmia r2!, {r8 - r13} 261 ldmia r2!, {r9 - r14}
261 stmia r1!, {r8 - r13} 262 stmia r1!, {r9 - r14}
262 cmp r2, r3 263 cmp r2, r3
263 blo 1b 264 blo 1b
264 265
@@ -308,11 +309,12 @@ params: ldr r0, =params_phys
308 * r4 = kernel execution address 309 * r4 = kernel execution address
309 * r6 = processor ID 310 * r6 = processor ID
310 * r7 = architecture number 311 * r7 = architecture number
311 * r8 = run-time address of "start" 312 * r8 = atags pointer
313 * r9 = run-time address of "start" (???)
312 * On exit, 314 * On exit,
313 * r1, r2, r3, r8, r9, r12 corrupted 315 * r1, r2, r3, r9, r10, r12 corrupted
314 * This routine must preserve: 316 * This routine must preserve:
315 * r4, r5, r6, r7 317 * r4, r5, r6, r7, r8
316 */ 318 */
317 .align 5 319 .align 5
318cache_on: mov r3, #8 @ cache_on function 320cache_on: mov r3, #8 @ cache_on function
@@ -326,15 +328,15 @@ __setup_mmu: sub r3, r4, #16384 @ Page directory size
326 * bits for the RAM area only. 328 * bits for the RAM area only.
327 */ 329 */
328 mov r0, r3 330 mov r0, r3
329 mov r8, r0, lsr #18 331 mov r9, r0, lsr #18
330 mov r8, r8, lsl #18 @ start of RAM 332 mov r9, r9, lsl #18 @ start of RAM
331 add r9, r8, #0x10000000 @ a reasonable RAM size 333 add r10, r9, #0x10000000 @ a reasonable RAM size
332 mov r1, #0x12 334 mov r1, #0x12
333 orr r1, r1, #3 << 10 335 orr r1, r1, #3 << 10
334 add r2, r3, #16384 336 add r2, r3, #16384
3351: cmp r1, r8 @ if virt > start of RAM 3371: cmp r1, r9 @ if virt > start of RAM
336 orrhs r1, r1, #0x0c @ set cacheable, bufferable 338 orrhs r1, r1, #0x0c @ set cacheable, bufferable
337 cmp r1, r9 @ if virt > end of RAM 339 cmp r1, r10 @ if virt > end of RAM
338 bichs r1, r1, #0x0c @ clear cacheable, bufferable 340 bichs r1, r1, #0x0c @ clear cacheable, bufferable
339 str r1, [r0], #4 @ 1:1 mapping 341 str r1, [r0], #4 @ 1:1 mapping
340 add r1, r1, #1048576 342 add r1, r1, #1048576
@@ -403,26 +405,28 @@ __common_cache_on:
403 * r5 = decompressed kernel start 405 * r5 = decompressed kernel start
404 * r6 = processor ID 406 * r6 = processor ID
405 * r7 = architecture ID 407 * r7 = architecture ID
406 * r8-r14 = unused 408 * r8 = atags pointer
409 * r9-r14 = corrupted
407 */ 410 */
408 .align 5 411 .align 5
409reloc_start: add r8, r5, r0 412reloc_start: add r9, r5, r0
410 debug_reloc_start 413 debug_reloc_start
411 mov r1, r4 414 mov r1, r4
4121: 4151:
413 .rept 4 416 .rept 4
414 ldmia r5!, {r0, r2, r3, r9 - r13} @ relocate kernel 417 ldmia r5!, {r0, r2, r3, r10 - r14} @ relocate kernel
415 stmia r1!, {r0, r2, r3, r9 - r13} 418 stmia r1!, {r0, r2, r3, r10 - r14}
416 .endr 419 .endr
417 420
418 cmp r5, r8 421 cmp r5, r9
419 blo 1b 422 blo 1b
420 debug_reloc_end 423 debug_reloc_end
421 424
422call_kernel: bl cache_clean_flush 425call_kernel: bl cache_clean_flush
423 bl cache_off 426 bl cache_off
424 mov r0, #0 427 mov r0, #0 @ must be zero
425 mov r1, r7 @ restore architecture number 428 mov r1, r7 @ restore architecture number
429 mov r2, r8 @ restore atags pointer
426 mov pc, r4 @ call kernel 430 mov pc, r4 @ call kernel
427 431
428/* 432/*
diff --git a/arch/arm/common/Kconfig b/arch/arm/common/Kconfig
index 666ba393575b..5e34ca6d38b6 100644
--- a/arch/arm/common/Kconfig
+++ b/arch/arm/common/Kconfig
@@ -1,7 +1,10 @@
1config ICST525 1config ARM_GIC
2 bool 2 bool
3 3
4config ARM_GIC 4config ARM_VIC
5 bool
6
7config ICST525
5 bool 8 bool
6 9
7config ICST307 10config ICST307
@@ -23,5 +26,8 @@ config SHARP_LOCOMO
23config SHARP_PARAM 26config SHARP_PARAM
24 bool 27 bool
25 28
29config SHARPSL_PM
30 bool
31
26config SHARP_SCOOP 32config SHARP_SCOOP
27 bool 33 bool
diff --git a/arch/arm/common/Makefile b/arch/arm/common/Makefile
index a87886564b19..c81a2ff6b5be 100644
--- a/arch/arm/common/Makefile
+++ b/arch/arm/common/Makefile
@@ -3,8 +3,8 @@
3# 3#
4 4
5obj-y += rtctime.o 5obj-y += rtctime.o
6obj-$(CONFIG_ARM_AMBA) += amba.o
7obj-$(CONFIG_ARM_GIC) += gic.o 6obj-$(CONFIG_ARM_GIC) += gic.o
7obj-$(CONFIG_ARM_VIC) += vic.o
8obj-$(CONFIG_ICST525) += icst525.o 8obj-$(CONFIG_ICST525) += icst525.o
9obj-$(CONFIG_ICST307) += icst307.o 9obj-$(CONFIG_ICST307) += icst307.o
10obj-$(CONFIG_SA1111) += sa1111.o 10obj-$(CONFIG_SA1111) += sa1111.o
@@ -13,4 +13,5 @@ obj-$(CONFIG_DMABOUNCE) += dmabounce.o
13obj-$(CONFIG_TIMER_ACORN) += time-acorn.o 13obj-$(CONFIG_TIMER_ACORN) += time-acorn.o
14obj-$(CONFIG_SHARP_LOCOMO) += locomo.o 14obj-$(CONFIG_SHARP_LOCOMO) += locomo.o
15obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o 15obj-$(CONFIG_SHARP_PARAM) += sharpsl_param.o
16obj-$(CONFIG_SHARPSL_PM) += sharpsl_pm.o
16obj-$(CONFIG_SHARP_SCOOP) += scoop.o 17obj-$(CONFIG_SHARP_SCOOP) += scoop.o
diff --git a/arch/arm/common/amba.c b/arch/arm/common/amba.c
deleted file mode 100644
index e1013112c354..000000000000
--- a/arch/arm/common/amba.c
+++ /dev/null
@@ -1,359 +0,0 @@
1/*
2 * linux/arch/arm/common/amba.c
3 *
4 * Copyright (C) 2003 Deep Blue Solutions Ltd, All Rights Reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/device.h>
13#include <linux/string.h>
14#include <linux/slab.h>
15
16#include <asm/io.h>
17#include <asm/irq.h>
18#include <asm/hardware/amba.h>
19#include <asm/sizes.h>
20
21#define to_amba_device(d) container_of(d, struct amba_device, dev)
22#define to_amba_driver(d) container_of(d, struct amba_driver, drv)
23
24static struct amba_id *
25amba_lookup(struct amba_id *table, struct amba_device *dev)
26{
27 int ret = 0;
28
29 while (table->mask) {
30 ret = (dev->periphid & table->mask) == table->id;
31 if (ret)
32 break;
33 table++;
34 }
35
36 return ret ? table : NULL;
37}
38
39static int amba_match(struct device *dev, struct device_driver *drv)
40{
41 struct amba_device *pcdev = to_amba_device(dev);
42 struct amba_driver *pcdrv = to_amba_driver(drv);
43
44 return amba_lookup(pcdrv->id_table, pcdev) != NULL;
45}
46
47#ifdef CONFIG_HOTPLUG
48static int amba_hotplug(struct device *dev, char **envp, int nr_env, char *buf, int bufsz)
49{
50 struct amba_device *pcdev = to_amba_device(dev);
51
52 if (nr_env < 2)
53 return -ENOMEM;
54
55 snprintf(buf, bufsz, "AMBA_ID=%08x", pcdev->periphid);
56 *envp++ = buf;
57 *envp++ = NULL;
58 return 0;
59}
60#else
61#define amba_hotplug NULL
62#endif
63
64static int amba_suspend(struct device *dev, pm_message_t state)
65{
66 struct amba_driver *drv = to_amba_driver(dev->driver);
67 int ret = 0;
68
69 if (dev->driver && drv->suspend)
70 ret = drv->suspend(to_amba_device(dev), state);
71 return ret;
72}
73
74static int amba_resume(struct device *dev)
75{
76 struct amba_driver *drv = to_amba_driver(dev->driver);
77 int ret = 0;
78
79 if (dev->driver && drv->resume)
80 ret = drv->resume(to_amba_device(dev));
81 return ret;
82}
83
84/*
85 * Primecells are part of the Advanced Microcontroller Bus Architecture,
86 * so we call the bus "amba".
87 */
88static struct bus_type amba_bustype = {
89 .name = "amba",
90 .match = amba_match,
91 .hotplug = amba_hotplug,
92 .suspend = amba_suspend,
93 .resume = amba_resume,
94};
95
96static int __init amba_init(void)
97{
98 return bus_register(&amba_bustype);
99}
100
101postcore_initcall(amba_init);
102
103/*
104 * These are the device model conversion veneers; they convert the
105 * device model structures to our more specific structures.
106 */
107static int amba_probe(struct device *dev)
108{
109 struct amba_device *pcdev = to_amba_device(dev);
110 struct amba_driver *pcdrv = to_amba_driver(dev->driver);
111 struct amba_id *id;
112
113 id = amba_lookup(pcdrv->id_table, pcdev);
114
115 return pcdrv->probe(pcdev, id);
116}
117
118static int amba_remove(struct device *dev)
119{
120 struct amba_driver *drv = to_amba_driver(dev->driver);
121 return drv->remove(to_amba_device(dev));
122}
123
124static void amba_shutdown(struct device *dev)
125{
126 struct amba_driver *drv = to_amba_driver(dev->driver);
127 drv->shutdown(to_amba_device(dev));
128}
129
130/**
131 * amba_driver_register - register an AMBA device driver
132 * @drv: amba device driver structure
133 *
134 * Register an AMBA device driver with the Linux device model
135 * core. If devices pre-exist, the drivers probe function will
136 * be called.
137 */
138int amba_driver_register(struct amba_driver *drv)
139{
140 drv->drv.bus = &amba_bustype;
141
142#define SETFN(fn) if (drv->fn) drv->drv.fn = amba_##fn
143 SETFN(probe);
144 SETFN(remove);
145 SETFN(shutdown);
146
147 return driver_register(&drv->drv);
148}
149
150/**
151 * amba_driver_unregister - remove an AMBA device driver
152 * @drv: AMBA device driver structure to remove
153 *
154 * Unregister an AMBA device driver from the Linux device
155 * model. The device model will call the drivers remove function
156 * for each device the device driver is currently handling.
157 */
158void amba_driver_unregister(struct amba_driver *drv)
159{
160 driver_unregister(&drv->drv);
161}
162
163
164static void amba_device_release(struct device *dev)
165{
166 struct amba_device *d = to_amba_device(dev);
167
168 if (d->res.parent)
169 release_resource(&d->res);
170 kfree(d);
171}
172
173#define amba_attr(name,fmt,arg...) \
174static ssize_t show_##name(struct device *_dev, struct device_attribute *attr, char *buf) \
175{ \
176 struct amba_device *dev = to_amba_device(_dev); \
177 return sprintf(buf, fmt, arg); \
178} \
179static DEVICE_ATTR(name, S_IRUGO, show_##name, NULL)
180
181amba_attr(id, "%08x\n", dev->periphid);
182amba_attr(irq0, "%u\n", dev->irq[0]);
183amba_attr(irq1, "%u\n", dev->irq[1]);
184amba_attr(resource, "\t%08lx\t%08lx\t%08lx\n",
185 dev->res.start, dev->res.end, dev->res.flags);
186
187/**
188 * amba_device_register - register an AMBA device
189 * @dev: AMBA device to register
190 * @parent: parent memory resource
191 *
192 * Setup the AMBA device, reading the cell ID if present.
193 * Claim the resource, and register the AMBA device with
194 * the Linux device manager.
195 */
196int amba_device_register(struct amba_device *dev, struct resource *parent)
197{
198 u32 pid, cid;
199 void __iomem *tmp;
200 int i, ret;
201
202 dev->dev.release = amba_device_release;
203 dev->dev.bus = &amba_bustype;
204 dev->dev.dma_mask = &dev->dma_mask;
205 dev->res.name = dev->dev.bus_id;
206
207 if (!dev->dev.coherent_dma_mask && dev->dma_mask)
208 dev_warn(&dev->dev, "coherent dma mask is unset\n");
209
210 ret = request_resource(parent, &dev->res);
211 if (ret == 0) {
212 tmp = ioremap(dev->res.start, SZ_4K);
213 if (!tmp) {
214 ret = -ENOMEM;
215 goto out;
216 }
217
218 for (pid = 0, i = 0; i < 4; i++)
219 pid |= (readl(tmp + 0xfe0 + 4 * i) & 255) << (i * 8);
220 for (cid = 0, i = 0; i < 4; i++)
221 cid |= (readl(tmp + 0xff0 + 4 * i) & 255) << (i * 8);
222
223 iounmap(tmp);
224
225 if (cid == 0xb105f00d)
226 dev->periphid = pid;
227
228 if (dev->periphid)
229 ret = device_register(&dev->dev);
230 else
231 ret = -ENODEV;
232
233 if (ret == 0) {
234 device_create_file(&dev->dev, &dev_attr_id);
235 if (dev->irq[0] != NO_IRQ)
236 device_create_file(&dev->dev, &dev_attr_irq0);
237 if (dev->irq[1] != NO_IRQ)
238 device_create_file(&dev->dev, &dev_attr_irq1);
239 device_create_file(&dev->dev, &dev_attr_resource);
240 } else {
241 out:
242 release_resource(&dev->res);
243 }
244 }
245 return ret;
246}
247
248/**
249 * amba_device_unregister - unregister an AMBA device
250 * @dev: AMBA device to remove
251 *
252 * Remove the specified AMBA device from the Linux device
253 * manager. All files associated with this object will be
254 * destroyed, and device drivers notified that the device has
255 * been removed. The AMBA device's resources including
256 * the amba_device structure will be freed once all
257 * references to it have been dropped.
258 */
259void amba_device_unregister(struct amba_device *dev)
260{
261 device_unregister(&dev->dev);
262}
263
264
265struct find_data {
266 struct amba_device *dev;
267 struct device *parent;
268 const char *busid;
269 unsigned int id;
270 unsigned int mask;
271};
272
273static int amba_find_match(struct device *dev, void *data)
274{
275 struct find_data *d = data;
276 struct amba_device *pcdev = to_amba_device(dev);
277 int r;
278
279 r = (pcdev->periphid & d->mask) == d->id;
280 if (d->parent)
281 r &= d->parent == dev->parent;
282 if (d->busid)
283 r &= strcmp(dev->bus_id, d->busid) == 0;
284
285 if (r) {
286 get_device(dev);
287 d->dev = pcdev;
288 }
289
290 return r;
291}
292
293/**
294 * amba_find_device - locate an AMBA device given a bus id
295 * @busid: bus id for device (or NULL)
296 * @parent: parent device (or NULL)
297 * @id: peripheral ID (or 0)
298 * @mask: peripheral ID mask (or 0)
299 *
300 * Return the AMBA device corresponding to the supplied parameters.
301 * If no device matches, returns NULL.
302 *
303 * NOTE: When a valid device is found, its refcount is
304 * incremented, and must be decremented before the returned
305 * reference.
306 */
307struct amba_device *
308amba_find_device(const char *busid, struct device *parent, unsigned int id,
309 unsigned int mask)
310{
311 struct find_data data;
312
313 data.dev = NULL;
314 data.parent = parent;
315 data.busid = busid;
316 data.id = id;
317 data.mask = mask;
318
319 bus_for_each_dev(&amba_bustype, NULL, &data, amba_find_match);
320
321 return data.dev;
322}
323
324/**
325 * amba_request_regions - request all mem regions associated with device
326 * @dev: amba_device structure for device
327 * @name: name, or NULL to use driver name
328 */
329int amba_request_regions(struct amba_device *dev, const char *name)
330{
331 int ret = 0;
332
333 if (!name)
334 name = dev->dev.driver->name;
335
336 if (!request_mem_region(dev->res.start, SZ_4K, name))
337 ret = -EBUSY;
338
339 return ret;
340}
341
342/**
343 * amba_release_regions - release mem regions assoicated with device
344 * @dev: amba_device structure for device
345 *
346 * Release regions claimed by a successful call to amba_request_regions.
347 */
348void amba_release_regions(struct amba_device *dev)
349{
350 release_mem_region(dev->res.start, SZ_4K);
351}
352
353EXPORT_SYMBOL(amba_driver_register);
354EXPORT_SYMBOL(amba_driver_unregister);
355EXPORT_SYMBOL(amba_device_register);
356EXPORT_SYMBOL(amba_device_unregister);
357EXPORT_SYMBOL(amba_find_device);
358EXPORT_SYMBOL(amba_request_regions);
359EXPORT_SYMBOL(amba_release_regions);
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
index 1b7eaab02b9e..159ad7ed7a40 100644
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -1103,14 +1103,14 @@ static int locomo_bus_remove(struct device *dev)
1103struct bus_type locomo_bus_type = { 1103struct bus_type locomo_bus_type = {
1104 .name = "locomo-bus", 1104 .name = "locomo-bus",
1105 .match = locomo_match, 1105 .match = locomo_match,
1106 .probe = locomo_bus_probe,
1107 .remove = locomo_bus_remove,
1106 .suspend = locomo_bus_suspend, 1108 .suspend = locomo_bus_suspend,
1107 .resume = locomo_bus_resume, 1109 .resume = locomo_bus_resume,
1108}; 1110};
1109 1111
1110int locomo_driver_register(struct locomo_driver *driver) 1112int locomo_driver_register(struct locomo_driver *driver)
1111{ 1113{
1112 driver->drv.probe = locomo_bus_probe;
1113 driver->drv.remove = locomo_bus_remove;
1114 driver->drv.bus = &locomo_bus_type; 1114 driver->drv.bus = &locomo_bus_type;
1115 return driver_register(&driver->drv); 1115 return driver_register(&driver->drv);
1116} 1116}
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c
index 72b03f201eb9..48b1e19b131f 100644
--- a/arch/arm/common/rtctime.c
+++ b/arch/arm/common/rtctime.c
@@ -17,7 +17,9 @@
17#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
18#include <linux/miscdevice.h> 18#include <linux/miscdevice.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
20#include <linux/capability.h>
20#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/mutex.h>
21 23
22#include <asm/rtc.h> 24#include <asm/rtc.h>
23#include <asm/semaphore.h> 25#include <asm/semaphore.h>
@@ -34,7 +36,7 @@ static unsigned long rtc_irq_data;
34/* 36/*
35 * rtc_sem protects rtc_inuse and rtc_ops 37 * rtc_sem protects rtc_inuse and rtc_ops
36 */ 38 */
37static DECLARE_MUTEX(rtc_sem); 39static DEFINE_MUTEX(rtc_mutex);
38static unsigned long rtc_inuse; 40static unsigned long rtc_inuse;
39static struct rtc_ops *rtc_ops; 41static struct rtc_ops *rtc_ops;
40 42
@@ -355,7 +357,7 @@ static int rtc_open(struct inode *inode, struct file *file)
355{ 357{
356 int ret; 358 int ret;
357 359
358 down(&rtc_sem); 360 mutex_lock(&rtc_mutex);
359 361
360 if (rtc_inuse) { 362 if (rtc_inuse) {
361 ret = -EBUSY; 363 ret = -EBUSY;
@@ -373,7 +375,7 @@ static int rtc_open(struct inode *inode, struct file *file)
373 rtc_inuse = 1; 375 rtc_inuse = 1;
374 } 376 }
375 } 377 }
376 up(&rtc_sem); 378 mutex_unlock(&rtc_mutex);
377 379
378 return ret; 380 return ret;
379} 381}
@@ -479,7 +481,7 @@ int register_rtc(struct rtc_ops *ops)
479{ 481{
480 int ret = -EBUSY; 482 int ret = -EBUSY;
481 483
482 down(&rtc_sem); 484 mutex_lock(&rtc_mutex);
483 if (rtc_ops == NULL) { 485 if (rtc_ops == NULL) {
484 rtc_ops = ops; 486 rtc_ops = ops;
485 487
@@ -488,7 +490,7 @@ int register_rtc(struct rtc_ops *ops)
488 create_proc_read_entry("driver/rtc", 0, NULL, 490 create_proc_read_entry("driver/rtc", 0, NULL,
489 rtc_read_proc, ops); 491 rtc_read_proc, ops);
490 } 492 }
491 up(&rtc_sem); 493 mutex_unlock(&rtc_mutex);
492 494
493 return ret; 495 return ret;
494} 496}
@@ -496,12 +498,12 @@ EXPORT_SYMBOL(register_rtc);
496 498
497void unregister_rtc(struct rtc_ops *rtc) 499void unregister_rtc(struct rtc_ops *rtc)
498{ 500{
499 down(&rtc_sem); 501 mutex_lock(&rtc_mutex);
500 if (rtc == rtc_ops) { 502 if (rtc == rtc_ops) {
501 remove_proc_entry("driver/rtc", NULL); 503 remove_proc_entry("driver/rtc", NULL);
502 misc_deregister(&rtc_miscdev); 504 misc_deregister(&rtc_miscdev);
503 rtc_ops = NULL; 505 rtc_ops = NULL;
504 } 506 }
505 up(&rtc_sem); 507 mutex_unlock(&rtc_mutex);
506} 508}
507EXPORT_SYMBOL(unregister_rtc); 509EXPORT_SYMBOL(unregister_rtc);
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index d0d6e6d2d649..1475089f9b42 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -1247,14 +1247,14 @@ static int sa1111_bus_remove(struct device *dev)
1247struct bus_type sa1111_bus_type = { 1247struct bus_type sa1111_bus_type = {
1248 .name = "sa1111-rab", 1248 .name = "sa1111-rab",
1249 .match = sa1111_match, 1249 .match = sa1111_match,
1250 .probe = sa1111_bus_probe,
1251 .remove = sa1111_bus_remove,
1250 .suspend = sa1111_bus_suspend, 1252 .suspend = sa1111_bus_suspend,
1251 .resume = sa1111_bus_resume, 1253 .resume = sa1111_bus_resume,
1252}; 1254};
1253 1255
1254int sa1111_driver_register(struct sa1111_driver *driver) 1256int sa1111_driver_register(struct sa1111_driver *driver)
1255{ 1257{
1256 driver->drv.probe = sa1111_bus_probe;
1257 driver->drv.remove = sa1111_bus_remove;
1258 driver->drv.bus = &sa1111_bus_type; 1258 driver->drv.bus = &sa1111_bus_type;
1259 return driver_register(&driver->drv); 1259 return driver_register(&driver->drv);
1260} 1260}
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index 0c3cbd9a388b..a2dfe0b0f1ec 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/string.h> 15#include <linux/string.h>
16#include <linux/slab.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <asm/io.h> 18#include <asm/io.h>
18#include <asm/hardware/scoop.h> 19#include <asm/hardware/scoop.h>
@@ -33,7 +34,6 @@ void reset_scoop(struct device *dev)
33 34
34 SCOOP_REG(sdev->base,SCOOP_MCR) = 0x0100; // 00 35 SCOOP_REG(sdev->base,SCOOP_MCR) = 0x0100; // 00
35 SCOOP_REG(sdev->base,SCOOP_CDR) = 0x0000; // 04 36 SCOOP_REG(sdev->base,SCOOP_CDR) = 0x0000; // 04
36 SCOOP_REG(sdev->base,SCOOP_CPR) = 0x0000; // 0C
37 SCOOP_REG(sdev->base,SCOOP_CCR) = 0x0000; // 10 37 SCOOP_REG(sdev->base,SCOOP_CCR) = 0x0000; // 10
38 SCOOP_REG(sdev->base,SCOOP_IMR) = 0x0000; // 18 38 SCOOP_REG(sdev->base,SCOOP_IMR) = 0x0000; // 18
39 SCOOP_REG(sdev->base,SCOOP_IRM) = 0x00FF; // 14 39 SCOOP_REG(sdev->base,SCOOP_IRM) = 0x00FF; // 14
@@ -154,6 +154,7 @@ int __init scoop_probe(struct platform_device *pdev)
154 154
155 SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140; 155 SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140;
156 reset_scoop(&pdev->dev); 156 reset_scoop(&pdev->dev);
157 SCOOP_REG(devptr->base, SCOOP_CPR) = 0x0000;
157 SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff; 158 SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff;
158 SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff; 159 SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff;
159 160
diff --git a/arch/arm/common/sharpsl_pm.c b/arch/arm/common/sharpsl_pm.c
new file mode 100644
index 000000000000..978d32e82d39
--- /dev/null
+++ b/arch/arm/common/sharpsl_pm.c
@@ -0,0 +1,839 @@
1/*
2 * Battery and Power Management code for the Sharp SL-C7xx and SL-Cxx00
3 * series of PDAs
4 *
5 * Copyright (c) 2004-2005 Richard Purdie
6 *
7 * Based on code written by Sharp for 2.4 kernels
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#undef DEBUG
16
17#include <linux/module.h>
18#include <linux/timer.h>
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <linux/apm_bios.h>
22#include <linux/delay.h>
23#include <linux/interrupt.h>
24#include <linux/platform_device.h>
25
26#include <asm/hardware.h>
27#include <asm/mach-types.h>
28#include <asm/irq.h>
29#include <asm/apm.h>
30#include <asm/arch/pm.h>
31#include <asm/arch/pxa-regs.h>
32#include <asm/arch/sharpsl.h>
33#include <asm/hardware/sharpsl_pm.h>
34
35/*
36 * Constants
37 */
38#define SHARPSL_CHARGE_ON_TIME_INTERVAL (msecs_to_jiffies(1*60*1000)) /* 1 min */
39#define SHARPSL_CHARGE_FINISH_TIME (msecs_to_jiffies(10*60*1000)) /* 10 min */
40#define SHARPSL_BATCHK_TIME (msecs_to_jiffies(15*1000)) /* 15 sec */
41#define SHARPSL_BATCHK_TIME_SUSPEND (60*10) /* 10 min */
42#define SHARPSL_WAIT_CO_TIME 15 /* 15 sec */
43#define SHARPSL_WAIT_DISCHARGE_ON 100 /* 100 msec */
44#define SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP 10 /* 10 msec */
45#define SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT 10 /* 10 msec */
46#define SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN 10 /* 10 msec */
47#define SHARPSL_CHARGE_WAIT_TIME 15 /* 15 msec */
48#define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */
49#define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */
50
51#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */
52#define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */
53#define SHARPSL_CHARGE_ON_ACIN_HIGH 0x9b /* 6V */
54#define SHARPSL_CHARGE_ON_ACIN_LOW 0x34 /* 2V */
55#define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */
56#define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */
57
58/*
59 * Prototypes
60 */
61static int sharpsl_off_charge_battery(void);
62static int sharpsl_check_battery_temp(void);
63static int sharpsl_check_battery_voltage(void);
64static int sharpsl_ac_check(void);
65static int sharpsl_fatal_check(void);
66static int sharpsl_average_value(int ad);
67static void sharpsl_average_clear(void);
68static void sharpsl_charge_toggle(void *private_);
69static void sharpsl_battery_thread(void *private_);
70
71
72/*
73 * Variables
74 */
75struct sharpsl_pm_status sharpsl_pm;
76DECLARE_WORK(toggle_charger, sharpsl_charge_toggle, NULL);
77DECLARE_WORK(sharpsl_bat, sharpsl_battery_thread, NULL);
78
79
80static int get_percentage(int voltage)
81{
82 int i = sharpsl_pm.machinfo->bat_levels - 1;
83 struct battery_thresh *thresh;
84
85 if (sharpsl_pm.charge_mode == CHRG_ON)
86 thresh=sharpsl_pm.machinfo->bat_levels_acin;
87 else
88 thresh=sharpsl_pm.machinfo->bat_levels_noac;
89
90 while (i > 0 && (voltage > thresh[i].voltage))
91 i--;
92
93 return thresh[i].percentage;
94}
95
96static int get_apm_status(int voltage)
97{
98 int low_thresh, high_thresh;
99
100 if (sharpsl_pm.charge_mode == CHRG_ON) {
101 high_thresh = sharpsl_pm.machinfo->status_high_acin;
102 low_thresh = sharpsl_pm.machinfo->status_low_acin;
103 } else {
104 high_thresh = sharpsl_pm.machinfo->status_high_noac;
105 low_thresh = sharpsl_pm.machinfo->status_low_noac;
106 }
107
108 if (voltage >= high_thresh)
109 return APM_BATTERY_STATUS_HIGH;
110 if (voltage >= low_thresh)
111 return APM_BATTERY_STATUS_LOW;
112 return APM_BATTERY_STATUS_CRITICAL;
113}
114
115void sharpsl_battery_kick(void)
116{
117 schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(125));
118}
119EXPORT_SYMBOL(sharpsl_battery_kick);
120
121
122static void sharpsl_battery_thread(void *private_)
123{
124 int voltage, percent, apm_status, i = 0;
125
126 if (!sharpsl_pm.machinfo)
127 return;
128
129 sharpsl_pm.battstat.ac_status = (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN) ? APM_AC_ONLINE : APM_AC_OFFLINE);
130
131 /* Corgi cannot confirm when battery fully charged so periodically kick! */
132 if (machine_is_corgi() && (sharpsl_pm.charge_mode == CHRG_ON)
133 && time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_ON_TIME_INTERVAL))
134 schedule_work(&toggle_charger);
135
136 while(1) {
137 voltage = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
138
139 if (voltage > 0) break;
140 if (i++ > 5) {
141 voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage;
142 dev_warn(sharpsl_pm.dev, "Warning: Cannot read main battery!\n");
143 break;
144 }
145 }
146
147 voltage = sharpsl_average_value(voltage);
148 apm_status = get_apm_status(voltage);
149 percent = get_percentage(voltage);
150
151 /* At low battery voltages, the voltage has a tendency to start
152 creeping back up so we try to avoid this here */
153 if ((sharpsl_pm.battstat.ac_status == APM_AC_ONLINE) || (apm_status == APM_BATTERY_STATUS_HIGH) || percent <= sharpsl_pm.battstat.mainbat_percent) {
154 sharpsl_pm.battstat.mainbat_voltage = voltage;
155 sharpsl_pm.battstat.mainbat_status = apm_status;
156 sharpsl_pm.battstat.mainbat_percent = percent;
157 }
158
159 dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %d\n", voltage,
160 sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies);
161
162 /* If battery is low. limit backlight intensity to save power. */
163 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
164 && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) ||
165 (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) {
166 if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) {
167 corgibl_limit_intensity(1);
168 sharpsl_pm.flags |= SHARPSL_BL_LIMIT;
169 }
170 } else if (sharpsl_pm.flags & SHARPSL_BL_LIMIT) {
171 corgibl_limit_intensity(0);
172 sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT;
173 }
174
175 /* Suspend if critical battery level */
176 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
177 && (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL)
178 && !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) {
179 sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
180 dev_err(sharpsl_pm.dev, "Fatal Off\n");
181 apm_queue_event(APM_CRITICAL_SUSPEND);
182 }
183
184 schedule_delayed_work(&sharpsl_bat, SHARPSL_BATCHK_TIME);
185}
186
187void sharpsl_pm_led(int val)
188{
189 if (val == SHARPSL_LED_ERROR) {
190 dev_err(sharpsl_pm.dev, "Charging Error!\n");
191 } else if (val == SHARPSL_LED_ON) {
192 dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
193
194 } else {
195 dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
196
197 }
198}
199
200static void sharpsl_charge_on(void)
201{
202 dev_dbg(sharpsl_pm.dev, "Turning Charger On\n");
203
204 sharpsl_pm.full_count = 0;
205 sharpsl_pm.charge_mode = CHRG_ON;
206 schedule_delayed_work(&toggle_charger, msecs_to_jiffies(250));
207 schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(500));
208}
209
210static void sharpsl_charge_off(void)
211{
212 dev_dbg(sharpsl_pm.dev, "Turning Charger Off\n");
213
214 sharpsl_pm.machinfo->charge(0);
215 sharpsl_pm_led(SHARPSL_LED_OFF);
216 sharpsl_pm.charge_mode = CHRG_OFF;
217
218 schedule_work(&sharpsl_bat);
219}
220
221static void sharpsl_charge_error(void)
222{
223 sharpsl_pm_led(SHARPSL_LED_ERROR);
224 sharpsl_pm.machinfo->charge(0);
225 sharpsl_pm.charge_mode = CHRG_ERROR;
226}
227
228static void sharpsl_charge_toggle(void *private_)
229{
230 dev_dbg(sharpsl_pm.dev, "Toogling Charger at time: %lx\n", jiffies);
231
232 if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) {
233 sharpsl_charge_off();
234 return;
235 } else if ((sharpsl_check_battery_temp() < 0) || (sharpsl_ac_check() < 0)) {
236 sharpsl_charge_error();
237 return;
238 }
239
240 sharpsl_pm_led(SHARPSL_LED_ON);
241 sharpsl_pm.machinfo->charge(0);
242 mdelay(SHARPSL_CHARGE_WAIT_TIME);
243 sharpsl_pm.machinfo->charge(1);
244
245 sharpsl_pm.charge_start_time = jiffies;
246}
247
248static void sharpsl_ac_timer(unsigned long data)
249{
250 int acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
251
252 dev_dbg(sharpsl_pm.dev, "AC Status: %d\n",acin);
253
254 sharpsl_average_clear();
255 if (acin && (sharpsl_pm.charge_mode != CHRG_ON))
256 sharpsl_charge_on();
257 else if (sharpsl_pm.charge_mode == CHRG_ON)
258 sharpsl_charge_off();
259
260 schedule_work(&sharpsl_bat);
261}
262
263
264irqreturn_t sharpsl_ac_isr(int irq, void *dev_id, struct pt_regs *fp)
265{
266 /* Delay the event slightly to debounce */
267 /* Must be a smaller delay than the chrg_full_isr below */
268 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250));
269
270 return IRQ_HANDLED;
271}
272
273static void sharpsl_chrg_full_timer(unsigned long data)
274{
275 dev_dbg(sharpsl_pm.dev, "Charge Full at time: %lx\n", jiffies);
276
277 sharpsl_pm.full_count++;
278
279 if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) {
280 dev_dbg(sharpsl_pm.dev, "Charge Full: AC removed - stop charging!\n");
281 if (sharpsl_pm.charge_mode == CHRG_ON)
282 sharpsl_charge_off();
283 } else if (sharpsl_pm.full_count < 2) {
284 dev_dbg(sharpsl_pm.dev, "Charge Full: Count too low\n");
285 schedule_work(&toggle_charger);
286 } else if (time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_FINISH_TIME)) {
287 dev_dbg(sharpsl_pm.dev, "Charge Full: Interrupt generated too slowly - retry.\n");
288 schedule_work(&toggle_charger);
289 } else {
290 sharpsl_charge_off();
291 sharpsl_pm.charge_mode = CHRG_DONE;
292 dev_dbg(sharpsl_pm.dev, "Charge Full: Charging Finished\n");
293 }
294}
295
296/* Charging Finished Interrupt (Not present on Corgi) */
297/* Can trigger at the same time as an AC staus change so
298 delay until after that has been processed */
299irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id, struct pt_regs *fp)
300{
301 if (sharpsl_pm.flags & SHARPSL_SUSPENDED)
302 return IRQ_HANDLED;
303
304 /* delay until after any ac interrupt */
305 mod_timer(&sharpsl_pm.chrg_full_timer, jiffies + msecs_to_jiffies(500));
306
307 return IRQ_HANDLED;
308}
309
310irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id, struct pt_regs *fp)
311{
312 int is_fatal = 0;
313
314 if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_LOCK)) {
315 dev_err(sharpsl_pm.dev, "Battery now Unlocked! Suspending.\n");
316 is_fatal = 1;
317 }
318
319 if (!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_FATAL)) {
320 dev_err(sharpsl_pm.dev, "Fatal Batt Error! Suspending.\n");
321 is_fatal = 1;
322 }
323
324 if (!(sharpsl_pm.flags & SHARPSL_APM_QUEUED) && is_fatal) {
325 sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
326 apm_queue_event(APM_CRITICAL_SUSPEND);
327 }
328
329 return IRQ_HANDLED;
330}
331
332/*
333 * Maintain an average of the last 10 readings
334 */
335#define SHARPSL_CNV_VALUE_NUM 10
336static int sharpsl_ad_index;
337
338static void sharpsl_average_clear(void)
339{
340 sharpsl_ad_index = 0;
341}
342
343static int sharpsl_average_value(int ad)
344{
345 int i, ad_val = 0;
346 static int sharpsl_ad[SHARPSL_CNV_VALUE_NUM+1];
347
348 if (sharpsl_pm.battstat.mainbat_status != APM_BATTERY_STATUS_HIGH) {
349 sharpsl_ad_index = 0;
350 return ad;
351 }
352
353 sharpsl_ad[sharpsl_ad_index] = ad;
354 sharpsl_ad_index++;
355 if (sharpsl_ad_index >= SHARPSL_CNV_VALUE_NUM) {
356 for (i=0; i < (SHARPSL_CNV_VALUE_NUM-1); i++)
357 sharpsl_ad[i] = sharpsl_ad[i+1];
358 sharpsl_ad_index = SHARPSL_CNV_VALUE_NUM - 1;
359 }
360 for (i=0; i < sharpsl_ad_index; i++)
361 ad_val += sharpsl_ad[i];
362
363 return (ad_val / sharpsl_ad_index);
364}
365
366/*
367 * Take an array of 5 integers, remove the maximum and minimum values
368 * and return the average.
369 */
370static int get_select_val(int *val)
371{
372 int i, j, k, temp, sum = 0;
373
374 /* Find MAX val */
375 temp = val[0];
376 j=0;
377 for (i=1; i<5; i++) {
378 if (temp < val[i]) {
379 temp = val[i];
380 j = i;
381 }
382 }
383
384 /* Find MIN val */
385 temp = val[4];
386 k=4;
387 for (i=3; i>=0; i--) {
388 if (temp > val[i]) {
389 temp = val[i];
390 k = i;
391 }
392 }
393
394 for (i=0; i<5; i++)
395 if (i != j && i != k )
396 sum += val[i];
397
398 dev_dbg(sharpsl_pm.dev, "Average: %d from values: %d, %d, %d, %d, %d\n", sum/3, val[0], val[1], val[2], val[3], val[4]);
399
400 return (sum/3);
401}
402
403static int sharpsl_check_battery_temp(void)
404{
405 int val, i, buff[5];
406
407 /* Check battery temperature */
408 for (i=0; i<5; i++) {
409 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
410 sharpsl_pm.machinfo->measure_temp(1);
411 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
412 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_TEMP);
413 sharpsl_pm.machinfo->measure_temp(0);
414 }
415
416 val = get_select_val(buff);
417
418 dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val);
419 if (val > SHARPSL_CHARGE_ON_TEMP)
420 return -1;
421
422 return 0;
423}
424
425static int sharpsl_check_battery_voltage(void)
426{
427 int val, i, buff[5];
428
429 /* disable charge, enable discharge */
430 sharpsl_pm.machinfo->charge(0);
431 sharpsl_pm.machinfo->discharge(1);
432 mdelay(SHARPSL_WAIT_DISCHARGE_ON);
433
434 if (sharpsl_pm.machinfo->discharge1)
435 sharpsl_pm.machinfo->discharge1(1);
436
437 /* Check battery voltage */
438 for (i=0; i<5; i++) {
439 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
440 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
441 }
442
443 if (sharpsl_pm.machinfo->discharge1)
444 sharpsl_pm.machinfo->discharge1(0);
445
446 sharpsl_pm.machinfo->discharge(0);
447
448 val = get_select_val(buff);
449 dev_dbg(sharpsl_pm.dev, "Battery Voltage: %d\n", val);
450
451 if (val < SHARPSL_CHARGE_ON_VOLT)
452 return -1;
453
454 return 0;
455}
456
457static int sharpsl_ac_check(void)
458{
459 int temp, i, buff[5];
460
461 for (i=0; i<5; i++) {
462 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_ACIN_VOLT);
463 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN);
464 }
465
466 temp = get_select_val(buff);
467 dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp);
468
469 if ((temp > SHARPSL_CHARGE_ON_ACIN_HIGH) || (temp < SHARPSL_CHARGE_ON_ACIN_LOW)) {
470 dev_err(sharpsl_pm.dev, "Error: AC check failed.\n");
471 return -1;
472 }
473
474 return 0;
475}
476
477#ifdef CONFIG_PM
478static int sharpsl_pm_suspend(struct platform_device *pdev, pm_message_t state)
479{
480 sharpsl_pm.flags |= SHARPSL_SUSPENDED;
481 flush_scheduled_work();
482
483 if (sharpsl_pm.charge_mode == CHRG_ON)
484 sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
485 else
486 sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG;
487
488 return 0;
489}
490
491static int sharpsl_pm_resume(struct platform_device *pdev)
492{
493 /* Clear the reset source indicators as they break the bootloader upon reboot */
494 RCSR = 0x0f;
495 sharpsl_average_clear();
496 sharpsl_pm.flags &= ~SHARPSL_APM_QUEUED;
497 sharpsl_pm.flags &= ~SHARPSL_SUSPENDED;
498
499 return 0;
500}
501
502static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
503{
504 dev_dbg(sharpsl_pm.dev, "Time is: %08x\n",RCNR);
505
506 dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n",sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG);
507 /* not charging and AC-IN! */
508
509 if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN))) {
510 dev_dbg(sharpsl_pm.dev, "Activating Offline Charger...\n");
511 sharpsl_pm.charge_mode = CHRG_OFF;
512 sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG;
513 sharpsl_off_charge_battery();
514 }
515
516 sharpsl_pm.machinfo->presuspend();
517
518 PEDR = 0xffffffff; /* clear it */
519
520 sharpsl_pm.flags &= ~SHARPSL_ALARM_ACTIVE;
521 if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) {
522 RTSR &= RTSR_ALE;
523 RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND;
524 dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n",RTAR);
525 sharpsl_pm.flags |= SHARPSL_ALARM_ACTIVE;
526 } else if (alarm_enable) {
527 RTSR &= RTSR_ALE;
528 RTAR = alarm_time;
529 dev_dbg(sharpsl_pm.dev, "User alarm at: %08x\n",RTAR);
530 } else {
531 dev_dbg(sharpsl_pm.dev, "No alarms set.\n");
532 }
533
534 pxa_pm_enter(state);
535
536 sharpsl_pm.machinfo->postsuspend();
537
538 dev_dbg(sharpsl_pm.dev, "Corgi woken up from suspend: %08x\n",PEDR);
539}
540
541static int corgi_enter_suspend(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
542{
543 if (!sharpsl_pm.machinfo->should_wakeup(!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE) && alarm_enable) )
544 {
545 if (!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE)) {
546 dev_dbg(sharpsl_pm.dev, "No user triggered wakeup events and not charging. Strange. Suspend.\n");
547 corgi_goto_sleep(alarm_time, alarm_enable, state);
548 return 1;
549 }
550 if(sharpsl_off_charge_battery()) {
551 dev_dbg(sharpsl_pm.dev, "Charging. Suspend...\n");
552 corgi_goto_sleep(alarm_time, alarm_enable, state);
553 return 1;
554 }
555 dev_dbg(sharpsl_pm.dev, "User triggered wakeup in offline charger.\n");
556 }
557
558 if ((!sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_LOCK)) || (sharpsl_fatal_check() < 0) )
559 {
560 dev_err(sharpsl_pm.dev, "Fatal condition. Suspend.\n");
561 corgi_goto_sleep(alarm_time, alarm_enable, state);
562 return 1;
563 }
564
565 return 0;
566}
567
568static int corgi_pxa_pm_enter(suspend_state_t state)
569{
570 unsigned long alarm_time = RTAR;
571 unsigned int alarm_status = ((RTSR & RTSR_ALE) != 0);
572
573 dev_dbg(sharpsl_pm.dev, "SharpSL suspending for first time.\n");
574
575 corgi_goto_sleep(alarm_time, alarm_status, state);
576
577 while (corgi_enter_suspend(alarm_time,alarm_status,state))
578 {}
579
580 dev_dbg(sharpsl_pm.dev, "SharpSL resuming...\n");
581
582 return 0;
583}
584#endif
585
586
587/*
588 * Check for fatal battery errors
589 * Fatal returns -1
590 */
591static int sharpsl_fatal_check(void)
592{
593 int buff[5], temp, i, acin;
594
595 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check entered\n");
596
597 /* Check AC-Adapter */
598 acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
599
600 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
601 sharpsl_pm.machinfo->charge(0);
602 udelay(100);
603 sharpsl_pm.machinfo->discharge(1); /* enable discharge */
604 mdelay(SHARPSL_WAIT_DISCHARGE_ON);
605 }
606
607 if (sharpsl_pm.machinfo->discharge1)
608 sharpsl_pm.machinfo->discharge1(1);
609
610 /* Check battery : check inserting battery ? */
611 for (i=0; i<5; i++) {
612 buff[i] = sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT);
613 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
614 }
615
616 if (sharpsl_pm.machinfo->discharge1)
617 sharpsl_pm.machinfo->discharge1(0);
618
619 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
620 udelay(100);
621 sharpsl_pm.machinfo->charge(1);
622 sharpsl_pm.machinfo->discharge(0);
623 }
624
625 temp = get_select_val(buff);
626 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_pm.machinfo->read_devdata(SHARPSL_BATT_VOLT));
627
628 if ((acin && (temp < SHARPSL_FATAL_ACIN_VOLT)) ||
629 (!acin && (temp < SHARPSL_FATAL_NOACIN_VOLT)))
630 return -1;
631 return 0;
632}
633
634static int sharpsl_off_charge_error(void)
635{
636 dev_err(sharpsl_pm.dev, "Offline Charger: Error occured.\n");
637 sharpsl_pm.machinfo->charge(0);
638 sharpsl_pm_led(SHARPSL_LED_ERROR);
639 sharpsl_pm.charge_mode = CHRG_ERROR;
640 return 1;
641}
642
643/*
644 * Charging Control while suspended
645 * Return 1 - go straight to sleep
646 * Return 0 - sleep or wakeup depending on other factors
647 */
648static int sharpsl_off_charge_battery(void)
649{
650 int time;
651
652 dev_dbg(sharpsl_pm.dev, "Charge Mode: %d\n", sharpsl_pm.charge_mode);
653
654 if (sharpsl_pm.charge_mode == CHRG_OFF) {
655 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 1\n");
656
657 /* AC Check */
658 if ((sharpsl_ac_check() < 0) || (sharpsl_check_battery_temp() < 0))
659 return sharpsl_off_charge_error();
660
661 /* Start Charging */
662 sharpsl_pm_led(SHARPSL_LED_ON);
663 sharpsl_pm.machinfo->charge(0);
664 mdelay(SHARPSL_CHARGE_WAIT_TIME);
665 sharpsl_pm.machinfo->charge(1);
666
667 sharpsl_pm.charge_mode = CHRG_ON;
668 sharpsl_pm.full_count = 0;
669
670 return 1;
671 } else if (sharpsl_pm.charge_mode != CHRG_ON) {
672 return 1;
673 }
674
675 if (sharpsl_pm.full_count == 0) {
676 int time;
677
678 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 2\n");
679
680 if ((sharpsl_check_battery_temp() < 0) || (sharpsl_check_battery_voltage() < 0))
681 return sharpsl_off_charge_error();
682
683 sharpsl_pm.machinfo->charge(0);
684 mdelay(SHARPSL_CHARGE_WAIT_TIME);
685 sharpsl_pm.machinfo->charge(1);
686 sharpsl_pm.charge_mode = CHRG_ON;
687
688 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
689
690 time = RCNR;
691 while(1) {
692 /* Check if any wakeup event had occured */
693 if (sharpsl_pm.machinfo->charger_wakeup() != 0)
694 return 0;
695 /* Check for timeout */
696 if ((RCNR - time) > SHARPSL_WAIT_CO_TIME)
697 return 1;
698 if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_CHRGFULL)) {
699 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charge full occured. Retrying to check\n");
700 sharpsl_pm.full_count++;
701 sharpsl_pm.machinfo->charge(0);
702 mdelay(SHARPSL_CHARGE_WAIT_TIME);
703 sharpsl_pm.machinfo->charge(1);
704 return 1;
705 }
706 }
707 }
708
709 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 3\n");
710
711 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
712
713 time = RCNR;
714 while(1) {
715 /* Check if any wakeup event had occured */
716 if (sharpsl_pm.machinfo->charger_wakeup() != 0)
717 return 0;
718 /* Check for timeout */
719 if ((RCNR-time) > SHARPSL_WAIT_CO_TIME) {
720 if (sharpsl_pm.full_count > SHARPSL_CHARGE_RETRY_CNT) {
721 dev_dbg(sharpsl_pm.dev, "Offline Charger: Not charged sufficiently. Retrying.\n");
722 sharpsl_pm.full_count = 0;
723 }
724 sharpsl_pm.full_count++;
725 return 1;
726 }
727 if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_CHRGFULL)) {
728 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charging complete.\n");
729 sharpsl_pm_led(SHARPSL_LED_OFF);
730 sharpsl_pm.machinfo->charge(0);
731 sharpsl_pm.charge_mode = CHRG_DONE;
732 return 1;
733 }
734 }
735}
736
737
738static ssize_t battery_percentage_show(struct device *dev, struct device_attribute *attr, char *buf)
739{
740 return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_percent);
741}
742
743static ssize_t battery_voltage_show(struct device *dev, struct device_attribute *attr, char *buf)
744{
745 return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_voltage);
746}
747
748static DEVICE_ATTR(battery_percentage, 0444, battery_percentage_show, NULL);
749static DEVICE_ATTR(battery_voltage, 0444, battery_voltage_show, NULL);
750
751extern void (*apm_get_power_status)(struct apm_power_info *);
752
753static void sharpsl_apm_get_power_status(struct apm_power_info *info)
754{
755 info->ac_line_status = sharpsl_pm.battstat.ac_status;
756
757 if (sharpsl_pm.charge_mode == CHRG_ON)
758 info->battery_status = APM_BATTERY_STATUS_CHARGING;
759 else
760 info->battery_status = sharpsl_pm.battstat.mainbat_status;
761
762 info->battery_flag = (1 << info->battery_status);
763 info->battery_life = sharpsl_pm.battstat.mainbat_percent;
764}
765
766static struct pm_ops sharpsl_pm_ops = {
767 .pm_disk_mode = PM_DISK_FIRMWARE,
768 .prepare = pxa_pm_prepare,
769 .enter = corgi_pxa_pm_enter,
770 .finish = pxa_pm_finish,
771};
772
773static int __init sharpsl_pm_probe(struct platform_device *pdev)
774{
775 if (!pdev->dev.platform_data)
776 return -EINVAL;
777
778 sharpsl_pm.dev = &pdev->dev;
779 sharpsl_pm.machinfo = pdev->dev.platform_data;
780 sharpsl_pm.charge_mode = CHRG_OFF;
781 sharpsl_pm.flags = 0;
782
783 init_timer(&sharpsl_pm.ac_timer);
784 sharpsl_pm.ac_timer.function = sharpsl_ac_timer;
785
786 init_timer(&sharpsl_pm.chrg_full_timer);
787 sharpsl_pm.chrg_full_timer.function = sharpsl_chrg_full_timer;
788
789 sharpsl_pm.machinfo->init();
790
791 device_create_file(&pdev->dev, &dev_attr_battery_percentage);
792 device_create_file(&pdev->dev, &dev_attr_battery_voltage);
793
794 apm_get_power_status = sharpsl_apm_get_power_status;
795
796 pm_set_ops(&sharpsl_pm_ops);
797
798 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250));
799
800 return 0;
801}
802
803static int sharpsl_pm_remove(struct platform_device *pdev)
804{
805 pm_set_ops(NULL);
806
807 device_remove_file(&pdev->dev, &dev_attr_battery_percentage);
808 device_remove_file(&pdev->dev, &dev_attr_battery_voltage);
809
810 sharpsl_pm.machinfo->exit();
811
812 del_timer_sync(&sharpsl_pm.chrg_full_timer);
813 del_timer_sync(&sharpsl_pm.ac_timer);
814
815 return 0;
816}
817
818static struct platform_driver sharpsl_pm_driver = {
819 .probe = sharpsl_pm_probe,
820 .remove = sharpsl_pm_remove,
821 .suspend = sharpsl_pm_suspend,
822 .resume = sharpsl_pm_resume,
823 .driver = {
824 .name = "sharpsl-pm",
825 },
826};
827
828static int __devinit sharpsl_pm_init(void)
829{
830 return platform_driver_register(&sharpsl_pm_driver);
831}
832
833static void sharpsl_pm_exit(void)
834{
835 platform_driver_unregister(&sharpsl_pm_driver);
836}
837
838late_initcall(sharpsl_pm_init);
839module_exit(sharpsl_pm_exit);
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
new file mode 100644
index 000000000000..a45ed1687a59
--- /dev/null
+++ b/arch/arm/common/vic.c
@@ -0,0 +1,92 @@
1/*
2 * linux/arch/arm/common/vic.c
3 *
4 * Copyright (C) 1999 - 2003 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/init.h>
22#include <linux/list.h>
23
24#include <asm/io.h>
25#include <asm/irq.h>
26#include <asm/mach/irq.h>
27#include <asm/hardware/vic.h>
28
29static void __iomem *vic_base;
30
31static void vic_mask_irq(unsigned int irq)
32{
33 irq -= IRQ_VIC_START;
34 writel(1 << irq, vic_base + VIC_INT_ENABLE_CLEAR);
35}
36
37static void vic_unmask_irq(unsigned int irq)
38{
39 irq -= IRQ_VIC_START;
40 writel(1 << irq, vic_base + VIC_INT_ENABLE);
41}
42
43static struct irqchip vic_chip = {
44 .ack = vic_mask_irq,
45 .mask = vic_mask_irq,
46 .unmask = vic_unmask_irq,
47};
48
49void __init vic_init(void __iomem *base, u32 vic_sources)
50{
51 unsigned int i;
52
53 vic_base = base;
54
55 /* Disable all interrupts initially. */
56
57 writel(0, vic_base + VIC_INT_SELECT);
58 writel(0, vic_base + VIC_INT_ENABLE);
59 writel(~0, vic_base + VIC_INT_ENABLE_CLEAR);
60 writel(0, vic_base + VIC_IRQ_STATUS);
61 writel(0, vic_base + VIC_ITCR);
62 writel(~0, vic_base + VIC_INT_SOFT_CLEAR);
63
64 /*
65 * Make sure we clear all existing interrupts
66 */
67 writel(0, vic_base + VIC_VECT_ADDR);
68 for (i = 0; i < 19; i++) {
69 unsigned int value;
70
71 value = readl(vic_base + VIC_VECT_ADDR);
72 writel(value, vic_base + VIC_VECT_ADDR);
73 }
74
75 for (i = 0; i < 16; i++) {
76 void __iomem *reg = vic_base + VIC_VECT_CNTL0 + (i * 4);
77 writel(VIC_VECT_CNTL_ENABLE | i, reg);
78 }
79
80 writel(32, vic_base + VIC_DEF_VECT_ADDR);
81
82 for (i = 0; i < 32; i++) {
83 unsigned int irq = IRQ_VIC_START + i;
84
85 set_irq_chip(irq, &vic_chip);
86
87 if (vic_sources & (1 << i)) {
88 set_irq_handler(irq, do_level_IRQ);
89 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
90 }
91 }
92}
diff --git a/arch/arm/configs/assabet_defconfig b/arch/arm/configs/assabet_defconfig
index ccbb4c0d58c4..089c9d598409 100644
--- a/arch/arm/configs/assabet_defconfig
+++ b/arch/arm/configs/assabet_defconfig
@@ -63,7 +63,6 @@ CONFIG_OBSOLETE_MODPARM=y
63# CONFIG_ARCH_CLPS711X is not set 63# CONFIG_ARCH_CLPS711X is not set
64# CONFIG_ARCH_CO285 is not set 64# CONFIG_ARCH_CO285 is not set
65# CONFIG_ARCH_EBSA110 is not set 65# CONFIG_ARCH_EBSA110 is not set
66# CONFIG_ARCH_CAMELOT is not set
67# CONFIG_ARCH_FOOTBRIDGE is not set 66# CONFIG_ARCH_FOOTBRIDGE is not set
68# CONFIG_ARCH_INTEGRATOR is not set 67# CONFIG_ARCH_INTEGRATOR is not set
69# CONFIG_ARCH_IOP3XX is not set 68# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/at91rm9200dk_defconfig b/arch/arm/configs/at91rm9200dk_defconfig
new file mode 100644
index 000000000000..5cdd13acf8ff
--- /dev/null
+++ b/arch/arm/configs/at91rm9200dk_defconfig
@@ -0,0 +1,1009 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15
4# Mon Jan 9 20:54:30 2006
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11
12#
13# Code maturity level options
14#
15CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y
18CONFIG_INIT_ENV_ARG_LIMIT=32
19
20#
21# General setup
22#
23CONFIG_LOCALVERSION=""
24CONFIG_LOCALVERSION_AUTO=y
25# CONFIG_SWAP is not set
26CONFIG_SYSVIPC=y
27# CONFIG_POSIX_MQUEUE is not set
28# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set
31CONFIG_HOTPLUG=y
32CONFIG_KOBJECT_UEVENT=y
33# CONFIG_IKCONFIG is not set
34CONFIG_INITRAMFS_SOURCE=""
35CONFIG_CC_OPTIMIZE_FOR_SIZE=y
36# CONFIG_EMBEDDED is not set
37CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set
39# CONFIG_KALLSYMS_EXTRA_PASS is not set
40CONFIG_PRINTK=y
41CONFIG_BUG=y
42CONFIG_BASE_FULL=y
43CONFIG_FUTEX=y
44CONFIG_EPOLL=y
45CONFIG_SHMEM=y
46CONFIG_CC_ALIGN_FUNCTIONS=0
47CONFIG_CC_ALIGN_LABELS=0
48CONFIG_CC_ALIGN_LOOPS=0
49CONFIG_CC_ALIGN_JUMPS=0
50# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0
52
53#
54# Loadable module support
55#
56CONFIG_MODULES=y
57CONFIG_MODULE_UNLOAD=y
58# CONFIG_MODULE_FORCE_UNLOAD is not set
59CONFIG_OBSOLETE_MODPARM=y
60# CONFIG_MODVERSIONS is not set
61# CONFIG_MODULE_SRCVERSION_ALL is not set
62CONFIG_KMOD=y
63
64#
65# Block layer
66#
67
68#
69# IO Schedulers
70#
71CONFIG_IOSCHED_NOOP=y
72CONFIG_IOSCHED_AS=y
73# CONFIG_IOSCHED_DEADLINE is not set
74# CONFIG_IOSCHED_CFQ is not set
75CONFIG_DEFAULT_AS=y
76# CONFIG_DEFAULT_DEADLINE is not set
77# CONFIG_DEFAULT_CFQ is not set
78# CONFIG_DEFAULT_NOOP is not set
79CONFIG_DEFAULT_IOSCHED="anticipatory"
80
81#
82# System Type
83#
84# CONFIG_ARCH_CLPS7500 is not set
85# CONFIG_ARCH_CLPS711X is not set
86# CONFIG_ARCH_CO285 is not set
87# CONFIG_ARCH_EBSA110 is not set
88# CONFIG_ARCH_CAMELOT is not set
89# CONFIG_ARCH_FOOTBRIDGE is not set
90# CONFIG_ARCH_INTEGRATOR is not set
91# CONFIG_ARCH_IOP3XX is not set
92# CONFIG_ARCH_IXP4XX is not set
93# CONFIG_ARCH_IXP2000 is not set
94# CONFIG_ARCH_L7200 is not set
95# CONFIG_ARCH_PXA is not set
96# CONFIG_ARCH_RPC is not set
97# CONFIG_ARCH_SA1100 is not set
98# CONFIG_ARCH_S3C2410 is not set
99# CONFIG_ARCH_SHARK is not set
100# CONFIG_ARCH_LH7A40X is not set
101# CONFIG_ARCH_OMAP is not set
102# CONFIG_ARCH_VERSATILE is not set
103# CONFIG_ARCH_REALVIEW is not set
104# CONFIG_ARCH_IMX is not set
105# CONFIG_ARCH_H720X is not set
106# CONFIG_ARCH_AAEC2000 is not set
107CONFIG_ARCH_AT91RM9200=y
108
109#
110# AT91RM9200 Implementations
111#
112
113#
114# AT91RM9200 Board Type
115#
116CONFIG_ARCH_AT91RM9200DK=y
117# CONFIG_MACH_AT91RM9200EK is not set
118# CONFIG_MACH_CSB337 is not set
119# CONFIG_MACH_CSB637 is not set
120# CONFIG_MACH_CARMEVA is not set
121# CONFIG_MACH_KB9200 is not set
122# CONFIG_MACH_ATEB9200 is not set
123
124#
125# AT91RM9200 Feature Selections
126#
127CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
128
129#
130# Processor Type
131#
132CONFIG_CPU_32=y
133CONFIG_CPU_ARM920T=y
134CONFIG_CPU_32v4=y
135CONFIG_CPU_ABRT_EV4T=y
136CONFIG_CPU_CACHE_V4WT=y
137CONFIG_CPU_CACHE_VIVT=y
138CONFIG_CPU_COPY_V4WB=y
139CONFIG_CPU_TLB_V4WBI=y
140
141#
142# Processor Features
143#
144# CONFIG_ARM_THUMB is not set
145# CONFIG_CPU_ICACHE_DISABLE is not set
146# CONFIG_CPU_DCACHE_DISABLE is not set
147# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
148
149#
150# Bus support
151#
152CONFIG_ISA_DMA_API=y
153
154#
155# PCCARD (PCMCIA/CardBus) support
156#
157CONFIG_PCCARD=y
158# CONFIG_PCMCIA_DEBUG is not set
159CONFIG_PCMCIA=y
160CONFIG_PCMCIA_LOAD_CIS=y
161CONFIG_PCMCIA_IOCTL=y
162
163#
164# PC-card bridges
165#
166CONFIG_AT91_CF=y
167
168#
169# Kernel Features
170#
171# CONFIG_PREEMPT is not set
172# CONFIG_NO_IDLE_HZ is not set
173# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
174CONFIG_SELECT_MEMORY_MODEL=y
175CONFIG_FLATMEM_MANUAL=y
176# CONFIG_DISCONTIGMEM_MANUAL is not set
177# CONFIG_SPARSEMEM_MANUAL is not set
178CONFIG_FLATMEM=y
179CONFIG_FLAT_NODE_MEM_MAP=y
180# CONFIG_SPARSEMEM_STATIC is not set
181CONFIG_SPLIT_PTLOCK_CPUS=4096
182CONFIG_LEDS=y
183CONFIG_LEDS_TIMER=y
184# CONFIG_LEDS_CPU is not set
185CONFIG_ALIGNMENT_TRAP=y
186
187#
188# Boot options
189#
190CONFIG_ZBOOT_ROM_TEXT=0x0
191CONFIG_ZBOOT_ROM_BSS=0x0
192CONFIG_CMDLINE="mem=32M console=ttyS0,115200 initrd=0x20410000,3145728 root=/dev/ram0 rw"
193# CONFIG_XIP_KERNEL is not set
194
195#
196# Floating point emulation
197#
198
199#
200# At least one emulation must be selected
201#
202CONFIG_FPE_NWFPE=y
203# CONFIG_FPE_NWFPE_XP is not set
204# CONFIG_FPE_FASTFPE is not set
205
206#
207# Userspace binary formats
208#
209CONFIG_BINFMT_ELF=y
210# CONFIG_BINFMT_AOUT is not set
211# CONFIG_BINFMT_MISC is not set
212# CONFIG_ARTHUR is not set
213
214#
215# Power management options
216#
217# CONFIG_PM is not set
218
219#
220# Networking
221#
222CONFIG_NET=y
223
224#
225# Networking options
226#
227CONFIG_PACKET=y
228# CONFIG_PACKET_MMAP is not set
229CONFIG_UNIX=y
230# CONFIG_NET_KEY is not set
231CONFIG_INET=y
232# CONFIG_IP_MULTICAST is not set
233# CONFIG_IP_ADVANCED_ROUTER is not set
234CONFIG_IP_FIB_HASH=y
235CONFIG_IP_PNP=y
236# CONFIG_IP_PNP_DHCP is not set
237CONFIG_IP_PNP_BOOTP=y
238# CONFIG_IP_PNP_RARP is not set
239# CONFIG_NET_IPIP is not set
240# CONFIG_NET_IPGRE is not set
241# CONFIG_ARPD is not set
242# CONFIG_SYN_COOKIES is not set
243# CONFIG_INET_AH is not set
244# CONFIG_INET_ESP is not set
245# CONFIG_INET_IPCOMP is not set
246# CONFIG_INET_TUNNEL is not set
247CONFIG_INET_DIAG=y
248CONFIG_INET_TCP_DIAG=y
249# CONFIG_TCP_CONG_ADVANCED is not set
250CONFIG_TCP_CONG_BIC=y
251# CONFIG_IPV6 is not set
252# CONFIG_NETFILTER is not set
253
254#
255# DCCP Configuration (EXPERIMENTAL)
256#
257# CONFIG_IP_DCCP is not set
258
259#
260# SCTP Configuration (EXPERIMENTAL)
261#
262# CONFIG_IP_SCTP is not set
263# CONFIG_ATM is not set
264# CONFIG_BRIDGE is not set
265# CONFIG_VLAN_8021Q is not set
266# CONFIG_DECNET is not set
267# CONFIG_LLC2 is not set
268# CONFIG_IPX is not set
269# CONFIG_ATALK is not set
270# CONFIG_X25 is not set
271# CONFIG_LAPB is not set
272# CONFIG_NET_DIVERT is not set
273# CONFIG_ECONET is not set
274# CONFIG_WAN_ROUTER is not set
275
276#
277# QoS and/or fair queueing
278#
279# CONFIG_NET_SCHED is not set
280
281#
282# Network testing
283#
284# CONFIG_NET_PKTGEN is not set
285# CONFIG_HAMRADIO is not set
286# CONFIG_IRDA is not set
287# CONFIG_BT is not set
288# CONFIG_IEEE80211 is not set
289
290#
291# Device Drivers
292#
293
294#
295# Generic Driver Options
296#
297CONFIG_STANDALONE=y
298CONFIG_PREVENT_FIRMWARE_BUILD=y
299CONFIG_FW_LOADER=y
300# CONFIG_DEBUG_DRIVER is not set
301
302#
303# Connector - unified userspace <-> kernelspace linker
304#
305# CONFIG_CONNECTOR is not set
306
307#
308# Memory Technology Devices (MTD)
309#
310CONFIG_MTD=y
311# CONFIG_MTD_DEBUG is not set
312# CONFIG_MTD_CONCAT is not set
313CONFIG_MTD_PARTITIONS=y
314# CONFIG_MTD_REDBOOT_PARTS is not set
315CONFIG_MTD_CMDLINE_PARTS=y
316# CONFIG_MTD_AFS_PARTS is not set
317
318#
319# User Modules And Translation Layers
320#
321CONFIG_MTD_CHAR=y
322CONFIG_MTD_BLOCK=y
323# CONFIG_FTL is not set
324# CONFIG_NFTL is not set
325# CONFIG_INFTL is not set
326# CONFIG_RFD_FTL is not set
327
328#
329# RAM/ROM/Flash chip drivers
330#
331CONFIG_MTD_CFI=y
332CONFIG_MTD_JEDECPROBE=y
333CONFIG_MTD_GEN_PROBE=y
334# CONFIG_MTD_CFI_ADV_OPTIONS is not set
335CONFIG_MTD_MAP_BANK_WIDTH_1=y
336CONFIG_MTD_MAP_BANK_WIDTH_2=y
337CONFIG_MTD_MAP_BANK_WIDTH_4=y
338# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
339# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
340# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
341CONFIG_MTD_CFI_I1=y
342CONFIG_MTD_CFI_I2=y
343# CONFIG_MTD_CFI_I4 is not set
344# CONFIG_MTD_CFI_I8 is not set
345# CONFIG_MTD_CFI_INTELEXT is not set
346CONFIG_MTD_CFI_AMDSTD=y
347CONFIG_MTD_CFI_AMDSTD_RETRY=0
348# CONFIG_MTD_CFI_STAA is not set
349CONFIG_MTD_CFI_UTIL=y
350# CONFIG_MTD_RAM is not set
351# CONFIG_MTD_ROM is not set
352# CONFIG_MTD_ABSENT is not set
353# CONFIG_MTD_XIP is not set
354
355#
356# Mapping drivers for chip access
357#
358# CONFIG_MTD_COMPLEX_MAPPINGS is not set
359CONFIG_MTD_PHYSMAP=y
360CONFIG_MTD_PHYSMAP_START=0x10000000
361CONFIG_MTD_PHYSMAP_LEN=0x200000
362CONFIG_MTD_PHYSMAP_BANKWIDTH=2
363# CONFIG_MTD_ARM_INTEGRATOR is not set
364# CONFIG_MTD_IMPA7 is not set
365# CONFIG_MTD_PLATRAM is not set
366
367#
368# Self-contained MTD device drivers
369#
370# CONFIG_MTD_SLRAM is not set
371# CONFIG_MTD_PHRAM is not set
372# CONFIG_MTD_MTDRAM is not set
373# CONFIG_MTD_BLKMTD is not set
374# CONFIG_MTD_BLOCK2MTD is not set
375
376#
377# Disk-On-Chip Device Drivers
378#
379# CONFIG_MTD_DOC2000 is not set
380# CONFIG_MTD_DOC2001 is not set
381# CONFIG_MTD_DOC2001PLUS is not set
382CONFIG_MTD_AT91_DATAFLASH=y
383CONFIG_MTD_AT91_DATAFLASH_CARD=y
384
385#
386# NAND Flash Device Drivers
387#
388# CONFIG_MTD_NAND is not set
389
390#
391# OneNAND Flash Device Drivers
392#
393# CONFIG_MTD_ONENAND is not set
394
395#
396# Parallel port support
397#
398# CONFIG_PARPORT is not set
399
400#
401# Plug and Play support
402#
403
404#
405# Block devices
406#
407# CONFIG_BLK_DEV_COW_COMMON is not set
408# CONFIG_BLK_DEV_LOOP is not set
409# CONFIG_BLK_DEV_NBD is not set
410# CONFIG_BLK_DEV_UB is not set
411CONFIG_BLK_DEV_RAM=y
412CONFIG_BLK_DEV_RAM_COUNT=16
413CONFIG_BLK_DEV_RAM_SIZE=8192
414CONFIG_BLK_DEV_INITRD=y
415# CONFIG_CDROM_PKTCDVD is not set
416# CONFIG_ATA_OVER_ETH is not set
417
418#
419# ATA/ATAPI/MFM/RLL support
420#
421# CONFIG_IDE is not set
422
423#
424# SCSI device support
425#
426# CONFIG_RAID_ATTRS is not set
427# CONFIG_SCSI is not set
428
429#
430# Multi-device support (RAID and LVM)
431#
432# CONFIG_MD is not set
433
434#
435# Fusion MPT device support
436#
437# CONFIG_FUSION is not set
438
439#
440# IEEE 1394 (FireWire) support
441#
442
443#
444# I2O device support
445#
446
447#
448# Network device support
449#
450CONFIG_NETDEVICES=y
451# CONFIG_DUMMY is not set
452# CONFIG_BONDING is not set
453# CONFIG_EQUALIZER is not set
454# CONFIG_TUN is not set
455
456#
457# PHY device support
458#
459# CONFIG_PHYLIB is not set
460
461#
462# Ethernet (10 or 100Mbit)
463#
464CONFIG_NET_ETHERNET=y
465CONFIG_MII=y
466CONFIG_ARM_AT91_ETHER=y
467# CONFIG_SMC91X is not set
468# CONFIG_DM9000 is not set
469
470#
471# Ethernet (1000 Mbit)
472#
473
474#
475# Ethernet (10000 Mbit)
476#
477
478#
479# Token Ring devices
480#
481
482#
483# Wireless LAN (non-hamradio)
484#
485# CONFIG_NET_RADIO is not set
486
487#
488# PCMCIA network device support
489#
490# CONFIG_NET_PCMCIA is not set
491
492#
493# Wan interfaces
494#
495# CONFIG_WAN is not set
496# CONFIG_PPP is not set
497# CONFIG_SLIP is not set
498# CONFIG_SHAPER is not set
499# CONFIG_NETCONSOLE is not set
500# CONFIG_NETPOLL is not set
501# CONFIG_NET_POLL_CONTROLLER is not set
502
503#
504# ISDN subsystem
505#
506# CONFIG_ISDN is not set
507
508#
509# Input device support
510#
511CONFIG_INPUT=y
512
513#
514# Userland interfaces
515#
516CONFIG_INPUT_MOUSEDEV=y
517# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
518CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
519CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
520# CONFIG_INPUT_JOYDEV is not set
521# CONFIG_INPUT_TSDEV is not set
522# CONFIG_INPUT_EVDEV is not set
523# CONFIG_INPUT_EVBUG is not set
524
525#
526# Input Device Drivers
527#
528# CONFIG_INPUT_KEYBOARD is not set
529# CONFIG_INPUT_MOUSE is not set
530# CONFIG_INPUT_JOYSTICK is not set
531# CONFIG_INPUT_TOUCHSCREEN is not set
532# CONFIG_INPUT_MISC is not set
533
534#
535# Hardware I/O ports
536#
537# CONFIG_SERIO is not set
538# CONFIG_GAMEPORT is not set
539
540#
541# Character devices
542#
543CONFIG_VT=y
544CONFIG_VT_CONSOLE=y
545CONFIG_HW_CONSOLE=y
546# CONFIG_SERIAL_NONSTANDARD is not set
547
548#
549# Serial drivers
550#
551# CONFIG_SERIAL_8250 is not set
552
553#
554# Non-8250 serial port support
555#
556CONFIG_SERIAL_AT91=y
557CONFIG_SERIAL_AT91_CONSOLE=y
558# CONFIG_SERIAL_AT91_TTYAT is not set
559CONFIG_SERIAL_CORE=y
560CONFIG_SERIAL_CORE_CONSOLE=y
561CONFIG_UNIX98_PTYS=y
562CONFIG_LEGACY_PTYS=y
563CONFIG_LEGACY_PTY_COUNT=256
564
565#
566# IPMI
567#
568# CONFIG_IPMI_HANDLER is not set
569
570#
571# Watchdog Cards
572#
573CONFIG_WATCHDOG=y
574CONFIG_WATCHDOG_NOWAYOUT=y
575
576#
577# Watchdog Device Drivers
578#
579# CONFIG_SOFT_WATCHDOG is not set
580CONFIG_AT91_WATCHDOG=y
581
582#
583# USB-based Watchdog Cards
584#
585# CONFIG_USBPCWATCHDOG is not set
586# CONFIG_NVRAM is not set
587# CONFIG_RTC is not set
588CONFIG_AT91_RTC=y
589# CONFIG_DTLK is not set
590# CONFIG_R3964 is not set
591
592#
593# Ftape, the floppy tape device driver
594#
595
596#
597# PCMCIA character devices
598#
599# CONFIG_SYNCLINK_CS is not set
600# CONFIG_CARDMAN_4000 is not set
601# CONFIG_CARDMAN_4040 is not set
602# CONFIG_RAW_DRIVER is not set
603
604#
605# TPM devices
606#
607# CONFIG_TCG_TPM is not set
608# CONFIG_TELCLOCK is not set
609CONFIG_AT91_SPI=y
610CONFIG_AT91_SPIDEV=y
611
612#
613# I2C support
614#
615CONFIG_I2C=y
616CONFIG_I2C_CHARDEV=y
617
618#
619# I2C Algorithms
620#
621# CONFIG_I2C_ALGOBIT is not set
622# CONFIG_I2C_ALGOPCF is not set
623# CONFIG_I2C_ALGOPCA is not set
624
625#
626# I2C Hardware Bus support
627#
628CONFIG_I2C_AT91=y
629# CONFIG_I2C_PARPORT_LIGHT is not set
630# CONFIG_I2C_STUB is not set
631# CONFIG_I2C_PCA_ISA is not set
632
633#
634# Miscellaneous I2C Chip support
635#
636# CONFIG_SENSORS_DS1337 is not set
637# CONFIG_SENSORS_DS1374 is not set
638# CONFIG_SENSORS_EEPROM is not set
639# CONFIG_SENSORS_PCF8574 is not set
640# CONFIG_SENSORS_PCA9539 is not set
641# CONFIG_SENSORS_PCF8591 is not set
642# CONFIG_SENSORS_RTC8564 is not set
643# CONFIG_SENSORS_MAX6875 is not set
644# CONFIG_RTC_X1205_I2C is not set
645# CONFIG_I2C_DEBUG_CORE is not set
646# CONFIG_I2C_DEBUG_ALGO is not set
647# CONFIG_I2C_DEBUG_BUS is not set
648# CONFIG_I2C_DEBUG_CHIP is not set
649
650#
651# Hardware Monitoring support
652#
653CONFIG_HWMON=y
654# CONFIG_HWMON_VID is not set
655# CONFIG_SENSORS_ADM1021 is not set
656# CONFIG_SENSORS_ADM1025 is not set
657# CONFIG_SENSORS_ADM1026 is not set
658# CONFIG_SENSORS_ADM1031 is not set
659# CONFIG_SENSORS_ADM9240 is not set
660# CONFIG_SENSORS_ASB100 is not set
661# CONFIG_SENSORS_ATXP1 is not set
662# CONFIG_SENSORS_DS1621 is not set
663# CONFIG_SENSORS_FSCHER is not set
664# CONFIG_SENSORS_FSCPOS is not set
665# CONFIG_SENSORS_GL518SM is not set
666# CONFIG_SENSORS_GL520SM is not set
667# CONFIG_SENSORS_IT87 is not set
668# CONFIG_SENSORS_LM63 is not set
669# CONFIG_SENSORS_LM75 is not set
670# CONFIG_SENSORS_LM77 is not set
671# CONFIG_SENSORS_LM78 is not set
672# CONFIG_SENSORS_LM80 is not set
673# CONFIG_SENSORS_LM83 is not set
674# CONFIG_SENSORS_LM85 is not set
675# CONFIG_SENSORS_LM87 is not set
676# CONFIG_SENSORS_LM90 is not set
677# CONFIG_SENSORS_LM92 is not set
678# CONFIG_SENSORS_MAX1619 is not set
679# CONFIG_SENSORS_PC87360 is not set
680# CONFIG_SENSORS_SMSC47M1 is not set
681# CONFIG_SENSORS_SMSC47B397 is not set
682# CONFIG_SENSORS_W83781D is not set
683# CONFIG_SENSORS_W83792D is not set
684# CONFIG_SENSORS_W83L785TS is not set
685# CONFIG_SENSORS_W83627HF is not set
686# CONFIG_SENSORS_W83627EHF is not set
687# CONFIG_HWMON_DEBUG_CHIP is not set
688
689#
690# Misc devices
691#
692
693#
694# Multimedia Capabilities Port drivers
695#
696
697#
698# Multimedia devices
699#
700# CONFIG_VIDEO_DEV is not set
701
702#
703# Digital Video Broadcasting Devices
704#
705# CONFIG_DVB is not set
706
707#
708# Graphics support
709#
710# CONFIG_FB is not set
711
712#
713# Console display driver support
714#
715# CONFIG_VGA_CONSOLE is not set
716CONFIG_DUMMY_CONSOLE=y
717
718#
719# Sound
720#
721# CONFIG_SOUND is not set
722
723#
724# USB support
725#
726CONFIG_USB_ARCH_HAS_HCD=y
727CONFIG_USB_ARCH_HAS_OHCI=y
728CONFIG_USB=y
729CONFIG_USB_DEBUG=y
730
731#
732# Miscellaneous USB options
733#
734CONFIG_USB_DEVICEFS=y
735# CONFIG_USB_BANDWIDTH is not set
736# CONFIG_USB_DYNAMIC_MINORS is not set
737# CONFIG_USB_OTG is not set
738
739#
740# USB Host Controller Drivers
741#
742# CONFIG_USB_ISP116X_HCD is not set
743CONFIG_USB_OHCI_HCD=y
744# CONFIG_USB_OHCI_BIG_ENDIAN is not set
745CONFIG_USB_OHCI_LITTLE_ENDIAN=y
746# CONFIG_USB_SL811_HCD is not set
747
748#
749# USB Device Class drivers
750#
751# CONFIG_USB_ACM is not set
752# CONFIG_USB_PRINTER is not set
753
754#
755# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
756#
757
758#
759# may also be needed; see USB_STORAGE Help for more information
760#
761# CONFIG_USB_STORAGE is not set
762
763#
764# USB Input Devices
765#
766# CONFIG_USB_HID is not set
767
768#
769# USB HID Boot Protocol drivers
770#
771# CONFIG_USB_KBD is not set
772# CONFIG_USB_MOUSE is not set
773# CONFIG_USB_AIPTEK is not set
774# CONFIG_USB_WACOM is not set
775# CONFIG_USB_ACECAD is not set
776# CONFIG_USB_KBTAB is not set
777# CONFIG_USB_POWERMATE is not set
778# CONFIG_USB_MTOUCH is not set
779# CONFIG_USB_ITMTOUCH is not set
780# CONFIG_USB_EGALAX is not set
781# CONFIG_USB_YEALINK is not set
782# CONFIG_USB_XPAD is not set
783# CONFIG_USB_ATI_REMOTE is not set
784# CONFIG_USB_KEYSPAN_REMOTE is not set
785# CONFIG_USB_APPLETOUCH is not set
786
787#
788# USB Imaging devices
789#
790# CONFIG_USB_MDC800 is not set
791
792#
793# USB Multimedia devices
794#
795# CONFIG_USB_DABUSB is not set
796
797#
798# Video4Linux support is needed for USB Multimedia device support
799#
800
801#
802# USB Network Adapters
803#
804# CONFIG_USB_CATC is not set
805# CONFIG_USB_KAWETH is not set
806# CONFIG_USB_PEGASUS is not set
807# CONFIG_USB_RTL8150 is not set
808# CONFIG_USB_USBNET is not set
809CONFIG_USB_MON=y
810
811#
812# USB port drivers
813#
814
815#
816# USB Serial Converter support
817#
818# CONFIG_USB_SERIAL is not set
819
820#
821# USB Miscellaneous drivers
822#
823# CONFIG_USB_EMI62 is not set
824# CONFIG_USB_EMI26 is not set
825# CONFIG_USB_AUERSWALD is not set
826# CONFIG_USB_RIO500 is not set
827# CONFIG_USB_LEGOTOWER is not set
828# CONFIG_USB_LCD is not set
829# CONFIG_USB_LED is not set
830# CONFIG_USB_CYTHERM is not set
831# CONFIG_USB_PHIDGETKIT is not set
832# CONFIG_USB_PHIDGETSERVO is not set
833# CONFIG_USB_IDMOUSE is not set
834# CONFIG_USB_LD is not set
835# CONFIG_USB_TEST is not set
836
837#
838# USB DSL modem support
839#
840
841#
842# USB Gadget Support
843#
844CONFIG_USB_GADGET=y
845# CONFIG_USB_GADGET_DEBUG_FILES is not set
846CONFIG_USB_GADGET_SELECTED=y
847# CONFIG_USB_GADGET_NET2280 is not set
848# CONFIG_USB_GADGET_PXA2XX is not set
849# CONFIG_USB_GADGET_GOKU is not set
850# CONFIG_USB_GADGET_LH7A40X is not set
851# CONFIG_USB_GADGET_OMAP is not set
852CONFIG_USB_GADGET_AT91=y
853CONFIG_USB_AT91=y
854# CONFIG_USB_GADGET_DUMMY_HCD is not set
855# CONFIG_USB_GADGET_DUALSPEED is not set
856# CONFIG_USB_ZERO is not set
857# CONFIG_USB_ETH is not set
858# CONFIG_USB_GADGETFS is not set
859# CONFIG_USB_FILE_STORAGE is not set
860# CONFIG_USB_G_SERIAL is not set
861
862#
863# MMC/SD Card support
864#
865CONFIG_MMC=y
866# CONFIG_MMC_DEBUG is not set
867CONFIG_MMC_BLOCK=y
868# CONFIG_MMC_WBSD is not set
869CONFIG_MMC_AT91RM9200=y
870
871#
872# File systems
873#
874CONFIG_EXT2_FS=y
875# CONFIG_EXT2_FS_XATTR is not set
876# CONFIG_EXT2_FS_XIP is not set
877# CONFIG_EXT3_FS is not set
878# CONFIG_JBD is not set
879# CONFIG_REISERFS_FS is not set
880# CONFIG_JFS_FS is not set
881# CONFIG_FS_POSIX_ACL is not set
882# CONFIG_XFS_FS is not set
883# CONFIG_MINIX_FS is not set
884# CONFIG_ROMFS_FS is not set
885CONFIG_INOTIFY=y
886# CONFIG_QUOTA is not set
887CONFIG_DNOTIFY=y
888# CONFIG_AUTOFS_FS is not set
889# CONFIG_AUTOFS4_FS is not set
890# CONFIG_FUSE_FS is not set
891
892#
893# CD-ROM/DVD Filesystems
894#
895# CONFIG_ISO9660_FS is not set
896# CONFIG_UDF_FS is not set
897
898#
899# DOS/FAT/NT Filesystems
900#
901# CONFIG_MSDOS_FS is not set
902# CONFIG_VFAT_FS is not set
903# CONFIG_NTFS_FS is not set
904
905#
906# Pseudo filesystems
907#
908CONFIG_PROC_FS=y
909CONFIG_SYSFS=y
910CONFIG_TMPFS=y
911# CONFIG_HUGETLB_PAGE is not set
912CONFIG_RAMFS=y
913# CONFIG_RELAYFS_FS is not set
914
915#
916# Miscellaneous filesystems
917#
918# CONFIG_ADFS_FS is not set
919# CONFIG_AFFS_FS is not set
920# CONFIG_HFS_FS is not set
921# CONFIG_HFSPLUS_FS is not set
922# CONFIG_BEFS_FS is not set
923# CONFIG_BFS_FS is not set
924# CONFIG_EFS_FS is not set
925# CONFIG_JFFS_FS is not set
926# CONFIG_JFFS2_FS is not set
927CONFIG_CRAMFS=y
928# CONFIG_VXFS_FS is not set
929# CONFIG_HPFS_FS is not set
930# CONFIG_QNX4FS_FS is not set
931# CONFIG_SYSV_FS is not set
932# CONFIG_UFS_FS is not set
933
934#
935# Network File Systems
936#
937# CONFIG_NFS_FS is not set
938# CONFIG_NFSD is not set
939# CONFIG_SMB_FS is not set
940# CONFIG_CIFS is not set
941# CONFIG_NCP_FS is not set
942# CONFIG_CODA_FS is not set
943# CONFIG_AFS_FS is not set
944# CONFIG_9P_FS is not set
945
946#
947# Partition Types
948#
949# CONFIG_PARTITION_ADVANCED is not set
950CONFIG_MSDOS_PARTITION=y
951
952#
953# Native Language Support
954#
955# CONFIG_NLS is not set
956
957#
958# Profiling support
959#
960# CONFIG_PROFILING is not set
961
962#
963# Kernel hacking
964#
965# CONFIG_PRINTK_TIME is not set
966CONFIG_DEBUG_KERNEL=y
967# CONFIG_MAGIC_SYSRQ is not set
968CONFIG_LOG_BUF_SHIFT=14
969CONFIG_DETECT_SOFTLOCKUP=y
970# CONFIG_SCHEDSTATS is not set
971# CONFIG_DEBUG_SLAB is not set
972# CONFIG_DEBUG_SPINLOCK is not set
973# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
974# CONFIG_DEBUG_KOBJECT is not set
975CONFIG_DEBUG_BUGVERBOSE=y
976# CONFIG_DEBUG_INFO is not set
977# CONFIG_DEBUG_FS is not set
978# CONFIG_DEBUG_VM is not set
979CONFIG_FRAME_POINTER=y
980# CONFIG_RCU_TORTURE_TEST is not set
981CONFIG_DEBUG_USER=y
982# CONFIG_DEBUG_WAITQ is not set
983# CONFIG_DEBUG_ERRORS is not set
984CONFIG_DEBUG_LL=y
985# CONFIG_DEBUG_ICEDCC is not set
986
987#
988# Security options
989#
990# CONFIG_KEYS is not set
991# CONFIG_SECURITY is not set
992
993#
994# Cryptographic options
995#
996# CONFIG_CRYPTO is not set
997
998#
999# Hardware crypto devices
1000#
1001
1002#
1003# Library routines
1004#
1005# CONFIG_CRC_CCITT is not set
1006# CONFIG_CRC16 is not set
1007CONFIG_CRC32=y
1008# CONFIG_LIBCRC32C is not set
1009CONFIG_ZLIB_INFLATE=y
diff --git a/arch/arm/configs/at91rm9200ek_defconfig b/arch/arm/configs/at91rm9200ek_defconfig
new file mode 100644
index 000000000000..20838ccf1da7
--- /dev/null
+++ b/arch/arm/configs/at91rm9200ek_defconfig
@@ -0,0 +1,998 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15
4# Mon Jan 9 20:57:31 2006
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11
12#
13# Code maturity level options
14#
15CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y
18CONFIG_INIT_ENV_ARG_LIMIT=32
19
20#
21# General setup
22#
23CONFIG_LOCALVERSION=""
24# CONFIG_LOCALVERSION_AUTO is not set
25# CONFIG_SWAP is not set
26CONFIG_SYSVIPC=y
27# CONFIG_POSIX_MQUEUE is not set
28# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set
31CONFIG_HOTPLUG=y
32CONFIG_KOBJECT_UEVENT=y
33# CONFIG_IKCONFIG is not set
34CONFIG_INITRAMFS_SOURCE=""
35CONFIG_CC_OPTIMIZE_FOR_SIZE=y
36# CONFIG_EMBEDDED is not set
37CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set
39# CONFIG_KALLSYMS_EXTRA_PASS is not set
40CONFIG_PRINTK=y
41CONFIG_BUG=y
42CONFIG_BASE_FULL=y
43CONFIG_FUTEX=y
44CONFIG_EPOLL=y
45CONFIG_SHMEM=y
46CONFIG_CC_ALIGN_FUNCTIONS=0
47CONFIG_CC_ALIGN_LABELS=0
48CONFIG_CC_ALIGN_LOOPS=0
49CONFIG_CC_ALIGN_JUMPS=0
50# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0
52
53#
54# Loadable module support
55#
56CONFIG_MODULES=y
57CONFIG_MODULE_UNLOAD=y
58# CONFIG_MODULE_FORCE_UNLOAD is not set
59CONFIG_OBSOLETE_MODPARM=y
60# CONFIG_MODVERSIONS is not set
61# CONFIG_MODULE_SRCVERSION_ALL is not set
62CONFIG_KMOD=y
63
64#
65# Block layer
66#
67
68#
69# IO Schedulers
70#
71CONFIG_IOSCHED_NOOP=y
72CONFIG_IOSCHED_AS=y
73# CONFIG_IOSCHED_DEADLINE is not set
74# CONFIG_IOSCHED_CFQ is not set
75CONFIG_DEFAULT_AS=y
76# CONFIG_DEFAULT_DEADLINE is not set
77# CONFIG_DEFAULT_CFQ is not set
78# CONFIG_DEFAULT_NOOP is not set
79CONFIG_DEFAULT_IOSCHED="anticipatory"
80
81#
82# System Type
83#
84# CONFIG_ARCH_CLPS7500 is not set
85# CONFIG_ARCH_CLPS711X is not set
86# CONFIG_ARCH_CO285 is not set
87# CONFIG_ARCH_EBSA110 is not set
88# CONFIG_ARCH_CAMELOT is not set
89# CONFIG_ARCH_FOOTBRIDGE is not set
90# CONFIG_ARCH_INTEGRATOR is not set
91# CONFIG_ARCH_IOP3XX is not set
92# CONFIG_ARCH_IXP4XX is not set
93# CONFIG_ARCH_IXP2000 is not set
94# CONFIG_ARCH_L7200 is not set
95# CONFIG_ARCH_PXA is not set
96# CONFIG_ARCH_RPC is not set
97# CONFIG_ARCH_SA1100 is not set
98# CONFIG_ARCH_S3C2410 is not set
99# CONFIG_ARCH_SHARK is not set
100# CONFIG_ARCH_LH7A40X is not set
101# CONFIG_ARCH_OMAP is not set
102# CONFIG_ARCH_VERSATILE is not set
103# CONFIG_ARCH_REALVIEW is not set
104# CONFIG_ARCH_IMX is not set
105# CONFIG_ARCH_H720X is not set
106# CONFIG_ARCH_AAEC2000 is not set
107CONFIG_ARCH_AT91RM9200=y
108
109#
110# AT91RM9200 Implementations
111#
112
113#
114# AT91RM9200 Board Type
115#
116# CONFIG_ARCH_AT91RM9200DK is not set
117CONFIG_MACH_AT91RM9200EK=y
118# CONFIG_MACH_CSB337 is not set
119# CONFIG_MACH_CSB637 is not set
120# CONFIG_MACH_CARMEVA is not set
121# CONFIG_MACH_KB9200 is not set
122# CONFIG_MACH_ATEB9200 is not set
123
124#
125# AT91RM9200 Feature Selections
126#
127CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
128
129#
130# Processor Type
131#
132CONFIG_CPU_32=y
133CONFIG_CPU_ARM920T=y
134CONFIG_CPU_32v4=y
135CONFIG_CPU_ABRT_EV4T=y
136CONFIG_CPU_CACHE_V4WT=y
137CONFIG_CPU_CACHE_VIVT=y
138CONFIG_CPU_COPY_V4WB=y
139CONFIG_CPU_TLB_V4WBI=y
140
141#
142# Processor Features
143#
144# CONFIG_ARM_THUMB is not set
145# CONFIG_CPU_ICACHE_DISABLE is not set
146# CONFIG_CPU_DCACHE_DISABLE is not set
147# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
148
149#
150# Bus support
151#
152CONFIG_ISA_DMA_API=y
153
154#
155# PCCARD (PCMCIA/CardBus) support
156#
157# CONFIG_PCCARD is not set
158
159#
160# Kernel Features
161#
162# CONFIG_PREEMPT is not set
163# CONFIG_NO_IDLE_HZ is not set
164# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
165CONFIG_SELECT_MEMORY_MODEL=y
166CONFIG_FLATMEM_MANUAL=y
167# CONFIG_DISCONTIGMEM_MANUAL is not set
168# CONFIG_SPARSEMEM_MANUAL is not set
169CONFIG_FLATMEM=y
170CONFIG_FLAT_NODE_MEM_MAP=y
171# CONFIG_SPARSEMEM_STATIC is not set
172CONFIG_SPLIT_PTLOCK_CPUS=4096
173CONFIG_LEDS=y
174CONFIG_LEDS_TIMER=y
175CONFIG_LEDS_CPU=y
176CONFIG_ALIGNMENT_TRAP=y
177
178#
179# Boot options
180#
181CONFIG_ZBOOT_ROM_TEXT=0x0
182CONFIG_ZBOOT_ROM_BSS=0x0
183CONFIG_CMDLINE="mem=32M console=ttyS0,115200 initrd=0x20410000,3145728 root=/dev/ram0 rw"
184# CONFIG_XIP_KERNEL is not set
185
186#
187# Floating point emulation
188#
189
190#
191# At least one emulation must be selected
192#
193CONFIG_FPE_NWFPE=y
194# CONFIG_FPE_NWFPE_XP is not set
195# CONFIG_FPE_FASTFPE is not set
196
197#
198# Userspace binary formats
199#
200CONFIG_BINFMT_ELF=y
201# CONFIG_BINFMT_AOUT is not set
202# CONFIG_BINFMT_MISC is not set
203# CONFIG_ARTHUR is not set
204
205#
206# Power management options
207#
208# CONFIG_PM is not set
209
210#
211# Networking
212#
213CONFIG_NET=y
214
215#
216# Networking options
217#
218CONFIG_PACKET=y
219# CONFIG_PACKET_MMAP is not set
220CONFIG_UNIX=y
221# CONFIG_NET_KEY is not set
222CONFIG_INET=y
223# CONFIG_IP_MULTICAST is not set
224# CONFIG_IP_ADVANCED_ROUTER is not set
225CONFIG_IP_FIB_HASH=y
226CONFIG_IP_PNP=y
227# CONFIG_IP_PNP_DHCP is not set
228CONFIG_IP_PNP_BOOTP=y
229# CONFIG_IP_PNP_RARP is not set
230# CONFIG_NET_IPIP is not set
231# CONFIG_NET_IPGRE is not set
232# CONFIG_ARPD is not set
233# CONFIG_SYN_COOKIES is not set
234# CONFIG_INET_AH is not set
235# CONFIG_INET_ESP is not set
236# CONFIG_INET_IPCOMP is not set
237# CONFIG_INET_TUNNEL is not set
238CONFIG_INET_DIAG=y
239CONFIG_INET_TCP_DIAG=y
240# CONFIG_TCP_CONG_ADVANCED is not set
241CONFIG_TCP_CONG_BIC=y
242# CONFIG_IPV6 is not set
243# CONFIG_NETFILTER is not set
244
245#
246# DCCP Configuration (EXPERIMENTAL)
247#
248# CONFIG_IP_DCCP is not set
249
250#
251# SCTP Configuration (EXPERIMENTAL)
252#
253# CONFIG_IP_SCTP is not set
254# CONFIG_ATM is not set
255# CONFIG_BRIDGE is not set
256# CONFIG_VLAN_8021Q is not set
257# CONFIG_DECNET is not set
258# CONFIG_LLC2 is not set
259# CONFIG_IPX is not set
260# CONFIG_ATALK is not set
261# CONFIG_X25 is not set
262# CONFIG_LAPB is not set
263# CONFIG_NET_DIVERT is not set
264# CONFIG_ECONET is not set
265# CONFIG_WAN_ROUTER is not set
266
267#
268# QoS and/or fair queueing
269#
270# CONFIG_NET_SCHED is not set
271
272#
273# Network testing
274#
275# CONFIG_NET_PKTGEN is not set
276# CONFIG_HAMRADIO is not set
277# CONFIG_IRDA is not set
278# CONFIG_BT is not set
279# CONFIG_IEEE80211 is not set
280
281#
282# Device Drivers
283#
284
285#
286# Generic Driver Options
287#
288CONFIG_STANDALONE=y
289CONFIG_PREVENT_FIRMWARE_BUILD=y
290# CONFIG_FW_LOADER is not set
291# CONFIG_DEBUG_DRIVER is not set
292
293#
294# Connector - unified userspace <-> kernelspace linker
295#
296# CONFIG_CONNECTOR is not set
297
298#
299# Memory Technology Devices (MTD)
300#
301CONFIG_MTD=y
302# CONFIG_MTD_DEBUG is not set
303# CONFIG_MTD_CONCAT is not set
304CONFIG_MTD_PARTITIONS=y
305# CONFIG_MTD_REDBOOT_PARTS is not set
306CONFIG_MTD_CMDLINE_PARTS=y
307# CONFIG_MTD_AFS_PARTS is not set
308
309#
310# User Modules And Translation Layers
311#
312CONFIG_MTD_CHAR=y
313CONFIG_MTD_BLOCK=y
314# CONFIG_FTL is not set
315# CONFIG_NFTL is not set
316# CONFIG_INFTL is not set
317# CONFIG_RFD_FTL is not set
318
319#
320# RAM/ROM/Flash chip drivers
321#
322CONFIG_MTD_CFI=y
323CONFIG_MTD_JEDECPROBE=y
324CONFIG_MTD_GEN_PROBE=y
325# CONFIG_MTD_CFI_ADV_OPTIONS is not set
326CONFIG_MTD_MAP_BANK_WIDTH_1=y
327CONFIG_MTD_MAP_BANK_WIDTH_2=y
328CONFIG_MTD_MAP_BANK_WIDTH_4=y
329# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
330# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
331# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
332CONFIG_MTD_CFI_I1=y
333CONFIG_MTD_CFI_I2=y
334# CONFIG_MTD_CFI_I4 is not set
335# CONFIG_MTD_CFI_I8 is not set
336# CONFIG_MTD_CFI_INTELEXT is not set
337CONFIG_MTD_CFI_AMDSTD=y
338CONFIG_MTD_CFI_AMDSTD_RETRY=0
339# CONFIG_MTD_CFI_STAA is not set
340CONFIG_MTD_CFI_UTIL=y
341# CONFIG_MTD_RAM is not set
342# CONFIG_MTD_ROM is not set
343# CONFIG_MTD_ABSENT is not set
344# CONFIG_MTD_XIP is not set
345
346#
347# Mapping drivers for chip access
348#
349# CONFIG_MTD_COMPLEX_MAPPINGS is not set
350CONFIG_MTD_PHYSMAP=y
351CONFIG_MTD_PHYSMAP_START=0x10000000
352CONFIG_MTD_PHYSMAP_LEN=0x800000
353CONFIG_MTD_PHYSMAP_BANKWIDTH=2
354# CONFIG_MTD_ARM_INTEGRATOR is not set
355# CONFIG_MTD_IMPA7 is not set
356# CONFIG_MTD_PLATRAM is not set
357
358#
359# Self-contained MTD device drivers
360#
361# CONFIG_MTD_SLRAM is not set
362# CONFIG_MTD_PHRAM is not set
363# CONFIG_MTD_MTDRAM is not set
364# CONFIG_MTD_BLKMTD is not set
365# CONFIG_MTD_BLOCK2MTD is not set
366
367#
368# Disk-On-Chip Device Drivers
369#
370# CONFIG_MTD_DOC2000 is not set
371# CONFIG_MTD_DOC2001 is not set
372# CONFIG_MTD_DOC2001PLUS is not set
373CONFIG_MTD_AT91_DATAFLASH=y
374CONFIG_MTD_AT91_DATAFLASH_CARD=y
375
376#
377# NAND Flash Device Drivers
378#
379# CONFIG_MTD_NAND is not set
380
381#
382# OneNAND Flash Device Drivers
383#
384# CONFIG_MTD_ONENAND is not set
385
386#
387# Parallel port support
388#
389# CONFIG_PARPORT is not set
390
391#
392# Plug and Play support
393#
394
395#
396# Block devices
397#
398# CONFIG_BLK_DEV_COW_COMMON is not set
399# CONFIG_BLK_DEV_LOOP is not set
400# CONFIG_BLK_DEV_NBD is not set
401# CONFIG_BLK_DEV_UB is not set
402CONFIG_BLK_DEV_RAM=y
403CONFIG_BLK_DEV_RAM_COUNT=16
404CONFIG_BLK_DEV_RAM_SIZE=8192
405CONFIG_BLK_DEV_INITRD=y
406# CONFIG_CDROM_PKTCDVD is not set
407# CONFIG_ATA_OVER_ETH is not set
408
409#
410# SCSI device support
411#
412# CONFIG_RAID_ATTRS is not set
413# CONFIG_SCSI is not set
414
415#
416# Multi-device support (RAID and LVM)
417#
418# CONFIG_MD is not set
419
420#
421# Fusion MPT device support
422#
423# CONFIG_FUSION is not set
424
425#
426# IEEE 1394 (FireWire) support
427#
428
429#
430# I2O device support
431#
432
433#
434# Network device support
435#
436CONFIG_NETDEVICES=y
437# CONFIG_DUMMY is not set
438# CONFIG_BONDING is not set
439# CONFIG_EQUALIZER is not set
440# CONFIG_TUN is not set
441
442#
443# PHY device support
444#
445# CONFIG_PHYLIB is not set
446
447#
448# Ethernet (10 or 100Mbit)
449#
450CONFIG_NET_ETHERNET=y
451CONFIG_MII=y
452CONFIG_ARM_AT91_ETHER=y
453# CONFIG_SMC91X is not set
454# CONFIG_DM9000 is not set
455
456#
457# Ethernet (1000 Mbit)
458#
459
460#
461# Ethernet (10000 Mbit)
462#
463
464#
465# Token Ring devices
466#
467
468#
469# Wireless LAN (non-hamradio)
470#
471# CONFIG_NET_RADIO is not set
472
473#
474# Wan interfaces
475#
476# CONFIG_WAN is not set
477# CONFIG_PPP is not set
478# CONFIG_SLIP is not set
479# CONFIG_SHAPER is not set
480# CONFIG_NETCONSOLE is not set
481# CONFIG_NETPOLL is not set
482# CONFIG_NET_POLL_CONTROLLER is not set
483
484#
485# ISDN subsystem
486#
487# CONFIG_ISDN is not set
488
489#
490# Input device support
491#
492CONFIG_INPUT=y
493
494#
495# Userland interfaces
496#
497CONFIG_INPUT_MOUSEDEV=y
498# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
499CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
500CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
501# CONFIG_INPUT_JOYDEV is not set
502# CONFIG_INPUT_TSDEV is not set
503# CONFIG_INPUT_EVDEV is not set
504# CONFIG_INPUT_EVBUG is not set
505
506#
507# Input Device Drivers
508#
509# CONFIG_INPUT_KEYBOARD is not set
510# CONFIG_INPUT_MOUSE is not set
511# CONFIG_INPUT_JOYSTICK is not set
512# CONFIG_INPUT_TOUCHSCREEN is not set
513# CONFIG_INPUT_MISC is not set
514
515#
516# Hardware I/O ports
517#
518# CONFIG_SERIO is not set
519# CONFIG_GAMEPORT is not set
520
521#
522# Character devices
523#
524CONFIG_VT=y
525CONFIG_VT_CONSOLE=y
526CONFIG_HW_CONSOLE=y
527# CONFIG_SERIAL_NONSTANDARD is not set
528
529#
530# Serial drivers
531#
532# CONFIG_SERIAL_8250 is not set
533
534#
535# Non-8250 serial port support
536#
537CONFIG_SERIAL_AT91=y
538CONFIG_SERIAL_AT91_CONSOLE=y
539# CONFIG_SERIAL_AT91_TTYAT is not set
540CONFIG_SERIAL_CORE=y
541CONFIG_SERIAL_CORE_CONSOLE=y
542CONFIG_UNIX98_PTYS=y
543CONFIG_LEGACY_PTYS=y
544CONFIG_LEGACY_PTY_COUNT=256
545
546#
547# IPMI
548#
549# CONFIG_IPMI_HANDLER is not set
550
551#
552# Watchdog Cards
553#
554CONFIG_WATCHDOG=y
555CONFIG_WATCHDOG_NOWAYOUT=y
556
557#
558# Watchdog Device Drivers
559#
560# CONFIG_SOFT_WATCHDOG is not set
561CONFIG_AT91_WATCHDOG=y
562
563#
564# USB-based Watchdog Cards
565#
566# CONFIG_USBPCWATCHDOG is not set
567# CONFIG_NVRAM is not set
568# CONFIG_RTC is not set
569CONFIG_AT91_RTC=y
570# CONFIG_DTLK is not set
571# CONFIG_R3964 is not set
572
573#
574# Ftape, the floppy tape device driver
575#
576# CONFIG_RAW_DRIVER is not set
577
578#
579# TPM devices
580#
581# CONFIG_TCG_TPM is not set
582# CONFIG_TELCLOCK is not set
583CONFIG_AT91_SPI=y
584CONFIG_AT91_SPIDEV=y
585
586#
587# I2C support
588#
589CONFIG_I2C=y
590CONFIG_I2C_CHARDEV=y
591
592#
593# I2C Algorithms
594#
595# CONFIG_I2C_ALGOBIT is not set
596# CONFIG_I2C_ALGOPCF is not set
597# CONFIG_I2C_ALGOPCA is not set
598
599#
600# I2C Hardware Bus support
601#
602CONFIG_I2C_AT91=y
603# CONFIG_I2C_PARPORT_LIGHT is not set
604# CONFIG_I2C_STUB is not set
605# CONFIG_I2C_PCA_ISA is not set
606
607#
608# Miscellaneous I2C Chip support
609#
610# CONFIG_SENSORS_DS1337 is not set
611# CONFIG_SENSORS_DS1374 is not set
612# CONFIG_SENSORS_EEPROM is not set
613# CONFIG_SENSORS_PCF8574 is not set
614# CONFIG_SENSORS_PCA9539 is not set
615# CONFIG_SENSORS_PCF8591 is not set
616# CONFIG_SENSORS_RTC8564 is not set
617# CONFIG_SENSORS_MAX6875 is not set
618# CONFIG_RTC_X1205_I2C is not set
619# CONFIG_I2C_DEBUG_CORE is not set
620# CONFIG_I2C_DEBUG_ALGO is not set
621# CONFIG_I2C_DEBUG_BUS is not set
622# CONFIG_I2C_DEBUG_CHIP is not set
623
624#
625# Hardware Monitoring support
626#
627CONFIG_HWMON=y
628# CONFIG_HWMON_VID is not set
629# CONFIG_SENSORS_ADM1021 is not set
630# CONFIG_SENSORS_ADM1025 is not set
631# CONFIG_SENSORS_ADM1026 is not set
632# CONFIG_SENSORS_ADM1031 is not set
633# CONFIG_SENSORS_ADM9240 is not set
634# CONFIG_SENSORS_ASB100 is not set
635# CONFIG_SENSORS_ATXP1 is not set
636# CONFIG_SENSORS_DS1621 is not set
637# CONFIG_SENSORS_FSCHER is not set
638# CONFIG_SENSORS_FSCPOS is not set
639# CONFIG_SENSORS_GL518SM is not set
640# CONFIG_SENSORS_GL520SM is not set
641# CONFIG_SENSORS_IT87 is not set
642# CONFIG_SENSORS_LM63 is not set
643# CONFIG_SENSORS_LM75 is not set
644# CONFIG_SENSORS_LM77 is not set
645# CONFIG_SENSORS_LM78 is not set
646# CONFIG_SENSORS_LM80 is not set
647# CONFIG_SENSORS_LM83 is not set
648# CONFIG_SENSORS_LM85 is not set
649# CONFIG_SENSORS_LM87 is not set
650# CONFIG_SENSORS_LM90 is not set
651# CONFIG_SENSORS_LM92 is not set
652# CONFIG_SENSORS_MAX1619 is not set
653# CONFIG_SENSORS_PC87360 is not set
654# CONFIG_SENSORS_SMSC47M1 is not set
655# CONFIG_SENSORS_SMSC47B397 is not set
656# CONFIG_SENSORS_W83781D is not set
657# CONFIG_SENSORS_W83792D is not set
658# CONFIG_SENSORS_W83L785TS is not set
659# CONFIG_SENSORS_W83627HF is not set
660# CONFIG_SENSORS_W83627EHF is not set
661# CONFIG_HWMON_DEBUG_CHIP is not set
662
663#
664# Misc devices
665#
666
667#
668# Multimedia Capabilities Port drivers
669#
670
671#
672# Multimedia devices
673#
674# CONFIG_VIDEO_DEV is not set
675
676#
677# Digital Video Broadcasting Devices
678#
679# CONFIG_DVB is not set
680
681#
682# Graphics support
683#
684CONFIG_FB=y
685CONFIG_FB_CFB_FILLRECT=y
686CONFIG_FB_CFB_COPYAREA=y
687CONFIG_FB_CFB_IMAGEBLIT=y
688# CONFIG_FB_MACMODES is not set
689# CONFIG_FB_MODE_HELPERS is not set
690# CONFIG_FB_TILEBLITTING is not set
691CONFIG_FB_S1D13XXX=y
692# CONFIG_FB_VIRTUAL is not set
693
694#
695# Console display driver support
696#
697# CONFIG_VGA_CONSOLE is not set
698CONFIG_DUMMY_CONSOLE=y
699# CONFIG_FRAMEBUFFER_CONSOLE is not set
700
701#
702# Logo configuration
703#
704# CONFIG_LOGO is not set
705# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
706
707#
708# Sound
709#
710# CONFIG_SOUND is not set
711
712#
713# USB support
714#
715CONFIG_USB_ARCH_HAS_HCD=y
716CONFIG_USB_ARCH_HAS_OHCI=y
717CONFIG_USB=y
718CONFIG_USB_DEBUG=y
719
720#
721# Miscellaneous USB options
722#
723CONFIG_USB_DEVICEFS=y
724# CONFIG_USB_BANDWIDTH is not set
725# CONFIG_USB_DYNAMIC_MINORS is not set
726# CONFIG_USB_OTG is not set
727
728#
729# USB Host Controller Drivers
730#
731# CONFIG_USB_ISP116X_HCD is not set
732CONFIG_USB_OHCI_HCD=y
733# CONFIG_USB_OHCI_BIG_ENDIAN is not set
734CONFIG_USB_OHCI_LITTLE_ENDIAN=y
735# CONFIG_USB_SL811_HCD is not set
736
737#
738# USB Device Class drivers
739#
740# CONFIG_USB_ACM is not set
741# CONFIG_USB_PRINTER is not set
742
743#
744# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
745#
746
747#
748# may also be needed; see USB_STORAGE Help for more information
749#
750# CONFIG_USB_STORAGE is not set
751
752#
753# USB Input Devices
754#
755# CONFIG_USB_HID is not set
756
757#
758# USB HID Boot Protocol drivers
759#
760# CONFIG_USB_KBD is not set
761# CONFIG_USB_MOUSE is not set
762# CONFIG_USB_AIPTEK is not set
763# CONFIG_USB_WACOM is not set
764# CONFIG_USB_ACECAD is not set
765# CONFIG_USB_KBTAB is not set
766# CONFIG_USB_POWERMATE is not set
767# CONFIG_USB_MTOUCH is not set
768# CONFIG_USB_ITMTOUCH is not set
769# CONFIG_USB_EGALAX is not set
770# CONFIG_USB_YEALINK is not set
771# CONFIG_USB_XPAD is not set
772# CONFIG_USB_ATI_REMOTE is not set
773# CONFIG_USB_KEYSPAN_REMOTE is not set
774# CONFIG_USB_APPLETOUCH is not set
775
776#
777# USB Imaging devices
778#
779# CONFIG_USB_MDC800 is not set
780
781#
782# USB Multimedia devices
783#
784# CONFIG_USB_DABUSB is not set
785
786#
787# Video4Linux support is needed for USB Multimedia device support
788#
789
790#
791# USB Network Adapters
792#
793# CONFIG_USB_CATC is not set
794# CONFIG_USB_KAWETH is not set
795# CONFIG_USB_PEGASUS is not set
796# CONFIG_USB_RTL8150 is not set
797# CONFIG_USB_USBNET is not set
798CONFIG_USB_MON=y
799
800#
801# USB port drivers
802#
803
804#
805# USB Serial Converter support
806#
807# CONFIG_USB_SERIAL is not set
808
809#
810# USB Miscellaneous drivers
811#
812# CONFIG_USB_EMI62 is not set
813# CONFIG_USB_EMI26 is not set
814# CONFIG_USB_AUERSWALD is not set
815# CONFIG_USB_RIO500 is not set
816# CONFIG_USB_LEGOTOWER is not set
817# CONFIG_USB_LCD is not set
818# CONFIG_USB_LED is not set
819# CONFIG_USB_CYTHERM is not set
820# CONFIG_USB_PHIDGETKIT is not set
821# CONFIG_USB_PHIDGETSERVO is not set
822# CONFIG_USB_IDMOUSE is not set
823# CONFIG_USB_LD is not set
824# CONFIG_USB_TEST is not set
825
826#
827# USB DSL modem support
828#
829
830#
831# USB Gadget Support
832#
833CONFIG_USB_GADGET=y
834# CONFIG_USB_GADGET_DEBUG_FILES is not set
835CONFIG_USB_GADGET_SELECTED=y
836# CONFIG_USB_GADGET_NET2280 is not set
837# CONFIG_USB_GADGET_PXA2XX is not set
838# CONFIG_USB_GADGET_GOKU is not set
839# CONFIG_USB_GADGET_LH7A40X is not set
840# CONFIG_USB_GADGET_OMAP is not set
841CONFIG_USB_GADGET_AT91=y
842CONFIG_USB_AT91=y
843# CONFIG_USB_GADGET_DUMMY_HCD is not set
844# CONFIG_USB_GADGET_DUALSPEED is not set
845# CONFIG_USB_ZERO is not set
846# CONFIG_USB_ETH is not set
847# CONFIG_USB_GADGETFS is not set
848# CONFIG_USB_FILE_STORAGE is not set
849# CONFIG_USB_G_SERIAL is not set
850
851#
852# MMC/SD Card support
853#
854CONFIG_MMC=y
855# CONFIG_MMC_DEBUG is not set
856CONFIG_MMC_BLOCK=y
857# CONFIG_MMC_WBSD is not set
858CONFIG_MMC_AT91RM9200=y
859
860#
861# File systems
862#
863CONFIG_EXT2_FS=y
864# CONFIG_EXT2_FS_XATTR is not set
865# CONFIG_EXT2_FS_XIP is not set
866# CONFIG_EXT3_FS is not set
867# CONFIG_JBD is not set
868# CONFIG_REISERFS_FS is not set
869# CONFIG_JFS_FS is not set
870# CONFIG_FS_POSIX_ACL is not set
871# CONFIG_XFS_FS is not set
872# CONFIG_MINIX_FS is not set
873# CONFIG_ROMFS_FS is not set
874CONFIG_INOTIFY=y
875# CONFIG_QUOTA is not set
876CONFIG_DNOTIFY=y
877# CONFIG_AUTOFS_FS is not set
878# CONFIG_AUTOFS4_FS is not set
879# CONFIG_FUSE_FS is not set
880
881#
882# CD-ROM/DVD Filesystems
883#
884# CONFIG_ISO9660_FS is not set
885# CONFIG_UDF_FS is not set
886
887#
888# DOS/FAT/NT Filesystems
889#
890# CONFIG_MSDOS_FS is not set
891# CONFIG_VFAT_FS is not set
892# CONFIG_NTFS_FS is not set
893
894#
895# Pseudo filesystems
896#
897CONFIG_PROC_FS=y
898CONFIG_SYSFS=y
899CONFIG_TMPFS=y
900# CONFIG_HUGETLB_PAGE is not set
901CONFIG_RAMFS=y
902# CONFIG_RELAYFS_FS is not set
903
904#
905# Miscellaneous filesystems
906#
907# CONFIG_ADFS_FS is not set
908# CONFIG_AFFS_FS is not set
909# CONFIG_HFS_FS is not set
910# CONFIG_HFSPLUS_FS is not set
911# CONFIG_BEFS_FS is not set
912# CONFIG_BFS_FS is not set
913# CONFIG_EFS_FS is not set
914# CONFIG_JFFS_FS is not set
915# CONFIG_JFFS2_FS is not set
916CONFIG_CRAMFS=y
917# CONFIG_VXFS_FS is not set
918# CONFIG_HPFS_FS is not set
919# CONFIG_QNX4FS_FS is not set
920# CONFIG_SYSV_FS is not set
921# CONFIG_UFS_FS is not set
922
923#
924# Network File Systems
925#
926# CONFIG_NFS_FS is not set
927# CONFIG_NFSD is not set
928# CONFIG_SMB_FS is not set
929# CONFIG_CIFS is not set
930# CONFIG_NCP_FS is not set
931# CONFIG_CODA_FS is not set
932# CONFIG_AFS_FS is not set
933# CONFIG_9P_FS is not set
934
935#
936# Partition Types
937#
938# CONFIG_PARTITION_ADVANCED is not set
939CONFIG_MSDOS_PARTITION=y
940
941#
942# Native Language Support
943#
944# CONFIG_NLS is not set
945
946#
947# Profiling support
948#
949# CONFIG_PROFILING is not set
950
951#
952# Kernel hacking
953#
954# CONFIG_PRINTK_TIME is not set
955CONFIG_DEBUG_KERNEL=y
956# CONFIG_MAGIC_SYSRQ is not set
957CONFIG_LOG_BUF_SHIFT=14
958CONFIG_DETECT_SOFTLOCKUP=y
959# CONFIG_SCHEDSTATS is not set
960# CONFIG_DEBUG_SLAB is not set
961# CONFIG_DEBUG_SPINLOCK is not set
962# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
963# CONFIG_DEBUG_KOBJECT is not set
964CONFIG_DEBUG_BUGVERBOSE=y
965# CONFIG_DEBUG_INFO is not set
966# CONFIG_DEBUG_FS is not set
967# CONFIG_DEBUG_VM is not set
968CONFIG_FRAME_POINTER=y
969# CONFIG_RCU_TORTURE_TEST is not set
970CONFIG_DEBUG_USER=y
971# CONFIG_DEBUG_WAITQ is not set
972# CONFIG_DEBUG_ERRORS is not set
973CONFIG_DEBUG_LL=y
974# CONFIG_DEBUG_ICEDCC is not set
975
976#
977# Security options
978#
979# CONFIG_KEYS is not set
980# CONFIG_SECURITY is not set
981
982#
983# Cryptographic options
984#
985# CONFIG_CRYPTO is not set
986
987#
988# Hardware crypto devices
989#
990
991#
992# Library routines
993#
994# CONFIG_CRC_CCITT is not set
995# CONFIG_CRC16 is not set
996CONFIG_CRC32=y
997# CONFIG_LIBCRC32C is not set
998CONFIG_ZLIB_INFLATE=y
diff --git a/arch/arm/configs/badge4_defconfig b/arch/arm/configs/badge4_defconfig
index 5d92af975d87..cfe6bd8e81cd 100644
--- a/arch/arm/configs/badge4_defconfig
+++ b/arch/arm/configs/badge4_defconfig
@@ -66,7 +66,6 @@ CONFIG_KMOD=y
66# CONFIG_ARCH_CLPS711X is not set 66# CONFIG_ARCH_CLPS711X is not set
67# CONFIG_ARCH_CO285 is not set 67# CONFIG_ARCH_CO285 is not set
68# CONFIG_ARCH_EBSA110 is not set 68# CONFIG_ARCH_EBSA110 is not set
69# CONFIG_ARCH_CAMELOT is not set
70# CONFIG_ARCH_FOOTBRIDGE is not set 69# CONFIG_ARCH_FOOTBRIDGE is not set
71# CONFIG_ARCH_INTEGRATOR is not set 70# CONFIG_ARCH_INTEGRATOR is not set
72# CONFIG_ARCH_IOP3XX is not set 71# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/bast_defconfig b/arch/arm/configs/bast_defconfig
index 35e3a99bcbb6..6886001b5366 100644
--- a/arch/arm/configs/bast_defconfig
+++ b/arch/arm/configs/bast_defconfig
@@ -64,7 +64,6 @@ CONFIG_KMOD=y
64# CONFIG_ARCH_CLPS711X is not set 64# CONFIG_ARCH_CLPS711X is not set
65# CONFIG_ARCH_CO285 is not set 65# CONFIG_ARCH_CO285 is not set
66# CONFIG_ARCH_EBSA110 is not set 66# CONFIG_ARCH_EBSA110 is not set
67# CONFIG_ARCH_CAMELOT is not set
68# CONFIG_ARCH_FOOTBRIDGE is not set 67# CONFIG_ARCH_FOOTBRIDGE is not set
69# CONFIG_ARCH_INTEGRATOR is not set 68# CONFIG_ARCH_INTEGRATOR is not set
70# CONFIG_ARCH_IOP3XX is not set 69# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/cerfcube_defconfig b/arch/arm/configs/cerfcube_defconfig
index d8fe0f40408f..f81a60005cd3 100644
--- a/arch/arm/configs/cerfcube_defconfig
+++ b/arch/arm/configs/cerfcube_defconfig
@@ -65,7 +65,6 @@ CONFIG_KMOD=y
65# CONFIG_ARCH_CLPS711X is not set 65# CONFIG_ARCH_CLPS711X is not set
66# CONFIG_ARCH_CO285 is not set 66# CONFIG_ARCH_CO285 is not set
67# CONFIG_ARCH_EBSA110 is not set 67# CONFIG_ARCH_EBSA110 is not set
68# CONFIG_ARCH_CAMELOT is not set
69# CONFIG_ARCH_FOOTBRIDGE is not set 68# CONFIG_ARCH_FOOTBRIDGE is not set
70# CONFIG_ARCH_INTEGRATOR is not set 69# CONFIG_ARCH_INTEGRATOR is not set
71# CONFIG_ARCH_IOP3XX is not set 70# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/clps7500_defconfig b/arch/arm/configs/clps7500_defconfig
index 908758371405..af9ae5389131 100644
--- a/arch/arm/configs/clps7500_defconfig
+++ b/arch/arm/configs/clps7500_defconfig
@@ -57,7 +57,6 @@ CONFIG_ARCH_CLPS7500=y
57# CONFIG_ARCH_CLPS711X is not set 57# CONFIG_ARCH_CLPS711X is not set
58# CONFIG_ARCH_CO285 is not set 58# CONFIG_ARCH_CO285 is not set
59# CONFIG_ARCH_EBSA110 is not set 59# CONFIG_ARCH_EBSA110 is not set
60# CONFIG_ARCH_CAMELOT is not set
61# CONFIG_ARCH_FOOTBRIDGE is not set 60# CONFIG_ARCH_FOOTBRIDGE is not set
62# CONFIG_ARCH_INTEGRATOR is not set 61# CONFIG_ARCH_INTEGRATOR is not set
63# CONFIG_ARCH_IOP3XX is not set 62# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/collie_defconfig b/arch/arm/configs/collie_defconfig
index 40dfe07a8bce..15468a0cf70e 100644
--- a/arch/arm/configs/collie_defconfig
+++ b/arch/arm/configs/collie_defconfig
@@ -71,7 +71,6 @@ CONFIG_KMOD=y
71# CONFIG_ARCH_CLPS711X is not set 71# CONFIG_ARCH_CLPS711X is not set
72# CONFIG_ARCH_CO285 is not set 72# CONFIG_ARCH_CO285 is not set
73# CONFIG_ARCH_EBSA110 is not set 73# CONFIG_ARCH_EBSA110 is not set
74# CONFIG_ARCH_CAMELOT is not set
75# CONFIG_ARCH_FOOTBRIDGE is not set 74# CONFIG_ARCH_FOOTBRIDGE is not set
76# CONFIG_ARCH_INTEGRATOR is not set 75# CONFIG_ARCH_INTEGRATOR is not set
77# CONFIG_ARCH_IOP3XX is not set 76# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/corgi_defconfig b/arch/arm/configs/corgi_defconfig
index 06229026f78b..3c3461e83398 100644
--- a/arch/arm/configs/corgi_defconfig
+++ b/arch/arm/configs/corgi_defconfig
@@ -87,7 +87,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
87# CONFIG_ARCH_CLPS711X is not set 87# CONFIG_ARCH_CLPS711X is not set
88# CONFIG_ARCH_CO285 is not set 88# CONFIG_ARCH_CO285 is not set
89# CONFIG_ARCH_EBSA110 is not set 89# CONFIG_ARCH_EBSA110 is not set
90# CONFIG_ARCH_CAMELOT is not set
91# CONFIG_ARCH_FOOTBRIDGE is not set 90# CONFIG_ARCH_FOOTBRIDGE is not set
92# CONFIG_ARCH_INTEGRATOR is not set 91# CONFIG_ARCH_INTEGRATOR is not set
93# CONFIG_ARCH_IOP3XX is not set 92# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/csb337_defconfig b/arch/arm/configs/csb337_defconfig
new file mode 100644
index 000000000000..885a3184830a
--- /dev/null
+++ b/arch/arm/configs/csb337_defconfig
@@ -0,0 +1,1136 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15
4# Mon Jan 9 21:51:31 2006
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11
12#
13# Code maturity level options
14#
15CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y
18CONFIG_INIT_ENV_ARG_LIMIT=32
19
20#
21# General setup
22#
23CONFIG_LOCALVERSION=""
24CONFIG_LOCALVERSION_AUTO=y
25# CONFIG_SWAP is not set
26CONFIG_SYSVIPC=y
27# CONFIG_POSIX_MQUEUE is not set
28# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set
31CONFIG_HOTPLUG=y
32CONFIG_KOBJECT_UEVENT=y
33# CONFIG_IKCONFIG is not set
34CONFIG_INITRAMFS_SOURCE=""
35CONFIG_CC_OPTIMIZE_FOR_SIZE=y
36# CONFIG_EMBEDDED is not set
37CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set
39# CONFIG_KALLSYMS_EXTRA_PASS is not set
40CONFIG_PRINTK=y
41CONFIG_BUG=y
42CONFIG_BASE_FULL=y
43CONFIG_FUTEX=y
44CONFIG_EPOLL=y
45CONFIG_SHMEM=y
46CONFIG_CC_ALIGN_FUNCTIONS=0
47CONFIG_CC_ALIGN_LABELS=0
48CONFIG_CC_ALIGN_LOOPS=0
49CONFIG_CC_ALIGN_JUMPS=0
50# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0
52
53#
54# Loadable module support
55#
56CONFIG_MODULES=y
57CONFIG_MODULE_UNLOAD=y
58# CONFIG_MODULE_FORCE_UNLOAD is not set
59CONFIG_OBSOLETE_MODPARM=y
60# CONFIG_MODVERSIONS is not set
61# CONFIG_MODULE_SRCVERSION_ALL is not set
62CONFIG_KMOD=y
63
64#
65# Block layer
66#
67
68#
69# IO Schedulers
70#
71CONFIG_IOSCHED_NOOP=y
72CONFIG_IOSCHED_AS=y
73CONFIG_IOSCHED_DEADLINE=y
74CONFIG_IOSCHED_CFQ=y
75CONFIG_DEFAULT_AS=y
76# CONFIG_DEFAULT_DEADLINE is not set
77# CONFIG_DEFAULT_CFQ is not set
78# CONFIG_DEFAULT_NOOP is not set
79CONFIG_DEFAULT_IOSCHED="anticipatory"
80
81#
82# System Type
83#
84# CONFIG_ARCH_CLPS7500 is not set
85# CONFIG_ARCH_CLPS711X is not set
86# CONFIG_ARCH_CO285 is not set
87# CONFIG_ARCH_EBSA110 is not set
88# CONFIG_ARCH_CAMELOT is not set
89# CONFIG_ARCH_FOOTBRIDGE is not set
90# CONFIG_ARCH_INTEGRATOR is not set
91# CONFIG_ARCH_IOP3XX is not set
92# CONFIG_ARCH_IXP4XX is not set
93# CONFIG_ARCH_IXP2000 is not set
94# CONFIG_ARCH_L7200 is not set
95# CONFIG_ARCH_PXA is not set
96# CONFIG_ARCH_RPC is not set
97# CONFIG_ARCH_SA1100 is not set
98# CONFIG_ARCH_S3C2410 is not set
99# CONFIG_ARCH_SHARK is not set
100# CONFIG_ARCH_LH7A40X is not set
101# CONFIG_ARCH_OMAP is not set
102# CONFIG_ARCH_VERSATILE is not set
103# CONFIG_ARCH_REALVIEW is not set
104# CONFIG_ARCH_IMX is not set
105# CONFIG_ARCH_H720X is not set
106# CONFIG_ARCH_AAEC2000 is not set
107CONFIG_ARCH_AT91RM9200=y
108
109#
110# AT91RM9200 Implementations
111#
112
113#
114# AT91RM9200 Board Type
115#
116# CONFIG_ARCH_AT91RM9200DK is not set
117# CONFIG_MACH_AT91RM9200EK is not set
118CONFIG_MACH_CSB337=y
119# CONFIG_MACH_CSB637 is not set
120# CONFIG_MACH_CARMEVA is not set
121# CONFIG_MACH_KB9200 is not set
122# CONFIG_MACH_ATEB9200 is not set
123
124#
125# AT91RM9200 Feature Selections
126#
127CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
128
129#
130# Processor Type
131#
132CONFIG_CPU_32=y
133CONFIG_CPU_ARM920T=y
134CONFIG_CPU_32v4=y
135CONFIG_CPU_ABRT_EV4T=y
136CONFIG_CPU_CACHE_V4WT=y
137CONFIG_CPU_CACHE_VIVT=y
138CONFIG_CPU_COPY_V4WB=y
139CONFIG_CPU_TLB_V4WBI=y
140
141#
142# Processor Features
143#
144# CONFIG_ARM_THUMB is not set
145# CONFIG_CPU_ICACHE_DISABLE is not set
146# CONFIG_CPU_DCACHE_DISABLE is not set
147# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
148
149#
150# Bus support
151#
152CONFIG_ISA_DMA_API=y
153
154#
155# PCCARD (PCMCIA/CardBus) support
156#
157CONFIG_PCCARD=y
158# CONFIG_PCMCIA_DEBUG is not set
159CONFIG_PCMCIA=y
160CONFIG_PCMCIA_LOAD_CIS=y
161CONFIG_PCMCIA_IOCTL=y
162
163#
164# PC-card bridges
165#
166CONFIG_AT91_CF=y
167
168#
169# Kernel Features
170#
171# CONFIG_PREEMPT is not set
172# CONFIG_NO_IDLE_HZ is not set
173# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
174CONFIG_SELECT_MEMORY_MODEL=y
175CONFIG_FLATMEM_MANUAL=y
176# CONFIG_DISCONTIGMEM_MANUAL is not set
177# CONFIG_SPARSEMEM_MANUAL is not set
178CONFIG_FLATMEM=y
179CONFIG_FLAT_NODE_MEM_MAP=y
180# CONFIG_SPARSEMEM_STATIC is not set
181CONFIG_SPLIT_PTLOCK_CPUS=4096
182CONFIG_LEDS=y
183CONFIG_LEDS_TIMER=y
184CONFIG_LEDS_CPU=y
185CONFIG_ALIGNMENT_TRAP=y
186
187#
188# Boot options
189#
190CONFIG_ZBOOT_ROM_TEXT=0x0
191CONFIG_ZBOOT_ROM_BSS=0x0
192CONFIG_CMDLINE="mem=32M console=ttyS0,38400 initrd=0x20410000,3145728 root=/dev/ram0 rw"
193# CONFIG_XIP_KERNEL is not set
194
195#
196# Floating point emulation
197#
198
199#
200# At least one emulation must be selected
201#
202CONFIG_FPE_NWFPE=y
203# CONFIG_FPE_NWFPE_XP is not set
204# CONFIG_FPE_FASTFPE is not set
205
206#
207# Userspace binary formats
208#
209CONFIG_BINFMT_ELF=y
210# CONFIG_BINFMT_AOUT is not set
211# CONFIG_BINFMT_MISC is not set
212# CONFIG_ARTHUR is not set
213
214#
215# Power management options
216#
217# CONFIG_PM is not set
218
219#
220# Networking
221#
222CONFIG_NET=y
223
224#
225# Networking options
226#
227CONFIG_PACKET=y
228# CONFIG_PACKET_MMAP is not set
229CONFIG_UNIX=y
230# CONFIG_NET_KEY is not set
231CONFIG_INET=y
232# CONFIG_IP_MULTICAST is not set
233# CONFIG_IP_ADVANCED_ROUTER is not set
234CONFIG_IP_FIB_HASH=y
235CONFIG_IP_PNP=y
236CONFIG_IP_PNP_DHCP=y
237CONFIG_IP_PNP_BOOTP=y
238# CONFIG_IP_PNP_RARP is not set
239# CONFIG_NET_IPIP is not set
240# CONFIG_NET_IPGRE is not set
241# CONFIG_ARPD is not set
242# CONFIG_SYN_COOKIES is not set
243# CONFIG_INET_AH is not set
244# CONFIG_INET_ESP is not set
245# CONFIG_INET_IPCOMP is not set
246# CONFIG_INET_TUNNEL is not set
247CONFIG_INET_DIAG=y
248CONFIG_INET_TCP_DIAG=y
249# CONFIG_TCP_CONG_ADVANCED is not set
250CONFIG_TCP_CONG_BIC=y
251# CONFIG_IPV6 is not set
252# CONFIG_NETFILTER is not set
253
254#
255# DCCP Configuration (EXPERIMENTAL)
256#
257# CONFIG_IP_DCCP is not set
258
259#
260# SCTP Configuration (EXPERIMENTAL)
261#
262# CONFIG_IP_SCTP is not set
263# CONFIG_ATM is not set
264# CONFIG_BRIDGE is not set
265# CONFIG_VLAN_8021Q is not set
266# CONFIG_DECNET is not set
267# CONFIG_LLC2 is not set
268# CONFIG_IPX is not set
269# CONFIG_ATALK is not set
270# CONFIG_X25 is not set
271# CONFIG_LAPB is not set
272# CONFIG_NET_DIVERT is not set
273# CONFIG_ECONET is not set
274# CONFIG_WAN_ROUTER is not set
275
276#
277# QoS and/or fair queueing
278#
279# CONFIG_NET_SCHED is not set
280
281#
282# Network testing
283#
284# CONFIG_NET_PKTGEN is not set
285# CONFIG_HAMRADIO is not set
286# CONFIG_IRDA is not set
287# CONFIG_BT is not set
288# CONFIG_IEEE80211 is not set
289
290#
291# Device Drivers
292#
293
294#
295# Generic Driver Options
296#
297CONFIG_STANDALONE=y
298CONFIG_PREVENT_FIRMWARE_BUILD=y
299CONFIG_FW_LOADER=y
300# CONFIG_DEBUG_DRIVER is not set
301
302#
303# Connector - unified userspace <-> kernelspace linker
304#
305# CONFIG_CONNECTOR is not set
306
307#
308# Memory Technology Devices (MTD)
309#
310CONFIG_MTD=y
311# CONFIG_MTD_DEBUG is not set
312# CONFIG_MTD_CONCAT is not set
313CONFIG_MTD_PARTITIONS=y
314# CONFIG_MTD_REDBOOT_PARTS is not set
315CONFIG_MTD_CMDLINE_PARTS=y
316# CONFIG_MTD_AFS_PARTS is not set
317
318#
319# User Modules And Translation Layers
320#
321CONFIG_MTD_CHAR=y
322CONFIG_MTD_BLOCK=y
323# CONFIG_FTL is not set
324# CONFIG_NFTL is not set
325# CONFIG_INFTL is not set
326# CONFIG_RFD_FTL is not set
327
328#
329# RAM/ROM/Flash chip drivers
330#
331CONFIG_MTD_CFI=y
332# CONFIG_MTD_JEDECPROBE is not set
333CONFIG_MTD_GEN_PROBE=y
334# CONFIG_MTD_CFI_ADV_OPTIONS is not set
335CONFIG_MTD_MAP_BANK_WIDTH_1=y
336CONFIG_MTD_MAP_BANK_WIDTH_2=y
337CONFIG_MTD_MAP_BANK_WIDTH_4=y
338# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
339# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
340# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
341CONFIG_MTD_CFI_I1=y
342CONFIG_MTD_CFI_I2=y
343# CONFIG_MTD_CFI_I4 is not set
344# CONFIG_MTD_CFI_I8 is not set
345CONFIG_MTD_CFI_INTELEXT=y
346# CONFIG_MTD_CFI_AMDSTD is not set
347# CONFIG_MTD_CFI_STAA is not set
348CONFIG_MTD_CFI_UTIL=y
349# CONFIG_MTD_RAM is not set
350# CONFIG_MTD_ROM is not set
351# CONFIG_MTD_ABSENT is not set
352# CONFIG_MTD_XIP is not set
353
354#
355# Mapping drivers for chip access
356#
357# CONFIG_MTD_COMPLEX_MAPPINGS is not set
358# CONFIG_MTD_PHYSMAP is not set
359# CONFIG_MTD_ARM_INTEGRATOR is not set
360# CONFIG_MTD_PLATRAM is not set
361CONFIG_MTD_CSB337=y
362
363#
364# Self-contained MTD device drivers
365#
366# CONFIG_MTD_SLRAM is not set
367# CONFIG_MTD_PHRAM is not set
368# CONFIG_MTD_MTDRAM is not set
369# CONFIG_MTD_BLKMTD is not set
370# CONFIG_MTD_BLOCK2MTD is not set
371
372#
373# Disk-On-Chip Device Drivers
374#
375# CONFIG_MTD_DOC2000 is not set
376# CONFIG_MTD_DOC2001 is not set
377# CONFIG_MTD_DOC2001PLUS is not set
378# CONFIG_MTD_AT91_DATAFLASH is not set
379
380#
381# NAND Flash Device Drivers
382#
383# CONFIG_MTD_NAND is not set
384
385#
386# OneNAND Flash Device Drivers
387#
388# CONFIG_MTD_ONENAND is not set
389
390#
391# Parallel port support
392#
393# CONFIG_PARPORT is not set
394
395#
396# Plug and Play support
397#
398
399#
400# Block devices
401#
402# CONFIG_BLK_DEV_COW_COMMON is not set
403CONFIG_BLK_DEV_LOOP=y
404# CONFIG_BLK_DEV_CRYPTOLOOP is not set
405# CONFIG_BLK_DEV_NBD is not set
406# CONFIG_BLK_DEV_UB is not set
407CONFIG_BLK_DEV_RAM=y
408CONFIG_BLK_DEV_RAM_COUNT=16
409CONFIG_BLK_DEV_RAM_SIZE=8192
410CONFIG_BLK_DEV_INITRD=y
411# CONFIG_CDROM_PKTCDVD is not set
412# CONFIG_ATA_OVER_ETH is not set
413
414#
415# ATA/ATAPI/MFM/RLL support
416#
417# CONFIG_IDE is not set
418
419#
420# SCSI device support
421#
422# CONFIG_RAID_ATTRS is not set
423CONFIG_SCSI=y
424CONFIG_SCSI_PROC_FS=y
425
426#
427# SCSI support type (disk, tape, CD-ROM)
428#
429# CONFIG_BLK_DEV_SD is not set
430# CONFIG_CHR_DEV_ST is not set
431# CONFIG_CHR_DEV_OSST is not set
432# CONFIG_BLK_DEV_SR is not set
433# CONFIG_CHR_DEV_SG is not set
434# CONFIG_CHR_DEV_SCH is not set
435
436#
437# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
438#
439# CONFIG_SCSI_MULTI_LUN is not set
440# CONFIG_SCSI_CONSTANTS is not set
441# CONFIG_SCSI_LOGGING is not set
442
443#
444# SCSI Transport Attributes
445#
446# CONFIG_SCSI_SPI_ATTRS is not set
447# CONFIG_SCSI_FC_ATTRS is not set
448# CONFIG_SCSI_ISCSI_ATTRS is not set
449# CONFIG_SCSI_SAS_ATTRS is not set
450
451#
452# SCSI low-level drivers
453#
454# CONFIG_ISCSI_TCP is not set
455# CONFIG_SCSI_SATA is not set
456# CONFIG_SCSI_DEBUG is not set
457
458#
459# PCMCIA SCSI adapter support
460#
461# CONFIG_PCMCIA_AHA152X is not set
462# CONFIG_PCMCIA_FDOMAIN is not set
463# CONFIG_PCMCIA_NINJA_SCSI is not set
464# CONFIG_PCMCIA_QLOGIC is not set
465# CONFIG_PCMCIA_SYM53C500 is not set
466
467#
468# Multi-device support (RAID and LVM)
469#
470# CONFIG_MD is not set
471
472#
473# Fusion MPT device support
474#
475# CONFIG_FUSION is not set
476
477#
478# IEEE 1394 (FireWire) support
479#
480
481#
482# I2O device support
483#
484
485#
486# Network device support
487#
488CONFIG_NETDEVICES=y
489# CONFIG_DUMMY is not set
490# CONFIG_BONDING is not set
491# CONFIG_EQUALIZER is not set
492# CONFIG_TUN is not set
493
494#
495# PHY device support
496#
497# CONFIG_PHYLIB is not set
498
499#
500# Ethernet (10 or 100Mbit)
501#
502CONFIG_NET_ETHERNET=y
503CONFIG_MII=y
504CONFIG_ARM_AT91_ETHER=y
505# CONFIG_SMC91X is not set
506# CONFIG_DM9000 is not set
507
508#
509# Ethernet (1000 Mbit)
510#
511
512#
513# Ethernet (10000 Mbit)
514#
515
516#
517# Token Ring devices
518#
519
520#
521# Wireless LAN (non-hamradio)
522#
523# CONFIG_NET_RADIO is not set
524
525#
526# PCMCIA network device support
527#
528# CONFIG_NET_PCMCIA is not set
529
530#
531# Wan interfaces
532#
533# CONFIG_WAN is not set
534# CONFIG_PPP is not set
535# CONFIG_SLIP is not set
536# CONFIG_SHAPER is not set
537# CONFIG_NETCONSOLE is not set
538# CONFIG_NETPOLL is not set
539# CONFIG_NET_POLL_CONTROLLER is not set
540
541#
542# ISDN subsystem
543#
544# CONFIG_ISDN is not set
545
546#
547# Input device support
548#
549CONFIG_INPUT=y
550
551#
552# Userland interfaces
553#
554CONFIG_INPUT_MOUSEDEV=y
555CONFIG_INPUT_MOUSEDEV_PSAUX=y
556CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
557CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
558# CONFIG_INPUT_JOYDEV is not set
559# CONFIG_INPUT_TSDEV is not set
560# CONFIG_INPUT_EVDEV is not set
561# CONFIG_INPUT_EVBUG is not set
562
563#
564# Input Device Drivers
565#
566# CONFIG_INPUT_KEYBOARD is not set
567# CONFIG_INPUT_MOUSE is not set
568# CONFIG_INPUT_JOYSTICK is not set
569# CONFIG_INPUT_TOUCHSCREEN is not set
570# CONFIG_INPUT_MISC is not set
571
572#
573# Hardware I/O ports
574#
575# CONFIG_SERIO is not set
576# CONFIG_GAMEPORT is not set
577
578#
579# Character devices
580#
581CONFIG_VT=y
582CONFIG_VT_CONSOLE=y
583CONFIG_HW_CONSOLE=y
584# CONFIG_SERIAL_NONSTANDARD is not set
585
586#
587# Serial drivers
588#
589# CONFIG_SERIAL_8250 is not set
590
591#
592# Non-8250 serial port support
593#
594CONFIG_SERIAL_AT91=y
595CONFIG_SERIAL_AT91_CONSOLE=y
596# CONFIG_SERIAL_AT91_TTYAT is not set
597CONFIG_SERIAL_CORE=y
598CONFIG_SERIAL_CORE_CONSOLE=y
599CONFIG_UNIX98_PTYS=y
600CONFIG_LEGACY_PTYS=y
601CONFIG_LEGACY_PTY_COUNT=256
602
603#
604# IPMI
605#
606# CONFIG_IPMI_HANDLER is not set
607
608#
609# Watchdog Cards
610#
611CONFIG_WATCHDOG=y
612CONFIG_WATCHDOG_NOWAYOUT=y
613
614#
615# Watchdog Device Drivers
616#
617# CONFIG_SOFT_WATCHDOG is not set
618CONFIG_AT91_WATCHDOG=y
619
620#
621# USB-based Watchdog Cards
622#
623# CONFIG_USBPCWATCHDOG is not set
624# CONFIG_NVRAM is not set
625CONFIG_RTC=y
626# CONFIG_AT91_RTC is not set
627# CONFIG_DTLK is not set
628# CONFIG_R3964 is not set
629
630#
631# Ftape, the floppy tape device driver
632#
633
634#
635# PCMCIA character devices
636#
637# CONFIG_SYNCLINK_CS is not set
638# CONFIG_CARDMAN_4000 is not set
639# CONFIG_CARDMAN_4040 is not set
640# CONFIG_RAW_DRIVER is not set
641
642#
643# TPM devices
644#
645# CONFIG_TCG_TPM is not set
646# CONFIG_TELCLOCK is not set
647CONFIG_AT91_SPI=y
648CONFIG_AT91_SPIDEV=y
649
650#
651# I2C support
652#
653CONFIG_I2C=y
654CONFIG_I2C_CHARDEV=y
655
656#
657# I2C Algorithms
658#
659# CONFIG_I2C_ALGOBIT is not set
660# CONFIG_I2C_ALGOPCF is not set
661# CONFIG_I2C_ALGOPCA is not set
662
663#
664# I2C Hardware Bus support
665#
666CONFIG_I2C_AT91=y
667# CONFIG_I2C_PARPORT_LIGHT is not set
668# CONFIG_I2C_STUB is not set
669# CONFIG_I2C_PCA_ISA is not set
670
671#
672# Miscellaneous I2C Chip support
673#
674# CONFIG_SENSORS_DS1337 is not set
675# CONFIG_SENSORS_DS1374 is not set
676# CONFIG_SENSORS_EEPROM is not set
677# CONFIG_SENSORS_PCF8574 is not set
678# CONFIG_SENSORS_PCA9539 is not set
679# CONFIG_SENSORS_PCF8591 is not set
680# CONFIG_SENSORS_RTC8564 is not set
681# CONFIG_SENSORS_MAX6875 is not set
682# CONFIG_RTC_X1205_I2C is not set
683# CONFIG_I2C_DEBUG_CORE is not set
684# CONFIG_I2C_DEBUG_ALGO is not set
685# CONFIG_I2C_DEBUG_BUS is not set
686# CONFIG_I2C_DEBUG_CHIP is not set
687
688#
689# Hardware Monitoring support
690#
691CONFIG_HWMON=y
692# CONFIG_HWMON_VID is not set
693# CONFIG_SENSORS_ADM1021 is not set
694# CONFIG_SENSORS_ADM1025 is not set
695# CONFIG_SENSORS_ADM1026 is not set
696# CONFIG_SENSORS_ADM1031 is not set
697# CONFIG_SENSORS_ADM9240 is not set
698# CONFIG_SENSORS_ASB100 is not set
699# CONFIG_SENSORS_ATXP1 is not set
700# CONFIG_SENSORS_DS1621 is not set
701# CONFIG_SENSORS_FSCHER is not set
702# CONFIG_SENSORS_FSCPOS is not set
703# CONFIG_SENSORS_GL518SM is not set
704# CONFIG_SENSORS_GL520SM is not set
705# CONFIG_SENSORS_IT87 is not set
706# CONFIG_SENSORS_LM63 is not set
707# CONFIG_SENSORS_LM75 is not set
708# CONFIG_SENSORS_LM77 is not set
709# CONFIG_SENSORS_LM78 is not set
710# CONFIG_SENSORS_LM80 is not set
711# CONFIG_SENSORS_LM83 is not set
712# CONFIG_SENSORS_LM85 is not set
713# CONFIG_SENSORS_LM87 is not set
714# CONFIG_SENSORS_LM90 is not set
715# CONFIG_SENSORS_LM92 is not set
716# CONFIG_SENSORS_MAX1619 is not set
717# CONFIG_SENSORS_PC87360 is not set
718# CONFIG_SENSORS_SMSC47M1 is not set
719# CONFIG_SENSORS_SMSC47B397 is not set
720# CONFIG_SENSORS_W83781D is not set
721# CONFIG_SENSORS_W83792D is not set
722# CONFIG_SENSORS_W83L785TS is not set
723# CONFIG_SENSORS_W83627HF is not set
724# CONFIG_SENSORS_W83627EHF is not set
725# CONFIG_HWMON_DEBUG_CHIP is not set
726
727#
728# Misc devices
729#
730
731#
732# Multimedia Capabilities Port drivers
733#
734
735#
736# Multimedia devices
737#
738# CONFIG_VIDEO_DEV is not set
739
740#
741# Digital Video Broadcasting Devices
742#
743# CONFIG_DVB is not set
744
745#
746# Graphics support
747#
748# CONFIG_FB is not set
749
750#
751# Console display driver support
752#
753# CONFIG_VGA_CONSOLE is not set
754CONFIG_DUMMY_CONSOLE=y
755
756#
757# Sound
758#
759# CONFIG_SOUND is not set
760
761#
762# USB support
763#
764CONFIG_USB_ARCH_HAS_HCD=y
765CONFIG_USB_ARCH_HAS_OHCI=y
766CONFIG_USB=y
767CONFIG_USB_DEBUG=y
768
769#
770# Miscellaneous USB options
771#
772CONFIG_USB_DEVICEFS=y
773# CONFIG_USB_BANDWIDTH is not set
774# CONFIG_USB_DYNAMIC_MINORS is not set
775# CONFIG_USB_OTG is not set
776
777#
778# USB Host Controller Drivers
779#
780# CONFIG_USB_ISP116X_HCD is not set
781CONFIG_USB_OHCI_HCD=y
782# CONFIG_USB_OHCI_BIG_ENDIAN is not set
783CONFIG_USB_OHCI_LITTLE_ENDIAN=y
784# CONFIG_USB_SL811_HCD is not set
785
786#
787# USB Device Class drivers
788#
789# CONFIG_USB_ACM is not set
790# CONFIG_USB_PRINTER is not set
791
792#
793# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
794#
795
796#
797# may also be needed; see USB_STORAGE Help for more information
798#
799CONFIG_USB_STORAGE=y
800# CONFIG_USB_STORAGE_DEBUG is not set
801# CONFIG_USB_STORAGE_DATAFAB is not set
802# CONFIG_USB_STORAGE_FREECOM is not set
803# CONFIG_USB_STORAGE_DPCM is not set
804# CONFIG_USB_STORAGE_USBAT is not set
805# CONFIG_USB_STORAGE_SDDR09 is not set
806# CONFIG_USB_STORAGE_SDDR55 is not set
807# CONFIG_USB_STORAGE_JUMPSHOT is not set
808
809#
810# USB Input Devices
811#
812# CONFIG_USB_HID is not set
813
814#
815# USB HID Boot Protocol drivers
816#
817# CONFIG_USB_KBD is not set
818# CONFIG_USB_MOUSE is not set
819# CONFIG_USB_AIPTEK is not set
820# CONFIG_USB_WACOM is not set
821# CONFIG_USB_ACECAD is not set
822# CONFIG_USB_KBTAB is not set
823# CONFIG_USB_POWERMATE is not set
824# CONFIG_USB_MTOUCH is not set
825# CONFIG_USB_ITMTOUCH is not set
826# CONFIG_USB_EGALAX is not set
827# CONFIG_USB_YEALINK is not set
828# CONFIG_USB_XPAD is not set
829# CONFIG_USB_ATI_REMOTE is not set
830# CONFIG_USB_KEYSPAN_REMOTE is not set
831# CONFIG_USB_APPLETOUCH is not set
832
833#
834# USB Imaging devices
835#
836# CONFIG_USB_MDC800 is not set
837# CONFIG_USB_MICROTEK is not set
838
839#
840# USB Multimedia devices
841#
842# CONFIG_USB_DABUSB is not set
843
844#
845# Video4Linux support is needed for USB Multimedia device support
846#
847
848#
849# USB Network Adapters
850#
851# CONFIG_USB_CATC is not set
852# CONFIG_USB_KAWETH is not set
853# CONFIG_USB_PEGASUS is not set
854# CONFIG_USB_RTL8150 is not set
855# CONFIG_USB_USBNET is not set
856CONFIG_USB_MON=y
857
858#
859# USB port drivers
860#
861
862#
863# USB Serial Converter support
864#
865CONFIG_USB_SERIAL=y
866CONFIG_USB_SERIAL_CONSOLE=y
867CONFIG_USB_SERIAL_GENERIC=y
868# CONFIG_USB_SERIAL_AIRPRIME is not set
869# CONFIG_USB_SERIAL_ANYDATA is not set
870# CONFIG_USB_SERIAL_BELKIN is not set
871# CONFIG_USB_SERIAL_WHITEHEAT is not set
872# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
873# CONFIG_USB_SERIAL_CP2101 is not set
874# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
875# CONFIG_USB_SERIAL_EMPEG is not set
876CONFIG_USB_SERIAL_FTDI_SIO=y
877# CONFIG_USB_SERIAL_VISOR is not set
878# CONFIG_USB_SERIAL_IPAQ is not set
879# CONFIG_USB_SERIAL_IR is not set
880# CONFIG_USB_SERIAL_EDGEPORT is not set
881# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
882# CONFIG_USB_SERIAL_GARMIN is not set
883# CONFIG_USB_SERIAL_IPW is not set
884# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
885CONFIG_USB_SERIAL_KEYSPAN=y
886CONFIG_USB_SERIAL_KEYSPAN_MPR=y
887CONFIG_USB_SERIAL_KEYSPAN_USA28=y
888CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
889CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
890CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
891CONFIG_USB_SERIAL_KEYSPAN_USA19=y
892CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
893CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
894CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
895CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
896CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
897CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
898# CONFIG_USB_SERIAL_KLSI is not set
899# CONFIG_USB_SERIAL_KOBIL_SCT is not set
900CONFIG_USB_SERIAL_MCT_U232=y
901# CONFIG_USB_SERIAL_PL2303 is not set
902# CONFIG_USB_SERIAL_HP4X is not set
903# CONFIG_USB_SERIAL_SAFE is not set
904# CONFIG_USB_SERIAL_TI is not set
905# CONFIG_USB_SERIAL_CYBERJACK is not set
906# CONFIG_USB_SERIAL_XIRCOM is not set
907# CONFIG_USB_SERIAL_OPTION is not set
908# CONFIG_USB_SERIAL_OMNINET is not set
909CONFIG_USB_EZUSB=y
910
911#
912# USB Miscellaneous drivers
913#
914# CONFIG_USB_EMI62 is not set
915# CONFIG_USB_EMI26 is not set
916# CONFIG_USB_AUERSWALD is not set
917# CONFIG_USB_RIO500 is not set
918# CONFIG_USB_LEGOTOWER is not set
919# CONFIG_USB_LCD is not set
920# CONFIG_USB_LED is not set
921# CONFIG_USB_CYTHERM is not set
922# CONFIG_USB_PHIDGETKIT is not set
923# CONFIG_USB_PHIDGETSERVO is not set
924# CONFIG_USB_IDMOUSE is not set
925# CONFIG_USB_LD is not set
926# CONFIG_USB_TEST is not set
927
928#
929# USB DSL modem support
930#
931
932#
933# USB Gadget Support
934#
935CONFIG_USB_GADGET=y
936# CONFIG_USB_GADGET_DEBUG_FILES is not set
937CONFIG_USB_GADGET_SELECTED=y
938# CONFIG_USB_GADGET_NET2280 is not set
939# CONFIG_USB_GADGET_PXA2XX is not set
940# CONFIG_USB_GADGET_GOKU is not set
941# CONFIG_USB_GADGET_LH7A40X is not set
942# CONFIG_USB_GADGET_OMAP is not set
943CONFIG_USB_GADGET_AT91=y
944CONFIG_USB_AT91=y
945# CONFIG_USB_GADGET_DUMMY_HCD is not set
946# CONFIG_USB_GADGET_DUALSPEED is not set
947# CONFIG_USB_ZERO is not set
948# CONFIG_USB_ETH is not set
949# CONFIG_USB_GADGETFS is not set
950# CONFIG_USB_FILE_STORAGE is not set
951# CONFIG_USB_G_SERIAL is not set
952
953#
954# MMC/SD Card support
955#
956CONFIG_MMC=y
957# CONFIG_MMC_DEBUG is not set
958CONFIG_MMC_BLOCK=y
959# CONFIG_MMC_WBSD is not set
960CONFIG_MMC_AT91RM9200=y
961
962#
963# File systems
964#
965CONFIG_EXT2_FS=y
966# CONFIG_EXT2_FS_XATTR is not set
967# CONFIG_EXT2_FS_XIP is not set
968# CONFIG_EXT3_FS is not set
969# CONFIG_JBD is not set
970# CONFIG_REISERFS_FS is not set
971# CONFIG_JFS_FS is not set
972# CONFIG_FS_POSIX_ACL is not set
973# CONFIG_XFS_FS is not set
974# CONFIG_MINIX_FS is not set
975# CONFIG_ROMFS_FS is not set
976CONFIG_INOTIFY=y
977# CONFIG_QUOTA is not set
978CONFIG_DNOTIFY=y
979# CONFIG_AUTOFS_FS is not set
980# CONFIG_AUTOFS4_FS is not set
981# CONFIG_FUSE_FS is not set
982
983#
984# CD-ROM/DVD Filesystems
985#
986# CONFIG_ISO9660_FS is not set
987# CONFIG_UDF_FS is not set
988
989#
990# DOS/FAT/NT Filesystems
991#
992# CONFIG_MSDOS_FS is not set
993# CONFIG_VFAT_FS is not set
994# CONFIG_NTFS_FS is not set
995
996#
997# Pseudo filesystems
998#
999CONFIG_PROC_FS=y
1000CONFIG_SYSFS=y
1001CONFIG_TMPFS=y
1002# CONFIG_HUGETLB_PAGE is not set
1003CONFIG_RAMFS=y
1004# CONFIG_RELAYFS_FS is not set
1005
1006#
1007# Miscellaneous filesystems
1008#
1009# CONFIG_ADFS_FS is not set
1010# CONFIG_AFFS_FS is not set
1011# CONFIG_HFS_FS is not set
1012# CONFIG_HFSPLUS_FS is not set
1013# CONFIG_BEFS_FS is not set
1014# CONFIG_BFS_FS is not set
1015# CONFIG_EFS_FS is not set
1016# CONFIG_JFFS_FS is not set
1017# CONFIG_JFFS2_FS is not set
1018CONFIG_CRAMFS=y
1019# CONFIG_VXFS_FS is not set
1020# CONFIG_HPFS_FS is not set
1021# CONFIG_QNX4FS_FS is not set
1022# CONFIG_SYSV_FS is not set
1023# CONFIG_UFS_FS is not set
1024
1025#
1026# Network File Systems
1027#
1028CONFIG_NFS_FS=y
1029CONFIG_NFS_V3=y
1030# CONFIG_NFS_V3_ACL is not set
1031CONFIG_NFS_V4=y
1032# CONFIG_NFS_DIRECTIO is not set
1033# CONFIG_NFSD is not set
1034CONFIG_ROOT_NFS=y
1035CONFIG_LOCKD=y
1036CONFIG_LOCKD_V4=y
1037CONFIG_NFS_COMMON=y
1038CONFIG_SUNRPC=y
1039CONFIG_SUNRPC_GSS=y
1040CONFIG_RPCSEC_GSS_KRB5=y
1041# CONFIG_RPCSEC_GSS_SPKM3 is not set
1042# CONFIG_SMB_FS is not set
1043# CONFIG_CIFS is not set
1044# CONFIG_NCP_FS is not set
1045# CONFIG_CODA_FS is not set
1046# CONFIG_AFS_FS is not set
1047# CONFIG_9P_FS is not set
1048
1049#
1050# Partition Types
1051#
1052# CONFIG_PARTITION_ADVANCED is not set
1053CONFIG_MSDOS_PARTITION=y
1054
1055#
1056# Native Language Support
1057#
1058# CONFIG_NLS is not set
1059
1060#
1061# Profiling support
1062#
1063# CONFIG_PROFILING is not set
1064
1065#
1066# Kernel hacking
1067#
1068# CONFIG_PRINTK_TIME is not set
1069CONFIG_DEBUG_KERNEL=y
1070# CONFIG_MAGIC_SYSRQ is not set
1071CONFIG_LOG_BUF_SHIFT=14
1072CONFIG_DETECT_SOFTLOCKUP=y
1073# CONFIG_SCHEDSTATS is not set
1074# CONFIG_DEBUG_SLAB is not set
1075# CONFIG_DEBUG_SPINLOCK is not set
1076# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1077# CONFIG_DEBUG_KOBJECT is not set
1078CONFIG_DEBUG_BUGVERBOSE=y
1079# CONFIG_DEBUG_INFO is not set
1080# CONFIG_DEBUG_FS is not set
1081# CONFIG_DEBUG_VM is not set
1082CONFIG_FRAME_POINTER=y
1083# CONFIG_RCU_TORTURE_TEST is not set
1084CONFIG_DEBUG_USER=y
1085# CONFIG_DEBUG_WAITQ is not set
1086# CONFIG_DEBUG_ERRORS is not set
1087CONFIG_DEBUG_LL=y
1088# CONFIG_DEBUG_ICEDCC is not set
1089
1090#
1091# Security options
1092#
1093# CONFIG_KEYS is not set
1094# CONFIG_SECURITY is not set
1095
1096#
1097# Cryptographic options
1098#
1099CONFIG_CRYPTO=y
1100# CONFIG_CRYPTO_HMAC is not set
1101# CONFIG_CRYPTO_NULL is not set
1102# CONFIG_CRYPTO_MD4 is not set
1103CONFIG_CRYPTO_MD5=y
1104# CONFIG_CRYPTO_SHA1 is not set
1105# CONFIG_CRYPTO_SHA256 is not set
1106# CONFIG_CRYPTO_SHA512 is not set
1107# CONFIG_CRYPTO_WP512 is not set
1108# CONFIG_CRYPTO_TGR192 is not set
1109CONFIG_CRYPTO_DES=y
1110# CONFIG_CRYPTO_BLOWFISH is not set
1111# CONFIG_CRYPTO_TWOFISH is not set
1112# CONFIG_CRYPTO_SERPENT is not set
1113# CONFIG_CRYPTO_AES is not set
1114# CONFIG_CRYPTO_CAST5 is not set
1115# CONFIG_CRYPTO_CAST6 is not set
1116# CONFIG_CRYPTO_TEA is not set
1117# CONFIG_CRYPTO_ARC4 is not set
1118# CONFIG_CRYPTO_KHAZAD is not set
1119# CONFIG_CRYPTO_ANUBIS is not set
1120# CONFIG_CRYPTO_DEFLATE is not set
1121# CONFIG_CRYPTO_MICHAEL_MIC is not set
1122# CONFIG_CRYPTO_CRC32C is not set
1123# CONFIG_CRYPTO_TEST is not set
1124
1125#
1126# Hardware crypto devices
1127#
1128
1129#
1130# Library routines
1131#
1132# CONFIG_CRC_CCITT is not set
1133# CONFIG_CRC16 is not set
1134CONFIG_CRC32=y
1135# CONFIG_LIBCRC32C is not set
1136CONFIG_ZLIB_INFLATE=y
diff --git a/arch/arm/configs/csb637_defconfig b/arch/arm/configs/csb637_defconfig
new file mode 100644
index 000000000000..95a96a5462a0
--- /dev/null
+++ b/arch/arm/configs/csb637_defconfig
@@ -0,0 +1,1116 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15
4# Mon Jan 9 21:52:00 2006
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11
12#
13# Code maturity level options
14#
15CONFIG_EXPERIMENTAL=y
16CONFIG_CLEAN_COMPILE=y
17CONFIG_BROKEN_ON_SMP=y
18CONFIG_INIT_ENV_ARG_LIMIT=32
19
20#
21# General setup
22#
23CONFIG_LOCALVERSION=""
24CONFIG_LOCALVERSION_AUTO=y
25# CONFIG_SWAP is not set
26CONFIG_SYSVIPC=y
27# CONFIG_POSIX_MQUEUE is not set
28# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set
31CONFIG_HOTPLUG=y
32CONFIG_KOBJECT_UEVENT=y
33# CONFIG_IKCONFIG is not set
34CONFIG_INITRAMFS_SOURCE=""
35CONFIG_CC_OPTIMIZE_FOR_SIZE=y
36# CONFIG_EMBEDDED is not set
37CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set
39# CONFIG_KALLSYMS_EXTRA_PASS is not set
40CONFIG_PRINTK=y
41CONFIG_BUG=y
42CONFIG_BASE_FULL=y
43CONFIG_FUTEX=y
44CONFIG_EPOLL=y
45CONFIG_SHMEM=y
46CONFIG_CC_ALIGN_FUNCTIONS=0
47CONFIG_CC_ALIGN_LABELS=0
48CONFIG_CC_ALIGN_LOOPS=0
49CONFIG_CC_ALIGN_JUMPS=0
50# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0
52
53#
54# Loadable module support
55#
56CONFIG_MODULES=y
57CONFIG_MODULE_UNLOAD=y
58# CONFIG_MODULE_FORCE_UNLOAD is not set
59CONFIG_OBSOLETE_MODPARM=y
60# CONFIG_MODVERSIONS is not set
61# CONFIG_MODULE_SRCVERSION_ALL is not set
62CONFIG_KMOD=y
63
64#
65# Block layer
66#
67
68#
69# IO Schedulers
70#
71CONFIG_IOSCHED_NOOP=y
72CONFIG_IOSCHED_AS=y
73CONFIG_IOSCHED_DEADLINE=y
74CONFIG_IOSCHED_CFQ=y
75CONFIG_DEFAULT_AS=y
76# CONFIG_DEFAULT_DEADLINE is not set
77# CONFIG_DEFAULT_CFQ is not set
78# CONFIG_DEFAULT_NOOP is not set
79CONFIG_DEFAULT_IOSCHED="anticipatory"
80
81#
82# System Type
83#
84# CONFIG_ARCH_CLPS7500 is not set
85# CONFIG_ARCH_CLPS711X is not set
86# CONFIG_ARCH_CO285 is not set
87# CONFIG_ARCH_EBSA110 is not set
88# CONFIG_ARCH_CAMELOT is not set
89# CONFIG_ARCH_FOOTBRIDGE is not set
90# CONFIG_ARCH_INTEGRATOR is not set
91# CONFIG_ARCH_IOP3XX is not set
92# CONFIG_ARCH_IXP4XX is not set
93# CONFIG_ARCH_IXP2000 is not set
94# CONFIG_ARCH_L7200 is not set
95# CONFIG_ARCH_PXA is not set
96# CONFIG_ARCH_RPC is not set
97# CONFIG_ARCH_SA1100 is not set
98# CONFIG_ARCH_S3C2410 is not set
99# CONFIG_ARCH_SHARK is not set
100# CONFIG_ARCH_LH7A40X is not set
101# CONFIG_ARCH_OMAP is not set
102# CONFIG_ARCH_VERSATILE is not set
103# CONFIG_ARCH_REALVIEW is not set
104# CONFIG_ARCH_IMX is not set
105# CONFIG_ARCH_H720X is not set
106# CONFIG_ARCH_AAEC2000 is not set
107CONFIG_ARCH_AT91RM9200=y
108
109#
110# AT91RM9200 Implementations
111#
112
113#
114# AT91RM9200 Board Type
115#
116# CONFIG_ARCH_AT91RM9200DK is not set
117# CONFIG_MACH_AT91RM9200EK is not set
118# CONFIG_MACH_CSB337 is not set
119CONFIG_MACH_CSB637=y
120# CONFIG_MACH_CARMEVA is not set
121# CONFIG_MACH_KB9200 is not set
122# CONFIG_MACH_ATEB9200 is not set
123
124#
125# AT91RM9200 Feature Selections
126#
127CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
128
129#
130# Processor Type
131#
132CONFIG_CPU_32=y
133CONFIG_CPU_ARM920T=y
134CONFIG_CPU_32v4=y
135CONFIG_CPU_ABRT_EV4T=y
136CONFIG_CPU_CACHE_V4WT=y
137CONFIG_CPU_CACHE_VIVT=y
138CONFIG_CPU_COPY_V4WB=y
139CONFIG_CPU_TLB_V4WBI=y
140
141#
142# Processor Features
143#
144# CONFIG_ARM_THUMB is not set
145# CONFIG_CPU_ICACHE_DISABLE is not set
146# CONFIG_CPU_DCACHE_DISABLE is not set
147# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
148
149#
150# Bus support
151#
152CONFIG_ISA_DMA_API=y
153
154#
155# PCCARD (PCMCIA/CardBus) support
156#
157CONFIG_PCCARD=y
158# CONFIG_PCMCIA_DEBUG is not set
159CONFIG_PCMCIA=y
160CONFIG_PCMCIA_LOAD_CIS=y
161CONFIG_PCMCIA_IOCTL=y
162
163#
164# PC-card bridges
165#
166CONFIG_AT91_CF=y
167
168#
169# Kernel Features
170#
171# CONFIG_PREEMPT is not set
172# CONFIG_NO_IDLE_HZ is not set
173# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
174CONFIG_SELECT_MEMORY_MODEL=y
175CONFIG_FLATMEM_MANUAL=y
176# CONFIG_DISCONTIGMEM_MANUAL is not set
177# CONFIG_SPARSEMEM_MANUAL is not set
178CONFIG_FLATMEM=y
179CONFIG_FLAT_NODE_MEM_MAP=y
180# CONFIG_SPARSEMEM_STATIC is not set
181CONFIG_SPLIT_PTLOCK_CPUS=4096
182CONFIG_LEDS=y
183CONFIG_LEDS_TIMER=y
184CONFIG_LEDS_CPU=y
185CONFIG_ALIGNMENT_TRAP=y
186
187#
188# Boot options
189#
190CONFIG_ZBOOT_ROM_TEXT=0x0
191CONFIG_ZBOOT_ROM_BSS=0x0
192CONFIG_CMDLINE="mem=32M console=ttyS0,38400 initrd=0x20410000,3145728 root=/dev/ram0 rw"
193# CONFIG_XIP_KERNEL is not set
194
195#
196# Floating point emulation
197#
198
199#
200# At least one emulation must be selected
201#
202CONFIG_FPE_NWFPE=y
203# CONFIG_FPE_NWFPE_XP is not set
204# CONFIG_FPE_FASTFPE is not set
205
206#
207# Userspace binary formats
208#
209CONFIG_BINFMT_ELF=y
210# CONFIG_BINFMT_AOUT is not set
211# CONFIG_BINFMT_MISC is not set
212# CONFIG_ARTHUR is not set
213
214#
215# Power management options
216#
217# CONFIG_PM is not set
218
219#
220# Networking
221#
222CONFIG_NET=y
223
224#
225# Networking options
226#
227CONFIG_PACKET=y
228# CONFIG_PACKET_MMAP is not set
229CONFIG_UNIX=y
230# CONFIG_NET_KEY is not set
231CONFIG_INET=y
232# CONFIG_IP_MULTICAST is not set
233# CONFIG_IP_ADVANCED_ROUTER is not set
234CONFIG_IP_FIB_HASH=y
235CONFIG_IP_PNP=y
236CONFIG_IP_PNP_DHCP=y
237CONFIG_IP_PNP_BOOTP=y
238# CONFIG_IP_PNP_RARP is not set
239# CONFIG_NET_IPIP is not set
240# CONFIG_NET_IPGRE is not set
241# CONFIG_ARPD is not set
242# CONFIG_SYN_COOKIES is not set
243# CONFIG_INET_AH is not set
244# CONFIG_INET_ESP is not set
245# CONFIG_INET_IPCOMP is not set
246# CONFIG_INET_TUNNEL is not set
247CONFIG_INET_DIAG=y
248CONFIG_INET_TCP_DIAG=y
249# CONFIG_TCP_CONG_ADVANCED is not set
250CONFIG_TCP_CONG_BIC=y
251# CONFIG_IPV6 is not set
252# CONFIG_NETFILTER is not set
253
254#
255# DCCP Configuration (EXPERIMENTAL)
256#
257# CONFIG_IP_DCCP is not set
258
259#
260# SCTP Configuration (EXPERIMENTAL)
261#
262# CONFIG_IP_SCTP is not set
263# CONFIG_ATM is not set
264# CONFIG_BRIDGE is not set
265# CONFIG_VLAN_8021Q is not set
266# CONFIG_DECNET is not set
267# CONFIG_LLC2 is not set
268# CONFIG_IPX is not set
269# CONFIG_ATALK is not set
270# CONFIG_X25 is not set
271# CONFIG_LAPB is not set
272# CONFIG_NET_DIVERT is not set
273# CONFIG_ECONET is not set
274# CONFIG_WAN_ROUTER is not set
275
276#
277# QoS and/or fair queueing
278#
279# CONFIG_NET_SCHED is not set
280
281#
282# Network testing
283#
284# CONFIG_NET_PKTGEN is not set
285# CONFIG_HAMRADIO is not set
286# CONFIG_IRDA is not set
287# CONFIG_BT is not set
288# CONFIG_IEEE80211 is not set
289
290#
291# Device Drivers
292#
293
294#
295# Generic Driver Options
296#
297CONFIG_STANDALONE=y
298CONFIG_PREVENT_FIRMWARE_BUILD=y
299CONFIG_FW_LOADER=y
300# CONFIG_DEBUG_DRIVER is not set
301
302#
303# Connector - unified userspace <-> kernelspace linker
304#
305# CONFIG_CONNECTOR is not set
306
307#
308# Memory Technology Devices (MTD)
309#
310CONFIG_MTD=y
311# CONFIG_MTD_DEBUG is not set
312# CONFIG_MTD_CONCAT is not set
313CONFIG_MTD_PARTITIONS=y
314# CONFIG_MTD_REDBOOT_PARTS is not set
315CONFIG_MTD_CMDLINE_PARTS=y
316# CONFIG_MTD_AFS_PARTS is not set
317
318#
319# User Modules And Translation Layers
320#
321CONFIG_MTD_CHAR=y
322CONFIG_MTD_BLOCK=y
323# CONFIG_FTL is not set
324# CONFIG_NFTL is not set
325# CONFIG_INFTL is not set
326# CONFIG_RFD_FTL is not set
327
328#
329# RAM/ROM/Flash chip drivers
330#
331CONFIG_MTD_CFI=y
332# CONFIG_MTD_JEDECPROBE is not set
333CONFIG_MTD_GEN_PROBE=y
334# CONFIG_MTD_CFI_ADV_OPTIONS is not set
335CONFIG_MTD_MAP_BANK_WIDTH_1=y
336CONFIG_MTD_MAP_BANK_WIDTH_2=y
337CONFIG_MTD_MAP_BANK_WIDTH_4=y
338# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
339# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
340# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
341CONFIG_MTD_CFI_I1=y
342CONFIG_MTD_CFI_I2=y
343# CONFIG_MTD_CFI_I4 is not set
344# CONFIG_MTD_CFI_I8 is not set
345CONFIG_MTD_CFI_INTELEXT=y
346# CONFIG_MTD_CFI_AMDSTD is not set
347# CONFIG_MTD_CFI_STAA is not set
348CONFIG_MTD_CFI_UTIL=y
349# CONFIG_MTD_RAM is not set
350# CONFIG_MTD_ROM is not set
351# CONFIG_MTD_ABSENT is not set
352# CONFIG_MTD_XIP is not set
353
354#
355# Mapping drivers for chip access
356#
357# CONFIG_MTD_COMPLEX_MAPPINGS is not set
358# CONFIG_MTD_PHYSMAP is not set
359# CONFIG_MTD_ARM_INTEGRATOR is not set
360# CONFIG_MTD_PLATRAM is not set
361CONFIG_MTD_CSB637=y
362
363#
364# Self-contained MTD device drivers
365#
366# CONFIG_MTD_SLRAM is not set
367# CONFIG_MTD_PHRAM is not set
368# CONFIG_MTD_MTDRAM is not set
369# CONFIG_MTD_BLKMTD is not set
370# CONFIG_MTD_BLOCK2MTD is not set
371
372#
373# Disk-On-Chip Device Drivers
374#
375# CONFIG_MTD_DOC2000 is not set
376# CONFIG_MTD_DOC2001 is not set
377# CONFIG_MTD_DOC2001PLUS is not set
378# CONFIG_MTD_AT91_DATAFLASH is not set
379
380#
381# NAND Flash Device Drivers
382#
383# CONFIG_MTD_NAND is not set
384
385#
386# OneNAND Flash Device Drivers
387#
388# CONFIG_MTD_ONENAND is not set
389
390#
391# Parallel port support
392#
393# CONFIG_PARPORT is not set
394
395#
396# Plug and Play support
397#
398
399#
400# Block devices
401#
402# CONFIG_BLK_DEV_COW_COMMON is not set
403CONFIG_BLK_DEV_LOOP=y
404# CONFIG_BLK_DEV_CRYPTOLOOP is not set
405# CONFIG_BLK_DEV_NBD is not set
406# CONFIG_BLK_DEV_UB is not set
407CONFIG_BLK_DEV_RAM=y
408CONFIG_BLK_DEV_RAM_COUNT=16
409CONFIG_BLK_DEV_RAM_SIZE=8192
410CONFIG_BLK_DEV_INITRD=y
411# CONFIG_CDROM_PKTCDVD is not set
412# CONFIG_ATA_OVER_ETH is not set
413
414#
415# ATA/ATAPI/MFM/RLL support
416#
417# CONFIG_IDE is not set
418
419#
420# SCSI device support
421#
422# CONFIG_RAID_ATTRS is not set
423CONFIG_SCSI=y
424CONFIG_SCSI_PROC_FS=y
425
426#
427# SCSI support type (disk, tape, CD-ROM)
428#
429# CONFIG_BLK_DEV_SD is not set
430# CONFIG_CHR_DEV_ST is not set
431# CONFIG_CHR_DEV_OSST is not set
432# CONFIG_BLK_DEV_SR is not set
433# CONFIG_CHR_DEV_SG is not set
434# CONFIG_CHR_DEV_SCH is not set
435
436#
437# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
438#
439# CONFIG_SCSI_MULTI_LUN is not set
440# CONFIG_SCSI_CONSTANTS is not set
441# CONFIG_SCSI_LOGGING is not set
442
443#
444# SCSI Transport Attributes
445#
446# CONFIG_SCSI_SPI_ATTRS is not set
447# CONFIG_SCSI_FC_ATTRS is not set
448# CONFIG_SCSI_ISCSI_ATTRS is not set
449# CONFIG_SCSI_SAS_ATTRS is not set
450
451#
452# SCSI low-level drivers
453#
454# CONFIG_ISCSI_TCP is not set
455# CONFIG_SCSI_SATA is not set
456# CONFIG_SCSI_DEBUG is not set
457
458#
459# PCMCIA SCSI adapter support
460#
461# CONFIG_PCMCIA_AHA152X is not set
462# CONFIG_PCMCIA_FDOMAIN is not set
463# CONFIG_PCMCIA_NINJA_SCSI is not set
464# CONFIG_PCMCIA_QLOGIC is not set
465# CONFIG_PCMCIA_SYM53C500 is not set
466
467#
468# Multi-device support (RAID and LVM)
469#
470# CONFIG_MD is not set
471
472#
473# Fusion MPT device support
474#
475# CONFIG_FUSION is not set
476
477#
478# IEEE 1394 (FireWire) support
479#
480
481#
482# I2O device support
483#
484
485#
486# Network device support
487#
488CONFIG_NETDEVICES=y
489# CONFIG_DUMMY is not set
490# CONFIG_BONDING is not set
491# CONFIG_EQUALIZER is not set
492# CONFIG_TUN is not set
493
494#
495# PHY device support
496#
497# CONFIG_PHYLIB is not set
498
499#
500# Ethernet (10 or 100Mbit)
501#
502CONFIG_NET_ETHERNET=y
503CONFIG_MII=y
504CONFIG_ARM_AT91_ETHER=y
505# CONFIG_SMC91X is not set
506# CONFIG_DM9000 is not set
507
508#
509# Ethernet (1000 Mbit)
510#
511
512#
513# Ethernet (10000 Mbit)
514#
515
516#
517# Token Ring devices
518#
519
520#
521# Wireless LAN (non-hamradio)
522#
523# CONFIG_NET_RADIO is not set
524
525#
526# PCMCIA network device support
527#
528# CONFIG_NET_PCMCIA is not set
529
530#
531# Wan interfaces
532#
533# CONFIG_WAN is not set
534# CONFIG_PPP is not set
535# CONFIG_SLIP is not set
536# CONFIG_SHAPER is not set
537# CONFIG_NETCONSOLE is not set
538# CONFIG_NETPOLL is not set
539# CONFIG_NET_POLL_CONTROLLER is not set
540
541#
542# ISDN subsystem
543#
544# CONFIG_ISDN is not set
545
546#
547# Input device support
548#
549CONFIG_INPUT=y
550
551#
552# Userland interfaces
553#
554CONFIG_INPUT_MOUSEDEV=y
555CONFIG_INPUT_MOUSEDEV_PSAUX=y
556CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
557CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
558# CONFIG_INPUT_JOYDEV is not set
559# CONFIG_INPUT_TSDEV is not set
560# CONFIG_INPUT_EVDEV is not set
561# CONFIG_INPUT_EVBUG is not set
562
563#
564# Input Device Drivers
565#
566# CONFIG_INPUT_KEYBOARD is not set
567# CONFIG_INPUT_MOUSE is not set
568# CONFIG_INPUT_JOYSTICK is not set
569# CONFIG_INPUT_TOUCHSCREEN is not set
570# CONFIG_INPUT_MISC is not set
571
572#
573# Hardware I/O ports
574#
575# CONFIG_SERIO is not set
576# CONFIG_GAMEPORT is not set
577
578#
579# Character devices
580#
581CONFIG_VT=y
582CONFIG_VT_CONSOLE=y
583CONFIG_HW_CONSOLE=y
584# CONFIG_SERIAL_NONSTANDARD is not set
585
586#
587# Serial drivers
588#
589# CONFIG_SERIAL_8250 is not set
590
591#
592# Non-8250 serial port support
593#
594CONFIG_SERIAL_AT91=y
595CONFIG_SERIAL_AT91_CONSOLE=y
596# CONFIG_SERIAL_AT91_TTYAT is not set
597CONFIG_SERIAL_CORE=y
598CONFIG_SERIAL_CORE_CONSOLE=y
599CONFIG_UNIX98_PTYS=y
600CONFIG_LEGACY_PTYS=y
601CONFIG_LEGACY_PTY_COUNT=256
602
603#
604# IPMI
605#
606# CONFIG_IPMI_HANDLER is not set
607
608#
609# Watchdog Cards
610#
611CONFIG_WATCHDOG=y
612CONFIG_WATCHDOG_NOWAYOUT=y
613
614#
615# Watchdog Device Drivers
616#
617# CONFIG_SOFT_WATCHDOG is not set
618CONFIG_AT91_WATCHDOG=y
619
620#
621# USB-based Watchdog Cards
622#
623# CONFIG_USBPCWATCHDOG is not set
624# CONFIG_NVRAM is not set
625CONFIG_RTC=y
626# CONFIG_AT91_RTC is not set
627# CONFIG_DTLK is not set
628# CONFIG_R3964 is not set
629
630#
631# Ftape, the floppy tape device driver
632#
633
634#
635# PCMCIA character devices
636#
637# CONFIG_SYNCLINK_CS is not set
638# CONFIG_CARDMAN_4000 is not set
639# CONFIG_CARDMAN_4040 is not set
640# CONFIG_RAW_DRIVER is not set
641
642#
643# TPM devices
644#
645# CONFIG_TCG_TPM is not set
646# CONFIG_TELCLOCK is not set
647CONFIG_AT91_SPI=y
648CONFIG_AT91_SPIDEV=y
649
650#
651# I2C support
652#
653CONFIG_I2C=y
654CONFIG_I2C_CHARDEV=y
655
656#
657# I2C Algorithms
658#
659# CONFIG_I2C_ALGOBIT is not set
660# CONFIG_I2C_ALGOPCF is not set
661# CONFIG_I2C_ALGOPCA is not set
662
663#
664# I2C Hardware Bus support
665#
666CONFIG_I2C_AT91=y
667# CONFIG_I2C_PARPORT_LIGHT is not set
668# CONFIG_I2C_STUB is not set
669# CONFIG_I2C_PCA_ISA is not set
670
671#
672# Miscellaneous I2C Chip support
673#
674# CONFIG_SENSORS_DS1337 is not set
675# CONFIG_SENSORS_DS1374 is not set
676# CONFIG_SENSORS_EEPROM is not set
677# CONFIG_SENSORS_PCF8574 is not set
678# CONFIG_SENSORS_PCA9539 is not set
679# CONFIG_SENSORS_PCF8591 is not set
680# CONFIG_SENSORS_RTC8564 is not set
681# CONFIG_SENSORS_MAX6875 is not set
682# CONFIG_RTC_X1205_I2C is not set
683# CONFIG_I2C_DEBUG_CORE is not set
684# CONFIG_I2C_DEBUG_ALGO is not set
685# CONFIG_I2C_DEBUG_BUS is not set
686# CONFIG_I2C_DEBUG_CHIP is not set
687
688#
689# Hardware Monitoring support
690#
691CONFIG_HWMON=y
692# CONFIG_HWMON_VID is not set
693# CONFIG_SENSORS_ADM1021 is not set
694# CONFIG_SENSORS_ADM1025 is not set
695# CONFIG_SENSORS_ADM1026 is not set
696# CONFIG_SENSORS_ADM1031 is not set
697# CONFIG_SENSORS_ADM9240 is not set
698# CONFIG_SENSORS_ASB100 is not set
699# CONFIG_SENSORS_ATXP1 is not set
700# CONFIG_SENSORS_DS1621 is not set
701# CONFIG_SENSORS_FSCHER is not set
702# CONFIG_SENSORS_FSCPOS is not set
703# CONFIG_SENSORS_GL518SM is not set
704# CONFIG_SENSORS_GL520SM is not set
705# CONFIG_SENSORS_IT87 is not set
706# CONFIG_SENSORS_LM63 is not set
707# CONFIG_SENSORS_LM75 is not set
708# CONFIG_SENSORS_LM77 is not set
709# CONFIG_SENSORS_LM78 is not set
710# CONFIG_SENSORS_LM80 is not set
711# CONFIG_SENSORS_LM83 is not set
712# CONFIG_SENSORS_LM85 is not set
713# CONFIG_SENSORS_LM87 is not set
714# CONFIG_SENSORS_LM90 is not set
715# CONFIG_SENSORS_LM92 is not set
716# CONFIG_SENSORS_MAX1619 is not set
717# CONFIG_SENSORS_PC87360 is not set
718# CONFIG_SENSORS_SMSC47M1 is not set
719# CONFIG_SENSORS_SMSC47B397 is not set
720# CONFIG_SENSORS_W83781D is not set
721# CONFIG_SENSORS_W83792D is not set
722# CONFIG_SENSORS_W83L785TS is not set
723# CONFIG_SENSORS_W83627HF is not set
724# CONFIG_SENSORS_W83627EHF is not set
725# CONFIG_HWMON_DEBUG_CHIP is not set
726
727#
728# Misc devices
729#
730
731#
732# Multimedia Capabilities Port drivers
733#
734
735#
736# Multimedia devices
737#
738# CONFIG_VIDEO_DEV is not set
739
740#
741# Digital Video Broadcasting Devices
742#
743# CONFIG_DVB is not set
744
745#
746# Graphics support
747#
748# CONFIG_FB is not set
749
750#
751# Console display driver support
752#
753# CONFIG_VGA_CONSOLE is not set
754CONFIG_DUMMY_CONSOLE=y
755
756#
757# Sound
758#
759# CONFIG_SOUND is not set
760
761#
762# USB support
763#
764CONFIG_USB_ARCH_HAS_HCD=y
765CONFIG_USB_ARCH_HAS_OHCI=y
766CONFIG_USB=y
767CONFIG_USB_DEBUG=y
768
769#
770# Miscellaneous USB options
771#
772CONFIG_USB_DEVICEFS=y
773# CONFIG_USB_BANDWIDTH is not set
774# CONFIG_USB_DYNAMIC_MINORS is not set
775# CONFIG_USB_OTG is not set
776
777#
778# USB Host Controller Drivers
779#
780# CONFIG_USB_ISP116X_HCD is not set
781CONFIG_USB_OHCI_HCD=y
782# CONFIG_USB_OHCI_BIG_ENDIAN is not set
783CONFIG_USB_OHCI_LITTLE_ENDIAN=y
784# CONFIG_USB_SL811_HCD is not set
785
786#
787# USB Device Class drivers
788#
789# CONFIG_USB_ACM is not set
790# CONFIG_USB_PRINTER is not set
791
792#
793# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
794#
795
796#
797# may also be needed; see USB_STORAGE Help for more information
798#
799CONFIG_USB_STORAGE=y
800# CONFIG_USB_STORAGE_DEBUG is not set
801# CONFIG_USB_STORAGE_DATAFAB is not set
802# CONFIG_USB_STORAGE_FREECOM is not set
803# CONFIG_USB_STORAGE_DPCM is not set
804# CONFIG_USB_STORAGE_USBAT is not set
805# CONFIG_USB_STORAGE_SDDR09 is not set
806# CONFIG_USB_STORAGE_SDDR55 is not set
807# CONFIG_USB_STORAGE_JUMPSHOT is not set
808
809#
810# USB Input Devices
811#
812# CONFIG_USB_HID is not set
813
814#
815# USB HID Boot Protocol drivers
816#
817# CONFIG_USB_KBD is not set
818# CONFIG_USB_MOUSE is not set
819# CONFIG_USB_AIPTEK is not set
820# CONFIG_USB_WACOM is not set
821# CONFIG_USB_ACECAD is not set
822# CONFIG_USB_KBTAB is not set
823# CONFIG_USB_POWERMATE is not set
824# CONFIG_USB_MTOUCH is not set
825# CONFIG_USB_ITMTOUCH is not set
826# CONFIG_USB_EGALAX is not set
827# CONFIG_USB_YEALINK is not set
828# CONFIG_USB_XPAD is not set
829# CONFIG_USB_ATI_REMOTE is not set
830# CONFIG_USB_KEYSPAN_REMOTE is not set
831# CONFIG_USB_APPLETOUCH is not set
832
833#
834# USB Imaging devices
835#
836# CONFIG_USB_MDC800 is not set
837# CONFIG_USB_MICROTEK is not set
838
839#
840# USB Multimedia devices
841#
842# CONFIG_USB_DABUSB is not set
843
844#
845# Video4Linux support is needed for USB Multimedia device support
846#
847
848#
849# USB Network Adapters
850#
851# CONFIG_USB_CATC is not set
852# CONFIG_USB_KAWETH is not set
853# CONFIG_USB_PEGASUS is not set
854# CONFIG_USB_RTL8150 is not set
855# CONFIG_USB_USBNET is not set
856CONFIG_USB_MON=y
857
858#
859# USB port drivers
860#
861
862#
863# USB Serial Converter support
864#
865CONFIG_USB_SERIAL=y
866CONFIG_USB_SERIAL_CONSOLE=y
867CONFIG_USB_SERIAL_GENERIC=y
868# CONFIG_USB_SERIAL_AIRPRIME is not set
869# CONFIG_USB_SERIAL_ANYDATA is not set
870# CONFIG_USB_SERIAL_BELKIN is not set
871# CONFIG_USB_SERIAL_WHITEHEAT is not set
872# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
873# CONFIG_USB_SERIAL_CP2101 is not set
874# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
875# CONFIG_USB_SERIAL_EMPEG is not set
876CONFIG_USB_SERIAL_FTDI_SIO=y
877# CONFIG_USB_SERIAL_VISOR is not set
878# CONFIG_USB_SERIAL_IPAQ is not set
879# CONFIG_USB_SERIAL_IR is not set
880# CONFIG_USB_SERIAL_EDGEPORT is not set
881# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
882# CONFIG_USB_SERIAL_GARMIN is not set
883# CONFIG_USB_SERIAL_IPW is not set
884# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
885CONFIG_USB_SERIAL_KEYSPAN=y
886CONFIG_USB_SERIAL_KEYSPAN_MPR=y
887CONFIG_USB_SERIAL_KEYSPAN_USA28=y
888CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
889CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
890CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
891CONFIG_USB_SERIAL_KEYSPAN_USA19=y
892CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
893CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
894CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
895CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
896CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
897CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
898# CONFIG_USB_SERIAL_KLSI is not set
899# CONFIG_USB_SERIAL_KOBIL_SCT is not set
900CONFIG_USB_SERIAL_MCT_U232=y
901# CONFIG_USB_SERIAL_PL2303 is not set
902# CONFIG_USB_SERIAL_HP4X is not set
903# CONFIG_USB_SERIAL_SAFE is not set
904# CONFIG_USB_SERIAL_TI is not set
905# CONFIG_USB_SERIAL_CYBERJACK is not set
906# CONFIG_USB_SERIAL_XIRCOM is not set
907# CONFIG_USB_SERIAL_OPTION is not set
908# CONFIG_USB_SERIAL_OMNINET is not set
909CONFIG_USB_EZUSB=y
910
911#
912# USB Miscellaneous drivers
913#
914# CONFIG_USB_EMI62 is not set
915# CONFIG_USB_EMI26 is not set
916# CONFIG_USB_AUERSWALD is not set
917# CONFIG_USB_RIO500 is not set
918# CONFIG_USB_LEGOTOWER is not set
919# CONFIG_USB_LCD is not set
920# CONFIG_USB_LED is not set
921# CONFIG_USB_CYTHERM is not set
922# CONFIG_USB_PHIDGETKIT is not set
923# CONFIG_USB_PHIDGETSERVO is not set
924# CONFIG_USB_IDMOUSE is not set
925# CONFIG_USB_LD is not set
926# CONFIG_USB_TEST is not set
927
928#
929# USB DSL modem support
930#
931
932#
933# USB Gadget Support
934#
935# CONFIG_USB_GADGET is not set
936
937#
938# MMC/SD Card support
939#
940# CONFIG_MMC is not set
941
942#
943# File systems
944#
945CONFIG_EXT2_FS=y
946# CONFIG_EXT2_FS_XATTR is not set
947# CONFIG_EXT2_FS_XIP is not set
948# CONFIG_EXT3_FS is not set
949# CONFIG_JBD is not set
950# CONFIG_REISERFS_FS is not set
951# CONFIG_JFS_FS is not set
952# CONFIG_FS_POSIX_ACL is not set
953# CONFIG_XFS_FS is not set
954# CONFIG_MINIX_FS is not set
955# CONFIG_ROMFS_FS is not set
956CONFIG_INOTIFY=y
957# CONFIG_QUOTA is not set
958CONFIG_DNOTIFY=y
959# CONFIG_AUTOFS_FS is not set
960# CONFIG_AUTOFS4_FS is not set
961# CONFIG_FUSE_FS is not set
962
963#
964# CD-ROM/DVD Filesystems
965#
966# CONFIG_ISO9660_FS is not set
967# CONFIG_UDF_FS is not set
968
969#
970# DOS/FAT/NT Filesystems
971#
972# CONFIG_MSDOS_FS is not set
973# CONFIG_VFAT_FS is not set
974# CONFIG_NTFS_FS is not set
975
976#
977# Pseudo filesystems
978#
979CONFIG_PROC_FS=y
980CONFIG_SYSFS=y
981CONFIG_TMPFS=y
982# CONFIG_HUGETLB_PAGE is not set
983CONFIG_RAMFS=y
984# CONFIG_RELAYFS_FS is not set
985
986#
987# Miscellaneous filesystems
988#
989# CONFIG_ADFS_FS is not set
990# CONFIG_AFFS_FS is not set
991# CONFIG_HFS_FS is not set
992# CONFIG_HFSPLUS_FS is not set
993# CONFIG_BEFS_FS is not set
994# CONFIG_BFS_FS is not set
995# CONFIG_EFS_FS is not set
996# CONFIG_JFFS_FS is not set
997# CONFIG_JFFS2_FS is not set
998CONFIG_CRAMFS=y
999# CONFIG_VXFS_FS is not set
1000# CONFIG_HPFS_FS is not set
1001# CONFIG_QNX4FS_FS is not set
1002# CONFIG_SYSV_FS is not set
1003# CONFIG_UFS_FS is not set
1004
1005#
1006# Network File Systems
1007#
1008CONFIG_NFS_FS=y
1009CONFIG_NFS_V3=y
1010# CONFIG_NFS_V3_ACL is not set
1011CONFIG_NFS_V4=y
1012# CONFIG_NFS_DIRECTIO is not set
1013# CONFIG_NFSD is not set
1014CONFIG_ROOT_NFS=y
1015CONFIG_LOCKD=y
1016CONFIG_LOCKD_V4=y
1017CONFIG_NFS_COMMON=y
1018CONFIG_SUNRPC=y
1019CONFIG_SUNRPC_GSS=y
1020CONFIG_RPCSEC_GSS_KRB5=y
1021# CONFIG_RPCSEC_GSS_SPKM3 is not set
1022# CONFIG_SMB_FS is not set
1023# CONFIG_CIFS is not set
1024# CONFIG_NCP_FS is not set
1025# CONFIG_CODA_FS is not set
1026# CONFIG_AFS_FS is not set
1027# CONFIG_9P_FS is not set
1028
1029#
1030# Partition Types
1031#
1032# CONFIG_PARTITION_ADVANCED is not set
1033CONFIG_MSDOS_PARTITION=y
1034
1035#
1036# Native Language Support
1037#
1038# CONFIG_NLS is not set
1039
1040#
1041# Profiling support
1042#
1043# CONFIG_PROFILING is not set
1044
1045#
1046# Kernel hacking
1047#
1048# CONFIG_PRINTK_TIME is not set
1049CONFIG_DEBUG_KERNEL=y
1050# CONFIG_MAGIC_SYSRQ is not set
1051CONFIG_LOG_BUF_SHIFT=14
1052CONFIG_DETECT_SOFTLOCKUP=y
1053# CONFIG_SCHEDSTATS is not set
1054# CONFIG_DEBUG_SLAB is not set
1055# CONFIG_DEBUG_SPINLOCK is not set
1056# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1057# CONFIG_DEBUG_KOBJECT is not set
1058CONFIG_DEBUG_BUGVERBOSE=y
1059# CONFIG_DEBUG_INFO is not set
1060# CONFIG_DEBUG_FS is not set
1061# CONFIG_DEBUG_VM is not set
1062CONFIG_FRAME_POINTER=y
1063# CONFIG_RCU_TORTURE_TEST is not set
1064CONFIG_DEBUG_USER=y
1065# CONFIG_DEBUG_WAITQ is not set
1066# CONFIG_DEBUG_ERRORS is not set
1067CONFIG_DEBUG_LL=y
1068# CONFIG_DEBUG_ICEDCC is not set
1069
1070#
1071# Security options
1072#
1073# CONFIG_KEYS is not set
1074# CONFIG_SECURITY is not set
1075
1076#
1077# Cryptographic options
1078#
1079CONFIG_CRYPTO=y
1080# CONFIG_CRYPTO_HMAC is not set
1081# CONFIG_CRYPTO_NULL is not set
1082# CONFIG_CRYPTO_MD4 is not set
1083CONFIG_CRYPTO_MD5=y
1084# CONFIG_CRYPTO_SHA1 is not set
1085# CONFIG_CRYPTO_SHA256 is not set
1086# CONFIG_CRYPTO_SHA512 is not set
1087# CONFIG_CRYPTO_WP512 is not set
1088# CONFIG_CRYPTO_TGR192 is not set
1089CONFIG_CRYPTO_DES=y
1090# CONFIG_CRYPTO_BLOWFISH is not set
1091# CONFIG_CRYPTO_TWOFISH is not set
1092# CONFIG_CRYPTO_SERPENT is not set
1093# CONFIG_CRYPTO_AES is not set
1094# CONFIG_CRYPTO_CAST5 is not set
1095# CONFIG_CRYPTO_CAST6 is not set
1096# CONFIG_CRYPTO_TEA is not set
1097# CONFIG_CRYPTO_ARC4 is not set
1098# CONFIG_CRYPTO_KHAZAD is not set
1099# CONFIG_CRYPTO_ANUBIS is not set
1100# CONFIG_CRYPTO_DEFLATE is not set
1101# CONFIG_CRYPTO_MICHAEL_MIC is not set
1102# CONFIG_CRYPTO_CRC32C is not set
1103# CONFIG_CRYPTO_TEST is not set
1104
1105#
1106# Hardware crypto devices
1107#
1108
1109#
1110# Library routines
1111#
1112# CONFIG_CRC_CCITT is not set
1113# CONFIG_CRC16 is not set
1114CONFIG_CRC32=y
1115# CONFIG_LIBCRC32C is not set
1116CONFIG_ZLIB_INFLATE=y
diff --git a/arch/arm/configs/ebsa110_defconfig b/arch/arm/configs/ebsa110_defconfig
index 6f61929b97a8..afcfff6140f2 100644
--- a/arch/arm/configs/ebsa110_defconfig
+++ b/arch/arm/configs/ebsa110_defconfig
@@ -63,7 +63,6 @@ CONFIG_KMOD=y
63# CONFIG_ARCH_CLPS711X is not set 63# CONFIG_ARCH_CLPS711X is not set
64# CONFIG_ARCH_CO285 is not set 64# CONFIG_ARCH_CO285 is not set
65CONFIG_ARCH_EBSA110=y 65CONFIG_ARCH_EBSA110=y
66# CONFIG_ARCH_CAMELOT is not set
67# CONFIG_ARCH_FOOTBRIDGE is not set 66# CONFIG_ARCH_FOOTBRIDGE is not set
68# CONFIG_ARCH_INTEGRATOR is not set 67# CONFIG_ARCH_INTEGRATOR is not set
69# CONFIG_ARCH_IOP3XX is not set 68# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/edb7211_defconfig b/arch/arm/configs/edb7211_defconfig
index 78b08ed4d5f4..6ba7355ff85b 100644
--- a/arch/arm/configs/edb7211_defconfig
+++ b/arch/arm/configs/edb7211_defconfig
@@ -57,7 +57,6 @@ CONFIG_BASE_SMALL=0
57CONFIG_ARCH_CLPS711X=y 57CONFIG_ARCH_CLPS711X=y
58# CONFIG_ARCH_CO285 is not set 58# CONFIG_ARCH_CO285 is not set
59# CONFIG_ARCH_EBSA110 is not set 59# CONFIG_ARCH_EBSA110 is not set
60# CONFIG_ARCH_CAMELOT is not set
61# CONFIG_ARCH_FOOTBRIDGE is not set 60# CONFIG_ARCH_FOOTBRIDGE is not set
62# CONFIG_ARCH_INTEGRATOR is not set 61# CONFIG_ARCH_INTEGRATOR is not set
63# CONFIG_ARCH_IOP3XX is not set 62# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/enp2611_defconfig b/arch/arm/configs/enp2611_defconfig
index fd7c0042bcca..9592e3925c79 100644
--- a/arch/arm/configs/enp2611_defconfig
+++ b/arch/arm/configs/enp2611_defconfig
@@ -86,7 +86,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
86# CONFIG_ARCH_CLPS711X is not set 86# CONFIG_ARCH_CLPS711X is not set
87# CONFIG_ARCH_CO285 is not set 87# CONFIG_ARCH_CO285 is not set
88# CONFIG_ARCH_EBSA110 is not set 88# CONFIG_ARCH_EBSA110 is not set
89# CONFIG_ARCH_CAMELOT is not set
90# CONFIG_ARCH_FOOTBRIDGE is not set 89# CONFIG_ARCH_FOOTBRIDGE is not set
91# CONFIG_ARCH_INTEGRATOR is not set 90# CONFIG_ARCH_INTEGRATOR is not set
92# CONFIG_ARCH_IOP3XX is not set 91# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/ep80219_defconfig b/arch/arm/configs/ep80219_defconfig
index 96342afa9c5f..3c73b707c2f3 100644
--- a/arch/arm/configs/ep80219_defconfig
+++ b/arch/arm/configs/ep80219_defconfig
@@ -64,7 +64,6 @@ CONFIG_KMOD=y
64# CONFIG_ARCH_CLPS711X is not set 64# CONFIG_ARCH_CLPS711X is not set
65# CONFIG_ARCH_CO285 is not set 65# CONFIG_ARCH_CO285 is not set
66# CONFIG_ARCH_EBSA110 is not set 66# CONFIG_ARCH_EBSA110 is not set
67# CONFIG_ARCH_CAMELOT is not set
68# CONFIG_ARCH_FOOTBRIDGE is not set 67# CONFIG_ARCH_FOOTBRIDGE is not set
69# CONFIG_ARCH_INTEGRATOR is not set 68# CONFIG_ARCH_INTEGRATOR is not set
70CONFIG_ARCH_IOP3XX=y 69CONFIG_ARCH_IOP3XX=y
@@ -523,6 +522,7 @@ CONFIG_E100=y
523# CONFIG_DL2K is not set 522# CONFIG_DL2K is not set
524CONFIG_E1000=y 523CONFIG_E1000=y
525CONFIG_E1000_NAPI=y 524CONFIG_E1000_NAPI=y
525# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
526# CONFIG_NS83820 is not set 526# CONFIG_NS83820 is not set
527# CONFIG_HAMACHI is not set 527# CONFIG_HAMACHI is not set
528# CONFIG_YELLOWFIN is not set 528# CONFIG_YELLOWFIN is not set
diff --git a/arch/arm/configs/footbridge_defconfig b/arch/arm/configs/footbridge_defconfig
index 9737c4850721..2a612d23120b 100644
--- a/arch/arm/configs/footbridge_defconfig
+++ b/arch/arm/configs/footbridge_defconfig
@@ -63,7 +63,6 @@ CONFIG_KMOD=y
63# CONFIG_ARCH_CLPS711X is not set 63# CONFIG_ARCH_CLPS711X is not set
64# CONFIG_ARCH_CO285 is not set 64# CONFIG_ARCH_CO285 is not set
65# CONFIG_ARCH_EBSA110 is not set 65# CONFIG_ARCH_EBSA110 is not set
66# CONFIG_ARCH_CAMELOT is not set
67CONFIG_ARCH_FOOTBRIDGE=y 66CONFIG_ARCH_FOOTBRIDGE=y
68# CONFIG_ARCH_INTEGRATOR is not set 67# CONFIG_ARCH_INTEGRATOR is not set
69# CONFIG_ARCH_IOP3XX is not set 68# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/fortunet_defconfig b/arch/arm/configs/fortunet_defconfig
index b6f688d850dc..65dc73a88c43 100644
--- a/arch/arm/configs/fortunet_defconfig
+++ b/arch/arm/configs/fortunet_defconfig
@@ -57,7 +57,6 @@ CONFIG_BASE_SMALL=0
57CONFIG_ARCH_CLPS711X=y 57CONFIG_ARCH_CLPS711X=y
58# CONFIG_ARCH_CO285 is not set 58# CONFIG_ARCH_CO285 is not set
59# CONFIG_ARCH_EBSA110 is not set 59# CONFIG_ARCH_EBSA110 is not set
60# CONFIG_ARCH_CAMELOT is not set
61# CONFIG_ARCH_FOOTBRIDGE is not set 60# CONFIG_ARCH_FOOTBRIDGE is not set
62# CONFIG_ARCH_INTEGRATOR is not set 61# CONFIG_ARCH_INTEGRATOR is not set
63# CONFIG_ARCH_IOP3XX is not set 62# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/h3600_defconfig b/arch/arm/configs/h3600_defconfig
index b9de07de80fe..7a0da0b7facb 100644
--- a/arch/arm/configs/h3600_defconfig
+++ b/arch/arm/configs/h3600_defconfig
@@ -65,7 +65,6 @@ CONFIG_OBSOLETE_MODPARM=y
65# CONFIG_ARCH_CLPS711X is not set 65# CONFIG_ARCH_CLPS711X is not set
66# CONFIG_ARCH_CO285 is not set 66# CONFIG_ARCH_CO285 is not set
67# CONFIG_ARCH_EBSA110 is not set 67# CONFIG_ARCH_EBSA110 is not set
68# CONFIG_ARCH_CAMELOT is not set
69# CONFIG_ARCH_FOOTBRIDGE is not set 68# CONFIG_ARCH_FOOTBRIDGE is not set
70# CONFIG_ARCH_INTEGRATOR is not set 69# CONFIG_ARCH_INTEGRATOR is not set
71# CONFIG_ARCH_IOP3XX is not set 70# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/h7201_defconfig b/arch/arm/configs/h7201_defconfig
index 39c13a354541..116920aecef7 100644
--- a/arch/arm/configs/h7201_defconfig
+++ b/arch/arm/configs/h7201_defconfig
@@ -60,7 +60,6 @@ CONFIG_KMOD=y
60# CONFIG_ARCH_CLPS711X is not set 60# CONFIG_ARCH_CLPS711X is not set
61# CONFIG_ARCH_CO285 is not set 61# CONFIG_ARCH_CO285 is not set
62# CONFIG_ARCH_EBSA110 is not set 62# CONFIG_ARCH_EBSA110 is not set
63# CONFIG_ARCH_CAMELOT is not set
64# CONFIG_ARCH_FOOTBRIDGE is not set 63# CONFIG_ARCH_FOOTBRIDGE is not set
65# CONFIG_ARCH_INTEGRATOR is not set 64# CONFIG_ARCH_INTEGRATOR is not set
66# CONFIG_ARCH_IOP3XX is not set 65# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/h7202_defconfig b/arch/arm/configs/h7202_defconfig
index fbf5c244c696..9d62ed16bf57 100644
--- a/arch/arm/configs/h7202_defconfig
+++ b/arch/arm/configs/h7202_defconfig
@@ -63,7 +63,6 @@ CONFIG_KMOD=y
63# CONFIG_ARCH_CLPS711X is not set 63# CONFIG_ARCH_CLPS711X is not set
64# CONFIG_ARCH_CO285 is not set 64# CONFIG_ARCH_CO285 is not set
65# CONFIG_ARCH_EBSA110 is not set 65# CONFIG_ARCH_EBSA110 is not set
66# CONFIG_ARCH_CAMELOT is not set
67# CONFIG_ARCH_FOOTBRIDGE is not set 66# CONFIG_ARCH_FOOTBRIDGE is not set
68# CONFIG_ARCH_INTEGRATOR is not set 67# CONFIG_ARCH_INTEGRATOR is not set
69# CONFIG_ARCH_IOP3XX is not set 68# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/hackkit_defconfig b/arch/arm/configs/hackkit_defconfig
index fb41a36a5a68..a45b57582b86 100644
--- a/arch/arm/configs/hackkit_defconfig
+++ b/arch/arm/configs/hackkit_defconfig
@@ -66,7 +66,6 @@ CONFIG_KMOD=y
66# CONFIG_ARCH_CLPS711X is not set 66# CONFIG_ARCH_CLPS711X is not set
67# CONFIG_ARCH_CO285 is not set 67# CONFIG_ARCH_CO285 is not set
68# CONFIG_ARCH_EBSA110 is not set 68# CONFIG_ARCH_EBSA110 is not set
69# CONFIG_ARCH_CAMELOT is not set
70# CONFIG_ARCH_FOOTBRIDGE is not set 69# CONFIG_ARCH_FOOTBRIDGE is not set
71# CONFIG_ARCH_INTEGRATOR is not set 70# CONFIG_ARCH_INTEGRATOR is not set
72# CONFIG_ARCH_IOP3XX is not set 71# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/integrator_defconfig b/arch/arm/configs/integrator_defconfig
index 27ee76825254..d1ba7fdde818 100644
--- a/arch/arm/configs/integrator_defconfig
+++ b/arch/arm/configs/integrator_defconfig
@@ -65,7 +65,6 @@ CONFIG_KMOD=y
65# CONFIG_ARCH_CLPS711X is not set 65# CONFIG_ARCH_CLPS711X is not set
66# CONFIG_ARCH_CO285 is not set 66# CONFIG_ARCH_CO285 is not set
67# CONFIG_ARCH_EBSA110 is not set 67# CONFIG_ARCH_EBSA110 is not set
68# CONFIG_ARCH_CAMELOT is not set
69# CONFIG_ARCH_FOOTBRIDGE is not set 68# CONFIG_ARCH_FOOTBRIDGE is not set
70CONFIG_ARCH_INTEGRATOR=y 69CONFIG_ARCH_INTEGRATOR=y
71# CONFIG_ARCH_IOP3XX is not set 70# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/iq31244_defconfig b/arch/arm/configs/iq31244_defconfig
index e71443b97390..32467160a6df 100644
--- a/arch/arm/configs/iq31244_defconfig
+++ b/arch/arm/configs/iq31244_defconfig
@@ -65,7 +65,6 @@ CONFIG_KMOD=y
65# CONFIG_ARCH_CLPS711X is not set 65# CONFIG_ARCH_CLPS711X is not set
66# CONFIG_ARCH_CO285 is not set 66# CONFIG_ARCH_CO285 is not set
67# CONFIG_ARCH_EBSA110 is not set 67# CONFIG_ARCH_EBSA110 is not set
68# CONFIG_ARCH_CAMELOT is not set
69# CONFIG_ARCH_FOOTBRIDGE is not set 68# CONFIG_ARCH_FOOTBRIDGE is not set
70# CONFIG_ARCH_INTEGRATOR is not set 69# CONFIG_ARCH_INTEGRATOR is not set
71CONFIG_ARCH_IOP3XX=y 70CONFIG_ARCH_IOP3XX=y
@@ -494,6 +493,7 @@ CONFIG_NETDEVICES=y
494# CONFIG_DL2K is not set 493# CONFIG_DL2K is not set
495CONFIG_E1000=y 494CONFIG_E1000=y
496CONFIG_E1000_NAPI=y 495CONFIG_E1000_NAPI=y
496# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
497# CONFIG_NS83820 is not set 497# CONFIG_NS83820 is not set
498# CONFIG_HAMACHI is not set 498# CONFIG_HAMACHI is not set
499# CONFIG_YELLOWFIN is not set 499# CONFIG_YELLOWFIN is not set
diff --git a/arch/arm/configs/iq80321_defconfig b/arch/arm/configs/iq80321_defconfig
index ab5ad23b27da..b000da753c41 100644
--- a/arch/arm/configs/iq80321_defconfig
+++ b/arch/arm/configs/iq80321_defconfig
@@ -64,7 +64,6 @@ CONFIG_KMOD=y
64# CONFIG_ARCH_CLPS711X is not set 64# CONFIG_ARCH_CLPS711X is not set
65# CONFIG_ARCH_CO285 is not set 65# CONFIG_ARCH_CO285 is not set
66# CONFIG_ARCH_EBSA110 is not set 66# CONFIG_ARCH_EBSA110 is not set
67# CONFIG_ARCH_CAMELOT is not set
68# CONFIG_ARCH_FOOTBRIDGE is not set 67# CONFIG_ARCH_FOOTBRIDGE is not set
69# CONFIG_ARCH_INTEGRATOR is not set 68# CONFIG_ARCH_INTEGRATOR is not set
70CONFIG_ARCH_IOP3XX=y 69CONFIG_ARCH_IOP3XX=y
@@ -416,6 +415,7 @@ CONFIG_NETDEVICES=y
416# CONFIG_DL2K is not set 415# CONFIG_DL2K is not set
417CONFIG_E1000=y 416CONFIG_E1000=y
418CONFIG_E1000_NAPI=y 417CONFIG_E1000_NAPI=y
418# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
419# CONFIG_NS83820 is not set 419# CONFIG_NS83820 is not set
420# CONFIG_HAMACHI is not set 420# CONFIG_HAMACHI is not set
421# CONFIG_YELLOWFIN is not set 421# CONFIG_YELLOWFIN is not set
diff --git a/arch/arm/configs/iq80331_defconfig b/arch/arm/configs/iq80331_defconfig
index bb536133ef87..46c79e1efe07 100644
--- a/arch/arm/configs/iq80331_defconfig
+++ b/arch/arm/configs/iq80331_defconfig
@@ -64,7 +64,6 @@ CONFIG_KMOD=y
64# CONFIG_ARCH_CLPS711X is not set 64# CONFIG_ARCH_CLPS711X is not set
65# CONFIG_ARCH_CO285 is not set 65# CONFIG_ARCH_CO285 is not set
66# CONFIG_ARCH_EBSA110 is not set 66# CONFIG_ARCH_EBSA110 is not set
67# CONFIG_ARCH_CAMELOT is not set
68# CONFIG_ARCH_FOOTBRIDGE is not set 67# CONFIG_ARCH_FOOTBRIDGE is not set
69# CONFIG_ARCH_INTEGRATOR is not set 68# CONFIG_ARCH_INTEGRATOR is not set
70CONFIG_ARCH_IOP3XX=y 69CONFIG_ARCH_IOP3XX=y
@@ -497,6 +496,7 @@ CONFIG_NETDEVICES=y
497# CONFIG_DL2K is not set 496# CONFIG_DL2K is not set
498CONFIG_E1000=y 497CONFIG_E1000=y
499CONFIG_E1000_NAPI=y 498CONFIG_E1000_NAPI=y
499# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
500# CONFIG_NS83820 is not set 500# CONFIG_NS83820 is not set
501# CONFIG_HAMACHI is not set 501# CONFIG_HAMACHI is not set
502# CONFIG_YELLOWFIN is not set 502# CONFIG_YELLOWFIN is not set
diff --git a/arch/arm/configs/iq80332_defconfig b/arch/arm/configs/iq80332_defconfig
index 305f01f3a729..11959b705d82 100644
--- a/arch/arm/configs/iq80332_defconfig
+++ b/arch/arm/configs/iq80332_defconfig
@@ -64,7 +64,6 @@ CONFIG_KMOD=y
64# CONFIG_ARCH_CLPS711X is not set 64# CONFIG_ARCH_CLPS711X is not set
65# CONFIG_ARCH_CO285 is not set 65# CONFIG_ARCH_CO285 is not set
66# CONFIG_ARCH_EBSA110 is not set 66# CONFIG_ARCH_EBSA110 is not set
67# CONFIG_ARCH_CAMELOT is not set
68# CONFIG_ARCH_FOOTBRIDGE is not set 67# CONFIG_ARCH_FOOTBRIDGE is not set
69# CONFIG_ARCH_INTEGRATOR is not set 68# CONFIG_ARCH_INTEGRATOR is not set
70CONFIG_ARCH_IOP3XX=y 69CONFIG_ARCH_IOP3XX=y
@@ -497,6 +496,7 @@ CONFIG_NETDEVICES=y
497# CONFIG_DL2K is not set 496# CONFIG_DL2K is not set
498CONFIG_E1000=y 497CONFIG_E1000=y
499CONFIG_E1000_NAPI=y 498CONFIG_E1000_NAPI=y
499# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
500# CONFIG_NS83820 is not set 500# CONFIG_NS83820 is not set
501# CONFIG_HAMACHI is not set 501# CONFIG_HAMACHI is not set
502# CONFIG_YELLOWFIN is not set 502# CONFIG_YELLOWFIN is not set
diff --git a/arch/arm/configs/ixdp2400_defconfig b/arch/arm/configs/ixdp2400_defconfig
index e6a4d2656fe5..d9d6bb86a6fa 100644
--- a/arch/arm/configs/ixdp2400_defconfig
+++ b/arch/arm/configs/ixdp2400_defconfig
@@ -86,7 +86,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
86# CONFIG_ARCH_CLPS711X is not set 86# CONFIG_ARCH_CLPS711X is not set
87# CONFIG_ARCH_CO285 is not set 87# CONFIG_ARCH_CO285 is not set
88# CONFIG_ARCH_EBSA110 is not set 88# CONFIG_ARCH_EBSA110 is not set
89# CONFIG_ARCH_CAMELOT is not set
90# CONFIG_ARCH_FOOTBRIDGE is not set 89# CONFIG_ARCH_FOOTBRIDGE is not set
91# CONFIG_ARCH_INTEGRATOR is not set 90# CONFIG_ARCH_INTEGRATOR is not set
92# CONFIG_ARCH_IOP3XX is not set 91# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/ixdp2401_defconfig b/arch/arm/configs/ixdp2401_defconfig
index 5572cf95d5f8..2dc9d499c7d7 100644
--- a/arch/arm/configs/ixdp2401_defconfig
+++ b/arch/arm/configs/ixdp2401_defconfig
@@ -86,7 +86,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
86# CONFIG_ARCH_CLPS711X is not set 86# CONFIG_ARCH_CLPS711X is not set
87# CONFIG_ARCH_CO285 is not set 87# CONFIG_ARCH_CO285 is not set
88# CONFIG_ARCH_EBSA110 is not set 88# CONFIG_ARCH_EBSA110 is not set
89# CONFIG_ARCH_CAMELOT is not set
90# CONFIG_ARCH_FOOTBRIDGE is not set 89# CONFIG_ARCH_FOOTBRIDGE is not set
91# CONFIG_ARCH_INTEGRATOR is not set 90# CONFIG_ARCH_INTEGRATOR is not set
92# CONFIG_ARCH_IOP3XX is not set 91# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/ixdp2800_defconfig b/arch/arm/configs/ixdp2800_defconfig
index 0fddbde85835..4248123815e9 100644
--- a/arch/arm/configs/ixdp2800_defconfig
+++ b/arch/arm/configs/ixdp2800_defconfig
@@ -86,7 +86,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
86# CONFIG_ARCH_CLPS711X is not set 86# CONFIG_ARCH_CLPS711X is not set
87# CONFIG_ARCH_CO285 is not set 87# CONFIG_ARCH_CO285 is not set
88# CONFIG_ARCH_EBSA110 is not set 88# CONFIG_ARCH_EBSA110 is not set
89# CONFIG_ARCH_CAMELOT is not set
90# CONFIG_ARCH_FOOTBRIDGE is not set 89# CONFIG_ARCH_FOOTBRIDGE is not set
91# CONFIG_ARCH_INTEGRATOR is not set 90# CONFIG_ARCH_INTEGRATOR is not set
92# CONFIG_ARCH_IOP3XX is not set 91# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/ixdp2801_defconfig b/arch/arm/configs/ixdp2801_defconfig
index 89b9aa06aa91..ea8f4b478fa3 100644
--- a/arch/arm/configs/ixdp2801_defconfig
+++ b/arch/arm/configs/ixdp2801_defconfig
@@ -86,7 +86,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
86# CONFIG_ARCH_CLPS711X is not set 86# CONFIG_ARCH_CLPS711X is not set
87# CONFIG_ARCH_CO285 is not set 87# CONFIG_ARCH_CO285 is not set
88# CONFIG_ARCH_EBSA110 is not set 88# CONFIG_ARCH_EBSA110 is not set
89# CONFIG_ARCH_CAMELOT is not set
90# CONFIG_ARCH_FOOTBRIDGE is not set 89# CONFIG_ARCH_FOOTBRIDGE is not set
91# CONFIG_ARCH_INTEGRATOR is not set 90# CONFIG_ARCH_INTEGRATOR is not set
92# CONFIG_ARCH_IOP3XX is not set 91# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/ixp4xx_defconfig b/arch/arm/configs/ixp4xx_defconfig
index f74c926beb42..4975b914f923 100644
--- a/arch/arm/configs/ixp4xx_defconfig
+++ b/arch/arm/configs/ixp4xx_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.14-rc1-git5 3# Linux kernel version: 2.6.15
4# Tue Sep 20 17:26:28 2005 4# Tue Jan 3 03:20:40 2006
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -33,6 +33,7 @@ CONFIG_SYSCTL=y
33CONFIG_KOBJECT_UEVENT=y 33CONFIG_KOBJECT_UEVENT=y
34# CONFIG_IKCONFIG is not set 34# CONFIG_IKCONFIG is not set
35CONFIG_INITRAMFS_SOURCE="" 35CONFIG_INITRAMFS_SOURCE=""
36CONFIG_CC_OPTIMIZE_FOR_SIZE=y
36CONFIG_EMBEDDED=y 37CONFIG_EMBEDDED=y
37CONFIG_KALLSYMS=y 38CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set 39# CONFIG_KALLSYMS_ALL is not set
@@ -42,7 +43,6 @@ CONFIG_BUG=y
42CONFIG_BASE_FULL=y 43CONFIG_BASE_FULL=y
43CONFIG_FUTEX=y 44CONFIG_FUTEX=y
44CONFIG_EPOLL=y 45CONFIG_EPOLL=y
45CONFIG_CC_OPTIMIZE_FOR_SIZE=y
46CONFIG_SHMEM=y 46CONFIG_SHMEM=y
47CONFIG_CC_ALIGN_FUNCTIONS=0 47CONFIG_CC_ALIGN_FUNCTIONS=0
48CONFIG_CC_ALIGN_LABELS=0 48CONFIG_CC_ALIGN_LABELS=0
@@ -62,13 +62,29 @@ CONFIG_MODVERSIONS=y
62CONFIG_KMOD=y 62CONFIG_KMOD=y
63 63
64# 64#
65# Block layer
66#
67
68#
69# IO Schedulers
70#
71CONFIG_IOSCHED_NOOP=y
72CONFIG_IOSCHED_AS=y
73CONFIG_IOSCHED_DEADLINE=y
74CONFIG_IOSCHED_CFQ=y
75CONFIG_DEFAULT_AS=y
76# CONFIG_DEFAULT_DEADLINE is not set
77# CONFIG_DEFAULT_CFQ is not set
78# CONFIG_DEFAULT_NOOP is not set
79CONFIG_DEFAULT_IOSCHED="anticipatory"
80
81#
65# System Type 82# System Type
66# 83#
67# CONFIG_ARCH_CLPS7500 is not set 84# CONFIG_ARCH_CLPS7500 is not set
68# CONFIG_ARCH_CLPS711X is not set 85# CONFIG_ARCH_CLPS711X is not set
69# CONFIG_ARCH_CO285 is not set 86# CONFIG_ARCH_CO285 is not set
70# CONFIG_ARCH_EBSA110 is not set 87# CONFIG_ARCH_EBSA110 is not set
71# CONFIG_ARCH_CAMELOT is not set
72# CONFIG_ARCH_FOOTBRIDGE is not set 88# CONFIG_ARCH_FOOTBRIDGE is not set
73# CONFIG_ARCH_INTEGRATOR is not set 89# CONFIG_ARCH_INTEGRATOR is not set
74# CONFIG_ARCH_IOP3XX is not set 90# CONFIG_ARCH_IOP3XX is not set
@@ -83,6 +99,7 @@ CONFIG_ARCH_IXP4XX=y
83# CONFIG_ARCH_LH7A40X is not set 99# CONFIG_ARCH_LH7A40X is not set
84# CONFIG_ARCH_OMAP is not set 100# CONFIG_ARCH_OMAP is not set
85# CONFIG_ARCH_VERSATILE is not set 101# CONFIG_ARCH_VERSATILE is not set
102# CONFIG_ARCH_REALVIEW is not set
86# CONFIG_ARCH_IMX is not set 103# CONFIG_ARCH_IMX is not set
87# CONFIG_ARCH_H720X is not set 104# CONFIG_ARCH_H720X is not set
88# CONFIG_ARCH_AAEC2000 is not set 105# CONFIG_ARCH_AAEC2000 is not set
@@ -102,6 +119,7 @@ CONFIG_MACH_IXDPG425=y
102CONFIG_MACH_IXDP465=y 119CONFIG_MACH_IXDP465=y
103CONFIG_ARCH_IXCDP1100=y 120CONFIG_ARCH_IXCDP1100=y
104CONFIG_ARCH_PRPMC1100=y 121CONFIG_ARCH_PRPMC1100=y
122CONFIG_MACH_NAS100D=y
105CONFIG_ARCH_IXDP4XX=y 123CONFIG_ARCH_IXDP4XX=y
106CONFIG_CPU_IXP46X=y 124CONFIG_CPU_IXP46X=y
107# CONFIG_MACH_GTWX5715 is not set 125# CONFIG_MACH_GTWX5715 is not set
@@ -155,6 +173,7 @@ CONFIG_FLATMEM_MANUAL=y
155CONFIG_FLATMEM=y 173CONFIG_FLATMEM=y
156CONFIG_FLAT_NODE_MEM_MAP=y 174CONFIG_FLAT_NODE_MEM_MAP=y
157# CONFIG_SPARSEMEM_STATIC is not set 175# CONFIG_SPARSEMEM_STATIC is not set
176CONFIG_SPLIT_PTLOCK_CPUS=4096
158CONFIG_ALIGNMENT_TRAP=y 177CONFIG_ALIGNMENT_TRAP=y
159 178
160# 179#
@@ -173,6 +192,7 @@ CONFIG_CMDLINE="console=ttyS0,115200 ip=bootp root=/dev/nfs"
173# At least one emulation must be selected 192# At least one emulation must be selected
174# 193#
175CONFIG_FPE_NWFPE=y 194CONFIG_FPE_NWFPE=y
195# CONFIG_FPE_NWFPE_XP is not set
176# CONFIG_FPE_FASTFPE is not set 196# CONFIG_FPE_FASTFPE is not set
177 197
178# 198#
@@ -187,6 +207,8 @@ CONFIG_BINFMT_ELF=y
187# Power management options 207# Power management options
188# 208#
189CONFIG_PM=y 209CONFIG_PM=y
210CONFIG_PM_LEGACY=y
211# CONFIG_PM_DEBUG is not set
190CONFIG_APM=y 212CONFIG_APM=y
191 213
192# 214#
@@ -271,6 +293,10 @@ CONFIG_IP_VS_SH=m
271CONFIG_NETFILTER=y 293CONFIG_NETFILTER=y
272# CONFIG_NETFILTER_DEBUG is not set 294# CONFIG_NETFILTER_DEBUG is not set
273CONFIG_BRIDGE_NETFILTER=y 295CONFIG_BRIDGE_NETFILTER=y
296
297#
298# Core Netfilter Configuration
299#
274# CONFIG_NETFILTER_NETLINK is not set 300# CONFIG_NETFILTER_NETLINK is not set
275 301
276# 302#
@@ -286,6 +312,7 @@ CONFIG_IP_NF_IRC=m
286# CONFIG_IP_NF_NETBIOS_NS is not set 312# CONFIG_IP_NF_NETBIOS_NS is not set
287# CONFIG_IP_NF_TFTP is not set 313# CONFIG_IP_NF_TFTP is not set
288# CONFIG_IP_NF_AMANDA is not set 314# CONFIG_IP_NF_AMANDA is not set
315# CONFIG_IP_NF_PPTP is not set
289CONFIG_IP_NF_QUEUE=m 316CONFIG_IP_NF_QUEUE=m
290CONFIG_IP_NF_IPTABLES=m 317CONFIG_IP_NF_IPTABLES=m
291CONFIG_IP_NF_MATCH_LIMIT=m 318CONFIG_IP_NF_MATCH_LIMIT=m
@@ -319,6 +346,7 @@ CONFIG_IP_NF_TARGET_REJECT=m
319CONFIG_IP_NF_TARGET_LOG=m 346CONFIG_IP_NF_TARGET_LOG=m
320CONFIG_IP_NF_TARGET_ULOG=m 347CONFIG_IP_NF_TARGET_ULOG=m
321CONFIG_IP_NF_TARGET_TCPMSS=m 348CONFIG_IP_NF_TARGET_TCPMSS=m
349# CONFIG_IP_NF_TARGET_NFQUEUE is not set
322CONFIG_IP_NF_NAT=m 350CONFIG_IP_NF_NAT=m
323CONFIG_IP_NF_NAT_NEEDED=y 351CONFIG_IP_NF_NAT_NEEDED=y
324CONFIG_IP_NF_TARGET_MASQUERADE=m 352CONFIG_IP_NF_TARGET_MASQUERADE=m
@@ -380,10 +408,18 @@ CONFIG_ECONET=m
380CONFIG_ECONET_AUNUDP=y 408CONFIG_ECONET_AUNUDP=y
381CONFIG_ECONET_NATIVE=y 409CONFIG_ECONET_NATIVE=y
382CONFIG_WAN_ROUTER=m 410CONFIG_WAN_ROUTER=m
411
412#
413# QoS and/or fair queueing
414#
383CONFIG_NET_SCHED=y 415CONFIG_NET_SCHED=y
384CONFIG_NET_SCH_CLK_JIFFIES=y 416CONFIG_NET_SCH_CLK_JIFFIES=y
385# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set 417# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
386# CONFIG_NET_SCH_CLK_CPU is not set 418# CONFIG_NET_SCH_CLK_CPU is not set
419
420#
421# Queueing/Scheduling
422#
387CONFIG_NET_SCH_CBQ=m 423CONFIG_NET_SCH_CBQ=m
388CONFIG_NET_SCH_HTB=m 424CONFIG_NET_SCH_HTB=m
389# CONFIG_NET_SCH_HFSC is not set 425# CONFIG_NET_SCH_HFSC is not set
@@ -397,8 +433,10 @@ CONFIG_NET_SCH_GRED=m
397CONFIG_NET_SCH_DSMARK=m 433CONFIG_NET_SCH_DSMARK=m
398# CONFIG_NET_SCH_NETEM is not set 434# CONFIG_NET_SCH_NETEM is not set
399CONFIG_NET_SCH_INGRESS=m 435CONFIG_NET_SCH_INGRESS=m
400CONFIG_NET_QOS=y 436
401CONFIG_NET_ESTIMATOR=y 437#
438# Classification
439#
402CONFIG_NET_CLS=y 440CONFIG_NET_CLS=y
403# CONFIG_NET_CLS_BASIC is not set 441# CONFIG_NET_CLS_BASIC is not set
404CONFIG_NET_CLS_TCINDEX=m 442CONFIG_NET_CLS_TCINDEX=m
@@ -407,13 +445,14 @@ CONFIG_NET_CLS_ROUTE=y
407CONFIG_NET_CLS_FW=m 445CONFIG_NET_CLS_FW=m
408CONFIG_NET_CLS_U32=m 446CONFIG_NET_CLS_U32=m
409# CONFIG_CLS_U32_PERF is not set 447# CONFIG_CLS_U32_PERF is not set
410# CONFIG_NET_CLS_IND is not set
411# CONFIG_CLS_U32_MARK is not set 448# CONFIG_CLS_U32_MARK is not set
412CONFIG_NET_CLS_RSVP=m 449CONFIG_NET_CLS_RSVP=m
413CONFIG_NET_CLS_RSVP6=m 450CONFIG_NET_CLS_RSVP6=m
414# CONFIG_NET_EMATCH is not set 451# CONFIG_NET_EMATCH is not set
415# CONFIG_NET_CLS_ACT is not set 452# CONFIG_NET_CLS_ACT is not set
416CONFIG_NET_CLS_POLICE=y 453CONFIG_NET_CLS_POLICE=y
454# CONFIG_NET_CLS_IND is not set
455CONFIG_NET_ESTIMATOR=y
417 456
418# 457#
419# Network testing 458# Network testing
@@ -437,6 +476,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
437# CONFIG_DEBUG_DRIVER is not set 476# CONFIG_DEBUG_DRIVER is not set
438 477
439# 478#
479# Connector - unified userspace <-> kernelspace linker
480#
481# CONFIG_CONNECTOR is not set
482
483#
440# Memory Technology Devices (MTD) 484# Memory Technology Devices (MTD)
441# 485#
442CONFIG_MTD=y 486CONFIG_MTD=y
@@ -458,6 +502,7 @@ CONFIG_MTD_BLOCK=y
458# CONFIG_FTL is not set 502# CONFIG_FTL is not set
459# CONFIG_NFTL is not set 503# CONFIG_NFTL is not set
460# CONFIG_INFTL is not set 504# CONFIG_INFTL is not set
505# CONFIG_RFD_FTL is not set
461 506
462# 507#
463# RAM/ROM/Flash chip drivers 508# RAM/ROM/Flash chip drivers
@@ -492,7 +537,6 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
492# CONFIG_MTD_PHYSMAP is not set 537# CONFIG_MTD_PHYSMAP is not set
493# CONFIG_MTD_ARM_INTEGRATOR is not set 538# CONFIG_MTD_ARM_INTEGRATOR is not set
494CONFIG_MTD_IXP4XX=y 539CONFIG_MTD_IXP4XX=y
495# CONFIG_MTD_EDB7312 is not set
496# CONFIG_MTD_PCI is not set 540# CONFIG_MTD_PCI is not set
497# CONFIG_MTD_PLATRAM is not set 541# CONFIG_MTD_PLATRAM is not set
498 542
@@ -523,6 +567,11 @@ CONFIG_MTD_NAND_IDS=m
523# CONFIG_MTD_NAND_NANDSIM is not set 567# CONFIG_MTD_NAND_NANDSIM is not set
524 568
525# 569#
570# OneNAND Flash Device Drivers
571#
572# CONFIG_MTD_ONENAND is not set
573
574#
526# Parallel port support 575# Parallel port support
527# 576#
528# CONFIG_PARPORT is not set 577# CONFIG_PARPORT is not set
@@ -548,14 +597,6 @@ CONFIG_BLK_DEV_RAM_COUNT=16
548CONFIG_BLK_DEV_RAM_SIZE=8192 597CONFIG_BLK_DEV_RAM_SIZE=8192
549CONFIG_BLK_DEV_INITRD=y 598CONFIG_BLK_DEV_INITRD=y
550# CONFIG_CDROM_PKTCDVD is not set 599# CONFIG_CDROM_PKTCDVD is not set
551
552#
553# IO Schedulers
554#
555CONFIG_IOSCHED_NOOP=y
556CONFIG_IOSCHED_AS=y
557CONFIG_IOSCHED_DEADLINE=y
558CONFIG_IOSCHED_CFQ=y
559# CONFIG_ATA_OVER_ETH is not set 600# CONFIG_ATA_OVER_ETH is not set
560 601
561# 602#
@@ -668,6 +709,7 @@ CONFIG_NET_ETHERNET=y
668CONFIG_MII=y 709CONFIG_MII=y
669# CONFIG_HAPPYMEAL is not set 710# CONFIG_HAPPYMEAL is not set
670# CONFIG_SUNGEM is not set 711# CONFIG_SUNGEM is not set
712# CONFIG_CASSINI is not set
671# CONFIG_NET_VENDOR_3COM is not set 713# CONFIG_NET_VENDOR_3COM is not set
672# CONFIG_SMC91X is not set 714# CONFIG_SMC91X is not set
673# CONFIG_DM9000 is not set 715# CONFIG_DM9000 is not set
@@ -739,6 +781,7 @@ CONFIG_NET_RADIO=y
739# 781#
740# Wireless 802.11b ISA/PCI cards support 782# Wireless 802.11b ISA/PCI cards support
741# 783#
784# CONFIG_AIRO is not set
742CONFIG_HERMES=y 785CONFIG_HERMES=y
743# CONFIG_PLX_HERMES is not set 786# CONFIG_PLX_HERMES is not set
744# CONFIG_TMD_HERMES is not set 787# CONFIG_TMD_HERMES is not set
@@ -782,6 +825,7 @@ CONFIG_WAN_ROUTER_DRIVERS=y
782# 825#
783# ATM drivers 826# ATM drivers
784# 827#
828# CONFIG_ATM_DUMMY is not set
785CONFIG_ATM_TCP=m 829CONFIG_ATM_TCP=m
786# CONFIG_ATM_LANAI is not set 830# CONFIG_ATM_LANAI is not set
787# CONFIG_ATM_ENI is not set 831# CONFIG_ATM_ENI is not set
@@ -902,6 +946,7 @@ CONFIG_IXP4XX_WATCHDOG=y
902# TPM devices 946# TPM devices
903# 947#
904# CONFIG_TCG_TPM is not set 948# CONFIG_TCG_TPM is not set
949# CONFIG_TELCLOCK is not set
905 950
906# 951#
907# I2C support 952# I2C support
@@ -954,6 +999,7 @@ CONFIG_SENSORS_EEPROM=y
954# CONFIG_SENSORS_PCF8591 is not set 999# CONFIG_SENSORS_PCF8591 is not set
955# CONFIG_SENSORS_RTC8564 is not set 1000# CONFIG_SENSORS_RTC8564 is not set
956# CONFIG_SENSORS_MAX6875 is not set 1001# CONFIG_SENSORS_MAX6875 is not set
1002# CONFIG_RTC_X1205_I2C is not set
957# CONFIG_I2C_DEBUG_CORE is not set 1003# CONFIG_I2C_DEBUG_CORE is not set
958# CONFIG_I2C_DEBUG_ALGO is not set 1004# CONFIG_I2C_DEBUG_ALGO is not set
959# CONFIG_I2C_DEBUG_BUS is not set 1005# CONFIG_I2C_DEBUG_BUS is not set
@@ -1036,6 +1082,10 @@ CONFIG_USB_ARCH_HAS_OHCI=y
1036# CONFIG_USB is not set 1082# CONFIG_USB is not set
1037 1083
1038# 1084#
1085# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1086#
1087
1088#
1039# USB Gadget Support 1089# USB Gadget Support
1040# 1090#
1041# CONFIG_USB_GADGET is not set 1091# CONFIG_USB_GADGET is not set
@@ -1110,6 +1160,7 @@ CONFIG_RAMFS=y
1110CONFIG_JFFS2_FS=y 1160CONFIG_JFFS2_FS=y
1111CONFIG_JFFS2_FS_DEBUG=0 1161CONFIG_JFFS2_FS_DEBUG=0
1112CONFIG_JFFS2_FS_WRITEBUFFER=y 1162CONFIG_JFFS2_FS_WRITEBUFFER=y
1163# CONFIG_JFFS2_SUMMARY is not set
1113# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 1164# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1114CONFIG_JFFS2_ZLIB=y 1165CONFIG_JFFS2_ZLIB=y
1115CONFIG_JFFS2_RTIME=y 1166CONFIG_JFFS2_RTIME=y
@@ -1190,7 +1241,9 @@ CONFIG_DETECT_SOFTLOCKUP=y
1190CONFIG_DEBUG_BUGVERBOSE=y 1241CONFIG_DEBUG_BUGVERBOSE=y
1191# CONFIG_DEBUG_INFO is not set 1242# CONFIG_DEBUG_INFO is not set
1192# CONFIG_DEBUG_FS is not set 1243# CONFIG_DEBUG_FS is not set
1244# CONFIG_DEBUG_VM is not set
1193CONFIG_FRAME_POINTER=y 1245CONFIG_FRAME_POINTER=y
1246# CONFIG_RCU_TORTURE_TEST is not set
1194# CONFIG_DEBUG_USER is not set 1247# CONFIG_DEBUG_USER is not set
1195# CONFIG_DEBUG_WAITQ is not set 1248# CONFIG_DEBUG_WAITQ is not set
1196CONFIG_DEBUG_ERRORS=y 1249CONFIG_DEBUG_ERRORS=y
diff --git a/arch/arm/configs/jornada720_defconfig b/arch/arm/configs/jornada720_defconfig
index b88aeba82bc0..ad1048db96fb 100644
--- a/arch/arm/configs/jornada720_defconfig
+++ b/arch/arm/configs/jornada720_defconfig
@@ -63,7 +63,6 @@ CONFIG_KMOD=y
63# CONFIG_ARCH_CLPS711X is not set 63# CONFIG_ARCH_CLPS711X is not set
64# CONFIG_ARCH_CO285 is not set 64# CONFIG_ARCH_CO285 is not set
65# CONFIG_ARCH_EBSA110 is not set 65# CONFIG_ARCH_EBSA110 is not set
66# CONFIG_ARCH_CAMELOT is not set
67# CONFIG_ARCH_FOOTBRIDGE is not set 66# CONFIG_ARCH_FOOTBRIDGE is not set
68# CONFIG_ARCH_INTEGRATOR is not set 67# CONFIG_ARCH_INTEGRATOR is not set
69# CONFIG_ARCH_IOP3XX is not set 68# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/lart_defconfig b/arch/arm/configs/lart_defconfig
index 7033829ed145..c3a932844160 100644
--- a/arch/arm/configs/lart_defconfig
+++ b/arch/arm/configs/lart_defconfig
@@ -62,7 +62,6 @@ CONFIG_KMOD=y
62# CONFIG_ARCH_CLPS711X is not set 62# CONFIG_ARCH_CLPS711X is not set
63# CONFIG_ARCH_CO285 is not set 63# CONFIG_ARCH_CO285 is not set
64# CONFIG_ARCH_EBSA110 is not set 64# CONFIG_ARCH_EBSA110 is not set
65# CONFIG_ARCH_CAMELOT is not set
66# CONFIG_ARCH_FOOTBRIDGE is not set 65# CONFIG_ARCH_FOOTBRIDGE is not set
67# CONFIG_ARCH_INTEGRATOR is not set 66# CONFIG_ARCH_INTEGRATOR is not set
68# CONFIG_ARCH_IOP3XX is not set 67# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/lpd7a400_defconfig b/arch/arm/configs/lpd7a400_defconfig
index d64706d3ff35..67eaa26c2647 100644
--- a/arch/arm/configs/lpd7a400_defconfig
+++ b/arch/arm/configs/lpd7a400_defconfig
@@ -60,7 +60,6 @@ CONFIG_BASE_SMALL=0
60# CONFIG_ARCH_CLPS711X is not set 60# CONFIG_ARCH_CLPS711X is not set
61# CONFIG_ARCH_CO285 is not set 61# CONFIG_ARCH_CO285 is not set
62# CONFIG_ARCH_EBSA110 is not set 62# CONFIG_ARCH_EBSA110 is not set
63# CONFIG_ARCH_CAMELOT is not set
64# CONFIG_ARCH_FOOTBRIDGE is not set 63# CONFIG_ARCH_FOOTBRIDGE is not set
65# CONFIG_ARCH_INTEGRATOR is not set 64# CONFIG_ARCH_INTEGRATOR is not set
66# CONFIG_ARCH_IOP3XX is not set 65# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/lpd7a404_defconfig b/arch/arm/configs/lpd7a404_defconfig
index 87cbedfb303f..208d591ebfce 100644
--- a/arch/arm/configs/lpd7a404_defconfig
+++ b/arch/arm/configs/lpd7a404_defconfig
@@ -60,7 +60,6 @@ CONFIG_BASE_SMALL=0
60# CONFIG_ARCH_CLPS711X is not set 60# CONFIG_ARCH_CLPS711X is not set
61# CONFIG_ARCH_CO285 is not set 61# CONFIG_ARCH_CO285 is not set
62# CONFIG_ARCH_EBSA110 is not set 62# CONFIG_ARCH_EBSA110 is not set
63# CONFIG_ARCH_CAMELOT is not set
64# CONFIG_ARCH_FOOTBRIDGE is not set 63# CONFIG_ARCH_FOOTBRIDGE is not set
65# CONFIG_ARCH_INTEGRATOR is not set 64# CONFIG_ARCH_INTEGRATOR is not set
66# CONFIG_ARCH_IOP3XX is not set 65# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/lubbock_defconfig b/arch/arm/configs/lubbock_defconfig
index 4bc8717c6f57..81daadcbe0ba 100644
--- a/arch/arm/configs/lubbock_defconfig
+++ b/arch/arm/configs/lubbock_defconfig
@@ -63,7 +63,6 @@ CONFIG_OBSOLETE_MODPARM=y
63# CONFIG_ARCH_CLPS711X is not set 63# CONFIG_ARCH_CLPS711X is not set
64# CONFIG_ARCH_CO285 is not set 64# CONFIG_ARCH_CO285 is not set
65# CONFIG_ARCH_EBSA110 is not set 65# CONFIG_ARCH_EBSA110 is not set
66# CONFIG_ARCH_CAMELOT is not set
67# CONFIG_ARCH_FOOTBRIDGE is not set 66# CONFIG_ARCH_FOOTBRIDGE is not set
68# CONFIG_ARCH_INTEGRATOR is not set 67# CONFIG_ARCH_INTEGRATOR is not set
69# CONFIG_ARCH_IOP3XX is not set 68# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/lusl7200_defconfig b/arch/arm/configs/lusl7200_defconfig
index 3ca64cabc92c..42f6a77bc3c0 100644
--- a/arch/arm/configs/lusl7200_defconfig
+++ b/arch/arm/configs/lusl7200_defconfig
@@ -62,7 +62,6 @@ CONFIG_KMOD=y
62# CONFIG_ARCH_CLPS711X is not set 62# CONFIG_ARCH_CLPS711X is not set
63# CONFIG_ARCH_CO285 is not set 63# CONFIG_ARCH_CO285 is not set
64# CONFIG_ARCH_EBSA110 is not set 64# CONFIG_ARCH_EBSA110 is not set
65# CONFIG_ARCH_CAMELOT is not set
66# CONFIG_ARCH_FOOTBRIDGE is not set 65# CONFIG_ARCH_FOOTBRIDGE is not set
67# CONFIG_ARCH_INTEGRATOR is not set 66# CONFIG_ARCH_INTEGRATOR is not set
68# CONFIG_ARCH_IOP3XX is not set 67# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/mainstone_defconfig b/arch/arm/configs/mainstone_defconfig
index 153d68594beb..b112bd75bda2 100644
--- a/arch/arm/configs/mainstone_defconfig
+++ b/arch/arm/configs/mainstone_defconfig
@@ -63,7 +63,6 @@ CONFIG_OBSOLETE_MODPARM=y
63# CONFIG_ARCH_CLPS711X is not set 63# CONFIG_ARCH_CLPS711X is not set
64# CONFIG_ARCH_CO285 is not set 64# CONFIG_ARCH_CO285 is not set
65# CONFIG_ARCH_EBSA110 is not set 65# CONFIG_ARCH_EBSA110 is not set
66# CONFIG_ARCH_CAMELOT is not set
67# CONFIG_ARCH_FOOTBRIDGE is not set 66# CONFIG_ARCH_FOOTBRIDGE is not set
68# CONFIG_ARCH_INTEGRATOR is not set 67# CONFIG_ARCH_INTEGRATOR is not set
69# CONFIG_ARCH_IOP3XX is not set 68# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/mx1ads_defconfig b/arch/arm/configs/mx1ads_defconfig
index 6517d167acf0..d16f6cd6e039 100644
--- a/arch/arm/configs/mx1ads_defconfig
+++ b/arch/arm/configs/mx1ads_defconfig
@@ -63,7 +63,6 @@ CONFIG_KMOD=y
63# CONFIG_ARCH_CLPS711X is not set 63# CONFIG_ARCH_CLPS711X is not set
64# CONFIG_ARCH_CO285 is not set 64# CONFIG_ARCH_CO285 is not set
65# CONFIG_ARCH_EBSA110 is not set 65# CONFIG_ARCH_EBSA110 is not set
66# CONFIG_ARCH_CAMELOT is not set
67# CONFIG_ARCH_FOOTBRIDGE is not set 66# CONFIG_ARCH_FOOTBRIDGE is not set
68# CONFIG_ARCH_INTEGRATOR is not set 67# CONFIG_ARCH_INTEGRATOR is not set
69# CONFIG_ARCH_IOP3XX is not set 68# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/neponset_defconfig b/arch/arm/configs/neponset_defconfig
index 7fb1f7c7bf43..3d35255c64ed 100644
--- a/arch/arm/configs/neponset_defconfig
+++ b/arch/arm/configs/neponset_defconfig
@@ -65,7 +65,6 @@ CONFIG_OBSOLETE_MODPARM=y
65# CONFIG_ARCH_CLPS711X is not set 65# CONFIG_ARCH_CLPS711X is not set
66# CONFIG_ARCH_CO285 is not set 66# CONFIG_ARCH_CO285 is not set
67# CONFIG_ARCH_EBSA110 is not set 67# CONFIG_ARCH_EBSA110 is not set
68# CONFIG_ARCH_CAMELOT is not set
69# CONFIG_ARCH_FOOTBRIDGE is not set 68# CONFIG_ARCH_FOOTBRIDGE is not set
70# CONFIG_ARCH_INTEGRATOR is not set 69# CONFIG_ARCH_INTEGRATOR is not set
71# CONFIG_ARCH_IOP3XX is not set 70# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/netwinder_defconfig b/arch/arm/configs/netwinder_defconfig
index 6e81acf94c2f..2cae1ead9f9b 100644
--- a/arch/arm/configs/netwinder_defconfig
+++ b/arch/arm/configs/netwinder_defconfig
@@ -58,7 +58,6 @@ CONFIG_BASE_SMALL=0
58# CONFIG_ARCH_CLPS711X is not set 58# CONFIG_ARCH_CLPS711X is not set
59# CONFIG_ARCH_CO285 is not set 59# CONFIG_ARCH_CO285 is not set
60# CONFIG_ARCH_EBSA110 is not set 60# CONFIG_ARCH_EBSA110 is not set
61# CONFIG_ARCH_CAMELOT is not set
62CONFIG_ARCH_FOOTBRIDGE=y 61CONFIG_ARCH_FOOTBRIDGE=y
63# CONFIG_ARCH_INTEGRATOR is not set 62# CONFIG_ARCH_INTEGRATOR is not set
64# CONFIG_ARCH_IOP3XX is not set 63# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/omap_h2_1610_defconfig b/arch/arm/configs/omap_h2_1610_defconfig
index 529f0f72e1e9..ee3ecbd9002d 100644
--- a/arch/arm/configs/omap_h2_1610_defconfig
+++ b/arch/arm/configs/omap_h2_1610_defconfig
@@ -85,7 +85,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
85# CONFIG_ARCH_CLPS711X is not set 85# CONFIG_ARCH_CLPS711X is not set
86# CONFIG_ARCH_CO285 is not set 86# CONFIG_ARCH_CO285 is not set
87# CONFIG_ARCH_EBSA110 is not set 87# CONFIG_ARCH_EBSA110 is not set
88# CONFIG_ARCH_CAMELOT is not set
89# CONFIG_ARCH_FOOTBRIDGE is not set 88# CONFIG_ARCH_FOOTBRIDGE is not set
90# CONFIG_ARCH_INTEGRATOR is not set 89# CONFIG_ARCH_INTEGRATOR is not set
91# CONFIG_ARCH_IOP3XX is not set 90# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/pleb_defconfig b/arch/arm/configs/pleb_defconfig
index 10fec890578d..24e8bdd4cb91 100644
--- a/arch/arm/configs/pleb_defconfig
+++ b/arch/arm/configs/pleb_defconfig
@@ -63,7 +63,6 @@ CONFIG_KMOD=y
63# CONFIG_ARCH_CLPS711X is not set 63# CONFIG_ARCH_CLPS711X is not set
64# CONFIG_ARCH_CO285 is not set 64# CONFIG_ARCH_CO285 is not set
65# CONFIG_ARCH_EBSA110 is not set 65# CONFIG_ARCH_EBSA110 is not set
66# CONFIG_ARCH_CAMELOT is not set
67# CONFIG_ARCH_FOOTBRIDGE is not set 66# CONFIG_ARCH_FOOTBRIDGE is not set
68# CONFIG_ARCH_INTEGRATOR is not set 67# CONFIG_ARCH_INTEGRATOR is not set
69# CONFIG_ARCH_IOP3XX is not set 68# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/pxa255-idp_defconfig b/arch/arm/configs/pxa255-idp_defconfig
index 21c327883d8c..b71d31a4bb56 100644
--- a/arch/arm/configs/pxa255-idp_defconfig
+++ b/arch/arm/configs/pxa255-idp_defconfig
@@ -63,7 +63,6 @@ CONFIG_OBSOLETE_MODPARM=y
63# CONFIG_ARCH_CLPS711X is not set 63# CONFIG_ARCH_CLPS711X is not set
64# CONFIG_ARCH_CO285 is not set 64# CONFIG_ARCH_CO285 is not set
65# CONFIG_ARCH_EBSA110 is not set 65# CONFIG_ARCH_EBSA110 is not set
66# CONFIG_ARCH_CAMELOT is not set
67# CONFIG_ARCH_FOOTBRIDGE is not set 66# CONFIG_ARCH_FOOTBRIDGE is not set
68# CONFIG_ARCH_INTEGRATOR is not set 67# CONFIG_ARCH_INTEGRATOR is not set
69# CONFIG_ARCH_IOP3XX is not set 68# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/realview_defconfig b/arch/arm/configs/realview_defconfig
index 0485b2f1cc20..3f1ec4e304f7 100644
--- a/arch/arm/configs/realview_defconfig
+++ b/arch/arm/configs/realview_defconfig
@@ -65,7 +65,6 @@ CONFIG_OBSOLETE_MODPARM=y
65# CONFIG_ARCH_CLPS711X is not set 65# CONFIG_ARCH_CLPS711X is not set
66# CONFIG_ARCH_CO285 is not set 66# CONFIG_ARCH_CO285 is not set
67# CONFIG_ARCH_EBSA110 is not set 67# CONFIG_ARCH_EBSA110 is not set
68# CONFIG_ARCH_CAMELOT is not set
69# CONFIG_ARCH_FOOTBRIDGE is not set 68# CONFIG_ARCH_FOOTBRIDGE is not set
70# CONFIG_ARCH_INTEGRATOR is not set 69# CONFIG_ARCH_INTEGRATOR is not set
71# CONFIG_ARCH_IOP3XX is not set 70# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/rpc_defconfig b/arch/arm/configs/rpc_defconfig
index 19184c1010ad..b498afdc03b6 100644
--- a/arch/arm/configs/rpc_defconfig
+++ b/arch/arm/configs/rpc_defconfig
@@ -66,7 +66,6 @@ CONFIG_KMOD=y
66# CONFIG_ARCH_CLPS711X is not set 66# CONFIG_ARCH_CLPS711X is not set
67# CONFIG_ARCH_CO285 is not set 67# CONFIG_ARCH_CO285 is not set
68# CONFIG_ARCH_EBSA110 is not set 68# CONFIG_ARCH_EBSA110 is not set
69# CONFIG_ARCH_CAMELOT is not set
70# CONFIG_ARCH_FOOTBRIDGE is not set 69# CONFIG_ARCH_FOOTBRIDGE is not set
71# CONFIG_ARCH_INTEGRATOR is not set 70# CONFIG_ARCH_INTEGRATOR is not set
72# CONFIG_ARCH_IOP3XX is not set 71# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index 3f97590c91f2..33f31080a98c 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_defconfig
@@ -85,7 +85,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
85# CONFIG_ARCH_CLPS711X is not set 85# CONFIG_ARCH_CLPS711X is not set
86# CONFIG_ARCH_CO285 is not set 86# CONFIG_ARCH_CO285 is not set
87# CONFIG_ARCH_EBSA110 is not set 87# CONFIG_ARCH_EBSA110 is not set
88# CONFIG_ARCH_CAMELOT is not set
89# CONFIG_ARCH_FOOTBRIDGE is not set 88# CONFIG_ARCH_FOOTBRIDGE is not set
90# CONFIG_ARCH_INTEGRATOR is not set 89# CONFIG_ARCH_INTEGRATOR is not set
91# CONFIG_ARCH_IOP3XX is not set 90# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/shannon_defconfig b/arch/arm/configs/shannon_defconfig
index e3facc4fe792..d052c8f80515 100644
--- a/arch/arm/configs/shannon_defconfig
+++ b/arch/arm/configs/shannon_defconfig
@@ -62,7 +62,6 @@ CONFIG_OBSOLETE_MODPARM=y
62# CONFIG_ARCH_CLPS711X is not set 62# CONFIG_ARCH_CLPS711X is not set
63# CONFIG_ARCH_CO285 is not set 63# CONFIG_ARCH_CO285 is not set
64# CONFIG_ARCH_EBSA110 is not set 64# CONFIG_ARCH_EBSA110 is not set
65# CONFIG_ARCH_CAMELOT is not set
66# CONFIG_ARCH_FOOTBRIDGE is not set 65# CONFIG_ARCH_FOOTBRIDGE is not set
67# CONFIG_ARCH_INTEGRATOR is not set 66# CONFIG_ARCH_INTEGRATOR is not set
68# CONFIG_ARCH_IOP3XX is not set 67# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/shark_defconfig b/arch/arm/configs/shark_defconfig
index 271823f0d708..c48d17062262 100644
--- a/arch/arm/configs/shark_defconfig
+++ b/arch/arm/configs/shark_defconfig
@@ -66,7 +66,6 @@ CONFIG_KMOD=y
66# CONFIG_ARCH_CLPS711X is not set 66# CONFIG_ARCH_CLPS711X is not set
67# CONFIG_ARCH_CO285 is not set 67# CONFIG_ARCH_CO285 is not set
68# CONFIG_ARCH_EBSA110 is not set 68# CONFIG_ARCH_EBSA110 is not set
69# CONFIG_ARCH_CAMELOT is not set
70# CONFIG_ARCH_FOOTBRIDGE is not set 69# CONFIG_ARCH_FOOTBRIDGE is not set
71# CONFIG_ARCH_INTEGRATOR is not set 70# CONFIG_ARCH_INTEGRATOR is not set
72# CONFIG_ARCH_IOP3XX is not set 71# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/simpad_defconfig b/arch/arm/configs/simpad_defconfig
index 5373eeb7d578..2e5a616cc98d 100644
--- a/arch/arm/configs/simpad_defconfig
+++ b/arch/arm/configs/simpad_defconfig
@@ -64,7 +64,6 @@ CONFIG_KMOD=y
64# CONFIG_ARCH_CLPS711X is not set 64# CONFIG_ARCH_CLPS711X is not set
65# CONFIG_ARCH_CO285 is not set 65# CONFIG_ARCH_CO285 is not set
66# CONFIG_ARCH_EBSA110 is not set 66# CONFIG_ARCH_EBSA110 is not set
67# CONFIG_ARCH_CAMELOT is not set
68# CONFIG_ARCH_FOOTBRIDGE is not set 67# CONFIG_ARCH_FOOTBRIDGE is not set
69# CONFIG_ARCH_INTEGRATOR is not set 68# CONFIG_ARCH_INTEGRATOR is not set
70# CONFIG_ARCH_IOP3XX is not set 69# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/smdk2410_defconfig b/arch/arm/configs/smdk2410_defconfig
index 2c60865fda19..4d123d33c7df 100644
--- a/arch/arm/configs/smdk2410_defconfig
+++ b/arch/arm/configs/smdk2410_defconfig
@@ -58,7 +58,6 @@ CONFIG_BASE_SMALL=0
58# CONFIG_ARCH_CLPS711X is not set 58# CONFIG_ARCH_CLPS711X is not set
59# CONFIG_ARCH_CO285 is not set 59# CONFIG_ARCH_CO285 is not set
60# CONFIG_ARCH_EBSA110 is not set 60# CONFIG_ARCH_EBSA110 is not set
61# CONFIG_ARCH_CAMELOT is not set
62# CONFIG_ARCH_FOOTBRIDGE is not set 61# CONFIG_ARCH_FOOTBRIDGE is not set
63# CONFIG_ARCH_INTEGRATOR is not set 62# CONFIG_ARCH_INTEGRATOR is not set
64# CONFIG_ARCH_IOP3XX is not set 63# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/configs/spitz_defconfig b/arch/arm/configs/spitz_defconfig
index 18e9beaec465..d1ace3abfd8a 100644
--- a/arch/arm/configs/spitz_defconfig
+++ b/arch/arm/configs/spitz_defconfig
@@ -87,7 +87,6 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
87# CONFIG_ARCH_CLPS711X is not set 87# CONFIG_ARCH_CLPS711X is not set
88# CONFIG_ARCH_CO285 is not set 88# CONFIG_ARCH_CO285 is not set
89# CONFIG_ARCH_EBSA110 is not set 89# CONFIG_ARCH_EBSA110 is not set
90# CONFIG_ARCH_CAMELOT is not set
91# CONFIG_ARCH_FOOTBRIDGE is not set 90# CONFIG_ARCH_FOOTBRIDGE is not set
92# CONFIG_ARCH_INTEGRATOR is not set 91# CONFIG_ARCH_INTEGRATOR is not set
93# CONFIG_ARCH_IOP3XX is not set 92# CONFIG_ARCH_IOP3XX is not set
@@ -897,7 +896,24 @@ CONFIG_UNIX98_PTYS=y
897# 896#
898# I2C support 897# I2C support
899# 898#
900# CONFIG_I2C is not set 899CONFIG_I2C=y
900# CONFIG_I2C_CHARDEV is not set
901
902#
903# I2C Algorithms
904#
905# CONFIG_I2C_ALGOBIT is not set
906# CONFIG_I2C_ALGOPCF is not set
907# CONFIG_I2C_ALGOPCA is not set
908
909#
910# I2C Hardware Bus support
911#
912CONFIG_I2C_PXA=y
913# CONFIG_I2C_PXA_SLAVE is not set
914# CONFIG_I2C_PARPORT_LIGHT is not set
915# CONFIG_I2C_STUB is not set
916# CONFIG_I2C_PCA_ISA is not set
901 917
902# 918#
903# Hardware Monitoring support 919# Hardware Monitoring support
diff --git a/arch/arm/configs/versatile_defconfig b/arch/arm/configs/versatile_defconfig
index d72f2c754268..2687a225aa6a 100644
--- a/arch/arm/configs/versatile_defconfig
+++ b/arch/arm/configs/versatile_defconfig
@@ -64,7 +64,6 @@ CONFIG_KMOD=y
64# CONFIG_ARCH_CLPS711X is not set 64# CONFIG_ARCH_CLPS711X is not set
65# CONFIG_ARCH_CO285 is not set 65# CONFIG_ARCH_CO285 is not set
66# CONFIG_ARCH_EBSA110 is not set 66# CONFIG_ARCH_EBSA110 is not set
67# CONFIG_ARCH_CAMELOT is not set
68# CONFIG_ARCH_FOOTBRIDGE is not set 67# CONFIG_ARCH_FOOTBRIDGE is not set
69# CONFIG_ARCH_INTEGRATOR is not set 68# CONFIG_ARCH_INTEGRATOR is not set
70# CONFIG_ARCH_IOP3XX is not set 69# CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index c11169b5ed9a..2ce0e3a27a45 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -2,15 +2,16 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5AFLAGS_head.o := -DKERNEL_RAM_ADDR=$(TEXTADDR) 5AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
6 6
7# Object file lists. 7# Object file lists.
8 8
9obj-y := compat.o dma.o entry-armv.o entry-common.o irq.o \ 9obj-y := compat.o entry-armv.o entry-common.o irq.o \
10 process.o ptrace.o semaphore.o setup.o signal.o sys_arm.o \ 10 process.o ptrace.o semaphore.o setup.o signal.o sys_arm.o \
11 time.o traps.o 11 time.o traps.o
12 12
13obj-$(CONFIG_APM) += apm.o 13obj-$(CONFIG_APM) += apm.o
14obj-$(CONFIG_ISA_DMA_API) += dma.o
14obj-$(CONFIG_ARCH_ACORN) += ecard.o 15obj-$(CONFIG_ARCH_ACORN) += ecard.o
15obj-$(CONFIG_FOOTBRIDGE) += isa.o 16obj-$(CONFIG_FOOTBRIDGE) += isa.o
16obj-$(CONFIG_FIQ) += fiq.o 17obj-$(CONFIG_FIQ) += fiq.o
@@ -19,6 +20,7 @@ obj-$(CONFIG_ARTHUR) += arthur.o
19obj-$(CONFIG_ISA_DMA) += dma-isa.o 20obj-$(CONFIG_ISA_DMA) += dma-isa.o
20obj-$(CONFIG_PCI) += bios32.o 21obj-$(CONFIG_PCI) += bios32.o
21obj-$(CONFIG_SMP) += smp.o 22obj-$(CONFIG_SMP) += smp.o
23obj-$(CONFIG_OABI_COMPAT) += sys_oabi-compat.o
22 24
23obj-$(CONFIG_IWMMXT) += iwmmxt.o 25obj-$(CONFIG_IWMMXT) += iwmmxt.o
24AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt 26AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt
diff --git a/arch/arm/kernel/apm.c b/arch/arm/kernel/apm.c
index a2843be05557..766b6c05c6db 100644
--- a/arch/arm/kernel/apm.c
+++ b/arch/arm/kernel/apm.c
@@ -18,9 +18,9 @@
18#include <linux/proc_fs.h> 18#include <linux/proc_fs.h>
19#include <linux/miscdevice.h> 19#include <linux/miscdevice.h>
20#include <linux/apm_bios.h> 20#include <linux/apm_bios.h>
21#include <linux/capability.h>
21#include <linux/sched.h> 22#include <linux/sched.h>
22#include <linux/pm.h> 23#include <linux/pm.h>
23#include <linux/pm_legacy.h>
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/list.h> 26#include <linux/list.h>
@@ -81,6 +81,7 @@ struct apm_user {
81 */ 81 */
82static int suspends_pending; 82static int suspends_pending;
83static int apm_disabled; 83static int apm_disabled;
84static int arm_apm_active;
84 85
85static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue); 86static DECLARE_WAIT_QUEUE_HEAD(apm_waitqueue);
86static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue); 87static DECLARE_WAIT_QUEUE_HEAD(apm_suspend_waitqueue);
@@ -477,9 +478,9 @@ static int kapmd(void *arg)
477 apm_event_t event; 478 apm_event_t event;
478 479
479 wait_event_interruptible(kapmd_wait, 480 wait_event_interruptible(kapmd_wait,
480 !queue_empty(&kapmd_queue) || !pm_active); 481 !queue_empty(&kapmd_queue) || !arm_apm_active);
481 482
482 if (!pm_active) 483 if (!arm_apm_active)
483 break; 484 break;
484 485
485 spin_lock_irq(&kapmd_queue_lock); 486 spin_lock_irq(&kapmd_queue_lock);
@@ -522,16 +523,11 @@ static int __init apm_init(void)
522 return -ENODEV; 523 return -ENODEV;
523 } 524 }
524 525
525 if (PM_IS_ACTIVE()) { 526 arm_apm_active = 1;
526 printk(KERN_NOTICE "apm: overridden by ACPI.\n");
527 return -EINVAL;
528 }
529
530 pm_active = 1;
531 527
532 ret = kernel_thread(kapmd, NULL, CLONE_KERNEL); 528 ret = kernel_thread(kapmd, NULL, CLONE_KERNEL);
533 if (ret < 0) { 529 if (ret < 0) {
534 pm_active = 0; 530 arm_apm_active = 0;
535 return ret; 531 return ret;
536 } 532 }
537 533
@@ -543,7 +539,7 @@ static int __init apm_init(void)
543 if (ret != 0) { 539 if (ret != 0) {
544 remove_proc_entry("apm", NULL); 540 remove_proc_entry("apm", NULL);
545 541
546 pm_active = 0; 542 arm_apm_active = 0;
547 wake_up(&kapmd_wait); 543 wake_up(&kapmd_wait);
548 wait_for_completion(&kapmd_exit); 544 wait_for_completion(&kapmd_exit);
549 } 545 }
@@ -556,7 +552,7 @@ static void __exit apm_exit(void)
556 misc_deregister(&apm_device); 552 misc_deregister(&apm_device);
557 remove_proc_entry("apm", NULL); 553 remove_proc_entry("apm", NULL);
558 554
559 pm_active = 0; 555 arm_apm_active = 0;
560 wake_up(&kapmd_wait); 556 wake_up(&kapmd_wait);
561 wait_for_completion(&kapmd_exit); 557 wait_for_completion(&kapmd_exit);
562} 558}
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index 9997098009a9..1574941ebfe1 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -35,6 +35,16 @@ extern void __udivsi3(void);
35extern void __umodsi3(void); 35extern void __umodsi3(void);
36extern void __do_div64(void); 36extern void __do_div64(void);
37 37
38extern void __aeabi_idiv(void);
39extern void __aeabi_idivmod(void);
40extern void __aeabi_lasr(void);
41extern void __aeabi_llsl(void);
42extern void __aeabi_llsr(void);
43extern void __aeabi_lmul(void);
44extern void __aeabi_uidiv(void);
45extern void __aeabi_uidivmod(void);
46extern void __aeabi_ulcmp(void);
47
38extern void fpundefinstr(void); 48extern void fpundefinstr(void);
39extern void fp_enter(void); 49extern void fp_enter(void);
40 50
@@ -141,6 +151,18 @@ EXPORT_SYMBOL(__udivsi3);
141EXPORT_SYMBOL(__umodsi3); 151EXPORT_SYMBOL(__umodsi3);
142EXPORT_SYMBOL(__do_div64); 152EXPORT_SYMBOL(__do_div64);
143 153
154#ifdef CONFIG_AEABI
155EXPORT_SYMBOL(__aeabi_idiv);
156EXPORT_SYMBOL(__aeabi_idivmod);
157EXPORT_SYMBOL(__aeabi_lasr);
158EXPORT_SYMBOL(__aeabi_llsl);
159EXPORT_SYMBOL(__aeabi_llsr);
160EXPORT_SYMBOL(__aeabi_lmul);
161EXPORT_SYMBOL(__aeabi_uidiv);
162EXPORT_SYMBOL(__aeabi_uidivmod);
163EXPORT_SYMBOL(__aeabi_ulcmp);
164#endif
165
144 /* bitops */ 166 /* bitops */
145EXPORT_SYMBOL(_set_bit_le); 167EXPORT_SYMBOL(_set_bit_le);
146EXPORT_SYMBOL(_test_and_set_bit_le); 168EXPORT_SYMBOL(_test_and_set_bit_le);
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 04d3082a7b94..0abbce8c70bc 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -23,20 +23,15 @@
23#error Sorry, your compiler targets APCS-26 but this kernel requires APCS-32 23#error Sorry, your compiler targets APCS-26 but this kernel requires APCS-32
24#endif 24#endif
25/* 25/*
26 * GCC 2.95.1, 2.95.2: ignores register clobber list in asm().
27 * GCC 3.0, 3.1: general bad code generation. 26 * GCC 3.0, 3.1: general bad code generation.
28 * GCC 3.2.0: incorrect function argument offset calculation. 27 * GCC 3.2.0: incorrect function argument offset calculation.
29 * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c 28 * GCC 3.2.x: miscompiles NEW_AUX_ENT in fs/binfmt_elf.c
30 * (http://gcc.gnu.org/PR8896) and incorrect structure 29 * (http://gcc.gnu.org/PR8896) and incorrect structure
31 * initialisation in fs/jffs2/erase.c 30 * initialisation in fs/jffs2/erase.c
32 */ 31 */
33#if __GNUC__ < 2 || \ 32#if (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
34 (__GNUC__ == 2 && __GNUC_MINOR__ < 95) || \
35 (__GNUC__ == 2 && __GNUC_MINOR__ == 95 && __GNUC_PATCHLEVEL__ != 0 && \
36 __GNUC_PATCHLEVEL__ < 3) || \
37 (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
38#error Your compiler is too buggy; it is known to miscompile kernels. 33#error Your compiler is too buggy; it is known to miscompile kernels.
39#error Known good compilers: 2.95.3, 2.95.4, 2.96, 3.3 34#error Known good compilers: 3.3
40#endif 35#endif
41 36
42/* Use marker if you need to separate the values later */ 37/* Use marker if you need to separate the values later */
diff --git a/arch/arm/kernel/calls.S b/arch/arm/kernel/calls.S
index 2ad4aa2a1536..75e6f9a94713 100644
--- a/arch/arm/kernel/calls.S
+++ b/arch/arm/kernel/calls.S
@@ -13,7 +13,7 @@
13#define NR_syscalls 328 13#define NR_syscalls 328
14#else 14#else
15 15
16__syscall_start: 16100:
17/* 0 */ .long sys_restart_syscall 17/* 0 */ .long sys_restart_syscall
18 .long sys_exit 18 .long sys_exit
19 .long sys_fork_wrapper 19 .long sys_fork_wrapper
@@ -27,7 +27,7 @@ __syscall_start:
27/* 10 */ .long sys_unlink 27/* 10 */ .long sys_unlink
28 .long sys_execve_wrapper 28 .long sys_execve_wrapper
29 .long sys_chdir 29 .long sys_chdir
30 .long sys_time /* used by libc4 */ 30 .long OBSOLETE(sys_time) /* used by libc4 */
31 .long sys_mknod 31 .long sys_mknod
32/* 15 */ .long sys_chmod 32/* 15 */ .long sys_chmod
33 .long sys_lchown16 33 .long sys_lchown16
@@ -36,15 +36,15 @@ __syscall_start:
36 .long sys_lseek 36 .long sys_lseek
37/* 20 */ .long sys_getpid 37/* 20 */ .long sys_getpid
38 .long sys_mount 38 .long sys_mount
39 .long sys_oldumount /* used by libc4 */ 39 .long OBSOLETE(sys_oldumount) /* used by libc4 */
40 .long sys_setuid16 40 .long sys_setuid16
41 .long sys_getuid16 41 .long sys_getuid16
42/* 25 */ .long sys_stime 42/* 25 */ .long OBSOLETE(sys_stime)
43 .long sys_ptrace 43 .long sys_ptrace
44 .long sys_alarm /* used by libc4 */ 44 .long OBSOLETE(sys_alarm) /* used by libc4 */
45 .long sys_ni_syscall /* was sys_fstat */ 45 .long sys_ni_syscall /* was sys_fstat */
46 .long sys_pause 46 .long sys_pause
47/* 30 */ .long sys_utime /* used by libc4 */ 47/* 30 */ .long OBSOLETE(sys_utime) /* used by libc4 */
48 .long sys_ni_syscall /* was sys_stty */ 48 .long sys_ni_syscall /* was sys_stty */
49 .long sys_ni_syscall /* was sys_getty */ 49 .long sys_ni_syscall /* was sys_getty */
50 .long sys_access 50 .long sys_access
@@ -90,21 +90,21 @@ __syscall_start:
90 .long sys_sigpending 90 .long sys_sigpending
91 .long sys_sethostname 91 .long sys_sethostname
92/* 75 */ .long sys_setrlimit 92/* 75 */ .long sys_setrlimit
93 .long sys_old_getrlimit /* used by libc4 */ 93 .long OBSOLETE(sys_old_getrlimit) /* used by libc4 */
94 .long sys_getrusage 94 .long sys_getrusage
95 .long sys_gettimeofday 95 .long sys_gettimeofday
96 .long sys_settimeofday 96 .long sys_settimeofday
97/* 80 */ .long sys_getgroups16 97/* 80 */ .long sys_getgroups16
98 .long sys_setgroups16 98 .long sys_setgroups16
99 .long old_select /* used by libc4 */ 99 .long OBSOLETE(old_select) /* used by libc4 */
100 .long sys_symlink 100 .long sys_symlink
101 .long sys_ni_syscall /* was sys_lstat */ 101 .long sys_ni_syscall /* was sys_lstat */
102/* 85 */ .long sys_readlink 102/* 85 */ .long sys_readlink
103 .long sys_uselib 103 .long sys_uselib
104 .long sys_swapon 104 .long sys_swapon
105 .long sys_reboot 105 .long sys_reboot
106 .long old_readdir /* used by libc4 */ 106 .long OBSOLETE(old_readdir) /* used by libc4 */
107/* 90 */ .long old_mmap /* used by libc4 */ 107/* 90 */ .long OBSOLETE(old_mmap) /* used by libc4 */
108 .long sys_munmap 108 .long sys_munmap
109 .long sys_truncate 109 .long sys_truncate
110 .long sys_ftruncate 110 .long sys_ftruncate
@@ -116,7 +116,7 @@ __syscall_start:
116 .long sys_statfs 116 .long sys_statfs
117/* 100 */ .long sys_fstatfs 117/* 100 */ .long sys_fstatfs
118 .long sys_ni_syscall 118 .long sys_ni_syscall
119 .long sys_socketcall 119 .long OBSOLETE(sys_socketcall)
120 .long sys_syslog 120 .long sys_syslog
121 .long sys_setitimer 121 .long sys_setitimer
122/* 105 */ .long sys_getitimer 122/* 105 */ .long sys_getitimer
@@ -127,11 +127,11 @@ __syscall_start:
127/* 110 */ .long sys_ni_syscall /* was sys_iopl */ 127/* 110 */ .long sys_ni_syscall /* was sys_iopl */
128 .long sys_vhangup 128 .long sys_vhangup
129 .long sys_ni_syscall 129 .long sys_ni_syscall
130 .long sys_syscall /* call a syscall */ 130 .long OBSOLETE(sys_syscall) /* call a syscall */
131 .long sys_wait4 131 .long sys_wait4
132/* 115 */ .long sys_swapoff 132/* 115 */ .long sys_swapoff
133 .long sys_sysinfo 133 .long sys_sysinfo
134 .long sys_ipc_wrapper 134 .long OBSOLETE(ABI(sys_ipc, sys_oabi_ipc))
135 .long sys_fsync 135 .long sys_fsync
136 .long sys_sigreturn_wrapper 136 .long sys_sigreturn_wrapper
137/* 120 */ .long sys_clone_wrapper 137/* 120 */ .long sys_clone_wrapper
@@ -194,8 +194,8 @@ __syscall_start:
194 .long sys_rt_sigtimedwait 194 .long sys_rt_sigtimedwait
195 .long sys_rt_sigqueueinfo 195 .long sys_rt_sigqueueinfo
196 .long sys_rt_sigsuspend_wrapper 196 .long sys_rt_sigsuspend_wrapper
197/* 180 */ .long sys_pread64 197/* 180 */ .long ABI(sys_pread64, sys_oabi_pread64)
198 .long sys_pwrite64 198 .long ABI(sys_pwrite64, sys_oabi_pwrite64)
199 .long sys_chown16 199 .long sys_chown16
200 .long sys_getcwd 200 .long sys_getcwd
201 .long sys_capget 201 .long sys_capget
@@ -207,11 +207,11 @@ __syscall_start:
207/* 190 */ .long sys_vfork_wrapper 207/* 190 */ .long sys_vfork_wrapper
208 .long sys_getrlimit 208 .long sys_getrlimit
209 .long sys_mmap2 209 .long sys_mmap2
210 .long sys_truncate64 210 .long ABI(sys_truncate64, sys_oabi_truncate64)
211 .long sys_ftruncate64 211 .long ABI(sys_ftruncate64, sys_oabi_ftruncate64)
212/* 195 */ .long sys_stat64 212/* 195 */ .long ABI(sys_stat64, sys_oabi_stat64)
213 .long sys_lstat64 213 .long ABI(sys_lstat64, sys_oabi_lstat64)
214 .long sys_fstat64 214 .long ABI(sys_fstat64, sys_oabi_fstat64)
215 .long sys_lchown 215 .long sys_lchown
216 .long sys_getuid 216 .long sys_getuid
217/* 200 */ .long sys_getgid 217/* 200 */ .long sys_getgid
@@ -235,11 +235,11 @@ __syscall_start:
235 .long sys_pivot_root 235 .long sys_pivot_root
236 .long sys_mincore 236 .long sys_mincore
237/* 220 */ .long sys_madvise 237/* 220 */ .long sys_madvise
238 .long sys_fcntl64 238 .long ABI(sys_fcntl64, sys_oabi_fcntl64)
239 .long sys_ni_syscall /* TUX */ 239 .long sys_ni_syscall /* TUX */
240 .long sys_ni_syscall 240 .long sys_ni_syscall
241 .long sys_gettid 241 .long sys_gettid
242/* 225 */ .long sys_readahead 242/* 225 */ .long ABI(sys_readahead, sys_oabi_readahead)
243 .long sys_setxattr 243 .long sys_setxattr
244 .long sys_lsetxattr 244 .long sys_lsetxattr
245 .long sys_fsetxattr 245 .long sys_fsetxattr
@@ -254,7 +254,7 @@ __syscall_start:
254 .long sys_fremovexattr 254 .long sys_fremovexattr
255 .long sys_tkill 255 .long sys_tkill
256 .long sys_sendfile64 256 .long sys_sendfile64
257/* 240 */ .long sys_futex_wrapper 257/* 240 */ .long sys_futex
258 .long sys_sched_setaffinity 258 .long sys_sched_setaffinity
259 .long sys_sched_getaffinity 259 .long sys_sched_getaffinity
260 .long sys_io_setup 260 .long sys_io_setup
@@ -265,8 +265,8 @@ __syscall_start:
265 .long sys_exit_group 265 .long sys_exit_group
266 .long sys_lookup_dcookie 266 .long sys_lookup_dcookie
267/* 250 */ .long sys_epoll_create 267/* 250 */ .long sys_epoll_create
268 .long sys_epoll_ctl 268 .long ABI(sys_epoll_ctl, sys_oabi_epoll_ctl)
269 .long sys_epoll_wait 269 .long ABI(sys_epoll_wait, sys_oabi_epoll_wait)
270 .long sys_remap_file_pages 270 .long sys_remap_file_pages
271 .long sys_ni_syscall /* sys_set_thread_area */ 271 .long sys_ni_syscall /* sys_set_thread_area */
272/* 255 */ .long sys_ni_syscall /* sys_get_thread_area */ 272/* 255 */ .long sys_ni_syscall /* sys_get_thread_area */
@@ -280,11 +280,11 @@ __syscall_start:
280 .long sys_clock_gettime 280 .long sys_clock_gettime
281 .long sys_clock_getres 281 .long sys_clock_getres
282/* 265 */ .long sys_clock_nanosleep 282/* 265 */ .long sys_clock_nanosleep
283 .long sys_statfs64 283 .long sys_statfs64_wrapper
284 .long sys_fstatfs64 284 .long sys_fstatfs64_wrapper
285 .long sys_tgkill 285 .long sys_tgkill
286 .long sys_utimes 286 .long sys_utimes
287/* 270 */ .long sys_arm_fadvise64_64_wrapper 287/* 270 */ .long sys_arm_fadvise64_64
288 .long sys_pciconfig_iobase 288 .long sys_pciconfig_iobase
289 .long sys_pciconfig_read 289 .long sys_pciconfig_read
290 .long sys_pciconfig_write 290 .long sys_pciconfig_write
@@ -312,7 +312,7 @@ __syscall_start:
312/* 295 */ .long sys_getsockopt 312/* 295 */ .long sys_getsockopt
313 .long sys_sendmsg 313 .long sys_sendmsg
314 .long sys_recvmsg 314 .long sys_recvmsg
315 .long sys_semop 315 .long ABI(sys_semop, sys_oabi_semop)
316 .long sys_semget 316 .long sys_semget
317/* 300 */ .long sys_semctl 317/* 300 */ .long sys_semctl
318 .long sys_msgsnd 318 .long sys_msgsnd
@@ -326,19 +326,18 @@ __syscall_start:
326 .long sys_add_key 326 .long sys_add_key
327/* 310 */ .long sys_request_key 327/* 310 */ .long sys_request_key
328 .long sys_keyctl 328 .long sys_keyctl
329 .long sys_semtimedop 329 .long ABI(sys_semtimedop, sys_oabi_semtimedop)
330/* vserver */ .long sys_ni_syscall 330/* vserver */ .long sys_ni_syscall
331 .long sys_ioprio_set 331 .long sys_ioprio_set
332/* 315 */ .long sys_ioprio_get 332/* 315 */ .long sys_ioprio_get
333 .long sys_inotify_init 333 .long sys_inotify_init
334 .long sys_inotify_add_watch 334 .long sys_inotify_add_watch
335 .long sys_inotify_rm_watch 335 .long sys_inotify_rm_watch
336 .long sys_mbind_wrapper 336 .long sys_mbind
337/* 320 */ .long sys_get_mempolicy 337/* 320 */ .long sys_get_mempolicy
338 .long sys_set_mempolicy 338 .long sys_set_mempolicy
339__syscall_end:
340 339
341 .rept NR_syscalls - (__syscall_end - __syscall_start) / 4 340 .rept NR_syscalls - (. - 100b) / 4
342 .long sys_ni_syscall 341 .long sys_ni_syscall
343 .endr 342 .endr
344#endif 343#endif
diff --git a/arch/arm/kernel/dma-isa.c b/arch/arm/kernel/dma-isa.c
index e9a36304ec3e..03532769a97f 100644
--- a/arch/arm/kernel/dma-isa.c
+++ b/arch/arm/kernel/dma-isa.c
@@ -18,7 +18,7 @@
18 */ 18 */
19#include <linux/ioport.h> 19#include <linux/ioport.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/pci.h> 21#include <linux/dma-mapping.h>
22 22
23#include <asm/dma.h> 23#include <asm/dma.h>
24#include <asm/io.h> 24#include <asm/io.h>
@@ -65,37 +65,41 @@ static void isa_enable_dma(dmach_t channel, dma_t *dma)
65{ 65{
66 if (dma->invalid) { 66 if (dma->invalid) {
67 unsigned long address, length; 67 unsigned long address, length;
68 unsigned int mode, direction; 68 unsigned int mode;
69 enum dma_data_direction direction;
69 70
70 mode = channel & 3; 71 mode = channel & 3;
71 switch (dma->dma_mode & DMA_MODE_MASK) { 72 switch (dma->dma_mode & DMA_MODE_MASK) {
72 case DMA_MODE_READ: 73 case DMA_MODE_READ:
73 mode |= ISA_DMA_MODE_READ; 74 mode |= ISA_DMA_MODE_READ;
74 direction = PCI_DMA_FROMDEVICE; 75 direction = DMA_FROM_DEVICE;
75 break; 76 break;
76 77
77 case DMA_MODE_WRITE: 78 case DMA_MODE_WRITE:
78 mode |= ISA_DMA_MODE_WRITE; 79 mode |= ISA_DMA_MODE_WRITE;
79 direction = PCI_DMA_TODEVICE; 80 direction = DMA_TO_DEVICE;
80 break; 81 break;
81 82
82 case DMA_MODE_CASCADE: 83 case DMA_MODE_CASCADE:
83 mode |= ISA_DMA_MODE_CASCADE; 84 mode |= ISA_DMA_MODE_CASCADE;
84 direction = PCI_DMA_BIDIRECTIONAL; 85 direction = DMA_BIDIRECTIONAL;
85 break; 86 break;
86 87
87 default: 88 default:
88 direction = PCI_DMA_NONE; 89 direction = DMA_NONE;
89 break; 90 break;
90 } 91 }
91 92
92 if (!dma->using_sg) { 93 if (!dma->sg) {
93 /* 94 /*
94 * Cope with ISA-style drivers which expect cache 95 * Cope with ISA-style drivers which expect cache
95 * coherence. 96 * coherence.
96 */ 97 */
97 dma->buf.dma_address = pci_map_single(NULL, 98 dma->sg = &dma->buf;
98 dma->buf.__address, dma->buf.length, 99 dma->sgcount = 1;
100 dma->buf.length = dma->count;
101 dma->buf.dma_address = dma_map_single(NULL,
102 dma->addr, dma->count,
99 direction); 103 direction);
100 } 104 }
101 105
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c
index 2b7883884234..5a0f4bc5da95 100644
--- a/arch/arm/kernel/dma.c
+++ b/arch/arm/kernel/dma.c
@@ -12,8 +12,6 @@
12 * DMA facilities. 12 * DMA facilities.
13 */ 13 */
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/slab.h>
16#include <linux/mman.h>
17#include <linux/init.h> 15#include <linux/init.h>
18#include <linux/spinlock.h> 16#include <linux/spinlock.h>
19#include <linux/errno.h> 17#include <linux/errno.h>
@@ -23,8 +21,7 @@
23#include <asm/mach/dma.h> 21#include <asm/mach/dma.h>
24 22
25DEFINE_SPINLOCK(dma_spin_lock); 23DEFINE_SPINLOCK(dma_spin_lock);
26 24EXPORT_SYMBOL(dma_spin_lock);
27#if MAX_DMA_CHANNELS > 0
28 25
29static dma_t dma_chan[MAX_DMA_CHANNELS]; 26static dma_t dma_chan[MAX_DMA_CHANNELS];
30 27
@@ -81,6 +78,7 @@ bad_dma:
81busy: 78busy:
82 return -EBUSY; 79 return -EBUSY;
83} 80}
81EXPORT_SYMBOL(request_dma);
84 82
85/* 83/*
86 * Free DMA channel 84 * Free DMA channel
@@ -112,6 +110,7 @@ void free_dma(dmach_t channel)
112bad_dma: 110bad_dma:
113 printk(KERN_ERR "dma: trying to free DMA%d\n", channel); 111 printk(KERN_ERR "dma: trying to free DMA%d\n", channel);
114} 112}
113EXPORT_SYMBOL(free_dma);
115 114
116/* Set DMA Scatter-Gather list 115/* Set DMA Scatter-Gather list
117 */ 116 */
@@ -125,15 +124,15 @@ void set_dma_sg (dmach_t channel, struct scatterlist *sg, int nr_sg)
125 124
126 dma->sg = sg; 125 dma->sg = sg;
127 dma->sgcount = nr_sg; 126 dma->sgcount = nr_sg;
128 dma->using_sg = 1;
129 dma->invalid = 1; 127 dma->invalid = 1;
130} 128}
129EXPORT_SYMBOL(set_dma_sg);
131 130
132/* Set DMA address 131/* Set DMA address
133 * 132 *
134 * Copy address to the structure, and set the invalid bit 133 * Copy address to the structure, and set the invalid bit
135 */ 134 */
136void set_dma_addr (dmach_t channel, unsigned long physaddr) 135void __set_dma_addr (dmach_t channel, void *addr)
137{ 136{
138 dma_t *dma = dma_chan + channel; 137 dma_t *dma = dma_chan + channel;
139 138
@@ -141,12 +140,11 @@ void set_dma_addr (dmach_t channel, unsigned long physaddr)
141 printk(KERN_ERR "dma%d: altering DMA address while " 140 printk(KERN_ERR "dma%d: altering DMA address while "
142 "DMA active\n", channel); 141 "DMA active\n", channel);
143 142
144 dma->sg = &dma->buf; 143 dma->sg = NULL;
145 dma->sgcount = 1; 144 dma->addr = addr;
146 dma->buf.__address = bus_to_virt(physaddr);
147 dma->using_sg = 0;
148 dma->invalid = 1; 145 dma->invalid = 1;
149} 146}
147EXPORT_SYMBOL(__set_dma_addr);
150 148
151/* Set DMA byte count 149/* Set DMA byte count
152 * 150 *
@@ -160,12 +158,11 @@ void set_dma_count (dmach_t channel, unsigned long count)
160 printk(KERN_ERR "dma%d: altering DMA count while " 158 printk(KERN_ERR "dma%d: altering DMA count while "
161 "DMA active\n", channel); 159 "DMA active\n", channel);
162 160
163 dma->sg = &dma->buf; 161 dma->sg = NULL;
164 dma->sgcount = 1; 162 dma->count = count;
165 dma->buf.length = count;
166 dma->using_sg = 0;
167 dma->invalid = 1; 163 dma->invalid = 1;
168} 164}
165EXPORT_SYMBOL(set_dma_count);
169 166
170/* Set DMA direction mode 167/* Set DMA direction mode
171 */ 168 */
@@ -180,6 +177,7 @@ void set_dma_mode (dmach_t channel, dmamode_t mode)
180 dma->dma_mode = mode; 177 dma->dma_mode = mode;
181 dma->invalid = 1; 178 dma->invalid = 1;
182} 179}
180EXPORT_SYMBOL(set_dma_mode);
183 181
184/* Enable DMA channel 182/* Enable DMA channel
185 */ 183 */
@@ -200,6 +198,7 @@ free_dma:
200 printk(KERN_ERR "dma%d: trying to enable free DMA\n", channel); 198 printk(KERN_ERR "dma%d: trying to enable free DMA\n", channel);
201 BUG(); 199 BUG();
202} 200}
201EXPORT_SYMBOL(enable_dma);
203 202
204/* Disable DMA channel 203/* Disable DMA channel
205 */ 204 */
@@ -220,6 +219,7 @@ free_dma:
220 printk(KERN_ERR "dma%d: trying to disable free DMA\n", channel); 219 printk(KERN_ERR "dma%d: trying to disable free DMA\n", channel);
221 BUG(); 220 BUG();
222} 221}
222EXPORT_SYMBOL(disable_dma);
223 223
224/* 224/*
225 * Is the specified DMA channel active? 225 * Is the specified DMA channel active?
@@ -233,6 +233,7 @@ void set_dma_page(dmach_t channel, char pagenr)
233{ 233{
234 printk(KERN_ERR "dma%d: trying to set_dma_page\n", channel); 234 printk(KERN_ERR "dma%d: trying to set_dma_page\n", channel);
235} 235}
236EXPORT_SYMBOL(set_dma_page);
236 237
237void set_dma_speed(dmach_t channel, int cycle_ns) 238void set_dma_speed(dmach_t channel, int cycle_ns)
238{ 239{
@@ -243,6 +244,7 @@ void set_dma_speed(dmach_t channel, int cycle_ns)
243 ret = dma->d_ops->setspeed(channel, dma, cycle_ns); 244 ret = dma->d_ops->setspeed(channel, dma, cycle_ns);
244 dma->speed = ret; 245 dma->speed = ret;
245} 246}
247EXPORT_SYMBOL(set_dma_speed);
246 248
247int get_dma_residue(dmach_t channel) 249int get_dma_residue(dmach_t channel)
248{ 250{
@@ -254,49 +256,12 @@ int get_dma_residue(dmach_t channel)
254 256
255 return ret; 257 return ret;
256} 258}
259EXPORT_SYMBOL(get_dma_residue);
257 260
258void __init init_dma(void) 261static int __init init_dma(void)
259{ 262{
260 arch_dma_init(dma_chan); 263 arch_dma_init(dma_chan);
261}
262
263#else
264
265int request_dma(dmach_t channel, const char *device_id)
266{
267 return -EINVAL;
268}
269
270int get_dma_residue(dmach_t channel)
271{
272 return 0; 264 return 0;
273} 265}
274 266
275#define GLOBAL_ALIAS(_a,_b) asm (".set " #_a "," #_b "; .globl " #_a) 267core_initcall(init_dma);
276GLOBAL_ALIAS(disable_dma, get_dma_residue);
277GLOBAL_ALIAS(enable_dma, get_dma_residue);
278GLOBAL_ALIAS(free_dma, get_dma_residue);
279GLOBAL_ALIAS(get_dma_list, get_dma_residue);
280GLOBAL_ALIAS(set_dma_mode, get_dma_residue);
281GLOBAL_ALIAS(set_dma_page, get_dma_residue);
282GLOBAL_ALIAS(set_dma_count, get_dma_residue);
283GLOBAL_ALIAS(set_dma_addr, get_dma_residue);
284GLOBAL_ALIAS(set_dma_sg, get_dma_residue);
285GLOBAL_ALIAS(set_dma_speed, get_dma_residue);
286GLOBAL_ALIAS(init_dma, get_dma_residue);
287
288#endif
289
290EXPORT_SYMBOL(request_dma);
291EXPORT_SYMBOL(free_dma);
292EXPORT_SYMBOL(enable_dma);
293EXPORT_SYMBOL(disable_dma);
294EXPORT_SYMBOL(set_dma_addr);
295EXPORT_SYMBOL(set_dma_count);
296EXPORT_SYMBOL(set_dma_mode);
297EXPORT_SYMBOL(set_dma_page);
298EXPORT_SYMBOL(get_dma_residue);
299EXPORT_SYMBOL(set_dma_sg);
300EXPORT_SYMBOL(set_dma_speed);
301
302EXPORT_SYMBOL(dma_spin_lock);
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index dceb826bd216..74ea29c3205e 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -40,6 +40,7 @@
40#include <linux/proc_fs.h> 40#include <linux/proc_fs.h>
41#include <linux/device.h> 41#include <linux/device.h>
42#include <linux/init.h> 42#include <linux/init.h>
43#include <linux/mutex.h>
43 44
44#include <asm/dma.h> 45#include <asm/dma.h>
45#include <asm/ecard.h> 46#include <asm/ecard.h>
@@ -206,7 +207,7 @@ static void ecard_task_readbytes(struct ecard_request *req)
206 207
207static DECLARE_WAIT_QUEUE_HEAD(ecard_wait); 208static DECLARE_WAIT_QUEUE_HEAD(ecard_wait);
208static struct ecard_request *ecard_req; 209static struct ecard_request *ecard_req;
209static DECLARE_MUTEX(ecard_sem); 210static DEFINE_MUTEX(ecard_mutex);
210 211
211/* 212/*
212 * Set up the expansion card daemon's page tables. 213 * Set up the expansion card daemon's page tables.
@@ -299,7 +300,7 @@ static void ecard_call(struct ecard_request *req)
299 300
300 req->complete = &completion; 301 req->complete = &completion;
301 302
302 down(&ecard_sem); 303 mutex_lock(&ecard_mutex);
303 ecard_req = req; 304 ecard_req = req;
304 wake_up(&ecard_wait); 305 wake_up(&ecard_wait);
305 306
@@ -307,7 +308,7 @@ static void ecard_call(struct ecard_request *req)
307 * Now wait for kecardd to run. 308 * Now wait for kecardd to run.
308 */ 309 */
309 wait_for_completion(&completion); 310 wait_for_completion(&completion);
310 up(&ecard_sem); 311 mutex_unlock(&ecard_mutex);
311} 312}
312 313
313/* ======================= Mid-level card control ===================== */ 314/* ======================= Mid-level card control ===================== */
@@ -1146,9 +1147,11 @@ static void ecard_drv_shutdown(struct device *dev)
1146 struct ecard_driver *drv = ECARD_DRV(dev->driver); 1147 struct ecard_driver *drv = ECARD_DRV(dev->driver);
1147 struct ecard_request req; 1148 struct ecard_request req;
1148 1149
1149 if (drv->shutdown) 1150 if (dev->driver) {
1150 drv->shutdown(ec); 1151 if (drv->shutdown)
1151 ecard_release(ec); 1152 drv->shutdown(ec);
1153 ecard_release(ec);
1154 }
1152 1155
1153 /* 1156 /*
1154 * If this card has a loader, call the reset handler. 1157 * If this card has a loader, call the reset handler.
@@ -1163,9 +1166,6 @@ static void ecard_drv_shutdown(struct device *dev)
1163int ecard_register_driver(struct ecard_driver *drv) 1166int ecard_register_driver(struct ecard_driver *drv)
1164{ 1167{
1165 drv->drv.bus = &ecard_bus_type; 1168 drv->drv.bus = &ecard_bus_type;
1166 drv->drv.probe = ecard_drv_probe;
1167 drv->drv.remove = ecard_drv_remove;
1168 drv->drv.shutdown = ecard_drv_shutdown;
1169 1169
1170 return driver_register(&drv->drv); 1170 return driver_register(&drv->drv);
1171} 1171}
@@ -1194,6 +1194,9 @@ struct bus_type ecard_bus_type = {
1194 .name = "ecard", 1194 .name = "ecard",
1195 .dev_attrs = ecard_dev_attrs, 1195 .dev_attrs = ecard_dev_attrs,
1196 .match = ecard_match, 1196 .match = ecard_match,
1197 .probe = ecard_drv_probe,
1198 .remove = ecard_drv_remove,
1199 .shutdown = ecard_drv_shutdown,
1197}; 1200};
1198 1201
1199static int ecard_bus_init(void) 1202static int ecard_bus_init(void)
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index d9fb819bf7cc..d401d908c463 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (C) 1996,1997,1998 Russell King. 4 * Copyright (C) 1996,1997,1998 Russell King.
5 * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk) 5 * ARM700 fix by Matthew Godbolt (linux-user@willothewisp.demon.co.uk)
6 * nommu support by Hyok S. Choi (hyok.choi@samsung.com)
6 * 7 *
7 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
@@ -18,8 +19,6 @@
18#include <asm/memory.h> 19#include <asm/memory.h>
19#include <asm/glue.h> 20#include <asm/glue.h>
20#include <asm/vfpmacros.h> 21#include <asm/vfpmacros.h>
21#include <asm/hardware.h> /* should be moved into entry-macro.S */
22#include <asm/arch/irqs.h> /* should be moved into entry-macro.S */
23#include <asm/arch/entry-macro.S> 22#include <asm/arch/entry-macro.S>
24 23
25#include "entry-header.S" 24#include "entry-header.S"
@@ -106,14 +105,24 @@ common_invalid:
106/* 105/*
107 * SVC mode handlers 106 * SVC mode handlers
108 */ 107 */
108
109#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5)
110#define SPFIX(code...) code
111#else
112#define SPFIX(code...)
113#endif
114
109 .macro svc_entry 115 .macro svc_entry
110 sub sp, sp, #S_FRAME_SIZE 116 sub sp, sp, #S_FRAME_SIZE
117 SPFIX( tst sp, #4 )
118 SPFIX( bicne sp, sp, #4 )
111 stmib sp, {r1 - r12} 119 stmib sp, {r1 - r12}
112 120
113 ldmia r0, {r1 - r3} 121 ldmia r0, {r1 - r3}
114 add r5, sp, #S_SP @ here for interlock avoidance 122 add r5, sp, #S_SP @ here for interlock avoidance
115 mov r4, #-1 @ "" "" "" "" 123 mov r4, #-1 @ "" "" "" ""
116 add r0, sp, #S_FRAME_SIZE @ "" "" "" "" 124 add r0, sp, #S_FRAME_SIZE @ "" "" "" ""
125 SPFIX( addne r0, r0, #4 )
117 str r1, [sp] @ save the "real" r0 copied 126 str r1, [sp] @ save the "real" r0 copied
118 @ from the exception stack 127 @ from the exception stack
119 128
@@ -304,7 +313,14 @@ __pabt_svc:
304 313
305/* 314/*
306 * User mode handlers 315 * User mode handlers
316 *
317 * EABI note: sp_svc is always 64-bit aligned here, so should S_FRAME_SIZE
307 */ 318 */
319
320#if defined(CONFIG_AEABI) && (__LINUX_ARM_ARCH__ >= 5) && (S_FRAME_SIZE & 7)
321#error "sizeof(struct pt_regs) must be a multiple of 8"
322#endif
323
308 .macro usr_entry 324 .macro usr_entry
309 sub sp, sp, #S_FRAME_SIZE 325 sub sp, sp, #S_FRAME_SIZE
310 stmib sp, {r1 - r12} 326 stmib sp, {r1 - r12}
@@ -540,7 +556,11 @@ ENTRY(__switch_to)
540 add ip, r1, #TI_CPU_SAVE 556 add ip, r1, #TI_CPU_SAVE
541 ldr r3, [r2, #TI_TP_VALUE] 557 ldr r3, [r2, #TI_TP_VALUE]
542 stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack 558 stmia ip!, {r4 - sl, fp, sp, lr} @ Store most regs on stack
559#ifndef CONFIG_MMU
560 add r2, r2, #TI_CPU_DOMAIN
561#else
543 ldr r6, [r2, #TI_CPU_DOMAIN]! 562 ldr r6, [r2, #TI_CPU_DOMAIN]!
563#endif
544#if __LINUX_ARM_ARCH__ >= 6 564#if __LINUX_ARM_ARCH__ >= 6
545#ifdef CONFIG_CPU_MPCORE 565#ifdef CONFIG_CPU_MPCORE
546 clrex 566 clrex
@@ -558,7 +578,9 @@ ENTRY(__switch_to)
558 mov r4, #0xffff0fff 578 mov r4, #0xffff0fff
559 str r3, [r4, #-15] @ TLS val at 0xffff0ff0 579 str r3, [r4, #-15] @ TLS val at 0xffff0ff0
560#endif 580#endif
581#ifdef CONFIG_MMU
561 mcr p15, 0, r6, c3, c0, 0 @ Set domain register 582 mcr p15, 0, r6, c3, c0, 0 @ Set domain register
583#endif
562#ifdef CONFIG_VFP 584#ifdef CONFIG_VFP
563 @ Always disable VFP so we can lazily save/restore the old 585 @ Always disable VFP so we can lazily save/restore the old
564 @ state. This occurs in the context of the previous thread. 586 @ state. This occurs in the context of the previous thread.
@@ -614,6 +636,47 @@ __kuser_helper_start:
614/* 636/*
615 * Reference prototype: 637 * Reference prototype:
616 * 638 *
639 * void __kernel_memory_barrier(void)
640 *
641 * Input:
642 *
643 * lr = return address
644 *
645 * Output:
646 *
647 * none
648 *
649 * Clobbered:
650 *
651 * the Z flag might be lost
652 *
653 * Definition and user space usage example:
654 *
655 * typedef void (__kernel_dmb_t)(void);
656 * #define __kernel_dmb (*(__kernel_dmb_t *)0xffff0fa0)
657 *
658 * Apply any needed memory barrier to preserve consistency with data modified
659 * manually and __kuser_cmpxchg usage.
660 *
661 * This could be used as follows:
662 *
663 * #define __kernel_dmb() \
664 * asm volatile ( "mov r0, #0xffff0fff; mov lr, pc; sub pc, r0, #95" \
665 * : : : "lr","cc" )
666 */
667
668__kuser_memory_barrier: @ 0xffff0fa0
669
670#if __LINUX_ARM_ARCH__ >= 6 && defined(CONFIG_SMP)
671 mcr p15, 0, r0, c7, c10, 5 @ dmb
672#endif
673 mov pc, lr
674
675 .align 5
676
677/*
678 * Reference prototype:
679 *
617 * int __kernel_cmpxchg(int oldval, int newval, int *ptr) 680 * int __kernel_cmpxchg(int oldval, int newval, int *ptr)
618 * 681 *
619 * Input: 682 * Input:
@@ -642,6 +705,8 @@ __kuser_helper_start:
642 * The C flag is also set if *ptr was changed to allow for assembly 705 * The C flag is also set if *ptr was changed to allow for assembly
643 * optimization in the calling code. 706 * optimization in the calling code.
644 * 707 *
708 * Note: this routine already includes memory barriers as needed.
709 *
645 * For example, a user space atomic_add implementation could look like this: 710 * For example, a user space atomic_add implementation could look like this:
646 * 711 *
647 * #define atomic_add(ptr, val) \ 712 * #define atomic_add(ptr, val) \
@@ -670,8 +735,11 @@ __kuser_cmpxchg: @ 0xffff0fc0
670 * The kernel itself must perform the operation. 735 * The kernel itself must perform the operation.
671 * A special ghost syscall is used for that (see traps.c). 736 * A special ghost syscall is used for that (see traps.c).
672 */ 737 */
738 stmfd sp!, {r7, lr}
739 mov r7, #0xff00 @ 0xfff0 into r7 for EABI
740 orr r7, r7, #0xf0
673 swi #0x9ffff0 741 swi #0x9ffff0
674 mov pc, lr 742 ldmfd sp!, {r7, pc}
675 743
676#elif __LINUX_ARM_ARCH__ < 6 744#elif __LINUX_ARM_ARCH__ < 6
677 745
@@ -698,10 +766,16 @@ __kuser_cmpxchg: @ 0xffff0fc0
698 766
699#else 767#else
700 768
769#ifdef CONFIG_SMP
770 mcr p15, 0, r0, c7, c10, 5 @ dmb
771#endif
701 ldrex r3, [r2] 772 ldrex r3, [r2]
702 subs r3, r3, r0 773 subs r3, r3, r0
703 strexeq r3, r1, [r2] 774 strexeq r3, r1, [r2]
704 rsbs r0, r3, #0 775 rsbs r0, r3, #0
776#ifdef CONFIG_SMP
777 mcr p15, 0, r0, c7, c10, 5 @ dmb
778#endif
705 mov pc, lr 779 mov pc, lr
706 780
707#endif 781#endif
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index f7f183075237..2b92ce85f97f 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -98,20 +98,14 @@ ENTRY(ret_from_fork)
98 run on an ARM7 and we can save a couple of instructions. 98 run on an ARM7 and we can save a couple of instructions.
99 --pb */ 99 --pb */
100#ifdef CONFIG_CPU_ARM710 100#ifdef CONFIG_CPU_ARM710
101 .macro arm710_bug_check, instr, temp 101#define A710(code...) code
102 and \temp, \instr, #0x0f000000 @ check for SWI 102.Larm710bug:
103 teq \temp, #0x0f000000
104 bne .Larm700bug
105 .endm
106
107.Larm700bug:
108 ldmia sp, {r0 - lr}^ @ Get calling r0 - lr 103 ldmia sp, {r0 - lr}^ @ Get calling r0 - lr
109 mov r0, r0 104 mov r0, r0
110 add sp, sp, #S_FRAME_SIZE 105 add sp, sp, #S_FRAME_SIZE
111 subs pc, lr, #4 106 subs pc, lr, #4
112#else 107#else
113 .macro arm710_bug_check, instr, temp 108#define A710(code...)
114 .endm
115#endif 109#endif
116 110
117 .align 5 111 .align 5
@@ -129,14 +123,50 @@ ENTRY(vector_swi)
129 /* 123 /*
130 * Get the system call number. 124 * Get the system call number.
131 */ 125 */
126
127#if defined(CONFIG_OABI_COMPAT)
128
129 /*
130 * If we have CONFIG_OABI_COMPAT then we need to look at the swi
131 * value to determine if it is an EABI or an old ABI call.
132 */
132#ifdef CONFIG_ARM_THUMB 133#ifdef CONFIG_ARM_THUMB
134 tst r8, #PSR_T_BIT
135 movne r10, #0 @ no thumb OABI emulation
136 ldreq r10, [lr, #-4] @ get SWI instruction
137#else
138 ldr r10, [lr, #-4] @ get SWI instruction
139 A710( and ip, r10, #0x0f000000 @ check for SWI )
140 A710( teq ip, #0x0f000000 )
141 A710( bne .Larm710bug )
142#endif
143
144#elif defined(CONFIG_AEABI)
145
146 /*
147 * Pure EABI user space always put syscall number into scno (r7).
148 */
149 A710( ldr ip, [lr, #-4] @ get SWI instruction )
150 A710( and ip, ip, #0x0f000000 @ check for SWI )
151 A710( teq ip, #0x0f000000 )
152 A710( bne .Larm710bug )
153
154#elif defined(CONFIG_ARM_THUMB)
155
156 /* Legacy ABI only, possibly thumb mode. */
133 tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs 157 tst r8, #PSR_T_BIT @ this is SPSR from save_user_regs
134 addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in 158 addne scno, r7, #__NR_SYSCALL_BASE @ put OS number in
135 ldreq scno, [lr, #-4] 159 ldreq scno, [lr, #-4]
160
136#else 161#else
162
163 /* Legacy ABI only. */
137 ldr scno, [lr, #-4] @ get SWI instruction 164 ldr scno, [lr, #-4] @ get SWI instruction
165 A710( and ip, scno, #0x0f000000 @ check for SWI )
166 A710( teq ip, #0x0f000000 )
167 A710( bne .Larm710bug )
168
138#endif 169#endif
139 arm710_bug_check scno, ip
140 170
141#ifdef CONFIG_ALIGNMENT_TRAP 171#ifdef CONFIG_ALIGNMENT_TRAP
142 ldr ip, __cr_alignment 172 ldr ip, __cr_alignment
@@ -145,18 +175,31 @@ ENTRY(vector_swi)
145#endif 175#endif
146 enable_irq 176 enable_irq
147 177
148 str r4, [sp, #-S_OFF]! @ push fifth arg
149
150 get_thread_info tsk 178 get_thread_info tsk
179 adr tbl, sys_call_table @ load syscall table pointer
151 ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing 180 ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing
181
182#if defined(CONFIG_OABI_COMPAT)
183 /*
184 * If the swi argument is zero, this is an EABI call and we do nothing.
185 *
186 * If this is an old ABI call, get the syscall number into scno and
187 * get the old ABI syscall table address.
188 */
189 bics r10, r10, #0xff000000
190 eorne scno, r10, #__NR_OABI_SYSCALL_BASE
191 ldrne tbl, =sys_oabi_call_table
192#elif !defined(CONFIG_AEABI)
152 bic scno, scno, #0xff000000 @ mask off SWI op-code 193 bic scno, scno, #0xff000000 @ mask off SWI op-code
153 eor scno, scno, #__NR_SYSCALL_BASE @ check OS number 194 eor scno, scno, #__NR_SYSCALL_BASE @ check OS number
154 adr tbl, sys_call_table @ load syscall table pointer 195#endif
196
197 stmdb sp!, {r4, r5} @ push fifth and sixth args
155 tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls? 198 tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
156 bne __sys_trace 199 bne __sys_trace
157 200
158 adr lr, ret_fast_syscall @ return address
159 cmp scno, #NR_syscalls @ check upper syscall limit 201 cmp scno, #NR_syscalls @ check upper syscall limit
202 adr lr, ret_fast_syscall @ return address
160 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine 203 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
161 204
162 add r1, sp, #S_OFF 205 add r1, sp, #S_OFF
@@ -171,11 +214,13 @@ ENTRY(vector_swi)
171 * context switches, and waiting for our parent to respond. 214 * context switches, and waiting for our parent to respond.
172 */ 215 */
173__sys_trace: 216__sys_trace:
217 mov r2, scno
174 add r1, sp, #S_OFF 218 add r1, sp, #S_OFF
175 mov r0, #0 @ trace entry [IP = 0] 219 mov r0, #0 @ trace entry [IP = 0]
176 bl syscall_trace 220 bl syscall_trace
177 221
178 adr lr, __sys_trace_return @ return address 222 adr lr, __sys_trace_return @ return address
223 mov scno, r0 @ syscall number (possibly new)
179 add r1, sp, #S_R0 + S_OFF @ pointer to regs 224 add r1, sp, #S_R0 + S_OFF @ pointer to regs
180 cmp scno, #NR_syscalls @ check upper syscall limit 225 cmp scno, #NR_syscalls @ check upper syscall limit
181 ldmccia r1, {r0 - r3} @ have to reload r0 - r3 226 ldmccia r1, {r0 - r3} @ have to reload r0 - r3
@@ -184,6 +229,7 @@ __sys_trace:
184 229
185__sys_trace_return: 230__sys_trace_return:
186 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0 231 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
232 mov r2, scno
187 mov r1, sp 233 mov r1, sp
188 mov r0, #1 @ trace exit [IP = 1] 234 mov r0, #1 @ trace exit [IP = 1]
189 bl syscall_trace 235 bl syscall_trace
@@ -195,19 +241,33 @@ __sys_trace_return:
195__cr_alignment: 241__cr_alignment:
196 .word cr_alignment 242 .word cr_alignment
197#endif 243#endif
244 .ltorg
245
246/*
247 * This is the syscall table declaration for native ABI syscalls.
248 * With EABI a couple syscalls are obsolete and defined as sys_ni_syscall.
249 */
250#define ABI(native, compat) native
251#ifdef CONFIG_AEABI
252#define OBSOLETE(syscall) sys_ni_syscall
253#else
254#define OBSOLETE(syscall) syscall
255#endif
198 256
199 .type sys_call_table, #object 257 .type sys_call_table, #object
200ENTRY(sys_call_table) 258ENTRY(sys_call_table)
201#include "calls.S" 259#include "calls.S"
260#undef ABI
261#undef OBSOLETE
202 262
203/*============================================================================ 263/*============================================================================
204 * Special system call wrappers 264 * Special system call wrappers
205 */ 265 */
206@ r0 = syscall number 266@ r0 = syscall number
207@ r5 = syscall table 267@ r8 = syscall table
208 .type sys_syscall, #function 268 .type sys_syscall, #function
209sys_syscall: 269sys_syscall:
210 eor scno, r0, #__NR_SYSCALL_BASE 270 eor scno, r0, #__NR_OABI_SYSCALL_BASE
211 cmp scno, #__NR_syscall - __NR_SYSCALL_BASE 271 cmp scno, #__NR_syscall - __NR_SYSCALL_BASE
212 cmpne scno, #NR_syscalls @ check range 272 cmpne scno, #NR_syscalls @ check range
213 stmloia sp, {r5, r6} @ shuffle args 273 stmloia sp, {r5, r6} @ shuffle args
@@ -255,21 +315,15 @@ sys_sigaltstack_wrapper:
255 ldr r2, [sp, #S_OFF + S_SP] 315 ldr r2, [sp, #S_OFF + S_SP]
256 b do_sigaltstack 316 b do_sigaltstack
257 317
258sys_futex_wrapper: 318sys_statfs64_wrapper:
259 str r5, [sp, #4] @ push sixth arg 319 teq r1, #88
260 b sys_futex 320 moveq r1, #84
261 321 b sys_statfs64
262sys_arm_fadvise64_64_wrapper:
263 str r5, [sp, #4] @ push r5 to stack
264 b sys_arm_fadvise64_64
265 322
266sys_mbind_wrapper: 323sys_fstatfs64_wrapper:
267 str r5, [sp, #4] 324 teq r1, #88
268 b sys_mbind 325 moveq r1, #84
269 326 b sys_fstatfs64
270sys_ipc_wrapper:
271 str r5, [sp, #4] @ push sixth arg
272 b sys_ipc
273 327
274/* 328/*
275 * Note: off_4k (r5) is always units of 4K. If we can't do the requested 329 * Note: off_4k (r5) is always units of 4K. If we can't do the requested
@@ -287,3 +341,49 @@ sys_mmap2:
287 str r5, [sp, #4] 341 str r5, [sp, #4]
288 b do_mmap2 342 b do_mmap2
289#endif 343#endif
344
345#ifdef CONFIG_OABI_COMPAT
346
347/*
348 * These are syscalls with argument register differences
349 */
350
351sys_oabi_pread64:
352 stmia sp, {r3, r4}
353 b sys_pread64
354
355sys_oabi_pwrite64:
356 stmia sp, {r3, r4}
357 b sys_pwrite64
358
359sys_oabi_truncate64:
360 mov r3, r2
361 mov r2, r1
362 b sys_truncate64
363
364sys_oabi_ftruncate64:
365 mov r3, r2
366 mov r2, r1
367 b sys_ftruncate64
368
369sys_oabi_readahead:
370 str r3, [sp]
371 mov r3, r2
372 mov r2, r1
373 b sys_readahead
374
375/*
376 * Let's declare a second syscall table for old ABI binaries
377 * using the compatibility syscall entries.
378 */
379#define ABI(native, compat) compat
380#define OBSOLETE(syscall) syscall
381
382 .type sys_oabi_call_table, #object
383ENTRY(sys_oabi_call_table)
384#include "calls.S"
385#undef ABI
386#undef OBSOLETE
387
388#endif
389
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 648cfff93138..55c99cdab7d6 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -19,6 +19,7 @@
19@ 19@
20@ Most of the stack format comes from struct pt_regs, but with 20@ Most of the stack format comes from struct pt_regs, but with
21@ the addition of 8 bytes for storing syscall args 5 and 6. 21@ the addition of 8 bytes for storing syscall args 5 and 6.
22@ This _must_ remain a multiple of 8 for EABI.
22@ 23@
23#define S_OFF 8 24#define S_OFF 8
24 25
diff --git a/arch/arm/kernel/fiq.c b/arch/arm/kernel/fiq.c
index 9299dfc25698..1ec3f7faa259 100644
--- a/arch/arm/kernel/fiq.c
+++ b/arch/arm/kernel/fiq.c
@@ -101,7 +101,7 @@ void __attribute__((naked)) set_fiq_regs(struct pt_regs *regs)
101 ldmia %1, {r8 - r14}\n\ 101 ldmia %1, {r8 - r14}\n\
102 msr cpsr_c, %0 @ return to SVC mode\n\ 102 msr cpsr_c, %0 @ return to SVC mode\n\
103 mov r0, r0\n\ 103 mov r0, r0\n\
104 ldmea fp, {fp, sp, pc}" 104 ldmfd sp, {fp, sp, pc}"
105 : "=&r" (tmp) 105 : "=&r" (tmp)
106 : "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)); 106 : "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE));
107} 107}
@@ -119,7 +119,7 @@ void __attribute__((naked)) get_fiq_regs(struct pt_regs *regs)
119 stmia %1, {r8 - r14}\n\ 119 stmia %1, {r8 - r14}\n\
120 msr cpsr_c, %0 @ return to SVC mode\n\ 120 msr cpsr_c, %0 @ return to SVC mode\n\
121 mov r0, r0\n\ 121 mov r0, r0\n\
122 ldmea fp, {fp, sp, pc}" 122 ldmfd sp, {fp, sp, pc}"
123 : "=&r" (tmp) 123 : "=&r" (tmp)
124 : "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE)); 124 : "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | FIQ_MODE));
125} 125}
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index d7d69fd7039f..1aca1775b28f 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -33,6 +33,8 @@
33#define MACHINFO_PGOFFIO 12 33#define MACHINFO_PGOFFIO 12
34#define MACHINFO_NAME 16 34#define MACHINFO_NAME 16
35 35
36#define KERNEL_RAM_ADDR (PAGE_OFFSET + TEXT_OFFSET)
37
36/* 38/*
37 * swapper_pg_dir is the virtual address of the initial page table. 39 * swapper_pg_dir is the virtual address of the initial page table.
38 * We place the page tables 16K below KERNEL_RAM_ADDR. Therefore, we must 40 * We place the page tables 16K below KERNEL_RAM_ADDR. Therefore, we must
@@ -249,12 +251,11 @@ __turn_mmu_on:
249 * r10 = procinfo 251 * r10 = procinfo
250 * 252 *
251 * Returns: 253 * Returns:
252 * r0, r3, r5, r6, r7 corrupted 254 * r0, r3, r6, r7 corrupted
253 * r4 = physical page table address 255 * r4 = physical page table address
254 */ 256 */
255 .type __create_page_tables, %function 257 .type __create_page_tables, %function
256__create_page_tables: 258__create_page_tables:
257 ldr r5, [r8, #MACHINFO_PHYSRAM] @ physram
258 pgtbl r4 @ page table address 259 pgtbl r4 @ page table address
259 260
260 /* 261 /*
@@ -301,7 +302,7 @@ __create_page_tables:
301 * Then map first 1MB of ram in case it contains our boot params. 302 * Then map first 1MB of ram in case it contains our boot params.
302 */ 303 */
303 add r0, r4, #PAGE_OFFSET >> 18 304 add r0, r4, #PAGE_OFFSET >> 18
304 orr r6, r5, r7 305 orr r6, r7, #PHYS_OFFSET
305 str r6, [r0] 306 str r6, [r0]
306 307
307#ifdef CONFIG_XIP_KERNEL 308#ifdef CONFIG_XIP_KERNEL
@@ -309,7 +310,7 @@ __create_page_tables:
309 * Map some ram to cover our .data and .bss areas. 310 * Map some ram to cover our .data and .bss areas.
310 * Mapping 3MB should be plenty. 311 * Mapping 3MB should be plenty.
311 */ 312 */
312 sub r3, r4, r5 313 sub r3, r4, #PHYS_OFFSET
313 mov r3, r3, lsr #20 314 mov r3, r3, lsr #20
314 add r0, r0, r3, lsl #2 315 add r0, r0, r3, lsl #2
315 add r6, r6, r3, lsl #20 316 add r6, r6, r3, lsl #20
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index d7099dbbb879..1d50d2b98f55 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -684,8 +684,12 @@ int setup_irq(unsigned int irq, struct irqaction *new)
684 spin_lock_irqsave(&irq_controller_lock, flags); 684 spin_lock_irqsave(&irq_controller_lock, flags);
685 p = &desc->action; 685 p = &desc->action;
686 if ((old = *p) != NULL) { 686 if ((old = *p) != NULL) {
687 /* Can't share interrupts unless both agree to */ 687 /*
688 if (!(old->flags & new->flags & SA_SHIRQ)) { 688 * Can't share interrupts unless both agree to and are
689 * the same type.
690 */
691 if (!(old->flags & new->flags & SA_SHIRQ) ||
692 (~old->flags & new->flags) & SA_TRIGGER_MASK) {
689 spin_unlock_irqrestore(&irq_controller_lock, flags); 693 spin_unlock_irqrestore(&irq_controller_lock, flags);
690 return -EBUSY; 694 return -EBUSY;
691 } 695 }
@@ -705,6 +709,13 @@ int setup_irq(unsigned int irq, struct irqaction *new)
705 desc->running = 0; 709 desc->running = 0;
706 desc->pending = 0; 710 desc->pending = 0;
707 desc->disable_depth = 1; 711 desc->disable_depth = 1;
712
713 if (new->flags & SA_TRIGGER_MASK &&
714 desc->chip->set_type) {
715 unsigned int type = new->flags & SA_TRIGGER_MASK;
716 desc->chip->set_type(irq, type);
717 }
718
708 if (!desc->noautoenable) { 719 if (!desc->noautoenable) {
709 desc->disable_depth = 0; 720 desc->disable_depth = 0;
710 desc->chip->unmask(irq); 721 desc->chip->unmask(irq);
@@ -1027,7 +1038,6 @@ void __init init_irq_proc(void)
1027void __init init_IRQ(void) 1038void __init init_IRQ(void)
1028{ 1039{
1029 struct irqdesc *desc; 1040 struct irqdesc *desc;
1030 extern void init_dma(void);
1031 int irq; 1041 int irq;
1032 1042
1033#ifdef CONFIG_SMP 1043#ifdef CONFIG_SMP
@@ -1041,7 +1051,6 @@ void __init init_IRQ(void)
1041 } 1051 }
1042 1052
1043 init_arch_irq(); 1053 init_arch_irq();
1044 init_dma();
1045} 1054}
1046 1055
1047static int __init noirqdebug_setup(char *str) 1056static int __init noirqdebug_setup(char *str)
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index 6055e1427ba3..055bf5d28894 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -101,6 +101,8 @@ apply_relocate(Elf32_Shdr *sechdrs, const char *strtab, unsigned int symindex,
101 break; 101 break;
102 102
103 case R_ARM_PC24: 103 case R_ARM_PC24:
104 case R_ARM_CALL:
105 case R_ARM_JUMP24:
104 offset = (*(u32 *)loc & 0x00ffffff) << 2; 106 offset = (*(u32 *)loc & 0x00ffffff) << 2;
105 if (offset & 0x02000000) 107 if (offset & 0x02000000)
106 offset -= 0x04000000; 108 offset -= 0x04000000;
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 30494aab829a..4b4e4cf79c80 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -28,10 +28,9 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/cpu.h> 29#include <linux/cpu.h>
30 30
31#include <asm/system.h>
32#include <asm/io.h>
33#include <asm/leds.h> 31#include <asm/leds.h>
34#include <asm/processor.h> 32#include <asm/processor.h>
33#include <asm/system.h>
35#include <asm/uaccess.h> 34#include <asm/uaccess.h>
36#include <asm/mach/time.h> 35#include <asm/mach/time.h>
37 36
@@ -343,10 +342,10 @@ void flush_thread(void)
343void release_thread(struct task_struct *dead_task) 342void release_thread(struct task_struct *dead_task)
344{ 343{
345#if defined(CONFIG_VFP) 344#if defined(CONFIG_VFP)
346 vfp_release_thread(&dead_task->thread_info->vfpstate); 345 vfp_release_thread(&task_thread_info(dead_task)->vfpstate);
347#endif 346#endif
348#if defined(CONFIG_IWMMXT) 347#if defined(CONFIG_IWMMXT)
349 iwmmxt_task_release(dead_task->thread_info); 348 iwmmxt_task_release(task_thread_info(dead_task));
350#endif 349#endif
351} 350}
352 351
@@ -356,10 +355,9 @@ int
356copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start, 355copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start,
357 unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs) 356 unsigned long stk_sz, struct task_struct *p, struct pt_regs *regs)
358{ 357{
359 struct thread_info *thread = p->thread_info; 358 struct thread_info *thread = task_thread_info(p);
360 struct pt_regs *childregs; 359 struct pt_regs *childregs = task_pt_regs(p);
361 360
362 childregs = (void *)thread + THREAD_START_SP - sizeof(*regs);
363 *childregs = *regs; 361 *childregs = *regs;
364 childregs->ARM_r0 = 0; 362 childregs->ARM_r0 = 0;
365 childregs->ARM_sp = stack_start; 363 childregs->ARM_sp = stack_start;
@@ -461,8 +459,8 @@ unsigned long get_wchan(struct task_struct *p)
461 if (!p || p == current || p->state == TASK_RUNNING) 459 if (!p || p == current || p->state == TASK_RUNNING)
462 return 0; 460 return 0;
463 461
464 stack_start = (unsigned long)(p->thread_info + 1); 462 stack_start = (unsigned long)end_of_stack(p);
465 stack_end = ((unsigned long)p->thread_info) + THREAD_SIZE; 463 stack_end = (unsigned long)task_stack_page(p) + THREAD_SIZE;
466 464
467 fp = thread_saved_fp(p); 465 fp = thread_saved_fp(p);
468 do { 466 do {
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 9a340e790da5..7b6256bb590e 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -55,23 +55,6 @@
55#endif 55#endif
56 56
57/* 57/*
58 * Get the address of the live pt_regs for the specified task.
59 * These are saved onto the top kernel stack when the process
60 * is not running.
61 *
62 * Note: if a user thread is execve'd from kernel space, the
63 * kernel stack will not be empty on entry to the kernel, so
64 * ptracing these tasks will fail.
65 */
66static inline struct pt_regs *
67get_user_regs(struct task_struct *task)
68{
69 return (struct pt_regs *)
70 ((unsigned long)task->thread_info + THREAD_SIZE -
71 8 - sizeof(struct pt_regs));
72}
73
74/*
75 * this routine will get a word off of the processes privileged stack. 58 * this routine will get a word off of the processes privileged stack.
76 * the offset is how far from the base addr as stored in the THREAD. 59 * the offset is how far from the base addr as stored in the THREAD.
77 * this routine assumes that all the privileged stacks are in our 60 * this routine assumes that all the privileged stacks are in our
@@ -79,7 +62,7 @@ get_user_regs(struct task_struct *task)
79 */ 62 */
80static inline long get_user_reg(struct task_struct *task, int offset) 63static inline long get_user_reg(struct task_struct *task, int offset)
81{ 64{
82 return get_user_regs(task)->uregs[offset]; 65 return task_pt_regs(task)->uregs[offset];
83} 66}
84 67
85/* 68/*
@@ -91,7 +74,7 @@ static inline long get_user_reg(struct task_struct *task, int offset)
91static inline int 74static inline int
92put_user_reg(struct task_struct *task, int offset, long data) 75put_user_reg(struct task_struct *task, int offset, long data)
93{ 76{
94 struct pt_regs newregs, *regs = get_user_regs(task); 77 struct pt_regs newregs, *regs = task_pt_regs(task);
95 int ret = -EINVAL; 78 int ret = -EINVAL;
96 79
97 newregs = *regs; 80 newregs = *regs;
@@ -242,6 +225,15 @@ get_branch_address(struct task_struct *child, unsigned long pc, unsigned long in
242 */ 225 */
243 long aluop1, aluop2, ccbit; 226 long aluop1, aluop2, ccbit;
244 227
228 if ((insn & 0x0fffffd0) == 0x012fff10) {
229 /*
230 * bx or blx
231 */
232 alt = get_user_reg(child, insn & 15);
233 break;
234 }
235
236
245 if ((insn & 0xf000) != 0xf000) 237 if ((insn & 0xf000) != 0xf000)
246 break; 238 break;
247 239
@@ -412,7 +404,7 @@ void ptrace_set_bpt(struct task_struct *child)
412 u32 insn; 404 u32 insn;
413 int res; 405 int res;
414 406
415 regs = get_user_regs(child); 407 regs = task_pt_regs(child);
416 pc = instruction_pointer(regs); 408 pc = instruction_pointer(regs);
417 409
418 if (thumb_mode(regs)) { 410 if (thumb_mode(regs)) {
@@ -563,7 +555,7 @@ static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
563 */ 555 */
564static int ptrace_getregs(struct task_struct *tsk, void __user *uregs) 556static int ptrace_getregs(struct task_struct *tsk, void __user *uregs)
565{ 557{
566 struct pt_regs *regs = get_user_regs(tsk); 558 struct pt_regs *regs = task_pt_regs(tsk);
567 559
568 return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; 560 return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
569} 561}
@@ -578,7 +570,7 @@ static int ptrace_setregs(struct task_struct *tsk, void __user *uregs)
578 570
579 ret = -EFAULT; 571 ret = -EFAULT;
580 if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { 572 if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {
581 struct pt_regs *regs = get_user_regs(tsk); 573 struct pt_regs *regs = task_pt_regs(tsk);
582 574
583 ret = -EINVAL; 575 ret = -EINVAL;
584 if (valid_user_regs(&newregs)) { 576 if (valid_user_regs(&newregs)) {
@@ -595,7 +587,7 @@ static int ptrace_setregs(struct task_struct *tsk, void __user *uregs)
595 */ 587 */
596static int ptrace_getfpregs(struct task_struct *tsk, void __user *ufp) 588static int ptrace_getfpregs(struct task_struct *tsk, void __user *ufp)
597{ 589{
598 return copy_to_user(ufp, &tsk->thread_info->fpstate, 590 return copy_to_user(ufp, &task_thread_info(tsk)->fpstate,
599 sizeof(struct user_fp)) ? -EFAULT : 0; 591 sizeof(struct user_fp)) ? -EFAULT : 0;
600} 592}
601 593
@@ -604,7 +596,7 @@ static int ptrace_getfpregs(struct task_struct *tsk, void __user *ufp)
604 */ 596 */
605static int ptrace_setfpregs(struct task_struct *tsk, void __user *ufp) 597static int ptrace_setfpregs(struct task_struct *tsk, void __user *ufp)
606{ 598{
607 struct thread_info *thread = tsk->thread_info; 599 struct thread_info *thread = task_thread_info(tsk);
608 thread->used_cp[1] = thread->used_cp[2] = 1; 600 thread->used_cp[1] = thread->used_cp[2] = 1;
609 return copy_from_user(&thread->fpstate, ufp, 601 return copy_from_user(&thread->fpstate, ufp,
610 sizeof(struct user_fp)) ? -EFAULT : 0; 602 sizeof(struct user_fp)) ? -EFAULT : 0;
@@ -617,7 +609,7 @@ static int ptrace_setfpregs(struct task_struct *tsk, void __user *ufp)
617 */ 609 */
618static int ptrace_getwmmxregs(struct task_struct *tsk, void __user *ufp) 610static int ptrace_getwmmxregs(struct task_struct *tsk, void __user *ufp)
619{ 611{
620 struct thread_info *thread = tsk->thread_info; 612 struct thread_info *thread = task_thread_info(tsk);
621 void *ptr = &thread->fpstate; 613 void *ptr = &thread->fpstate;
622 614
623 if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT)) 615 if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT))
@@ -634,7 +626,7 @@ static int ptrace_getwmmxregs(struct task_struct *tsk, void __user *ufp)
634 */ 626 */
635static int ptrace_setwmmxregs(struct task_struct *tsk, void __user *ufp) 627static int ptrace_setwmmxregs(struct task_struct *tsk, void __user *ufp)
636{ 628{
637 struct thread_info *thread = tsk->thread_info; 629 struct thread_info *thread = task_thread_info(tsk);
638 void *ptr = &thread->fpstate; 630 void *ptr = &thread->fpstate;
639 631
640 if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT)) 632 if (!test_ti_thread_flag(thread, TIF_USING_IWMMXT))
@@ -770,10 +762,15 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
770#endif 762#endif
771 763
772 case PTRACE_GET_THREAD_AREA: 764 case PTRACE_GET_THREAD_AREA:
773 ret = put_user(child->thread_info->tp_value, 765 ret = put_user(task_thread_info(child)->tp_value,
774 (unsigned long __user *) data); 766 (unsigned long __user *) data);
775 break; 767 break;
776 768
769 case PTRACE_SET_SYSCALL:
770 ret = 0;
771 child->ptrace_message = data;
772 break;
773
777 default: 774 default:
778 ret = ptrace_request(child, request, addr, data); 775 ret = ptrace_request(child, request, addr, data);
779 break; 776 break;
@@ -782,14 +779,14 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
782 return ret; 779 return ret;
783} 780}
784 781
785asmlinkage void syscall_trace(int why, struct pt_regs *regs) 782asmlinkage int syscall_trace(int why, struct pt_regs *regs, int scno)
786{ 783{
787 unsigned long ip; 784 unsigned long ip;
788 785
789 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 786 if (!test_thread_flag(TIF_SYSCALL_TRACE))
790 return; 787 return scno;
791 if (!(current->ptrace & PT_PTRACED)) 788 if (!(current->ptrace & PT_PTRACED))
792 return; 789 return scno;
793 790
794 /* 791 /*
795 * Save IP. IP is used to denote syscall entry/exit: 792 * Save IP. IP is used to denote syscall entry/exit:
@@ -798,6 +795,8 @@ asmlinkage void syscall_trace(int why, struct pt_regs *regs)
798 ip = regs->ARM_ip; 795 ip = regs->ARM_ip;
799 regs->ARM_ip = why; 796 regs->ARM_ip = why;
800 797
798 current->ptrace_message = scno;
799
801 /* the 0x80 provides a way for the tracing parent to distinguish 800 /* the 0x80 provides a way for the tracing parent to distinguish
802 between a syscall stop and SIGTRAP delivery */ 801 between a syscall stop and SIGTRAP delivery */
803 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) 802 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
@@ -812,4 +811,6 @@ asmlinkage void syscall_trace(int why, struct pt_regs *regs)
812 current->exit_code = 0; 811 current->exit_code = 0;
813 } 812 }
814 regs->ARM_ip = ip; 813 regs->ARM_ip = ip;
814
815 return current->ptrace_message;
815} 816}
diff --git a/arch/arm/kernel/semaphore.c b/arch/arm/kernel/semaphore.c
index 4c31f2923055..981fe5c6ccbe 100644
--- a/arch/arm/kernel/semaphore.c
+++ b/arch/arm/kernel/semaphore.c
@@ -177,41 +177,42 @@ int __down_trylock(struct semaphore * sem)
177 * ip contains the semaphore pointer on entry. Save the C-clobbered 177 * ip contains the semaphore pointer on entry. Save the C-clobbered
178 * registers (r0 to r3 and lr), but not ip, as we use it as a return 178 * registers (r0 to r3 and lr), but not ip, as we use it as a return
179 * value in some cases.. 179 * value in some cases..
180 * To remain AAPCS compliant (64-bit stack align) we save r4 as well.
180 */ 181 */
181asm(" .section .sched.text,\"ax\",%progbits \n\ 182asm(" .section .sched.text,\"ax\",%progbits \n\
182 .align 5 \n\ 183 .align 5 \n\
183 .globl __down_failed \n\ 184 .globl __down_failed \n\
184__down_failed: \n\ 185__down_failed: \n\
185 stmfd sp!, {r0 - r3, lr} \n\ 186 stmfd sp!, {r0 - r4, lr} \n\
186 mov r0, ip \n\ 187 mov r0, ip \n\
187 bl __down \n\ 188 bl __down \n\
188 ldmfd sp!, {r0 - r3, pc} \n\ 189 ldmfd sp!, {r0 - r4, pc} \n\
189 \n\ 190 \n\
190 .align 5 \n\ 191 .align 5 \n\
191 .globl __down_interruptible_failed \n\ 192 .globl __down_interruptible_failed \n\
192__down_interruptible_failed: \n\ 193__down_interruptible_failed: \n\
193 stmfd sp!, {r0 - r3, lr} \n\ 194 stmfd sp!, {r0 - r4, lr} \n\
194 mov r0, ip \n\ 195 mov r0, ip \n\
195 bl __down_interruptible \n\ 196 bl __down_interruptible \n\
196 mov ip, r0 \n\ 197 mov ip, r0 \n\
197 ldmfd sp!, {r0 - r3, pc} \n\ 198 ldmfd sp!, {r0 - r4, pc} \n\
198 \n\ 199 \n\
199 .align 5 \n\ 200 .align 5 \n\
200 .globl __down_trylock_failed \n\ 201 .globl __down_trylock_failed \n\
201__down_trylock_failed: \n\ 202__down_trylock_failed: \n\
202 stmfd sp!, {r0 - r3, lr} \n\ 203 stmfd sp!, {r0 - r4, lr} \n\
203 mov r0, ip \n\ 204 mov r0, ip \n\
204 bl __down_trylock \n\ 205 bl __down_trylock \n\
205 mov ip, r0 \n\ 206 mov ip, r0 \n\
206 ldmfd sp!, {r0 - r3, pc} \n\ 207 ldmfd sp!, {r0 - r4, pc} \n\
207 \n\ 208 \n\
208 .align 5 \n\ 209 .align 5 \n\
209 .globl __up_wakeup \n\ 210 .globl __up_wakeup \n\
210__up_wakeup: \n\ 211__up_wakeup: \n\
211 stmfd sp!, {r0 - r3, lr} \n\ 212 stmfd sp!, {r0 - r4, lr} \n\
212 mov r0, ip \n\ 213 mov r0, ip \n\
213 bl __up \n\ 214 bl __up \n\
214 ldmfd sp!, {r0 - r3, pc} \n\ 215 ldmfd sp!, {r0 - r4, pc} \n\
215 "); 216 ");
216 217
217EXPORT_SYMBOL(__down_failed); 218EXPORT_SYMBOL(__down_failed);
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 85774165e9fd..c45d10d07bde 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -26,8 +26,6 @@
26 26
27#include <asm/cpu.h> 27#include <asm/cpu.h>
28#include <asm/elf.h> 28#include <asm/elf.h>
29#include <asm/hardware.h>
30#include <asm/io.h>
31#include <asm/procinfo.h> 29#include <asm/procinfo.h>
32#include <asm/setup.h> 30#include <asm/setup.h>
33#include <asm/mach-types.h> 31#include <asm/mach-types.h>
@@ -207,7 +205,7 @@ static const char *proc_arch[] = {
207 "5TE", 205 "5TE",
208 "5TEJ", 206 "5TEJ",
209 "6TEJ", 207 "6TEJ",
210 "?(10)", 208 "7",
211 "?(11)", 209 "?(11)",
212 "?(12)", 210 "?(12)",
213 "?(13)", 211 "?(13)",
@@ -260,14 +258,17 @@ int cpu_architecture(void)
260{ 258{
261 int cpu_arch; 259 int cpu_arch;
262 260
263 if ((processor_id & 0x0000f000) == 0) { 261 if ((processor_id & 0x0008f000) == 0) {
264 cpu_arch = CPU_ARCH_UNKNOWN; 262 cpu_arch = CPU_ARCH_UNKNOWN;
265 } else if ((processor_id & 0x0000f000) == 0x00007000) { 263 } else if ((processor_id & 0x0008f000) == 0x00007000) {
266 cpu_arch = (processor_id & (1 << 23)) ? CPU_ARCH_ARMv4T : CPU_ARCH_ARMv3; 264 cpu_arch = (processor_id & (1 << 23)) ? CPU_ARCH_ARMv4T : CPU_ARCH_ARMv3;
267 } else { 265 } else if ((processor_id & 0x00080000) == 0x00000000) {
268 cpu_arch = (processor_id >> 16) & 7; 266 cpu_arch = (processor_id >> 16) & 7;
269 if (cpu_arch) 267 if (cpu_arch)
270 cpu_arch += CPU_ARCH_ARMv3; 268 cpu_arch += CPU_ARCH_ARMv3;
269 } else {
270 /* the revised CPUID */
271 cpu_arch = ((processor_id >> 12) & 0xf) - 0xb + CPU_ARCH_ARMv6;
271 } 272 }
272 273
273 return cpu_arch; 274 return cpu_arch;
@@ -865,11 +866,11 @@ static int c_show(struct seq_file *m, void *v)
865 seq_printf(m, "\nCPU implementer\t: 0x%02x\n", processor_id >> 24); 866 seq_printf(m, "\nCPU implementer\t: 0x%02x\n", processor_id >> 24);
866 seq_printf(m, "CPU architecture: %s\n", proc_arch[cpu_architecture()]); 867 seq_printf(m, "CPU architecture: %s\n", proc_arch[cpu_architecture()]);
867 868
868 if ((processor_id & 0x0000f000) == 0x00000000) { 869 if ((processor_id & 0x0008f000) == 0x00000000) {
869 /* pre-ARM7 */ 870 /* pre-ARM7 */
870 seq_printf(m, "CPU part\t\t: %07x\n", processor_id >> 4); 871 seq_printf(m, "CPU part\t\t: %07x\n", processor_id >> 4);
871 } else { 872 } else {
872 if ((processor_id & 0x0000f000) == 0x00007000) { 873 if ((processor_id & 0x0008f000) == 0x00007000) {
873 /* ARM7 */ 874 /* ARM7 */
874 seq_printf(m, "CPU variant\t: 0x%02x\n", 875 seq_printf(m, "CPU variant\t: 0x%02x\n",
875 (processor_id >> 16) & 127); 876 (processor_id >> 16) & 127);
diff --git a/arch/arm/kernel/signal.c b/arch/arm/kernel/signal.c
index 765922bcf9e7..a0cd0a90a10d 100644
--- a/arch/arm/kernel/signal.c
+++ b/arch/arm/kernel/signal.c
@@ -30,15 +30,21 @@
30#define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn)) 30#define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn))
31 31
32/* 32/*
33 * With EABI, the syscall number has to be loaded into r7.
34 */
35#define MOV_R7_NR_SIGRETURN (0xe3a07000 | (__NR_sigreturn - __NR_SYSCALL_BASE))
36#define MOV_R7_NR_RT_SIGRETURN (0xe3a07000 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE))
37
38/*
33 * For Thumb syscalls, we pass the syscall number via r7. We therefore 39 * For Thumb syscalls, we pass the syscall number via r7. We therefore
34 * need two 16-bit instructions. 40 * need two 16-bit instructions.
35 */ 41 */
36#define SWI_THUMB_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_sigreturn - __NR_SYSCALL_BASE)) 42#define SWI_THUMB_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_sigreturn - __NR_SYSCALL_BASE))
37#define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE)) 43#define SWI_THUMB_RT_SIGRETURN (0xdf00 << 16 | 0x2700 | (__NR_rt_sigreturn - __NR_SYSCALL_BASE))
38 44
39const unsigned long sigreturn_codes[4] = { 45const unsigned long sigreturn_codes[7] = {
40 SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN, 46 MOV_R7_NR_SIGRETURN, SWI_SYS_SIGRETURN, SWI_THUMB_SIGRETURN,
41 SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN 47 MOV_R7_NR_RT_SIGRETURN, SWI_SYS_RT_SIGRETURN, SWI_THUMB_RT_SIGRETURN,
42}; 48};
43 49
44static int do_signal(sigset_t *oldset, struct pt_regs * regs, int syscall); 50static int do_signal(sigset_t *oldset, struct pt_regs * regs, int syscall);
@@ -189,7 +195,7 @@ struct aux_sigframe {
189struct sigframe { 195struct sigframe {
190 struct sigcontext sc; 196 struct sigcontext sc;
191 unsigned long extramask[_NSIG_WORDS-1]; 197 unsigned long extramask[_NSIG_WORDS-1];
192 unsigned long retcode; 198 unsigned long retcode[2];
193 struct aux_sigframe aux __attribute__((aligned(8))); 199 struct aux_sigframe aux __attribute__((aligned(8)));
194}; 200};
195 201
@@ -198,7 +204,7 @@ struct rt_sigframe {
198 void __user *puc; 204 void __user *puc;
199 struct siginfo info; 205 struct siginfo info;
200 struct ucontext uc; 206 struct ucontext uc;
201 unsigned long retcode; 207 unsigned long retcode[2];
202 struct aux_sigframe aux __attribute__((aligned(8))); 208 struct aux_sigframe aux __attribute__((aligned(8)));
203}; 209};
204 210
@@ -436,12 +442,13 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
436 if (ka->sa.sa_flags & SA_RESTORER) { 442 if (ka->sa.sa_flags & SA_RESTORER) {
437 retcode = (unsigned long)ka->sa.sa_restorer; 443 retcode = (unsigned long)ka->sa.sa_restorer;
438 } else { 444 } else {
439 unsigned int idx = thumb; 445 unsigned int idx = thumb << 1;
440 446
441 if (ka->sa.sa_flags & SA_SIGINFO) 447 if (ka->sa.sa_flags & SA_SIGINFO)
442 idx += 2; 448 idx += 3;
443 449
444 if (__put_user(sigreturn_codes[idx], rc)) 450 if (__put_user(sigreturn_codes[idx], rc) ||
451 __put_user(sigreturn_codes[idx+1], rc+1))
445 return 1; 452 return 1;
446 453
447 if (cpsr & MODE32_BIT) { 454 if (cpsr & MODE32_BIT) {
@@ -456,7 +463,7 @@ setup_return(struct pt_regs *regs, struct k_sigaction *ka,
456 * the return code written onto the stack. 463 * the return code written onto the stack.
457 */ 464 */
458 flush_icache_range((unsigned long)rc, 465 flush_icache_range((unsigned long)rc,
459 (unsigned long)(rc + 1)); 466 (unsigned long)(rc + 2));
460 467
461 retcode = ((unsigned long)rc) + thumb; 468 retcode = ((unsigned long)rc) + thumb;
462 } 469 }
@@ -488,7 +495,7 @@ setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *reg
488 } 495 }
489 496
490 if (err == 0) 497 if (err == 0)
491 err = setup_return(regs, ka, &frame->retcode, frame, usig); 498 err = setup_return(regs, ka, frame->retcode, frame, usig);
492 499
493 return err; 500 return err;
494} 501}
@@ -522,7 +529,7 @@ setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
522 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); 529 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
523 530
524 if (err == 0) 531 if (err == 0)
525 err = setup_return(regs, ka, &frame->retcode, frame, usig); 532 err = setup_return(regs, ka, frame->retcode, frame, usig);
526 533
527 if (err == 0) { 534 if (err == 0) {
528 /* 535 /*
diff --git a/arch/arm/kernel/signal.h b/arch/arm/kernel/signal.h
index 91d26faca62b..9991049c522d 100644
--- a/arch/arm/kernel/signal.h
+++ b/arch/arm/kernel/signal.h
@@ -9,4 +9,4 @@
9 */ 9 */
10#define KERN_SIGRETURN_CODE 0xffff0500 10#define KERN_SIGRETURN_CODE 0xffff0500
11 11
12extern const unsigned long sigreturn_codes[4]; 12extern const unsigned long sigreturn_codes[7];
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 373c0959bc2f..7338948bd7d3 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -114,7 +114,7 @@ int __cpuinit __cpu_up(unsigned int cpu)
114 * We need to tell the secondary core where to find 114 * We need to tell the secondary core where to find
115 * its stack and the page tables. 115 * its stack and the page tables.
116 */ 116 */
117 secondary_data.stack = (void *)idle->thread_info + THREAD_START_SP; 117 secondary_data.stack = task_stack_page(idle) + THREAD_START_SP;
118 secondary_data.pgdir = virt_to_phys(pgd); 118 secondary_data.pgdir = virt_to_phys(pgd);
119 wmb(); 119 wmb();
120 120
@@ -245,7 +245,7 @@ void __cpuexit cpu_die(void)
245 __asm__("mov sp, %0\n" 245 __asm__("mov sp, %0\n"
246 " b secondary_start_kernel" 246 " b secondary_start_kernel"
247 : 247 :
248 : "r" ((void *)current->thread_info + THREAD_SIZE - 8)); 248 : "r" (task_stack_page(current) + THREAD_SIZE - 8));
249} 249}
250#endif /* CONFIG_HOTPLUG_CPU */ 250#endif /* CONFIG_HOTPLUG_CPU */
251 251
diff --git a/arch/arm/kernel/sys_arm.c b/arch/arm/kernel/sys_arm.c
index ea569ba482b1..a491de2d9024 100644
--- a/arch/arm/kernel/sys_arm.c
+++ b/arch/arm/kernel/sys_arm.c
@@ -147,6 +147,7 @@ asmlinkage int old_select(struct sel_arg_struct __user *arg)
147 return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); 147 return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
148} 148}
149 149
150#if !defined(CONFIG_AEABI) || defined(CONFIG_OABI_COMPAT)
150/* 151/*
151 * sys_ipc() is the de-multiplexer for the SysV IPC calls.. 152 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
152 * 153 *
@@ -226,6 +227,7 @@ asmlinkage int sys_ipc(uint call, int first, int second, int third,
226 return -ENOSYS; 227 return -ENOSYS;
227 } 228 }
228} 229}
230#endif
229 231
230/* Fork a new task - this creates a new program thread. 232/* Fork a new task - this creates a new program thread.
231 * This is called indirectly via a small wrapper 233 * This is called indirectly via a small wrapper
diff --git a/arch/arm/kernel/sys_oabi-compat.c b/arch/arm/kernel/sys_oabi-compat.c
new file mode 100644
index 000000000000..eafa8e5284af
--- /dev/null
+++ b/arch/arm/kernel/sys_oabi-compat.c
@@ -0,0 +1,339 @@
1/*
2 * arch/arm/kernel/sys_oabi-compat.c
3 *
4 * Compatibility wrappers for syscalls that are used from
5 * old ABI user space binaries with an EABI kernel.
6 *
7 * Author: Nicolas Pitre
8 * Created: Oct 7, 2005
9 * Copyright: MontaVista Software, Inc.
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/*
17 * The legacy ABI and the new ARM EABI have different rules making some
18 * syscalls incompatible especially with structure arguments.
19 * Most notably, Eabi says 64-bit members should be 64-bit aligned instead of
20 * simply word aligned. EABI also pads structures to the size of the largest
21 * member it contains instead of the invariant 32-bit.
22 *
23 * The following syscalls are affected:
24 *
25 * sys_stat64:
26 * sys_lstat64:
27 * sys_fstat64:
28 *
29 * struct stat64 has different sizes and some members are shifted
30 * Compatibility wrappers are needed for them and provided below.
31 *
32 * sys_fcntl64:
33 *
34 * struct flock64 has different sizes and some members are shifted
35 * A compatibility wrapper is needed and provided below.
36 *
37 * sys_statfs64:
38 * sys_fstatfs64:
39 *
40 * struct statfs64 has extra padding with EABI growing its size from
41 * 84 to 88. This struct is now __attribute__((packed,aligned(4)))
42 * with a small assembly wrapper to force the sz argument to 84 if it is 88
43 * to avoid copying the extra padding over user space unexpecting it.
44 *
45 * sys_newuname:
46 *
47 * struct new_utsname has no padding with EABI. No problem there.
48 *
49 * sys_epoll_ctl:
50 * sys_epoll_wait:
51 *
52 * struct epoll_event has its second member shifted also affecting the
53 * structure size. Compatibility wrappers are needed and provided below.
54 *
55 * sys_ipc:
56 * sys_semop:
57 * sys_semtimedop:
58 *
59 * struct sembuf loses its padding with EABI. Since arrays of them are
60 * used they have to be copyed to remove the padding. Compatibility wrappers
61 * provided below.
62 */
63
64#include <linux/syscalls.h>
65#include <linux/errno.h>
66#include <linux/fs.h>
67#include <linux/fcntl.h>
68#include <linux/eventpoll.h>
69#include <linux/sem.h>
70#include <asm/ipc.h>
71#include <asm/uaccess.h>
72
73struct oldabi_stat64 {
74 unsigned long long st_dev;
75 unsigned int __pad1;
76 unsigned long __st_ino;
77 unsigned int st_mode;
78 unsigned int st_nlink;
79
80 unsigned long st_uid;
81 unsigned long st_gid;
82
83 unsigned long long st_rdev;
84 unsigned int __pad2;
85
86 long long st_size;
87 unsigned long st_blksize;
88 unsigned long long st_blocks;
89
90 unsigned long st_atime;
91 unsigned long st_atime_nsec;
92
93 unsigned long st_mtime;
94 unsigned long st_mtime_nsec;
95
96 unsigned long st_ctime;
97 unsigned long st_ctime_nsec;
98
99 unsigned long long st_ino;
100} __attribute__ ((packed,aligned(4)));
101
102static long cp_oldabi_stat64(struct kstat *stat,
103 struct oldabi_stat64 __user *statbuf)
104{
105 struct oldabi_stat64 tmp;
106
107 tmp.st_dev = huge_encode_dev(stat->dev);
108 tmp.__pad1 = 0;
109 tmp.__st_ino = stat->ino;
110 tmp.st_mode = stat->mode;
111 tmp.st_nlink = stat->nlink;
112 tmp.st_uid = stat->uid;
113 tmp.st_gid = stat->gid;
114 tmp.st_rdev = huge_encode_dev(stat->rdev);
115 tmp.st_size = stat->size;
116 tmp.st_blocks = stat->blocks;
117 tmp.__pad2 = 0;
118 tmp.st_blksize = stat->blksize;
119 tmp.st_atime = stat->atime.tv_sec;
120 tmp.st_atime_nsec = stat->atime.tv_nsec;
121 tmp.st_mtime = stat->mtime.tv_sec;
122 tmp.st_mtime_nsec = stat->mtime.tv_nsec;
123 tmp.st_ctime = stat->ctime.tv_sec;
124 tmp.st_ctime_nsec = stat->ctime.tv_nsec;
125 tmp.st_ino = stat->ino;
126 return copy_to_user(statbuf,&tmp,sizeof(tmp)) ? -EFAULT : 0;
127}
128
129asmlinkage long sys_oabi_stat64(char __user * filename,
130 struct oldabi_stat64 __user * statbuf)
131{
132 struct kstat stat;
133 int error = vfs_stat(filename, &stat);
134 if (!error)
135 error = cp_oldabi_stat64(&stat, statbuf);
136 return error;
137}
138
139asmlinkage long sys_oabi_lstat64(char __user * filename,
140 struct oldabi_stat64 __user * statbuf)
141{
142 struct kstat stat;
143 int error = vfs_lstat(filename, &stat);
144 if (!error)
145 error = cp_oldabi_stat64(&stat, statbuf);
146 return error;
147}
148
149asmlinkage long sys_oabi_fstat64(unsigned long fd,
150 struct oldabi_stat64 __user * statbuf)
151{
152 struct kstat stat;
153 int error = vfs_fstat(fd, &stat);
154 if (!error)
155 error = cp_oldabi_stat64(&stat, statbuf);
156 return error;
157}
158
159struct oabi_flock64 {
160 short l_type;
161 short l_whence;
162 loff_t l_start;
163 loff_t l_len;
164 pid_t l_pid;
165} __attribute__ ((packed,aligned(4)));
166
167asmlinkage long sys_oabi_fcntl64(unsigned int fd, unsigned int cmd,
168 unsigned long arg)
169{
170 struct oabi_flock64 user;
171 struct flock64 kernel;
172 mm_segment_t fs = USER_DS; /* initialized to kill a warning */
173 unsigned long local_arg = arg;
174 int ret;
175
176 switch (cmd) {
177 case F_GETLK64:
178 case F_SETLK64:
179 case F_SETLKW64:
180 if (copy_from_user(&user, (struct oabi_flock64 __user *)arg,
181 sizeof(user)))
182 return -EFAULT;
183 kernel.l_type = user.l_type;
184 kernel.l_whence = user.l_whence;
185 kernel.l_start = user.l_start;
186 kernel.l_len = user.l_len;
187 kernel.l_pid = user.l_pid;
188 local_arg = (unsigned long)&kernel;
189 fs = get_fs();
190 set_fs(KERNEL_DS);
191 }
192
193 ret = sys_fcntl64(fd, cmd, local_arg);
194
195 switch (cmd) {
196 case F_GETLK64:
197 if (!ret) {
198 user.l_type = kernel.l_type;
199 user.l_whence = kernel.l_whence;
200 user.l_start = kernel.l_start;
201 user.l_len = kernel.l_len;
202 user.l_pid = kernel.l_pid;
203 if (copy_to_user((struct oabi_flock64 __user *)arg,
204 &user, sizeof(user)))
205 ret = -EFAULT;
206 }
207 case F_SETLK64:
208 case F_SETLKW64:
209 set_fs(fs);
210 }
211
212 return ret;
213}
214
215struct oabi_epoll_event {
216 __u32 events;
217 __u64 data;
218} __attribute__ ((packed,aligned(4)));
219
220asmlinkage long sys_oabi_epoll_ctl(int epfd, int op, int fd,
221 struct oabi_epoll_event __user *event)
222{
223 struct oabi_epoll_event user;
224 struct epoll_event kernel;
225 mm_segment_t fs;
226 long ret;
227
228 if (op == EPOLL_CTL_DEL)
229 return sys_epoll_ctl(epfd, op, fd, NULL);
230 if (copy_from_user(&user, event, sizeof(user)))
231 return -EFAULT;
232 kernel.events = user.events;
233 kernel.data = user.data;
234 fs = get_fs();
235 set_fs(KERNEL_DS);
236 ret = sys_epoll_ctl(epfd, op, fd, &kernel);
237 set_fs(fs);
238 return ret;
239}
240
241asmlinkage long sys_oabi_epoll_wait(int epfd,
242 struct oabi_epoll_event __user *events,
243 int maxevents, int timeout)
244{
245 struct epoll_event *kbuf;
246 mm_segment_t fs;
247 long ret, err, i;
248
249 if (maxevents <= 0 || maxevents > (INT_MAX/sizeof(struct epoll_event)))
250 return -EINVAL;
251 kbuf = kmalloc(sizeof(*kbuf) * maxevents, GFP_KERNEL);
252 if (!kbuf)
253 return -ENOMEM;
254 fs = get_fs();
255 set_fs(KERNEL_DS);
256 ret = sys_epoll_wait(epfd, kbuf, maxevents, timeout);
257 set_fs(fs);
258 err = 0;
259 for (i = 0; i < ret; i++) {
260 __put_user_error(kbuf[i].events, &events->events, err);
261 __put_user_error(kbuf[i].data, &events->data, err);
262 events++;
263 }
264 kfree(kbuf);
265 return err ? -EFAULT : ret;
266}
267
268struct oabi_sembuf {
269 unsigned short sem_num;
270 short sem_op;
271 short sem_flg;
272 unsigned short __pad;
273};
274
275asmlinkage long sys_oabi_semtimedop(int semid,
276 struct oabi_sembuf __user *tsops,
277 unsigned nsops,
278 const struct timespec __user *timeout)
279{
280 struct sembuf *sops;
281 struct timespec local_timeout;
282 long err;
283 int i;
284
285 if (nsops < 1)
286 return -EINVAL;
287 sops = kmalloc(sizeof(*sops) * nsops, GFP_KERNEL);
288 if (!sops)
289 return -ENOMEM;
290 err = 0;
291 for (i = 0; i < nsops; i++) {
292 __get_user_error(sops[i].sem_num, &tsops->sem_num, err);
293 __get_user_error(sops[i].sem_op, &tsops->sem_op, err);
294 __get_user_error(sops[i].sem_flg, &tsops->sem_flg, err);
295 tsops++;
296 }
297 if (timeout) {
298 /* copy this as well before changing domain protection */
299 err |= copy_from_user(&local_timeout, timeout, sizeof(*timeout));
300 timeout = &local_timeout;
301 }
302 if (err) {
303 err = -EFAULT;
304 } else {
305 mm_segment_t fs = get_fs();
306 set_fs(KERNEL_DS);
307 err = sys_semtimedop(semid, sops, nsops, timeout);
308 set_fs(fs);
309 }
310 kfree(sops);
311 return err;
312}
313
314asmlinkage long sys_oabi_semop(int semid, struct oabi_sembuf __user *tsops,
315 unsigned nsops)
316{
317 return sys_oabi_semtimedop(semid, tsops, nsops, NULL);
318}
319
320extern asmlinkage int sys_ipc(uint call, int first, int second, int third,
321 void __user *ptr, long fifth);
322
323asmlinkage int sys_oabi_ipc(uint call, int first, int second, int third,
324 void __user *ptr, long fifth)
325{
326 switch (call & 0xffff) {
327 case SEMOP:
328 return sys_oabi_semtimedop(first,
329 (struct oabi_sembuf __user *)ptr,
330 second, NULL);
331 case SEMTIMEDOP:
332 return sys_oabi_semtimedop(first,
333 (struct oabi_sembuf __user *)ptr,
334 second,
335 (const struct timespec __user *)fifth);
336 default:
337 return sys_ipc(call, first, second, third, ptr, fifth);
338 }
339}
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index fc4729106a32..d7d932c02866 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -29,9 +29,6 @@
29#include <linux/sysdev.h> 29#include <linux/sysdev.h>
30#include <linux/timer.h> 30#include <linux/timer.h>
31 31
32#include <asm/hardware.h>
33#include <asm/io.h>
34#include <asm/irq.h>
35#include <asm/leds.h> 32#include <asm/leds.h>
36#include <asm/thread_info.h> 33#include <asm/thread_info.h>
37#include <asm/mach/time.h> 34#include <asm/mach/time.h>
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 45e9ea6cd2a5..10235b01582e 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -23,7 +23,6 @@
23 23
24#include <asm/atomic.h> 24#include <asm/atomic.h>
25#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
26#include <asm/io.h>
27#include <asm/system.h> 26#include <asm/system.h>
28#include <asm/uaccess.h> 27#include <asm/uaccess.h>
29#include <asm/unistd.h> 28#include <asm/unistd.h>
@@ -165,7 +164,7 @@ static void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
165 } else if (verify_stack(fp)) { 164 } else if (verify_stack(fp)) {
166 printk("invalid frame pointer 0x%08x", fp); 165 printk("invalid frame pointer 0x%08x", fp);
167 ok = 0; 166 ok = 0;
168 } else if (fp < (unsigned long)(tsk->thread_info + 1)) 167 } else if (fp < (unsigned long)end_of_stack(tsk))
169 printk("frame pointer underflow"); 168 printk("frame pointer underflow");
170 printk("\n"); 169 printk("\n");
171 170
@@ -211,7 +210,7 @@ static void __die(const char *str, int err, struct thread_info *thread, struct p
211 210
212 if (!user_mode(regs) || in_interrupt()) { 211 if (!user_mode(regs) || in_interrupt()) {
213 dump_mem("Stack: ", regs->ARM_sp, 212 dump_mem("Stack: ", regs->ARM_sp,
214 THREAD_SIZE + (unsigned long)tsk->thread_info); 213 THREAD_SIZE + (unsigned long)task_stack_page(tsk));
215 dump_backtrace(regs, tsk); 214 dump_backtrace(regs, tsk);
216 dump_instr(regs); 215 dump_instr(regs);
217 } 216 }
@@ -405,7 +404,7 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
405 struct thread_info *thread = current_thread_info(); 404 struct thread_info *thread = current_thread_info();
406 siginfo_t info; 405 siginfo_t info;
407 406
408 if ((no >> 16) != 0x9f) 407 if ((no >> 16) != (__ARM_NR_BASE>> 16))
409 return bad_syscall(no, regs); 408 return bad_syscall(no, regs);
410 409
411 switch (no & 0xffff) { 410 switch (no & 0xffff) {
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index 9a47770114d4..2b254e88595c 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -17,15 +17,13 @@ jiffies = jiffies_64;
17jiffies = jiffies_64 + 4; 17jiffies = jiffies_64 + 4;
18#endif 18#endif
19 19
20SECTIONS
21{
20#ifdef CONFIG_XIP_KERNEL 22#ifdef CONFIG_XIP_KERNEL
21#define TEXTADDR XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) 23 . = XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR);
22#else 24#else
23#define TEXTADDR KERNEL_RAM_ADDR 25 . = PAGE_OFFSET + TEXT_OFFSET;
24#endif 26#endif
25
26SECTIONS
27{
28 . = TEXTADDR;
29 .init : { /* Init code and data */ 27 .init : { /* Init code and data */
30 _stext = .; 28 _stext = .;
31 _sinittext = .; 29 _sinittext = .;
@@ -104,7 +102,7 @@ SECTIONS
104 102
105#ifdef CONFIG_XIP_KERNEL 103#ifdef CONFIG_XIP_KERNEL
106 __data_loc = ALIGN(4); /* location in binary */ 104 __data_loc = ALIGN(4); /* location in binary */
107 . = KERNEL_RAM_ADDR; 105 . = PAGE_OFFSET + TEXT_OFFSET;
108#else 106#else
109 . = ALIGN(THREAD_SIZE); 107 . = ALIGN(THREAD_SIZE);
110 __data_loc = .; 108 __data_loc = .;
diff --git a/arch/arm/lib/ashldi3.S b/arch/arm/lib/ashldi3.S
index 561e20717b30..55e57a1c2e6d 100644
--- a/arch/arm/lib/ashldi3.S
+++ b/arch/arm/lib/ashldi3.S
@@ -37,6 +37,7 @@ Boston, MA 02110-1301, USA. */
37#endif 37#endif
38 38
39ENTRY(__ashldi3) 39ENTRY(__ashldi3)
40ENTRY(__aeabi_llsl)
40 41
41 subs r3, r2, #32 42 subs r3, r2, #32
42 rsb ip, r2, #32 43 rsb ip, r2, #32
diff --git a/arch/arm/lib/ashrdi3.S b/arch/arm/lib/ashrdi3.S
index 86fb2a90c301..0b31398f89b2 100644
--- a/arch/arm/lib/ashrdi3.S
+++ b/arch/arm/lib/ashrdi3.S
@@ -37,6 +37,7 @@ Boston, MA 02110-1301, USA. */
37#endif 37#endif
38 38
39ENTRY(__ashrdi3) 39ENTRY(__ashrdi3)
40ENTRY(__aeabi_lasr)
40 41
41 subs r3, r2, #32 42 subs r3, r2, #32
42 rsb ip, r2, #32 43 rsb ip, r2, #32
diff --git a/arch/arm/lib/csumpartialcopy.S b/arch/arm/lib/csumpartialcopy.S
index 990ee63b2465..21effe0dbf97 100644
--- a/arch/arm/lib/csumpartialcopy.S
+++ b/arch/arm/lib/csumpartialcopy.S
@@ -18,11 +18,13 @@
18 */ 18 */
19 19
20 .macro save_regs 20 .macro save_regs
21 mov ip, sp
21 stmfd sp!, {r1, r4 - r8, fp, ip, lr, pc} 22 stmfd sp!, {r1, r4 - r8, fp, ip, lr, pc}
23 sub fp, ip, #4
22 .endm 24 .endm
23 25
24 .macro load_regs,flags 26 .macro load_regs
25 LOADREGS(\flags,fp,{r1, r4 - r8, fp, sp, pc}) 27 ldmfd sp, {r1, r4 - r8, fp, sp, pc}
26 .endm 28 .endm
27 29
28 .macro load1b, reg1 30 .macro load1b, reg1
diff --git a/arch/arm/lib/csumpartialcopygeneric.S b/arch/arm/lib/csumpartialcopygeneric.S
index 4a4609c19095..c50e8f5285d1 100644
--- a/arch/arm/lib/csumpartialcopygeneric.S
+++ b/arch/arm/lib/csumpartialcopygeneric.S
@@ -23,7 +23,7 @@ len .req r2
23sum .req r3 23sum .req r3
24 24
25.Lzero: mov r0, sum 25.Lzero: mov r0, sum
26 load_regs ea 26 load_regs
27 27
28 /* 28 /*
29 * Align an unaligned destination pointer. We know that 29 * Align an unaligned destination pointer. We know that
@@ -87,9 +87,7 @@ sum .req r3
87 b .Ldone 87 b .Ldone
88 88
89FN_ENTRY 89FN_ENTRY
90 mov ip, sp
91 save_regs 90 save_regs
92 sub fp, ip, #4
93 91
94 cmp len, #8 @ Ensure that we have at least 92 cmp len, #8 @ Ensure that we have at least
95 blo .Lless8 @ 8 bytes to copy. 93 blo .Lless8 @ 8 bytes to copy.
@@ -163,7 +161,7 @@ FN_ENTRY
163 ldr sum, [sp, #0] @ dst 161 ldr sum, [sp, #0] @ dst
164 tst sum, #1 162 tst sum, #1
165 movne r0, r0, ror #8 163 movne r0, r0, ror #8
166 load_regs ea 164 load_regs
167 165
168.Lsrc_not_aligned: 166.Lsrc_not_aligned:
169 adc sum, sum, #0 @ include C from dst alignment 167 adc sum, sum, #0 @ include C from dst alignment
diff --git a/arch/arm/lib/csumpartialcopyuser.S b/arch/arm/lib/csumpartialcopyuser.S
index 333bca292de9..c3b93e22ea25 100644
--- a/arch/arm/lib/csumpartialcopyuser.S
+++ b/arch/arm/lib/csumpartialcopyuser.S
@@ -18,11 +18,13 @@
18 .text 18 .text
19 19
20 .macro save_regs 20 .macro save_regs
21 mov ip, sp
21 stmfd sp!, {r1 - r2, r4 - r8, fp, ip, lr, pc} 22 stmfd sp!, {r1 - r2, r4 - r8, fp, ip, lr, pc}
23 sub fp, ip, #4
22 .endm 24 .endm
23 25
24 .macro load_regs,flags 26 .macro load_regs
25 ldm\flags fp, {r1, r2, r4-r8, fp, sp, pc} 27 ldmfd sp, {r1, r2, r4-r8, fp, sp, pc}
26 .endm 28 .endm
27 29
28 .macro load1b, reg1 30 .macro load1b, reg1
@@ -100,5 +102,5 @@
1006002: teq r2, r1 1026002: teq r2, r1
101 strneb r0, [r1], #1 103 strneb r0, [r1], #1
102 bne 6002b 104 bne 6002b
103 load_regs ea 105 load_regs
104 .previous 106 .previous
diff --git a/arch/arm/lib/lib1funcs.S b/arch/arm/lib/lib1funcs.S
index 59026029d017..4e492f4b3f0e 100644
--- a/arch/arm/lib/lib1funcs.S
+++ b/arch/arm/lib/lib1funcs.S
@@ -206,6 +206,7 @@ Boston, MA 02111-1307, USA. */
206 206
207 207
208ENTRY(__udivsi3) 208ENTRY(__udivsi3)
209ENTRY(__aeabi_uidiv)
209 210
210 subs r2, r1, #1 211 subs r2, r1, #1
211 moveq pc, lr 212 moveq pc, lr
@@ -246,6 +247,7 @@ ENTRY(__umodsi3)
246 247
247 248
248ENTRY(__divsi3) 249ENTRY(__divsi3)
250ENTRY(__aeabi_idiv)
249 251
250 cmp r1, #0 252 cmp r1, #0
251 eor ip, r0, r1 @ save the sign of the result. 253 eor ip, r0, r1 @ save the sign of the result.
@@ -303,12 +305,33 @@ ENTRY(__modsi3)
303 rsbmi r0, r0, #0 305 rsbmi r0, r0, #0
304 mov pc, lr 306 mov pc, lr
305 307
308#ifdef CONFIG_AEABI
309
310ENTRY(__aeabi_uidivmod)
311
312 stmfd sp!, {r0, r1, ip, lr}
313 bl __aeabi_uidiv
314 ldmfd sp!, {r1, r2, ip, lr}
315 mul r3, r0, r2
316 sub r1, r1, r3
317 mov pc, lr
318
319ENTRY(__aeabi_idivmod)
320
321 stmfd sp!, {r0, r1, ip, lr}
322 bl __aeabi_idiv
323 ldmfd sp!, {r1, r2, ip, lr}
324 mul r3, r0, r2
325 sub r1, r1, r3
326 mov pc, lr
327
328#endif
306 329
307Ldiv0: 330Ldiv0:
308 331
309 str lr, [sp, #-4]! 332 str lr, [sp, #-8]!
310 bl __div0 333 bl __div0
311 mov r0, #0 @ About as wrong as it could be. 334 mov r0, #0 @ About as wrong as it could be.
312 ldr pc, [sp], #4 335 ldr pc, [sp], #8
313 336
314 337
diff --git a/arch/arm/lib/lshrdi3.S b/arch/arm/lib/lshrdi3.S
index 46c2ed19ec95..a86dbdd59cc4 100644
--- a/arch/arm/lib/lshrdi3.S
+++ b/arch/arm/lib/lshrdi3.S
@@ -37,6 +37,7 @@ Boston, MA 02110-1301, USA. */
37#endif 37#endif
38 38
39ENTRY(__lshrdi3) 39ENTRY(__lshrdi3)
40ENTRY(__aeabi_llsr)
40 41
41 subs r3, r2, #32 42 subs r3, r2, #32
42 rsb ip, r2, #32 43 rsb ip, r2, #32
diff --git a/arch/arm/lib/muldi3.S b/arch/arm/lib/muldi3.S
index c7fbdf005319..72d594184b8a 100644
--- a/arch/arm/lib/muldi3.S
+++ b/arch/arm/lib/muldi3.S
@@ -25,6 +25,7 @@
25#endif 25#endif
26 26
27ENTRY(__muldi3) 27ENTRY(__muldi3)
28ENTRY(__aeabi_lmul)
28 29
29 mul xh, yl, xh 30 mul xh, yl, xh
30 mla xh, xl, yh, xh 31 mla xh, xl, yh, xh
diff --git a/arch/arm/lib/ucmpdi2.S b/arch/arm/lib/ucmpdi2.S
index 112630f93e5d..d847a62834cb 100644
--- a/arch/arm/lib/ucmpdi2.S
+++ b/arch/arm/lib/ucmpdi2.S
@@ -10,6 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12 12
13#include <linux/config.h>
13#include <linux/linkage.h> 14#include <linux/linkage.h>
14 15
15#ifdef __ARMEB__ 16#ifdef __ARMEB__
@@ -33,3 +34,16 @@ ENTRY(__ucmpdi2)
33 movhi r0, #2 34 movhi r0, #2
34 mov pc, lr 35 mov pc, lr
35 36
37#ifdef CONFIG_AEABI
38
39ENTRY(__aeabi_ulcmp)
40
41 cmp xh, yh
42 cmpeq xl, yl
43 movlo r0, #-1
44 moveq r0, #0
45 movhi r0, #1
46 mov pc, lr
47
48#endif
49
diff --git a/arch/arm/mach-aaec2000/aaed2000.c b/arch/arm/mach-aaec2000/aaed2000.c
index f5ef69702296..dc5fa8e5ebef 100644
--- a/arch/arm/mach-aaec2000/aaed2000.c
+++ b/arch/arm/mach-aaec2000/aaed2000.c
@@ -90,7 +90,6 @@ static void __init aaed2000_map_io(void)
90 90
91MACHINE_START(AAED2000, "Agilent AAED-2000 Development Platform") 91MACHINE_START(AAED2000, "Agilent AAED-2000 Development Platform")
92 /* Maintainer: Nicolas Bellido Y Ortega */ 92 /* Maintainer: Nicolas Bellido Y Ortega */
93 .phys_ram = 0xf0000000,
94 .phys_io = PIO_BASE, 93 .phys_io = PIO_BASE,
95 .io_pg_offst = ((VIO_BASE) >> 18) & 0xfffc, 94 .io_pg_offst = ((VIO_BASE) >> 18) & 0xfffc,
96 .map_io = aaed2000_map_io, 95 .map_io = aaed2000_map_io,
diff --git a/arch/arm/mach-aaec2000/clock.c b/arch/arm/mach-aaec2000/clock.c
index 0340ddc4824e..74aa7a39bb68 100644
--- a/arch/arm/mach-aaec2000/clock.c
+++ b/arch/arm/mach-aaec2000/clock.c
@@ -15,27 +15,28 @@
15#include <linux/errno.h> 15#include <linux/errno.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/clk.h>
19#include <linux/mutex.h>
18 20
19#include <asm/semaphore.h> 21#include <asm/semaphore.h>
20#include <asm/hardware/clock.h>
21 22
22#include "clock.h" 23#include "clock.h"
23 24
24static LIST_HEAD(clocks); 25static LIST_HEAD(clocks);
25static DECLARE_MUTEX(clocks_sem); 26static DEFINE_MUTEX(clocks_mutex);
26 27
27struct clk *clk_get(struct device *dev, const char *id) 28struct clk *clk_get(struct device *dev, const char *id)
28{ 29{
29 struct clk *p, *clk = ERR_PTR(-ENOENT); 30 struct clk *p, *clk = ERR_PTR(-ENOENT);
30 31
31 down(&clocks_sem); 32 mutex_lock(&clocks_mutex);
32 list_for_each_entry(p, &clocks, node) { 33 list_for_each_entry(p, &clocks, node) {
33 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 34 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
34 clk = p; 35 clk = p;
35 break; 36 break;
36 } 37 }
37 } 38 }
38 up(&clocks_sem); 39 mutex_unlock(&clocks_mutex);
39 40
40 return clk; 41 return clk;
41} 42}
@@ -58,17 +59,6 @@ void clk_disable(struct clk *clk)
58} 59}
59EXPORT_SYMBOL(clk_disable); 60EXPORT_SYMBOL(clk_disable);
60 61
61int clk_use(struct clk *clk)
62{
63 return 0;
64}
65EXPORT_SYMBOL(clk_use);
66
67void clk_unuse(struct clk *clk)
68{
69}
70EXPORT_SYMBOL(clk_unuse);
71
72unsigned long clk_get_rate(struct clk *clk) 62unsigned long clk_get_rate(struct clk *clk)
73{ 63{
74 return clk->rate; 64 return clk->rate;
@@ -89,18 +79,18 @@ EXPORT_SYMBOL(clk_set_rate);
89 79
90int clk_register(struct clk *clk) 80int clk_register(struct clk *clk)
91{ 81{
92 down(&clocks_sem); 82 mutex_lock(&clocks_mutex);
93 list_add(&clk->node, &clocks); 83 list_add(&clk->node, &clocks);
94 up(&clocks_sem); 84 mutex_unlock(&clocks_mutex);
95 return 0; 85 return 0;
96} 86}
97EXPORT_SYMBOL(clk_register); 87EXPORT_SYMBOL(clk_register);
98 88
99void clk_unregister(struct clk *clk) 89void clk_unregister(struct clk *clk)
100{ 90{
101 down(&clocks_sem); 91 mutex_lock(&clocks_mutex);
102 list_del(&clk->node); 92 list_del(&clk->node);
103 up(&clocks_sem); 93 mutex_unlock(&clocks_mutex);
104} 94}
105EXPORT_SYMBOL(clk_unregister); 95EXPORT_SYMBOL(clk_unregister);
106 96
diff --git a/arch/arm/mach-aaec2000/core.c b/arch/arm/mach-aaec2000/core.c
index 4e706d9ad368..dce4815cf53c 100644
--- a/arch/arm/mach-aaec2000/core.c
+++ b/arch/arm/mach-aaec2000/core.c
@@ -20,11 +20,11 @@
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/timex.h> 21#include <linux/timex.h>
22#include <linux/signal.h> 22#include <linux/signal.h>
23#include <linux/amba/bus.h>
23 24
24#include <asm/hardware.h> 25#include <asm/hardware.h>
25#include <asm/irq.h> 26#include <asm/irq.h>
26#include <asm/sizes.h> 27#include <asm/sizes.h>
27#include <asm/hardware/amba.h>
28 28
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30#include <asm/mach/irq.h> 30#include <asm/mach/irq.h>
diff --git a/arch/arm/mach-aaec2000/core.h b/arch/arm/mach-aaec2000/core.h
index daefc0ea14a1..b6029a95f19c 100644
--- a/arch/arm/mach-aaec2000/core.h
+++ b/arch/arm/mach-aaec2000/core.h
@@ -9,7 +9,7 @@
9 * 9 *
10 */ 10 */
11 11
12#include <asm/hardware/amba_clcd.h> 12#include <linux/amba/clcd.h>
13 13
14struct sys_timer; 14struct sys_timer;
15 15
diff --git a/arch/arm/mach-at91rm9200/Kconfig b/arch/arm/mach-at91rm9200/Kconfig
new file mode 100644
index 000000000000..4b7218fc3eb1
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/Kconfig
@@ -0,0 +1,54 @@
1if ARCH_AT91RM9200
2
3menu "AT91RM9200 Implementations"
4
5comment "AT91RM9200 Board Type"
6
7config ARCH_AT91RM9200DK
8 bool "Atmel AT91RM9200-DK Development board"
9 depends on ARCH_AT91RM9200
10 help
11 Select this if you are using Atmel's AT91RM9200-DK Development board
12
13config MACH_AT91RM9200EK
14 bool "Atmel AT91RM9200-EK Evaluation Kit"
15 depends on ARCH_AT91RM9200
16 help
17 Select this if you are using Atmel's AT91RM9200-EK Evaluation Kit
18
19config MACH_CSB337
20 bool "Cogent CSB337 board"
21 depends on ARCH_AT91RM9200
22 help
23 Select this if you are using Cogent's CSB337 board
24
25config MACH_CSB637
26 bool "Cogent CSB637 board"
27 depends on ARCH_AT91RM9200
28 help
29 Select this if you are using Cogent's CSB637 board
30
31config MACH_CARMEVA
32 bool "Conitec's ARM&EVA"
33 depends on ARCH_AT91RM9200
34 help
35 Select this if you are using Conitec's AT91RM9200-MCU-Module
36
37config MACH_KB9200
38 bool "KwikByte's KB920x"
39 depends on ARCH_AT91RM9200
40 help
41 Select this if you are using KwikByte's KB920x board
42
43
44comment "AT91RM9200 Feature Selections"
45
46config AT91_PROGRAMMABLE_CLOCKS
47 bool "Programmable Clocks"
48 help
49 Select this if you need to program one or more of the PCK0..PCK3
50 programmable clock outputs.
51
52endmenu
53
54endif
diff --git a/arch/arm/mach-at91rm9200/Makefile b/arch/arm/mach-at91rm9200/Makefile
new file mode 100644
index 000000000000..75e6ee318ded
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/Makefile
@@ -0,0 +1,27 @@
1#
2# Makefile for the linux kernel.
3#
4
5obj-y := clock.o irq.o time.o gpio.o common.o devices.o
6obj-m :=
7obj-n :=
8obj- :=
9
10# Board-specific support
11obj-$(CONFIG_ARCH_AT91RM9200DK) += board-dk.o
12obj-$(CONFIG_MACH_AT91RM9200EK) += board-ek.o
13obj-$(CONFIG_MACH_CSB337) += board-csb337.o
14obj-$(CONFIG_MACH_CSB637) += board-csb637.o
15#obj-$(CONFIG_MACH_CARMEVA) += board-carmeva.o
16#obj-$(CONFIG_MACH_KB9200) += board-kb9202.o
17
18# LEDs support
19#led-$(CONFIG_ARCH_AT91RM9200DK) += leds.o
20#led-$(CONFIG_MACH_AT91RM9200EK) += leds.o
21#led-$(CONFIG_MACH_CSB337) += leds.o
22#led-$(CONFIG_MACH_CSB637) += leds.o
23#led-$(CONFIG_MACH_KB9200) += leds.o
24obj-$(CONFIG_LEDS) += $(led-y)
25
26# VGA support
27#obj-$(CONFIG_FB_S1D13XXX) += ics1523.o
diff --git a/arch/arm/mach-at91rm9200/Makefile.boot b/arch/arm/mach-at91rm9200/Makefile.boot
new file mode 100644
index 000000000000..e667dcc7cd34
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/Makefile.boot
@@ -0,0 +1,9 @@
1# Note: the following conditions must always be true:
2# ZRELADDR == virt_to_phys(TEXTADDR)
3# PARAMS_PHYS must be within 4MB of ZRELADDR
4# INITRD_PHYS must be in RAM
5
6 zreladdr-y := 0x20008000
7params_phys-y := 0x20000100
8initrd_phys-y := 0x20410000
9
diff --git a/arch/arm/mach-at91rm9200/board-csb337.c b/arch/arm/mach-at91rm9200/board-csb337.c
new file mode 100644
index 000000000000..54022e58d50d
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/board-csb337.c
@@ -0,0 +1,142 @@
1/*
2 * linux/arch/arm/mach-at91rm9200/board-csb337.c
3 *
4 * Copyright (C) 2005 SAN People
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/config.h>
22#include <linux/types.h>
23#include <linux/init.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/platform_device.h>
27
28#include <asm/hardware.h>
29#include <asm/setup.h>
30#include <asm/mach-types.h>
31#include <asm/irq.h>
32
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/mach/irq.h>
36
37#include <asm/arch/hardware.h>
38#include <asm/mach/serial_at91rm9200.h>
39#include <asm/arch/board.h>
40
41#include "generic.h"
42
43static void __init csb337_init_irq(void)
44{
45 /* Initialize AIC controller */
46 at91rm9200_init_irq(NULL);
47
48 /* Set up the GPIO interrupts */
49 at91_gpio_irq_setup(BGA_GPIO_BANKS);
50}
51
52/*
53 * Serial port configuration.
54 * 0 .. 3 = USART0 .. USART3
55 * 4 = DBGU
56 */
57#define CSB337_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
58#define CSB337_SERIAL_CONSOLE 0 /* ttyS0 */
59
60static void __init csb337_map_io(void)
61{
62 int serial[AT91_NR_UART] = CSB337_UART_MAP;
63 int i;
64
65 at91rm9200_map_io();
66
67 /* Initialize clocks: 3.6864 MHz crystal */
68 at91_clock_init(3686400);
69
70#ifdef CONFIG_SERIAL_AT91
71 at91_console_port = CSB337_SERIAL_CONSOLE;
72 memcpy(at91_serial_map, serial, sizeof(serial));
73
74 /* Register UARTs */
75 for (i = 0; i < AT91_NR_UART; i++) {
76 if (serial[i] >= 0)
77 at91_register_uart(i, serial[i]);
78 }
79#endif
80}
81
82static struct at91_eth_data __initdata csb337_eth_data = {
83 .phy_irq_pin = AT91_PIN_PC2,
84 .is_rmii = 0,
85};
86
87static struct at91_usbh_data __initdata csb337_usbh_data = {
88 .ports = 2,
89};
90
91static struct at91_udc_data __initdata csb337_udc_data = {
92 // this has no VBUS sensing pin
93 .pullup_pin = AT91_PIN_PA24,
94};
95
96static struct at91_cf_data __initdata csb337_cf_data = {
97 /*
98 * connector P4 on the CSB 337 mates to
99 * connector P8 on the CSB 300CF
100 */
101
102 /* CSB337 specific */
103 .det_pin = AT91_PIN_PC3,
104
105 /* CSB300CF specific */
106 .irq_pin = AT91_PIN_PA19,
107 .vcc_pin = AT91_PIN_PD0,
108 .rst_pin = AT91_PIN_PD2,
109};
110
111static struct at91_mmc_data __initdata csb337_mmc_data = {
112 .det_pin = AT91_PIN_PD5,
113 .is_b = 0,
114 .wire4 = 1,
115 .wp_pin = AT91_PIN_PD6,
116};
117
118static void __init csb337_board_init(void)
119{
120 /* Ethernet */
121 at91_add_device_eth(&csb337_eth_data);
122 /* USB Host */
123 at91_add_device_usbh(&csb337_usbh_data);
124 /* USB Device */
125 at91_add_device_udc(&csb337_udc_data);
126 /* Compact Flash */
127 at91_set_gpio_input(AT91_PIN_PB22, 1); /* IOIS16 */
128 at91_add_device_cf(&csb337_cf_data);
129 /* MMC */
130 at91_add_device_mmc(&csb337_mmc_data);
131}
132
133MACHINE_START(CSB337, "Cogent CSB337")
134 /* Maintainer: Bill Gatliff */
135 .phys_io = AT91_BASE_SYS,
136 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
137 .boot_params = AT91_SDRAM_BASE + 0x100,
138 .timer = &at91rm9200_timer,
139 .map_io = csb337_map_io,
140 .init_irq = csb337_init_irq,
141 .init_machine = csb337_board_init,
142MACHINE_END
diff --git a/arch/arm/mach-at91rm9200/board-csb637.c b/arch/arm/mach-at91rm9200/board-csb637.c
new file mode 100644
index 000000000000..8195f9d919ea
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/board-csb637.c
@@ -0,0 +1,115 @@
1/*
2 * linux/arch/arm/mach-at91rm9200/board-csb637.c
3 *
4 * Copyright (C) 2005 SAN People
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21#include <linux/config.h>
22#include <linux/types.h>
23#include <linux/init.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/platform_device.h>
27
28#include <asm/hardware.h>
29#include <asm/setup.h>
30#include <asm/mach-types.h>
31#include <asm/irq.h>
32
33#include <asm/mach/arch.h>
34#include <asm/mach/map.h>
35#include <asm/mach/irq.h>
36
37#include <asm/arch/hardware.h>
38#include <asm/mach/serial_at91rm9200.h>
39#include <asm/arch/board.h>
40
41#include "generic.h"
42
43static void __init csb637_init_irq(void)
44{
45 /* Initialize AIC controller */
46 at91rm9200_init_irq(NULL);
47
48 /* Set up the GPIO interrupts */
49 at91_gpio_irq_setup(BGA_GPIO_BANKS);
50}
51
52/*
53 * Serial port configuration.
54 * 0 .. 3 = USART0 .. USART3
55 * 4 = DBGU
56 */
57#define CSB637_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
58#define CSB637_SERIAL_CONSOLE 0 /* ttyS0 */
59
60static void __init csb637_map_io(void)
61{
62 int serial[AT91_NR_UART] = CSB637_UART_MAP;
63 int i;
64
65 at91rm9200_map_io();
66
67 /* Initialize clocks: 3.6864 MHz crystal */
68 at91_clock_init(3686400);
69
70#ifdef CONFIG_SERIAL_AT91
71 at91_console_port = CSB637_SERIAL_CONSOLE;
72 memcpy(at91_serial_map, serial, sizeof(serial));
73
74 /* Register UARTs */
75 for (i = 0; i < AT91_NR_UART; i++) {
76 if (serial[i] >= 0)
77 at91_register_uart(i, serial[i]);
78 }
79#endif
80}
81
82static struct at91_eth_data __initdata csb637_eth_data = {
83 .phy_irq_pin = AT91_PIN_PC0,
84 .is_rmii = 0,
85};
86
87static struct at91_usbh_data __initdata csb637_usbh_data = {
88 .ports = 2,
89};
90
91static struct at91_udc_data __initdata csb637_udc_data = {
92 .vbus_pin = AT91_PIN_PB28,
93 .pullup_pin = AT91_PIN_PB1,
94};
95
96static void __init csb637_board_init(void)
97{
98 /* Ethernet */
99 at91_add_device_eth(&csb637_eth_data);
100 /* USB Host */
101 at91_add_device_usbh(&csb637_usbh_data);
102 /* USB Device */
103 at91_add_device_udc(&csb637_udc_data);
104}
105
106MACHINE_START(CSB637, "Cogent CSB637")
107 /* Maintainer: Bill Gatliff */
108 .phys_io = AT91_BASE_SYS,
109 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
110 .boot_params = AT91_SDRAM_BASE + 0x100,
111 .timer = &at91rm9200_timer,
112 .map_io = csb637_map_io,
113 .init_irq = csb637_init_irq,
114 .init_machine = csb637_board_init,
115MACHINE_END
diff --git a/arch/arm/mach-at91rm9200/board-dk.c b/arch/arm/mach-at91rm9200/board-dk.c
new file mode 100644
index 000000000000..8a783368366e
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/board-dk.c
@@ -0,0 +1,137 @@
1/*
2 * linux/arch/arm/mach-at91rm9200/board-dk.c
3 *
4 * Copyright (C) 2005 SAN People
5 *
6 * Epson S1D framebuffer glue code is:
7 * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/config.h>
25#include <linux/types.h>
26#include <linux/init.h>
27#include <linux/mm.h>
28#include <linux/module.h>
29#include <linux/platform_device.h>
30
31#include <asm/hardware.h>
32#include <asm/setup.h>
33#include <asm/mach-types.h>
34#include <asm/irq.h>
35
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/irq.h>
39
40#include <asm/arch/hardware.h>
41#include <asm/mach/serial_at91rm9200.h>
42#include <asm/arch/board.h>
43
44#include "generic.h"
45
46static void __init dk_init_irq(void)
47{
48 /* Initialize AIC controller */
49 at91rm9200_init_irq(NULL);
50
51 /* Set up the GPIO interrupts */
52 at91_gpio_irq_setup(BGA_GPIO_BANKS);
53}
54
55/*
56 * Serial port configuration.
57 * 0 .. 3 = USART0 .. USART3
58 * 4 = DBGU
59 */
60#define DK_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
61#define DK_SERIAL_CONSOLE 0 /* ttyS0 */
62
63static void __init dk_map_io(void)
64{
65 int serial[AT91_NR_UART] = DK_UART_MAP;
66 int i;
67
68 at91rm9200_map_io();
69
70 /* Initialize clocks: 18.432 MHz crystal */
71 at91_clock_init(18432000);
72
73#ifdef CONFIG_SERIAL_AT91
74 at91_console_port = DK_SERIAL_CONSOLE;
75 memcpy(at91_serial_map, serial, sizeof(serial));
76
77 /* Register UARTs */
78 for (i = 0; i < AT91_NR_UART; i++) {
79 if (at91_serial_map[i] >= 0)
80 at91_register_uart(i, at91_serial_map[i]);
81 }
82#endif
83}
84
85static struct at91_eth_data __initdata dk_eth_data = {
86 .phy_irq_pin = AT91_PIN_PC4,
87 .is_rmii = 1,
88};
89
90static struct at91_usbh_data __initdata dk_usbh_data = {
91 .ports = 2,
92};
93
94static struct at91_udc_data __initdata dk_udc_data = {
95 .vbus_pin = AT91_PIN_PD4,
96 .pullup_pin = AT91_PIN_PD5,
97};
98
99static struct at91_cf_data __initdata dk_cf_data = {
100 .det_pin = AT91_PIN_PB0,
101 .rst_pin = AT91_PIN_PC5,
102 // .irq_pin = ... not connected
103 // .vcc_pin = ... always powered
104};
105
106static struct at91_mmc_data __initdata dk_mmc_data = {
107 .is_b = 0,
108 .wire4 = 1,
109};
110
111static void __init dk_board_init(void)
112{
113 /* Ethernet */
114 at91_add_device_eth(&dk_eth_data);
115 /* USB Host */
116 at91_add_device_usbh(&dk_usbh_data);
117 /* USB Device */
118 at91_add_device_udc(&dk_udc_data);
119 /* Compact Flash */
120 at91_add_device_cf(&dk_cf_data);
121 /* MMC */
122 at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). default: MMC */
123 at91_add_device_mmc(&dk_mmc_data);
124 /* VGA */
125// dk_add_device_video();
126}
127
128MACHINE_START(AT91RM9200DK, "Atmel AT91RM9200-DK")
129 /* Maintainer: SAN People/Atmel */
130 .phys_io = AT91_BASE_SYS,
131 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
132 .boot_params = AT91_SDRAM_BASE + 0x100,
133 .timer = &at91rm9200_timer,
134 .map_io = dk_map_io,
135 .init_irq = dk_init_irq,
136 .init_machine = dk_board_init,
137MACHINE_END
diff --git a/arch/arm/mach-at91rm9200/board-ek.c b/arch/arm/mach-at91rm9200/board-ek.c
new file mode 100644
index 000000000000..fd0752eba897
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/board-ek.c
@@ -0,0 +1,130 @@
1/*
2 * linux/arch/arm/mach-at91rm9200/board-ek.c
3 *
4 * Copyright (C) 2005 SAN People
5 *
6 * Epson S1D framebuffer glue code is:
7 * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23
24#include <linux/config.h>
25#include <linux/types.h>
26#include <linux/init.h>
27#include <linux/mm.h>
28#include <linux/module.h>
29#include <linux/platform_device.h>
30
31#include <asm/hardware.h>
32#include <asm/setup.h>
33#include <asm/mach-types.h>
34#include <asm/irq.h>
35
36#include <asm/mach/arch.h>
37#include <asm/mach/map.h>
38#include <asm/mach/irq.h>
39
40#include <asm/arch/hardware.h>
41#include <asm/mach/serial_at91rm9200.h>
42#include <asm/arch/board.h>
43
44#include "generic.h"
45
46static void __init ek_init_irq(void)
47{
48 /* Initialize AIC controller */
49 at91rm9200_init_irq(NULL);
50
51 /* Set up the GPIO interrupts */
52 at91_gpio_irq_setup(BGA_GPIO_BANKS);
53}
54
55/*
56 * Serial port configuration.
57 * 0 .. 3 = USART0 .. USART3
58 * 4 = DBGU
59 */
60#define EK_UART_MAP { 4, 1, -1, -1, -1 } /* ttyS0, ..., ttyS4 */
61#define EK_SERIAL_CONSOLE 0 /* ttyS0 */
62
63static void __init ek_map_io(void)
64{
65 int serial[AT91_NR_UART] = EK_UART_MAP;
66 int i;
67
68 at91rm9200_map_io();
69
70 /* Initialize clocks: 18.432 MHz crystal */
71 at91_clock_init(18432000);
72
73#ifdef CONFIG_SERIAL_AT91
74 at91_console_port = EK_SERIAL_CONSOLE;
75 memcpy(at91_serial_map, serial, sizeof(serial));
76
77 /* Register UARTs */
78 for (i = 0; i < AT91_NR_UART; i++) {
79 if (serial[i] >= 0)
80 at91_register_uart(i, serial[i]);
81 }
82#endif
83}
84
85static struct at91_eth_data __initdata ek_eth_data = {
86 .phy_irq_pin = AT91_PIN_PC4,
87 .is_rmii = 1,
88};
89
90static struct at91_usbh_data __initdata ek_usbh_data = {
91 .ports = 2,
92};
93
94static struct at91_udc_data __initdata ek_udc_data = {
95 .vbus_pin = AT91_PIN_PD4,
96 .pullup_pin = AT91_PIN_PD5,
97};
98
99static struct at91_mmc_data __initdata ek_mmc_data = {
100 .det_pin = AT91_PIN_PB27,
101 .is_b = 0,
102 .wire4 = 1,
103 .wp_pin = AT91_PIN_PA17,
104};
105
106static void __init ek_board_init(void)
107{
108 /* Ethernet */
109 at91_add_device_eth(&ek_eth_data);
110 /* USB Host */
111 at91_add_device_usbh(&ek_usbh_data);
112 /* USB Device */
113 at91_add_device_udc(&ek_udc_data);
114 /* MMC */
115 at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). default: MMC */
116 at91_add_device_mmc(&ek_mmc_data);
117 /* VGA */
118// ek_add_device_video();
119}
120
121MACHINE_START(AT91RM9200EK, "Atmel AT91RM9200-EK")
122 /* Maintainer: SAN People/Atmel */
123 .phys_io = AT91_BASE_SYS,
124 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
125 .boot_params = AT91_SDRAM_BASE + 0x100,
126 .timer = &at91rm9200_timer,
127 .map_io = ek_map_io,
128 .init_irq = ek_init_irq,
129 .init_machine = ek_board_init,
130MACHINE_END
diff --git a/arch/arm/mach-at91rm9200/clock.c b/arch/arm/mach-at91rm9200/clock.c
new file mode 100644
index 000000000000..ec8195a2a3cc
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/clock.c
@@ -0,0 +1,620 @@
1/*
2 * linux/arch/arm/mach-at91rm9200/clock.c
3 *
4 * Copyright (C) 2005 David Brownell
5 * Copyright (C) 2005 Ivan Kokshaysky
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#include <linux/module.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/fs.h>
17#include <linux/debugfs.h>
18#include <linux/seq_file.h>
19#include <linux/list.h>
20#include <linux/errno.h>
21#include <linux/err.h>
22#include <linux/spinlock.h>
23#include <linux/delay.h>
24#include <linux/clk.h>
25
26#include <asm/semaphore.h>
27#include <asm/io.h>
28#include <asm/mach-types.h>
29
30#include <asm/arch/hardware.h>
31#include <asm/arch/board.h> /* for master clock global */
32
33#include "generic.h"
34
35#undef DEBUG
36
37/*
38 * There's a lot more which can be done with clocks, including cpufreq
39 * integration, slow clock mode support (for system suspend), letting
40 * PLLB be used at other rates (on boards that don't need USB), etc.
41 */
42
43struct clk {
44 const char *name;
45 unsigned long rate_hz;
46 struct clk *parent;
47 u32 pmc_mask;
48 void (*mode)(struct clk *, int);
49 unsigned id:2; /* PCK0..3, or 32k/main/a/b */
50 unsigned primary:1;
51 unsigned pll:1;
52 unsigned programmable:1;
53 u16 users;
54};
55
56static spinlock_t clk_lock;
57static u32 at91_pllb_usb_init;
58
59/*
60 * Four primary clock sources: two crystal oscillators (32K, main), and
61 * two PLLs. PLLA usually runs the master clock; and PLLB must run at
62 * 48 MHz (unless no USB function clocks are needed). The main clock and
63 * both PLLs are turned off to run in "slow clock mode" (system suspend).
64 */
65static struct clk clk32k = {
66 .name = "clk32k",
67 .rate_hz = AT91_SLOW_CLOCK,
68 .users = 1, /* always on */
69 .id = 0,
70 .primary = 1,
71};
72static struct clk main_clk = {
73 .name = "main",
74 .pmc_mask = 1 << 0, /* in PMC_SR */
75 .users = 1,
76 .id = 1,
77 .primary = 1,
78};
79static struct clk plla = {
80 .name = "plla",
81 .parent = &main_clk,
82 .pmc_mask = 1 << 1, /* in PMC_SR */
83 .id = 2,
84 .primary = 1,
85 .pll = 1,
86};
87
88static void pllb_mode(struct clk *clk, int is_on)
89{
90 u32 value;
91
92 if (is_on) {
93 is_on = AT91_PMC_LOCKB;
94 value = at91_pllb_usb_init;
95 } else
96 value = 0;
97
98 at91_sys_write(AT91_CKGR_PLLBR, value);
99
100 do {
101 cpu_relax();
102 } while ((at91_sys_read(AT91_PMC_SR) & AT91_PMC_LOCKB) != is_on);
103}
104
105static struct clk pllb = {
106 .name = "pllb",
107 .parent = &main_clk,
108 .pmc_mask = 1 << 2, /* in PMC_SR */
109 .mode = pllb_mode,
110 .id = 3,
111 .primary = 1,
112 .pll = 1,
113};
114
115static void pmc_sys_mode(struct clk *clk, int is_on)
116{
117 if (is_on)
118 at91_sys_write(AT91_PMC_SCER, clk->pmc_mask);
119 else
120 at91_sys_write(AT91_PMC_SCDR, clk->pmc_mask);
121}
122
123/* USB function clocks (PLLB must be 48 MHz) */
124static struct clk udpck = {
125 .name = "udpck",
126 .parent = &pllb,
127 .pmc_mask = AT91_PMC_UDP,
128 .mode = pmc_sys_mode,
129};
130static struct clk uhpck = {
131 .name = "uhpck",
132 .parent = &pllb,
133 .pmc_mask = AT91_PMC_UHP,
134 .mode = pmc_sys_mode,
135};
136
137#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
138/*
139 * The four programmable clocks can be parented by any primary clock.
140 * You must configure pin multiplexing to bring these signals out.
141 */
142static struct clk pck0 = {
143 .name = "pck0",
144 .pmc_mask = AT91_PMC_PCK0,
145 .mode = pmc_sys_mode,
146 .programmable = 1,
147 .id = 0,
148};
149static struct clk pck1 = {
150 .name = "pck1",
151 .pmc_mask = AT91_PMC_PCK1,
152 .mode = pmc_sys_mode,
153 .programmable = 1,
154 .id = 1,
155};
156static struct clk pck2 = {
157 .name = "pck2",
158 .pmc_mask = AT91_PMC_PCK2,
159 .mode = pmc_sys_mode,
160 .programmable = 1,
161 .id = 2,
162};
163static struct clk pck3 = {
164 .name = "pck3",
165 .pmc_mask = AT91_PMC_PCK3,
166 .mode = pmc_sys_mode,
167 .programmable = 1,
168 .id = 3,
169};
170#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
171
172
173/*
174 * The master clock is divided from the CPU clock (by 1-4). It's used for
175 * memory, interfaces to on-chip peripherals, the AIC, and sometimes more
176 * (e.g baud rate generation). It's sourced from one of the primary clocks.
177 */
178static struct clk mck = {
179 .name = "mck",
180 .pmc_mask = 1 << 3, /* in PMC_SR */
181 .users = 1, /* (must be) always on */
182};
183
184static void pmc_periph_mode(struct clk *clk, int is_on)
185{
186 if (is_on)
187 at91_sys_write(AT91_PMC_PCER, clk->pmc_mask);
188 else
189 at91_sys_write(AT91_PMC_PCDR, clk->pmc_mask);
190}
191
192static struct clk udc_clk = {
193 .name = "udc_clk",
194 .parent = &mck,
195 .pmc_mask = 1 << AT91_ID_UDP,
196 .mode = pmc_periph_mode,
197};
198static struct clk ohci_clk = {
199 .name = "ohci_clk",
200 .parent = &mck,
201 .pmc_mask = 1 << AT91_ID_UHP,
202 .mode = pmc_periph_mode,
203};
204
205static struct clk *const clock_list[] = {
206 /* four primary clocks -- MUST BE FIRST! */
207 &clk32k,
208 &main_clk,
209 &plla,
210 &pllb,
211
212 /* PLLB children (USB) */
213 &udpck,
214 &uhpck,
215
216#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
217 /* programmable clocks */
218 &pck0,
219 &pck1,
220 &pck2,
221 &pck3,
222#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
223
224 /* MCK and peripherals */
225 &mck,
226 // usart0..usart3
227 // mmc
228 &udc_clk,
229 // i2c
230 // spi
231 // ssc0..ssc2
232 // tc0..tc5
233 &ohci_clk,
234 // ether
235};
236
237
238/* clocks are all static for now; no refcounting necessary */
239struct clk *clk_get(struct device *dev, const char *id)
240{
241 int i;
242
243 for (i = 0; i < ARRAY_SIZE(clock_list); i++) {
244 if (strcmp(id, clock_list[i]->name) == 0)
245 return clock_list[i];
246 }
247
248 return ERR_PTR(-ENOENT);
249}
250EXPORT_SYMBOL(clk_get);
251
252void clk_put(struct clk *clk)
253{
254}
255EXPORT_SYMBOL(clk_put);
256
257static void __clk_enable(struct clk *clk)
258{
259 if (clk->parent)
260 __clk_enable(clk->parent);
261 if (clk->users++ == 0 && clk->mode)
262 clk->mode(clk, 1);
263}
264
265int clk_enable(struct clk *clk)
266{
267 unsigned long flags;
268
269 spin_lock_irqsave(&clk_lock, flags);
270 __clk_enable(clk);
271 spin_unlock_irqrestore(&clk_lock, flags);
272 return 0;
273}
274EXPORT_SYMBOL(clk_enable);
275
276static void __clk_disable(struct clk *clk)
277{
278 BUG_ON(clk->users == 0);
279 if (--clk->users == 0 && clk->mode)
280 clk->mode(clk, 0);
281 if (clk->parent)
282 __clk_disable(clk->parent);
283}
284
285void clk_disable(struct clk *clk)
286{
287 unsigned long flags;
288
289 spin_lock_irqsave(&clk_lock, flags);
290 __clk_disable(clk);
291 spin_unlock_irqrestore(&clk_lock, flags);
292}
293EXPORT_SYMBOL(clk_disable);
294
295unsigned long clk_get_rate(struct clk *clk)
296{
297 unsigned long flags;
298 unsigned long rate;
299
300 spin_lock_irqsave(&clk_lock, flags);
301 for (;;) {
302 rate = clk->rate_hz;
303 if (rate || !clk->parent)
304 break;
305 clk = clk->parent;
306 }
307 spin_unlock_irqrestore(&clk_lock, flags);
308 return rate;
309}
310EXPORT_SYMBOL(clk_get_rate);
311
312/*------------------------------------------------------------------------*/
313
314#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
315
316/*
317 * For now, only the programmable clocks support reparenting (MCK could
318 * do this too, with care) or rate changing (the PLLs could do this too,
319 * ditto MCK but that's more for cpufreq). Drivers may reparent to get
320 * a better rate match; we don't.
321 */
322
323long clk_round_rate(struct clk *clk, unsigned long rate)
324{
325 unsigned long flags;
326 unsigned prescale;
327 unsigned long actual;
328
329 if (!clk->programmable)
330 return -EINVAL;
331 spin_lock_irqsave(&clk_lock, flags);
332
333 actual = clk->parent->rate_hz;
334 for (prescale = 0; prescale < 7; prescale++) {
335 if (actual && actual <= rate)
336 break;
337 actual >>= 1;
338 }
339
340 spin_unlock_irqrestore(&clk_lock, flags);
341 return (prescale < 7) ? actual : -ENOENT;
342}
343EXPORT_SYMBOL(clk_round_rate);
344
345int clk_set_rate(struct clk *clk, unsigned long rate)
346{
347 unsigned long flags;
348 unsigned prescale;
349 unsigned long actual;
350
351 if (!clk->programmable)
352 return -EINVAL;
353 if (clk->users)
354 return -EBUSY;
355 spin_lock_irqsave(&clk_lock, flags);
356
357 actual = clk->parent->rate_hz;
358 for (prescale = 0; prescale < 7; prescale++) {
359 if (actual && actual <= rate) {
360 u32 pckr;
361
362 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id));
363 pckr &= 0x03;
364 pckr |= prescale << 2;
365 at91_sys_write(AT91_PMC_PCKR(clk->id), pckr);
366 clk->rate_hz = actual;
367 break;
368 }
369 actual >>= 1;
370 }
371
372 spin_unlock_irqrestore(&clk_lock, flags);
373 return (prescale < 7) ? actual : -ENOENT;
374}
375EXPORT_SYMBOL(clk_set_rate);
376
377struct clk *clk_get_parent(struct clk *clk)
378{
379 return clk->parent;
380}
381EXPORT_SYMBOL(clk_get_parent);
382
383int clk_set_parent(struct clk *clk, struct clk *parent)
384{
385 unsigned long flags;
386
387 if (clk->users)
388 return -EBUSY;
389 if (!parent->primary || !clk->programmable)
390 return -EINVAL;
391 spin_lock_irqsave(&clk_lock, flags);
392
393 clk->rate_hz = parent->rate_hz;
394 clk->parent = parent;
395 at91_sys_write(AT91_PMC_PCKR(clk->id), parent->id);
396
397 spin_unlock_irqrestore(&clk_lock, flags);
398 return 0;
399}
400EXPORT_SYMBOL(clk_set_parent);
401
402#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
403
404/*------------------------------------------------------------------------*/
405
406#ifdef CONFIG_DEBUG_FS
407
408static int at91_clk_show(struct seq_file *s, void *unused)
409{
410 u32 scsr, pcsr, sr;
411 unsigned i;
412
413 seq_printf(s, "SCSR = %8x\n", scsr = at91_sys_read(AT91_PMC_SCSR));
414 seq_printf(s, "PCSR = %8x\n", pcsr = at91_sys_read(AT91_PMC_PCSR));
415
416 seq_printf(s, "MOR = %8x\n", at91_sys_read(AT91_CKGR_MOR));
417 seq_printf(s, "MCFR = %8x\n", at91_sys_read(AT91_CKGR_MCFR));
418 seq_printf(s, "PLLA = %8x\n", at91_sys_read(AT91_CKGR_PLLAR));
419 seq_printf(s, "PLLB = %8x\n", at91_sys_read(AT91_CKGR_PLLBR));
420
421 seq_printf(s, "MCKR = %8x\n", at91_sys_read(AT91_PMC_MCKR));
422 for (i = 0; i < 4; i++)
423 seq_printf(s, "PCK%d = %8x\n", i, at91_sys_read(AT91_PMC_PCKR(i)));
424 seq_printf(s, "SR = %8x\n", sr = at91_sys_read(AT91_PMC_SR));
425
426 seq_printf(s, "\n");
427
428 for (i = 0; i < ARRAY_SIZE(clock_list); i++) {
429 char *state;
430 struct clk *clk = clock_list[i];
431
432 if (clk->mode == pmc_sys_mode)
433 state = (scsr & clk->pmc_mask) ? "on" : "off";
434 else if (clk->mode == pmc_periph_mode)
435 state = (pcsr & clk->pmc_mask) ? "on" : "off";
436 else if (clk->pmc_mask)
437 state = (sr & clk->pmc_mask) ? "on" : "off";
438 else if (clk == &clk32k || clk == &main_clk)
439 state = "on";
440 else
441 state = "";
442
443 seq_printf(s, "%-10s users=%d %-3s %9ld Hz %s\n",
444 clk->name, clk->users, state, clk_get_rate(clk),
445 clk->parent ? clk->parent->name : "");
446 }
447 return 0;
448}
449
450static int at91_clk_open(struct inode *inode, struct file *file)
451{
452 return single_open(file, at91_clk_show, NULL);
453}
454
455static struct file_operations at91_clk_operations = {
456 .open = at91_clk_open,
457 .read = seq_read,
458 .llseek = seq_lseek,
459 .release = single_release,
460};
461
462static int __init at91_clk_debugfs_init(void)
463{
464 /* /sys/kernel/debug/at91_clk */
465 (void) debugfs_create_file("at91_clk", S_IFREG | S_IRUGO, NULL, NULL, &at91_clk_operations);
466
467 return 0;
468}
469postcore_initcall(at91_clk_debugfs_init);
470
471#endif
472
473/*------------------------------------------------------------------------*/
474
475static u32 __init at91_pll_rate(struct clk *pll, u32 freq, u32 reg)
476{
477 unsigned mul, div;
478
479 div = reg & 0xff;
480 mul = (reg >> 16) & 0x7ff;
481 if (div && mul) {
482 freq /= div;
483 freq *= mul + 1;
484 } else
485 freq = 0;
486 if (pll == &pllb && (reg & (1 << 28)))
487 freq /= 2;
488 return freq;
489}
490
491static unsigned __init at91_pll_calc(unsigned main_freq, unsigned out_freq)
492{
493 unsigned i, div = 0, mul = 0, diff = 1 << 30;
494 unsigned ret = (out_freq > 155000000) ? 0xbe00 : 0x3e00;
495
496 /* PLL output max 240 MHz (or 180 MHz per errata) */
497 if (out_freq > 240000000)
498 goto fail;
499
500 for (i = 1; i < 256; i++) {
501 int diff1;
502 unsigned input, mul1;
503
504 /*
505 * PLL input between 1MHz and 32MHz per spec, but lower
506 * frequences seem necessary in some cases so allow 100K.
507 */
508 input = main_freq / i;
509 if (input < 100000)
510 continue;
511 if (input > 32000000)
512 continue;
513
514 mul1 = out_freq / input;
515 if (mul1 > 2048)
516 continue;
517 if (mul1 < 2)
518 goto fail;
519
520 diff1 = out_freq - input * mul1;
521 if (diff1 < 0)
522 diff1 = -diff1;
523 if (diff > diff1) {
524 diff = diff1;
525 div = i;
526 mul = mul1;
527 if (diff == 0)
528 break;
529 }
530 }
531 if (i == 256 && diff > (out_freq >> 5))
532 goto fail;
533 return ret | ((mul - 1) << 16) | div;
534fail:
535 return 0;
536}
537
538int __init at91_clock_init(unsigned long main_clock)
539{
540 unsigned tmp, freq, mckr;
541
542 spin_lock_init(&clk_lock);
543
544 /*
545 * When the bootloader initialized the main oscillator correctly,
546 * there's no problem using the cycle counter. But if it didn't,
547 * or when using oscillator bypass mode, we must be told the speed
548 * of the main clock.
549 */
550 if (!main_clock) {
551 do {
552 tmp = at91_sys_read(AT91_CKGR_MCFR);
553 } while (!(tmp & 0x10000));
554 main_clock = (tmp & 0xffff) * (AT91_SLOW_CLOCK / 16);
555 }
556 main_clk.rate_hz = main_clock;
557
558 /* report if PLLA is more than mildly overclocked */
559 plla.rate_hz = at91_pll_rate(&plla, main_clock, at91_sys_read(AT91_CKGR_PLLAR));
560 if (plla.rate_hz > 209000000)
561 pr_info("Clocks: PLLA overclocked, %ld MHz\n", plla.rate_hz / 1000000);
562
563 /*
564 * USB clock init: choose 48 MHz PLLB value, turn all clocks off,
565 * disable 48MHz clock during usb peripheral suspend.
566 *
567 * REVISIT: assumes MCK doesn't derive from PLLB!
568 */
569 at91_pllb_usb_init = at91_pll_calc(main_clock, 48000000 * 2) | 0x10000000;
570 pllb.rate_hz = at91_pll_rate(&pllb, main_clock, at91_pllb_usb_init);
571 at91_sys_write(AT91_PMC_PCDR, (1 << AT91_ID_UHP) | (1 << AT91_ID_UDP));
572 at91_sys_write(AT91_PMC_SCDR, AT91_PMC_UHP | AT91_PMC_UDP);
573 at91_sys_write(AT91_CKGR_PLLBR, 0);
574 at91_sys_write(AT91_PMC_SCER, AT91_PMC_MCKUDP);
575
576 /*
577 * MCK and CPU derive from one of those primary clocks.
578 * For now, assume this parentage won't change.
579 */
580 mckr = at91_sys_read(AT91_PMC_MCKR);
581 mck.parent = clock_list[mckr & AT91_PMC_CSS];
582 mck.parent->users++;
583 freq = mck.parent->rate_hz;
584 freq /= (1 << ((mckr >> 2) & 3)); /* prescale */
585 mck.rate_hz = freq / (1 + ((mckr >> 8) & 3)); /* mdiv */
586
587 printk("Clocks: CPU %u MHz, master %u MHz, main %u.%03u MHz\n",
588 freq / 1000000, (unsigned) mck.rate_hz / 1000000,
589 (unsigned) main_clock / 1000000,
590 ((unsigned) main_clock % 1000000) / 1000);
591
592 /* FIXME get rid of master_clock global */
593 at91_master_clock = mck.rate_hz;
594
595#ifdef CONFIG_AT91_PROGRAMMABLE_CLOCKS
596 /* establish PCK0..PCK3 parentage */
597 for (tmp = 0; tmp < ARRAY_SIZE(clock_list); tmp++) {
598 struct clk *clk = clock_list[tmp], *parent;
599 u32 pckr;
600
601 if (!clk->programmable)
602 continue;
603
604 pckr = at91_sys_read(AT91_PMC_PCKR(clk->id));
605 parent = clock_list[pckr & 3];
606 clk->parent = parent;
607 clk->rate_hz = parent->rate_hz / (1 << ((pckr >> 2) & 3));
608 }
609#else
610 /* disable unused clocks */
611 at91_sys_write(AT91_PMC_SCDR, AT91_PMC_PCK0 | AT91_PMC_PCK1 | AT91_PMC_PCK2 | AT91_PMC_PCK3);
612#endif /* CONFIG_AT91_PROGRAMMABLE_CLOCKS */
613
614 /* FIXME several unused clocks may still be active... provide
615 * a CONFIG option to turn off all unused clocks at some point
616 * before driver init starts.
617 */
618
619 return 0;
620}
diff --git a/arch/arm/mach-at91rm9200/common.c b/arch/arm/mach-at91rm9200/common.c
new file mode 100644
index 000000000000..3848fd2d5596
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/common.c
@@ -0,0 +1,115 @@
1/*
2 * arch/arm/mach-at91rm9200/common.c
3 *
4 * Copyright (C) 2005 SAN People
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12
13#include <linux/config.h>
14#include <linux/module.h>
15
16#include <asm/mach/arch.h>
17#include <asm/mach/map.h>
18
19#include <asm/arch/hardware.h>
20
21static struct map_desc at91rm9200_io_desc[] __initdata = {
22 {
23 .virtual = AT91_VA_BASE_SYS,
24 .pfn = __phys_to_pfn(AT91_BASE_SYS),
25 .length = SZ_4K,
26 .type = MT_DEVICE,
27 }, {
28 .virtual = AT91_VA_BASE_SPI,
29 .pfn = __phys_to_pfn(AT91_BASE_SPI),
30 .length = SZ_16K,
31 .type = MT_DEVICE,
32 }, {
33 .virtual = AT91_VA_BASE_SSC2,
34 .pfn = __phys_to_pfn(AT91_BASE_SSC2),
35 .length = SZ_16K,
36 .type = MT_DEVICE,
37 }, {
38 .virtual = AT91_VA_BASE_SSC1,
39 .pfn = __phys_to_pfn(AT91_BASE_SSC1),
40 .length = SZ_16K,
41 .type = MT_DEVICE,
42 }, {
43 .virtual = AT91_VA_BASE_SSC0,
44 .pfn = __phys_to_pfn(AT91_BASE_SSC0),
45 .length = SZ_16K,
46 .type = MT_DEVICE,
47 }, {
48 .virtual = AT91_VA_BASE_US3,
49 .pfn = __phys_to_pfn(AT91_BASE_US3),
50 .length = SZ_16K,
51 .type = MT_DEVICE,
52 }, {
53 .virtual = AT91_VA_BASE_US2,
54 .pfn = __phys_to_pfn(AT91_BASE_US2),
55 .length = SZ_16K,
56 .type = MT_DEVICE,
57 }, {
58 .virtual = AT91_VA_BASE_US1,
59 .pfn = __phys_to_pfn(AT91_BASE_US1),
60 .length = SZ_16K,
61 .type = MT_DEVICE,
62 }, {
63 .virtual = AT91_VA_BASE_US0,
64 .pfn = __phys_to_pfn(AT91_BASE_US0),
65 .length = SZ_16K,
66 .type = MT_DEVICE,
67 }, {
68 .virtual = AT91_VA_BASE_EMAC,
69 .pfn = __phys_to_pfn(AT91_BASE_EMAC),
70 .length = SZ_16K,
71 .type = MT_DEVICE,
72 }, {
73 .virtual = AT91_VA_BASE_TWI,
74 .pfn = __phys_to_pfn(AT91_BASE_TWI),
75 .length = SZ_16K,
76 .type = MT_DEVICE,
77 }, {
78 .virtual = AT91_VA_BASE_MCI,
79 .pfn = __phys_to_pfn(AT91_BASE_MCI),
80 .length = SZ_16K,
81 .type = MT_DEVICE,
82 }, {
83 .virtual = AT91_VA_BASE_UDP,
84 .pfn = __phys_to_pfn(AT91_BASE_UDP),
85 .length = SZ_16K,
86 .type = MT_DEVICE,
87 }, {
88 .virtual = AT91_VA_BASE_TCB1,
89 .pfn = __phys_to_pfn(AT91_BASE_TCB1),
90 .length = SZ_16K,
91 .type = MT_DEVICE,
92 }, {
93 .virtual = AT91_VA_BASE_TCB0,
94 .pfn = __phys_to_pfn(AT91_BASE_TCB0),
95 .length = SZ_16K,
96 .type = MT_DEVICE,
97 },
98};
99
100void __init at91rm9200_map_io(void)
101{
102 iotable_init(at91rm9200_io_desc, ARRAY_SIZE(at91rm9200_io_desc));
103}
104
105
106unsigned long at91_master_clock;
107
108EXPORT_SYMBOL(at91_master_clock);
109
110
111int at91_serial_map[AT91_NR_UART];
112int at91_console_port;
113
114EXPORT_SYMBOL(at91_serial_map);
115EXPORT_SYMBOL(at91_console_port);
diff --git a/arch/arm/mach-at91rm9200/devices.c b/arch/arm/mach-at91rm9200/devices.c
new file mode 100644
index 000000000000..8df3e5245651
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/devices.c
@@ -0,0 +1,291 @@
1/*
2 * arch/arm/mach-at91rm9200/devices.c
3 *
4 * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
5 * Copyright (C) 2005 David Brownell
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 <asm/mach/arch.h>
14#include <asm/mach/map.h>
15
16#include <linux/config.h>
17#include <linux/platform_device.h>
18
19#include <asm/arch/board.h>
20#include <asm/arch/pio.h>
21
22
23/* --------------------------------------------------------------------
24 * USB Host
25 * -------------------------------------------------------------------- */
26
27#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
28static u64 ohci_dmamask = 0xffffffffUL;
29static struct at91_usbh_data usbh_data;
30
31static struct resource at91rm9200_usbh_resource[] = {
32 [0] = {
33 .start = AT91_UHP_BASE,
34 .end = AT91_UHP_BASE + SZ_1M -1,
35 .flags = IORESOURCE_MEM,
36 },
37 [1] = {
38 .start = AT91_ID_UHP,
39 .end = AT91_ID_UHP,
40 .flags = IORESOURCE_IRQ,
41 },
42};
43
44static struct platform_device at91rm9200_usbh_device = {
45 .name = "at91rm9200-ohci",
46 .id = -1,
47 .dev = {
48 .dma_mask = &ohci_dmamask,
49 .coherent_dma_mask = 0xffffffff,
50 .platform_data = &usbh_data,
51 },
52 .resource = at91rm9200_usbh_resource,
53 .num_resources = ARRAY_SIZE(at91rm9200_usbh_resource),
54};
55
56void __init at91_add_device_usbh(struct at91_usbh_data *data)
57{
58 if (!data)
59 return;
60
61 usbh_data = *data;
62 platform_device_register(&at91rm9200_usbh_device);
63}
64#else
65void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
66#endif
67
68
69/* --------------------------------------------------------------------
70 * USB Device (Gadget)
71 * -------------------------------------------------------------------- */
72
73#ifdef CONFIG_USB_GADGET_AT91
74static struct at91_udc_data udc_data;
75
76static struct resource at91_udc_resources[] = {
77 {
78 .start = AT91_BASE_UDP,
79 .end = AT91_BASE_UDP + SZ_16K - 1,
80 .flags = IORESOURCE_MEM,
81 }
82};
83
84static struct platform_device at91rm9200_udc_device = {
85 .name = "at91_udc",
86 .id = -1,
87 .dev = {
88 .platform_data = &udc_data,
89 },
90 .resource = at91_udc_resources,
91 .num_resources = ARRAY_SIZE(at91_udc_resources),
92};
93
94void __init at91_add_device_udc(struct at91_udc_data *data)
95{
96 if (!data)
97 return;
98
99 if (data->vbus_pin) {
100 at91_set_gpio_input(data->vbus_pin, 0);
101 at91_set_deglitch(data->vbus_pin, 1);
102 }
103 if (data->pullup_pin)
104 at91_set_gpio_output(data->pullup_pin, 0);
105
106 udc_data = *data;
107 platform_device_register(&at91rm9200_udc_device);
108}
109#else
110void __init at91_add_device_udc(struct at91_udc_data *data) {}
111#endif
112
113
114/* --------------------------------------------------------------------
115 * Ethernet
116 * -------------------------------------------------------------------- */
117
118#if defined(CONFIG_ARM_AT91_ETHER) || defined(CONFIG_ARM_AT91_ETHER_MODULE)
119static u64 eth_dmamask = 0xffffffffUL;
120static struct at91_eth_data eth_data;
121
122static struct platform_device at91rm9200_eth_device = {
123 .name = "at91_ether",
124 .id = -1,
125 .dev = {
126 .dma_mask = &eth_dmamask,
127 .coherent_dma_mask = 0xffffffff,
128 .platform_data = &eth_data,
129 },
130 .num_resources = 0,
131};
132
133void __init at91_add_device_eth(struct at91_eth_data *data)
134{
135 if (!data)
136 return;
137
138 if (data->phy_irq_pin) {
139 at91_set_gpio_input(data->phy_irq_pin, 0);
140 at91_set_deglitch(data->phy_irq_pin, 1);
141 }
142
143 /* Pins used for MII and RMII */
144 at91_set_A_periph(AT91_PIN_PA16, 0); /* EMDIO */
145 at91_set_A_periph(AT91_PIN_PA15, 0); /* EMDC */
146 at91_set_A_periph(AT91_PIN_PA14, 0); /* ERXER */
147 at91_set_A_periph(AT91_PIN_PA13, 0); /* ERX1 */
148 at91_set_A_periph(AT91_PIN_PA12, 0); /* ERX0 */
149 at91_set_A_periph(AT91_PIN_PA11, 0); /* ECRS_ECRSDV */
150 at91_set_A_periph(AT91_PIN_PA10, 0); /* ETX1 */
151 at91_set_A_periph(AT91_PIN_PA9, 0); /* ETX0 */
152 at91_set_A_periph(AT91_PIN_PA8, 0); /* ETXEN */
153 at91_set_A_periph(AT91_PIN_PA7, 0); /* ETXCK_EREFCK */
154
155 if (!data->is_rmii) {
156 at91_set_B_periph(AT91_PIN_PB19, 0); /* ERXCK */
157 at91_set_B_periph(AT91_PIN_PB18, 0); /* ECOL */
158 at91_set_B_periph(AT91_PIN_PB17, 0); /* ERXDV */
159 at91_set_B_periph(AT91_PIN_PB16, 0); /* ERX3 */
160 at91_set_B_periph(AT91_PIN_PB15, 0); /* ERX2 */
161 at91_set_B_periph(AT91_PIN_PB14, 0); /* ETXER */
162 at91_set_B_periph(AT91_PIN_PB13, 0); /* ETX3 */
163 at91_set_B_periph(AT91_PIN_PB12, 0); /* ETX2 */
164 }
165
166 eth_data = *data;
167 platform_device_register(&at91rm9200_eth_device);
168}
169#else
170void __init at91_add_device_eth(struct at91_eth_data *data) {}
171#endif
172
173
174/* --------------------------------------------------------------------
175 * Compact Flash / PCMCIA
176 * -------------------------------------------------------------------- */
177
178#if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE)
179static struct at91_cf_data cf_data;
180
181static struct platform_device at91rm9200_cf_device = {
182 .name = "at91_cf",
183 .id = -1,
184 .dev = {
185 .platform_data = &cf_data,
186 },
187 .num_resources = 0,
188};
189
190void __init at91_add_device_cf(struct at91_cf_data *data)
191{
192 if (!data)
193 return;
194
195 /* input/irq */
196 if (data->irq_pin) {
197 at91_set_gpio_input(data->irq_pin, 1);
198 at91_set_deglitch(data->irq_pin, 1);
199 }
200 at91_set_gpio_input(data->det_pin, 1);
201 at91_set_deglitch(data->det_pin, 1);
202
203 /* outputs, initially off */
204 if (data->vcc_pin)
205 at91_set_gpio_output(data->vcc_pin, 0);
206 at91_set_gpio_output(data->rst_pin, 0);
207
208 cf_data = *data;
209 platform_device_register(&at91rm9200_cf_device);
210}
211#else
212void __init at91_add_device_cf(struct at91_cf_data *data) {}
213#endif
214
215
216/* --------------------------------------------------------------------
217 * MMC / SD
218 * -------------------------------------------------------------------- */
219
220#if defined(CONFIG_MMC_AT91RM9200) || defined(CONFIG_MMC_AT91RM9200_MODULE)
221static u64 mmc_dmamask = 0xffffffffUL;
222static struct at91_mmc_data mmc_data;
223
224static struct resource at91_mmc_resources[] = {
225 {
226 .start = AT91_BASE_MCI,
227 .end = AT91_BASE_MCI + SZ_16K - 1,
228 .flags = IORESOURCE_MEM,
229 }
230};
231
232static struct platform_device at91rm9200_mmc_device = {
233 .name = "at91rm9200_mci",
234 .id = -1,
235 .dev = {
236 .dma_mask = &mmc_dmamask,
237 .coherent_dma_mask = 0xffffffff,
238 .platform_data = &mmc_data,
239 },
240 .resource = at91_mmc_resources,
241 .num_resources = ARRAY_SIZE(at91_mmc_resources),
242};
243
244void __init at91_add_device_mmc(struct at91_mmc_data *data)
245{
246 if (!data)
247 return;
248
249 /* input/irq */
250 if (data->det_pin) {
251 at91_set_gpio_input(data->det_pin, 1);
252 at91_set_deglitch(data->det_pin, 1);
253 }
254 if (data->wp_pin)
255 at91_set_gpio_input(data->wp_pin, 1);
256
257 /* CLK */
258 at91_set_A_periph(AT91_PIN_PA27, 0);
259
260 if (data->is_b) {
261 /* CMD */
262 at91_set_B_periph(AT91_PIN_PA8, 0);
263
264 /* DAT0, maybe DAT1..DAT3 */
265 at91_set_B_periph(AT91_PIN_PA9, 0);
266 if (data->wire4) {
267 at91_set_B_periph(AT91_PIN_PA10, 0);
268 at91_set_B_periph(AT91_PIN_PA11, 0);
269 at91_set_B_periph(AT91_PIN_PA12, 0);
270 }
271 } else {
272 /* CMD */
273 at91_set_A_periph(AT91_PIN_PA28, 0);
274
275 /* DAT0, maybe DAT1..DAT3 */
276 at91_set_A_periph(AT91_PIN_PA29, 0);
277 if (data->wire4) {
278 at91_set_B_periph(AT91_PIN_PB3, 0);
279 at91_set_B_periph(AT91_PIN_PB4, 0);
280 at91_set_B_periph(AT91_PIN_PB5, 0);
281 }
282 }
283
284 mmc_data = *data;
285 platform_device_register(&at91rm9200_mmc_device);
286}
287#else
288void __init at91_add_device_mmc(struct at91_mmc_data *data) {}
289#endif
290
291/* -------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91rm9200/generic.h b/arch/arm/mach-at91rm9200/generic.h
new file mode 100644
index 000000000000..9bd541eba0a0
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/generic.h
@@ -0,0 +1,18 @@
1/*
2 * linux/arch/arm/mach-at91rm9200/generic.h
3 *
4 * Copyright (C) 2005 David Brownell
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
11void at91_gpio_irq_setup(unsigned banks);
12
13struct sys_timer;
14extern struct sys_timer at91rm9200_timer;
15
16extern void __init at91rm9200_map_io(void);
17
18extern int __init at91_clock_init(unsigned long main_clock);
diff --git a/arch/arm/mach-at91rm9200/gpio.c b/arch/arm/mach-at91rm9200/gpio.c
new file mode 100644
index 000000000000..2fd2ef583e4d
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/gpio.c
@@ -0,0 +1,302 @@
1/*
2 * linux/arch/arm/mach-at91rm9200/gpio.c
3 *
4 * Copyright (C) 2005 HP Labs
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
12#include <linux/errno.h>
13#include <linux/kernel.h>
14#include <linux/list.h>
15#include <linux/module.h>
16
17#include <asm/io.h>
18#include <asm/mach/irq.h>
19#include <asm/arch/hardware.h>
20#include <asm/arch/gpio.h>
21
22static const u32 pio_controller_offset[4] = {
23 AT91_PIOA,
24 AT91_PIOB,
25 AT91_PIOC,
26 AT91_PIOD,
27};
28
29static inline void __iomem *pin_to_controller(unsigned pin)
30{
31 void __iomem *sys_base = (void __iomem *) AT91_VA_BASE_SYS;
32
33 pin -= PIN_BASE;
34 pin /= 32;
35 if (likely(pin < BGA_GPIO_BANKS))
36 return sys_base + pio_controller_offset[pin];
37
38 return NULL;
39}
40
41static inline unsigned pin_to_mask(unsigned pin)
42{
43 pin -= PIN_BASE;
44 return 1 << (pin % 32);
45}
46
47
48/*--------------------------------------------------------------------------*/
49
50/* Not all hardware capabilities are exposed through these calls; they
51 * only encapsulate the most common features and modes. (So if you
52 * want to change signals in groups, do it directly.)
53 *
54 * Bootloaders will usually handle some of the pin multiplexing setup.
55 * The intent is certainly that by the time Linux is fully booted, all
56 * pins should have been fully initialized. These setup calls should
57 * only be used by board setup routines, or possibly in driver probe().
58 *
59 * For bootloaders doing all that setup, these calls could be inlined
60 * as NOPs so Linux won't duplicate any setup code
61 */
62
63
64/*
65 * mux the pin to the "A" internal peripheral role.
66 */
67int __init_or_module at91_set_A_periph(unsigned pin, int use_pullup)
68{
69 void __iomem *pio = pin_to_controller(pin);
70 unsigned mask = pin_to_mask(pin);
71
72 if (!pio)
73 return -EINVAL;
74
75 __raw_writel(mask, pio + PIO_IDR);
76 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
77 __raw_writel(mask, pio + PIO_ASR);
78 __raw_writel(mask, pio + PIO_PDR);
79 return 0;
80}
81EXPORT_SYMBOL(at91_set_A_periph);
82
83
84/*
85 * mux the pin to the "B" internal peripheral role.
86 */
87int __init_or_module at91_set_B_periph(unsigned pin, int use_pullup)
88{
89 void __iomem *pio = pin_to_controller(pin);
90 unsigned mask = pin_to_mask(pin);
91
92 if (!pio)
93 return -EINVAL;
94
95 __raw_writel(mask, pio + PIO_IDR);
96 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
97 __raw_writel(mask, pio + PIO_BSR);
98 __raw_writel(mask, pio + PIO_PDR);
99 return 0;
100}
101EXPORT_SYMBOL(at91_set_B_periph);
102
103
104/*
105 * mux the pin to the gpio controller (instead of "A" or "B" peripheral), and
106 * configure it for an input.
107 */
108int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup)
109{
110 void __iomem *pio = pin_to_controller(pin);
111 unsigned mask = pin_to_mask(pin);
112
113 if (!pio)
114 return -EINVAL;
115
116 __raw_writel(mask, pio + PIO_IDR);
117 __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR));
118 __raw_writel(mask, pio + PIO_ODR);
119 __raw_writel(mask, pio + PIO_PER);
120 return 0;
121}
122EXPORT_SYMBOL(at91_set_gpio_input);
123
124
125/*
126 * mux the pin to the gpio controller (instead of "A" or "B" peripheral),
127 * and configure it for an output.
128 */
129int __init_or_module at91_set_gpio_output(unsigned pin, int value)
130{
131 void __iomem *pio = pin_to_controller(pin);
132 unsigned mask = pin_to_mask(pin);
133
134 if (!pio)
135 return -EINVAL;
136
137 __raw_writel(mask, pio + PIO_IDR);
138 __raw_writel(mask, pio + PIO_PUDR);
139 __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
140 __raw_writel(mask, pio + PIO_OER);
141 __raw_writel(mask, pio + PIO_PER);
142 return 0;
143}
144EXPORT_SYMBOL(at91_set_gpio_output);
145
146
147/*
148 * enable/disable the glitch filter; mostly used with IRQ handling.
149 */
150int __init_or_module at91_set_deglitch(unsigned pin, int is_on)
151{
152 void __iomem *pio = pin_to_controller(pin);
153 unsigned mask = pin_to_mask(pin);
154
155 if (!pio)
156 return -EINVAL;
157 __raw_writel(mask, pio + (is_on ? PIO_IFER : PIO_IFDR));
158 return 0;
159}
160EXPORT_SYMBOL(at91_set_deglitch);
161
162/*--------------------------------------------------------------------------*/
163
164
165/*
166 * assuming the pin is muxed as a gpio output, set its value.
167 */
168int at91_set_gpio_value(unsigned pin, int value)
169{
170 void __iomem *pio = pin_to_controller(pin);
171 unsigned mask = pin_to_mask(pin);
172
173 if (!pio)
174 return -EINVAL;
175 __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR));
176 return 0;
177}
178EXPORT_SYMBOL(at91_set_gpio_value);
179
180
181/*
182 * read the pin's value (works even if it's not muxed as a gpio).
183 */
184int at91_get_gpio_value(unsigned pin)
185{
186 void __iomem *pio = pin_to_controller(pin);
187 unsigned mask = pin_to_mask(pin);
188 u32 pdsr;
189
190 if (!pio)
191 return -EINVAL;
192 pdsr = __raw_readl(pio + PIO_PDSR);
193 return (pdsr & mask) != 0;
194}
195EXPORT_SYMBOL(at91_get_gpio_value);
196
197/*--------------------------------------------------------------------------*/
198
199
200/* Several AIC controller irqs are dispatched through this GPIO handler.
201 * To use any AT91_PIN_* as an externally triggered IRQ, first call
202 * at91_set_gpio_input() then maybe enable its glitch filter.
203 * Then just request_irq() with the pin ID; it works like any ARM IRQ
204 * handler, though it always triggers on rising and falling edges.
205 *
206 * Alternatively, certain pins may be used directly as IRQ0..IRQ6 after
207 * configuring them with at91_set_a_periph() or at91_set_b_periph().
208 * IRQ0..IRQ6 should be configurable, e.g. level vs edge triggering.
209 */
210
211static void gpio_irq_mask(unsigned pin)
212{
213 void __iomem *pio = pin_to_controller(pin);
214 unsigned mask = pin_to_mask(pin);
215
216 if (pio)
217 __raw_writel(mask, pio + PIO_IDR);
218}
219
220static void gpio_irq_unmask(unsigned pin)
221{
222 void __iomem *pio = pin_to_controller(pin);
223 unsigned mask = pin_to_mask(pin);
224
225 if (pio)
226 __raw_writel(mask, pio + PIO_IER);
227}
228
229static int gpio_irq_type(unsigned pin, unsigned type)
230{
231 return (type == IRQT_BOTHEDGE) ? 0 : -EINVAL;
232}
233
234static struct irqchip gpio_irqchip = {
235 .mask = gpio_irq_mask,
236 .unmask = gpio_irq_unmask,
237 .set_type = gpio_irq_type,
238};
239
240static void gpio_irq_handler(unsigned irq, struct irqdesc *desc, struct pt_regs *regs)
241{
242 unsigned pin;
243 struct irqdesc *gpio;
244 void __iomem *pio;
245 u32 isr;
246
247 pio = (void __force __iomem *) desc->chipdata;
248
249 /* temporarily mask (level sensitive) parent IRQ */
250 desc->chip->ack(irq);
251 for (;;) {
252 isr = __raw_readl(pio + PIO_ISR) & __raw_readl(pio + PIO_IMR);
253 if (!isr)
254 break;
255
256 pin = (unsigned) desc->data;
257 gpio = &irq_desc[pin];
258
259 while (isr) {
260 if (isr & 1)
261 gpio->handle(pin, gpio, regs);
262 pin++;
263 gpio++;
264 isr >>= 1;
265 }
266 }
267 desc->chip->unmask(irq);
268 /* now it may re-trigger */
269}
270
271/* call this from board-specific init_irq */
272void __init at91_gpio_irq_setup(unsigned banks)
273{
274 unsigned pioc, pin, id;
275
276 if (banks > 4)
277 banks = 4;
278 for (pioc = 0, pin = PIN_BASE, id = AT91_ID_PIOA;
279 pioc < banks;
280 pioc++, id++) {
281 void __iomem *controller;
282 unsigned i;
283
284 controller = (void __iomem *) AT91_VA_BASE_SYS + pio_controller_offset[pioc];
285 __raw_writel(~0, controller + PIO_IDR);
286
287 set_irq_data(id, (void *) pin);
288 set_irq_chipdata(id, (void __force *) controller);
289
290 for (i = 0; i < 32; i++, pin++) {
291 set_irq_chip(pin, &gpio_irqchip);
292 set_irq_handler(pin, do_simple_IRQ);
293 set_irq_flags(pin, IRQF_VALID);
294 }
295
296 set_irq_chained_handler(id, gpio_irq_handler);
297
298 /* enable the PIO peripheral clock */
299 at91_sys_write(AT91_PMC_PCER, 1 << id);
300 }
301 pr_info("AT91: %d gpio irqs in %d banks\n", pin - PIN_BASE, banks);
302}
diff --git a/arch/arm/mach-at91rm9200/irq.c b/arch/arm/mach-at91rm9200/irq.c
new file mode 100644
index 000000000000..cb62bc83a1dd
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/irq.c
@@ -0,0 +1,170 @@
1/*
2 * linux/arch/arm/mach-at91rm9200/irq.c
3 *
4 * Copyright (C) 2004 SAN People
5 * Copyright (C) 2004 ATMEL
6 * Copyright (C) Rick Bronson
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23#include <linux/config.h>
24#include <linux/init.h>
25#include <linux/module.h>
26#include <linux/mm.h>
27#include <linux/types.h>
28
29#include <asm/hardware.h>
30#include <asm/irq.h>
31#include <asm/mach-types.h>
32#include <asm/setup.h>
33
34#include <asm/mach/arch.h>
35#include <asm/mach/irq.h>
36#include <asm/mach/map.h>
37
38#include "generic.h"
39
40/*
41 * The default interrupt priority levels (0 = lowest, 7 = highest).
42 */
43static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = {
44 7, /* Advanced Interrupt Controller */
45 7, /* System Peripheral */
46 0, /* Parallel IO Controller A */
47 0, /* Parallel IO Controller B */
48 0, /* Parallel IO Controller C */
49 0, /* Parallel IO Controller D */
50 6, /* USART 0 */
51 6, /* USART 1 */
52 6, /* USART 2 */
53 6, /* USART 3 */
54 0, /* Multimedia Card Interface */
55 4, /* USB Device Port */
56 0, /* Two-Wire Interface */
57 6, /* Serial Peripheral Interface */
58 5, /* Serial Synchronous Controller */
59 5, /* Serial Synchronous Controller */
60 5, /* Serial Synchronous Controller */
61 0, /* Timer Counter 0 */
62 0, /* Timer Counter 1 */
63 0, /* Timer Counter 2 */
64 0, /* Timer Counter 3 */
65 0, /* Timer Counter 4 */
66 0, /* Timer Counter 5 */
67 3, /* USB Host port */
68 3, /* Ethernet MAC */
69 0, /* Advanced Interrupt Controller */
70 0, /* Advanced Interrupt Controller */
71 0, /* Advanced Interrupt Controller */
72 0, /* Advanced Interrupt Controller */
73 0, /* Advanced Interrupt Controller */
74 0, /* Advanced Interrupt Controller */
75 0 /* Advanced Interrupt Controller */
76};
77
78
79static void at91rm9200_mask_irq(unsigned int irq)
80{
81 /* Disable interrupt on AIC */
82 at91_sys_write(AT91_AIC_IDCR, 1 << irq);
83}
84
85static void at91rm9200_unmask_irq(unsigned int irq)
86{
87 /* Enable interrupt on AIC */
88 at91_sys_write(AT91_AIC_IECR, 1 << irq);
89}
90
91static int at91rm9200_irq_type(unsigned irq, unsigned type)
92{
93 unsigned int smr, srctype;
94
95 /* change triggering only for FIQ and external IRQ0..IRQ6 */
96 if ((irq < AT91_ID_IRQ0) && (irq != AT91_ID_FIQ))
97 return -EINVAL;
98
99 switch (type) {
100 case IRQT_HIGH:
101 srctype = AT91_AIC_SRCTYPE_HIGH;
102 break;
103 case IRQT_RISING:
104 srctype = AT91_AIC_SRCTYPE_RISING;
105 break;
106 case IRQT_LOW:
107 srctype = AT91_AIC_SRCTYPE_LOW;
108 break;
109 case IRQT_FALLING:
110 srctype = AT91_AIC_SRCTYPE_FALLING;
111 break;
112 default:
113 return -EINVAL;
114 }
115
116 smr = at91_sys_read(AT91_AIC_SMR(irq)) & ~AT91_AIC_SRCTYPE;
117 at91_sys_write(AT91_AIC_SMR(irq), smr | srctype);
118 return 0;
119}
120
121static struct irqchip at91rm9200_irq_chip = {
122 .ack = at91rm9200_mask_irq,
123 .mask = at91rm9200_mask_irq,
124 .unmask = at91rm9200_unmask_irq,
125 .set_type = at91rm9200_irq_type,
126};
127
128/*
129 * Initialize the AIC interrupt controller.
130 */
131void __init at91rm9200_init_irq(unsigned int priority[NR_AIC_IRQS])
132{
133 unsigned int i;
134
135 /* No priority list specified for this board -> use defaults */
136 if (priority == NULL)
137 priority = at91rm9200_default_irq_priority;
138
139 /*
140 * The IVR is used by macro get_irqnr_and_base to read and verify.
141 * The irq number is NR_AIC_IRQS when a spurious interrupt has occurred.
142 */
143 for (i = 0; i < NR_AIC_IRQS; i++) {
144 /* Put irq number in Source Vector Register: */
145 at91_sys_write(AT91_AIC_SVR(i), i);
146 /* Store the Source Mode Register as defined in table above */
147 at91_sys_write(AT91_AIC_SMR(i), AT91_AIC_SRCTYPE_LOW | priority[i]);
148
149 set_irq_chip(i, &at91rm9200_irq_chip);
150 set_irq_handler(i, do_level_IRQ);
151 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
152
153 /* Perform 8 End Of Interrupt Command to make sure AIC will not Lock out nIRQ */
154 if (i < 8)
155 at91_sys_write(AT91_AIC_EOICR, 0);
156 }
157
158 /*
159 * Spurious Interrupt ID in Spurious Vector Register is NR_AIC_IRQS
160 * When there is no current interrupt, the IRQ Vector Register reads the value stored in AIC_SPU
161 */
162 at91_sys_write(AT91_AIC_SPU, NR_AIC_IRQS);
163
164 /* No debugging in AIC: Debug (Protect) Control Register */
165 at91_sys_write(AT91_AIC_DCR, 0);
166
167 /* Disable and clear all interrupts initially */
168 at91_sys_write(AT91_AIC_IDCR, 0xFFFFFFFF);
169 at91_sys_write(AT91_AIC_ICCR, 0xFFFFFFFF);
170}
diff --git a/arch/arm/mach-at91rm9200/time.c b/arch/arm/mach-at91rm9200/time.c
new file mode 100644
index 000000000000..1b6dd2deeb22
--- /dev/null
+++ b/arch/arm/mach-at91rm9200/time.c
@@ -0,0 +1,127 @@
1/*
2 * linux/arch/arm/mach-at91rm9200/time.c
3 *
4 * Copyright (C) 2003 SAN People
5 * Copyright (C) 2003 ATMEL
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/config.h>
23#include <linux/init.h>
24#include <linux/interrupt.h>
25#include <linux/kernel.h>
26#include <linux/sched.h>
27#include <linux/time.h>
28
29#include <asm/hardware.h>
30#include <asm/io.h>
31#include <asm/irq.h>
32#include <asm/mach/time.h>
33
34/*
35 * The ST_CRTR is updated asynchronously to the master clock. It is therefore
36 * necessary to read it twice (with the same value) to ensure accuracy.
37 */
38static inline unsigned long read_CRTR(void) {
39 unsigned long x1, x2;
40
41 do {
42 x1 = at91_sys_read(AT91_ST_CRTR);
43 x2 = at91_sys_read(AT91_ST_CRTR);
44 } while (x1 != x2);
45
46 return x1;
47}
48
49/*
50 * Returns number of microseconds since last timer interrupt. Note that interrupts
51 * will have been disabled by do_gettimeofday()
52 * 'LATCH' is hwclock ticks (see CLOCK_TICK_RATE in timex.h) per jiffy.
53 * 'tick' is usecs per jiffy (linux/timex.h).
54 */
55static unsigned long at91rm9200_gettimeoffset(void)
56{
57 unsigned long elapsed;
58
59 elapsed = (read_CRTR() - at91_sys_read(AT91_ST_RTAR)) & AT91_ST_ALMV;
60
61 return (unsigned long)(elapsed * (tick_nsec / 1000)) / LATCH;
62}
63
64/*
65 * IRQ handler for the timer.
66 */
67static irqreturn_t at91rm9200_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
68{
69 unsigned long rtar;
70
71 if (at91_sys_read(AT91_ST_SR) & AT91_ST_PITS) { /* This is a shared interrupt */
72 write_seqlock(&xtime_lock);
73
74 do {
75 timer_tick(regs);
76 rtar = (at91_sys_read(AT91_ST_RTAR) + LATCH) & AT91_ST_ALMV;
77 at91_sys_write(AT91_ST_RTAR, rtar);
78 } while (((read_CRTR() - at91_sys_read(AT91_ST_RTAR)) & AT91_ST_ALMV) >= LATCH);
79
80 write_sequnlock(&xtime_lock);
81
82 return IRQ_HANDLED;
83 }
84 else
85 return IRQ_NONE; /* not handled */
86}
87
88static struct irqaction at91rm9200_timer_irq = {
89 .name = "at91_tick",
90 .flags = SA_SHIRQ | SA_INTERRUPT,
91 .handler = at91rm9200_timer_interrupt
92};
93
94/*
95 * Set up timer interrupt.
96 */
97void __init at91rm9200_timer_init(void)
98{
99 /* Disable all timer interrupts */
100 at91_sys_write(AT91_ST_IDR, AT91_ST_PITS | AT91_ST_WDOVF | AT91_ST_RTTINC | AT91_ST_ALMS);
101 (void) at91_sys_read(AT91_ST_SR); /* Clear any pending interrupts */
102
103 /*
104 * Make IRQs happen for the system timer.
105 */
106 setup_irq(AT91_ID_SYS, &at91rm9200_timer_irq);
107
108 /* Set initial alarm to 0 */
109 at91_sys_write(AT91_ST_RTAR, 0);
110
111 /* Real time counter incremented every 30.51758 microseconds */
112 at91_sys_write(AT91_ST_RTMR, 1);
113
114 /* Set Period Interval timer */
115 at91_sys_write(AT91_ST_PIMR, LATCH);
116
117 /* Change the kernel's 'tick' value to 10009 usec. (the default is 10000) */
118 tick_usec = (LATCH * 1000000) / CLOCK_TICK_RATE;
119
120 /* Enable Period Interval Timer interrupt */
121 at91_sys_write(AT91_ST_IER, AT91_ST_PITS);
122}
123
124struct sys_timer at91rm9200_timer = {
125 .init = at91rm9200_timer_init,
126 .offset = at91rm9200_gettimeoffset,
127};
diff --git a/arch/arm/mach-clps711x/autcpu12.c b/arch/arm/mach-clps711x/autcpu12.c
index 43b9423d1440..c13ca6c56baa 100644
--- a/arch/arm/mach-clps711x/autcpu12.c
+++ b/arch/arm/mach-clps711x/autcpu12.c
@@ -64,7 +64,6 @@ void __init autcpu12_map_io(void)
64 64
65MACHINE_START(AUTCPU12, "autronix autcpu12") 65MACHINE_START(AUTCPU12, "autronix autcpu12")
66 /* Maintainer: Thomas Gleixner */ 66 /* Maintainer: Thomas Gleixner */
67 .phys_ram = 0xc0000000,
68 .phys_io = 0x80000000, 67 .phys_io = 0x80000000,
69 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, 68 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc,
70 .boot_params = 0xc0020000, 69 .boot_params = 0xc0020000,
diff --git a/arch/arm/mach-clps711x/cdb89712.c b/arch/arm/mach-clps711x/cdb89712.c
index cba7be5a06c3..831df007f6c7 100644
--- a/arch/arm/mach-clps711x/cdb89712.c
+++ b/arch/arm/mach-clps711x/cdb89712.c
@@ -55,7 +55,6 @@ static void __init cdb89712_map_io(void)
55 55
56MACHINE_START(CDB89712, "Cirrus-CDB89712") 56MACHINE_START(CDB89712, "Cirrus-CDB89712")
57 /* Maintainer: Ray Lehtiniemi */ 57 /* Maintainer: Ray Lehtiniemi */
58 .phys_ram = 0xc0000000,
59 .phys_io = 0x80000000, 58 .phys_io = 0x80000000,
60 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, 59 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc,
61 .boot_params = 0xc0000100, 60 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-clps711x/ceiva.c b/arch/arm/mach-clps711x/ceiva.c
index 35d51a759b59..e2b2c5ac8a83 100644
--- a/arch/arm/mach-clps711x/ceiva.c
+++ b/arch/arm/mach-clps711x/ceiva.c
@@ -56,7 +56,6 @@ static void __init ceiva_map_io(void)
56 56
57MACHINE_START(CEIVA, "CEIVA/Polaroid Photo MAX Digital Picture Frame") 57MACHINE_START(CEIVA, "CEIVA/Polaroid Photo MAX Digital Picture Frame")
58 /* Maintainer: Rob Scott */ 58 /* Maintainer: Rob Scott */
59 .phys_ram = 0xc0000000,
60 .phys_io = 0x80000000, 59 .phys_io = 0x80000000,
61 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, 60 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc,
62 .boot_params = 0xc0000100, 61 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c
index c83f3fd68fcd..09fb57e45213 100644
--- a/arch/arm/mach-clps711x/clep7312.c
+++ b/arch/arm/mach-clps711x/clep7312.c
@@ -38,7 +38,6 @@ fixup_clep7312(struct machine_desc *desc, struct tag *tags,
38 38
39MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312") 39MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
40 /* Maintainer: Nobody */ 40 /* Maintainer: Nobody */
41 .phys_ram = 0xc0000000,
42 .phys_io = 0x80000000, 41 .phys_io = 0x80000000,
43 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, 42 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc,
44 .boot_params = 0xc0000100, 43 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-clps711x/dma.c b/arch/arm/mach-clps711x/dma.c
deleted file mode 100644
index af5a4de38eac..000000000000
--- a/arch/arm/mach-clps711x/dma.c
+++ /dev/null
@@ -1,27 +0,0 @@
1/*
2 * linux/arch/arm/mach-clps711x/dma.c
3 *
4 * Copyright (C) 2000 Deep Blue Solutions Ltd
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21
22#include <asm/dma.h>
23#include <asm/mach/dma.h>
24
25void __init arch_dma_init(dma_t *dma)
26{
27}
diff --git a/arch/arm/mach-clps711x/edb7211-arch.c b/arch/arm/mach-clps711x/edb7211-arch.c
index 255c98b63e15..dc81cc68595d 100644
--- a/arch/arm/mach-clps711x/edb7211-arch.c
+++ b/arch/arm/mach-clps711x/edb7211-arch.c
@@ -52,7 +52,6 @@ fixup_edb7211(struct machine_desc *desc, struct tag *tags,
52 52
53MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)") 53MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
54 /* Maintainer: Jon McClintock */ 54 /* Maintainer: Jon McClintock */
55 .phys_ram = 0xc0000000,
56 .phys_io = 0x80000000, 55 .phys_io = 0x80000000,
57 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, 56 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc,
58 .boot_params = 0xc0020100, /* 0xc0000000 - 0xc001ffff can be video RAM */ 57 .boot_params = 0xc0020100, /* 0xc0000000 - 0xc001ffff can be video RAM */
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c
index 3d88da0c287b..ff26a85aa4ba 100644
--- a/arch/arm/mach-clps711x/fortunet.c
+++ b/arch/arm/mach-clps711x/fortunet.c
@@ -78,7 +78,6 @@ fortunet_fixup(struct machine_desc *desc, struct tag *tags,
78 78
79MACHINE_START(FORTUNET, "ARM-FortuNet") 79MACHINE_START(FORTUNET, "ARM-FortuNet")
80 /* Maintainer: FortuNet Inc. */ 80 /* Maintainer: FortuNet Inc. */
81 .phys_ram = 0xc0000000,
82 .phys_io = 0x80000000, 81 .phys_io = 0x80000000,
83 .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, 82 .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc,
84 .boot_params = 0x00000000, 83 .boot_params = 0x00000000,
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c
index a1acb945fb51..9ba45f4d5a7e 100644
--- a/arch/arm/mach-clps711x/p720t.c
+++ b/arch/arm/mach-clps711x/p720t.c
@@ -90,7 +90,6 @@ static void __init p720t_map_io(void)
90 90
91MACHINE_START(P720T, "ARM-Prospector720T") 91MACHINE_START(P720T, "ARM-Prospector720T")
92 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 92 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
93 .phys_ram = 0xc0000000,
94 .phys_io = 0x80000000, 93 .phys_io = 0x80000000,
95 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc, 94 .io_pg_offst = ((0xff000000) >> 18) & 0xfffc,
96 .boot_params = 0xc0000100, 95 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-clps7500/core.c b/arch/arm/mach-clps7500/core.c
index d869af0023f8..5b12cab0e691 100644
--- a/arch/arm/mach-clps7500/core.c
+++ b/arch/arm/mach-clps7500/core.c
@@ -384,7 +384,6 @@ static void __init clps7500_init(void)
384 384
385MACHINE_START(CLPS7500, "CL-PS7500") 385MACHINE_START(CLPS7500, "CL-PS7500")
386 /* Maintainer: Philip Blundell */ 386 /* Maintainer: Philip Blundell */
387 .phys_ram = 0x10000000,
388 .phys_io = 0x03000000, 387 .phys_io = 0x03000000,
389 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, 388 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
390 .map_io = clps7500_map_io, 389 .map_io = clps7500_map_io,
diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c
index ed4614983adb..6d620d8268cc 100644
--- a/arch/arm/mach-ebsa110/core.c
+++ b/arch/arm/mach-ebsa110/core.c
@@ -284,7 +284,6 @@ arch_initcall(ebsa110_init);
284 284
285MACHINE_START(EBSA110, "EBSA110") 285MACHINE_START(EBSA110, "EBSA110")
286 /* Maintainer: Russell King */ 286 /* Maintainer: Russell King */
287 .phys_ram = 0x00000000,
288 .phys_io = 0xe0000000, 287 .phys_io = 0xe0000000,
289 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, 288 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
290 .boot_params = 0x00000400, 289 .boot_params = 0x00000400,
diff --git a/arch/arm/mach-epxa10db/Kconfig b/arch/arm/mach-epxa10db/Kconfig
deleted file mode 100644
index 55d896dd4950..000000000000
--- a/arch/arm/mach-epxa10db/Kconfig
+++ /dev/null
@@ -1,23 +0,0 @@
1if ARCH_CAMELOT
2
3menu "Epxa10db"
4
5comment "PLD hotswap support"
6
7config PLD
8 bool
9 default y
10
11config PLD_HOTSWAP
12 bool "Support for PLD device hotplugging (experimental)"
13 depends on EXPERIMENTAL
14 help
15 This enables support for the dynamic loading and configuration of
16 compatible drivers when the contents of the PLD are changed. This
17 is still experimental and requires configuration tools which are
18 not yet generally available. Say N here. You must enable the kernel
19 module loader for this feature to work.
20
21endmenu
22
23endif
diff --git a/arch/arm/mach-epxa10db/Makefile b/arch/arm/mach-epxa10db/Makefile
deleted file mode 100644
index 24fbd7d3a3c1..000000000000
--- a/arch/arm/mach-epxa10db/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7obj-y := arch.o irq.o mm.o time.o
8obj-m :=
9obj-n :=
10obj- :=
11
diff --git a/arch/arm/mach-epxa10db/Makefile.boot b/arch/arm/mach-epxa10db/Makefile.boot
deleted file mode 100644
index 28bec7d3fc88..000000000000
--- a/arch/arm/mach-epxa10db/Makefile.boot
+++ /dev/null
@@ -1,2 +0,0 @@
1 zreladdr-y := 0x00008000
2
diff --git a/arch/arm/mach-epxa10db/arch.c b/arch/arm/mach-epxa10db/arch.c
deleted file mode 100644
index 44c56571d183..000000000000
--- a/arch/arm/mach-epxa10db/arch.c
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * linux/arch/arm/mach-epxa10db/arch.c
3 *
4 * Copyright (C) 2000 Deep Blue Solutions Ltd
5 * Copyright (C) 2001 Altera Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/types.h>
22#include <linux/init.h>
23#include <linux/serial_8250.h>
24
25#include <asm/hardware.h>
26#include <asm/setup.h>
27#include <asm/mach-types.h>
28
29#include <asm/mach/arch.h>
30
31static struct plat_serial8250_port serial_platform_data[] = {
32 {
33 .iobase = 0x3f8,
34 .irq = IRQ_UARTINT0,
35#error FIXME
36 .uartclk = 0,
37 .regshift = 0,
38 .iotype = UPIO_PORT,
39 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
40 },
41 {
42 .iobase = 0x2f8,
43 .irq = IRQ_UARTINT1,
44#error FIXME
45 .uartclk = 0,
46 .regshift = 0,
47 .iotype = UPIO_PORT,
48 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
49 },
50 { },
51};
52
53static struct platform_device serial_device = {
54 .name = "serial8250",
55 .id = PLAT8250_DEV_PLATFORM,
56 .dev = {
57 .platform_data = serial_platform_data,
58 },
59};
60
61extern void epxa10db_map_io(void);
62extern void epxa10db_init_irq(void);
63extern struct sys_timer epxa10db_timer;
64
65MACHINE_START(CAMELOT, "Altera Epxa10db")
66 /* Maintainer: Altera Corporation */
67 .phys_ram = 0x00000000,
68 .phys_io = 0x7fffc000,
69 .io_pg_offst = ((0xffffc000) >> 18) & 0xfffc,
70 .map_io = epxa10db_map_io,
71 .init_irq = epxa10db_init_irq,
72 .timer = &epxa10db_timer,
73MACHINE_END
74
diff --git a/arch/arm/mach-epxa10db/dma.c b/arch/arm/mach-epxa10db/dma.c
deleted file mode 100644
index 0151e9f1c066..000000000000
--- a/arch/arm/mach-epxa10db/dma.c
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * linux/arch/arm/mach-epxa10db/dma.c
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/init.h>
22
23#include <asm/dma.h>
24#include <asm/mach/dma.h>
25
26void __init arch_dma_init(dma_t *dma)
27{
28}
diff --git a/arch/arm/mach-epxa10db/irq.c b/arch/arm/mach-epxa10db/irq.c
deleted file mode 100644
index 9bf927e13309..000000000000
--- a/arch/arm/mach-epxa10db/irq.c
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * linux/arch/arm/mach-epxa10db/irq.c
3 *
4 * Copyright (C) 2001 Altera 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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20#include <linux/init.h>
21#include <linux/ioport.h>
22#include <linux/stddef.h>
23#include <linux/timer.h>
24#include <linux/list.h>
25#include <asm/io.h>
26#include <asm/hardware.h>
27#include <asm/irq.h>
28#include <asm/mach/irq.h>
29#include <asm/arch/platform.h>
30#include <asm/arch/int_ctrl00.h>
31
32
33static void epxa_mask_irq(unsigned int irq)
34{
35 writel(1 << irq, INT_MC(IO_ADDRESS(EXC_INT_CTRL00_BASE)));
36}
37
38static void epxa_unmask_irq(unsigned int irq)
39{
40 writel(1 << irq, INT_MS(IO_ADDRESS(EXC_INT_CTRL00_BASE)));
41}
42
43
44static struct irqchip epxa_irq_chip = {
45 .ack = epxa_mask_irq,
46 .mask = epxa_mask_irq,
47 .unmask = epxa_unmask_irq,
48};
49
50static struct resource irq_resource = {
51 .name = "irq_handler",
52 .start = IO_ADDRESS(EXC_INT_CTRL00_BASE),
53 .end = IO_ADDRESS(INT_PRIORITY_FC(EXC_INT_CTRL00_BASE))+4,
54};
55
56void __init epxa10db_init_irq(void)
57{
58 unsigned int i;
59
60 request_resource(&iomem_resource, &irq_resource);
61
62 /*
63 * This bit sets up the interrupt controller using
64 * the 6 PLD interrupts mode (the default) each
65 * irqs is assigned a priority which is the same
66 * as its interrupt number. This scheme is used because
67 * its easy, but you may want to change it depending
68 * on the contents of your PLD
69 */
70
71 writel(3,INT_MODE(IO_ADDRESS(EXC_INT_CTRL00_BASE)));
72 for (i = 0; i < NR_IRQS; i++){
73 writel(i+1, INT_PRIORITY_P0(IO_ADDRESS(EXC_INT_CTRL00_BASE)) + (4*i));
74 set_irq_chip(i,&epxa_irq_chip);
75 set_irq_handler(i,do_level_IRQ);
76 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
77 }
78
79 /* Disable all interrupts */
80 writel(-1,INT_MC(IO_ADDRESS(EXC_INT_CTRL00_BASE)));
81
82}
diff --git a/arch/arm/mach-epxa10db/mm.c b/arch/arm/mach-epxa10db/mm.c
deleted file mode 100644
index cfd0d2182d44..000000000000
--- a/arch/arm/mach-epxa10db/mm.c
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * linux/arch/arm/mach-epxa10db/mm.c
3 *
4 * MM routines for Altera'a Epxa10db board
5 *
6 * Copyright (C) 2001 Altera Corporation
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22#include <linux/kernel.h>
23#include <linux/init.h>
24
25#include <asm/hardware.h>
26#include <asm/io.h>
27#include <asm/sizes.h>
28#include <asm/page.h>
29
30#include <asm/mach/map.h>
31
32/* Page table mapping for I/O region */
33
34static struct map_desc epxa10db_io_desc[] __initdata = {
35 {
36 .virtual = IO_ADDRESS(EXC_REGISTERS_BASE),
37 .pfn = __phys_to_pfn(EXC_REGISTERS_BASE),
38 .length = SZ_16K,
39 .type = MT_DEVICE
40 }, {
41 .virtual = IO_ADDRESS(EXC_PLD_BLOCK0_BASE),
42 .pfn = __phys_to_pfn(EXC_PLD_BLOCK0_BASE),
43 .length = SZ_16K,
44 .type = MT_DEVICE
45 }, {
46 .virtual = IO_ADDRESS(EXC_PLD_BLOCK1_BASE),
47 .pfn =__phys_to_pfn(EXC_PLD_BLOCK1_BASE),
48 .length = SZ_16K,
49 .type = MT_DEVICE
50 }, {
51 .virtual = IO_ADDRESS(EXC_PLD_BLOCK2_BASE),
52 .physical = __phys_to_pfn(EXC_PLD_BLOCK2_BASE),
53 .length = SZ_16K,
54 .type = MT_DEVICE
55 }, {
56 .virtual = IO_ADDRESS(EXC_PLD_BLOCK3_BASE),
57 .pfn = __phys_to_pfn(EXC_PLD_BLOCK3_BASE),
58 .length = SZ_16K,
59 .type = MT_DEVICE
60 }, {
61 .virtual = FLASH_VADDR(EXC_EBI_BLOCK0_BASE),
62 .pfn = __phys_to_pfn(EXC_EBI_BLOCK0_BASE),
63 .length = SZ_16M,
64 .type = MT_DEVICE
65 }
66};
67
68void __init epxa10db_map_io(void)
69{
70 iotable_init(epxa10db_io_desc, ARRAY_SIZE(epxa10db_io_desc));
71}
diff --git a/arch/arm/mach-epxa10db/time.c b/arch/arm/mach-epxa10db/time.c
deleted file mode 100644
index 4b1084dde8dd..000000000000
--- a/arch/arm/mach-epxa10db/time.c
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * linux/arch/arm/mach-epxa10db/time.c
3 *
4 * Copyright (C) 2000 Deep Blue Solutions
5 * Copyright (C) 2001 Altera Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/kernel.h>
12#include <linux/init.h>
13#include <linux/interrupt.h>
14#include <linux/sched.h>
15
16#include <asm/hardware.h>
17#include <asm/system.h>
18#include <asm/leds.h>
19
20#include <asm/mach/time.h>
21
22#define TIMER00_TYPE (volatile unsigned int*)
23#include <asm/arch/timer00.h>
24
25static int epxa10db_set_rtc(void)
26{
27 return 1;
28}
29
30static int epxa10db_rtc_init(void)
31{
32 set_rtc = epxa10db_set_rtc;
33
34 return 0;
35}
36
37__initcall(epxa10db_rtc_init);
38
39
40/*
41 * IRQ handler for the timer
42 */
43static irqreturn_t
44epxa10db_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
45{
46 write_seqlock(&xtime_lock);
47
48 // ...clear the interrupt
49 *TIMER0_CR(IO_ADDRESS(EXC_TIMER00_BASE))|=TIMER0_CR_CI_MSK;
50
51 timer_tick(regs);
52 write_sequnlock(&xtime_lock);
53
54 return IRQ_HANDLED;
55}
56
57static struct irqaction epxa10db_timer_irq = {
58 .name = "Excalibur Timer Tick",
59 .flags = SA_INTERRUPT | SA_TIMER,
60 .handler = epxa10db_timer_interrupt,
61};
62
63/*
64 * Set up timer interrupt, and return the current time in seconds.
65 */
66static void __init epxa10db_timer_init(void)
67{
68 /* Start the timer */
69 *TIMER0_LIMIT(IO_ADDRESS(EXC_TIMER00_BASE))=(unsigned int)(EXC_AHB2_CLK_FREQUENCY/200);
70 *TIMER0_PRESCALE(IO_ADDRESS(EXC_TIMER00_BASE))=1;
71 *TIMER0_CR(IO_ADDRESS(EXC_TIMER00_BASE))=TIMER0_CR_IE_MSK | TIMER0_CR_S_MSK;
72
73 setup_irq(IRQ_TIMER0, &epxa10db_timer_irq);
74}
75
76struct sys_timer epxa10db_timer = {
77 .init = epxa10db_timer_init,
78};
diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c
index 49b898af0032..5b64d5c5b967 100644
--- a/arch/arm/mach-footbridge/cats-hw.c
+++ b/arch/arm/mach-footbridge/cats-hw.c
@@ -85,7 +85,6 @@ fixup_cats(struct machine_desc *desc, struct tag *tags,
85 85
86MACHINE_START(CATS, "Chalice-CATS") 86MACHINE_START(CATS, "Chalice-CATS")
87 /* Maintainer: Philip Blundell */ 87 /* Maintainer: Philip Blundell */
88 .phys_ram = 0x00000000,
89 .phys_io = DC21285_ARMCSR_BASE, 88 .phys_io = DC21285_ARMCSR_BASE,
90 .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, 89 .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc,
91 .boot_params = 0x00000100, 90 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-footbridge/co285.c b/arch/arm/mach-footbridge/co285.c
index 548a79081688..4545576ad8d9 100644
--- a/arch/arm/mach-footbridge/co285.c
+++ b/arch/arm/mach-footbridge/co285.c
@@ -29,7 +29,6 @@ fixup_coebsa285(struct machine_desc *desc, struct tag *tags,
29 29
30MACHINE_START(CO285, "co-EBSA285") 30MACHINE_START(CO285, "co-EBSA285")
31 /* Maintainer: Mark van Doesburg */ 31 /* Maintainer: Mark van Doesburg */
32 .phys_ram = 0x00000000,
33 .phys_io = DC21285_ARMCSR_BASE, 32 .phys_io = DC21285_ARMCSR_BASE,
34 .io_pg_offst = ((0x7cf00000) >> 18) & 0xfffc, 33 .io_pg_offst = ((0x7cf00000) >> 18) & 0xfffc,
35 .fixup = fixup_coebsa285, 34 .fixup = fixup_coebsa285,
diff --git a/arch/arm/mach-footbridge/dma.c b/arch/arm/mach-footbridge/dma.c
index a6b1396b0951..7a54578b51af 100644
--- a/arch/arm/mach-footbridge/dma.c
+++ b/arch/arm/mach-footbridge/dma.c
@@ -15,6 +15,7 @@
15 15
16#include <asm/dma.h> 16#include <asm/dma.h>
17#include <asm/io.h> 17#include <asm/io.h>
18#include <asm/scatterlist.h>
18 19
19#include <asm/mach/dma.h> 20#include <asm/mach/dma.h>
20#include <asm/hardware/dec21285.h> 21#include <asm/hardware/dec21285.h>
diff --git a/arch/arm/mach-footbridge/ebsa285.c b/arch/arm/mach-footbridge/ebsa285.c
index 1c37605268d5..b1d3bf20a41e 100644
--- a/arch/arm/mach-footbridge/ebsa285.c
+++ b/arch/arm/mach-footbridge/ebsa285.c
@@ -14,7 +14,6 @@
14 14
15MACHINE_START(EBSA285, "EBSA285") 15MACHINE_START(EBSA285, "EBSA285")
16 /* Maintainer: Russell King */ 16 /* Maintainer: Russell King */
17 .phys_ram = 0x00000000,
18 .phys_io = DC21285_ARMCSR_BASE, 17 .phys_io = DC21285_ARMCSR_BASE,
19 .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, 18 .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc,
20 .boot_params = 0x00000100, 19 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c
index 775f85fc8513..229bf0585e40 100644
--- a/arch/arm/mach-footbridge/netwinder-hw.c
+++ b/arch/arm/mach-footbridge/netwinder-hw.c
@@ -601,6 +601,7 @@ EXPORT_SYMBOL(gpio_lock);
601EXPORT_SYMBOL(gpio_modify_op); 601EXPORT_SYMBOL(gpio_modify_op);
602EXPORT_SYMBOL(gpio_modify_io); 602EXPORT_SYMBOL(gpio_modify_io);
603EXPORT_SYMBOL(cpld_modify); 603EXPORT_SYMBOL(cpld_modify);
604EXPORT_SYMBOL(gpio_read);
604 605
605/* 606/*
606 * Initialise any other hardware after we've got the PCI bus 607 * Initialise any other hardware after we've got the PCI bus
@@ -648,7 +649,6 @@ fixup_netwinder(struct machine_desc *desc, struct tag *tags,
648 649
649MACHINE_START(NETWINDER, "Rebel-NetWinder") 650MACHINE_START(NETWINDER, "Rebel-NetWinder")
650 /* Maintainer: Russell King/Rebel.com */ 651 /* Maintainer: Russell King/Rebel.com */
651 .phys_ram = 0x00000000,
652 .phys_io = DC21285_ARMCSR_BASE, 652 .phys_io = DC21285_ARMCSR_BASE,
653 .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, 653 .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc,
654 .boot_params = 0x00000100, 654 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-footbridge/personal.c b/arch/arm/mach-footbridge/personal.c
index 0146b8bb59da..c4f843fc099d 100644
--- a/arch/arm/mach-footbridge/personal.c
+++ b/arch/arm/mach-footbridge/personal.c
@@ -14,7 +14,6 @@
14 14
15MACHINE_START(PERSONAL_SERVER, "Compaq-PersonalServer") 15MACHINE_START(PERSONAL_SERVER, "Compaq-PersonalServer")
16 /* Maintainer: Jamey Hicks / George France */ 16 /* Maintainer: Jamey Hicks / George France */
17 .phys_ram = 0x00000000,
18 .phys_io = DC21285_ARMCSR_BASE, 17 .phys_io = DC21285_ARMCSR_BASE,
19 .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc, 18 .io_pg_offst = ((0xfe000000) >> 18) & 0xfffc,
20 .boot_params = 0x00000100, 19 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-h720x/h7201-eval.c b/arch/arm/mach-h720x/h7201-eval.c
index fa59e9e2a5c8..193f968edac3 100644
--- a/arch/arm/mach-h720x/h7201-eval.c
+++ b/arch/arm/mach-h720x/h7201-eval.c
@@ -31,7 +31,6 @@
31 31
32MACHINE_START(H7201, "Hynix GMS30C7201") 32MACHINE_START(H7201, "Hynix GMS30C7201")
33 /* Maintainer: Robert Schwebel, Pengutronix */ 33 /* Maintainer: Robert Schwebel, Pengutronix */
34 .phys_ram = 0x40000000,
35 .phys_io = 0x80000000, 34 .phys_io = 0x80000000,
36 .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, 35 .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc,
37 .boot_params = 0xc0001000, 36 .boot_params = 0xc0001000,
diff --git a/arch/arm/mach-h720x/h7202-eval.c b/arch/arm/mach-h720x/h7202-eval.c
index d75c8221d2a5..36266896979c 100644
--- a/arch/arm/mach-h720x/h7202-eval.c
+++ b/arch/arm/mach-h720x/h7202-eval.c
@@ -72,7 +72,6 @@ static void __init init_eval_h7202(void)
72 72
73MACHINE_START(H7202, "Hynix HMS30C7202") 73MACHINE_START(H7202, "Hynix HMS30C7202")
74 /* Maintainer: Robert Schwebel, Pengutronix */ 74 /* Maintainer: Robert Schwebel, Pengutronix */
75 .phys_ram = 0x40000000,
76 .phys_io = 0x80000000, 75 .phys_io = 0x80000000,
77 .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc, 76 .io_pg_offst = ((0xf0000000) >> 18) & 0xfffc,
78 .boot_params = 0x40000100, 77 .boot_params = 0x40000100,
diff --git a/arch/arm/mach-imx/mx1ads.c b/arch/arm/mach-imx/mx1ads.c
index 708e1b3faa14..dc31e3fd6c57 100644
--- a/arch/arm/mach-imx/mx1ads.c
+++ b/arch/arm/mach-imx/mx1ads.c
@@ -29,27 +29,27 @@
29#include "generic.h" 29#include "generic.h"
30#include <asm/serial.h> 30#include <asm/serial.h>
31 31
32static struct resource mx1ads_resources[] = { 32static struct resource cs89x0_resources[] = {
33 [0] = { 33 [0] = {
34 .start = IMX_CS4_VIRT, 34 .start = IMX_CS4_PHYS + 0x300,
35 .end = IMX_CS4_VIRT + 16, 35 .end = IMX_CS4_PHYS + 0x300 + 16,
36 .flags = IORESOURCE_MEM, 36 .flags = IORESOURCE_MEM,
37 }, 37 },
38 [1] = { 38 [1] = {
39 .start = 13, 39 .start = IRQ_GPIOC(17),
40 .end = 13, 40 .end = IRQ_GPIOC(17),
41 .flags = IORESOURCE_IRQ, 41 .flags = IORESOURCE_IRQ,
42 }, 42 },
43}; 43};
44 44
45static struct platform_device mx1ads_device = { 45static struct platform_device cs89x0_device = {
46 .name = "mx1ads", 46 .name = "cirrus-cs89x0",
47 .num_resources = ARRAY_SIZE(mx1ads_resources), 47 .num_resources = ARRAY_SIZE(cs89x0_resources),
48 .resource = mx1ads_resources, 48 .resource = cs89x0_resources,
49}; 49};
50 50
51static struct platform_device *devices[] __initdata = { 51static struct platform_device *devices[] __initdata = {
52 &mx1ads_device, 52 &cs89x0_device,
53}; 53};
54 54
55static void __init 55static void __init
@@ -61,50 +61,14 @@ mx1ads_init(void)
61 platform_add_devices(devices, ARRAY_SIZE(devices)); 61 platform_add_devices(devices, ARRAY_SIZE(devices));
62} 62}
63 63
64static struct map_desc mx1ads_io_desc[] __initdata = {
65 {
66 .virtual = IMX_CS0_VIRT,
67 .pfn = __phys_to_pfn(IMX_CS0_PHYS),
68 .length = IMX_CS0_SIZE,
69 .type = MT_DEVICE
70 }, {
71 .virtual = IMX_CS1_VIRT,
72 .pfn = __phys_to_pfn(IMX_CS1_PHYS),
73 .length = IMX_CS1_SIZE,
74 .type = MT_DEVICE
75 }, {
76 .virtual = IMX_CS2_VIRT,
77 .pfn = __phys_to_pfn(IMX_CS2_PHYS),
78 .length = IMX_CS2_SIZE,
79 .type = MT_DEVICE
80 }, {
81 .virtual = IMX_CS3_VIRT,
82 .pfn = __phys_to_pfn(IMX_CS3_PHYS),
83 .length = IMX_CS3_SIZE,
84 .type = MT_DEVICE
85 }, {
86 .virtual = IMX_CS4_VIRT,
87 .pfn = __phys_to_pfn(IMX_CS4_PHYS),
88 .length = IMX_CS4_SIZE,
89 .type = MT_DEVICE
90 }, {
91 .virtual = IMX_CS5_VIRT,
92 .pfn = __phys_to_pfn(IMX_CS5_PHYS),
93 .length = IMX_CS5_SIZE,
94 .type = MT_DEVICE
95 }
96};
97
98static void __init 64static void __init
99mx1ads_map_io(void) 65mx1ads_map_io(void)
100{ 66{
101 imx_map_io(); 67 imx_map_io();
102 iotable_init(mx1ads_io_desc, ARRAY_SIZE(mx1ads_io_desc));
103} 68}
104 69
105MACHINE_START(MX1ADS, "Motorola MX1ADS") 70MACHINE_START(MX1ADS, "Motorola MX1ADS")
106 /* Maintainer: Sascha Hauer, Pengutronix */ 71 /* Maintainer: Sascha Hauer, Pengutronix */
107 .phys_ram = 0x08000000,
108 .phys_io = 0x00200000, 72 .phys_io = 0x00200000,
109 .io_pg_offst = ((0xe0200000) >> 18) & 0xfffc, 73 .io_pg_offst = ((0xe0200000) >> 18) & 0xfffc,
110 .boot_params = 0x08000100, 74 .boot_params = 0x08000100,
diff --git a/arch/arm/mach-integrator/clock.c b/arch/arm/mach-integrator/clock.c
index 73c360685cad..95a1e263f7fa 100644
--- a/arch/arm/mach-integrator/clock.c
+++ b/arch/arm/mach-integrator/clock.c
@@ -14,28 +14,29 @@
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/clk.h>
18#include <linux/mutex.h>
17 19
18#include <asm/semaphore.h> 20#include <asm/semaphore.h>
19#include <asm/hardware/clock.h>
20#include <asm/hardware/icst525.h> 21#include <asm/hardware/icst525.h>
21 22
22#include "clock.h" 23#include "clock.h"
23 24
24static LIST_HEAD(clocks); 25static LIST_HEAD(clocks);
25static DECLARE_MUTEX(clocks_sem); 26static DEFINE_MUTEX(clocks_mutex);
26 27
27struct clk *clk_get(struct device *dev, const char *id) 28struct clk *clk_get(struct device *dev, const char *id)
28{ 29{
29 struct clk *p, *clk = ERR_PTR(-ENOENT); 30 struct clk *p, *clk = ERR_PTR(-ENOENT);
30 31
31 down(&clocks_sem); 32 mutex_lock(&clocks_mutex);
32 list_for_each_entry(p, &clocks, node) { 33 list_for_each_entry(p, &clocks, node) {
33 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 34 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
34 clk = p; 35 clk = p;
35 break; 36 break;
36 } 37 }
37 } 38 }
38 up(&clocks_sem); 39 mutex_unlock(&clocks_mutex);
39 40
40 return clk; 41 return clk;
41} 42}
@@ -58,17 +59,6 @@ void clk_disable(struct clk *clk)
58} 59}
59EXPORT_SYMBOL(clk_disable); 60EXPORT_SYMBOL(clk_disable);
60 61
61int clk_use(struct clk *clk)
62{
63 return 0;
64}
65EXPORT_SYMBOL(clk_use);
66
67void clk_unuse(struct clk *clk)
68{
69}
70EXPORT_SYMBOL(clk_unuse);
71
72unsigned long clk_get_rate(struct clk *clk) 62unsigned long clk_get_rate(struct clk *clk)
73{ 63{
74 return clk->rate; 64 return clk->rate;
@@ -118,18 +108,18 @@ static struct clk uart_clk = {
118 108
119int clk_register(struct clk *clk) 109int clk_register(struct clk *clk)
120{ 110{
121 down(&clocks_sem); 111 mutex_lock(&clocks_mutex);
122 list_add(&clk->node, &clocks); 112 list_add(&clk->node, &clocks);
123 up(&clocks_sem); 113 mutex_unlock(&clocks_mutex);
124 return 0; 114 return 0;
125} 115}
126EXPORT_SYMBOL(clk_register); 116EXPORT_SYMBOL(clk_register);
127 117
128void clk_unregister(struct clk *clk) 118void clk_unregister(struct clk *clk)
129{ 119{
130 down(&clocks_sem); 120 mutex_lock(&clocks_mutex);
131 list_del(&clk->node); 121 list_del(&clk->node);
132 up(&clocks_sem); 122 mutex_unlock(&clocks_mutex);
133} 123}
134EXPORT_SYMBOL(clk_unregister); 124EXPORT_SYMBOL(clk_unregister);
135 125
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index dacbf504dae2..20071a2767cc 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -15,11 +15,11 @@
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/sched.h> 16#include <linux/sched.h>
17#include <linux/smp.h> 17#include <linux/smp.h>
18#include <linux/amba/bus.h>
18 19
19#include <asm/hardware.h> 20#include <asm/hardware.h>
20#include <asm/irq.h> 21#include <asm/irq.h>
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/hardware/amba.h>
23#include <asm/hardware/arm_timer.h> 23#include <asm/hardware/arm_timer.h>
24#include <asm/arch/cm.h> 24#include <asm/arch/cm.h>
25#include <asm/system.h> 25#include <asm/system.h>
diff --git a/arch/arm/mach-integrator/dma.c b/arch/arm/mach-integrator/dma.c
deleted file mode 100644
index aae6f23cd72b..000000000000
--- a/arch/arm/mach-integrator/dma.c
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * linux/arch/arm/mach-integrator/dma.c
3 *
4 * Copyright (C) 1999 ARM Limited
5 * Copyright (C) 2000 Deep Blue Solutions Ltd
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21#include <linux/slab.h>
22#include <linux/mman.h>
23#include <linux/init.h>
24
25#include <asm/page.h>
26#include <asm/pgtable.h>
27#include <asm/dma.h>
28#include <asm/io.h>
29#include <asm/hardware.h>
30
31#include <asm/mach/dma.h>
32
33void __init arch_dma_init(dma_t *dma)
34{
35}
diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c
index a4bafee77a06..a85d471c5bfa 100644
--- a/arch/arm/mach-integrator/impd1.c
+++ b/arch/arm/mach-integrator/impd1.c
@@ -18,11 +18,11 @@
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/mm.h> 20#include <linux/mm.h>
21#include <linux/amba/bus.h>
22#include <linux/amba/clcd.h>
21 23
22#include <asm/io.h> 24#include <asm/io.h>
23#include <asm/hardware/icst525.h> 25#include <asm/hardware/icst525.h>
24#include <asm/hardware/amba.h>
25#include <asm/hardware/amba_clcd.h>
26#include <asm/arch/lm.h> 26#include <asm/arch/lm.h>
27#include <asm/arch/impd1.h> 27#include <asm/arch/impd1.h>
28#include <asm/sizes.h> 28#include <asm/sizes.h>
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 4c0f7c65facf..d8d3c2a5a97e 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -25,6 +25,8 @@
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/string.h> 26#include <linux/string.h>
27#include <linux/sysdev.h> 27#include <linux/sysdev.h>
28#include <linux/amba/bus.h>
29#include <linux/amba/kmi.h>
28 30
29#include <asm/hardware.h> 31#include <asm/hardware.h>
30#include <asm/io.h> 32#include <asm/io.h>
@@ -32,8 +34,6 @@
32#include <asm/setup.h> 34#include <asm/setup.h>
33#include <asm/param.h> /* HZ */ 35#include <asm/param.h> /* HZ */
34#include <asm/mach-types.h> 36#include <asm/mach-types.h>
35#include <asm/hardware/amba.h>
36#include <asm/hardware/amba_kmi.h>
37 37
38#include <asm/arch/lm.h> 38#include <asm/arch/lm.h>
39 39
@@ -347,7 +347,6 @@ static struct sys_timer ap_timer = {
347 347
348MACHINE_START(INTEGRATOR, "ARM-Integrator") 348MACHINE_START(INTEGRATOR, "ARM-Integrator")
349 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 349 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
350 .phys_ram = 0x00000000,
351 .phys_io = 0x16000000, 350 .phys_io = 0x16000000,
352 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, 351 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc,
353 .boot_params = 0x00000100, 352 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index 93f7ccb22c27..31820170f306 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -16,15 +16,15 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/string.h> 17#include <linux/string.h>
18#include <linux/sysdev.h> 18#include <linux/sysdev.h>
19#include <linux/amba/bus.h>
20#include <linux/amba/kmi.h>
21#include <linux/amba/clcd.h>
19 22
20#include <asm/hardware.h> 23#include <asm/hardware.h>
21#include <asm/io.h> 24#include <asm/io.h>
22#include <asm/irq.h> 25#include <asm/irq.h>
23#include <asm/setup.h> 26#include <asm/setup.h>
24#include <asm/mach-types.h> 27#include <asm/mach-types.h>
25#include <asm/hardware/amba.h>
26#include <asm/hardware/amba_kmi.h>
27#include <asm/hardware/amba_clcd.h>
28#include <asm/hardware/icst525.h> 28#include <asm/hardware/icst525.h>
29 29
30#include <asm/arch/cm.h> 30#include <asm/arch/cm.h>
@@ -578,7 +578,6 @@ static struct sys_timer cp_timer = {
578 578
579MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP") 579MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
580 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 580 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
581 .phys_ram = 0x00000000,
582 .phys_io = 0x16000000, 581 .phys_io = 0x16000000,
583 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, 582 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc,
584 .boot_params = 0x00000100, 583 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-integrator/lm.c b/arch/arm/mach-integrator/lm.c
index 5b41e3a724e1..622cdc4212dd 100644
--- a/arch/arm/mach-integrator/lm.c
+++ b/arch/arm/mach-integrator/lm.c
@@ -22,20 +22,6 @@ static int lm_match(struct device *dev, struct device_driver *drv)
22 return 1; 22 return 1;
23} 23}
24 24
25static struct bus_type lm_bustype = {
26 .name = "logicmodule",
27 .match = lm_match,
28// .suspend = lm_suspend,
29// .resume = lm_resume,
30};
31
32static int __init lm_init(void)
33{
34 return bus_register(&lm_bustype);
35}
36
37postcore_initcall(lm_init);
38
39static int lm_bus_probe(struct device *dev) 25static int lm_bus_probe(struct device *dev)
40{ 26{
41 struct lm_device *lmdev = to_lm_device(dev); 27 struct lm_device *lmdev = to_lm_device(dev);
@@ -49,16 +35,30 @@ static int lm_bus_remove(struct device *dev)
49 struct lm_device *lmdev = to_lm_device(dev); 35 struct lm_device *lmdev = to_lm_device(dev);
50 struct lm_driver *lmdrv = to_lm_driver(dev->driver); 36 struct lm_driver *lmdrv = to_lm_driver(dev->driver);
51 37
52 lmdrv->remove(lmdev); 38 if (lmdrv->remove)
39 lmdrv->remove(lmdev);
53 return 0; 40 return 0;
54} 41}
55 42
43static struct bus_type lm_bustype = {
44 .name = "logicmodule",
45 .match = lm_match,
46 .probe = lm_bus_probe,
47 .remove = lm_bus_remove,
48// .suspend = lm_bus_suspend,
49// .resume = lm_bus_resume,
50};
51
52static int __init lm_init(void)
53{
54 return bus_register(&lm_bustype);
55}
56
57postcore_initcall(lm_init);
58
56int lm_driver_register(struct lm_driver *drv) 59int lm_driver_register(struct lm_driver *drv)
57{ 60{
58 drv->drv.bus = &lm_bustype; 61 drv->drv.bus = &lm_bustype;
59 drv->drv.probe = lm_bus_probe;
60 drv->drv.remove = lm_bus_remove;
61
62 return driver_register(&drv->drv); 62 return driver_register(&drv->drv);
63} 63}
64 64
diff --git a/arch/arm/mach-integrator/time.c b/arch/arm/mach-integrator/time.c
index 1a844ca139e0..3c22c16b38bf 100644
--- a/arch/arm/mach-integrator/time.c
+++ b/arch/arm/mach-integrator/time.c
@@ -14,8 +14,8 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/amba/bus.h>
17 18
18#include <asm/hardware/amba.h>
19#include <asm/hardware.h> 19#include <asm/hardware.h>
20#include <asm/io.h> 20#include <asm/io.h>
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
@@ -96,7 +96,8 @@ static struct rtc_ops rtc_ops = {
96 .set_alarm = rtc_set_alarm, 96 .set_alarm = rtc_set_alarm,
97}; 97};
98 98
99static irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs) 99static irqreturn_t arm_rtc_interrupt(int irq, void *dev_id,
100 struct pt_regs *regs)
100{ 101{
101 writel(0, rtc_base + RTC_EOI); 102 writel(0, rtc_base + RTC_EOI);
102 return IRQ_HANDLED; 103 return IRQ_HANDLED;
@@ -124,7 +125,7 @@ static int rtc_probe(struct amba_device *dev, void *id)
124 125
125 xtime.tv_sec = __raw_readl(rtc_base + RTC_DR); 126 xtime.tv_sec = __raw_readl(rtc_base + RTC_DR);
126 127
127 ret = request_irq(dev->irq[0], rtc_interrupt, SA_INTERRUPT, 128 ret = request_irq(dev->irq[0], arm_rtc_interrupt, SA_INTERRUPT,
128 "rtc-pl030", dev); 129 "rtc-pl030", dev);
129 if (ret) 130 if (ret)
130 goto map_out; 131 goto map_out;
diff --git a/arch/arm/mach-iop3xx/iop321-setup.c b/arch/arm/mach-iop3xx/iop321-setup.c
index 80770233b8d4..e4f4c52d93d4 100644
--- a/arch/arm/mach-iop3xx/iop321-setup.c
+++ b/arch/arm/mach-iop3xx/iop321-setup.c
@@ -151,7 +151,6 @@ extern void iop321_init_time(void);
151#if defined(CONFIG_ARCH_IQ80321) 151#if defined(CONFIG_ARCH_IQ80321)
152MACHINE_START(IQ80321, "Intel IQ80321") 152MACHINE_START(IQ80321, "Intel IQ80321")
153 /* Maintainer: Intel Corporation */ 153 /* Maintainer: Intel Corporation */
154 .phys_ram = PHYS_OFFSET,
155 .phys_io = IQ80321_UART, 154 .phys_io = IQ80321_UART,
156 .io_pg_offst = ((IQ80321_UART) >> 18) & 0xfffc, 155 .io_pg_offst = ((IQ80321_UART) >> 18) & 0xfffc,
157 .map_io = iq80321_map_io, 156 .map_io = iq80321_map_io,
@@ -163,7 +162,6 @@ MACHINE_END
163#elif defined(CONFIG_ARCH_IQ31244) 162#elif defined(CONFIG_ARCH_IQ31244)
164MACHINE_START(IQ31244, "Intel IQ31244") 163MACHINE_START(IQ31244, "Intel IQ31244")
165 /* Maintainer: Intel Corp. */ 164 /* Maintainer: Intel Corp. */
166 .phys_ram = PHYS_OFFSET,
167 .phys_io = IQ31244_UART, 165 .phys_io = IQ31244_UART,
168 .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc, 166 .io_pg_offst = ((IQ31244_UART) >> 18) & 0xfffc,
169 .map_io = iq31244_map_io, 167 .map_io = iq31244_map_io,
diff --git a/arch/arm/mach-iop3xx/iop331-setup.c b/arch/arm/mach-iop3xx/iop331-setup.c
index 53f60614498b..63585485123e 100644
--- a/arch/arm/mach-iop3xx/iop331-setup.c
+++ b/arch/arm/mach-iop3xx/iop331-setup.c
@@ -18,7 +18,7 @@
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/serial.h> 19#include <linux/serial.h>
20#include <linux/tty.h> 20#include <linux/tty.h>
21#include <linux/serial_core.h> 21#include <linux/serial_8250.h>
22 22
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
@@ -50,32 +50,74 @@ static struct map_desc iop331_std_desc[] __initdata = {
50 } 50 }
51}; 51};
52 52
53static struct uart_port iop331_serial_ports[] = { 53static struct resource iop33x_uart0_resources[] = {
54 { 54 [0] = {
55 .membase = (char*)(IOP331_UART0_VIRT), 55 .start = IOP331_UART0_PHYS,
56 .mapbase = (IOP331_UART0_PHYS), 56 .end = IOP331_UART0_PHYS + 0x3f,
57 .irq = IRQ_IOP331_UART0, 57 .flags = IORESOURCE_MEM,
58 .flags = UPF_SKIP_TEST, 58 },
59 .iotype = UPIO_MEM, 59 [1] = {
60 .regshift = 2, 60 .start = IRQ_IOP331_UART0,
61 .uartclk = IOP331_UART_XTAL, 61 .end = IRQ_IOP331_UART0,
62 .line = 0, 62 .flags = IORESOURCE_IRQ
63 .type = PORT_XSCALE, 63 }
64 .fifosize = 32 64};
65 } , { 65
66 .membase = (char*)(IOP331_UART1_VIRT), 66static struct resource iop33x_uart1_resources[] = {
67 .mapbase = (IOP331_UART1_PHYS), 67 [0] = {
68 .irq = IRQ_IOP331_UART1, 68 .start = IOP331_UART1_PHYS,
69 .flags = UPF_SKIP_TEST, 69 .end = IOP331_UART1_PHYS + 0x3f,
70 .iotype = UPIO_MEM, 70 .flags = IORESOURCE_MEM,
71 .regshift = 2, 71 },
72 .uartclk = IOP331_UART_XTAL, 72 [1] = {
73 .line = 1, 73 .start = IRQ_IOP331_UART1,
74 .type = PORT_XSCALE, 74 .end = IRQ_IOP331_UART1,
75 .fifosize = 32 75 .flags = IORESOURCE_IRQ
76 } 76 }
77}; 77};
78 78
79static struct plat_serial8250_port iop33x_uart0_data[] = {
80 {
81 .membase = (char*)(IOP331_UART0_VIRT),
82 .mapbase = (IOP331_UART0_PHYS),
83 .irq = IRQ_IOP331_UART0,
84 .uartclk = IOP331_UART_XTAL,
85 .regshift = 2,
86 .iotype = UPIO_MEM,
87 .flags = UPF_SKIP_TEST,
88 },
89 { },
90};
91
92static struct plat_serial8250_port iop33x_uart1_data[] = {
93 {
94 .membase = (char*)(IOP331_UART1_VIRT),
95 .mapbase = (IOP331_UART1_PHYS),
96 .irq = IRQ_IOP331_UART1,
97 .uartclk = IOP331_UART_XTAL,
98 .regshift = 2,
99 .iotype = UPIO_MEM,
100 .flags = UPF_SKIP_TEST,
101 },
102 { },
103};
104
105static struct platform_device iop33x_uart0 = {
106 .name = "serial8250",
107 .id = 0,
108 .dev.platform_data = iop33x_uart0_data,
109 .num_resources = 2,
110 .resource = iop33x_uart0_resources,
111};
112
113static struct platform_device iop33x_uart1 = {
114 .name = "serial8250",
115 .id = 1,
116 .dev.platform_data = iop33x_uart1_data,
117 .num_resources = 2,
118 .resource = iop33x_uart1_resources,
119};
120
79static struct resource iop33x_i2c_0_resources[] = { 121static struct resource iop33x_i2c_0_resources[] = {
80 [0] = { 122 [0] = {
81 .start = 0xfffff680, 123 .start = 0xfffff680,
@@ -117,6 +159,8 @@ static struct platform_device iop33x_i2c_1_controller = {
117}; 159};
118 160
119static struct platform_device *iop33x_devices[] __initdata = { 161static struct platform_device *iop33x_devices[] __initdata = {
162 &iop33x_uart0,
163 &iop33x_uart1,
120 &iop33x_i2c_0_controller, 164 &iop33x_i2c_0_controller,
121 &iop33x_i2c_1_controller 165 &iop33x_i2c_1_controller
122}; 166};
@@ -133,8 +177,6 @@ void __init iop33x_init(void)
133void __init iop331_map_io(void) 177void __init iop331_map_io(void)
134{ 178{
135 iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc)); 179 iotable_init(iop331_std_desc, ARRAY_SIZE(iop331_std_desc));
136 early_serial_setup(&iop331_serial_ports[0]);
137 early_serial_setup(&iop331_serial_ports[1]);
138} 180}
139 181
140#ifdef CONFIG_ARCH_IOP331 182#ifdef CONFIG_ARCH_IOP331
@@ -153,7 +195,6 @@ extern void iq80332_map_io(void);
153#if defined(CONFIG_ARCH_IQ80331) 195#if defined(CONFIG_ARCH_IQ80331)
154MACHINE_START(IQ80331, "Intel IQ80331") 196MACHINE_START(IQ80331, "Intel IQ80331")
155 /* Maintainer: Intel Corp. */ 197 /* Maintainer: Intel Corp. */
156 .phys_ram = PHYS_OFFSET,
157 .phys_io = 0xfefff000, 198 .phys_io = 0xfefff000,
158 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical 199 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
159 .map_io = iq80331_map_io, 200 .map_io = iq80331_map_io,
@@ -166,7 +207,6 @@ MACHINE_END
166#elif defined(CONFIG_MACH_IQ80332) 207#elif defined(CONFIG_MACH_IQ80332)
167MACHINE_START(IQ80332, "Intel IQ80332") 208MACHINE_START(IQ80332, "Intel IQ80332")
168 /* Maintainer: Intel Corp. */ 209 /* Maintainer: Intel Corp. */
169 .phys_ram = PHYS_OFFSET,
170 .phys_io = 0xfefff000, 210 .phys_io = 0xfefff000,
171 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical 211 .io_pg_offst = ((0xfffff000) >> 18) & 0xfffc, // virtual, physical
172 .map_io = iq80332_map_io, 212 .map_io = iq80332_map_io,
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index 6851abaf5524..cfd5bef3190b 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -106,6 +106,16 @@ static struct map_desc ixp2000_io_desc[] __initdata = {
106 .length = IXP2000_MSF_SIZE, 106 .length = IXP2000_MSF_SIZE,
107 .type = MT_IXP2000_DEVICE, 107 .type = MT_IXP2000_DEVICE,
108 }, { 108 }, {
109 .virtual = IXP2000_SCRATCH_RING_VIRT_BASE,
110 .pfn = __phys_to_pfn(IXP2000_SCRATCH_RING_PHYS_BASE),
111 .length = IXP2000_SCRATCH_RING_SIZE,
112 .type = MT_IXP2000_DEVICE,
113 }, {
114 .virtual = IXP2000_SRAM0_VIRT_BASE,
115 .pfn = __phys_to_pfn(IXP2000_SRAM0_PHYS_BASE),
116 .length = IXP2000_SRAM0_SIZE,
117 .type = MT_IXP2000_DEVICE,
118 }, {
109 .virtual = IXP2000_PCI_IO_VIRT_BASE, 119 .virtual = IXP2000_PCI_IO_VIRT_BASE,
110 .pfn = __phys_to_pfn(IXP2000_PCI_IO_PHYS_BASE), 120 .pfn = __phys_to_pfn(IXP2000_PCI_IO_PHYS_BASE),
111 .length = IXP2000_PCI_IO_SIZE, 121 .length = IXP2000_PCI_IO_SIZE,
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c
index 61f6006241bd..9e5a13bb39d0 100644
--- a/arch/arm/mach-ixp2000/enp2611.c
+++ b/arch/arm/mach-ixp2000/enp2611.c
@@ -254,7 +254,6 @@ static void __init enp2611_init_machine(void)
254 254
255MACHINE_START(ENP2611, "Radisys ENP-2611 PCI network processor board") 255MACHINE_START(ENP2611, "Radisys ENP-2611 PCI network processor board")
256 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */ 256 /* Maintainer: Lennert Buytenhek <buytenh@wantstofly.org> */
257 .phys_ram = 0x00000000,
258 .phys_io = IXP2000_UART_PHYS_BASE, 257 .phys_io = IXP2000_UART_PHYS_BASE,
259 .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, 258 .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc,
260 .boot_params = 0x00000100, 259 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-ixp2000/ixdp2400.c b/arch/arm/mach-ixp2000/ixdp2400.c
index fd280a93637e..7c782403042a 100644
--- a/arch/arm/mach-ixp2000/ixdp2400.c
+++ b/arch/arm/mach-ixp2000/ixdp2400.c
@@ -169,7 +169,6 @@ void ixdp2400_init_irq(void)
169 169
170MACHINE_START(IXDP2400, "Intel IXDP2400 Development Platform") 170MACHINE_START(IXDP2400, "Intel IXDP2400 Development Platform")
171 /* Maintainer: MontaVista Software, Inc. */ 171 /* Maintainer: MontaVista Software, Inc. */
172 .phys_ram = 0x00000000,
173 .phys_io = IXP2000_UART_PHYS_BASE, 172 .phys_io = IXP2000_UART_PHYS_BASE,
174 .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, 173 .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc,
175 .boot_params = 0x00000100, 174 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-ixp2000/ixdp2800.c b/arch/arm/mach-ixp2000/ixdp2800.c
index f9073aa28615..076e3f8acc96 100644
--- a/arch/arm/mach-ixp2000/ixdp2800.c
+++ b/arch/arm/mach-ixp2000/ixdp2800.c
@@ -285,7 +285,6 @@ void ixdp2800_init_irq(void)
285 285
286MACHINE_START(IXDP2800, "Intel IXDP2800 Development Platform") 286MACHINE_START(IXDP2800, "Intel IXDP2800 Development Platform")
287 /* Maintainer: MontaVista Software, Inc. */ 287 /* Maintainer: MontaVista Software, Inc. */
288 .phys_ram = 0x00000000,
289 .phys_io = IXP2000_UART_PHYS_BASE, 288 .phys_io = IXP2000_UART_PHYS_BASE,
290 .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, 289 .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc,
291 .boot_params = 0x00000100, 290 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c
index e6a882f35da2..10f06606d460 100644
--- a/arch/arm/mach-ixp2000/ixdp2x01.c
+++ b/arch/arm/mach-ixp2000/ixdp2x01.c
@@ -376,7 +376,6 @@ static void __init ixdp2x01_init_machine(void)
376#ifdef CONFIG_ARCH_IXDP2401 376#ifdef CONFIG_ARCH_IXDP2401
377MACHINE_START(IXDP2401, "Intel IXDP2401 Development Platform") 377MACHINE_START(IXDP2401, "Intel IXDP2401 Development Platform")
378 /* Maintainer: MontaVista Software, Inc. */ 378 /* Maintainer: MontaVista Software, Inc. */
379 .phys_ram = 0x00000000,
380 .phys_io = IXP2000_UART_PHYS_BASE, 379 .phys_io = IXP2000_UART_PHYS_BASE,
381 .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, 380 .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc,
382 .boot_params = 0x00000100, 381 .boot_params = 0x00000100,
@@ -390,7 +389,6 @@ MACHINE_END
390#ifdef CONFIG_ARCH_IXDP2801 389#ifdef CONFIG_ARCH_IXDP2801
391MACHINE_START(IXDP2801, "Intel IXDP2801 Development Platform") 390MACHINE_START(IXDP2801, "Intel IXDP2801 Development Platform")
392 /* Maintainer: MontaVista Software, Inc. */ 391 /* Maintainer: MontaVista Software, Inc. */
393 .phys_ram = 0x00000000,
394 .phys_io = IXP2000_UART_PHYS_BASE, 392 .phys_io = IXP2000_UART_PHYS_BASE,
395 .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc, 393 .io_pg_offst = ((IXP2000_UART_VIRT_BASE) >> 18) & 0xfffc,
396 .boot_params = 0x00000100, 394 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-ixp4xx/Kconfig b/arch/arm/mach-ixp4xx/Kconfig
index 385285851cb5..daadc78e271b 100644
--- a/arch/arm/mach-ixp4xx/Kconfig
+++ b/arch/arm/mach-ixp4xx/Kconfig
@@ -71,6 +71,14 @@ config ARCH_PRPMC1100
71 PrPCM1100 Processor Mezanine Module. For more information on 71 PrPCM1100 Processor Mezanine Module. For more information on
72 this platform, see <file:Documentation/arm/IXP4xx>. 72 this platform, see <file:Documentation/arm/IXP4xx>.
73 73
74config MACH_NAS100D
75 bool
76 prompt "NAS100D"
77 help
78 Say 'Y' here if you want your kernel to support Iomega's
79 NAS 100d device. For more information on this platform,
80 see http://www.nslu2-linux.org/wiki/NAS100d/HomePage
81
74# 82#
75# Avila and IXDP share the same source for now. Will change in future 83# Avila and IXDP share the same source for now. Will change in future
76# 84#
diff --git a/arch/arm/mach-ixp4xx/Makefile b/arch/arm/mach-ixp4xx/Makefile
index 7a15629c18d0..0471044fa179 100644
--- a/arch/arm/mach-ixp4xx/Makefile
+++ b/arch/arm/mach-ixp4xx/Makefile
@@ -9,4 +9,5 @@ obj-$(CONFIG_MACH_IXDPG425) += ixdpg425-pci.o coyote-setup.o
9obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o 9obj-$(CONFIG_ARCH_ADI_COYOTE) += coyote-pci.o coyote-setup.o
10obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o gtwx5715-setup.o 10obj-$(CONFIG_MACH_GTWX5715) += gtwx5715-pci.o gtwx5715-setup.o
11obj-$(CONFIG_MACH_NSLU2) += nslu2-pci.o nslu2-setup.o nslu2-power.o 11obj-$(CONFIG_MACH_NSLU2) += nslu2-pci.o nslu2-setup.o nslu2-power.o
12obj-$(CONFIG_MACH_NAS100D) += nas100d-pci.o nas100d-setup.o nas100d-power.o
12 13
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 9795da270e3a..6e3462ed5306 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -341,6 +341,29 @@ int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
341 return (dev->bus == &pci_bus_type ) && ((dma_addr + size) >= SZ_64M); 341 return (dev->bus == &pci_bus_type ) && ((dma_addr + size) >= SZ_64M);
342} 342}
343 343
344/*
345 * Only first 64MB of memory can be accessed via PCI.
346 * We use GFP_DMA to allocate safe buffers to do map/unmap.
347 * This is really ugly and we need a better way of specifying
348 * DMA-capable regions of memory.
349 */
350void __init ixp4xx_adjust_zones(int node, unsigned long *zone_size,
351 unsigned long *zhole_size)
352{
353 unsigned int sz = SZ_64M >> PAGE_SHIFT;
354
355 /*
356 * Only adjust if > 64M on current system
357 */
358 if (node || (zone_size[0] <= sz))
359 return;
360
361 zone_size[1] = zone_size[0] - sz;
362 zone_size[0] = sz;
363 zhole_size[1] = zhole_size[0];
364 zhole_size[0] = 0;
365}
366
344void __init ixp4xx_pci_preinit(void) 367void __init ixp4xx_pci_preinit(void)
345{ 368{
346 unsigned long processor_id; 369 unsigned long processor_id;
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c
index f3c687cf0071..4bdc9d4526cd 100644
--- a/arch/arm/mach-ixp4xx/common.c
+++ b/arch/arm/mach-ixp4xx/common.c
@@ -142,6 +142,8 @@ static int ixp4xx_set_irq_type(unsigned int irq, unsigned int type)
142 *int_reg &= ~(IXP4XX_GPIO_STYLE_CLEAR << 142 *int_reg &= ~(IXP4XX_GPIO_STYLE_CLEAR <<
143 (line * IXP4XX_GPIO_STYLE_SIZE)); 143 (line * IXP4XX_GPIO_STYLE_SIZE));
144 144
145 *IXP4XX_GPIO_GPISR = (1 << line);
146
145 /* Set the new style */ 147 /* Set the new style */
146 *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE)); 148 *int_reg |= (int_style << (line * IXP4XX_GPIO_STYLE_SIZE));
147 149
@@ -169,7 +171,7 @@ static void ixp4xx_irq_ack(unsigned int irq)
169 int line = (irq < 32) ? irq2gpio[irq] : -1; 171 int line = (irq < 32) ? irq2gpio[irq] : -1;
170 172
171 if (line >= 0) 173 if (line >= 0)
172 gpio_line_isr_clear(line); 174 *IXP4XX_GPIO_GPISR = (1 << line);
173} 175}
174 176
175/* 177/*
@@ -330,11 +332,28 @@ static struct platform_device *ixp46x_devices[] __initdata = {
330 &ixp46x_i2c_controller 332 &ixp46x_i2c_controller
331}; 333};
332 334
335unsigned long ixp4xx_exp_bus_size;
336EXPORT_SYMBOL(ixp4xx_exp_bus_size);
337
333void __init ixp4xx_sys_init(void) 338void __init ixp4xx_sys_init(void)
334{ 339{
340 ixp4xx_exp_bus_size = SZ_16M;
341
335 if (cpu_is_ixp46x()) { 342 if (cpu_is_ixp46x()) {
343 int region;
344
336 platform_add_devices(ixp46x_devices, 345 platform_add_devices(ixp46x_devices,
337 ARRAY_SIZE(ixp46x_devices)); 346 ARRAY_SIZE(ixp46x_devices));
347
348 for (region = 0; region < 7; region++) {
349 if((*(IXP4XX_EXP_REG(0x4 * region)) & 0x200)) {
350 ixp4xx_exp_bus_size = SZ_32M;
351 break;
352 }
353 }
338 } 354 }
355
356 printk("IXP4xx: Using %luMiB expansion bus window size\n",
357 ixp4xx_exp_bus_size >> 20);
339} 358}
340 359
diff --git a/arch/arm/mach-ixp4xx/coyote-pci.c b/arch/arm/mach-ixp4xx/coyote-pci.c
index 60de8a94cff5..e6b7fcd923fa 100644
--- a/arch/arm/mach-ixp4xx/coyote-pci.c
+++ b/arch/arm/mach-ixp4xx/coyote-pci.c
@@ -33,9 +33,6 @@ void __init coyote_pci_preinit(void)
33 set_irq_type(IRQ_COYOTE_PCI_SLOT0, IRQT_LOW); 33 set_irq_type(IRQ_COYOTE_PCI_SLOT0, IRQT_LOW);
34 set_irq_type(IRQ_COYOTE_PCI_SLOT1, IRQT_LOW); 34 set_irq_type(IRQ_COYOTE_PCI_SLOT1, IRQT_LOW);
35 35
36 gpio_line_isr_clear(COYOTE_PCI_SLOT0_PIN);
37 gpio_line_isr_clear(COYOTE_PCI_SLOT1_PIN);
38
39 ixp4xx_pci_preinit(); 36 ixp4xx_pci_preinit();
40} 37}
41 38
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index 050c92768913..13f8a7ac3ba9 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -14,6 +14,7 @@
14#include <linux/serial.h> 14#include <linux/serial.h>
15#include <linux/tty.h> 15#include <linux/tty.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/slab.h>
17 18
18#include <asm/types.h> 19#include <asm/types.h>
19#include <asm/setup.h> 20#include <asm/setup.h>
@@ -30,8 +31,6 @@ static struct flash_platform_data coyote_flash_data = {
30}; 31};
31 32
32static struct resource coyote_flash_resource = { 33static struct resource coyote_flash_resource = {
33 .start = COYOTE_FLASH_BASE,
34 .end = COYOTE_FLASH_BASE + COYOTE_FLASH_SIZE - 1,
35 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
36}; 35};
37 36
@@ -81,6 +80,11 @@ static struct platform_device *coyote_devices[] __initdata = {
81 80
82static void __init coyote_init(void) 81static void __init coyote_init(void)
83{ 82{
83 ixp4xx_sys_init();
84
85 coyote_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
86 coyote_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_32M - 1;
87
84 *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE; 88 *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
85 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; 89 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
86 90
@@ -91,15 +95,12 @@ static void __init coyote_init(void)
91 coyote_uart_data[0].irq = IRQ_IXP4XX_UART1; 95 coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
92 } 96 }
93 97
94
95 ixp4xx_sys_init();
96 platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices)); 98 platform_add_devices(coyote_devices, ARRAY_SIZE(coyote_devices));
97} 99}
98 100
99#ifdef CONFIG_ARCH_ADI_COYOTE 101#ifdef CONFIG_ARCH_ADI_COYOTE
100MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote") 102MACHINE_START(ADI_COYOTE, "ADI Engineering Coyote")
101 /* Maintainer: MontaVista Software, Inc. */ 103 /* Maintainer: MontaVista Software, Inc. */
102 .phys_ram = PHYS_OFFSET,
103 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, 104 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
104 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, 105 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
105 .map_io = ixp4xx_map_io, 106 .map_io = ixp4xx_map_io,
@@ -117,7 +118,6 @@ MACHINE_END
117#ifdef CONFIG_MACH_IXDPG425 118#ifdef CONFIG_MACH_IXDPG425
118MACHINE_START(IXDPG425, "Intel IXDPG425") 119MACHINE_START(IXDPG425, "Intel IXDPG425")
119 /* Maintainer: MontaVista Software, Inc. */ 120 /* Maintainer: MontaVista Software, Inc. */
120 .phys_ram = PHYS_OFFSET,
121 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, 121 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
122 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, 122 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
123 .map_io = ixp4xx_map_io, 123 .map_io = ixp4xx_map_io,
diff --git a/arch/arm/mach-ixp4xx/gtwx5715-setup.c b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
index 29a6d02fa851..654e2eed81fb 100644
--- a/arch/arm/mach-ixp4xx/gtwx5715-setup.c
+++ b/arch/arm/mach-ixp4xx/gtwx5715-setup.c
@@ -27,6 +27,7 @@
27#include <linux/serial.h> 27#include <linux/serial.h>
28#include <linux/tty.h> 28#include <linux/tty.h>
29#include <linux/serial_8250.h> 29#include <linux/serial_8250.h>
30#include <linux/slab.h>
30 31
31#include <asm/types.h> 32#include <asm/types.h>
32#include <asm/setup.h> 33#include <asm/setup.h>
@@ -106,11 +107,9 @@ static struct flash_platform_data gtwx5715_flash_data = {
106 .width = 2, 107 .width = 2,
107}; 108};
108 109
109static struct resource gtwx5715_flash_resource = { 110static struct gtw5715_flash_resource = {
110 .start = GTWX5715_FLASH_BASE,
111 .end = GTWX5715_FLASH_BASE + GTWX5715_FLASH_SIZE - 1,
112 .flags = IORESOURCE_MEM, 111 .flags = IORESOURCE_MEM,
113}; 112}
114 113
115static struct platform_device gtwx5715_flash = { 114static struct platform_device gtwx5715_flash = {
116 .name = "IXP4XX-Flash", 115 .name = "IXP4XX-Flash",
@@ -129,13 +128,20 @@ static struct platform_device *gtwx5715_devices[] __initdata = {
129 128
130static void __init gtwx5715_init(void) 129static void __init gtwx5715_init(void)
131{ 130{
131 ixp4xx_sys_init();
132
133 if (!flash_resource)
134 printk(KERN_ERR "Could not allocate flash resource\n");
135
136 gtwx5715_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
137 gtwx5715_flash_resource.end = IXP4XX_EXP_BUS_BASE(0) + SZ_8M - 1;
138
132 platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices)); 139 platform_add_devices(gtwx5715_devices, ARRAY_SIZE(gtwx5715_devices));
133} 140}
134 141
135 142
136MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)") 143MACHINE_START(GTWX5715, "Gemtek GTWX5715 (Linksys WRV54G)")
137 /* Maintainer: George Joseph */ 144 /* Maintainer: George Joseph */
138 .phys_ram = PHYS_OFFSET,
139 .phys_io = IXP4XX_UART2_BASE_PHYS, 145 .phys_io = IXP4XX_UART2_BASE_PHYS,
140 .io_pg_offst = ((IXP4XX_UART2_BASE_VIRT) >> 18) & 0xfffc, 146 .io_pg_offst = ((IXP4XX_UART2_BASE_VIRT) >> 18) & 0xfffc,
141 .map_io = ixp4xx_map_io, 147 .map_io = ixp4xx_map_io,
diff --git a/arch/arm/mach-ixp4xx/ixdp425-pci.c b/arch/arm/mach-ixp4xx/ixdp425-pci.c
index f9a1d3e7d692..da415d5d7f37 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-pci.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-pci.c
@@ -32,11 +32,6 @@ void __init ixdp425_pci_preinit(void)
32 set_irq_type(IRQ_IXDP425_PCI_INTC, IRQT_LOW); 32 set_irq_type(IRQ_IXDP425_PCI_INTC, IRQT_LOW);
33 set_irq_type(IRQ_IXDP425_PCI_INTD, IRQT_LOW); 33 set_irq_type(IRQ_IXDP425_PCI_INTD, IRQT_LOW);
34 34
35 gpio_line_isr_clear(IXDP425_PCI_INTA_PIN);
36 gpio_line_isr_clear(IXDP425_PCI_INTB_PIN);
37 gpio_line_isr_clear(IXDP425_PCI_INTC_PIN);
38 gpio_line_isr_clear(IXDP425_PCI_INTD_PIN);
39
40 ixp4xx_pci_preinit(); 35 ixp4xx_pci_preinit();
41} 36}
42 37
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index 0a41080d2266..da72383ee301 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -14,6 +14,7 @@
14#include <linux/serial.h> 14#include <linux/serial.h>
15#include <linux/tty.h> 15#include <linux/tty.h>
16#include <linux/serial_8250.h> 16#include <linux/serial_8250.h>
17#include <linux/slab.h>
17 18
18#include <asm/types.h> 19#include <asm/types.h>
19#include <asm/setup.h> 20#include <asm/setup.h>
@@ -30,8 +31,6 @@ static struct flash_platform_data ixdp425_flash_data = {
30}; 31};
31 32
32static struct resource ixdp425_flash_resource = { 33static struct resource ixdp425_flash_resource = {
33 .start = IXDP425_FLASH_BASE,
34 .end = IXDP425_FLASH_BASE + IXDP425_FLASH_SIZE - 1,
35 .flags = IORESOURCE_MEM, 34 .flags = IORESOURCE_MEM,
36}; 35};
37 36
@@ -85,7 +84,7 @@ static struct plat_serial8250_port ixdp425_uart_data[] = {
85 { 84 {
86 .mapbase = IXP4XX_UART2_BASE_PHYS, 85 .mapbase = IXP4XX_UART2_BASE_PHYS,
87 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, 86 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
88 .irq = IRQ_IXP4XX_UART1, 87 .irq = IRQ_IXP4XX_UART2,
89 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 88 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
90 .iotype = UPIO_MEM, 89 .iotype = UPIO_MEM,
91 .regshift = 2, 90 .regshift = 2,
@@ -108,17 +107,13 @@ static struct platform_device *ixdp425_devices[] __initdata = {
108 &ixdp425_uart 107 &ixdp425_uart
109}; 108};
110 109
111
112static void __init ixdp425_init(void) 110static void __init ixdp425_init(void)
113{ 111{
114 ixp4xx_sys_init(); 112 ixp4xx_sys_init();
115 113
116 /* 114 ixdp425_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
117 * IXP465 has 32MB window 115 ixdp425_flash_resource.end =
118 */ 116 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
119 if (machine_is_ixdp465()) {
120 ixdp425_flash_resource.end += IXDP425_FLASH_SIZE;
121 }
122 117
123 platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices)); 118 platform_add_devices(ixdp425_devices, ARRAY_SIZE(ixdp425_devices));
124} 119}
@@ -126,7 +121,6 @@ static void __init ixdp425_init(void)
126#ifdef CONFIG_ARCH_IXDP425 121#ifdef CONFIG_ARCH_IXDP425
127MACHINE_START(IXDP425, "Intel IXDP425 Development Platform") 122MACHINE_START(IXDP425, "Intel IXDP425 Development Platform")
128 /* Maintainer: MontaVista Software, Inc. */ 123 /* Maintainer: MontaVista Software, Inc. */
129 .phys_ram = PHYS_OFFSET,
130 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, 124 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
131 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, 125 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
132 .map_io = ixp4xx_map_io, 126 .map_io = ixp4xx_map_io,
@@ -140,7 +134,6 @@ MACHINE_END
140#ifdef CONFIG_MACH_IXDP465 134#ifdef CONFIG_MACH_IXDP465
141MACHINE_START(IXDP465, "Intel IXDP465 Development Platform") 135MACHINE_START(IXDP465, "Intel IXDP465 Development Platform")
142 /* Maintainer: MontaVista Software, Inc. */ 136 /* Maintainer: MontaVista Software, Inc. */
143 .phys_ram = PHYS_OFFSET,
144 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, 137 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
145 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, 138 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
146 .map_io = ixp4xx_map_io, 139 .map_io = ixp4xx_map_io,
@@ -154,7 +147,6 @@ MACHINE_END
154#ifdef CONFIG_ARCH_PRPMC1100 147#ifdef CONFIG_ARCH_PRPMC1100
155MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform") 148MACHINE_START(IXCDP1100, "Intel IXCDP1100 Development Platform")
156 /* Maintainer: MontaVista Software, Inc. */ 149 /* Maintainer: MontaVista Software, Inc. */
157 .phys_ram = PHYS_OFFSET,
158 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, 150 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
159 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, 151 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
160 .map_io = ixp4xx_map_io, 152 .map_io = ixp4xx_map_io,
@@ -174,7 +166,6 @@ MACHINE_END
174#ifdef CONFIG_ARCH_AVILA 166#ifdef CONFIG_ARCH_AVILA
175MACHINE_START(AVILA, "Gateworks Avila Network Platform") 167MACHINE_START(AVILA, "Gateworks Avila Network Platform")
176 /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */ 168 /* Maintainer: Deepak Saxena <dsaxena@plexity.net> */
177 .phys_ram = PHYS_OFFSET,
178 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, 169 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
179 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc, 170 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xfffc,
180 .map_io = ixp4xx_map_io, 171 .map_io = ixp4xx_map_io,
diff --git a/arch/arm/mach-ixp4xx/ixdpg425-pci.c b/arch/arm/mach-ixp4xx/ixdpg425-pci.c
index fe5e7660de1d..526fb6175bc3 100644
--- a/arch/arm/mach-ixp4xx/ixdpg425-pci.c
+++ b/arch/arm/mach-ixp4xx/ixdpg425-pci.c
@@ -32,9 +32,6 @@ void __init ixdpg425_pci_preinit(void)
32 set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW); 32 set_irq_type(IRQ_IXP4XX_GPIO6, IRQT_LOW);
33 set_irq_type(IRQ_IXP4XX_GPIO7, IRQT_LOW); 33 set_irq_type(IRQ_IXP4XX_GPIO7, IRQT_LOW);
34 34
35 gpio_line_isr_clear(6);
36 gpio_line_isr_clear(7);
37
38 ixp4xx_pci_preinit(); 35 ixp4xx_pci_preinit();
39} 36}
40 37
diff --git a/arch/arm/mach-ixp4xx/nas100d-pci.c b/arch/arm/mach-ixp4xx/nas100d-pci.c
new file mode 100644
index 000000000000..26b7c001ff64
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/nas100d-pci.c
@@ -0,0 +1,71 @@
1/*
2 * arch/arm/mach-ixp4xx/nas100d-pci.c
3 *
4 * NAS 100d board-level PCI initialization
5 *
6 * based on ixdp425-pci.c:
7 * Copyright (C) 2002 Intel Corporation.
8 * Copyright (C) 2003-2004 MontaVista Software, Inc.
9 *
10 * Maintainer: http://www.nslu2-linux.org/
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
18#include <linux/config.h>
19#include <linux/pci.h>
20#include <linux/init.h>
21
22#include <asm/mach/pci.h>
23#include <asm/mach-types.h>
24
25void __init nas100d_pci_preinit(void)
26{
27 set_irq_type(IRQ_NAS100D_PCI_INTA, IRQT_LOW);
28 set_irq_type(IRQ_NAS100D_PCI_INTB, IRQT_LOW);
29 set_irq_type(IRQ_NAS100D_PCI_INTC, IRQT_LOW);
30 set_irq_type(IRQ_NAS100D_PCI_INTD, IRQT_LOW);
31 set_irq_type(IRQ_NAS100D_PCI_INTE, IRQT_LOW);
32
33 ixp4xx_pci_preinit();
34}
35
36static int __init nas100d_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
37{
38 static int pci_irq_table[NAS100D_PCI_MAX_DEV][NAS100D_PCI_IRQ_LINES] =
39 {
40 { IRQ_NAS100D_PCI_INTA, -1, -1 },
41 { IRQ_NAS100D_PCI_INTB, -1, -1 },
42 { IRQ_NAS100D_PCI_INTC, IRQ_NAS100D_PCI_INTD, IRQ_NAS100D_PCI_INTE },
43 };
44
45 int irq = -1;
46
47 if (slot >= 1 && slot <= NAS100D_PCI_MAX_DEV &&
48 pin >= 1 && pin <= NAS100D_PCI_IRQ_LINES)
49 irq = pci_irq_table[slot-1][pin-1];
50
51 return irq;
52}
53
54struct hw_pci __initdata nas100d_pci = {
55 .nr_controllers = 1,
56 .preinit = nas100d_pci_preinit,
57 .swizzle = pci_std_swizzle,
58 .setup = ixp4xx_setup,
59 .scan = ixp4xx_scan_bus,
60 .map_irq = nas100d_map_irq,
61};
62
63int __init nas100d_pci_init(void)
64{
65 if (machine_is_nas100d())
66 pci_common_init(&nas100d_pci);
67
68 return 0;
69}
70
71subsys_initcall(nas100d_pci_init);
diff --git a/arch/arm/mach-ixp4xx/nas100d-power.c b/arch/arm/mach-ixp4xx/nas100d-power.c
new file mode 100644
index 000000000000..2bec69bfa715
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/nas100d-power.c
@@ -0,0 +1,67 @@
1/*
2 * arch/arm/mach-ixp4xx/nas100d-power.c
3 *
4 * NAS 100d Power/Reset driver
5 *
6 * Copyright (C) 2005 Tower Technologies
7 *
8 * based on nas100d-io.c
9 * Copyright (C) 2004 Karen Spearel
10 *
11 * Author: Alessandro Zummo <a.zummo@towertech.it>
12 * Maintainers: http://www.nslu2-linux.org/
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
17 *
18 */
19
20#include <linux/module.h>
21#include <linux/reboot.h>
22#include <linux/interrupt.h>
23
24#include <asm/mach-types.h>
25
26extern void ctrl_alt_del(void);
27
28static irqreturn_t nas100d_reset_handler(int irq, void *dev_id, struct pt_regs *regs)
29{
30 /* Signal init to do the ctrlaltdel action, this will bypass init if
31 * it hasn't started and do a kernel_restart.
32 */
33 ctrl_alt_del();
34
35 return IRQ_HANDLED;
36}
37
38static int __init nas100d_power_init(void)
39{
40 if (!(machine_is_nas100d()))
41 return 0;
42
43 set_irq_type(NAS100D_RB_IRQ, IRQT_LOW);
44
45 if (request_irq(NAS100D_RB_IRQ, &nas100d_reset_handler,
46 SA_INTERRUPT, "NAS100D reset button", NULL) < 0) {
47
48 printk(KERN_DEBUG "Reset Button IRQ %d not available\n",
49 NAS100D_RB_IRQ);
50
51 return -EIO;
52 }
53
54 return 0;
55}
56
57static void __exit nas100d_power_exit(void)
58{
59 free_irq(NAS100D_RB_IRQ, NULL);
60}
61
62module_init(nas100d_power_init);
63module_exit(nas100d_power_exit);
64
65MODULE_AUTHOR("Alessandro Zummo <a.zummo@towertech.it>");
66MODULE_DESCRIPTION("NAS100D Power/Reset driver");
67MODULE_LICENSE("GPL");
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
new file mode 100644
index 000000000000..856d56f3b2ae
--- /dev/null
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -0,0 +1,134 @@
1/*
2 * arch/arm/mach-ixp4xx/nas100d-setup.c
3 *
4 * NAS 100d board-setup
5 *
6 * based ixdp425-setup.c:
7 * Copyright (C) 2003-2004 MontaVista Software, Inc.
8 *
9 * Author: Alessandro Zummo <a.zummo@towertech.it>
10 * Author: Rod Whitby <rod@whitby.id.au>
11 * Maintainers: http://www.nslu2-linux.org/
12 *
13 */
14
15#include <linux/kernel.h>
16#include <linux/serial.h>
17#include <linux/serial_8250.h>
18
19#include <asm/mach-types.h>
20#include <asm/mach/arch.h>
21#include <asm/mach/flash.h>
22
23static struct flash_platform_data nas100d_flash_data = {
24 .map_name = "cfi_probe",
25 .width = 2,
26};
27
28static struct resource nas100d_flash_resource = {
29 .flags = IORESOURCE_MEM,
30};
31
32static struct platform_device nas100d_flash = {
33 .name = "IXP4XX-Flash",
34 .id = 0,
35 .dev.platform_data = &nas100d_flash_data,
36 .num_resources = 1,
37 .resource = &nas100d_flash_resource,
38};
39
40static struct ixp4xx_i2c_pins nas100d_i2c_gpio_pins = {
41 .sda_pin = NAS100D_SDA_PIN,
42 .scl_pin = NAS100D_SCL_PIN,
43};
44
45static struct platform_device nas100d_i2c_controller = {
46 .name = "IXP4XX-I2C",
47 .id = 0,
48 .dev.platform_data = &nas100d_i2c_gpio_pins,
49 .num_resources = 0,
50};
51
52static struct resource nas100d_uart_resources[] = {
53 {
54 .start = IXP4XX_UART1_BASE_PHYS,
55 .end = IXP4XX_UART1_BASE_PHYS + 0x0fff,
56 .flags = IORESOURCE_MEM,
57 },
58 {
59 .start = IXP4XX_UART2_BASE_PHYS,
60 .end = IXP4XX_UART2_BASE_PHYS + 0x0fff,
61 .flags = IORESOURCE_MEM,
62 }
63};
64
65static struct plat_serial8250_port nas100d_uart_data[] = {
66 {
67 .mapbase = IXP4XX_UART1_BASE_PHYS,
68 .membase = (char *)IXP4XX_UART1_BASE_VIRT + REG_OFFSET,
69 .irq = IRQ_IXP4XX_UART1,
70 .flags = UPF_BOOT_AUTOCONF,
71 .iotype = UPIO_MEM,
72 .regshift = 2,
73 .uartclk = IXP4XX_UART_XTAL,
74 },
75 {
76 .mapbase = IXP4XX_UART2_BASE_PHYS,
77 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
78 .irq = IRQ_IXP4XX_UART2,
79 .flags = UPF_BOOT_AUTOCONF,
80 .iotype = UPIO_MEM,
81 .regshift = 2,
82 .uartclk = IXP4XX_UART_XTAL,
83 },
84 { }
85};
86
87static struct platform_device nas100d_uart = {
88 .name = "serial8250",
89 .id = PLAT8250_DEV_PLATFORM,
90 .dev.platform_data = nas100d_uart_data,
91 .num_resources = 2,
92 .resource = nas100d_uart_resources,
93};
94
95static struct platform_device *nas100d_devices[] __initdata = {
96 &nas100d_i2c_controller,
97 &nas100d_flash,
98 &nas100d_uart,
99};
100
101static void nas100d_power_off(void)
102{
103 /* This causes the box to drop the power and go dead. */
104
105 /* enable the pwr cntl gpio */
106 gpio_line_config(NAS100D_PO_GPIO, IXP4XX_GPIO_OUT);
107
108 /* do the deed */
109 gpio_line_set(NAS100D_PO_GPIO, IXP4XX_GPIO_HIGH);
110}
111
112static void __init nas100d_init(void)
113{
114 ixp4xx_sys_init();
115
116 nas100d_flash_resource.start = IXP4XX_EXP_BUS_BASE(0);
117 nas100d_flash_resource.end =
118 IXP4XX_EXP_BUS_BASE(0) + ixp4xx_exp_bus_size - 1;
119
120 pm_power_off = nas100d_power_off;
121
122 platform_add_devices(nas100d_devices, ARRAY_SIZE(nas100d_devices));
123}
124
125MACHINE_START(NAS100D, "Iomega NAS 100d")
126 /* Maintainer: www.nslu2-linux.org */
127 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
128 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
129 .boot_params = 0x00000100,
130 .map_io = ixp4xx_map_io,
131 .init_irq = ixp4xx_init_irq,
132 .timer = &ixp4xx_timer,
133 .init_machine = nas100d_init,
134MACHINE_END
diff --git a/arch/arm/mach-ixp4xx/nslu2-pci.c b/arch/arm/mach-ixp4xx/nslu2-pci.c
index a575f2e0b2c8..ece860444d5b 100644
--- a/arch/arm/mach-ixp4xx/nslu2-pci.c
+++ b/arch/arm/mach-ixp4xx/nslu2-pci.c
@@ -28,14 +28,6 @@ void __init nslu2_pci_preinit(void)
28 set_irq_type(IRQ_NSLU2_PCI_INTB, IRQT_LOW); 28 set_irq_type(IRQ_NSLU2_PCI_INTB, IRQT_LOW);
29 set_irq_type(IRQ_NSLU2_PCI_INTC, IRQT_LOW); 29 set_irq_type(IRQ_NSLU2_PCI_INTC, IRQT_LOW);
30 30
31 gpio_line_isr_clear(NSLU2_PCI_INTA_PIN);
32 gpio_line_isr_clear(NSLU2_PCI_INTB_PIN);
33 gpio_line_isr_clear(NSLU2_PCI_INTC_PIN);
34
35 /* INTD is not configured as GPIO is used
36 * for the power input button.
37 */
38
39 ixp4xx_pci_preinit(); 31 ixp4xx_pci_preinit();
40} 32}
41 33
diff --git a/arch/arm/mach-ixp4xx/nslu2-power.c b/arch/arm/mach-ixp4xx/nslu2-power.c
index 18fbc8c0fb30..b0ad9e901f6e 100644
--- a/arch/arm/mach-ixp4xx/nslu2-power.c
+++ b/arch/arm/mach-ixp4xx/nslu2-power.c
@@ -54,9 +54,6 @@ static int __init nslu2_power_init(void)
54 set_irq_type(NSLU2_RB_IRQ, IRQT_LOW); 54 set_irq_type(NSLU2_RB_IRQ, IRQT_LOW);
55 set_irq_type(NSLU2_PB_IRQ, IRQT_HIGH); 55 set_irq_type(NSLU2_PB_IRQ, IRQT_HIGH);
56 56
57 gpio_line_isr_clear(NSLU2_RB_GPIO);
58 gpio_line_isr_clear(NSLU2_PB_GPIO);
59
60 if (request_irq(NSLU2_RB_IRQ, &nslu2_reset_handler, 57 if (request_irq(NSLU2_RB_IRQ, &nslu2_reset_handler,
61 SA_INTERRUPT, "NSLU2 reset button", NULL) < 0) { 58 SA_INTERRUPT, "NSLU2 reset button", NULL) < 0) {
62 59
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 289e94cb65c2..da9340a53434 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -123,7 +123,6 @@ static void __init nslu2_init(void)
123 123
124MACHINE_START(NSLU2, "Linksys NSLU2") 124MACHINE_START(NSLU2, "Linksys NSLU2")
125 /* Maintainer: www.nslu2-linux.org */ 125 /* Maintainer: www.nslu2-linux.org */
126 .phys_ram = PHYS_OFFSET,
127 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS, 126 .phys_io = IXP4XX_PERIPHERAL_BASE_PHYS,
128 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC, 127 .io_pg_offst = ((IXP4XX_PERIPHERAL_BASE_VIRT) >> 18) & 0xFFFC,
129 .boot_params = 0x00000100, 128 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-l7200/core.c b/arch/arm/mach-l7200/core.c
index 03ed742ae2be..ac626436e96f 100644
--- a/arch/arm/mach-l7200/core.c
+++ b/arch/arm/mach-l7200/core.c
@@ -91,7 +91,6 @@ static void __init l7200_map_io(void)
91 91
92MACHINE_START(L7200, "LinkUp Systems L7200") 92MACHINE_START(L7200, "LinkUp Systems L7200")
93 /* Maintainer: Steve Hill / Scott McConnell */ 93 /* Maintainer: Steve Hill / Scott McConnell */
94 .phys_ram = 0xf0000000,
95 .phys_io = 0x80040000, 94 .phys_io = 0x80040000,
96 .io_pg_offst = ((0xd0000000) >> 18) & 0xfffc, 95 .io_pg_offst = ((0xd0000000) >> 18) & 0xfffc,
97 .map_io = l7200_map_io, 96 .map_io = l7200_map_io,
diff --git a/arch/arm/mach-lh7a40x/arch-kev7a400.c b/arch/arm/mach-lh7a40x/arch-kev7a400.c
index 19f2fa2244c4..2cccc27c62e4 100644
--- a/arch/arm/mach-lh7a40x/arch-kev7a400.c
+++ b/arch/arm/mach-lh7a40x/arch-kev7a400.c
@@ -112,7 +112,6 @@ void __init lh7a40x_init_board_irq (void)
112 112
113MACHINE_START (KEV7A400, "Sharp KEV7a400") 113MACHINE_START (KEV7A400, "Sharp KEV7a400")
114 /* Maintainer: Marc Singer */ 114 /* Maintainer: Marc Singer */
115 .phys_ram = 0xc0000000,
116 .phys_io = 0x80000000, 115 .phys_io = 0x80000000,
117 .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, 116 .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc,
118 .boot_params = 0xc0000100, 117 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
index 4eb962fdb3a8..12e23277c5ea 100644
--- a/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
+++ b/arch/arm/mach-lh7a40x/arch-lpd7a40x.c
@@ -317,7 +317,6 @@ lpd7a400_map_io(void)
317 317
318MACHINE_START (LPD7A400, "Logic Product Development LPD7A400-10") 318MACHINE_START (LPD7A400, "Logic Product Development LPD7A400-10")
319 /* Maintainer: Marc Singer */ 319 /* Maintainer: Marc Singer */
320 .phys_ram = 0xc0000000,
321 .phys_io = 0x80000000, 320 .phys_io = 0x80000000,
322 .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, 321 .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc,
323 .boot_params = 0xc0000100, 322 .boot_params = 0xc0000100,
@@ -333,7 +332,6 @@ MACHINE_END
333 332
334MACHINE_START (LPD7A404, "Logic Product Development LPD7A404-10") 333MACHINE_START (LPD7A404, "Logic Product Development LPD7A404-10")
335 /* Maintainer: Marc Singer */ 334 /* Maintainer: Marc Singer */
336 .phys_ram = 0xc0000000,
337 .phys_io = 0x80000000, 335 .phys_io = 0x80000000,
338 .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc, 336 .io_pg_offst = ((io_p2v (0x80000000))>>18) & 0xfffc,
339 .boot_params = 0xc0000100, 337 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 4b292e93fbe2..bdc20b51b076 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -109,7 +109,6 @@ static void __init omap_generic_map_io(void)
109 109
110MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710") 110MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
111 /* Maintainer: Tony Lindgren <tony@atomide.com> */ 111 /* Maintainer: Tony Lindgren <tony@atomide.com> */
112 .phys_ram = 0x10000000,
113 .phys_io = 0xfff00000, 112 .phys_io = 0xfff00000,
114 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 113 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
115 .boot_params = 0x10000100, 114 .boot_params = 0x10000100,
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index a07e2c9307fa..9533c36a92df 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -199,7 +199,6 @@ static void __init h2_map_io(void)
199 199
200MACHINE_START(OMAP_H2, "TI-H2") 200MACHINE_START(OMAP_H2, "TI-H2")
201 /* Maintainer: Imre Deak <imre.deak@nokia.com> */ 201 /* Maintainer: Imre Deak <imre.deak@nokia.com> */
202 .phys_ram = 0x10000000,
203 .phys_io = 0xfff00000, 202 .phys_io = 0xfff00000,
204 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 203 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
205 .boot_params = 0x10000100, 204 .boot_params = 0x10000100,
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 668e278433c2..d665efc1c344 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -215,7 +215,6 @@ static void __init h3_map_io(void)
215 215
216MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board") 216MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
217 /* Maintainer: Texas Instruments, Inc. */ 217 /* Maintainer: Texas Instruments, Inc. */
218 .phys_ram = 0x10000000,
219 .phys_io = 0xfff00000, 218 .phys_io = 0xfff00000,
220 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 219 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
221 .boot_params = 0x10000100, 220 .boot_params = 0x10000100,
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 95f1ff36cdcb..652f37c7f906 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -303,7 +303,6 @@ static void __init innovator_map_io(void)
303 303
304MACHINE_START(OMAP_INNOVATOR, "TI-Innovator") 304MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
305 /* Maintainer: MontaVista Software, Inc. */ 305 /* Maintainer: MontaVista Software, Inc. */
306 .phys_ram = 0x10000000,
307 .phys_io = 0xfff00000, 306 .phys_io = 0xfff00000,
308 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 307 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
309 .boot_params = 0x10000100, 308 .boot_params = 0x10000100,
diff --git a/arch/arm/mach-omap1/board-netstar.c b/arch/arm/mach-omap1/board-netstar.c
index 0448fa7de8a4..58f783930d45 100644
--- a/arch/arm/mach-omap1/board-netstar.c
+++ b/arch/arm/mach-omap1/board-netstar.c
@@ -149,7 +149,6 @@ postcore_initcall(netstar_late_init);
149 149
150MACHINE_START(NETSTAR, "NetStar OMAP5910") 150MACHINE_START(NETSTAR, "NetStar OMAP5910")
151 /* Maintainer: Ladislav Michl <michl@2n.cz> */ 151 /* Maintainer: Ladislav Michl <michl@2n.cz> */
152 .phys_ram = 0x10000000,
153 .phys_io = 0xfff00000, 152 .phys_io = 0xfff00000,
154 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 153 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
155 .boot_params = 0x10000100, 154 .boot_params = 0x10000100,
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index e990e1bc1669..e5d126e8f276 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -274,7 +274,6 @@ static void __init osk_map_io(void)
274 274
275MACHINE_START(OMAP_OSK, "TI-OSK") 275MACHINE_START(OMAP_OSK, "TI-OSK")
276 /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */ 276 /* Maintainer: Dirk Behme <dirk.behme@de.bosch.com> */
277 .phys_ram = 0x10000000,
278 .phys_io = 0xfff00000, 277 .phys_io = 0xfff00000,
279 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 278 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
280 .boot_params = 0x10000100, 279 .boot_params = 0x10000100,
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 540b20d78cca..67fada207622 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -19,6 +19,7 @@
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/notifier.h> 21#include <linux/notifier.h>
22#include <linux/clk.h>
22 23
23#include <asm/hardware.h> 24#include <asm/hardware.h>
24#include <asm/mach-types.h> 25#include <asm/mach-types.h>
@@ -30,7 +31,6 @@
30#include <asm/arch/usb.h> 31#include <asm/arch/usb.h>
31#include <asm/arch/board.h> 32#include <asm/arch/board.h>
32#include <asm/arch/common.h> 33#include <asm/arch/common.h>
33#include <asm/hardware/clock.h>
34 34
35static void __init omap_generic_init_irq(void) 35static void __init omap_generic_init_irq(void)
36{ 36{
@@ -76,7 +76,6 @@ static void __init omap_generic_map_io(void)
76} 76}
77 77
78MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E") 78MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
79 .phys_ram = 0x10000000,
80 .phys_io = 0xfff00000, 79 .phys_io = 0xfff00000,
81 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 80 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
82 .boot_params = 0x10000100, 81 .boot_params = 0x10000100,
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index bd900b7ab33c..88708a0c52a2 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -184,7 +184,7 @@ static void __init omap_perseus2_map_io(void)
184 omap_writel(0x00000088, OMAP730_FLASH_ACFG_0); 184 omap_writel(0x00000088, OMAP730_FLASH_ACFG_0);
185 185
186 /* 186 /*
187 * Ethernet support trough the debug board 187 * Ethernet support through the debug board
188 * CS1 timings setup 188 * CS1 timings setup
189 */ 189 */
190 omap_writel(0x0000fff3, OMAP730_FLASH_CFG_1); 190 omap_writel(0x0000fff3, OMAP730_FLASH_CFG_1);
@@ -199,7 +199,6 @@ static void __init omap_perseus2_map_io(void)
199 199
200MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2") 200MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
201 /* Maintainer: Kevin Hilman <kjh@hilman.org> */ 201 /* Maintainer: Kevin Hilman <kjh@hilman.org> */
202 .phys_ram = 0x10000000,
203 .phys_io = 0xfff00000, 202 .phys_io = 0xfff00000,
204 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 203 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
205 .boot_params = 0x10000100, 204 .boot_params = 0x10000100,
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 6f9a6220e78a..959b4b847c87 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -281,7 +281,6 @@ EXPORT_SYMBOL(voiceblue_wdt_ping);
281 281
282MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910") 282MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
283 /* Maintainer: Ladislav Michl <michl@2n.cz> */ 283 /* Maintainer: Ladislav Michl <michl@2n.cz> */
284 .phys_ram = 0x10000000,
285 .phys_io = 0xfff00000, 284 .phys_io = 0xfff00000,
286 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 285 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
287 .boot_params = 0x10000100, 286 .boot_params = 0x10000100,
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c
index 4277eee44ed5..75110ba10424 100644
--- a/arch/arm/mach-omap1/clock.c
+++ b/arch/arm/mach-omap1/clock.c
@@ -16,9 +16,9 @@
16#include <linux/list.h> 16#include <linux/list.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/err.h> 18#include <linux/err.h>
19#include <linux/clk.h>
19 20
20#include <asm/io.h> 21#include <asm/io.h>
21#include <asm/hardware/clock.h>
22 22
23#include <asm/arch/usb.h> 23#include <asm/arch/usb.h>
24#include <asm/arch/clock.h> 24#include <asm/arch/clock.h>
@@ -50,10 +50,10 @@ static int omap1_clk_enable_dsp_domain(struct clk *clk)
50{ 50{
51 int retval; 51 int retval;
52 52
53 retval = omap1_clk_use(&api_ck.clk); 53 retval = omap1_clk_enable(&api_ck.clk);
54 if (!retval) { 54 if (!retval) {
55 retval = omap1_clk_enable(clk); 55 retval = omap1_clk_enable_generic(clk);
56 omap1_clk_unuse(&api_ck.clk); 56 omap1_clk_disable(&api_ck.clk);
57 } 57 }
58 58
59 return retval; 59 return retval;
@@ -61,9 +61,9 @@ static int omap1_clk_enable_dsp_domain(struct clk *clk)
61 61
62static void omap1_clk_disable_dsp_domain(struct clk *clk) 62static void omap1_clk_disable_dsp_domain(struct clk *clk)
63{ 63{
64 if (omap1_clk_use(&api_ck.clk) == 0) { 64 if (omap1_clk_enable(&api_ck.clk) == 0) {
65 omap1_clk_disable(clk); 65 omap1_clk_disable_generic(clk);
66 omap1_clk_unuse(&api_ck.clk); 66 omap1_clk_disable(&api_ck.clk);
67 } 67 }
68} 68}
69 69
@@ -72,7 +72,7 @@ static int omap1_clk_enable_uart_functional(struct clk *clk)
72 int ret; 72 int ret;
73 struct uart_clk *uclk; 73 struct uart_clk *uclk;
74 74
75 ret = omap1_clk_enable(clk); 75 ret = omap1_clk_enable_generic(clk);
76 if (ret == 0) { 76 if (ret == 0) {
77 /* Set smart idle acknowledgement mode */ 77 /* Set smart idle acknowledgement mode */
78 uclk = (struct uart_clk *)clk; 78 uclk = (struct uart_clk *)clk;
@@ -91,7 +91,7 @@ static void omap1_clk_disable_uart_functional(struct clk *clk)
91 uclk = (struct uart_clk *)clk; 91 uclk = (struct uart_clk *)clk;
92 omap_writeb((omap_readb(uclk->sysc_addr) & ~0x18), uclk->sysc_addr); 92 omap_writeb((omap_readb(uclk->sysc_addr) & ~0x18), uclk->sysc_addr);
93 93
94 omap1_clk_disable(clk); 94 omap1_clk_disable_generic(clk);
95} 95}
96 96
97static void omap1_clk_allow_idle(struct clk *clk) 97static void omap1_clk_allow_idle(struct clk *clk)
@@ -230,9 +230,9 @@ static void omap1_ckctl_recalc_dsp_domain(struct clk * clk)
230 * Note that DSP_CKCTL virt addr = phys addr, so 230 * Note that DSP_CKCTL virt addr = phys addr, so
231 * we must use __raw_readw() instead of omap_readw(). 231 * we must use __raw_readw() instead of omap_readw().
232 */ 232 */
233 omap1_clk_use(&api_ck.clk); 233 omap1_clk_enable(&api_ck.clk);
234 dsor = 1 << (3 & (__raw_readw(DSP_CKCTL) >> clk->rate_offset)); 234 dsor = 1 << (3 & (__raw_readw(DSP_CKCTL) >> clk->rate_offset));
235 omap1_clk_unuse(&api_ck.clk); 235 omap1_clk_disable(&api_ck.clk);
236 236
237 if (unlikely(clk->rate == clk->parent->rate / dsor)) 237 if (unlikely(clk->rate == clk->parent->rate / dsor))
238 return; /* No change, quick exit */ 238 return; /* No change, quick exit */
@@ -412,12 +412,12 @@ static void omap1_init_ext_clk(struct clk * clk)
412 clk-> rate = 96000000 / dsor; 412 clk-> rate = 96000000 / dsor;
413} 413}
414 414
415static int omap1_clk_use(struct clk *clk) 415static int omap1_clk_enable(struct clk *clk)
416{ 416{
417 int ret = 0; 417 int ret = 0;
418 if (clk->usecount++ == 0) { 418 if (clk->usecount++ == 0) {
419 if (likely(clk->parent)) { 419 if (likely(clk->parent)) {
420 ret = omap1_clk_use(clk->parent); 420 ret = omap1_clk_enable(clk->parent);
421 421
422 if (unlikely(ret != 0)) { 422 if (unlikely(ret != 0)) {
423 clk->usecount--; 423 clk->usecount--;
@@ -432,7 +432,7 @@ static int omap1_clk_use(struct clk *clk)
432 ret = clk->enable(clk); 432 ret = clk->enable(clk);
433 433
434 if (unlikely(ret != 0) && clk->parent) { 434 if (unlikely(ret != 0) && clk->parent) {
435 omap1_clk_unuse(clk->parent); 435 omap1_clk_disable(clk->parent);
436 clk->usecount--; 436 clk->usecount--;
437 } 437 }
438 } 438 }
@@ -440,12 +440,12 @@ static int omap1_clk_use(struct clk *clk)
440 return ret; 440 return ret;
441} 441}
442 442
443static void omap1_clk_unuse(struct clk *clk) 443static void omap1_clk_disable(struct clk *clk)
444{ 444{
445 if (clk->usecount > 0 && !(--clk->usecount)) { 445 if (clk->usecount > 0 && !(--clk->usecount)) {
446 clk->disable(clk); 446 clk->disable(clk);
447 if (likely(clk->parent)) { 447 if (likely(clk->parent)) {
448 omap1_clk_unuse(clk->parent); 448 omap1_clk_disable(clk->parent);
449 if (clk->flags & CLOCK_NO_IDLE_PARENT) 449 if (clk->flags & CLOCK_NO_IDLE_PARENT)
450 if (!cpu_is_omap24xx()) 450 if (!cpu_is_omap24xx())
451 omap1_clk_allow_idle(clk->parent); 451 omap1_clk_allow_idle(clk->parent);
@@ -453,7 +453,7 @@ static void omap1_clk_unuse(struct clk *clk)
453 } 453 }
454} 454}
455 455
456static int omap1_clk_enable(struct clk *clk) 456static int omap1_clk_enable_generic(struct clk *clk)
457{ 457{
458 __u16 regval16; 458 __u16 regval16;
459 __u32 regval32; 459 __u32 regval32;
@@ -492,7 +492,7 @@ static int omap1_clk_enable(struct clk *clk)
492 return 0; 492 return 0;
493} 493}
494 494
495static void omap1_clk_disable(struct clk *clk) 495static void omap1_clk_disable_generic(struct clk *clk)
496{ 496{
497 __u16 regval16; 497 __u16 regval16;
498 __u32 regval32; 498 __u32 regval32;
@@ -654,8 +654,8 @@ late_initcall(omap1_late_clk_reset);
654#endif 654#endif
655 655
656static struct clk_functions omap1_clk_functions = { 656static struct clk_functions omap1_clk_functions = {
657 .clk_use = omap1_clk_use, 657 .clk_enable = omap1_clk_enable,
658 .clk_unuse = omap1_clk_unuse, 658 .clk_disable = omap1_clk_disable,
659 .clk_round_rate = omap1_clk_round_rate, 659 .clk_round_rate = omap1_clk_round_rate,
660 .clk_set_rate = omap1_clk_set_rate, 660 .clk_set_rate = omap1_clk_set_rate,
661}; 661};
@@ -780,9 +780,9 @@ int __init omap1_clk_init(void)
780 * Only enable those clocks we will need, let the drivers 780 * Only enable those clocks we will need, let the drivers
781 * enable other clocks as necessary 781 * enable other clocks as necessary
782 */ 782 */
783 clk_use(&armper_ck.clk); 783 clk_enable(&armper_ck.clk);
784 clk_use(&armxor_ck.clk); 784 clk_enable(&armxor_ck.clk);
785 clk_use(&armtim_ck.clk); /* This should be done by timer code */ 785 clk_enable(&armtim_ck.clk); /* This should be done by timer code */
786 786
787 if (cpu_is_omap1510()) 787 if (cpu_is_omap1510())
788 clk_enable(&arm_gpio_ck); 788 clk_enable(&arm_gpio_ck);
diff --git a/arch/arm/mach-omap1/clock.h b/arch/arm/mach-omap1/clock.h
index f3bdfb50e01a..4f18d1b94449 100644
--- a/arch/arm/mach-omap1/clock.h
+++ b/arch/arm/mach-omap1/clock.h
@@ -13,8 +13,8 @@
13#ifndef __ARCH_ARM_MACH_OMAP1_CLOCK_H 13#ifndef __ARCH_ARM_MACH_OMAP1_CLOCK_H
14#define __ARCH_ARM_MACH_OMAP1_CLOCK_H 14#define __ARCH_ARM_MACH_OMAP1_CLOCK_H
15 15
16static int omap1_clk_enable(struct clk * clk); 16static int omap1_clk_enable_generic(struct clk * clk);
17static void omap1_clk_disable(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 void omap1_ckctl_recalc_dsp_domain(struct clk * clk); 20static void omap1_ckctl_recalc_dsp_domain(struct clk * clk);
@@ -30,8 +30,8 @@ static long omap1_round_ext_clk_rate(struct clk * clk, unsigned long rate);
30static void omap1_init_ext_clk(struct clk * clk); 30static void omap1_init_ext_clk(struct clk * clk);
31static int omap1_select_table_rate(struct clk * clk, unsigned long rate); 31static int omap1_select_table_rate(struct clk * clk, unsigned long rate);
32static long omap1_round_to_table_rate(struct clk * clk, unsigned long rate); 32static long omap1_round_to_table_rate(struct clk * clk, unsigned long rate);
33static int omap1_clk_use(struct clk *clk); 33static int omap1_clk_enable(struct clk *clk);
34static void omap1_clk_unuse(struct clk *clk); 34static void omap1_clk_disable(struct clk *clk);
35 35
36struct mpu_rate { 36struct mpu_rate {
37 unsigned long rate; 37 unsigned long rate;
@@ -152,8 +152,8 @@ static struct clk ck_ref = {
152 .rate = 12000000, 152 .rate = 12000000,
153 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 153 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
154 ALWAYS_ENABLED, 154 ALWAYS_ENABLED,
155 .enable = &omap1_clk_enable, 155 .enable = &omap1_clk_enable_generic,
156 .disable = &omap1_clk_disable, 156 .disable = &omap1_clk_disable_generic,
157}; 157};
158 158
159static struct clk ck_dpll1 = { 159static struct clk ck_dpll1 = {
@@ -161,8 +161,8 @@ static struct clk ck_dpll1 = {
161 .parent = &ck_ref, 161 .parent = &ck_ref,
162 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 162 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
163 RATE_PROPAGATES | ALWAYS_ENABLED, 163 RATE_PROPAGATES | ALWAYS_ENABLED,
164 .enable = &omap1_clk_enable, 164 .enable = &omap1_clk_enable_generic,
165 .disable = &omap1_clk_disable, 165 .disable = &omap1_clk_disable_generic,
166}; 166};
167 167
168static struct arm_idlect1_clk ck_dpll1out = { 168static struct arm_idlect1_clk ck_dpll1out = {
@@ -173,8 +173,8 @@ static struct arm_idlect1_clk ck_dpll1out = {
173 .enable_reg = (void __iomem *)ARM_IDLECT2, 173 .enable_reg = (void __iomem *)ARM_IDLECT2,
174 .enable_bit = EN_CKOUT_ARM, 174 .enable_bit = EN_CKOUT_ARM,
175 .recalc = &followparent_recalc, 175 .recalc = &followparent_recalc,
176 .enable = &omap1_clk_enable, 176 .enable = &omap1_clk_enable_generic,
177 .disable = &omap1_clk_disable, 177 .disable = &omap1_clk_disable_generic,
178 }, 178 },
179 .idlect_shift = 12, 179 .idlect_shift = 12,
180}; 180};
@@ -186,8 +186,8 @@ static struct clk arm_ck = {
186 RATE_CKCTL | RATE_PROPAGATES | ALWAYS_ENABLED, 186 RATE_CKCTL | RATE_PROPAGATES | ALWAYS_ENABLED,
187 .rate_offset = CKCTL_ARMDIV_OFFSET, 187 .rate_offset = CKCTL_ARMDIV_OFFSET,
188 .recalc = &omap1_ckctl_recalc, 188 .recalc = &omap1_ckctl_recalc,
189 .enable = &omap1_clk_enable, 189 .enable = &omap1_clk_enable_generic,
190 .disable = &omap1_clk_disable, 190 .disable = &omap1_clk_disable_generic,
191}; 191};
192 192
193static struct arm_idlect1_clk armper_ck = { 193static struct arm_idlect1_clk armper_ck = {
@@ -200,8 +200,8 @@ static struct arm_idlect1_clk armper_ck = {
200 .enable_bit = EN_PERCK, 200 .enable_bit = EN_PERCK,
201 .rate_offset = CKCTL_PERDIV_OFFSET, 201 .rate_offset = CKCTL_PERDIV_OFFSET,
202 .recalc = &omap1_ckctl_recalc, 202 .recalc = &omap1_ckctl_recalc,
203 .enable = &omap1_clk_enable, 203 .enable = &omap1_clk_enable_generic,
204 .disable = &omap1_clk_disable, 204 .disable = &omap1_clk_disable_generic,
205 }, 205 },
206 .idlect_shift = 2, 206 .idlect_shift = 2,
207}; 207};
@@ -213,8 +213,8 @@ static struct clk arm_gpio_ck = {
213 .enable_reg = (void __iomem *)ARM_IDLECT2, 213 .enable_reg = (void __iomem *)ARM_IDLECT2,
214 .enable_bit = EN_GPIOCK, 214 .enable_bit = EN_GPIOCK,
215 .recalc = &followparent_recalc, 215 .recalc = &followparent_recalc,
216 .enable = &omap1_clk_enable, 216 .enable = &omap1_clk_enable_generic,
217 .disable = &omap1_clk_disable, 217 .disable = &omap1_clk_disable_generic,
218}; 218};
219 219
220static struct arm_idlect1_clk armxor_ck = { 220static struct arm_idlect1_clk armxor_ck = {
@@ -226,8 +226,8 @@ static struct arm_idlect1_clk armxor_ck = {
226 .enable_reg = (void __iomem *)ARM_IDLECT2, 226 .enable_reg = (void __iomem *)ARM_IDLECT2,
227 .enable_bit = EN_XORPCK, 227 .enable_bit = EN_XORPCK,
228 .recalc = &followparent_recalc, 228 .recalc = &followparent_recalc,
229 .enable = &omap1_clk_enable, 229 .enable = &omap1_clk_enable_generic,
230 .disable = &omap1_clk_disable, 230 .disable = &omap1_clk_disable_generic,
231 }, 231 },
232 .idlect_shift = 1, 232 .idlect_shift = 1,
233}; 233};
@@ -241,8 +241,8 @@ static struct arm_idlect1_clk armtim_ck = {
241 .enable_reg = (void __iomem *)ARM_IDLECT2, 241 .enable_reg = (void __iomem *)ARM_IDLECT2,
242 .enable_bit = EN_TIMCK, 242 .enable_bit = EN_TIMCK,
243 .recalc = &followparent_recalc, 243 .recalc = &followparent_recalc,
244 .enable = &omap1_clk_enable, 244 .enable = &omap1_clk_enable_generic,
245 .disable = &omap1_clk_disable, 245 .disable = &omap1_clk_disable_generic,
246 }, 246 },
247 .idlect_shift = 9, 247 .idlect_shift = 9,
248}; 248};
@@ -256,8 +256,8 @@ static struct arm_idlect1_clk armwdt_ck = {
256 .enable_reg = (void __iomem *)ARM_IDLECT2, 256 .enable_reg = (void __iomem *)ARM_IDLECT2,
257 .enable_bit = EN_WDTCK, 257 .enable_bit = EN_WDTCK,
258 .recalc = &omap1_watchdog_recalc, 258 .recalc = &omap1_watchdog_recalc,
259 .enable = &omap1_clk_enable, 259 .enable = &omap1_clk_enable_generic,
260 .disable = &omap1_clk_disable, 260 .disable = &omap1_clk_disable_generic,
261 }, 261 },
262 .idlect_shift = 0, 262 .idlect_shift = 0,
263}; 263};
@@ -272,8 +272,8 @@ static struct clk arminth_ck16xx = {
272 * 272 *
273 * 1510 version is in TC clocks. 273 * 1510 version is in TC clocks.
274 */ 274 */
275 .enable = &omap1_clk_enable, 275 .enable = &omap1_clk_enable_generic,
276 .disable = &omap1_clk_disable, 276 .disable = &omap1_clk_disable_generic,
277}; 277};
278 278
279static struct clk dsp_ck = { 279static struct clk dsp_ck = {
@@ -285,8 +285,8 @@ static struct clk dsp_ck = {
285 .enable_bit = EN_DSPCK, 285 .enable_bit = EN_DSPCK,
286 .rate_offset = CKCTL_DSPDIV_OFFSET, 286 .rate_offset = CKCTL_DSPDIV_OFFSET,
287 .recalc = &omap1_ckctl_recalc, 287 .recalc = &omap1_ckctl_recalc,
288 .enable = &omap1_clk_enable, 288 .enable = &omap1_clk_enable_generic,
289 .disable = &omap1_clk_disable, 289 .disable = &omap1_clk_disable_generic,
290}; 290};
291 291
292static struct clk dspmmu_ck = { 292static struct clk dspmmu_ck = {
@@ -296,8 +296,8 @@ static struct clk dspmmu_ck = {
296 RATE_CKCTL | ALWAYS_ENABLED, 296 RATE_CKCTL | ALWAYS_ENABLED,
297 .rate_offset = CKCTL_DSPMMUDIV_OFFSET, 297 .rate_offset = CKCTL_DSPMMUDIV_OFFSET,
298 .recalc = &omap1_ckctl_recalc, 298 .recalc = &omap1_ckctl_recalc,
299 .enable = &omap1_clk_enable, 299 .enable = &omap1_clk_enable_generic,
300 .disable = &omap1_clk_disable, 300 .disable = &omap1_clk_disable_generic,
301}; 301};
302 302
303static struct clk dspper_ck = { 303static struct clk dspper_ck = {
@@ -349,8 +349,8 @@ static struct arm_idlect1_clk tc_ck = {
349 CLOCK_IDLE_CONTROL, 349 CLOCK_IDLE_CONTROL,
350 .rate_offset = CKCTL_TCDIV_OFFSET, 350 .rate_offset = CKCTL_TCDIV_OFFSET,
351 .recalc = &omap1_ckctl_recalc, 351 .recalc = &omap1_ckctl_recalc,
352 .enable = &omap1_clk_enable, 352 .enable = &omap1_clk_enable_generic,
353 .disable = &omap1_clk_disable, 353 .disable = &omap1_clk_disable_generic,
354 }, 354 },
355 .idlect_shift = 6, 355 .idlect_shift = 6,
356}; 356};
@@ -364,8 +364,8 @@ static struct clk arminth_ck1510 = {
364 * 364 *
365 * 16xx version is in MPU clocks. 365 * 16xx version is in MPU clocks.
366 */ 366 */
367 .enable = &omap1_clk_enable, 367 .enable = &omap1_clk_enable_generic,
368 .disable = &omap1_clk_disable, 368 .disable = &omap1_clk_disable_generic,
369}; 369};
370 370
371static struct clk tipb_ck = { 371static struct clk tipb_ck = {
@@ -374,8 +374,8 @@ static struct clk tipb_ck = {
374 .parent = &tc_ck.clk, 374 .parent = &tc_ck.clk,
375 .flags = CLOCK_IN_OMAP1510 | ALWAYS_ENABLED, 375 .flags = CLOCK_IN_OMAP1510 | ALWAYS_ENABLED,
376 .recalc = &followparent_recalc, 376 .recalc = &followparent_recalc,
377 .enable = &omap1_clk_enable, 377 .enable = &omap1_clk_enable_generic,
378 .disable = &omap1_clk_disable, 378 .disable = &omap1_clk_disable_generic,
379}; 379};
380 380
381static struct clk l3_ocpi_ck = { 381static struct clk l3_ocpi_ck = {
@@ -386,8 +386,8 @@ static struct clk l3_ocpi_ck = {
386 .enable_reg = (void __iomem *)ARM_IDLECT3, 386 .enable_reg = (void __iomem *)ARM_IDLECT3,
387 .enable_bit = EN_OCPI_CK, 387 .enable_bit = EN_OCPI_CK,
388 .recalc = &followparent_recalc, 388 .recalc = &followparent_recalc,
389 .enable = &omap1_clk_enable, 389 .enable = &omap1_clk_enable_generic,
390 .disable = &omap1_clk_disable, 390 .disable = &omap1_clk_disable_generic,
391}; 391};
392 392
393static struct clk tc1_ck = { 393static struct clk tc1_ck = {
@@ -397,8 +397,8 @@ static struct clk tc1_ck = {
397 .enable_reg = (void __iomem *)ARM_IDLECT3, 397 .enable_reg = (void __iomem *)ARM_IDLECT3,
398 .enable_bit = EN_TC1_CK, 398 .enable_bit = EN_TC1_CK,
399 .recalc = &followparent_recalc, 399 .recalc = &followparent_recalc,
400 .enable = &omap1_clk_enable, 400 .enable = &omap1_clk_enable_generic,
401 .disable = &omap1_clk_disable, 401 .disable = &omap1_clk_disable_generic,
402}; 402};
403 403
404static struct clk tc2_ck = { 404static struct clk tc2_ck = {
@@ -408,8 +408,8 @@ static struct clk tc2_ck = {
408 .enable_reg = (void __iomem *)ARM_IDLECT3, 408 .enable_reg = (void __iomem *)ARM_IDLECT3,
409 .enable_bit = EN_TC2_CK, 409 .enable_bit = EN_TC2_CK,
410 .recalc = &followparent_recalc, 410 .recalc = &followparent_recalc,
411 .enable = &omap1_clk_enable, 411 .enable = &omap1_clk_enable_generic,
412 .disable = &omap1_clk_disable, 412 .disable = &omap1_clk_disable_generic,
413}; 413};
414 414
415static struct clk dma_ck = { 415static struct clk dma_ck = {
@@ -419,8 +419,8 @@ static struct clk dma_ck = {
419 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 419 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
420 ALWAYS_ENABLED, 420 ALWAYS_ENABLED,
421 .recalc = &followparent_recalc, 421 .recalc = &followparent_recalc,
422 .enable = &omap1_clk_enable, 422 .enable = &omap1_clk_enable_generic,
423 .disable = &omap1_clk_disable, 423 .disable = &omap1_clk_disable_generic,
424}; 424};
425 425
426static struct clk dma_lcdfree_ck = { 426static struct clk dma_lcdfree_ck = {
@@ -428,8 +428,8 @@ static struct clk dma_lcdfree_ck = {
428 .parent = &tc_ck.clk, 428 .parent = &tc_ck.clk,
429 .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED, 429 .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED,
430 .recalc = &followparent_recalc, 430 .recalc = &followparent_recalc,
431 .enable = &omap1_clk_enable, 431 .enable = &omap1_clk_enable_generic,
432 .disable = &omap1_clk_disable, 432 .disable = &omap1_clk_disable_generic,
433}; 433};
434 434
435static struct arm_idlect1_clk api_ck = { 435static struct arm_idlect1_clk api_ck = {
@@ -441,8 +441,8 @@ static struct arm_idlect1_clk api_ck = {
441 .enable_reg = (void __iomem *)ARM_IDLECT2, 441 .enable_reg = (void __iomem *)ARM_IDLECT2,
442 .enable_bit = EN_APICK, 442 .enable_bit = EN_APICK,
443 .recalc = &followparent_recalc, 443 .recalc = &followparent_recalc,
444 .enable = &omap1_clk_enable, 444 .enable = &omap1_clk_enable_generic,
445 .disable = &omap1_clk_disable, 445 .disable = &omap1_clk_disable_generic,
446 }, 446 },
447 .idlect_shift = 8, 447 .idlect_shift = 8,
448}; 448};
@@ -455,8 +455,8 @@ static struct arm_idlect1_clk lb_ck = {
455 .enable_reg = (void __iomem *)ARM_IDLECT2, 455 .enable_reg = (void __iomem *)ARM_IDLECT2,
456 .enable_bit = EN_LBCK, 456 .enable_bit = EN_LBCK,
457 .recalc = &followparent_recalc, 457 .recalc = &followparent_recalc,
458 .enable = &omap1_clk_enable, 458 .enable = &omap1_clk_enable_generic,
459 .disable = &omap1_clk_disable, 459 .disable = &omap1_clk_disable_generic,
460 }, 460 },
461 .idlect_shift = 4, 461 .idlect_shift = 4,
462}; 462};
@@ -466,8 +466,8 @@ static struct clk rhea1_ck = {
466 .parent = &tc_ck.clk, 466 .parent = &tc_ck.clk,
467 .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED, 467 .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED,
468 .recalc = &followparent_recalc, 468 .recalc = &followparent_recalc,
469 .enable = &omap1_clk_enable, 469 .enable = &omap1_clk_enable_generic,
470 .disable = &omap1_clk_disable, 470 .disable = &omap1_clk_disable_generic,
471}; 471};
472 472
473static struct clk rhea2_ck = { 473static struct clk rhea2_ck = {
@@ -475,8 +475,8 @@ static struct clk rhea2_ck = {
475 .parent = &tc_ck.clk, 475 .parent = &tc_ck.clk,
476 .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED, 476 .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED,
477 .recalc = &followparent_recalc, 477 .recalc = &followparent_recalc,
478 .enable = &omap1_clk_enable, 478 .enable = &omap1_clk_enable_generic,
479 .disable = &omap1_clk_disable, 479 .disable = &omap1_clk_disable_generic,
480}; 480};
481 481
482static struct clk lcd_ck_16xx = { 482static struct clk lcd_ck_16xx = {
@@ -487,8 +487,8 @@ static struct clk lcd_ck_16xx = {
487 .enable_bit = EN_LCDCK, 487 .enable_bit = EN_LCDCK,
488 .rate_offset = CKCTL_LCDDIV_OFFSET, 488 .rate_offset = CKCTL_LCDDIV_OFFSET,
489 .recalc = &omap1_ckctl_recalc, 489 .recalc = &omap1_ckctl_recalc,
490 .enable = &omap1_clk_enable, 490 .enable = &omap1_clk_enable_generic,
491 .disable = &omap1_clk_disable, 491 .disable = &omap1_clk_disable_generic,
492}; 492};
493 493
494static struct arm_idlect1_clk lcd_ck_1510 = { 494static struct arm_idlect1_clk lcd_ck_1510 = {
@@ -501,8 +501,8 @@ static struct arm_idlect1_clk lcd_ck_1510 = {
501 .enable_bit = EN_LCDCK, 501 .enable_bit = EN_LCDCK,
502 .rate_offset = CKCTL_LCDDIV_OFFSET, 502 .rate_offset = CKCTL_LCDDIV_OFFSET,
503 .recalc = &omap1_ckctl_recalc, 503 .recalc = &omap1_ckctl_recalc,
504 .enable = &omap1_clk_enable, 504 .enable = &omap1_clk_enable_generic,
505 .disable = &omap1_clk_disable, 505 .disable = &omap1_clk_disable_generic,
506 }, 506 },
507 .idlect_shift = 3, 507 .idlect_shift = 3,
508}; 508};
@@ -518,8 +518,8 @@ static struct clk uart1_1510 = {
518 .enable_bit = 29, /* Chooses between 12MHz and 48MHz */ 518 .enable_bit = 29, /* Chooses between 12MHz and 48MHz */
519 .set_rate = &omap1_set_uart_rate, 519 .set_rate = &omap1_set_uart_rate,
520 .recalc = &omap1_uart_recalc, 520 .recalc = &omap1_uart_recalc,
521 .enable = &omap1_clk_enable, 521 .enable = &omap1_clk_enable_generic,
522 .disable = &omap1_clk_disable, 522 .disable = &omap1_clk_disable_generic,
523}; 523};
524 524
525static struct uart_clk uart1_16xx = { 525static struct uart_clk uart1_16xx = {
@@ -550,8 +550,8 @@ static struct clk uart2_ck = {
550 .enable_bit = 30, /* Chooses between 12MHz and 48MHz */ 550 .enable_bit = 30, /* Chooses between 12MHz and 48MHz */
551 .set_rate = &omap1_set_uart_rate, 551 .set_rate = &omap1_set_uart_rate,
552 .recalc = &omap1_uart_recalc, 552 .recalc = &omap1_uart_recalc,
553 .enable = &omap1_clk_enable, 553 .enable = &omap1_clk_enable_generic,
554 .disable = &omap1_clk_disable, 554 .disable = &omap1_clk_disable_generic,
555}; 555};
556 556
557static struct clk uart3_1510 = { 557static struct clk uart3_1510 = {
@@ -565,8 +565,8 @@ static struct clk uart3_1510 = {
565 .enable_bit = 31, /* Chooses between 12MHz and 48MHz */ 565 .enable_bit = 31, /* Chooses between 12MHz and 48MHz */
566 .set_rate = &omap1_set_uart_rate, 566 .set_rate = &omap1_set_uart_rate,
567 .recalc = &omap1_uart_recalc, 567 .recalc = &omap1_uart_recalc,
568 .enable = &omap1_clk_enable, 568 .enable = &omap1_clk_enable_generic,
569 .disable = &omap1_clk_disable, 569 .disable = &omap1_clk_disable_generic,
570}; 570};
571 571
572static struct uart_clk uart3_16xx = { 572static struct uart_clk uart3_16xx = {
@@ -593,8 +593,8 @@ static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */
593 RATE_FIXED | ENABLE_REG_32BIT, 593 RATE_FIXED | ENABLE_REG_32BIT,
594 .enable_reg = (void __iomem *)ULPD_CLOCK_CTRL, 594 .enable_reg = (void __iomem *)ULPD_CLOCK_CTRL,
595 .enable_bit = USB_MCLK_EN_BIT, 595 .enable_bit = USB_MCLK_EN_BIT,
596 .enable = &omap1_clk_enable, 596 .enable = &omap1_clk_enable_generic,
597 .disable = &omap1_clk_disable, 597 .disable = &omap1_clk_disable_generic,
598}; 598};
599 599
600static struct clk usb_hhc_ck1510 = { 600static struct clk usb_hhc_ck1510 = {
@@ -605,8 +605,8 @@ static struct clk usb_hhc_ck1510 = {
605 RATE_FIXED | ENABLE_REG_32BIT, 605 RATE_FIXED | ENABLE_REG_32BIT,
606 .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, 606 .enable_reg = (void __iomem *)MOD_CONF_CTRL_0,
607 .enable_bit = USB_HOST_HHC_UHOST_EN, 607 .enable_bit = USB_HOST_HHC_UHOST_EN,
608 .enable = &omap1_clk_enable, 608 .enable = &omap1_clk_enable_generic,
609 .disable = &omap1_clk_disable, 609 .disable = &omap1_clk_disable_generic,
610}; 610};
611 611
612static struct clk usb_hhc_ck16xx = { 612static struct clk usb_hhc_ck16xx = {
@@ -618,8 +618,8 @@ static struct clk usb_hhc_ck16xx = {
618 RATE_FIXED | ENABLE_REG_32BIT, 618 RATE_FIXED | ENABLE_REG_32BIT,
619 .enable_reg = (void __iomem *)OTG_BASE + 0x08 /* OTG_SYSCON_2 */, 619 .enable_reg = (void __iomem *)OTG_BASE + 0x08 /* OTG_SYSCON_2 */,
620 .enable_bit = 8 /* UHOST_EN */, 620 .enable_bit = 8 /* UHOST_EN */,
621 .enable = &omap1_clk_enable, 621 .enable = &omap1_clk_enable_generic,
622 .disable = &omap1_clk_disable, 622 .disable = &omap1_clk_disable_generic,
623}; 623};
624 624
625static struct clk usb_dc_ck = { 625static struct clk usb_dc_ck = {
@@ -629,8 +629,8 @@ static struct clk usb_dc_ck = {
629 .flags = CLOCK_IN_OMAP16XX | RATE_FIXED, 629 .flags = CLOCK_IN_OMAP16XX | RATE_FIXED,
630 .enable_reg = (void __iomem *)SOFT_REQ_REG, 630 .enable_reg = (void __iomem *)SOFT_REQ_REG,
631 .enable_bit = 4, 631 .enable_bit = 4,
632 .enable = &omap1_clk_enable, 632 .enable = &omap1_clk_enable_generic,
633 .disable = &omap1_clk_disable, 633 .disable = &omap1_clk_disable_generic,
634}; 634};
635 635
636static struct clk mclk_1510 = { 636static struct clk mclk_1510 = {
@@ -638,8 +638,8 @@ static struct clk mclk_1510 = {
638 /* Direct from ULPD, no parent. May be enabled by ext hardware. */ 638 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
639 .rate = 12000000, 639 .rate = 12000000,
640 .flags = CLOCK_IN_OMAP1510 | RATE_FIXED, 640 .flags = CLOCK_IN_OMAP1510 | RATE_FIXED,
641 .enable = &omap1_clk_enable, 641 .enable = &omap1_clk_enable_generic,
642 .disable = &omap1_clk_disable, 642 .disable = &omap1_clk_disable_generic,
643}; 643};
644 644
645static struct clk mclk_16xx = { 645static struct clk mclk_16xx = {
@@ -651,8 +651,8 @@ static struct clk mclk_16xx = {
651 .set_rate = &omap1_set_ext_clk_rate, 651 .set_rate = &omap1_set_ext_clk_rate,
652 .round_rate = &omap1_round_ext_clk_rate, 652 .round_rate = &omap1_round_ext_clk_rate,
653 .init = &omap1_init_ext_clk, 653 .init = &omap1_init_ext_clk,
654 .enable = &omap1_clk_enable, 654 .enable = &omap1_clk_enable_generic,
655 .disable = &omap1_clk_disable, 655 .disable = &omap1_clk_disable_generic,
656}; 656};
657 657
658static struct clk bclk_1510 = { 658static struct clk bclk_1510 = {
@@ -660,8 +660,8 @@ static struct clk bclk_1510 = {
660 /* Direct from ULPD, no parent. May be enabled by ext hardware. */ 660 /* Direct from ULPD, no parent. May be enabled by ext hardware. */
661 .rate = 12000000, 661 .rate = 12000000,
662 .flags = CLOCK_IN_OMAP1510 | RATE_FIXED, 662 .flags = CLOCK_IN_OMAP1510 | RATE_FIXED,
663 .enable = &omap1_clk_enable, 663 .enable = &omap1_clk_enable_generic,
664 .disable = &omap1_clk_disable, 664 .disable = &omap1_clk_disable_generic,
665}; 665};
666 666
667static struct clk bclk_16xx = { 667static struct clk bclk_16xx = {
@@ -673,8 +673,8 @@ static struct clk bclk_16xx = {
673 .set_rate = &omap1_set_ext_clk_rate, 673 .set_rate = &omap1_set_ext_clk_rate,
674 .round_rate = &omap1_round_ext_clk_rate, 674 .round_rate = &omap1_round_ext_clk_rate,
675 .init = &omap1_init_ext_clk, 675 .init = &omap1_init_ext_clk,
676 .enable = &omap1_clk_enable, 676 .enable = &omap1_clk_enable_generic,
677 .disable = &omap1_clk_disable, 677 .disable = &omap1_clk_disable_generic,
678}; 678};
679 679
680static struct clk mmc1_ck = { 680static struct clk mmc1_ck = {
@@ -686,8 +686,8 @@ static struct clk mmc1_ck = {
686 RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, 686 RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
687 .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, 687 .enable_reg = (void __iomem *)MOD_CONF_CTRL_0,
688 .enable_bit = 23, 688 .enable_bit = 23,
689 .enable = &omap1_clk_enable, 689 .enable = &omap1_clk_enable_generic,
690 .disable = &omap1_clk_disable, 690 .disable = &omap1_clk_disable_generic,
691}; 691};
692 692
693static struct clk mmc2_ck = { 693static struct clk mmc2_ck = {
@@ -699,8 +699,8 @@ static struct clk mmc2_ck = {
699 RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT, 699 RATE_FIXED | ENABLE_REG_32BIT | CLOCK_NO_IDLE_PARENT,
700 .enable_reg = (void __iomem *)MOD_CONF_CTRL_0, 700 .enable_reg = (void __iomem *)MOD_CONF_CTRL_0,
701 .enable_bit = 20, 701 .enable_bit = 20,
702 .enable = &omap1_clk_enable, 702 .enable = &omap1_clk_enable_generic,
703 .disable = &omap1_clk_disable, 703 .disable = &omap1_clk_disable_generic,
704}; 704};
705 705
706static struct clk virtual_ck_mpu = { 706static struct clk virtual_ck_mpu = {
@@ -711,8 +711,8 @@ static struct clk virtual_ck_mpu = {
711 .recalc = &followparent_recalc, 711 .recalc = &followparent_recalc,
712 .set_rate = &omap1_select_table_rate, 712 .set_rate = &omap1_select_table_rate,
713 .round_rate = &omap1_round_to_table_rate, 713 .round_rate = &omap1_round_to_table_rate,
714 .enable = &omap1_clk_enable, 714 .enable = &omap1_clk_enable_generic,
715 .disable = &omap1_clk_disable, 715 .disable = &omap1_clk_disable_generic,
716}; 716};
717 717
718static struct clk * onchip_clks[] = { 718static struct clk * onchip_clks[] = {
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 6810cfb84462..e924e0c6a4ce 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -17,10 +17,10 @@
17#include <linux/tty.h> 17#include <linux/tty.h>
18#include <linux/serial_8250.h> 18#include <linux/serial_8250.h>
19#include <linux/serial_reg.h> 19#include <linux/serial_reg.h>
20#include <linux/clk.h>
20 21
21#include <asm/io.h> 22#include <asm/io.h>
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/hardware/clock.h>
24 24
25#include <asm/arch/board.h> 25#include <asm/arch/board.h>
26#include <asm/arch/mux.h> 26#include <asm/arch/mux.h>
@@ -146,7 +146,7 @@ void __init omap_serial_init(void)
146 if (IS_ERR(uart1_ck)) 146 if (IS_ERR(uart1_ck))
147 printk("Could not get uart1_ck\n"); 147 printk("Could not get uart1_ck\n");
148 else { 148 else {
149 clk_use(uart1_ck); 149 clk_enable(uart1_ck);
150 if (cpu_is_omap1510()) 150 if (cpu_is_omap1510())
151 clk_set_rate(uart1_ck, 12000000); 151 clk_set_rate(uart1_ck, 12000000);
152 } 152 }
@@ -166,7 +166,7 @@ void __init omap_serial_init(void)
166 if (IS_ERR(uart2_ck)) 166 if (IS_ERR(uart2_ck))
167 printk("Could not get uart2_ck\n"); 167 printk("Could not get uart2_ck\n");
168 else { 168 else {
169 clk_use(uart2_ck); 169 clk_enable(uart2_ck);
170 if (cpu_is_omap1510()) 170 if (cpu_is_omap1510())
171 clk_set_rate(uart2_ck, 12000000); 171 clk_set_rate(uart2_ck, 12000000);
172 else 172 else
@@ -188,7 +188,7 @@ void __init omap_serial_init(void)
188 if (IS_ERR(uart3_ck)) 188 if (IS_ERR(uart3_ck))
189 printk("Could not get uart3_ck\n"); 189 printk("Could not get uart3_ck\n");
190 else { 190 else {
191 clk_use(uart3_ck); 191 clk_enable(uart3_ck);
192 if (cpu_is_omap1510()) 192 if (cpu_is_omap1510())
193 clk_set_rate(uart3_ck, 12000000); 193 clk_set_rate(uart3_ck, 12000000);
194 } 194 }
@@ -252,9 +252,8 @@ static void __init omap_serial_set_port_wakeup(int gpio_nr)
252 return; 252 return;
253 } 253 }
254 omap_set_gpio_direction(gpio_nr, 1); 254 omap_set_gpio_direction(gpio_nr, 1);
255 set_irq_type(OMAP_GPIO_IRQ(gpio_nr), IRQT_RISING);
256 ret = request_irq(OMAP_GPIO_IRQ(gpio_nr), &omap_serial_wake_interrupt, 255 ret = request_irq(OMAP_GPIO_IRQ(gpio_nr), &omap_serial_wake_interrupt,
257 0, "serial wakeup", NULL); 256 SA_TRIGGER_RISING, "serial wakeup", NULL);
258 if (ret) { 257 if (ret) {
259 omap_free_gpio(gpio_nr); 258 omap_free_gpio(gpio_nr);
260 printk(KERN_ERR "No interrupt for UART wake GPIO: %i\n", 259 printk(KERN_ERR "No interrupt for UART wake GPIO: %i\n",
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index c602e7a3d93e..b937123e5c65 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -69,7 +69,6 @@ static void __init omap_generic_map_io(void)
69 69
70MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx") 70MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
71 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ 71 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
72 .phys_ram = 0x80000000,
73 .phys_io = 0x48000000, 72 .phys_io = 0x48000000,
74 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 73 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
75 .boot_params = 0x80000100, 74 .boot_params = 0x80000100,
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index f2554469a76a..c3c35d40378a 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -186,7 +186,6 @@ static void __init omap_h4_map_io(void)
186 186
187MACHINE_START(OMAP_H4, "OMAP2420 H4 board") 187MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
188 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */ 188 /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
189 .phys_ram = 0x80000000,
190 .phys_io = 0x48000000, 189 .phys_io = 0x48000000,
191 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 190 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
192 .boot_params = 0x80000100, 191 .boot_params = 0x80000100,
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 85818d9f2635..180f675c9064 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -22,10 +22,10 @@
22#include <linux/list.h> 22#include <linux/list.h>
23#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/clk.h>
25 26
26#include <asm/io.h> 27#include <asm/io.h>
27 28
28#include <asm/hardware/clock.h>
29#include <asm/arch/clock.h> 29#include <asm/arch/clock.h>
30#include <asm/arch/sram.h> 30#include <asm/arch/sram.h>
31#include <asm/arch/prcm.h> 31#include <asm/arch/prcm.h>
@@ -111,7 +111,7 @@ static void omap2_clk_fixed_enable(struct clk *clk)
111/* Enables clock without considering parent dependencies or use count 111/* Enables clock without considering parent dependencies or use count
112 * REVISIT: Maybe change this to use clk->enable like on omap1? 112 * REVISIT: Maybe change this to use clk->enable like on omap1?
113 */ 113 */
114static int omap2_clk_enable(struct clk * clk) 114static int _omap2_clk_enable(struct clk * clk)
115{ 115{
116 u32 regval32; 116 u32 regval32;
117 117
@@ -150,7 +150,7 @@ static void omap2_clk_fixed_disable(struct clk *clk)
150} 150}
151 151
152/* Disables clock without considering parent dependencies or use count */ 152/* Disables clock without considering parent dependencies or use count */
153static void omap2_clk_disable(struct clk *clk) 153static void _omap2_clk_disable(struct clk *clk)
154{ 154{
155 u32 regval32; 155 u32 regval32;
156 156
@@ -167,23 +167,23 @@ static void omap2_clk_disable(struct clk *clk)
167 __raw_writel(regval32, clk->enable_reg); 167 __raw_writel(regval32, clk->enable_reg);
168} 168}
169 169
170static int omap2_clk_use(struct clk *clk) 170static int omap2_clk_enable(struct clk *clk)
171{ 171{
172 int ret = 0; 172 int ret = 0;
173 173
174 if (clk->usecount++ == 0) { 174 if (clk->usecount++ == 0) {
175 if (likely((u32)clk->parent)) 175 if (likely((u32)clk->parent))
176 ret = omap2_clk_use(clk->parent); 176 ret = omap2_clk_enable(clk->parent);
177 177
178 if (unlikely(ret != 0)) { 178 if (unlikely(ret != 0)) {
179 clk->usecount--; 179 clk->usecount--;
180 return ret; 180 return ret;
181 } 181 }
182 182
183 ret = omap2_clk_enable(clk); 183 ret = _omap2_clk_enable(clk);
184 184
185 if (unlikely(ret != 0) && clk->parent) { 185 if (unlikely(ret != 0) && clk->parent) {
186 omap2_clk_unuse(clk->parent); 186 omap2_clk_disable(clk->parent);
187 clk->usecount--; 187 clk->usecount--;
188 } 188 }
189 } 189 }
@@ -191,12 +191,12 @@ static int omap2_clk_use(struct clk *clk)
191 return ret; 191 return ret;
192} 192}
193 193
194static void omap2_clk_unuse(struct clk *clk) 194static void omap2_clk_disable(struct clk *clk)
195{ 195{
196 if (clk->usecount > 0 && !(--clk->usecount)) { 196 if (clk->usecount > 0 && !(--clk->usecount)) {
197 omap2_clk_disable(clk); 197 _omap2_clk_disable(clk);
198 if (likely((u32)clk->parent)) 198 if (likely((u32)clk->parent))
199 omap2_clk_unuse(clk->parent); 199 omap2_clk_disable(clk->parent);
200 } 200 }
201} 201}
202 202
@@ -873,7 +873,7 @@ static int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
873 reg = (void __iomem *)src_sel; 873 reg = (void __iomem *)src_sel;
874 874
875 if (clk->usecount > 0) 875 if (clk->usecount > 0)
876 omap2_clk_disable(clk); 876 _omap2_clk_disable(clk);
877 877
878 /* Set new source value (previous dividers if any in effect) */ 878 /* Set new source value (previous dividers if any in effect) */
879 reg_val = __raw_readl(reg) & ~(field_mask << src_off); 879 reg_val = __raw_readl(reg) & ~(field_mask << src_off);
@@ -884,7 +884,7 @@ static int omap2_clk_set_parent(struct clk *clk, struct clk *new_parent)
884 __raw_writel(0x1, (void __iomem *)&PRCM_CLKCFG_CTRL); 884 __raw_writel(0x1, (void __iomem *)&PRCM_CLKCFG_CTRL);
885 885
886 if (clk->usecount > 0) 886 if (clk->usecount > 0)
887 omap2_clk_enable(clk); 887 _omap2_clk_enable(clk);
888 888
889 clk->parent = new_parent; 889 clk->parent = new_parent;
890 890
@@ -999,8 +999,6 @@ static int omap2_select_table_rate(struct clk * clk, unsigned long rate)
999static struct clk_functions omap2_clk_functions = { 999static struct clk_functions omap2_clk_functions = {
1000 .clk_enable = omap2_clk_enable, 1000 .clk_enable = omap2_clk_enable,
1001 .clk_disable = omap2_clk_disable, 1001 .clk_disable = omap2_clk_disable,
1002 .clk_use = omap2_clk_use,
1003 .clk_unuse = omap2_clk_unuse,
1004 .clk_round_rate = omap2_clk_round_rate, 1002 .clk_round_rate = omap2_clk_round_rate,
1005 .clk_set_rate = omap2_clk_set_rate, 1003 .clk_set_rate = omap2_clk_set_rate,
1006 .clk_set_parent = omap2_clk_set_parent, 1004 .clk_set_parent = omap2_clk_set_parent,
@@ -1045,7 +1043,7 @@ static void __init omap2_disable_unused_clocks(void)
1045 continue; 1043 continue;
1046 1044
1047 printk(KERN_INFO "Disabling unused clock \"%s\"\n", ck->name); 1045 printk(KERN_INFO "Disabling unused clock \"%s\"\n", ck->name);
1048 omap2_clk_disable(ck); 1046 _omap2_clk_disable(ck);
1049 } 1047 }
1050} 1048}
1051late_initcall(omap2_disable_unused_clocks); 1049late_initcall(omap2_disable_unused_clocks);
@@ -1120,10 +1118,10 @@ int __init omap2_clk_init(void)
1120 * Only enable those clocks we will need, let the drivers 1118 * Only enable those clocks we will need, let the drivers
1121 * enable other clocks as necessary 1119 * enable other clocks as necessary
1122 */ 1120 */
1123 clk_use(&sync_32k_ick); 1121 clk_enable(&sync_32k_ick);
1124 clk_use(&omapctrl_ick); 1122 clk_enable(&omapctrl_ick);
1125 if (cpu_is_omap2430()) 1123 if (cpu_is_omap2430())
1126 clk_use(&sdrc_ick); 1124 clk_enable(&sdrc_ick);
1127 1125
1128 return 0; 1126 return 0;
1129} 1127}
diff --git a/arch/arm/mach-omap2/clock.h b/arch/arm/mach-omap2/clock.h
index 4aeab5591bd3..6cab20b1d3c1 100644
--- a/arch/arm/mach-omap2/clock.h
+++ b/arch/arm/mach-omap2/clock.h
@@ -24,7 +24,7 @@ static void omap2_propagate_rate(struct clk * clk);
24static void omap2_mpu_recalc(struct clk * clk); 24static void omap2_mpu_recalc(struct clk * clk);
25static int omap2_select_table_rate(struct clk * clk, unsigned long rate); 25static int omap2_select_table_rate(struct clk * clk, unsigned long rate);
26static long omap2_round_to_table_rate(struct clk * clk, unsigned long rate); 26static long omap2_round_to_table_rate(struct clk * clk, unsigned long rate);
27static void omap2_clk_unuse(struct clk *clk); 27static void omap2_clk_disable(struct clk *clk);
28static void omap2_sys_clk_recalc(struct clk * clk); 28static void omap2_sys_clk_recalc(struct clk * clk);
29static u32 omap2_clksel_to_divisor(u32 div_sel, u32 field_val); 29static u32 omap2_clksel_to_divisor(u32 div_sel, u32 field_val);
30static u32 omap2_clksel_get_divisor(struct clk *clk); 30static u32 omap2_clksel_get_divisor(struct clk *clk);
@@ -859,7 +859,7 @@ static struct clk core_l3_ck = { /* Used for ick and fck, interconnect */
859 859
860static struct clk usb_l4_ick = { /* FS-USB interface clock */ 860static struct clk usb_l4_ick = { /* FS-USB interface clock */
861 .name = "usb_l4_ick", 861 .name = "usb_l4_ick",
862 .parent = &core_ck, 862 .parent = &core_l3_ck,
863 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | 863 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
864 RATE_CKCTL | CM_CORE_SEL1 | DELAYED_APP | 864 RATE_CKCTL | CM_CORE_SEL1 | DELAYED_APP |
865 CONFIG_PARTICIPANT, 865 CONFIG_PARTICIPANT,
@@ -1045,7 +1045,7 @@ static struct clk gpt1_ick = {
1045 .name = "gpt1_ick", 1045 .name = "gpt1_ick",
1046 .parent = &l4_ck, 1046 .parent = &l4_ck,
1047 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1047 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1048 .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, /* Bit4 */ 1048 .enable_reg = (void __iomem *)&CM_ICLKEN_WKUP, /* Bit0 */
1049 .enable_bit = 0, 1049 .enable_bit = 0,
1050 .recalc = &omap2_followparent_recalc, 1050 .recalc = &omap2_followparent_recalc,
1051}; 1051};
@@ -1055,7 +1055,7 @@ static struct clk gpt1_fck = {
1055 .parent = &func_32k_ck, 1055 .parent = &func_32k_ck,
1056 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X | 1056 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X |
1057 CM_WKUP_SEL1, 1057 CM_WKUP_SEL1,
1058 .enable_reg = (void __iomem *)&CM_FCLKEN_WKUP, 1058 .enable_reg = (void __iomem *)&CM_FCLKEN_WKUP, /* Bit0 */
1059 .enable_bit = 0, 1059 .enable_bit = 0,
1060 .src_offset = 0, 1060 .src_offset = 0,
1061 .recalc = &omap2_followparent_recalc, 1061 .recalc = &omap2_followparent_recalc,
@@ -1065,7 +1065,7 @@ static struct clk gpt2_ick = {
1065 .name = "gpt2_ick", 1065 .name = "gpt2_ick",
1066 .parent = &l4_ck, 1066 .parent = &l4_ck,
1067 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X, 1067 .flags = CLOCK_IN_OMAP242X | CLOCK_IN_OMAP243X,
1068 .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* bit4 */ 1068 .enable_reg = (void __iomem *)&CM_ICLKEN1_CORE, /* Bit4 */
1069 .enable_bit = 0, 1069 .enable_bit = 0,
1070 .recalc = &omap2_followparent_recalc, 1070 .recalc = &omap2_followparent_recalc,
1071}; 1071};
@@ -1839,7 +1839,7 @@ static struct clk usb_fck = {
1839 1839
1840static struct clk usbhs_ick = { 1840static struct clk usbhs_ick = {
1841 .name = "usbhs_ick", 1841 .name = "usbhs_ick",
1842 .parent = &l4_ck, 1842 .parent = &core_l3_ck,
1843 .flags = CLOCK_IN_OMAP243X, 1843 .flags = CLOCK_IN_OMAP243X,
1844 .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE, 1844 .enable_reg = (void __iomem *)&CM_ICLKEN2_CORE,
1845 .enable_bit = 6, 1845 .enable_bit = 6,
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index f4df04fe1dd8..24dd374224af 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -16,9 +16,9 @@
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/serial_8250.h> 17#include <linux/serial_8250.h>
18#include <linux/serial_reg.h> 18#include <linux/serial_reg.h>
19#include <linux/clk.h>
19 20
20#include <asm/io.h> 21#include <asm/io.h>
21#include <asm/hardware/clock.h>
22 22
23#include <asm/arch/common.h> 23#include <asm/arch/common.h>
24#include <asm/arch/board.h> 24#include <asm/arch/board.h>
@@ -119,14 +119,14 @@ void __init omap_serial_init()
119 if (IS_ERR(uart1_ick)) 119 if (IS_ERR(uart1_ick))
120 printk("Could not get uart1_ick\n"); 120 printk("Could not get uart1_ick\n");
121 else { 121 else {
122 clk_use(uart1_ick); 122 clk_enable(uart1_ick);
123 } 123 }
124 124
125 uart1_fck = clk_get(NULL, "uart1_fck"); 125 uart1_fck = clk_get(NULL, "uart1_fck");
126 if (IS_ERR(uart1_fck)) 126 if (IS_ERR(uart1_fck))
127 printk("Could not get uart1_fck\n"); 127 printk("Could not get uart1_fck\n");
128 else { 128 else {
129 clk_use(uart1_fck); 129 clk_enable(uart1_fck);
130 } 130 }
131 break; 131 break;
132 case 1: 132 case 1:
@@ -134,14 +134,14 @@ void __init omap_serial_init()
134 if (IS_ERR(uart2_ick)) 134 if (IS_ERR(uart2_ick))
135 printk("Could not get uart2_ick\n"); 135 printk("Could not get uart2_ick\n");
136 else { 136 else {
137 clk_use(uart2_ick); 137 clk_enable(uart2_ick);
138 } 138 }
139 139
140 uart2_fck = clk_get(NULL, "uart2_fck"); 140 uart2_fck = clk_get(NULL, "uart2_fck");
141 if (IS_ERR(uart2_fck)) 141 if (IS_ERR(uart2_fck))
142 printk("Could not get uart2_fck\n"); 142 printk("Could not get uart2_fck\n");
143 else { 143 else {
144 clk_use(uart2_fck); 144 clk_enable(uart2_fck);
145 } 145 }
146 break; 146 break;
147 case 2: 147 case 2:
@@ -149,14 +149,14 @@ void __init omap_serial_init()
149 if (IS_ERR(uart3_ick)) 149 if (IS_ERR(uart3_ick))
150 printk("Could not get uart3_ick\n"); 150 printk("Could not get uart3_ick\n");
151 else { 151 else {
152 clk_use(uart3_ick); 152 clk_enable(uart3_ick);
153 } 153 }
154 154
155 uart3_fck = clk_get(NULL, "uart3_fck"); 155 uart3_fck = clk_get(NULL, "uart3_fck");
156 if (IS_ERR(uart3_fck)) 156 if (IS_ERR(uart3_fck))
157 printk("Could not get uart3_fck\n"); 157 printk("Could not get uart3_fck\n");
158 else { 158 else {
159 clk_use(uart3_fck); 159 clk_enable(uart3_fck);
160 } 160 }
161 break; 161 break;
162 } 162 }
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
index 9ec11443200f..1d2f5ac2f69b 100644
--- a/arch/arm/mach-omap2/timer-gp.c
+++ b/arch/arm/mach-omap2/timer-gp.c
@@ -21,10 +21,11 @@
21#include <linux/time.h> 21#include <linux/time.h>
22#include <linux/interrupt.h> 22#include <linux/interrupt.h>
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/clk.h>
25
24#include <asm/mach/time.h> 26#include <asm/mach/time.h>
25#include <asm/delay.h> 27#include <asm/delay.h>
26#include <asm/io.h> 28#include <asm/io.h>
27#include <asm/hardware/clock.h>
28 29
29#define OMAP2_GP_TIMER1_BASE 0x48028000 30#define OMAP2_GP_TIMER1_BASE 0x48028000
30#define OMAP2_GP_TIMER2_BASE 0x4802a000 31#define OMAP2_GP_TIMER2_BASE 0x4802a000
@@ -103,7 +104,7 @@ static void __init omap2_gp_timer_init(void)
103 if (IS_ERR(sys_ck)) 104 if (IS_ERR(sys_ck))
104 printk(KERN_ERR "Could not get sys_ck\n"); 105 printk(KERN_ERR "Could not get sys_ck\n");
105 else { 106 else {
106 clk_use(sys_ck); 107 clk_enable(sys_ck);
107 tick_period = clk_get_rate(sys_ck) / 100; 108 tick_period = clk_get_rate(sys_ck) / 100;
108 clk_put(sys_ck); 109 clk_put(sys_ck);
109 } 110 }
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 526acbc32067..c1d77f5b3823 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -77,6 +77,8 @@ config MACH_AKITA
77 depends PXA_SHARPSL_27x 77 depends PXA_SHARPSL_27x
78 select PXA_SHARP_Cxx00 78 select PXA_SHARP_Cxx00
79 select MACH_SPITZ 79 select MACH_SPITZ
80 select I2C
81 select I2C_PXA
80 82
81config MACH_SPITZ 83config MACH_SPITZ
82 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support" 84 bool "Enable Sharp Zaurus SL-3000 (Spitz) Support"
@@ -110,12 +112,14 @@ config IWMMXT
110config PXA_SHARP_C7xx 112config PXA_SHARP_C7xx
111 bool 113 bool
112 select PXA_SSP 114 select PXA_SSP
115 select SHARPSL_PM
113 help 116 help
114 Enable support for all Sharp C7xx models 117 Enable support for all Sharp C7xx models
115 118
116config PXA_SHARP_Cxx00 119config PXA_SHARP_Cxx00
117 bool 120 bool
118 select PXA_SSP 121 select PXA_SSP
122 select SHARPSL_PM
119 help 123 help
120 Enable common support for Sharp Cxx00 models 124 Enable common support for Sharp Cxx00 models
121 125
diff --git a/arch/arm/mach-pxa/akita-ioexp.c b/arch/arm/mach-pxa/akita-ioexp.c
index f6d73cc01f78..1b398742ab56 100644
--- a/arch/arm/mach-pxa/akita-ioexp.c
+++ b/arch/arm/mach-pxa/akita-ioexp.c
@@ -124,17 +124,16 @@ static int max7310_detach_client(struct i2c_client *client)
124} 124}
125 125
126static struct i2c_driver max7310_i2c_driver = { 126static struct i2c_driver max7310_i2c_driver = {
127 .owner = THIS_MODULE, 127 .driver = {
128 .name = "akita-max7310", 128 .name = "akita-max7310",
129 },
129 .id = I2C_DRIVERID_AKITAIOEXP, 130 .id = I2C_DRIVERID_AKITAIOEXP,
130 .flags = I2C_DF_NOTIFY,
131 .attach_adapter = max7310_attach_adapter, 131 .attach_adapter = max7310_attach_adapter,
132 .detach_client = max7310_detach_client, 132 .detach_client = max7310_detach_client,
133}; 133};
134 134
135static struct i2c_client max7310_template = { 135static struct i2c_client max7310_template = {
136 name: "akita-max7310", 136 name: "akita-max7310",
137 flags: I2C_CLIENT_ALLOW_USE,
138 driver: &max7310_i2c_driver, 137 driver: &max7310_i2c_driver,
139}; 138};
140 139
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 100fb31b5156..7ffd2de8f2f3 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -213,15 +213,14 @@ static int corgi_mci_init(struct device *dev, irqreturn_t (*corgi_detect_int)(in
213 213
214 corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250); 214 corgi_mci_platform_data.detect_delay = msecs_to_jiffies(250);
215 215
216 err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_detect_int, SA_INTERRUPT, 216 err = request_irq(CORGI_IRQ_GPIO_nSD_DETECT, corgi_detect_int,
217 "MMC card detect", data); 217 SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING,
218 "MMC card detect", data);
218 if (err) { 219 if (err) {
219 printk(KERN_ERR "corgi_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); 220 printk(KERN_ERR "corgi_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
220 return -1; 221 return -1;
221 } 222 }
222 223
223 set_irq_type(CORGI_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
224
225 return 0; 224 return 0;
226} 225}
227 226
@@ -343,7 +342,6 @@ static void __init fixup_corgi(struct machine_desc *desc,
343 342
344#ifdef CONFIG_MACH_CORGI 343#ifdef CONFIG_MACH_CORGI
345MACHINE_START(CORGI, "SHARP Corgi") 344MACHINE_START(CORGI, "SHARP Corgi")
346 .phys_ram = 0xa0000000,
347 .phys_io = 0x40000000, 345 .phys_io = 0x40000000,
348 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 346 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
349 .fixup = fixup_corgi, 347 .fixup = fixup_corgi,
@@ -356,7 +354,6 @@ MACHINE_END
356 354
357#ifdef CONFIG_MACH_SHEPHERD 355#ifdef CONFIG_MACH_SHEPHERD
358MACHINE_START(SHEPHERD, "SHARP Shepherd") 356MACHINE_START(SHEPHERD, "SHARP Shepherd")
359 .phys_ram = 0xa0000000,
360 .phys_io = 0x40000000, 357 .phys_io = 0x40000000,
361 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 358 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
362 .fixup = fixup_corgi, 359 .fixup = fixup_corgi,
@@ -369,7 +366,6 @@ MACHINE_END
369 366
370#ifdef CONFIG_MACH_HUSKY 367#ifdef CONFIG_MACH_HUSKY
371MACHINE_START(HUSKY, "SHARP Husky") 368MACHINE_START(HUSKY, "SHARP Husky")
372 .phys_ram = 0xa0000000,
373 .phys_io = 0x40000000, 369 .phys_io = 0x40000000,
374 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 370 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
375 .fixup = fixup_corgi, 371 .fixup = fixup_corgi,
diff --git a/arch/arm/mach-pxa/corgi_pm.c b/arch/arm/mach-pxa/corgi_pm.c
index 599be14754f9..7a1ab73e9e10 100644
--- a/arch/arm/mach-pxa/corgi_pm.c
+++ b/arch/arm/mach-pxa/corgi_pm.c
@@ -33,19 +33,7 @@ static void corgi_charger_init(void)
33 pxa_gpio_mode(CORGI_GPIO_CHRG_ON | GPIO_OUT); 33 pxa_gpio_mode(CORGI_GPIO_CHRG_ON | GPIO_OUT);
34 pxa_gpio_mode(CORGI_GPIO_CHRG_UKN | GPIO_OUT); 34 pxa_gpio_mode(CORGI_GPIO_CHRG_UKN | GPIO_OUT);
35 pxa_gpio_mode(CORGI_GPIO_KEY_INT | GPIO_IN); 35 pxa_gpio_mode(CORGI_GPIO_KEY_INT | GPIO_IN);
36} 36 sharpsl_pm_pxa_init();
37
38static void corgi_charge_led(int val)
39{
40 if (val == SHARPSL_LED_ERROR) {
41 dev_dbg(sharpsl_pm.dev, "Charge LED Error\n");
42 } else if (val == SHARPSL_LED_ON) {
43 dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
44 GPSR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
45 } else {
46 dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
47 GPCR0 = GPIO_bit(CORGI_GPIO_LED_ORANGE);
48 }
49} 37}
50 38
51static void corgi_measure_temp(int on) 39static void corgi_measure_temp(int on)
@@ -138,15 +126,15 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm)
138 dev_dbg(sharpsl_pm.dev, "GPLR0 = %x,%x\n", GPLR0, PEDR); 126 dev_dbg(sharpsl_pm.dev, "GPLR0 = %x,%x\n", GPLR0, PEDR);
139 127
140 if ((PEDR & GPIO_bit(CORGI_GPIO_AC_IN))) { 128 if ((PEDR & GPIO_bit(CORGI_GPIO_AC_IN))) {
141 if (STATUS_AC_IN()) { 129 if (sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN)) {
142 /* charge on */ 130 /* charge on */
143 dev_dbg(sharpsl_pm.dev, "ac insert\n"); 131 dev_dbg(sharpsl_pm.dev, "ac insert\n");
144 sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG; 132 sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
145 } else { 133 } else {
146 /* charge off */ 134 /* charge off */
147 dev_dbg(sharpsl_pm.dev, "ac remove\n"); 135 dev_dbg(sharpsl_pm.dev, "ac remove\n");
148 CHARGE_LED_OFF(); 136 sharpsl_pm_led(SHARPSL_LED_OFF);
149 CHARGE_OFF(); 137 sharpsl_pm.machinfo->charge(0);
150 sharpsl_pm.charge_mode = CHRG_OFF; 138 sharpsl_pm.charge_mode = CHRG_OFF;
151 } 139 }
152 } 140 }
@@ -172,23 +160,39 @@ static unsigned long corgi_charger_wakeup(void)
172 return ~GPLR0 & ( GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) ); 160 return ~GPLR0 & ( GPIO_bit(CORGI_GPIO_AC_IN) | GPIO_bit(CORGI_GPIO_KEY_INT) | GPIO_bit(CORGI_GPIO_WAKEUP) );
173} 161}
174 162
175static int corgi_acin_status(void) 163unsigned long corgipm_read_devdata(int type)
176{ 164{
177 return ((GPLR(CORGI_GPIO_AC_IN) & GPIO_bit(CORGI_GPIO_AC_IN)) != 0); 165 switch(type) {
166 case SHARPSL_STATUS_ACIN:
167 return ((GPLR(CORGI_GPIO_AC_IN) & GPIO_bit(CORGI_GPIO_AC_IN)) != 0);
168 case SHARPSL_STATUS_LOCK:
169 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock);
170 case SHARPSL_STATUS_CHRGFULL:
171 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull);
172 case SHARPSL_STATUS_FATAL:
173 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal);
174 case SHARPSL_ACIN_VOLT:
175 return sharpsl_pm_pxa_read_max1111(MAX1111_ACIN_VOLT);
176 case SHARPSL_BATT_TEMP:
177 return sharpsl_pm_pxa_read_max1111(MAX1111_BATT_TEMP);
178 case SHARPSL_BATT_VOLT:
179 default:
180 return sharpsl_pm_pxa_read_max1111(MAX1111_BATT_VOLT);
181 }
178} 182}
179 183
180static struct sharpsl_charger_machinfo corgi_pm_machinfo = { 184static struct sharpsl_charger_machinfo corgi_pm_machinfo = {
181 .init = corgi_charger_init, 185 .init = corgi_charger_init,
186 .exit = sharpsl_pm_pxa_remove,
182 .gpio_batlock = CORGI_GPIO_BAT_COVER, 187 .gpio_batlock = CORGI_GPIO_BAT_COVER,
183 .gpio_acin = CORGI_GPIO_AC_IN, 188 .gpio_acin = CORGI_GPIO_AC_IN,
184 .gpio_batfull = CORGI_GPIO_CHRG_FULL, 189 .gpio_batfull = CORGI_GPIO_CHRG_FULL,
185 .status_acin = corgi_acin_status,
186 .discharge = corgi_discharge, 190 .discharge = corgi_discharge,
187 .charge = corgi_charge, 191 .charge = corgi_charge,
188 .chargeled = corgi_charge_led,
189 .measure_temp = corgi_measure_temp, 192 .measure_temp = corgi_measure_temp,
190 .presuspend = corgi_presuspend, 193 .presuspend = corgi_presuspend,
191 .postsuspend = corgi_postsuspend, 194 .postsuspend = corgi_postsuspend,
195 .read_devdata = corgipm_read_devdata,
192 .charger_wakeup = corgi_charger_wakeup, 196 .charger_wakeup = corgi_charger_wakeup,
193 .should_wakeup = corgi_should_wakeup, 197 .should_wakeup = corgi_should_wakeup,
194 .bat_levels = 40, 198 .bat_levels = 40,
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c
index 7de159e2ab42..347b9dea24c6 100644
--- a/arch/arm/mach-pxa/idp.c
+++ b/arch/arm/mach-pxa/idp.c
@@ -183,7 +183,6 @@ static void __init idp_map_io(void)
183 183
184MACHINE_START(PXA_IDP, "Vibren PXA255 IDP") 184MACHINE_START(PXA_IDP, "Vibren PXA255 IDP")
185 /* Maintainer: Vibren Technologies */ 185 /* Maintainer: Vibren Technologies */
186 .phys_ram = 0xa0000000,
187 .phys_io = 0x40000000, 186 .phys_io = 0x40000000,
188 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 187 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
189 .map_io = idp_map_io, 188 .map_io = idp_map_io,
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index b464bc88ff93..3e26d7ce5bb2 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -437,7 +437,6 @@ static void __init lubbock_map_io(void)
437 437
438MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)") 438MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)")
439 /* Maintainer: MontaVista Software Inc. */ 439 /* Maintainer: MontaVista Software Inc. */
440 .phys_ram = 0xa0000000,
441 .phys_io = 0x40000000, 440 .phys_io = 0x40000000,
442 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 441 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
443 .map_io = lubbock_map_io, 442 .map_io = lubbock_map_io,
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 07892f4012d8..d5bda60209ec 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -43,6 +43,7 @@
43#include <asm/arch/pxafb.h> 43#include <asm/arch/pxafb.h>
44#include <asm/arch/mmc.h> 44#include <asm/arch/mmc.h>
45#include <asm/arch/irda.h> 45#include <asm/arch/irda.h>
46#include <asm/arch/ohci.h>
46 47
47#include "generic.h" 48#include "generic.h"
48 49
@@ -393,6 +394,25 @@ static struct platform_device *platform_devices[] __initdata = {
393 &mst_flash_device[1], 394 &mst_flash_device[1],
394}; 395};
395 396
397static int mainstone_ohci_init(struct device *dev)
398{
399 /* setup Port1 GPIO pin. */
400 pxa_gpio_mode( 88 | GPIO_ALT_FN_1_IN); /* USBHPWR1 */
401 pxa_gpio_mode( 89 | GPIO_ALT_FN_2_OUT); /* USBHPEN1 */
402
403 /* Set the Power Control Polarity Low and Power Sense
404 Polarity Low to active low. */
405 UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) &
406 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
407
408 return 0;
409}
410
411static struct pxaohci_platform_data mainstone_ohci_platform_data = {
412 .port_mode = PMM_PERPORT_MODE,
413 .init = mainstone_ohci_init,
414};
415
396static void __init mainstone_init(void) 416static void __init mainstone_init(void)
397{ 417{
398 int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */ 418 int SW7 = 0; /* FIXME: get from SCR (Mst doc section 3.2.1.1) */
@@ -407,6 +427,12 @@ static void __init mainstone_init(void)
407 printk(KERN_NOTICE "Mainstone configured to boot from %s\n", 427 printk(KERN_NOTICE "Mainstone configured to boot from %s\n",
408 mst_flash_data[0].name); 428 mst_flash_data[0].name);
409 429
430 /* system bus arbiter setting
431 * - Core_Park
432 * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
433 */
434 ARB_CNTRL = ARB_CORE_PARK | 0x234;
435
410 /* 436 /*
411 * On Mainstone, we route AC97_SYSCLK via GPIO45 to 437 * On Mainstone, we route AC97_SYSCLK via GPIO45 to
412 * the audio daughter card 438 * the audio daughter card
@@ -424,6 +450,7 @@ static void __init mainstone_init(void)
424 450
425 pxa_set_mci_info(&mainstone_mci_platform_data); 451 pxa_set_mci_info(&mainstone_mci_platform_data);
426 pxa_set_ficp_info(&mainstone_ficp_platform_data); 452 pxa_set_ficp_info(&mainstone_ficp_platform_data);
453 pxa_set_ohci_info(&mainstone_ohci_platform_data);
427} 454}
428 455
429 456
@@ -462,7 +489,6 @@ static void __init mainstone_map_io(void)
462 489
463MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)") 490MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
464 /* Maintainer: MontaVista Software Inc. */ 491 /* Maintainer: MontaVista Software Inc. */
465 .phys_ram = 0xa0000000,
466 .phys_io = 0x40000000, 492 .phys_io = 0x40000000,
467 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 493 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
468 .map_io = mainstone_map_io, 494 .map_io = mainstone_map_io,
diff --git a/arch/arm/mach-pxa/pm.c b/arch/arm/mach-pxa/pm.c
index f74b9af112dc..852ea72d8c80 100644
--- a/arch/arm/mach-pxa/pm.c
+++ b/arch/arm/mach-pxa/pm.c
@@ -155,19 +155,20 @@ int pxa_pm_enter(suspend_state_t state)
155 PSPR = 0; 155 PSPR = 0;
156 156
157 /* restore registers */ 157 /* restore registers */
158 RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2);
159 RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2);
158 RESTORE(GAFR0_L); RESTORE(GAFR0_U); 160 RESTORE(GAFR0_L); RESTORE(GAFR0_U);
159 RESTORE(GAFR1_L); RESTORE(GAFR1_U); 161 RESTORE(GAFR1_L); RESTORE(GAFR1_U);
160 RESTORE(GAFR2_L); RESTORE(GAFR2_U); 162 RESTORE(GAFR2_L); RESTORE(GAFR2_U);
161 RESTORE_GPLEVEL(0); RESTORE_GPLEVEL(1); RESTORE_GPLEVEL(2);
162 RESTORE(GPDR0); RESTORE(GPDR1); RESTORE(GPDR2);
163 RESTORE(GRER0); RESTORE(GRER1); RESTORE(GRER2); 163 RESTORE(GRER0); RESTORE(GRER1); RESTORE(GRER2);
164 RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2); 164 RESTORE(GFER0); RESTORE(GFER1); RESTORE(GFER2);
165 RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2); 165 RESTORE(PGSR0); RESTORE(PGSR1); RESTORE(PGSR2);
166 166
167#ifdef CONFIG_PXA27x 167#ifdef CONFIG_PXA27x
168 RESTORE(MDREFR); 168 RESTORE(MDREFR);
169 RESTORE(GAFR3_L); RESTORE(GAFR3_U); RESTORE_GPLEVEL(3); 169 RESTORE_GPLEVEL(3); RESTORE(GPDR3);
170 RESTORE(GPDR3); RESTORE(GRER3); RESTORE(GFER3); RESTORE(PGSR3); 170 RESTORE(GAFR3_L); RESTORE(GAFR3_U);
171 RESTORE(GRER3); RESTORE(GFER3); RESTORE(PGSR3);
171 RESTORE(PWER); RESTORE(PCFR); RESTORE(PRER); 172 RESTORE(PWER); RESTORE(PCFR); RESTORE(PRER);
172 RESTORE(PFER); RESTORE(PKWR); 173 RESTORE(PFER); RESTORE(PKWR);
173#endif 174#endif
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index eef3de26ad37..911e6ff5a9bd 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -146,15 +146,14 @@ static int poodle_mci_init(struct device *dev, irqreturn_t (*poodle_detect_int)(
146 146
147 poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250); 147 poodle_mci_platform_data.detect_delay = msecs_to_jiffies(250);
148 148
149 err = request_irq(POODLE_IRQ_GPIO_nSD_DETECT, poodle_detect_int, SA_INTERRUPT, 149 err = request_irq(POODLE_IRQ_GPIO_nSD_DETECT, poodle_detect_int,
150 "MMC card detect", data); 150 SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING,
151 "MMC card detect", data);
151 if (err) { 152 if (err) {
152 printk(KERN_ERR "poodle_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); 153 printk(KERN_ERR "poodle_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
153 return -1; 154 return -1;
154 } 155 }
155 156
156 set_irq_type(POODLE_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
157
158 return 0; 157 return 0;
159} 158}
160 159
@@ -312,7 +311,6 @@ static void __init fixup_poodle(struct machine_desc *desc,
312} 311}
313 312
314MACHINE_START(POODLE, "SHARP Poodle") 313MACHINE_START(POODLE, "SHARP Poodle")
315 .phys_ram = 0xa0000000,
316 .phys_io = 0x40000000, 314 .phys_io = 0x40000000,
317 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 315 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
318 .fixup = fixup_poodle, 316 .fixup = fixup_poodle,
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index c722a9a91fcc..b41b1efaa2cf 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -21,6 +21,7 @@
21#include <asm/hardware.h> 21#include <asm/hardware.h>
22#include <asm/irq.h> 22#include <asm/irq.h>
23#include <asm/arch/pxa-regs.h> 23#include <asm/arch/pxa-regs.h>
24#include <asm/arch/ohci.h>
24 25
25#include "generic.h" 26#include "generic.h"
26 27
@@ -194,6 +195,11 @@ static struct platform_device ohci_device = {
194 .resource = pxa27x_ohci_resources, 195 .resource = pxa27x_ohci_resources,
195}; 196};
196 197
198void __init pxa_set_ohci_info(struct pxaohci_platform_data *info)
199{
200 ohci_device.dev.platform_data = info;
201}
202
197static struct platform_device *devices[] __initdata = { 203static struct platform_device *devices[] __initdata = {
198 &ohci_device, 204 &ohci_device,
199}; 205};
diff --git a/arch/arm/mach-pxa/sharpsl.h b/arch/arm/mach-pxa/sharpsl.h
index b0c40a1d6671..da4769caaf72 100644
--- a/arch/arm/mach-pxa/sharpsl.h
+++ b/arch/arm/mach-pxa/sharpsl.h
@@ -1,7 +1,17 @@
1/* 1/*
2 * SharpSL SSP Driver 2 * Copyright (c) 2004-2005 Richard Purdie
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
3 */ 8 */
4 9
10#include <asm/hardware/sharpsl_pm.h>
11
12/*
13 * SharpSL SSP Driver
14 */
5struct corgissp_machinfo { 15struct corgissp_machinfo {
6 int port; 16 int port;
7 int cs_lcdcon; 17 int cs_lcdcon;
@@ -14,18 +24,18 @@ struct corgissp_machinfo {
14 24
15void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo); 25void corgi_ssp_set_machinfo(struct corgissp_machinfo *machinfo);
16 26
27
17/* 28/*
18 * SharpSL Backlight 29 * SharpSL Backlight
19 */ 30 */
20
21void corgi_bl_set_intensity(int intensity); 31void corgi_bl_set_intensity(int intensity);
22void spitz_bl_set_intensity(int intensity); 32void spitz_bl_set_intensity(int intensity);
23void akita_bl_set_intensity(int intensity); 33void akita_bl_set_intensity(int intensity);
24 34
35
25/* 36/*
26 * SharpSL Touchscreen Driver 37 * SharpSL Touchscreen Driver
27 */ 38 */
28
29unsigned long corgi_get_hsync_len(void); 39unsigned long corgi_get_hsync_len(void);
30unsigned long spitz_get_hsync_len(void); 40unsigned long spitz_get_hsync_len(void);
31void corgi_put_hsync(void); 41void corgi_put_hsync(void);
@@ -33,89 +43,22 @@ void spitz_put_hsync(void);
33void corgi_wait_hsync(void); 43void corgi_wait_hsync(void);
34void spitz_wait_hsync(void); 44void spitz_wait_hsync(void);
35 45
46
36/* 47/*
37 * SharpSL Battery/PM Driver 48 * SharpSL Battery/PM Driver
38 */ 49 */
39 50
40struct sharpsl_charger_machinfo { 51#define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x))
41 void (*init)(void);
42 int gpio_acin;
43 int gpio_batfull;
44 int gpio_batlock;
45 int gpio_fatal;
46 int (*status_acin)(void);
47 void (*discharge)(int);
48 void (*discharge1)(int);
49 void (*charge)(int);
50 void (*chargeled)(int);
51 void (*measure_temp)(int);
52 void (*presuspend)(void);
53 void (*postsuspend)(void);
54 unsigned long (*charger_wakeup)(void);
55 int (*should_wakeup)(unsigned int resume_on_alarm);
56 int bat_levels;
57 struct battery_thresh *bat_levels_noac;
58 struct battery_thresh *bat_levels_acin;
59 int status_high_acin;
60 int status_low_acin;
61 int status_high_noac;
62 int status_low_noac;
63};
64
65struct battery_thresh {
66 int voltage;
67 int percentage;
68};
69
70struct battery_stat {
71 int ac_status; /* APM AC Present/Not Present */
72 int mainbat_status; /* APM Main Battery Status */
73 int mainbat_percent; /* Main Battery Percentage Charge */
74 int mainbat_voltage; /* Main Battery Voltage */
75};
76
77struct sharpsl_pm_status {
78 struct device *dev;
79 struct timer_list ac_timer;
80 struct timer_list chrg_full_timer;
81
82 int charge_mode;
83#define CHRG_ERROR (-1)
84#define CHRG_OFF (0)
85#define CHRG_ON (1)
86#define CHRG_DONE (2)
87
88 unsigned int flags;
89#define SHARPSL_SUSPENDED (1 << 0) /* Device is Suspended */
90#define SHARPSL_ALARM_ACTIVE (1 << 1) /* Alarm is for charging event (not user) */
91#define SHARPSL_BL_LIMIT (1 << 2) /* Backlight Intensity Limited */
92#define SHARPSL_APM_QUEUED (1 << 3) /* APM Event Queued */
93#define SHARPSL_DO_OFFLINE_CHRG (1 << 4) /* Trigger the offline charger */
94 52
95 int full_count; 53/* MAX1111 Channel Definitions */
96 unsigned long charge_start_time; 54#define MAX1111_BATT_VOLT 4u
97 struct sharpsl_charger_machinfo *machinfo; 55#define MAX1111_BATT_TEMP 2u
98 struct battery_stat battstat; 56#define MAX1111_ACIN_VOLT 6u
99};
100 57
101extern struct sharpsl_pm_status sharpsl_pm;
102extern struct battery_thresh spitz_battery_levels_acin[]; 58extern struct battery_thresh spitz_battery_levels_acin[];
103extern struct battery_thresh spitz_battery_levels_noac[]; 59extern struct battery_thresh spitz_battery_levels_noac[];
60void sharpsl_pm_pxa_init(void);
61void sharpsl_pm_pxa_remove(void);
62int sharpsl_pm_pxa_read_max1111(int channel);
104 63
105#define READ_GPIO_BIT(x) (GPLR(x) & GPIO_bit(x))
106
107#define SHARPSL_LED_ERROR 2
108#define SHARPSL_LED_ON 1
109#define SHARPSL_LED_OFF 0
110 64
111#define CHARGE_ON() sharpsl_pm.machinfo->charge(1)
112#define CHARGE_OFF() sharpsl_pm.machinfo->charge(0)
113#define CHARGE_LED_ON() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_ON)
114#define CHARGE_LED_OFF() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_OFF)
115#define CHARGE_LED_ERR() sharpsl_pm.machinfo->chargeled(SHARPSL_LED_ERROR)
116#define DISCHARGE_ON() sharpsl_pm.machinfo->discharge(1)
117#define DISCHARGE_OFF() sharpsl_pm.machinfo->discharge(0)
118#define STATUS_AC_IN() sharpsl_pm.machinfo->status_acin()
119#define STATUS_BATT_LOCKED() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock)
120#define STATUS_CHRG_FULL() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull)
121#define STATUS_FATAL() READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal)
diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-pxa/sharpsl_pm.c
index c10be00fb526..6d402b262d8a 100644
--- a/arch/arm/mach-pxa/sharpsl_pm.c
+++ b/arch/arm/mach-pxa/sharpsl_pm.c
@@ -15,48 +15,20 @@
15#undef DEBUG 15#undef DEBUG
16 16
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/timer.h>
19#include <linux/init.h> 18#include <linux/init.h>
20#include <linux/kernel.h> 19#include <linux/kernel.h>
21#include <linux/apm_bios.h>
22#include <linux/delay.h>
23#include <linux/interrupt.h> 20#include <linux/interrupt.h>
24#include <linux/platform_device.h> 21#include <linux/platform_device.h>
25 22
26#include <asm/hardware.h> 23#include <asm/hardware.h>
27#include <asm/hardware/scoop.h>
28#include <asm/mach-types.h> 24#include <asm/mach-types.h>
29#include <asm/irq.h> 25#include <asm/irq.h>
30#include <asm/apm.h> 26#include <asm/apm.h>
31
32#include <asm/arch/pm.h> 27#include <asm/arch/pm.h>
33#include <asm/arch/pxa-regs.h> 28#include <asm/arch/pxa-regs.h>
34#include <asm/arch/sharpsl.h> 29#include <asm/arch/sharpsl.h>
35#include "sharpsl.h" 30#include "sharpsl.h"
36 31
37/*
38 * Constants
39 */
40#define SHARPSL_CHARGE_ON_TIME_INTERVAL (msecs_to_jiffies(1*60*1000)) /* 1 min */
41#define SHARPSL_CHARGE_FINISH_TIME (msecs_to_jiffies(10*60*1000)) /* 10 min */
42#define SHARPSL_BATCHK_TIME (msecs_to_jiffies(15*1000)) /* 15 sec */
43#define SHARPSL_BATCHK_TIME_SUSPEND (60*10) /* 10 min */
44#define SHARPSL_WAIT_CO_TIME 15 /* 15 sec */
45#define SHARPSL_WAIT_DISCHARGE_ON 100 /* 100 msec */
46#define SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP 10 /* 10 msec */
47#define SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT 10 /* 10 msec */
48#define SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN 10 /* 10 msec */
49#define SHARPSL_CHARGE_WAIT_TIME 15 /* 15 msec */
50#define SHARPSL_CHARGE_CO_CHECK_TIME 5 /* 5 msec */
51#define SHARPSL_CHARGE_RETRY_CNT 1 /* eqv. 10 min */
52
53#define SHARPSL_CHARGE_ON_VOLT 0x99 /* 2.9V */
54#define SHARPSL_CHARGE_ON_TEMP 0xe0 /* 2.9V */
55#define SHARPSL_CHARGE_ON_ACIN_HIGH 0x9b /* 6V */
56#define SHARPSL_CHARGE_ON_ACIN_LOW 0x34 /* 2V */
57#define SHARPSL_FATAL_ACIN_VOLT 182 /* 3.45V */
58#define SHARPSL_FATAL_NOACIN_VOLT 170 /* 3.40V */
59
60struct battery_thresh spitz_battery_levels_acin[] = { 32struct battery_thresh spitz_battery_levels_acin[] = {
61 { 213, 100}, 33 { 213, 100},
62 { 212, 98}, 34 { 212, 98},
@@ -151,763 +123,17 @@ struct battery_thresh spitz_battery_levels_noac[] = {
151#define MAXCTRL_SEL_SH 4 123#define MAXCTRL_SEL_SH 4
152#define MAXCTRL_STR 1u << 7 124#define MAXCTRL_STR 1u << 7
153 125
154/* MAX1111 Channel Definitions */
155#define BATT_AD 4u
156#define BATT_THM 2u
157#define JK_VAD 6u
158
159
160/*
161 * Prototypes
162 */
163static int sharpsl_read_main_battery(void);
164static int sharpsl_off_charge_battery(void);
165static int sharpsl_check_battery_temp(void);
166static int sharpsl_check_battery_voltage(void);
167static int sharpsl_ac_check(void);
168static int sharpsl_fatal_check(void);
169static int sharpsl_average_value(int ad);
170static void sharpsl_average_clear(void);
171static void sharpsl_charge_toggle(void *private_);
172static void sharpsl_battery_thread(void *private_);
173
174
175/*
176 * Variables
177 */
178struct sharpsl_pm_status sharpsl_pm;
179DECLARE_WORK(toggle_charger, sharpsl_charge_toggle, NULL);
180DECLARE_WORK(sharpsl_bat, sharpsl_battery_thread, NULL);
181
182
183static int get_percentage(int voltage)
184{
185 int i = sharpsl_pm.machinfo->bat_levels - 1;
186 struct battery_thresh *thresh;
187
188 if (sharpsl_pm.charge_mode == CHRG_ON)
189 thresh=sharpsl_pm.machinfo->bat_levels_acin;
190 else
191 thresh=sharpsl_pm.machinfo->bat_levels_noac;
192
193 while (i > 0 && (voltage > thresh[i].voltage))
194 i--;
195
196 return thresh[i].percentage;
197}
198
199static int get_apm_status(int voltage)
200{
201 int low_thresh, high_thresh;
202
203 if (sharpsl_pm.charge_mode == CHRG_ON) {
204 high_thresh = sharpsl_pm.machinfo->status_high_acin;
205 low_thresh = sharpsl_pm.machinfo->status_low_acin;
206 } else {
207 high_thresh = sharpsl_pm.machinfo->status_high_noac;
208 low_thresh = sharpsl_pm.machinfo->status_low_noac;
209 }
210
211 if (voltage >= high_thresh)
212 return APM_BATTERY_STATUS_HIGH;
213 if (voltage >= low_thresh)
214 return APM_BATTERY_STATUS_LOW;
215 return APM_BATTERY_STATUS_CRITICAL;
216}
217
218void sharpsl_battery_kick(void)
219{
220 schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(125));
221}
222EXPORT_SYMBOL(sharpsl_battery_kick);
223
224
225static void sharpsl_battery_thread(void *private_)
226{
227 int voltage, percent, apm_status, i = 0;
228
229 if (!sharpsl_pm.machinfo)
230 return;
231
232 sharpsl_pm.battstat.ac_status = (STATUS_AC_IN() ? APM_AC_ONLINE : APM_AC_OFFLINE);
233
234 /* Corgi cannot confirm when battery fully charged so periodically kick! */
235 if (machine_is_corgi() && (sharpsl_pm.charge_mode == CHRG_ON)
236 && time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_ON_TIME_INTERVAL))
237 schedule_work(&toggle_charger);
238
239 while(1) {
240 voltage = sharpsl_read_main_battery();
241 if (voltage > 0) break;
242 if (i++ > 5) {
243 voltage = sharpsl_pm.machinfo->bat_levels_noac[0].voltage;
244 dev_warn(sharpsl_pm.dev, "Warning: Cannot read main battery!\n");
245 break;
246 }
247 }
248
249 voltage = sharpsl_average_value(voltage);
250 apm_status = get_apm_status(voltage);
251 percent = get_percentage(voltage);
252
253 /* At low battery voltages, the voltage has a tendency to start
254 creeping back up so we try to avoid this here */
255 if ((sharpsl_pm.battstat.ac_status == APM_AC_ONLINE) || (apm_status == APM_BATTERY_STATUS_HIGH) || percent <= sharpsl_pm.battstat.mainbat_percent) {
256 sharpsl_pm.battstat.mainbat_voltage = voltage;
257 sharpsl_pm.battstat.mainbat_status = apm_status;
258 sharpsl_pm.battstat.mainbat_percent = percent;
259 }
260
261 dev_dbg(sharpsl_pm.dev, "Battery: voltage: %d, status: %d, percentage: %d, time: %d\n", voltage,
262 sharpsl_pm.battstat.mainbat_status, sharpsl_pm.battstat.mainbat_percent, jiffies);
263
264 /* If battery is low. limit backlight intensity to save power. */
265 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
266 && ((sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_LOW) ||
267 (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL))) {
268 if (!(sharpsl_pm.flags & SHARPSL_BL_LIMIT)) {
269 corgibl_limit_intensity(1);
270 sharpsl_pm.flags |= SHARPSL_BL_LIMIT;
271 }
272 } else if (sharpsl_pm.flags & SHARPSL_BL_LIMIT) {
273 corgibl_limit_intensity(0);
274 sharpsl_pm.flags &= ~SHARPSL_BL_LIMIT;
275 }
276
277 /* Suspend if critical battery level */
278 if ((sharpsl_pm.battstat.ac_status != APM_AC_ONLINE)
279 && (sharpsl_pm.battstat.mainbat_status == APM_BATTERY_STATUS_CRITICAL)
280 && !(sharpsl_pm.flags & SHARPSL_APM_QUEUED)) {
281 sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
282 dev_err(sharpsl_pm.dev, "Fatal Off\n");
283 apm_queue_event(APM_CRITICAL_SUSPEND);
284 }
285
286 schedule_delayed_work(&sharpsl_bat, SHARPSL_BATCHK_TIME);
287}
288
289static void sharpsl_charge_on(void)
290{
291 dev_dbg(sharpsl_pm.dev, "Turning Charger On\n");
292
293 sharpsl_pm.full_count = 0;
294 sharpsl_pm.charge_mode = CHRG_ON;
295 schedule_delayed_work(&toggle_charger, msecs_to_jiffies(250));
296 schedule_delayed_work(&sharpsl_bat, msecs_to_jiffies(500));
297}
298
299static void sharpsl_charge_off(void)
300{
301 dev_dbg(sharpsl_pm.dev, "Turning Charger Off\n");
302
303 CHARGE_OFF();
304 CHARGE_LED_OFF();
305 sharpsl_pm.charge_mode = CHRG_OFF;
306
307 schedule_work(&sharpsl_bat);
308}
309
310static void sharpsl_charge_error(void)
311{
312 CHARGE_LED_ERR();
313 CHARGE_OFF();
314 sharpsl_pm.charge_mode = CHRG_ERROR;
315}
316
317static void sharpsl_charge_toggle(void *private_)
318{
319 dev_dbg(sharpsl_pm.dev, "Toogling Charger at time: %lx\n", jiffies);
320
321 if (STATUS_AC_IN() == 0) {
322 sharpsl_charge_off();
323 return;
324 } else if ((sharpsl_check_battery_temp() < 0) || (sharpsl_ac_check() < 0)) {
325 sharpsl_charge_error();
326 return;
327 }
328
329 CHARGE_LED_ON();
330 CHARGE_OFF();
331 mdelay(SHARPSL_CHARGE_WAIT_TIME);
332 CHARGE_ON();
333
334 sharpsl_pm.charge_start_time = jiffies;
335}
336
337static void sharpsl_ac_timer(unsigned long data)
338{
339 int acin = STATUS_AC_IN();
340
341 dev_dbg(sharpsl_pm.dev, "AC Status: %d\n",acin);
342
343 sharpsl_average_clear();
344 if (acin && (sharpsl_pm.charge_mode != CHRG_ON))
345 sharpsl_charge_on();
346 else if (sharpsl_pm.charge_mode == CHRG_ON)
347 sharpsl_charge_off();
348
349 schedule_work(&sharpsl_bat);
350}
351
352
353static irqreturn_t sharpsl_ac_isr(int irq, void *dev_id, struct pt_regs *fp)
354{
355 /* Delay the event slightly to debounce */
356 /* Must be a smaller delay than the chrg_full_isr below */
357 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250));
358
359 return IRQ_HANDLED;
360}
361
362static void sharpsl_chrg_full_timer(unsigned long data)
363{
364 dev_dbg(sharpsl_pm.dev, "Charge Full at time: %lx\n", jiffies);
365
366 sharpsl_pm.full_count++;
367
368 if (STATUS_AC_IN() == 0) {
369 dev_dbg(sharpsl_pm.dev, "Charge Full: AC removed - stop charging!\n");
370 if (sharpsl_pm.charge_mode == CHRG_ON)
371 sharpsl_charge_off();
372 } else if (sharpsl_pm.full_count < 2) {
373 dev_dbg(sharpsl_pm.dev, "Charge Full: Count too low\n");
374 schedule_work(&toggle_charger);
375 } else if (time_after(jiffies, sharpsl_pm.charge_start_time + SHARPSL_CHARGE_FINISH_TIME)) {
376 dev_dbg(sharpsl_pm.dev, "Charge Full: Interrupt generated too slowly - retry.\n");
377 schedule_work(&toggle_charger);
378 } else {
379 sharpsl_charge_off();
380 sharpsl_pm.charge_mode = CHRG_DONE;
381 dev_dbg(sharpsl_pm.dev, "Charge Full: Charging Finished\n");
382 }
383}
384
385/* Charging Finished Interrupt (Not present on Corgi) */
386/* Can trigger at the same time as an AC staus change so
387 delay until after that has been processed */
388static irqreturn_t sharpsl_chrg_full_isr(int irq, void *dev_id, struct pt_regs *fp)
389{
390 if (sharpsl_pm.flags & SHARPSL_SUSPENDED)
391 return IRQ_HANDLED;
392
393 /* delay until after any ac interrupt */
394 mod_timer(&sharpsl_pm.chrg_full_timer, jiffies + msecs_to_jiffies(500));
395
396 return IRQ_HANDLED;
397}
398
399static irqreturn_t sharpsl_fatal_isr(int irq, void *dev_id, struct pt_regs *fp)
400{
401 int is_fatal = 0;
402
403 if (STATUS_BATT_LOCKED() == 0) {
404 dev_err(sharpsl_pm.dev, "Battery now Unlocked! Suspending.\n");
405 is_fatal = 1;
406 }
407
408 if (sharpsl_pm.machinfo->gpio_fatal && (STATUS_FATAL() == 0)) {
409 dev_err(sharpsl_pm.dev, "Fatal Batt Error! Suspending.\n");
410 is_fatal = 1;
411 }
412
413 if (!(sharpsl_pm.flags & SHARPSL_APM_QUEUED) && is_fatal) {
414 sharpsl_pm.flags |= SHARPSL_APM_QUEUED;
415 apm_queue_event(APM_CRITICAL_SUSPEND);
416 }
417
418 return IRQ_HANDLED;
419}
420
421/*
422 * Maintain an average of the last 10 readings
423 */
424#define SHARPSL_CNV_VALUE_NUM 10
425static int sharpsl_ad_index;
426
427static void sharpsl_average_clear(void)
428{
429 sharpsl_ad_index = 0;
430}
431
432static int sharpsl_average_value(int ad)
433{
434 int i, ad_val = 0;
435 static int sharpsl_ad[SHARPSL_CNV_VALUE_NUM+1];
436
437 if (sharpsl_pm.battstat.mainbat_status != APM_BATTERY_STATUS_HIGH) {
438 sharpsl_ad_index = 0;
439 return ad;
440 }
441
442 sharpsl_ad[sharpsl_ad_index] = ad;
443 sharpsl_ad_index++;
444 if (sharpsl_ad_index >= SHARPSL_CNV_VALUE_NUM) {
445 for (i=0; i < (SHARPSL_CNV_VALUE_NUM-1); i++)
446 sharpsl_ad[i] = sharpsl_ad[i+1];
447 sharpsl_ad_index = SHARPSL_CNV_VALUE_NUM - 1;
448 }
449 for (i=0; i < sharpsl_ad_index; i++)
450 ad_val += sharpsl_ad[i];
451
452 return (ad_val / sharpsl_ad_index);
453}
454
455
456/* 126/*
457 * Read MAX1111 ADC 127 * Read MAX1111 ADC
458 */ 128 */
459static int read_max1111(int channel) 129int sharpsl_pm_pxa_read_max1111(int channel)
460{ 130{
461 return corgi_ssp_max1111_get((channel << MAXCTRL_SEL_SH) | MAXCTRL_PD0 | MAXCTRL_PD1 131 return corgi_ssp_max1111_get((channel << MAXCTRL_SEL_SH) | MAXCTRL_PD0 | MAXCTRL_PD1
462 | MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR); 132 | MAXCTRL_SGL | MAXCTRL_UNI | MAXCTRL_STR);
463} 133}
464 134
465static int sharpsl_read_main_battery(void) 135void sharpsl_pm_pxa_init(void)
466{
467 return read_max1111(BATT_AD);
468}
469
470static int sharpsl_read_temp(void)
471{ 136{
472 int temp;
473
474 sharpsl_pm.machinfo->measure_temp(1);
475
476 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
477 temp = read_max1111(BATT_THM);
478
479 sharpsl_pm.machinfo->measure_temp(0);
480
481 return temp;
482}
483
484static int sharpsl_read_acin(void)
485{
486 return read_max1111(JK_VAD);
487}
488
489/*
490 * Take an array of 5 integers, remove the maximum and minimum values
491 * and return the average.
492 */
493static int get_select_val(int *val)
494{
495 int i, j, k, temp, sum = 0;
496
497 /* Find MAX val */
498 temp = val[0];
499 j=0;
500 for (i=1; i<5; i++) {
501 if (temp < val[i]) {
502 temp = val[i];
503 j = i;
504 }
505 }
506
507 /* Find MIN val */
508 temp = val[4];
509 k=4;
510 for (i=3; i>=0; i--) {
511 if (temp > val[i]) {
512 temp = val[i];
513 k = i;
514 }
515 }
516
517 for (i=0; i<5; i++)
518 if (i != j && i != k )
519 sum += val[i];
520
521 dev_dbg(sharpsl_pm.dev, "Average: %d from values: %d, %d, %d, %d, %d\n", sum/3, val[0], val[1], val[2], val[3], val[4]);
522
523 return (sum/3);
524}
525
526static int sharpsl_check_battery_temp(void)
527{
528 int val, i, buff[5];
529
530 /* Check battery temperature */
531 for (i=0; i<5; i++) {
532 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_TEMP);
533 buff[i] = sharpsl_read_temp();
534 }
535
536 val = get_select_val(buff);
537
538 dev_dbg(sharpsl_pm.dev, "Temperature: %d\n", val);
539 if (val > SHARPSL_CHARGE_ON_TEMP)
540 return -1;
541
542 return 0;
543}
544
545static int sharpsl_check_battery_voltage(void)
546{
547 int val, i, buff[5];
548
549 /* disable charge, enable discharge */
550 CHARGE_OFF();
551 DISCHARGE_ON();
552 mdelay(SHARPSL_WAIT_DISCHARGE_ON);
553
554 if (sharpsl_pm.machinfo->discharge1)
555 sharpsl_pm.machinfo->discharge1(1);
556
557 /* Check battery voltage */
558 for (i=0; i<5; i++) {
559 buff[i] = sharpsl_read_main_battery();
560 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
561 }
562
563 if (sharpsl_pm.machinfo->discharge1)
564 sharpsl_pm.machinfo->discharge1(0);
565
566 DISCHARGE_OFF();
567
568 val = get_select_val(buff);
569 dev_dbg(sharpsl_pm.dev, "Battery Voltage: %d\n", val);
570
571 if (val < SHARPSL_CHARGE_ON_VOLT)
572 return -1;
573
574 return 0;
575}
576
577static int sharpsl_ac_check(void)
578{
579 int temp, i, buff[5];
580
581 for (i=0; i<5; i++) {
582 buff[i] = sharpsl_read_acin();
583 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_ACIN);
584 }
585
586 temp = get_select_val(buff);
587 dev_dbg(sharpsl_pm.dev, "AC Voltage: %d\n",temp);
588
589 if ((temp > SHARPSL_CHARGE_ON_ACIN_HIGH) || (temp < SHARPSL_CHARGE_ON_ACIN_LOW)) {
590 dev_err(sharpsl_pm.dev, "Error: AC check failed.\n");
591 return -1;
592 }
593
594 return 0;
595}
596
597#ifdef CONFIG_PM
598static int sharpsl_pm_suspend(struct platform_device *pdev, pm_message_t state)
599{
600 sharpsl_pm.flags |= SHARPSL_SUSPENDED;
601 flush_scheduled_work();
602
603 if (sharpsl_pm.charge_mode == CHRG_ON)
604 sharpsl_pm.flags |= SHARPSL_DO_OFFLINE_CHRG;
605 else
606 sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG;
607
608 return 0;
609}
610
611static int sharpsl_pm_resume(struct platform_device *pdev)
612{
613 /* Clear the reset source indicators as they break the bootloader upon reboot */
614 RCSR = 0x0f;
615 sharpsl_average_clear();
616 sharpsl_pm.flags &= ~SHARPSL_APM_QUEUED;
617 sharpsl_pm.flags &= ~SHARPSL_SUSPENDED;
618
619 return 0;
620}
621
622static void corgi_goto_sleep(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
623{
624 dev_dbg(sharpsl_pm.dev, "Time is: %08x\n",RCNR);
625
626 dev_dbg(sharpsl_pm.dev, "Offline Charge Activate = %d\n",sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG);
627 /* not charging and AC-IN! */
628
629 if ((sharpsl_pm.flags & SHARPSL_DO_OFFLINE_CHRG) && (STATUS_AC_IN() != 0)) {
630 dev_dbg(sharpsl_pm.dev, "Activating Offline Charger...\n");
631 sharpsl_pm.charge_mode = CHRG_OFF;
632 sharpsl_pm.flags &= ~SHARPSL_DO_OFFLINE_CHRG;
633 sharpsl_off_charge_battery();
634 }
635
636 sharpsl_pm.machinfo->presuspend();
637
638 PEDR = 0xffffffff; /* clear it */
639
640 sharpsl_pm.flags &= ~SHARPSL_ALARM_ACTIVE;
641 if ((sharpsl_pm.charge_mode == CHRG_ON) && ((alarm_enable && ((alarm_time - RCNR) > (SHARPSL_BATCHK_TIME_SUSPEND + 30))) || !alarm_enable)) {
642 RTSR &= RTSR_ALE;
643 RTAR = RCNR + SHARPSL_BATCHK_TIME_SUSPEND;
644 dev_dbg(sharpsl_pm.dev, "Charging alarm at: %08x\n",RTAR);
645 sharpsl_pm.flags |= SHARPSL_ALARM_ACTIVE;
646 } else if (alarm_enable) {
647 RTSR &= RTSR_ALE;
648 RTAR = alarm_time;
649 dev_dbg(sharpsl_pm.dev, "User alarm at: %08x\n",RTAR);
650 } else {
651 dev_dbg(sharpsl_pm.dev, "No alarms set.\n");
652 }
653
654 pxa_pm_enter(state);
655
656 sharpsl_pm.machinfo->postsuspend();
657
658 dev_dbg(sharpsl_pm.dev, "Corgi woken up from suspend: %08x\n",PEDR);
659}
660
661static int corgi_enter_suspend(unsigned long alarm_time, unsigned int alarm_enable, suspend_state_t state)
662{
663 if (!sharpsl_pm.machinfo->should_wakeup(!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE) && alarm_enable) )
664 {
665 if (!(sharpsl_pm.flags & SHARPSL_ALARM_ACTIVE)) {
666 dev_dbg(sharpsl_pm.dev, "No user triggered wakeup events and not charging. Strange. Suspend.\n");
667 corgi_goto_sleep(alarm_time, alarm_enable, state);
668 return 1;
669 }
670 if(sharpsl_off_charge_battery()) {
671 dev_dbg(sharpsl_pm.dev, "Charging. Suspend...\n");
672 corgi_goto_sleep(alarm_time, alarm_enable, state);
673 return 1;
674 }
675 dev_dbg(sharpsl_pm.dev, "User triggered wakeup in offline charger.\n");
676 }
677
678 if ((STATUS_BATT_LOCKED() == 0) || (sharpsl_fatal_check() < 0) )
679 {
680 dev_err(sharpsl_pm.dev, "Fatal condition. Suspend.\n");
681 corgi_goto_sleep(alarm_time, alarm_enable, state);
682 return 1;
683 }
684
685 return 0;
686}
687
688static int corgi_pxa_pm_enter(suspend_state_t state)
689{
690 unsigned long alarm_time = RTAR;
691 unsigned int alarm_status = ((RTSR & RTSR_ALE) != 0);
692
693 dev_dbg(sharpsl_pm.dev, "SharpSL suspending for first time.\n");
694
695 corgi_goto_sleep(alarm_time, alarm_status, state);
696
697 while (corgi_enter_suspend(alarm_time,alarm_status,state))
698 {}
699
700 dev_dbg(sharpsl_pm.dev, "SharpSL resuming...\n");
701
702 return 0;
703}
704#endif
705
706
707/*
708 * Check for fatal battery errors
709 * Fatal returns -1
710 */
711static int sharpsl_fatal_check(void)
712{
713 int buff[5], temp, i, acin;
714
715 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check entered\n");
716
717 /* Check AC-Adapter */
718 acin = STATUS_AC_IN();
719
720 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
721 CHARGE_OFF();
722 udelay(100);
723 DISCHARGE_ON(); /* enable discharge */
724 mdelay(SHARPSL_WAIT_DISCHARGE_ON);
725 }
726
727 if (sharpsl_pm.machinfo->discharge1)
728 sharpsl_pm.machinfo->discharge1(1);
729
730 /* Check battery : check inserting battery ? */
731 for (i=0; i<5; i++) {
732 buff[i] = sharpsl_read_main_battery();
733 mdelay(SHARPSL_CHECK_BATTERY_WAIT_TIME_VOLT);
734 }
735
736 if (sharpsl_pm.machinfo->discharge1)
737 sharpsl_pm.machinfo->discharge1(0);
738
739 if (acin && (sharpsl_pm.charge_mode == CHRG_ON)) {
740 udelay(100);
741 CHARGE_ON();
742 DISCHARGE_OFF();
743 }
744
745 temp = get_select_val(buff);
746 dev_dbg(sharpsl_pm.dev, "sharpsl_fatal_check: acin: %d, discharge voltage: %d, no discharge: %d\n", acin, temp, sharpsl_read_main_battery());
747
748 if ((acin && (temp < SHARPSL_FATAL_ACIN_VOLT)) ||
749 (!acin && (temp < SHARPSL_FATAL_NOACIN_VOLT)))
750 return -1;
751 return 0;
752}
753
754static int sharpsl_off_charge_error(void)
755{
756 dev_err(sharpsl_pm.dev, "Offline Charger: Error occured.\n");
757 CHARGE_OFF();
758 CHARGE_LED_ERR();
759 sharpsl_pm.charge_mode = CHRG_ERROR;
760 return 1;
761}
762
763/*
764 * Charging Control while suspended
765 * Return 1 - go straight to sleep
766 * Return 0 - sleep or wakeup depending on other factors
767 */
768static int sharpsl_off_charge_battery(void)
769{
770 int time;
771
772 dev_dbg(sharpsl_pm.dev, "Charge Mode: %d\n", sharpsl_pm.charge_mode);
773
774 if (sharpsl_pm.charge_mode == CHRG_OFF) {
775 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 1\n");
776
777 /* AC Check */
778 if ((sharpsl_ac_check() < 0) || (sharpsl_check_battery_temp() < 0))
779 return sharpsl_off_charge_error();
780
781 /* Start Charging */
782 CHARGE_LED_ON();
783 CHARGE_OFF();
784 mdelay(SHARPSL_CHARGE_WAIT_TIME);
785 CHARGE_ON();
786
787 sharpsl_pm.charge_mode = CHRG_ON;
788 sharpsl_pm.full_count = 0;
789
790 return 1;
791 } else if (sharpsl_pm.charge_mode != CHRG_ON) {
792 return 1;
793 }
794
795 if (sharpsl_pm.full_count == 0) {
796 int time;
797
798 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 2\n");
799
800 if ((sharpsl_check_battery_temp() < 0) || (sharpsl_check_battery_voltage() < 0))
801 return sharpsl_off_charge_error();
802
803 CHARGE_OFF();
804 mdelay(SHARPSL_CHARGE_WAIT_TIME);
805 CHARGE_ON();
806 sharpsl_pm.charge_mode = CHRG_ON;
807
808 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
809
810 time = RCNR;
811 while(1) {
812 /* Check if any wakeup event had occured */
813 if (sharpsl_pm.machinfo->charger_wakeup() != 0)
814 return 0;
815 /* Check for timeout */
816 if ((RCNR - time) > SHARPSL_WAIT_CO_TIME)
817 return 1;
818 if (STATUS_CHRG_FULL()) {
819 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charge full occured. Retrying to check\n");
820 sharpsl_pm.full_count++;
821 CHARGE_OFF();
822 mdelay(SHARPSL_CHARGE_WAIT_TIME);
823 CHARGE_ON();
824 return 1;
825 }
826 }
827 }
828
829 dev_dbg(sharpsl_pm.dev, "Offline Charger: Step 3\n");
830
831 mdelay(SHARPSL_CHARGE_CO_CHECK_TIME);
832
833 time = RCNR;
834 while(1) {
835 /* Check if any wakeup event had occured */
836 if (sharpsl_pm.machinfo->charger_wakeup() != 0)
837 return 0;
838 /* Check for timeout */
839 if ((RCNR-time) > SHARPSL_WAIT_CO_TIME) {
840 if (sharpsl_pm.full_count > SHARPSL_CHARGE_RETRY_CNT) {
841 dev_dbg(sharpsl_pm.dev, "Offline Charger: Not charged sufficiently. Retrying.\n");
842 sharpsl_pm.full_count = 0;
843 }
844 sharpsl_pm.full_count++;
845 return 1;
846 }
847 if (STATUS_CHRG_FULL()) {
848 dev_dbg(sharpsl_pm.dev, "Offline Charger: Charging complete.\n");
849 CHARGE_LED_OFF();
850 CHARGE_OFF();
851 sharpsl_pm.charge_mode = CHRG_DONE;
852 return 1;
853 }
854 }
855}
856
857
858static ssize_t battery_percentage_show(struct device *dev, struct device_attribute *attr, char *buf)
859{
860 return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_percent);
861}
862
863static ssize_t battery_voltage_show(struct device *dev, struct device_attribute *attr, char *buf)
864{
865 return sprintf(buf, "%d\n",sharpsl_pm.battstat.mainbat_voltage);
866}
867
868static DEVICE_ATTR(battery_percentage, 0444, battery_percentage_show, NULL);
869static DEVICE_ATTR(battery_voltage, 0444, battery_voltage_show, NULL);
870
871extern void (*apm_get_power_status)(struct apm_power_info *);
872
873static void sharpsl_apm_get_power_status(struct apm_power_info *info)
874{
875 info->ac_line_status = sharpsl_pm.battstat.ac_status;
876
877 if (sharpsl_pm.charge_mode == CHRG_ON)
878 info->battery_status = APM_BATTERY_STATUS_CHARGING;
879 else
880 info->battery_status = sharpsl_pm.battstat.mainbat_status;
881
882 info->battery_flag = (1 << info->battery_status);
883 info->battery_life = sharpsl_pm.battstat.mainbat_percent;
884}
885
886static struct pm_ops sharpsl_pm_ops = {
887 .pm_disk_mode = PM_DISK_FIRMWARE,
888 .prepare = pxa_pm_prepare,
889 .enter = corgi_pxa_pm_enter,
890 .finish = pxa_pm_finish,
891};
892
893static int __init sharpsl_pm_probe(struct platform_device *pdev)
894{
895 if (!pdev->dev.platform_data)
896 return -EINVAL;
897
898 sharpsl_pm.dev = &pdev->dev;
899 sharpsl_pm.machinfo = pdev->dev.platform_data;
900 sharpsl_pm.charge_mode = CHRG_OFF;
901 sharpsl_pm.flags = 0;
902
903 sharpsl_pm.machinfo->init();
904
905 init_timer(&sharpsl_pm.ac_timer);
906 sharpsl_pm.ac_timer.function = sharpsl_ac_timer;
907
908 init_timer(&sharpsl_pm.chrg_full_timer);
909 sharpsl_pm.chrg_full_timer.function = sharpsl_chrg_full_timer;
910
911 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_acin | GPIO_IN); 137 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_acin | GPIO_IN);
912 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batfull | GPIO_IN); 138 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batfull | GPIO_IN);
913 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batlock | GPIO_IN); 139 pxa_gpio_mode(sharpsl_pm.machinfo->gpio_batlock | GPIO_IN);
@@ -938,26 +164,10 @@ static int __init sharpsl_pm_probe(struct platform_device *pdev)
938 } 164 }
939 else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull),IRQT_RISING); 165 else set_irq_type(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull),IRQT_RISING);
940 } 166 }
941
942 device_create_file(&pdev->dev, &dev_attr_battery_percentage);
943 device_create_file(&pdev->dev, &dev_attr_battery_voltage);
944
945 apm_get_power_status = sharpsl_apm_get_power_status;
946
947 pm_set_ops(&sharpsl_pm_ops);
948
949 mod_timer(&sharpsl_pm.ac_timer, jiffies + msecs_to_jiffies(250));
950
951 return 0;
952} 167}
953 168
954static int sharpsl_pm_remove(struct platform_device *pdev) 169void sharpsl_pm_pxa_remove(void)
955{ 170{
956 pm_set_ops(NULL);
957
958 device_remove_file(&pdev->dev, &dev_attr_battery_percentage);
959 device_remove_file(&pdev->dev, &dev_attr_battery_voltage);
960
961 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr); 171 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_acin), sharpsl_ac_isr);
962 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr); 172 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batlock), sharpsl_fatal_isr);
963 173
@@ -966,32 +176,4 @@ static int sharpsl_pm_remove(struct platform_device *pdev)
966 176
967 if (!machine_is_corgi()) 177 if (!machine_is_corgi())
968 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr); 178 free_irq(IRQ_GPIO(sharpsl_pm.machinfo->gpio_batfull), sharpsl_chrg_full_isr);
969
970 del_timer_sync(&sharpsl_pm.chrg_full_timer);
971 del_timer_sync(&sharpsl_pm.ac_timer);
972
973 return 0;
974} 179}
975
976static struct platform_driver sharpsl_pm_driver = {
977 .probe = sharpsl_pm_probe,
978 .remove = sharpsl_pm_remove,
979 .suspend = sharpsl_pm_suspend,
980 .resume = sharpsl_pm_resume,
981 .driver = {
982 .name = "sharpsl-pm",
983 },
984};
985
986static int __devinit sharpsl_pm_init(void)
987{
988 return platform_driver_register(&sharpsl_pm_driver);
989}
990
991static void sharpsl_pm_exit(void)
992{
993 platform_driver_unregister(&sharpsl_pm_driver);
994}
995
996late_initcall(sharpsl_pm_init);
997module_exit(sharpsl_pm_exit);
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 2df1b56615b1..c094d99ebf56 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -36,6 +36,7 @@
36#include <asm/arch/irq.h> 36#include <asm/arch/irq.h>
37#include <asm/arch/irda.h> 37#include <asm/arch/irda.h>
38#include <asm/arch/mmc.h> 38#include <asm/arch/mmc.h>
39#include <asm/arch/ohci.h>
39#include <asm/arch/udc.h> 40#include <asm/arch/udc.h>
40#include <asm/arch/pxafb.h> 41#include <asm/arch/pxafb.h>
41#include <asm/arch/akita.h> 42#include <asm/arch/akita.h>
@@ -126,10 +127,12 @@ static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
126 cpr &= ~0x0002; 127 cpr &= ~0x0002;
127 if (device == SPITZ_PWR_SD) 128 if (device == SPITZ_PWR_SD)
128 cpr &= ~0x0004; 129 cpr &= ~0x0004;
129 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
130 if (!(cpr & 0x0002) && !(cpr & 0x0004)) { 130 if (!(cpr & 0x0002) && !(cpr & 0x0004)) {
131 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000);
131 mdelay(1); 132 mdelay(1);
132 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); 133 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
134 } else {
135 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
133 } 136 }
134 } 137 }
135} 138}
@@ -293,15 +296,14 @@ static int spitz_mci_init(struct device *dev, irqreturn_t (*spitz_detect_int)(in
293 296
294 spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250); 297 spitz_mci_platform_data.detect_delay = msecs_to_jiffies(250);
295 298
296 err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int, SA_INTERRUPT, 299 err = request_irq(SPITZ_IRQ_GPIO_nSD_DETECT, spitz_detect_int,
297 "MMC card detect", data); 300 SA_INTERRUPT | SA_TRIGGER_RISING | SA_TRIGGER_FALLING,
301 "MMC card detect", data);
298 if (err) { 302 if (err) {
299 printk(KERN_ERR "spitz_mci_init: MMC/SD: can't request MMC card detect IRQ\n"); 303 printk(KERN_ERR "spitz_mci_init: MMC/SD: can't request MMC card detect IRQ\n");
300 return -1; 304 return -1;
301 } 305 }
302 306
303 set_irq_type(SPITZ_IRQ_GPIO_nSD_DETECT, IRQT_BOTHEDGE);
304
305 return 0; 307 return 0;
306} 308}
307 309
@@ -335,6 +337,35 @@ static struct pxamci_platform_data spitz_mci_platform_data = {
335 337
336 338
337/* 339/*
340 * USB Host (OHCI)
341 */
342static int spitz_ohci_init(struct device *dev)
343{
344 /* Only Port 2 is connected */
345 pxa_gpio_mode(SPITZ_GPIO_USB_CONNECT | GPIO_IN);
346 pxa_gpio_mode(SPITZ_GPIO_USB_HOST | GPIO_OUT);
347 pxa_gpio_mode(SPITZ_GPIO_USB_DEVICE | GPIO_IN);
348
349 /* Setup USB Port 2 Output Control Register */
350 UP2OCR = UP2OCR_HXS | UP2OCR_HXOE | UP2OCR_DPPDE | UP2OCR_DMPDE;
351
352 GPSR(SPITZ_GPIO_USB_HOST) = GPIO_bit(SPITZ_GPIO_USB_HOST);
353
354 UHCHR = (UHCHR) &
355 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
356
357 UHCRHDA |= UHCRHDA_NOCP;
358
359 return 0;
360}
361
362static struct pxaohci_platform_data spitz_ohci_platform_data = {
363 .port_mode = PMM_NPS_MODE,
364 .init = spitz_ohci_init,
365};
366
367
368/*
338 * Irda 369 * Irda
339 */ 370 */
340static void spitz_irda_transceiver_mode(struct device *dev, int mode) 371static void spitz_irda_transceiver_mode(struct device *dev, int mode)
@@ -411,6 +442,7 @@ static void __init common_init(void)
411 442
412 platform_add_devices(devices, ARRAY_SIZE(devices)); 443 platform_add_devices(devices, ARRAY_SIZE(devices));
413 pxa_set_mci_info(&spitz_mci_platform_data); 444 pxa_set_mci_info(&spitz_mci_platform_data);
445 pxa_set_ohci_info(&spitz_ohci_platform_data);
414 pxa_set_ficp_info(&spitz_ficp_platform_data); 446 pxa_set_ficp_info(&spitz_ficp_platform_data);
415 set_pxa_fb_parent(&spitzssp_device.dev); 447 set_pxa_fb_parent(&spitzssp_device.dev);
416 set_pxa_fb_info(&spitz_pxafb_info); 448 set_pxa_fb_info(&spitz_pxafb_info);
@@ -465,7 +497,6 @@ static void __init fixup_spitz(struct machine_desc *desc,
465 497
466#ifdef CONFIG_MACH_SPITZ 498#ifdef CONFIG_MACH_SPITZ
467MACHINE_START(SPITZ, "SHARP Spitz") 499MACHINE_START(SPITZ, "SHARP Spitz")
468 .phys_ram = 0xa0000000,
469 .phys_io = 0x40000000, 500 .phys_io = 0x40000000,
470 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 501 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
471 .fixup = fixup_spitz, 502 .fixup = fixup_spitz,
@@ -478,7 +509,6 @@ MACHINE_END
478 509
479#ifdef CONFIG_MACH_BORZOI 510#ifdef CONFIG_MACH_BORZOI
480MACHINE_START(BORZOI, "SHARP Borzoi") 511MACHINE_START(BORZOI, "SHARP Borzoi")
481 .phys_ram = 0xa0000000,
482 .phys_io = 0x40000000, 512 .phys_io = 0x40000000,
483 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 513 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
484 .fixup = fixup_spitz, 514 .fixup = fixup_spitz,
@@ -491,7 +521,6 @@ MACHINE_END
491 521
492#ifdef CONFIG_MACH_AKITA 522#ifdef CONFIG_MACH_AKITA
493MACHINE_START(AKITA, "SHARP Akita") 523MACHINE_START(AKITA, "SHARP Akita")
494 .phys_ram = 0xa0000000,
495 .phys_io = 0x40000000, 524 .phys_io = 0x40000000,
496 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 525 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
497 .fixup = fixup_spitz, 526 .fixup = fixup_spitz,
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 3ce7486daa51..5e5bdc898482 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -33,19 +33,7 @@ static void spitz_charger_init(void)
33{ 33{
34 pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN); 34 pxa_gpio_mode(SPITZ_GPIO_KEY_INT | GPIO_IN);
35 pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN); 35 pxa_gpio_mode(SPITZ_GPIO_SYNC | GPIO_IN);
36} 36 sharpsl_pm_pxa_init();
37
38static void spitz_charge_led(int val)
39{
40 if (val == SHARPSL_LED_ERROR) {
41 dev_dbg(sharpsl_pm.dev, "Charge LED Error\n");
42 } else if (val == SHARPSL_LED_ON) {
43 dev_dbg(sharpsl_pm.dev, "Charge LED On\n");
44 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
45 } else {
46 dev_dbg(sharpsl_pm.dev, "Charge LED Off\n");
47 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_ORANGE);
48 }
49} 37}
50 38
51static void spitz_measure_temp(int on) 39static void spitz_measure_temp(int on)
@@ -92,7 +80,7 @@ static void spitz_discharge1(int on)
92 80
93static void spitz_presuspend(void) 81static void spitz_presuspend(void)
94{ 82{
95 spitz_last_ac_status = STATUS_AC_IN(); 83 spitz_last_ac_status = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
96 84
97 /* GPIO Sleep Register */ 85 /* GPIO Sleep Register */
98 PGSR0 = 0x00144018; 86 PGSR0 = 0x00144018;
@@ -138,7 +126,7 @@ static void spitz_postsuspend(void)
138static int spitz_should_wakeup(unsigned int resume_on_alarm) 126static int spitz_should_wakeup(unsigned int resume_on_alarm)
139{ 127{
140 int is_resume = 0; 128 int is_resume = 0;
141 int acin = STATUS_AC_IN(); 129 int acin = sharpsl_pm.machinfo->read_devdata(SHARPSL_STATUS_ACIN);
142 130
143 if (spitz_last_ac_status != acin) { 131 if (spitz_last_ac_status != acin) {
144 if (acin) { 132 if (acin) {
@@ -148,8 +136,8 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm)
148 } else { 136 } else {
149 /* charge off */ 137 /* charge off */
150 dev_dbg(sharpsl_pm.dev, "AC Removed\n"); 138 dev_dbg(sharpsl_pm.dev, "AC Removed\n");
151 CHARGE_LED_OFF(); 139 sharpsl_pm_led(SHARPSL_LED_OFF);
152 CHARGE_OFF(); 140 sharpsl_pm.machinfo->charge(0);
153 sharpsl_pm.charge_mode = CHRG_OFF; 141 sharpsl_pm.charge_mode = CHRG_OFF;
154 } 142 }
155 spitz_last_ac_status = acin; 143 spitz_last_ac_status = acin;
@@ -175,25 +163,41 @@ static unsigned long spitz_charger_wakeup(void)
175 return (~GPLR0 & GPIO_bit(SPITZ_GPIO_KEY_INT)) | (GPLR0 & GPIO_bit(SPITZ_GPIO_SYNC)); 163 return (~GPLR0 & GPIO_bit(SPITZ_GPIO_KEY_INT)) | (GPLR0 & GPIO_bit(SPITZ_GPIO_SYNC));
176} 164}
177 165
178static int spitz_acin_status(void) 166unsigned long spitzpm_read_devdata(int type)
179{ 167{
180 return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0); 168 switch(type) {
169 case SHARPSL_STATUS_ACIN:
170 return (((~GPLR(SPITZ_GPIO_AC_IN)) & GPIO_bit(SPITZ_GPIO_AC_IN)) != 0);
171 case SHARPSL_STATUS_LOCK:
172 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batlock);
173 case SHARPSL_STATUS_CHRGFULL:
174 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_batfull);
175 case SHARPSL_STATUS_FATAL:
176 return READ_GPIO_BIT(sharpsl_pm.machinfo->gpio_fatal);
177 case SHARPSL_ACIN_VOLT:
178 return sharpsl_pm_pxa_read_max1111(MAX1111_ACIN_VOLT);
179 case SHARPSL_BATT_TEMP:
180 return sharpsl_pm_pxa_read_max1111(MAX1111_BATT_TEMP);
181 case SHARPSL_BATT_VOLT:
182 default:
183 return sharpsl_pm_pxa_read_max1111(MAX1111_BATT_VOLT);
184 }
181} 185}
182 186
183struct sharpsl_charger_machinfo spitz_pm_machinfo = { 187struct sharpsl_charger_machinfo spitz_pm_machinfo = {
184 .init = spitz_charger_init, 188 .init = spitz_charger_init,
189 .exit = sharpsl_pm_pxa_remove,
185 .gpio_batlock = SPITZ_GPIO_BAT_COVER, 190 .gpio_batlock = SPITZ_GPIO_BAT_COVER,
186 .gpio_acin = SPITZ_GPIO_AC_IN, 191 .gpio_acin = SPITZ_GPIO_AC_IN,
187 .gpio_batfull = SPITZ_GPIO_CHRG_FULL, 192 .gpio_batfull = SPITZ_GPIO_CHRG_FULL,
188 .gpio_fatal = SPITZ_GPIO_FATAL_BAT, 193 .gpio_fatal = SPITZ_GPIO_FATAL_BAT,
189 .status_acin = spitz_acin_status,
190 .discharge = spitz_discharge, 194 .discharge = spitz_discharge,
191 .discharge1 = spitz_discharge1, 195 .discharge1 = spitz_discharge1,
192 .charge = spitz_charge, 196 .charge = spitz_charge,
193 .chargeled = spitz_charge_led,
194 .measure_temp = spitz_measure_temp, 197 .measure_temp = spitz_measure_temp,
195 .presuspend = spitz_presuspend, 198 .presuspend = spitz_presuspend,
196 .postsuspend = spitz_postsuspend, 199 .postsuspend = spitz_postsuspend,
200 .read_devdata = spitzpm_read_devdata,
197 .charger_wakeup = spitz_charger_wakeup, 201 .charger_wakeup = spitz_charger_wakeup,
198 .should_wakeup = spitz_should_wakeup, 202 .should_wakeup = spitz_should_wakeup,
199 .bat_levels = 40, 203 .bat_levels = 40,
diff --git a/arch/arm/mach-pxa/ssp.c b/arch/arm/mach-pxa/ssp.c
index a68b30eff4d2..93096befd017 100644
--- a/arch/arm/mach-pxa/ssp.c
+++ b/arch/arm/mach-pxa/ssp.c
@@ -31,6 +31,7 @@
31#include <linux/interrupt.h> 31#include <linux/interrupt.h>
32#include <linux/ioport.h> 32#include <linux/ioport.h>
33#include <linux/init.h> 33#include <linux/init.h>
34#include <linux/mutex.h>
34#include <asm/io.h> 35#include <asm/io.h>
35#include <asm/irq.h> 36#include <asm/irq.h>
36#include <asm/hardware.h> 37#include <asm/hardware.h>
@@ -59,7 +60,7 @@ static const struct ssp_info_ ssp_info[PXA_SSP_PORTS] = {
59#endif 60#endif
60}; 61};
61 62
62static DECLARE_MUTEX(sem); 63static DEFINE_MUTEX(mutex);
63static int use_count[PXA_SSP_PORTS] = {0, 0, 0}; 64static int use_count[PXA_SSP_PORTS] = {0, 0, 0};
64 65
65static irqreturn_t ssp_interrupt(int irq, void *dev_id, struct pt_regs *regs) 66static irqreturn_t ssp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
@@ -239,16 +240,16 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags)
239 if (port > PXA_SSP_PORTS || port == 0) 240 if (port > PXA_SSP_PORTS || port == 0)
240 return -ENODEV; 241 return -ENODEV;
241 242
242 down(&sem); 243 mutex_lock(&mutex);
243 if (use_count[port - 1]) { 244 if (use_count[port - 1]) {
244 up(&sem); 245 mutex_unlock(&mutex);
245 return -EBUSY; 246 return -EBUSY;
246 } 247 }
247 use_count[port - 1]++; 248 use_count[port - 1]++;
248 249
249 if (!request_mem_region(__PREG(SSCR0_P(port)), 0x2c, "SSP")) { 250 if (!request_mem_region(__PREG(SSCR0_P(port)), 0x2c, "SSP")) {
250 use_count[port - 1]--; 251 use_count[port - 1]--;
251 up(&sem); 252 mutex_unlock(&mutex);
252 return -EBUSY; 253 return -EBUSY;
253 } 254 }
254 dev->port = port; 255 dev->port = port;
@@ -265,13 +266,13 @@ int ssp_init(struct ssp_dev *dev, u32 port, u32 init_flags)
265 266
266 /* turn on SSP port clock */ 267 /* turn on SSP port clock */
267 pxa_set_cken(ssp_info[port-1].clock, 1); 268 pxa_set_cken(ssp_info[port-1].clock, 1);
268 up(&sem); 269 mutex_unlock(&mutex);
269 return 0; 270 return 0;
270 271
271out_region: 272out_region:
272 release_mem_region(__PREG(SSCR0_P(port)), 0x2c); 273 release_mem_region(__PREG(SSCR0_P(port)), 0x2c);
273 use_count[port - 1]--; 274 use_count[port - 1]--;
274 up(&sem); 275 mutex_unlock(&mutex);
275 return ret; 276 return ret;
276} 277}
277 278
@@ -282,7 +283,7 @@ out_region:
282 */ 283 */
283void ssp_exit(struct ssp_dev *dev) 284void ssp_exit(struct ssp_dev *dev)
284{ 285{
285 down(&sem); 286 mutex_lock(&mutex);
286 SSCR0_P(dev->port) &= ~SSCR0_SSE; 287 SSCR0_P(dev->port) &= ~SSCR0_SSE;
287 288
288 if (dev->port > PXA_SSP_PORTS || dev->port == 0) { 289 if (dev->port > PXA_SSP_PORTS || dev->port == 0) {
@@ -295,7 +296,7 @@ void ssp_exit(struct ssp_dev *dev)
295 free_irq(dev->irq, dev); 296 free_irq(dev->irq, dev);
296 release_mem_region(__PREG(SSCR0_P(dev->port)), 0x2c); 297 release_mem_region(__PREG(SSCR0_P(dev->port)), 0x2c);
297 use_count[dev->port - 1]--; 298 use_count[dev->port - 1]--;
298 up(&sem); 299 mutex_unlock(&mutex);
299} 300}
300 301
301EXPORT_SYMBOL(ssp_write_word); 302EXPORT_SYMBOL(ssp_write_word);
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index e4f92efc616e..d168286ed470 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -295,7 +295,6 @@ static void __init fixup_tosa(struct machine_desc *desc,
295} 295}
296 296
297MACHINE_START(TOSA, "SHARP Tosa") 297MACHINE_START(TOSA, "SHARP Tosa")
298 .phys_ram = 0xa0000000,
299 .phys_io = 0x40000000, 298 .phys_io = 0x40000000,
300 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 299 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
301 .fixup = fixup_tosa, 300 .fixup = fixup_tosa,
diff --git a/arch/arm/mach-realview/Kconfig b/arch/arm/mach-realview/Kconfig
index 129976866d47..17f5f4439fe7 100644
--- a/arch/arm/mach-realview/Kconfig
+++ b/arch/arm/mach-realview/Kconfig
@@ -3,7 +3,6 @@ menu "RealView platform type"
3 3
4config MACH_REALVIEW_EB 4config MACH_REALVIEW_EB
5 bool "Support RealView/EB platform" 5 bool "Support RealView/EB platform"
6 default n
7 select ARM_GIC 6 select ARM_GIC
8 help 7 help
9 Include support for the ARM(R) RealView Emulation Baseboard platform. 8 Include support for the ARM(R) RealView Emulation Baseboard platform.
diff --git a/arch/arm/mach-realview/clock.c b/arch/arm/mach-realview/clock.c
index 002635c97bb6..21325a4da9da 100644
--- a/arch/arm/mach-realview/clock.c
+++ b/arch/arm/mach-realview/clock.c
@@ -13,28 +13,29 @@
13#include <linux/list.h> 13#include <linux/list.h>
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/clk.h>
17#include <linux/mutex.h>
16 18
17#include <asm/semaphore.h> 19#include <asm/semaphore.h>
18#include <asm/hardware/clock.h>
19#include <asm/hardware/icst307.h> 20#include <asm/hardware/icst307.h>
20 21
21#include "clock.h" 22#include "clock.h"
22 23
23static LIST_HEAD(clocks); 24static LIST_HEAD(clocks);
24static DECLARE_MUTEX(clocks_sem); 25static DEFINE_MUTEX(clocks_mutex);
25 26
26struct clk *clk_get(struct device *dev, const char *id) 27struct clk *clk_get(struct device *dev, const char *id)
27{ 28{
28 struct clk *p, *clk = ERR_PTR(-ENOENT); 29 struct clk *p, *clk = ERR_PTR(-ENOENT);
29 30
30 down(&clocks_sem); 31 mutex_lock(&clocks_mutex);
31 list_for_each_entry(p, &clocks, node) { 32 list_for_each_entry(p, &clocks, node) {
32 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 33 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
33 clk = p; 34 clk = p;
34 break; 35 break;
35 } 36 }
36 } 37 }
37 up(&clocks_sem); 38 mutex_unlock(&clocks_mutex);
38 39
39 return clk; 40 return clk;
40} 41}
@@ -57,17 +58,6 @@ void clk_disable(struct clk *clk)
57} 58}
58EXPORT_SYMBOL(clk_disable); 59EXPORT_SYMBOL(clk_disable);
59 60
60int clk_use(struct clk *clk)
61{
62 return 0;
63}
64EXPORT_SYMBOL(clk_use);
65
66void clk_unuse(struct clk *clk)
67{
68}
69EXPORT_SYMBOL(clk_unuse);
70
71unsigned long clk_get_rate(struct clk *clk) 61unsigned long clk_get_rate(struct clk *clk)
72{ 62{
73 return clk->rate; 63 return clk->rate;
@@ -120,18 +110,18 @@ static struct clk mmci_clk = {
120 110
121int clk_register(struct clk *clk) 111int clk_register(struct clk *clk)
122{ 112{
123 down(&clocks_sem); 113 mutex_lock(&clocks_mutex);
124 list_add(&clk->node, &clocks); 114 list_add(&clk->node, &clocks);
125 up(&clocks_sem); 115 mutex_unlock(&clocks_mutex);
126 return 0; 116 return 0;
127} 117}
128EXPORT_SYMBOL(clk_register); 118EXPORT_SYMBOL(clk_register);
129 119
130void clk_unregister(struct clk *clk) 120void clk_unregister(struct clk *clk)
131{ 121{
132 down(&clocks_sem); 122 mutex_lock(&clocks_mutex);
133 list_del(&clk->node); 123 list_del(&clk->node);
134 up(&clocks_sem); 124 mutex_unlock(&clocks_mutex);
135} 125}
136EXPORT_SYMBOL(clk_unregister); 126EXPORT_SYMBOL(clk_unregister);
137 127
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index af6580f1ceb8..4a222f59f2cf 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -24,14 +24,14 @@
24#include <linux/dma-mapping.h> 24#include <linux/dma-mapping.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/amba/bus.h>
28#include <linux/amba/clcd.h>
27 29
28#include <asm/system.h> 30#include <asm/system.h>
29#include <asm/hardware.h> 31#include <asm/hardware.h>
30#include <asm/io.h> 32#include <asm/io.h>
31#include <asm/irq.h> 33#include <asm/irq.h>
32#include <asm/leds.h> 34#include <asm/leds.h>
33#include <asm/hardware/amba.h>
34#include <asm/hardware/amba_clcd.h>
35#include <asm/hardware/arm_timer.h> 35#include <asm/hardware/arm_timer.h>
36#include <asm/hardware/icst307.h> 36#include <asm/hardware/icst307.h>
37 37
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index c06e6041df41..93e86d9f439c 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -22,7 +22,8 @@
22#ifndef __ASM_ARCH_REALVIEW_H 22#ifndef __ASM_ARCH_REALVIEW_H
23#define __ASM_ARCH_REALVIEW_H 23#define __ASM_ARCH_REALVIEW_H
24 24
25#include <asm/hardware/amba.h> 25#include <linux/amba/bus.h>
26
26#include <asm/leds.h> 27#include <asm/leds.h>
27#include <asm/io.h> 28#include <asm/io.h>
28 29
diff --git a/arch/arm/mach-realview/localtimer.c b/arch/arm/mach-realview/localtimer.c
index c9d7c596b200..caf6b8bb6c95 100644
--- a/arch/arm/mach-realview/localtimer.c
+++ b/arch/arm/mach-realview/localtimer.c
@@ -13,6 +13,7 @@
13#include <linux/delay.h> 13#include <linux/delay.h>
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/smp.h> 15#include <linux/smp.h>
16#include <linux/jiffies.h>
16 17
17#include <asm/mach/time.h> 18#include <asm/mach/time.h>
18#include <asm/hardware/arm_twd.h> 19#include <asm/hardware/arm_twd.h>
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 7dc32503fdf2..d4a586e38d5b 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -23,6 +23,7 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/amba/bus.h>
26 27
27#include <asm/hardware.h> 28#include <asm/hardware.h>
28#include <asm/io.h> 29#include <asm/io.h>
@@ -30,7 +31,6 @@
30#include <asm/leds.h> 31#include <asm/leds.h>
31#include <asm/mach-types.h> 32#include <asm/mach-types.h>
32#include <asm/hardware/gic.h> 33#include <asm/hardware/gic.h>
33#include <asm/hardware/amba.h>
34#include <asm/hardware/icst307.h> 34#include <asm/hardware/icst307.h>
35 35
36#include <asm/mach/arch.h> 36#include <asm/mach/arch.h>
@@ -166,7 +166,6 @@ static void __init realview_eb_init(void)
166 166
167MACHINE_START(REALVIEW_EB, "ARM-RealView EB") 167MACHINE_START(REALVIEW_EB, "ARM-RealView EB")
168 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 168 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
169 .phys_ram = 0x00000000,
170 .phys_io = REALVIEW_UART0_BASE, 169 .phys_io = REALVIEW_UART0_BASE,
171 .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc, 170 .io_pg_offst = (IO_ADDRESS(REALVIEW_UART0_BASE) >> 18) & 0xfffc,
172 .boot_params = 0x00000100, 171 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-rpc/dma.c b/arch/arm/mach-rpc/dma.c
index bc0747439fb3..bd86ffba8810 100644
--- a/arch/arm/mach-rpc/dma.c
+++ b/arch/arm/mach-rpc/dma.c
@@ -13,7 +13,7 @@
13#include <linux/mman.h> 13#include <linux/mman.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/pci.h> 16#include <linux/dma-mapping.h>
17 17
18#include <asm/page.h> 18#include <asm/page.h>
19#include <asm/dma.h> 19#include <asm/dma.h>
@@ -148,11 +148,14 @@ static void iomd_enable_dma(dmach_t channel, dma_t *dma)
148 * Cope with ISA-style drivers which expect cache 148 * Cope with ISA-style drivers which expect cache
149 * coherence. 149 * coherence.
150 */ 150 */
151 if (!dma->using_sg) { 151 if (!dma->sg) {
152 dma->buf.dma_address = pci_map_single(NULL, 152 dma->sg = &dma->buf;
153 dma->buf.__address, dma->buf.length, 153 dma->sgcount = 1;
154 dma->buf.length = dma->count;
155 dma->buf.dma_address = dma_map_single(NULL,
156 dma->addr, dma->count,
154 dma->dma_mode == DMA_MODE_READ ? 157 dma->dma_mode == DMA_MODE_READ ?
155 PCI_DMA_FROMDEVICE : PCI_DMA_TODEVICE); 158 DMA_FROM_DEVICE : DMA_TO_DEVICE);
156 } 159 }
157 160
158 iomd_writeb(DMA_CR_C, dma_base + CR); 161 iomd_writeb(DMA_CR_C, dma_base + CR);
@@ -239,7 +242,7 @@ static void floppy_enable_dma(dmach_t channel, dma_t *dma)
239 unsigned int fiqhandler_length; 242 unsigned int fiqhandler_length;
240 struct pt_regs regs; 243 struct pt_regs regs;
241 244
242 if (dma->using_sg) 245 if (dma->sg)
243 BUG(); 246 BUG();
244 247
245 if (dma->dma_mode == DMA_MODE_READ) { 248 if (dma->dma_mode == DMA_MODE_READ) {
@@ -252,8 +255,8 @@ static void floppy_enable_dma(dmach_t channel, dma_t *dma)
252 fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start; 255 fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start;
253 } 256 }
254 257
255 regs.ARM_r9 = dma->buf.length; 258 regs.ARM_r9 = dma->count;
256 regs.ARM_r10 = (unsigned long)dma->buf.__address; 259 regs.ARM_r10 = (unsigned long)dma->addr;
257 regs.ARM_fp = (unsigned long)FLOPPYDMA_BASE; 260 regs.ARM_fp = (unsigned long)FLOPPYDMA_BASE;
258 261
259 if (claim_fiq(&fh)) { 262 if (claim_fiq(&fh)) {
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index 5c4ac1c008a6..208a2b5dba1b 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -177,7 +177,6 @@ extern struct sys_timer ioc_timer;
177 177
178MACHINE_START(RISCPC, "Acorn-RiscPC") 178MACHINE_START(RISCPC, "Acorn-RiscPC")
179 /* Maintainer: Russell King */ 179 /* Maintainer: Russell King */
180 .phys_ram = 0x10000000,
181 .phys_io = 0x03000000, 180 .phys_io = 0x03000000,
182 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, 181 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
183 .boot_params = 0x10000100, 182 .boot_params = 0x10000100,
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c
index 82e8253b1fa0..af2f3d52b61b 100644
--- a/arch/arm/mach-s3c2410/clock.c
+++ b/arch/arm/mach-s3c2410/clock.c
@@ -34,16 +34,16 @@
34#include <linux/err.h> 34#include <linux/err.h>
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/sysdev.h> 36#include <linux/sysdev.h>
37
38#include <linux/interrupt.h> 37#include <linux/interrupt.h>
39#include <linux/ioport.h> 38#include <linux/ioport.h>
39#include <linux/clk.h>
40#include <linux/mutex.h>
40 41
41#include <asm/hardware.h> 42#include <asm/hardware.h>
42#include <asm/atomic.h> 43#include <asm/atomic.h>
43#include <asm/irq.h> 44#include <asm/irq.h>
44#include <asm/io.h> 45#include <asm/io.h>
45 46
46#include <asm/hardware/clock.h>
47#include <asm/arch/regs-clock.h> 47#include <asm/arch/regs-clock.h>
48 48
49#include "clock.h" 49#include "clock.h"
@@ -52,7 +52,7 @@
52/* clock information */ 52/* clock information */
53 53
54static LIST_HEAD(clocks); 54static LIST_HEAD(clocks);
55static DECLARE_MUTEX(clocks_sem); 55static DEFINE_MUTEX(clocks_mutex);
56 56
57/* old functions */ 57/* old functions */
58 58
@@ -103,7 +103,7 @@ struct clk *clk_get(struct device *dev, const char *id)
103 else 103 else
104 idno = to_platform_device(dev)->id; 104 idno = to_platform_device(dev)->id;
105 105
106 down(&clocks_sem); 106 mutex_lock(&clocks_mutex);
107 107
108 list_for_each_entry(p, &clocks, list) { 108 list_for_each_entry(p, &clocks, list) {
109 if (p->id == idno && 109 if (p->id == idno &&
@@ -127,7 +127,7 @@ struct clk *clk_get(struct device *dev, const char *id)
127 } 127 }
128 } 128 }
129 129
130 up(&clocks_sem); 130 mutex_unlock(&clocks_mutex);
131 return clk; 131 return clk;
132} 132}
133 133
@@ -151,18 +151,6 @@ void clk_disable(struct clk *clk)
151} 151}
152 152
153 153
154int clk_use(struct clk *clk)
155{
156 atomic_inc(&clk->used);
157 return 0;
158}
159
160
161void clk_unuse(struct clk *clk)
162{
163 atomic_dec(&clk->used);
164}
165
166unsigned long clk_get_rate(struct clk *clk) 154unsigned long clk_get_rate(struct clk *clk)
167{ 155{
168 if (IS_ERR(clk)) 156 if (IS_ERR(clk))
@@ -196,8 +184,6 @@ EXPORT_SYMBOL(clk_get);
196EXPORT_SYMBOL(clk_put); 184EXPORT_SYMBOL(clk_put);
197EXPORT_SYMBOL(clk_enable); 185EXPORT_SYMBOL(clk_enable);
198EXPORT_SYMBOL(clk_disable); 186EXPORT_SYMBOL(clk_disable);
199EXPORT_SYMBOL(clk_use);
200EXPORT_SYMBOL(clk_unuse);
201EXPORT_SYMBOL(clk_get_rate); 187EXPORT_SYMBOL(clk_get_rate);
202EXPORT_SYMBOL(clk_round_rate); 188EXPORT_SYMBOL(clk_round_rate);
203EXPORT_SYMBOL(clk_set_rate); 189EXPORT_SYMBOL(clk_set_rate);
@@ -268,100 +254,101 @@ struct clk s3c24xx_uclk = {
268/* clock definitions */ 254/* clock definitions */
269 255
270static struct clk init_clocks[] = { 256static struct clk init_clocks[] = {
271 { .name = "nand", 257 {
272 .id = -1, 258 .name = "nand",
273 .parent = &clk_h, 259 .id = -1,
274 .enable = s3c24xx_clkcon_enable, 260 .parent = &clk_h,
275 .ctrlbit = S3C2410_CLKCON_NAND 261 .enable = s3c24xx_clkcon_enable,
276 }, 262 .ctrlbit = S3C2410_CLKCON_NAND,
277 { .name = "lcd", 263 }, {
278 .id = -1, 264 .name = "lcd",
279 .parent = &clk_h, 265 .id = -1,
280 .enable = s3c24xx_clkcon_enable, 266 .parent = &clk_h,
281 .ctrlbit = S3C2410_CLKCON_LCDC 267 .enable = s3c24xx_clkcon_enable,
282 }, 268 .ctrlbit = S3C2410_CLKCON_LCDC,
283 { .name = "usb-host", 269 }, {
284 .id = -1, 270 .name = "usb-host",
285 .parent = &clk_h, 271 .id = -1,
286 .enable = s3c24xx_clkcon_enable, 272 .parent = &clk_h,
287 .ctrlbit = S3C2410_CLKCON_USBH 273 .enable = s3c24xx_clkcon_enable,
288 }, 274 .ctrlbit = S3C2410_CLKCON_USBH,
289 { .name = "usb-device", 275 }, {
290 .id = -1, 276 .name = "usb-device",
291 .parent = &clk_h, 277 .id = -1,
292 .enable = s3c24xx_clkcon_enable, 278 .parent = &clk_h,
293 .ctrlbit = S3C2410_CLKCON_USBD 279 .enable = s3c24xx_clkcon_enable,
294 }, 280 .ctrlbit = S3C2410_CLKCON_USBD,
295 { .name = "timers", 281 }, {
296 .id = -1, 282 .name = "timers",
297 .parent = &clk_p, 283 .id = -1,
298 .enable = s3c24xx_clkcon_enable, 284 .parent = &clk_p,
299 .ctrlbit = S3C2410_CLKCON_PWMT 285 .enable = s3c24xx_clkcon_enable,
300 }, 286 .ctrlbit = S3C2410_CLKCON_PWMT,
301 { .name = "sdi", 287 }, {
302 .id = -1, 288 .name = "sdi",
303 .parent = &clk_p, 289 .id = -1,
304 .enable = s3c24xx_clkcon_enable, 290 .parent = &clk_p,
305 .ctrlbit = S3C2410_CLKCON_SDI 291 .enable = s3c24xx_clkcon_enable,
306 }, 292 .ctrlbit = S3C2410_CLKCON_SDI,
307 { .name = "uart", 293 }, {
308 .id = 0, 294 .name = "uart",
309 .parent = &clk_p, 295 .id = 0,
310 .enable = s3c24xx_clkcon_enable, 296 .parent = &clk_p,
311 .ctrlbit = S3C2410_CLKCON_UART0 297 .enable = s3c24xx_clkcon_enable,
312 }, 298 .ctrlbit = S3C2410_CLKCON_UART0,
313 { .name = "uart", 299 }, {
314 .id = 1, 300 .name = "uart",
315 .parent = &clk_p, 301 .id = 1,
316 .enable = s3c24xx_clkcon_enable, 302 .parent = &clk_p,
317 .ctrlbit = S3C2410_CLKCON_UART1 303 .enable = s3c24xx_clkcon_enable,
318 }, 304 .ctrlbit = S3C2410_CLKCON_UART1,
319 { .name = "uart", 305 }, {
320 .id = 2, 306 .name = "uart",
321 .parent = &clk_p, 307 .id = 2,
322 .enable = s3c24xx_clkcon_enable, 308 .parent = &clk_p,
323 .ctrlbit = S3C2410_CLKCON_UART2 309 .enable = s3c24xx_clkcon_enable,
324 }, 310 .ctrlbit = S3C2410_CLKCON_UART2,
325 { .name = "gpio", 311 }, {
326 .id = -1, 312 .name = "gpio",
327 .parent = &clk_p, 313 .id = -1,
328 .enable = s3c24xx_clkcon_enable, 314 .parent = &clk_p,
329 .ctrlbit = S3C2410_CLKCON_GPIO 315 .enable = s3c24xx_clkcon_enable,
330 }, 316 .ctrlbit = S3C2410_CLKCON_GPIO,
331 { .name = "rtc", 317 }, {
332 .id = -1, 318 .name = "rtc",
333 .parent = &clk_p, 319 .id = -1,
334 .enable = s3c24xx_clkcon_enable, 320 .parent = &clk_p,
335 .ctrlbit = S3C2410_CLKCON_RTC 321 .enable = s3c24xx_clkcon_enable,
336 }, 322 .ctrlbit = S3C2410_CLKCON_RTC,
337 { .name = "adc", 323 }, {
338 .id = -1, 324 .name = "adc",
339 .parent = &clk_p, 325 .id = -1,
340 .enable = s3c24xx_clkcon_enable, 326 .parent = &clk_p,
341 .ctrlbit = S3C2410_CLKCON_ADC 327 .enable = s3c24xx_clkcon_enable,
342 }, 328 .ctrlbit = S3C2410_CLKCON_ADC,
343 { .name = "i2c", 329 }, {
344 .id = -1, 330 .name = "i2c",
345 .parent = &clk_p, 331 .id = -1,
346 .enable = s3c24xx_clkcon_enable, 332 .parent = &clk_p,
347 .ctrlbit = S3C2410_CLKCON_IIC 333 .enable = s3c24xx_clkcon_enable,
348 }, 334 .ctrlbit = S3C2410_CLKCON_IIC,
349 { .name = "iis", 335 }, {
350 .id = -1, 336 .name = "iis",
351 .parent = &clk_p, 337 .id = -1,
352 .enable = s3c24xx_clkcon_enable, 338 .parent = &clk_p,
353 .ctrlbit = S3C2410_CLKCON_IIS 339 .enable = s3c24xx_clkcon_enable,
354 }, 340 .ctrlbit = S3C2410_CLKCON_IIS,
355 { .name = "spi", 341 }, {
356 .id = -1, 342 .name = "spi",
357 .parent = &clk_p, 343 .id = -1,
358 .enable = s3c24xx_clkcon_enable, 344 .parent = &clk_p,
359 .ctrlbit = S3C2410_CLKCON_SPI 345 .enable = s3c24xx_clkcon_enable,
360 }, 346 .ctrlbit = S3C2410_CLKCON_SPI,
361 { .name = "watchdog", 347 }, {
362 .id = -1, 348 .name = "watchdog",
363 .parent = &clk_p, 349 .id = -1,
364 .ctrlbit = 0 350 .parent = &clk_p,
351 .ctrlbit = 0,
365 } 352 }
366}; 353};
367 354
@@ -370,16 +357,15 @@ static struct clk init_clocks[] = {
370int s3c24xx_register_clock(struct clk *clk) 357int s3c24xx_register_clock(struct clk *clk)
371{ 358{
372 clk->owner = THIS_MODULE; 359 clk->owner = THIS_MODULE;
373 atomic_set(&clk->used, 0);
374 360
375 if (clk->enable == NULL) 361 if (clk->enable == NULL)
376 clk->enable = clk_null_enable; 362 clk->enable = clk_null_enable;
377 363
378 /* add to the list of available clocks */ 364 /* add to the list of available clocks */
379 365
380 down(&clocks_sem); 366 mutex_lock(&clocks_mutex);
381 list_add(&clk->list, &clocks); 367 list_add(&clk->list, &clocks);
382 up(&clocks_sem); 368 mutex_unlock(&clocks_mutex);
383 369
384 return 0; 370 return 0;
385} 371}
@@ -406,16 +392,15 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
406 clk_p.rate = pclk; 392 clk_p.rate = pclk;
407 clk_f.rate = fclk; 393 clk_f.rate = fclk;
408 394
409 /* it looks like just setting the register here is not good 395 /* We must be careful disabling the clocks we are not intending to
410 * enough, and causes the odd hang at initial boot time, so 396 * be using at boot time, as subsytems such as the LCD which do
411 * do all of them indivdually. 397 * their own DMA requests to the bus can cause the system to lockup
412 * 398 * if they where in the middle of requesting bus access.
413 * I think disabling the LCD clock if the LCD is active is
414 * very dangerous, and therefore the bootloader should be
415 * careful to not enable the LCD clock if it is not needed.
416 * 399 *
417 * and of course, this looks neater 400 * Disabling the LCD clock if the LCD is active is very dangerous,
418 */ 401 * and therefore the bootloader should be careful to not enable
402 * the LCD clock if it is not needed.
403 */
419 404
420 s3c24xx_clk_enable(S3C2410_CLKCON_NAND, 0); 405 s3c24xx_clk_enable(S3C2410_CLKCON_NAND, 0);
421 s3c24xx_clk_enable(S3C2410_CLKCON_USBH, 0); 406 s3c24xx_clk_enable(S3C2410_CLKCON_USBH, 0);
diff --git a/arch/arm/mach-s3c2410/clock.h b/arch/arm/mach-s3c2410/clock.h
index 7953b6f397b9..177d5c8decf7 100644
--- a/arch/arm/mach-s3c2410/clock.h
+++ b/arch/arm/mach-s3c2410/clock.h
@@ -16,7 +16,6 @@ struct clk {
16 struct clk *parent; 16 struct clk *parent;
17 const char *name; 17 const char *name;
18 int id; 18 int id;
19 atomic_t used;
20 unsigned long rate; 19 unsigned long rate;
21 unsigned long ctrlbit; 20 unsigned long ctrlbit;
22 int (*enable)(struct clk *, int enable); 21 int (*enable)(struct clk *, int enable);
diff --git a/arch/arm/mach-s3c2410/mach-anubis.c b/arch/arm/mach-s3c2410/mach-anubis.c
index 0f81fc0c2f7f..3e327b8e46be 100644
--- a/arch/arm/mach-s3c2410/mach-anubis.c
+++ b/arch/arm/mach-s3c2410/mach-anubis.c
@@ -294,7 +294,6 @@ static void __init anubis_map_io(void)
294 294
295MACHINE_START(ANUBIS, "Simtec-Anubis") 295MACHINE_START(ANUBIS, "Simtec-Anubis")
296 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ 296 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
297 .phys_ram = S3C2410_SDRAM_PA,
298 .phys_io = S3C2410_PA_UART, 297 .phys_io = S3C2410_PA_UART,
299 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 298 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
300 .boot_params = S3C2410_SDRAM_PA + 0x100, 299 .boot_params = S3C2410_SDRAM_PA + 0x100,
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index 4d962717fdf7..995bb8add331 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -527,7 +527,6 @@ static void __init bast_init(void)
527 527
528MACHINE_START(BAST, "Simtec-BAST") 528MACHINE_START(BAST, "Simtec-BAST")
529 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ 529 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
530 .phys_ram = S3C2410_SDRAM_PA,
531 .phys_io = S3C2410_PA_UART, 530 .phys_io = S3C2410_PA_UART,
532 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 531 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
533 .boot_params = S3C2410_SDRAM_PA + 0x100, 532 .boot_params = S3C2410_SDRAM_PA + 0x100,
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 0aa8760598f7..1c316f14ed94 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -171,7 +171,6 @@ static void __init h1940_init(void)
171 171
172MACHINE_START(H1940, "IPAQ-H1940") 172MACHINE_START(H1940, "IPAQ-H1940")
173 /* Maintainer: Ben Dooks <ben@fluff.org> */ 173 /* Maintainer: Ben Dooks <ben@fluff.org> */
174 .phys_ram = S3C2410_SDRAM_PA,
175 .phys_io = S3C2410_PA_UART, 174 .phys_io = S3C2410_PA_UART,
176 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 175 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
177 .boot_params = S3C2410_SDRAM_PA + 0x100, 176 .boot_params = S3C2410_SDRAM_PA + 0x100,
diff --git a/arch/arm/mach-s3c2410/mach-n30.c b/arch/arm/mach-s3c2410/mach-n30.c
index 378d640ab00b..116ac3169966 100644
--- a/arch/arm/mach-s3c2410/mach-n30.c
+++ b/arch/arm/mach-s3c2410/mach-n30.c
@@ -128,7 +128,6 @@ MACHINE_START(N30, "Acer-N30")
128 /* Maintainer: Christer Weinigel <christer@weinigel.se>, 128 /* Maintainer: Christer Weinigel <christer@weinigel.se>,
129 Ben Dooks <ben-linux@fluff.org> 129 Ben Dooks <ben-linux@fluff.org>
130 */ 130 */
131 .phys_ram = S3C2410_SDRAM_PA,
132 .phys_io = S3C2410_PA_UART, 131 .phys_io = S3C2410_PA_UART,
133 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 132 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
134 .boot_params = S3C2410_SDRAM_PA + 0x100, 133 .boot_params = S3C2410_SDRAM_PA + 0x100,
diff --git a/arch/arm/mach-s3c2410/mach-nexcoder.c b/arch/arm/mach-s3c2410/mach-nexcoder.c
index 42b0eeff2e0f..07d09509a626 100644
--- a/arch/arm/mach-s3c2410/mach-nexcoder.c
+++ b/arch/arm/mach-s3c2410/mach-nexcoder.c
@@ -148,7 +148,6 @@ static void __init nexcoder_map_io(void)
148 148
149MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440") 149MACHINE_START(NEXCODER_2440, "NexVision - Nexcoder 2440")
150 /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */ 150 /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */
151 .phys_ram = S3C2410_SDRAM_PA,
152 .phys_io = S3C2410_PA_UART, 151 .phys_io = S3C2410_PA_UART,
153 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 152 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
154 .boot_params = S3C2410_SDRAM_PA + 0x100, 153 .boot_params = S3C2410_SDRAM_PA + 0x100,
diff --git a/arch/arm/mach-s3c2410/mach-otom.c b/arch/arm/mach-s3c2410/mach-otom.c
index a2eb9ed48fcd..b39daedf93ca 100644
--- a/arch/arm/mach-s3c2410/mach-otom.c
+++ b/arch/arm/mach-s3c2410/mach-otom.c
@@ -116,7 +116,6 @@ static void __init otom11_map_io(void)
116 116
117MACHINE_START(OTOM, "Nex Vision - Otom 1.1") 117MACHINE_START(OTOM, "Nex Vision - Otom 1.1")
118 /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */ 118 /* Maintainer: Guillaume GOURAT <guillaume.gourat@nexvision.tv> */
119 .phys_ram = S3C2410_SDRAM_PA,
120 .phys_io = S3C2410_PA_UART, 119 .phys_io = S3C2410_PA_UART,
121 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 120 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
122 .boot_params = S3C2410_SDRAM_PA + 0x100, 121 .boot_params = S3C2410_SDRAM_PA + 0x100,
diff --git a/arch/arm/mach-s3c2410/mach-rx3715.c b/arch/arm/mach-s3c2410/mach-rx3715.c
index f8d86d1e16b6..0260ed5ab946 100644
--- a/arch/arm/mach-s3c2410/mach-rx3715.c
+++ b/arch/arm/mach-s3c2410/mach-rx3715.c
@@ -205,7 +205,6 @@ static void __init rx3715_init_machine(void)
205 205
206MACHINE_START(RX3715, "IPAQ-RX3715") 206MACHINE_START(RX3715, "IPAQ-RX3715")
207 /* Maintainer: Ben Dooks <ben@fluff.org> */ 207 /* Maintainer: Ben Dooks <ben@fluff.org> */
208 .phys_ram = S3C2410_SDRAM_PA,
209 .phys_io = S3C2410_PA_UART, 208 .phys_io = S3C2410_PA_UART,
210 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 209 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
211 .boot_params = S3C2410_SDRAM_PA + 0x100, 210 .boot_params = S3C2410_SDRAM_PA + 0x100,
diff --git a/arch/arm/mach-s3c2410/mach-smdk2410.c b/arch/arm/mach-s3c2410/mach-smdk2410.c
index 2c91965ee1c8..1e76e1fdfcea 100644
--- a/arch/arm/mach-s3c2410/mach-smdk2410.c
+++ b/arch/arm/mach-s3c2410/mach-smdk2410.c
@@ -115,7 +115,6 @@ static void __init smdk2410_init_irq(void)
115MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch 115MACHINE_START(SMDK2410, "SMDK2410") /* @TODO: request a new identifier and switch
116 * to SMDK2410 */ 116 * to SMDK2410 */
117 /* Maintainer: Jonas Dietsche */ 117 /* Maintainer: Jonas Dietsche */
118 .phys_ram = S3C2410_SDRAM_PA,
119 .phys_io = S3C2410_PA_UART, 118 .phys_io = S3C2410_PA_UART,
120 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 119 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
121 .boot_params = S3C2410_SDRAM_PA + 0x100, 120 .boot_params = S3C2410_SDRAM_PA + 0x100,
diff --git a/arch/arm/mach-s3c2410/mach-smdk2440.c b/arch/arm/mach-s3c2410/mach-smdk2440.c
index 4e31118533e6..f4315721c3b8 100644
--- a/arch/arm/mach-s3c2410/mach-smdk2440.c
+++ b/arch/arm/mach-s3c2410/mach-smdk2440.c
@@ -216,7 +216,6 @@ static void __init smdk2440_machine_init(void)
216 216
217MACHINE_START(S3C2440, "SMDK2440") 217MACHINE_START(S3C2440, "SMDK2440")
218 /* Maintainer: Ben Dooks <ben@fluff.org> */ 218 /* Maintainer: Ben Dooks <ben@fluff.org> */
219 .phys_ram = S3C2410_SDRAM_PA,
220 .phys_io = S3C2410_PA_UART, 219 .phys_io = S3C2410_PA_UART,
221 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 220 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
222 .boot_params = S3C2410_SDRAM_PA + 0x100, 221 .boot_params = S3C2410_SDRAM_PA + 0x100,
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c
index ae7e099bf6c8..785fc9cdcf7c 100644
--- a/arch/arm/mach-s3c2410/mach-vr1000.c
+++ b/arch/arm/mach-s3c2410/mach-vr1000.c
@@ -395,7 +395,6 @@ static void __init vr1000_map_io(void)
395 395
396MACHINE_START(VR1000, "Thorcom-VR1000") 396MACHINE_START(VR1000, "Thorcom-VR1000")
397 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */ 397 /* Maintainer: Ben Dooks <ben@simtec.co.uk> */
398 .phys_ram = S3C2410_SDRAM_PA,
399 .phys_io = S3C2410_PA_UART, 398 .phys_io = S3C2410_PA_UART,
400 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 399 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
401 .boot_params = S3C2410_SDRAM_PA + 0x100, 400 .boot_params = S3C2410_SDRAM_PA + 0x100,
diff --git a/arch/arm/mach-s3c2410/s3c2440-clock.c b/arch/arm/mach-s3c2410/s3c2440-clock.c
index c67e0979aec3..b557a2be8a01 100644
--- a/arch/arm/mach-s3c2410/s3c2440-clock.c
+++ b/arch/arm/mach-s3c2410/s3c2440-clock.c
@@ -29,16 +29,15 @@
29#include <linux/err.h> 29#include <linux/err.h>
30#include <linux/device.h> 30#include <linux/device.h>
31#include <linux/sysdev.h> 31#include <linux/sysdev.h>
32
33#include <linux/interrupt.h> 32#include <linux/interrupt.h>
34#include <linux/ioport.h> 33#include <linux/ioport.h>
34#include <linux/clk.h>
35 35
36#include <asm/hardware.h> 36#include <asm/hardware.h>
37#include <asm/atomic.h> 37#include <asm/atomic.h>
38#include <asm/irq.h> 38#include <asm/irq.h>
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#include <asm/hardware/clock.h>
42#include <asm/arch/regs-clock.h> 41#include <asm/arch/regs-clock.h>
43 42
44#include "clock.h" 43#include "clock.h"
diff --git a/arch/arm/mach-s3c2410/s3c2440.c b/arch/arm/mach-s3c2410/s3c2440.c
index 4d63e7133b48..b7fe6d9453fb 100644
--- a/arch/arm/mach-s3c2410/s3c2440.c
+++ b/arch/arm/mach-s3c2410/s3c2440.c
@@ -28,6 +28,7 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#include <linux/sysdev.h> 30#include <linux/sysdev.h>
31#include <linux/clk.h>
31 32
32#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 34#include <asm/mach/map.h>
@@ -36,7 +37,6 @@
36#include <asm/hardware.h> 37#include <asm/hardware.h>
37#include <asm/io.h> 38#include <asm/io.h>
38#include <asm/irq.h> 39#include <asm/irq.h>
39#include <asm/hardware/clock.h>
40 40
41#include <asm/arch/regs-clock.h> 41#include <asm/arch/regs-clock.h>
42#include <asm/arch/regs-serial.h> 42#include <asm/arch/regs-serial.h>
diff --git a/arch/arm/mach-s3c2410/time.c b/arch/arm/mach-s3c2410/time.c
index 8a00e3c3cd08..10a2976aefdd 100644
--- a/arch/arm/mach-s3c2410/time.c
+++ b/arch/arm/mach-s3c2410/time.c
@@ -24,6 +24,7 @@
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/interrupt.h> 25#include <linux/interrupt.h>
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/clk.h>
27 28
28#include <asm/system.h> 29#include <asm/system.h>
29#include <asm/leds.h> 30#include <asm/leds.h>
@@ -35,7 +36,6 @@
35#include <asm/arch/regs-timer.h> 36#include <asm/arch/regs-timer.h>
36#include <asm/arch/regs-irq.h> 37#include <asm/arch/regs-irq.h>
37#include <asm/mach/time.h> 38#include <asm/mach/time.h>
38#include <asm/hardware/clock.h>
39 39
40#include "clock.h" 40#include "clock.h"
41#include "cpu.h" 41#include "cpu.h"
@@ -191,7 +191,6 @@ static void s3c2410_timer_setup (void)
191 if (IS_ERR(clk)) 191 if (IS_ERR(clk))
192 panic("failed to get clock for system timer"); 192 panic("failed to get clock for system timer");
193 193
194 clk_use(clk);
195 clk_enable(clk); 194 clk_enable(clk);
196 195
197 pclk = clk_get_rate(clk); 196 pclk = clk_get_rate(clk);
diff --git a/arch/arm/mach-s3c2410/usb-simtec.c b/arch/arm/mach-s3c2410/usb-simtec.c
index 5098b50158a3..495f8c6ffcb6 100644
--- a/arch/arm/mach-s3c2410/usb-simtec.c
+++ b/arch/arm/mach-s3c2410/usb-simtec.c
@@ -84,13 +84,13 @@ static void usb_simtec_enableoc(struct s3c2410_hcd_info *info, int on)
84 int ret; 84 int ret;
85 85
86 if (on) { 86 if (on) {
87 ret = request_irq(IRQ_USBOC, usb_simtec_ocirq, SA_INTERRUPT, 87 ret = request_irq(IRQ_USBOC, usb_simtec_ocirq,
88 SA_INTERRUPT | SA_TRIGGER_RISING |
89 SA_TRIGGER_FALLING,
88 "USB Over-current", info); 90 "USB Over-current", info);
89 if (ret != 0) { 91 if (ret != 0) {
90 printk(KERN_ERR "failed to request usb oc irq\n"); 92 printk(KERN_ERR "failed to request usb oc irq\n");
91 } 93 }
92
93 set_irq_type(IRQ_USBOC, IRQT_BOTHEDGE);
94 } else { 94 } else {
95 free_irq(IRQ_USBOC, info); 95 free_irq(IRQ_USBOC, info);
96 } 96 }
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index a66ac61233a2..a599bb0d4ab8 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -447,7 +447,6 @@ static void __init assabet_map_io(void)
447 447
448 448
449MACHINE_START(ASSABET, "Intel-Assabet") 449MACHINE_START(ASSABET, "Intel-Assabet")
450 .phys_ram = 0xc0000000,
451 .phys_io = 0x80000000, 450 .phys_io = 0x80000000,
452 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 451 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
453 .boot_params = 0xc0000100, 452 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-sa1100/badge4.c b/arch/arm/mach-sa1100/badge4.c
index edccd5eb06be..f60b7a66dfa0 100644
--- a/arch/arm/mach-sa1100/badge4.c
+++ b/arch/arm/mach-sa1100/badge4.c
@@ -297,7 +297,6 @@ static void __init badge4_map_io(void)
297} 297}
298 298
299MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4") 299MACHINE_START(BADGE4, "Hewlett-Packard Laboratories BadgePAD 4")
300 .phys_ram = 0xc0000000,
301 .phys_io = 0x80000000, 300 .phys_io = 0x80000000,
302 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 301 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
303 .boot_params = 0xc0000100, 302 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-sa1100/cerf.c b/arch/arm/mach-sa1100/cerf.c
index 508593722bc7..8269a9ef9afe 100644
--- a/arch/arm/mach-sa1100/cerf.c
+++ b/arch/arm/mach-sa1100/cerf.c
@@ -135,7 +135,6 @@ static void __init cerf_init(void)
135 135
136MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube") 136MACHINE_START(CERF, "Intrinsyc CerfBoard/CerfCube")
137 /* Maintainer: support@intrinsyc.com */ 137 /* Maintainer: support@intrinsyc.com */
138 .phys_ram = 0xc0000000,
139 .phys_io = 0x80000000, 138 .phys_io = 0x80000000,
140 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 139 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
141 .map_io = cerf_map_io, 140 .map_io = cerf_map_io,
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 522abc036d3a..6888816a1935 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -191,7 +191,6 @@ static void __init collie_map_io(void)
191} 191}
192 192
193MACHINE_START(COLLIE, "Sharp-Collie") 193MACHINE_START(COLLIE, "Sharp-Collie")
194 .phys_ram = 0xc0000000,
195 .phys_io = 0x80000000, 194 .phys_io = 0x80000000,
196 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 195 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
197 .map_io = collie_map_io, 196 .map_io = collie_map_io,
diff --git a/arch/arm/mach-sa1100/h3600.c b/arch/arm/mach-sa1100/h3600.c
index e8352b7f74b0..b04d92271020 100644
--- a/arch/arm/mach-sa1100/h3600.c
+++ b/arch/arm/mach-sa1100/h3600.c
@@ -392,7 +392,6 @@ static void __init h3100_map_io(void)
392} 392}
393 393
394MACHINE_START(H3100, "Compaq iPAQ H3100") 394MACHINE_START(H3100, "Compaq iPAQ H3100")
395 .phys_ram = 0xc0000000,
396 .phys_io = 0x80000000, 395 .phys_io = 0x80000000,
397 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 396 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
398 .boot_params = 0xc0000100, 397 .boot_params = 0xc0000100,
@@ -510,7 +509,6 @@ static void __init h3600_map_io(void)
510} 509}
511 510
512MACHINE_START(H3600, "Compaq iPAQ H3600") 511MACHINE_START(H3600, "Compaq iPAQ H3600")
513 .phys_ram = 0xc0000000,
514 .phys_io = 0x80000000, 512 .phys_io = 0x80000000,
515 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 513 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
516 .boot_params = 0xc0000100, 514 .boot_params = 0xc0000100,
@@ -897,7 +895,6 @@ static void __init h3800_map_io(void)
897} 895}
898 896
899MACHINE_START(H3800, "Compaq iPAQ H3800") 897MACHINE_START(H3800, "Compaq iPAQ H3800")
900 .phys_ram = 0xc0000000,
901 .phys_io = 0x80000000, 898 .phys_io = 0x80000000,
902 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 899 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
903 .boot_params = 0xc0000100, 900 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-sa1100/hackkit.c b/arch/arm/mach-sa1100/hackkit.c
index c922e043c424..046b213efd5b 100644
--- a/arch/arm/mach-sa1100/hackkit.c
+++ b/arch/arm/mach-sa1100/hackkit.c
@@ -195,7 +195,6 @@ static void __init hackkit_init(void)
195 */ 195 */
196 196
197MACHINE_START(HACKKIT, "HackKit Cpu Board") 197MACHINE_START(HACKKIT, "HackKit Cpu Board")
198 .phys_ram = 0xc0000000,
199 .phys_io = 0x80000000, 198 .phys_io = 0x80000000,
200 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 199 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
201 .boot_params = 0xc0000100, 200 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-sa1100/jornada720.c b/arch/arm/mach-sa1100/jornada720.c
index 2f671cc3cb99..17f5a43acdb7 100644
--- a/arch/arm/mach-sa1100/jornada720.c
+++ b/arch/arm/mach-sa1100/jornada720.c
@@ -173,7 +173,6 @@ static void __init jornada720_mach_init(void)
173 173
174MACHINE_START(JORNADA720, "HP Jornada 720") 174MACHINE_START(JORNADA720, "HP Jornada 720")
175 /* Maintainer: Michael Gernoth <michael@gernoth.net> */ 175 /* Maintainer: Michael Gernoth <michael@gernoth.net> */
176 .phys_ram = 0xc0000000,
177 .phys_io = 0x80000000, 176 .phys_io = 0x80000000,
178 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 177 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
179 .boot_params = 0xc0000100, 178 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-sa1100/lart.c b/arch/arm/mach-sa1100/lart.c
index 8c9e3dd52942..07d3a696ae7f 100644
--- a/arch/arm/mach-sa1100/lart.c
+++ b/arch/arm/mach-sa1100/lart.c
@@ -60,7 +60,6 @@ static void __init lart_map_io(void)
60} 60}
61 61
62MACHINE_START(LART, "LART") 62MACHINE_START(LART, "LART")
63 .phys_ram = 0xc0000000,
64 .phys_io = 0x80000000, 63 .phys_io = 0x80000000,
65 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 64 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
66 .boot_params = 0xc0000100, 65 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-sa1100/pleb.c b/arch/arm/mach-sa1100/pleb.c
index 58c18f9e9b7b..0709ebab531c 100644
--- a/arch/arm/mach-sa1100/pleb.c
+++ b/arch/arm/mach-sa1100/pleb.c
@@ -146,7 +146,6 @@ static void __init pleb_map_io(void)
146} 146}
147 147
148MACHINE_START(PLEB, "PLEB") 148MACHINE_START(PLEB, "PLEB")
149 .phys_ram = 0xc0000000,
150 .phys_io = 0x80000000, 149 .phys_io = 0x80000000,
151 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 150 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
152 .map_io = pleb_map_io, 151 .map_io = pleb_map_io,
diff --git a/arch/arm/mach-sa1100/pm.c b/arch/arm/mach-sa1100/pm.c
index 59c7964cfe11..786c8534231f 100644
--- a/arch/arm/mach-sa1100/pm.c
+++ b/arch/arm/mach-sa1100/pm.c
@@ -135,29 +135,11 @@ unsigned long sleep_phys_sp(void *sp)
135} 135}
136 136
137/* 137/*
138 * Called after processes are frozen, but before we shut down devices.
139 */
140static int sa11x0_pm_prepare(suspend_state_t state)
141{
142 return 0;
143}
144
145/*
146 * Called after devices are re-setup, but before processes are thawed.
147 */
148static int sa11x0_pm_finish(suspend_state_t state)
149{
150 return 0;
151}
152
153/*
154 * Set to PM_DISK_FIRMWARE so we can quickly veto suspend-to-disk. 138 * Set to PM_DISK_FIRMWARE so we can quickly veto suspend-to-disk.
155 */ 139 */
156static struct pm_ops sa11x0_pm_ops = { 140static struct pm_ops sa11x0_pm_ops = {
157 .pm_disk_mode = PM_DISK_FIRMWARE, 141 .pm_disk_mode = PM_DISK_FIRMWARE,
158 .prepare = sa11x0_pm_prepare,
159 .enter = sa11x0_pm_enter, 142 .enter = sa11x0_pm_enter,
160 .finish = sa11x0_pm_finish,
161}; 143};
162 144
163static int __init sa11x0_pm_init(void) 145static int __init sa11x0_pm_init(void)
diff --git a/arch/arm/mach-sa1100/shannon.c b/arch/arm/mach-sa1100/shannon.c
index 7482288278d9..5aafe0b56992 100644
--- a/arch/arm/mach-sa1100/shannon.c
+++ b/arch/arm/mach-sa1100/shannon.c
@@ -83,7 +83,6 @@ static void __init shannon_map_io(void)
83} 83}
84 84
85MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)") 85MACHINE_START(SHANNON, "Shannon (AKA: Tuxscreen)")
86 .phys_ram = 0xc0000000,
87 .phys_io = 0x80000000, 86 .phys_io = 0x80000000,
88 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 87 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
89 .boot_params = 0xc0000100, 88 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index 439ddc9b06d6..d2c23b2c34d1 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -229,7 +229,6 @@ arch_initcall(simpad_init);
229 229
230MACHINE_START(SIMPAD, "Simpad") 230MACHINE_START(SIMPAD, "Simpad")
231 /* Maintainer: Holger Freyther */ 231 /* Maintainer: Holger Freyther */
232 .phys_ram = 0xc0000000,
233 .phys_io = 0x80000000, 232 .phys_io = 0x80000000,
234 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc, 233 .io_pg_offst = ((0xf8000000) >> 18) & 0xfffc,
235 .boot_params = 0xc0000100, 234 .boot_params = 0xc0000100,
diff --git a/arch/arm/mach-shark/core.c b/arch/arm/mach-shark/core.c
index 2d428b6dbb58..877600e212dd 100644
--- a/arch/arm/mach-shark/core.c
+++ b/arch/arm/mach-shark/core.c
@@ -111,7 +111,6 @@ static struct sys_timer shark_timer = {
111 111
112MACHINE_START(SHARK, "Shark") 112MACHINE_START(SHARK, "Shark")
113 /* Maintainer: Alexander Schulz */ 113 /* Maintainer: Alexander Schulz */
114 .phys_ram = 0x08000000,
115 .phys_io = 0x40000000, 114 .phys_io = 0x40000000,
116 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc, 115 .io_pg_offst = ((0xe0000000) >> 18) & 0xfffc,
117 .boot_params = 0x08003000, 116 .boot_params = 0x08003000,
diff --git a/arch/arm/mach-versatile/Kconfig b/arch/arm/mach-versatile/Kconfig
index 8d787f4c78e6..95096afd5271 100644
--- a/arch/arm/mach-versatile/Kconfig
+++ b/arch/arm/mach-versatile/Kconfig
@@ -9,7 +9,6 @@ config ARCH_VERSATILE_PB
9 9
10config MACH_VERSATILE_AB 10config MACH_VERSATILE_AB
11 bool "Support Versatile/AB platform" 11 bool "Support Versatile/AB platform"
12 default n
13 help 12 help
14 Include support for the ARM(R) Versatile/AP platform. 13 Include support for the ARM(R) Versatile/AP platform.
15 14
diff --git a/arch/arm/mach-versatile/clock.c b/arch/arm/mach-versatile/clock.c
index b96a2ea15d41..9858c96560e2 100644
--- a/arch/arm/mach-versatile/clock.c
+++ b/arch/arm/mach-versatile/clock.c
@@ -14,28 +14,29 @@
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/err.h> 15#include <linux/err.h>
16#include <linux/string.h> 16#include <linux/string.h>
17#include <linux/clk.h>
18#include <linux/mutex.h>
17 19
18#include <asm/semaphore.h> 20#include <asm/semaphore.h>
19#include <asm/hardware/clock.h>
20#include <asm/hardware/icst307.h> 21#include <asm/hardware/icst307.h>
21 22
22#include "clock.h" 23#include "clock.h"
23 24
24static LIST_HEAD(clocks); 25static LIST_HEAD(clocks);
25static DECLARE_MUTEX(clocks_sem); 26static DEFINE_MUTEX(clocks_mutex);
26 27
27struct clk *clk_get(struct device *dev, const char *id) 28struct clk *clk_get(struct device *dev, const char *id)
28{ 29{
29 struct clk *p, *clk = ERR_PTR(-ENOENT); 30 struct clk *p, *clk = ERR_PTR(-ENOENT);
30 31
31 down(&clocks_sem); 32 mutex_lock(&clocks_mutex);
32 list_for_each_entry(p, &clocks, node) { 33 list_for_each_entry(p, &clocks, node) {
33 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 34 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
34 clk = p; 35 clk = p;
35 break; 36 break;
36 } 37 }
37 } 38 }
38 up(&clocks_sem); 39 mutex_unlock(&clocks_mutex);
39 40
40 return clk; 41 return clk;
41} 42}
@@ -58,17 +59,6 @@ void clk_disable(struct clk *clk)
58} 59}
59EXPORT_SYMBOL(clk_disable); 60EXPORT_SYMBOL(clk_disable);
60 61
61int clk_use(struct clk *clk)
62{
63 return 0;
64}
65EXPORT_SYMBOL(clk_use);
66
67void clk_unuse(struct clk *clk)
68{
69}
70EXPORT_SYMBOL(clk_unuse);
71
72unsigned long clk_get_rate(struct clk *clk) 62unsigned long clk_get_rate(struct clk *clk)
73{ 63{
74 return clk->rate; 64 return clk->rate;
@@ -121,18 +111,18 @@ static struct clk mmci_clk = {
121 111
122int clk_register(struct clk *clk) 112int clk_register(struct clk *clk)
123{ 113{
124 down(&clocks_sem); 114 mutex_lock(&clocks_mutex);
125 list_add(&clk->node, &clocks); 115 list_add(&clk->node, &clocks);
126 up(&clocks_sem); 116 mutex_unlock(&clocks_mutex);
127 return 0; 117 return 0;
128} 118}
129EXPORT_SYMBOL(clk_register); 119EXPORT_SYMBOL(clk_register);
130 120
131void clk_unregister(struct clk *clk) 121void clk_unregister(struct clk *clk)
132{ 122{
133 down(&clocks_sem); 123 mutex_lock(&clocks_mutex);
134 list_del(&clk->node); 124 list_del(&clk->node);
135 up(&clocks_sem); 125 mutex_unlock(&clocks_mutex);
136} 126}
137EXPORT_SYMBOL(clk_unregister); 127EXPORT_SYMBOL(clk_unregister);
138 128
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index a1ca46630dda..9ebbe808b41d 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -25,16 +25,17 @@
25#include <linux/platform_device.h> 25#include <linux/platform_device.h>
26#include <linux/sysdev.h> 26#include <linux/sysdev.h>
27#include <linux/interrupt.h> 27#include <linux/interrupt.h>
28#include <linux/amba/bus.h>
29#include <linux/amba/clcd.h>
28 30
29#include <asm/system.h> 31#include <asm/system.h>
30#include <asm/hardware.h> 32#include <asm/hardware.h>
31#include <asm/io.h> 33#include <asm/io.h>
32#include <asm/irq.h> 34#include <asm/irq.h>
33#include <asm/leds.h> 35#include <asm/leds.h>
34#include <asm/hardware/amba.h>
35#include <asm/hardware/amba_clcd.h>
36#include <asm/hardware/arm_timer.h> 36#include <asm/hardware/arm_timer.h>
37#include <asm/hardware/icst307.h> 37#include <asm/hardware/icst307.h>
38#include <asm/hardware/vic.h>
38 39
39#include <asm/mach/arch.h> 40#include <asm/mach/arch.h>
40#include <asm/mach/flash.h> 41#include <asm/mach/flash.h>
@@ -56,24 +57,6 @@
56#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE) 57#define VA_VIC_BASE __io_address(VERSATILE_VIC_BASE)
57#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE) 58#define VA_SIC_BASE __io_address(VERSATILE_SIC_BASE)
58 59
59static void vic_mask_irq(unsigned int irq)
60{
61 irq -= IRQ_VIC_START;
62 writel(1 << irq, VA_VIC_BASE + VIC_IRQ_ENABLE_CLEAR);
63}
64
65static void vic_unmask_irq(unsigned int irq)
66{
67 irq -= IRQ_VIC_START;
68 writel(1 << irq, VA_VIC_BASE + VIC_IRQ_ENABLE);
69}
70
71static struct irqchip vic_chip = {
72 .ack = vic_mask_irq,
73 .mask = vic_mask_irq,
74 .unmask = vic_unmask_irq,
75};
76
77static void sic_mask_irq(unsigned int irq) 60static void sic_mask_irq(unsigned int irq)
78{ 61{
79 irq -= IRQ_SIC_START; 62 irq -= IRQ_SIC_START;
@@ -127,43 +110,12 @@ sic_handle_irq(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
127 110
128void __init versatile_init_irq(void) 111void __init versatile_init_irq(void)
129{ 112{
130 unsigned int i, value; 113 unsigned int i;
131
132 /* Disable all interrupts initially. */
133 114
134 writel(0, VA_VIC_BASE + VIC_INT_SELECT); 115 vic_init(VA_VIC_BASE, ~(1 << 31));
135 writel(0, VA_VIC_BASE + VIC_IRQ_ENABLE);
136 writel(~0, VA_VIC_BASE + VIC_IRQ_ENABLE_CLEAR);
137 writel(0, VA_VIC_BASE + VIC_IRQ_STATUS);
138 writel(0, VA_VIC_BASE + VIC_ITCR);
139 writel(~0, VA_VIC_BASE + VIC_IRQ_SOFT_CLEAR);
140
141 /*
142 * Make sure we clear all existing interrupts
143 */
144 writel(0, VA_VIC_BASE + VIC_VECT_ADDR);
145 for (i = 0; i < 19; i++) {
146 value = readl(VA_VIC_BASE + VIC_VECT_ADDR);
147 writel(value, VA_VIC_BASE + VIC_VECT_ADDR);
148 }
149
150 for (i = 0; i < 16; i++) {
151 value = readl(VA_VIC_BASE + VIC_VECT_CNTL0 + (i * 4));
152 writel(value | VICVectCntl_Enable | i, VA_VIC_BASE + VIC_VECT_CNTL0 + (i * 4));
153 }
154
155 writel(32, VA_VIC_BASE + VIC_DEF_VECT_ADDR);
156
157 for (i = IRQ_VIC_START; i <= IRQ_VIC_END; i++) {
158 if (i != IRQ_VICSOURCE31) {
159 set_irq_chip(i, &vic_chip);
160 set_irq_handler(i, do_level_IRQ);
161 set_irq_flags(i, IRQF_VALID | IRQF_PROBE);
162 }
163 }
164 116
165 set_irq_handler(IRQ_VICSOURCE31, sic_handle_irq); 117 set_irq_handler(IRQ_VICSOURCE31, sic_handle_irq);
166 vic_unmask_irq(IRQ_VICSOURCE31); 118 enable_irq(IRQ_VICSOURCE31);
167 119
168 /* Do second interrupt controller */ 120 /* Do second interrupt controller */
169 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR); 121 writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
@@ -877,7 +829,7 @@ static unsigned long versatile_gettimeoffset(void)
877 ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff; 829 ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff;
878 do { 830 do {
879 ticks1 = ticks2; 831 ticks1 = ticks2;
880 status = __raw_readl(VA_IC_BASE + VIC_IRQ_RAW_STATUS); 832 status = __raw_readl(VA_IC_BASE + VIC_RAW_STATUS);
881 ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff; 833 ticks2 = readl(TIMER0_VA_BASE + TIMER_VALUE) & 0xffff;
882 } while (ticks2 > ticks1); 834 } while (ticks2 > ticks1);
883 835
diff --git a/arch/arm/mach-versatile/core.h b/arch/arm/mach-versatile/core.h
index 588c20669d5d..afcaa858eb1f 100644
--- a/arch/arm/mach-versatile/core.h
+++ b/arch/arm/mach-versatile/core.h
@@ -22,7 +22,7 @@
22#ifndef __ASM_ARCH_VERSATILE_H 22#ifndef __ASM_ARCH_VERSATILE_H
23#define __ASM_ARCH_VERSATILE_H 23#define __ASM_ARCH_VERSATILE_H
24 24
25#include <asm/hardware/amba.h> 25#include <linux/amba/bus.h>
26 26
27extern void __init versatile_init(void); 27extern void __init versatile_init(void);
28extern void __init versatile_init_irq(void); 28extern void __init versatile_init_irq(void);
diff --git a/arch/arm/mach-versatile/versatile_ab.c b/arch/arm/mach-versatile/versatile_ab.c
index 8b0b3bef24ae..1eb596782078 100644
--- a/arch/arm/mach-versatile/versatile_ab.c
+++ b/arch/arm/mach-versatile/versatile_ab.c
@@ -23,12 +23,12 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/amba/bus.h>
26 27
27#include <asm/hardware.h> 28#include <asm/hardware.h>
28#include <asm/io.h> 29#include <asm/io.h>
29#include <asm/irq.h> 30#include <asm/irq.h>
30#include <asm/mach-types.h> 31#include <asm/mach-types.h>
31#include <asm/hardware/amba.h>
32 32
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34 34
@@ -36,7 +36,6 @@
36 36
37MACHINE_START(VERSATILE_AB, "ARM-Versatile AB") 37MACHINE_START(VERSATILE_AB, "ARM-Versatile AB")
38 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 38 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
39 .phys_ram = 0x00000000,
40 .phys_io = 0x101f1000, 39 .phys_io = 0x101f1000,
41 .io_pg_offst = ((0xf11f1000) >> 18) & 0xfffc, 40 .io_pg_offst = ((0xf11f1000) >> 18) & 0xfffc,
42 .boot_params = 0x00000100, 41 .boot_params = 0x00000100,
diff --git a/arch/arm/mach-versatile/versatile_pb.c b/arch/arm/mach-versatile/versatile_pb.c
index 7c3078c38916..f17ab4fb548a 100644
--- a/arch/arm/mach-versatile/versatile_pb.c
+++ b/arch/arm/mach-versatile/versatile_pb.c
@@ -23,12 +23,12 @@
23#include <linux/init.h> 23#include <linux/init.h>
24#include <linux/device.h> 24#include <linux/device.h>
25#include <linux/sysdev.h> 25#include <linux/sysdev.h>
26#include <linux/amba/bus.h>
26 27
27#include <asm/hardware.h> 28#include <asm/hardware.h>
28#include <asm/io.h> 29#include <asm/io.h>
29#include <asm/irq.h> 30#include <asm/irq.h>
30#include <asm/mach-types.h> 31#include <asm/mach-types.h>
31#include <asm/hardware/amba.h>
32 32
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/mmc.h> 34#include <asm/mach/mmc.h>
@@ -100,7 +100,6 @@ arch_initcall(versatile_pb_init);
100 100
101MACHINE_START(VERSATILE_PB, "ARM-Versatile PB") 101MACHINE_START(VERSATILE_PB, "ARM-Versatile PB")
102 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */ 102 /* Maintainer: ARM Ltd/Deep Blue Solutions Ltd */
103 .phys_ram = 0x00000000,
104 .phys_io = 0x101f1000, 103 .phys_io = 0x101f1000,
105 .io_pg_offst = ((0xf11f1000) >> 18) & 0xfffc, 104 .io_pg_offst = ((0xf11f1000) >> 18) & 0xfffc,
106 .boot_params = 0x00000100, 105 .boot_params = 0x00000100,
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index e84fdde6edf8..3b79d0e23455 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -62,8 +62,8 @@ config CPU_ARM720T
62# ARM920T 62# ARM920T
63config CPU_ARM920T 63config CPU_ARM920T
64 bool "Support ARM920T processor" if !ARCH_S3C2410 64 bool "Support ARM920T processor" if !ARCH_S3C2410
65 depends on ARCH_INTEGRATOR || ARCH_S3C2410 || ARCH_IMX || ARCH_AAEC2000 65 depends on ARCH_INTEGRATOR || ARCH_S3C2410 || ARCH_IMX || ARCH_AAEC2000 || ARCH_AT91RM9200
66 default y if ARCH_S3C2410 66 default y if ARCH_S3C2410 || ARCH_AT91RM9200
67 select CPU_32v4 67 select CPU_32v4
68 select CPU_ABRT_EV4T 68 select CPU_ABRT_EV4T
69 select CPU_CACHE_V4WT 69 select CPU_CACHE_V4WT
@@ -83,8 +83,8 @@ config CPU_ARM920T
83# ARM922T 83# ARM922T
84config CPU_ARM922T 84config CPU_ARM922T
85 bool "Support ARM922T processor" if ARCH_INTEGRATOR 85 bool "Support ARM922T processor" if ARCH_INTEGRATOR
86 depends on ARCH_CAMELOT || ARCH_LH7A40X || ARCH_INTEGRATOR 86 depends on ARCH_LH7A40X || ARCH_INTEGRATOR
87 default y if ARCH_CAMELOT || ARCH_LH7A40X 87 default y if ARCH_LH7A40X
88 select CPU_32v4 88 select CPU_32v4
89 select CPU_ABRT_EV4T 89 select CPU_ABRT_EV4T
90 select CPU_CACHE_V4WT 90 select CPU_CACHE_V4WT
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c
index dbfe9e891f01..c2ee18d2075e 100644
--- a/arch/arm/mm/consistent.c
+++ b/arch/arm/mm/consistent.c
@@ -19,17 +19,26 @@
19#include <linux/dma-mapping.h> 19#include <linux/dma-mapping.h>
20 20
21#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
22#include <asm/io.h>
23#include <asm/tlbflush.h> 22#include <asm/tlbflush.h>
23#include <asm/sizes.h>
24
25/* Sanity check size */
26#if (CONSISTENT_DMA_SIZE % SZ_2M)
27#error "CONSISTENT_DMA_SIZE must be multiple of 2MiB"
28#endif
24 29
25#define CONSISTENT_BASE (0xffc00000)
26#define CONSISTENT_END (0xffe00000) 30#define CONSISTENT_END (0xffe00000)
31#define CONSISTENT_BASE (CONSISTENT_END - CONSISTENT_DMA_SIZE)
32
27#define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT) 33#define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT)
34#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PGDIR_SHIFT)
35#define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PGDIR_SHIFT)
36
28 37
29/* 38/*
30 * This is the page table (2MB) covering uncached, DMA consistent allocations 39 * These are the page tables (2MB each) covering uncached, DMA consistent allocations
31 */ 40 */
32static pte_t *consistent_pte; 41static pte_t *consistent_pte[NUM_CONSISTENT_PTES];
33static DEFINE_SPINLOCK(consistent_lock); 42static DEFINE_SPINLOCK(consistent_lock);
34 43
35/* 44/*
@@ -143,7 +152,7 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
143 unsigned long order; 152 unsigned long order;
144 u64 mask = ISA_DMA_THRESHOLD, limit; 153 u64 mask = ISA_DMA_THRESHOLD, limit;
145 154
146 if (!consistent_pte) { 155 if (!consistent_pte[0]) {
147 printk(KERN_ERR "%s: not initialised\n", __func__); 156 printk(KERN_ERR "%s: not initialised\n", __func__);
148 dump_stack(); 157 dump_stack();
149 return NULL; 158 return NULL;
@@ -206,9 +215,12 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
206 c = vm_region_alloc(&consistent_head, size, 215 c = vm_region_alloc(&consistent_head, size,
207 gfp & ~(__GFP_DMA | __GFP_HIGHMEM)); 216 gfp & ~(__GFP_DMA | __GFP_HIGHMEM));
208 if (c) { 217 if (c) {
209 pte_t *pte = consistent_pte + CONSISTENT_OFFSET(c->vm_start); 218 pte_t *pte;
210 struct page *end = page + (1 << order); 219 struct page *end = page + (1 << order);
220 int idx = CONSISTENT_PTE_INDEX(c->vm_start);
221 u32 off = CONSISTENT_OFFSET(c->vm_start) & (PTRS_PER_PTE-1);
211 222
223 pte = consistent_pte[idx] + off;
212 c->vm_pages = page; 224 c->vm_pages = page;
213 225
214 /* 226 /*
@@ -227,6 +239,11 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
227 set_pte(pte, mk_pte(page, prot)); 239 set_pte(pte, mk_pte(page, prot));
228 page++; 240 page++;
229 pte++; 241 pte++;
242 off++;
243 if (off >= PTRS_PER_PTE) {
244 off = 0;
245 pte = consistent_pte[++idx];
246 }
230 } while (size -= PAGE_SIZE); 247 } while (size -= PAGE_SIZE);
231 248
232 /* 249 /*
@@ -328,6 +345,8 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr
328 struct vm_region *c; 345 struct vm_region *c;
329 unsigned long flags, addr; 346 unsigned long flags, addr;
330 pte_t *ptep; 347 pte_t *ptep;
348 int idx;
349 u32 off;
331 350
332 WARN_ON(irqs_disabled()); 351 WARN_ON(irqs_disabled());
333 352
@@ -348,7 +367,9 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr
348 size = c->vm_end - c->vm_start; 367 size = c->vm_end - c->vm_start;
349 } 368 }
350 369
351 ptep = consistent_pte + CONSISTENT_OFFSET(c->vm_start); 370 idx = CONSISTENT_PTE_INDEX(c->vm_start);
371 off = CONSISTENT_OFFSET(c->vm_start) & (PTRS_PER_PTE-1);
372 ptep = consistent_pte[idx] + off;
352 addr = c->vm_start; 373 addr = c->vm_start;
353 do { 374 do {
354 pte_t pte = ptep_get_and_clear(&init_mm, addr, ptep); 375 pte_t pte = ptep_get_and_clear(&init_mm, addr, ptep);
@@ -356,6 +377,11 @@ void dma_free_coherent(struct device *dev, size_t size, void *cpu_addr, dma_addr
356 377
357 ptep++; 378 ptep++;
358 addr += PAGE_SIZE; 379 addr += PAGE_SIZE;
380 off++;
381 if (off >= PTRS_PER_PTE) {
382 off = 0;
383 ptep = consistent_pte[++idx];
384 }
359 385
360 if (!pte_none(pte) && pte_present(pte)) { 386 if (!pte_none(pte) && pte_present(pte)) {
361 pfn = pte_pfn(pte); 387 pfn = pte_pfn(pte);
@@ -402,11 +428,12 @@ static int __init consistent_init(void)
402 pgd_t *pgd; 428 pgd_t *pgd;
403 pmd_t *pmd; 429 pmd_t *pmd;
404 pte_t *pte; 430 pte_t *pte;
405 int ret = 0; 431 int ret = 0, i = 0;
432 u32 base = CONSISTENT_BASE;
406 433
407 do { 434 do {
408 pgd = pgd_offset(&init_mm, CONSISTENT_BASE); 435 pgd = pgd_offset(&init_mm, base);
409 pmd = pmd_alloc(&init_mm, pgd, CONSISTENT_BASE); 436 pmd = pmd_alloc(&init_mm, pgd, base);
410 if (!pmd) { 437 if (!pmd) {
411 printk(KERN_ERR "%s: no pmd tables\n", __func__); 438 printk(KERN_ERR "%s: no pmd tables\n", __func__);
412 ret = -ENOMEM; 439 ret = -ENOMEM;
@@ -414,15 +441,16 @@ static int __init consistent_init(void)
414 } 441 }
415 WARN_ON(!pmd_none(*pmd)); 442 WARN_ON(!pmd_none(*pmd));
416 443
417 pte = pte_alloc_kernel(pmd, CONSISTENT_BASE); 444 pte = pte_alloc_kernel(pmd, base);
418 if (!pte) { 445 if (!pte) {
419 printk(KERN_ERR "%s: no pte tables\n", __func__); 446 printk(KERN_ERR "%s: no pte tables\n", __func__);
420 ret = -ENOMEM; 447 ret = -ENOMEM;
421 break; 448 break;
422 } 449 }
423 450
424 consistent_pte = pte; 451 consistent_pte[i++] = pte;
425 } while (0); 452 base += (1 << PGDIR_SHIFT);
453 } while (base < CONSISTENT_END);
426 454
427 return ret; 455 return ret;
428} 456}
diff --git a/arch/arm/mm/discontig.c b/arch/arm/mm/discontig.c
index 0d097bb1bc4d..1e5602189507 100644
--- a/arch/arm/mm/discontig.c
+++ b/arch/arm/mm/discontig.c
@@ -9,10 +9,8 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12
13#include <linux/module.h> 12#include <linux/module.h>
14#include <linux/mm.h> 13#include <linux/mmzone.h>
15#include <linux/init.h>
16#include <linux/bootmem.h> 14#include <linux/bootmem.h>
17 15
18#if MAX_NUMNODES != 4 && MAX_NUMNODES != 16 16#if MAX_NUMNODES != 4 && MAX_NUMNODES != 16
diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c
index c9a03981b785..330695b6b19d 100644
--- a/arch/arm/mm/flush.c
+++ b/arch/arm/mm/flush.c
@@ -155,14 +155,19 @@ static void __flush_dcache_aliases(struct address_space *mapping, struct page *p
155 * space mappings, we can be lazy and remember that we may have dirty 155 * space mappings, we can be lazy and remember that we may have dirty
156 * kernel cache lines for later. Otherwise, we assume we have 156 * kernel cache lines for later. Otherwise, we assume we have
157 * aliasing mappings. 157 * aliasing mappings.
158 *
159 * Note that we disable the lazy flush for SMP.
158 */ 160 */
159void flush_dcache_page(struct page *page) 161void flush_dcache_page(struct page *page)
160{ 162{
161 struct address_space *mapping = page_mapping(page); 163 struct address_space *mapping = page_mapping(page);
162 164
165#ifndef CONFIG_SMP
163 if (mapping && !mapping_mapped(mapping)) 166 if (mapping && !mapping_mapped(mapping))
164 set_bit(PG_dcache_dirty, &page->flags); 167 set_bit(PG_dcache_dirty, &page->flags);
165 else { 168 else
169#endif
170 {
166 __flush_dcache_page(mapping, page); 171 __flush_dcache_page(mapping, page);
167 if (mapping && cache_is_vivt()) 172 if (mapping && cache_is_vivt())
168 __flush_dcache_aliases(mapping, page); 173 __flush_dcache_aliases(mapping, page);
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 10901398e4a2..de3ce1eec2ec 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -86,11 +86,12 @@ remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size,
86} 86}
87 87
88static int 88static int
89remap_area_pages(unsigned long start, unsigned long phys_addr, 89remap_area_pages(unsigned long start, unsigned long pfn,
90 unsigned long size, unsigned long flags) 90 unsigned long size, unsigned long flags)
91{ 91{
92 unsigned long address = start; 92 unsigned long address = start;
93 unsigned long end = start + size; 93 unsigned long end = start + size;
94 unsigned long phys_addr = __pfn_to_phys(pfn);
94 int err = 0; 95 int err = 0;
95 pgd_t * dir; 96 pgd_t * dir;
96 97
@@ -130,36 +131,44 @@ remap_area_pages(unsigned long start, unsigned long phys_addr,
130 * mapping. See include/asm-arm/proc-armv/pgtable.h for more information. 131 * mapping. See include/asm-arm/proc-armv/pgtable.h for more information.
131 */ 132 */
132void __iomem * 133void __iomem *
134__ioremap_pfn(unsigned long pfn, unsigned long offset, size_t size,
135 unsigned long flags)
136{
137 unsigned long addr;
138 struct vm_struct * area;
139
140 area = get_vm_area(size, VM_IOREMAP);
141 if (!area)
142 return NULL;
143 addr = (unsigned long)area->addr;
144 if (remap_area_pages(addr, pfn, size, flags)) {
145 vfree(addr);
146 return NULL;
147 }
148 return (void __iomem *) (offset + (char *)addr);
149}
150EXPORT_SYMBOL(__ioremap_pfn);
151
152void __iomem *
133__ioremap(unsigned long phys_addr, size_t size, unsigned long flags) 153__ioremap(unsigned long phys_addr, size_t size, unsigned long flags)
134{ 154{
135 void * addr; 155 unsigned long last_addr;
136 struct vm_struct * area; 156 unsigned long offset = phys_addr & ~PAGE_MASK;
137 unsigned long offset, last_addr; 157 unsigned long pfn = __phys_to_pfn(phys_addr);
138 158
139 /* Don't allow wraparound or zero size */ 159 /*
160 * Don't allow wraparound or zero size
161 */
140 last_addr = phys_addr + size - 1; 162 last_addr = phys_addr + size - 1;
141 if (!size || last_addr < phys_addr) 163 if (!size || last_addr < phys_addr)
142 return NULL; 164 return NULL;
143 165
144 /* 166 /*
145 * Mappings have to be page-aligned 167 * Page align the mapping size
146 */ 168 */
147 offset = phys_addr & ~PAGE_MASK;
148 phys_addr &= PAGE_MASK;
149 size = PAGE_ALIGN(last_addr + 1) - phys_addr; 169 size = PAGE_ALIGN(last_addr + 1) - phys_addr;
150 170
151 /* 171 return __ioremap_pfn(pfn, offset, size, flags);
152 * Ok, go for it..
153 */
154 area = get_vm_area(size, VM_IOREMAP);
155 if (!area)
156 return NULL;
157 addr = area->addr;
158 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) {
159 vfree(addr);
160 return NULL;
161 }
162 return (void __iomem *) (offset + (char *)addr);
163} 172}
164EXPORT_SYMBOL(__ioremap); 173EXPORT_SYMBOL(__ioremap);
165 174
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
index 9e50127be635..d0245a31d4dd 100644
--- a/arch/arm/mm/mm-armv.c
+++ b/arch/arm/mm/mm-armv.c
@@ -19,7 +19,6 @@
19 19
20#include <asm/pgalloc.h> 20#include <asm/pgalloc.h>
21#include <asm/page.h> 21#include <asm/page.h>
22#include <asm/io.h>
23#include <asm/setup.h> 22#include <asm/setup.h>
24#include <asm/tlbflush.h> 23#include <asm/tlbflush.h>
25 24
diff --git a/arch/arm/nwfpe/fpa11.h b/arch/arm/nwfpe/fpa11.h
index da4c616b6c49..28cd79a451d3 100644
--- a/arch/arm/nwfpe/fpa11.h
+++ b/arch/arm/nwfpe/fpa11.h
@@ -62,7 +62,7 @@ typedef union tagFPREG {
62#else 62#else
63 u32 padding[3]; 63 u32 padding[3];
64#endif 64#endif
65} FPREG; 65} __attribute__ ((packed,aligned(4))) FPREG;
66 66
67/* 67/*
68 * FPA11 device model. 68 * FPA11 device model.
@@ -89,7 +89,7 @@ typedef struct tagFPA11 {
89 so we can use it to detect whether this 89 so we can use it to detect whether this
90 instance of the emulator needs to be 90 instance of the emulator needs to be
91 initialised. */ 91 initialised. */
92} FPA11; 92} __attribute__ ((packed,aligned(4))) FPA11;
93 93
94extern int8 SetRoundingMode(const unsigned int); 94extern int8 SetRoundingMode(const unsigned int);
95extern int8 SetRoundingPrecision(const unsigned int); 95extern int8 SetRoundingPrecision(const unsigned int);
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 9693e9b4ffd1..0887bb2a2551 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -22,7 +22,6 @@ comment "OMAP Feature Selections"
22config OMAP_RESET_CLOCKS 22config OMAP_RESET_CLOCKS
23 bool "Reset unused clocks during boot" 23 bool "Reset unused clocks during boot"
24 depends on ARCH_OMAP 24 depends on ARCH_OMAP
25 default n
26 help 25 help
27 Say Y if you want to reset unused clocks during boot. 26 Say Y if you want to reset unused clocks during boot.
28 This option saves power, but assumes all drivers are 27 This option saves power, but assumes all drivers are
@@ -44,7 +43,6 @@ config OMAP_MUX
44config OMAP_MUX_DEBUG 43config OMAP_MUX_DEBUG
45 bool "Multiplexing debug output" 44 bool "Multiplexing debug output"
46 depends on OMAP_MUX 45 depends on OMAP_MUX
47 default n
48 help 46 help
49 Makes the multiplexing functions print out a lot of debug info. 47 Makes the multiplexing functions print out a lot of debug info.
50 This is useful if you want to find out the correct values of the 48 This is useful if you want to find out the correct values of the
@@ -93,7 +91,6 @@ config OMAP_32K_TIMER_HZ
93 91
94config OMAP_DM_TIMER 92config OMAP_DM_TIMER
95 bool "Use dual-mode timer" 93 bool "Use dual-mode timer"
96 default n
97 depends on ARCH_OMAP16XX 94 depends on ARCH_OMAP16XX
98 help 95 help
99 Select this option if you want to use OMAP Dual-Mode timers. 96 Select this option if you want to use OMAP Dual-Mode timers.
diff --git a/arch/arm/plat-omap/clock.c b/arch/arm/plat-omap/clock.c
index 7ce39b986e23..3c2bfc0efdaf 100644
--- a/arch/arm/plat-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -19,35 +19,36 @@
19#include <linux/errno.h> 19#include <linux/errno.h>
20#include <linux/err.h> 20#include <linux/err.h>
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/clk.h>
23#include <linux/mutex.h>
22 24
23#include <asm/io.h> 25#include <asm/io.h>
24#include <asm/semaphore.h> 26#include <asm/semaphore.h>
25#include <asm/hardware/clock.h>
26 27
27#include <asm/arch/clock.h> 28#include <asm/arch/clock.h>
28 29
29LIST_HEAD(clocks); 30LIST_HEAD(clocks);
30static DECLARE_MUTEX(clocks_sem); 31static DEFINE_MUTEX(clocks_mutex);
31DEFINE_SPINLOCK(clockfw_lock); 32DEFINE_SPINLOCK(clockfw_lock);
32 33
33static struct clk_functions *arch_clock; 34static struct clk_functions *arch_clock;
34 35
35/*------------------------------------------------------------------------- 36/*-------------------------------------------------------------------------
36 * Standard clock functions defined in asm/hardware/clock.h 37 * Standard clock functions defined in include/linux/clk.h
37 *-------------------------------------------------------------------------*/ 38 *-------------------------------------------------------------------------*/
38 39
39struct clk * clk_get(struct device *dev, const char *id) 40struct clk * clk_get(struct device *dev, const char *id)
40{ 41{
41 struct clk *p, *clk = ERR_PTR(-ENOENT); 42 struct clk *p, *clk = ERR_PTR(-ENOENT);
42 43
43 down(&clocks_sem); 44 mutex_lock(&clocks_mutex);
44 list_for_each_entry(p, &clocks, node) { 45 list_for_each_entry(p, &clocks, node) {
45 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) { 46 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
46 clk = p; 47 clk = p;
47 break; 48 break;
48 } 49 }
49 } 50 }
50 up(&clocks_sem); 51 mutex_unlock(&clocks_mutex);
51 52
52 return clk; 53 return clk;
53} 54}
@@ -59,12 +60,8 @@ int clk_enable(struct clk *clk)
59 int ret = 0; 60 int ret = 0;
60 61
61 spin_lock_irqsave(&clockfw_lock, flags); 62 spin_lock_irqsave(&clockfw_lock, flags);
62 if (clk->enable) 63 if (arch_clock->clk_enable)
63 ret = clk->enable(clk);
64 else if (arch_clock->clk_enable)
65 ret = arch_clock->clk_enable(clk); 64 ret = arch_clock->clk_enable(clk);
66 else
67 printk(KERN_ERR "Could not enable clock %s\n", clk->name);
68 spin_unlock_irqrestore(&clockfw_lock, flags); 65 spin_unlock_irqrestore(&clockfw_lock, flags);
69 66
70 return ret; 67 return ret;
@@ -76,41 +73,12 @@ void clk_disable(struct clk *clk)
76 unsigned long flags; 73 unsigned long flags;
77 74
78 spin_lock_irqsave(&clockfw_lock, flags); 75 spin_lock_irqsave(&clockfw_lock, flags);
79 if (clk->disable) 76 if (arch_clock->clk_disable)
80 clk->disable(clk);
81 else if (arch_clock->clk_disable)
82 arch_clock->clk_disable(clk); 77 arch_clock->clk_disable(clk);
83 else
84 printk(KERN_ERR "Could not disable clock %s\n", clk->name);
85 spin_unlock_irqrestore(&clockfw_lock, flags); 78 spin_unlock_irqrestore(&clockfw_lock, flags);
86} 79}
87EXPORT_SYMBOL(clk_disable); 80EXPORT_SYMBOL(clk_disable);
88 81
89int clk_use(struct clk *clk)
90{
91 unsigned long flags;
92 int ret = 0;
93
94 spin_lock_irqsave(&clockfw_lock, flags);
95 if (arch_clock->clk_use)
96 ret = arch_clock->clk_use(clk);
97 spin_unlock_irqrestore(&clockfw_lock, flags);
98
99 return ret;
100}
101EXPORT_SYMBOL(clk_use);
102
103void clk_unuse(struct clk *clk)
104{
105 unsigned long flags;
106
107 spin_lock_irqsave(&clockfw_lock, flags);
108 if (arch_clock->clk_unuse)
109 arch_clock->clk_unuse(clk);
110 spin_unlock_irqrestore(&clockfw_lock, flags);
111}
112EXPORT_SYMBOL(clk_unuse);
113
114int clk_get_usecount(struct clk *clk) 82int clk_get_usecount(struct clk *clk)
115{ 83{
116 unsigned long flags; 84 unsigned long flags;
@@ -145,7 +113,7 @@ void clk_put(struct clk *clk)
145EXPORT_SYMBOL(clk_put); 113EXPORT_SYMBOL(clk_put);
146 114
147/*------------------------------------------------------------------------- 115/*-------------------------------------------------------------------------
148 * Optional clock functions defined in asm/hardware/clock.h 116 * Optional clock functions defined in include/linux/clk.h
149 *-------------------------------------------------------------------------*/ 117 *-------------------------------------------------------------------------*/
150 118
151long clk_round_rate(struct clk *clk, unsigned long rate) 119long clk_round_rate(struct clk *clk, unsigned long rate)
@@ -249,11 +217,11 @@ void propagate_rate(struct clk * tclk)
249 217
250int clk_register(struct clk *clk) 218int clk_register(struct clk *clk)
251{ 219{
252 down(&clocks_sem); 220 mutex_lock(&clocks_mutex);
253 list_add(&clk->node, &clocks); 221 list_add(&clk->node, &clocks);
254 if (clk->init) 222 if (clk->init)
255 clk->init(clk); 223 clk->init(clk);
256 up(&clocks_sem); 224 mutex_unlock(&clocks_mutex);
257 225
258 return 0; 226 return 0;
259} 227}
@@ -261,9 +229,9 @@ EXPORT_SYMBOL(clk_register);
261 229
262void clk_unregister(struct clk *clk) 230void clk_unregister(struct clk *clk)
263{ 231{
264 down(&clocks_sem); 232 mutex_lock(&clocks_mutex);
265 list_del(&clk->node); 233 list_del(&clk->node);
266 up(&clocks_sem); 234 mutex_unlock(&clocks_mutex);
267} 235}
268EXPORT_SYMBOL(clk_unregister); 236EXPORT_SYMBOL(clk_unregister);
269 237
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index ccdb452630cf..adffc5a859ee 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -18,12 +18,12 @@
18#include <linux/tty.h> 18#include <linux/tty.h>
19#include <linux/serial_8250.h> 19#include <linux/serial_8250.h>
20#include <linux/serial_reg.h> 20#include <linux/serial_reg.h>
21#include <linux/clk.h>
21 22
22#include <asm/hardware.h> 23#include <asm/hardware.h>
23#include <asm/system.h> 24#include <asm/system.h>
24#include <asm/pgtable.h> 25#include <asm/pgtable.h>
25#include <asm/mach/map.h> 26#include <asm/mach/map.h>
26#include <asm/hardware/clock.h>
27#include <asm/io.h> 27#include <asm/io.h>
28#include <asm/setup.h> 28#include <asm/setup.h>
29 29
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
index fd894bb00107..98edc9fdd6d1 100644
--- a/arch/arm/plat-omap/cpu-omap.c
+++ b/arch/arm/plat-omap/cpu-omap.c
@@ -19,13 +19,12 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/clk.h>
22 23
23#include <asm/hardware.h> 24#include <asm/hardware.h>
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/system.h> 26#include <asm/system.h>
26 27
27#include <asm/hardware/clock.h>
28
29/* TODO: Add support for SDRAM timing changes */ 28/* TODO: Add support for SDRAM timing changes */
30 29
31int omap_verify_speed(struct cpufreq_policy *policy) 30int omap_verify_speed(struct cpufreq_policy *policy)
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index f5cc21ad0956..a4e5ac77f6df 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -64,7 +64,7 @@ static int dma_chan_count;
64static spinlock_t dma_chan_lock; 64static spinlock_t dma_chan_lock;
65static struct omap_dma_lch dma_chan[OMAP_LOGICAL_DMA_CH_COUNT]; 65static struct omap_dma_lch dma_chan[OMAP_LOGICAL_DMA_CH_COUNT];
66 66
67const static u8 omap1_dma_irq[OMAP_LOGICAL_DMA_CH_COUNT] = { 67static const u8 omap1_dma_irq[OMAP_LOGICAL_DMA_CH_COUNT] = {
68 INT_DMA_CH0_6, INT_DMA_CH1_7, INT_DMA_CH2_8, INT_DMA_CH3, 68 INT_DMA_CH0_6, INT_DMA_CH1_7, INT_DMA_CH2_8, INT_DMA_CH3,
69 INT_DMA_CH4, INT_DMA_CH5, INT_1610_DMA_CH6, INT_1610_DMA_CH7, 69 INT_DMA_CH4, INT_DMA_CH5, INT_1610_DMA_CH6, INT_1610_DMA_CH7,
70 INT_1610_DMA_CH8, INT_1610_DMA_CH9, INT_1610_DMA_CH10, 70 INT_1610_DMA_CH8, INT_1610_DMA_CH9, INT_1610_DMA_CH10,
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 76f721d85137..b4d5b9e4bfce 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -19,9 +19,9 @@
19#include <linux/ptrace.h> 19#include <linux/ptrace.h>
20#include <linux/sysdev.h> 20#include <linux/sysdev.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/clk.h>
22 23
23#include <asm/hardware.h> 24#include <asm/hardware.h>
24#include <asm/hardware/clock.h>
25#include <asm/irq.h> 25#include <asm/irq.h>
26#include <asm/arch/irqs.h> 26#include <asm/arch/irqs.h>
27#include <asm/arch/gpio.h> 27#include <asm/arch/gpio.h>
@@ -853,19 +853,19 @@ static int __init _omap_gpio_init(void)
853 if (IS_ERR(gpio_ick)) 853 if (IS_ERR(gpio_ick))
854 printk("Could not get arm_gpio_ck\n"); 854 printk("Could not get arm_gpio_ck\n");
855 else 855 else
856 clk_use(gpio_ick); 856 clk_enable(gpio_ick);
857 } 857 }
858 if (cpu_is_omap24xx()) { 858 if (cpu_is_omap24xx()) {
859 gpio_ick = clk_get(NULL, "gpios_ick"); 859 gpio_ick = clk_get(NULL, "gpios_ick");
860 if (IS_ERR(gpio_ick)) 860 if (IS_ERR(gpio_ick))
861 printk("Could not get gpios_ick\n"); 861 printk("Could not get gpios_ick\n");
862 else 862 else
863 clk_use(gpio_ick); 863 clk_enable(gpio_ick);
864 gpio_fck = clk_get(NULL, "gpios_fck"); 864 gpio_fck = clk_get(NULL, "gpios_fck");
865 if (IS_ERR(gpio_ick)) 865 if (IS_ERR(gpio_ick))
866 printk("Could not get gpios_fck\n"); 866 printk("Could not get gpios_fck\n");
867 else 867 else
868 clk_use(gpio_fck); 868 clk_enable(gpio_fck);
869 } 869 }
870 870
871#ifdef CONFIG_ARCH_OMAP15XX 871#ifdef CONFIG_ARCH_OMAP15XX
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index ea9475c86656..1cd2cace7e1b 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -19,6 +19,7 @@
19#include <linux/completion.h> 19#include <linux/completion.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/err.h> 21#include <linux/err.h>
22#include <linux/clk.h>
22 23
23#include <asm/delay.h> 24#include <asm/delay.h>
24#include <asm/io.h> 25#include <asm/io.h>
@@ -30,8 +31,6 @@
30#include <asm/arch/dsp_common.h> 31#include <asm/arch/dsp_common.h>
31#include <asm/arch/mcbsp.h> 32#include <asm/arch/mcbsp.h>
32 33
33#include <asm/hardware/clock.h>
34
35#ifdef CONFIG_MCBSP_DEBUG 34#ifdef CONFIG_MCBSP_DEBUG
36#define DBG(x...) printk(x) 35#define DBG(x...) printk(x)
37#else 36#else
@@ -191,11 +190,11 @@ static int omap_mcbsp_check(unsigned int id)
191static void omap_mcbsp_dsp_request(void) 190static void omap_mcbsp_dsp_request(void)
192{ 191{
193 if (cpu_is_omap1510() || cpu_is_omap16xx()) { 192 if (cpu_is_omap1510() || cpu_is_omap16xx()) {
194 clk_use(mcbsp_dsp_ck); 193 clk_enable(mcbsp_dsp_ck);
195 clk_use(mcbsp_api_ck); 194 clk_enable(mcbsp_api_ck);
196 195
197 /* enable 12MHz clock to mcbsp 1 & 3 */ 196 /* enable 12MHz clock to mcbsp 1 & 3 */
198 clk_use(mcbsp_dspxor_ck); 197 clk_enable(mcbsp_dspxor_ck);
199 198
200 /* 199 /*
201 * DSP external peripheral reset 200 * DSP external peripheral reset
@@ -209,9 +208,9 @@ static void omap_mcbsp_dsp_request(void)
209static void omap_mcbsp_dsp_free(void) 208static void omap_mcbsp_dsp_free(void)
210{ 209{
211 if (cpu_is_omap1510() || cpu_is_omap16xx()) { 210 if (cpu_is_omap1510() || cpu_is_omap16xx()) {
212 clk_unuse(mcbsp_dspxor_ck); 211 clk_disable(mcbsp_dspxor_ck);
213 clk_unuse(mcbsp_dsp_ck); 212 clk_disable(mcbsp_dsp_ck);
214 clk_unuse(mcbsp_api_ck); 213 clk_disable(mcbsp_api_ck);
215 } 214 }
216} 215}
217 216
diff --git a/arch/arm/plat-omap/ocpi.c b/arch/arm/plat-omap/ocpi.c
index b86148227480..5cc6775c789c 100644
--- a/arch/arm/plat-omap/ocpi.c
+++ b/arch/arm/plat-omap/ocpi.c
@@ -31,9 +31,9 @@
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <linux/err.h> 33#include <linux/err.h>
34#include <linux/clk.h>
34 35
35#include <asm/io.h> 36#include <asm/io.h>
36#include <asm/hardware/clock.h>
37#include <asm/hardware.h> 37#include <asm/hardware.h>
38 38
39#define OCPI_BASE 0xfffec320 39#define OCPI_BASE 0xfffec320
@@ -88,7 +88,7 @@ static int __init omap_ocpi_init(void)
88 if (IS_ERR(ocpi_ck)) 88 if (IS_ERR(ocpi_ck))
89 return PTR_ERR(ocpi_ck); 89 return PTR_ERR(ocpi_ck);
90 90
91 clk_use(ocpi_ck); 91 clk_enable(ocpi_ck);
92 ocpi_enable(); 92 ocpi_enable();
93 printk("OMAP OCPI interconnect driver loaded\n"); 93 printk("OMAP OCPI interconnect driver loaded\n");
94 94
@@ -102,7 +102,7 @@ static void __exit omap_ocpi_exit(void)
102 if (!cpu_is_omap16xx()) 102 if (!cpu_is_omap16xx())
103 return; 103 return;
104 104
105 clk_unuse(ocpi_ck); 105 clk_disable(ocpi_ck);
106 clk_put(ocpi_ck); 106 clk_put(ocpi_ck);
107} 107}
108 108
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 465487470d0e..d0f9bb5e9023 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,7 +12,7 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# Last update: Fri Nov 25 14:43:04 2005 15# Last update: Mon Jan 9 12:56:42 2006
16# 16#
17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number 17# machine_is_xxx CONFIG_xxxx MACH_TYPE_xxx number
18# 18#
@@ -910,3 +910,31 @@ mbus MACH_MBUS MBUS 896
910nadia2vb MACH_NADIA2VB NADIA2VB 897 910nadia2vb MACH_NADIA2VB NADIA2VB 897
911r1000 MACH_R1000 R1000 898 911r1000 MACH_R1000 R1000 898
912hw90250 MACH_HW90250 HW90250 899 912hw90250 MACH_HW90250 HW90250 899
913omap_2430sdp MACH_OMAP_2430SDP OMAP_2430SDP 900
914davinci_evm MACH_DAVINCI_EVM DAVINCI_EVM 901
915omap_tornado MACH_OMAP_TORNADO OMAP_TORNADO 902
916olocreek MACH_OLOCREEK OLOCREEK 903
917palmz72 MACH_PALMZ72 PALMZ72 904
918nxdb500 MACH_NXDB500 NXDB500 905
919apf9328 MACH_APF9328 APF9328 906
920omap_wipoq MACH_OMAP_WIPOQ OMAP_WIPOQ 907
921omap_twip MACH_OMAP_TWIP OMAP_TWIP 908
922xscale_treo650 MACH_XSCALE_PALMTREO650 XSCALE_PALMTREO650 909
923acumen MACH_ACUMEN ACUMEN 910
924xp100 MACH_XP100 XP100 911
925fs2410 MACH_FS2410 FS2410 912
926pxa270_cerf MACH_PXA270_CERF PXA270_CERF 913
927sq2ftlpalm MACH_SQ2FTLPALM SQ2FTLPALM 914
928bsemserver MACH_BSEMSERVER BSEMSERVER 915
929netclient MACH_NETCLIENT NETCLIENT 916
930xscale_palmtt5 MACH_XSCALE_PALMTT5 XSCALE_PALMTT5 917
931xscale_palmtc MACH_OMAP_PALMTC OMAP_PALMTC 918
932omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919
933argonlvevb MACH_ARGONLVEVB ARGONLVEVB 920
934rea_2d MACH_REA_2D REA_2D 921
935eti3e524 MACH_TI3E524 TI3E524 922
936ateb9200 MACH_ATEB9200 ATEB9200 923
937auckland MACH_AUCKLAND AUCKLAND 924
938ak3220m MACH_AK3320M AK3320M 925
939duramax MACH_DURAMAX DURAMAX 926
940n35 MACH_N35 N35 927
diff --git a/arch/arm26/Kconfig b/arch/arm26/Kconfig
index 1f00b3d03a07..274e07019b46 100644
--- a/arch/arm26/Kconfig
+++ b/arch/arm26/Kconfig
@@ -34,10 +34,6 @@ config FORCE_MAX_ZONEORDER
34 int 34 int
35 default 9 35 default 9
36 36
37config UID16
38 bool
39 default y
40
41config RWSEM_GENERIC_SPINLOCK 37config RWSEM_GENERIC_SPINLOCK
42 bool 38 bool
43 default y 39 default y
diff --git a/arch/arm26/kernel/armksyms.c b/arch/arm26/kernel/armksyms.c
index 35514b398e2e..811a6376c624 100644
--- a/arch/arm26/kernel/armksyms.c
+++ b/arch/arm26/kernel/armksyms.c
@@ -35,7 +35,6 @@
35#include <asm/checksum.h> 35#include <asm/checksum.h>
36#include <asm/mach-types.h> 36#include <asm/mach-types.h>
37 37
38extern void dump_thread(struct pt_regs *, struct user *);
39extern int dump_fpu(struct pt_regs *, struct user_fp_struct *); 38extern int dump_fpu(struct pt_regs *, struct user_fp_struct *);
40extern void inswb(unsigned int port, void *to, int len); 39extern void inswb(unsigned int port, void *to, int len);
41extern void outswb(unsigned int port, const void *to, int len); 40extern void outswb(unsigned int port, const void *to, int len);
diff --git a/arch/arm26/kernel/asm-offsets.c b/arch/arm26/kernel/asm-offsets.c
index 4ccacaef94df..ac682d5fd039 100644
--- a/arch/arm26/kernel/asm-offsets.c
+++ b/arch/arm26/kernel/asm-offsets.c
@@ -25,13 +25,6 @@
25#if defined(__APCS_32__) && defined(CONFIG_CPU_26) 25#if defined(__APCS_32__) && defined(CONFIG_CPU_26)
26#error Sorry, your compiler targets APCS-32 but this kernel requires APCS-26 26#error Sorry, your compiler targets APCS-32 but this kernel requires APCS-26
27#endif 27#endif
28#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 95)
29#error Sorry, your compiler is known to miscompile kernels. Only use gcc 2.95.3 and later.
30#endif
31#if __GNUC__ == 2 && __GNUC_MINOR__ == 95
32/* shame we can't detect the .1 or .2 releases */
33#warning GCC 2.95.2 and earlier miscompiles kernels.
34#endif
35 28
36/* Use marker if you need to separate the values later */ 29/* Use marker if you need to separate the values later */
37 30
diff --git a/arch/arm26/kernel/irq.c b/arch/arm26/kernel/irq.c
index f3cc1036e5bc..0934e6fba606 100644
--- a/arch/arm26/kernel/irq.c
+++ b/arch/arm26/kernel/irq.c
@@ -141,7 +141,7 @@ int show_interrupts(struct seq_file *p, void *v)
141 if (i < NR_IRQS) { 141 if (i < NR_IRQS) {
142 action = irq_desc[i].action; 142 action = irq_desc[i].action;
143 if (!action) 143 if (!action)
144 continue; 144 goto out;
145 seq_printf(p, "%3d: %10u ", i, kstat_irqs(i)); 145 seq_printf(p, "%3d: %10u ", i, kstat_irqs(i));
146 seq_printf(p, " %s", action->name); 146 seq_printf(p, " %s", action->name);
147 for (action = action->next; action; action = action->next) { 147 for (action = action->next; action; action = action->next) {
@@ -152,6 +152,7 @@ int show_interrupts(struct seq_file *p, void *v)
152 show_fiq_list(p, v); 152 show_fiq_list(p, v);
153 seq_printf(p, "Err: %10lu\n", irq_err_count); 153 seq_printf(p, "Err: %10lu\n", irq_err_count);
154 } 154 }
155out:
155 return 0; 156 return 0;
156} 157}
157 158
diff --git a/arch/arm26/kernel/process.c b/arch/arm26/kernel/process.c
index 15833a0057dd..386305659171 100644
--- a/arch/arm26/kernel/process.c
+++ b/arch/arm26/kernel/process.c
@@ -277,10 +277,9 @@ int
277copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start, 277copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start,
278 unsigned long unused, struct task_struct *p, struct pt_regs *regs) 278 unsigned long unused, struct task_struct *p, struct pt_regs *regs)
279{ 279{
280 struct thread_info *thread = p->thread_info; 280 struct thread_info *thread = task_thread_info(p);
281 struct pt_regs *childregs; 281 struct pt_regs *childregs = task_pt_regs(p);
282 282
283 childregs = __get_user_regs(thread);
284 *childregs = *regs; 283 *childregs = *regs;
285 childregs->ARM_r0 = 0; 284 childregs->ARM_r0 = 0;
286 childregs->ARM_sp = stack_start; 285 childregs->ARM_sp = stack_start;
diff --git a/arch/arm26/kernel/ptrace.c b/arch/arm26/kernel/ptrace.c
index 4e6b7356a722..282e24d79328 100644
--- a/arch/arm26/kernel/ptrace.c
+++ b/arch/arm26/kernel/ptrace.c
@@ -40,21 +40,6 @@
40#define BREAKINST_ARM 0xef9f0001 40#define BREAKINST_ARM 0xef9f0001
41 41
42/* 42/*
43 * Get the address of the live pt_regs for the specified task.
44 * These are saved onto the top kernel stack when the process
45 * is not running.
46 *
47 * Note: if a user thread is execve'd from kernel space, the
48 * kernel stack will not be empty on entry to the kernel, so
49 * ptracing these tasks will fail.
50 */
51static inline struct pt_regs *
52get_user_regs(struct task_struct *task)
53{
54 return __get_user_regs(task->thread_info);
55}
56
57/*
58 * this routine will get a word off of the processes privileged stack. 43 * this routine will get a word off of the processes privileged stack.
59 * the offset is how far from the base addr as stored in the THREAD. 44 * the offset is how far from the base addr as stored in the THREAD.
60 * this routine assumes that all the privileged stacks are in our 45 * this routine assumes that all the privileged stacks are in our
@@ -62,7 +47,7 @@ get_user_regs(struct task_struct *task)
62 */ 47 */
63static inline long get_user_reg(struct task_struct *task, int offset) 48static inline long get_user_reg(struct task_struct *task, int offset)
64{ 49{
65 return get_user_regs(task)->uregs[offset]; 50 return task_pt_regs(task)->uregs[offset];
66} 51}
67 52
68/* 53/*
@@ -74,7 +59,7 @@ static inline long get_user_reg(struct task_struct *task, int offset)
74static inline int 59static inline int
75put_user_reg(struct task_struct *task, int offset, long data) 60put_user_reg(struct task_struct *task, int offset, long data)
76{ 61{
77 struct pt_regs newregs, *regs = get_user_regs(task); 62 struct pt_regs newregs, *regs = task_pt_regs(task);
78 int ret = -EINVAL; 63 int ret = -EINVAL;
79 64
80 newregs = *regs; 65 newregs = *regs;
@@ -377,7 +362,7 @@ void ptrace_set_bpt(struct task_struct *child)
377 u32 insn; 362 u32 insn;
378 int res; 363 int res;
379 364
380 regs = get_user_regs(child); 365 regs = task_pt_regs(child);
381 pc = instruction_pointer(regs); 366 pc = instruction_pointer(regs);
382 367
383 res = read_instr(child, pc, &insn); 368 res = read_instr(child, pc, &insn);
@@ -500,7 +485,7 @@ static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
500 */ 485 */
501static int ptrace_getregs(struct task_struct *tsk, void *uregs) 486static int ptrace_getregs(struct task_struct *tsk, void *uregs)
502{ 487{
503 struct pt_regs *regs = get_user_regs(tsk); 488 struct pt_regs *regs = task_pt_regs(tsk);
504 489
505 return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; 490 return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
506} 491}
@@ -515,7 +500,7 @@ static int ptrace_setregs(struct task_struct *tsk, void *uregs)
515 500
516 ret = -EFAULT; 501 ret = -EFAULT;
517 if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { 502 if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {
518 struct pt_regs *regs = get_user_regs(tsk); 503 struct pt_regs *regs = task_pt_regs(tsk);
519 504
520 ret = -EINVAL; 505 ret = -EINVAL;
521 if (valid_user_regs(&newregs)) { 506 if (valid_user_regs(&newregs)) {
@@ -532,7 +517,7 @@ static int ptrace_setregs(struct task_struct *tsk, void *uregs)
532 */ 517 */
533static int ptrace_getfpregs(struct task_struct *tsk, void *ufp) 518static int ptrace_getfpregs(struct task_struct *tsk, void *ufp)
534{ 519{
535 return copy_to_user(ufp, &tsk->thread_info->fpstate, 520 return copy_to_user(ufp, &task_thread_info(tsk)->fpstate,
536 sizeof(struct user_fp)) ? -EFAULT : 0; 521 sizeof(struct user_fp)) ? -EFAULT : 0;
537} 522}
538 523
@@ -542,7 +527,7 @@ static int ptrace_getfpregs(struct task_struct *tsk, void *ufp)
542static int ptrace_setfpregs(struct task_struct *tsk, void *ufp) 527static int ptrace_setfpregs(struct task_struct *tsk, void *ufp)
543{ 528{
544 set_stopped_child_used_math(tsk); 529 set_stopped_child_used_math(tsk);
545 return copy_from_user(&tsk->thread_info->fpstate, ufp, 530 return copy_from_user(&task_thread_info(tsk)->fpstate, ufp,
546 sizeof(struct user_fp)) ? -EFAULT : 0; 531 sizeof(struct user_fp)) ? -EFAULT : 0;
547} 532}
548 533
diff --git a/arch/arm26/kernel/traps.c b/arch/arm26/kernel/traps.c
index f64f59022392..5847ea5d7747 100644
--- a/arch/arm26/kernel/traps.c
+++ b/arch/arm26/kernel/traps.c
@@ -132,7 +132,7 @@ static void dump_instr(struct pt_regs *regs)
132 132
133/*static*/ void __dump_stack(struct task_struct *tsk, unsigned long sp) 133/*static*/ void __dump_stack(struct task_struct *tsk, unsigned long sp)
134{ 134{
135 dump_mem("Stack: ", sp, 8192+(unsigned long)tsk->thread_info); 135 dump_mem("Stack: ", sp, 8192+(unsigned long)task_stack_page(tsk));
136} 136}
137 137
138void dump_stack(void) 138void dump_stack(void)
@@ -158,7 +158,7 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
158 } else if (verify_stack(fp)) { 158 } else if (verify_stack(fp)) {
159 printk("invalid frame pointer 0x%08x", fp); 159 printk("invalid frame pointer 0x%08x", fp);
160 ok = 0; 160 ok = 0;
161 } else if (fp < (unsigned long)(tsk->thread_info + 1)) 161 } else if (fp < (unsigned long)end_of_stack(tsk))
162 printk("frame pointer underflow"); 162 printk("frame pointer underflow");
163 printk("\n"); 163 printk("\n");
164 164
@@ -168,7 +168,7 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
168 168
169/* FIXME - this is probably wrong.. */ 169/* FIXME - this is probably wrong.. */
170void show_stack(struct task_struct *task, unsigned long *sp) { 170void show_stack(struct task_struct *task, unsigned long *sp) {
171 dump_mem("Stack: ", (unsigned long)sp, 8192+(unsigned long)task->thread_info); 171 dump_mem("Stack: ", (unsigned long)sp, 8192+(unsigned long)task_stack_page(task));
172} 172}
173 173
174DEFINE_SPINLOCK(die_lock); 174DEFINE_SPINLOCK(die_lock);
@@ -187,7 +187,7 @@ NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
187 printk("CPU: %d\n", smp_processor_id()); 187 printk("CPU: %d\n", smp_processor_id());
188 show_regs(regs); 188 show_regs(regs);
189 printk("Process %s (pid: %d, stack limit = 0x%p)\n", 189 printk("Process %s (pid: %d, stack limit = 0x%p)\n",
190 current->comm, current->pid, tsk->thread_info + 1); 190 current->comm, current->pid, end_of_stack(tsk));
191 191
192 if (!user_mode(regs) || in_interrupt()) { 192 if (!user_mode(regs) || in_interrupt()) {
193 __dump_stack(tsk, (unsigned long)(regs + 1)); 193 __dump_stack(tsk, (unsigned long)(regs + 1));
diff --git a/arch/arm26/nwfpe/fpmodule.c b/arch/arm26/nwfpe/fpmodule.c
index 528fa710aa34..5258c6096fb9 100644
--- a/arch/arm26/nwfpe/fpmodule.c
+++ b/arch/arm26/nwfpe/fpmodule.c
@@ -46,10 +46,9 @@ typedef struct task_struct* PTASK;
46 46
47#ifdef MODULE 47#ifdef MODULE
48void fp_send_sig(unsigned long sig, PTASK p, int priv); 48void fp_send_sig(unsigned long sig, PTASK p, int priv);
49#if LINUX_VERSION_CODE > 0x20115 49
50MODULE_AUTHOR("Scott Bambrough <scottb@rebel.com>"); 50MODULE_AUTHOR("Scott Bambrough <scottb@rebel.com>");
51MODULE_DESCRIPTION("NWFPE floating point emulator"); 51MODULE_DESCRIPTION("NWFPE floating point emulator");
52#endif
53 52
54#else 53#else
55#define fp_send_sig send_sig 54#define fp_send_sig send_sig
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index e5979d68e352..b83261949737 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -9,10 +9,6 @@ config MMU
9 bool 9 bool
10 default y 10 default y
11 11
12config UID16
13 bool
14 default y
15
16config RWSEM_GENERIC_SPINLOCK 12config RWSEM_GENERIC_SPINLOCK
17 bool 13 bool
18 default y 14 default y
diff --git a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c
index 10795f67f687..b100f26497c4 100644
--- a/arch/cris/arch-v10/drivers/ds1302.c
+++ b/arch/cris/arch-v10/drivers/ds1302.c
@@ -148,6 +148,7 @@
148#include <linux/miscdevice.h> 148#include <linux/miscdevice.h>
149#include <linux/delay.h> 149#include <linux/delay.h>
150#include <linux/bcd.h> 150#include <linux/bcd.h>
151#include <linux/capability.h>
151 152
152#include <asm/uaccess.h> 153#include <asm/uaccess.h>
153#include <asm/system.h> 154#include <asm/system.h>
diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
index f2c55742e90c..af517c210383 100644
--- a/arch/cris/arch-v10/drivers/pcf8563.c
+++ b/arch/cris/arch-v10/drivers/pcf8563.c
@@ -28,6 +28,7 @@
28#include <linux/ioctl.h> 28#include <linux/ioctl.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/bcd.h> 30#include <linux/bcd.h>
31#include <linux/capability.h>
31 32
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/system.h> 34#include <asm/system.h>
diff --git a/arch/cris/arch-v10/kernel/kgdb.c b/arch/cris/arch-v10/kernel/kgdb.c
index b72e6a91a639..34528da98817 100644
--- a/arch/cris/arch-v10/kernel/kgdb.c
+++ b/arch/cris/arch-v10/kernel/kgdb.c
@@ -569,12 +569,6 @@ gdb_cris_strtol (const char *s, char **endptr, int base)
569 return x; 569 return x;
570} 570}
571 571
572int
573double_this(int x)
574{
575 return 2 * x;
576}
577
578/********************************* Register image ****************************/ 572/********************************* Register image ****************************/
579/* Copy the content of a register image into another. The size n is 573/* Copy the content of a register image into another. The size n is
580 the size of the register image. Due to struct assignment generation of 574 the size of the register image. Due to struct assignment generation of
diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c
index 69e28b4057e8..0a675ce9e099 100644
--- a/arch/cris/arch-v10/kernel/process.c
+++ b/arch/cris/arch-v10/kernel/process.c
@@ -79,7 +79,7 @@ void hard_reset_now (void)
79 */ 79 */
80unsigned long thread_saved_pc(struct task_struct *t) 80unsigned long thread_saved_pc(struct task_struct *t)
81{ 81{
82 return (unsigned long)user_regs(t->thread_info)->irp; 82 return task_pt_regs(t)->irp;
83} 83}
84 84
85static void kernel_thread_helper(void* dummy, int (*fn)(void *), void * arg) 85static void kernel_thread_helper(void* dummy, int (*fn)(void *), void * arg)
@@ -128,7 +128,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
128 * remember that the task_struct doubles as the kernel stack for the task 128 * remember that the task_struct doubles as the kernel stack for the task
129 */ 129 */
130 130
131 childregs = user_regs(p->thread_info); 131 childregs = task_pt_regs(p);
132 132
133 *childregs = *regs; /* struct copy of pt_regs */ 133 *childregs = *regs; /* struct copy of pt_regs */
134 134
diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
index 6cbd34a27b90..f214f74f264e 100644
--- a/arch/cris/arch-v10/kernel/ptrace.c
+++ b/arch/cris/arch-v10/kernel/ptrace.c
@@ -37,7 +37,7 @@ inline long get_reg(struct task_struct *task, unsigned int regno)
37 if (regno == PT_USP) 37 if (regno == PT_USP)
38 return task->thread.usp; 38 return task->thread.usp;
39 else if (regno < PT_MAX) 39 else if (regno < PT_MAX)
40 return ((unsigned long *)user_regs(task->thread_info))[regno]; 40 return ((unsigned long *)task_pt_regs(task))[regno];
41 else 41 else
42 return 0; 42 return 0;
43} 43}
@@ -51,7 +51,7 @@ inline int put_reg(struct task_struct *task, unsigned int regno,
51 if (regno == PT_USP) 51 if (regno == PT_USP)
52 task->thread.usp = data; 52 task->thread.usp = data;
53 else if (regno < PT_MAX) 53 else if (regno < PT_MAX)
54 ((unsigned long *)user_regs(task->thread_info))[regno] = data; 54 ((unsigned long *)task_pt_regs(task))[regno] = data;
55 else 55 else
56 return -1; 56 return -1;
57 return 0; 57 return 0;
diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c
index 882be42114f7..843513102d3c 100644
--- a/arch/cris/arch-v32/kernel/process.c
+++ b/arch/cris/arch-v32/kernel/process.c
@@ -96,7 +96,7 @@ hard_reset_now(void)
96 */ 96 */
97unsigned long thread_saved_pc(struct task_struct *t) 97unsigned long thread_saved_pc(struct task_struct *t)
98{ 98{
99 return (unsigned long)user_regs(t->thread_info)->erp; 99 return task_pt_regs(t)->erp;
100} 100}
101 101
102static void 102static void
@@ -148,7 +148,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
148 * fix it up. Note: the task_struct doubles as the kernel stack for the 148 * fix it up. Note: the task_struct doubles as the kernel stack for the
149 * task. 149 * task.
150 */ 150 */
151 childregs = user_regs(p->thread_info); 151 childregs = task_pt_regs(p);
152 *childregs = *regs; /* Struct copy of pt_regs. */ 152 *childregs = *regs; /* Struct copy of pt_regs. */
153 p->set_child_tid = p->clear_child_tid = NULL; 153 p->set_child_tid = p->clear_child_tid = NULL;
154 childregs->r10 = 0; /* Child returns 0 after a fork/clone. */ 154 childregs->r10 = 0; /* Child returns 0 after a fork/clone. */
@@ -157,7 +157,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
157 * The TLS is in $mof beacuse it is the 5th argument to sys_clone. 157 * The TLS is in $mof beacuse it is the 5th argument to sys_clone.
158 */ 158 */
159 if (p->mm && (clone_flags & CLONE_SETTLS)) { 159 if (p->mm && (clone_flags & CLONE_SETTLS)) {
160 p->thread_info->tls = regs->mof; 160 task_thread_info(p)->tls = regs->mof;
161 } 161 }
162 162
163 /* Put the switch stack right below the pt_regs. */ 163 /* Put the switch stack right below the pt_regs. */
diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c
index 5528b83a622b..82cf2e3624a4 100644
--- a/arch/cris/arch-v32/kernel/ptrace.c
+++ b/arch/cris/arch-v32/kernel/ptrace.c
@@ -46,7 +46,7 @@ long get_reg(struct task_struct *task, unsigned int regno)
46 unsigned long ret; 46 unsigned long ret;
47 47
48 if (regno <= PT_EDA) 48 if (regno <= PT_EDA)
49 ret = ((unsigned long *)user_regs(task->thread_info))[regno]; 49 ret = ((unsigned long *)task_pt_regs(task))[regno];
50 else if (regno == PT_USP) 50 else if (regno == PT_USP)
51 ret = task->thread.usp; 51 ret = task->thread.usp;
52 else if (regno == PT_PPC) 52 else if (regno == PT_PPC)
@@ -65,13 +65,13 @@ long get_reg(struct task_struct *task, unsigned int regno)
65int put_reg(struct task_struct *task, unsigned int regno, unsigned long data) 65int put_reg(struct task_struct *task, unsigned int regno, unsigned long data)
66{ 66{
67 if (regno <= PT_EDA) 67 if (regno <= PT_EDA)
68 ((unsigned long *)user_regs(task->thread_info))[regno] = data; 68 ((unsigned long *)task_pt_regs(task))[regno] = data;
69 else if (regno == PT_USP) 69 else if (regno == PT_USP)
70 task->thread.usp = data; 70 task->thread.usp = data;
71 else if (regno == PT_PPC) { 71 else if (regno == PT_PPC) {
72 /* Write pseudo-PC to ERP only if changed. */ 72 /* Write pseudo-PC to ERP only if changed. */
73 if (data != get_pseudo_pc(task)) 73 if (data != get_pseudo_pc(task))
74 ((unsigned long *)user_regs(task->thread_info))[PT_ERP] = data; 74 task_pt_regs(task)->erp = data;
75 } else if (regno <= PT_MAX) 75 } else if (regno <= PT_MAX)
76 return put_debugreg(task->pid, regno, data); 76 return put_debugreg(task->pid, regno, data);
77 else 77 else
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
index 13867f4fad16..da40d19a151e 100644
--- a/arch/cris/arch-v32/kernel/smp.c
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -113,10 +113,10 @@ smp_boot_one_cpu(int cpuid)
113 if (IS_ERR(idle)) 113 if (IS_ERR(idle))
114 panic("SMP: fork failed for CPU:%d", cpuid); 114 panic("SMP: fork failed for CPU:%d", cpuid);
115 115
116 idle->thread_info->cpu = cpuid; 116 task_thread_info(idle)->cpu = cpuid;
117 117
118 /* Information to the CPU that is about to boot */ 118 /* Information to the CPU that is about to boot */
119 smp_init_current_idle_thread = idle->thread_info; 119 smp_init_current_idle_thread = task_thread_info(idle);
120 cpu_now_booting = cpuid; 120 cpu_now_booting = cpuid;
121 121
122 /* Wait for CPU to come online */ 122 /* Wait for CPU to come online */
diff --git a/arch/cris/arch-v32/mm/tlb.c b/arch/cris/arch-v32/mm/tlb.c
index b08a28bb58ab..9d75d7692303 100644
--- a/arch/cris/arch-v32/mm/tlb.c
+++ b/arch/cris/arch-v32/mm/tlb.c
@@ -198,9 +198,9 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
198 per_cpu(current_pgd, cpu) = next->pgd; 198 per_cpu(current_pgd, cpu) = next->pgd;
199 199
200 /* Switch context in the MMU. */ 200 /* Switch context in the MMU. */
201 if (tsk && tsk->thread_info) 201 if (tsk && task_thread_info(tsk))
202 { 202 {
203 SPEC_REG_WR(SPEC_REG_PID, next->context.page_id | tsk->thread_info->tls); 203 SPEC_REG_WR(SPEC_REG_PID, next->context.page_id | task_thread_info(tsk)->tls);
204 } 204 }
205 else 205 else
206 { 206 {
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
index 85833d704ebb..de39725da920 100644
--- a/arch/cris/kernel/crisksyms.c
+++ b/arch/cris/kernel/crisksyms.c
@@ -21,7 +21,6 @@
21#include <asm/pgtable.h> 21#include <asm/pgtable.h>
22#include <asm/fasttimer.h> 22#include <asm/fasttimer.h>
23 23
24extern void dump_thread(struct pt_regs *, struct user *);
25extern unsigned long get_cmos_time(void); 24extern unsigned long get_cmos_time(void);
26extern void __Udiv(void); 25extern void __Udiv(void);
27extern void __Umod(void); 26extern void __Umod(void);
@@ -33,7 +32,6 @@ extern void __lshrdi3(void);
33extern void iounmap(volatile void * __iomem); 32extern void iounmap(volatile void * __iomem);
34 33
35/* Platform dependent support */ 34/* Platform dependent support */
36EXPORT_SYMBOL(dump_thread);
37EXPORT_SYMBOL(kernel_thread); 35EXPORT_SYMBOL(kernel_thread);
38EXPORT_SYMBOL(get_cmos_time); 36EXPORT_SYMBOL(get_cmos_time);
39EXPORT_SYMBOL(loops_per_usec); 37EXPORT_SYMBOL(loops_per_usec);
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 7c80afb10460..4ab3e87115b6 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -257,34 +257,6 @@ void flush_thread(void)
257{ 257{
258} 258}
259 259
260/*
261 * fill in the user structure for a core dump..
262 */
263void dump_thread(struct pt_regs * regs, struct user * dump)
264{
265#if 0
266 int i;
267
268 /* changed the size calculations - should hopefully work better. lbt */
269 dump->magic = CMAGIC;
270 dump->start_code = 0;
271 dump->start_stack = regs->esp & ~(PAGE_SIZE - 1);
272 dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT;
273 dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT;
274 dump->u_dsize -= dump->u_tsize;
275 dump->u_ssize = 0;
276 for (i = 0; i < 8; i++)
277 dump->u_debugreg[i] = current->debugreg[i];
278
279 if (dump->start_stack < TASK_SIZE)
280 dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT;
281
282 dump->regs = *regs;
283
284 dump->u_fpvalid = dump_fpu (regs, &dump->i387);
285#endif
286}
287
288/* Fill in the fpu structure for a core dump. */ 260/* Fill in the fpu structure for a core dump. */
289int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu) 261int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
290{ 262{
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index ec85c0d6c6da..60a617aff8ba 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -6,10 +6,6 @@ config FRV
6 bool 6 bool
7 default y 7 default y
8 8
9config UID16
10 bool
11 default y
12
13config RWSEM_GENERIC_SPINLOCK 9config RWSEM_GENERIC_SPINLOCK
14 bool 10 bool
15 default y 11 default y
@@ -274,6 +270,11 @@ config GPREL_DATA_NONE
274 270
275endchoice 271endchoice
276 272
273config FRV_ONCPU_SERIAL
274 bool "Use on-CPU serial ports"
275 select SERIAL_8250
276 default y
277
277config PCI 278config PCI
278 bool "Use PCI" 279 bool "Use PCI"
279 depends on MB93090_MB00 280 depends on MB93090_MB00
@@ -305,23 +306,7 @@ config RESERVE_DMA_COHERENT
305 306
306source "drivers/pci/Kconfig" 307source "drivers/pci/Kconfig"
307 308
308config PCMCIA 309source "drivers/pcmcia/Kconfig"
309 tristate "Use PCMCIA"
310 help
311 Say Y here if you want to attach PCMCIA- or PC-cards to your FR-V
312 board. These are credit-card size devices such as network cards,
313 modems or hard drives often used with laptops computers. There are
314 actually two varieties of these cards: the older 16 bit PCMCIA cards
315 and the newer 32 bit CardBus cards. If you want to use CardBus
316 cards, you need to say Y here and also to "CardBus support" below.
317
318 To use your PC-cards, you will need supporting software from David
319 Hinds pcmcia-cs package (see the file <file:Documentation/Changes>
320 for location). Please also read the PCMCIA-HOWTO, available from
321 <http://www.tldp.org/docs.html#howto>.
322
323 To compile this driver as modules, choose M here: the
324 modules will be called pcmcia_core and ds.
325 310
326#config MATH_EMULATION 311#config MATH_EMULATION
327# bool "Math emulation support (EXPERIMENTAL)" 312# bool "Math emulation support (EXPERIMENTAL)"
diff --git a/arch/frv/Kconfig.debug b/arch/frv/Kconfig.debug
index 0034b654995d..211f01bc4caa 100644
--- a/arch/frv/Kconfig.debug
+++ b/arch/frv/Kconfig.debug
@@ -2,32 +2,10 @@ menu "Kernel hacking"
2 2
3source "lib/Kconfig.debug" 3source "lib/Kconfig.debug"
4 4
5config EARLY_PRINTK
6 bool "Early printk"
7 depends on EMBEDDED && DEBUG_KERNEL
8 default n
9 help
10 Write kernel log output directly into the VGA buffer or to a serial
11 port.
12
13 This is useful for kernel debugging when your machine crashes very
14 early before the console code is initialized. For normal operation
15 it is not recommended because it looks ugly and doesn't cooperate
16 with klogd/syslogd or the X server. You should normally N here,
17 unless you want to debug such a crash.
18
19config DEBUG_STACKOVERFLOW 5config DEBUG_STACKOVERFLOW
20 bool "Check for stack overflows" 6 bool "Check for stack overflows"
21 depends on DEBUG_KERNEL 7 depends on DEBUG_KERNEL
22 8
23config DEBUG_PAGEALLOC
24 bool "Page alloc debugging"
25 depends on DEBUG_KERNEL
26 help
27 Unmap pages from the kernel linear mapping after free_pages().
28 This results in a large slowdown, but helps to find certain types
29 of memory corruptions.
30
31config GDBSTUB 9config GDBSTUB
32 bool "Remote GDB kernel debugging" 10 bool "Remote GDB kernel debugging"
33 depends on DEBUG_KERNEL 11 depends on DEBUG_KERNEL
diff --git a/arch/frv/Makefile b/arch/frv/Makefile
index 54046d2386f5..90c0fb8d9dc3 100644
--- a/arch/frv/Makefile
+++ b/arch/frv/Makefile
@@ -109,10 +109,10 @@ bootstrap:
109 $(Q)$(MAKEBOOT) bootstrap 109 $(Q)$(MAKEBOOT) bootstrap
110 110
111archmrproper: 111archmrproper:
112 $(Q)$(MAKE) -C arch/frv/boot mrproper 112 $(Q)$(MAKE) $(build)=arch/frv/boot mrproper
113 113
114archclean: 114archclean:
115 $(Q)$(MAKE) -C arch/frv/boot clean 115 $(Q)$(MAKE) $(build)=arch/frv/boot clean
116 116
117archdep: scripts/mkdep symlinks 117archdep: scripts/mkdep symlinks
118 $(Q)$(MAKE) -C arch/frv/boot dep 118 $(Q)$(MAKE) $(build)=arch/frv/boot dep
diff --git a/arch/frv/boot/Makefile b/arch/frv/boot/Makefile
index d75e0d771366..5dfc93fd945a 100644
--- a/arch/frv/boot/Makefile
+++ b/arch/frv/boot/Makefile
@@ -57,10 +57,10 @@ initrd:
57# installation 57# installation
58# 58#
59install: $(CONFIGURE) Image 59install: $(CONFIGURE) Image
60 sh ./install.sh $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) Image $(TOPDIR)/System.map "$(INSTALL_PATH)" 60 sh ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)"
61 61
62zinstall: $(CONFIGURE) zImage 62zinstall: $(CONFIGURE) zImage
63 sh ./install.sh $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)" 63 sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)"
64 64
65# 65#
66# miscellany 66# miscellany
diff --git a/arch/frv/kernel/Makefile b/arch/frv/kernel/Makefile
index 981c2c7dec0d..5a827b349b5e 100644
--- a/arch/frv/kernel/Makefile
+++ b/arch/frv/kernel/Makefile
@@ -20,3 +20,5 @@ obj-$(CONFIG_FUJITSU_MB93493) += irq-mb93493.o
20obj-$(CONFIG_PM) += pm.o cmode.o 20obj-$(CONFIG_PM) += pm.o cmode.o
21obj-$(CONFIG_MB93093_PDK) += pm-mb93093.o 21obj-$(CONFIG_MB93093_PDK) += pm-mb93093.o
22obj-$(CONFIG_SYSCTL) += sysctl.o 22obj-$(CONFIG_SYSCTL) += sysctl.o
23obj-$(CONFIG_FUTEX) += futex.o
24obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/frv/kernel/entry.S b/arch/frv/kernel/entry.S
index ad10ea595459..5f6548388b74 100644
--- a/arch/frv/kernel/entry.S
+++ b/arch/frv/kernel/entry.S
@@ -1076,7 +1076,7 @@ __entry_work_notifysig:
1076 LEDS 0x6410 1076 LEDS 0x6410
1077 ori.p gr4,#0,gr8 1077 ori.p gr4,#0,gr8
1078 call do_notify_resume 1078 call do_notify_resume
1079 bra __entry_return_direct 1079 bra __entry_resume_userspace
1080 1080
1081 # perform syscall entry tracing 1081 # perform syscall entry tracing
1082__syscall_trace_entry: 1082__syscall_trace_entry:
diff --git a/arch/frv/kernel/frv_ksyms.c b/arch/frv/kernel/frv_ksyms.c
index 1a76d5247190..0f1c6cbc4f50 100644
--- a/arch/frv/kernel/frv_ksyms.c
+++ b/arch/frv/kernel/frv_ksyms.c
@@ -16,17 +16,16 @@
16#include <asm/semaphore.h> 16#include <asm/semaphore.h>
17#include <asm/checksum.h> 17#include <asm/checksum.h>
18#include <asm/hardirq.h> 18#include <asm/hardirq.h>
19#include <asm/current.h> 19#include <asm/cacheflush.h>
20 20
21extern void dump_thread(struct pt_regs *, struct user *);
22extern long __memcpy_user(void *dst, const void *src, size_t count); 21extern long __memcpy_user(void *dst, const void *src, size_t count);
22extern long __memset_user(void *dst, const void *src, size_t count);
23 23
24/* platform dependent support */ 24/* platform dependent support */
25 25
26EXPORT_SYMBOL(__ioremap); 26EXPORT_SYMBOL(__ioremap);
27EXPORT_SYMBOL(iounmap); 27EXPORT_SYMBOL(iounmap);
28 28
29EXPORT_SYMBOL(dump_thread);
30EXPORT_SYMBOL(strnlen); 29EXPORT_SYMBOL(strnlen);
31EXPORT_SYMBOL(strrchr); 30EXPORT_SYMBOL(strrchr);
32EXPORT_SYMBOL(strstr); 31EXPORT_SYMBOL(strstr);
@@ -50,7 +49,11 @@ EXPORT_SYMBOL(disable_irq);
50EXPORT_SYMBOL(__res_bus_clock_speed_HZ); 49EXPORT_SYMBOL(__res_bus_clock_speed_HZ);
51EXPORT_SYMBOL(__page_offset); 50EXPORT_SYMBOL(__page_offset);
52EXPORT_SYMBOL(__memcpy_user); 51EXPORT_SYMBOL(__memcpy_user);
53EXPORT_SYMBOL(flush_dcache_page); 52EXPORT_SYMBOL(__memset_user);
53EXPORT_SYMBOL(frv_dcache_writeback);
54EXPORT_SYMBOL(frv_cache_invalidate);
55EXPORT_SYMBOL(frv_icache_invalidate);
56EXPORT_SYMBOL(frv_cache_wback_inv);
54 57
55#ifndef CONFIG_MMU 58#ifndef CONFIG_MMU
56EXPORT_SYMBOL(memory_start); 59EXPORT_SYMBOL(memory_start);
@@ -72,6 +75,9 @@ EXPORT_SYMBOL(memcmp);
72EXPORT_SYMBOL(memscan); 75EXPORT_SYMBOL(memscan);
73EXPORT_SYMBOL(memmove); 76EXPORT_SYMBOL(memmove);
74 77
78EXPORT_SYMBOL(__outsl_ns);
79EXPORT_SYMBOL(__insl_ns);
80
75EXPORT_SYMBOL(get_wchan); 81EXPORT_SYMBOL(get_wchan);
76 82
77#ifdef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS 83#ifdef CONFIG_FRV_OUTOFLINE_ATOMIC_OPS
@@ -80,14 +86,13 @@ EXPORT_SYMBOL(atomic_test_and_OR_mask);
80EXPORT_SYMBOL(atomic_test_and_XOR_mask); 86EXPORT_SYMBOL(atomic_test_and_XOR_mask);
81EXPORT_SYMBOL(atomic_add_return); 87EXPORT_SYMBOL(atomic_add_return);
82EXPORT_SYMBOL(atomic_sub_return); 88EXPORT_SYMBOL(atomic_sub_return);
83EXPORT_SYMBOL(__xchg_8);
84EXPORT_SYMBOL(__xchg_16);
85EXPORT_SYMBOL(__xchg_32); 89EXPORT_SYMBOL(__xchg_32);
86EXPORT_SYMBOL(__cmpxchg_8);
87EXPORT_SYMBOL(__cmpxchg_16);
88EXPORT_SYMBOL(__cmpxchg_32); 90EXPORT_SYMBOL(__cmpxchg_32);
89#endif 91#endif
90 92
93EXPORT_SYMBOL(__debug_bug_printk);
94EXPORT_SYMBOL(__delay_loops_MHz);
95
91/* 96/*
92 * libgcc functions - functions that are used internally by the 97 * libgcc functions - functions that are used internally by the
93 * compiler... (prototypes are not correct though, but that 98 * compiler... (prototypes are not correct though, but that
@@ -101,6 +106,8 @@ extern void __divdi3(void);
101extern void __lshrdi3(void); 106extern void __lshrdi3(void);
102extern void __moddi3(void); 107extern void __moddi3(void);
103extern void __muldi3(void); 108extern void __muldi3(void);
109extern void __mulll(void);
110extern void __umulll(void);
104extern void __negdi2(void); 111extern void __negdi2(void);
105extern void __ucmpdi2(void); 112extern void __ucmpdi2(void);
106extern void __udivdi3(void); 113extern void __udivdi3(void);
@@ -116,8 +123,10 @@ EXPORT_SYMBOL(__ashrdi3);
116EXPORT_SYMBOL(__lshrdi3); 123EXPORT_SYMBOL(__lshrdi3);
117//EXPORT_SYMBOL(__moddi3); 124//EXPORT_SYMBOL(__moddi3);
118EXPORT_SYMBOL(__muldi3); 125EXPORT_SYMBOL(__muldi3);
126EXPORT_SYMBOL(__mulll);
127EXPORT_SYMBOL(__umulll);
119EXPORT_SYMBOL(__negdi2); 128EXPORT_SYMBOL(__negdi2);
120//EXPORT_SYMBOL(__ucmpdi2); 129EXPORT_SYMBOL(__ucmpdi2);
121//EXPORT_SYMBOL(__udivdi3); 130//EXPORT_SYMBOL(__udivdi3);
122//EXPORT_SYMBOL(__udivmoddi4); 131//EXPORT_SYMBOL(__udivmoddi4);
123//EXPORT_SYMBOL(__umoddi3); 132//EXPORT_SYMBOL(__umoddi3);
diff --git a/arch/frv/kernel/futex.c b/arch/frv/kernel/futex.c
new file mode 100644
index 000000000000..eae874a970c6
--- /dev/null
+++ b/arch/frv/kernel/futex.c
@@ -0,0 +1,242 @@
1/* futex.c: futex operations
2 *
3 * Copyright (C) 2005 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/futex.h>
13#include <asm/futex.h>
14#include <asm/errno.h>
15#include <asm/uaccess.h>
16
17/*
18 * the various futex operations; MMU fault checking is ignored under no-MMU
19 * conditions
20 */
21static inline int atomic_futex_op_xchg_set(int oparg, int __user *uaddr, int *_oldval)
22{
23 int oldval, ret;
24
25 asm("0: \n"
26 " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */
27 " ckeq icc3,cc7 \n"
28 "1: ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */
29 " orcr cc7,cc7,cc3 \n" /* set CC3 to true */
30 "2: cst.p %3,%M0 ,cc3,#1 \n"
31 " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */
32 " beq icc3,#0,0b \n"
33 " setlos 0,%2 \n"
34 "3: \n"
35 ".subsection 2 \n"
36 "4: setlos %5,%2 \n"
37 " bra 3b \n"
38 ".previous \n"
39 ".section __ex_table,\"a\" \n"
40 " .balign 8 \n"
41 " .long 1b,4b \n"
42 " .long 2b,4b \n"
43 ".previous"
44 : "+U"(*uaddr), "=&r"(oldval), "=&r"(ret), "=r"(oparg)
45 : "3"(oparg), "i"(-EFAULT)
46 : "memory", "cc7", "cc3", "icc3"
47 );
48
49 *_oldval = oldval;
50 return ret;
51}
52
53static inline int atomic_futex_op_xchg_add(int oparg, int __user *uaddr, int *_oldval)
54{
55 int oldval, ret;
56
57 asm("0: \n"
58 " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */
59 " ckeq icc3,cc7 \n"
60 "1: ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */
61 " orcr cc7,cc7,cc3 \n" /* set CC3 to true */
62 " add %1,%3,%3 \n"
63 "2: cst.p %3,%M0 ,cc3,#1 \n"
64 " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */
65 " beq icc3,#0,0b \n"
66 " setlos 0,%2 \n"
67 "3: \n"
68 ".subsection 2 \n"
69 "4: setlos %5,%2 \n"
70 " bra 3b \n"
71 ".previous \n"
72 ".section __ex_table,\"a\" \n"
73 " .balign 8 \n"
74 " .long 1b,4b \n"
75 " .long 2b,4b \n"
76 ".previous"
77 : "+U"(*uaddr), "=&r"(oldval), "=&r"(ret), "=r"(oparg)
78 : "3"(oparg), "i"(-EFAULT)
79 : "memory", "cc7", "cc3", "icc3"
80 );
81
82 *_oldval = oldval;
83 return ret;
84}
85
86static inline int atomic_futex_op_xchg_or(int oparg, int __user *uaddr, int *_oldval)
87{
88 int oldval, ret;
89
90 asm("0: \n"
91 " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */
92 " ckeq icc3,cc7 \n"
93 "1: ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */
94 " orcr cc7,cc7,cc3 \n" /* set CC3 to true */
95 " or %1,%3,%3 \n"
96 "2: cst.p %3,%M0 ,cc3,#1 \n"
97 " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */
98 " beq icc3,#0,0b \n"
99 " setlos 0,%2 \n"
100 "3: \n"
101 ".subsection 2 \n"
102 "4: setlos %5,%2 \n"
103 " bra 3b \n"
104 ".previous \n"
105 ".section __ex_table,\"a\" \n"
106 " .balign 8 \n"
107 " .long 1b,4b \n"
108 " .long 2b,4b \n"
109 ".previous"
110 : "+U"(*uaddr), "=&r"(oldval), "=&r"(ret), "=r"(oparg)
111 : "3"(oparg), "i"(-EFAULT)
112 : "memory", "cc7", "cc3", "icc3"
113 );
114
115 *_oldval = oldval;
116 return ret;
117}
118
119static inline int atomic_futex_op_xchg_and(int oparg, int __user *uaddr, int *_oldval)
120{
121 int oldval, ret;
122
123 asm("0: \n"
124 " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */
125 " ckeq icc3,cc7 \n"
126 "1: ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */
127 " orcr cc7,cc7,cc3 \n" /* set CC3 to true */
128 " and %1,%3,%3 \n"
129 "2: cst.p %3,%M0 ,cc3,#1 \n"
130 " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */
131 " beq icc3,#0,0b \n"
132 " setlos 0,%2 \n"
133 "3: \n"
134 ".subsection 2 \n"
135 "4: setlos %5,%2 \n"
136 " bra 3b \n"
137 ".previous \n"
138 ".section __ex_table,\"a\" \n"
139 " .balign 8 \n"
140 " .long 1b,4b \n"
141 " .long 2b,4b \n"
142 ".previous"
143 : "+U"(*uaddr), "=&r"(oldval), "=&r"(ret), "=r"(oparg)
144 : "3"(oparg), "i"(-EFAULT)
145 : "memory", "cc7", "cc3", "icc3"
146 );
147
148 *_oldval = oldval;
149 return ret;
150}
151
152static inline int atomic_futex_op_xchg_xor(int oparg, int __user *uaddr, int *_oldval)
153{
154 int oldval, ret;
155
156 asm("0: \n"
157 " orcc gr0,gr0,gr0,icc3 \n" /* set ICC3.Z */
158 " ckeq icc3,cc7 \n"
159 "1: ld.p %M0,%1 \n" /* LD.P/ORCR must be atomic */
160 " orcr cc7,cc7,cc3 \n" /* set CC3 to true */
161 " xor %1,%3,%3 \n"
162 "2: cst.p %3,%M0 ,cc3,#1 \n"
163 " corcc gr29,gr29,gr0 ,cc3,#1 \n" /* clear ICC3.Z if store happens */
164 " beq icc3,#0,0b \n"
165 " setlos 0,%2 \n"
166 "3: \n"
167 ".subsection 2 \n"
168 "4: setlos %5,%2 \n"
169 " bra 3b \n"
170 ".previous \n"
171 ".section __ex_table,\"a\" \n"
172 " .balign 8 \n"
173 " .long 1b,4b \n"
174 " .long 2b,4b \n"
175 ".previous"
176 : "+U"(*uaddr), "=&r"(oldval), "=&r"(ret), "=r"(oparg)
177 : "3"(oparg), "i"(-EFAULT)
178 : "memory", "cc7", "cc3", "icc3"
179 );
180
181 *_oldval = oldval;
182 return ret;
183}
184
185/*****************************************************************************/
186/*
187 * do the futex operations
188 */
189int futex_atomic_op_inuser(int encoded_op, int __user *uaddr)
190{
191 int op = (encoded_op >> 28) & 7;
192 int cmp = (encoded_op >> 24) & 15;
193 int oparg = (encoded_op << 8) >> 20;
194 int cmparg = (encoded_op << 20) >> 20;
195 int oldval = 0, ret;
196
197 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
198 oparg = 1 << oparg;
199
200 if (!access_ok(VERIFY_WRITE, uaddr, sizeof(int)))
201 return -EFAULT;
202
203 inc_preempt_count();
204
205 switch (op) {
206 case FUTEX_OP_SET:
207 ret = atomic_futex_op_xchg_set(oparg, uaddr, &oldval);
208 break;
209 case FUTEX_OP_ADD:
210 ret = atomic_futex_op_xchg_add(oparg, uaddr, &oldval);
211 break;
212 case FUTEX_OP_OR:
213 ret = atomic_futex_op_xchg_or(oparg, uaddr, &oldval);
214 break;
215 case FUTEX_OP_ANDN:
216 ret = atomic_futex_op_xchg_and(~oparg, uaddr, &oldval);
217 break;
218 case FUTEX_OP_XOR:
219 ret = atomic_futex_op_xchg_xor(oparg, uaddr, &oldval);
220 break;
221 default:
222 ret = -ENOSYS;
223 break;
224 }
225
226 dec_preempt_count();
227
228 if (!ret) {
229 switch (cmp) {
230 case FUTEX_OP_CMP_EQ: ret = (oldval == cmparg); break;
231 case FUTEX_OP_CMP_NE: ret = (oldval != cmparg); break;
232 case FUTEX_OP_CMP_LT: ret = (oldval < cmparg); break;
233 case FUTEX_OP_CMP_GE: ret = (oldval >= cmparg); break;
234 case FUTEX_OP_CMP_LE: ret = (oldval <= cmparg); break;
235 case FUTEX_OP_CMP_GT: ret = (oldval > cmparg); break;
236 default: ret = -ENOSYS; break;
237 }
238 }
239
240 return ret;
241
242} /* end futex_atomic_op_inuser() */
diff --git a/arch/frv/kernel/irq.c b/arch/frv/kernel/irq.c
index 8c524cdd2717..59580c59c62c 100644
--- a/arch/frv/kernel/irq.c
+++ b/arch/frv/kernel/irq.c
@@ -32,6 +32,7 @@
32#include <linux/irq.h> 32#include <linux/irq.h>
33#include <linux/proc_fs.h> 33#include <linux/proc_fs.h>
34#include <linux/seq_file.h> 34#include <linux/seq_file.h>
35#include <linux/module.h>
35 36
36#include <asm/atomic.h> 37#include <asm/atomic.h>
37#include <asm/io.h> 38#include <asm/io.h>
@@ -178,6 +179,8 @@ void disable_irq_nosync(unsigned int irq)
178 spin_unlock_irqrestore(&level->lock, flags); 179 spin_unlock_irqrestore(&level->lock, flags);
179} 180}
180 181
182EXPORT_SYMBOL(disable_irq_nosync);
183
181/** 184/**
182 * disable_irq - disable an irq and wait for completion 185 * disable_irq - disable an irq and wait for completion
183 * @irq: Interrupt to disable 186 * @irq: Interrupt to disable
@@ -204,6 +207,8 @@ void disable_irq(unsigned int irq)
204#endif 207#endif
205} 208}
206 209
210EXPORT_SYMBOL(disable_irq);
211
207/** 212/**
208 * enable_irq - enable handling of an irq 213 * enable_irq - enable handling of an irq
209 * @irq: Interrupt to enable 214 * @irq: Interrupt to enable
@@ -268,6 +273,8 @@ void enable_irq(unsigned int irq)
268 spin_unlock_irqrestore(&level->lock, flags); 273 spin_unlock_irqrestore(&level->lock, flags);
269} 274}
270 275
276EXPORT_SYMBOL(enable_irq);
277
271/*****************************************************************************/ 278/*****************************************************************************/
272/* 279/*
273 * handles all normal device IRQ's 280 * handles all normal device IRQ's
@@ -425,6 +432,8 @@ int request_irq(unsigned int irq,
425 return retval; 432 return retval;
426} 433}
427 434
435EXPORT_SYMBOL(request_irq);
436
428/** 437/**
429 * free_irq - free an interrupt 438 * free_irq - free an interrupt
430 * @irq: Interrupt line to free 439 * @irq: Interrupt line to free
@@ -496,6 +505,8 @@ void free_irq(unsigned int irq, void *dev_id)
496 } 505 }
497} 506}
498 507
508EXPORT_SYMBOL(free_irq);
509
499/* 510/*
500 * IRQ autodetection code.. 511 * IRQ autodetection code..
501 * 512 *
@@ -519,6 +530,8 @@ unsigned long probe_irq_on(void)
519 return 0; 530 return 0;
520} 531}
521 532
533EXPORT_SYMBOL(probe_irq_on);
534
522/* 535/*
523 * Return a mask of triggered interrupts (this 536 * Return a mask of triggered interrupts (this
524 * can handle only legacy ISA interrupts). 537 * can handle only legacy ISA interrupts).
@@ -542,6 +555,8 @@ unsigned int probe_irq_mask(unsigned long xmask)
542 return 0; 555 return 0;
543} 556}
544 557
558EXPORT_SYMBOL(probe_irq_mask);
559
545/* 560/*
546 * Return the one interrupt that triggered (this can 561 * Return the one interrupt that triggered (this can
547 * handle any interrupt source). 562 * handle any interrupt source).
@@ -571,6 +586,8 @@ int probe_irq_off(unsigned long xmask)
571 return -1; 586 return -1;
572} 587}
573 588
589EXPORT_SYMBOL(probe_irq_off);
590
574/* this was setup_x86_irq but it seems pretty generic */ 591/* this was setup_x86_irq but it seems pretty generic */
575int setup_irq(unsigned int irq, struct irqaction *new) 592int setup_irq(unsigned int irq, struct irqaction *new)
576{ 593{
diff --git a/arch/frv/kernel/module.c b/arch/frv/kernel/module.c
new file mode 100644
index 000000000000..850d168f69fc
--- /dev/null
+++ b/arch/frv/kernel/module.c
@@ -0,0 +1,80 @@
1/* module.c: FRV specific module loading bits
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 * - Derived from arch/i386/kernel/module.c, Copyright (C) 2001 Rusty Russell.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12#include <linux/moduleloader.h>
13#include <linux/elf.h>
14#include <linux/vmalloc.h>
15#include <linux/fs.h>
16#include <linux/string.h>
17#include <linux/kernel.h>
18
19#if 0
20#define DEBUGP printk
21#else
22#define DEBUGP(fmt...)
23#endif
24
25void *module_alloc(unsigned long size)
26{
27 if (size == 0)
28 return NULL;
29
30 return vmalloc_exec(size);
31}
32
33
34/* Free memory returned from module_alloc */
35void module_free(struct module *mod, void *module_region)
36{
37 vfree(module_region);
38 /* FIXME: If module_region == mod->init_region, trim exception
39 table entries. */
40}
41
42/* We don't need anything special. */
43int module_frob_arch_sections(Elf_Ehdr *hdr,
44 Elf_Shdr *sechdrs,
45 char *secstrings,
46 struct module *mod)
47{
48 return 0;
49}
50
51int apply_relocate(Elf32_Shdr *sechdrs,
52 const char *strtab,
53 unsigned int symindex,
54 unsigned int relsec,
55 struct module *me)
56{
57 printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
58 return -ENOEXEC;
59}
60
61int apply_relocate_add(Elf32_Shdr *sechdrs,
62 const char *strtab,
63 unsigned int symindex,
64 unsigned int relsec,
65 struct module *me)
66{
67 printk(KERN_ERR "module %s: ADD RELOCATION unsupported\n", me->name);
68 return -ENOEXEC;
69}
70
71int module_finalize(const Elf_Ehdr *hdr,
72 const Elf_Shdr *sechdrs,
73 struct module *me)
74{
75 return 0;
76}
77
78void module_arch_cleanup(struct module *mod)
79{
80}
diff --git a/arch/frv/kernel/pm.c b/arch/frv/kernel/pm.c
index 712c3c24c954..f0b8fff3e733 100644
--- a/arch/frv/kernel/pm.c
+++ b/arch/frv/kernel/pm.c
@@ -13,6 +13,7 @@
13 13
14#include <linux/config.h> 14#include <linux/config.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/module.h>
16#include <linux/pm.h> 17#include <linux/pm.h>
17#include <linux/pm_legacy.h> 18#include <linux/pm_legacy.h>
18#include <linux/sched.h> 19#include <linux/sched.h>
@@ -27,6 +28,7 @@
27#include "local.h" 28#include "local.h"
28 29
29void (*pm_power_off)(void); 30void (*pm_power_off)(void);
31EXPORT_SYMBOL(pm_power_off);
30 32
31extern void frv_change_cmode(int); 33extern void frv_change_cmode(int);
32 34
diff --git a/arch/frv/kernel/process.c b/arch/frv/kernel/process.c
index 54a452136f00..0fff8a61ef2a 100644
--- a/arch/frv/kernel/process.c
+++ b/arch/frv/kernel/process.c
@@ -204,7 +204,7 @@ int copy_thread(int nr, unsigned long clone_flags,
204 204
205 regs0 = __kernel_frame0_ptr; 205 regs0 = __kernel_frame0_ptr;
206 childregs0 = (struct pt_regs *) 206 childregs0 = (struct pt_regs *)
207 ((unsigned long) p->thread_info + THREAD_SIZE - USER_CONTEXT_SIZE); 207 (task_stack_page(p) + THREAD_SIZE - USER_CONTEXT_SIZE);
208 childregs = childregs0; 208 childregs = childregs0;
209 209
210 /* set up the userspace frame (the only place that the USP is stored) */ 210 /* set up the userspace frame (the only place that the USP is stored) */
@@ -220,7 +220,7 @@ int copy_thread(int nr, unsigned long clone_flags,
220 *childregs = *regs; 220 *childregs = *regs;
221 childregs->sp = (unsigned long) childregs0; 221 childregs->sp = (unsigned long) childregs0;
222 childregs->next_frame = childregs0; 222 childregs->next_frame = childregs0;
223 childregs->gr15 = (unsigned long) p->thread_info; 223 childregs->gr15 = (unsigned long) task_thread_info(p);
224 childregs->gr29 = (unsigned long) p; 224 childregs->gr29 = (unsigned long) p;
225 } 225 }
226 226
@@ -244,28 +244,6 @@ int copy_thread(int nr, unsigned long clone_flags,
244} /* end copy_thread() */ 244} /* end copy_thread() */
245 245
246/* 246/*
247 * fill in the user structure for a core dump..
248 */
249void dump_thread(struct pt_regs *regs, struct user *dump)
250{
251#if 0
252 /* changed the size calculations - should hopefully work better. lbt */
253 dump->magic = CMAGIC;
254 dump->start_code = 0;
255 dump->start_stack = user_stack(regs) & ~(PAGE_SIZE - 1);
256 dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT;
257 dump->u_dsize = ((unsigned long) (current->mm->brk + (PAGE_SIZE-1))) >> PAGE_SHIFT;
258 dump->u_dsize -= dump->u_tsize;
259 dump->u_ssize = 0;
260
261 if (dump->start_stack < TASK_SIZE)
262 dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT;
263
264 dump->regs = *(struct user_context *) regs;
265#endif
266}
267
268/*
269 * sys_execve() executes a new program. 247 * sys_execve() executes a new program.
270 */ 248 */
271asmlinkage int sys_execve(char *name, char **argv, char **envp) 249asmlinkage int sys_execve(char *name, char **argv, char **envp)
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index 767ebb55bd83..5908deae9607 100644
--- a/arch/frv/kernel/setup.c
+++ b/arch/frv/kernel/setup.c
@@ -787,6 +787,7 @@ void __init setup_arch(char **cmdline_p)
787#endif 787#endif
788 788
789 /* register those serial ports that are available */ 789 /* register those serial ports that are available */
790#ifdef CONFIG_FRV_ONCPU_SERIAL
790#ifndef CONFIG_GDBSTUB_UART0 791#ifndef CONFIG_GDBSTUB_UART0
791 __reg(UART0_BASE + UART_IER * 8) = 0; 792 __reg(UART0_BASE + UART_IER * 8) = 0;
792 early_serial_setup(&__frv_uart0); 793 early_serial_setup(&__frv_uart0);
@@ -795,6 +796,7 @@ void __init setup_arch(char **cmdline_p)
795 __reg(UART1_BASE + UART_IER * 8) = 0; 796 __reg(UART1_BASE + UART_IER * 8) = 0;
796 early_serial_setup(&__frv_uart1); 797 early_serial_setup(&__frv_uart1);
797#endif 798#endif
799#endif
798 800
799#if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH) 801#if defined(CONFIG_CHR_DEV_FLASH) || defined(CONFIG_BLK_DEV_FLASH)
800 /* we need to initialize the Flashrom device here since we might 802 /* we need to initialize the Flashrom device here since we might
diff --git a/arch/frv/kernel/signal.c b/arch/frv/kernel/signal.c
index d4ccc0728dfe..679c1d5cc958 100644
--- a/arch/frv/kernel/signal.c
+++ b/arch/frv/kernel/signal.c
@@ -35,74 +35,22 @@ struct fdpic_func_descriptor {
35 unsigned long GOT; 35 unsigned long GOT;
36}; 36};
37 37
38asmlinkage int do_signal(struct pt_regs *regs, sigset_t *oldset);
39
40/* 38/*
41 * Atomically swap in the new signal mask, and wait for a signal. 39 * Atomically swap in the new signal mask, and wait for a signal.
42 */ 40 */
43asmlinkage int sys_sigsuspend(int history0, int history1, old_sigset_t mask) 41asmlinkage int sys_sigsuspend(int history0, int history1, old_sigset_t mask)
44{ 42{
45 sigset_t saveset;
46
47 mask &= _BLOCKABLE; 43 mask &= _BLOCKABLE;
48 spin_lock_irq(&current->sighand->siglock); 44 spin_lock_irq(&current->sighand->siglock);
49 saveset = current->blocked; 45 current->saved_sigmask = current->blocked;
50 siginitset(&current->blocked, mask); 46 siginitset(&current->blocked, mask);
51 recalc_sigpending(); 47 recalc_sigpending();
52 spin_unlock_irq(&current->sighand->siglock); 48 spin_unlock_irq(&current->sighand->siglock);
53 49
54 __frame->gr8 = -EINTR; 50 current->state = TASK_INTERRUPTIBLE;
55 while (1) { 51 schedule();
56 current->state = TASK_INTERRUPTIBLE; 52 set_thread_flag(TIF_RESTORE_SIGMASK);
57 schedule(); 53 return -ERESTARTNOHAND;
58 if (do_signal(__frame, &saveset))
59 /* return the signal number as the return value of this function
60 * - this is an utterly evil hack. syscalls should not invoke do_signal()
61 * as entry.S sets regs->gr8 to the return value of the system call
62 * - we can't just use sigpending() as we'd have to discard SIG_IGN signals
63 * and call waitpid() if SIGCHLD needed discarding
64 * - this only works on the i386 because it passes arguments to the signal
65 * handler on the stack, and the return value in EAX is effectively
66 * discarded
67 */
68 return __frame->gr8;
69 }
70}
71
72asmlinkage int sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize)
73{
74 sigset_t saveset, newset;
75
76 /* XXX: Don't preclude handling different sized sigset_t's. */
77 if (sigsetsize != sizeof(sigset_t))
78 return -EINVAL;
79
80 if (copy_from_user(&newset, unewset, sizeof(newset)))
81 return -EFAULT;
82 sigdelsetmask(&newset, ~_BLOCKABLE);
83
84 spin_lock_irq(&current->sighand->siglock);
85 saveset = current->blocked;
86 current->blocked = newset;
87 recalc_sigpending();
88 spin_unlock_irq(&current->sighand->siglock);
89
90 __frame->gr8 = -EINTR;
91 while (1) {
92 current->state = TASK_INTERRUPTIBLE;
93 schedule();
94 if (do_signal(__frame, &saveset))
95 /* return the signal number as the return value of this function
96 * - this is an utterly evil hack. syscalls should not invoke do_signal()
97 * as entry.S sets regs->gr8 to the return value of the system call
98 * - we can't just use sigpending() as we'd have to discard SIG_IGN signals
99 * and call waitpid() if SIGCHLD needed discarding
100 * - this only works on the i386 because it passes arguments to the signal
101 * handler on the stack, and the return value in EAX is effectively
102 * discarded
103 */
104 return __frame->gr8;
105 }
106} 54}
107 55
108asmlinkage int sys_sigaction(int sig, 56asmlinkage int sys_sigaction(int sig,
@@ -276,13 +224,12 @@ static int setup_sigcontext(struct sigcontext __user *sc, unsigned long mask)
276 * Determine which stack to use.. 224 * Determine which stack to use..
277 */ 225 */
278static inline void __user *get_sigframe(struct k_sigaction *ka, 226static inline void __user *get_sigframe(struct k_sigaction *ka,
279 struct pt_regs *regs,
280 size_t frame_size) 227 size_t frame_size)
281{ 228{
282 unsigned long sp; 229 unsigned long sp;
283 230
284 /* Default to using normal stack */ 231 /* Default to using normal stack */
285 sp = regs->sp; 232 sp = __frame->sp;
286 233
287 /* This is the X/Open sanctioned signal stack switching. */ 234 /* This is the X/Open sanctioned signal stack switching. */
288 if (ka->sa.sa_flags & SA_ONSTACK) { 235 if (ka->sa.sa_flags & SA_ONSTACK) {
@@ -291,18 +238,19 @@ static inline void __user *get_sigframe(struct k_sigaction *ka,
291 } 238 }
292 239
293 return (void __user *) ((sp - frame_size) & ~7UL); 240 return (void __user *) ((sp - frame_size) & ~7UL);
241
294} /* end get_sigframe() */ 242} /* end get_sigframe() */
295 243
296/*****************************************************************************/ 244/*****************************************************************************/
297/* 245/*
298 * 246 *
299 */ 247 */
300static void setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, struct pt_regs * regs) 248static int setup_frame(int sig, struct k_sigaction *ka, sigset_t *set)
301{ 249{
302 struct sigframe __user *frame; 250 struct sigframe __user *frame;
303 int rsig; 251 int rsig;
304 252
305 frame = get_sigframe(ka, regs, sizeof(*frame)); 253 frame = get_sigframe(ka, sizeof(*frame));
306 254
307 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 255 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
308 goto give_sigsegv; 256 goto give_sigsegv;
@@ -346,47 +294,51 @@ static void setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, struct p
346 } 294 }
347 295
348 /* set up registers for signal handler */ 296 /* set up registers for signal handler */
349 regs->sp = (unsigned long) frame; 297 __frame->sp = (unsigned long) frame;
350 regs->lr = (unsigned long) &frame->retcode; 298 __frame->lr = (unsigned long) &frame->retcode;
351 regs->gr8 = sig; 299 __frame->gr8 = sig;
352 300
353 if (get_personality & FDPIC_FUNCPTRS) { 301 if (get_personality & FDPIC_FUNCPTRS) {
354 struct fdpic_func_descriptor __user *funcptr = 302 struct fdpic_func_descriptor __user *funcptr =
355 (struct fdpic_func_descriptor *) ka->sa.sa_handler; 303 (struct fdpic_func_descriptor *) ka->sa.sa_handler;
356 __get_user(regs->pc, &funcptr->text); 304 __get_user(__frame->pc, &funcptr->text);
357 __get_user(regs->gr15, &funcptr->GOT); 305 __get_user(__frame->gr15, &funcptr->GOT);
358 } else { 306 } else {
359 regs->pc = (unsigned long) ka->sa.sa_handler; 307 __frame->pc = (unsigned long) ka->sa.sa_handler;
360 regs->gr15 = 0; 308 __frame->gr15 = 0;
361 } 309 }
362 310
363 set_fs(USER_DS); 311 set_fs(USER_DS);
364 312
313 /* the tracer may want to single-step inside the handler */
314 if (test_thread_flag(TIF_SINGLESTEP))
315 ptrace_notify(SIGTRAP);
316
365#if DEBUG_SIG 317#if DEBUG_SIG
366 printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", 318 printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n",
367 sig, current->comm, current->pid, frame, regs->pc, frame->pretcode); 319 sig, current->comm, current->pid, frame, __frame->pc,
320 frame->pretcode);
368#endif 321#endif
369 322
370 return; 323 return 0;
371 324
372give_sigsegv: 325give_sigsegv:
373 if (sig == SIGSEGV)
374 ka->sa.sa_handler = SIG_DFL;
375
376 force_sig(SIGSEGV, current); 326 force_sig(SIGSEGV, current);
327 return -EFAULT;
328
377} /* end setup_frame() */ 329} /* end setup_frame() */
378 330
379/*****************************************************************************/ 331/*****************************************************************************/
380/* 332/*
381 * 333 *
382 */ 334 */
383static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 335static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
384 sigset_t *set, struct pt_regs * regs) 336 sigset_t *set)
385{ 337{
386 struct rt_sigframe __user *frame; 338 struct rt_sigframe __user *frame;
387 int rsig; 339 int rsig;
388 340
389 frame = get_sigframe(ka, regs, sizeof(*frame)); 341 frame = get_sigframe(ka, sizeof(*frame));
390 342
391 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) 343 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
392 goto give_sigsegv; 344 goto give_sigsegv;
@@ -409,7 +361,7 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
409 if (__put_user(0, &frame->uc.uc_flags) || 361 if (__put_user(0, &frame->uc.uc_flags) ||
410 __put_user(0, &frame->uc.uc_link) || 362 __put_user(0, &frame->uc.uc_link) ||
411 __put_user((void*)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp) || 363 __put_user((void*)current->sas_ss_sp, &frame->uc.uc_stack.ss_sp) ||
412 __put_user(sas_ss_flags(regs->sp), &frame->uc.uc_stack.ss_flags) || 364 __put_user(sas_ss_flags(__frame->sp), &frame->uc.uc_stack.ss_flags) ||
413 __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size)) 365 __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size))
414 goto give_sigsegv; 366 goto give_sigsegv;
415 367
@@ -440,34 +392,38 @@ static void setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
440 } 392 }
441 393
442 /* Set up registers for signal handler */ 394 /* Set up registers for signal handler */
443 regs->sp = (unsigned long) frame; 395 __frame->sp = (unsigned long) frame;
444 regs->lr = (unsigned long) &frame->retcode; 396 __frame->lr = (unsigned long) &frame->retcode;
445 regs->gr8 = sig; 397 __frame->gr8 = sig;
446 regs->gr9 = (unsigned long) &frame->info; 398 __frame->gr9 = (unsigned long) &frame->info;
447 399
448 if (get_personality & FDPIC_FUNCPTRS) { 400 if (get_personality & FDPIC_FUNCPTRS) {
449 struct fdpic_func_descriptor *funcptr = 401 struct fdpic_func_descriptor *funcptr =
450 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler; 402 (struct fdpic_func_descriptor __user *) ka->sa.sa_handler;
451 __get_user(regs->pc, &funcptr->text); 403 __get_user(__frame->pc, &funcptr->text);
452 __get_user(regs->gr15, &funcptr->GOT); 404 __get_user(__frame->gr15, &funcptr->GOT);
453 } else { 405 } else {
454 regs->pc = (unsigned long) ka->sa.sa_handler; 406 __frame->pc = (unsigned long) ka->sa.sa_handler;
455 regs->gr15 = 0; 407 __frame->gr15 = 0;
456 } 408 }
457 409
458 set_fs(USER_DS); 410 set_fs(USER_DS);
459 411
412 /* the tracer may want to single-step inside the handler */
413 if (test_thread_flag(TIF_SINGLESTEP))
414 ptrace_notify(SIGTRAP);
415
460#if DEBUG_SIG 416#if DEBUG_SIG
461 printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n", 417 printk("SIG deliver %d (%s:%d): sp=%p pc=%lx ra=%p\n",
462 sig, current->comm, current->pid, frame, regs->pc, frame->pretcode); 418 sig, current->comm, current->pid, frame, __frame->pc,
419 frame->pretcode);
463#endif 420#endif
464 421
465 return; 422 return 0;
466 423
467give_sigsegv: 424give_sigsegv:
468 if (sig == SIGSEGV)
469 ka->sa.sa_handler = SIG_DFL;
470 force_sig(SIGSEGV, current); 425 force_sig(SIGSEGV, current);
426 return -EFAULT;
471 427
472} /* end setup_rt_frame() */ 428} /* end setup_rt_frame() */
473 429
@@ -475,43 +431,51 @@ give_sigsegv:
475/* 431/*
476 * OK, we're invoking a handler 432 * OK, we're invoking a handler
477 */ 433 */
478static void handle_signal(unsigned long sig, siginfo_t *info, 434static int handle_signal(unsigned long sig, siginfo_t *info,
479 struct k_sigaction *ka, sigset_t *oldset, 435 struct k_sigaction *ka, sigset_t *oldset)
480 struct pt_regs *regs)
481{ 436{
437 int ret;
438
482 /* Are we from a system call? */ 439 /* Are we from a system call? */
483 if (in_syscall(regs)) { 440 if (in_syscall(__frame)) {
484 /* If so, check system call restarting.. */ 441 /* If so, check system call restarting.. */
485 switch (regs->gr8) { 442 switch (__frame->gr8) {
486 case -ERESTART_RESTARTBLOCK: 443 case -ERESTART_RESTARTBLOCK:
487 case -ERESTARTNOHAND: 444 case -ERESTARTNOHAND:
488 regs->gr8 = -EINTR; 445 __frame->gr8 = -EINTR;
489 break; 446 break;
490 447
491 case -ERESTARTSYS: 448 case -ERESTARTSYS:
492 if (!(ka->sa.sa_flags & SA_RESTART)) { 449 if (!(ka->sa.sa_flags & SA_RESTART)) {
493 regs->gr8 = -EINTR; 450 __frame->gr8 = -EINTR;
494 break; 451 break;
495 } 452 }
453
496 /* fallthrough */ 454 /* fallthrough */
497 case -ERESTARTNOINTR: 455 case -ERESTARTNOINTR:
498 regs->gr8 = regs->orig_gr8; 456 __frame->gr8 = __frame->orig_gr8;
499 regs->pc -= 4; 457 __frame->pc -= 4;
500 } 458 }
501 } 459 }
502 460
503 /* Set up the stack frame */ 461 /* Set up the stack frame */
504 if (ka->sa.sa_flags & SA_SIGINFO) 462 if (ka->sa.sa_flags & SA_SIGINFO)
505 setup_rt_frame(sig, ka, info, oldset, regs); 463 ret = setup_rt_frame(sig, ka, info, oldset);
506 else 464 else
507 setup_frame(sig, ka, oldset, regs); 465 ret = setup_frame(sig, ka, oldset);
466
467 if (ret == 0) {
468 spin_lock_irq(&current->sighand->siglock);
469 sigorsets(&current->blocked, &current->blocked,
470 &ka->sa.sa_mask);
471 if (!(ka->sa.sa_flags & SA_NODEFER))
472 sigaddset(&current->blocked, sig);
473 recalc_sigpending();
474 spin_unlock_irq(&current->sighand->siglock);
475 }
476
477 return ret;
508 478
509 spin_lock_irq(&current->sighand->siglock);
510 sigorsets(&current->blocked, &current->blocked, &ka->sa.sa_mask);
511 if (!(ka->sa.sa_flags & SA_NODEFER))
512 sigaddset(&current->blocked, sig);
513 recalc_sigpending();
514 spin_unlock_irq(&current->sighand->siglock);
515} /* end handle_signal() */ 479} /* end handle_signal() */
516 480
517/*****************************************************************************/ 481/*****************************************************************************/
@@ -520,10 +484,11 @@ static void handle_signal(unsigned long sig, siginfo_t *info,
520 * want to handle. Thus you cannot kill init even with a SIGKILL even by 484 * want to handle. Thus you cannot kill init even with a SIGKILL even by
521 * mistake. 485 * mistake.
522 */ 486 */
523int do_signal(struct pt_regs *regs, sigset_t *oldset) 487static void do_signal(void)
524{ 488{
525 struct k_sigaction ka; 489 struct k_sigaction ka;
526 siginfo_t info; 490 siginfo_t info;
491 sigset_t *oldset;
527 int signr; 492 int signr;
528 493
529 /* 494 /*
@@ -532,45 +497,63 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
532 * kernel mode. Just return without doing anything 497 * kernel mode. Just return without doing anything
533 * if so. 498 * if so.
534 */ 499 */
535 if (!user_mode(regs)) 500 if (!user_mode(__frame))
536 return 1; 501 return;
537 502
538 if (try_to_freeze()) 503 if (try_to_freeze())
539 goto no_signal; 504 goto no_signal;
540 505
541 if (!oldset) 506 if (test_thread_flag(TIF_RESTORE_SIGMASK))
507 oldset = &current->saved_sigmask;
508 else
542 oldset = &current->blocked; 509 oldset = &current->blocked;
543 510
544 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 511 signr = get_signal_to_deliver(&info, &ka, __frame, NULL);
545 if (signr > 0) { 512 if (signr > 0) {
546 handle_signal(signr, &info, &ka, oldset, regs); 513 if (handle_signal(signr, &info, &ka, oldset) == 0) {
547 return 1; 514 /* a signal was successfully delivered; the saved
515 * sigmask will have been stored in the signal frame,
516 * and will be restored by sigreturn, so we can simply
517 * clear the TIF_RESTORE_SIGMASK flag */
518 if (test_thread_flag(TIF_RESTORE_SIGMASK))
519 clear_thread_flag(TIF_RESTORE_SIGMASK);
520 }
521
522 return;
548 } 523 }
549 524
550 no_signal: 525no_signal:
551 /* Did we come from a system call? */ 526 /* Did we come from a system call? */
552 if (regs->syscallno >= 0) { 527 if (__frame->syscallno >= 0) {
553 /* Restart the system call - no handlers present */ 528 /* Restart the system call - no handlers present */
554 if (regs->gr8 == -ERESTARTNOHAND || 529 switch (__frame->gr8) {
555 regs->gr8 == -ERESTARTSYS || 530 case -ERESTARTNOHAND:
556 regs->gr8 == -ERESTARTNOINTR) { 531 case -ERESTARTSYS:
557 regs->gr8 = regs->orig_gr8; 532 case -ERESTARTNOINTR:
558 regs->pc -= 4; 533 __frame->gr8 = __frame->orig_gr8;
559 } 534 __frame->pc -= 4;
535 break;
560 536
561 if (regs->gr8 == -ERESTART_RESTARTBLOCK){ 537 case -ERESTART_RESTARTBLOCK:
562 regs->gr8 = __NR_restart_syscall; 538 __frame->gr8 = __NR_restart_syscall;
563 regs->pc -= 4; 539 __frame->pc -= 4;
540 break;
564 } 541 }
565 } 542 }
566 543
567 return 0; 544 /* if there's no signal to deliver, we just put the saved sigmask
545 * back */
546 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
547 clear_thread_flag(TIF_RESTORE_SIGMASK);
548 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
549 }
550
568} /* end do_signal() */ 551} /* end do_signal() */
569 552
570/*****************************************************************************/ 553/*****************************************************************************/
571/* 554/*
572 * notification of userspace execution resumption 555 * notification of userspace execution resumption
573 * - triggered by current->work.notify_resume 556 * - triggered by the TIF_WORK_MASK flags
574 */ 557 */
575asmlinkage void do_notify_resume(__u32 thread_info_flags) 558asmlinkage void do_notify_resume(__u32 thread_info_flags)
576{ 559{
@@ -579,7 +562,7 @@ asmlinkage void do_notify_resume(__u32 thread_info_flags)
579 clear_thread_flag(TIF_SINGLESTEP); 562 clear_thread_flag(TIF_SINGLESTEP);
580 563
581 /* deal with pending signal delivery */ 564 /* deal with pending signal delivery */
582 if (thread_info_flags & _TIF_SIGPENDING) 565 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
583 do_signal(__frame, NULL); 566 do_signal();
584 567
585} /* end do_notify_resume() */ 568} /* end do_notify_resume() */
diff --git a/arch/frv/kernel/time.c b/arch/frv/kernel/time.c
index 2e9741227b73..24cf85f89e40 100644
--- a/arch/frv/kernel/time.c
+++ b/arch/frv/kernel/time.c
@@ -189,6 +189,8 @@ void do_gettimeofday(struct timeval *tv)
189 tv->tv_usec = usec; 189 tv->tv_usec = usec;
190} 190}
191 191
192EXPORT_SYMBOL(do_gettimeofday);
193
192int do_settimeofday(struct timespec *tv) 194int do_settimeofday(struct timespec *tv)
193{ 195{
194 time_t wtm_sec, sec = tv->tv_sec; 196 time_t wtm_sec, sec = tv->tv_sec;
@@ -218,6 +220,7 @@ int do_settimeofday(struct timespec *tv)
218 clock_was_set(); 220 clock_was_set();
219 return 0; 221 return 0;
220} 222}
223
221EXPORT_SYMBOL(do_settimeofday); 224EXPORT_SYMBOL(do_settimeofday);
222 225
223/* 226/*
diff --git a/arch/frv/kernel/traps.c b/arch/frv/kernel/traps.c
index 89073cae4b5d..9eb84b2e6abc 100644
--- a/arch/frv/kernel/traps.c
+++ b/arch/frv/kernel/traps.c
@@ -19,6 +19,7 @@
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/linkage.h> 20#include <linux/linkage.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/module.h>
22 23
23#include <asm/setup.h> 24#include <asm/setup.h>
24#include <asm/fpu.h> 25#include <asm/fpu.h>
@@ -250,6 +251,8 @@ void dump_stack(void)
250 show_stack(NULL, NULL); 251 show_stack(NULL, NULL);
251} 252}
252 253
254EXPORT_SYMBOL(dump_stack);
255
253void show_stack(struct task_struct *task, unsigned long *sp) 256void show_stack(struct task_struct *task, unsigned long *sp)
254{ 257{
255} 258}
diff --git a/arch/frv/kernel/uaccess.c b/arch/frv/kernel/uaccess.c
index f3fd58a5bc4a..9b751c0f0e84 100644
--- a/arch/frv/kernel/uaccess.c
+++ b/arch/frv/kernel/uaccess.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/module.h>
13#include <asm/uaccess.h> 14#include <asm/uaccess.h>
14 15
15/*****************************************************************************/ 16/*****************************************************************************/
@@ -58,8 +59,11 @@ long strncpy_from_user(char *dst, const char *src, long count)
58 memset(p, 0, count); /* clear remainder of buffer [security] */ 59 memset(p, 0, count); /* clear remainder of buffer [security] */
59 60
60 return err; 61 return err;
62
61} /* end strncpy_from_user() */ 63} /* end strncpy_from_user() */
62 64
65EXPORT_SYMBOL(strncpy_from_user);
66
63/*****************************************************************************/ 67/*****************************************************************************/
64/* 68/*
65 * Return the size of a string (including the ending 0) 69 * Return the size of a string (including the ending 0)
@@ -92,4 +96,7 @@ long strnlen_user(const char *src, long count)
92 } 96 }
93 97
94 return p - src + 1; /* return length including NUL */ 98 return p - src + 1; /* return length including NUL */
99
95} /* end strnlen_user() */ 100} /* end strnlen_user() */
101
102EXPORT_SYMBOL(strnlen_user);
diff --git a/arch/frv/kernel/vmlinux.lds.S b/arch/frv/kernel/vmlinux.lds.S
index fceafd2cc202..f474534ba78a 100644
--- a/arch/frv/kernel/vmlinux.lds.S
+++ b/arch/frv/kernel/vmlinux.lds.S
@@ -112,6 +112,7 @@ SECTIONS
112#endif 112#endif
113 ) 113 )
114 SCHED_TEXT 114 SCHED_TEXT
115 LOCK_TEXT
115 *(.fixup) 116 *(.fixup)
116 *(.gnu.warning) 117 *(.gnu.warning)
117 *(.exitcall.exit) 118 *(.exitcall.exit)
diff --git a/arch/frv/lib/Makefile b/arch/frv/lib/Makefile
index 19be2626d5e6..08be305c9f44 100644
--- a/arch/frv/lib/Makefile
+++ b/arch/frv/lib/Makefile
@@ -3,6 +3,6 @@
3# 3#
4 4
5lib-y := \ 5lib-y := \
6 __ashldi3.o __lshrdi3.o __muldi3.o __ashrdi3.o __negdi2.o \ 6 __ashldi3.o __lshrdi3.o __muldi3.o __ashrdi3.o __negdi2.o __ucmpdi2.o \
7 checksum.o memcpy.o memset.o atomic-ops.o \ 7 checksum.o memcpy.o memset.o atomic-ops.o \
8 outsl_ns.o outsl_sw.o insl_ns.o insl_sw.o cache.o 8 outsl_ns.o outsl_sw.o insl_ns.o insl_sw.o cache.o
diff --git a/arch/frv/lib/__ucmpdi2.S b/arch/frv/lib/__ucmpdi2.S
new file mode 100644
index 000000000000..d892f16ffaa9
--- /dev/null
+++ b/arch/frv/lib/__ucmpdi2.S
@@ -0,0 +1,45 @@
1/* __ucmpdi2.S: 64-bit unsigned compare
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12
13 .text
14 .p2align 4
15
16###############################################################################
17#
18# int __ucmpdi2(unsigned long long a [GR8:GR9],
19# unsigned long long b [GR10:GR11])
20#
21# - returns 0, 1, or 2 as a <, =, > b respectively.
22#
23###############################################################################
24 .globl __ucmpdi2
25 .type __ucmpdi2,@function
26__ucmpdi2:
27 or.p gr8,gr0,gr4
28 subcc gr8,gr10,gr0,icc0
29 setlos.p #0,gr8
30 bclr icc0,#2 ; a.msw < b.msw
31
32 setlos.p #2,gr8
33 bhilr icc0,#0 ; a.msw > b.msw
34
35 subcc.p gr9,gr11,gr0,icc1
36 setlos #0,gr8
37 setlos.p #2,gr9
38 setlos #1,gr7
39 cknc icc1,cc6
40 cor.p gr9,gr0,gr8, cc6,#1
41 cckls icc1,cc4, cc6,#1
42 andcr cc6,cc4,cc4
43 cor gr7,gr0,gr8, cc4,#1
44 bralr
45 .size __ucmpdi2, .-__ucmpdi2
diff --git a/arch/frv/lib/atomic-ops.S b/arch/frv/lib/atomic-ops.S
index b03d510a89e4..545cd325ac57 100644
--- a/arch/frv/lib/atomic-ops.S
+++ b/arch/frv/lib/atomic-ops.S
@@ -129,48 +129,6 @@ atomic_sub_return:
129 129
130############################################################################### 130###############################################################################
131# 131#
132# uint8_t __xchg_8(uint8_t i, uint8_t *v)
133#
134###############################################################################
135 .globl __xchg_8
136 .type __xchg_8,@function
137__xchg_8:
138 or.p gr8,gr8,gr10
1390:
140 orcc gr0,gr0,gr0,icc3 /* set ICC3.Z */
141 ckeq icc3,cc7
142 ldub.p @(gr9,gr0),gr8 /* LD.P/ORCR must be atomic */
143 orcr cc7,cc7,cc3 /* set CC3 to true */
144 cstb.p gr10,@(gr9,gr0) ,cc3,#1
145 corcc gr29,gr29,gr0 ,cc3,#1 /* clear ICC3.Z if store happens */
146 beq icc3,#0,0b
147 bralr
148
149 .size __xchg_8, .-__xchg_8
150
151###############################################################################
152#
153# uint16_t __xchg_16(uint16_t i, uint16_t *v)
154#
155###############################################################################
156 .globl __xchg_16
157 .type __xchg_16,@function
158__xchg_16:
159 or.p gr8,gr8,gr10
1600:
161 orcc gr0,gr0,gr0,icc3 /* set ICC3.Z */
162 ckeq icc3,cc7
163 lduh.p @(gr9,gr0),gr8 /* LD.P/ORCR must be atomic */
164 orcr cc7,cc7,cc3 /* set CC3 to true */
165 csth.p gr10,@(gr9,gr0) ,cc3,#1
166 corcc gr29,gr29,gr0 ,cc3,#1 /* clear ICC3.Z if store happens */
167 beq icc3,#0,0b
168 bralr
169
170 .size __xchg_16, .-__xchg_16
171
172###############################################################################
173#
174# uint32_t __xchg_32(uint32_t i, uint32_t *v) 132# uint32_t __xchg_32(uint32_t i, uint32_t *v)
175# 133#
176############################################################################### 134###############################################################################
@@ -192,56 +150,6 @@ __xchg_32:
192 150
193############################################################################### 151###############################################################################
194# 152#
195# uint8_t __cmpxchg_8(uint8_t *v, uint8_t test, uint8_t new)
196#
197###############################################################################
198 .globl __cmpxchg_8
199 .type __cmpxchg_8,@function
200__cmpxchg_8:
201 or.p gr8,gr8,gr11
2020:
203 orcc gr0,gr0,gr0,icc3
204 ckeq icc3,cc7
205 ldub.p @(gr11,gr0),gr8
206 orcr cc7,cc7,cc3
207 sub gr8,gr9,gr7
208 sllicc gr7,#24,gr0,icc0
209 bne icc0,#0,1f
210 cstb.p gr10,@(gr11,gr0) ,cc3,#1
211 corcc gr29,gr29,gr0 ,cc3,#1
212 beq icc3,#0,0b
2131:
214 bralr
215
216 .size __cmpxchg_8, .-__cmpxchg_8
217
218###############################################################################
219#
220# uint16_t __cmpxchg_16(uint16_t *v, uint16_t test, uint16_t new)
221#
222###############################################################################
223 .globl __cmpxchg_16
224 .type __cmpxchg_16,@function
225__cmpxchg_16:
226 or.p gr8,gr8,gr11
2270:
228 orcc gr0,gr0,gr0,icc3
229 ckeq icc3,cc7
230 lduh.p @(gr11,gr0),gr8
231 orcr cc7,cc7,cc3
232 sub gr8,gr9,gr7
233 sllicc gr7,#16,gr0,icc0
234 bne icc0,#0,1f
235 csth.p gr10,@(gr11,gr0) ,cc3,#1
236 corcc gr29,gr29,gr0 ,cc3,#1
237 beq icc3,#0,0b
2381:
239 bralr
240
241 .size __cmpxchg_16, .-__cmpxchg_16
242
243###############################################################################
244#
245# uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new) 153# uint32_t __cmpxchg_32(uint32_t *v, uint32_t test, uint32_t new)
246# 154#
247############################################################################### 155###############################################################################
diff --git a/arch/frv/lib/checksum.c b/arch/frv/lib/checksum.c
index 7bf5bd6cac8a..20e7dfc474ef 100644
--- a/arch/frv/lib/checksum.c
+++ b/arch/frv/lib/checksum.c
@@ -33,6 +33,7 @@
33 33
34#include <net/checksum.h> 34#include <net/checksum.h>
35#include <asm/checksum.h> 35#include <asm/checksum.h>
36#include <linux/module.h>
36 37
37static inline unsigned short from32to16(unsigned long x) 38static inline unsigned short from32to16(unsigned long x)
38{ 39{
@@ -115,34 +116,52 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
115 return result; 116 return result;
116} 117}
117 118
119EXPORT_SYMBOL(csum_partial);
120
118/* 121/*
119 * this routine is used for miscellaneous IP-like checksums, mainly 122 * this routine is used for miscellaneous IP-like checksums, mainly
120 * in icmp.c 123 * in icmp.c
121 */ 124 */
122unsigned short ip_compute_csum(const unsigned char * buff, int len) 125unsigned short ip_compute_csum(const unsigned char * buff, int len)
123{ 126{
124 return ~do_csum(buff,len); 127 return ~do_csum(buff, len);
125} 128}
126 129
130EXPORT_SYMBOL(ip_compute_csum);
131
127/* 132/*
128 * copy from fs while checksumming, otherwise like csum_partial 133 * copy from fs while checksumming, otherwise like csum_partial
129 */ 134 */
130
131unsigned int 135unsigned int
132csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *csum_err) 136csum_partial_copy_from_user(const char __user *src, char *dst,
137 int len, int sum, int *csum_err)
133{ 138{
134 if (csum_err) *csum_err = 0; 139 int rem;
135 memcpy(dst, src, len); 140
141 if (csum_err)
142 *csum_err = 0;
143
144 rem = copy_from_user(dst, src, len);
145 if (rem != 0) {
146 if (csum_err)
147 *csum_err = -EFAULT;
148 memset(dst + len - rem, 0, rem);
149 len = rem;
150 }
151
136 return csum_partial(dst, len, sum); 152 return csum_partial(dst, len, sum);
137} 153}
138 154
155EXPORT_SYMBOL(csum_partial_copy_from_user);
156
139/* 157/*
140 * copy from ds while checksumming, otherwise like csum_partial 158 * copy from ds while checksumming, otherwise like csum_partial
141 */ 159 */
142
143unsigned int 160unsigned int
144csum_partial_copy(const char *src, char *dst, int len, int sum) 161csum_partial_copy(const char *src, char *dst, int len, int sum)
145{ 162{
146 memcpy(dst, src, len); 163 memcpy(dst, src, len);
147 return csum_partial(dst, len, sum); 164 return csum_partial(dst, len, sum);
148} 165}
166
167EXPORT_SYMBOL(csum_partial_copy);
diff --git a/arch/frv/mb93090-mb00/Makefile b/arch/frv/mb93090-mb00/Makefile
index 3faf0f8cf9b5..76595e870733 100644
--- a/arch/frv/mb93090-mb00/Makefile
+++ b/arch/frv/mb93090-mb00/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5ifeq "$(CONFIG_PCI)" "y" 5ifeq "$(CONFIG_PCI)" "y"
6obj-y := pci-frv.o pci-irq.o pci-vdk.o 6obj-y := pci-frv.o pci-irq.o pci-vdk.o pci-iomap.o
7 7
8ifeq "$(CONFIG_MMU)" "y" 8ifeq "$(CONFIG_MMU)" "y"
9obj-y += pci-dma.o 9obj-y += pci-dma.o
diff --git a/arch/frv/mb93090-mb00/pci-dma-nommu.c b/arch/frv/mb93090-mb00/pci-dma-nommu.c
index 2082a9647f4f..4985466b1a7c 100644
--- a/arch/frv/mb93090-mb00/pci-dma-nommu.c
+++ b/arch/frv/mb93090-mb00/pci-dma-nommu.c
@@ -83,6 +83,8 @@ void *dma_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_hand
83 return NULL; 83 return NULL;
84} 84}
85 85
86EXPORT_SYMBOL(dma_alloc_coherent);
87
86void dma_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle) 88void dma_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
87{ 89{
88 struct dma_alloc_record *rec; 90 struct dma_alloc_record *rec;
@@ -102,6 +104,8 @@ void dma_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_
102 BUG(); 104 BUG();
103} 105}
104 106
107EXPORT_SYMBOL(dma_free_coherent);
108
105/* 109/*
106 * Map a single buffer of the indicated size for DMA in streaming mode. 110 * Map a single buffer of the indicated size for DMA in streaming mode.
107 * The 32-bit bus address to use is returned. 111 * The 32-bit bus address to use is returned.
@@ -120,6 +124,8 @@ dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
120 return virt_to_bus(ptr); 124 return virt_to_bus(ptr);
121} 125}
122 126
127EXPORT_SYMBOL(dma_map_single);
128
123/* 129/*
124 * Map a set of buffers described by scatterlist in streaming 130 * Map a set of buffers described by scatterlist in streaming
125 * mode for DMA. This is the scather-gather version of the 131 * mode for DMA. This is the scather-gather version of the
@@ -150,3 +156,5 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
150 156
151 return nents; 157 return nents;
152} 158}
159
160EXPORT_SYMBOL(dma_map_sg);
diff --git a/arch/frv/mb93090-mb00/pci-dma.c b/arch/frv/mb93090-mb00/pci-dma.c
index 86fbdadc51b6..671ce1e8434f 100644
--- a/arch/frv/mb93090-mb00/pci-dma.c
+++ b/arch/frv/mb93090-mb00/pci-dma.c
@@ -28,11 +28,15 @@ void *dma_alloc_coherent(struct device *hwdev, size_t size, dma_addr_t *dma_hand
28 return ret; 28 return ret;
29} 29}
30 30
31EXPORT_SYMBOL(dma_alloc_coherent);
32
31void dma_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle) 33void dma_free_coherent(struct device *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
32{ 34{
33 consistent_free(vaddr); 35 consistent_free(vaddr);
34} 36}
35 37
38EXPORT_SYMBOL(dma_free_coherent);
39
36/* 40/*
37 * Map a single buffer of the indicated size for DMA in streaming mode. 41 * Map a single buffer of the indicated size for DMA in streaming mode.
38 * The 32-bit bus address to use is returned. 42 * The 32-bit bus address to use is returned.
@@ -51,6 +55,8 @@ dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
51 return virt_to_bus(ptr); 55 return virt_to_bus(ptr);
52} 56}
53 57
58EXPORT_SYMBOL(dma_map_single);
59
54/* 60/*
55 * Map a set of buffers described by scatterlist in streaming 61 * Map a set of buffers described by scatterlist in streaming
56 * mode for DMA. This is the scather-gather version of the 62 * mode for DMA. This is the scather-gather version of the
@@ -96,6 +102,8 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
96 return nents; 102 return nents;
97} 103}
98 104
105EXPORT_SYMBOL(dma_map_sg);
106
99dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset, 107dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset,
100 size_t size, enum dma_data_direction direction) 108 size_t size, enum dma_data_direction direction)
101{ 109{
@@ -103,3 +111,5 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long off
103 flush_dcache_page(page); 111 flush_dcache_page(page);
104 return (dma_addr_t) page_to_phys(page) + offset; 112 return (dma_addr_t) page_to_phys(page) + offset;
105} 113}
114
115EXPORT_SYMBOL(dma_map_page);
diff --git a/arch/frv/mb93090-mb00/pci-frv.c b/arch/frv/mb93090-mb00/pci-frv.c
index 83e5489cf039..0a26bf6f1cd4 100644
--- a/arch/frv/mb93090-mb00/pci-frv.c
+++ b/arch/frv/mb93090-mb00/pci-frv.c
@@ -142,9 +142,7 @@ static void __init pcibios_allocate_resources(int pass)
142 u16 command; 142 u16 command;
143 struct resource *r, *pr; 143 struct resource *r, *pr;
144 144
145 while (dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev), 145 for_each_pci_dev(dev) {
146 dev != NULL
147 ) {
148 pci_read_config_word(dev, PCI_COMMAND, &command); 146 pci_read_config_word(dev, PCI_COMMAND, &command);
149 for(idx = 0; idx < 6; idx++) { 147 for(idx = 0; idx < 6; idx++) {
150 r = &dev->resource[idx]; 148 r = &dev->resource[idx];
@@ -188,9 +186,7 @@ static void __init pcibios_assign_resources(void)
188 int idx; 186 int idx;
189 struct resource *r; 187 struct resource *r;
190 188
191 while (dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev), 189 for_each_pci_dev(dev) {
192 dev != NULL
193 ) {
194 int class = dev->class >> 8; 190 int class = dev->class >> 8;
195 191
196 /* Don't touch classless devices and host bridges */ 192 /* Don't touch classless devices and host bridges */
diff --git a/arch/frv/mb93090-mb00/pci-iomap.c b/arch/frv/mb93090-mb00/pci-iomap.c
new file mode 100644
index 000000000000..068fa04bd527
--- /dev/null
+++ b/arch/frv/mb93090-mb00/pci-iomap.c
@@ -0,0 +1,29 @@
1/* pci-iomap.c: description
2 *
3 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
4 * Written by David Howells (dhowells@redhat.com)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11#include <linux/pci.h>
12#include <linux/module.h>
13
14void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long maxlen)
15{
16 unsigned long start = pci_resource_start(dev, bar);
17 unsigned long len = pci_resource_len(dev, bar);
18 unsigned long flags = pci_resource_flags(dev, bar);
19
20 if (!len || !start)
21 return NULL;
22
23 if ((flags & IORESOURCE_IO) || (flags & IORESOURCE_MEM))
24 return (void __iomem *) start;
25
26 return NULL;
27}
28
29EXPORT_SYMBOL(pci_iomap);
diff --git a/arch/frv/mb93090-mb00/pci-irq.c b/arch/frv/mb93090-mb00/pci-irq.c
index 24622d89b1ca..c4a1144c98b0 100644
--- a/arch/frv/mb93090-mb00/pci-irq.c
+++ b/arch/frv/mb93090-mb00/pci-irq.c
@@ -48,9 +48,7 @@ void __init pcibios_fixup_irqs(void)
48 struct pci_dev *dev = NULL; 48 struct pci_dev *dev = NULL;
49 uint8_t line, pin; 49 uint8_t line, pin;
50 50
51 while (dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev), 51 for_each_pci_dev(dev) {
52 dev != NULL
53 ) {
54 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); 52 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
55 if (pin) { 53 if (pin) {
56 dev->irq = pci_bus0_irq_routing[PCI_SLOT(dev->devfn)][pin - 1]; 54 dev->irq = pci_bus0_irq_routing[PCI_SLOT(dev->devfn)][pin - 1];
diff --git a/arch/frv/mm/cache-page.c b/arch/frv/mm/cache-page.c
index 683b5e344318..0261cbe153b5 100644
--- a/arch/frv/mm/cache-page.c
+++ b/arch/frv/mm/cache-page.c
@@ -11,6 +11,7 @@
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/mm.h> 12#include <linux/mm.h>
13#include <linux/highmem.h> 13#include <linux/highmem.h>
14#include <linux/module.h>
14#include <asm/pgalloc.h> 15#include <asm/pgalloc.h>
15 16
16/*****************************************************************************/ 17/*****************************************************************************/
@@ -38,6 +39,8 @@ void flush_dcache_page(struct page *page)
38 39
39} /* end flush_dcache_page() */ 40} /* end flush_dcache_page() */
40 41
42EXPORT_SYMBOL(flush_dcache_page);
43
41/*****************************************************************************/ 44/*****************************************************************************/
42/* 45/*
43 * ICI takes a virtual address and the page may not currently have one 46 * ICI takes a virtual address and the page may not currently have one
@@ -64,3 +67,5 @@ void flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
64 } 67 }
65 68
66} /* end flush_icache_user_range() */ 69} /* end flush_icache_user_range() */
70
71EXPORT_SYMBOL(flush_icache_user_range);
diff --git a/arch/frv/mm/extable.c b/arch/frv/mm/extable.c
index 41be1128dc64..caacf030ac75 100644
--- a/arch/frv/mm/extable.c
+++ b/arch/frv/mm/extable.c
@@ -43,7 +43,7 @@ static inline unsigned long search_one_table(const struct exception_table_entry
43 */ 43 */
44unsigned long search_exception_table(unsigned long pc) 44unsigned long search_exception_table(unsigned long pc)
45{ 45{
46 unsigned long ret = 0; 46 const struct exception_table_entry *extab;
47 47
48 /* determine if the fault lay during a memcpy_user or a memset_user */ 48 /* determine if the fault lay during a memcpy_user or a memset_user */
49 if (__frame->lr == (unsigned long) &__memset_user_error_lr && 49 if (__frame->lr == (unsigned long) &__memset_user_error_lr &&
@@ -55,9 +55,10 @@ unsigned long search_exception_table(unsigned long pc)
55 */ 55 */
56 return (unsigned long) &__memset_user_error_handler; 56 return (unsigned long) &__memset_user_error_handler;
57 } 57 }
58 else if (__frame->lr == (unsigned long) &__memcpy_user_error_lr && 58
59 (unsigned long) &memcpy <= pc && pc < (unsigned long) &__memcpy_end 59 if (__frame->lr == (unsigned long) &__memcpy_user_error_lr &&
60 ) { 60 (unsigned long) &memcpy <= pc && pc < (unsigned long) &__memcpy_end
61 ) {
61 /* the fault occurred in a protected memset 62 /* the fault occurred in a protected memset
62 * - we search for the return address (in LR) instead of the program counter 63 * - we search for the return address (in LR) instead of the program counter
63 * - it was probably during a copy_to/from_user() 64 * - it was probably during a copy_to/from_user()
@@ -65,27 +66,10 @@ unsigned long search_exception_table(unsigned long pc)
65 return (unsigned long) &__memcpy_user_error_handler; 66 return (unsigned long) &__memcpy_user_error_handler;
66 } 67 }
67 68
68#ifndef CONFIG_MODULES 69 extab = search_exception_tables(pc);
69 /* there is only the kernel to search. */ 70 if (extab)
70 ret = search_one_table(__start___ex_table, __stop___ex_table - 1, pc); 71 return extab->fixup;
71 return ret;
72
73#else
74 /* the kernel is the last "module" -- no need to treat it special */
75 unsigned long flags;
76 struct module *mp;
77 72
78 spin_lock_irqsave(&modlist_lock, flags); 73 return 0;
79
80 for (mp = module_list; mp != NULL; mp = mp->next) {
81 if (mp->ex_table_start == NULL || !(mp->flags & (MOD_RUNNING | MOD_INITIALIZING)))
82 continue;
83 ret = search_one_table(mp->ex_table_start, mp->ex_table_end - 1, pc);
84 if (ret)
85 break;
86 }
87 74
88 spin_unlock_irqrestore(&modlist_lock, flags);
89 return ret;
90#endif
91} /* end search_exception_table() */ 75} /* end search_exception_table() */
diff --git a/arch/frv/mm/highmem.c b/arch/frv/mm/highmem.c
index 7dc8fbf3af97..7f77db7fabc7 100644
--- a/arch/frv/mm/highmem.c
+++ b/arch/frv/mm/highmem.c
@@ -9,6 +9,7 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11#include <linux/highmem.h> 11#include <linux/highmem.h>
12#include <linux/module.h>
12 13
13void *kmap(struct page *page) 14void *kmap(struct page *page)
14{ 15{
@@ -18,6 +19,8 @@ void *kmap(struct page *page)
18 return kmap_high(page); 19 return kmap_high(page);
19} 20}
20 21
22EXPORT_SYMBOL(kmap);
23
21void kunmap(struct page *page) 24void kunmap(struct page *page)
22{ 25{
23 if (in_interrupt()) 26 if (in_interrupt())
@@ -27,7 +30,12 @@ void kunmap(struct page *page)
27 kunmap_high(page); 30 kunmap_high(page);
28} 31}
29 32
33EXPORT_SYMBOL(kunmap);
34
30struct page *kmap_atomic_to_page(void *ptr) 35struct page *kmap_atomic_to_page(void *ptr)
31{ 36{
32 return virt_to_page(ptr); 37 return virt_to_page(ptr);
33} 38}
39
40
41EXPORT_SYMBOL(kmap_atomic_to_page);
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 26698a49f153..80940d712acf 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -21,10 +21,6 @@ config FPU
21 bool 21 bool
22 default n 22 default n
23 23
24config UID16
25 bool
26 default y
27
28config RWSEM_GENERIC_SPINLOCK 24config RWSEM_GENERIC_SPINLOCK
29 bool 25 bool
30 default y 26 default y
diff --git a/arch/h8300/kernel/gpio.c b/arch/h8300/kernel/gpio.c
index 795682b873e2..d195568ca8a2 100644
--- a/arch/h8300/kernel/gpio.c
+++ b/arch/h8300/kernel/gpio.c
@@ -122,7 +122,7 @@ int h8300_get_gpio_dir(int port_bit)
122static char *port_status(int portno) 122static char *port_status(int portno)
123{ 123{
124 static char result[10]; 124 static char result[10];
125 const static char io[2]={'I','O'}; 125 static const char io[2]={'I','O'};
126 char *rp; 126 char *rp;
127 int c; 127 int c;
128 unsigned char used,ddr; 128 unsigned char used,ddr;
@@ -143,7 +143,7 @@ static int gpio_proc_read(char *buf, char **start, off_t offset,
143 int len, int *unused_i, void *unused_v) 143 int len, int *unused_i, void *unused_v)
144{ 144{
145 int c,outlen; 145 int c,outlen;
146 const static char port_name[]="123456789ABCDEFGH"; 146 static const char port_name[]="123456789ABCDEFGH";
147 outlen = 0; 147 outlen = 0;
148 for (c = 0; c < MAX_PORT; c++) { 148 for (c = 0; c < MAX_PORT; c++) {
149 if (ddrs[c] == NULL) 149 if (ddrs[c] == NULL)
diff --git a/arch/h8300/kernel/h8300_ksyms.c b/arch/h8300/kernel/h8300_ksyms.c
index 5a630233112f..5cc76efaf7aa 100644
--- a/arch/h8300/kernel/h8300_ksyms.c
+++ b/arch/h8300/kernel/h8300_ksyms.c
@@ -22,11 +22,8 @@
22//asmlinkage long long __lshrdi3 (long long, int); 22//asmlinkage long long __lshrdi3 (long long, int);
23extern char h8300_debug_device[]; 23extern char h8300_debug_device[];
24 24
25extern void dump_thread(struct pt_regs *, struct user *);
26
27/* platform dependent support */ 25/* platform dependent support */
28 26
29EXPORT_SYMBOL(dump_thread);
30EXPORT_SYMBOL(strnlen); 27EXPORT_SYMBOL(strnlen);
31EXPORT_SYMBOL(strrchr); 28EXPORT_SYMBOL(strrchr);
32EXPORT_SYMBOL(strstr); 29EXPORT_SYMBOL(strstr);
@@ -103,10 +100,6 @@ EXPORT_SYMBOL(__udivsi3);
103EXPORT_SYMBOL(__umoddi3); 100EXPORT_SYMBOL(__umoddi3);
104EXPORT_SYMBOL(__umodsi3); 101EXPORT_SYMBOL(__umodsi3);
105 102
106#ifdef MAGIC_ROM_PTR
107EXPORT_SYMBOL(is_in_rom);
108#endif
109
110EXPORT_SYMBOL(h8300_reserved_gpio); 103EXPORT_SYMBOL(h8300_reserved_gpio);
111EXPORT_SYMBOL(h8300_free_gpio); 104EXPORT_SYMBOL(h8300_free_gpio);
112EXPORT_SYMBOL(h8300_set_gpio_dir); 105EXPORT_SYMBOL(h8300_set_gpio_dir);
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
index fe21adf3e75e..ed79ae20e88d 100644
--- a/arch/h8300/kernel/process.c
+++ b/arch/h8300/kernel/process.c
@@ -195,7 +195,7 @@ int copy_thread(int nr, unsigned long clone_flags,
195{ 195{
196 struct pt_regs * childregs; 196 struct pt_regs * childregs;
197 197
198 childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; 198 childregs = (struct pt_regs *) (THREAD_SIZE + task_stack_page(p)) - 1;
199 199
200 *childregs = *regs; 200 *childregs = *regs;
201 childregs->retpc = (unsigned long) ret_from_fork; 201 childregs->retpc = (unsigned long) ret_from_fork;
@@ -208,34 +208,6 @@ int copy_thread(int nr, unsigned long clone_flags,
208} 208}
209 209
210/* 210/*
211 * fill in the user structure for a core dump..
212 */
213void dump_thread(struct pt_regs * regs, struct user * dump)
214{
215/* changed the size calculations - should hopefully work better. lbt */
216 dump->magic = CMAGIC;
217 dump->start_code = 0;
218 dump->start_stack = rdusp() & ~(PAGE_SIZE - 1);
219 dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT;
220 dump->u_dsize = ((unsigned long) (current->mm->brk +
221 (PAGE_SIZE-1))) >> PAGE_SHIFT;
222 dump->u_dsize -= dump->u_tsize;
223 dump->u_ssize = 0;
224
225 dump->u_ar0 = (struct user_regs_struct *)(((int)(&dump->regs)) -((int)(dump)));
226 dump->regs.er0 = regs->er0;
227 dump->regs.er1 = regs->er1;
228 dump->regs.er2 = regs->er2;
229 dump->regs.er3 = regs->er3;
230 dump->regs.er4 = regs->er4;
231 dump->regs.er5 = regs->er5;
232 dump->regs.er6 = regs->er6;
233 dump->regs.orig_er0 = regs->orig_er0;
234 dump->regs.ccr = regs->ccr;
235 dump->regs.pc = regs->pc;
236}
237
238/*
239 * sys_execve() executes a new program. 211 * sys_execve() executes a new program.
240 */ 212 */
241asmlinkage int sys_execve(char *name, char **argv, char **envp,int dummy,...) 213asmlinkage int sys_execve(char *name, char **argv, char **envp,int dummy,...)
diff --git a/arch/h8300/mm/memory.c b/arch/h8300/mm/memory.c
index f4ddece3216f..81eace93f867 100644
--- a/arch/h8300/mm/memory.c
+++ b/arch/h8300/mm/memory.c
@@ -55,16 +55,3 @@ unsigned long kernel_map(unsigned long paddr, unsigned long size,
55 return paddr; 55 return paddr;
56} 56}
57 57
58#ifdef MAGIC_ROM_PTR
59
60int is_in_rom(unsigned long addr)
61{
62 /* Anything not in operational RAM is returned as in rom! */
63 if (addr < _ramstart || addr >= _ramend)
64 return 1;
65 else
66 return 0;
67}
68
69#endif
70
diff --git a/arch/h8300/platform/h8300h/ptrace_h8300h.c b/arch/h8300/platform/h8300h/ptrace_h8300h.c
index 6ac93c05a1ae..746b1ae672a1 100644
--- a/arch/h8300/platform/h8300h/ptrace_h8300h.c
+++ b/arch/h8300/platform/h8300h/ptrace_h8300h.c
@@ -98,7 +98,7 @@ struct optable {
98 .type = jmp, \ 98 .type = jmp, \
99 } 99 }
100 100
101const static struct optable optable_0[] = { 101static const struct optable optable_0[] = {
102 OPTABLE(0x00,0xff, 1,none), /* 0x00 */ 102 OPTABLE(0x00,0xff, 1,none), /* 0x00 */
103 OPTABLE(0x01,0xff,-1,none), /* 0x01 */ 103 OPTABLE(0x01,0xff,-1,none), /* 0x01 */
104 OPTABLE(0x02,0xfe, 1,none), /* 0x02-0x03 */ 104 OPTABLE(0x02,0xfe, 1,none), /* 0x02-0x03 */
@@ -131,31 +131,31 @@ const static struct optable optable_0[] = {
131 OPTABLE(0x80,0x80, 1,none), /* 0x80-0xff */ 131 OPTABLE(0x80,0x80, 1,none), /* 0x80-0xff */
132}; 132};
133 133
134const static struct optable optable_1[] = { 134static const struct optable optable_1[] = {
135 OPTABLE(0x00,0xff,-3,none), /* 0x0100 */ 135 OPTABLE(0x00,0xff,-3,none), /* 0x0100 */
136 OPTABLE(0x40,0xf0,-3,none), /* 0x0140-0x14f */ 136 OPTABLE(0x40,0xf0,-3,none), /* 0x0140-0x14f */
137 OPTABLE(0x80,0xf0, 1,none), /* 0x0180-0x018f */ 137 OPTABLE(0x80,0xf0, 1,none), /* 0x0180-0x018f */
138 OPTABLE(0xc0,0xc0, 2,none), /* 0x01c0-0x01ff */ 138 OPTABLE(0xc0,0xc0, 2,none), /* 0x01c0-0x01ff */
139}; 139};
140 140
141const static struct optable optable_2[] = { 141static const struct optable optable_2[] = {
142 OPTABLE(0x00,0x20, 2,none), /* 0x6a0?/0x6a8?/0x6b0?/0x6b8? */ 142 OPTABLE(0x00,0x20, 2,none), /* 0x6a0?/0x6a8?/0x6b0?/0x6b8? */
143 OPTABLE(0x20,0x20, 3,none), /* 0x6a2?/0x6aa?/0x6b2?/0x6ba? */ 143 OPTABLE(0x20,0x20, 3,none), /* 0x6a2?/0x6aa?/0x6b2?/0x6ba? */
144}; 144};
145 145
146const static struct optable optable_3[] = { 146static const struct optable optable_3[] = {
147 OPTABLE(0x69,0xfb, 2,none), /* 0x010069/0x01006d/014069/0x01406d */ 147 OPTABLE(0x69,0xfb, 2,none), /* 0x010069/0x01006d/014069/0x01406d */
148 OPTABLE(0x6b,0xff,-4,none), /* 0x01006b/0x01406b */ 148 OPTABLE(0x6b,0xff,-4,none), /* 0x01006b/0x01406b */
149 OPTABLE(0x6f,0xff, 3,none), /* 0x01006f/0x01406f */ 149 OPTABLE(0x6f,0xff, 3,none), /* 0x01006f/0x01406f */
150 OPTABLE(0x78,0xff, 5,none), /* 0x010078/0x014078 */ 150 OPTABLE(0x78,0xff, 5,none), /* 0x010078/0x014078 */
151}; 151};
152 152
153const static struct optable optable_4[] = { 153static const struct optable optable_4[] = {
154 OPTABLE(0x00,0x78, 3,none), /* 0x0100690?/0x01006d0?/0140690/0x01406d0?/0x0100698?/0x01006d8?/0140698?/0x01406d8? */ 154 OPTABLE(0x00,0x78, 3,none), /* 0x0100690?/0x01006d0?/0140690/0x01406d0?/0x0100698?/0x01006d8?/0140698?/0x01406d8? */
155 OPTABLE(0x20,0x78, 4,none), /* 0x0100692?/0x01006d2?/0140692/0x01406d2?/0x010069a?/0x01006da?/014069a?/0x01406da? */ 155 OPTABLE(0x20,0x78, 4,none), /* 0x0100692?/0x01006d2?/0140692/0x01406d2?/0x010069a?/0x01006da?/014069a?/0x01406da? */
156}; 156};
157 157
158const static struct optables_list { 158static const struct optables_list {
159 const struct optable *ptr; 159 const struct optable *ptr;
160 int size; 160 int size;
161} optables[] = { 161} optables[] = {
diff --git a/arch/h8300/platform/h8s/ints.c b/arch/h8300/platform/h8s/ints.c
index 5441cdd12a39..f6ed663bdde0 100644
--- a/arch/h8300/platform/h8s/ints.c
+++ b/arch/h8300/platform/h8s/ints.c
@@ -52,7 +52,7 @@ struct irq_pins {
52 unsigned char bit_no; 52 unsigned char bit_no;
53}; 53};
54/* ISTR = 0 */ 54/* ISTR = 0 */
55const static struct irq_pins irq_assign_table0[16]={ 55static const struct irq_pins irq_assign_table0[16]={
56 {H8300_GPIO_P5,H8300_GPIO_B0},{H8300_GPIO_P5,H8300_GPIO_B1}, 56 {H8300_GPIO_P5,H8300_GPIO_B0},{H8300_GPIO_P5,H8300_GPIO_B1},
57 {H8300_GPIO_P5,H8300_GPIO_B2},{H8300_GPIO_P5,H8300_GPIO_B3}, 57 {H8300_GPIO_P5,H8300_GPIO_B2},{H8300_GPIO_P5,H8300_GPIO_B3},
58 {H8300_GPIO_P5,H8300_GPIO_B4},{H8300_GPIO_P5,H8300_GPIO_B5}, 58 {H8300_GPIO_P5,H8300_GPIO_B4},{H8300_GPIO_P5,H8300_GPIO_B5},
@@ -63,7 +63,7 @@ const static struct irq_pins irq_assign_table0[16]={
63 {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2}, 63 {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2},
64}; 64};
65/* ISTR = 1 */ 65/* ISTR = 1 */
66const static struct irq_pins irq_assign_table1[16]={ 66static const struct irq_pins irq_assign_table1[16]={
67 {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1}, 67 {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1},
68 {H8300_GPIO_P8,H8300_GPIO_B2},{H8300_GPIO_P8,H8300_GPIO_B3}, 68 {H8300_GPIO_P8,H8300_GPIO_B2},{H8300_GPIO_P8,H8300_GPIO_B3},
69 {H8300_GPIO_P8,H8300_GPIO_B4},{H8300_GPIO_P8,H8300_GPIO_B5}, 69 {H8300_GPIO_P8,H8300_GPIO_B4},{H8300_GPIO_P8,H8300_GPIO_B5},
diff --git a/arch/h8300/platform/h8s/ints_h8s.c b/arch/h8300/platform/h8s/ints_h8s.c
index f53de493e3e8..8268dfd12f1f 100644
--- a/arch/h8300/platform/h8s/ints_h8s.c
+++ b/arch/h8300/platform/h8s/ints_h8s.c
@@ -42,7 +42,7 @@ struct irq_pins {
42 unsigned char bit_no; 42 unsigned char bit_no;
43} __attribute__((aligned(1),packed)); 43} __attribute__((aligned(1),packed));
44/* ISTR = 0 */ 44/* ISTR = 0 */
45const static struct irq_pins irq_assign_table0[16]={ 45static const struct irq_pins irq_assign_table0[16]={
46 {H8300_GPIO_P5,H8300_GPIO_B0},{H8300_GPIO_P5,H8300_GPIO_B1}, 46 {H8300_GPIO_P5,H8300_GPIO_B0},{H8300_GPIO_P5,H8300_GPIO_B1},
47 {H8300_GPIO_P5,H8300_GPIO_B2},{H8300_GPIO_P5,H8300_GPIO_B3}, 47 {H8300_GPIO_P5,H8300_GPIO_B2},{H8300_GPIO_P5,H8300_GPIO_B3},
48 {H8300_GPIO_P5,H8300_GPIO_B4},{H8300_GPIO_P5,H8300_GPIO_B5}, 48 {H8300_GPIO_P5,H8300_GPIO_B4},{H8300_GPIO_P5,H8300_GPIO_B5},
@@ -53,7 +53,7 @@ const static struct irq_pins irq_assign_table0[16]={
53 {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2}, 53 {H8300_GPIO_PF,H8300_GPIO_B1},{H8300_GPIO_PF,H8300_GPIO_B2},
54}; 54};
55/* ISTR = 1 */ 55/* ISTR = 1 */
56const static struct irq_pins irq_assign_table1[16]={ 56static const struct irq_pins irq_assign_table1[16]={
57 {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1}, 57 {H8300_GPIO_P8,H8300_GPIO_B0},{H8300_GPIO_P8,H8300_GPIO_B1},
58 {H8300_GPIO_P8,H8300_GPIO_B2},{H8300_GPIO_P8,H8300_GPIO_B3}, 58 {H8300_GPIO_P8,H8300_GPIO_B2},{H8300_GPIO_P8,H8300_GPIO_B3},
59 {H8300_GPIO_P8,H8300_GPIO_B4},{H8300_GPIO_P8,H8300_GPIO_B5}, 59 {H8300_GPIO_P8,H8300_GPIO_B4},{H8300_GPIO_P8,H8300_GPIO_B5},
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 6004bb0795e0..cbde675bc95c 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -29,10 +29,6 @@ config MMU
29config SBUS 29config SBUS
30 bool 30 bool
31 31
32config UID16
33 bool
34 default y
35
36config GENERIC_ISA_DMA 32config GENERIC_ISA_DMA
37 bool 33 bool
38 default y 34 default y
@@ -45,8 +41,21 @@ config ARCH_MAY_HAVE_PC_FDC
45 bool 41 bool
46 default y 42 default y
47 43
44config DMI
45 bool
46 default y
47
48source "init/Kconfig" 48source "init/Kconfig"
49 49
50config DOUBLEFAULT
51 default y
52 bool "Enable doublefault exception handler" if EMBEDDED
53 help
54 This option allows trapping of rare doublefault exceptions that
55 would otherwise cause a system to silently reboot. Disabling this
56 option saves about 4k and might cause you much additional grey
57 hair.
58
50menu "Processor type and features" 59menu "Processor type and features"
51 60
52choice 61choice
@@ -464,7 +473,6 @@ config NUMA
464 depends on SMP && HIGHMEM64G && (X86_NUMAQ || X86_GENERICARCH || (X86_SUMMIT && ACPI)) 473 depends on SMP && HIGHMEM64G && (X86_NUMAQ || X86_GENERICARCH || (X86_SUMMIT && ACPI))
465 default n if X86_PC 474 default n if X86_PC
466 default y if (X86_NUMAQ || X86_SUMMIT) 475 default y if (X86_NUMAQ || X86_SUMMIT)
467 select SPARSEMEM_STATIC
468 476
469# Need comments to help the hapless user trying to turn on NUMA support 477# Need comments to help the hapless user trying to turn on NUMA support
470comment "NUMA (NUMA-Q) requires SMP, 64GB highmem support" 478comment "NUMA (NUMA-Q) requires SMP, 64GB highmem support"
@@ -493,6 +501,10 @@ config HAVE_ARCH_ALLOC_REMAP
493 depends on NUMA 501 depends on NUMA
494 default y 502 default y
495 503
504config ARCH_FLATMEM_ENABLE
505 def_bool y
506 depends on (ARCH_SELECT_MEMORY_MODEL && X86_PC)
507
496config ARCH_DISCONTIGMEM_ENABLE 508config ARCH_DISCONTIGMEM_ENABLE
497 def_bool y 509 def_bool y
498 depends on NUMA 510 depends on NUMA
@@ -503,7 +515,8 @@ config ARCH_DISCONTIGMEM_DEFAULT
503 515
504config ARCH_SPARSEMEM_ENABLE 516config ARCH_SPARSEMEM_ENABLE
505 def_bool y 517 def_bool y
506 depends on NUMA 518 depends on (NUMA || (X86_PC && EXPERIMENTAL))
519 select SPARSEMEM_STATIC
507 520
508config ARCH_SELECT_MEMORY_MODEL 521config ARCH_SELECT_MEMORY_MODEL
509 def_bool y 522 def_bool y
@@ -626,10 +639,6 @@ config REGPARM
626 and passes the first three arguments of a function call in registers. 639 and passes the first three arguments of a function call in registers.
627 This will probably break binary only modules. 640 This will probably break binary only modules.
628 641
629 This feature is only enabled for gcc-3.0 and later - earlier compilers
630 generate incorrect output with certain kernel constructs when
631 -mregparm=3 is used.
632
633config SECCOMP 642config SECCOMP
634 bool "Enable seccomp to safely compute untrusted bytecode" 643 bool "Enable seccomp to safely compute untrusted bytecode"
635 depends on PROC_FS 644 depends on PROC_FS
@@ -649,17 +658,6 @@ config SECCOMP
649 658
650source kernel/Kconfig.hz 659source kernel/Kconfig.hz
651 660
652config PHYSICAL_START
653 hex "Physical address where the kernel is loaded" if EMBEDDED
654 default "0x100000"
655 help
656 This gives the physical address where the kernel is loaded.
657 Primarily used in the case of kexec on panic where the
658 fail safe kernel needs to run at a different address than
659 the panic-ed kernel.
660
661 Don't change this unless you know what you are doing.
662
663config KEXEC 661config KEXEC
664 bool "kexec system call (EXPERIMENTAL)" 662 bool "kexec system call (EXPERIMENTAL)"
665 depends on EXPERIMENTAL 663 depends on EXPERIMENTAL
@@ -679,11 +677,40 @@ config KEXEC
679 677
680config CRASH_DUMP 678config CRASH_DUMP
681 bool "kernel crash dumps (EXPERIMENTAL)" 679 bool "kernel crash dumps (EXPERIMENTAL)"
682 depends on EMBEDDED
683 depends on EXPERIMENTAL 680 depends on EXPERIMENTAL
684 depends on HIGHMEM 681 depends on HIGHMEM
685 help 682 help
686 Generate crash dump after being started by kexec. 683 Generate crash dump after being started by kexec.
684
685config PHYSICAL_START
686 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
687
688 default "0x1000000" if CRASH_DUMP
689 default "0x100000"
690 help
691 This gives the physical address where the kernel is loaded. Normally
692 for regular kernels this value is 0x100000 (1MB). But in the case
693 of kexec on panic the fail safe kernel needs to run at a different
694 address than the panic-ed kernel. This option is used to set the load
695 address for kernels used to capture crash dump on being kexec'ed
696 after panic. The default value for crash dump kernels is
697 0x1000000 (16MB). This can also be set based on the "X" value as
698 specified in the "crashkernel=YM@XM" command line boot parameter
699 passed to the panic-ed kernel. Typically this parameter is set as
700 crashkernel=64M@16M. Please take a look at
701 Documentation/kdump/kdump.txt for more details about crash dumps.
702
703 Don't change this unless you know what you are doing.
704
705config HOTPLUG_CPU
706 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
707 depends on SMP && HOTPLUG && EXPERIMENTAL
708 ---help---
709 Say Y here to experiment with turning CPUs off and on. CPUs
710 can be controlled through /sys/devices/system/cpu.
711
712 Say N.
713
687endmenu 714endmenu
688 715
689 716
@@ -699,7 +726,7 @@ depends on PM && !X86_VISWS
699 726
700config APM 727config APM
701 tristate "APM (Advanced Power Management) BIOS support" 728 tristate "APM (Advanced Power Management) BIOS support"
702 depends on PM && PM_LEGACY 729 depends on PM
703 ---help--- 730 ---help---
704 APM is a BIOS specification for saving power using several different 731 APM is a BIOS specification for saving power using several different
705 techniques. This is mostly useful for battery powered laptops with 732 techniques. This is mostly useful for battery powered laptops with
@@ -970,15 +997,6 @@ config SCx200
970 This support is also available as a module. If compiled as a 997 This support is also available as a module. If compiled as a
971 module, it will be called scx200. 998 module, it will be called scx200.
972 999
973config HOTPLUG_CPU
974 bool "Support for hot-pluggable CPUs (EXPERIMENTAL)"
975 depends on SMP && HOTPLUG && EXPERIMENTAL
976 ---help---
977 Say Y here to experiment with turning CPUs off and on. CPUs
978 can be controlled through /sys/devices/system/cpu.
979
980 Say N.
981
982source "drivers/pcmcia/Kconfig" 1000source "drivers/pcmcia/Kconfig"
983 1001
984source "drivers/pci/hotplug/Kconfig" 1002source "drivers/pci/hotplug/Kconfig"
@@ -1055,3 +1073,7 @@ config X86_TRAMPOLINE
1055 bool 1073 bool
1056 depends on X86_SMP || (X86_VOYAGER && SMP) 1074 depends on X86_SMP || (X86_VOYAGER && SMP)
1057 default y 1075 default y
1076
1077config KTIME_SCALAR
1078 bool
1079 default y
diff --git a/arch/i386/Kconfig.cpu b/arch/i386/Kconfig.cpu
index 53bbb3c008ee..79603b3471f9 100644
--- a/arch/i386/Kconfig.cpu
+++ b/arch/i386/Kconfig.cpu
@@ -39,6 +39,7 @@ config M386
39 - "Winchip-2" for IDT Winchip 2. 39 - "Winchip-2" for IDT Winchip 2.
40 - "Winchip-2A" for IDT Winchips with 3dNow! capabilities. 40 - "Winchip-2A" for IDT Winchips with 3dNow! capabilities.
41 - "GeodeGX1" for Geode GX1 (Cyrix MediaGX). 41 - "GeodeGX1" for Geode GX1 (Cyrix MediaGX).
42 - "Geode GX/LX" For AMD Geode GX and LX processors.
42 - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3. 43 - "CyrixIII/VIA C3" for VIA Cyrix III or VIA C3.
43 - "VIA C3-2 for VIA C3-2 "Nehemiah" (model 9 and above). 44 - "VIA C3-2 for VIA C3-2 "Nehemiah" (model 9 and above).
44 45
@@ -171,6 +172,11 @@ config MGEODEGX1
171 help 172 help
172 Select this for a Geode GX1 (Cyrix MediaGX) chip. 173 Select this for a Geode GX1 (Cyrix MediaGX) chip.
173 174
175config MGEODE_LX
176 bool "Geode GX/LX"
177 help
178 Select this for AMD Geode GX and LX processors.
179
174config MCYRIXIII 180config MCYRIXIII
175 bool "CyrixIII/VIA-C3" 181 bool "CyrixIII/VIA-C3"
176 help 182 help
@@ -220,8 +226,8 @@ config X86_XADD
220config X86_L1_CACHE_SHIFT 226config X86_L1_CACHE_SHIFT
221 int 227 int
222 default "7" if MPENTIUM4 || X86_GENERIC 228 default "7" if MPENTIUM4 || X86_GENERIC
223 default "4" if X86_ELAN || M486 || M386 229 default "4" if X86_ELAN || M486 || M386 || MGEODEGX1
224 default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODEGX1 230 default "5" if MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCRUSOE || MEFFICEON || MCYRIXIII || MK6 || MPENTIUMIII || MPENTIUMII || M686 || M586MMX || M586TSC || M586 || MVIAC3_2 || MGEODE_LX
225 default "6" if MK7 || MK8 || MPENTIUMM 231 default "6" if MK7 || MK8 || MPENTIUMM
226 232
227config RWSEM_GENERIC_SPINLOCK 233config RWSEM_GENERIC_SPINLOCK
@@ -290,12 +296,12 @@ config X86_INTEL_USERCOPY
290 296
291config X86_USE_PPRO_CHECKSUM 297config X86_USE_PPRO_CHECKSUM
292 bool 298 bool
293 depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MEFFICEON 299 depends on MWINCHIP3D || MWINCHIP2 || MWINCHIPC6 || MCYRIXIII || MK7 || MK6 || MPENTIUM4 || MPENTIUMM || MPENTIUMIII || MPENTIUMII || M686 || MK8 || MVIAC3_2 || MEFFICEON || MGEODE_LX
294 default y 300 default y
295 301
296config X86_USE_3DNOW 302config X86_USE_3DNOW
297 bool 303 bool
298 depends on MCYRIXIII || MK7 304 depends on MCYRIXIII || MK7 || MGEODE_LX
299 default y 305 default y
300 306
301config X86_OOSTORE 307config X86_OOSTORE
diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug
index c48b424dd640..bf32ecc9ad04 100644
--- a/arch/i386/Kconfig.debug
+++ b/arch/i386/Kconfig.debug
@@ -42,6 +42,16 @@ config DEBUG_PAGEALLOC
42 This results in a large slowdown, but helps to find certain types 42 This results in a large slowdown, but helps to find certain types
43 of memory corruptions. 43 of memory corruptions.
44 44
45config DEBUG_RODATA
46 bool "Write protect kernel read-only data structures"
47 depends on DEBUG_KERNEL
48 help
49 Mark the kernel read-only data as write-protected in the pagetables,
50 in order to catch accidental (and incorrect) writes to such const
51 data. This option may have a slight performance impact because a
52 portion of the kernel code won't be covered by a 2MB TLB anymore.
53 If in doubt, say "N".
54
45config 4KSTACKS 55config 4KSTACKS
46 bool "Use 4Kb for kernel stacks instead of 8Kb" 56 bool "Use 4Kb for kernel stacks instead of 8Kb"
47 depends on DEBUG_KERNEL 57 depends on DEBUG_KERNEL
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index d121ea18460f..36bef6543ac1 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -37,14 +37,11 @@ CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2)
37# CPU-specific tuning. Anything which can be shared with UML should go here. 37# CPU-specific tuning. Anything which can be shared with UML should go here.
38include $(srctree)/arch/i386/Makefile.cpu 38include $(srctree)/arch/i386/Makefile.cpu
39 39
40# -mregparm=3 works ok on gcc-3.0 and later 40cflags-$(CONFIG_REGPARM) += -mregparm=3
41#
42GCC_VERSION := $(call cc-version)
43cflags-$(CONFIG_REGPARM) += $(shell if [ $(GCC_VERSION) -ge 0300 ] ; then echo "-mregparm=3"; fi ;)
44 41
45# Disable unit-at-a-time mode, it makes gcc use a lot more stack 42# Disable unit-at-a-time mode on pre-gcc-4.0 compilers, it makes gcc use
46# due to the lack of sharing of stacklots. 43# a lot more stack due to the lack of sharing of stacklots:
47CFLAGS += $(call cc-option,-fno-unit-at-a-time) 44CFLAGS += $(shell if [ $(call cc-version) -lt 0400 ] ; then echo $(call cc-option,-fno-unit-at-a-time); fi ;)
48 45
49CFLAGS += $(cflags-y) 46CFLAGS += $(cflags-y)
50 47
@@ -103,7 +100,7 @@ AFLAGS += $(mflags-y)
103boot := arch/i386/boot 100boot := arch/i386/boot
104 101
105.PHONY: zImage bzImage compressed zlilo bzlilo \ 102.PHONY: zImage bzImage compressed zlilo bzlilo \
106 zdisk bzdisk fdimage fdimage144 fdimage288 install kernel_install 103 zdisk bzdisk fdimage fdimage144 fdimage288 install
107 104
108all: bzImage 105all: bzImage
109 106
@@ -125,8 +122,7 @@ zdisk bzdisk: vmlinux
125fdimage fdimage144 fdimage288: vmlinux 122fdimage fdimage144 fdimage288: vmlinux
126 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@ 123 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) $@
127 124
128install: vmlinux 125install:
129install kernel_install:
130 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install 126 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(KBUILD_IMAGE) install
131 127
132archclean: 128archclean:
diff --git a/arch/i386/Makefile.cpu b/arch/i386/Makefile.cpu
index 8e51456df23d..dcd936ef45db 100644
--- a/arch/i386/Makefile.cpu
+++ b/arch/i386/Makefile.cpu
@@ -1,7 +1,7 @@
1# CPU tuning section - shared with UML. 1# CPU tuning section - shared with UML.
2# Must change only cflags-y (or [yn]), not CFLAGS! That makes a difference for UML. 2# Must change only cflags-y (or [yn]), not CFLAGS! That makes a difference for UML.
3 3
4#-mtune exists since gcc 3.4, and some -mcpu flavors didn't exist in gcc 2.95. 4#-mtune exists since gcc 3.4
5HAS_MTUNE := $(call cc-option-yn, -mtune=i386) 5HAS_MTUNE := $(call cc-option-yn, -mtune=i386)
6ifeq ($(HAS_MTUNE),y) 6ifeq ($(HAS_MTUNE),y)
7tune = $(call cc-option,-mtune=$(1),) 7tune = $(call cc-option,-mtune=$(1),)
@@ -14,7 +14,7 @@ cflags-$(CONFIG_M386) += -march=i386
14cflags-$(CONFIG_M486) += -march=i486 14cflags-$(CONFIG_M486) += -march=i486
15cflags-$(CONFIG_M586) += -march=i586 15cflags-$(CONFIG_M586) += -march=i586
16cflags-$(CONFIG_M586TSC) += -march=i586 16cflags-$(CONFIG_M586TSC) += -march=i586
17cflags-$(CONFIG_M586MMX) += $(call cc-option,-march=pentium-mmx,-march=i586) 17cflags-$(CONFIG_M586MMX) += -march=pentium-mmx
18cflags-$(CONFIG_M686) += -march=i686 18cflags-$(CONFIG_M686) += -march=i686
19cflags-$(CONFIG_MPENTIUMII) += -march=i686 $(call tune,pentium2) 19cflags-$(CONFIG_MPENTIUMII) += -march=i686 $(call tune,pentium2)
20cflags-$(CONFIG_MPENTIUMIII) += -march=i686 $(call tune,pentium3) 20cflags-$(CONFIG_MPENTIUMIII) += -march=i686 $(call tune,pentium3)
@@ -23,8 +23,8 @@ cflags-$(CONFIG_MPENTIUM4) += -march=i686 $(call tune,pentium4)
23cflags-$(CONFIG_MK6) += -march=k6 23cflags-$(CONFIG_MK6) += -march=k6
24# Please note, that patches that add -march=athlon-xp and friends are pointless. 24# Please note, that patches that add -march=athlon-xp and friends are pointless.
25# They make zero difference whatsosever to performance at this time. 25# They make zero difference whatsosever to performance at this time.
26cflags-$(CONFIG_MK7) += $(call cc-option,-march=athlon,-march=i686 $(align)-functions=4) 26cflags-$(CONFIG_MK7) += -march=athlon
27cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8,$(call cc-option,-march=athlon,-march=i686 $(align)-functions=4)) 27cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8,-march=athlon)
28cflags-$(CONFIG_MCRUSOE) += -march=i686 $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0 28cflags-$(CONFIG_MCRUSOE) += -march=i686 $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0
29cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0 29cflags-$(CONFIG_MEFFICEON) += -march=i686 $(call tune,pentium3) $(align)-functions=0 $(align)-jumps=0 $(align)-loops=0
30cflags-$(CONFIG_MWINCHIPC6) += $(call cc-option,-march=winchip-c6,-march=i586) 30cflags-$(CONFIG_MWINCHIPC6) += $(call cc-option,-march=winchip-c6,-march=i586)
@@ -37,5 +37,5 @@ cflags-$(CONFIG_MVIAC3_2) += $(call cc-option,-march=c3-2,-march=i686)
37cflags-$(CONFIG_X86_ELAN) += -march=i486 37cflags-$(CONFIG_X86_ELAN) += -march=i486
38 38
39# Geode GX1 support 39# Geode GX1 support
40cflags-$(CONFIG_MGEODEGX1) += $(call cc-option,-march=pentium-mmx,-march=i486) 40cflags-$(CONFIG_MGEODEGX1) += -march=pentium-mmx
41 41
diff --git a/arch/i386/boot/Makefile b/arch/i386/boot/Makefile
index 1e71382d413a..f136752563b1 100644
--- a/arch/i386/boot/Makefile
+++ b/arch/i386/boot/Makefile
@@ -100,5 +100,5 @@ zlilo: $(BOOTIMAGE)
100 cp System.map $(INSTALL_PATH)/ 100 cp System.map $(INSTALL_PATH)/
101 if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi 101 if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
102 102
103install: $(BOOTIMAGE) 103install:
104 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $< System.map "$(INSTALL_PATH)" 104 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
diff --git a/arch/i386/boot/compressed/misc.c b/arch/i386/boot/compressed/misc.c
index 82a807f9f5e6..f19f3a7492a5 100644
--- a/arch/i386/boot/compressed/misc.c
+++ b/arch/i386/boot/compressed/misc.c
@@ -11,7 +11,7 @@
11 11
12#include <linux/linkage.h> 12#include <linux/linkage.h>
13#include <linux/vmalloc.h> 13#include <linux/vmalloc.h>
14#include <linux/tty.h> 14#include <linux/screen_info.h>
15#include <asm/io.h> 15#include <asm/io.h>
16#include <asm/page.h> 16#include <asm/page.h>
17 17
diff --git a/arch/i386/boot/install.sh b/arch/i386/boot/install.sh
index f17b40dfc0f4..5e44c736eea8 100644
--- a/arch/i386/boot/install.sh
+++ b/arch/i386/boot/install.sh
@@ -19,6 +19,20 @@
19# $4 - default install path (blank if root directory) 19# $4 - default install path (blank if root directory)
20# 20#
21 21
22verify () {
23 if [ ! -f "$1" ]; then
24 echo "" 1>&2
25 echo " *** Missing file: $1" 1>&2
26 echo ' *** You need to run "make" before "make install".' 1>&2
27 echo "" 1>&2
28 exit 1
29 fi
30}
31
32# Make sure the files actually exist
33verify "$2"
34verify "$3"
35
22# User may have a custom install script 36# User may have a custom install script
23 37
24if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi 38if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S
index 92f669470142..2ac40c8244c4 100644
--- a/arch/i386/boot/video.S
+++ b/arch/i386/boot/video.S
@@ -97,7 +97,6 @@
97#define PARAM_VESAPM_OFF 0x30 97#define PARAM_VESAPM_OFF 0x30
98#define PARAM_LFB_PAGES 0x32 98#define PARAM_LFB_PAGES 0x32
99#define PARAM_VESA_ATTRIB 0x34 99#define PARAM_VESA_ATTRIB 0x34
100#define PARAM_CAPABILITIES 0x36
101 100
102/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */ 101/* Define DO_STORE according to CONFIG_VIDEO_RETAIN */
103#ifdef CONFIG_VIDEO_RETAIN 102#ifdef CONFIG_VIDEO_RETAIN
@@ -234,10 +233,6 @@ mopar_gr:
234 movw 18(%di), %ax 233 movw 18(%di), %ax
235 movl %eax, %fs:(PARAM_LFB_SIZE) 234 movl %eax, %fs:(PARAM_LFB_SIZE)
236 235
237# store mode capabilities
238 movl 10(%di), %eax
239 movl %eax, %fs:(PARAM_CAPABILITIES)
240
241# switching the DAC to 8-bit is for <= 8 bpp only 236# switching the DAC to 8-bit is for <= 8 bpp only
242 movw %fs:(PARAM_LFB_DEPTH), %ax 237 movw %fs:(PARAM_LFB_DEPTH), %ax
243 cmpw $8, %ax 238 cmpw $8, %ax
diff --git a/arch/i386/crypto/aes-i586-asm.S b/arch/i386/crypto/aes-i586-asm.S
index 7b73c67cb4e8..911b15377f2e 100644
--- a/arch/i386/crypto/aes-i586-asm.S
+++ b/arch/i386/crypto/aes-i586-asm.S
@@ -255,18 +255,17 @@ aes_enc_blk:
255 xor 8(%ebp),%r4 255 xor 8(%ebp),%r4
256 xor 12(%ebp),%r5 256 xor 12(%ebp),%r5
257 257
258 sub $8,%esp // space for register saves on stack 258 sub $8,%esp // space for register saves on stack
259 add $16,%ebp // increment to next round key 259 add $16,%ebp // increment to next round key
260 sub $10,%r3 260 cmp $12,%r3
261 je 4f // 10 rounds for 128-bit key 261 jb 4f // 10 rounds for 128-bit key
262 add $32,%ebp 262 lea 32(%ebp),%ebp
263 sub $2,%r3 263 je 3f // 12 rounds for 192-bit key
264 je 3f // 12 rounds for 128-bit key 264 lea 32(%ebp),%ebp
265 add $32,%ebp 265
266 2662: fwd_rnd1( -64(%ebp) ,ft_tab) // 14 rounds for 256-bit key
2672: fwd_rnd1( -64(%ebp) ,ft_tab) // 14 rounds for 128-bit key
268 fwd_rnd2( -48(%ebp) ,ft_tab) 267 fwd_rnd2( -48(%ebp) ,ft_tab)
2693: fwd_rnd1( -32(%ebp) ,ft_tab) // 12 rounds for 128-bit key 2683: fwd_rnd1( -32(%ebp) ,ft_tab) // 12 rounds for 192-bit key
270 fwd_rnd2( -16(%ebp) ,ft_tab) 269 fwd_rnd2( -16(%ebp) ,ft_tab)
2714: fwd_rnd1( (%ebp) ,ft_tab) // 10 rounds for 128-bit key 2704: fwd_rnd1( (%ebp) ,ft_tab) // 10 rounds for 128-bit key
272 fwd_rnd2( +16(%ebp) ,ft_tab) 271 fwd_rnd2( +16(%ebp) ,ft_tab)
@@ -334,18 +333,17 @@ aes_dec_blk:
334 xor 8(%ebp),%r4 333 xor 8(%ebp),%r4
335 xor 12(%ebp),%r5 334 xor 12(%ebp),%r5
336 335
337 sub $8,%esp // space for register saves on stack 336 sub $8,%esp // space for register saves on stack
338 sub $16,%ebp // increment to next round key 337 sub $16,%ebp // increment to next round key
339 sub $10,%r3 338 cmp $12,%r3
340 je 4f // 10 rounds for 128-bit key 339 jb 4f // 10 rounds for 128-bit key
341 sub $32,%ebp 340 lea -32(%ebp),%ebp
342 sub $2,%r3 341 je 3f // 12 rounds for 192-bit key
343 je 3f // 12 rounds for 128-bit key 342 lea -32(%ebp),%ebp
344 sub $32,%ebp
345 343
3462: inv_rnd1( +64(%ebp), it_tab) // 14 rounds for 128-bit key 3442: inv_rnd1( +64(%ebp), it_tab) // 14 rounds for 256-bit key
347 inv_rnd2( +48(%ebp), it_tab) 345 inv_rnd2( +48(%ebp), it_tab)
3483: inv_rnd1( +32(%ebp), it_tab) // 12 rounds for 128-bit key 3463: inv_rnd1( +32(%ebp), it_tab) // 12 rounds for 192-bit key
349 inv_rnd2( +16(%ebp), it_tab) 347 inv_rnd2( +16(%ebp), it_tab)
3504: inv_rnd1( (%ebp), it_tab) // 10 rounds for 128-bit key 3484: inv_rnd1( (%ebp), it_tab) // 10 rounds for 128-bit key
351 inv_rnd2( -16(%ebp), it_tab) 349 inv_rnd2( -16(%ebp), it_tab)
diff --git a/arch/i386/crypto/aes.c b/arch/i386/crypto/aes.c
index 88ee85c3b43b..a50397b1d5c7 100644
--- a/arch/i386/crypto/aes.c
+++ b/arch/i386/crypto/aes.c
@@ -36,6 +36,8 @@
36 * Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com> 36 * Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
37 * 37 *
38 */ 38 */
39
40#include <asm/byteorder.h>
39#include <linux/kernel.h> 41#include <linux/kernel.h>
40#include <linux/module.h> 42#include <linux/module.h>
41#include <linux/init.h> 43#include <linux/init.h>
@@ -59,7 +61,6 @@ struct aes_ctx {
59}; 61};
60 62
61#define WPOLY 0x011b 63#define WPOLY 0x011b
62#define u32_in(x) le32_to_cpup((const __le32 *)(x))
63#define bytes2word(b0, b1, b2, b3) \ 64#define bytes2word(b0, b1, b2, b3) \
64 (((u32)(b3) << 24) | ((u32)(b2) << 16) | ((u32)(b1) << 8) | (b0)) 65 (((u32)(b3) << 24) | ((u32)(b2) << 16) | ((u32)(b1) << 8) | (b0))
65 66
@@ -93,7 +94,6 @@ static u32 rcon_tab[RC_LENGTH];
93 94
94u32 ft_tab[4][256]; 95u32 ft_tab[4][256];
95u32 fl_tab[4][256]; 96u32 fl_tab[4][256];
96static u32 ls_tab[4][256];
97static u32 im_tab[4][256]; 97static u32 im_tab[4][256];
98u32 il_tab[4][256]; 98u32 il_tab[4][256];
99u32 it_tab[4][256]; 99u32 it_tab[4][256];
@@ -144,15 +144,6 @@ static void gen_tabs(void)
144 fl_tab[2][i] = upr(w, 2); 144 fl_tab[2][i] = upr(w, 2);
145 fl_tab[3][i] = upr(w, 3); 145 fl_tab[3][i] = upr(w, 3);
146 146
147 /*
148 * table for key schedule if fl_tab above is
149 * not of the required form
150 */
151 ls_tab[0][i] = w;
152 ls_tab[1][i] = upr(w, 1);
153 ls_tab[2][i] = upr(w, 2);
154 ls_tab[3][i] = upr(w, 3);
155
156 b = fi(inv_affine((u8)i)); 147 b = fi(inv_affine((u8)i));
157 w = bytes2word(fe(b), f9(b), fd(b), fb(b)); 148 w = bytes2word(fe(b), f9(b), fd(b), fb(b));
158 149
@@ -393,13 +384,14 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags)
393 int i; 384 int i;
394 u32 ss[8]; 385 u32 ss[8];
395 struct aes_ctx *ctx = ctx_arg; 386 struct aes_ctx *ctx = ctx_arg;
387 const __le32 *key = (const __le32 *)in_key;
396 388
397 /* encryption schedule */ 389 /* encryption schedule */
398 390
399 ctx->ekey[0] = ss[0] = u32_in(in_key); 391 ctx->ekey[0] = ss[0] = le32_to_cpu(key[0]);
400 ctx->ekey[1] = ss[1] = u32_in(in_key + 4); 392 ctx->ekey[1] = ss[1] = le32_to_cpu(key[1]);
401 ctx->ekey[2] = ss[2] = u32_in(in_key + 8); 393 ctx->ekey[2] = ss[2] = le32_to_cpu(key[2]);
402 ctx->ekey[3] = ss[3] = u32_in(in_key + 12); 394 ctx->ekey[3] = ss[3] = le32_to_cpu(key[3]);
403 395
404 switch(key_len) { 396 switch(key_len) {
405 case 16: 397 case 16:
@@ -410,8 +402,8 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags)
410 break; 402 break;
411 403
412 case 24: 404 case 24:
413 ctx->ekey[4] = ss[4] = u32_in(in_key + 16); 405 ctx->ekey[4] = ss[4] = le32_to_cpu(key[4]);
414 ctx->ekey[5] = ss[5] = u32_in(in_key + 20); 406 ctx->ekey[5] = ss[5] = le32_to_cpu(key[5]);
415 for (i = 0; i < 7; i++) 407 for (i = 0; i < 7; i++)
416 ke6(ctx->ekey, i); 408 ke6(ctx->ekey, i);
417 kel6(ctx->ekey, 7); 409 kel6(ctx->ekey, 7);
@@ -419,10 +411,10 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags)
419 break; 411 break;
420 412
421 case 32: 413 case 32:
422 ctx->ekey[4] = ss[4] = u32_in(in_key + 16); 414 ctx->ekey[4] = ss[4] = le32_to_cpu(key[4]);
423 ctx->ekey[5] = ss[5] = u32_in(in_key + 20); 415 ctx->ekey[5] = ss[5] = le32_to_cpu(key[5]);
424 ctx->ekey[6] = ss[6] = u32_in(in_key + 24); 416 ctx->ekey[6] = ss[6] = le32_to_cpu(key[6]);
425 ctx->ekey[7] = ss[7] = u32_in(in_key + 28); 417 ctx->ekey[7] = ss[7] = le32_to_cpu(key[7]);
426 for (i = 0; i < 6; i++) 418 for (i = 0; i < 6; i++)
427 ke8(ctx->ekey, i); 419 ke8(ctx->ekey, i);
428 kel8(ctx->ekey, 6); 420 kel8(ctx->ekey, 6);
@@ -436,10 +428,10 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags)
436 428
437 /* decryption schedule */ 429 /* decryption schedule */
438 430
439 ctx->dkey[0] = ss[0] = u32_in(in_key); 431 ctx->dkey[0] = ss[0] = le32_to_cpu(key[0]);
440 ctx->dkey[1] = ss[1] = u32_in(in_key + 4); 432 ctx->dkey[1] = ss[1] = le32_to_cpu(key[1]);
441 ctx->dkey[2] = ss[2] = u32_in(in_key + 8); 433 ctx->dkey[2] = ss[2] = le32_to_cpu(key[2]);
442 ctx->dkey[3] = ss[3] = u32_in(in_key + 12); 434 ctx->dkey[3] = ss[3] = le32_to_cpu(key[3]);
443 435
444 switch (key_len) { 436 switch (key_len) {
445 case 16: 437 case 16:
@@ -450,8 +442,8 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags)
450 break; 442 break;
451 443
452 case 24: 444 case 24:
453 ctx->dkey[4] = ff(ss[4] = u32_in(in_key + 16)); 445 ctx->dkey[4] = ff(ss[4] = le32_to_cpu(key[4]));
454 ctx->dkey[5] = ff(ss[5] = u32_in(in_key + 20)); 446 ctx->dkey[5] = ff(ss[5] = le32_to_cpu(key[5]));
455 kdf6(ctx->dkey, 0); 447 kdf6(ctx->dkey, 0);
456 for (i = 1; i < 7; i++) 448 for (i = 1; i < 7; i++)
457 kd6(ctx->dkey, i); 449 kd6(ctx->dkey, i);
@@ -459,10 +451,10 @@ aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len, u32 *flags)
459 break; 451 break;
460 452
461 case 32: 453 case 32:
462 ctx->dkey[4] = ff(ss[4] = u32_in(in_key + 16)); 454 ctx->dkey[4] = ff(ss[4] = le32_to_cpu(key[4]));
463 ctx->dkey[5] = ff(ss[5] = u32_in(in_key + 20)); 455 ctx->dkey[5] = ff(ss[5] = le32_to_cpu(key[5]));
464 ctx->dkey[6] = ff(ss[6] = u32_in(in_key + 24)); 456 ctx->dkey[6] = ff(ss[6] = le32_to_cpu(key[6]));
465 ctx->dkey[7] = ff(ss[7] = u32_in(in_key + 28)); 457 ctx->dkey[7] = ff(ss[7] = le32_to_cpu(key[7]));
466 kdf8(ctx->dkey, 0); 458 kdf8(ctx->dkey, 0);
467 for (i = 1; i < 6; i++) 459 for (i = 1; i < 6; i++)
468 kd8(ctx->dkey, i); 460 kd8(ctx->dkey, i);
@@ -484,6 +476,8 @@ static inline void aes_decrypt(void *ctx, u8 *dst, const u8 *src)
484 476
485static struct crypto_alg aes_alg = { 477static struct crypto_alg aes_alg = {
486 .cra_name = "aes", 478 .cra_name = "aes",
479 .cra_driver_name = "aes-i586",
480 .cra_priority = 200,
487 .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 481 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
488 .cra_blocksize = AES_BLOCK_SIZE, 482 .cra_blocksize = AES_BLOCK_SIZE,
489 .cra_ctxsize = sizeof(struct aes_ctx), 483 .cra_ctxsize = sizeof(struct aes_ctx),
diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index 6a431b926019..3cbe6e9cb9fc 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -644,6 +644,8 @@ CONFIG_8139TOO_PIO=y
644# CONFIG_ACENIC is not set 644# CONFIG_ACENIC is not set
645# CONFIG_DL2K is not set 645# CONFIG_DL2K is not set
646# CONFIG_E1000 is not set 646# CONFIG_E1000 is not set
647# CONFIG_E1000_NAPI is not set
648# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
647# CONFIG_NS83820 is not set 649# CONFIG_NS83820 is not set
648# CONFIG_HAMACHI is not set 650# CONFIG_HAMACHI is not set
649# CONFIG_YELLOWFIN is not set 651# CONFIG_YELLOWFIN is not set
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index f10de0f2c5e6..60c3f76dfca4 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -4,10 +4,10 @@
4 4
5extra-y := head.o init_task.o vmlinux.lds 5extra-y := head.o init_task.o vmlinux.lds
6 6
7obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \ 7obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o \
8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ 8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
9 pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ 9 pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \
10 doublefault.o quirks.o i8237.o 10 quirks.o i8237.o
11 11
12obj-y += cpu/ 12obj-y += cpu/
13obj-y += timers/ 13obj-y += timers/
@@ -25,6 +25,7 @@ obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o
25obj-$(CONFIG_X86_IO_APIC) += io_apic.o 25obj-$(CONFIG_X86_IO_APIC) += io_apic.o
26obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups.o 26obj-$(CONFIG_X86_REBOOTFIXUPS) += reboot_fixups.o
27obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o 27obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o
28obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
28obj-$(CONFIG_X86_NUMAQ) += numaq.o 29obj-$(CONFIG_X86_NUMAQ) += numaq.o
29obj-$(CONFIG_X86_SUMMIT_NUMA) += summit.o 30obj-$(CONFIG_X86_SUMMIT_NUMA) += summit.o
30obj-$(CONFIG_KPROBES) += kprobes.o 31obj-$(CONFIG_KPROBES) += kprobes.o
@@ -33,6 +34,8 @@ obj-y += sysenter.o vsyscall.o
33obj-$(CONFIG_ACPI_SRAT) += srat.o 34obj-$(CONFIG_ACPI_SRAT) += srat.o
34obj-$(CONFIG_HPET_TIMER) += time_hpet.o 35obj-$(CONFIG_HPET_TIMER) += time_hpet.o
35obj-$(CONFIG_EFI) += efi.o efi_stub.o 36obj-$(CONFIG_EFI) += efi.o efi_stub.o
37obj-$(CONFIG_DOUBLEFAULT) += doublefault.o
38obj-$(CONFIG_VM86) += vm86.o
36obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 39obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
37 40
38EXTRA_AFLAGS := -traditional 41EXTRA_AFLAGS := -traditional
diff --git a/arch/i386/kernel/acpi/Makefile b/arch/i386/kernel/acpi/Makefile
index 267ca48e1b6c..d51c7313cae8 100644
--- a/arch/i386/kernel/acpi/Makefile
+++ b/arch/i386/kernel/acpi/Makefile
@@ -3,6 +3,6 @@ obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o
3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o 3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o
4 4
5ifneq ($(CONFIG_ACPI_PROCESSOR),) 5ifneq ($(CONFIG_ACPI_PROCESSOR),)
6obj-y += cstate.o 6obj-y += cstate.o processor.o
7endif 7endif
8 8
diff --git a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c
index 76b1135d401a..f21fa0d4482f 100644
--- a/arch/i386/kernel/acpi/boot.c
+++ b/arch/i386/kernel/acpi/boot.c
@@ -108,7 +108,7 @@ char *__acpi_map_table(unsigned long phys_addr, unsigned long size)
108 if (!phys_addr || !size) 108 if (!phys_addr || !size)
109 return NULL; 109 return NULL;
110 110
111 if (phys_addr < (end_pfn_map << PAGE_SHIFT)) 111 if (phys_addr+size <= (end_pfn_map << PAGE_SHIFT) + PAGE_SIZE)
112 return __va(phys_addr); 112 return __va(phys_addr);
113 113
114 return NULL; 114 return NULL;
@@ -464,7 +464,7 @@ int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
464 * success: return IRQ number (>=0) 464 * success: return IRQ number (>=0)
465 * failure: return < 0 465 * failure: return < 0
466 */ 466 */
467int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) 467int acpi_register_gsi(u32 gsi, int triggering, int polarity)
468{ 468{
469 unsigned int irq; 469 unsigned int irq;
470 unsigned int plat_gsi = gsi; 470 unsigned int plat_gsi = gsi;
@@ -476,14 +476,14 @@ int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low)
476 if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) { 476 if (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {
477 extern void eisa_set_level_irq(unsigned int irq); 477 extern void eisa_set_level_irq(unsigned int irq);
478 478
479 if (edge_level == ACPI_LEVEL_SENSITIVE) 479 if (triggering == ACPI_LEVEL_SENSITIVE)
480 eisa_set_level_irq(gsi); 480 eisa_set_level_irq(gsi);
481 } 481 }
482#endif 482#endif
483 483
484#ifdef CONFIG_X86_IO_APIC 484#ifdef CONFIG_X86_IO_APIC
485 if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) { 485 if (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) {
486 plat_gsi = mp_register_gsi(gsi, edge_level, active_high_low); 486 plat_gsi = mp_register_gsi(gsi, triggering, polarity);
487 } 487 }
488#endif 488#endif
489 acpi_gsi_to_irq(plat_gsi, &irq); 489 acpi_gsi_to_irq(plat_gsi, &irq);
@@ -638,6 +638,13 @@ static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
638 return 0; 638 return 0;
639 639
640 pmtmr_ioport = fadt->xpm_tmr_blk.address; 640 pmtmr_ioport = fadt->xpm_tmr_blk.address;
641 /*
642 * "X" fields are optional extensions to the original V1.0
643 * fields, so we must selectively expand V1.0 fields if the
644 * corresponding X field is zero.
645 */
646 if (!pmtmr_ioport)
647 pmtmr_ioport = fadt->V1_pm_tmr_blk;
641 } else { 648 } else {
642 /* FADT rev. 1 */ 649 /* FADT rev. 1 */
643 pmtmr_ioport = fadt->V1_pm_tmr_blk; 650 pmtmr_ioport = fadt->V1_pm_tmr_blk;
diff --git a/arch/i386/kernel/acpi/cstate.c b/arch/i386/kernel/acpi/cstate.c
index 4c3036ba65df..25db49ef1770 100644
--- a/arch/i386/kernel/acpi/cstate.c
+++ b/arch/i386/kernel/acpi/cstate.c
@@ -14,64 +14,6 @@
14#include <acpi/processor.h> 14#include <acpi/processor.h>
15#include <asm/acpi.h> 15#include <asm/acpi.h>
16 16
17static void acpi_processor_power_init_intel_pdc(struct acpi_processor_power
18 *pow)
19{
20 struct acpi_object_list *obj_list;
21 union acpi_object *obj;
22 u32 *buf;
23
24 /* allocate and initialize pdc. It will be used later. */
25 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
26 if (!obj_list) {
27 printk(KERN_ERR "Memory allocation error\n");
28 return;
29 }
30
31 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
32 if (!obj) {
33 printk(KERN_ERR "Memory allocation error\n");
34 kfree(obj_list);
35 return;
36 }
37
38 buf = kmalloc(12, GFP_KERNEL);
39 if (!buf) {
40 printk(KERN_ERR "Memory allocation error\n");
41 kfree(obj);
42 kfree(obj_list);
43 return;
44 }
45
46 buf[0] = ACPI_PDC_REVISION_ID;
47 buf[1] = 1;
48 buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
49
50 obj->type = ACPI_TYPE_BUFFER;
51 obj->buffer.length = 12;
52 obj->buffer.pointer = (u8 *) buf;
53 obj_list->count = 1;
54 obj_list->pointer = obj;
55 pow->pdc = obj_list;
56
57 return;
58}
59
60/* Initialize _PDC data based on the CPU vendor */
61void acpi_processor_power_init_pdc(struct acpi_processor_power *pow,
62 unsigned int cpu)
63{
64 struct cpuinfo_x86 *c = cpu_data + cpu;
65
66 pow->pdc = NULL;
67 if (c->x86_vendor == X86_VENDOR_INTEL)
68 acpi_processor_power_init_intel_pdc(pow);
69
70 return;
71}
72
73EXPORT_SYMBOL(acpi_processor_power_init_pdc);
74
75/* 17/*
76 * Initialize bm_flags based on the CPU cache properties 18 * Initialize bm_flags based on the CPU cache properties
77 * On SMP it depends on cache configuration 19 * On SMP it depends on cache configuration
diff --git a/arch/i386/kernel/acpi/processor.c b/arch/i386/kernel/acpi/processor.c
new file mode 100644
index 000000000000..9f4cc02717ec
--- /dev/null
+++ b/arch/i386/kernel/acpi/processor.c
@@ -0,0 +1,75 @@
1/*
2 * arch/i386/kernel/acpi/processor.c
3 *
4 * Copyright (C) 2005 Intel Corporation
5 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
6 * - Added _PDC for platforms with Intel CPUs
7 */
8
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/acpi.h>
13
14#include <acpi/processor.h>
15#include <asm/acpi.h>
16
17static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
18{
19 struct acpi_object_list *obj_list;
20 union acpi_object *obj;
21 u32 *buf;
22
23 /* allocate and initialize pdc. It will be used later. */
24 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
25 if (!obj_list) {
26 printk(KERN_ERR "Memory allocation error\n");
27 return;
28 }
29
30 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
31 if (!obj) {
32 printk(KERN_ERR "Memory allocation error\n");
33 kfree(obj_list);
34 return;
35 }
36
37 buf = kmalloc(12, GFP_KERNEL);
38 if (!buf) {
39 printk(KERN_ERR "Memory allocation error\n");
40 kfree(obj);
41 kfree(obj_list);
42 return;
43 }
44
45 buf[0] = ACPI_PDC_REVISION_ID;
46 buf[1] = 1;
47 buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
48
49 if (cpu_has(c, X86_FEATURE_EST))
50 buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
51
52 obj->type = ACPI_TYPE_BUFFER;
53 obj->buffer.length = 12;
54 obj->buffer.pointer = (u8 *) buf;
55 obj_list->count = 1;
56 obj_list->pointer = obj;
57 pr->pdc = obj_list;
58
59 return;
60}
61
62/* Initialize _PDC data based on the CPU vendor */
63void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
64{
65 unsigned int cpu = pr->id;
66 struct cpuinfo_x86 *c = cpu_data + cpu;
67
68 pr->pdc = NULL;
69 if (c->x86_vendor == X86_VENDOR_INTEL)
70 init_intel_pdc(pr, c);
71
72 return;
73}
74
75EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
diff --git a/arch/i386/kernel/apic.c b/arch/i386/kernel/apic.c
index 496a2c9909fe..acd3f1e34ca6 100644
--- a/arch/i386/kernel/apic.c
+++ b/arch/i386/kernel/apic.c
@@ -26,6 +26,7 @@
26#include <linux/kernel_stat.h> 26#include <linux/kernel_stat.h>
27#include <linux/sysdev.h> 27#include <linux/sysdev.h>
28#include <linux/cpu.h> 28#include <linux/cpu.h>
29#include <linux/module.h>
29 30
30#include <asm/atomic.h> 31#include <asm/atomic.h>
31#include <asm/smp.h> 32#include <asm/smp.h>
@@ -37,10 +38,17 @@
37#include <asm/i8253.h> 38#include <asm/i8253.h>
38 39
39#include <mach_apic.h> 40#include <mach_apic.h>
41#include <mach_ipi.h>
40 42
41#include "io_ports.h" 43#include "io_ports.h"
42 44
43/* 45/*
46 * cpu_mask that denotes the CPUs that needs timer interrupt coming in as
47 * IPIs in place of local APIC timers
48 */
49static cpumask_t timer_bcast_ipi;
50
51/*
44 * Knob to control our willingness to enable the local APIC. 52 * Knob to control our willingness to enable the local APIC.
45 */ 53 */
46int enable_local_apic __initdata = 0; /* -1=force-disable, +1=force-enable */ 54int enable_local_apic __initdata = 0; /* -1=force-disable, +1=force-enable */
@@ -92,10 +100,6 @@ void __init apic_intr_init(void)
92/* Using APIC to generate smp_local_timer_interrupt? */ 100/* Using APIC to generate smp_local_timer_interrupt? */
93int using_apic_timer = 0; 101int using_apic_timer = 0;
94 102
95static DEFINE_PER_CPU(int, prof_multiplier) = 1;
96static DEFINE_PER_CPU(int, prof_old_multiplier) = 1;
97static DEFINE_PER_CPU(int, prof_counter) = 1;
98
99static int enabled_via_apicbase; 103static int enabled_via_apicbase;
100 104
101void enable_NMI_through_LVT0 (void * dummy) 105void enable_NMI_through_LVT0 (void * dummy)
@@ -721,7 +725,7 @@ static int __init apic_set_verbosity(char *str)
721 apic_verbosity = APIC_VERBOSE; 725 apic_verbosity = APIC_VERBOSE;
722 else 726 else
723 printk(KERN_WARNING "APIC Verbosity level %s not recognised" 727 printk(KERN_WARNING "APIC Verbosity level %s not recognised"
724 " use apic=verbose or apic=debug", str); 728 " use apic=verbose or apic=debug\n", str);
725 729
726 return 0; 730 return 0;
727} 731}
@@ -935,11 +939,16 @@ void (*wait_timer_tick)(void) __devinitdata = wait_8254_wraparound;
935static void __setup_APIC_LVTT(unsigned int clocks) 939static void __setup_APIC_LVTT(unsigned int clocks)
936{ 940{
937 unsigned int lvtt_value, tmp_value, ver; 941 unsigned int lvtt_value, tmp_value, ver;
942 int cpu = smp_processor_id();
938 943
939 ver = GET_APIC_VERSION(apic_read(APIC_LVR)); 944 ver = GET_APIC_VERSION(apic_read(APIC_LVR));
940 lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; 945 lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR;
941 if (!APIC_INTEGRATED(ver)) 946 if (!APIC_INTEGRATED(ver))
942 lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV); 947 lvtt_value |= SET_APIC_TIMER_BASE(APIC_TIMER_BASE_DIV);
948
949 if (cpu_isset(cpu, timer_bcast_ipi))
950 lvtt_value |= APIC_LVT_MASKED;
951
943 apic_write_around(APIC_LVTT, lvtt_value); 952 apic_write_around(APIC_LVTT, lvtt_value);
944 953
945 /* 954 /*
@@ -1072,7 +1081,7 @@ void __devinit setup_secondary_APIC_clock(void)
1072 setup_APIC_timer(calibration_result); 1081 setup_APIC_timer(calibration_result);
1073} 1082}
1074 1083
1075void __devinit disable_APIC_timer(void) 1084void disable_APIC_timer(void)
1076{ 1085{
1077 if (using_apic_timer) { 1086 if (using_apic_timer) {
1078 unsigned long v; 1087 unsigned long v;
@@ -1084,7 +1093,10 @@ void __devinit disable_APIC_timer(void)
1084 1093
1085void enable_APIC_timer(void) 1094void enable_APIC_timer(void)
1086{ 1095{
1087 if (using_apic_timer) { 1096 int cpu = smp_processor_id();
1097
1098 if (using_apic_timer &&
1099 !cpu_isset(cpu, timer_bcast_ipi)) {
1088 unsigned long v; 1100 unsigned long v;
1089 1101
1090 v = apic_read(APIC_LVTT); 1102 v = apic_read(APIC_LVTT);
@@ -1092,33 +1104,31 @@ void enable_APIC_timer(void)
1092 } 1104 }
1093} 1105}
1094 1106
1095/* 1107void switch_APIC_timer_to_ipi(void *cpumask)
1096 * the frequency of the profiling timer can be changed
1097 * by writing a multiplier value into /proc/profile.
1098 */
1099int setup_profiling_timer(unsigned int multiplier)
1100{ 1108{
1101 int i; 1109 cpumask_t mask = *(cpumask_t *)cpumask;
1110 int cpu = smp_processor_id();
1102 1111
1103 /* 1112 if (cpu_isset(cpu, mask) &&
1104 * Sanity check. [at least 500 APIC cycles should be 1113 !cpu_isset(cpu, timer_bcast_ipi)) {
1105 * between APIC interrupts as a rule of thumb, to avoid 1114 disable_APIC_timer();
1106 * irqs flooding us] 1115 cpu_set(cpu, timer_bcast_ipi);
1107 */ 1116 }
1108 if ( (!multiplier) || (calibration_result/multiplier < 500)) 1117}
1109 return -EINVAL; 1118EXPORT_SYMBOL(switch_APIC_timer_to_ipi);
1110
1111 /*
1112 * Set the new multiplier for each CPU. CPUs don't start using the
1113 * new values until the next timer interrupt in which they do process
1114 * accounting. At that time they also adjust their APIC timers
1115 * accordingly.
1116 */
1117 for (i = 0; i < NR_CPUS; ++i)
1118 per_cpu(prof_multiplier, i) = multiplier;
1119 1119
1120 return 0; 1120void switch_ipi_to_APIC_timer(void *cpumask)
1121{
1122 cpumask_t mask = *(cpumask_t *)cpumask;
1123 int cpu = smp_processor_id();
1124
1125 if (cpu_isset(cpu, mask) &&
1126 cpu_isset(cpu, timer_bcast_ipi)) {
1127 cpu_clear(cpu, timer_bcast_ipi);
1128 enable_APIC_timer();
1129 }
1121} 1130}
1131EXPORT_SYMBOL(switch_ipi_to_APIC_timer);
1122 1132
1123#undef APIC_DIVISOR 1133#undef APIC_DIVISOR
1124 1134
@@ -1134,32 +1144,10 @@ int setup_profiling_timer(unsigned int multiplier)
1134 1144
1135inline void smp_local_timer_interrupt(struct pt_regs * regs) 1145inline void smp_local_timer_interrupt(struct pt_regs * regs)
1136{ 1146{
1137 int cpu = smp_processor_id();
1138
1139 profile_tick(CPU_PROFILING, regs); 1147 profile_tick(CPU_PROFILING, regs);
1140 if (--per_cpu(prof_counter, cpu) <= 0) {
1141 /*
1142 * The multiplier may have changed since the last time we got
1143 * to this point as a result of the user writing to
1144 * /proc/profile. In this case we need to adjust the APIC
1145 * timer accordingly.
1146 *
1147 * Interrupts are already masked off at this point.
1148 */
1149 per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu);
1150 if (per_cpu(prof_counter, cpu) !=
1151 per_cpu(prof_old_multiplier, cpu)) {
1152 __setup_APIC_LVTT(
1153 calibration_result/
1154 per_cpu(prof_counter, cpu));
1155 per_cpu(prof_old_multiplier, cpu) =
1156 per_cpu(prof_counter, cpu);
1157 }
1158
1159#ifdef CONFIG_SMP 1148#ifdef CONFIG_SMP
1160 update_process_times(user_mode_vm(regs)); 1149 update_process_times(user_mode_vm(regs));
1161#endif 1150#endif
1162 }
1163 1151
1164 /* 1152 /*
1165 * We take the 'long' return path, and there every subsystem 1153 * We take the 'long' return path, and there every subsystem
@@ -1206,6 +1194,43 @@ fastcall void smp_apic_timer_interrupt(struct pt_regs *regs)
1206 irq_exit(); 1194 irq_exit();
1207} 1195}
1208 1196
1197#ifndef CONFIG_SMP
1198static void up_apic_timer_interrupt_call(struct pt_regs *regs)
1199{
1200 int cpu = smp_processor_id();
1201
1202 /*
1203 * the NMI deadlock-detector uses this.
1204 */
1205 per_cpu(irq_stat, cpu).apic_timer_irqs++;
1206
1207 smp_local_timer_interrupt(regs);
1208}
1209#endif
1210
1211void smp_send_timer_broadcast_ipi(struct pt_regs *regs)
1212{
1213 cpumask_t mask;
1214
1215 cpus_and(mask, cpu_online_map, timer_bcast_ipi);
1216 if (!cpus_empty(mask)) {
1217#ifdef CONFIG_SMP
1218 send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
1219#else
1220 /*
1221 * We can directly call the apic timer interrupt handler
1222 * in UP case. Minus all irq related functions
1223 */
1224 up_apic_timer_interrupt_call(regs);
1225#endif
1226 }
1227}
1228
1229int setup_profiling_timer(unsigned int multiplier)
1230{
1231 return -EINVAL;
1232}
1233
1209/* 1234/*
1210 * This interrupt should _never_ happen with our APIC/SMP architecture 1235 * This interrupt should _never_ happen with our APIC/SMP architecture
1211 */ 1236 */
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index 1e60acbed3c1..05312a8abb8b 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -219,6 +219,7 @@
219#include <linux/sched.h> 219#include <linux/sched.h>
220#include <linux/pm.h> 220#include <linux/pm.h>
221#include <linux/pm_legacy.h> 221#include <linux/pm_legacy.h>
222#include <linux/capability.h>
222#include <linux/device.h> 223#include <linux/device.h>
223#include <linux/kernel.h> 224#include <linux/kernel.h>
224#include <linux/smp.h> 225#include <linux/smp.h>
@@ -303,17 +304,6 @@ extern int (*console_blank_hook)(int);
303#include "apm.h" 304#include "apm.h"
304 305
305/* 306/*
306 * Define to make all _set_limit calls use 64k limits. The APM 1.1 BIOS is
307 * supposed to provide limit information that it recognizes. Many machines
308 * do this correctly, but many others do not restrict themselves to their
309 * claimed limit. When this happens, they will cause a segmentation
310 * violation in the kernel at boot time. Most BIOS's, however, will
311 * respect a 64k limit, so we use that. If you want to be pedantic and
312 * hold your BIOS to its claims, then undefine this.
313 */
314#define APM_RELAX_SEGMENTS
315
316/*
317 * Define to re-initialize the interrupt 0 timer to 100 Hz after a suspend. 307 * Define to re-initialize the interrupt 0 timer to 100 Hz after a suspend.
318 * This patched by Chad Miller <cmiller@surfsouth.com>, original code by 308 * This patched by Chad Miller <cmiller@surfsouth.com>, original code by
319 * David Chen <chen@ctpa04.mit.edu> 309 * David Chen <chen@ctpa04.mit.edu>
@@ -1075,22 +1065,23 @@ static int apm_engage_power_management(u_short device, int enable)
1075 1065
1076static int apm_console_blank(int blank) 1066static int apm_console_blank(int blank)
1077{ 1067{
1078 int error; 1068 int error, i;
1079 u_short state; 1069 u_short state;
1070 static const u_short dev[3] = { 0x100, 0x1FF, 0x101 };
1080 1071
1081 state = blank ? APM_STATE_STANDBY : APM_STATE_READY; 1072 state = blank ? APM_STATE_STANDBY : APM_STATE_READY;
1082 /* Blank the first display device */ 1073
1083 error = set_power_state(0x100, state); 1074 for (i = 0; i < ARRAY_SIZE(dev); i++) {
1084 if ((error != APM_SUCCESS) && (error != APM_NO_ERROR)) { 1075 error = set_power_state(dev[i], state);
1085 /* try to blank them all instead */ 1076
1086 error = set_power_state(0x1ff, state); 1077 if ((error == APM_SUCCESS) || (error == APM_NO_ERROR))
1087 if ((error != APM_SUCCESS) && (error != APM_NO_ERROR)) 1078 return 1;
1088 /* try to blank device one instead */ 1079
1089 error = set_power_state(0x101, state); 1080 if (error == APM_NOT_ENGAGED)
1081 break;
1090 } 1082 }
1091 if ((error == APM_SUCCESS) || (error == APM_NO_ERROR)) 1083
1092 return 1; 1084 if (error == APM_NOT_ENGAGED && state != APM_STATE_READY) {
1093 if (error == APM_NOT_ENGAGED) {
1094 static int tried; 1085 static int tried;
1095 int eng_error; 1086 int eng_error;
1096 if (tried++ == 0) { 1087 if (tried++ == 0) {
@@ -2233,8 +2224,8 @@ static struct dmi_system_id __initdata apm_dmi_table[] = {
2233static int __init apm_init(void) 2224static int __init apm_init(void)
2234{ 2225{
2235 struct proc_dir_entry *apm_proc; 2226 struct proc_dir_entry *apm_proc;
2227 struct desc_struct *gdt;
2236 int ret; 2228 int ret;
2237 int i;
2238 2229
2239 dmi_check_system(apm_dmi_table); 2230 dmi_check_system(apm_dmi_table);
2240 2231
@@ -2301,7 +2292,9 @@ static int __init apm_init(void)
2301 apm_info.disabled = 1; 2292 apm_info.disabled = 1;
2302 return -ENODEV; 2293 return -ENODEV;
2303 } 2294 }
2295#ifdef CONFIG_PM_LEGACY
2304 pm_active = 1; 2296 pm_active = 1;
2297#endif
2305 2298
2306 /* 2299 /*
2307 * Set up a segment that references the real mode segment 0x40 2300 * Set up a segment that references the real mode segment 0x40
@@ -2312,45 +2305,30 @@ static int __init apm_init(void)
2312 set_base(bad_bios_desc, __va((unsigned long)0x40 << 4)); 2305 set_base(bad_bios_desc, __va((unsigned long)0x40 << 4));
2313 _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4)); 2306 _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4));
2314 2307
2308 /*
2309 * Set up the long jump entry point to the APM BIOS, which is called
2310 * from inline assembly.
2311 */
2315 apm_bios_entry.offset = apm_info.bios.offset; 2312 apm_bios_entry.offset = apm_info.bios.offset;
2316 apm_bios_entry.segment = APM_CS; 2313 apm_bios_entry.segment = APM_CS;
2317 2314
2318 for (i = 0; i < NR_CPUS; i++) { 2315 /*
2319 struct desc_struct *gdt = get_cpu_gdt_table(i); 2316 * The APM 1.1 BIOS is supposed to provide limit information that it
2320 set_base(gdt[APM_CS >> 3], 2317 * recognizes. Many machines do this correctly, but many others do
2321 __va((unsigned long)apm_info.bios.cseg << 4)); 2318 * not restrict themselves to their claimed limit. When this happens,
2322 set_base(gdt[APM_CS_16 >> 3], 2319 * they will cause a segmentation violation in the kernel at boot time.
2323 __va((unsigned long)apm_info.bios.cseg_16 << 4)); 2320 * Most BIOS's, however, will respect a 64k limit, so we use that.
2324 set_base(gdt[APM_DS >> 3], 2321 *
2325 __va((unsigned long)apm_info.bios.dseg << 4)); 2322 * Note we only set APM segments on CPU zero, since we pin the APM
2326#ifndef APM_RELAX_SEGMENTS 2323 * code to that CPU.
2327 if (apm_info.bios.version == 0x100) { 2324 */
2328#endif 2325 gdt = get_cpu_gdt_table(0);
2329 /* For ASUS motherboard, Award BIOS rev 110 (and others?) */ 2326 set_base(gdt[APM_CS >> 3],
2330 _set_limit((char *)&gdt[APM_CS >> 3], 64 * 1024 - 1); 2327 __va((unsigned long)apm_info.bios.cseg << 4));
2331 /* For some unknown machine. */ 2328 set_base(gdt[APM_CS_16 >> 3],
2332 _set_limit((char *)&gdt[APM_CS_16 >> 3], 64 * 1024 - 1); 2329 __va((unsigned long)apm_info.bios.cseg_16 << 4));
2333 /* For the DEC Hinote Ultra CT475 (and others?) */ 2330 set_base(gdt[APM_DS >> 3],
2334 _set_limit((char *)&gdt[APM_DS >> 3], 64 * 1024 - 1); 2331 __va((unsigned long)apm_info.bios.dseg << 4));
2335#ifndef APM_RELAX_SEGMENTS
2336 } else {
2337 _set_limit((char *)&gdt[APM_CS >> 3],
2338 (apm_info.bios.cseg_len - 1) & 0xffff);
2339 _set_limit((char *)&gdt[APM_CS_16 >> 3],
2340 (apm_info.bios.cseg_16_len - 1) & 0xffff);
2341 _set_limit((char *)&gdt[APM_DS >> 3],
2342 (apm_info.bios.dseg_len - 1) & 0xffff);
2343 /* workaround for broken BIOSes */
2344 if (apm_info.bios.cseg_len <= apm_info.bios.offset)
2345 _set_limit((char *)&gdt[APM_CS >> 3], 64 * 1024 -1);
2346 if (apm_info.bios.dseg_len <= 0x40) { /* 0x40 * 4kB == 64kB */
2347 /* for the BIOS that assumes granularity = 1 */
2348 gdt[APM_DS >> 3].b |= 0x800000;
2349 printk(KERN_NOTICE "apm: we set the granularity of dseg.\n");
2350 }
2351 }
2352#endif
2353 }
2354 2332
2355 apm_proc = create_proc_info_entry("apm", 0, NULL, apm_get_info); 2333 apm_proc = create_proc_info_entry("apm", 0, NULL, apm_get_info);
2356 if (apm_proc) 2334 if (apm_proc)
@@ -2407,7 +2385,9 @@ static void __exit apm_exit(void)
2407 exit_kapmd = 1; 2385 exit_kapmd = 1;
2408 while (kapmd_running) 2386 while (kapmd_running)
2409 schedule(); 2387 schedule();
2388#ifdef CONFIG_PM_LEGACY
2410 pm_active = 0; 2389 pm_active = 0;
2390#endif
2411} 2391}
2412 2392
2413module_init(apm_init); 2393module_init(apm_init);
diff --git a/arch/i386/kernel/cpu/amd.c b/arch/i386/kernel/cpu/amd.c
index e344ef88cfcd..333578a4e91a 100644
--- a/arch/i386/kernel/cpu/amd.c
+++ b/arch/i386/kernel/cpu/amd.c
@@ -161,8 +161,13 @@ static void __init init_amd(struct cpuinfo_x86 *c)
161 set_bit(X86_FEATURE_K6_MTRR, c->x86_capability); 161 set_bit(X86_FEATURE_K6_MTRR, c->x86_capability);
162 break; 162 break;
163 } 163 }
164 break;
165 164
165 if (c->x86_model == 10) {
166 /* AMD Geode LX is model 10 */
167 /* placeholder for any needed mods */
168 break;
169 }
170 break;
166 case 6: /* An Athlon/Duron */ 171 case 6: /* An Athlon/Duron */
167 172
168 /* Bit 15 of Athlon specific MSR 15, needs to be 0 173 /* Bit 15 of Athlon specific MSR 15, needs to be 0
@@ -211,6 +216,12 @@ static void __init init_amd(struct cpuinfo_x86 *c)
211 c->x86_max_cores = 1; 216 c->x86_max_cores = 1;
212 } 217 }
213 218
219 if (cpuid_eax(0x80000000) >= 0x80000007) {
220 c->x86_power = cpuid_edx(0x80000007);
221 if (c->x86_power & (1<<8))
222 set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
223 }
224
214#ifdef CONFIG_X86_HT 225#ifdef CONFIG_X86_HT
215 /* 226 /*
216 * On a AMD dual core setup the lower bits of the APIC id 227 * On a AMD dual core setup the lower bits of the APIC id
@@ -228,6 +239,7 @@ static void __init init_amd(struct cpuinfo_x86 *c)
228 cpu, c->x86_max_cores, cpu_core_id[cpu]); 239 cpu, c->x86_max_cores, cpu_core_id[cpu]);
229 } 240 }
230#endif 241#endif
242
231} 243}
232 244
233static unsigned int amd_size_cache(struct cpuinfo_x86 * c, unsigned int size) 245static unsigned int amd_size_cache(struct cpuinfo_x86 * c, unsigned int size)
diff --git a/arch/i386/kernel/cpu/changelog b/arch/i386/kernel/cpu/changelog
deleted file mode 100644
index cef76b80a710..000000000000
--- a/arch/i386/kernel/cpu/changelog
+++ /dev/null
@@ -1,63 +0,0 @@
1/*
2 * Enhanced CPU type detection by Mike Jagdis, Patrick St. Jean
3 * and Martin Mares, November 1997.
4 *
5 * Force Cyrix 6x86(MX) and M II processors to report MTRR capability
6 * and Cyrix "coma bug" recognition by
7 * Zoltán Böszörményi <zboszor@mail.externet.hu> February 1999.
8 *
9 * Force Centaur C6 processors to report MTRR capability.
10 * Bart Hartgers <bart@etpmod.phys.tue.nl>, May 1999.
11 *
12 * Intel Mobile Pentium II detection fix. Sean Gilley, June 1999.
13 *
14 * IDT Winchip tweaks, misc clean ups.
15 * Dave Jones <davej@suse.de>, August 1999
16 *
17 * Better detection of Centaur/IDT WinChip models.
18 * Bart Hartgers <bart@etpmod.phys.tue.nl>, August 1999.
19 *
20 * Cleaned up cache-detection code
21 * Dave Jones <davej@suse.de>, October 1999
22 *
23 * Added proper L2 cache detection for Coppermine
24 * Dragan Stancevic <visitor@valinux.com>, October 1999
25 *
26 * Added the original array for capability flags but forgot to credit
27 * myself :) (~1998) Fixed/cleaned up some cpu_model_info and other stuff
28 * Jauder Ho <jauderho@carumba.com>, January 2000
29 *
30 * Detection for Celeron coppermine, identify_cpu() overhauled,
31 * and a few other clean ups.
32 * Dave Jones <davej@suse.de>, April 2000
33 *
34 * Pentium III FXSR, SSE support
35 * General FPU state handling cleanups
36 * Gareth Hughes <gareth@valinux.com>, May 2000
37 *
38 * Added proper Cascades CPU and L2 cache detection for Cascades
39 * and 8-way type cache happy bunch from Intel:^)
40 * Dragan Stancevic <visitor@valinux.com>, May 2000
41 *
42 * Forward port AMD Duron errata T13 from 2.2.17pre
43 * Dave Jones <davej@suse.de>, August 2000
44 *
45 * Forward port lots of fixes/improvements from 2.2.18pre
46 * Cyrix III, Pentium IV support.
47 * Dave Jones <davej@suse.de>, October 2000
48 *
49 * Massive cleanup of CPU detection and bug handling;
50 * Transmeta CPU detection,
51 * H. Peter Anvin <hpa@zytor.com>, November 2000
52 *
53 * VIA C3 Support.
54 * Dave Jones <davej@suse.de>, March 2001
55 *
56 * AMD Athlon/Duron/Thunderbird bluesmoke support.
57 * Dave Jones <davej@suse.de>, April 2001.
58 *
59 * CacheSize bug workaround updates for AMD, Intel & VIA Cyrix.
60 * Dave Jones <davej@suse.de>, September, October 2001.
61 *
62 */
63
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 31e344b26bae..15aee26ec2b6 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -18,9 +18,6 @@
18 18
19#include "cpu.h" 19#include "cpu.h"
20 20
21DEFINE_PER_CPU(struct desc_struct, cpu_gdt_table[GDT_ENTRIES]);
22EXPORT_PER_CPU_SYMBOL(cpu_gdt_table);
23
24DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]); 21DEFINE_PER_CPU(unsigned char, cpu_16bit_stack[CPU_16BIT_STACK_SIZE]);
25EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack); 22EXPORT_PER_CPU_SYMBOL(cpu_16bit_stack);
26 23
@@ -207,7 +204,10 @@ static int __devinit have_cpuid_p(void)
207 204
208/* Do minimum CPU detection early. 205/* Do minimum CPU detection early.
209 Fields really needed: vendor, cpuid_level, family, model, mask, cache alignment. 206 Fields really needed: vendor, cpuid_level, family, model, mask, cache alignment.
210 The others are not touched to avoid unwanted side effects. */ 207 The others are not touched to avoid unwanted side effects.
208
209 WARNING: this function is only called on the BP. Don't add code here
210 that is supposed to run on all CPUs. */
211static void __init early_cpu_detect(void) 211static void __init early_cpu_detect(void)
212{ 212{
213 struct cpuinfo_x86 *c = &boot_cpu_data; 213 struct cpuinfo_x86 *c = &boot_cpu_data;
@@ -239,12 +239,6 @@ static void __init early_cpu_detect(void)
239 if (cap0 & (1<<19)) 239 if (cap0 & (1<<19))
240 c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8; 240 c->x86_cache_alignment = ((misc >> 8) & 0xff) * 8;
241 } 241 }
242
243 early_intel_workaround(c);
244
245#ifdef CONFIG_X86_HT
246 phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff;
247#endif
248} 242}
249 243
250void __devinit generic_identify(struct cpuinfo_x86 * c) 244void __devinit generic_identify(struct cpuinfo_x86 * c)
@@ -292,6 +286,12 @@ void __devinit generic_identify(struct cpuinfo_x86 * c)
292 get_model_name(c); /* Default name */ 286 get_model_name(c); /* Default name */
293 } 287 }
294 } 288 }
289
290 early_intel_workaround(c);
291
292#ifdef CONFIG_X86_HT
293 phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff;
294#endif
295} 295}
296 296
297static void __devinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c) 297static void __devinit squash_the_stupid_serial_number(struct cpuinfo_x86 *c)
@@ -599,11 +599,6 @@ void __devinit cpu_init(void)
599 load_idt(&idt_descr); 599 load_idt(&idt_descr);
600 600
601 /* 601 /*
602 * Delete NT
603 */
604 __asm__("pushfl ; andl $0xffffbfff,(%esp) ; popfl");
605
606 /*
607 * Set up and load the per-CPU TSS and LDT 602 * Set up and load the per-CPU TSS and LDT
608 */ 603 */
609 atomic_inc(&init_mm.mm_count); 604 atomic_inc(&init_mm.mm_count);
@@ -617,8 +612,10 @@ void __devinit cpu_init(void)
617 load_TR_desc(); 612 load_TR_desc();
618 load_LDT(&init_mm.context); 613 load_LDT(&init_mm.context);
619 614
615#ifdef CONFIG_DOUBLEFAULT
620 /* Set up doublefault TSS pointer in the GDT */ 616 /* Set up doublefault TSS pointer in the GDT */
621 __set_tss_desc(cpu, GDT_ENTRY_DOUBLEFAULT_TSS, &doublefault_tss); 617 __set_tss_desc(cpu, GDT_ENTRY_DOUBLEFAULT_TSS, &doublefault_tss);
618#endif
622 619
623 /* Clear %fs and %gs. */ 620 /* Clear %fs and %gs. */
624 asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs"); 621 asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs");
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index 871366b83b3f..3852d0a4c1b5 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -40,8 +40,6 @@
40#include <linux/acpi.h> 40#include <linux/acpi.h>
41#include <acpi/processor.h> 41#include <acpi/processor.h>
42 42
43#include "speedstep-est-common.h"
44
45#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg) 43#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_DRIVER, "acpi-cpufreq", msg)
46 44
47MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski"); 45MODULE_AUTHOR("Paul Diefenbaugh, Dominik Brodowski");
@@ -297,68 +295,6 @@ acpi_cpufreq_guess_freq (
297} 295}
298 296
299 297
300/*
301 * acpi_processor_cpu_init_pdc_est - let BIOS know about the SMP capabilities
302 * of this driver
303 * @perf: processor-specific acpi_io_data struct
304 * @cpu: CPU being initialized
305 *
306 * To avoid issues with legacy OSes, some BIOSes require to be informed of
307 * the SMP capabilities of OS P-state driver. Here we set the bits in _PDC
308 * accordingly, for Enhanced Speedstep. Actual call to _PDC is done in
309 * driver/acpi/processor.c
310 */
311static void
312acpi_processor_cpu_init_pdc_est(
313 struct acpi_processor_performance *perf,
314 unsigned int cpu,
315 struct acpi_object_list *obj_list
316 )
317{
318 union acpi_object *obj;
319 u32 *buf;
320 struct cpuinfo_x86 *c = cpu_data + cpu;
321 dprintk("acpi_processor_cpu_init_pdc_est\n");
322
323 if (!cpu_has(c, X86_FEATURE_EST))
324 return;
325
326 /* Initialize pdc. It will be used later. */
327 if (!obj_list)
328 return;
329
330 if (!(obj_list->count && obj_list->pointer))
331 return;
332
333 obj = obj_list->pointer;
334 if ((obj->buffer.length == 12) && obj->buffer.pointer) {
335 buf = (u32 *)obj->buffer.pointer;
336 buf[0] = ACPI_PDC_REVISION_ID;
337 buf[1] = 1;
338 buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
339 perf->pdc = obj_list;
340 }
341 return;
342}
343
344
345/* CPU specific PDC initialization */
346static void
347acpi_processor_cpu_init_pdc(
348 struct acpi_processor_performance *perf,
349 unsigned int cpu,
350 struct acpi_object_list *obj_list
351 )
352{
353 struct cpuinfo_x86 *c = cpu_data + cpu;
354 dprintk("acpi_processor_cpu_init_pdc\n");
355 perf->pdc = NULL;
356 if (cpu_has(c, X86_FEATURE_EST))
357 acpi_processor_cpu_init_pdc_est(perf, cpu, obj_list);
358 return;
359}
360
361
362static int 298static int
363acpi_cpufreq_cpu_init ( 299acpi_cpufreq_cpu_init (
364 struct cpufreq_policy *policy) 300 struct cpufreq_policy *policy)
@@ -367,15 +303,9 @@ acpi_cpufreq_cpu_init (
367 unsigned int cpu = policy->cpu; 303 unsigned int cpu = policy->cpu;
368 struct cpufreq_acpi_io *data; 304 struct cpufreq_acpi_io *data;
369 unsigned int result = 0; 305 unsigned int result = 0;
370 306 struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
371 union acpi_object arg0 = {ACPI_TYPE_BUFFER};
372 u32 arg0_buf[3];
373 struct acpi_object_list arg_list = {1, &arg0};
374 307
375 dprintk("acpi_cpufreq_cpu_init\n"); 308 dprintk("acpi_cpufreq_cpu_init\n");
376 /* setup arg_list for _PDC settings */
377 arg0.buffer.length = 12;
378 arg0.buffer.pointer = (u8 *) arg0_buf;
379 309
380 data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); 310 data = kzalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
381 if (!data) 311 if (!data)
@@ -383,14 +313,12 @@ acpi_cpufreq_cpu_init (
383 313
384 acpi_io_data[cpu] = data; 314 acpi_io_data[cpu] = data;
385 315
386 acpi_processor_cpu_init_pdc(&data->acpi_data, cpu, &arg_list);
387 result = acpi_processor_register_performance(&data->acpi_data, cpu); 316 result = acpi_processor_register_performance(&data->acpi_data, cpu);
388 data->acpi_data.pdc = NULL;
389 317
390 if (result) 318 if (result)
391 goto err_free; 319 goto err_free;
392 320
393 if (is_const_loops_cpu(cpu)) { 321 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
394 acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS; 322 acpi_cpufreq_driver.flags |= CPUFREQ_CONST_LOOPS;
395 } 323 }
396 324
diff --git a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c
index 04a405345203..2b62dee35c6c 100644
--- a/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c
+++ b/arch/i386/kernel/cpu/cpufreq/cpufreq-nforce2.c
@@ -177,9 +177,10 @@ static unsigned int nforce2_fsb_read(int bootfsb)
177 */ 177 */
178static int nforce2_set_fsb(unsigned int fsb) 178static int nforce2_set_fsb(unsigned int fsb)
179{ 179{
180 u32 pll, temp = 0; 180 u32 temp = 0;
181 unsigned int tfsb; 181 unsigned int tfsb;
182 int diff; 182 int diff;
183 int pll = 0;
183 184
184 if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) { 185 if ((fsb > max_fsb) || (fsb < NFORCE2_MIN_FSB)) {
185 printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb); 186 printk(KERN_ERR "cpufreq: FSB %d is out of range!\n", fsb);
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index 68a1fc87f4ca..e11a09207ec8 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -45,7 +45,7 @@
45 45
46#define PFX "powernow-k8: " 46#define PFX "powernow-k8: "
47#define BFX PFX "BIOS error: " 47#define BFX PFX "BIOS error: "
48#define VERSION "version 1.50.4" 48#define VERSION "version 1.60.0"
49#include "powernow-k8.h" 49#include "powernow-k8.h"
50 50
51/* serialize freq changes */ 51/* serialize freq changes */
@@ -216,10 +216,10 @@ static int write_new_vid(struct powernow_k8_data *data, u32 vid)
216 216
217 do { 217 do {
218 wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS); 218 wrmsr(MSR_FIDVID_CTL, lo, STOP_GRANT_5NS);
219 if (i++ > 100) { 219 if (i++ > 100) {
220 printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n"); 220 printk(KERN_ERR PFX "internal error - pending bit very stuck - no further pstate changes possible\n");
221 return 1; 221 return 1;
222 } 222 }
223 } while (query_current_values_with_pending_wait(data)); 223 } while (query_current_values_with_pending_wait(data));
224 224
225 if (savefid != data->currfid) { 225 if (savefid != data->currfid) {
@@ -336,7 +336,7 @@ static int core_voltage_pre_transition(struct powernow_k8_data *data, u32 reqvid
336/* Phase 2 - core frequency transition */ 336/* Phase 2 - core frequency transition */
337static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid) 337static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)
338{ 338{
339 u32 vcoreqfid, vcocurrfid, vcofiddiff, savevid = data->currvid; 339 u32 vcoreqfid, vcocurrfid, vcofiddiff, fid_interval, savevid = data->currvid;
340 340
341 if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) { 341 if ((reqfid < HI_FID_TABLE_BOTTOM) && (data->currfid < HI_FID_TABLE_BOTTOM)) {
342 printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n", 342 printk(KERN_ERR PFX "ph2: illegal lo-lo transition 0x%x 0x%x\n",
@@ -359,9 +359,11 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)
359 : vcoreqfid - vcocurrfid; 359 : vcoreqfid - vcocurrfid;
360 360
361 while (vcofiddiff > 2) { 361 while (vcofiddiff > 2) {
362 (data->currfid & 1) ? (fid_interval = 1) : (fid_interval = 2);
363
362 if (reqfid > data->currfid) { 364 if (reqfid > data->currfid) {
363 if (data->currfid > LO_FID_TABLE_TOP) { 365 if (data->currfid > LO_FID_TABLE_TOP) {
364 if (write_new_fid(data, data->currfid + 2)) { 366 if (write_new_fid(data, data->currfid + fid_interval)) {
365 return 1; 367 return 1;
366 } 368 }
367 } else { 369 } else {
@@ -371,7 +373,7 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid)
371 } 373 }
372 } 374 }
373 } else { 375 } else {
374 if (write_new_fid(data, data->currfid - 2)) 376 if (write_new_fid(data, data->currfid - fid_interval))
375 return 1; 377 return 1;
376 } 378 }
377 379
@@ -464,7 +466,7 @@ static int check_supported_cpu(unsigned int cpu)
464 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 466 set_cpus_allowed(current, cpumask_of_cpu(cpu));
465 467
466 if (smp_processor_id() != cpu) { 468 if (smp_processor_id() != cpu) {
467 printk(KERN_ERR "limiting to cpu %u failed\n", cpu); 469 printk(KERN_ERR PFX "limiting to cpu %u failed\n", cpu);
468 goto out; 470 goto out;
469 } 471 }
470 472
@@ -474,7 +476,7 @@ static int check_supported_cpu(unsigned int cpu)
474 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE); 476 eax = cpuid_eax(CPUID_PROCESSOR_SIGNATURE);
475 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) || 477 if (((eax & CPUID_USE_XFAM_XMOD) != CPUID_USE_XFAM_XMOD) ||
476 ((eax & CPUID_XFAM) != CPUID_XFAM_K8) || 478 ((eax & CPUID_XFAM) != CPUID_XFAM_K8) ||
477 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_F)) { 479 ((eax & CPUID_XMOD) > CPUID_XMOD_REV_G)) {
478 printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax); 480 printk(KERN_INFO PFX "Processor cpuid %x not supported\n", eax);
479 goto out; 481 goto out;
480 } 482 }
@@ -517,22 +519,24 @@ static int check_pst_table(struct powernow_k8_data *data, struct pst_s *pst, u8
517 printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j); 519 printk(KERN_ERR BFX "maxvid exceeded with pstate %d\n", j);
518 return -ENODEV; 520 return -ENODEV;
519 } 521 }
520 if ((pst[j].fid > MAX_FID) 522 if (pst[j].fid > MAX_FID) {
521 || (pst[j].fid & 1) 523 printk(KERN_ERR BFX "maxfid exceeded with pstate %d\n", j);
522 || (j && (pst[j].fid < HI_FID_TABLE_BOTTOM))) { 524 return -ENODEV;
525 }
526 if (j && (pst[j].fid < HI_FID_TABLE_BOTTOM)) {
523 /* Only first fid is allowed to be in "low" range */ 527 /* Only first fid is allowed to be in "low" range */
524 printk(KERN_ERR PFX "two low fids - %d : 0x%x\n", j, pst[j].fid); 528 printk(KERN_ERR BFX "two low fids - %d : 0x%x\n", j, pst[j].fid);
525 return -EINVAL; 529 return -EINVAL;
526 } 530 }
527 if (pst[j].fid < lastfid) 531 if (pst[j].fid < lastfid)
528 lastfid = pst[j].fid; 532 lastfid = pst[j].fid;
529 } 533 }
530 if (lastfid & 1) { 534 if (lastfid & 1) {
531 printk(KERN_ERR PFX "lastfid invalid\n"); 535 printk(KERN_ERR BFX "lastfid invalid\n");
532 return -EINVAL; 536 return -EINVAL;
533 } 537 }
534 if (lastfid > LO_FID_TABLE_TOP) 538 if (lastfid > LO_FID_TABLE_TOP)
535 printk(KERN_INFO PFX "first fid not from lo freq table\n"); 539 printk(KERN_INFO BFX "first fid not from lo freq table\n");
536 540
537 return 0; 541 return 0;
538} 542}
@@ -631,7 +635,7 @@ static int find_psb_table(struct powernow_k8_data *data)
631 635
632 dprintk("table vers: 0x%x\n", psb->tableversion); 636 dprintk("table vers: 0x%x\n", psb->tableversion);
633 if (psb->tableversion != PSB_VERSION_1_4) { 637 if (psb->tableversion != PSB_VERSION_1_4) {
634 printk(KERN_INFO BFX "PSB table is not v1.4\n"); 638 printk(KERN_ERR BFX "PSB table is not v1.4\n");
635 return -ENODEV; 639 return -ENODEV;
636 } 640 }
637 641
@@ -689,7 +693,7 @@ static int find_psb_table(struct powernow_k8_data *data)
689 * BIOS and Kernel Developer's Guide, which is available on 693 * BIOS and Kernel Developer's Guide, which is available on
690 * www.amd.com 694 * www.amd.com
691 */ 695 */
692 printk(KERN_INFO PFX "BIOS error - no PSB or ACPI _PSS objects\n"); 696 printk(KERN_ERR PFX "BIOS error - no PSB or ACPI _PSS objects\n");
693 return -ENODEV; 697 return -ENODEV;
694} 698}
695 699
@@ -912,7 +916,7 @@ static int powernowk8_target(struct cpufreq_policy *pol, unsigned targfreq, unsi
912 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); 916 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
913 917
914 if (smp_processor_id() != pol->cpu) { 918 if (smp_processor_id() != pol->cpu) {
915 printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); 919 printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
916 goto err_out; 920 goto err_out;
917 } 921 }
918 922
@@ -976,12 +980,15 @@ static int powernowk8_verify(struct cpufreq_policy *pol)
976} 980}
977 981
978/* per CPU init entry point to the driver */ 982/* per CPU init entry point to the driver */
979static int __init powernowk8_cpu_init(struct cpufreq_policy *pol) 983static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
980{ 984{
981 struct powernow_k8_data *data; 985 struct powernow_k8_data *data;
982 cpumask_t oldmask = CPU_MASK_ALL; 986 cpumask_t oldmask = CPU_MASK_ALL;
983 int rc, i; 987 int rc, i;
984 988
989 if (!cpu_online(pol->cpu))
990 return -ENODEV;
991
985 if (!check_supported_cpu(pol->cpu)) 992 if (!check_supported_cpu(pol->cpu))
986 return -ENODEV; 993 return -ENODEV;
987 994
@@ -1021,7 +1028,7 @@ static int __init powernowk8_cpu_init(struct cpufreq_policy *pol)
1021 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu)); 1028 set_cpus_allowed(current, cpumask_of_cpu(pol->cpu));
1022 1029
1023 if (smp_processor_id() != pol->cpu) { 1030 if (smp_processor_id() != pol->cpu) {
1024 printk(KERN_ERR "limiting to cpu %u failed\n", pol->cpu); 1031 printk(KERN_ERR PFX "limiting to cpu %u failed\n", pol->cpu);
1025 goto err_out; 1032 goto err_out;
1026 } 1033 }
1027 1034
@@ -1134,7 +1141,7 @@ static struct cpufreq_driver cpufreq_amd64_driver = {
1134}; 1141};
1135 1142
1136/* driver entry point for init */ 1143/* driver entry point for init */
1137static int __init powernowk8_init(void) 1144static int __cpuinit powernowk8_init(void)
1138{ 1145{
1139 unsigned int i, supported_cpus = 0; 1146 unsigned int i, supported_cpus = 0;
1140 1147
@@ -1162,10 +1169,9 @@ static void __exit powernowk8_exit(void)
1162 cpufreq_unregister_driver(&cpufreq_amd64_driver); 1169 cpufreq_unregister_driver(&cpufreq_amd64_driver);
1163} 1170}
1164 1171
1165MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com."); 1172MODULE_AUTHOR("Paul Devriendt <paul.devriendt@amd.com> and Mark Langsdorf <mark.langsdorf@amd.com>");
1166MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver."); 1173MODULE_DESCRIPTION("AMD Athlon 64 and Opteron processor frequency driver.");
1167MODULE_LICENSE("GPL"); 1174MODULE_LICENSE("GPL");
1168 1175
1169late_initcall(powernowk8_init); 1176late_initcall(powernowk8_init);
1170module_exit(powernowk8_exit); 1177module_exit(powernowk8_exit);
1171
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
index b1e85bb36396..d0de37d58e9a 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
@@ -42,7 +42,7 @@ struct powernow_k8_data {
42#define CPUID_XFAM 0x0ff00000 /* extended family */ 42#define CPUID_XFAM 0x0ff00000 /* extended family */
43#define CPUID_XFAM_K8 0 43#define CPUID_XFAM_K8 0
44#define CPUID_XMOD 0x000f0000 /* extended model */ 44#define CPUID_XMOD 0x000f0000 /* extended model */
45#define CPUID_XMOD_REV_F 0x00040000 45#define CPUID_XMOD_REV_G 0x00060000
46#define CPUID_USE_XFAM_XMOD 0x00000f00 46#define CPUID_USE_XFAM_XMOD 0x00000f00
47#define CPUID_GET_MAX_CAPABILITIES 0x80000000 47#define CPUID_GET_MAX_CAPABILITIES 0x80000000
48#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 48#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007
@@ -86,13 +86,14 @@ struct powernow_k8_data {
86 * low fid table 86 * low fid table
87 * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry 87 * - lowest entry in the high fid table must be a <= 200MHz + 2 * the entry
88 * in the low fid table 88 * in the low fid table
89 * - the parts can only step at 200 MHz intervals, so 1.9 GHz is never valid 89 * - the parts can only step at <= 200 MHz intervals, odd fid values are
90 * supported in revision G and later revisions.
90 * - lowest frequency must be >= interprocessor hypertransport link speed 91 * - lowest frequency must be >= interprocessor hypertransport link speed
91 * (only applies to MP systems obviously) 92 * (only applies to MP systems obviously)
92 */ 93 */
93 94
94/* fids (frequency identifiers) are arranged in 2 tables - lo and hi */ 95/* fids (frequency identifiers) are arranged in 2 tables - lo and hi */
95#define LO_FID_TABLE_TOP 6 /* fid values marking the boundary */ 96#define LO_FID_TABLE_TOP 7 /* fid values marking the boundary */
96#define HI_FID_TABLE_BOTTOM 8 /* between the low and high tables */ 97#define HI_FID_TABLE_BOTTOM 8 /* between the low and high tables */
97 98
98#define LO_VCOFREQ_TABLE_TOP 1400 /* corresponding vco frequency values */ 99#define LO_VCOFREQ_TABLE_TOP 1400 /* corresponding vco frequency values */
@@ -106,7 +107,7 @@ struct powernow_k8_data {
106#define MIN_FREQ 800 /* Min and max freqs, per spec */ 107#define MIN_FREQ 800 /* Min and max freqs, per spec */
107#define MAX_FREQ 5000 108#define MAX_FREQ 5000
108 109
109#define INVALID_FID_MASK 0xffffffc1 /* not a valid fid if these bits are set */ 110#define INVALID_FID_MASK 0xffffffc0 /* not a valid fid if these bits are set */
110#define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */ 111#define INVALID_VID_MASK 0xffffffc0 /* not a valid vid if these bits are set */
111 112
112#define VID_OFF 0x3f 113#define VID_OFF 0x3f
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index edb9873e27e3..c173c0fa117a 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -35,8 +35,6 @@
35#include <asm/processor.h> 35#include <asm/processor.h>
36#include <asm/cpufeature.h> 36#include <asm/cpufeature.h>
37 37
38#include "speedstep-est-common.h"
39
40#define PFX "speedstep-centrino: " 38#define PFX "speedstep-centrino: "
41#define MAINTAINER "Jeremy Fitzhardinge <jeremy@goop.org>" 39#define MAINTAINER "Jeremy Fitzhardinge <jeremy@goop.org>"
42 40
@@ -364,22 +362,10 @@ static struct acpi_processor_performance p;
364 */ 362 */
365static int centrino_cpu_init_acpi(struct cpufreq_policy *policy) 363static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
366{ 364{
367 union acpi_object arg0 = {ACPI_TYPE_BUFFER};
368 u32 arg0_buf[3];
369 struct acpi_object_list arg_list = {1, &arg0};
370 unsigned long cur_freq; 365 unsigned long cur_freq;
371 int result = 0, i; 366 int result = 0, i;
372 unsigned int cpu = policy->cpu; 367 unsigned int cpu = policy->cpu;
373 368
374 /* _PDC settings */
375 arg0.buffer.length = 12;
376 arg0.buffer.pointer = (u8 *) arg0_buf;
377 arg0_buf[0] = ACPI_PDC_REVISION_ID;
378 arg0_buf[1] = 1;
379 arg0_buf[2] = ACPI_PDC_EST_CAPABILITY_SMP_MSR;
380
381 p.pdc = &arg_list;
382
383 /* register with ACPI core */ 369 /* register with ACPI core */
384 if (acpi_processor_register_performance(&p, cpu)) { 370 if (acpi_processor_register_performance(&p, cpu)) {
385 dprintk(KERN_INFO PFX "obtaining ACPI data failed\n"); 371 dprintk(KERN_INFO PFX "obtaining ACPI data failed\n");
@@ -493,12 +479,13 @@ static int centrino_cpu_init(struct cpufreq_policy *policy)
493 unsigned l, h; 479 unsigned l, h;
494 int ret; 480 int ret;
495 int i; 481 int i;
482 struct cpuinfo_x86 *c = &cpu_data[policy->cpu];
496 483
497 /* Only Intel makes Enhanced Speedstep-capable CPUs */ 484 /* Only Intel makes Enhanced Speedstep-capable CPUs */
498 if (cpu->x86_vendor != X86_VENDOR_INTEL || !cpu_has(cpu, X86_FEATURE_EST)) 485 if (cpu->x86_vendor != X86_VENDOR_INTEL || !cpu_has(cpu, X86_FEATURE_EST))
499 return -ENODEV; 486 return -ENODEV;
500 487
501 if (is_const_loops_cpu(policy->cpu)) { 488 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
502 centrino_driver.flags |= CPUFREQ_CONST_LOOPS; 489 centrino_driver.flags |= CPUFREQ_CONST_LOOPS;
503 } 490 }
504 491
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h b/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h
deleted file mode 100644
index 5ce995c9d866..000000000000
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-est-common.h
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * Routines common for drivers handling Enhanced Speedstep Technology
3 * Copyright (C) 2004 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
4 *
5 * Licensed under the terms of the GNU GPL License version 2 -- see
6 * COPYING for details.
7 */
8
9static inline int is_const_loops_cpu(unsigned int cpu)
10{
11 struct cpuinfo_x86 *c = cpu_data + cpu;
12
13 if (c->x86_vendor != X86_VENDOR_INTEL || !cpu_has(c, X86_FEATURE_EST))
14 return 0;
15
16 /*
17 * on P-4s, the TSC runs with constant frequency independent of cpu freq
18 * when we use EST
19 */
20 if (c->x86 == 0xf)
21 return 1;
22
23 return 0;
24}
25
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c
index 5b7d18a06afa..b425cd3d1838 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-ich.c
@@ -40,6 +40,7 @@ static struct pci_dev *speedstep_chipset_dev;
40 */ 40 */
41static unsigned int speedstep_processor = 0; 41static unsigned int speedstep_processor = 0;
42 42
43static u32 pmbase;
43 44
44/* 45/*
45 * There are only two frequency states for each processor. Values 46 * There are only two frequency states for each processor. Values
@@ -56,34 +57,47 @@ static struct cpufreq_frequency_table speedstep_freqs[] = {
56 57
57 58
58/** 59/**
59 * speedstep_set_state - set the SpeedStep state 60 * speedstep_find_register - read the PMBASE address
60 * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH)
61 * 61 *
62 * Tries to change the SpeedStep state. 62 * Returns: -ENODEV if no register could be found
63 */ 63 */
64static void speedstep_set_state (unsigned int state) 64static int speedstep_find_register (void)
65{ 65{
66 u32 pmbase; 66 if (!speedstep_chipset_dev)
67 u8 pm2_blk; 67 return -ENODEV;
68 u8 value;
69 unsigned long flags;
70
71 if (!speedstep_chipset_dev || (state > 0x1))
72 return;
73 68
74 /* get PMBASE */ 69 /* get PMBASE */
75 pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase); 70 pci_read_config_dword(speedstep_chipset_dev, 0x40, &pmbase);
76 if (!(pmbase & 0x01)) { 71 if (!(pmbase & 0x01)) {
77 printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); 72 printk(KERN_ERR "speedstep-ich: could not find speedstep register\n");
78 return; 73 return -ENODEV;
79 } 74 }
80 75
81 pmbase &= 0xFFFFFFFE; 76 pmbase &= 0xFFFFFFFE;
82 if (!pmbase) { 77 if (!pmbase) {
83 printk(KERN_ERR "speedstep-ich: could not find speedstep register\n"); 78 printk(KERN_ERR "speedstep-ich: could not find speedstep register\n");
84 return; 79 return -ENODEV;
85 } 80 }
86 81
82 dprintk("pmbase is 0x%x\n", pmbase);
83 return 0;
84}
85
86/**
87 * speedstep_set_state - set the SpeedStep state
88 * @state: new processor frequency state (SPEEDSTEP_LOW or SPEEDSTEP_HIGH)
89 *
90 * Tries to change the SpeedStep state.
91 */
92static void speedstep_set_state (unsigned int state)
93{
94 u8 pm2_blk;
95 u8 value;
96 unsigned long flags;
97
98 if (state > 0x1)
99 return;
100
87 /* Disable IRQs */ 101 /* Disable IRQs */
88 local_irq_save(flags); 102 local_irq_save(flags);
89 103
@@ -315,10 +329,11 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
315 cpus_allowed = current->cpus_allowed; 329 cpus_allowed = current->cpus_allowed;
316 set_cpus_allowed(current, policy->cpus); 330 set_cpus_allowed(current, policy->cpus);
317 331
318 /* detect low and high frequency */ 332 /* detect low and high frequency and transition latency */
319 result = speedstep_get_freqs(speedstep_processor, 333 result = speedstep_get_freqs(speedstep_processor,
320 &speedstep_freqs[SPEEDSTEP_LOW].frequency, 334 &speedstep_freqs[SPEEDSTEP_LOW].frequency,
321 &speedstep_freqs[SPEEDSTEP_HIGH].frequency, 335 &speedstep_freqs[SPEEDSTEP_HIGH].frequency,
336 &policy->cpuinfo.transition_latency,
322 &speedstep_set_state); 337 &speedstep_set_state);
323 set_cpus_allowed(current, cpus_allowed); 338 set_cpus_allowed(current, cpus_allowed);
324 if (result) 339 if (result)
@@ -335,7 +350,6 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
335 350
336 /* cpuinfo and default policy values */ 351 /* cpuinfo and default policy values */
337 policy->governor = CPUFREQ_DEFAULT_GOVERNOR; 352 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
338 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
339 policy->cur = speed; 353 policy->cur = speed;
340 354
341 result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs); 355 result = cpufreq_frequency_table_cpuinfo(policy, speedstep_freqs);
@@ -400,6 +414,9 @@ static int __init speedstep_init(void)
400 return -EINVAL; 414 return -EINVAL;
401 } 415 }
402 416
417 if (speedstep_find_register())
418 return -ENODEV;
419
403 return cpufreq_register_driver(&speedstep_driver); 420 return cpufreq_register_driver(&speedstep_driver);
404} 421}
405 422
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
index d368b3f5fce8..7c47005a1805 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.c
@@ -320,11 +320,13 @@ EXPORT_SYMBOL_GPL(speedstep_detect_processor);
320unsigned int speedstep_get_freqs(unsigned int processor, 320unsigned int speedstep_get_freqs(unsigned int processor,
321 unsigned int *low_speed, 321 unsigned int *low_speed,
322 unsigned int *high_speed, 322 unsigned int *high_speed,
323 unsigned int *transition_latency,
323 void (*set_state) (unsigned int state)) 324 void (*set_state) (unsigned int state))
324{ 325{
325 unsigned int prev_speed; 326 unsigned int prev_speed;
326 unsigned int ret = 0; 327 unsigned int ret = 0;
327 unsigned long flags; 328 unsigned long flags;
329 struct timeval tv1, tv2;
328 330
329 if ((!processor) || (!low_speed) || (!high_speed) || (!set_state)) 331 if ((!processor) || (!low_speed) || (!high_speed) || (!set_state))
330 return -EINVAL; 332 return -EINVAL;
@@ -337,7 +339,7 @@ unsigned int speedstep_get_freqs(unsigned int processor,
337 return -EIO; 339 return -EIO;
338 340
339 dprintk("previous speed is %u\n", prev_speed); 341 dprintk("previous speed is %u\n", prev_speed);
340 342
341 local_irq_save(flags); 343 local_irq_save(flags);
342 344
343 /* switch to low state */ 345 /* switch to low state */
@@ -350,8 +352,17 @@ unsigned int speedstep_get_freqs(unsigned int processor,
350 352
351 dprintk("low speed is %u\n", *low_speed); 353 dprintk("low speed is %u\n", *low_speed);
352 354
355 /* start latency measurement */
356 if (transition_latency)
357 do_gettimeofday(&tv1);
358
353 /* switch to high state */ 359 /* switch to high state */
354 set_state(SPEEDSTEP_HIGH); 360 set_state(SPEEDSTEP_HIGH);
361
362 /* end latency measurement */
363 if (transition_latency)
364 do_gettimeofday(&tv2);
365
355 *high_speed = speedstep_get_processor_frequency(processor); 366 *high_speed = speedstep_get_processor_frequency(processor);
356 if (!*high_speed) { 367 if (!*high_speed) {
357 ret = -EIO; 368 ret = -EIO;
@@ -369,6 +380,25 @@ unsigned int speedstep_get_freqs(unsigned int processor,
369 if (*high_speed != prev_speed) 380 if (*high_speed != prev_speed)
370 set_state(SPEEDSTEP_LOW); 381 set_state(SPEEDSTEP_LOW);
371 382
383 if (transition_latency) {
384 *transition_latency = (tv2.tv_sec - tv1.tv_sec) * USEC_PER_SEC +
385 tv2.tv_usec - tv1.tv_usec;
386 dprintk("transition latency is %u uSec\n", *transition_latency);
387
388 /* convert uSec to nSec and add 20% for safety reasons */
389 *transition_latency *= 1200;
390
391 /* check if the latency measurement is too high or too low
392 * and set it to a safe value (500uSec) in that case
393 */
394 if (*transition_latency > 10000000 || *transition_latency < 50000) {
395 printk (KERN_WARNING "speedstep: frequency transition measured seems out of "
396 "range (%u nSec), falling back to a safe one of %u nSec.\n",
397 *transition_latency, 500000);
398 *transition_latency = 500000;
399 }
400 }
401
372 out: 402 out:
373 local_irq_restore(flags); 403 local_irq_restore(flags);
374 return (ret); 404 return (ret);
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
index 261a2c9b7f6b..6a727fd3a77e 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-lib.h
@@ -44,4 +44,5 @@ extern unsigned int speedstep_get_processor_frequency(unsigned int processor);
44extern unsigned int speedstep_get_freqs(unsigned int processor, 44extern unsigned int speedstep_get_freqs(unsigned int processor,
45 unsigned int *low_speed, 45 unsigned int *low_speed,
46 unsigned int *high_speed, 46 unsigned int *high_speed,
47 unsigned int *transition_latency,
47 void (*set_state) (unsigned int state)); 48 void (*set_state) (unsigned int state));
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
index 2718fb6f6aba..28cc5d524afc 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-smi.c
@@ -269,6 +269,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
269 result = speedstep_get_freqs(speedstep_processor, 269 result = speedstep_get_freqs(speedstep_processor,
270 &speedstep_freqs[SPEEDSTEP_LOW].frequency, 270 &speedstep_freqs[SPEEDSTEP_LOW].frequency,
271 &speedstep_freqs[SPEEDSTEP_HIGH].frequency, 271 &speedstep_freqs[SPEEDSTEP_HIGH].frequency,
272 NULL,
272 &speedstep_set_state); 273 &speedstep_set_state);
273 274
274 if (result) { 275 if (result) {
diff --git a/arch/i386/kernel/cpu/cyrix.c b/arch/i386/kernel/cpu/cyrix.c
index ff87cc22b323..75015975d038 100644
--- a/arch/i386/kernel/cpu/cyrix.c
+++ b/arch/i386/kernel/cpu/cyrix.c
@@ -343,6 +343,31 @@ static void __init init_cyrix(struct cpuinfo_x86 *c)
343} 343}
344 344
345/* 345/*
346 * Handle National Semiconductor branded processors
347 */
348static void __devinit init_nsc(struct cpuinfo_x86 *c)
349{
350 /* There may be GX1 processors in the wild that are branded
351 * NSC and not Cyrix.
352 *
353 * This function only handles the GX processor, and kicks every
354 * thing else to the Cyrix init function above - that should
355 * cover any processors that might have been branded differently
356 * after NSC aquired Cyrix.
357 *
358 * If this breaks your GX1 horribly, please e-mail
359 * info-linux@ldcmail.amd.com to tell us.
360 */
361
362 /* Handle the GX (Formally known as the GX2) */
363
364 if (c->x86 == 5 && c->x86_model == 5)
365 display_cacheinfo(c);
366 else
367 init_cyrix(c);
368}
369
370/*
346 * Cyrix CPUs without cpuid or with cpuid not yet enabled can be detected 371 * Cyrix CPUs without cpuid or with cpuid not yet enabled can be detected
347 * by the fact that they preserve the flags across the division of 5/2. 372 * by the fact that they preserve the flags across the division of 5/2.
348 * PII and PPro exhibit this behavior too, but they have cpuid available. 373 * PII and PPro exhibit this behavior too, but they have cpuid available.
@@ -422,7 +447,7 @@ int __init cyrix_init_cpu(void)
422static struct cpu_dev nsc_cpu_dev __initdata = { 447static struct cpu_dev nsc_cpu_dev __initdata = {
423 .c_vendor = "NSC", 448 .c_vendor = "NSC",
424 .c_ident = { "Geode by NSC" }, 449 .c_ident = { "Geode by NSC" },
425 .c_init = init_cyrix, 450 .c_init = init_nsc,
426 .c_identify = generic_identify, 451 .c_identify = generic_identify,
427}; 452};
428 453
diff --git a/arch/i386/kernel/cpu/intel.c b/arch/i386/kernel/cpu/intel.c
index 5e2da704f0fa..8c0120186b9f 100644
--- a/arch/i386/kernel/cpu/intel.c
+++ b/arch/i386/kernel/cpu/intel.c
@@ -183,10 +183,13 @@ static void __devinit init_intel(struct cpuinfo_x86 *c)
183 } 183 }
184#endif 184#endif
185 185
186 if (c->x86 == 15) 186 if (c->x86 == 15)
187 set_bit(X86_FEATURE_P4, c->x86_capability); 187 set_bit(X86_FEATURE_P4, c->x86_capability);
188 if (c->x86 == 6) 188 if (c->x86 == 6)
189 set_bit(X86_FEATURE_P3, c->x86_capability); 189 set_bit(X86_FEATURE_P3, c->x86_capability);
190 if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
191 (c->x86 == 0x6 && c->x86_model >= 0x0e))
192 set_bit(X86_FEATURE_CONSTANT_TSC, c->x86_capability);
190} 193}
191 194
192 195
diff --git a/arch/i386/kernel/cpu/mtrr/changelog b/arch/i386/kernel/cpu/mtrr/changelog
deleted file mode 100644
index af1368535955..000000000000
--- a/arch/i386/kernel/cpu/mtrr/changelog
+++ /dev/null
@@ -1,229 +0,0 @@
1 ChangeLog
2
3 Prehistory Martin Tischhäuser <martin@ikcbarka.fzk.de>
4 Initial register-setting code (from proform-1.0).
5 19971216 Richard Gooch <rgooch@atnf.csiro.au>
6 Original version for /proc/mtrr interface, SMP-safe.
7 v1.0
8 19971217 Richard Gooch <rgooch@atnf.csiro.au>
9 Bug fix for ioctls()'s.
10 Added sample code in Documentation/mtrr.txt
11 v1.1
12 19971218 Richard Gooch <rgooch@atnf.csiro.au>
13 Disallow overlapping regions.
14 19971219 Jens Maurer <jmaurer@menuett.rhein-main.de>
15 Register-setting fixups.
16 v1.2
17 19971222 Richard Gooch <rgooch@atnf.csiro.au>
18 Fixups for kernel 2.1.75.
19 v1.3
20 19971229 David Wragg <dpw@doc.ic.ac.uk>
21 Register-setting fixups and conformity with Intel conventions.
22 19971229 Richard Gooch <rgooch@atnf.csiro.au>
23 Cosmetic changes and wrote this ChangeLog ;-)
24 19980106 Richard Gooch <rgooch@atnf.csiro.au>
25 Fixups for kernel 2.1.78.
26 v1.4
27 19980119 David Wragg <dpw@doc.ic.ac.uk>
28 Included passive-release enable code (elsewhere in PCI setup).
29 v1.5
30 19980131 Richard Gooch <rgooch@atnf.csiro.au>
31 Replaced global kernel lock with private spinlock.
32 v1.6
33 19980201 Richard Gooch <rgooch@atnf.csiro.au>
34 Added wait for other CPUs to complete changes.
35 v1.7
36 19980202 Richard Gooch <rgooch@atnf.csiro.au>
37 Bug fix in definition of <set_mtrr> for UP.
38 v1.8
39 19980319 Richard Gooch <rgooch@atnf.csiro.au>
40 Fixups for kernel 2.1.90.
41 19980323 Richard Gooch <rgooch@atnf.csiro.au>
42 Move SMP BIOS fixup before secondary CPUs call <calibrate_delay>
43 v1.9
44 19980325 Richard Gooch <rgooch@atnf.csiro.au>
45 Fixed test for overlapping regions: confused by adjacent regions
46 19980326 Richard Gooch <rgooch@atnf.csiro.au>
47 Added wbinvd in <set_mtrr_prepare>.
48 19980401 Richard Gooch <rgooch@atnf.csiro.au>
49 Bug fix for non-SMP compilation.
50 19980418 David Wragg <dpw@doc.ic.ac.uk>
51 Fixed-MTRR synchronisation for SMP and use atomic operations
52 instead of spinlocks.
53 19980418 Richard Gooch <rgooch@atnf.csiro.au>
54 Differentiate different MTRR register classes for BIOS fixup.
55 v1.10
56 19980419 David Wragg <dpw@doc.ic.ac.uk>
57 Bug fix in variable MTRR synchronisation.
58 v1.11
59 19980419 Richard Gooch <rgooch@atnf.csiro.au>
60 Fixups for kernel 2.1.97.
61 v1.12
62 19980421 Richard Gooch <rgooch@atnf.csiro.au>
63 Safer synchronisation across CPUs when changing MTRRs.
64 v1.13
65 19980423 Richard Gooch <rgooch@atnf.csiro.au>
66 Bugfix for SMP systems without MTRR support.
67 v1.14
68 19980427 Richard Gooch <rgooch@atnf.csiro.au>
69 Trap calls to <mtrr_add> and <mtrr_del> on non-MTRR machines.
70 v1.15
71 19980427 Richard Gooch <rgooch@atnf.csiro.au>
72 Use atomic bitops for setting SMP change mask.
73 v1.16
74 19980428 Richard Gooch <rgooch@atnf.csiro.au>
75 Removed spurious diagnostic message.
76 v1.17
77 19980429 Richard Gooch <rgooch@atnf.csiro.au>
78 Moved register-setting macros into this file.
79 Moved setup code from init/main.c to i386-specific areas.
80 v1.18
81 19980502 Richard Gooch <rgooch@atnf.csiro.au>
82 Moved MTRR detection outside conditionals in <mtrr_init>.
83 v1.19
84 19980502 Richard Gooch <rgooch@atnf.csiro.au>
85 Documentation improvement: mention Pentium II and AGP.
86 v1.20
87 19980521 Richard Gooch <rgooch@atnf.csiro.au>
88 Only manipulate interrupt enable flag on local CPU.
89 Allow enclosed uncachable regions.
90 v1.21
91 19980611 Richard Gooch <rgooch@atnf.csiro.au>
92 Always define <main_lock>.
93 v1.22
94 19980901 Richard Gooch <rgooch@atnf.csiro.au>
95 Removed module support in order to tidy up code.
96 Added sanity check for <mtrr_add>/<mtrr_del> before <mtrr_init>.
97 Created addition queue for prior to SMP commence.
98 v1.23
99 19980902 Richard Gooch <rgooch@atnf.csiro.au>
100 Ported patch to kernel 2.1.120-pre3.
101 v1.24
102 19980910 Richard Gooch <rgooch@atnf.csiro.au>
103 Removed sanity checks and addition queue: Linus prefers an OOPS.
104 v1.25
105 19981001 Richard Gooch <rgooch@atnf.csiro.au>
106 Fixed harmless compiler warning in include/asm-i386/mtrr.h
107 Fixed version numbering and history for v1.23 -> v1.24.
108 v1.26
109 19990118 Richard Gooch <rgooch@atnf.csiro.au>
110 Added devfs support.
111 v1.27
112 19990123 Richard Gooch <rgooch@atnf.csiro.au>
113 Changed locking to spin with reschedule.
114 Made use of new <smp_call_function>.
115 v1.28
116 19990201 Zoltán Böszörményi <zboszor@mail.externet.hu>
117 Extended the driver to be able to use Cyrix style ARRs.
118 19990204 Richard Gooch <rgooch@atnf.csiro.au>
119 Restructured Cyrix support.
120 v1.29
121 19990204 Zoltán Böszörményi <zboszor@mail.externet.hu>
122 Refined ARR support: enable MAPEN in set_mtrr_prepare()
123 and disable MAPEN in set_mtrr_done().
124 19990205 Richard Gooch <rgooch@atnf.csiro.au>
125 Minor cleanups.
126 v1.30
127 19990208 Zoltán Böszörményi <zboszor@mail.externet.hu>
128 Protect plain 6x86s (and other processors without the
129 Page Global Enable feature) against accessing CR4 in
130 set_mtrr_prepare() and set_mtrr_done().
131 19990210 Richard Gooch <rgooch@atnf.csiro.au>
132 Turned <set_mtrr_up> and <get_mtrr> into function pointers.
133 v1.31
134 19990212 Zoltán Böszörményi <zboszor@mail.externet.hu>
135 Major rewrite of cyrix_arr_init(): do not touch ARRs,
136 leave them as the BIOS have set them up.
137 Enable usage of all 8 ARRs.
138 Avoid multiplications by 3 everywhere and other
139 code clean ups/speed ups.
140 19990213 Zoltán Böszörményi <zboszor@mail.externet.hu>
141 Set up other Cyrix processors identical to the boot cpu.
142 Since Cyrix don't support Intel APIC, this is l'art pour l'art.
143 Weigh ARRs by size:
144 If size <= 32M is given, set up ARR# we were given.
145 If size > 32M is given, set up ARR7 only if it is free,
146 fail otherwise.
147 19990214 Zoltán Böszörményi <zboszor@mail.externet.hu>
148 Also check for size >= 256K if we are to set up ARR7,
149 mtrr_add() returns the value it gets from set_mtrr()
150 19990218 Zoltán Böszörményi <zboszor@mail.externet.hu>
151 Remove Cyrix "coma bug" workaround from here.
152 Moved to linux/arch/i386/kernel/setup.c and
153 linux/include/asm-i386/bugs.h
154 19990228 Richard Gooch <rgooch@atnf.csiro.au>
155 Added MTRRIOC_KILL_ENTRY ioctl(2)
156 Trap for counter underflow in <mtrr_file_del>.
157 Trap for 4 MiB aligned regions for PPro, stepping <= 7.
158 19990301 Richard Gooch <rgooch@atnf.csiro.au>
159 Created <get_free_region> hook.
160 19990305 Richard Gooch <rgooch@atnf.csiro.au>
161 Temporarily disable AMD support now MTRR capability flag is set.
162 v1.32
163 19990308 Zoltán Böszörményi <zboszor@mail.externet.hu>
164 Adjust my changes (19990212-19990218) to Richard Gooch's
165 latest changes. (19990228-19990305)
166 v1.33
167 19990309 Richard Gooch <rgooch@atnf.csiro.au>
168 Fixed typo in <printk> message.
169 19990310 Richard Gooch <rgooch@atnf.csiro.au>
170 Support K6-II/III based on Alan Cox's <alan@redhat.com> patches.
171 v1.34
172 19990511 Bart Hartgers <bart@etpmod.phys.tue.nl>
173 Support Centaur C6 MCR's.
174 19990512 Richard Gooch <rgooch@atnf.csiro.au>
175 Minor cleanups.
176 v1.35
177 19990707 Zoltán Böszörményi <zboszor@mail.externet.hu>
178 Check whether ARR3 is protected in cyrix_get_free_region()
179 and mtrr_del(). The code won't attempt to delete or change it
180 from now on if the BIOS protected ARR3. It silently skips ARR3
181 in cyrix_get_free_region() or returns with an error code from
182 mtrr_del().
183 19990711 Zoltán Böszörményi <zboszor@mail.externet.hu>
184 Reset some bits in the CCRs in cyrix_arr_init() to disable SMM
185 if ARR3 isn't protected. This is needed because if SMM is active
186 and ARR3 isn't protected then deleting and setting ARR3 again
187 may lock up the processor. With SMM entirely disabled, it does
188 not happen.
189 19990812 Zoltán Böszörményi <zboszor@mail.externet.hu>
190 Rearrange switch() statements so the driver accomodates to
191 the fact that the AMD Athlon handles its MTRRs the same way
192 as Intel does.
193 19990814 Zoltán Böszörményi <zboszor@mail.externet.hu>
194 Double check for Intel in mtrr_add()'s big switch() because
195 that revision check is only valid for Intel CPUs.
196 19990819 Alan Cox <alan@redhat.com>
197 Tested Zoltan's changes on a pre production Athlon - 100%
198 success.
199 19991008 Manfred Spraul <manfreds@colorfullife.com>
200 replaced spin_lock_reschedule() with a normal semaphore.
201 v1.36
202 20000221 Richard Gooch <rgooch@atnf.csiro.au>
203 Compile fix if procfs and devfs not enabled.
204 Formatting changes.
205 v1.37
206 20001109 H. Peter Anvin <hpa@zytor.com>
207 Use the new centralized CPU feature detects.
208
209 v1.38
210 20010309 Dave Jones <davej@suse.de>
211 Add support for Cyrix III.
212
213 v1.39
214 20010312 Dave Jones <davej@suse.de>
215 Ugh, I broke AMD support.
216 Reworked fix by Troels Walsted Hansen <troels@thule.no>
217
218 v1.40
219 20010327 Dave Jones <davej@suse.de>
220 Adapted Cyrix III support to include VIA C3.
221
222 v2.0
223 20020306 Patrick Mochel <mochel@osdl.org>
224 Split mtrr.c -> mtrr/*.c
225 Converted to Linux Kernel Coding Style
226 Fixed several minor nits in form
227 Moved some SMP-only functions out, so they can be used
228 for power management in the future.
229 TODO: Fix user interface cruft.
diff --git a/arch/i386/kernel/cpu/mtrr/if.c b/arch/i386/kernel/cpu/mtrr/if.c
index cf39e205d33c..5ac051bb9d55 100644
--- a/arch/i386/kernel/cpu/mtrr/if.c
+++ b/arch/i386/kernel/cpu/mtrr/if.c
@@ -1,5 +1,6 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/proc_fs.h> 2#include <linux/proc_fs.h>
3#include <linux/capability.h>
3#include <linux/ctype.h> 4#include <linux/ctype.h>
4#include <linux/module.h> 5#include <linux/module.h>
5#include <linux/seq_file.h> 6#include <linux/seq_file.h>
diff --git a/arch/i386/kernel/cpu/proc.c b/arch/i386/kernel/cpu/proc.c
index e7921315ae9d..89a85af33d28 100644
--- a/arch/i386/kernel/cpu/proc.c
+++ b/arch/i386/kernel/cpu/proc.c
@@ -3,6 +3,7 @@
3#include <linux/string.h> 3#include <linux/string.h>
4#include <asm/semaphore.h> 4#include <asm/semaphore.h>
5#include <linux/seq_file.h> 5#include <linux/seq_file.h>
6#include <linux/cpufreq.h>
6 7
7/* 8/*
8 * Get CPU information for use by the procfs. 9 * Get CPU information for use by the procfs.
@@ -28,7 +29,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
28 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 29 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
29 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, 30 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
30 NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL, 31 NULL, NULL, NULL, "mp", "nx", NULL, "mmxext", NULL,
31 NULL, "fxsr_opt", NULL, NULL, NULL, "lm", "3dnowext", "3dnow", 32 NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow",
32 33
33 /* Transmeta-defined */ 34 /* Transmeta-defined */
34 "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, 35 "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
@@ -39,7 +40,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
39 /* Other (Linux-defined) */ 40 /* Other (Linux-defined) */
40 "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr", 41 "cxmmx", "k6_mtrr", "cyrix_arr", "centaur_mcr",
41 NULL, NULL, NULL, NULL, 42 NULL, NULL, NULL, NULL,
42 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 43 "constant_tsc", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
43 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 44 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
44 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 45 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
45 46
@@ -56,11 +57,21 @@ static int show_cpuinfo(struct seq_file *m, void *v)
56 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 57 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
57 58
58 /* AMD-defined (#2) */ 59 /* AMD-defined (#2) */
59 "lahf_lm", "cmp_legacy", NULL, NULL, NULL, NULL, NULL, NULL, 60 "lahf_lm", "cmp_legacy", "svm", NULL, "cr8legacy", NULL, NULL, NULL,
60 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 61 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
61 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 62 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
62 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 63 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
63 }; 64 };
65 static char *x86_power_flags[] = {
66 "ts", /* temperature sensor */
67 "fid", /* frequency id control */
68 "vid", /* voltage id control */
69 "ttp", /* thermal trip */
70 "tm",
71 "stc",
72 NULL,
73 /* nothing */ /* constant_tsc - moved to flags */
74 };
64 struct cpuinfo_x86 *c = v; 75 struct cpuinfo_x86 *c = v;
65 int i, n = c - cpu_data; 76 int i, n = c - cpu_data;
66 int fpu_exception; 77 int fpu_exception;
@@ -86,8 +97,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
86 seq_printf(m, "stepping\t: unknown\n"); 97 seq_printf(m, "stepping\t: unknown\n");
87 98
88 if ( cpu_has(c, X86_FEATURE_TSC) ) { 99 if ( cpu_has(c, X86_FEATURE_TSC) ) {
100 unsigned int freq = cpufreq_quick_get(n);
101 if (!freq)
102 freq = cpu_khz;
89 seq_printf(m, "cpu MHz\t\t: %u.%03u\n", 103 seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
90 cpu_khz / 1000, (cpu_khz % 1000)); 104 freq / 1000, (freq % 1000));
91 } 105 }
92 106
93 /* Cache size */ 107 /* Cache size */
@@ -127,6 +141,17 @@ static int show_cpuinfo(struct seq_file *m, void *v)
127 x86_cap_flags[i] != NULL ) 141 x86_cap_flags[i] != NULL )
128 seq_printf(m, " %s", x86_cap_flags[i]); 142 seq_printf(m, " %s", x86_cap_flags[i]);
129 143
144 for (i = 0; i < 32; i++)
145 if (c->x86_power & (1 << i)) {
146 if (i < ARRAY_SIZE(x86_power_flags) &&
147 x86_power_flags[i])
148 seq_printf(m, "%s%s",
149 x86_power_flags[i][0]?" ":"",
150 x86_power_flags[i]);
151 else
152 seq_printf(m, " [%d]", i);
153 }
154
130 seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n", 155 seq_printf(m, "\nbogomips\t: %lu.%02lu\n\n",
131 c->loops_per_jiffy/(500000/HZ), 156 c->loops_per_jiffy/(500000/HZ),
132 (c->loops_per_jiffy/(5000/HZ)) % 100); 157 (c->loops_per_jiffy/(5000/HZ)) % 100);
diff --git a/arch/i386/kernel/cpuid.c b/arch/i386/kernel/cpuid.c
index 13bae799e626..006141d1c12a 100644
--- a/arch/i386/kernel/cpuid.c
+++ b/arch/i386/kernel/cpuid.c
@@ -117,14 +117,13 @@ static ssize_t cpuid_read(struct file *file, char __user *buf,
117{ 117{
118 char __user *tmp = buf; 118 char __user *tmp = buf;
119 u32 data[4]; 119 u32 data[4];
120 size_t rv;
121 u32 reg = *ppos; 120 u32 reg = *ppos;
122 int cpu = iminor(file->f_dentry->d_inode); 121 int cpu = iminor(file->f_dentry->d_inode);
123 122
124 if (count % 16) 123 if (count % 16)
125 return -EINVAL; /* Invalid chunk size */ 124 return -EINVAL; /* Invalid chunk size */
126 125
127 for (rv = 0; count; count -= 16) { 126 for (; count; count -= 16) {
128 do_cpuid(cpu, reg, data); 127 do_cpuid(cpu, reg, data);
129 if (copy_to_user(tmp, &data, 16)) 128 if (copy_to_user(tmp, &data, 16))
130 return -EFAULT; 129 return -EFAULT;
diff --git a/arch/i386/kernel/crash.c b/arch/i386/kernel/crash.c
index 0248e084017c..d49dbe8dc96b 100644
--- a/arch/i386/kernel/crash.c
+++ b/arch/i386/kernel/crash.c
@@ -25,7 +25,6 @@
25#include <mach_ipi.h> 25#include <mach_ipi.h>
26 26
27 27
28note_buf_t crash_notes[NR_CPUS];
29/* This keeps a track of which one is crashing cpu. */ 28/* This keeps a track of which one is crashing cpu. */
30static int crashing_cpu; 29static int crashing_cpu;
31 30
@@ -72,7 +71,9 @@ static void crash_save_this_cpu(struct pt_regs *regs, int cpu)
72 * squirrelled away. ELF notes happen to provide 71 * squirrelled away. ELF notes happen to provide
73 * all of that that no need to invent something new. 72 * all of that that no need to invent something new.
74 */ 73 */
75 buf = &crash_notes[cpu][0]; 74 buf = (u32*)per_cpu_ptr(crash_notes, cpu);
75 if (!buf)
76 return;
76 memset(&prstatus, 0, sizeof(prstatus)); 77 memset(&prstatus, 0, sizeof(prstatus));
77 prstatus.pr_pid = current->pid; 78 prstatus.pr_pid = current->pid;
78 elf_core_copy_regs(&prstatus.pr_reg, regs); 79 elf_core_copy_regs(&prstatus.pr_reg, regs);
@@ -81,51 +82,12 @@ static void crash_save_this_cpu(struct pt_regs *regs, int cpu)
81 final_note(buf); 82 final_note(buf);
82} 83}
83 84
84static void crash_get_current_regs(struct pt_regs *regs) 85static void crash_save_self(struct pt_regs *regs)
85{
86 __asm__ __volatile__("movl %%ebx,%0" : "=m"(regs->ebx));
87 __asm__ __volatile__("movl %%ecx,%0" : "=m"(regs->ecx));
88 __asm__ __volatile__("movl %%edx,%0" : "=m"(regs->edx));
89 __asm__ __volatile__("movl %%esi,%0" : "=m"(regs->esi));
90 __asm__ __volatile__("movl %%edi,%0" : "=m"(regs->edi));
91 __asm__ __volatile__("movl %%ebp,%0" : "=m"(regs->ebp));
92 __asm__ __volatile__("movl %%eax,%0" : "=m"(regs->eax));
93 __asm__ __volatile__("movl %%esp,%0" : "=m"(regs->esp));
94 __asm__ __volatile__("movw %%ss, %%ax;" :"=a"(regs->xss));
95 __asm__ __volatile__("movw %%cs, %%ax;" :"=a"(regs->xcs));
96 __asm__ __volatile__("movw %%ds, %%ax;" :"=a"(regs->xds));
97 __asm__ __volatile__("movw %%es, %%ax;" :"=a"(regs->xes));
98 __asm__ __volatile__("pushfl; popl %0" :"=m"(regs->eflags));
99
100 regs->eip = (unsigned long)current_text_addr();
101}
102
103/* CPU does not save ss and esp on stack if execution is already
104 * running in kernel mode at the time of NMI occurrence. This code
105 * fixes it.
106 */
107static void crash_setup_regs(struct pt_regs *newregs, struct pt_regs *oldregs)
108{
109 memcpy(newregs, oldregs, sizeof(*newregs));
110 newregs->esp = (unsigned long)&(oldregs->esp);
111 __asm__ __volatile__("xorl %eax, %eax;");
112 __asm__ __volatile__ ("movw %%ss, %%ax;" :"=a"(newregs->xss));
113}
114
115/* We may have saved_regs from where the error came from
116 * or it is NULL if via a direct panic().
117 */
118static void crash_save_self(struct pt_regs *saved_regs)
119{ 86{
120 struct pt_regs regs;
121 int cpu; 87 int cpu;
122 88
123 cpu = smp_processor_id(); 89 cpu = smp_processor_id();
124 if (saved_regs) 90 crash_save_this_cpu(regs, cpu);
125 crash_setup_regs(&regs, saved_regs);
126 else
127 crash_get_current_regs(&regs);
128 crash_save_this_cpu(&regs, cpu);
129} 91}
130 92
131#ifdef CONFIG_SMP 93#ifdef CONFIG_SMP
@@ -144,7 +106,7 @@ static int crash_nmi_callback(struct pt_regs *regs, int cpu)
144 local_irq_disable(); 106 local_irq_disable();
145 107
146 if (!user_mode(regs)) { 108 if (!user_mode(regs)) {
147 crash_setup_regs(&fixed_regs, regs); 109 crash_fixup_ss_esp(&fixed_regs, regs);
148 regs = &fixed_regs; 110 regs = &fixed_regs;
149 } 111 }
150 crash_save_this_cpu(regs, cpu); 112 crash_save_this_cpu(regs, cpu);
diff --git a/arch/i386/kernel/crash_dump.c b/arch/i386/kernel/crash_dump.c
new file mode 100644
index 000000000000..3f532df488bc
--- /dev/null
+++ b/arch/i386/kernel/crash_dump.c
@@ -0,0 +1,74 @@
1/*
2 * kernel/crash_dump.c - Memory preserving reboot related code.
3 *
4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
5 * Copyright (C) IBM Corporation, 2004. All rights reserved
6 */
7
8#include <linux/errno.h>
9#include <linux/highmem.h>
10#include <linux/crash_dump.h>
11
12#include <asm/uaccess.h>
13
14static void *kdump_buf_page;
15
16/**
17 * copy_oldmem_page - copy one page from "oldmem"
18 * @pfn: page frame number to be copied
19 * @buf: target memory address for the copy; this can be in kernel address
20 * space or user address space (see @userbuf)
21 * @csize: number of bytes to copy
22 * @offset: offset in bytes into the page (based on pfn) to begin the copy
23 * @userbuf: if set, @buf is in user address space, use copy_to_user(),
24 * otherwise @buf is in kernel address space, use memcpy().
25 *
26 * Copy a page from "oldmem". For this page, there is no pte mapped
27 * in the current kernel. We stitch up a pte, similar to kmap_atomic.
28 *
29 * Calling copy_to_user() in atomic context is not desirable. Hence first
30 * copying the data to a pre-allocated kernel page and then copying to user
31 * space in non-atomic context.
32 */
33ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
34 size_t csize, unsigned long offset, int userbuf)
35{
36 void *vaddr;
37
38 if (!csize)
39 return 0;
40
41 vaddr = kmap_atomic_pfn(pfn, KM_PTE0);
42
43 if (!userbuf) {
44 memcpy(buf, (vaddr + offset), csize);
45 kunmap_atomic(vaddr, KM_PTE0);
46 } else {
47 if (!kdump_buf_page) {
48 printk(KERN_WARNING "Kdump: Kdump buffer page not"
49 " allocated\n");
50 return -EFAULT;
51 }
52 copy_page(kdump_buf_page, vaddr);
53 kunmap_atomic(vaddr, KM_PTE0);
54 if (copy_to_user(buf, (kdump_buf_page + offset), csize))
55 return -EFAULT;
56 }
57
58 return csize;
59}
60
61static int __init kdump_buf_page_init(void)
62{
63 int ret = 0;
64
65 kdump_buf_page = kmalloc(PAGE_SIZE, GFP_KERNEL);
66 if (!kdump_buf_page) {
67 printk(KERN_WARNING "Kdump: Failed to allocate kdump buffer"
68 " page\n");
69 ret = -ENOMEM;
70 }
71
72 return ret;
73}
74arch_initcall(kdump_buf_page_init);
diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c
index 58516e2ac172..6a93d75db431 100644
--- a/arch/i386/kernel/dmi_scan.c
+++ b/arch/i386/kernel/dmi_scan.c
@@ -4,7 +4,7 @@
4#include <linux/module.h> 4#include <linux/module.h>
5#include <linux/dmi.h> 5#include <linux/dmi.h>
6#include <linux/bootmem.h> 6#include <linux/bootmem.h>
7 7#include <linux/slab.h>
8 8
9static char * __init dmi_string(struct dmi_header *dm, u8 s) 9static char * __init dmi_string(struct dmi_header *dm, u8 s)
10{ 10{
@@ -19,7 +19,7 @@ static char * __init dmi_string(struct dmi_header *dm, u8 s)
19 } 19 }
20 20
21 if (*bp != 0) { 21 if (*bp != 0) {
22 str = alloc_bootmem(strlen(bp) + 1); 22 str = dmi_alloc(strlen(bp) + 1);
23 if (str != NULL) 23 if (str != NULL)
24 strcpy(str, bp); 24 strcpy(str, bp);
25 else 25 else
@@ -40,7 +40,7 @@ static int __init dmi_table(u32 base, int len, int num,
40 u8 *buf, *data; 40 u8 *buf, *data;
41 int i = 0; 41 int i = 0;
42 42
43 buf = bt_ioremap(base, len); 43 buf = dmi_ioremap(base, len);
44 if (buf == NULL) 44 if (buf == NULL)
45 return -1; 45 return -1;
46 46
@@ -65,7 +65,7 @@ static int __init dmi_table(u32 base, int len, int num,
65 data += 2; 65 data += 2;
66 i++; 66 i++;
67 } 67 }
68 bt_iounmap(buf, len); 68 dmi_iounmap(buf, len);
69 return 0; 69 return 0;
70} 70}
71 71
@@ -112,7 +112,7 @@ static void __init dmi_save_devices(struct dmi_header *dm)
112 if ((*d & 0x80) == 0) 112 if ((*d & 0x80) == 0)
113 continue; 113 continue;
114 114
115 dev = alloc_bootmem(sizeof(*dev)); 115 dev = dmi_alloc(sizeof(*dev));
116 if (!dev) { 116 if (!dev) {
117 printk(KERN_ERR "dmi_save_devices: out of memory.\n"); 117 printk(KERN_ERR "dmi_save_devices: out of memory.\n");
118 break; 118 break;
@@ -131,7 +131,7 @@ static void __init dmi_save_ipmi_device(struct dmi_header *dm)
131 struct dmi_device *dev; 131 struct dmi_device *dev;
132 void * data; 132 void * data;
133 133
134 data = alloc_bootmem(dm->length); 134 data = dmi_alloc(dm->length);
135 if (data == NULL) { 135 if (data == NULL) {
136 printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); 136 printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
137 return; 137 return;
@@ -139,7 +139,7 @@ static void __init dmi_save_ipmi_device(struct dmi_header *dm)
139 139
140 memcpy(data, dm, dm->length); 140 memcpy(data, dm, dm->length);
141 141
142 dev = alloc_bootmem(sizeof(*dev)); 142 dev = dmi_alloc(sizeof(*dev));
143 if (!dev) { 143 if (!dev) {
144 printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n"); 144 printk(KERN_ERR "dmi_save_ipmi_device: out of memory.\n");
145 return; 145 return;
@@ -221,7 +221,7 @@ void __init dmi_scan_machine(void)
221 } 221 }
222 } 222 }
223 223
224out: printk(KERN_INFO "DMI not present.\n"); 224out: printk(KERN_INFO "DMI not present or invalid.\n");
225} 225}
226 226
227 227
diff --git a/arch/i386/kernel/entry.S b/arch/i386/kernel/entry.S
index e50b93155249..4d704724b2f5 100644
--- a/arch/i386/kernel/entry.S
+++ b/arch/i386/kernel/entry.S
@@ -323,6 +323,7 @@ work_notifysig: # deal with pending signals and
323 323
324 ALIGN 324 ALIGN
325work_notifysig_v86: 325work_notifysig_v86:
326#ifdef CONFIG_VM86
326 pushl %ecx # save ti_flags for do_notify_resume 327 pushl %ecx # save ti_flags for do_notify_resume
327 call save_v86_state # %eax contains pt_regs pointer 328 call save_v86_state # %eax contains pt_regs pointer
328 popl %ecx 329 popl %ecx
@@ -330,6 +331,7 @@ work_notifysig_v86:
330 xorl %edx, %edx 331 xorl %edx, %edx
331 call do_notify_resume 332 call do_notify_resume
332 jmp resume_userspace 333 jmp resume_userspace
334#endif
333 335
334 # perform syscall exit tracing 336 # perform syscall exit tracing
335 ALIGN 337 ALIGN
@@ -657,6 +659,7 @@ ENTRY(spurious_interrupt_bug)
657 pushl $do_spurious_interrupt_bug 659 pushl $do_spurious_interrupt_bug
658 jmp error_code 660 jmp error_code
659 661
662.section .rodata,"a"
660#include "syscall_table.S" 663#include "syscall_table.S"
661 664
662syscall_table_size=(.-sys_call_table) 665syscall_table_size=(.-sys_call_table)
diff --git a/arch/i386/kernel/head.S b/arch/i386/kernel/head.S
index e437fb367498..5884469f6bfe 100644
--- a/arch/i386/kernel/head.S
+++ b/arch/i386/kernel/head.S
@@ -504,19 +504,24 @@ ENTRY(cpu_gdt_table)
504 .quad 0x0000000000000000 /* 0x80 TSS descriptor */ 504 .quad 0x0000000000000000 /* 0x80 TSS descriptor */
505 .quad 0x0000000000000000 /* 0x88 LDT descriptor */ 505 .quad 0x0000000000000000 /* 0x88 LDT descriptor */
506 506
507 /* Segments used for calling PnP BIOS */ 507 /*
508 .quad 0x00c09a0000000000 /* 0x90 32-bit code */ 508 * Segments used for calling PnP BIOS have byte granularity.
509 .quad 0x00809a0000000000 /* 0x98 16-bit code */ 509 * They code segments and data segments have fixed 64k limits,
510 .quad 0x0080920000000000 /* 0xa0 16-bit data */ 510 * the transfer segment sizes are set at run time.
511 .quad 0x0080920000000000 /* 0xa8 16-bit data */ 511 */
512 .quad 0x0080920000000000 /* 0xb0 16-bit data */ 512 .quad 0x00409a000000ffff /* 0x90 32-bit code */
513 .quad 0x00009a000000ffff /* 0x98 16-bit code */
514 .quad 0x000092000000ffff /* 0xa0 16-bit data */
515 .quad 0x0000920000000000 /* 0xa8 16-bit data */
516 .quad 0x0000920000000000 /* 0xb0 16-bit data */
517
513 /* 518 /*
514 * The APM segments have byte granularity and their bases 519 * The APM segments have byte granularity and their bases
515 * and limits are set at run time. 520 * are set at run time. All have 64k limits.
516 */ 521 */
517 .quad 0x00409a0000000000 /* 0xb8 APM CS code */ 522 .quad 0x00409a000000ffff /* 0xb8 APM CS code */
518 .quad 0x00009a0000000000 /* 0xc0 APM CS 16 code (16 bit) */ 523 .quad 0x00009a000000ffff /* 0xc0 APM CS 16 code (16 bit) */
519 .quad 0x0040920000000000 /* 0xc8 APM DS data */ 524 .quad 0x004092000000ffff /* 0xc8 APM DS data */
520 525
521 .quad 0x0000920000000000 /* 0xd0 - ESPFIX 16-bit SS */ 526 .quad 0x0000920000000000 /* 0xd0 - ESPFIX 16-bit SS */
522 .quad 0x0000000000000000 /* 0xd8 - unused */ 527 .quad 0x0000000000000000 /* 0xd8 - unused */
@@ -525,3 +530,5 @@ ENTRY(cpu_gdt_table)
525 .quad 0x0000000000000000 /* 0xf0 - unused */ 530 .quad 0x0000000000000000 /* 0xf0 - unused */
526 .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */ 531 .quad 0x0000000000000000 /* 0xf8 - GDT entry 31: double-fault TSS */
527 532
533 /* Be sure this is zeroed to avoid false validations in Xen */
534 .fill PAGE_SIZE_asm / 8 - GDT_ENTRIES,8,0
diff --git a/arch/i386/kernel/i386_ksyms.c b/arch/i386/kernel/i386_ksyms.c
index 180f070d03cb..3999bec50c33 100644
--- a/arch/i386/kernel/i386_ksyms.c
+++ b/arch/i386/kernel/i386_ksyms.c
@@ -3,8 +3,7 @@
3#include <asm/checksum.h> 3#include <asm/checksum.h>
4#include <asm/desc.h> 4#include <asm/desc.h>
5 5
6/* This is definitely a GPL-only symbol */ 6EXPORT_SYMBOL_GPL(cpu_gdt_descr);
7EXPORT_SYMBOL_GPL(cpu_gdt_table);
8 7
9EXPORT_SYMBOL(__down_failed); 8EXPORT_SYMBOL(__down_failed);
10EXPORT_SYMBOL(__down_failed_interruptible); 9EXPORT_SYMBOL(__down_failed_interruptible);
diff --git a/arch/i386/kernel/init_task.c b/arch/i386/kernel/init_task.c
index 9caa8e8db80c..cff95d10a4d8 100644
--- a/arch/i386/kernel/init_task.c
+++ b/arch/i386/kernel/init_task.c
@@ -42,5 +42,5 @@ EXPORT_SYMBOL(init_task);
42 * per-CPU TSS segments. Threads are completely 'soft' on Linux, 42 * per-CPU TSS segments. Threads are completely 'soft' on Linux,
43 * no more per-task TSS's. 43 * no more per-task TSS's.
44 */ 44 */
45DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp = INIT_TSS; 45DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS;
46 46
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 22c8675c79f4..f2dd218d88cb 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -1649,7 +1649,7 @@ static void __init enable_IO_APIC(void)
1649 for(apic = 0; apic < nr_ioapics; apic++) { 1649 for(apic = 0; apic < nr_ioapics; apic++) {
1650 int pin; 1650 int pin;
1651 /* See if any of the pins is in ExtINT mode */ 1651 /* See if any of the pins is in ExtINT mode */
1652 for(pin = 0; pin < nr_ioapic_registers[i]; pin++) { 1652 for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
1653 struct IO_APIC_route_entry entry; 1653 struct IO_APIC_route_entry entry;
1654 spin_lock_irqsave(&ioapic_lock, flags); 1654 spin_lock_irqsave(&ioapic_lock, flags);
1655 *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin); 1655 *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
@@ -1722,8 +1722,8 @@ void disable_IO_APIC(void)
1722 entry.dest_mode = 0; /* Physical */ 1722 entry.dest_mode = 0; /* Physical */
1723 entry.delivery_mode = dest_ExtINT; /* ExtInt */ 1723 entry.delivery_mode = dest_ExtINT; /* ExtInt */
1724 entry.vector = 0; 1724 entry.vector = 0;
1725 entry.dest.physical.physical_dest = 0; 1725 entry.dest.physical.physical_dest =
1726 1726 GET_APIC_ID(apic_read(APIC_ID));
1727 1727
1728 /* 1728 /*
1729 * Add it to the IO-APIC irq-routing table: 1729 * Add it to the IO-APIC irq-routing table:
diff --git a/arch/i386/kernel/ioport.c b/arch/i386/kernel/ioport.c
index b59a34dbe262..79026f026b85 100644
--- a/arch/i386/kernel/ioport.c
+++ b/arch/i386/kernel/ioport.c
@@ -7,6 +7,7 @@
7 7
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/capability.h>
10#include <linux/errno.h> 11#include <linux/errno.h>
11#include <linux/types.h> 12#include <linux/types.h>
12#include <linux/ioport.h> 13#include <linux/ioport.h>
diff --git a/arch/i386/kernel/irq.c b/arch/i386/kernel/irq.c
index 1a201a932865..f3a9c78c4a24 100644
--- a/arch/i386/kernel/irq.c
+++ b/arch/i386/kernel/irq.c
@@ -19,7 +19,7 @@
19#include <linux/cpu.h> 19#include <linux/cpu.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21 21
22DEFINE_PER_CPU(irq_cpustat_t, irq_stat) ____cacheline_maxaligned_in_smp; 22DEFINE_PER_CPU(irq_cpustat_t, irq_stat) ____cacheline_internodealigned_in_smp;
23EXPORT_PER_CPU_SYMBOL(irq_stat); 23EXPORT_PER_CPU_SYMBOL(irq_stat);
24 24
25#ifndef CONFIG_X86_LOCAL_APIC 25#ifndef CONFIG_X86_LOCAL_APIC
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index 32b0c24ab9a6..6483eeb1a4e8 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -58,13 +58,9 @@ static inline int is_IF_modifier(kprobe_opcode_t opcode)
58 58
59int __kprobes arch_prepare_kprobe(struct kprobe *p) 59int __kprobes arch_prepare_kprobe(struct kprobe *p)
60{ 60{
61 return 0;
62}
63
64void __kprobes arch_copy_kprobe(struct kprobe *p)
65{
66 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); 61 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
67 p->opcode = *p->addr; 62 p->opcode = *p->addr;
63 return 0;
68} 64}
69 65
70void __kprobes arch_arm_kprobe(struct kprobe *p) 66void __kprobes arch_arm_kprobe(struct kprobe *p)
@@ -81,10 +77,6 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
81 (unsigned long) p->addr + sizeof(kprobe_opcode_t)); 77 (unsigned long) p->addr + sizeof(kprobe_opcode_t));
82} 78}
83 79
84void __kprobes arch_remove_kprobe(struct kprobe *p)
85{
86}
87
88static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) 80static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
89{ 81{
90 kcb->prev_kprobe.kp = kprobe_running(); 82 kcb->prev_kprobe.kp = kprobe_running();
@@ -191,11 +183,24 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
191 */ 183 */
192 save_previous_kprobe(kcb); 184 save_previous_kprobe(kcb);
193 set_current_kprobe(p, regs, kcb); 185 set_current_kprobe(p, regs, kcb);
194 p->nmissed++; 186 kprobes_inc_nmissed_count(p);
195 prepare_singlestep(p, regs); 187 prepare_singlestep(p, regs);
196 kcb->kprobe_status = KPROBE_REENTER; 188 kcb->kprobe_status = KPROBE_REENTER;
197 return 1; 189 return 1;
198 } else { 190 } else {
191 if (regs->eflags & VM_MASK) {
192 /* We are in virtual-8086 mode. Return 0 */
193 goto no_kprobe;
194 }
195 if (*addr != BREAKPOINT_INSTRUCTION) {
196 /* The breakpoint instruction was removed by
197 * another cpu right after we hit, no further
198 * handling of this interrupt is appropriate
199 */
200 regs->eip -= sizeof(kprobe_opcode_t);
201 ret = 1;
202 goto no_kprobe;
203 }
199 p = __get_cpu_var(current_kprobe); 204 p = __get_cpu_var(current_kprobe);
200 if (p->break_handler && p->break_handler(p, regs)) { 205 if (p->break_handler && p->break_handler(p, regs)) {
201 goto ss_probe; 206 goto ss_probe;
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index 165f13158c60..d3fdf0057d82 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -70,6 +70,7 @@
70 */ 70 */
71 71
72//#define DEBUG /* pr_debug */ 72//#define DEBUG /* pr_debug */
73#include <linux/capability.h>
73#include <linux/kernel.h> 74#include <linux/kernel.h>
74#include <linux/init.h> 75#include <linux/init.h>
75#include <linux/sched.h> 76#include <linux/sched.h>
@@ -165,7 +166,7 @@ static void collect_cpu_info (void *unused)
165 166
166 wrmsr(MSR_IA32_UCODE_REV, 0, 0); 167 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
167 /* see notes above for revision 1.07. Apparent chip bug */ 168 /* see notes above for revision 1.07. Apparent chip bug */
168 serialize_cpu(); 169 sync_core();
169 /* get the current revision from MSR 0x8B */ 170 /* get the current revision from MSR 0x8B */
170 rdmsr(MSR_IA32_UCODE_REV, val[0], uci->rev); 171 rdmsr(MSR_IA32_UCODE_REV, val[0], uci->rev);
171 pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n", 172 pr_debug("microcode: collect_cpu_info : sig=0x%x, pf=0x%x, rev=0x%x\n",
@@ -379,7 +380,7 @@ static void do_update_one (void * unused)
379 wrmsr(MSR_IA32_UCODE_REV, 0, 0); 380 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
380 381
381 /* see notes above for revision 1.07. Apparent chip bug */ 382 /* see notes above for revision 1.07. Apparent chip bug */
382 serialize_cpu(); 383 sync_core();
383 384
384 /* get the current revision from MSR 0x8B */ 385 /* get the current revision from MSR 0x8B */
385 rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]); 386 rdmsr(MSR_IA32_UCODE_REV, val[0], val[1]);
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c
index 1ca5269b1e86..0102f3d50e57 100644
--- a/arch/i386/kernel/mpparse.c
+++ b/arch/i386/kernel/mpparse.c
@@ -38,6 +38,12 @@
38int smp_found_config; 38int smp_found_config;
39unsigned int __initdata maxcpus = NR_CPUS; 39unsigned int __initdata maxcpus = NR_CPUS;
40 40
41#ifdef CONFIG_HOTPLUG_CPU
42#define CPU_HOTPLUG_ENABLED (1)
43#else
44#define CPU_HOTPLUG_ENABLED (0)
45#endif
46
41/* 47/*
42 * Various Linux-internal data structures created from the 48 * Various Linux-internal data structures created from the
43 * MP-table. 49 * MP-table.
@@ -219,14 +225,18 @@ static void __devinit MP_processor_info (struct mpc_config_processor *m)
219 cpu_set(num_processors, cpu_possible_map); 225 cpu_set(num_processors, cpu_possible_map);
220 num_processors++; 226 num_processors++;
221 227
222 if ((num_processors > 8) && 228 if (CPU_HOTPLUG_ENABLED || (num_processors > 8)) {
223 ((APIC_XAPIC(ver) && 229 switch (boot_cpu_data.x86_vendor) {
224 (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)) || 230 case X86_VENDOR_INTEL:
225 (boot_cpu_data.x86_vendor == X86_VENDOR_AMD))) 231 if (!APIC_XAPIC(ver)) {
226 def_to_bigsmp = 1; 232 def_to_bigsmp = 0;
227 else 233 break;
228 def_to_bigsmp = 0; 234 }
229 235 /* If P4 and above fall through */
236 case X86_VENDOR_AMD:
237 def_to_bigsmp = 1;
238 }
239 }
230 bios_cpu_apicid[num_processors - 1] = m->mpc_apicid; 240 bios_cpu_apicid[num_processors - 1] = m->mpc_apicid;
231} 241}
232 242
@@ -1070,7 +1080,7 @@ void __init mp_config_acpi_legacy_irqs (void)
1070 1080
1071#define MAX_GSI_NUM 4096 1081#define MAX_GSI_NUM 4096
1072 1082
1073int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) 1083int mp_register_gsi (u32 gsi, int triggering, int polarity)
1074{ 1084{
1075 int ioapic = -1; 1085 int ioapic = -1;
1076 int ioapic_pin = 0; 1086 int ioapic_pin = 0;
@@ -1119,7 +1129,7 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
1119 1129
1120 mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); 1130 mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit);
1121 1131
1122 if (edge_level) { 1132 if (triggering == ACPI_LEVEL_SENSITIVE) {
1123 /* 1133 /*
1124 * For PCI devices assign IRQs in order, avoiding gaps 1134 * For PCI devices assign IRQs in order, avoiding gaps
1125 * due to unused I/O APIC pins. 1135 * due to unused I/O APIC pins.
@@ -1141,8 +1151,8 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low)
1141 } 1151 }
1142 1152
1143 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, 1153 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
1144 edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1, 1154 triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
1145 active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1); 1155 polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
1146 return gsi; 1156 return gsi;
1147} 1157}
1148 1158
diff --git a/arch/i386/kernel/msr.c b/arch/i386/kernel/msr.c
index 44470fea4309..1d0a55e68760 100644
--- a/arch/i386/kernel/msr.c
+++ b/arch/i386/kernel/msr.c
@@ -172,7 +172,6 @@ static ssize_t msr_read(struct file *file, char __user * buf,
172{ 172{
173 u32 __user *tmp = (u32 __user *) buf; 173 u32 __user *tmp = (u32 __user *) buf;
174 u32 data[2]; 174 u32 data[2];
175 size_t rv;
176 u32 reg = *ppos; 175 u32 reg = *ppos;
177 int cpu = iminor(file->f_dentry->d_inode); 176 int cpu = iminor(file->f_dentry->d_inode);
178 int err; 177 int err;
@@ -180,7 +179,7 @@ static ssize_t msr_read(struct file *file, char __user * buf,
180 if (count % 8) 179 if (count % 8)
181 return -EINVAL; /* Invalid chunk size */ 180 return -EINVAL; /* Invalid chunk size */
182 181
183 for (rv = 0; count; count -= 8) { 182 for (; count; count -= 8) {
184 err = do_rdmsr(cpu, reg, &data[0], &data[1]); 183 err = do_rdmsr(cpu, reg, &data[0], &data[1]);
185 if (err) 184 if (err)
186 return err; 185 return err;
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index df6c2bcde067..2185377fdde1 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -48,6 +48,7 @@
48#include <asm/processor.h> 48#include <asm/processor.h>
49#include <asm/i387.h> 49#include <asm/i387.h>
50#include <asm/desc.h> 50#include <asm/desc.h>
51#include <asm/vm86.h>
51#ifdef CONFIG_MATH_EMULATION 52#ifdef CONFIG_MATH_EMULATION
52#include <asm/math_emu.h> 53#include <asm/math_emu.h>
53#endif 54#endif
@@ -308,9 +309,7 @@ void show_regs(struct pt_regs * regs)
308 cr0 = read_cr0(); 309 cr0 = read_cr0();
309 cr2 = read_cr2(); 310 cr2 = read_cr2();
310 cr3 = read_cr3(); 311 cr3 = read_cr3();
311 if (current_cpu_data.x86 > 4) { 312 cr4 = read_cr4_safe();
312 cr4 = read_cr4();
313 }
314 printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4); 313 printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4);
315 show_trace(NULL, &regs->esp); 314 show_trace(NULL, &regs->esp);
316} 315}
@@ -404,17 +403,7 @@ void flush_thread(void)
404 403
405void release_thread(struct task_struct *dead_task) 404void release_thread(struct task_struct *dead_task)
406{ 405{
407 if (dead_task->mm) { 406 BUG_ON(dead_task->mm);
408 // temporary debugging check
409 if (dead_task->mm->context.size) {
410 printk("WARNING: dead process %8s still has LDT? <%p/%d>\n",
411 dead_task->comm,
412 dead_task->mm->context.ldt,
413 dead_task->mm->context.size);
414 BUG();
415 }
416 }
417
418 release_vm86_irqs(dead_task); 407 release_vm86_irqs(dead_task);
419} 408}
420 409
@@ -435,18 +424,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
435 struct task_struct *tsk; 424 struct task_struct *tsk;
436 int err; 425 int err;
437 426
438 childregs = ((struct pt_regs *) (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; 427 childregs = task_pt_regs(p);
439 /*
440 * The below -8 is to reserve 8 bytes on top of the ring0 stack.
441 * This is necessary to guarantee that the entire "struct pt_regs"
442 * is accessable even if the CPU haven't stored the SS/ESP registers
443 * on the stack (interrupt gate does not save these registers
444 * when switching to the same priv ring).
445 * Therefore beware: accessing the xss/esp fields of the
446 * "struct pt_regs" is possible, but they may contain the
447 * completely wrong values.
448 */
449 childregs = (struct pt_regs *) ((unsigned long) childregs - 8);
450 *childregs = *regs; 428 *childregs = *regs;
451 childregs->eax = 0; 429 childregs->eax = 0;
452 childregs->esp = esp; 430 childregs->esp = esp;
@@ -551,10 +529,7 @@ EXPORT_SYMBOL(dump_thread);
551 */ 529 */
552int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) 530int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
553{ 531{
554 struct pt_regs ptregs; 532 struct pt_regs ptregs = *task_pt_regs(tsk);
555
556 ptregs = *(struct pt_regs *)
557 ((unsigned long)tsk->thread_info+THREAD_SIZE - sizeof(ptregs));
558 ptregs.xcs &= 0xffff; 533 ptregs.xcs &= 0xffff;
559 ptregs.xds &= 0xffff; 534 ptregs.xds &= 0xffff;
560 ptregs.xes &= 0xffff; 535 ptregs.xes &= 0xffff;
@@ -610,8 +585,8 @@ static inline void disable_tsc(struct task_struct *prev_p,
610 * gcc should eliminate the ->thread_info dereference if 585 * gcc should eliminate the ->thread_info dereference if
611 * has_secure_computing returns 0 at compile time (SECCOMP=n). 586 * has_secure_computing returns 0 at compile time (SECCOMP=n).
612 */ 587 */
613 prev = prev_p->thread_info; 588 prev = task_thread_info(prev_p);
614 next = next_p->thread_info; 589 next = task_thread_info(next_p);
615 590
616 if (has_secure_computing(prev) || has_secure_computing(next)) { 591 if (has_secure_computing(prev) || has_secure_computing(next)) {
617 /* slow path here */ 592 /* slow path here */
@@ -796,7 +771,7 @@ unsigned long get_wchan(struct task_struct *p)
796 int count = 0; 771 int count = 0;
797 if (!p || p == current || p->state == TASK_RUNNING) 772 if (!p || p == current || p->state == TASK_RUNNING)
798 return 0; 773 return 0;
799 stack_page = (unsigned long)p->thread_info; 774 stack_page = (unsigned long)task_stack_page(p);
800 esp = p->thread.esp; 775 esp = p->thread.esp;
801 if (!stack_page || esp < stack_page || esp > top_esp+stack_page) 776 if (!stack_page || esp < stack_page || esp > top_esp+stack_page)
802 return 0; 777 return 0;
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
index 5ffbb4b7ad05..5c1fb6aada5b 100644
--- a/arch/i386/kernel/ptrace.c
+++ b/arch/i386/kernel/ptrace.c
@@ -32,9 +32,12 @@
32 * in exit.c or in signal.c. 32 * in exit.c or in signal.c.
33 */ 33 */
34 34
35/* determines which flags the user has access to. */ 35/*
36/* 1 = access 0 = no access */ 36 * Determines which flags the user has access to [1 = access, 0 = no access].
37#define FLAG_MASK 0x00044dd5 37 * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9).
38 * Also masks reserved bits (31-22, 15, 5, 3, 1).
39 */
40#define FLAG_MASK 0x00054dd5
38 41
39/* set's the trap flag. */ 42/* set's the trap flag. */
40#define TRAP_FLAG 0x100 43#define TRAP_FLAG 0x100
diff --git a/arch/i386/kernel/quirks.c b/arch/i386/kernel/quirks.c
index aaf89cb2bc51..87ccdac84928 100644
--- a/arch/i386/kernel/quirks.c
+++ b/arch/i386/kernel/quirks.c
@@ -25,8 +25,7 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev)
25 25
26 /* enable access to config space*/ 26 /* enable access to config space*/
27 pci_read_config_byte(dev, 0xf4, &config); 27 pci_read_config_byte(dev, 0xf4, &config);
28 config |= 0x2; 28 pci_write_config_byte(dev, 0xf4, config|0x2);
29 pci_write_config_byte(dev, 0xf4, config);
30 29
31 /* read xTPR register */ 30 /* read xTPR register */
32 raw_pci_ops->read(0, 0, 0x40, 0x4c, 2, &word); 31 raw_pci_ops->read(0, 0, 0x40, 0x4c, 2, &word);
@@ -42,9 +41,9 @@ static void __devinit quirk_intel_irqbalance(struct pci_dev *dev)
42#endif 41#endif
43 } 42 }
44 43
45 config &= ~0x2; 44 /* put back the original value for config space*/
46 /* disable access to config space*/ 45 if (!(config & 0x2))
47 pci_write_config_byte(dev, 0xf4, config); 46 pci_write_config_byte(dev, 0xf4, config);
48} 47}
49DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_intel_irqbalance); 48DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_E7320_MCH, quirk_intel_irqbalance);
50DECLARE_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);
diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c
index 2afe0f8d555a..d207242976d3 100644
--- a/arch/i386/kernel/reboot.c
+++ b/arch/i386/kernel/reboot.c
@@ -12,6 +12,7 @@
12#include <linux/efi.h> 12#include <linux/efi.h>
13#include <linux/dmi.h> 13#include <linux/dmi.h>
14#include <linux/ctype.h> 14#include <linux/ctype.h>
15#include <linux/pm.h>
15#include <asm/uaccess.h> 16#include <asm/uaccess.h>
16#include <asm/apic.h> 17#include <asm/apic.h>
17#include <asm/desc.h> 18#include <asm/desc.h>
@@ -111,12 +112,12 @@ static struct dmi_system_id __initdata reboot_dmi_table[] = {
111 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2400"), 112 DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2400"),
112 }, 113 },
113 }, 114 },
114 { /* Handle problems with rebooting on HP nc6120 */ 115 { /* Handle problems with rebooting on HP laptops */
115 .callback = set_bios_reboot, 116 .callback = set_bios_reboot,
116 .ident = "HP Compaq nc6120", 117 .ident = "HP Compaq Laptop",
117 .matches = { 118 .matches = {
118 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"), 119 DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
119 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq nc6120"), 120 DMI_MATCH(DMI_PRODUCT_NAME, "HP Compaq"),
120 }, 121 },
121 }, 122 },
122 { } 123 { }
@@ -355,10 +356,10 @@ void machine_halt(void)
355 356
356void machine_power_off(void) 357void machine_power_off(void)
357{ 358{
358 machine_shutdown(); 359 if (pm_power_off) {
359 360 machine_shutdown();
360 if (pm_power_off)
361 pm_power_off(); 361 pm_power_off();
362 }
362} 363}
363 364
364 365
diff --git a/arch/i386/kernel/scx200.c b/arch/i386/kernel/scx200.c
index 9c968ae67c43..321f5fd26e75 100644
--- a/arch/i386/kernel/scx200.c
+++ b/arch/i386/kernel/scx200.c
@@ -143,7 +143,7 @@ static int __init scx200_init(void)
143{ 143{
144 printk(KERN_INFO NAME ": NatSemi SCx200 Driver\n"); 144 printk(KERN_INFO NAME ": NatSemi SCx200 Driver\n");
145 145
146 return pci_module_init(&scx200_pci_driver); 146 return pci_register_driver(&scx200_pci_driver);
147} 147}
148 148
149static void __exit scx200_cleanup(void) 149static void __exit scx200_cleanup(void)
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index fdfcb0cba9b4..51e513b4f72d 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -45,6 +45,7 @@
45#include <linux/nodemask.h> 45#include <linux/nodemask.h>
46#include <linux/kexec.h> 46#include <linux/kexec.h>
47#include <linux/crash_dump.h> 47#include <linux/crash_dump.h>
48#include <linux/dmi.h>
48 49
49#include <video/edid.h> 50#include <video/edid.h>
50 51
@@ -146,7 +147,6 @@ EXPORT_SYMBOL(ist_info);
146struct e820map e820; 147struct e820map e820;
147 148
148extern void early_cpu_init(void); 149extern void early_cpu_init(void);
149extern void dmi_scan_machine(void);
150extern void generic_apic_probe(char *); 150extern void generic_apic_probe(char *);
151extern int root_mountflags; 151extern int root_mountflags;
152 152
@@ -898,7 +898,7 @@ static void __init parse_cmdline_early (char ** cmdline_p)
898 } 898 }
899 } 899 }
900#endif 900#endif
901#ifdef CONFIG_CRASH_DUMP 901#ifdef CONFIG_PROC_VMCORE
902 /* elfcorehdr= specifies the location of elf core header 902 /* elfcorehdr= specifies the location of elf core header
903 * stored by the crashed kernel. 903 * stored by the crashed kernel.
904 */ 904 */
@@ -954,6 +954,12 @@ efi_find_max_pfn(unsigned long start, unsigned long end, void *arg)
954 return 0; 954 return 0;
955} 955}
956 956
957static int __init
958efi_memory_present_wrapper(unsigned long start, unsigned long end, void *arg)
959{
960 memory_present(0, start, end);
961 return 0;
962}
957 963
958/* 964/*
959 * Find the highest page frame number we have available 965 * Find the highest page frame number we have available
@@ -965,6 +971,7 @@ void __init find_max_pfn(void)
965 max_pfn = 0; 971 max_pfn = 0;
966 if (efi_enabled) { 972 if (efi_enabled) {
967 efi_memmap_walk(efi_find_max_pfn, &max_pfn); 973 efi_memmap_walk(efi_find_max_pfn, &max_pfn);
974 efi_memmap_walk(efi_memory_present_wrapper, NULL);
968 return; 975 return;
969 } 976 }
970 977
@@ -979,6 +986,7 @@ void __init find_max_pfn(void)
979 continue; 986 continue;
980 if (end > max_pfn) 987 if (end > max_pfn)
981 max_pfn = end; 988 max_pfn = end;
989 memory_present(0, start, end);
982 } 990 }
983} 991}
984 992
@@ -1576,7 +1584,7 @@ void __init setup_arch(char **cmdline_p)
1576 if (s) { 1584 if (s) {
1577 extern void setup_early_printk(char *); 1585 extern void setup_early_printk(char *);
1578 1586
1579 setup_early_printk(s); 1587 setup_early_printk(strchr(s, '=') + 1);
1580 printk("early console enabled\n"); 1588 printk("early console enabled\n");
1581 } 1589 }
1582 } 1590 }
diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
index adcd069db91e..963616d364ec 100644
--- a/arch/i386/kernel/signal.c
+++ b/arch/i386/kernel/signal.c
@@ -37,51 +37,17 @@
37asmlinkage int 37asmlinkage int
38sys_sigsuspend(int history0, int history1, old_sigset_t mask) 38sys_sigsuspend(int history0, int history1, old_sigset_t mask)
39{ 39{
40 struct pt_regs * regs = (struct pt_regs *) &history0;
41 sigset_t saveset;
42
43 mask &= _BLOCKABLE; 40 mask &= _BLOCKABLE;
44 spin_lock_irq(&current->sighand->siglock); 41 spin_lock_irq(&current->sighand->siglock);
45 saveset = current->blocked; 42 current->saved_sigmask = current->blocked;
46 siginitset(&current->blocked, mask); 43 siginitset(&current->blocked, mask);
47 recalc_sigpending(); 44 recalc_sigpending();
48 spin_unlock_irq(&current->sighand->siglock); 45 spin_unlock_irq(&current->sighand->siglock);
49 46
50 regs->eax = -EINTR; 47 current->state = TASK_INTERRUPTIBLE;
51 while (1) { 48 schedule();
52 current->state = TASK_INTERRUPTIBLE; 49 set_thread_flag(TIF_RESTORE_SIGMASK);
53 schedule(); 50 return -ERESTARTNOHAND;
54 if (do_signal(regs, &saveset))
55 return -EINTR;
56 }
57}
58
59asmlinkage int
60sys_rt_sigsuspend(struct pt_regs regs)
61{
62 sigset_t saveset, newset;
63
64 /* XXX: Don't preclude handling different sized sigset_t's. */
65 if (regs.ecx != sizeof(sigset_t))
66 return -EINVAL;
67
68 if (copy_from_user(&newset, (sigset_t __user *)regs.ebx, sizeof(newset)))
69 return -EFAULT;
70 sigdelsetmask(&newset, ~_BLOCKABLE);
71
72 spin_lock_irq(&current->sighand->siglock);
73 saveset = current->blocked;
74 current->blocked = newset;
75 recalc_sigpending();
76 spin_unlock_irq(&current->sighand->siglock);
77
78 regs.eax = -EINTR;
79 while (1) {
80 current->state = TASK_INTERRUPTIBLE;
81 schedule();
82 if (do_signal(&regs, &saveset))
83 return -EINTR;
84 }
85} 51}
86 52
87asmlinkage int 53asmlinkage int
@@ -433,11 +399,11 @@ static int setup_frame(int sig, struct k_sigaction *ka,
433 current->comm, current->pid, frame, regs->eip, frame->pretcode); 399 current->comm, current->pid, frame, regs->eip, frame->pretcode);
434#endif 400#endif
435 401
436 return 1; 402 return 0;
437 403
438give_sigsegv: 404give_sigsegv:
439 force_sigsegv(sig, current); 405 force_sigsegv(sig, current);
440 return 0; 406 return -EFAULT;
441} 407}
442 408
443static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, 409static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
@@ -527,11 +493,11 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
527 current->comm, current->pid, frame, regs->eip, frame->pretcode); 493 current->comm, current->pid, frame, regs->eip, frame->pretcode);
528#endif 494#endif
529 495
530 return 1; 496 return 0;
531 497
532give_sigsegv: 498give_sigsegv:
533 force_sigsegv(sig, current); 499 force_sigsegv(sig, current);
534 return 0; 500 return -EFAULT;
535} 501}
536 502
537/* 503/*
@@ -581,7 +547,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
581 else 547 else
582 ret = setup_frame(sig, ka, oldset, regs); 548 ret = setup_frame(sig, ka, oldset, regs);
583 549
584 if (ret) { 550 if (ret == 0) {
585 spin_lock_irq(&current->sighand->siglock); 551 spin_lock_irq(&current->sighand->siglock);
586 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask); 552 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
587 if (!(ka->sa.sa_flags & SA_NODEFER)) 553 if (!(ka->sa.sa_flags & SA_NODEFER))
@@ -598,11 +564,12 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
598 * want to handle. Thus you cannot kill init even with a SIGKILL even by 564 * want to handle. Thus you cannot kill init even with a SIGKILL even by
599 * mistake. 565 * mistake.
600 */ 566 */
601int fastcall do_signal(struct pt_regs *regs, sigset_t *oldset) 567static void fastcall do_signal(struct pt_regs *regs)
602{ 568{
603 siginfo_t info; 569 siginfo_t info;
604 int signr; 570 int signr;
605 struct k_sigaction ka; 571 struct k_sigaction ka;
572 sigset_t *oldset;
606 573
607 /* 574 /*
608 * We want the common case to go fast, which 575 * We want the common case to go fast, which
@@ -613,12 +580,14 @@ int fastcall do_signal(struct pt_regs *regs, sigset_t *oldset)
613 * CS suffices. 580 * CS suffices.
614 */ 581 */
615 if (!user_mode(regs)) 582 if (!user_mode(regs))
616 return 1; 583 return;
617 584
618 if (try_to_freeze()) 585 if (try_to_freeze())
619 goto no_signal; 586 goto no_signal;
620 587
621 if (!oldset) 588 if (test_thread_flag(TIF_RESTORE_SIGMASK))
589 oldset = &current->saved_sigmask;
590 else
622 oldset = &current->blocked; 591 oldset = &current->blocked;
623 592
624 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 593 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
@@ -628,38 +597,55 @@ int fastcall do_signal(struct pt_regs *regs, sigset_t *oldset)
628 * have been cleared if the watchpoint triggered 597 * have been cleared if the watchpoint triggered
629 * inside the kernel. 598 * inside the kernel.
630 */ 599 */
631 if (unlikely(current->thread.debugreg[7])) { 600 if (unlikely(current->thread.debugreg[7]))
632 set_debugreg(current->thread.debugreg[7], 7); 601 set_debugreg(current->thread.debugreg[7], 7);
633 }
634 602
635 /* Whee! Actually deliver the signal. */ 603 /* Whee! Actually deliver the signal. */
636 return handle_signal(signr, &info, &ka, oldset, regs); 604 if (handle_signal(signr, &info, &ka, oldset, regs) == 0) {
605 /* a signal was successfully delivered; the saved
606 * sigmask will have been stored in the signal frame,
607 * and will be restored by sigreturn, so we can simply
608 * clear the TIF_RESTORE_SIGMASK flag */
609 if (test_thread_flag(TIF_RESTORE_SIGMASK))
610 clear_thread_flag(TIF_RESTORE_SIGMASK);
611 }
612
613 return;
637 } 614 }
638 615
639 no_signal: 616no_signal:
640 /* Did we come from a system call? */ 617 /* Did we come from a system call? */
641 if (regs->orig_eax >= 0) { 618 if (regs->orig_eax >= 0) {
642 /* Restart the system call - no handlers present */ 619 /* Restart the system call - no handlers present */
643 if (regs->eax == -ERESTARTNOHAND || 620 switch (regs->eax) {
644 regs->eax == -ERESTARTSYS || 621 case -ERESTARTNOHAND:
645 regs->eax == -ERESTARTNOINTR) { 622 case -ERESTARTSYS:
623 case -ERESTARTNOINTR:
646 regs->eax = regs->orig_eax; 624 regs->eax = regs->orig_eax;
647 regs->eip -= 2; 625 regs->eip -= 2;
648 } 626 break;
649 if (regs->eax == -ERESTART_RESTARTBLOCK){ 627
628 case -ERESTART_RESTARTBLOCK:
650 regs->eax = __NR_restart_syscall; 629 regs->eax = __NR_restart_syscall;
651 regs->eip -= 2; 630 regs->eip -= 2;
631 break;
652 } 632 }
653 } 633 }
654 return 0; 634
635 /* if there's no signal to deliver, we just put the saved sigmask
636 * back */
637 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
638 clear_thread_flag(TIF_RESTORE_SIGMASK);
639 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
640 }
655} 641}
656 642
657/* 643/*
658 * notification of userspace execution resumption 644 * notification of userspace execution resumption
659 * - triggered by current->work.notify_resume 645 * - triggered by the TIF_WORK_MASK flags
660 */ 646 */
661__attribute__((regparm(3))) 647__attribute__((regparm(3)))
662void do_notify_resume(struct pt_regs *regs, sigset_t *oldset, 648void do_notify_resume(struct pt_regs *regs, void *_unused,
663 __u32 thread_info_flags) 649 __u32 thread_info_flags)
664{ 650{
665 /* Pending single-step? */ 651 /* Pending single-step? */
@@ -667,9 +653,10 @@ void do_notify_resume(struct pt_regs *regs, sigset_t *oldset,
667 regs->eflags |= TF_MASK; 653 regs->eflags |= TF_MASK;
668 clear_thread_flag(TIF_SINGLESTEP); 654 clear_thread_flag(TIF_SINGLESTEP);
669 } 655 }
656
670 /* deal with pending signal delivery */ 657 /* deal with pending signal delivery */
671 if (thread_info_flags & _TIF_SIGPENDING) 658 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
672 do_signal(regs,oldset); 659 do_signal(regs);
673 660
674 clear_thread_flag(TIF_IRET); 661 clear_thread_flag(TIF_IRET);
675} 662}
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index d16520da4550..255adb498268 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -875,8 +875,7 @@ static inline struct task_struct * alloc_idle_task(int cpu)
875 /* initialize thread_struct. we really want to avoid destroy 875 /* initialize thread_struct. we really want to avoid destroy
876 * idle tread 876 * idle tread
877 */ 877 */
878 idle->thread.esp = (unsigned long)(((struct pt_regs *) 878 idle->thread.esp = (unsigned long)task_pt_regs(idle);
879 (THREAD_SIZE + (unsigned long) idle->thread_info)) - 1);
880 init_idle(idle, cpu); 879 init_idle(idle, cpu);
881 return idle; 880 return idle;
882 } 881 }
@@ -903,6 +902,12 @@ static int __devinit do_boot_cpu(int apicid, int cpu)
903 unsigned long start_eip; 902 unsigned long start_eip;
904 unsigned short nmi_high = 0, nmi_low = 0; 903 unsigned short nmi_high = 0, nmi_low = 0;
905 904
905 if (!cpu_gdt_descr[cpu].address &&
906 !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) {
907 printk("Failed to allocate GDT for CPU %d\n", cpu);
908 return 1;
909 }
910
906 ++cpucount; 911 ++cpucount;
907 912
908 /* 913 /*
@@ -1090,6 +1095,7 @@ static void smp_tune_scheduling (void)
1090 cachesize = 16; /* Pentiums, 2x8kB cache */ 1095 cachesize = 16; /* Pentiums, 2x8kB cache */
1091 bandwidth = 100; 1096 bandwidth = 100;
1092 } 1097 }
1098 max_cache_size = cachesize * 1024;
1093 } 1099 }
1094} 1100}
1095 1101
@@ -1338,8 +1344,7 @@ int __cpu_disable(void)
1338 if (cpu == 0) 1344 if (cpu == 0)
1339 return -EBUSY; 1345 return -EBUSY;
1340 1346
1341 /* We enable the timer again on the exit path of the death loop */ 1347 clear_local_APIC();
1342 disable_APIC_timer();
1343 /* Allow any queued timer interrupts to get serviced */ 1348 /* Allow any queued timer interrupts to get serviced */
1344 local_irq_enable(); 1349 local_irq_enable();
1345 mdelay(1); 1350 mdelay(1);
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index 9b21a31d4f4e..1b665928336b 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -1,4 +1,3 @@
1.data
2ENTRY(sys_call_table) 1ENTRY(sys_call_table)
3 .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */ 2 .long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */
4 .long sys_exit 3 .long sys_exit
@@ -294,3 +293,19 @@ ENTRY(sys_call_table)
294 .long sys_inotify_init 293 .long sys_inotify_init
295 .long sys_inotify_add_watch 294 .long sys_inotify_add_watch
296 .long sys_inotify_rm_watch 295 .long sys_inotify_rm_watch
296 .long sys_migrate_pages
297 .long sys_openat /* 295 */
298 .long sys_mkdirat
299 .long sys_mknodat
300 .long sys_fchownat
301 .long sys_futimesat
302 .long sys_newfstatat /* 300 */
303 .long sys_unlinkat
304 .long sys_renameat
305 .long sys_linkat
306 .long sys_symlinkat
307 .long sys_readlinkat /* 305 */
308 .long sys_fchmodat
309 .long sys_faccessat
310 .long sys_pselect6
311 .long sys_ppoll
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
index 41c5b2dc6200..a14d594bfbeb 100644
--- a/arch/i386/kernel/time.c
+++ b/arch/i386/kernel/time.c
@@ -302,6 +302,12 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
302 do_timer_interrupt(irq, regs); 302 do_timer_interrupt(irq, regs);
303 303
304 write_sequnlock(&xtime_lock); 304 write_sequnlock(&xtime_lock);
305
306#ifdef CONFIG_X86_LOCAL_APIC
307 if (using_apic_timer)
308 smp_send_timer_broadcast_ipi(regs);
309#endif
310
305 return IRQ_HANDLED; 311 return IRQ_HANDLED;
306} 312}
307 313
diff --git a/arch/i386/kernel/time_hpet.c b/arch/i386/kernel/time_hpet.c
index 9caeaa315cd7..a529f0cdce17 100644
--- a/arch/i386/kernel/time_hpet.c
+++ b/arch/i386/kernel/time_hpet.c
@@ -259,8 +259,6 @@ __setup("hpet=", hpet_setup);
259#include <linux/mc146818rtc.h> 259#include <linux/mc146818rtc.h>
260#include <linux/rtc.h> 260#include <linux/rtc.h>
261 261
262extern irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
263
264#define DEFAULT_RTC_INT_FREQ 64 262#define DEFAULT_RTC_INT_FREQ 64
265#define RTC_NUM_INTS 1 263#define RTC_NUM_INTS 1
266 264
diff --git a/arch/i386/kernel/timers/timer_tsc.c b/arch/i386/kernel/timers/timer_tsc.c
index d395e3b42485..47675bbbb316 100644
--- a/arch/i386/kernel/timers/timer_tsc.c
+++ b/arch/i386/kernel/timers/timer_tsc.c
@@ -330,7 +330,9 @@ int recalibrate_cpu_khz(void)
330 unsigned int cpu_khz_old = cpu_khz; 330 unsigned int cpu_khz_old = cpu_khz;
331 331
332 if (cpu_has_tsc) { 332 if (cpu_has_tsc) {
333 local_irq_disable();
333 init_cpu_khz(); 334 init_cpu_khz();
335 local_irq_enable();
334 cpu_data[0].loops_per_jiffy = 336 cpu_data[0].loops_per_jiffy =
335 cpufreq_scale(cpu_data[0].loops_per_jiffy, 337 cpufreq_scale(cpu_data[0].loops_per_jiffy,
336 cpu_khz_old, 338 cpu_khz_old,
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index c34d1bfc5161..0aaebf3e1cfa 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -112,33 +112,38 @@ static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
112 p < (void *)tinfo + THREAD_SIZE - 3; 112 p < (void *)tinfo + THREAD_SIZE - 3;
113} 113}
114 114
115static void print_addr_and_symbol(unsigned long addr, char *log_lvl)
116{
117 printk(log_lvl);
118 printk(" [<%08lx>] ", addr);
119 print_symbol("%s", addr);
120 printk("\n");
121}
122
115static inline unsigned long print_context_stack(struct thread_info *tinfo, 123static inline unsigned long print_context_stack(struct thread_info *tinfo,
116 unsigned long *stack, unsigned long ebp) 124 unsigned long *stack, unsigned long ebp,
125 char *log_lvl)
117{ 126{
118 unsigned long addr; 127 unsigned long addr;
119 128
120#ifdef CONFIG_FRAME_POINTER 129#ifdef CONFIG_FRAME_POINTER
121 while (valid_stack_ptr(tinfo, (void *)ebp)) { 130 while (valid_stack_ptr(tinfo, (void *)ebp)) {
122 addr = *(unsigned long *)(ebp + 4); 131 addr = *(unsigned long *)(ebp + 4);
123 printk(" [<%08lx>] ", addr); 132 print_addr_and_symbol(addr, log_lvl);
124 print_symbol("%s", addr);
125 printk("\n");
126 ebp = *(unsigned long *)ebp; 133 ebp = *(unsigned long *)ebp;
127 } 134 }
128#else 135#else
129 while (valid_stack_ptr(tinfo, stack)) { 136 while (valid_stack_ptr(tinfo, stack)) {
130 addr = *stack++; 137 addr = *stack++;
131 if (__kernel_text_address(addr)) { 138 if (__kernel_text_address(addr))
132 printk(" [<%08lx>]", addr); 139 print_addr_and_symbol(addr, log_lvl);
133 print_symbol(" %s", addr);
134 printk("\n");
135 }
136 } 140 }
137#endif 141#endif
138 return ebp; 142 return ebp;
139} 143}
140 144
141void show_trace(struct task_struct *task, unsigned long * stack) 145static void show_trace_log_lvl(struct task_struct *task,
146 unsigned long *stack, char *log_lvl)
142{ 147{
143 unsigned long ebp; 148 unsigned long ebp;
144 149
@@ -157,15 +162,21 @@ void show_trace(struct task_struct *task, unsigned long * stack)
157 struct thread_info *context; 162 struct thread_info *context;
158 context = (struct thread_info *) 163 context = (struct thread_info *)
159 ((unsigned long)stack & (~(THREAD_SIZE - 1))); 164 ((unsigned long)stack & (~(THREAD_SIZE - 1)));
160 ebp = print_context_stack(context, stack, ebp); 165 ebp = print_context_stack(context, stack, ebp, log_lvl);
161 stack = (unsigned long*)context->previous_esp; 166 stack = (unsigned long*)context->previous_esp;
162 if (!stack) 167 if (!stack)
163 break; 168 break;
164 printk(" =======================\n"); 169 printk(KERN_EMERG " =======================\n");
165 } 170 }
166} 171}
167 172
168void show_stack(struct task_struct *task, unsigned long *esp) 173void show_trace(struct task_struct *task, unsigned long * stack)
174{
175 show_trace_log_lvl(task, stack, "");
176}
177
178static void show_stack_log_lvl(struct task_struct *task, unsigned long *esp,
179 char *log_lvl)
169{ 180{
170 unsigned long *stack; 181 unsigned long *stack;
171 int i; 182 int i;
@@ -178,15 +189,26 @@ void show_stack(struct task_struct *task, unsigned long *esp)
178 } 189 }
179 190
180 stack = esp; 191 stack = esp;
192 printk(log_lvl);
181 for(i = 0; i < kstack_depth_to_print; i++) { 193 for(i = 0; i < kstack_depth_to_print; i++) {
182 if (kstack_end(stack)) 194 if (kstack_end(stack))
183 break; 195 break;
184 if (i && ((i % 8) == 0)) 196 if (i && ((i % 8) == 0)) {
185 printk("\n "); 197 printk("\n");
198 printk(log_lvl);
199 printk(" ");
200 }
186 printk("%08lx ", *stack++); 201 printk("%08lx ", *stack++);
187 } 202 }
188 printk("\nCall Trace:\n"); 203 printk("\n");
189 show_trace(task, esp); 204 printk(log_lvl);
205 printk("Call Trace:\n");
206 show_trace_log_lvl(task, esp, log_lvl);
207}
208
209void show_stack(struct task_struct *task, unsigned long *esp)
210{
211 show_stack_log_lvl(task, esp, "");
190} 212}
191 213
192/* 214/*
@@ -216,18 +238,18 @@ void show_registers(struct pt_regs *regs)
216 ss = regs->xss & 0xffff; 238 ss = regs->xss & 0xffff;
217 } 239 }
218 print_modules(); 240 print_modules();
219 printk("CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\nEFLAGS: %08lx" 241 printk(KERN_EMERG "CPU: %d\nEIP: %04x:[<%08lx>] %s VLI\n"
220 " (%s) \n", 242 "EFLAGS: %08lx (%s) \n",
221 smp_processor_id(), 0xffff & regs->xcs, regs->eip, 243 smp_processor_id(), 0xffff & regs->xcs, regs->eip,
222 print_tainted(), regs->eflags, system_utsname.release); 244 print_tainted(), regs->eflags, system_utsname.release);
223 print_symbol("EIP is at %s\n", regs->eip); 245 print_symbol(KERN_EMERG "EIP is at %s\n", regs->eip);
224 printk("eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n", 246 printk(KERN_EMERG "eax: %08lx ebx: %08lx ecx: %08lx edx: %08lx\n",
225 regs->eax, regs->ebx, regs->ecx, regs->edx); 247 regs->eax, regs->ebx, regs->ecx, regs->edx);
226 printk("esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n", 248 printk(KERN_EMERG "esi: %08lx edi: %08lx ebp: %08lx esp: %08lx\n",
227 regs->esi, regs->edi, regs->ebp, esp); 249 regs->esi, regs->edi, regs->ebp, esp);
228 printk("ds: %04x es: %04x ss: %04x\n", 250 printk(KERN_EMERG "ds: %04x es: %04x ss: %04x\n",
229 regs->xds & 0xffff, regs->xes & 0xffff, ss); 251 regs->xds & 0xffff, regs->xes & 0xffff, ss);
230 printk("Process %s (pid: %d, threadinfo=%p task=%p)", 252 printk(KERN_EMERG "Process %s (pid: %d, threadinfo=%p task=%p)",
231 current->comm, current->pid, current_thread_info(), current); 253 current->comm, current->pid, current_thread_info(), current);
232 /* 254 /*
233 * When in-kernel, we also print out the stack and code at the 255 * When in-kernel, we also print out the stack and code at the
@@ -236,10 +258,10 @@ void show_registers(struct pt_regs *regs)
236 if (in_kernel) { 258 if (in_kernel) {
237 u8 __user *eip; 259 u8 __user *eip;
238 260
239 printk("\nStack: "); 261 printk("\n" KERN_EMERG "Stack: ");
240 show_stack(NULL, (unsigned long*)esp); 262 show_stack_log_lvl(NULL, (unsigned long *)esp, KERN_EMERG);
241 263
242 printk("Code: "); 264 printk(KERN_EMERG "Code: ");
243 265
244 eip = (u8 __user *)regs->eip - 43; 266 eip = (u8 __user *)regs->eip - 43;
245 for (i = 0; i < 64; i++, eip++) { 267 for (i = 0; i < 64; i++, eip++) {
@@ -280,15 +302,15 @@ static void handle_BUG(struct pt_regs *regs)
280 (unsigned long)file < PAGE_OFFSET || __get_user(c, file)) 302 (unsigned long)file < PAGE_OFFSET || __get_user(c, file))
281 file = "<bad filename>"; 303 file = "<bad filename>";
282 304
283 printk("------------[ cut here ]------------\n"); 305 printk(KERN_EMERG "------------[ cut here ]------------\n");
284 printk(KERN_ALERT "kernel BUG at %s:%d!\n", file, line); 306 printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line);
285 307
286no_bug: 308no_bug:
287 return; 309 return;
288 310
289 /* Here we know it was a BUG but file-n-line is unavailable */ 311 /* Here we know it was a BUG but file-n-line is unavailable */
290bug: 312bug:
291 printk("Kernel BUG\n"); 313 printk(KERN_EMERG "Kernel BUG\n");
292} 314}
293 315
294/* This is gone through when something in the kernel 316/* This is gone through when something in the kernel
@@ -306,28 +328,35 @@ void die(const char * str, struct pt_regs * regs, long err)
306 .lock_owner_depth = 0 328 .lock_owner_depth = 0
307 }; 329 };
308 static int die_counter; 330 static int die_counter;
331 unsigned long flags;
309 332
310 if (die.lock_owner != raw_smp_processor_id()) { 333 if (die.lock_owner != raw_smp_processor_id()) {
311 console_verbose(); 334 console_verbose();
312 spin_lock_irq(&die.lock); 335 spin_lock_irqsave(&die.lock, flags);
313 die.lock_owner = smp_processor_id(); 336 die.lock_owner = smp_processor_id();
314 die.lock_owner_depth = 0; 337 die.lock_owner_depth = 0;
315 bust_spinlocks(1); 338 bust_spinlocks(1);
316 } 339 }
340 else
341 local_save_flags(flags);
317 342
318 if (++die.lock_owner_depth < 3) { 343 if (++die.lock_owner_depth < 3) {
319 int nl = 0; 344 int nl = 0;
320 handle_BUG(regs); 345 handle_BUG(regs);
321 printk(KERN_ALERT "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter); 346 printk(KERN_EMERG "%s: %04lx [#%d]\n", str, err & 0xffff, ++die_counter);
322#ifdef CONFIG_PREEMPT 347#ifdef CONFIG_PREEMPT
323 printk("PREEMPT "); 348 printk(KERN_EMERG "PREEMPT ");
324 nl = 1; 349 nl = 1;
325#endif 350#endif
326#ifdef CONFIG_SMP 351#ifdef CONFIG_SMP
352 if (!nl)
353 printk(KERN_EMERG);
327 printk("SMP "); 354 printk("SMP ");
328 nl = 1; 355 nl = 1;
329#endif 356#endif
330#ifdef CONFIG_DEBUG_PAGEALLOC 357#ifdef CONFIG_DEBUG_PAGEALLOC
358 if (!nl)
359 printk(KERN_EMERG);
331 printk("DEBUG_PAGEALLOC"); 360 printk("DEBUG_PAGEALLOC");
332 nl = 1; 361 nl = 1;
333#endif 362#endif
@@ -336,11 +365,11 @@ void die(const char * str, struct pt_regs * regs, long err)
336 notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); 365 notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV);
337 show_registers(regs); 366 show_registers(regs);
338 } else 367 } else
339 printk(KERN_ERR "Recursive die() failure, output suppressed\n"); 368 printk(KERN_EMERG "Recursive die() failure, output suppressed\n");
340 369
341 bust_spinlocks(0); 370 bust_spinlocks(0);
342 die.lock_owner = -1; 371 die.lock_owner = -1;
343 spin_unlock_irq(&die.lock); 372 spin_unlock_irqrestore(&die.lock, flags);
344 373
345 if (kexec_should_crash(current)) 374 if (kexec_should_crash(current))
346 crash_kexec(regs); 375 crash_kexec(regs);
@@ -452,7 +481,7 @@ DO_VM86_ERROR( 3, SIGTRAP, "int3", int3)
452#endif 481#endif
453DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow) 482DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow)
454DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds) 483DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds)
455DO_ERROR_INFO( 6, SIGILL, "invalid operand", invalid_op, ILL_ILLOPN, regs->eip) 484DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->eip)
456DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) 485DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun)
457DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) 486DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
458DO_ERROR(11, SIGBUS, "segment not present", segment_not_present) 487DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)
@@ -524,8 +553,10 @@ gp_in_kernel:
524 553
525static void mem_parity_error(unsigned char reason, struct pt_regs * regs) 554static void mem_parity_error(unsigned char reason, struct pt_regs * regs)
526{ 555{
527 printk("Uhhuh. NMI received. Dazed and confused, but trying to continue\n"); 556 printk(KERN_EMERG "Uhhuh. NMI received. Dazed and confused, but trying "
528 printk("You probably have a hardware problem with your RAM chips\n"); 557 "to continue\n");
558 printk(KERN_EMERG "You probably have a hardware problem with your RAM "
559 "chips\n");
529 560
530 /* Clear and disable the memory parity error line. */ 561 /* Clear and disable the memory parity error line. */
531 clear_mem_error(reason); 562 clear_mem_error(reason);
@@ -535,7 +566,7 @@ static void io_check_error(unsigned char reason, struct pt_regs * regs)
535{ 566{
536 unsigned long i; 567 unsigned long i;
537 568
538 printk("NMI: IOCK error (debug interrupt?)\n"); 569 printk(KERN_EMERG "NMI: IOCK error (debug interrupt?)\n");
539 show_registers(regs); 570 show_registers(regs);
540 571
541 /* Re-enable the IOCK line, wait for a few seconds */ 572 /* Re-enable the IOCK line, wait for a few seconds */
@@ -577,11 +608,11 @@ void die_nmi (struct pt_regs *regs, const char *msg)
577 * to get a message out. 608 * to get a message out.
578 */ 609 */
579 bust_spinlocks(1); 610 bust_spinlocks(1);
580 printk(msg); 611 printk(KERN_EMERG "%s", msg);
581 printk(" on CPU%d, eip %08lx, registers:\n", 612 printk(" on CPU%d, eip %08lx, registers:\n",
582 smp_processor_id(), regs->eip); 613 smp_processor_id(), regs->eip);
583 show_registers(regs); 614 show_registers(regs);
584 printk("console shuts up ...\n"); 615 printk(KERN_EMERG "console shuts up ...\n");
585 console_silent(); 616 console_silent();
586 spin_unlock(&nmi_print_lock); 617 spin_unlock(&nmi_print_lock);
587 bust_spinlocks(0); 618 bust_spinlocks(0);
@@ -650,13 +681,6 @@ fastcall void do_nmi(struct pt_regs * regs, long error_code)
650 681
651 cpu = smp_processor_id(); 682 cpu = smp_processor_id();
652 683
653#ifdef CONFIG_HOTPLUG_CPU
654 if (!cpu_online(cpu)) {
655 nmi_exit();
656 return;
657 }
658#endif
659
660 ++nmi_count(cpu); 684 ++nmi_count(cpu);
661 685
662 if (!rcu_dereference(nmi_callback)(regs, cpu)) 686 if (!rcu_dereference(nmi_callback)(regs, cpu))
@@ -994,8 +1018,8 @@ asmlinkage void math_state_restore(struct pt_regs regs)
994 1018
995asmlinkage void math_emulate(long arg) 1019asmlinkage void math_emulate(long arg)
996{ 1020{
997 printk("math-emulation not enabled and no coprocessor found.\n"); 1021 printk(KERN_EMERG "math-emulation not enabled and no coprocessor found.\n");
998 printk("killing %s.\n",current->comm); 1022 printk(KERN_EMERG "killing %s.\n",current->comm);
999 force_sig(SIGFPE,current); 1023 force_sig(SIGFPE,current);
1000 schedule(); 1024 schedule();
1001} 1025}
@@ -1082,9 +1106,9 @@ void __init trap_init(void)
1082 set_trap_gate(0,&divide_error); 1106 set_trap_gate(0,&divide_error);
1083 set_intr_gate(1,&debug); 1107 set_intr_gate(1,&debug);
1084 set_intr_gate(2,&nmi); 1108 set_intr_gate(2,&nmi);
1085 set_system_intr_gate(3, &int3); /* int3-5 can be called from all */ 1109 set_system_intr_gate(3, &int3); /* int3/4 can be called from all */
1086 set_system_gate(4,&overflow); 1110 set_system_gate(4,&overflow);
1087 set_system_gate(5,&bounds); 1111 set_trap_gate(5,&bounds);
1088 set_trap_gate(6,&invalid_op); 1112 set_trap_gate(6,&invalid_op);
1089 set_trap_gate(7,&device_not_available); 1113 set_trap_gate(7,&device_not_available);
1090 set_task_gate(8,GDT_ENTRY_DOUBLEFAULT_TSS); 1114 set_task_gate(8,GDT_ENTRY_DOUBLEFAULT_TSS);
@@ -1102,6 +1126,28 @@ void __init trap_init(void)
1102#endif 1126#endif
1103 set_trap_gate(19,&simd_coprocessor_error); 1127 set_trap_gate(19,&simd_coprocessor_error);
1104 1128
1129 if (cpu_has_fxsr) {
1130 /*
1131 * Verify that the FXSAVE/FXRSTOR data will be 16-byte aligned.
1132 * Generates a compile-time "error: zero width for bit-field" if
1133 * the alignment is wrong.
1134 */
1135 struct fxsrAlignAssert {
1136 int _:!(offsetof(struct task_struct,
1137 thread.i387.fxsave) & 15);
1138 };
1139
1140 printk(KERN_INFO "Enabling fast FPU save and restore... ");
1141 set_in_cr4(X86_CR4_OSFXSR);
1142 printk("done.\n");
1143 }
1144 if (cpu_has_xmm) {
1145 printk(KERN_INFO "Enabling unmasked SIMD FPU exception "
1146 "support... ");
1147 set_in_cr4(X86_CR4_OSXMMEXCPT);
1148 printk("done.\n");
1149 }
1150
1105 set_system_gate(SYSCALL_VECTOR,&system_call); 1151 set_system_gate(SYSCALL_VECTOR,&system_call);
1106 1152
1107 /* 1153 /*
diff --git a/arch/i386/kernel/vm86.c b/arch/i386/kernel/vm86.c
index fc1993564f98..f51c894a7da5 100644
--- a/arch/i386/kernel/vm86.c
+++ b/arch/i386/kernel/vm86.c
@@ -4,7 +4,7 @@
4 * Copyright (C) 1994 Linus Torvalds 4 * Copyright (C) 1994 Linus Torvalds
5 * 5 *
6 * 29 dec 2001 - Fixed oopses caused by unchecked access to the vm86 6 * 29 dec 2001 - Fixed oopses caused by unchecked access to the vm86
7 * stack - Manfred Spraul <manfreds@colorfullife.com> 7 * stack - Manfred Spraul <manfred@colorfullife.com>
8 * 8 *
9 * 22 mar 2002 - Manfred detected the stackfaults, but didn't handle 9 * 22 mar 2002 - Manfred detected the stackfaults, but didn't handle
10 * them correctly. Now the emulation will be in a 10 * them correctly. Now the emulation will be in a
@@ -30,6 +30,7 @@
30 * 30 *
31 */ 31 */
32 32
33#include <linux/capability.h>
33#include <linux/config.h> 34#include <linux/config.h>
34#include <linux/errno.h> 35#include <linux/errno.h>
35#include <linux/interrupt.h> 36#include <linux/interrupt.h>
@@ -310,7 +311,7 @@ static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk
310 "movl %1,%%ebp\n\t" 311 "movl %1,%%ebp\n\t"
311 "jmp resume_userspace" 312 "jmp resume_userspace"
312 : /* no outputs */ 313 : /* no outputs */
313 :"r" (&info->regs), "r" (tsk->thread_info) : "ax"); 314 :"r" (&info->regs), "r" (task_thread_info(tsk)) : "ax");
314 /* we never return here */ 315 /* we never return here */
315} 316}
316 317
diff --git a/arch/i386/mm/init.c b/arch/i386/mm/init.c
index 06e26f006238..2700f01994ba 100644
--- a/arch/i386/mm/init.c
+++ b/arch/i386/mm/init.c
@@ -268,7 +268,7 @@ static void __init permanent_kmaps_init(pgd_t *pgd_base)
268 pkmap_page_table = pte; 268 pkmap_page_table = pte;
269} 269}
270 270
271static void __devinit free_new_highpage(struct page *page) 271static void __meminit free_new_highpage(struct page *page)
272{ 272{
273 set_page_count(page, 1); 273 set_page_count(page, 1);
274 __free_page(page); 274 __free_page(page);
@@ -735,6 +735,30 @@ void free_initmem(void)
735 printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (__init_end - __init_begin) >> 10); 735 printk (KERN_INFO "Freeing unused kernel memory: %dk freed\n", (__init_end - __init_begin) >> 10);
736} 736}
737 737
738#ifdef CONFIG_DEBUG_RODATA
739
740extern char __start_rodata, __end_rodata;
741void mark_rodata_ro(void)
742{
743 unsigned long addr = (unsigned long)&__start_rodata;
744
745 for (; addr < (unsigned long)&__end_rodata; addr += PAGE_SIZE)
746 change_page_attr(virt_to_page(addr), 1, PAGE_KERNEL_RO);
747
748 printk ("Write protecting the kernel read-only data: %luk\n",
749 (unsigned long)(&__end_rodata - &__start_rodata) >> 10);
750
751 /*
752 * change_page_attr() requires a global_flush_tlb() call after it.
753 * We do this after the printk so that if something went wrong in the
754 * change, the printk gets out at least to give a better debug hint
755 * of who is the culprit.
756 */
757 global_flush_tlb();
758}
759#endif
760
761
738#ifdef CONFIG_BLK_DEV_INITRD 762#ifdef CONFIG_BLK_DEV_INITRD
739void free_initrd_mem(unsigned long start, unsigned long end) 763void free_initrd_mem(unsigned long start, unsigned long end)
740{ 764{
diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c
index 5d09de8d1c6b..247fde76aaed 100644
--- a/arch/i386/mm/ioremap.c
+++ b/arch/i386/mm/ioremap.c
@@ -223,9 +223,15 @@ void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size)
223} 223}
224EXPORT_SYMBOL(ioremap_nocache); 224EXPORT_SYMBOL(ioremap_nocache);
225 225
226/**
227 * iounmap - Free a IO remapping
228 * @addr: virtual address from ioremap_*
229 *
230 * Caller must ensure there is only one unmapping for the same pointer.
231 */
226void iounmap(volatile void __iomem *addr) 232void iounmap(volatile void __iomem *addr)
227{ 233{
228 struct vm_struct *p; 234 struct vm_struct *p, *o;
229 235
230 if ((void __force *)addr <= high_memory) 236 if ((void __force *)addr <= high_memory)
231 return; 237 return;
@@ -239,22 +245,37 @@ void iounmap(volatile void __iomem *addr)
239 addr < phys_to_virt(ISA_END_ADDRESS)) 245 addr < phys_to_virt(ISA_END_ADDRESS))
240 return; 246 return;
241 247
242 write_lock(&vmlist_lock); 248 addr = (volatile void __iomem *)(PAGE_MASK & (unsigned long __force)addr);
243 p = __remove_vm_area((void *)(PAGE_MASK & (unsigned long __force)addr)); 249
244 if (!p) { 250 /* Use the vm area unlocked, assuming the caller
245 printk(KERN_WARNING "iounmap: bad address %p\n", addr); 251 ensures there isn't another iounmap for the same address
252 in parallel. Reuse of the virtual address is prevented by
253 leaving it in the global lists until we're done with it.
254 cpa takes care of the direct mappings. */
255 read_lock(&vmlist_lock);
256 for (p = vmlist; p; p = p->next) {
257 if (p->addr == addr)
258 break;
259 }
260 read_unlock(&vmlist_lock);
261
262 if (!p) {
263 printk("iounmap: bad address %p\n", addr);
246 dump_stack(); 264 dump_stack();
247 goto out_unlock; 265 return;
248 } 266 }
249 267
268 /* Reset the direct mapping. Can block */
250 if ((p->flags >> 20) && p->phys_addr < virt_to_phys(high_memory) - 1) { 269 if ((p->flags >> 20) && p->phys_addr < virt_to_phys(high_memory) - 1) {
251 change_page_attr(virt_to_page(__va(p->phys_addr)), 270 change_page_attr(virt_to_page(__va(p->phys_addr)),
252 p->size >> PAGE_SHIFT, 271 p->size >> PAGE_SHIFT,
253 PAGE_KERNEL); 272 PAGE_KERNEL);
254 global_flush_tlb(); 273 global_flush_tlb();
255 } 274 }
256out_unlock: 275
257 write_unlock(&vmlist_lock); 276 /* Finally remove it */
277 o = remove_vm_area((void *)addr);
278 BUG_ON(p != o || o == NULL);
258 kfree(p); 279 kfree(p);
259} 280}
260EXPORT_SYMBOL(iounmap); 281EXPORT_SYMBOL(iounmap);
diff --git a/arch/i386/mm/pageattr.c b/arch/i386/mm/pageattr.c
index f600fc244f02..d0cadb33b54c 100644
--- a/arch/i386/mm/pageattr.c
+++ b/arch/i386/mm/pageattr.c
@@ -13,6 +13,7 @@
13#include <asm/processor.h> 13#include <asm/processor.h>
14#include <asm/tlbflush.h> 14#include <asm/tlbflush.h>
15#include <asm/pgalloc.h> 15#include <asm/pgalloc.h>
16#include <asm/sections.h>
16 17
17static DEFINE_SPINLOCK(cpa_lock); 18static DEFINE_SPINLOCK(cpa_lock);
18static struct list_head df_list = LIST_HEAD_INIT(df_list); 19static struct list_head df_list = LIST_HEAD_INIT(df_list);
@@ -36,7 +37,8 @@ pte_t *lookup_address(unsigned long address)
36 return pte_offset_kernel(pmd, address); 37 return pte_offset_kernel(pmd, address);
37} 38}
38 39
39static struct page *split_large_page(unsigned long address, pgprot_t prot) 40static struct page *split_large_page(unsigned long address, pgprot_t prot,
41 pgprot_t ref_prot)
40{ 42{
41 int i; 43 int i;
42 unsigned long addr; 44 unsigned long addr;
@@ -54,7 +56,7 @@ static struct page *split_large_page(unsigned long address, pgprot_t prot)
54 pbase = (pte_t *)page_address(base); 56 pbase = (pte_t *)page_address(base);
55 for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) { 57 for (i = 0; i < PTRS_PER_PTE; i++, addr += PAGE_SIZE) {
56 set_pte(&pbase[i], pfn_pte(addr >> PAGE_SHIFT, 58 set_pte(&pbase[i], pfn_pte(addr >> PAGE_SHIFT,
57 addr == address ? prot : PAGE_KERNEL)); 59 addr == address ? prot : ref_prot));
58 } 60 }
59 return base; 61 return base;
60} 62}
@@ -98,11 +100,18 @@ static void set_pmd_pte(pte_t *kpte, unsigned long address, pte_t pte)
98 */ 100 */
99static inline void revert_page(struct page *kpte_page, unsigned long address) 101static inline void revert_page(struct page *kpte_page, unsigned long address)
100{ 102{
101 pte_t *linear = (pte_t *) 103 pgprot_t ref_prot;
104 pte_t *linear;
105
106 ref_prot =
107 ((address & LARGE_PAGE_MASK) < (unsigned long)&_etext)
108 ? PAGE_KERNEL_LARGE_EXEC : PAGE_KERNEL_LARGE;
109
110 linear = (pte_t *)
102 pmd_offset(pud_offset(pgd_offset_k(address), address), address); 111 pmd_offset(pud_offset(pgd_offset_k(address), address), address);
103 set_pmd_pte(linear, address, 112 set_pmd_pte(linear, address,
104 pfn_pte((__pa(address) & LARGE_PAGE_MASK) >> PAGE_SHIFT, 113 pfn_pte((__pa(address) & LARGE_PAGE_MASK) >> PAGE_SHIFT,
105 PAGE_KERNEL_LARGE)); 114 ref_prot));
106} 115}
107 116
108static int 117static int
@@ -123,10 +132,16 @@ __change_page_attr(struct page *page, pgprot_t prot)
123 if ((pte_val(*kpte) & _PAGE_PSE) == 0) { 132 if ((pte_val(*kpte) & _PAGE_PSE) == 0) {
124 set_pte_atomic(kpte, mk_pte(page, prot)); 133 set_pte_atomic(kpte, mk_pte(page, prot));
125 } else { 134 } else {
126 struct page *split = split_large_page(address, prot); 135 pgprot_t ref_prot;
136 struct page *split;
137
138 ref_prot =
139 ((address & LARGE_PAGE_MASK) < (unsigned long)&_etext)
140 ? PAGE_KERNEL_EXEC : PAGE_KERNEL;
141 split = split_large_page(address, prot, ref_prot);
127 if (!split) 142 if (!split)
128 return -ENOMEM; 143 return -ENOMEM;
129 set_pmd_pte(kpte,address,mk_pte(split, PAGE_KERNEL)); 144 set_pmd_pte(kpte,address,mk_pte(split, ref_prot));
130 kpte_page = split; 145 kpte_page = split;
131 } 146 }
132 get_page(kpte_page); 147 get_page(kpte_page);
@@ -207,6 +222,10 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
207{ 222{
208 if (PageHighMem(page)) 223 if (PageHighMem(page))
209 return; 224 return;
225 if (!enable)
226 mutex_debug_check_no_locks_freed(page_address(page),
227 numpages * PAGE_SIZE);
228
210 /* the return value is ignored - the calls cannot fail, 229 /* the return value is ignored - the calls cannot fail,
211 * large pages are disabled at boot time. 230 * large pages are disabled at boot time.
212 */ 231 */
diff --git a/arch/i386/pci/Makefile b/arch/i386/pci/Makefile
index ead6122dd06d..5461d4d5ea1e 100644
--- a/arch/i386/pci/Makefile
+++ b/arch/i386/pci/Makefile
@@ -1,7 +1,7 @@
1obj-y := i386.o 1obj-y := i386.o
2 2
3obj-$(CONFIG_PCI_BIOS) += pcbios.o 3obj-$(CONFIG_PCI_BIOS) += pcbios.o
4obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o 4obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o
5obj-$(CONFIG_PCI_DIRECT) += direct.o 5obj-$(CONFIG_PCI_DIRECT) += direct.o
6 6
7pci-y := fixup.o 7pci-y := fixup.o
diff --git a/arch/i386/pci/acpi.c b/arch/i386/pci/acpi.c
index 4c4522b43be5..b33aea845f58 100644
--- a/arch/i386/pci/acpi.c
+++ b/arch/i386/pci/acpi.c
@@ -53,7 +53,7 @@ static int __init pci_acpi_init(void)
53 * don't use pci_enable_device(). 53 * don't use pci_enable_device().
54 */ 54 */
55 printk(KERN_INFO "PCI: Routing PCI interrupts for all devices because \"pci=routeirq\" specified\n"); 55 printk(KERN_INFO "PCI: Routing PCI interrupts for all devices because \"pci=routeirq\" specified\n");
56 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) 56 for_each_pci_dev(dev)
57 acpi_pci_irq_enable(dev); 57 acpi_pci_irq_enable(dev);
58 } else 58 } else
59 printk(KERN_INFO "PCI: If a device doesn't work, try \"pci=routeirq\". If it helps, post a report\n"); 59 printk(KERN_INFO "PCI: If a device doesn't work, try \"pci=routeirq\". If it helps, post a report\n");
diff --git a/arch/i386/pci/direct.c b/arch/i386/pci/direct.c
index 94331d6be7a3..e3ac502bf2fb 100644
--- a/arch/i386/pci/direct.c
+++ b/arch/i386/pci/direct.c
@@ -13,7 +13,7 @@
13#define PCI_CONF1_ADDRESS(bus, devfn, reg) \ 13#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
14 (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3)) 14 (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
15 15
16static int pci_conf1_read(unsigned int seg, unsigned int bus, 16int pci_conf1_read(unsigned int seg, unsigned int bus,
17 unsigned int devfn, int reg, int len, u32 *value) 17 unsigned int devfn, int reg, int len, u32 *value)
18{ 18{
19 unsigned long flags; 19 unsigned long flags;
@@ -42,7 +42,7 @@ static int pci_conf1_read(unsigned int seg, unsigned int bus,
42 return 0; 42 return 0;
43} 43}
44 44
45static int pci_conf1_write(unsigned int seg, unsigned int bus, 45int pci_conf1_write(unsigned int seg, unsigned int bus,
46 unsigned int devfn, int reg, int len, u32 value) 46 unsigned int devfn, int reg, int len, u32 value)
47{ 47{
48 unsigned long flags; 48 unsigned long flags;
diff --git a/arch/i386/pci/fixup.c b/arch/i386/pci/fixup.c
index eeb1b1f2d548..83c3645ccc43 100644
--- a/arch/i386/pci/fixup.c
+++ b/arch/i386/pci/fixup.c
@@ -413,6 +413,13 @@ static struct dmi_system_id __devinitdata toshiba_ohci1394_dmi_table[] = {
413 DMI_MATCH(DMI_PRODUCT_VERSION, "PSM4"), 413 DMI_MATCH(DMI_PRODUCT_VERSION, "PSM4"),
414 }, 414 },
415 }, 415 },
416 {
417 .ident = "Toshiba A40 based laptop",
418 .matches = {
419 DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
420 DMI_MATCH(DMI_PRODUCT_VERSION, "PSA40U"),
421 },
422 },
416 { } 423 { }
417}; 424};
418 425
@@ -442,3 +449,19 @@ static void __devinit pci_post_fixup_toshiba_ohci1394(struct pci_dev *dev)
442} 449}
443DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_TI, 0x8032, 450DECLARE_PCI_FIXUP_ENABLE(PCI_VENDOR_ID_TI, 0x8032,
444 pci_post_fixup_toshiba_ohci1394); 451 pci_post_fixup_toshiba_ohci1394);
452
453
454/*
455 * Prevent the BIOS trapping accesses to the Cyrix CS5530A video device
456 * configuration space.
457 */
458static void __devinit pci_early_fixup_cyrix_5530(struct pci_dev *dev)
459{
460 u8 r;
461 /* clear 'F4 Video Configuration Trap' bit */
462 pci_read_config_byte(dev, 0x42, &r);
463 r &= 0xfd;
464 pci_write_config_byte(dev, 0x42, r);
465}
466DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY,
467 pci_early_fixup_cyrix_5530);
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index 19e6f4871d1e..e715aa930036 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -78,7 +78,7 @@ static inline struct irq_routing_table * pirq_check_routing_table(u8 *addr)
78 for (i=0; i < rt->size; i++) 78 for (i=0; i < rt->size; i++)
79 sum += addr[i]; 79 sum += addr[i];
80 if (!sum) { 80 if (!sum) {
81 DBG("PCI: Interrupt Routing Table found at 0x%p\n", rt); 81 DBG(KERN_DEBUG "PCI: Interrupt Routing Table found at 0x%p\n", rt);
82 return rt; 82 return rt;
83 } 83 }
84 return NULL; 84 return NULL;
@@ -128,7 +128,7 @@ static void __init pirq_peer_trick(void)
128#ifdef DEBUG 128#ifdef DEBUG
129 { 129 {
130 int j; 130 int j;
131 DBG("%02x:%02x slot=%02x", e->bus, e->devfn/8, e->slot); 131 DBG(KERN_DEBUG "%02x:%02x slot=%02x", e->bus, e->devfn/8, e->slot);
132 for(j=0; j<4; j++) 132 for(j=0; j<4; j++)
133 DBG(" %d:%02x/%04x", j, e->irq[j].link, e->irq[j].bitmap); 133 DBG(" %d:%02x/%04x", j, e->irq[j].link, e->irq[j].bitmap);
134 DBG("\n"); 134 DBG("\n");
@@ -160,10 +160,10 @@ void eisa_set_level_irq(unsigned int irq)
160 return; 160 return;
161 161
162 eisa_irq_mask |= (1 << irq); 162 eisa_irq_mask |= (1 << irq);
163 printk("PCI: setting IRQ %u as level-triggered\n", irq); 163 printk(KERN_DEBUG "PCI: setting IRQ %u as level-triggered\n", irq);
164 val = inb(port); 164 val = inb(port);
165 if (!(val & mask)) { 165 if (!(val & mask)) {
166 DBG(" -> edge"); 166 DBG(KERN_DEBUG " -> edge");
167 outb(val | mask, port); 167 outb(val | mask, port);
168 } 168 }
169} 169}
@@ -677,11 +677,11 @@ static __init int ali_router_probe(struct irq_router *r, struct pci_dev *router,
677 { 677 {
678 case PCI_DEVICE_ID_AL_M1533: 678 case PCI_DEVICE_ID_AL_M1533:
679 case PCI_DEVICE_ID_AL_M1563: 679 case PCI_DEVICE_ID_AL_M1563:
680 printk("PCI: Using ALI IRQ Router\n"); 680 printk(KERN_DEBUG "PCI: Using ALI IRQ Router\n");
681 r->name = "ALI"; 681 r->name = "ALI";
682 r->get = pirq_ali_get; 682 r->get = pirq_ali_get;
683 r->set = pirq_ali_set; 683 r->set = pirq_ali_set;
684 return 1; 684 return 1;
685 } 685 }
686 return 0; 686 return 0;
687} 687}
@@ -749,12 +749,13 @@ static void __init pirq_find_router(struct irq_router *r)
749 r->get = NULL; 749 r->get = NULL;
750 r->set = NULL; 750 r->set = NULL;
751 751
752 DBG("PCI: Attempting to find IRQ router for %04x:%04x\n", 752 DBG(KERN_DEBUG "PCI: Attempting to find IRQ router for %04x:%04x\n",
753 rt->rtr_vendor, rt->rtr_device); 753 rt->rtr_vendor, rt->rtr_device);
754 754
755 pirq_router_dev = pci_find_slot(rt->rtr_bus, rt->rtr_devfn); 755 pirq_router_dev = pci_find_slot(rt->rtr_bus, rt->rtr_devfn);
756 if (!pirq_router_dev) { 756 if (!pirq_router_dev) {
757 DBG("PCI: Interrupt router not found at %02x:%02x\n", rt->rtr_bus, rt->rtr_devfn); 757 DBG(KERN_DEBUG "PCI: Interrupt router not found at "
758 "%02x:%02x\n", rt->rtr_bus, rt->rtr_devfn);
758 return; 759 return;
759 } 760 }
760 761
@@ -799,7 +800,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
799 /* Find IRQ pin */ 800 /* Find IRQ pin */
800 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); 801 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
801 if (!pin) { 802 if (!pin) {
802 DBG(" -> no interrupt pin\n"); 803 DBG(KERN_DEBUG " -> no interrupt pin\n");
803 return 0; 804 return 0;
804 } 805 }
805 pin = pin - 1; 806 pin = pin - 1;
@@ -809,16 +810,16 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
809 if (!pirq_table) 810 if (!pirq_table)
810 return 0; 811 return 0;
811 812
812 DBG("IRQ for %s[%c]", pci_name(dev), 'A' + pin); 813 DBG(KERN_DEBUG "IRQ for %s[%c]", pci_name(dev), 'A' + pin);
813 info = pirq_get_info(dev); 814 info = pirq_get_info(dev);
814 if (!info) { 815 if (!info) {
815 DBG(" -> not found in routing table\n"); 816 DBG(" -> not found in routing table\n" KERN_DEBUG);
816 return 0; 817 return 0;
817 } 818 }
818 pirq = info->irq[pin].link; 819 pirq = info->irq[pin].link;
819 mask = info->irq[pin].bitmap; 820 mask = info->irq[pin].bitmap;
820 if (!pirq) { 821 if (!pirq) {
821 DBG(" -> not routed\n"); 822 DBG(" -> not routed\n" KERN_DEBUG);
822 return 0; 823 return 0;
823 } 824 }
824 DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask, pirq_table->exclusive_irqs); 825 DBG(" -> PIRQ %02x, mask %04x, excl %04x", pirq, mask, pirq_table->exclusive_irqs);
@@ -846,9 +847,12 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
846 * reported by the device if possible. 847 * reported by the device if possible.
847 */ 848 */
848 newirq = dev->irq; 849 newirq = dev->irq;
849 if (!((1 << newirq) & mask)) { 850 if (newirq && !((1 << newirq) & mask)) {
850 if ( pci_probe & PCI_USE_PIRQ_MASK) newirq = 0; 851 if ( pci_probe & PCI_USE_PIRQ_MASK) newirq = 0;
851 else printk(KERN_WARNING "PCI: IRQ %i for device %s doesn't match PIRQ mask - try pci=usepirqmask\n", newirq, pci_name(dev)); 852 else printk("\n" KERN_WARNING
853 "PCI: IRQ %i for device %s doesn't match PIRQ mask "
854 "- try pci=usepirqmask\n" KERN_DEBUG, newirq,
855 pci_name(dev));
852 } 856 }
853 if (!newirq && assign) { 857 if (!newirq && assign) {
854 for (i = 0; i < 16; i++) { 858 for (i = 0; i < 16; i++) {
@@ -923,14 +927,14 @@ static void __init pcibios_fixup_irqs(void)
923 struct pci_dev *dev = NULL; 927 struct pci_dev *dev = NULL;
924 u8 pin; 928 u8 pin;
925 929
926 DBG("PCI: IRQ fixup\n"); 930 DBG(KERN_DEBUG "PCI: IRQ fixup\n");
927 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 931 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
928 /* 932 /*
929 * If the BIOS has set an out of range IRQ number, just ignore it. 933 * If the BIOS has set an out of range IRQ number, just ignore it.
930 * Also keep track of which IRQ's are already in use. 934 * Also keep track of which IRQ's are already in use.
931 */ 935 */
932 if (dev->irq >= 16) { 936 if (dev->irq >= 16) {
933 DBG("%s: ignoring bogus IRQ %d\n", pci_name(dev), dev->irq); 937 DBG(KERN_DEBUG "%s: ignoring bogus IRQ %d\n", pci_name(dev), dev->irq);
934 dev->irq = 0; 938 dev->irq = 0;
935 } 939 }
936 /* If the IRQ is already assigned to a PCI device, ignore its ISA use penalty */ 940 /* If the IRQ is already assigned to a PCI device, ignore its ISA use penalty */
@@ -1039,7 +1043,7 @@ static struct dmi_system_id __initdata pciirq_dmi_table[] = {
1039 1043
1040static int __init pcibios_irq_init(void) 1044static int __init pcibios_irq_init(void)
1041{ 1045{
1042 DBG("PCI: IRQ init\n"); 1046 DBG(KERN_DEBUG "PCI: IRQ init\n");
1043 1047
1044 if (pcibios_enable_irq || raw_pci_ops == NULL) 1048 if (pcibios_enable_irq || raw_pci_ops == NULL)
1045 return 0; 1049 return 0;
diff --git a/arch/i386/pci/mmconfig.c b/arch/i386/pci/mmconfig.c
index dfbf80cff834..4bb4d4b0f73a 100644
--- a/arch/i386/pci/mmconfig.c
+++ b/arch/i386/pci/mmconfig.c
@@ -19,21 +19,25 @@
19/* The base address of the last MMCONFIG device accessed */ 19/* The base address of the last MMCONFIG device accessed */
20static u32 mmcfg_last_accessed_device; 20static u32 mmcfg_last_accessed_device;
21 21
22static DECLARE_BITMAP(fallback_slots, 32);
23
22/* 24/*
23 * Functions for accessing PCI configuration space with MMCONFIG accesses 25 * Functions for accessing PCI configuration space with MMCONFIG accesses
24 */ 26 */
25static u32 get_base_addr(unsigned int seg, int bus) 27static u32 get_base_addr(unsigned int seg, int bus, unsigned devfn)
26{ 28{
27 int cfg_num = -1; 29 int cfg_num = -1;
28 struct acpi_table_mcfg_config *cfg; 30 struct acpi_table_mcfg_config *cfg;
29 31
32 if (seg == 0 && bus == 0 &&
33 test_bit(PCI_SLOT(devfn), fallback_slots))
34 return 0;
35
30 while (1) { 36 while (1) {
31 ++cfg_num; 37 ++cfg_num;
32 if (cfg_num >= pci_mmcfg_config_num) { 38 if (cfg_num >= pci_mmcfg_config_num) {
33 /* something bad is going on, no cfg table is found. */ 39 /* Not found - fallback to type 1 */
34 /* so we fall back to the old way we used to do this */ 40 return 0;
35 /* and just rely on the first entry to be correct. */
36 return pci_mmcfg_config[0].base_address;
37 } 41 }
38 cfg = &pci_mmcfg_config[cfg_num]; 42 cfg = &pci_mmcfg_config[cfg_num];
39 if (cfg->pci_segment_group_number != seg) 43 if (cfg->pci_segment_group_number != seg)
@@ -44,9 +48,9 @@ static u32 get_base_addr(unsigned int seg, int bus)
44 } 48 }
45} 49}
46 50
47static inline void pci_exp_set_dev_base(unsigned int seg, int bus, int devfn) 51static inline void pci_exp_set_dev_base(unsigned int base, int bus, int devfn)
48{ 52{
49 u32 dev_base = get_base_addr(seg, bus) | (bus << 20) | (devfn << 12); 53 u32 dev_base = base | (bus << 20) | (devfn << 12);
50 if (dev_base != mmcfg_last_accessed_device) { 54 if (dev_base != mmcfg_last_accessed_device) {
51 mmcfg_last_accessed_device = dev_base; 55 mmcfg_last_accessed_device = dev_base;
52 set_fixmap_nocache(FIX_PCIE_MCFG, dev_base); 56 set_fixmap_nocache(FIX_PCIE_MCFG, dev_base);
@@ -57,13 +61,18 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
57 unsigned int devfn, int reg, int len, u32 *value) 61 unsigned int devfn, int reg, int len, u32 *value)
58{ 62{
59 unsigned long flags; 63 unsigned long flags;
64 u32 base;
60 65
61 if (!value || (bus > 255) || (devfn > 255) || (reg > 4095)) 66 if (!value || (bus > 255) || (devfn > 255) || (reg > 4095))
62 return -EINVAL; 67 return -EINVAL;
63 68
69 base = get_base_addr(seg, bus, devfn);
70 if (!base)
71 return pci_conf1_read(seg,bus,devfn,reg,len,value);
72
64 spin_lock_irqsave(&pci_config_lock, flags); 73 spin_lock_irqsave(&pci_config_lock, flags);
65 74
66 pci_exp_set_dev_base(seg, bus, devfn); 75 pci_exp_set_dev_base(base, bus, devfn);
67 76
68 switch (len) { 77 switch (len) {
69 case 1: 78 case 1:
@@ -86,13 +95,18 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
86 unsigned int devfn, int reg, int len, u32 value) 95 unsigned int devfn, int reg, int len, u32 value)
87{ 96{
88 unsigned long flags; 97 unsigned long flags;
98 u32 base;
89 99
90 if ((bus > 255) || (devfn > 255) || (reg > 4095)) 100 if ((bus > 255) || (devfn > 255) || (reg > 4095))
91 return -EINVAL; 101 return -EINVAL;
92 102
103 base = get_base_addr(seg, bus, devfn);
104 if (!base)
105 return pci_conf1_write(seg,bus,devfn,reg,len,value);
106
93 spin_lock_irqsave(&pci_config_lock, flags); 107 spin_lock_irqsave(&pci_config_lock, flags);
94 108
95 pci_exp_set_dev_base(seg, bus, devfn); 109 pci_exp_set_dev_base(base, bus, devfn);
96 110
97 switch (len) { 111 switch (len) {
98 case 1: 112 case 1:
@@ -116,6 +130,37 @@ static struct pci_raw_ops pci_mmcfg = {
116 .write = pci_mmcfg_write, 130 .write = pci_mmcfg_write,
117}; 131};
118 132
133/* K8 systems have some devices (typically in the builtin northbridge)
134 that are only accessible using type1
135 Normally this can be expressed in the MCFG by not listing them
136 and assigning suitable _SEGs, but this isn't implemented in some BIOS.
137 Instead try to discover all devices on bus 0 that are unreachable using MM
138 and fallback for them.
139 We only do this for bus 0/seg 0 */
140static __init void unreachable_devices(void)
141{
142 int i;
143 unsigned long flags;
144
145 for (i = 0; i < 32; i++) {
146 u32 val1;
147 u32 addr;
148
149 pci_conf1_read(0, 0, PCI_DEVFN(i, 0), 0, 4, &val1);
150 if (val1 == 0xffffffff)
151 continue;
152
153 /* Locking probably not needed, but safer */
154 spin_lock_irqsave(&pci_config_lock, flags);
155 addr = get_base_addr(0, 0, PCI_DEVFN(i, 0));
156 if (addr != 0)
157 pci_exp_set_dev_base(addr, 0, PCI_DEVFN(i, 0));
158 if (addr == 0 || readl((u32 __iomem *)mmcfg_virt_addr) != val1)
159 set_bit(i, fallback_slots);
160 spin_unlock_irqrestore(&pci_config_lock, flags);
161 }
162}
163
119static int __init pci_mmcfg_init(void) 164static int __init pci_mmcfg_init(void)
120{ 165{
121 if ((pci_probe & PCI_PROBE_MMCONF) == 0) 166 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
@@ -131,6 +176,8 @@ static int __init pci_mmcfg_init(void)
131 raw_pci_ops = &pci_mmcfg; 176 raw_pci_ops = &pci_mmcfg;
132 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; 177 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
133 178
179 unreachable_devices();
180
134 out: 181 out:
135 return 0; 182 return 0;
136} 183}
diff --git a/arch/i386/pci/pci.h b/arch/i386/pci/pci.h
index 127d53ad16be..f550781ec310 100644
--- a/arch/i386/pci/pci.h
+++ b/arch/i386/pci/pci.h
@@ -74,3 +74,10 @@ extern spinlock_t pci_config_lock;
74 74
75extern int (*pcibios_enable_irq)(struct pci_dev *dev); 75extern int (*pcibios_enable_irq)(struct pci_dev *dev);
76extern void (*pcibios_disable_irq)(struct pci_dev *dev); 76extern void (*pcibios_disable_irq)(struct pci_dev *dev);
77
78extern int pci_conf1_write(unsigned int seg, unsigned int bus,
79 unsigned int devfn, int reg, int len, u32 value);
80extern int pci_conf1_read(unsigned int seg, unsigned int bus,
81 unsigned int devfn, int reg, int len, u32 *value);
82
83
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index b76ce1fe2e7f..199eeaf0f4e3 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -58,7 +58,7 @@ config IA64_UNCACHED_ALLOCATOR
58 bool 58 bool
59 select GENERIC_ALLOCATOR 59 select GENERIC_ALLOCATOR
60 60
61config ZONE_DMA_IS_DMA32 61config DMA_IS_DMA32
62 bool 62 bool
63 default y 63 default y
64 64
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index 67932ad53082..f722e1a25948 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -25,7 +25,6 @@ cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \
25 -falign-functions=32 -frename-registers -fno-optimize-sibling-calls 25 -falign-functions=32 -frename-registers -fno-optimize-sibling-calls
26CFLAGS_KERNEL := -mconstant-gp 26CFLAGS_KERNEL := -mconstant-gp
27 27
28GCC_VERSION := $(call cc-version)
29GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)") 28GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)")
30CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)") 29CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)")
31 30
@@ -37,11 +36,7 @@ $(error Sorry, you need a newer version of the assember, one that is built from
37 ftp://ftp.hpl.hp.com/pub/linux-ia64/gas-030124.tar.gz) 36 ftp://ftp.hpl.hp.com/pub/linux-ia64/gas-030124.tar.gz)
38endif 37endif
39 38
40ifneq ($(shell if [ $(GCC_VERSION) -lt 0300 ] ; then echo "bad"; fi ;),) 39ifeq ($(call cc-version),0304)
41$(error Sorry, your compiler is too old. GCC v2.96 is known to generate bad code.)
42endif
43
44ifeq ($(GCC_VERSION),0304)
45 cflags-$(CONFIG_ITANIUM) += -mtune=merced 40 cflags-$(CONFIG_ITANIUM) += -mtune=merced
46 cflags-$(CONFIG_MCKINLEY) += -mtune=mckinley 41 cflags-$(CONFIG_MCKINLEY) += -mtune=mckinley
47endif 42endif
diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig
index 80f8663bc6d9..991c07b57c24 100644
--- a/arch/ia64/configs/gensparse_defconfig
+++ b/arch/ia64/configs/gensparse_defconfig
@@ -557,6 +557,7 @@ CONFIG_E100=m
557# CONFIG_DL2K is not set 557# CONFIG_DL2K is not set
558CONFIG_E1000=y 558CONFIG_E1000=y
559# CONFIG_E1000_NAPI is not set 559# CONFIG_E1000_NAPI is not set
560# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
560# CONFIG_NS83820 is not set 561# CONFIG_NS83820 is not set
561# CONFIG_HAMACHI is not set 562# CONFIG_HAMACHI is not set
562# CONFIG_YELLOWFIN is not set 563# CONFIG_YELLOWFIN is not set
@@ -701,6 +702,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
701CONFIG_SERIAL_SGI_L1_CONSOLE=y 702CONFIG_SERIAL_SGI_L1_CONSOLE=y
702# CONFIG_SERIAL_JSM is not set 703# CONFIG_SERIAL_JSM is not set
703CONFIG_SERIAL_SGI_IOC4=y 704CONFIG_SERIAL_SGI_IOC4=y
705CONFIG_SERIAL_SGI_IOC3=y
704CONFIG_UNIX98_PTYS=y 706CONFIG_UNIX98_PTYS=y
705CONFIG_LEGACY_PTYS=y 707CONFIG_LEGACY_PTYS=y
706CONFIG_LEGACY_PTY_COUNT=256 708CONFIG_LEGACY_PTY_COUNT=256
@@ -1046,6 +1048,7 @@ CONFIG_INFINIBAND_IPOIB=m
1046# SN Devices 1048# SN Devices
1047# 1049#
1048CONFIG_SGI_IOC4=y 1050CONFIG_SGI_IOC4=y
1051CONFIG_SGI_IOC3=y
1049 1052
1050# 1053#
1051# File systems 1054# File systems
diff --git a/arch/ia64/configs/sn2_defconfig b/arch/ia64/configs/sn2_defconfig
index 87cfd31a4a39..3cb503b659e6 100644
--- a/arch/ia64/configs/sn2_defconfig
+++ b/arch/ia64/configs/sn2_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.13-rc6 3# Linux kernel version: 2.6.15-rc4
4# Tue Aug 16 14:40:41 2005 4# Fri Dec 2 10:33:48 2005
5# 5#
6 6
7# 7#
@@ -16,6 +16,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
16# General setup 16# General setup
17# 17#
18CONFIG_LOCALVERSION="" 18CONFIG_LOCALVERSION=""
19# CONFIG_LOCALVERSION_AUTO is not set
19CONFIG_SWAP=y 20CONFIG_SWAP=y
20CONFIG_SYSVIPC=y 21CONFIG_SYSVIPC=y
21CONFIG_POSIX_MQUEUE=y 22CONFIG_POSIX_MQUEUE=y
@@ -26,6 +27,7 @@ CONFIG_HOTPLUG=y
26CONFIG_KOBJECT_UEVENT=y 27CONFIG_KOBJECT_UEVENT=y
27# CONFIG_IKCONFIG is not set 28# CONFIG_IKCONFIG is not set
28CONFIG_CPUSETS=y 29CONFIG_CPUSETS=y
30CONFIG_INITRAMFS_SOURCE=""
29# CONFIG_EMBEDDED is not set 31# CONFIG_EMBEDDED is not set
30CONFIG_KALLSYMS=y 32CONFIG_KALLSYMS=y
31CONFIG_KALLSYMS_ALL=y 33CONFIG_KALLSYMS_ALL=y
@@ -56,11 +58,29 @@ CONFIG_KMOD=y
56CONFIG_STOP_MACHINE=y 58CONFIG_STOP_MACHINE=y
57 59
58# 60#
61# Block layer
62#
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
59# Processor type and features 78# Processor type and features
60# 79#
61CONFIG_IA64=y 80CONFIG_IA64=y
62CONFIG_64BIT=y 81CONFIG_64BIT=y
63CONFIG_MMU=y 82CONFIG_MMU=y
83CONFIG_SWIOTLB=y
64CONFIG_RWSEM_XCHGADD_ALGORITHM=y 84CONFIG_RWSEM_XCHGADD_ALGORITHM=y
65CONFIG_GENERIC_CALIBRATE_DELAY=y 85CONFIG_GENERIC_CALIBRATE_DELAY=y
66CONFIG_TIME_INTERPOLATION=y 86CONFIG_TIME_INTERPOLATION=y
@@ -68,6 +88,7 @@ CONFIG_EFI=y
68CONFIG_GENERIC_IOMAP=y 88CONFIG_GENERIC_IOMAP=y
69CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 89CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
70CONFIG_IA64_UNCACHED_ALLOCATOR=y 90CONFIG_IA64_UNCACHED_ALLOCATOR=y
91CONFIG_ZONE_DMA_IS_DMA32=y
71# CONFIG_IA64_GENERIC is not set 92# CONFIG_IA64_GENERIC is not set
72# CONFIG_IA64_DIG is not set 93# CONFIG_IA64_DIG is not set
73# CONFIG_IA64_HP_ZX1 is not set 94# CONFIG_IA64_HP_ZX1 is not set
@@ -87,16 +108,12 @@ CONFIG_HZ_250=y
87# CONFIG_HZ_1000 is not set 108# CONFIG_HZ_1000 is not set
88CONFIG_HZ=250 109CONFIG_HZ=250
89CONFIG_IA64_L1_CACHE_SHIFT=7 110CONFIG_IA64_L1_CACHE_SHIFT=7
90CONFIG_NUMA=y
91CONFIG_VIRTUAL_MEM_MAP=y
92CONFIG_HOLES_IN_ZONE=y
93CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
94# CONFIG_IA64_CYCLONE is not set 111# CONFIG_IA64_CYCLONE is not set
95CONFIG_IOSAPIC=y 112CONFIG_IOSAPIC=y
96CONFIG_IA64_SGI_SN_XP=m 113CONFIG_IA64_SGI_SN_XP=m
97CONFIG_FORCE_MAX_ZONEORDER=18 114CONFIG_FORCE_MAX_ZONEORDER=17
98CONFIG_SMP=y 115CONFIG_SMP=y
99CONFIG_NR_CPUS=512 116CONFIG_NR_CPUS=1024
100# CONFIG_HOTPLUG_CPU is not set 117# CONFIG_HOTPLUG_CPU is not set
101CONFIG_SCHED_SMT=y 118CONFIG_SCHED_SMT=y
102CONFIG_PREEMPT=y 119CONFIG_PREEMPT=y
@@ -107,7 +124,17 @@ CONFIG_DISCONTIGMEM_MANUAL=y
107CONFIG_DISCONTIGMEM=y 124CONFIG_DISCONTIGMEM=y
108CONFIG_FLAT_NODE_MEM_MAP=y 125CONFIG_FLAT_NODE_MEM_MAP=y
109CONFIG_NEED_MULTIPLE_NODES=y 126CONFIG_NEED_MULTIPLE_NODES=y
110CONFIG_HAVE_DEC_LOCK=y 127# CONFIG_SPARSEMEM_STATIC is not set
128CONFIG_SPLIT_PTLOCK_CPUS=4
129CONFIG_ARCH_SELECT_MEMORY_MODEL=y
130CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
131CONFIG_ARCH_FLATMEM_ENABLE=y
132CONFIG_ARCH_SPARSEMEM_ENABLE=y
133CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
134CONFIG_NUMA=y
135CONFIG_VIRTUAL_MEM_MAP=y
136CONFIG_HOLES_IN_ZONE=y
137CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
111CONFIG_IA32_SUPPORT=y 138CONFIG_IA32_SUPPORT=y
112CONFIG_COMPAT=y 139CONFIG_COMPAT=y
113CONFIG_IA64_MCA_RECOVERY=y 140CONFIG_IA64_MCA_RECOVERY=y
@@ -126,28 +153,35 @@ CONFIG_BINFMT_ELF=y
126# Power management and ACPI 153# Power management and ACPI
127# 154#
128CONFIG_PM=y 155CONFIG_PM=y
129CONFIG_ACPI=y 156# CONFIG_PM_LEGACY is not set
157# CONFIG_PM_DEBUG is not set
130 158
131# 159#
132# ACPI (Advanced Configuration and Power Interface) Support 160# ACPI (Advanced Configuration and Power Interface) Support
133# 161#
162CONFIG_ACPI=y
134# CONFIG_ACPI_BUTTON is not set 163# CONFIG_ACPI_BUTTON is not set
135# CONFIG_ACPI_FAN is not set 164# CONFIG_ACPI_FAN is not set
136# CONFIG_ACPI_PROCESSOR is not set 165# CONFIG_ACPI_PROCESSOR is not set
137CONFIG_ACPI_NUMA=y 166CONFIG_ACPI_NUMA=y
167CONFIG_ACPI_BLACKLIST_YEAR=0
138# CONFIG_ACPI_DEBUG is not set 168# CONFIG_ACPI_DEBUG is not set
139CONFIG_ACPI_POWER=y 169CONFIG_ACPI_POWER=y
140CONFIG_ACPI_SYSTEM=y 170CONFIG_ACPI_SYSTEM=y
141# CONFIG_ACPI_CONTAINER is not set 171# CONFIG_ACPI_CONTAINER is not set
142 172
143# 173#
174# CPU Frequency scaling
175#
176# CONFIG_CPU_FREQ is not set
177
178#
144# Bus options (PCI, PCMCIA) 179# Bus options (PCI, PCMCIA)
145# 180#
146CONFIG_PCI=y 181CONFIG_PCI=y
147CONFIG_PCI_DOMAINS=y 182CONFIG_PCI_DOMAINS=y
148# CONFIG_PCI_MSI is not set 183# CONFIG_PCI_MSI is not set
149CONFIG_PCI_LEGACY_PROC=y 184CONFIG_PCI_LEGACY_PROC=y
150CONFIG_PCI_NAMES=y
151# CONFIG_PCI_DEBUG is not set 185# CONFIG_PCI_DEBUG is not set
152 186
153# 187#
@@ -191,8 +225,8 @@ CONFIG_SYN_COOKIES=y
191# CONFIG_INET_ESP is not set 225# CONFIG_INET_ESP is not set
192# CONFIG_INET_IPCOMP is not set 226# CONFIG_INET_IPCOMP is not set
193# CONFIG_INET_TUNNEL is not set 227# CONFIG_INET_TUNNEL is not set
194CONFIG_IP_TCPDIAG=y 228CONFIG_INET_DIAG=m
195# CONFIG_IP_TCPDIAG_IPV6 is not set 229CONFIG_INET_TCP_DIAG=m
196# CONFIG_TCP_CONG_ADVANCED is not set 230# CONFIG_TCP_CONG_ADVANCED is not set
197CONFIG_TCP_CONG_BIC=y 231CONFIG_TCP_CONG_BIC=y
198CONFIG_IPV6=m 232CONFIG_IPV6=m
@@ -205,6 +239,11 @@ CONFIG_IPV6=m
205# CONFIG_NETFILTER is not set 239# CONFIG_NETFILTER is not set
206 240
207# 241#
242# DCCP Configuration (EXPERIMENTAL)
243#
244# CONFIG_IP_DCCP is not set
245
246#
208# SCTP Configuration (EXPERIMENTAL) 247# SCTP Configuration (EXPERIMENTAL)
209# 248#
210# CONFIG_IP_SCTP is not set 249# CONFIG_IP_SCTP is not set
@@ -220,8 +259,11 @@ CONFIG_IPV6=m
220# CONFIG_NET_DIVERT is not set 259# CONFIG_NET_DIVERT is not set
221# CONFIG_ECONET is not set 260# CONFIG_ECONET is not set
222# CONFIG_WAN_ROUTER is not set 261# CONFIG_WAN_ROUTER is not set
262
263#
264# QoS and/or fair queueing
265#
223# CONFIG_NET_SCHED is not set 266# CONFIG_NET_SCHED is not set
224# CONFIG_NET_CLS_ROUTE is not set
225 267
226# 268#
227# Network testing 269# Network testing
@@ -230,6 +272,7 @@ CONFIG_IPV6=m
230# CONFIG_HAMRADIO is not set 272# CONFIG_HAMRADIO is not set
231# CONFIG_IRDA is not set 273# CONFIG_IRDA is not set
232# CONFIG_BT is not set 274# CONFIG_BT is not set
275# CONFIG_IEEE80211 is not set
233 276
234# 277#
235# Device Drivers 278# Device Drivers
@@ -244,6 +287,11 @@ CONFIG_FW_LOADER=y
244# CONFIG_DEBUG_DRIVER is not set 287# CONFIG_DEBUG_DRIVER is not set
245 288
246# 289#
290# Connector - unified userspace <-> kernelspace linker
291#
292# CONFIG_CONNECTOR is not set
293
294#
247# Memory Technology Devices (MTD) 295# Memory Technology Devices (MTD)
248# 296#
249# CONFIG_MTD is not set 297# CONFIG_MTD is not set
@@ -275,16 +323,7 @@ CONFIG_BLK_DEV_RAM=y
275CONFIG_BLK_DEV_RAM_COUNT=16 323CONFIG_BLK_DEV_RAM_COUNT=16
276CONFIG_BLK_DEV_RAM_SIZE=4096 324CONFIG_BLK_DEV_RAM_SIZE=4096
277CONFIG_BLK_DEV_INITRD=y 325CONFIG_BLK_DEV_INITRD=y
278CONFIG_INITRAMFS_SOURCE=""
279# CONFIG_CDROM_PKTCDVD is not set 326# CONFIG_CDROM_PKTCDVD is not set
280
281#
282# IO Schedulers
283#
284CONFIG_IOSCHED_NOOP=y
285CONFIG_IOSCHED_AS=y
286CONFIG_IOSCHED_DEADLINE=y
287CONFIG_IOSCHED_CFQ=y
288CONFIG_ATA_OVER_ETH=m 327CONFIG_ATA_OVER_ETH=m
289 328
290# 329#
@@ -349,6 +388,7 @@ CONFIG_IDEDMA_AUTO=y
349# 388#
350# SCSI device support 389# SCSI device support
351# 390#
391# CONFIG_RAID_ATTRS is not set
352CONFIG_SCSI=y 392CONFIG_SCSI=y
353CONFIG_SCSI_PROC_FS=y 393CONFIG_SCSI_PROC_FS=y
354 394
@@ -375,11 +415,13 @@ CONFIG_SCSI_CONSTANTS=y
375# 415#
376CONFIG_SCSI_SPI_ATTRS=y 416CONFIG_SCSI_SPI_ATTRS=y
377CONFIG_SCSI_FC_ATTRS=y 417CONFIG_SCSI_FC_ATTRS=y
378# CONFIG_SCSI_ISCSI_ATTRS is not set 418CONFIG_SCSI_ISCSI_ATTRS=m
419CONFIG_SCSI_SAS_ATTRS=y
379 420
380# 421#
381# SCSI low-level drivers 422# SCSI low-level drivers
382# 423#
424CONFIG_ISCSI_TCP=m
383# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 425# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
384# CONFIG_SCSI_3W_9XXX is not set 426# CONFIG_SCSI_3W_9XXX is not set
385# CONFIG_SCSI_ACARD is not set 427# CONFIG_SCSI_ACARD is not set
@@ -389,15 +431,19 @@ CONFIG_SCSI_FC_ATTRS=y
389# CONFIG_SCSI_AIC79XX is not set 431# CONFIG_SCSI_AIC79XX is not set
390# CONFIG_MEGARAID_NEWGEN is not set 432# CONFIG_MEGARAID_NEWGEN is not set
391# CONFIG_MEGARAID_LEGACY is not set 433# CONFIG_MEGARAID_LEGACY is not set
434# CONFIG_MEGARAID_SAS is not set
392CONFIG_SCSI_SATA=y 435CONFIG_SCSI_SATA=y
393# CONFIG_SCSI_SATA_AHCI is not set 436# CONFIG_SCSI_SATA_AHCI is not set
394# CONFIG_SCSI_SATA_SVW is not set 437# CONFIG_SCSI_SATA_SVW is not set
395# CONFIG_SCSI_ATA_PIIX is not set 438# CONFIG_SCSI_ATA_PIIX is not set
439# CONFIG_SCSI_SATA_MV is not set
396# CONFIG_SCSI_SATA_NV is not set 440# CONFIG_SCSI_SATA_NV is not set
397# CONFIG_SCSI_SATA_PROMISE is not set 441# CONFIG_SCSI_PDC_ADMA is not set
398# CONFIG_SCSI_SATA_QSTOR is not set 442# CONFIG_SCSI_SATA_QSTOR is not set
443# CONFIG_SCSI_SATA_PROMISE is not set
399# CONFIG_SCSI_SATA_SX4 is not set 444# CONFIG_SCSI_SATA_SX4 is not set
400# CONFIG_SCSI_SATA_SIL is not set 445# CONFIG_SCSI_SATA_SIL is not set
446# CONFIG_SCSI_SATA_SIL24 is not set
401# CONFIG_SCSI_SATA_SIS is not set 447# CONFIG_SCSI_SATA_SIS is not set
402# CONFIG_SCSI_SATA_ULI is not set 448# CONFIG_SCSI_SATA_ULI is not set
403# CONFIG_SCSI_SATA_VIA is not set 449# CONFIG_SCSI_SATA_VIA is not set
@@ -411,7 +457,6 @@ CONFIG_SCSI_SATA_VITESSE=y
411# CONFIG_SCSI_IPR is not set 457# CONFIG_SCSI_IPR is not set
412# CONFIG_SCSI_QLOGIC_FC is not set 458# CONFIG_SCSI_QLOGIC_FC is not set
413CONFIG_SCSI_QLOGIC_1280=y 459CONFIG_SCSI_QLOGIC_1280=y
414# CONFIG_SCSI_QLOGIC_1280_1040 is not set
415CONFIG_SCSI_QLA2XXX=y 460CONFIG_SCSI_QLA2XXX=y
416# CONFIG_SCSI_QLA21XX is not set 461# CONFIG_SCSI_QLA21XX is not set
417CONFIG_SCSI_QLA22XX=y 462CONFIG_SCSI_QLA22XX=y
@@ -451,6 +496,7 @@ CONFIG_DM_MULTIPATH_EMC=m
451CONFIG_FUSION=y 496CONFIG_FUSION=y
452CONFIG_FUSION_SPI=y 497CONFIG_FUSION_SPI=y
453CONFIG_FUSION_FC=y 498CONFIG_FUSION_FC=y
499CONFIG_FUSION_SAS=y
454CONFIG_FUSION_MAX_SGE=128 500CONFIG_FUSION_MAX_SGE=128
455CONFIG_FUSION_CTL=m 501CONFIG_FUSION_CTL=m
456 502
@@ -479,6 +525,10 @@ CONFIG_NETDEVICES=y
479# CONFIG_ARCNET is not set 525# CONFIG_ARCNET is not set
480 526
481# 527#
528# PHY device support
529#
530
531#
482# Ethernet (10 or 100Mbit) 532# Ethernet (10 or 100Mbit)
483# 533#
484# CONFIG_NET_ETHERNET is not set 534# CONFIG_NET_ETHERNET is not set
@@ -493,6 +543,7 @@ CONFIG_NETDEVICES=y
493# CONFIG_HAMACHI is not set 543# CONFIG_HAMACHI is not set
494# CONFIG_YELLOWFIN is not set 544# CONFIG_YELLOWFIN is not set
495# CONFIG_R8169 is not set 545# CONFIG_R8169 is not set
546# CONFIG_SIS190 is not set
496# CONFIG_SKGE is not set 547# CONFIG_SKGE is not set
497# CONFIG_SK98LIN is not set 548# CONFIG_SK98LIN is not set
498CONFIG_TIGON3=y 549CONFIG_TIGON3=y
@@ -501,10 +552,10 @@ CONFIG_TIGON3=y
501# 552#
502# Ethernet (10000 Mbit) 553# Ethernet (10000 Mbit)
503# 554#
555CONFIG_CHELSIO_T1=m
504# CONFIG_IXGB is not set 556# CONFIG_IXGB is not set
505CONFIG_S2IO=m 557CONFIG_S2IO=m
506# CONFIG_S2IO_NAPI is not set 558# CONFIG_S2IO_NAPI is not set
507# CONFIG_2BUFF_MODE is not set
508 559
509# 560#
510# Token Ring devices 561# Token Ring devices
@@ -583,6 +634,7 @@ CONFIG_HW_CONSOLE=y
583CONFIG_SERIAL_NONSTANDARD=y 634CONFIG_SERIAL_NONSTANDARD=y
584# CONFIG_ROCKETPORT is not set 635# CONFIG_ROCKETPORT is not set
585# CONFIG_CYCLADES is not set 636# CONFIG_CYCLADES is not set
637# CONFIG_DIGIEPCA is not set
586# CONFIG_MOXA_SMARTIO is not set 638# CONFIG_MOXA_SMARTIO is not set
587# CONFIG_ISI is not set 639# CONFIG_ISI is not set
588# CONFIG_SYNCLINKMP is not set 640# CONFIG_SYNCLINKMP is not set
@@ -607,6 +659,7 @@ CONFIG_SERIAL_CORE_CONSOLE=y
607CONFIG_SERIAL_SGI_L1_CONSOLE=y 659CONFIG_SERIAL_SGI_L1_CONSOLE=y
608# CONFIG_SERIAL_JSM is not set 660# CONFIG_SERIAL_JSM is not set
609CONFIG_SERIAL_SGI_IOC4=y 661CONFIG_SERIAL_SGI_IOC4=y
662CONFIG_SERIAL_SGI_IOC3=y
610CONFIG_UNIX98_PTYS=y 663CONFIG_UNIX98_PTYS=y
611CONFIG_LEGACY_PTYS=y 664CONFIG_LEGACY_PTYS=y
612CONFIG_LEGACY_PTY_COUNT=256 665CONFIG_LEGACY_PTY_COUNT=256
@@ -629,7 +682,8 @@ CONFIG_EFI_RTC=y
629# 682#
630# Ftape, the floppy tape device driver 683# Ftape, the floppy tape device driver
631# 684#
632# CONFIG_AGP is not set 685CONFIG_AGP=y
686CONFIG_AGP_SGI_TIOCA=y
633# CONFIG_DRM is not set 687# CONFIG_DRM is not set
634CONFIG_RAW_DRIVER=m 688CONFIG_RAW_DRIVER=m
635# CONFIG_HPET is not set 689# CONFIG_HPET is not set
@@ -641,12 +695,12 @@ CONFIG_MMTIMER=y
641# TPM devices 695# TPM devices
642# 696#
643# CONFIG_TCG_TPM is not set 697# CONFIG_TCG_TPM is not set
698# CONFIG_TELCLOCK is not set
644 699
645# 700#
646# I2C support 701# I2C support
647# 702#
648# CONFIG_I2C is not set 703# CONFIG_I2C is not set
649# CONFIG_I2C_SENSOR is not set
650 704
651# 705#
652# Dallas's 1-wire bus 706# Dallas's 1-wire bus
@@ -657,12 +711,17 @@ CONFIG_MMTIMER=y
657# Hardware Monitoring support 711# Hardware Monitoring support
658# 712#
659# CONFIG_HWMON is not set 713# CONFIG_HWMON is not set
714# CONFIG_HWMON_VID is not set
660 715
661# 716#
662# Misc devices 717# Misc devices
663# 718#
664 719
665# 720#
721# Multimedia Capabilities Port drivers
722#
723
724#
666# Multimedia devices 725# Multimedia devices
667# 726#
668# CONFIG_VIDEO_DEV is not set 727# CONFIG_VIDEO_DEV is not set
@@ -721,12 +780,15 @@ CONFIG_USB_UHCI_HCD=m
721# 780#
722# USB Device Class drivers 781# USB Device Class drivers
723# 782#
724# CONFIG_USB_BLUETOOTH_TTY is not set
725# CONFIG_USB_ACM is not set 783# CONFIG_USB_ACM is not set
726# CONFIG_USB_PRINTER is not set 784# CONFIG_USB_PRINTER is not set
727 785
728# 786#
729# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information 787# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
788#
789
790#
791# may also be needed; see USB_STORAGE Help for more information
730# 792#
731# CONFIG_USB_STORAGE is not set 793# CONFIG_USB_STORAGE is not set
732 794
@@ -751,9 +813,11 @@ CONFIG_USB_HIDINPUT=y
751# CONFIG_USB_MTOUCH is not set 813# CONFIG_USB_MTOUCH is not set
752# CONFIG_USB_ITMTOUCH is not set 814# CONFIG_USB_ITMTOUCH is not set
753# CONFIG_USB_EGALAX is not set 815# CONFIG_USB_EGALAX is not set
816# CONFIG_USB_YEALINK is not set
754# CONFIG_USB_XPAD is not set 817# CONFIG_USB_XPAD is not set
755# CONFIG_USB_ATI_REMOTE is not set 818# CONFIG_USB_ATI_REMOTE is not set
756# CONFIG_USB_KEYSPAN_REMOTE is not set 819# CONFIG_USB_KEYSPAN_REMOTE is not set
820# CONFIG_USB_APPLETOUCH is not set
757 821
758# 822#
759# USB Imaging devices 823# USB Imaging devices
@@ -824,16 +888,19 @@ CONFIG_USB_MON=y
824# InfiniBand support 888# InfiniBand support
825# 889#
826CONFIG_INFINIBAND=m 890CONFIG_INFINIBAND=m
827CONFIG_INFINIBAND_USER_VERBS=m 891# CONFIG_INFINIBAND_USER_MAD is not set
892CONFIG_INFINIBAND_USER_ACCESS=m
828CONFIG_INFINIBAND_MTHCA=m 893CONFIG_INFINIBAND_MTHCA=m
829# CONFIG_INFINIBAND_MTHCA_DEBUG is not set 894# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
830CONFIG_INFINIBAND_IPOIB=m 895CONFIG_INFINIBAND_IPOIB=m
831# CONFIG_INFINIBAND_IPOIB_DEBUG is not set 896# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
897CONFIG_INFINIBAND_SRP=m
832 898
833# 899#
834# SN Devices 900# SN Devices
835# 901#
836CONFIG_SGI_IOC4=y 902CONFIG_SGI_IOC4=y
903CONFIG_SGI_IOC3=y
837 904
838# 905#
839# File systems 906# File systems
@@ -858,16 +925,12 @@ CONFIG_REISERFS_FS_POSIX_ACL=y
858CONFIG_REISERFS_FS_SECURITY=y 925CONFIG_REISERFS_FS_SECURITY=y
859# CONFIG_JFS_FS is not set 926# CONFIG_JFS_FS is not set
860CONFIG_FS_POSIX_ACL=y 927CONFIG_FS_POSIX_ACL=y
861
862#
863# XFS support
864#
865CONFIG_XFS_FS=y 928CONFIG_XFS_FS=y
866CONFIG_XFS_EXPORT=y 929CONFIG_XFS_EXPORT=y
867CONFIG_XFS_RT=y
868CONFIG_XFS_QUOTA=y 930CONFIG_XFS_QUOTA=y
869# CONFIG_XFS_SECURITY is not set 931# CONFIG_XFS_SECURITY is not set
870CONFIG_XFS_POSIX_ACL=y 932CONFIG_XFS_POSIX_ACL=y
933CONFIG_XFS_RT=y
871# CONFIG_MINIX_FS is not set 934# CONFIG_MINIX_FS is not set
872# CONFIG_ROMFS_FS is not set 935# CONFIG_ROMFS_FS is not set
873CONFIG_INOTIFY=y 936CONFIG_INOTIFY=y
@@ -878,6 +941,7 @@ CONFIG_QUOTACTL=y
878CONFIG_DNOTIFY=y 941CONFIG_DNOTIFY=y
879CONFIG_AUTOFS_FS=m 942CONFIG_AUTOFS_FS=m
880CONFIG_AUTOFS4_FS=m 943CONFIG_AUTOFS4_FS=m
944CONFIG_FUSE_FS=m
881 945
882# 946#
883# CD-ROM/DVD Filesystems 947# CD-ROM/DVD Filesystems
@@ -904,13 +968,11 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
904CONFIG_PROC_FS=y 968CONFIG_PROC_FS=y
905CONFIG_PROC_KCORE=y 969CONFIG_PROC_KCORE=y
906CONFIG_SYSFS=y 970CONFIG_SYSFS=y
907# CONFIG_DEVPTS_FS_XATTR is not set
908CONFIG_TMPFS=y 971CONFIG_TMPFS=y
909CONFIG_TMPFS_XATTR=y
910CONFIG_TMPFS_SECURITY=y
911CONFIG_HUGETLBFS=y 972CONFIG_HUGETLBFS=y
912CONFIG_HUGETLB_PAGE=y 973CONFIG_HUGETLB_PAGE=y
913CONFIG_RAMFS=y 974CONFIG_RAMFS=y
975CONFIG_RELAYFS_FS=m
914 976
915# 977#
916# Miscellaneous filesystems 978# Miscellaneous filesystems
@@ -959,6 +1021,7 @@ CONFIG_CIFS=m
959# CONFIG_NCP_FS is not set 1021# CONFIG_NCP_FS is not set
960# CONFIG_CODA_FS is not set 1022# CONFIG_CODA_FS is not set
961# CONFIG_AFS_FS is not set 1023# CONFIG_AFS_FS is not set
1024# CONFIG_9P_FS is not set
962 1025
963# 1026#
964# Partition Types 1027# Partition Types
@@ -1028,18 +1091,21 @@ CONFIG_NLS_UTF8=y
1028# Library routines 1091# Library routines
1029# 1092#
1030# CONFIG_CRC_CCITT is not set 1093# CONFIG_CRC_CCITT is not set
1094CONFIG_CRC16=m
1031CONFIG_CRC32=y 1095CONFIG_CRC32=y
1032# CONFIG_LIBCRC32C is not set 1096CONFIG_LIBCRC32C=m
1033CONFIG_ZLIB_INFLATE=m 1097CONFIG_ZLIB_INFLATE=m
1034CONFIG_ZLIB_DEFLATE=m 1098CONFIG_ZLIB_DEFLATE=m
1035CONFIG_GENERIC_ALLOCATOR=y 1099CONFIG_GENERIC_ALLOCATOR=y
1036CONFIG_GENERIC_HARDIRQS=y 1100CONFIG_GENERIC_HARDIRQS=y
1037CONFIG_GENERIC_IRQ_PROBE=y 1101CONFIG_GENERIC_IRQ_PROBE=y
1102CONFIG_GENERIC_PENDING_IRQ=y
1038 1103
1039# 1104#
1040# Profiling support 1105# Instrumentation Support
1041# 1106#
1042# CONFIG_PROFILING is not set 1107# CONFIG_PROFILING is not set
1108# CONFIG_KPROBES is not set
1043 1109
1044# 1110#
1045# Kernel hacking 1111# Kernel hacking
@@ -1048,6 +1114,7 @@ CONFIG_GENERIC_IRQ_PROBE=y
1048CONFIG_DEBUG_KERNEL=y 1114CONFIG_DEBUG_KERNEL=y
1049CONFIG_MAGIC_SYSRQ=y 1115CONFIG_MAGIC_SYSRQ=y
1050CONFIG_LOG_BUF_SHIFT=20 1116CONFIG_LOG_BUF_SHIFT=20
1117CONFIG_DETECT_SOFTLOCKUP=y
1051# CONFIG_SCHEDSTATS is not set 1118# CONFIG_SCHEDSTATS is not set
1052# CONFIG_DEBUG_SLAB is not set 1119# CONFIG_DEBUG_SLAB is not set
1053CONFIG_DEBUG_PREEMPT=y 1120CONFIG_DEBUG_PREEMPT=y
@@ -1056,7 +1123,8 @@ CONFIG_DEBUG_PREEMPT=y
1056# CONFIG_DEBUG_KOBJECT is not set 1123# CONFIG_DEBUG_KOBJECT is not set
1057CONFIG_DEBUG_INFO=y 1124CONFIG_DEBUG_INFO=y
1058# CONFIG_DEBUG_FS is not set 1125# CONFIG_DEBUG_FS is not set
1059# CONFIG_KPROBES is not set 1126# CONFIG_DEBUG_VM is not set
1127# CONFIG_RCU_TORTURE_TEST is not set
1060CONFIG_IA64_GRANULE_16MB=y 1128CONFIG_IA64_GRANULE_16MB=y
1061# CONFIG_IA64_GRANULE_64MB is not set 1129# CONFIG_IA64_GRANULE_64MB is not set
1062# CONFIG_IA64_PRINT_HAZARDS is not set 1130# CONFIG_IA64_PRINT_HAZARDS is not set
@@ -1097,7 +1165,7 @@ CONFIG_CRYPTO_DES=m
1097# CONFIG_CRYPTO_ANUBIS is not set 1165# CONFIG_CRYPTO_ANUBIS is not set
1098CONFIG_CRYPTO_DEFLATE=m 1166CONFIG_CRYPTO_DEFLATE=m
1099# CONFIG_CRYPTO_MICHAEL_MIC is not set 1167# CONFIG_CRYPTO_MICHAEL_MIC is not set
1100# CONFIG_CRYPTO_CRC32C is not set 1168CONFIG_CRYPTO_CRC32C=m
1101# CONFIG_CRYPTO_TEST is not set 1169# CONFIG_CRYPTO_TEST is not set
1102 1170
1103# 1171#
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index 9bc8bcafc905..6859119bc9dd 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_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.14-rc1 3# Linux kernel version: 2.6.15-rc4
4# Wed Sep 14 15:17:57 2005 4# Fri Dec 2 16:06:32 2005
5# 5#
6 6
7# 7#
@@ -59,17 +59,36 @@ CONFIG_KMOD=y
59CONFIG_STOP_MACHINE=y 59CONFIG_STOP_MACHINE=y
60 60
61# 61#
62# Block layer
63#
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
62# Processor type and features 79# Processor type and features
63# 80#
64CONFIG_IA64=y 81CONFIG_IA64=y
65CONFIG_64BIT=y 82CONFIG_64BIT=y
66CONFIG_MMU=y 83CONFIG_MMU=y
84CONFIG_SWIOTLB=y
67CONFIG_RWSEM_XCHGADD_ALGORITHM=y 85CONFIG_RWSEM_XCHGADD_ALGORITHM=y
68CONFIG_GENERIC_CALIBRATE_DELAY=y 86CONFIG_GENERIC_CALIBRATE_DELAY=y
69CONFIG_TIME_INTERPOLATION=y 87CONFIG_TIME_INTERPOLATION=y
70CONFIG_EFI=y 88CONFIG_EFI=y
71CONFIG_GENERIC_IOMAP=y 89CONFIG_GENERIC_IOMAP=y
72CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y 90CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
91CONFIG_ZONE_DMA_IS_DMA32=y
73# CONFIG_IA64_GENERIC is not set 92# CONFIG_IA64_GENERIC is not set
74CONFIG_IA64_DIG=y 93CONFIG_IA64_DIG=y
75# CONFIG_IA64_HP_ZX1 is not set 94# CONFIG_IA64_HP_ZX1 is not set
@@ -82,18 +101,16 @@ CONFIG_MCKINLEY=y
82# CONFIG_IA64_PAGE_SIZE_8KB is not set 101# CONFIG_IA64_PAGE_SIZE_8KB is not set
83CONFIG_IA64_PAGE_SIZE_16KB=y 102CONFIG_IA64_PAGE_SIZE_16KB=y
84# CONFIG_IA64_PAGE_SIZE_64KB is not set 103# CONFIG_IA64_PAGE_SIZE_64KB is not set
104CONFIG_PGTABLE_3=y
105# CONFIG_PGTABLE_4 is not set
85# CONFIG_HZ_100 is not set 106# CONFIG_HZ_100 is not set
86CONFIG_HZ_250=y 107CONFIG_HZ_250=y
87# CONFIG_HZ_1000 is not set 108# CONFIG_HZ_1000 is not set
88CONFIG_HZ=250 109CONFIG_HZ=250
89CONFIG_IA64_L1_CACHE_SHIFT=7 110CONFIG_IA64_L1_CACHE_SHIFT=7
90# CONFIG_NUMA is not set
91CONFIG_VIRTUAL_MEM_MAP=y
92CONFIG_HOLES_IN_ZONE=y
93CONFIG_IA64_CYCLONE=y 111CONFIG_IA64_CYCLONE=y
94CONFIG_IOSAPIC=y 112CONFIG_IOSAPIC=y
95# CONFIG_IA64_SGI_SN_XP is not set 113CONFIG_FORCE_MAX_ZONEORDER=17
96CONFIG_FORCE_MAX_ZONEORDER=18
97CONFIG_SMP=y 114CONFIG_SMP=y
98CONFIG_NR_CPUS=4 115CONFIG_NR_CPUS=4
99CONFIG_HOTPLUG_CPU=y 116CONFIG_HOTPLUG_CPU=y
@@ -106,7 +123,13 @@ CONFIG_FLATMEM_MANUAL=y
106CONFIG_FLATMEM=y 123CONFIG_FLATMEM=y
107CONFIG_FLAT_NODE_MEM_MAP=y 124CONFIG_FLAT_NODE_MEM_MAP=y
108# CONFIG_SPARSEMEM_STATIC is not set 125# CONFIG_SPARSEMEM_STATIC is not set
109CONFIG_HAVE_DEC_LOCK=y 126CONFIG_SPLIT_PTLOCK_CPUS=4
127CONFIG_ARCH_SELECT_MEMORY_MODEL=y
128CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
129CONFIG_ARCH_FLATMEM_ENABLE=y
130CONFIG_ARCH_SPARSEMEM_ENABLE=y
131CONFIG_VIRTUAL_MEM_MAP=y
132CONFIG_HOLES_IN_ZONE=y
110CONFIG_IA32_SUPPORT=y 133CONFIG_IA32_SUPPORT=y
111CONFIG_COMPAT=y 134CONFIG_COMPAT=y
112CONFIG_IA64_MCA_RECOVERY=y 135CONFIG_IA64_MCA_RECOVERY=y
@@ -118,7 +141,6 @@ CONFIG_IA64_PALINFO=y
118# 141#
119CONFIG_EFI_VARS=y 142CONFIG_EFI_VARS=y
120CONFIG_EFI_PCDP=y 143CONFIG_EFI_PCDP=y
121# CONFIG_DELL_RBU is not set
122CONFIG_BINFMT_ELF=y 144CONFIG_BINFMT_ELF=y
123CONFIG_BINFMT_MISC=m 145CONFIG_BINFMT_MISC=m
124 146
@@ -126,6 +148,7 @@ CONFIG_BINFMT_MISC=m
126# Power management and ACPI 148# Power management and ACPI
127# 149#
128CONFIG_PM=y 150CONFIG_PM=y
151CONFIG_PM_LEGACY=y
129# CONFIG_PM_DEBUG is not set 152# CONFIG_PM_DEBUG is not set
130 153
131# 154#
@@ -226,14 +249,16 @@ CONFIG_TCP_CONG_BIC=y
226# CONFIG_NET_DIVERT is not set 249# CONFIG_NET_DIVERT is not set
227# CONFIG_ECONET is not set 250# CONFIG_ECONET is not set
228# CONFIG_WAN_ROUTER is not set 251# CONFIG_WAN_ROUTER is not set
252
253#
254# QoS and/or fair queueing
255#
229# CONFIG_NET_SCHED is not set 256# CONFIG_NET_SCHED is not set
230# CONFIG_NET_CLS_ROUTE is not set
231 257
232# 258#
233# Network testing 259# Network testing
234# 260#
235# CONFIG_NET_PKTGEN is not set 261# CONFIG_NET_PKTGEN is not set
236# CONFIG_NETFILTER_NETLINK is not set
237# CONFIG_HAMRADIO is not set 262# CONFIG_HAMRADIO is not set
238# CONFIG_IRDA is not set 263# CONFIG_IRDA is not set
239# CONFIG_BT is not set 264# CONFIG_BT is not set
@@ -295,14 +320,6 @@ CONFIG_BLK_DEV_RAM_COUNT=16
295CONFIG_BLK_DEV_RAM_SIZE=4096 320CONFIG_BLK_DEV_RAM_SIZE=4096
296CONFIG_BLK_DEV_INITRD=y 321CONFIG_BLK_DEV_INITRD=y
297# CONFIG_CDROM_PKTCDVD is not set 322# CONFIG_CDROM_PKTCDVD is not set
298
299#
300# IO Schedulers
301#
302CONFIG_IOSCHED_NOOP=y
303CONFIG_IOSCHED_AS=y
304CONFIG_IOSCHED_DEADLINE=y
305CONFIG_IOSCHED_CFQ=y
306# CONFIG_ATA_OVER_ETH is not set 323# CONFIG_ATA_OVER_ETH is not set
307 324
308# 325#
@@ -400,6 +417,7 @@ CONFIG_SCSI_FC_ATTRS=y
400# 417#
401# SCSI low-level drivers 418# SCSI low-level drivers
402# 419#
420# CONFIG_ISCSI_TCP is not set
403# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 421# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
404# CONFIG_SCSI_3W_9XXX is not set 422# CONFIG_SCSI_3W_9XXX is not set
405# CONFIG_SCSI_ACARD is not set 423# CONFIG_SCSI_ACARD is not set
@@ -409,6 +427,7 @@ CONFIG_SCSI_FC_ATTRS=y
409# CONFIG_SCSI_AIC79XX is not set 427# CONFIG_SCSI_AIC79XX is not set
410# CONFIG_MEGARAID_NEWGEN is not set 428# CONFIG_MEGARAID_NEWGEN is not set
411# CONFIG_MEGARAID_LEGACY is not set 429# CONFIG_MEGARAID_LEGACY is not set
430# CONFIG_MEGARAID_SAS is not set
412# CONFIG_SCSI_SATA is not set 431# CONFIG_SCSI_SATA is not set
413# CONFIG_SCSI_DMX3191D is not set 432# CONFIG_SCSI_DMX3191D is not set
414# CONFIG_SCSI_FUTURE_DOMAIN is not set 433# CONFIG_SCSI_FUTURE_DOMAIN is not set
@@ -424,7 +443,6 @@ CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
424CONFIG_SCSI_QLOGIC_FC=y 443CONFIG_SCSI_QLOGIC_FC=y
425# CONFIG_SCSI_QLOGIC_FC_FIRMWARE is not set 444# CONFIG_SCSI_QLOGIC_FC_FIRMWARE is not set
426CONFIG_SCSI_QLOGIC_1280=y 445CONFIG_SCSI_QLOGIC_1280=y
427# CONFIG_SCSI_QLOGIC_1280_1040 is not set
428CONFIG_SCSI_QLA2XXX=y 446CONFIG_SCSI_QLA2XXX=y
429CONFIG_SCSI_QLA21XX=m 447CONFIG_SCSI_QLA21XX=m
430CONFIG_SCSI_QLA22XX=m 448CONFIG_SCSI_QLA22XX=m
@@ -463,6 +481,7 @@ CONFIG_DM_ZERO=m
463CONFIG_FUSION=y 481CONFIG_FUSION=y
464CONFIG_FUSION_SPI=y 482CONFIG_FUSION_SPI=y
465CONFIG_FUSION_FC=y 483CONFIG_FUSION_FC=y
484# CONFIG_FUSION_SAS is not set
466CONFIG_FUSION_MAX_SGE=128 485CONFIG_FUSION_MAX_SGE=128
467CONFIG_FUSION_CTL=y 486CONFIG_FUSION_CTL=y
468 487
@@ -503,6 +522,7 @@ CONFIG_NET_ETHERNET=y
503CONFIG_MII=m 522CONFIG_MII=m
504# CONFIG_HAPPYMEAL is not set 523# CONFIG_HAPPYMEAL is not set
505# CONFIG_SUNGEM is not set 524# CONFIG_SUNGEM is not set
525# CONFIG_CASSINI is not set
506# CONFIG_NET_VENDOR_3COM is not set 526# CONFIG_NET_VENDOR_3COM is not set
507 527
508# 528#
@@ -545,6 +565,7 @@ CONFIG_E100=m
545# CONFIG_DL2K is not set 565# CONFIG_DL2K is not set
546CONFIG_E1000=y 566CONFIG_E1000=y
547# CONFIG_E1000_NAPI is not set 567# CONFIG_E1000_NAPI is not set
568# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
548# CONFIG_NS83820 is not set 569# CONFIG_NS83820 is not set
549# CONFIG_HAMACHI is not set 570# CONFIG_HAMACHI is not set
550# CONFIG_YELLOWFIN is not set 571# CONFIG_YELLOWFIN is not set
@@ -727,6 +748,7 @@ CONFIG_MAX_RAW_DEVS=256
727# TPM devices 748# TPM devices
728# 749#
729# CONFIG_TCG_TPM is not set 750# CONFIG_TCG_TPM is not set
751# CONFIG_TELCLOCK is not set
730 752
731# 753#
732# I2C support 754# I2C support
@@ -812,12 +834,15 @@ CONFIG_USB_UHCI_HCD=y
812# 834#
813# USB Device Class drivers 835# USB Device Class drivers
814# 836#
815# CONFIG_USB_BLUETOOTH_TTY is not set
816# CONFIG_USB_ACM is not set 837# CONFIG_USB_ACM is not set
817# CONFIG_USB_PRINTER is not set 838# CONFIG_USB_PRINTER is not set
818 839
819# 840#
820# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information 841# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
842#
843
844#
845# may also be needed; see USB_STORAGE Help for more information
821# 846#
822CONFIG_USB_STORAGE=m 847CONFIG_USB_STORAGE=m
823# CONFIG_USB_STORAGE_DEBUG is not set 848# CONFIG_USB_STORAGE_DEBUG is not set
@@ -1123,9 +1148,10 @@ CONFIG_GENERIC_IRQ_PROBE=y
1123CONFIG_GENERIC_PENDING_IRQ=y 1148CONFIG_GENERIC_PENDING_IRQ=y
1124 1149
1125# 1150#
1126# Profiling support 1151# Instrumentation Support
1127# 1152#
1128# CONFIG_PROFILING is not set 1153# CONFIG_PROFILING is not set
1154# CONFIG_KPROBES is not set
1129 1155
1130# 1156#
1131# Kernel hacking 1157# Kernel hacking
@@ -1142,7 +1168,8 @@ CONFIG_DETECT_SOFTLOCKUP=y
1142# CONFIG_DEBUG_KOBJECT is not set 1168# CONFIG_DEBUG_KOBJECT is not set
1143# CONFIG_DEBUG_INFO is not set 1169# CONFIG_DEBUG_INFO is not set
1144# CONFIG_DEBUG_FS is not set 1170# CONFIG_DEBUG_FS is not set
1145# CONFIG_KPROBES is not set 1171# CONFIG_DEBUG_VM is not set
1172# CONFIG_RCU_TORTURE_TEST is not set
1146CONFIG_IA64_GRANULE_16MB=y 1173CONFIG_IA64_GRANULE_16MB=y
1147# CONFIG_IA64_GRANULE_64MB is not set 1174# CONFIG_IA64_GRANULE_64MB is not set
1148# CONFIG_IA64_PRINT_HAZARDS is not set 1175# CONFIG_IA64_PRINT_HAZARDS is not set
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index 0856ca67dd50..53899dc8eb53 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -548,6 +548,7 @@ CONFIG_E100=y
548# CONFIG_DL2K is not set 548# CONFIG_DL2K is not set
549CONFIG_E1000=y 549CONFIG_E1000=y
550# CONFIG_E1000_NAPI is not set 550# CONFIG_E1000_NAPI is not set
551# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
551# CONFIG_NS83820 is not set 552# CONFIG_NS83820 is not set
552# CONFIG_HAMACHI is not set 553# CONFIG_HAMACHI is not set
553# CONFIG_YELLOWFIN is not set 554# CONFIG_YELLOWFIN is not set
diff --git a/arch/ia64/defconfig b/arch/ia64/defconfig
index 275a26c6e5aa..dcbc78a4cfa4 100644
--- a/arch/ia64/defconfig
+++ b/arch/ia64/defconfig
@@ -565,6 +565,7 @@ CONFIG_E100=m
565# CONFIG_DL2K is not set 565# CONFIG_DL2K is not set
566CONFIG_E1000=y 566CONFIG_E1000=y
567# CONFIG_E1000_NAPI is not set 567# CONFIG_E1000_NAPI is not set
568# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
568# CONFIG_NS83820 is not set 569# CONFIG_NS83820 is not set
569# CONFIG_HAMACHI is not set 570# CONFIG_HAMACHI is not set
570# CONFIG_YELLOWFIN is not set 571# CONFIG_YELLOWFIN is not set
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index 19ee635eeb70..626cdc83668b 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -26,6 +26,7 @@
26#include <linux/fcntl.h> 26#include <linux/fcntl.h>
27#include <linux/mm.h> 27#include <linux/mm.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/capability.h>
29#include <linux/console.h> 30#include <linux/console.h>
30#include <linux/module.h> 31#include <linux/module.h>
31#include <linux/serial.h> 32#include <linux/serial.h>
@@ -107,7 +108,6 @@ static struct async_struct *IRQ_ports[NR_IRQS];
107static struct console *console; 108static struct console *console;
108 109
109static unsigned char *tmp_buf; 110static unsigned char *tmp_buf;
110static DECLARE_MUTEX(tmp_buf_sem);
111 111
112extern struct console *console_drivers; /* from kernel/printk.c */ 112extern struct console *console_drivers; /* from kernel/printk.c */
113 113
@@ -166,15 +166,9 @@ static void receive_chars(struct tty_struct *tty, struct pt_regs *regs)
166 } 166 }
167 } 167 }
168 seen_esc = 0; 168 seen_esc = 0;
169 if (tty->flip.count >= TTY_FLIPBUF_SIZE) break;
170 169
171 *tty->flip.char_buf_ptr = ch; 170 if (tty_insert_flip_char(tty, ch, TTY_NORMAL) == 0)
172 171 break;
173 *tty->flip.flag_buf_ptr = 0;
174
175 tty->flip.flag_buf_ptr++;
176 tty->flip.char_buf_ptr++;
177 tty->flip.count++;
178 } 172 }
179 tty_flip_buffer_push(tty); 173 tty_flip_buffer_push(tty);
180} 174}
diff --git a/arch/ia64/ia32/Makefile b/arch/ia64/ia32/Makefile
index 2ed90da81166..61cb60affd95 100644
--- a/arch/ia64/ia32/Makefile
+++ b/arch/ia64/ia32/Makefile
@@ -2,11 +2,9 @@
2# Makefile for the ia32 kernel emulation subsystem. 2# Makefile for the ia32 kernel emulation subsystem.
3# 3#
4 4
5obj-y := ia32_entry.o sys_ia32.o ia32_ioctl.o ia32_signal.o \ 5obj-y := ia32_entry.o sys_ia32.o ia32_signal.o \
6 ia32_support.o ia32_traps.o binfmt_elf32.o ia32_ldt.o 6 ia32_support.o ia32_traps.o binfmt_elf32.o ia32_ldt.o
7 7
8CFLAGS_ia32_ioctl.o += -Ifs/
9
10# Don't let GCC uses f16-f31 so that save_ia32_fpstate_live() and 8# Don't let GCC uses f16-f31 so that save_ia32_fpstate_live() and
11# restore_ia32_fpstate_live() can be sure the live register contain user-level state. 9# restore_ia32_fpstate_live() can be sure the live register contain user-level state.
12CFLAGS_ia32_signal.o += -mfixed-range=f16-f31 10CFLAGS_ia32_signal.o += -mfixed-range=f16-f31
diff --git a/arch/ia64/ia32/binfmt_elf32.c b/arch/ia64/ia32/binfmt_elf32.c
index a7280d9f6c16..4e7a6a1ec6c7 100644
--- a/arch/ia64/ia32/binfmt_elf32.c
+++ b/arch/ia64/ia32/binfmt_elf32.c
@@ -261,8 +261,6 @@ elf32_set_personality (void)
261{ 261{
262 set_personality(PER_LINUX32); 262 set_personality(PER_LINUX32);
263 current->thread.map_base = IA32_PAGE_OFFSET/3; 263 current->thread.map_base = IA32_PAGE_OFFSET/3;
264 current->thread.task_size = IA32_PAGE_OFFSET; /* use what Linux/x86 uses... */
265 set_fs(USER_DS); /* set addr limit for new TASK_SIZE */
266} 264}
267 265
268static unsigned long 266static unsigned long
diff --git a/arch/ia64/ia32/elfcore32.h b/arch/ia64/ia32/elfcore32.h
index b73b8b6b10c1..a47f63b204fb 100644
--- a/arch/ia64/ia32/elfcore32.h
+++ b/arch/ia64/ia32/elfcore32.h
@@ -95,8 +95,7 @@ static inline void elf_core_copy_regs(elf_gregset_t *elfregs,
95static inline int elf_core_copy_task_regs(struct task_struct *t, 95static inline int elf_core_copy_task_regs(struct task_struct *t,
96 elf_gregset_t* elfregs) 96 elf_gregset_t* elfregs)
97{ 97{
98 struct pt_regs *pp = ia64_task_regs(t); 98 ELF_CORE_COPY_REGS((*elfregs), task_pt_regs(t));
99 ELF_CORE_COPY_REGS((*elfregs), pp);
100 return 1; 99 return 1;
101} 100}
102 101
diff --git a/arch/ia64/ia32/ia32_entry.S b/arch/ia64/ia32/ia32_entry.S
index 494fad6bf376..95fe04400f6b 100644
--- a/arch/ia64/ia32/ia32_entry.S
+++ b/arch/ia64/ia32/ia32_entry.S
@@ -469,7 +469,7 @@ ia32_syscall_table:
469 data8 sys32_epoll_wait 469 data8 sys32_epoll_wait
470 data8 sys_remap_file_pages 470 data8 sys_remap_file_pages
471 data8 sys_set_tid_address 471 data8 sys_set_tid_address
472 data8 sys32_timer_create 472 data8 compat_sys_timer_create
473 data8 compat_sys_timer_settime /* 260 */ 473 data8 compat_sys_timer_settime /* 260 */
474 data8 compat_sys_timer_gettime 474 data8 compat_sys_timer_gettime
475 data8 sys_timer_getoverrun 475 data8 sys_timer_getoverrun
diff --git a/arch/ia64/ia32/ia32_ioctl.c b/arch/ia64/ia32/ia32_ioctl.c
deleted file mode 100644
index 88739394f6df..000000000000
--- a/arch/ia64/ia32/ia32_ioctl.c
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * IA32 Architecture-specific ioctl shim code
3 *
4 * Copyright (C) 2000 VA Linux Co
5 * Copyright (C) 2000 Don Dugger <n0ano@valinux.com>
6 * Copyright (C) 2001-2003 Hewlett-Packard Co
7 * David Mosberger-Tang <davidm@hpl.hp.com>
8 */
9
10#include <linux/signal.h> /* argh, msdos_fs.h isn't self-contained... */
11#include <linux/syscalls.h>
12#include "ia32priv.h"
13
14#define INCLUDES
15#include "compat_ioctl.c"
16
17#define IOCTL_NR(a) ((a) & ~(_IOC_SIZEMASK << _IOC_SIZESHIFT))
18
19#define DO_IOCTL(fd, cmd, arg) ({ \
20 int _ret; \
21 mm_segment_t _old_fs = get_fs(); \
22 \
23 set_fs(KERNEL_DS); \
24 _ret = sys_ioctl(fd, cmd, (unsigned long)arg); \
25 set_fs(_old_fs); \
26 _ret; \
27})
28
29#define CODE
30#include "compat_ioctl.c"
31
32#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl)
33#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL },
34#define IOCTL_TABLE_START \
35 struct ioctl_trans ioctl_start[] = {
36#define IOCTL_TABLE_END \
37 };
38
39IOCTL_TABLE_START
40#define DECLARES
41#include "compat_ioctl.c"
42#include <linux/compat_ioctl.h>
43IOCTL_TABLE_END
44
45int ioctl_table_size = ARRAY_SIZE(ioctl_start);
diff --git a/arch/ia64/ia32/ia32_signal.c b/arch/ia64/ia32/ia32_signal.c
index aa891c9bc9b6..5856510210fa 100644
--- a/arch/ia64/ia32/ia32_signal.c
+++ b/arch/ia64/ia32/ia32_signal.c
@@ -255,7 +255,7 @@ save_ia32_fpstate_live (struct _fpstate_ia32 __user *save)
255 */ 255 */
256 fp_tos = (fsr>>11)&0x7; 256 fp_tos = (fsr>>11)&0x7;
257 fr8_st_map = (8-fp_tos)&0x7; 257 fr8_st_map = (8-fp_tos)&0x7;
258 ptp = ia64_task_regs(tsk); 258 ptp = task_pt_regs(tsk);
259 fpregp = (struct _fpreg_ia32 *)(((unsigned long)buf + 15) & ~15); 259 fpregp = (struct _fpreg_ia32 *)(((unsigned long)buf + 15) & ~15);
260 ia64f2ia32f(fpregp, &ptp->f8); 260 ia64f2ia32f(fpregp, &ptp->f8);
261 copy_to_user(&save->_st[(0+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32)); 261 copy_to_user(&save->_st[(0+fr8_st_map)&0x7], fpregp, sizeof(struct _fpreg_ia32));
@@ -389,7 +389,7 @@ restore_ia32_fpstate_live (struct _fpstate_ia32 __user *save)
389 fr8_st_map = (8-fp_tos)&0x7; 389 fr8_st_map = (8-fp_tos)&0x7;
390 fpregp = (struct _fpreg_ia32 *)(((unsigned long)buf + 15) & ~15); 390 fpregp = (struct _fpreg_ia32 *)(((unsigned long)buf + 15) & ~15);
391 391
392 ptp = ia64_task_regs(tsk); 392 ptp = task_pt_regs(tsk);
393 copy_from_user(fpregp, &save->_st[(0+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32)); 393 copy_from_user(fpregp, &save->_st[(0+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
394 ia32f2ia64f(&ptp->f8, fpregp); 394 ia32f2ia64f(&ptp->f8, fpregp);
395 copy_from_user(fpregp, &save->_st[(1+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32)); 395 copy_from_user(fpregp, &save->_st[(1+fr8_st_map)&0x7], sizeof(struct _fpreg_ia32));
diff --git a/arch/ia64/ia32/ia32_support.c b/arch/ia64/ia32/ia32_support.c
index 4f630043b3ae..c187743965a0 100644
--- a/arch/ia64/ia32/ia32_support.c
+++ b/arch/ia64/ia32/ia32_support.c
@@ -58,7 +58,7 @@ load_desc (u16 selector)
58void 58void
59ia32_load_segment_descriptors (struct task_struct *task) 59ia32_load_segment_descriptors (struct task_struct *task)
60{ 60{
61 struct pt_regs *regs = ia64_task_regs(task); 61 struct pt_regs *regs = task_pt_regs(task);
62 62
63 /* Setup the segment descriptors */ 63 /* Setup the segment descriptors */
64 regs->r24 = load_desc(regs->r16 >> 16); /* ESD */ 64 regs->r24 = load_desc(regs->r16 >> 16); /* ESD */
@@ -113,7 +113,7 @@ void
113ia32_load_state (struct task_struct *t) 113ia32_load_state (struct task_struct *t)
114{ 114{
115 unsigned long eflag, fsr, fcr, fir, fdr, tssd; 115 unsigned long eflag, fsr, fcr, fir, fdr, tssd;
116 struct pt_regs *regs = ia64_task_regs(t); 116 struct pt_regs *regs = task_pt_regs(t);
117 117
118 eflag = t->thread.eflag; 118 eflag = t->thread.eflag;
119 fsr = t->thread.fsr; 119 fsr = t->thread.fsr;
diff --git a/arch/ia64/ia32/ia32priv.h b/arch/ia64/ia32/ia32priv.h
index e3e9290e3ff2..68ceb4e690c7 100644
--- a/arch/ia64/ia32/ia32priv.h
+++ b/arch/ia64/ia32/ia32priv.h
@@ -305,7 +305,6 @@ struct old_linux32_dirent {
305#define ELF_DATA ELFDATA2LSB 305#define ELF_DATA ELFDATA2LSB
306#define ELF_ARCH EM_386 306#define ELF_ARCH EM_386
307 307
308#define IA32_PAGE_OFFSET 0xc0000000
309#define IA32_STACK_TOP IA32_PAGE_OFFSET 308#define IA32_STACK_TOP IA32_PAGE_OFFSET
310#define IA32_GATE_OFFSET IA32_PAGE_OFFSET 309#define IA32_GATE_OFFSET IA32_PAGE_OFFSET
311#define IA32_GATE_END IA32_PAGE_OFFSET + PAGE_SIZE 310#define IA32_GATE_END IA32_PAGE_OFFSET + PAGE_SIZE
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c
index dc282710421a..70dba1f0e2ee 100644
--- a/arch/ia64/ia32/sys_ia32.c
+++ b/arch/ia64/ia32/sys_ia32.c
@@ -48,12 +48,13 @@
48#include <linux/ptrace.h> 48#include <linux/ptrace.h>
49#include <linux/stat.h> 49#include <linux/stat.h>
50#include <linux/ipc.h> 50#include <linux/ipc.h>
51#include <linux/capability.h>
51#include <linux/compat.h> 52#include <linux/compat.h>
52#include <linux/vfs.h> 53#include <linux/vfs.h>
53#include <linux/mman.h> 54#include <linux/mman.h>
55#include <linux/mutex.h>
54 56
55#include <asm/intrinsics.h> 57#include <asm/intrinsics.h>
56#include <asm/semaphore.h>
57#include <asm/types.h> 58#include <asm/types.h>
58#include <asm/uaccess.h> 59#include <asm/uaccess.h>
59#include <asm/unistd.h> 60#include <asm/unistd.h>
@@ -85,7 +86,7 @@
85 * while doing so. 86 * while doing so.
86 */ 87 */
87/* XXX make per-mm: */ 88/* XXX make per-mm: */
88static DECLARE_MUTEX(ia32_mmap_sem); 89static DEFINE_MUTEX(ia32_mmap_mutex);
89 90
90asmlinkage long 91asmlinkage long
91sys32_execve (char __user *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp, 92sys32_execve (char __user *name, compat_uptr_t __user *argv, compat_uptr_t __user *envp,
@@ -894,11 +895,11 @@ ia32_do_mmap (struct file *file, unsigned long addr, unsigned long len, int prot
894 prot = get_prot32(prot); 895 prot = get_prot32(prot);
895 896
896#if PAGE_SHIFT > IA32_PAGE_SHIFT 897#if PAGE_SHIFT > IA32_PAGE_SHIFT
897 down(&ia32_mmap_sem); 898 mutex_lock(&ia32_mmap_mutex);
898 { 899 {
899 addr = emulate_mmap(file, addr, len, prot, flags, offset); 900 addr = emulate_mmap(file, addr, len, prot, flags, offset);
900 } 901 }
901 up(&ia32_mmap_sem); 902 mutex_unlock(&ia32_mmap_mutex);
902#else 903#else
903 down_write(&current->mm->mmap_sem); 904 down_write(&current->mm->mmap_sem);
904 { 905 {
@@ -999,11 +1000,9 @@ sys32_munmap (unsigned int start, unsigned int len)
999 if (start >= end) 1000 if (start >= end)
1000 return 0; 1001 return 0;
1001 1002
1002 down(&ia32_mmap_sem); 1003 mutex_lock(&ia32_mmap_mutex);
1003 { 1004 ret = sys_munmap(start, end - start);
1004 ret = sys_munmap(start, end - start); 1005 mutex_unlock(&ia32_mmap_mutex);
1005 }
1006 up(&ia32_mmap_sem);
1007#endif 1006#endif
1008 return ret; 1007 return ret;
1009} 1008}
@@ -1055,7 +1054,7 @@ sys32_mprotect (unsigned int start, unsigned int len, int prot)
1055 if (retval < 0) 1054 if (retval < 0)
1056 return retval; 1055 return retval;
1057 1056
1058 down(&ia32_mmap_sem); 1057 mutex_lock(&ia32_mmap_mutex);
1059 { 1058 {
1060 if (offset_in_page(start)) { 1059 if (offset_in_page(start)) {
1061 /* start address is 4KB aligned but not page aligned. */ 1060 /* start address is 4KB aligned but not page aligned. */
@@ -1079,7 +1078,7 @@ sys32_mprotect (unsigned int start, unsigned int len, int prot)
1079 retval = sys_mprotect(start, end - start, prot); 1078 retval = sys_mprotect(start, end - start, prot);
1080 } 1079 }
1081 out: 1080 out:
1082 up(&ia32_mmap_sem); 1081 mutex_unlock(&ia32_mmap_mutex);
1083 return retval; 1082 return retval;
1084#endif 1083#endif
1085} 1084}
@@ -1123,11 +1122,9 @@ sys32_mremap (unsigned int addr, unsigned int old_len, unsigned int new_len,
1123 old_len = PAGE_ALIGN(old_end) - addr; 1122 old_len = PAGE_ALIGN(old_end) - addr;
1124 new_len = PAGE_ALIGN(new_end) - addr; 1123 new_len = PAGE_ALIGN(new_end) - addr;
1125 1124
1126 down(&ia32_mmap_sem); 1125 mutex_lock(&ia32_mmap_mutex);
1127 { 1126 ret = sys_mremap(addr, old_len, new_len, flags, new_addr);
1128 ret = sys_mremap(addr, old_len, new_len, flags, new_addr); 1127 mutex_unlock(&ia32_mmap_mutex);
1129 }
1130 up(&ia32_mmap_sem);
1131 1128
1132 if ((ret >= 0) && (old_len < new_len)) { 1129 if ((ret >= 0) && (old_len < new_len)) {
1133 /* mremap expanded successfully */ 1130 /* mremap expanded successfully */
@@ -1481,7 +1478,7 @@ getreg (struct task_struct *child, int regno)
1481{ 1478{
1482 struct pt_regs *child_regs; 1479 struct pt_regs *child_regs;
1483 1480
1484 child_regs = ia64_task_regs(child); 1481 child_regs = task_pt_regs(child);
1485 switch (regno / sizeof(int)) { 1482 switch (regno / sizeof(int)) {
1486 case PT_EBX: return child_regs->r11; 1483 case PT_EBX: return child_regs->r11;
1487 case PT_ECX: return child_regs->r9; 1484 case PT_ECX: return child_regs->r9;
@@ -1509,7 +1506,7 @@ putreg (struct task_struct *child, int regno, unsigned int value)
1509{ 1506{
1510 struct pt_regs *child_regs; 1507 struct pt_regs *child_regs;
1511 1508
1512 child_regs = ia64_task_regs(child); 1509 child_regs = task_pt_regs(child);
1513 switch (regno / sizeof(int)) { 1510 switch (regno / sizeof(int)) {
1514 case PT_EBX: child_regs->r11 = value; break; 1511 case PT_EBX: child_regs->r11 = value; break;
1515 case PT_ECX: child_regs->r9 = value; break; 1512 case PT_ECX: child_regs->r9 = value; break;
@@ -1625,7 +1622,7 @@ save_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct __user
1625 * Stack frames start with 16-bytes of temp space 1622 * Stack frames start with 16-bytes of temp space
1626 */ 1623 */
1627 swp = (struct switch_stack *)(tsk->thread.ksp + 16); 1624 swp = (struct switch_stack *)(tsk->thread.ksp + 16);
1628 ptp = ia64_task_regs(tsk); 1625 ptp = task_pt_regs(tsk);
1629 tos = (tsk->thread.fsr >> 11) & 7; 1626 tos = (tsk->thread.fsr >> 11) & 7;
1630 for (i = 0; i < 8; i++) 1627 for (i = 0; i < 8; i++)
1631 put_fpreg(i, &save->st_space[i], ptp, swp, tos); 1628 put_fpreg(i, &save->st_space[i], ptp, swp, tos);
@@ -1658,7 +1655,7 @@ restore_ia32_fpstate (struct task_struct *tsk, struct ia32_user_i387_struct __us
1658 * Stack frames start with 16-bytes of temp space 1655 * Stack frames start with 16-bytes of temp space
1659 */ 1656 */
1660 swp = (struct switch_stack *)(tsk->thread.ksp + 16); 1657 swp = (struct switch_stack *)(tsk->thread.ksp + 16);
1661 ptp = ia64_task_regs(tsk); 1658 ptp = task_pt_regs(tsk);
1662 tos = (tsk->thread.fsr >> 11) & 7; 1659 tos = (tsk->thread.fsr >> 11) & 7;
1663 for (i = 0; i < 8; i++) 1660 for (i = 0; i < 8; i++)
1664 get_fpreg(i, &save->st_space[i], ptp, swp, tos); 1661 get_fpreg(i, &save->st_space[i], ptp, swp, tos);
@@ -1689,7 +1686,7 @@ save_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __user
1689 * Stack frames start with 16-bytes of temp space 1686 * Stack frames start with 16-bytes of temp space
1690 */ 1687 */
1691 swp = (struct switch_stack *)(tsk->thread.ksp + 16); 1688 swp = (struct switch_stack *)(tsk->thread.ksp + 16);
1692 ptp = ia64_task_regs(tsk); 1689 ptp = task_pt_regs(tsk);
1693 tos = (tsk->thread.fsr >> 11) & 7; 1690 tos = (tsk->thread.fsr >> 11) & 7;
1694 for (i = 0; i < 8; i++) 1691 for (i = 0; i < 8; i++)
1695 put_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos); 1692 put_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos);
@@ -1733,7 +1730,7 @@ restore_ia32_fpxstate (struct task_struct *tsk, struct ia32_user_fxsr_struct __u
1733 * Stack frames start with 16-bytes of temp space 1730 * Stack frames start with 16-bytes of temp space
1734 */ 1731 */
1735 swp = (struct switch_stack *)(tsk->thread.ksp + 16); 1732 swp = (struct switch_stack *)(tsk->thread.ksp + 16);
1736 ptp = ia64_task_regs(tsk); 1733 ptp = task_pt_regs(tsk);
1737 tos = (tsk->thread.fsr >> 11) & 7; 1734 tos = (tsk->thread.fsr >> 11) & 7;
1738 for (i = 0; i < 8; i++) 1735 for (i = 0; i < 8; i++)
1739 get_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos); 1736 get_fpreg(i, (struct _fpreg_ia32 __user *)&save->st_space[4*i], ptp, swp, tos);
@@ -1761,21 +1758,15 @@ sys32_ptrace (int request, pid_t pid, unsigned int addr, unsigned int data)
1761 1758
1762 lock_kernel(); 1759 lock_kernel();
1763 if (request == PTRACE_TRACEME) { 1760 if (request == PTRACE_TRACEME) {
1764 ret = sys_ptrace(request, pid, addr, data); 1761 ret = ptrace_traceme();
1765 goto out; 1762 goto out;
1766 } 1763 }
1767 1764
1768 ret = -ESRCH; 1765 child = ptrace_get_task_struct(pid);
1769 read_lock(&tasklist_lock); 1766 if (IS_ERR(child)) {
1770 child = find_task_by_pid(pid); 1767 ret = PTR_ERR(child);
1771 if (child)
1772 get_task_struct(child);
1773 read_unlock(&tasklist_lock);
1774 if (!child)
1775 goto out; 1768 goto out;
1776 ret = -EPERM; 1769 }
1777 if (pid == 1) /* no messing around with init! */
1778 goto out_tsk;
1779 1770
1780 if (request == PTRACE_ATTACH) { 1771 if (request == PTRACE_ATTACH) {
1781 ret = sys_ptrace(request, pid, addr, data); 1772 ret = sys_ptrace(request, pid, addr, data);
@@ -2559,34 +2550,6 @@ sys32_get_thread_area (struct ia32_user_desc __user *u_info)
2559 return 0; 2550 return 0;
2560} 2551}
2561 2552
2562asmlinkage long
2563sys32_timer_create(u32 clock, struct compat_sigevent __user *se32, timer_t __user *timer_id)
2564{
2565 struct sigevent se;
2566 mm_segment_t oldfs;
2567 timer_t t;
2568 long err;
2569
2570 if (se32 == NULL)
2571 return sys_timer_create(clock, NULL, timer_id);
2572
2573 if (get_compat_sigevent(&se, se32))
2574 return -EFAULT;
2575
2576 if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t)))
2577 return -EFAULT;
2578
2579 oldfs = get_fs();
2580 set_fs(KERNEL_DS);
2581 err = sys_timer_create(clock, (struct sigevent __user *) &se, (timer_t __user *) &t);
2582 set_fs(oldfs);
2583
2584 if (!err)
2585 err = __put_user (t, timer_id);
2586
2587 return err;
2588}
2589
2590long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 2553long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high,
2591 __u32 len_low, __u32 len_high, int advice) 2554 __u32 len_low, __u32 len_high, int advice)
2592{ 2555{
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 307514f7a282..09a0dbc17fb6 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -13,6 +13,11 @@ obj-$(CONFIG_IA64_BRL_EMU) += brl_emu.o
13obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o 13obj-$(CONFIG_IA64_GENERIC) += acpi-ext.o
14obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o 14obj-$(CONFIG_IA64_HP_ZX1) += acpi-ext.o
15obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o 15obj-$(CONFIG_IA64_HP_ZX1_SWIOTLB) += acpi-ext.o
16
17ifneq ($(CONFIG_ACPI_PROCESSOR),)
18obj-y += acpi-processor.o
19endif
20
16obj-$(CONFIG_IA64_PALINFO) += palinfo.o 21obj-$(CONFIG_IA64_PALINFO) += palinfo.o
17obj-$(CONFIG_IOSAPIC) += iosapic.o 22obj-$(CONFIG_IOSAPIC) += iosapic.o
18obj-$(CONFIG_MODULES) += module.o 23obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/ia64/kernel/acpi-ext.c b/arch/ia64/kernel/acpi-ext.c
index 13a5b3b49bf8..4a5574ff007b 100644
--- a/arch/ia64/kernel/acpi-ext.c
+++ b/arch/ia64/kernel/acpi-ext.c
@@ -33,33 +33,33 @@ acpi_vendor_resource_match(struct acpi_resource *resource, void *context)
33 struct acpi_vendor_info *info = (struct acpi_vendor_info *)context; 33 struct acpi_vendor_info *info = (struct acpi_vendor_info *)context;
34 struct acpi_resource_vendor *vendor; 34 struct acpi_resource_vendor *vendor;
35 struct acpi_vendor_descriptor *descriptor; 35 struct acpi_vendor_descriptor *descriptor;
36 u32 length; 36 u32 byte_length;
37 37
38 if (resource->id != ACPI_RSTYPE_VENDOR) 38 if (resource->type != ACPI_RESOURCE_TYPE_VENDOR)
39 return AE_OK; 39 return AE_OK;
40 40
41 vendor = (struct acpi_resource_vendor *)&resource->data; 41 vendor = (struct acpi_resource_vendor *)&resource->data;
42 descriptor = (struct acpi_vendor_descriptor *)vendor->reserved; 42 descriptor = (struct acpi_vendor_descriptor *)vendor->byte_data;
43 if (vendor->length <= sizeof(*info->descriptor) || 43 if (vendor->byte_length <= sizeof(*info->descriptor) ||
44 descriptor->guid_id != info->descriptor->guid_id || 44 descriptor->guid_id != info->descriptor->guid_id ||
45 efi_guidcmp(descriptor->guid, info->descriptor->guid)) 45 efi_guidcmp(descriptor->guid, info->descriptor->guid))
46 return AE_OK; 46 return AE_OK;
47 47
48 length = vendor->length - sizeof(struct acpi_vendor_descriptor); 48 byte_length = vendor->byte_length - sizeof(struct acpi_vendor_descriptor);
49 info->data = acpi_os_allocate(length); 49 info->data = acpi_os_allocate(byte_length);
50 if (!info->data) 50 if (!info->data)
51 return AE_NO_MEMORY; 51 return AE_NO_MEMORY;
52 52
53 memcpy(info->data, 53 memcpy(info->data,
54 vendor->reserved + sizeof(struct acpi_vendor_descriptor), 54 vendor->byte_data + sizeof(struct acpi_vendor_descriptor),
55 length); 55 byte_length);
56 info->length = length; 56 info->length = byte_length;
57 return AE_CTRL_TERMINATE; 57 return AE_CTRL_TERMINATE;
58} 58}
59 59
60acpi_status 60acpi_status
61acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id, 61acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
62 u8 ** data, u32 * length) 62 u8 ** data, u32 * byte_length)
63{ 63{
64 struct acpi_vendor_info info; 64 struct acpi_vendor_info info;
65 65
@@ -72,7 +72,7 @@ acpi_find_vendor_resource(acpi_handle obj, struct acpi_vendor_descriptor * id,
72 return AE_NOT_FOUND; 72 return AE_NOT_FOUND;
73 73
74 *data = info.data; 74 *data = info.data;
75 *length = info.length; 75 *byte_length = info.length;
76 return AE_OK; 76 return AE_OK;
77} 77}
78 78
diff --git a/arch/ia64/kernel/acpi-processor.c b/arch/ia64/kernel/acpi-processor.c
new file mode 100644
index 000000000000..e683630c8ce2
--- /dev/null
+++ b/arch/ia64/kernel/acpi-processor.c
@@ -0,0 +1,67 @@
1/*
2 * arch/ia64/kernel/cpufreq/processor.c
3 *
4 * Copyright (C) 2005 Intel Corporation
5 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
6 * - Added _PDC for platforms with Intel CPUs
7 */
8
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/acpi.h>
13
14#include <acpi/processor.h>
15#include <asm/acpi.h>
16
17static void init_intel_pdc(struct acpi_processor *pr)
18{
19 struct acpi_object_list *obj_list;
20 union acpi_object *obj;
21 u32 *buf;
22
23 /* allocate and initialize pdc. It will be used later. */
24 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
25 if (!obj_list) {
26 printk(KERN_ERR "Memory allocation error\n");
27 return;
28 }
29
30 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
31 if (!obj) {
32 printk(KERN_ERR "Memory allocation error\n");
33 kfree(obj_list);
34 return;
35 }
36
37 buf = kmalloc(12, GFP_KERNEL);
38 if (!buf) {
39 printk(KERN_ERR "Memory allocation error\n");
40 kfree(obj);
41 kfree(obj_list);
42 return;
43 }
44
45 buf[0] = ACPI_PDC_REVISION_ID;
46 buf[1] = 1;
47 buf[2] |= ACPI_PDC_EST_CAPABILITY_SMP;
48
49 obj->type = ACPI_TYPE_BUFFER;
50 obj->buffer.length = 12;
51 obj->buffer.pointer = (u8 *) buf;
52 obj_list->count = 1;
53 obj_list->pointer = obj;
54 pr->pdc = obj_list;
55
56 return;
57}
58
59/* Initialize _PDC data based on the CPU vendor */
60void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
61{
62 pr->pdc = NULL;
63 init_intel_pdc(pr);
64 return;
65}
66
67EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 9ad94ddf6687..d2702c419cf8 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -567,16 +567,16 @@ void __init acpi_numa_arch_fixup(void)
567 * success: return IRQ number (>=0) 567 * success: return IRQ number (>=0)
568 * failure: return < 0 568 * failure: return < 0
569 */ 569 */
570int acpi_register_gsi(u32 gsi, int edge_level, int active_high_low) 570int acpi_register_gsi(u32 gsi, int triggering, int polarity)
571{ 571{
572 if (has_8259 && gsi < 16) 572 if (has_8259 && gsi < 16)
573 return isa_irq_to_vector(gsi); 573 return isa_irq_to_vector(gsi);
574 574
575 return iosapic_register_intr(gsi, 575 return iosapic_register_intr(gsi,
576 (active_high_low == 576 (polarity ==
577 ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH : 577 ACPI_ACTIVE_HIGH) ? IOSAPIC_POL_HIGH :
578 IOSAPIC_POL_LOW, 578 IOSAPIC_POL_LOW,
579 (edge_level == 579 (triggering ==
580 ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE : 580 ACPI_EDGE_SENSITIVE) ? IOSAPIC_EDGE :
581 IOSAPIC_LEVEL); 581 IOSAPIC_LEVEL);
582} 582}
diff --git a/arch/ia64/kernel/cpufreq/Makefile b/arch/ia64/kernel/cpufreq/Makefile
index f748d34c02f0..4838f2a57c7a 100644
--- a/arch/ia64/kernel/cpufreq/Makefile
+++ b/arch/ia64/kernel/cpufreq/Makefile
@@ -1 +1,2 @@
1obj-$(CONFIG_IA64_ACPI_CPUFREQ) += acpi-cpufreq.o 1obj-$(CONFIG_IA64_ACPI_CPUFREQ) += acpi-cpufreq.o
2
diff --git a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
index da4d5cf80a48..5a1bf815282d 100644
--- a/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
+++ b/arch/ia64/kernel/cpufreq/acpi-cpufreq.c
@@ -269,48 +269,6 @@ acpi_cpufreq_verify (
269} 269}
270 270
271 271
272/*
273 * processor_init_pdc - let BIOS know about the SMP capabilities
274 * of this driver
275 * @perf: processor-specific acpi_io_data struct
276 * @cpu: CPU being initialized
277 *
278 * To avoid issues with legacy OSes, some BIOSes require to be informed of
279 * the SMP capabilities of OS P-state driver. Here we set the bits in _PDC
280 * accordingly. Actual call to _PDC is done in driver/acpi/processor.c
281 */
282static void
283processor_init_pdc (
284 struct acpi_processor_performance *perf,
285 unsigned int cpu,
286 struct acpi_object_list *obj_list
287 )
288{
289 union acpi_object *obj;
290 u32 *buf;
291
292 dprintk("processor_init_pdc\n");
293
294 perf->pdc = NULL;
295 /* Initialize pdc. It will be used later. */
296 if (!obj_list)
297 return;
298
299 if (!(obj_list->count && obj_list->pointer))
300 return;
301
302 obj = obj_list->pointer;
303 if ((obj->buffer.length == 12) && obj->buffer.pointer) {
304 buf = (u32 *)obj->buffer.pointer;
305 buf[0] = ACPI_PDC_REVISION_ID;
306 buf[1] = 1;
307 buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
308 perf->pdc = obj_list;
309 }
310 return;
311}
312
313
314static int 272static int
315acpi_cpufreq_cpu_init ( 273acpi_cpufreq_cpu_init (
316 struct cpufreq_policy *policy) 274 struct cpufreq_policy *policy)
@@ -320,14 +278,7 @@ acpi_cpufreq_cpu_init (
320 struct cpufreq_acpi_io *data; 278 struct cpufreq_acpi_io *data;
321 unsigned int result = 0; 279 unsigned int result = 0;
322 280
323 union acpi_object arg0 = {ACPI_TYPE_BUFFER};
324 u32 arg0_buf[3];
325 struct acpi_object_list arg_list = {1, &arg0};
326
327 dprintk("acpi_cpufreq_cpu_init\n"); 281 dprintk("acpi_cpufreq_cpu_init\n");
328 /* setup arg_list for _PDC settings */
329 arg0.buffer.length = 12;
330 arg0.buffer.pointer = (u8 *) arg0_buf;
331 282
332 data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL); 283 data = kmalloc(sizeof(struct cpufreq_acpi_io), GFP_KERNEL);
333 if (!data) 284 if (!data)
@@ -337,9 +288,7 @@ acpi_cpufreq_cpu_init (
337 288
338 acpi_io_data[cpu] = data; 289 acpi_io_data[cpu] = data;
339 290
340 processor_init_pdc(&data->acpi_data, cpu, &arg_list);
341 result = acpi_processor_register_performance(&data->acpi_data, cpu); 291 result = acpi_processor_register_performance(&data->acpi_data, cpu);
342 data->acpi_data.pdc = NULL;
343 292
344 if (result) 293 if (result)
345 goto err_free; 294 goto err_free;
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index a3aa45cbcfa0..c485a3b32ba8 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -247,6 +247,32 @@ typedef struct kern_memdesc {
247 247
248static kern_memdesc_t *kern_memmap; 248static kern_memdesc_t *kern_memmap;
249 249
250#define efi_md_size(md) (md->num_pages << EFI_PAGE_SHIFT)
251
252static inline u64
253kmd_end(kern_memdesc_t *kmd)
254{
255 return (kmd->start + (kmd->num_pages << EFI_PAGE_SHIFT));
256}
257
258static inline u64
259efi_md_end(efi_memory_desc_t *md)
260{
261 return (md->phys_addr + efi_md_size(md));
262}
263
264static inline int
265efi_wb(efi_memory_desc_t *md)
266{
267 return (md->attribute & EFI_MEMORY_WB);
268}
269
270static inline int
271efi_uc(efi_memory_desc_t *md)
272{
273 return (md->attribute & EFI_MEMORY_UC);
274}
275
250static void 276static void
251walk (efi_freemem_callback_t callback, void *arg, u64 attr) 277walk (efi_freemem_callback_t callback, void *arg, u64 attr)
252{ 278{
@@ -595,8 +621,8 @@ efi_get_iobase (void)
595 return 0; 621 return 0;
596} 622}
597 623
598u32 624static efi_memory_desc_t *
599efi_mem_type (unsigned long phys_addr) 625efi_memory_descriptor (unsigned long phys_addr)
600{ 626{
601 void *efi_map_start, *efi_map_end, *p; 627 void *efi_map_start, *efi_map_end, *p;
602 efi_memory_desc_t *md; 628 efi_memory_desc_t *md;
@@ -610,13 +636,13 @@ efi_mem_type (unsigned long phys_addr)
610 md = p; 636 md = p;
611 637
612 if (phys_addr - md->phys_addr < (md->num_pages << EFI_PAGE_SHIFT)) 638 if (phys_addr - md->phys_addr < (md->num_pages << EFI_PAGE_SHIFT))
613 return md->type; 639 return md;
614 } 640 }
615 return 0; 641 return 0;
616} 642}
617 643
618u64 644static int
619efi_mem_attributes (unsigned long phys_addr) 645efi_memmap_has_mmio (void)
620{ 646{
621 void *efi_map_start, *efi_map_end, *p; 647 void *efi_map_start, *efi_map_end, *p;
622 efi_memory_desc_t *md; 648 efi_memory_desc_t *md;
@@ -629,36 +655,98 @@ efi_mem_attributes (unsigned long phys_addr)
629 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) { 655 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) {
630 md = p; 656 md = p;
631 657
632 if (phys_addr - md->phys_addr < (md->num_pages << EFI_PAGE_SHIFT)) 658 if (md->type == EFI_MEMORY_MAPPED_IO)
633 return md->attribute; 659 return 1;
634 } 660 }
635 return 0; 661 return 0;
636} 662}
663
664u32
665efi_mem_type (unsigned long phys_addr)
666{
667 efi_memory_desc_t *md = efi_memory_descriptor(phys_addr);
668
669 if (md)
670 return md->type;
671 return 0;
672}
673
674u64
675efi_mem_attributes (unsigned long phys_addr)
676{
677 efi_memory_desc_t *md = efi_memory_descriptor(phys_addr);
678
679 if (md)
680 return md->attribute;
681 return 0;
682}
637EXPORT_SYMBOL(efi_mem_attributes); 683EXPORT_SYMBOL(efi_mem_attributes);
638 684
685/*
686 * Determines whether the memory at phys_addr supports the desired
687 * attribute (WB, UC, etc). If this returns 1, the caller can safely
688 * access *size bytes at phys_addr with the specified attribute.
689 */
690static int
691efi_mem_attribute_range (unsigned long phys_addr, unsigned long *size, u64 attr)
692{
693 efi_memory_desc_t *md = efi_memory_descriptor(phys_addr);
694 unsigned long md_end;
695
696 if (!md || (md->attribute & attr) != attr)
697 return 0;
698
699 do {
700 md_end = efi_md_end(md);
701 if (phys_addr + *size <= md_end)
702 return 1;
703
704 md = efi_memory_descriptor(md_end);
705 if (!md || (md->attribute & attr) != attr) {
706 *size = md_end - phys_addr;
707 return 1;
708 }
709 } while (md);
710 return 0;
711}
712
713/*
714 * For /dev/mem, we only allow read & write system calls to access
715 * write-back memory, because read & write don't allow the user to
716 * control access size.
717 */
639int 718int
640valid_phys_addr_range (unsigned long phys_addr, unsigned long *size) 719valid_phys_addr_range (unsigned long phys_addr, unsigned long *size)
641{ 720{
642 void *efi_map_start, *efi_map_end, *p; 721 return efi_mem_attribute_range(phys_addr, size, EFI_MEMORY_WB);
643 efi_memory_desc_t *md; 722}
644 u64 efi_desc_size;
645 723
646 efi_map_start = __va(ia64_boot_param->efi_memmap); 724/*
647 efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size; 725 * We allow mmap of anything in the EFI memory map that supports
648 efi_desc_size = ia64_boot_param->efi_memdesc_size; 726 * either write-back or uncacheable access. For uncacheable regions,
727 * the supported access sizes are system-dependent, and the user is
728 * responsible for using the correct size.
729 *
730 * Note that this doesn't currently allow access to hot-added memory,
731 * because that doesn't appear in the boot-time EFI memory map.
732 */
733int
734valid_mmap_phys_addr_range (unsigned long phys_addr, unsigned long *size)
735{
736 if (efi_mem_attribute_range(phys_addr, size, EFI_MEMORY_WB))
737 return 1;
649 738
650 for (p = efi_map_start; p < efi_map_end; p += efi_desc_size) { 739 if (efi_mem_attribute_range(phys_addr, size, EFI_MEMORY_UC))
651 md = p; 740 return 1;
652 741
653 if (phys_addr - md->phys_addr < (md->num_pages << EFI_PAGE_SHIFT)) { 742 /*
654 if (!(md->attribute & EFI_MEMORY_WB)) 743 * Some firmware doesn't report MMIO regions in the EFI memory map.
655 return 0; 744 * The Intel BigSur (a.k.a. HP i2000) has this problem. In this
745 * case, we can't use the EFI memory map to validate mmap requests.
746 */
747 if (!efi_memmap_has_mmio())
748 return 1;
656 749
657 if (*size > md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) - phys_addr)
658 *size = md->phys_addr + (md->num_pages << EFI_PAGE_SHIFT) - phys_addr;
659 return 1;
660 }
661 }
662 return 0; 750 return 0;
663} 751}
664 752
@@ -707,32 +795,6 @@ efi_uart_console_only(void)
707 return 0; 795 return 0;
708} 796}
709 797
710#define efi_md_size(md) (md->num_pages << EFI_PAGE_SHIFT)
711
712static inline u64
713kmd_end(kern_memdesc_t *kmd)
714{
715 return (kmd->start + (kmd->num_pages << EFI_PAGE_SHIFT));
716}
717
718static inline u64
719efi_md_end(efi_memory_desc_t *md)
720{
721 return (md->phys_addr + efi_md_size(md));
722}
723
724static inline int
725efi_wb(efi_memory_desc_t *md)
726{
727 return (md->attribute & EFI_MEMORY_WB);
728}
729
730static inline int
731efi_uc(efi_memory_desc_t *md)
732{
733 return (md->attribute & EFI_MEMORY_UC);
734}
735
736/* 798/*
737 * Look for the first granule aligned memory descriptor memory 799 * Look for the first granule aligned memory descriptor memory
738 * that is big enough to hold EFI memory map. Make sure this 800 * that is big enough to hold EFI memory map. Make sure this
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 0741b066b98f..7a6ffd613789 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1600,5 +1600,6 @@ sys_call_table:
1600 data8 sys_inotify_init 1600 data8 sys_inotify_init
1601 data8 sys_inotify_add_watch 1601 data8 sys_inotify_add_watch
1602 data8 sys_inotify_rm_watch 1602 data8 sys_inotify_rm_watch
1603 data8 sys_migrate_pages // 1280
1603 1604
1604 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1605 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/fsys.S b/arch/ia64/kernel/fsys.S
index 2ddbac6f4999..ce423910ca97 100644
--- a/arch/ia64/kernel/fsys.S
+++ b/arch/ia64/kernel/fsys.S
@@ -903,5 +903,6 @@ fsyscall_table:
903 data8 0 903 data8 0
904 data8 0 904 data8 0
905 data8 0 905 data8 0
906 data8 0 // 1280
906 907
907 .org fsyscall_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 908 .org fsyscall_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/head.S b/arch/ia64/kernel/head.S
index bfe65b2e8621..fbc7ea35dd57 100644
--- a/arch/ia64/kernel/head.S
+++ b/arch/ia64/kernel/head.S
@@ -1060,7 +1060,7 @@ SET_REG(b5);
1060 * the clobber lists for spin_lock() in include/asm-ia64/spinlock.h. 1060 * the clobber lists for spin_lock() in include/asm-ia64/spinlock.h.
1061 */ 1061 */
1062 1062
1063#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3) 1063#if (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
1064 1064
1065GLOBAL_ENTRY(ia64_spinlock_contention_pre3_4) 1065GLOBAL_ENTRY(ia64_spinlock_contention_pre3_4)
1066 .prologue 1066 .prologue
diff --git a/arch/ia64/kernel/ia64_ksyms.c b/arch/ia64/kernel/ia64_ksyms.c
index 5db9d3bcbbcb..e72de580ebbf 100644
--- a/arch/ia64/kernel/ia64_ksyms.c
+++ b/arch/ia64/kernel/ia64_ksyms.c
@@ -103,7 +103,7 @@ EXPORT_SYMBOL(unw_init_running);
103 103
104#ifdef ASM_SUPPORTED 104#ifdef ASM_SUPPORTED
105# ifdef CONFIG_SMP 105# ifdef CONFIG_SMP
106# if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3) 106# if (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
107/* 107/*
108 * This is not a normal routine and we don't want a function descriptor for it, so we use 108 * This is not a normal routine and we don't want a function descriptor for it, so we use
109 * a fake declaration here. 109 * a fake declaration here.
diff --git a/arch/ia64/kernel/jprobes.S b/arch/ia64/kernel/jprobes.S
index 2323377e3695..5cd6226f44f2 100644
--- a/arch/ia64/kernel/jprobes.S
+++ b/arch/ia64/kernel/jprobes.S
@@ -60,3 +60,30 @@ END(jprobe_break)
60GLOBAL_ENTRY(jprobe_inst_return) 60GLOBAL_ENTRY(jprobe_inst_return)
61 br.call.sptk.many b0=jprobe_break 61 br.call.sptk.many b0=jprobe_break
62END(jprobe_inst_return) 62END(jprobe_inst_return)
63
64GLOBAL_ENTRY(invalidate_stacked_regs)
65 movl r16=invalidate_restore_cfm
66 ;;
67 mov b6=r16
68 ;;
69 br.ret.sptk.many b6
70 ;;
71invalidate_restore_cfm:
72 mov r16=ar.rsc
73 ;;
74 mov ar.rsc=r0
75 ;;
76 loadrs
77 ;;
78 mov ar.rsc=r16
79 ;;
80 br.cond.sptk.many rp
81END(invalidate_stacked_regs)
82
83GLOBAL_ENTRY(flush_register_stack)
84 // flush dirty regs to backing store (must be first in insn group)
85 flushrs
86 ;;
87 br.ret.sptk.many rp
88END(flush_register_stack)
89
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 2895d6e6062f..50ae8c7d453d 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -467,10 +467,6 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
467 flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t)); 467 flush_icache_range(arm_addr, arm_addr + sizeof(bundle_t));
468} 468}
469 469
470void __kprobes arch_remove_kprobe(struct kprobe *p)
471{
472}
473
474/* 470/*
475 * We are resuming execution after a single step fault, so the pt_regs 471 * We are resuming execution after a single step fault, so the pt_regs
476 * structure reflects the register state after we executed the instruction 472 * structure reflects the register state after we executed the instruction
@@ -630,7 +626,7 @@ static int __kprobes pre_kprobes_handler(struct die_args *args)
630 */ 626 */
631 save_previous_kprobe(kcb); 627 save_previous_kprobe(kcb);
632 set_current_kprobe(p, kcb); 628 set_current_kprobe(p, kcb);
633 p->nmissed++; 629 kprobes_inc_nmissed_count(p);
634 prepare_ss(p, regs); 630 prepare_ss(p, regs);
635 kcb->kprobe_status = KPROBE_REENTER; 631 kcb->kprobe_status = KPROBE_REENTER;
636 return 1; 632 return 1;
@@ -642,6 +638,13 @@ static int __kprobes pre_kprobes_handler(struct die_args *args)
642 if (p->break_handler && p->break_handler(p, regs)) { 638 if (p->break_handler && p->break_handler(p, regs)) {
643 goto ss_probe; 639 goto ss_probe;
644 } 640 }
641 } else if (!is_ia64_break_inst(regs)) {
642 /* The breakpoint instruction was removed by
643 * another cpu right after we hit, no further
644 * handling of this interrupt is appropriate
645 */
646 ret = 1;
647 goto no_kprobe;
645 } else { 648 } else {
646 /* Not our break */ 649 /* Not our break */
647 goto no_kprobe; 650 goto no_kprobe;
@@ -763,11 +766,56 @@ int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
763 return ret; 766 return ret;
764} 767}
765 768
769struct param_bsp_cfm {
770 unsigned long ip;
771 unsigned long *bsp;
772 unsigned long cfm;
773};
774
775static void ia64_get_bsp_cfm(struct unw_frame_info *info, void *arg)
776{
777 unsigned long ip;
778 struct param_bsp_cfm *lp = arg;
779
780 do {
781 unw_get_ip(info, &ip);
782 if (ip == 0)
783 break;
784 if (ip == lp->ip) {
785 unw_get_bsp(info, (unsigned long*)&lp->bsp);
786 unw_get_cfm(info, (unsigned long*)&lp->cfm);
787 return;
788 }
789 } while (unw_unwind(info) >= 0);
790 lp->bsp = 0;
791 lp->cfm = 0;
792 return;
793}
794
766int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs) 795int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
767{ 796{
768 struct jprobe *jp = container_of(p, struct jprobe, kp); 797 struct jprobe *jp = container_of(p, struct jprobe, kp);
769 unsigned long addr = ((struct fnptr *)(jp->entry))->ip; 798 unsigned long addr = ((struct fnptr *)(jp->entry))->ip;
770 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 799 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
800 struct param_bsp_cfm pa;
801 int bytes;
802
803 /*
804 * Callee owns the argument space and could overwrite it, eg
805 * tail call optimization. So to be absolutely safe
806 * we save the argument space before transfering the control
807 * to instrumented jprobe function which runs in
808 * the process context
809 */
810 pa.ip = regs->cr_iip;
811 unw_init_running(ia64_get_bsp_cfm, &pa);
812 bytes = (char *)ia64_rse_skip_regs(pa.bsp, pa.cfm & 0x3f)
813 - (char *)pa.bsp;
814 memcpy( kcb->jprobes_saved_stacked_regs,
815 pa.bsp,
816 bytes );
817 kcb->bsp = pa.bsp;
818 kcb->cfm = pa.cfm;
771 819
772 /* save architectural state */ 820 /* save architectural state */
773 kcb->jprobe_saved_regs = *regs; 821 kcb->jprobe_saved_regs = *regs;
@@ -789,8 +837,20 @@ int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
789int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs) 837int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
790{ 838{
791 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk(); 839 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
840 int bytes;
792 841
842 /* restoring architectural state */
793 *regs = kcb->jprobe_saved_regs; 843 *regs = kcb->jprobe_saved_regs;
844
845 /* restoring the original argument space */
846 flush_register_stack();
847 bytes = (char *)ia64_rse_skip_regs(kcb->bsp, kcb->cfm & 0x3f)
848 - (char *)kcb->bsp;
849 memcpy( kcb->bsp,
850 kcb->jprobes_saved_stacked_regs,
851 bytes );
852 invalidate_stacked_regs();
853
794 preempt_enable_no_resched(); 854 preempt_enable_no_resched();
795 return 1; 855 return 1;
796} 856}
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 355af15287c7..ee7eec9ee576 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -766,7 +766,7 @@ ia64_mca_modify_original_stack(struct pt_regs *regs,
766 l = strlen(previous_current->comm); 766 l = strlen(previous_current->comm);
767 snprintf(comm, sizeof(comm), "%s %*s %d", 767 snprintf(comm, sizeof(comm), "%s %*s %d",
768 current->comm, l, previous_current->comm, 768 current->comm, l, previous_current->comm,
769 previous_current->thread_info->cpu); 769 task_thread_info(previous_current)->cpu);
770 } 770 }
771 memcpy(current->comm, comm, sizeof(current->comm)); 771 memcpy(current->comm, comm, sizeof(current->comm));
772 772
@@ -1423,7 +1423,7 @@ format_mca_init_stack(void *mca_data, unsigned long offset,
1423 struct task_struct *p = (struct task_struct *)((char *)mca_data + offset); 1423 struct task_struct *p = (struct task_struct *)((char *)mca_data + offset);
1424 struct thread_info *ti; 1424 struct thread_info *ti;
1425 memset(p, 0, KERNEL_STACK_SIZE); 1425 memset(p, 0, KERNEL_STACK_SIZE);
1426 ti = (struct thread_info *)((char *)p + IA64_TASK_SIZE); 1426 ti = task_thread_info(p);
1427 ti->flags = _TIF_MCA_INIT; 1427 ti->flags = _TIF_MCA_INIT;
1428 ti->preempt_count = 1; 1428 ti->preempt_count = 1;
1429 ti->task = p; 1429 ti->task = p;
diff --git a/arch/ia64/kernel/mca_asm.S b/arch/ia64/kernel/mca_asm.S
index db32fc1d3935..403a80a58c13 100644
--- a/arch/ia64/kernel/mca_asm.S
+++ b/arch/ia64/kernel/mca_asm.S
@@ -847,7 +847,7 @@ ia64_state_restore:
847 ;; 847 ;;
848 mov cr.iim=temp3 848 mov cr.iim=temp3
849 mov cr.iha=temp4 849 mov cr.iha=temp4
850 dep r22=0,r22,62,2 // pal_min_state, physical, uncached 850 dep r22=0,r22,62,1 // pal_min_state, physical, uncached
851 mov IA64_KR(CURRENT)=r21 851 mov IA64_KR(CURRENT)=r21
852 ld8 r8=[temp1] // os_status 852 ld8 r8=[temp1] // os_status
853 ld8 r10=[temp2] // context 853 ld8 r10=[temp2] // context
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 410d4804fa6e..9c5194b385da 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -38,7 +38,9 @@
38#include <linux/pagemap.h> 38#include <linux/pagemap.h>
39#include <linux/mount.h> 39#include <linux/mount.h>
40#include <linux/bitops.h> 40#include <linux/bitops.h>
41#include <linux/capability.h>
41#include <linux/rcupdate.h> 42#include <linux/rcupdate.h>
43#include <linux/completion.h>
42 44
43#include <asm/errno.h> 45#include <asm/errno.h>
44#include <asm/intrinsics.h> 46#include <asm/intrinsics.h>
@@ -285,7 +287,7 @@ typedef struct pfm_context {
285 287
286 unsigned long ctx_ovfl_regs[4]; /* which registers overflowed (notification) */ 288 unsigned long ctx_ovfl_regs[4]; /* which registers overflowed (notification) */
287 289
288 struct semaphore ctx_restart_sem; /* use for blocking notification mode */ 290 struct completion ctx_restart_done; /* use for blocking notification mode */
289 291
290 unsigned long ctx_used_pmds[4]; /* bitmask of PMD used */ 292 unsigned long ctx_used_pmds[4]; /* bitmask of PMD used */
291 unsigned long ctx_all_pmds[4]; /* bitmask of all accessible PMDs */ 293 unsigned long ctx_all_pmds[4]; /* bitmask of all accessible PMDs */
@@ -627,9 +629,11 @@ static int pfm_write_ibr_dbr(int mode, pfm_context_t *ctx, void *arg, int count,
627 629
628#include "perfmon_itanium.h" 630#include "perfmon_itanium.h"
629#include "perfmon_mckinley.h" 631#include "perfmon_mckinley.h"
632#include "perfmon_montecito.h"
630#include "perfmon_generic.h" 633#include "perfmon_generic.h"
631 634
632static pmu_config_t *pmu_confs[]={ 635static pmu_config_t *pmu_confs[]={
636 &pmu_conf_mont,
633 &pmu_conf_mck, 637 &pmu_conf_mck,
634 &pmu_conf_ita, 638 &pmu_conf_ita,
635 &pmu_conf_gen, /* must be last */ 639 &pmu_conf_gen, /* must be last */
@@ -1709,7 +1713,7 @@ static void
1709pfm_syswide_force_stop(void *info) 1713pfm_syswide_force_stop(void *info)
1710{ 1714{
1711 pfm_context_t *ctx = (pfm_context_t *)info; 1715 pfm_context_t *ctx = (pfm_context_t *)info;
1712 struct pt_regs *regs = ia64_task_regs(current); 1716 struct pt_regs *regs = task_pt_regs(current);
1713 struct task_struct *owner; 1717 struct task_struct *owner;
1714 unsigned long flags; 1718 unsigned long flags;
1715 int ret; 1719 int ret;
@@ -1814,7 +1818,7 @@ pfm_flush(struct file *filp)
1814 is_system = ctx->ctx_fl_system; 1818 is_system = ctx->ctx_fl_system;
1815 1819
1816 task = PFM_CTX_TASK(ctx); 1820 task = PFM_CTX_TASK(ctx);
1817 regs = ia64_task_regs(task); 1821 regs = task_pt_regs(task);
1818 1822
1819 DPRINT(("ctx_state=%d is_current=%d\n", 1823 DPRINT(("ctx_state=%d is_current=%d\n",
1820 state, 1824 state,
@@ -1944,7 +1948,7 @@ pfm_close(struct inode *inode, struct file *filp)
1944 is_system = ctx->ctx_fl_system; 1948 is_system = ctx->ctx_fl_system;
1945 1949
1946 task = PFM_CTX_TASK(ctx); 1950 task = PFM_CTX_TASK(ctx);
1947 regs = ia64_task_regs(task); 1951 regs = task_pt_regs(task);
1948 1952
1949 DPRINT(("ctx_state=%d is_current=%d\n", 1953 DPRINT(("ctx_state=%d is_current=%d\n",
1950 state, 1954 state,
@@ -1988,7 +1992,7 @@ pfm_close(struct inode *inode, struct file *filp)
1988 /* 1992 /*
1989 * force task to wake up from MASKED state 1993 * force task to wake up from MASKED state
1990 */ 1994 */
1991 up(&ctx->ctx_restart_sem); 1995 complete(&ctx->ctx_restart_done);
1992 1996
1993 DPRINT(("waking up ctx_state=%d\n", state)); 1997 DPRINT(("waking up ctx_state=%d\n", state));
1994 1998
@@ -2703,7 +2707,7 @@ pfm_context_create(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
2703 /* 2707 /*
2704 * init restart semaphore to locked 2708 * init restart semaphore to locked
2705 */ 2709 */
2706 sema_init(&ctx->ctx_restart_sem, 0); 2710 init_completion(&ctx->ctx_restart_done);
2707 2711
2708 /* 2712 /*
2709 * activation is used in SMP only 2713 * activation is used in SMP only
@@ -3684,7 +3688,7 @@ pfm_restart(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
3684 */ 3688 */
3685 if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) { 3689 if (CTX_OVFL_NOBLOCK(ctx) == 0 && state == PFM_CTX_MASKED) {
3686 DPRINT(("unblocking [%d] \n", task->pid)); 3690 DPRINT(("unblocking [%d] \n", task->pid));
3687 up(&ctx->ctx_restart_sem); 3691 complete(&ctx->ctx_restart_done);
3688 } else { 3692 } else {
3689 DPRINT(("[%d] armed exit trap\n", task->pid)); 3693 DPRINT(("[%d] armed exit trap\n", task->pid));
3690 3694
@@ -4051,7 +4055,7 @@ pfm_stop(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
4051 */ 4055 */
4052 ia64_psr(regs)->up = 0; 4056 ia64_psr(regs)->up = 0;
4053 } else { 4057 } else {
4054 tregs = ia64_task_regs(task); 4058 tregs = task_pt_regs(task);
4055 4059
4056 /* 4060 /*
4057 * stop monitoring at the user level 4061 * stop monitoring at the user level
@@ -4133,7 +4137,7 @@ pfm_start(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
4133 ia64_psr(regs)->up = 1; 4137 ia64_psr(regs)->up = 1;
4134 4138
4135 } else { 4139 } else {
4136 tregs = ia64_task_regs(ctx->ctx_task); 4140 tregs = task_pt_regs(ctx->ctx_task);
4137 4141
4138 /* 4142 /*
4139 * start monitoring at the kernel level the next 4143 * start monitoring at the kernel level the next
@@ -4403,7 +4407,7 @@ pfm_context_load(pfm_context_t *ctx, void *arg, int count, struct pt_regs *regs)
4403 /* 4407 /*
4404 * when not current, task MUST be stopped, so this is safe 4408 * when not current, task MUST be stopped, so this is safe
4405 */ 4409 */
4406 regs = ia64_task_regs(task); 4410 regs = task_pt_regs(task);
4407 4411
4408 /* force a full reload */ 4412 /* force a full reload */
4409 ctx->ctx_last_activation = PFM_INVALID_ACTIVATION; 4413 ctx->ctx_last_activation = PFM_INVALID_ACTIVATION;
@@ -4529,7 +4533,7 @@ pfm_context_unload(pfm_context_t *ctx, void *arg, int count, struct pt_regs *reg
4529 /* 4533 /*
4530 * per-task mode 4534 * per-task mode
4531 */ 4535 */
4532 tregs = task == current ? regs : ia64_task_regs(task); 4536 tregs = task == current ? regs : task_pt_regs(task);
4533 4537
4534 if (task == current) { 4538 if (task == current) {
4535 /* 4539 /*
@@ -4592,7 +4596,7 @@ pfm_exit_thread(struct task_struct *task)
4592{ 4596{
4593 pfm_context_t *ctx; 4597 pfm_context_t *ctx;
4594 unsigned long flags; 4598 unsigned long flags;
4595 struct pt_regs *regs = ia64_task_regs(task); 4599 struct pt_regs *regs = task_pt_regs(task);
4596 int ret, state; 4600 int ret, state;
4597 int free_ok = 0; 4601 int free_ok = 0;
4598 4602
@@ -4925,7 +4929,7 @@ restart_args:
4925 if (unlikely(ret)) goto abort_locked; 4929 if (unlikely(ret)) goto abort_locked;
4926 4930
4927skip_fd: 4931skip_fd:
4928 ret = (*func)(ctx, args_k, count, ia64_task_regs(current)); 4932 ret = (*func)(ctx, args_k, count, task_pt_regs(current));
4929 4933
4930 call_made = 1; 4934 call_made = 1;
4931 4935
@@ -5049,7 +5053,7 @@ pfm_handle_work(void)
5049 5053
5050 pfm_clear_task_notify(); 5054 pfm_clear_task_notify();
5051 5055
5052 regs = ia64_task_regs(current); 5056 regs = task_pt_regs(current);
5053 5057
5054 /* 5058 /*
5055 * extract reason for being here and clear 5059 * extract reason for being here and clear
@@ -5086,7 +5090,7 @@ pfm_handle_work(void)
5086 * may go through without blocking on SMP systems 5090 * may go through without blocking on SMP systems
5087 * if restart has been received already by the time we call down() 5091 * if restart has been received already by the time we call down()
5088 */ 5092 */
5089 ret = down_interruptible(&ctx->ctx_restart_sem); 5093 ret = wait_for_completion_interruptible(&ctx->ctx_restart_done);
5090 5094
5091 DPRINT(("after block sleeping ret=%d\n", ret)); 5095 DPRINT(("after block sleeping ret=%d\n", ret));
5092 5096
@@ -5793,7 +5797,7 @@ pfm_syst_wide_update_task(struct task_struct *task, unsigned long info, int is_c
5793 * on every CPU, so we can rely on the pid to identify the idle task. 5797 * on every CPU, so we can rely on the pid to identify the idle task.
5794 */ 5798 */
5795 if ((info & PFM_CPUINFO_EXCL_IDLE) == 0 || task->pid) { 5799 if ((info & PFM_CPUINFO_EXCL_IDLE) == 0 || task->pid) {
5796 regs = ia64_task_regs(task); 5800 regs = task_pt_regs(task);
5797 ia64_psr(regs)->pp = is_ctxswin ? dcr_pp : 0; 5801 ia64_psr(regs)->pp = is_ctxswin ? dcr_pp : 0;
5798 return; 5802 return;
5799 } 5803 }
@@ -5876,7 +5880,7 @@ pfm_save_regs(struct task_struct *task)
5876 flags = pfm_protect_ctx_ctxsw(ctx); 5880 flags = pfm_protect_ctx_ctxsw(ctx);
5877 5881
5878 if (ctx->ctx_state == PFM_CTX_ZOMBIE) { 5882 if (ctx->ctx_state == PFM_CTX_ZOMBIE) {
5879 struct pt_regs *regs = ia64_task_regs(task); 5883 struct pt_regs *regs = task_pt_regs(task);
5880 5884
5881 pfm_clear_psr_up(); 5885 pfm_clear_psr_up();
5882 5886
@@ -6076,7 +6080,7 @@ pfm_load_regs (struct task_struct *task)
6076 BUG_ON(psr & IA64_PSR_I); 6080 BUG_ON(psr & IA64_PSR_I);
6077 6081
6078 if (unlikely(ctx->ctx_state == PFM_CTX_ZOMBIE)) { 6082 if (unlikely(ctx->ctx_state == PFM_CTX_ZOMBIE)) {
6079 struct pt_regs *regs = ia64_task_regs(task); 6083 struct pt_regs *regs = task_pt_regs(task);
6080 6084
6081 BUG_ON(ctx->ctx_smpl_hdr); 6085 BUG_ON(ctx->ctx_smpl_hdr);
6082 6086
@@ -6445,7 +6449,7 @@ pfm_alt_save_pmu_state(void *data)
6445{ 6449{
6446 struct pt_regs *regs; 6450 struct pt_regs *regs;
6447 6451
6448 regs = ia64_task_regs(current); 6452 regs = task_pt_regs(current);
6449 6453
6450 DPRINT(("called\n")); 6454 DPRINT(("called\n"));
6451 6455
@@ -6471,7 +6475,7 @@ pfm_alt_restore_pmu_state(void *data)
6471{ 6475{
6472 struct pt_regs *regs; 6476 struct pt_regs *regs;
6473 6477
6474 regs = ia64_task_regs(current); 6478 regs = task_pt_regs(current);
6475 6479
6476 DPRINT(("called\n")); 6480 DPRINT(("called\n"));
6477 6481
@@ -6753,7 +6757,7 @@ dump_pmu_state(const char *from)
6753 local_irq_save(flags); 6757 local_irq_save(flags);
6754 6758
6755 this_cpu = smp_processor_id(); 6759 this_cpu = smp_processor_id();
6756 regs = ia64_task_regs(current); 6760 regs = task_pt_regs(current);
6757 info = PFM_CPUINFO_GET(); 6761 info = PFM_CPUINFO_GET();
6758 dcr = ia64_getreg(_IA64_REG_CR_DCR); 6762 dcr = ia64_getreg(_IA64_REG_CR_DCR);
6759 6763
diff --git a/arch/ia64/kernel/perfmon_montecito.h b/arch/ia64/kernel/perfmon_montecito.h
new file mode 100644
index 000000000000..cd06ac6a686c
--- /dev/null
+++ b/arch/ia64/kernel/perfmon_montecito.h
@@ -0,0 +1,269 @@
1/*
2 * This file contains the Montecito PMU register description tables
3 * and pmc checker used by perfmon.c.
4 *
5 * Copyright (c) 2005-2006 Hewlett-Packard Development Company, L.P.
6 * Contributed by Stephane Eranian <eranian@hpl.hp.com>
7 */
8static int pfm_mont_pmc_check(struct task_struct *task, pfm_context_t *ctx, unsigned int cnum, unsigned long *val, struct pt_regs *regs);
9
10#define RDEP_MONT_ETB (RDEP(38)|RDEP(39)|RDEP(48)|RDEP(49)|RDEP(50)|RDEP(51)|RDEP(52)|RDEP(53)|RDEP(54)|\
11 RDEP(55)|RDEP(56)|RDEP(57)|RDEP(58)|RDEP(59)|RDEP(60)|RDEP(61)|RDEP(62)|RDEP(63))
12#define RDEP_MONT_DEAR (RDEP(32)|RDEP(33)|RDEP(36))
13#define RDEP_MONT_IEAR (RDEP(34)|RDEP(35))
14
15static pfm_reg_desc_t pfm_mont_pmc_desc[PMU_MAX_PMCS]={
16/* pmc0 */ { PFM_REG_CONTROL , 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {0,0, 0, 0}},
17/* pmc1 */ { PFM_REG_CONTROL , 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {0,0, 0, 0}},
18/* pmc2 */ { PFM_REG_CONTROL , 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {0,0, 0, 0}},
19/* pmc3 */ { PFM_REG_CONTROL , 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {0,0, 0, 0}},
20/* pmc4 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(4),0, 0, 0}, {0,0, 0, 0}},
21/* pmc5 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(5),0, 0, 0}, {0,0, 0, 0}},
22/* pmc6 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(6),0, 0, 0}, {0,0, 0, 0}},
23/* pmc7 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(7),0, 0, 0}, {0,0, 0, 0}},
24/* pmc8 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(8),0, 0, 0}, {0,0, 0, 0}},
25/* pmc9 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(9),0, 0, 0}, {0,0, 0, 0}},
26/* pmc10 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(10),0, 0, 0}, {0,0, 0, 0}},
27/* pmc11 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(11),0, 0, 0}, {0,0, 0, 0}},
28/* pmc12 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(12),0, 0, 0}, {0,0, 0, 0}},
29/* pmc13 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(13),0, 0, 0}, {0,0, 0, 0}},
30/* pmc14 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(14),0, 0, 0}, {0,0, 0, 0}},
31/* pmc15 */ { PFM_REG_COUNTING, 6, 0x2000000, 0x7c7fff7f, NULL, pfm_mont_pmc_check, {RDEP(15),0, 0, 0}, {0,0, 0, 0}},
32/* pmc16 */ { PFM_REG_NOTIMPL, },
33/* pmc17 */ { PFM_REG_NOTIMPL, },
34/* pmc18 */ { PFM_REG_NOTIMPL, },
35/* pmc19 */ { PFM_REG_NOTIMPL, },
36/* pmc20 */ { PFM_REG_NOTIMPL, },
37/* pmc21 */ { PFM_REG_NOTIMPL, },
38/* pmc22 */ { PFM_REG_NOTIMPL, },
39/* pmc23 */ { PFM_REG_NOTIMPL, },
40/* pmc24 */ { PFM_REG_NOTIMPL, },
41/* pmc25 */ { PFM_REG_NOTIMPL, },
42/* pmc26 */ { PFM_REG_NOTIMPL, },
43/* pmc27 */ { PFM_REG_NOTIMPL, },
44/* pmc28 */ { PFM_REG_NOTIMPL, },
45/* pmc29 */ { PFM_REG_NOTIMPL, },
46/* pmc30 */ { PFM_REG_NOTIMPL, },
47/* pmc31 */ { PFM_REG_NOTIMPL, },
48/* pmc32 */ { PFM_REG_CONFIG, 0, 0x30f01ffffffffff, 0x30f01ffffffffff, NULL, pfm_mont_pmc_check, {0,0, 0, 0}, {0,0, 0, 0}},
49/* pmc33 */ { PFM_REG_CONFIG, 0, 0x0, 0x1ffffffffff, NULL, pfm_mont_pmc_check, {0,0, 0, 0}, {0,0, 0, 0}},
50/* pmc34 */ { PFM_REG_CONFIG, 0, 0xf01ffffffffff, 0xf01ffffffffff, NULL, pfm_mont_pmc_check, {0,0, 0, 0}, {0,0, 0, 0}},
51/* pmc35 */ { PFM_REG_CONFIG, 0, 0x0, 0x1ffffffffff, NULL, pfm_mont_pmc_check, {0,0, 0, 0}, {0,0, 0, 0}},
52/* pmc36 */ { PFM_REG_CONFIG, 0, 0xfffffff0, 0xf, NULL, pfm_mont_pmc_check, {0,0, 0, 0}, {0,0, 0, 0}},
53/* pmc37 */ { PFM_REG_MONITOR, 4, 0x0, 0x3fff, NULL, pfm_mont_pmc_check, {RDEP_MONT_IEAR, 0, 0, 0}, {0, 0, 0, 0}},
54/* pmc38 */ { PFM_REG_CONFIG, 0, 0xdb6, 0x2492, NULL, pfm_mont_pmc_check, {0,0, 0, 0}, {0,0, 0, 0}},
55/* pmc39 */ { PFM_REG_MONITOR, 6, 0x0, 0xffcf, NULL, pfm_mont_pmc_check, {RDEP_MONT_ETB,0, 0, 0}, {0,0, 0, 0}},
56/* pmc40 */ { PFM_REG_MONITOR, 6, 0x2000000, 0xf01cf, NULL, pfm_mont_pmc_check, {RDEP_MONT_DEAR,0, 0, 0}, {0,0, 0, 0}},
57/* pmc41 */ { PFM_REG_CONFIG, 0, 0x00002078fefefefe, 0x1e00018181818, NULL, pfm_mont_pmc_check, {0,0, 0, 0}, {0,0, 0, 0}},
58/* pmc42 */ { PFM_REG_MONITOR, 6, 0x0, 0x7ff4f, NULL, pfm_mont_pmc_check, {RDEP_MONT_ETB,0, 0, 0}, {0,0, 0, 0}},
59 { PFM_REG_END , 0, 0x0, -1, NULL, NULL, {0,}, {0,}}, /* end marker */
60};
61
62static pfm_reg_desc_t pfm_mont_pmd_desc[PMU_MAX_PMDS]={
63/* pmd0 */ { PFM_REG_NOTIMPL, },
64/* pmd1 */ { PFM_REG_NOTIMPL, },
65/* pmd2 */ { PFM_REG_NOTIMPL, },
66/* pmd3 */ { PFM_REG_NOTIMPL, },
67/* pmd4 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(4),0, 0, 0}},
68/* pmd5 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(5),0, 0, 0}},
69/* pmd6 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(6),0, 0, 0}},
70/* pmd7 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(7),0, 0, 0}},
71/* pmd8 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(8),0, 0, 0}},
72/* pmd9 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(9),0, 0, 0}},
73/* pmd10 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(10),0, 0, 0}},
74/* pmd11 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(11),0, 0, 0}},
75/* pmd12 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(12),0, 0, 0}},
76/* pmd13 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(13),0, 0, 0}},
77/* pmd14 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(14),0, 0, 0}},
78/* pmd15 */ { PFM_REG_COUNTING, 0, 0x0, -1, NULL, NULL, {0,0, 0, 0}, {RDEP(15),0, 0, 0}},
79/* pmd16 */ { PFM_REG_NOTIMPL, },
80/* pmd17 */ { PFM_REG_NOTIMPL, },
81/* pmd18 */ { PFM_REG_NOTIMPL, },
82/* pmd19 */ { PFM_REG_NOTIMPL, },
83/* pmd20 */ { PFM_REG_NOTIMPL, },
84/* pmd21 */ { PFM_REG_NOTIMPL, },
85/* pmd22 */ { PFM_REG_NOTIMPL, },
86/* pmd23 */ { PFM_REG_NOTIMPL, },
87/* pmd24 */ { PFM_REG_NOTIMPL, },
88/* pmd25 */ { PFM_REG_NOTIMPL, },
89/* pmd26 */ { PFM_REG_NOTIMPL, },
90/* pmd27 */ { PFM_REG_NOTIMPL, },
91/* pmd28 */ { PFM_REG_NOTIMPL, },
92/* pmd29 */ { PFM_REG_NOTIMPL, },
93/* pmd30 */ { PFM_REG_NOTIMPL, },
94/* pmd31 */ { PFM_REG_NOTIMPL, },
95/* pmd32 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP(33)|RDEP(36),0, 0, 0}, {RDEP(40),0, 0, 0}},
96/* pmd33 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP(32)|RDEP(36),0, 0, 0}, {RDEP(40),0, 0, 0}},
97/* pmd34 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP(35),0, 0, 0}, {RDEP(37),0, 0, 0}},
98/* pmd35 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP(34),0, 0, 0}, {RDEP(37),0, 0, 0}},
99/* pmd36 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP(32)|RDEP(33),0, 0, 0}, {RDEP(40),0, 0, 0}},
100/* pmd37 */ { PFM_REG_NOTIMPL, },
101/* pmd38 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
102/* pmd39 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
103/* pmd40 */ { PFM_REG_NOTIMPL, },
104/* pmd41 */ { PFM_REG_NOTIMPL, },
105/* pmd42 */ { PFM_REG_NOTIMPL, },
106/* pmd43 */ { PFM_REG_NOTIMPL, },
107/* pmd44 */ { PFM_REG_NOTIMPL, },
108/* pmd45 */ { PFM_REG_NOTIMPL, },
109/* pmd46 */ { PFM_REG_NOTIMPL, },
110/* pmd47 */ { PFM_REG_NOTIMPL, },
111/* pmd48 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
112/* pmd49 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
113/* pmd50 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
114/* pmd51 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
115/* pmd52 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
116/* pmd53 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
117/* pmd54 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
118/* pmd55 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
119/* pmd56 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
120/* pmd57 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
121/* pmd58 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
122/* pmd59 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
123/* pmd60 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
124/* pmd61 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
125/* pmd62 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
126/* pmd63 */ { PFM_REG_BUFFER, 0, 0x0, -1, NULL, NULL, {RDEP_MONT_ETB,0, 0, 0}, {RDEP(39),0, 0, 0}},
127 { PFM_REG_END , 0, 0x0, -1, NULL, NULL, {0,}, {0,}}, /* end marker */
128};
129
130/*
131 * PMC reserved fields must have their power-up values preserved
132 */
133static int
134pfm_mont_reserved(unsigned int cnum, unsigned long *val, struct pt_regs *regs)
135{
136 unsigned long tmp1, tmp2, ival = *val;
137
138 /* remove reserved areas from user value */
139 tmp1 = ival & PMC_RSVD_MASK(cnum);
140
141 /* get reserved fields values */
142 tmp2 = PMC_DFL_VAL(cnum) & ~PMC_RSVD_MASK(cnum);
143
144 *val = tmp1 | tmp2;
145
146 DPRINT(("pmc[%d]=0x%lx, mask=0x%lx, reset=0x%lx, val=0x%lx\n",
147 cnum, ival, PMC_RSVD_MASK(cnum), PMC_DFL_VAL(cnum), *val));
148 return 0;
149}
150
151/*
152 * task can be NULL if the context is unloaded
153 */
154static int
155pfm_mont_pmc_check(struct task_struct *task, pfm_context_t *ctx, unsigned int cnum, unsigned long *val, struct pt_regs *regs)
156{
157 int ret = 0;
158 unsigned long val32 = 0, val38 = 0, val41 = 0;
159 unsigned long tmpval;
160 int check_case1 = 0;
161 int is_loaded;
162
163 /* first preserve the reserved fields */
164 pfm_mont_reserved(cnum, val, regs);
165
166 tmpval = *val;
167
168 /* sanity check */
169 if (ctx == NULL) return -EINVAL;
170
171 is_loaded = ctx->ctx_state == PFM_CTX_LOADED || ctx->ctx_state == PFM_CTX_MASKED;
172
173 /*
174 * we must clear the debug registers if pmc41 has a value which enable
175 * memory pipeline event constraints. In this case we need to clear the
176 * the debug registers if they have not yet been accessed. This is required
177 * to avoid picking stale state.
178 * PMC41 is "active" if:
179 * one of the pmc41.cfg_dtagXX field is different from 0x3
180 * AND
181 * at the corresponding pmc41.en_dbrpXX is set.
182 * AND
183 * ctx_fl_using_dbreg == 0 (i.e., dbr not yet used)
184 */
185 DPRINT(("cnum=%u val=0x%lx, using_dbreg=%d loaded=%d\n", cnum, tmpval, ctx->ctx_fl_using_dbreg, is_loaded));
186
187 if (cnum == 41 && is_loaded
188 && (tmpval & 0x1e00000000000) && (tmpval & 0x18181818UL) != 0x18181818UL && ctx->ctx_fl_using_dbreg == 0) {
189
190 DPRINT(("pmc[%d]=0x%lx has active pmc41 settings, clearing dbr\n", cnum, tmpval));
191
192 /* don't mix debug with perfmon */
193 if (task && (task->thread.flags & IA64_THREAD_DBG_VALID) != 0) return -EINVAL;
194
195 /*
196 * a count of 0 will mark the debug registers if:
197 * AND
198 */
199 ret = pfm_write_ibr_dbr(PFM_DATA_RR, ctx, NULL, 0, regs);
200 if (ret) return ret;
201 }
202 /*
203 * we must clear the (instruction) debug registers if:
204 * pmc38.ig_ibrpX is 0 (enabled)
205 * AND
206 * ctx_fl_using_dbreg == 0 (i.e., dbr not yet used)
207 */
208 if (cnum == 38 && is_loaded && ((tmpval & 0x492UL) != 0x492UL) && ctx->ctx_fl_using_dbreg == 0) {
209
210 DPRINT(("pmc38=0x%lx has active pmc38 settings, clearing ibr\n", tmpval));
211
212 /* don't mix debug with perfmon */
213 if (task && (task->thread.flags & IA64_THREAD_DBG_VALID) != 0) return -EINVAL;
214
215 /*
216 * a count of 0 will mark the debug registers as in use and also
217 * ensure that they are properly cleared.
218 */
219 ret = pfm_write_ibr_dbr(PFM_CODE_RR, ctx, NULL, 0, regs);
220 if (ret) return ret;
221
222 }
223 switch(cnum) {
224 case 32: val32 = *val;
225 val38 = ctx->ctx_pmcs[38];
226 val41 = ctx->ctx_pmcs[41];
227 check_case1 = 1;
228 break;
229 case 38: val38 = *val;
230 val32 = ctx->ctx_pmcs[32];
231 val41 = ctx->ctx_pmcs[41];
232 check_case1 = 1;
233 break;
234 case 41: val41 = *val;
235 val32 = ctx->ctx_pmcs[32];
236 val38 = ctx->ctx_pmcs[38];
237 check_case1 = 1;
238 break;
239 }
240 /* check illegal configuration which can produce inconsistencies in tagging
241 * i-side events in L1D and L2 caches
242 */
243 if (check_case1) {
244 ret = (((val41 >> 45) & 0xf) == 0 && ((val32>>57) & 0x1) == 0)
245 && ((((val38>>1) & 0x3) == 0x2 || ((val38>>1) & 0x3) == 0)
246 || (((val38>>4) & 0x3) == 0x2 || ((val38>>4) & 0x3) == 0));
247 if (ret) {
248 DPRINT(("invalid config pmc38=0x%lx pmc41=0x%lx pmc32=0x%lx\n", val38, val41, val32));
249 return -EINVAL;
250 }
251 }
252 *val = tmpval;
253 return 0;
254}
255
256/*
257 * impl_pmcs, impl_pmds are computed at runtime to minimize errors!
258 */
259static pmu_config_t pmu_conf_mont={
260 .pmu_name = "Montecito",
261 .pmu_family = 0x20,
262 .flags = PFM_PMU_IRQ_RESEND,
263 .ovfl_val = (1UL << 47) - 1,
264 .pmd_desc = pfm_mont_pmd_desc,
265 .pmc_desc = pfm_mont_pmc_desc,
266 .num_ibrs = 8,
267 .num_dbrs = 8,
268 .use_rr_dbregs = 1 /* debug register are use for range retrictions */
269};
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 2e33665d9c18..309d59658e5f 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -328,7 +328,7 @@ ia64_save_extra (struct task_struct *task)
328#endif 328#endif
329 329
330#ifdef CONFIG_IA32_SUPPORT 330#ifdef CONFIG_IA32_SUPPORT
331 if (IS_IA32_PROCESS(ia64_task_regs(task))) 331 if (IS_IA32_PROCESS(task_pt_regs(task)))
332 ia32_save_state(task); 332 ia32_save_state(task);
333#endif 333#endif
334} 334}
@@ -353,7 +353,7 @@ ia64_load_extra (struct task_struct *task)
353#endif 353#endif
354 354
355#ifdef CONFIG_IA32_SUPPORT 355#ifdef CONFIG_IA32_SUPPORT
356 if (IS_IA32_PROCESS(ia64_task_regs(task))) 356 if (IS_IA32_PROCESS(task_pt_regs(task)))
357 ia32_load_state(task); 357 ia32_load_state(task);
358#endif 358#endif
359} 359}
@@ -488,7 +488,7 @@ copy_thread (int nr, unsigned long clone_flags,
488 * If we're cloning an IA32 task then save the IA32 extra 488 * If we're cloning an IA32 task then save the IA32 extra
489 * state from the current task to the new task 489 * state from the current task to the new task
490 */ 490 */
491 if (IS_IA32_PROCESS(ia64_task_regs(current))) { 491 if (IS_IA32_PROCESS(task_pt_regs(current))) {
492 ia32_save_state(p); 492 ia32_save_state(p);
493 if (clone_flags & CLONE_SETTLS) 493 if (clone_flags & CLONE_SETTLS)
494 retval = ia32_clone_tls(p, child_ptregs); 494 retval = ia32_clone_tls(p, child_ptregs);
@@ -701,7 +701,7 @@ int
701kernel_thread_helper (int (*fn)(void *), void *arg) 701kernel_thread_helper (int (*fn)(void *), void *arg)
702{ 702{
703#ifdef CONFIG_IA32_SUPPORT 703#ifdef CONFIG_IA32_SUPPORT
704 if (IS_IA32_PROCESS(ia64_task_regs(current))) { 704 if (IS_IA32_PROCESS(task_pt_regs(current))) {
705 /* A kernel thread is always a 64-bit process. */ 705 /* A kernel thread is always a 64-bit process. */
706 current->thread.map_base = DEFAULT_MAP_BASE; 706 current->thread.map_base = DEFAULT_MAP_BASE;
707 current->thread.task_size = DEFAULT_TASK_SIZE; 707 current->thread.task_size = DEFAULT_TASK_SIZE;
@@ -721,8 +721,13 @@ flush_thread (void)
721 /* drop floating-point and debug-register state if it exists: */ 721 /* drop floating-point and debug-register state if it exists: */
722 current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID); 722 current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID);
723 ia64_drop_fpu(current); 723 ia64_drop_fpu(current);
724 if (IS_IA32_PROCESS(ia64_task_regs(current))) 724#ifdef CONFIG_IA32_SUPPORT
725 if (IS_IA32_PROCESS(task_pt_regs(current))) {
725 ia32_drop_partial_page_list(current); 726 ia32_drop_partial_page_list(current);
727 current->thread.task_size = IA32_PAGE_OFFSET;
728 set_fs(USER_DS);
729 }
730#endif
726} 731}
727 732
728/* 733/*
@@ -750,7 +755,7 @@ exit_thread (void)
750 if (current->thread.flags & IA64_THREAD_DBG_VALID) 755 if (current->thread.flags & IA64_THREAD_DBG_VALID)
751 pfm_release_debug_registers(current); 756 pfm_release_debug_registers(current);
752#endif 757#endif
753 if (IS_IA32_PROCESS(ia64_task_regs(current))) 758 if (IS_IA32_PROCESS(task_pt_regs(current)))
754 ia32_drop_partial_page_list(current); 759 ia32_drop_partial_page_list(current);
755} 760}
756 761
diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c
index 4b19d0410632..eaed14aac6aa 100644
--- a/arch/ia64/kernel/ptrace.c
+++ b/arch/ia64/kernel/ptrace.c
@@ -254,7 +254,7 @@ get_rnat (struct task_struct *task, struct switch_stack *sw,
254 long num_regs, nbits; 254 long num_regs, nbits;
255 struct pt_regs *pt; 255 struct pt_regs *pt;
256 256
257 pt = ia64_task_regs(task); 257 pt = task_pt_regs(task);
258 kbsp = (unsigned long *) sw->ar_bspstore; 258 kbsp = (unsigned long *) sw->ar_bspstore;
259 ubspstore = (unsigned long *) pt->ar_bspstore; 259 ubspstore = (unsigned long *) pt->ar_bspstore;
260 260
@@ -314,7 +314,7 @@ put_rnat (struct task_struct *task, struct switch_stack *sw,
314 struct pt_regs *pt; 314 struct pt_regs *pt;
315 unsigned long cfm, *urbs_kargs; 315 unsigned long cfm, *urbs_kargs;
316 316
317 pt = ia64_task_regs(task); 317 pt = task_pt_regs(task);
318 kbsp = (unsigned long *) sw->ar_bspstore; 318 kbsp = (unsigned long *) sw->ar_bspstore;
319 ubspstore = (unsigned long *) pt->ar_bspstore; 319 ubspstore = (unsigned long *) pt->ar_bspstore;
320 320
@@ -407,7 +407,7 @@ ia64_peek (struct task_struct *child, struct switch_stack *child_stack,
407 407
408 urbs_end = (long *) user_rbs_end; 408 urbs_end = (long *) user_rbs_end;
409 laddr = (unsigned long *) addr; 409 laddr = (unsigned long *) addr;
410 child_regs = ia64_task_regs(child); 410 child_regs = task_pt_regs(child);
411 bspstore = (unsigned long *) child_regs->ar_bspstore; 411 bspstore = (unsigned long *) child_regs->ar_bspstore;
412 krbs = (unsigned long *) child + IA64_RBS_OFFSET/8; 412 krbs = (unsigned long *) child + IA64_RBS_OFFSET/8;
413 if (on_kernel_rbs(addr, (unsigned long) bspstore, 413 if (on_kernel_rbs(addr, (unsigned long) bspstore,
@@ -467,7 +467,7 @@ ia64_poke (struct task_struct *child, struct switch_stack *child_stack,
467 struct pt_regs *child_regs; 467 struct pt_regs *child_regs;
468 468
469 laddr = (unsigned long *) addr; 469 laddr = (unsigned long *) addr;
470 child_regs = ia64_task_regs(child); 470 child_regs = task_pt_regs(child);
471 bspstore = (unsigned long *) child_regs->ar_bspstore; 471 bspstore = (unsigned long *) child_regs->ar_bspstore;
472 krbs = (unsigned long *) child + IA64_RBS_OFFSET/8; 472 krbs = (unsigned long *) child + IA64_RBS_OFFSET/8;
473 if (on_kernel_rbs(addr, (unsigned long) bspstore, 473 if (on_kernel_rbs(addr, (unsigned long) bspstore,
@@ -567,7 +567,7 @@ thread_matches (struct task_struct *thread, unsigned long addr)
567 */ 567 */
568 return 0; 568 return 0;
569 569
570 thread_regs = ia64_task_regs(thread); 570 thread_regs = task_pt_regs(thread);
571 thread_rbs_end = ia64_get_user_rbs_end(thread, thread_regs, NULL); 571 thread_rbs_end = ia64_get_user_rbs_end(thread, thread_regs, NULL);
572 if (!on_kernel_rbs(addr, thread_regs->ar_bspstore, thread_rbs_end)) 572 if (!on_kernel_rbs(addr, thread_regs->ar_bspstore, thread_rbs_end))
573 return 0; 573 return 0;
@@ -627,7 +627,7 @@ find_thread_for_addr (struct task_struct *child, unsigned long addr)
627inline void 627inline void
628ia64_flush_fph (struct task_struct *task) 628ia64_flush_fph (struct task_struct *task)
629{ 629{
630 struct ia64_psr *psr = ia64_psr(ia64_task_regs(task)); 630 struct ia64_psr *psr = ia64_psr(task_pt_regs(task));
631 631
632 /* 632 /*
633 * Prevent migrating this task while 633 * Prevent migrating this task while
@@ -653,7 +653,7 @@ ia64_flush_fph (struct task_struct *task)
653void 653void
654ia64_sync_fph (struct task_struct *task) 654ia64_sync_fph (struct task_struct *task)
655{ 655{
656 struct ia64_psr *psr = ia64_psr(ia64_task_regs(task)); 656 struct ia64_psr *psr = ia64_psr(task_pt_regs(task));
657 657
658 ia64_flush_fph(task); 658 ia64_flush_fph(task);
659 if (!(task->thread.flags & IA64_THREAD_FPH_VALID)) { 659 if (!(task->thread.flags & IA64_THREAD_FPH_VALID)) {
@@ -794,7 +794,7 @@ access_uarea (struct task_struct *child, unsigned long addr,
794 + offsetof(struct pt_regs, reg))) 794 + offsetof(struct pt_regs, reg)))
795 795
796 796
797 pt = ia64_task_regs(child); 797 pt = task_pt_regs(child);
798 sw = (struct switch_stack *) (child->thread.ksp + 16); 798 sw = (struct switch_stack *) (child->thread.ksp + 16);
799 799
800 if ((addr & 0x7) != 0) { 800 if ((addr & 0x7) != 0) {
@@ -1120,7 +1120,7 @@ ptrace_getregs (struct task_struct *child, struct pt_all_user_regs __user *ppr)
1120 if (!access_ok(VERIFY_WRITE, ppr, sizeof(struct pt_all_user_regs))) 1120 if (!access_ok(VERIFY_WRITE, ppr, sizeof(struct pt_all_user_regs)))
1121 return -EIO; 1121 return -EIO;
1122 1122
1123 pt = ia64_task_regs(child); 1123 pt = task_pt_regs(child);
1124 sw = (struct switch_stack *) (child->thread.ksp + 16); 1124 sw = (struct switch_stack *) (child->thread.ksp + 16);
1125 unw_init_from_blocked_task(&info, child); 1125 unw_init_from_blocked_task(&info, child);
1126 if (unw_unwind_to_user(&info) < 0) { 1126 if (unw_unwind_to_user(&info) < 0) {
@@ -1265,7 +1265,7 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs __user *ppr)
1265 if (!access_ok(VERIFY_READ, ppr, sizeof(struct pt_all_user_regs))) 1265 if (!access_ok(VERIFY_READ, ppr, sizeof(struct pt_all_user_regs)))
1266 return -EIO; 1266 return -EIO;
1267 1267
1268 pt = ia64_task_regs(child); 1268 pt = task_pt_regs(child);
1269 sw = (struct switch_stack *) (child->thread.ksp + 16); 1269 sw = (struct switch_stack *) (child->thread.ksp + 16);
1270 unw_init_from_blocked_task(&info, child); 1270 unw_init_from_blocked_task(&info, child);
1271 if (unw_unwind_to_user(&info) < 0) { 1271 if (unw_unwind_to_user(&info) < 0) {
@@ -1403,7 +1403,7 @@ ptrace_setregs (struct task_struct *child, struct pt_all_user_regs __user *ppr)
1403void 1403void
1404ptrace_disable (struct task_struct *child) 1404ptrace_disable (struct task_struct *child)
1405{ 1405{
1406 struct ia64_psr *child_psr = ia64_psr(ia64_task_regs(child)); 1406 struct ia64_psr *child_psr = ia64_psr(task_pt_regs(child));
1407 1407
1408 /* make sure the single step/taken-branch trap bits are not set: */ 1408 /* make sure the single step/taken-branch trap bits are not set: */
1409 child_psr->ss = 0; 1409 child_psr->ss = 0;
@@ -1422,14 +1422,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
1422 lock_kernel(); 1422 lock_kernel();
1423 ret = -EPERM; 1423 ret = -EPERM;
1424 if (request == PTRACE_TRACEME) { 1424 if (request == PTRACE_TRACEME) {
1425 /* are we already being traced? */ 1425 ret = ptrace_traceme();
1426 if (current->ptrace & PT_PTRACED)
1427 goto out;
1428 ret = security_ptrace(current->parent, current);
1429 if (ret)
1430 goto out;
1431 current->ptrace |= PT_PTRACED;
1432 ret = 0;
1433 goto out; 1426 goto out;
1434 } 1427 }
1435 1428
@@ -1463,7 +1456,7 @@ sys_ptrace (long request, pid_t pid, unsigned long addr, unsigned long data)
1463 if (ret < 0) 1456 if (ret < 0)
1464 goto out_tsk; 1457 goto out_tsk;
1465 1458
1466 pt = ia64_task_regs(child); 1459 pt = task_pt_regs(child);
1467 sw = (struct switch_stack *) (child->thread.ksp + 16); 1460 sw = (struct switch_stack *) (child->thread.ksp + 16);
1468 1461
1469 switch (request) { 1462 switch (request) {
diff --git a/arch/ia64/kernel/salinfo.c b/arch/ia64/kernel/salinfo.c
index ca68e6e44a72..9d5a823479a3 100644
--- a/arch/ia64/kernel/salinfo.c
+++ b/arch/ia64/kernel/salinfo.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Creates entries in /proc/sal for various system features. 4 * Creates entries in /proc/sal for various system features.
5 * 5 *
6 * Copyright (c) 2003 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (c) 2003, 2006 Silicon Graphics, Inc. All rights reserved.
7 * Copyright (c) 2003 Hewlett-Packard Co 7 * Copyright (c) 2003 Hewlett-Packard Co
8 * Bjorn Helgaas <bjorn.helgaas@hp.com> 8 * Bjorn Helgaas <bjorn.helgaas@hp.com>
9 * 9 *
@@ -27,8 +27,17 @@
27 * mca.c may not pass a buffer, a NULL buffer just indicates that a new 27 * mca.c may not pass a buffer, a NULL buffer just indicates that a new
28 * record is available in SAL. 28 * record is available in SAL.
29 * Replace some NR_CPUS by cpus_online, for hotplug cpu. 29 * Replace some NR_CPUS by cpus_online, for hotplug cpu.
30 *
31 * Jan 5 2006 kaos@sgi.com
32 * Handle hotplug cpus coming online.
33 * Handle hotplug cpus going offline while they still have outstanding records.
34 * Use the cpu_* macros consistently.
35 * Replace the counting semaphore with a mutex and a test if the cpumask is non-empty.
36 * Modify the locking to make the test for "work to do" an atomic operation.
30 */ 37 */
31 38
39#include <linux/capability.h>
40#include <linux/cpu.h>
32#include <linux/types.h> 41#include <linux/types.h>
33#include <linux/proc_fs.h> 42#include <linux/proc_fs.h>
34#include <linux/module.h> 43#include <linux/module.h>
@@ -131,8 +140,8 @@ enum salinfo_state {
131}; 140};
132 141
133struct salinfo_data { 142struct salinfo_data {
134 volatile cpumask_t cpu_event; /* which cpus have outstanding events */ 143 cpumask_t cpu_event; /* which cpus have outstanding events */
135 struct semaphore sem; /* count of cpus with outstanding events (bits set in cpu_event) */ 144 struct semaphore mutex;
136 u8 *log_buffer; 145 u8 *log_buffer;
137 u64 log_size; 146 u64 log_size;
138 u8 *oemdata; /* decoded oem data */ 147 u8 *oemdata; /* decoded oem data */
@@ -173,6 +182,21 @@ struct salinfo_platform_oemdata_parms {
173 int ret; 182 int ret;
174}; 183};
175 184
185/* Kick the mutex that tells user space that there is work to do. Instead of
186 * trying to track the state of the mutex across multiple cpus, in user
187 * context, interrupt context, non-maskable interrupt context and hotplug cpu,
188 * it is far easier just to grab the mutex if it is free then release it.
189 *
190 * This routine must be called with data_saved_lock held, to make the down/up
191 * operation atomic.
192 */
193static void
194salinfo_work_to_do(struct salinfo_data *data)
195{
196 down_trylock(&data->mutex);
197 up(&data->mutex);
198}
199
176static void 200static void
177salinfo_platform_oemdata_cpu(void *context) 201salinfo_platform_oemdata_cpu(void *context)
178{ 202{
@@ -211,9 +235,9 @@ salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
211 235
212 BUG_ON(type >= ARRAY_SIZE(salinfo_log_name)); 236 BUG_ON(type >= ARRAY_SIZE(salinfo_log_name));
213 237
238 if (irqsafe)
239 spin_lock_irqsave(&data_saved_lock, flags);
214 if (buffer) { 240 if (buffer) {
215 if (irqsafe)
216 spin_lock_irqsave(&data_saved_lock, flags);
217 for (i = 0, data_saved = data->data_saved; i < saved_size; ++i, ++data_saved) { 241 for (i = 0, data_saved = data->data_saved; i < saved_size; ++i, ++data_saved) {
218 if (!data_saved->buffer) 242 if (!data_saved->buffer)
219 break; 243 break;
@@ -231,13 +255,11 @@ salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
231 data_saved->size = size; 255 data_saved->size = size;
232 data_saved->buffer = buffer; 256 data_saved->buffer = buffer;
233 } 257 }
234 if (irqsafe)
235 spin_unlock_irqrestore(&data_saved_lock, flags);
236 } 258 }
237 259 cpu_set(smp_processor_id(), data->cpu_event);
238 if (!test_and_set_bit(smp_processor_id(), &data->cpu_event)) { 260 if (irqsafe) {
239 if (irqsafe) 261 salinfo_work_to_do(data);
240 up(&data->sem); 262 spin_unlock_irqrestore(&data_saved_lock, flags);
241 } 263 }
242} 264}
243 265
@@ -248,20 +270,17 @@ static struct timer_list salinfo_timer;
248static void 270static void
249salinfo_timeout_check(struct salinfo_data *data) 271salinfo_timeout_check(struct salinfo_data *data)
250{ 272{
251 int i; 273 unsigned long flags;
252 if (!data->open) 274 if (!data->open)
253 return; 275 return;
254 for_each_online_cpu(i) { 276 if (!cpus_empty(data->cpu_event)) {
255 if (test_bit(i, &data->cpu_event)) { 277 spin_lock_irqsave(&data_saved_lock, flags);
256 /* double up() is not a problem, user space will see no 278 salinfo_work_to_do(data);
257 * records for the additional "events". 279 spin_unlock_irqrestore(&data_saved_lock, flags);
258 */
259 up(&data->sem);
260 }
261 } 280 }
262} 281}
263 282
264static void 283static void
265salinfo_timeout (unsigned long arg) 284salinfo_timeout (unsigned long arg)
266{ 285{
267 salinfo_timeout_check(salinfo_data + SAL_INFO_TYPE_MCA); 286 salinfo_timeout_check(salinfo_data + SAL_INFO_TYPE_MCA);
@@ -289,16 +308,20 @@ salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t
289 int i, n, cpu = -1; 308 int i, n, cpu = -1;
290 309
291retry: 310retry:
292 if (down_trylock(&data->sem)) { 311 if (cpus_empty(data->cpu_event) && down_trylock(&data->mutex)) {
293 if (file->f_flags & O_NONBLOCK) 312 if (file->f_flags & O_NONBLOCK)
294 return -EAGAIN; 313 return -EAGAIN;
295 if (down_interruptible(&data->sem)) 314 if (down_interruptible(&data->mutex))
296 return -ERESTARTSYS; 315 return -EINTR;
297 } 316 }
298 317
299 n = data->cpu_check; 318 n = data->cpu_check;
300 for (i = 0; i < NR_CPUS; i++) { 319 for (i = 0; i < NR_CPUS; i++) {
301 if (test_bit(n, &data->cpu_event) && cpu_online(n)) { 320 if (cpu_isset(n, data->cpu_event)) {
321 if (!cpu_online(n)) {
322 cpu_clear(n, data->cpu_event);
323 continue;
324 }
302 cpu = n; 325 cpu = n;
303 break; 326 break;
304 } 327 }
@@ -309,9 +332,6 @@ retry:
309 if (cpu == -1) 332 if (cpu == -1)
310 goto retry; 333 goto retry;
311 334
312 /* events are sticky until the user says "clear" */
313 up(&data->sem);
314
315 /* for next read, start checking at next CPU */ 335 /* for next read, start checking at next CPU */
316 data->cpu_check = cpu; 336 data->cpu_check = cpu;
317 if (++data->cpu_check == NR_CPUS) 337 if (++data->cpu_check == NR_CPUS)
@@ -380,10 +400,8 @@ salinfo_log_release(struct inode *inode, struct file *file)
380static void 400static void
381call_on_cpu(int cpu, void (*fn)(void *), void *arg) 401call_on_cpu(int cpu, void (*fn)(void *), void *arg)
382{ 402{
383 cpumask_t save_cpus_allowed, new_cpus_allowed; 403 cpumask_t save_cpus_allowed = current->cpus_allowed;
384 memcpy(&save_cpus_allowed, &current->cpus_allowed, sizeof(save_cpus_allowed)); 404 cpumask_t new_cpus_allowed = cpumask_of_cpu(cpu);
385 memset(&new_cpus_allowed, 0, sizeof(new_cpus_allowed));
386 set_bit(cpu, &new_cpus_allowed);
387 set_cpus_allowed(current, new_cpus_allowed); 405 set_cpus_allowed(current, new_cpus_allowed);
388 (*fn)(arg); 406 (*fn)(arg);
389 set_cpus_allowed(current, save_cpus_allowed); 407 set_cpus_allowed(current, save_cpus_allowed);
@@ -432,10 +450,10 @@ retry:
432 if (!data->saved_num) 450 if (!data->saved_num)
433 call_on_cpu(cpu, salinfo_log_read_cpu, data); 451 call_on_cpu(cpu, salinfo_log_read_cpu, data);
434 if (!data->log_size) { 452 if (!data->log_size) {
435 data->state = STATE_NO_DATA; 453 data->state = STATE_NO_DATA;
436 clear_bit(cpu, &data->cpu_event); 454 cpu_clear(cpu, data->cpu_event);
437 } else { 455 } else {
438 data->state = STATE_LOG_RECORD; 456 data->state = STATE_LOG_RECORD;
439 } 457 }
440} 458}
441 459
@@ -472,27 +490,31 @@ static int
472salinfo_log_clear(struct salinfo_data *data, int cpu) 490salinfo_log_clear(struct salinfo_data *data, int cpu)
473{ 491{
474 sal_log_record_header_t *rh; 492 sal_log_record_header_t *rh;
493 unsigned long flags;
494 spin_lock_irqsave(&data_saved_lock, flags);
475 data->state = STATE_NO_DATA; 495 data->state = STATE_NO_DATA;
476 if (!test_bit(cpu, &data->cpu_event)) 496 if (!cpu_isset(cpu, data->cpu_event)) {
497 spin_unlock_irqrestore(&data_saved_lock, flags);
477 return 0; 498 return 0;
478 down(&data->sem); 499 }
479 clear_bit(cpu, &data->cpu_event); 500 cpu_clear(cpu, data->cpu_event);
480 if (data->saved_num) { 501 if (data->saved_num) {
481 unsigned long flags; 502 shift1_data_saved(data, data->saved_num - 1);
482 spin_lock_irqsave(&data_saved_lock, flags);
483 shift1_data_saved(data, data->saved_num - 1 );
484 data->saved_num = 0; 503 data->saved_num = 0;
485 spin_unlock_irqrestore(&data_saved_lock, flags);
486 } 504 }
505 spin_unlock_irqrestore(&data_saved_lock, flags);
487 rh = (sal_log_record_header_t *)(data->log_buffer); 506 rh = (sal_log_record_header_t *)(data->log_buffer);
488 /* Corrected errors have already been cleared from SAL */ 507 /* Corrected errors have already been cleared from SAL */
489 if (rh->severity != sal_log_severity_corrected) 508 if (rh->severity != sal_log_severity_corrected)
490 call_on_cpu(cpu, salinfo_log_clear_cpu, data); 509 call_on_cpu(cpu, salinfo_log_clear_cpu, data);
491 /* clearing a record may make a new record visible */ 510 /* clearing a record may make a new record visible */
492 salinfo_log_new_read(cpu, data); 511 salinfo_log_new_read(cpu, data);
493 if (data->state == STATE_LOG_RECORD && 512 if (data->state == STATE_LOG_RECORD) {
494 !test_and_set_bit(cpu, &data->cpu_event)) 513 spin_lock_irqsave(&data_saved_lock, flags);
495 up(&data->sem); 514 cpu_set(cpu, data->cpu_event);
515 salinfo_work_to_do(data);
516 spin_unlock_irqrestore(&data_saved_lock, flags);
517 }
496 return 0; 518 return 0;
497} 519}
498 520
@@ -549,6 +571,53 @@ static struct file_operations salinfo_data_fops = {
549 .write = salinfo_log_write, 571 .write = salinfo_log_write,
550}; 572};
551 573
574#ifdef CONFIG_HOTPLUG_CPU
575static int __devinit
576salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
577{
578 unsigned int i, cpu = (unsigned long)hcpu;
579 unsigned long flags;
580 struct salinfo_data *data;
581 switch (action) {
582 case CPU_ONLINE:
583 spin_lock_irqsave(&data_saved_lock, flags);
584 for (i = 0, data = salinfo_data;
585 i < ARRAY_SIZE(salinfo_data);
586 ++i, ++data) {
587 cpu_set(cpu, data->cpu_event);
588 salinfo_work_to_do(data);
589 }
590 spin_unlock_irqrestore(&data_saved_lock, flags);
591 break;
592 case CPU_DEAD:
593 spin_lock_irqsave(&data_saved_lock, flags);
594 for (i = 0, data = salinfo_data;
595 i < ARRAY_SIZE(salinfo_data);
596 ++i, ++data) {
597 struct salinfo_data_saved *data_saved;
598 int j;
599 for (j = ARRAY_SIZE(data->data_saved) - 1, data_saved = data->data_saved + j;
600 j >= 0;
601 --j, --data_saved) {
602 if (data_saved->buffer && data_saved->cpu == cpu) {
603 shift1_data_saved(data, j);
604 }
605 }
606 cpu_clear(cpu, data->cpu_event);
607 }
608 spin_unlock_irqrestore(&data_saved_lock, flags);
609 break;
610 }
611 return NOTIFY_OK;
612}
613
614static struct notifier_block salinfo_cpu_notifier =
615{
616 .notifier_call = salinfo_cpu_callback,
617 .priority = 0,
618};
619#endif /* CONFIG_HOTPLUG_CPU */
620
552static int __init 621static int __init
553salinfo_init(void) 622salinfo_init(void)
554{ 623{
@@ -556,7 +625,7 @@ salinfo_init(void)
556 struct proc_dir_entry **sdir = salinfo_proc_entries; /* keeps track of every entry */ 625 struct proc_dir_entry **sdir = salinfo_proc_entries; /* keeps track of every entry */
557 struct proc_dir_entry *dir, *entry; 626 struct proc_dir_entry *dir, *entry;
558 struct salinfo_data *data; 627 struct salinfo_data *data;
559 int i, j, online; 628 int i, j;
560 629
561 salinfo_dir = proc_mkdir("sal", NULL); 630 salinfo_dir = proc_mkdir("sal", NULL);
562 if (!salinfo_dir) 631 if (!salinfo_dir)
@@ -571,7 +640,7 @@ salinfo_init(void)
571 for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) { 640 for (i = 0; i < ARRAY_SIZE(salinfo_log_name); i++) {
572 data = salinfo_data + i; 641 data = salinfo_data + i;
573 data->type = i; 642 data->type = i;
574 sema_init(&data->sem, 0); 643 init_MUTEX(&data->mutex);
575 dir = proc_mkdir(salinfo_log_name[i], salinfo_dir); 644 dir = proc_mkdir(salinfo_log_name[i], salinfo_dir);
576 if (!dir) 645 if (!dir)
577 continue; 646 continue;
@@ -591,12 +660,8 @@ salinfo_init(void)
591 *sdir++ = entry; 660 *sdir++ = entry;
592 661
593 /* we missed any events before now */ 662 /* we missed any events before now */
594 online = 0; 663 for_each_online_cpu(j)
595 for_each_online_cpu(j) { 664 cpu_set(j, data->cpu_event);
596 set_bit(j, &data->cpu_event);
597 ++online;
598 }
599 sema_init(&data->sem, online);
600 665
601 *sdir++ = dir; 666 *sdir++ = dir;
602 } 667 }
@@ -608,6 +673,10 @@ salinfo_init(void)
608 salinfo_timer.function = &salinfo_timeout; 673 salinfo_timer.function = &salinfo_timeout;
609 add_timer(&salinfo_timer); 674 add_timer(&salinfo_timer);
610 675
676#ifdef CONFIG_HOTPLUG_CPU
677 register_cpu_notifier(&salinfo_cpu_notifier);
678#endif
679
611 return 0; 680 return 0;
612} 681}
613 682
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 5add0bcf87a7..c0766575a3a2 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -43,6 +43,7 @@
43#include <linux/initrd.h> 43#include <linux/initrd.h>
44#include <linux/platform.h> 44#include <linux/platform.h>
45#include <linux/pm.h> 45#include <linux/pm.h>
46#include <linux/cpufreq.h>
46 47
47#include <asm/ia32.h> 48#include <asm/ia32.h>
48#include <asm/machvec.h> 49#include <asm/machvec.h>
@@ -59,6 +60,7 @@
59#include <asm/smp.h> 60#include <asm/smp.h>
60#include <asm/system.h> 61#include <asm/system.h>
61#include <asm/unistd.h> 62#include <asm/unistd.h>
63#include <asm/system.h>
62 64
63#if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE) 65#if defined(CONFIG_SMP) && (IA64_CPU_SIZE > PAGE_SIZE)
64# error "struct cpuinfo_ia64 too big!" 66# error "struct cpuinfo_ia64 too big!"
@@ -517,6 +519,7 @@ show_cpuinfo (struct seq_file *m, void *v)
517 char family[32], features[128], *cp, sep; 519 char family[32], features[128], *cp, sep;
518 struct cpuinfo_ia64 *c = v; 520 struct cpuinfo_ia64 *c = v;
519 unsigned long mask; 521 unsigned long mask;
522 unsigned long proc_freq;
520 int i; 523 int i;
521 524
522 mask = c->features; 525 mask = c->features;
@@ -549,6 +552,10 @@ show_cpuinfo (struct seq_file *m, void *v)
549 sprintf(cp, " 0x%lx", mask); 552 sprintf(cp, " 0x%lx", mask);
550 } 553 }
551 554
555 proc_freq = cpufreq_quick_get(cpunum);
556 if (!proc_freq)
557 proc_freq = c->proc_freq / 1000;
558
552 seq_printf(m, 559 seq_printf(m,
553 "processor : %d\n" 560 "processor : %d\n"
554 "vendor : %s\n" 561 "vendor : %s\n"
@@ -565,7 +572,7 @@ show_cpuinfo (struct seq_file *m, void *v)
565 "BogoMIPS : %lu.%02lu\n", 572 "BogoMIPS : %lu.%02lu\n",
566 cpunum, c->vendor, family, c->model, c->revision, c->archrev, 573 cpunum, c->vendor, family, c->model, c->revision, c->archrev,
567 features, c->ppn, c->number, 574 features, c->ppn, c->number,
568 c->proc_freq / 1000000, c->proc_freq % 1000000, 575 proc_freq / 1000, proc_freq % 1000,
569 c->itc_freq / 1000000, c->itc_freq % 1000000, 576 c->itc_freq / 1000000, c->itc_freq % 1000000,
570 lpj*HZ/500000, (lpj*HZ/5000) % 100); 577 lpj*HZ/500000, (lpj*HZ/5000) % 100);
571#ifdef CONFIG_SMP 578#ifdef CONFIG_SMP
@@ -689,6 +696,7 @@ static void
689get_max_cacheline_size (void) 696get_max_cacheline_size (void)
690{ 697{
691 unsigned long line_size, max = 1; 698 unsigned long line_size, max = 1;
699 unsigned int cache_size = 0;
692 u64 l, levels, unique_caches; 700 u64 l, levels, unique_caches;
693 pal_cache_config_info_t cci; 701 pal_cache_config_info_t cci;
694 s64 status; 702 s64 status;
@@ -718,6 +726,8 @@ get_max_cacheline_size (void)
718 line_size = 1 << cci.pcci_line_size; 726 line_size = 1 << cci.pcci_line_size;
719 if (line_size > max) 727 if (line_size > max)
720 max = line_size; 728 max = line_size;
729 if (cache_size < cci.pcci_cache_size)
730 cache_size = cci.pcci_cache_size;
721 if (!cci.pcci_unified) { 731 if (!cci.pcci_unified) {
722 status = ia64_pal_cache_config_info(l, 732 status = ia64_pal_cache_config_info(l,
723 /* cache_type (instruction)= */ 1, 733 /* cache_type (instruction)= */ 1,
@@ -734,6 +744,9 @@ get_max_cacheline_size (void)
734 ia64_i_cache_stride_shift = cci.pcci_stride; 744 ia64_i_cache_stride_shift = cci.pcci_stride;
735 } 745 }
736 out: 746 out:
747#ifdef CONFIG_SMP
748 max_cache_size = max(max_cache_size, cache_size);
749#endif
737 if (max > ia64_max_cacheline_size) 750 if (max > ia64_max_cacheline_size)
738 ia64_max_cacheline_size = max; 751 ia64_max_cacheline_size = max;
739} 752}
@@ -788,7 +801,7 @@ cpu_init (void)
788#endif 801#endif
789 802
790 /* Clear the stack memory reserved for pt_regs: */ 803 /* Clear the stack memory reserved for pt_regs: */
791 memset(ia64_task_regs(current), 0, sizeof(struct pt_regs)); 804 memset(task_pt_regs(current), 0, sizeof(struct pt_regs));
792 805
793 ia64_set_kr(IA64_KR_FPU_OWNER, 0); 806 ia64_set_kr(IA64_KR_FPU_OWNER, 0);
794 807
@@ -864,6 +877,15 @@ cpu_init (void)
864 pm_idle = default_idle; 877 pm_idle = default_idle;
865} 878}
866 879
880/*
881 * On SMP systems, when the scheduler does migration-cost autodetection,
882 * it needs a way to flush as much of the CPU's caches as possible.
883 */
884void sched_cacheflush(void)
885{
886 ia64_sal_cache_flush(3);
887}
888
867void 889void
868check_bugs (void) 890check_bugs (void)
869{ 891{
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index 58ce07efc56e..463f6bb44d07 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -655,11 +655,11 @@ set_sigdelayed(pid_t pid, int signo, int code, void __user *addr)
655 655
656 if (!t) 656 if (!t)
657 return; 657 return;
658 t->thread_info->sigdelayed.signo = signo; 658 task_thread_info(t)->sigdelayed.signo = signo;
659 t->thread_info->sigdelayed.code = code; 659 task_thread_info(t)->sigdelayed.code = code;
660 t->thread_info->sigdelayed.addr = addr; 660 task_thread_info(t)->sigdelayed.addr = addr;
661 t->thread_info->sigdelayed.start_time = start_time; 661 task_thread_info(t)->sigdelayed.start_time = start_time;
662 t->thread_info->sigdelayed.pid = pid; 662 task_thread_info(t)->sigdelayed.pid = pid;
663 wmb(); 663 wmb();
664 set_tsk_thread_flag(t, TIF_SIGDELAYED); 664 set_tsk_thread_flag(t, TIF_SIGDELAYED);
665 } 665 }
diff --git a/arch/ia64/kernel/sys_ia64.c b/arch/ia64/kernel/sys_ia64.c
index f2dbcd1db0d4..c7b943f10199 100644
--- a/arch/ia64/kernel/sys_ia64.c
+++ b/arch/ia64/kernel/sys_ia64.c
@@ -151,7 +151,7 @@ out:
151asmlinkage long 151asmlinkage long
152sys_pipe (void) 152sys_pipe (void)
153{ 153{
154 struct pt_regs *regs = ia64_task_regs(current); 154 struct pt_regs *regs = task_pt_regs(current);
155 int fd[2]; 155 int fd[2];
156 int retval; 156 int retval;
157 157
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 5b7e736f3b49..028a2b95936c 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -249,3 +249,32 @@ time_init (void)
249 */ 249 */
250 set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec); 250 set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
251} 251}
252
253#define SMALLUSECS 100
254
255void
256udelay (unsigned long usecs)
257{
258 unsigned long start;
259 unsigned long cycles;
260 unsigned long smallusecs;
261
262 /*
263 * Execute the non-preemptible delay loop (because the ITC might
264 * not be synchronized between CPUS) in relatively short time
265 * chunks, allowing preemption between the chunks.
266 */
267 while (usecs > 0) {
268 smallusecs = (usecs > SMALLUSECS) ? SMALLUSECS : usecs;
269 preempt_disable();
270 cycles = smallusecs*local_cpu_data->cyc_per_usec;
271 start = ia64_get_itc();
272
273 while (ia64_get_itc() - start < cycles)
274 cpu_relax();
275
276 preempt_enable();
277 usecs -= smallusecs;
278 }
279}
280EXPORT_SYMBOL(udelay);
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index d3e0ecb56d62..55391901b013 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -530,12 +530,15 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
530 if (fsys_mode(current, &regs)) { 530 if (fsys_mode(current, &regs)) {
531 extern char __kernel_syscall_via_break[]; 531 extern char __kernel_syscall_via_break[];
532 /* 532 /*
533 * Got a trap in fsys-mode: Taken Branch Trap and Single Step trap 533 * Got a trap in fsys-mode: Taken Branch Trap
534 * need special handling; Debug trap is not supposed to happen. 534 * and Single Step trap need special handling;
535 * Debug trap is ignored (we disable it here
536 * and re-enable it in the lower-privilege trap).
535 */ 537 */
536 if (unlikely(vector == 29)) { 538 if (unlikely(vector == 29)) {
537 die("Got debug trap in fsys-mode---not supposed to happen!", 539 set_thread_flag(TIF_DB_DISABLED);
538 &regs, 0); 540 ia64_psr(&regs)->db = 0;
541 ia64_psr(&regs)->lp = 1;
539 return; 542 return;
540 } 543 }
541 /* re-do the system call via break 0x100000: */ 544 /* re-do the system call via break 0x100000: */
@@ -589,10 +592,19 @@ ia64_fault (unsigned long vector, unsigned long isr, unsigned long ifa,
589 case 34: 592 case 34:
590 if (isr & 0x2) { 593 if (isr & 0x2) {
591 /* Lower-Privilege Transfer Trap */ 594 /* Lower-Privilege Transfer Trap */
595
596 /* If we disabled debug traps during an fsyscall,
597 * re-enable them here.
598 */
599 if (test_thread_flag(TIF_DB_DISABLED)) {
600 clear_thread_flag(TIF_DB_DISABLED);
601 ia64_psr(&regs)->db = 1;
602 }
603
592 /* 604 /*
593 * Just clear PSR.lp and then return immediately: all the 605 * Just clear PSR.lp and then return immediately:
594 * interesting work (e.g., signal delivery is done in the kernel 606 * all the interesting work (e.g., signal delivery)
595 * exit path). 607 * is done in the kernel exit path.
596 */ 608 */
597 ia64_psr(&regs)->lp = 0; 609 ia64_psr(&regs)->lp = 0;
598 return; 610 return;
diff --git a/arch/ia64/kernel/uncached.c b/arch/ia64/kernel/uncached.c
index c6d40446c2c4..fcd2bad0286f 100644
--- a/arch/ia64/kernel/uncached.c
+++ b/arch/ia64/kernel/uncached.c
@@ -53,7 +53,7 @@ static void uncached_ipi_visibility(void *data)
53 if ((status != PAL_VISIBILITY_OK) && 53 if ((status != PAL_VISIBILITY_OK) &&
54 (status != PAL_VISIBILITY_OK_REMOTE_NEEDED)) 54 (status != PAL_VISIBILITY_OK_REMOTE_NEEDED))
55 printk(KERN_DEBUG "pal_prefetch_visibility() returns %i on " 55 printk(KERN_DEBUG "pal_prefetch_visibility() returns %i on "
56 "CPU %i\n", status, get_cpu()); 56 "CPU %i\n", status, raw_smp_processor_id());
57} 57}
58 58
59 59
@@ -63,7 +63,7 @@ static void uncached_ipi_mc_drain(void *data)
63 status = ia64_pal_mc_drain(); 63 status = ia64_pal_mc_drain();
64 if (status) 64 if (status)
65 printk(KERN_WARNING "ia64_pal_mc_drain() failed with %i on " 65 printk(KERN_WARNING "ia64_pal_mc_drain() failed with %i on "
66 "CPU %i\n", status, get_cpu()); 66 "CPU %i\n", status, raw_smp_processor_id());
67} 67}
68 68
69 69
@@ -105,7 +105,7 @@ uncached_get_new_chunk(struct gen_pool *poolp)
105 status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL); 105 status = ia64_pal_prefetch_visibility(PAL_VISIBILITY_PHYSICAL);
106 106
107 dprintk(KERN_INFO "pal_prefetch_visibility() returns %i on cpu %i\n", 107 dprintk(KERN_INFO "pal_prefetch_visibility() returns %i on cpu %i\n",
108 status, get_cpu()); 108 status, raw_smp_processor_id());
109 109
110 if (!status) { 110 if (!status) {
111 status = smp_call_function(uncached_ipi_visibility, NULL, 0, 1); 111 status = smp_call_function(uncached_ipi_visibility, NULL, 0, 1);
@@ -210,6 +210,7 @@ uncached_build_memmap(unsigned long start, unsigned long end, void *arg)
210 210
211 dprintk(KERN_ERR "uncached_build_memmap(%lx %lx)\n", start, end); 211 dprintk(KERN_ERR "uncached_build_memmap(%lx %lx)\n", start, end);
212 212
213 touch_softlockup_watchdog();
213 memset((char *)start, 0, length); 214 memset((char *)start, 0, length);
214 215
215 node = paddr_to_nid(start - __IA64_UNCACHED_OFFSET); 216 node = paddr_to_nid(start - __IA64_UNCACHED_OFFSET);
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index 30d8564e9603..73af6267d2ef 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -177,6 +177,9 @@ SECTIONS
177 } 177 }
178 . = ALIGN(PAGE_SIZE); /* make sure the gate page doesn't expose kernel data */ 178 . = ALIGN(PAGE_SIZE); /* make sure the gate page doesn't expose kernel data */
179 179
180 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET)
181 { *(.data.read_mostly) }
182
180 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) 183 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET)
181 { *(.data.cacheline_aligned) } 184 { *(.data.cacheline_aligned) }
182 185
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 0f776b032d31..c87d6d1d5813 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -50,8 +50,10 @@ static nodemask_t memory_less_mask __initdata;
50 * To prevent cache aliasing effects, align per-node structures so that they 50 * To prevent cache aliasing effects, align per-node structures so that they
51 * start at addresses that are strided by node number. 51 * start at addresses that are strided by node number.
52 */ 52 */
53#define MAX_NODE_ALIGN_OFFSET (32 * 1024 * 1024)
53#define NODEDATA_ALIGN(addr, node) \ 54#define NODEDATA_ALIGN(addr, node) \
54 ((((addr) + 1024*1024-1) & ~(1024*1024-1)) + (node)*PERCPU_PAGE_SIZE) 55 ((((addr) + 1024*1024-1) & ~(1024*1024-1)) + \
56 (((node)*PERCPU_PAGE_SIZE) & (MAX_NODE_ALIGN_OFFSET - 1)))
55 57
56/** 58/**
57 * build_node_maps - callback to setup bootmem structs for each node 59 * build_node_maps - callback to setup bootmem structs for each node
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index e3215ba64ffd..b38b6d213c15 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -635,3 +635,39 @@ mem_init (void)
635 ia32_mem_init(); 635 ia32_mem_init();
636#endif 636#endif
637} 637}
638
639#ifdef CONFIG_MEMORY_HOTPLUG
640void online_page(struct page *page)
641{
642 ClearPageReserved(page);
643 set_page_count(page, 1);
644 __free_page(page);
645 totalram_pages++;
646 num_physpages++;
647}
648
649int add_memory(u64 start, u64 size)
650{
651 pg_data_t *pgdat;
652 struct zone *zone;
653 unsigned long start_pfn = start >> PAGE_SHIFT;
654 unsigned long nr_pages = size >> PAGE_SHIFT;
655 int ret;
656
657 pgdat = NODE_DATA(0);
658
659 zone = pgdat->node_zones + ZONE_NORMAL;
660 ret = __add_pages(zone, start_pfn, nr_pages);
661
662 if (ret)
663 printk("%s: Problem encountered in __add_pages() as ret=%d\n",
664 __FUNCTION__, ret);
665
666 return ret;
667}
668
669int remove_memory(u64 start, u64 size)
670{
671 return -EINVAL;
672}
673#endif
diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index 41105d454423..6a4eec9113e8 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -90,7 +90,7 @@ ia64_global_tlb_purge (struct mm_struct *mm, unsigned long start,
90{ 90{
91 static DEFINE_SPINLOCK(ptcg_lock); 91 static DEFINE_SPINLOCK(ptcg_lock);
92 92
93 if (mm != current->active_mm) { 93 if (mm != current->active_mm || !current->mm) {
94 flush_tlb_all(); 94 flush_tlb_all();
95 return; 95 return;
96 } 96 }
diff --git a/arch/ia64/oprofile/backtrace.c b/arch/ia64/oprofile/backtrace.c
index b7dabbfb0d61..adb01566bd57 100644
--- a/arch/ia64/oprofile/backtrace.c
+++ b/arch/ia64/oprofile/backtrace.c
@@ -32,7 +32,7 @@ typedef struct
32 u64 *prev_pfs_loc; /* state for WAR for old spinlock ool code */ 32 u64 *prev_pfs_loc; /* state for WAR for old spinlock ool code */
33} ia64_backtrace_t; 33} ia64_backtrace_t;
34 34
35#if __GNUC__ < 3 || (__GNUC__ == 3 && __GNUC_MINOR__ < 3) 35#if (__GNUC__ == 3 && __GNUC_MINOR__ < 3)
36/* 36/*
37 * Returns non-zero if the PC is in the spinlock contention out-of-line code 37 * Returns non-zero if the PC is in the spinlock contention out-of-line code
38 * with non-standard calling sequence (on older compilers). 38 * with non-standard calling sequence (on older compilers).
diff --git a/arch/ia64/pci/pci.c b/arch/ia64/pci/pci.c
index 20d76fae24e8..0b30ca006286 100644
--- a/arch/ia64/pci/pci.c
+++ b/arch/ia64/pci/pci.c
@@ -193,12 +193,12 @@ add_io_space (struct pci_root_info *info, struct acpi_resource_address64 *addr)
193 goto free_resource; 193 goto free_resource;
194 } 194 }
195 195
196 min = addr->min_address_range; 196 min = addr->minimum;
197 max = min + addr->address_length - 1; 197 max = min + addr->address_length - 1;
198 if (addr->attribute.io.translation_attribute == ACPI_SPARSE_TRANSLATION) 198 if (addr->info.io.translation_type == ACPI_SPARSE_TRANSLATION)
199 sparse = 1; 199 sparse = 1;
200 200
201 space_nr = new_space(addr->address_translation_offset, sparse); 201 space_nr = new_space(addr->translation_offset, sparse);
202 if (space_nr == ~0) 202 if (space_nr == ~0)
203 goto free_name; 203 goto free_name;
204 204
@@ -285,7 +285,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
285 if (addr.resource_type == ACPI_MEMORY_RANGE) { 285 if (addr.resource_type == ACPI_MEMORY_RANGE) {
286 flags = IORESOURCE_MEM; 286 flags = IORESOURCE_MEM;
287 root = &iomem_resource; 287 root = &iomem_resource;
288 offset = addr.address_translation_offset; 288 offset = addr.translation_offset;
289 } else if (addr.resource_type == ACPI_IO_RANGE) { 289 } else if (addr.resource_type == ACPI_IO_RANGE) {
290 flags = IORESOURCE_IO; 290 flags = IORESOURCE_IO;
291 root = &ioport_resource; 291 root = &ioport_resource;
@@ -298,7 +298,7 @@ static __devinit acpi_status add_window(struct acpi_resource *res, void *data)
298 window = &info->controller->window[info->controller->windows++]; 298 window = &info->controller->window[info->controller->windows++];
299 window->resource.name = info->name; 299 window->resource.name = info->name;
300 window->resource.flags = flags; 300 window->resource.flags = flags;
301 window->resource.start = addr.min_address_range + offset; 301 window->resource.start = addr.minimum + offset;
302 window->resource.end = window->resource.start + addr.address_length - 1; 302 window->resource.end = window->resource.start + addr.address_length - 1;
303 window->resource.child = NULL; 303 window->resource.child = NULL;
304 window->offset = offset; 304 window->offset = offset;
@@ -454,14 +454,13 @@ static int __devinit is_valid_resource(struct pci_dev *dev, int idx)
454 return 0; 454 return 0;
455} 455}
456 456
457static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) 457static void __devinit
458pcibios_fixup_resources(struct pci_dev *dev, int start, int limit)
458{ 459{
459 struct pci_bus_region region; 460 struct pci_bus_region region;
460 int i; 461 int i;
461 int limit = (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) ? \
462 PCI_BRIDGE_RESOURCES : PCI_NUM_RESOURCES;
463 462
464 for (i = 0; i < limit; i++) { 463 for (i = start; i < limit; i++) {
465 if (!dev->resource[i].flags) 464 if (!dev->resource[i].flags)
466 continue; 465 continue;
467 region.start = dev->resource[i].start; 466 region.start = dev->resource[i].start;
@@ -472,6 +471,16 @@ static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
472 } 471 }
473} 472}
474 473
474static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
475{
476 pcibios_fixup_resources(dev, 0, PCI_BRIDGE_RESOURCES);
477}
478
479static void __devinit pcibios_fixup_bridge_resources(struct pci_dev *dev)
480{
481 pcibios_fixup_resources(dev, PCI_BRIDGE_RESOURCES, PCI_NUM_RESOURCES);
482}
483
475/* 484/*
476 * Called after each bus is probed, but before its children are examined. 485 * Called after each bus is probed, but before its children are examined.
477 */ 486 */
@@ -482,7 +491,7 @@ pcibios_fixup_bus (struct pci_bus *b)
482 491
483 if (b->self) { 492 if (b->self) {
484 pci_read_bridge_bases(b); 493 pci_read_bridge_bases(b);
485 pcibios_fixup_device_resources(b->self); 494 pcibios_fixup_bridge_resources(b->self);
486 } 495 }
487 list_for_each_entry(dev, &b->devices, bus_list) 496 list_for_each_entry(dev, &b->devices, bus_list)
488 pcibios_fixup_device_resources(dev); 497 pcibios_fixup_device_resources(dev);
@@ -700,7 +709,7 @@ int ia64_pci_legacy_read(struct pci_bus *bus, u16 port, u32 *val, u8 size)
700 */ 709 */
701int ia64_pci_legacy_write(struct pci_dev *bus, u16 port, u32 val, u8 size) 710int ia64_pci_legacy_write(struct pci_dev *bus, u16 port, u32 val, u8 size)
702{ 711{
703 int ret = 0; 712 int ret = size;
704 713
705 switch (size) { 714 switch (size) {
706 case 1: 715 case 1:
diff --git a/arch/ia64/sn/include/xtalk/hubdev.h b/arch/ia64/sn/include/xtalk/hubdev.h
index 71c2b271b4c6..8182583c762c 100644
--- a/arch/ia64/sn/include/xtalk/hubdev.h
+++ b/arch/ia64/sn/include/xtalk/hubdev.h
@@ -26,29 +26,46 @@
26#define IIO_NUM_ITTES 7 26#define IIO_NUM_ITTES 7
27#define HUB_NUM_BIG_WINDOW (IIO_NUM_ITTES - 1) 27#define HUB_NUM_BIG_WINDOW (IIO_NUM_ITTES - 1)
28 28
29struct sn_flush_device_list { 29/* This struct is shared between the PROM and the kernel.
30 * Changes to this struct will require corresponding changes to the kernel.
31 */
32struct sn_flush_device_common {
30 int sfdl_bus; 33 int sfdl_bus;
31 int sfdl_slot; 34 int sfdl_slot;
32 int sfdl_pin; 35 int sfdl_pin;
33 struct bar_list { 36 struct common_bar_list {
34 unsigned long start; 37 unsigned long start;
35 unsigned long end; 38 unsigned long end;
36 } sfdl_bar_list[6]; 39 } sfdl_bar_list[6];
37 unsigned long sfdl_force_int_addr; 40 unsigned long sfdl_force_int_addr;
38 unsigned long sfdl_flush_value; 41 unsigned long sfdl_flush_value;
39 volatile unsigned long *sfdl_flush_addr; 42 volatile unsigned long *sfdl_flush_addr;
40 uint32_t sfdl_persistent_busnum; 43 u32 sfdl_persistent_busnum;
41 uint32_t sfdl_persistent_segment; 44 u32 sfdl_persistent_segment;
42 struct pcibus_info *sfdl_pcibus_info; 45 struct pcibus_info *sfdl_pcibus_info;
46};
47
48/* This struct is kernel only and is not used by the PROM */
49struct sn_flush_device_kernel {
43 spinlock_t sfdl_flush_lock; 50 spinlock_t sfdl_flush_lock;
51 struct sn_flush_device_common *common;
52};
53
54/* 01/16/06 This struct is the old PROM/kernel struct and needs to be included
55 * for older official PROMs to function on the new kernel base. This struct
56 * will be removed when the next official PROM release occurs. */
57
58struct sn_flush_device_war {
59 struct sn_flush_device_common common;
60 u32 filler; /* older PROMs expect the default size of a spinlock_t */
44}; 61};
45 62
46/* 63/*
47 * **widget_p - Used as an array[wid_num][device] of sn_flush_device_list. 64 * **widget_p - Used as an array[wid_num][device] of sn_flush_device_kernel.
48 */ 65 */
49struct sn_flush_nasid_entry { 66struct sn_flush_nasid_entry {
50 struct sn_flush_device_list **widget_p; /* Used as a array of wid_num */ 67 struct sn_flush_device_kernel **widget_p; // Used as an array of wid_num
51 uint64_t iio_itte[8]; 68 u64 iio_itte[8];
52}; 69};
53 70
54struct hubdev_info { 71struct hubdev_info {
@@ -62,8 +79,8 @@ struct hubdev_info {
62 79
63 void *hdi_nodepda; 80 void *hdi_nodepda;
64 void *hdi_node_vertex; 81 void *hdi_node_vertex;
65 uint32_t max_segment_number; 82 u32 max_segment_number;
66 uint32_t max_pcibus_number; 83 u32 max_pcibus_number;
67}; 84};
68 85
69extern void hubdev_init_node(nodepda_t *, cnodeid_t); 86extern void hubdev_init_node(nodepda_t *, cnodeid_t);
diff --git a/arch/ia64/sn/include/xtalk/xbow.h b/arch/ia64/sn/include/xtalk/xbow.h
index ec56b3432f17..90f37a4133d0 100644
--- a/arch/ia64/sn/include/xtalk/xbow.h
+++ b/arch/ia64/sn/include/xtalk/xbow.h
@@ -3,7 +3,8 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1992-1997,2000-2004 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (C) 1992-1997,2000-2006 Silicon Graphics, Inc. All Rights
7 * Reserved.
7 */ 8 */
8#ifndef _ASM_IA64_SN_XTALK_XBOW_H 9#ifndef _ASM_IA64_SN_XTALK_XBOW_H
9#define _ASM_IA64_SN_XTALK_XBOW_H 10#define _ASM_IA64_SN_XTALK_XBOW_H
@@ -21,94 +22,94 @@
21 22
22/* Register set for each xbow link */ 23/* Register set for each xbow link */
23typedef volatile struct xb_linkregs_s { 24typedef volatile struct xb_linkregs_s {
24/* 25/*
25 * we access these through synergy unswizzled space, so the address 26 * we access these through synergy unswizzled space, so the address
26 * gets twiddled (i.e. references to 0x4 actually go to 0x0 and vv.) 27 * gets twiddled (i.e. references to 0x4 actually go to 0x0 and vv.)
27 * That's why we put the register first and filler second. 28 * That's why we put the register first and filler second.
28 */ 29 */
29 uint32_t link_ibf; 30 u32 link_ibf;
30 uint32_t filler0; /* filler for proper alignment */ 31 u32 filler0; /* filler for proper alignment */
31 uint32_t link_control; 32 u32 link_control;
32 uint32_t filler1; 33 u32 filler1;
33 uint32_t link_status; 34 u32 link_status;
34 uint32_t filler2; 35 u32 filler2;
35 uint32_t link_arb_upper; 36 u32 link_arb_upper;
36 uint32_t filler3; 37 u32 filler3;
37 uint32_t link_arb_lower; 38 u32 link_arb_lower;
38 uint32_t filler4; 39 u32 filler4;
39 uint32_t link_status_clr; 40 u32 link_status_clr;
40 uint32_t filler5; 41 u32 filler5;
41 uint32_t link_reset; 42 u32 link_reset;
42 uint32_t filler6; 43 u32 filler6;
43 uint32_t link_aux_status; 44 u32 link_aux_status;
44 uint32_t filler7; 45 u32 filler7;
45} xb_linkregs_t; 46} xb_linkregs_t;
46 47
47typedef volatile struct xbow_s { 48typedef volatile struct xbow_s {
48 /* standard widget configuration 0x000000-0x000057 */ 49 /* standard widget configuration 0x000000-0x000057 */
49 struct widget_cfg xb_widget; /* 0x000000 */ 50 struct widget_cfg xb_widget; /* 0x000000 */
50 51
51 /* helper fieldnames for accessing bridge widget */ 52 /* helper fieldnames for accessing bridge widget */
52 53
53#define xb_wid_id xb_widget.w_id 54#define xb_wid_id xb_widget.w_id
54#define xb_wid_stat xb_widget.w_status 55#define xb_wid_stat xb_widget.w_status
55#define xb_wid_err_upper xb_widget.w_err_upper_addr 56#define xb_wid_err_upper xb_widget.w_err_upper_addr
56#define xb_wid_err_lower xb_widget.w_err_lower_addr 57#define xb_wid_err_lower xb_widget.w_err_lower_addr
57#define xb_wid_control xb_widget.w_control 58#define xb_wid_control xb_widget.w_control
58#define xb_wid_req_timeout xb_widget.w_req_timeout 59#define xb_wid_req_timeout xb_widget.w_req_timeout
59#define xb_wid_int_upper xb_widget.w_intdest_upper_addr 60#define xb_wid_int_upper xb_widget.w_intdest_upper_addr
60#define xb_wid_int_lower xb_widget.w_intdest_lower_addr 61#define xb_wid_int_lower xb_widget.w_intdest_lower_addr
61#define xb_wid_err_cmdword xb_widget.w_err_cmd_word 62#define xb_wid_err_cmdword xb_widget.w_err_cmd_word
62#define xb_wid_llp xb_widget.w_llp_cfg 63#define xb_wid_llp xb_widget.w_llp_cfg
63#define xb_wid_stat_clr xb_widget.w_tflush 64#define xb_wid_stat_clr xb_widget.w_tflush
64 65
65/* 66/*
66 * we access these through synergy unswizzled space, so the address 67 * we access these through synergy unswizzled space, so the address
67 * gets twiddled (i.e. references to 0x4 actually go to 0x0 and vv.) 68 * gets twiddled (i.e. references to 0x4 actually go to 0x0 and vv.)
68 * That's why we put the register first and filler second. 69 * That's why we put the register first and filler second.
69 */ 70 */
70 /* xbow-specific widget configuration 0x000058-0x0000FF */ 71 /* xbow-specific widget configuration 0x000058-0x0000FF */
71 uint32_t xb_wid_arb_reload; /* 0x00005C */ 72 u32 xb_wid_arb_reload; /* 0x00005C */
72 uint32_t _pad_000058; 73 u32 _pad_000058;
73 uint32_t xb_perf_ctr_a; /* 0x000064 */ 74 u32 xb_perf_ctr_a; /* 0x000064 */
74 uint32_t _pad_000060; 75 u32 _pad_000060;
75 uint32_t xb_perf_ctr_b; /* 0x00006c */ 76 u32 xb_perf_ctr_b; /* 0x00006c */
76 uint32_t _pad_000068; 77 u32 _pad_000068;
77 uint32_t xb_nic; /* 0x000074 */ 78 u32 xb_nic; /* 0x000074 */
78 uint32_t _pad_000070; 79 u32 _pad_000070;
79 80
80 /* Xbridge only */ 81 /* Xbridge only */
81 uint32_t xb_w0_rst_fnc; /* 0x00007C */ 82 u32 xb_w0_rst_fnc; /* 0x00007C */
82 uint32_t _pad_000078; 83 u32 _pad_000078;
83 uint32_t xb_l8_rst_fnc; /* 0x000084 */ 84 u32 xb_l8_rst_fnc; /* 0x000084 */
84 uint32_t _pad_000080; 85 u32 _pad_000080;
85 uint32_t xb_l9_rst_fnc; /* 0x00008c */ 86 u32 xb_l9_rst_fnc; /* 0x00008c */
86 uint32_t _pad_000088; 87 u32 _pad_000088;
87 uint32_t xb_la_rst_fnc; /* 0x000094 */ 88 u32 xb_la_rst_fnc; /* 0x000094 */
88 uint32_t _pad_000090; 89 u32 _pad_000090;
89 uint32_t xb_lb_rst_fnc; /* 0x00009c */ 90 u32 xb_lb_rst_fnc; /* 0x00009c */
90 uint32_t _pad_000098; 91 u32 _pad_000098;
91 uint32_t xb_lc_rst_fnc; /* 0x0000a4 */ 92 u32 xb_lc_rst_fnc; /* 0x0000a4 */
92 uint32_t _pad_0000a0; 93 u32 _pad_0000a0;
93 uint32_t xb_ld_rst_fnc; /* 0x0000ac */ 94 u32 xb_ld_rst_fnc; /* 0x0000ac */
94 uint32_t _pad_0000a8; 95 u32 _pad_0000a8;
95 uint32_t xb_le_rst_fnc; /* 0x0000b4 */ 96 u32 xb_le_rst_fnc; /* 0x0000b4 */
96 uint32_t _pad_0000b0; 97 u32 _pad_0000b0;
97 uint32_t xb_lf_rst_fnc; /* 0x0000bc */ 98 u32 xb_lf_rst_fnc; /* 0x0000bc */
98 uint32_t _pad_0000b8; 99 u32 _pad_0000b8;
99 uint32_t xb_lock; /* 0x0000c4 */ 100 u32 xb_lock; /* 0x0000c4 */
100 uint32_t _pad_0000c0; 101 u32 _pad_0000c0;
101 uint32_t xb_lock_clr; /* 0x0000cc */ 102 u32 xb_lock_clr; /* 0x0000cc */
102 uint32_t _pad_0000c8; 103 u32 _pad_0000c8;
103 /* end of Xbridge only */ 104 /* end of Xbridge only */
104 uint32_t _pad_0000d0[12]; 105 u32 _pad_0000d0[12];
105 106
106 /* Link Specific Registers, port 8..15 0x000100-0x000300 */ 107 /* Link Specific Registers, port 8..15 0x000100-0x000300 */
107 xb_linkregs_t xb_link_raw[MAX_XBOW_PORTS]; 108 xb_linkregs_t xb_link_raw[MAX_XBOW_PORTS];
108#define xb_link(p) xb_link_raw[(p) & (MAX_XBOW_PORTS - 1)]
109
110} xbow_t; 109} xbow_t;
111 110
111#define xb_link(p) xb_link_raw[(p) & (MAX_XBOW_PORTS - 1)]
112
112#define XB_FLAGS_EXISTS 0x1 /* device exists */ 113#define XB_FLAGS_EXISTS 0x1 /* device exists */
113#define XB_FLAGS_MASTER 0x2 114#define XB_FLAGS_MASTER 0x2
114#define XB_FLAGS_SLAVE 0x0 115#define XB_FLAGS_SLAVE 0x0
@@ -160,7 +161,7 @@ typedef volatile struct xbow_s {
160/* End of Xbridge only */ 161/* End of Xbridge only */
161 162
162/* used only in ide, but defined here within the reserved portion */ 163/* used only in ide, but defined here within the reserved portion */
163/* of the widget0 address space (before 0xf4) */ 164/* of the widget0 address space (before 0xf4) */
164#define XBOW_WID_UNDEF 0xe4 165#define XBOW_WID_UNDEF 0xe4
165 166
166/* xbow link register set base, legal value for x is 0x8..0xf */ 167/* xbow link register set base, legal value for x is 0x8..0xf */
@@ -179,29 +180,37 @@ typedef volatile struct xbow_s {
179 180
180/* link_control(x) */ 181/* link_control(x) */
181#define XB_CTRL_LINKALIVE_IE 0x80000000 /* link comes alive */ 182#define XB_CTRL_LINKALIVE_IE 0x80000000 /* link comes alive */
182 /* reserved: 0x40000000 */ 183/* reserved: 0x40000000 */
183#define XB_CTRL_PERF_CTR_MODE_MSK 0x30000000 /* perf counter mode */ 184#define XB_CTRL_PERF_CTR_MODE_MSK 0x30000000 /* perf counter mode */
184#define XB_CTRL_IBUF_LEVEL_MSK 0x0e000000 /* input packet buffer level */ 185#define XB_CTRL_IBUF_LEVEL_MSK 0x0e000000 /* input packet buffer
185#define XB_CTRL_8BIT_MODE 0x01000000 /* force link into 8 bit mode */ 186 level */
186#define XB_CTRL_BAD_LLP_PKT 0x00800000 /* force bad LLP packet */ 187#define XB_CTRL_8BIT_MODE 0x01000000 /* force link into 8
187#define XB_CTRL_WIDGET_CR_MSK 0x007c0000 /* LLP widget credit mask */ 188 bit mode */
188#define XB_CTRL_WIDGET_CR_SHFT 18 /* LLP widget credit shift */ 189#define XB_CTRL_BAD_LLP_PKT 0x00800000 /* force bad LLP
189#define XB_CTRL_ILLEGAL_DST_IE 0x00020000 /* illegal destination */ 190 packet */
190#define XB_CTRL_OALLOC_IBUF_IE 0x00010000 /* overallocated input buffer */ 191#define XB_CTRL_WIDGET_CR_MSK 0x007c0000 /* LLP widget credit
191 /* reserved: 0x0000fe00 */ 192 mask */
193#define XB_CTRL_WIDGET_CR_SHFT 18 /* LLP widget credit
194 shift */
195#define XB_CTRL_ILLEGAL_DST_IE 0x00020000 /* illegal destination
196 */
197#define XB_CTRL_OALLOC_IBUF_IE 0x00010000 /* overallocated input
198 buffer */
199/* reserved: 0x0000fe00 */
192#define XB_CTRL_BNDWDTH_ALLOC_IE 0x00000100 /* bandwidth alloc */ 200#define XB_CTRL_BNDWDTH_ALLOC_IE 0x00000100 /* bandwidth alloc */
193#define XB_CTRL_RCV_CNT_OFLOW_IE 0x00000080 /* rcv retry overflow */ 201#define XB_CTRL_RCV_CNT_OFLOW_IE 0x00000080 /* rcv retry overflow */
194#define XB_CTRL_XMT_CNT_OFLOW_IE 0x00000040 /* xmt retry overflow */ 202#define XB_CTRL_XMT_CNT_OFLOW_IE 0x00000040 /* xmt retry overflow */
195#define XB_CTRL_XMT_MAX_RTRY_IE 0x00000020 /* max transmit retry */ 203#define XB_CTRL_XMT_MAX_RTRY_IE 0x00000020 /* max transmit retry */
196#define XB_CTRL_RCV_IE 0x00000010 /* receive */ 204#define XB_CTRL_RCV_IE 0x00000010 /* receive */
197#define XB_CTRL_XMT_RTRY_IE 0x00000008 /* transmit retry */ 205#define XB_CTRL_XMT_RTRY_IE 0x00000008 /* transmit retry */
198 /* reserved: 0x00000004 */ 206/* reserved: 0x00000004 */
199#define XB_CTRL_MAXREQ_TOUT_IE 0x00000002 /* maximum request timeout */ 207#define XB_CTRL_MAXREQ_TOUT_IE 0x00000002 /* maximum request
208 timeout */
200#define XB_CTRL_SRC_TOUT_IE 0x00000001 /* source timeout */ 209#define XB_CTRL_SRC_TOUT_IE 0x00000001 /* source timeout */
201 210
202/* link_status(x) */ 211/* link_status(x) */
203#define XB_STAT_LINKALIVE XB_CTRL_LINKALIVE_IE 212#define XB_STAT_LINKALIVE XB_CTRL_LINKALIVE_IE
204 /* reserved: 0x7ff80000 */ 213/* reserved: 0x7ff80000 */
205#define XB_STAT_MULTI_ERR 0x00040000 /* multi error */ 214#define XB_STAT_MULTI_ERR 0x00040000 /* multi error */
206#define XB_STAT_ILLEGAL_DST_ERR XB_CTRL_ILLEGAL_DST_IE 215#define XB_STAT_ILLEGAL_DST_ERR XB_CTRL_ILLEGAL_DST_IE
207#define XB_STAT_OALLOC_IBUF_ERR XB_CTRL_OALLOC_IBUF_IE 216#define XB_STAT_OALLOC_IBUF_ERR XB_CTRL_OALLOC_IBUF_IE
@@ -211,7 +220,7 @@ typedef volatile struct xbow_s {
211#define XB_STAT_XMT_MAX_RTRY_ERR XB_CTRL_XMT_MAX_RTRY_IE 220#define XB_STAT_XMT_MAX_RTRY_ERR XB_CTRL_XMT_MAX_RTRY_IE
212#define XB_STAT_RCV_ERR XB_CTRL_RCV_IE 221#define XB_STAT_RCV_ERR XB_CTRL_RCV_IE
213#define XB_STAT_XMT_RTRY_ERR XB_CTRL_XMT_RTRY_IE 222#define XB_STAT_XMT_RTRY_ERR XB_CTRL_XMT_RTRY_IE
214 /* reserved: 0x00000004 */ 223/* reserved: 0x00000004 */
215#define XB_STAT_MAXREQ_TOUT_ERR XB_CTRL_MAXREQ_TOUT_IE 224#define XB_STAT_MAXREQ_TOUT_ERR XB_CTRL_MAXREQ_TOUT_IE
216#define XB_STAT_SRC_TOUT_ERR XB_CTRL_SRC_TOUT_IE 225#define XB_STAT_SRC_TOUT_ERR XB_CTRL_SRC_TOUT_IE
217 226
@@ -222,7 +231,7 @@ typedef volatile struct xbow_s {
222#define XB_AUX_LINKFAIL_RST_BAD 0x00000040 231#define XB_AUX_LINKFAIL_RST_BAD 0x00000040
223#define XB_AUX_STAT_PRESENT 0x00000020 232#define XB_AUX_STAT_PRESENT 0x00000020
224#define XB_AUX_STAT_PORT_WIDTH 0x00000010 233#define XB_AUX_STAT_PORT_WIDTH 0x00000010
225 /* reserved: 0x0000000f */ 234/* reserved: 0x0000000f */
226 235
227/* 236/*
228 * link_arb_upper/link_arb_lower(x), (reg) should be the link_arb_upper 237 * link_arb_upper/link_arb_lower(x), (reg) should be the link_arb_upper
@@ -238,7 +247,8 @@ typedef volatile struct xbow_s {
238/* XBOW_WID_STAT */ 247/* XBOW_WID_STAT */
239#define XB_WID_STAT_LINK_INTR_SHFT (24) 248#define XB_WID_STAT_LINK_INTR_SHFT (24)
240#define XB_WID_STAT_LINK_INTR_MASK (0xFF << XB_WID_STAT_LINK_INTR_SHFT) 249#define XB_WID_STAT_LINK_INTR_MASK (0xFF << XB_WID_STAT_LINK_INTR_SHFT)
241#define XB_WID_STAT_LINK_INTR(x) (0x1 << (((x)&7) + XB_WID_STAT_LINK_INTR_SHFT)) 250#define XB_WID_STAT_LINK_INTR(x) \
251 (0x1 << (((x)&7) + XB_WID_STAT_LINK_INTR_SHFT))
242#define XB_WID_STAT_WIDGET0_INTR 0x00800000 252#define XB_WID_STAT_WIDGET0_INTR 0x00800000
243#define XB_WID_STAT_SRCID_MASK 0x000003c0 /* Xbridge only */ 253#define XB_WID_STAT_SRCID_MASK 0x000003c0 /* Xbridge only */
244#define XB_WID_STAT_REG_ACC_ERR 0x00000020 254#define XB_WID_STAT_REG_ACC_ERR 0x00000020
@@ -264,7 +274,7 @@ typedef volatile struct xbow_s {
264#define XXBOW_WIDGET_PART_NUM 0xd000 /* Xbridge */ 274#define XXBOW_WIDGET_PART_NUM 0xd000 /* Xbridge */
265#define XBOW_WIDGET_MFGR_NUM 0x0 275#define XBOW_WIDGET_MFGR_NUM 0x0
266#define XXBOW_WIDGET_MFGR_NUM 0x0 276#define XXBOW_WIDGET_MFGR_NUM 0x0
267#define PXBOW_WIDGET_PART_NUM 0xd100 /* PIC */ 277#define PXBOW_WIDGET_PART_NUM 0xd100 /* PIC */
268 278
269#define XBOW_REV_1_0 0x1 /* xbow rev 1.0 is "1" */ 279#define XBOW_REV_1_0 0x1 /* xbow rev 1.0 is "1" */
270#define XBOW_REV_1_1 0x2 /* xbow rev 1.1 is "2" */ 280#define XBOW_REV_1_1 0x2 /* xbow rev 1.1 is "2" */
@@ -279,13 +289,13 @@ typedef volatile struct xbow_s {
279#define XBOW_WID_ARB_RELOAD_INT 0x3f /* GBR reload interval */ 289#define XBOW_WID_ARB_RELOAD_INT 0x3f /* GBR reload interval */
280 290
281#define IS_XBRIDGE_XBOW(wid) \ 291#define IS_XBRIDGE_XBOW(wid) \
282 (XWIDGET_PART_NUM(wid) == XXBOW_WIDGET_PART_NUM && \ 292 (XWIDGET_PART_NUM(wid) == XXBOW_WIDGET_PART_NUM && \
283 XWIDGET_MFG_NUM(wid) == XXBOW_WIDGET_MFGR_NUM) 293 XWIDGET_MFG_NUM(wid) == XXBOW_WIDGET_MFGR_NUM)
284 294
285#define IS_PIC_XBOW(wid) \ 295#define IS_PIC_XBOW(wid) \
286 (XWIDGET_PART_NUM(wid) == PXBOW_WIDGET_PART_NUM && \ 296 (XWIDGET_PART_NUM(wid) == PXBOW_WIDGET_PART_NUM && \
287 XWIDGET_MFG_NUM(wid) == XXBOW_WIDGET_MFGR_NUM) 297 XWIDGET_MFG_NUM(wid) == XXBOW_WIDGET_MFGR_NUM)
288 298
289#define XBOW_WAR_ENABLED(pv, widid) ((1 << XWIDGET_REV_NUM(widid)) & pv) 299#define XBOW_WAR_ENABLED(pv, widid) ((1 << XWIDGET_REV_NUM(widid)) & pv)
290 300
291#endif /* _ASM_IA64_SN_XTALK_XBOW_H */ 301#endif /* _ASM_IA64_SN_XTALK_XBOW_H */
diff --git a/arch/ia64/sn/include/xtalk/xwidgetdev.h b/arch/ia64/sn/include/xtalk/xwidgetdev.h
index c5f4bc5cc033..2800eda0fd68 100644
--- a/arch/ia64/sn/include/xtalk/xwidgetdev.h
+++ b/arch/ia64/sn/include/xtalk/xwidgetdev.h
@@ -25,28 +25,28 @@
25 25
26/* widget configuration registers */ 26/* widget configuration registers */
27struct widget_cfg{ 27struct widget_cfg{
28 uint32_t w_id; /* 0x04 */ 28 u32 w_id; /* 0x04 */
29 uint32_t w_pad_0; /* 0x00 */ 29 u32 w_pad_0; /* 0x00 */
30 uint32_t w_status; /* 0x0c */ 30 u32 w_status; /* 0x0c */
31 uint32_t w_pad_1; /* 0x08 */ 31 u32 w_pad_1; /* 0x08 */
32 uint32_t w_err_upper_addr; /* 0x14 */ 32 u32 w_err_upper_addr; /* 0x14 */
33 uint32_t w_pad_2; /* 0x10 */ 33 u32 w_pad_2; /* 0x10 */
34 uint32_t w_err_lower_addr; /* 0x1c */ 34 u32 w_err_lower_addr; /* 0x1c */
35 uint32_t w_pad_3; /* 0x18 */ 35 u32 w_pad_3; /* 0x18 */
36 uint32_t w_control; /* 0x24 */ 36 u32 w_control; /* 0x24 */
37 uint32_t w_pad_4; /* 0x20 */ 37 u32 w_pad_4; /* 0x20 */
38 uint32_t w_req_timeout; /* 0x2c */ 38 u32 w_req_timeout; /* 0x2c */
39 uint32_t w_pad_5; /* 0x28 */ 39 u32 w_pad_5; /* 0x28 */
40 uint32_t w_intdest_upper_addr; /* 0x34 */ 40 u32 w_intdest_upper_addr; /* 0x34 */
41 uint32_t w_pad_6; /* 0x30 */ 41 u32 w_pad_6; /* 0x30 */
42 uint32_t w_intdest_lower_addr; /* 0x3c */ 42 u32 w_intdest_lower_addr; /* 0x3c */
43 uint32_t w_pad_7; /* 0x38 */ 43 u32 w_pad_7; /* 0x38 */
44 uint32_t w_err_cmd_word; /* 0x44 */ 44 u32 w_err_cmd_word; /* 0x44 */
45 uint32_t w_pad_8; /* 0x40 */ 45 u32 w_pad_8; /* 0x40 */
46 uint32_t w_llp_cfg; /* 0x4c */ 46 u32 w_llp_cfg; /* 0x4c */
47 uint32_t w_pad_9; /* 0x48 */ 47 u32 w_pad_9; /* 0x48 */
48 uint32_t w_tflush; /* 0x54 */ 48 u32 w_tflush; /* 0x54 */
49 uint32_t w_pad_10; /* 0x50 */ 49 u32 w_pad_10; /* 0x50 */
50}; 50};
51 51
52/* 52/*
@@ -63,7 +63,7 @@ struct xwidget_info{
63 struct xwidget_hwid xwi_hwid; /* Widget Identification */ 63 struct xwidget_hwid xwi_hwid; /* Widget Identification */
64 char xwi_masterxid; /* Hub's Widget Port Number */ 64 char xwi_masterxid; /* Hub's Widget Port Number */
65 void *xwi_hubinfo; /* Hub's provider private info */ 65 void *xwi_hubinfo; /* Hub's provider private info */
66 uint64_t *xwi_hub_provider; /* prom provider functions */ 66 u64 *xwi_hub_provider; /* prom provider functions */
67 void *xwi_vertex; 67 void *xwi_vertex;
68}; 68};
69 69
diff --git a/arch/ia64/sn/kernel/bte_error.c b/arch/ia64/sn/kernel/bte_error.c
index fcbc748ae433..f1ec1370b3e3 100644
--- a/arch/ia64/sn/kernel/bte_error.c
+++ b/arch/ia64/sn/kernel/bte_error.c
@@ -33,7 +33,7 @@ void bte_error_handler(unsigned long);
33 * Wait until all BTE related CRBs are completed 33 * Wait until all BTE related CRBs are completed
34 * and then reset the interfaces. 34 * and then reset the interfaces.
35 */ 35 */
36void shub1_bte_error_handler(unsigned long _nodepda) 36int shub1_bte_error_handler(unsigned long _nodepda)
37{ 37{
38 struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda; 38 struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda;
39 struct timer_list *recovery_timer = &err_nodepda->bte_recovery_timer; 39 struct timer_list *recovery_timer = &err_nodepda->bte_recovery_timer;
@@ -53,7 +53,7 @@ void shub1_bte_error_handler(unsigned long _nodepda)
53 (err_nodepda->bte_if[1].bh_error == BTE_SUCCESS)) { 53 (err_nodepda->bte_if[1].bh_error == BTE_SUCCESS)) {
54 BTE_PRINTK(("eh:%p:%d Nothing to do.\n", err_nodepda, 54 BTE_PRINTK(("eh:%p:%d Nothing to do.\n", err_nodepda,
55 smp_processor_id())); 55 smp_processor_id()));
56 return; 56 return 1;
57 } 57 }
58 58
59 /* Determine information about our hub */ 59 /* Determine information about our hub */
@@ -81,7 +81,7 @@ void shub1_bte_error_handler(unsigned long _nodepda)
81 mod_timer(recovery_timer, HZ * 5); 81 mod_timer(recovery_timer, HZ * 5);
82 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda, 82 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda,
83 smp_processor_id())); 83 smp_processor_id()));
84 return; 84 return 1;
85 } 85 }
86 if (icmr.ii_icmr_fld_s.i_crb_vld != 0) { 86 if (icmr.ii_icmr_fld_s.i_crb_vld != 0) {
87 87
@@ -99,7 +99,7 @@ void shub1_bte_error_handler(unsigned long _nodepda)
99 BTE_PRINTK(("eh:%p:%d Valid %d, Giving up\n", 99 BTE_PRINTK(("eh:%p:%d Valid %d, Giving up\n",
100 err_nodepda, smp_processor_id(), 100 err_nodepda, smp_processor_id(),
101 i)); 101 i));
102 return; 102 return 1;
103 } 103 }
104 } 104 }
105 } 105 }
@@ -124,6 +124,42 @@ void shub1_bte_error_handler(unsigned long _nodepda)
124 REMOTE_HUB_S(nasid, IIO_IBCR, ibcr.ii_ibcr_regval); 124 REMOTE_HUB_S(nasid, IIO_IBCR, ibcr.ii_ibcr_regval);
125 125
126 del_timer(recovery_timer); 126 del_timer(recovery_timer);
127 return 0;
128}
129
130/*
131 * Wait until all BTE related CRBs are completed
132 * and then reset the interfaces.
133 */
134int shub2_bte_error_handler(unsigned long _nodepda)
135{
136 struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda;
137 struct timer_list *recovery_timer = &err_nodepda->bte_recovery_timer;
138 struct bteinfo_s *bte;
139 nasid_t nasid;
140 u64 status;
141 int i;
142
143 nasid = cnodeid_to_nasid(err_nodepda->bte_if[0].bte_cnode);
144
145 /*
146 * Verify that all the BTEs are complete
147 */
148 for (i = 0; i < BTES_PER_NODE; i++) {
149 bte = &err_nodepda->bte_if[i];
150 status = BTE_LNSTAT_LOAD(bte);
151 if ((status & IBLS_ERROR) || !(status & IBLS_BUSY))
152 continue;
153 mod_timer(recovery_timer, HZ * 5);
154 BTE_PRINTK(("eh:%p:%d Marked Giving up\n", err_nodepda,
155 smp_processor_id()));
156 return 1;
157 }
158 if (ia64_sn_bte_recovery(nasid))
159 panic("bte_error_handler(): Fatal BTE Error");
160
161 del_timer(recovery_timer);
162 return 0;
127} 163}
128 164
129/* 165/*
@@ -135,7 +171,6 @@ void bte_error_handler(unsigned long _nodepda)
135 struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda; 171 struct nodepda_s *err_nodepda = (struct nodepda_s *)_nodepda;
136 spinlock_t *recovery_lock = &err_nodepda->bte_recovery_lock; 172 spinlock_t *recovery_lock = &err_nodepda->bte_recovery_lock;
137 int i; 173 int i;
138 nasid_t nasid;
139 unsigned long irq_flags; 174 unsigned long irq_flags;
140 volatile u64 *notify; 175 volatile u64 *notify;
141 bte_result_t bh_error; 176 bte_result_t bh_error;
@@ -160,12 +195,15 @@ void bte_error_handler(unsigned long _nodepda)
160 } 195 }
161 196
162 if (is_shub1()) { 197 if (is_shub1()) {
163 shub1_bte_error_handler(_nodepda); 198 if (shub1_bte_error_handler(_nodepda)) {
199 spin_unlock_irqrestore(recovery_lock, irq_flags);
200 return;
201 }
164 } else { 202 } else {
165 nasid = cnodeid_to_nasid(err_nodepda->bte_if[0].bte_cnode); 203 if (shub2_bte_error_handler(_nodepda)) {
166 204 spin_unlock_irqrestore(recovery_lock, irq_flags);
167 if (ia64_sn_bte_recovery(nasid)) 205 return;
168 panic("bte_error_handler(): Fatal BTE Error"); 206 }
169 } 207 }
170 208
171 for (i = 0; i < BTES_PER_NODE; i++) { 209 for (i = 0; i < BTES_PER_NODE; i++) {
diff --git a/arch/ia64/sn/kernel/huberror.c b/arch/ia64/sn/kernel/huberror.c
index 5c5eb01c50f0..56ab6bae00ee 100644
--- a/arch/ia64/sn/kernel/huberror.c
+++ b/arch/ia64/sn/kernel/huberror.c
@@ -32,13 +32,14 @@ static irqreturn_t hub_eint_handler(int irq, void *arg, struct pt_regs *ep)
32 ret_stuff.v0 = 0; 32 ret_stuff.v0 = 0;
33 hubdev_info = (struct hubdev_info *)arg; 33 hubdev_info = (struct hubdev_info *)arg;
34 nasid = hubdev_info->hdi_nasid; 34 nasid = hubdev_info->hdi_nasid;
35 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_HUB_ERROR_INTERRUPT, 35
36 if (is_shub1()) {
37 SAL_CALL_NOLOCK(ret_stuff, SN_SAL_HUB_ERROR_INTERRUPT,
36 (u64) nasid, 0, 0, 0, 0, 0, 0); 38 (u64) nasid, 0, 0, 0, 0, 0, 0);
37 39
38 if ((int)ret_stuff.v0) 40 if ((int)ret_stuff.v0)
39 panic("hubii_eint_handler(): Fatal TIO Error"); 41 panic("hubii_eint_handler(): Fatal TIO Error");
40 42
41 if (is_shub1()) {
42 if (!(nasid & 1)) /* Not a TIO, handle CRB errors */ 43 if (!(nasid & 1)) /* Not a TIO, handle CRB errors */
43 (void)hubiio_crb_error_handler(hubdev_info); 44 (void)hubiio_crb_error_handler(hubdev_info);
44 } else 45 } else
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 05e4ea889981..00700f7e6837 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8 8
9#include <linux/bootmem.h> 9#include <linux/bootmem.h>
@@ -76,11 +76,12 @@ static struct sn_pcibus_provider sn_pci_default_provider = {
76}; 76};
77 77
78/* 78/*
79 * Retrieve the DMA Flush List given nasid. This list is needed 79 * Retrieve the DMA Flush List given nasid, widget, and device.
80 * to implement the WAR - Flush DMA data on PIO Reads. 80 * This list is needed to implement the WAR - Flush DMA data on PIO Reads.
81 */ 81 */
82static inline uint64_t 82static inline u64
83sal_get_widget_dmaflush_list(u64 nasid, u64 widget_num, u64 address) 83sal_get_device_dmaflush_list(u64 nasid, u64 widget_num, u64 device_num,
84 u64 address)
84{ 85{
85 86
86 struct ia64_sal_retval ret_stuff; 87 struct ia64_sal_retval ret_stuff;
@@ -88,17 +89,17 @@ sal_get_widget_dmaflush_list(u64 nasid, u64 widget_num, u64 address)
88 ret_stuff.v0 = 0; 89 ret_stuff.v0 = 0;
89 90
90 SAL_CALL_NOLOCK(ret_stuff, 91 SAL_CALL_NOLOCK(ret_stuff,
91 (u64) SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST, 92 (u64) SN_SAL_IOIF_GET_DEVICE_DMAFLUSH_LIST,
92 (u64) nasid, (u64) widget_num, (u64) address, 0, 0, 0, 93 (u64) nasid, (u64) widget_num,
93 0); 94 (u64) device_num, (u64) address, 0, 0, 0);
94 return ret_stuff.v0; 95 return ret_stuff.status;
95 96
96} 97}
97 98
98/* 99/*
99 * Retrieve the hub device info structure for the given nasid. 100 * Retrieve the hub device info structure for the given nasid.
100 */ 101 */
101static inline uint64_t sal_get_hubdev_info(u64 handle, u64 address) 102static inline u64 sal_get_hubdev_info(u64 handle, u64 address)
102{ 103{
103 104
104 struct ia64_sal_retval ret_stuff; 105 struct ia64_sal_retval ret_stuff;
@@ -114,7 +115,7 @@ static inline uint64_t sal_get_hubdev_info(u64 handle, u64 address)
114/* 115/*
115 * Retrieve the pci bus information given the bus number. 116 * Retrieve the pci bus information given the bus number.
116 */ 117 */
117static inline uint64_t sal_get_pcibus_info(u64 segment, u64 busnum, u64 address) 118static inline u64 sal_get_pcibus_info(u64 segment, u64 busnum, u64 address)
118{ 119{
119 120
120 struct ia64_sal_retval ret_stuff; 121 struct ia64_sal_retval ret_stuff;
@@ -130,9 +131,9 @@ static inline uint64_t sal_get_pcibus_info(u64 segment, u64 busnum, u64 address)
130/* 131/*
131 * Retrieve the pci device information given the bus and device|function number. 132 * Retrieve the pci device information given the bus and device|function number.
132 */ 133 */
133static inline uint64_t 134static inline u64
134sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev, 135sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev,
135 u64 sn_irq_info) 136 u64 sn_irq_info)
136{ 137{
137 struct ia64_sal_retval ret_stuff; 138 struct ia64_sal_retval ret_stuff;
138 ret_stuff.status = 0; 139 ret_stuff.status = 0;
@@ -140,24 +141,79 @@ sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev,
140 141
141 SAL_CALL_NOLOCK(ret_stuff, 142 SAL_CALL_NOLOCK(ret_stuff,
142 (u64) SN_SAL_IOIF_GET_PCIDEV_INFO, 143 (u64) SN_SAL_IOIF_GET_PCIDEV_INFO,
143 (u64) segment, (u64) bus_number, (u64) devfn, 144 (u64) segment, (u64) bus_number, (u64) devfn,
144 (u64) pci_dev, 145 (u64) pci_dev,
145 sn_irq_info, 0, 0); 146 sn_irq_info, 0, 0);
146 return ret_stuff.v0; 147 return ret_stuff.v0;
147} 148}
148 149
149/* 150/*
150 * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for 151 * sn_pcidev_info_get() - Retrieve the pcidev_info struct for the specified
152 * device.
153 */
154inline struct pcidev_info *
155sn_pcidev_info_get(struct pci_dev *dev)
156{
157 struct pcidev_info *pcidev;
158
159 list_for_each_entry(pcidev,
160 &(SN_PCI_CONTROLLER(dev)->pcidev_info), pdi_list) {
161 if (pcidev->pdi_linux_pcidev == dev) {
162 return pcidev;
163 }
164 }
165 return NULL;
166}
167
168/* Older PROM flush WAR
169 *
170 * 01/16/06 -- This war will be in place until a new official PROM is released.
171 * Additionally note that the struct sn_flush_device_war also has to be
172 * removed from arch/ia64/sn/include/xtalk/hubdev.h
173 */
174static u8 war_implemented = 0;
175
176static void sn_device_fixup_war(u64 nasid, u64 widget, int device,
177 struct sn_flush_device_common *common)
178{
179 struct sn_flush_device_war *war_list;
180 struct sn_flush_device_war *dev_entry;
181 struct ia64_sal_retval isrv = {0,0,0,0};
182
183 if (!war_implemented) {
184 printk(KERN_WARNING "PROM version < 4.50 -- implementing old "
185 "PROM flush WAR\n");
186 war_implemented = 1;
187 }
188
189 war_list = kzalloc(DEV_PER_WIDGET * sizeof(*war_list), GFP_KERNEL);
190 if (!war_list)
191 BUG();
192
193 SAL_CALL_NOLOCK(isrv, SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST,
194 nasid, widget, __pa(war_list), 0, 0, 0 ,0);
195 if (isrv.status)
196 panic("sn_device_fixup_war failed: %s\n",
197 ia64_sal_strerror(isrv.status));
198
199 dev_entry = war_list + device;
200 memcpy(common,dev_entry, sizeof(*common));
201
202 kfree(war_list);
203}
204
205/*
206 * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for
151 * each node in the system. 207 * each node in the system.
152 */ 208 */
153static void sn_fixup_ionodes(void) 209static void sn_fixup_ionodes(void)
154{ 210{
155 211 struct sn_flush_device_kernel *sn_flush_device_kernel;
156 struct sn_flush_device_list *sn_flush_device_list; 212 struct sn_flush_device_kernel *dev_entry;
157 struct hubdev_info *hubdev; 213 struct hubdev_info *hubdev;
158 uint64_t status; 214 u64 status;
159 uint64_t nasid; 215 u64 nasid;
160 int i, widget; 216 int i, widget, device;
161 217
162 /* 218 /*
163 * Get SGI Specific HUB chipset information. 219 * Get SGI Specific HUB chipset information.
@@ -168,7 +224,7 @@ static void sn_fixup_ionodes(void)
168 nasid = cnodeid_to_nasid(i); 224 nasid = cnodeid_to_nasid(i);
169 hubdev->max_segment_number = 0xffffffff; 225 hubdev->max_segment_number = 0xffffffff;
170 hubdev->max_pcibus_number = 0xff; 226 hubdev->max_pcibus_number = 0xff;
171 status = sal_get_hubdev_info(nasid, (uint64_t) __pa(hubdev)); 227 status = sal_get_hubdev_info(nasid, (u64) __pa(hubdev));
172 if (status) 228 if (status)
173 continue; 229 continue;
174 230
@@ -195,38 +251,104 @@ static void sn_fixup_ionodes(void)
195 251
196 hubdev->hdi_flush_nasid_list.widget_p = 252 hubdev->hdi_flush_nasid_list.widget_p =
197 kmalloc((HUB_WIDGET_ID_MAX + 1) * 253 kmalloc((HUB_WIDGET_ID_MAX + 1) *
198 sizeof(struct sn_flush_device_list *), GFP_KERNEL); 254 sizeof(struct sn_flush_device_kernel *),
199 255 GFP_KERNEL);
200 memset(hubdev->hdi_flush_nasid_list.widget_p, 0x0, 256 memset(hubdev->hdi_flush_nasid_list.widget_p, 0x0,
201 (HUB_WIDGET_ID_MAX + 1) * 257 (HUB_WIDGET_ID_MAX + 1) *
202 sizeof(struct sn_flush_device_list *)); 258 sizeof(struct sn_flush_device_kernel *));
203 259
204 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) { 260 for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) {
205 sn_flush_device_list = kmalloc(DEV_PER_WIDGET * 261 sn_flush_device_kernel = kmalloc(DEV_PER_WIDGET *
206 sizeof(struct 262 sizeof(struct
207 sn_flush_device_list), 263 sn_flush_device_kernel),
208 GFP_KERNEL); 264 GFP_KERNEL);
209 memset(sn_flush_device_list, 0x0, 265 if (!sn_flush_device_kernel)
266 BUG();
267 memset(sn_flush_device_kernel, 0x0,
210 DEV_PER_WIDGET * 268 DEV_PER_WIDGET *
211 sizeof(struct sn_flush_device_list)); 269 sizeof(struct sn_flush_device_kernel));
212 270
213 status = 271 dev_entry = sn_flush_device_kernel;
214 sal_get_widget_dmaflush_list(nasid, widget, 272 for (device = 0; device < DEV_PER_WIDGET;
215 (uint64_t) 273 device++,dev_entry++) {
216 __pa 274 dev_entry->common = kmalloc(sizeof(struct
217 (sn_flush_device_list)); 275 sn_flush_device_common),
218 if (status) { 276 GFP_KERNEL);
219 kfree(sn_flush_device_list); 277 if (!dev_entry->common)
220 continue; 278 BUG();
279 memset(dev_entry->common, 0x0, sizeof(struct
280 sn_flush_device_common));
281
282 status = sal_get_device_dmaflush_list(nasid,
283 widget,
284 device,
285 (u64)(dev_entry->common));
286 if (status) {
287 if (sn_sal_rev() < 0x0450) {
288 /* shortlived WAR for older
289 * PROM images
290 */
291 sn_device_fixup_war(nasid,
292 widget,
293 device,
294 dev_entry->common);
295 }
296 else
297 BUG();
298 }
299
300 spin_lock_init(&dev_entry->sfdl_flush_lock);
221 } 301 }
222 302
223 spin_lock_init(&sn_flush_device_list->sfdl_flush_lock); 303 if (sn_flush_device_kernel)
224 hubdev->hdi_flush_nasid_list.widget_p[widget] = 304 hubdev->hdi_flush_nasid_list.widget_p[widget] =
225 sn_flush_device_list; 305 sn_flush_device_kernel;
226 } 306 }
307 }
308}
309
310/*
311 * sn_pci_window_fixup() - Create a pci_window for each device resource.
312 * Until ACPI support is added, we need this code
313 * to setup pci_windows for use by
314 * pcibios_bus_to_resource(),
315 * pcibios_resource_to_bus(), etc.
316 */
317static void
318sn_pci_window_fixup(struct pci_dev *dev, unsigned int count,
319 s64 * pci_addrs)
320{
321 struct pci_controller *controller = PCI_CONTROLLER(dev->bus);
322 unsigned int i;
323 unsigned int idx;
324 unsigned int new_count;
325 struct pci_window *new_window;
326
327 if (count == 0)
328 return;
329 idx = controller->windows;
330 new_count = controller->windows + count;
331 new_window = kcalloc(new_count, sizeof(struct pci_window), GFP_KERNEL);
332 if (new_window == NULL)
333 BUG();
334 if (controller->window) {
335 memcpy(new_window, controller->window,
336 sizeof(struct pci_window) * controller->windows);
337 kfree(controller->window);
338 }
227 339
340 /* Setup a pci_window for each device resource. */
341 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
342 if (pci_addrs[i] == -1)
343 continue;
344
345 new_window[idx].offset = dev->resource[i].start - pci_addrs[i];
346 new_window[idx].resource = dev->resource[i];
347 idx++;
228 } 348 }
229 349
350 controller->windows = new_count;
351 controller->window = new_window;
230} 352}
231 353
232void sn_pci_unfixup_slot(struct pci_dev *dev) 354void sn_pci_unfixup_slot(struct pci_dev *dev)
@@ -246,21 +368,23 @@ void sn_pci_unfixup_slot(struct pci_dev *dev)
246 */ 368 */
247void sn_pci_fixup_slot(struct pci_dev *dev) 369void sn_pci_fixup_slot(struct pci_dev *dev)
248{ 370{
371 unsigned int count = 0;
249 int idx; 372 int idx;
250 int segment = pci_domain_nr(dev->bus); 373 int segment = pci_domain_nr(dev->bus);
251 int status = 0; 374 int status = 0;
252 struct pcibus_bussoft *bs; 375 struct pcibus_bussoft *bs;
253 struct pci_bus *host_pci_bus; 376 struct pci_bus *host_pci_bus;
254 struct pci_dev *host_pci_dev; 377 struct pci_dev *host_pci_dev;
378 struct pcidev_info *pcidev_info;
379 s64 pci_addrs[PCI_ROM_RESOURCE + 1];
255 struct sn_irq_info *sn_irq_info; 380 struct sn_irq_info *sn_irq_info;
256 unsigned long size; 381 unsigned long size;
257 unsigned int bus_no, devfn; 382 unsigned int bus_no, devfn;
258 383
259 pci_dev_get(dev); /* for the sysdata pointer */ 384 pci_dev_get(dev); /* for the sysdata pointer */
260 dev->sysdata = kmalloc(sizeof(struct pcidev_info), GFP_KERNEL); 385 pcidev_info = kzalloc(sizeof(struct pcidev_info), GFP_KERNEL);
261 if (SN_PCIDEV_INFO(dev) <= 0) 386 if (pcidev_info <= 0)
262 BUG(); /* Cannot afford to run out of memory */ 387 BUG(); /* Cannot afford to run out of memory */
263 memset(SN_PCIDEV_INFO(dev), 0, sizeof(struct pcidev_info));
264 388
265 sn_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_KERNEL); 389 sn_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_KERNEL);
266 if (sn_irq_info <= 0) 390 if (sn_irq_info <= 0)
@@ -270,22 +394,34 @@ void sn_pci_fixup_slot(struct pci_dev *dev)
270 /* Call to retrieve pci device information needed by kernel. */ 394 /* Call to retrieve pci device information needed by kernel. */
271 status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number, 395 status = sal_get_pcidev_info((u64) segment, (u64) dev->bus->number,
272 dev->devfn, 396 dev->devfn,
273 (u64) __pa(SN_PCIDEV_INFO(dev)), 397 (u64) __pa(pcidev_info),
274 (u64) __pa(sn_irq_info)); 398 (u64) __pa(sn_irq_info));
275 if (status) 399 if (status)
276 BUG(); /* Cannot get platform pci device information */ 400 BUG(); /* Cannot get platform pci device information */
277 401
402 /* Add pcidev_info to list in sn_pci_controller struct */
403 list_add_tail(&pcidev_info->pdi_list,
404 &(SN_PCI_CONTROLLER(dev->bus)->pcidev_info));
405
278 /* Copy over PIO Mapped Addresses */ 406 /* Copy over PIO Mapped Addresses */
279 for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) { 407 for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) {
280 unsigned long start, end, addr; 408 unsigned long start, end, addr;
281 409
282 if (!SN_PCIDEV_INFO(dev)->pdi_pio_mapped_addr[idx]) 410 if (!pcidev_info->pdi_pio_mapped_addr[idx]) {
411 pci_addrs[idx] = -1;
283 continue; 412 continue;
413 }
284 414
285 start = dev->resource[idx].start; 415 start = dev->resource[idx].start;
286 end = dev->resource[idx].end; 416 end = dev->resource[idx].end;
287 size = end - start; 417 size = end - start;
288 addr = SN_PCIDEV_INFO(dev)->pdi_pio_mapped_addr[idx]; 418 if (size == 0) {
419 pci_addrs[idx] = -1;
420 continue;
421 }
422 pci_addrs[idx] = start;
423 count++;
424 addr = pcidev_info->pdi_pio_mapped_addr[idx];
289 addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET; 425 addr = ((addr << 4) >> 4) | __IA64_UNCACHED_OFFSET;
290 dev->resource[idx].start = addr; 426 dev->resource[idx].start = addr;
291 dev->resource[idx].end = addr + size; 427 dev->resource[idx].end = addr + size;
@@ -294,23 +430,27 @@ void sn_pci_fixup_slot(struct pci_dev *dev)
294 else 430 else
295 dev->resource[idx].parent = &iomem_resource; 431 dev->resource[idx].parent = &iomem_resource;
296 } 432 }
433 /* Create a pci_window in the pci_controller struct for
434 * each device resource.
435 */
436 if (count > 0)
437 sn_pci_window_fixup(dev, count, pci_addrs);
297 438
298 /* 439 /*
299 * Using the PROMs values for the PCI host bus, get the Linux 440 * Using the PROMs values for the PCI host bus, get the Linux
300 * PCI host_pci_dev struct and set up host bus linkages 441 * PCI host_pci_dev struct and set up host bus linkages
301 */ 442 */
302 443
303 bus_no = (SN_PCIDEV_INFO(dev)->pdi_slot_host_handle >> 32) & 0xff; 444 bus_no = (pcidev_info->pdi_slot_host_handle >> 32) & 0xff;
304 devfn = SN_PCIDEV_INFO(dev)->pdi_slot_host_handle & 0xffffffff; 445 devfn = pcidev_info->pdi_slot_host_handle & 0xffffffff;
305 host_pci_bus = pci_find_bus(segment, bus_no); 446 host_pci_bus = pci_find_bus(segment, bus_no);
306 host_pci_dev = pci_get_slot(host_pci_bus, devfn); 447 host_pci_dev = pci_get_slot(host_pci_bus, devfn);
307 448
308 SN_PCIDEV_INFO(dev)->host_pci_dev = host_pci_dev; 449 pcidev_info->host_pci_dev = host_pci_dev;
309 SN_PCIDEV_INFO(dev)->pdi_host_pcidev_info = 450 pcidev_info->pdi_linux_pcidev = dev;
310 SN_PCIDEV_INFO(host_pci_dev); 451 pcidev_info->pdi_host_pcidev_info = SN_PCIDEV_INFO(host_pci_dev);
311 SN_PCIDEV_INFO(dev)->pdi_linux_pcidev = dev;
312 bs = SN_PCIBUS_BUSSOFT(dev->bus); 452 bs = SN_PCIBUS_BUSSOFT(dev->bus);
313 SN_PCIDEV_INFO(dev)->pdi_pcibus_info = bs; 453 pcidev_info->pdi_pcibus_info = bs;
314 454
315 if (bs && bs->bs_asic_type < PCIIO_ASIC_MAX_TYPES) { 455 if (bs && bs->bs_asic_type < PCIIO_ASIC_MAX_TYPES) {
316 SN_PCIDEV_BUSPROVIDER(dev) = sn_pci_provider[bs->bs_asic_type]; 456 SN_PCIDEV_BUSPROVIDER(dev) = sn_pci_provider[bs->bs_asic_type];
@@ -320,11 +460,11 @@ void sn_pci_fixup_slot(struct pci_dev *dev)
320 460
321 /* Only set up IRQ stuff if this device has a host bus context */ 461 /* Only set up IRQ stuff if this device has a host bus context */
322 if (bs && sn_irq_info->irq_irq) { 462 if (bs && sn_irq_info->irq_irq) {
323 SN_PCIDEV_INFO(dev)->pdi_sn_irq_info = sn_irq_info; 463 pcidev_info->pdi_sn_irq_info = sn_irq_info;
324 dev->irq = SN_PCIDEV_INFO(dev)->pdi_sn_irq_info->irq_irq; 464 dev->irq = pcidev_info->pdi_sn_irq_info->irq_irq;
325 sn_irq_fixup(dev, sn_irq_info); 465 sn_irq_fixup(dev, sn_irq_info);
326 } else { 466 } else {
327 SN_PCIDEV_INFO(dev)->pdi_sn_irq_info = NULL; 467 pcidev_info->pdi_sn_irq_info = NULL;
328 kfree(sn_irq_info); 468 kfree(sn_irq_info);
329 } 469 }
330} 470}
@@ -338,6 +478,7 @@ void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
338 int status = 0; 478 int status = 0;
339 int nasid, cnode; 479 int nasid, cnode;
340 struct pci_controller *controller; 480 struct pci_controller *controller;
481 struct sn_pci_controller *sn_controller;
341 struct pcibus_bussoft *prom_bussoft_ptr; 482 struct pcibus_bussoft *prom_bussoft_ptr;
342 struct hubdev_info *hubdev_info; 483 struct hubdev_info *hubdev_info;
343 void *provider_soft = NULL; 484 void *provider_soft = NULL;
@@ -349,10 +490,15 @@ void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
349 return; /*bus # does not exist */ 490 return; /*bus # does not exist */
350 prom_bussoft_ptr = __va(prom_bussoft_ptr); 491 prom_bussoft_ptr = __va(prom_bussoft_ptr);
351 492
352 controller = kzalloc(sizeof(struct pci_controller), GFP_KERNEL); 493 /* Allocate a sn_pci_controller, which has a pci_controller struct
494 * as the first member.
495 */
496 sn_controller = kzalloc(sizeof(struct sn_pci_controller), GFP_KERNEL);
497 if (!sn_controller)
498 BUG();
499 INIT_LIST_HEAD(&sn_controller->pcidev_info);
500 controller = &sn_controller->pci_controller;
353 controller->segment = segment; 501 controller->segment = segment;
354 if (!controller)
355 BUG();
356 502
357 if (bus == NULL) { 503 if (bus == NULL) {
358 bus = pci_scan_bus(busnum, &pci_root_ops, controller); 504 bus = pci_scan_bus(busnum, &pci_root_ops, controller);
@@ -390,6 +536,29 @@ void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
390 } 536 }
391 537
392 /* 538 /*
539 * Setup pci_windows for legacy IO and MEM space.
540 * (Temporary until ACPI support is in place.)
541 */
542 controller->window = kcalloc(2, sizeof(struct pci_window), GFP_KERNEL);
543 if (controller->window == NULL)
544 BUG();
545 controller->window[0].offset = prom_bussoft_ptr->bs_legacy_io;
546 controller->window[0].resource.name = "legacy_io";
547 controller->window[0].resource.flags = IORESOURCE_IO;
548 controller->window[0].resource.start = prom_bussoft_ptr->bs_legacy_io;
549 controller->window[0].resource.end =
550 controller->window[0].resource.start + 0xffff;
551 controller->window[0].resource.parent = &ioport_resource;
552 controller->window[1].offset = prom_bussoft_ptr->bs_legacy_mem;
553 controller->window[1].resource.name = "legacy_mem";
554 controller->window[1].resource.flags = IORESOURCE_MEM;
555 controller->window[1].resource.start = prom_bussoft_ptr->bs_legacy_mem;
556 controller->window[1].resource.end =
557 controller->window[1].resource.start + (1024 * 1024) - 1;
558 controller->window[1].resource.parent = &iomem_resource;
559 controller->windows = 2;
560
561 /*
393 * Generic bus fixup goes here. Don't reference prom_bussoft_ptr 562 * Generic bus fixup goes here. Don't reference prom_bussoft_ptr
394 * after this point. 563 * after this point.
395 */ 564 */
@@ -421,7 +590,7 @@ void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
421 590
422error_return: 591error_return:
423 592
424 kfree(controller); 593 kfree(sn_controller);
425 return; 594 return;
426} 595}
427 596
@@ -434,7 +603,7 @@ void sn_bus_store_sysdata(struct pci_dev *dev)
434 dev_dbg(dev, "%s: out of memory!\n", __FUNCTION__); 603 dev_dbg(dev, "%s: out of memory!\n", __FUNCTION__);
435 return; 604 return;
436 } 605 }
437 element->sysdata = dev->sysdata; 606 element->sysdata = SN_PCIDEV_INFO(dev);
438 list_add(&element->entry, &sn_sysdata_list); 607 list_add(&element->entry, &sn_sysdata_list);
439} 608}
440 609
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 01d18b7b5bb3..ec37084bdc17 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -28,7 +28,7 @@ extern int sn_ioif_inited;
28static struct list_head **sn_irq_lh; 28static struct list_head **sn_irq_lh;
29static spinlock_t sn_irq_info_lock = SPIN_LOCK_UNLOCKED; /* non-IRQ lock */ 29static spinlock_t sn_irq_info_lock = SPIN_LOCK_UNLOCKED; /* non-IRQ lock */
30 30
31static inline uint64_t sn_intr_alloc(nasid_t local_nasid, int local_widget, 31static inline u64 sn_intr_alloc(nasid_t local_nasid, int local_widget,
32 u64 sn_irq_info, 32 u64 sn_irq_info,
33 int req_irq, nasid_t req_nasid, 33 int req_irq, nasid_t req_nasid,
34 int req_slice) 34 int req_slice)
@@ -123,7 +123,7 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
123 123
124 list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe, 124 list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe,
125 sn_irq_lh[irq], list) { 125 sn_irq_lh[irq], list) {
126 uint64_t bridge; 126 u64 bridge;
127 int local_widget, status; 127 int local_widget, status;
128 nasid_t local_nasid; 128 nasid_t local_nasid;
129 struct sn_irq_info *new_irq_info; 129 struct sn_irq_info *new_irq_info;
@@ -134,7 +134,7 @@ static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
134 break; 134 break;
135 memcpy(new_irq_info, sn_irq_info, sizeof(struct sn_irq_info)); 135 memcpy(new_irq_info, sn_irq_info, sizeof(struct sn_irq_info));
136 136
137 bridge = (uint64_t) new_irq_info->irq_bridge; 137 bridge = (u64) new_irq_info->irq_bridge;
138 if (!bridge) { 138 if (!bridge) {
139 kfree(new_irq_info); 139 kfree(new_irq_info);
140 break; /* irq is not a device interrupt */ 140 break; /* irq is not a device interrupt */
@@ -349,10 +349,10 @@ static void force_interrupt(int irq)
349 */ 349 */
350static void sn_check_intr(int irq, struct sn_irq_info *sn_irq_info) 350static void sn_check_intr(int irq, struct sn_irq_info *sn_irq_info)
351{ 351{
352 uint64_t regval; 352 u64 regval;
353 int irr_reg_num; 353 int irr_reg_num;
354 int irr_bit; 354 int irr_bit;
355 uint64_t irr_reg; 355 u64 irr_reg;
356 struct pcidev_info *pcidev_info; 356 struct pcidev_info *pcidev_info;
357 struct pcibus_info *pcibus_info; 357 struct pcibus_info *pcibus_info;
358 358
diff --git a/arch/ia64/sn/kernel/mca.c b/arch/ia64/sn/kernel/mca.c
index 6546db6abdba..9ab684d1bb55 100644
--- a/arch/ia64/sn/kernel/mca.c
+++ b/arch/ia64/sn/kernel/mca.c
@@ -10,6 +10,7 @@
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/timer.h> 11#include <linux/timer.h>
12#include <linux/vmalloc.h> 12#include <linux/vmalloc.h>
13#include <linux/mutex.h>
13#include <asm/mca.h> 14#include <asm/mca.h>
14#include <asm/sal.h> 15#include <asm/sal.h>
15#include <asm/sn/sn_sal.h> 16#include <asm/sn/sn_sal.h>
@@ -27,7 +28,7 @@ void sn_init_cpei_timer(void);
27/* Printing oemdata from mca uses data that is not passed through SAL, it is 28/* Printing oemdata from mca uses data that is not passed through SAL, it is
28 * global. Only one user at a time. 29 * global. Only one user at a time.
29 */ 30 */
30static DECLARE_MUTEX(sn_oemdata_mutex); 31static DEFINE_MUTEX(sn_oemdata_mutex);
31static u8 **sn_oemdata; 32static u8 **sn_oemdata;
32static u64 *sn_oemdata_size, sn_oemdata_bufsize; 33static u64 *sn_oemdata_size, sn_oemdata_bufsize;
33 34
@@ -89,7 +90,7 @@ static int
89sn_platform_plat_specific_err_print(const u8 * sect_header, u8 ** oemdata, 90sn_platform_plat_specific_err_print(const u8 * sect_header, u8 ** oemdata,
90 u64 * oemdata_size) 91 u64 * oemdata_size)
91{ 92{
92 down(&sn_oemdata_mutex); 93 mutex_lock(&sn_oemdata_mutex);
93 sn_oemdata = oemdata; 94 sn_oemdata = oemdata;
94 sn_oemdata_size = oemdata_size; 95 sn_oemdata_size = oemdata_size;
95 sn_oemdata_bufsize = 0; 96 sn_oemdata_bufsize = 0;
@@ -107,7 +108,7 @@ sn_platform_plat_specific_err_print(const u8 * sect_header, u8 ** oemdata,
107 *sn_oemdata_size = 0; 108 *sn_oemdata_size = 0;
108 ia64_sn_plat_specific_err_print(print_hook, (char *)sect_header); 109 ia64_sn_plat_specific_err_print(print_hook, (char *)sect_header);
109 } 110 }
110 up(&sn_oemdata_mutex); 111 mutex_unlock(&sn_oemdata_mutex);
111 return 0; 112 return 0;
112} 113}
113 114
diff --git a/arch/ia64/sn/kernel/sn2/ptc_deadlock.S b/arch/ia64/sn/kernel/sn2/ptc_deadlock.S
index 3fa95065a446..bebbcc4f8dd4 100644
--- a/arch/ia64/sn/kernel/sn2/ptc_deadlock.S
+++ b/arch/ia64/sn/kernel/sn2/ptc_deadlock.S
@@ -39,9 +39,13 @@ sn2_ptc_deadlock_recovery_core:
39 mov r8=r0 39 mov r8=r0
40 40
411: 411:
42 cmp.ne p8,p9=r0,ptc1 // Test for shub type (ptc1 non-null on shub1)
43 // p8 = 1 if shub1, p9 = 1 if shub2
44
42 add scr2=ALIAS_OFFSET,piowc // Address of WRITE_STATUS alias register 45 add scr2=ALIAS_OFFSET,piowc // Address of WRITE_STATUS alias register
43 ;; 46 mov scr1=7;; // Clear DEADLOCK, WRITE_ERROR, MULTI_WRITE_ERROR
44 ld8.acq scr1=[scr2];; 47(p8) st8.rel [scr2]=scr1;;
48(p9) ld8.acq scr1=[scr2];;
45 49
465: ld8.acq scr1=[piowc];; // Wait for PIOs to complete. 505: ld8.acq scr1=[piowc];; // Wait for PIOs to complete.
47 hint @pause 51 hint @pause
diff --git a/arch/ia64/sn/kernel/sn2/sn2_smp.c b/arch/ia64/sn/kernel/sn2/sn2_smp.c
index 5d54f5f4e926..471bbaa65d1b 100644
--- a/arch/ia64/sn/kernel/sn2/sn2_smp.c
+++ b/arch/ia64/sn/kernel/sn2/sn2_smp.c
@@ -202,7 +202,7 @@ sn2_global_tlb_purge(struct mm_struct *mm, unsigned long start,
202 unsigned long end, unsigned long nbits) 202 unsigned long end, unsigned long nbits)
203{ 203{
204 int i, opt, shub1, cnode, mynasid, cpu, lcpu = 0, nasid, flushed = 0; 204 int i, opt, shub1, cnode, mynasid, cpu, lcpu = 0, nasid, flushed = 0;
205 int mymm = (mm == current->active_mm); 205 int mymm = (mm == current->active_mm && current->mm);
206 volatile unsigned long *ptc0, *ptc1; 206 volatile unsigned long *ptc0, *ptc1;
207 unsigned long itc, itc2, flags, data0 = 0, data1 = 0, rr_value; 207 unsigned long itc, itc2, flags, data0 = 0, data1 = 0, rr_value;
208 short nasids[MAX_NUMNODES], nix; 208 short nasids[MAX_NUMNODES], nix;
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index 0d8592a745a7..d263d3e8fbb9 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -11,6 +11,7 @@
11#include <linux/slab.h> 11#include <linux/slab.h>
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
14#include <linux/capability.h>
14#include <linux/device.h> 15#include <linux/device.h>
15#include <linux/delay.h> 16#include <linux/delay.h>
16#include <asm/system.h> 17#include <asm/system.h>
@@ -65,7 +66,7 @@ static int tiocx_match(struct device *dev, struct device_driver *drv)
65 66
66} 67}
67 68
68static int tiocx_hotplug(struct device *dev, char **envp, int num_envp, 69static int tiocx_uevent(struct device *dev, char **envp, int num_envp,
69 char *buffer, int buffer_size) 70 char *buffer, int buffer_size)
70{ 71{
71 return -ENODEV; 72 return -ENODEV;
@@ -76,12 +77,6 @@ static void tiocx_bus_release(struct device *dev)
76 kfree(to_cx_dev(dev)); 77 kfree(to_cx_dev(dev));
77} 78}
78 79
79struct bus_type tiocx_bus_type = {
80 .name = "tiocx",
81 .match = tiocx_match,
82 .hotplug = tiocx_hotplug,
83};
84
85/** 80/**
86 * cx_device_match - Find cx_device in the id table. 81 * cx_device_match - Find cx_device in the id table.
87 * @ids: id table from driver 82 * @ids: id table from driver
@@ -148,6 +143,14 @@ static int cx_driver_remove(struct device *dev)
148 return 0; 143 return 0;
149} 144}
150 145
146struct bus_type tiocx_bus_type = {
147 .name = "tiocx",
148 .match = tiocx_match,
149 .uevent = tiocx_uevent,
150 .probe = cx_device_probe,
151 .remove = cx_driver_remove,
152};
153
151/** 154/**
152 * cx_driver_register - Register the driver. 155 * cx_driver_register - Register the driver.
153 * @cx_driver: driver table (cx_drv struct) from driver 156 * @cx_driver: driver table (cx_drv struct) from driver
@@ -161,8 +164,6 @@ int cx_driver_register(struct cx_drv *cx_driver)
161{ 164{
162 cx_driver->driver.name = cx_driver->name; 165 cx_driver->driver.name = cx_driver->name;
163 cx_driver->driver.bus = &tiocx_bus_type; 166 cx_driver->driver.bus = &tiocx_bus_type;
164 cx_driver->driver.probe = cx_device_probe;
165 cx_driver->driver.remove = cx_driver_remove;
166 167
167 return driver_register(&cx_driver->driver); 168 return driver_register(&cx_driver->driver);
168} 169}
@@ -244,7 +245,7 @@ static int cx_device_reload(struct cx_dev *cx_dev)
244 cx_dev->bt); 245 cx_dev->bt);
245} 246}
246 247
247static inline uint64_t tiocx_intr_alloc(nasid_t nasid, int widget, 248static inline u64 tiocx_intr_alloc(nasid_t nasid, int widget,
248 u64 sn_irq_info, 249 u64 sn_irq_info,
249 int req_irq, nasid_t req_nasid, 250 int req_irq, nasid_t req_nasid,
250 int req_slice) 251 int req_slice)
@@ -301,7 +302,7 @@ struct sn_irq_info *tiocx_irq_alloc(nasid_t nasid, int widget, int irq,
301 302
302void tiocx_irq_free(struct sn_irq_info *sn_irq_info) 303void tiocx_irq_free(struct sn_irq_info *sn_irq_info)
303{ 304{
304 uint64_t bridge = (uint64_t) sn_irq_info->irq_bridge; 305 u64 bridge = (u64) sn_irq_info->irq_bridge;
305 nasid_t nasid = NASID_GET(bridge); 306 nasid_t nasid = NASID_GET(bridge);
306 int widget; 307 int widget;
307 308
@@ -312,12 +313,12 @@ void tiocx_irq_free(struct sn_irq_info *sn_irq_info)
312 } 313 }
313} 314}
314 315
315uint64_t tiocx_dma_addr(uint64_t addr) 316u64 tiocx_dma_addr(u64 addr)
316{ 317{
317 return PHYS_TO_TIODMA(addr); 318 return PHYS_TO_TIODMA(addr);
318} 319}
319 320
320uint64_t tiocx_swin_base(int nasid) 321u64 tiocx_swin_base(int nasid)
321{ 322{
322 return TIO_SWIN_BASE(nasid, TIOCX_CORELET); 323 return TIO_SWIN_BASE(nasid, TIOCX_CORELET);
323} 324}
@@ -334,8 +335,8 @@ EXPORT_SYMBOL(tiocx_swin_base);
334 335
335static void tio_conveyor_set(nasid_t nasid, int enable_flag) 336static void tio_conveyor_set(nasid_t nasid, int enable_flag)
336{ 337{
337 uint64_t ice_frz; 338 u64 ice_frz;
338 uint64_t disable_cb = (1ull << 61); 339 u64 disable_cb = (1ull << 61);
339 340
340 if (!(nasid & 1)) 341 if (!(nasid & 1))
341 return; 342 return;
@@ -387,7 +388,7 @@ static int is_fpga_tio(int nasid, int *bt)
387 388
388static int bitstream_loaded(nasid_t nasid) 389static int bitstream_loaded(nasid_t nasid)
389{ 390{
390 uint64_t cx_credits; 391 u64 cx_credits;
391 392
392 cx_credits = REMOTE_HUB_L(nasid, TIO_ICE_PMI_TX_DYN_CREDIT_STAT_CB3); 393 cx_credits = REMOTE_HUB_L(nasid, TIO_ICE_PMI_TX_DYN_CREDIT_STAT_CB3);
393 cx_credits &= TIO_ICE_PMI_TX_DYN_CREDIT_STAT_CB3_CREDIT_CNT_MASK; 394 cx_credits &= TIO_ICE_PMI_TX_DYN_CREDIT_STAT_CB3_CREDIT_CNT_MASK;
@@ -403,14 +404,14 @@ static int tiocx_reload(struct cx_dev *cx_dev)
403 nasid_t nasid = cx_dev->cx_id.nasid; 404 nasid_t nasid = cx_dev->cx_id.nasid;
404 405
405 if (bitstream_loaded(nasid)) { 406 if (bitstream_loaded(nasid)) {
406 uint64_t cx_id; 407 u64 cx_id;
407 int rv; 408 int rv;
408 409
409 rv = ia64_sn_sysctl_tio_clock_reset(nasid); 410 rv = ia64_sn_sysctl_tio_clock_reset(nasid);
410 if (rv) { 411 if (rv) {
411 printk(KERN_ALERT "CX port JTAG reset failed.\n"); 412 printk(KERN_ALERT "CX port JTAG reset failed.\n");
412 } else { 413 } else {
413 cx_id = *(volatile uint64_t *) 414 cx_id = *(volatile u64 *)
414 (TIO_SWIN_BASE(nasid, TIOCX_CORELET) + 415 (TIO_SWIN_BASE(nasid, TIOCX_CORELET) +
415 WIDGET_ID); 416 WIDGET_ID);
416 part_num = XWIDGET_PART_NUM(cx_id); 417 part_num = XWIDGET_PART_NUM(cx_id);
diff --git a/arch/ia64/sn/kernel/xp_main.c b/arch/ia64/sn/kernel/xp_main.c
index 3be52a34c80f..b7ea46645e12 100644
--- a/arch/ia64/sn/kernel/xp_main.c
+++ b/arch/ia64/sn/kernel/xp_main.c
@@ -19,6 +19,7 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/mutex.h>
22#include <asm/sn/intr.h> 23#include <asm/sn/intr.h>
23#include <asm/sn/sn_sal.h> 24#include <asm/sn/sn_sal.h>
24#include <asm/sn/xp.h> 25#include <asm/sn/xp.h>
@@ -136,13 +137,13 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
136 137
137 registration = &xpc_registrations[ch_number]; 138 registration = &xpc_registrations[ch_number];
138 139
139 if (down_interruptible(&registration->sema) != 0) { 140 if (mutex_lock_interruptible(&registration->mutex) != 0) {
140 return xpcInterrupted; 141 return xpcInterrupted;
141 } 142 }
142 143
143 /* if XPC_CHANNEL_REGISTERED(ch_number) */ 144 /* if XPC_CHANNEL_REGISTERED(ch_number) */
144 if (registration->func != NULL) { 145 if (registration->func != NULL) {
145 up(&registration->sema); 146 mutex_unlock(&registration->mutex);
146 return xpcAlreadyRegistered; 147 return xpcAlreadyRegistered;
147 } 148 }
148 149
@@ -154,7 +155,7 @@ xpc_connect(int ch_number, xpc_channel_func func, void *key, u16 payload_size,
154 registration->key = key; 155 registration->key = key;
155 registration->func = func; 156 registration->func = func;
156 157
157 up(&registration->sema); 158 mutex_unlock(&registration->mutex);
158 159
159 xpc_interface.connect(ch_number); 160 xpc_interface.connect(ch_number);
160 161
@@ -190,11 +191,11 @@ xpc_disconnect(int ch_number)
190 * figured XPC's users will just turn around and call xpc_disconnect() 191 * figured XPC's users will just turn around and call xpc_disconnect()
191 * again anyways, so we might as well wait, if need be. 192 * again anyways, so we might as well wait, if need be.
192 */ 193 */
193 down(&registration->sema); 194 mutex_lock(&registration->mutex);
194 195
195 /* if !XPC_CHANNEL_REGISTERED(ch_number) */ 196 /* if !XPC_CHANNEL_REGISTERED(ch_number) */
196 if (registration->func == NULL) { 197 if (registration->func == NULL) {
197 up(&registration->sema); 198 mutex_unlock(&registration->mutex);
198 return; 199 return;
199 } 200 }
200 201
@@ -208,7 +209,7 @@ xpc_disconnect(int ch_number)
208 209
209 xpc_interface.disconnect(ch_number); 210 xpc_interface.disconnect(ch_number);
210 211
211 up(&registration->sema); 212 mutex_unlock(&registration->mutex);
212 213
213 return; 214 return;
214} 215}
@@ -250,9 +251,9 @@ xp_init(void)
250 xp_nofault_PIOR_target = SH1_IPI_ACCESS; 251 xp_nofault_PIOR_target = SH1_IPI_ACCESS;
251 } 252 }
252 253
253 /* initialize the connection registration semaphores */ 254 /* initialize the connection registration mutex */
254 for (ch_number = 0; ch_number < XPC_NCHANNELS; ch_number++) { 255 for (ch_number = 0; ch_number < XPC_NCHANNELS; ch_number++) {
255 sema_init(&xpc_registrations[ch_number].sema, 1); /* mutex */ 256 mutex_init(&xpc_registrations[ch_number].mutex);
256 } 257 }
257 258
258 return 0; 259 return 0;
diff --git a/arch/ia64/sn/kernel/xpc.h b/arch/ia64/sn/kernel/xpc.h
deleted file mode 100644
index 5483a9f227d4..000000000000
--- a/arch/ia64/sn/kernel/xpc.h
+++ /dev/null
@@ -1,1273 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved.
7 */
8
9
10/*
11 * Cross Partition Communication (XPC) structures and macros.
12 */
13
14#ifndef _IA64_SN_KERNEL_XPC_H
15#define _IA64_SN_KERNEL_XPC_H
16
17
18#include <linux/config.h>
19#include <linux/interrupt.h>
20#include <linux/sysctl.h>
21#include <linux/device.h>
22#include <asm/pgtable.h>
23#include <asm/processor.h>
24#include <asm/sn/bte.h>
25#include <asm/sn/clksupport.h>
26#include <asm/sn/addrs.h>
27#include <asm/sn/mspec.h>
28#include <asm/sn/shub_mmr.h>
29#include <asm/sn/xp.h>
30
31
32/*
33 * XPC Version numbers consist of a major and minor number. XPC can always
34 * talk to versions with same major #, and never talk to versions with a
35 * different major #.
36 */
37#define _XPC_VERSION(_maj, _min) (((_maj) << 4) | ((_min) & 0xf))
38#define XPC_VERSION_MAJOR(_v) ((_v) >> 4)
39#define XPC_VERSION_MINOR(_v) ((_v) & 0xf)
40
41
42/*
43 * The next macros define word or bit representations for given
44 * C-brick nasid in either the SAL provided bit array representing
45 * nasids in the partition/machine or the AMO_t array used for
46 * inter-partition initiation communications.
47 *
48 * For SN2 machines, C-Bricks are alway even numbered NASIDs. As
49 * such, some space will be saved by insisting that nasid information
50 * passed from SAL always be packed for C-Bricks and the
51 * cross-partition interrupts use the same packing scheme.
52 */
53#define XPC_NASID_W_INDEX(_n) (((_n) / 64) / 2)
54#define XPC_NASID_B_INDEX(_n) (((_n) / 2) & (64 - 1))
55#define XPC_NASID_IN_ARRAY(_n, _p) ((_p)[XPC_NASID_W_INDEX(_n)] & \
56 (1UL << XPC_NASID_B_INDEX(_n)))
57#define XPC_NASID_FROM_W_B(_w, _b) (((_w) * 64 + (_b)) * 2)
58
59#define XPC_HB_DEFAULT_INTERVAL 5 /* incr HB every x secs */
60#define XPC_HB_CHECK_DEFAULT_INTERVAL 20 /* check HB every x secs */
61
62/* define the process name of HB checker and the CPU it is pinned to */
63#define XPC_HB_CHECK_THREAD_NAME "xpc_hb"
64#define XPC_HB_CHECK_CPU 0
65
66/* define the process name of the discovery thread */
67#define XPC_DISCOVERY_THREAD_NAME "xpc_discovery"
68
69
70/*
71 * the reserved page
72 *
73 * SAL reserves one page of memory per partition for XPC. Though a full page
74 * in length (16384 bytes), its starting address is not page aligned, but it
75 * is cacheline aligned. The reserved page consists of the following:
76 *
77 * reserved page header
78 *
79 * The first cacheline of the reserved page contains the header
80 * (struct xpc_rsvd_page). Before SAL initialization has completed,
81 * SAL has set up the following fields of the reserved page header:
82 * SAL_signature, SAL_version, partid, and nasids_size. The other
83 * fields are set up by XPC. (xpc_rsvd_page points to the local
84 * partition's reserved page.)
85 *
86 * part_nasids mask
87 * mach_nasids mask
88 *
89 * SAL also sets up two bitmaps (or masks), one that reflects the actual
90 * nasids in this partition (part_nasids), and the other that reflects
91 * the actual nasids in the entire machine (mach_nasids). We're only
92 * interested in the even numbered nasids (which contain the processors
93 * and/or memory), so we only need half as many bits to represent the
94 * nasids. The part_nasids mask is located starting at the first cacheline
95 * following the reserved page header. The mach_nasids mask follows right
96 * after the part_nasids mask. The size in bytes of each mask is reflected
97 * by the reserved page header field 'nasids_size'. (Local partition's
98 * mask pointers are xpc_part_nasids and xpc_mach_nasids.)
99 *
100 * vars
101 * vars part
102 *
103 * Immediately following the mach_nasids mask are the XPC variables
104 * required by other partitions. First are those that are generic to all
105 * partitions (vars), followed on the next available cacheline by those
106 * which are partition specific (vars part). These are setup by XPC.
107 * (Local partition's vars pointers are xpc_vars and xpc_vars_part.)
108 *
109 * Note: Until vars_pa is set, the partition XPC code has not been initialized.
110 */
111struct xpc_rsvd_page {
112 u64 SAL_signature; /* SAL: unique signature */
113 u64 SAL_version; /* SAL: version */
114 u8 partid; /* SAL: partition ID */
115 u8 version;
116 u8 pad1[6]; /* align to next u64 in cacheline */
117 volatile u64 vars_pa;
118 struct timespec stamp; /* time when reserved page was setup by XPC */
119 u64 pad2[9]; /* align to last u64 in cacheline */
120 u64 nasids_size; /* SAL: size of each nasid mask in bytes */
121};
122
123#define XPC_RP_VERSION _XPC_VERSION(1,1) /* version 1.1 of the reserved page */
124
125#define XPC_SUPPORTS_RP_STAMP(_version) \
126 (_version >= _XPC_VERSION(1,1))
127
128/*
129 * compare stamps - the return value is:
130 *
131 * < 0, if stamp1 < stamp2
132 * = 0, if stamp1 == stamp2
133 * > 0, if stamp1 > stamp2
134 */
135static inline int
136xpc_compare_stamps(struct timespec *stamp1, struct timespec *stamp2)
137{
138 int ret;
139
140
141 if ((ret = stamp1->tv_sec - stamp2->tv_sec) == 0) {
142 ret = stamp1->tv_nsec - stamp2->tv_nsec;
143 }
144 return ret;
145}
146
147
148/*
149 * Define the structures by which XPC variables can be exported to other
150 * partitions. (There are two: struct xpc_vars and struct xpc_vars_part)
151 */
152
153/*
154 * The following structure describes the partition generic variables
155 * needed by other partitions in order to properly initialize.
156 *
157 * struct xpc_vars version number also applies to struct xpc_vars_part.
158 * Changes to either structure and/or related functionality should be
159 * reflected by incrementing either the major or minor version numbers
160 * of struct xpc_vars.
161 */
162struct xpc_vars {
163 u8 version;
164 u64 heartbeat;
165 u64 heartbeating_to_mask;
166 u64 heartbeat_offline; /* if 0, heartbeat should be changing */
167 int act_nasid;
168 int act_phys_cpuid;
169 u64 vars_part_pa;
170 u64 amos_page_pa; /* paddr of page of AMOs from MSPEC driver */
171 AMO_t *amos_page; /* vaddr of page of AMOs from MSPEC driver */
172};
173
174#define XPC_V_VERSION _XPC_VERSION(3,1) /* version 3.1 of the cross vars */
175
176#define XPC_SUPPORTS_DISENGAGE_REQUEST(_version) \
177 (_version >= _XPC_VERSION(3,1))
178
179
180static inline int
181xpc_hb_allowed(partid_t partid, struct xpc_vars *vars)
182{
183 return ((vars->heartbeating_to_mask & (1UL << partid)) != 0);
184}
185
186static inline void
187xpc_allow_hb(partid_t partid, struct xpc_vars *vars)
188{
189 u64 old_mask, new_mask;
190
191 do {
192 old_mask = vars->heartbeating_to_mask;
193 new_mask = (old_mask | (1UL << partid));
194 } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
195 old_mask);
196}
197
198static inline void
199xpc_disallow_hb(partid_t partid, struct xpc_vars *vars)
200{
201 u64 old_mask, new_mask;
202
203 do {
204 old_mask = vars->heartbeating_to_mask;
205 new_mask = (old_mask & ~(1UL << partid));
206 } while (cmpxchg(&vars->heartbeating_to_mask, old_mask, new_mask) !=
207 old_mask);
208}
209
210
211/*
212 * The AMOs page consists of a number of AMO variables which are divided into
213 * four groups, The first two groups are used to identify an IRQ's sender.
214 * These two groups consist of 64 and 128 AMO variables respectively. The last
215 * two groups, consisting of just one AMO variable each, are used to identify
216 * the remote partitions that are currently engaged (from the viewpoint of
217 * the XPC running on the remote partition).
218 */
219#define XPC_NOTIFY_IRQ_AMOS 0
220#define XPC_ACTIVATE_IRQ_AMOS (XPC_NOTIFY_IRQ_AMOS + XP_MAX_PARTITIONS)
221#define XPC_ENGAGED_PARTITIONS_AMO (XPC_ACTIVATE_IRQ_AMOS + XP_NASID_MASK_WORDS)
222#define XPC_DISENGAGE_REQUEST_AMO (XPC_ENGAGED_PARTITIONS_AMO + 1)
223
224
225/*
226 * The following structure describes the per partition specific variables.
227 *
228 * An array of these structures, one per partition, will be defined. As a
229 * partition becomes active XPC will copy the array entry corresponding to
230 * itself from that partition. It is desirable that the size of this
231 * structure evenly divide into a cacheline, such that none of the entries
232 * in this array crosses a cacheline boundary. As it is now, each entry
233 * occupies half a cacheline.
234 */
235struct xpc_vars_part {
236 volatile u64 magic;
237
238 u64 openclose_args_pa; /* physical address of open and close args */
239 u64 GPs_pa; /* physical address of Get/Put values */
240
241 u64 IPI_amo_pa; /* physical address of IPI AMO_t structure */
242 int IPI_nasid; /* nasid of where to send IPIs */
243 int IPI_phys_cpuid; /* physical CPU ID of where to send IPIs */
244
245 u8 nchannels; /* #of defined channels supported */
246
247 u8 reserved[23]; /* pad to a full 64 bytes */
248};
249
250/*
251 * The vars_part MAGIC numbers play a part in the first contact protocol.
252 *
253 * MAGIC1 indicates that the per partition specific variables for a remote
254 * partition have been initialized by this partition.
255 *
256 * MAGIC2 indicates that this partition has pulled the remote partititions
257 * per partition variables that pertain to this partition.
258 */
259#define XPC_VP_MAGIC1 0x0053524156435058L /* 'XPCVARS\0'L (little endian) */
260#define XPC_VP_MAGIC2 0x0073726176435058L /* 'XPCvars\0'L (little endian) */
261
262
263/* the reserved page sizes and offsets */
264
265#define XPC_RP_HEADER_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_rsvd_page))
266#define XPC_RP_VARS_SIZE L1_CACHE_ALIGN(sizeof(struct xpc_vars))
267
268#define XPC_RP_PART_NASIDS(_rp) (u64 *) ((u8 *) _rp + XPC_RP_HEADER_SIZE)
269#define XPC_RP_MACH_NASIDS(_rp) (XPC_RP_PART_NASIDS(_rp) + xp_nasid_mask_words)
270#define XPC_RP_VARS(_rp) ((struct xpc_vars *) XPC_RP_MACH_NASIDS(_rp) + xp_nasid_mask_words)
271#define XPC_RP_VARS_PART(_rp) (struct xpc_vars_part *) ((u8 *) XPC_RP_VARS(rp) + XPC_RP_VARS_SIZE)
272
273
274/*
275 * Functions registered by add_timer() or called by kernel_thread() only
276 * allow for a single 64-bit argument. The following macros can be used to
277 * pack and unpack two (32-bit, 16-bit or 8-bit) arguments into or out from
278 * the passed argument.
279 */
280#define XPC_PACK_ARGS(_arg1, _arg2) \
281 ((((u64) _arg1) & 0xffffffff) | \
282 ((((u64) _arg2) & 0xffffffff) << 32))
283
284#define XPC_UNPACK_ARG1(_args) (((u64) _args) & 0xffffffff)
285#define XPC_UNPACK_ARG2(_args) ((((u64) _args) >> 32) & 0xffffffff)
286
287
288
289/*
290 * Define a Get/Put value pair (pointers) used with a message queue.
291 */
292struct xpc_gp {
293 volatile s64 get; /* Get value */
294 volatile s64 put; /* Put value */
295};
296
297#define XPC_GP_SIZE \
298 L1_CACHE_ALIGN(sizeof(struct xpc_gp) * XPC_NCHANNELS)
299
300
301
302/*
303 * Define a structure that contains arguments associated with opening and
304 * closing a channel.
305 */
306struct xpc_openclose_args {
307 u16 reason; /* reason why channel is closing */
308 u16 msg_size; /* sizeof each message entry */
309 u16 remote_nentries; /* #of message entries in remote msg queue */
310 u16 local_nentries; /* #of message entries in local msg queue */
311 u64 local_msgqueue_pa; /* physical address of local message queue */
312};
313
314#define XPC_OPENCLOSE_ARGS_SIZE \
315 L1_CACHE_ALIGN(sizeof(struct xpc_openclose_args) * XPC_NCHANNELS)
316
317
318
319/* struct xpc_msg flags */
320
321#define XPC_M_DONE 0x01 /* msg has been received/consumed */
322#define XPC_M_READY 0x02 /* msg is ready to be sent */
323#define XPC_M_INTERRUPT 0x04 /* send interrupt when msg consumed */
324
325
326#define XPC_MSG_ADDRESS(_payload) \
327 ((struct xpc_msg *)((u8 *)(_payload) - XPC_MSG_PAYLOAD_OFFSET))
328
329
330
331/*
332 * Defines notify entry.
333 *
334 * This is used to notify a message's sender that their message was received
335 * and consumed by the intended recipient.
336 */
337struct xpc_notify {
338 struct semaphore sema; /* notify semaphore */
339 volatile u8 type; /* type of notification */
340
341 /* the following two fields are only used if type == XPC_N_CALL */
342 xpc_notify_func func; /* user's notify function */
343 void *key; /* pointer to user's key */
344};
345
346/* struct xpc_notify type of notification */
347
348#define XPC_N_CALL 0x01 /* notify function provided by user */
349
350
351
352/*
353 * Define the structure that manages all the stuff required by a channel. In
354 * particular, they are used to manage the messages sent across the channel.
355 *
356 * This structure is private to a partition, and is NOT shared across the
357 * partition boundary.
358 *
359 * There is an array of these structures for each remote partition. It is
360 * allocated at the time a partition becomes active. The array contains one
361 * of these structures for each potential channel connection to that partition.
362 *
363 * Each of these structures manages two message queues (circular buffers).
364 * They are allocated at the time a channel connection is made. One of
365 * these message queues (local_msgqueue) holds the locally created messages
366 * that are destined for the remote partition. The other of these message
367 * queues (remote_msgqueue) is a locally cached copy of the remote partition's
368 * own local_msgqueue.
369 *
370 * The following is a description of the Get/Put pointers used to manage these
371 * two message queues. Consider the local_msgqueue to be on one partition
372 * and the remote_msgqueue to be its cached copy on another partition. A
373 * description of what each of the lettered areas contains is included.
374 *
375 *
376 * local_msgqueue remote_msgqueue
377 *
378 * |/////////| |/////////|
379 * w_remote_GP.get --> +---------+ |/////////|
380 * | F | |/////////|
381 * remote_GP.get --> +---------+ +---------+ <-- local_GP->get
382 * | | | |
383 * | | | E |
384 * | | | |
385 * | | +---------+ <-- w_local_GP.get
386 * | B | |/////////|
387 * | | |////D////|
388 * | | |/////////|
389 * | | +---------+ <-- w_remote_GP.put
390 * | | |////C////|
391 * local_GP->put --> +---------+ +---------+ <-- remote_GP.put
392 * | | |/////////|
393 * | A | |/////////|
394 * | | |/////////|
395 * w_local_GP.put --> +---------+ |/////////|
396 * |/////////| |/////////|
397 *
398 *
399 * ( remote_GP.[get|put] are cached copies of the remote
400 * partition's local_GP->[get|put], and thus their values can
401 * lag behind their counterparts on the remote partition. )
402 *
403 *
404 * A - Messages that have been allocated, but have not yet been sent to the
405 * remote partition.
406 *
407 * B - Messages that have been sent, but have not yet been acknowledged by the
408 * remote partition as having been received.
409 *
410 * C - Area that needs to be prepared for the copying of sent messages, by
411 * the clearing of the message flags of any previously received messages.
412 *
413 * D - Area into which sent messages are to be copied from the remote
414 * partition's local_msgqueue and then delivered to their intended
415 * recipients. [ To allow for a multi-message copy, another pointer
416 * (next_msg_to_pull) has been added to keep track of the next message
417 * number needing to be copied (pulled). It chases after w_remote_GP.put.
418 * Any messages lying between w_local_GP.get and next_msg_to_pull have
419 * been copied and are ready to be delivered. ]
420 *
421 * E - Messages that have been copied and delivered, but have not yet been
422 * acknowledged by the recipient as having been received.
423 *
424 * F - Messages that have been acknowledged, but XPC has not yet notified the
425 * sender that the message was received by its intended recipient.
426 * This is also an area that needs to be prepared for the allocating of
427 * new messages, by the clearing of the message flags of the acknowledged
428 * messages.
429 */
430struct xpc_channel {
431 partid_t partid; /* ID of remote partition connected */
432 spinlock_t lock; /* lock for updating this structure */
433 u32 flags; /* general flags */
434
435 enum xpc_retval reason; /* reason why channel is disconnect'g */
436 int reason_line; /* line# disconnect initiated from */
437
438 u16 number; /* channel # */
439
440 u16 msg_size; /* sizeof each msg entry */
441 u16 local_nentries; /* #of msg entries in local msg queue */
442 u16 remote_nentries; /* #of msg entries in remote msg queue*/
443
444 void *local_msgqueue_base; /* base address of kmalloc'd space */
445 struct xpc_msg *local_msgqueue; /* local message queue */
446 void *remote_msgqueue_base; /* base address of kmalloc'd space */
447 struct xpc_msg *remote_msgqueue;/* cached copy of remote partition's */
448 /* local message queue */
449 u64 remote_msgqueue_pa; /* phys addr of remote partition's */
450 /* local message queue */
451
452 atomic_t references; /* #of external references to queues */
453
454 atomic_t n_on_msg_allocate_wq; /* #on msg allocation wait queue */
455 wait_queue_head_t msg_allocate_wq; /* msg allocation wait queue */
456
457 u8 delayed_IPI_flags; /* IPI flags received, but delayed */
458 /* action until channel disconnected */
459
460 /* queue of msg senders who want to be notified when msg received */
461
462 atomic_t n_to_notify; /* #of msg senders to notify */
463 struct xpc_notify *notify_queue;/* notify queue for messages sent */
464
465 xpc_channel_func func; /* user's channel function */
466 void *key; /* pointer to user's key */
467
468 struct semaphore msg_to_pull_sema; /* next msg to pull serialization */
469 struct semaphore wdisconnect_sema; /* wait for channel disconnect */
470
471 struct xpc_openclose_args *local_openclose_args; /* args passed on */
472 /* opening or closing of channel */
473
474 /* various flavors of local and remote Get/Put values */
475
476 struct xpc_gp *local_GP; /* local Get/Put values */
477 struct xpc_gp remote_GP; /* remote Get/Put values */
478 struct xpc_gp w_local_GP; /* working local Get/Put values */
479 struct xpc_gp w_remote_GP; /* working remote Get/Put values */
480 s64 next_msg_to_pull; /* Put value of next msg to pull */
481
482 /* kthread management related fields */
483
484// >>> rethink having kthreads_assigned_limit and kthreads_idle_limit; perhaps
485// >>> allow the assigned limit be unbounded and let the idle limit be dynamic
486// >>> dependent on activity over the last interval of time
487 atomic_t kthreads_assigned; /* #of kthreads assigned to channel */
488 u32 kthreads_assigned_limit; /* limit on #of kthreads assigned */
489 atomic_t kthreads_idle; /* #of kthreads idle waiting for work */
490 u32 kthreads_idle_limit; /* limit on #of kthreads idle */
491 atomic_t kthreads_active; /* #of kthreads actively working */
492 // >>> following field is temporary
493 u32 kthreads_created; /* total #of kthreads created */
494
495 wait_queue_head_t idle_wq; /* idle kthread wait queue */
496
497} ____cacheline_aligned;
498
499
500/* struct xpc_channel flags */
501
502#define XPC_C_WASCONNECTED 0x00000001 /* channel was connected */
503
504#define XPC_C_ROPENREPLY 0x00000002 /* remote open channel reply */
505#define XPC_C_OPENREPLY 0x00000004 /* local open channel reply */
506#define XPC_C_ROPENREQUEST 0x00000008 /* remote open channel request */
507#define XPC_C_OPENREQUEST 0x00000010 /* local open channel request */
508
509#define XPC_C_SETUP 0x00000020 /* channel's msgqueues are alloc'd */
510#define XPC_C_CONNECTCALLOUT 0x00000040 /* channel connected callout made */
511#define XPC_C_CONNECTED 0x00000080 /* local channel is connected */
512#define XPC_C_CONNECTING 0x00000100 /* channel is being connected */
513
514#define XPC_C_RCLOSEREPLY 0x00000200 /* remote close channel reply */
515#define XPC_C_CLOSEREPLY 0x00000400 /* local close channel reply */
516#define XPC_C_RCLOSEREQUEST 0x00000800 /* remote close channel request */
517#define XPC_C_CLOSEREQUEST 0x00001000 /* local close channel request */
518
519#define XPC_C_DISCONNECTED 0x00002000 /* channel is disconnected */
520#define XPC_C_DISCONNECTING 0x00004000 /* channel is being disconnected */
521#define XPC_C_DISCONNECTCALLOUT 0x00008000 /* chan disconnected callout made */
522#define XPC_C_WDISCONNECT 0x00010000 /* waiting for channel disconnect */
523
524
525
526/*
527 * Manages channels on a partition basis. There is one of these structures
528 * for each partition (a partition will never utilize the structure that
529 * represents itself).
530 */
531struct xpc_partition {
532
533 /* XPC HB infrastructure */
534
535 u8 remote_rp_version; /* version# of partition's rsvd pg */
536 struct timespec remote_rp_stamp;/* time when rsvd pg was initialized */
537 u64 remote_rp_pa; /* phys addr of partition's rsvd pg */
538 u64 remote_vars_pa; /* phys addr of partition's vars */
539 u64 remote_vars_part_pa; /* phys addr of partition's vars part */
540 u64 last_heartbeat; /* HB at last read */
541 u64 remote_amos_page_pa; /* phys addr of partition's amos page */
542 int remote_act_nasid; /* active part's act/deact nasid */
543 int remote_act_phys_cpuid; /* active part's act/deact phys cpuid */
544 u32 act_IRQ_rcvd; /* IRQs since activation */
545 spinlock_t act_lock; /* protect updating of act_state */
546 u8 act_state; /* from XPC HB viewpoint */
547 u8 remote_vars_version; /* version# of partition's vars */
548 enum xpc_retval reason; /* reason partition is deactivating */
549 int reason_line; /* line# deactivation initiated from */
550 int reactivate_nasid; /* nasid in partition to reactivate */
551
552 unsigned long disengage_request_timeout; /* timeout in jiffies */
553 struct timer_list disengage_request_timer;
554
555
556 /* XPC infrastructure referencing and teardown control */
557
558 volatile u8 setup_state; /* infrastructure setup state */
559 wait_queue_head_t teardown_wq; /* kthread waiting to teardown infra */
560 atomic_t references; /* #of references to infrastructure */
561
562
563 /*
564 * NONE OF THE PRECEDING FIELDS OF THIS STRUCTURE WILL BE CLEARED WHEN
565 * XPC SETS UP THE NECESSARY INFRASTRUCTURE TO SUPPORT CROSS PARTITION
566 * COMMUNICATION. ALL OF THE FOLLOWING FIELDS WILL BE CLEARED. (THE
567 * 'nchannels' FIELD MUST BE THE FIRST OF THE FIELDS TO BE CLEARED.)
568 */
569
570
571 u8 nchannels; /* #of defined channels supported */
572 atomic_t nchannels_active; /* #of channels that are not DISCONNECTED */
573 atomic_t nchannels_engaged;/* #of channels engaged with remote part */
574 struct xpc_channel *channels;/* array of channel structures */
575
576 void *local_GPs_base; /* base address of kmalloc'd space */
577 struct xpc_gp *local_GPs; /* local Get/Put values */
578 void *remote_GPs_base; /* base address of kmalloc'd space */
579 struct xpc_gp *remote_GPs;/* copy of remote partition's local Get/Put */
580 /* values */
581 u64 remote_GPs_pa; /* phys address of remote partition's local */
582 /* Get/Put values */
583
584
585 /* fields used to pass args when opening or closing a channel */
586
587 void *local_openclose_args_base; /* base address of kmalloc'd space */
588 struct xpc_openclose_args *local_openclose_args; /* local's args */
589 void *remote_openclose_args_base; /* base address of kmalloc'd space */
590 struct xpc_openclose_args *remote_openclose_args; /* copy of remote's */
591 /* args */
592 u64 remote_openclose_args_pa; /* phys addr of remote's args */
593
594
595 /* IPI sending, receiving and handling related fields */
596
597 int remote_IPI_nasid; /* nasid of where to send IPIs */
598 int remote_IPI_phys_cpuid; /* phys CPU ID of where to send IPIs */
599 AMO_t *remote_IPI_amo_va; /* address of remote IPI AMO_t structure */
600
601 AMO_t *local_IPI_amo_va; /* address of IPI AMO_t structure */
602 u64 local_IPI_amo; /* IPI amo flags yet to be handled */
603 char IPI_owner[8]; /* IPI owner's name */
604 struct timer_list dropped_IPI_timer; /* dropped IPI timer */
605
606 spinlock_t IPI_lock; /* IPI handler lock */
607
608
609 /* channel manager related fields */
610
611 atomic_t channel_mgr_requests; /* #of requests to activate chan mgr */
612 wait_queue_head_t channel_mgr_wq; /* channel mgr's wait queue */
613
614} ____cacheline_aligned;
615
616
617/* struct xpc_partition act_state values (for XPC HB) */
618
619#define XPC_P_INACTIVE 0x00 /* partition is not active */
620#define XPC_P_ACTIVATION_REQ 0x01 /* created thread to activate */
621#define XPC_P_ACTIVATING 0x02 /* activation thread started */
622#define XPC_P_ACTIVE 0x03 /* xpc_partition_up() was called */
623#define XPC_P_DEACTIVATING 0x04 /* partition deactivation initiated */
624
625
626#define XPC_DEACTIVATE_PARTITION(_p, _reason) \
627 xpc_deactivate_partition(__LINE__, (_p), (_reason))
628
629
630/* struct xpc_partition setup_state values */
631
632#define XPC_P_UNSET 0x00 /* infrastructure was never setup */
633#define XPC_P_SETUP 0x01 /* infrastructure is setup */
634#define XPC_P_WTEARDOWN 0x02 /* waiting to teardown infrastructure */
635#define XPC_P_TORNDOWN 0x03 /* infrastructure is torndown */
636
637
638
639/*
640 * struct xpc_partition IPI_timer #of seconds to wait before checking for
641 * dropped IPIs. These occur whenever an IPI amo write doesn't complete until
642 * after the IPI was received.
643 */
644#define XPC_P_DROPPED_IPI_WAIT (0.25 * HZ)
645
646
647/* number of seconds to wait for other partitions to disengage */
648#define XPC_DISENGAGE_REQUEST_DEFAULT_TIMELIMIT 90
649
650/* interval in seconds to print 'waiting disengagement' messages */
651#define XPC_DISENGAGE_PRINTMSG_INTERVAL 10
652
653
654#define XPC_PARTID(_p) ((partid_t) ((_p) - &xpc_partitions[0]))
655
656
657
658/* found in xp_main.c */
659extern struct xpc_registration xpc_registrations[];
660
661
662/* found in xpc_main.c */
663extern struct device *xpc_part;
664extern struct device *xpc_chan;
665extern int xpc_disengage_request_timelimit;
666extern irqreturn_t xpc_notify_IRQ_handler(int, void *, struct pt_regs *);
667extern void xpc_dropped_IPI_check(struct xpc_partition *);
668extern void xpc_activate_partition(struct xpc_partition *);
669extern void xpc_activate_kthreads(struct xpc_channel *, int);
670extern void xpc_create_kthreads(struct xpc_channel *, int);
671extern void xpc_disconnect_wait(int);
672
673
674/* found in xpc_partition.c */
675extern int xpc_exiting;
676extern struct xpc_vars *xpc_vars;
677extern struct xpc_rsvd_page *xpc_rsvd_page;
678extern struct xpc_vars_part *xpc_vars_part;
679extern struct xpc_partition xpc_partitions[XP_MAX_PARTITIONS + 1];
680extern char xpc_remote_copy_buffer[];
681extern struct xpc_rsvd_page *xpc_rsvd_page_init(void);
682extern void xpc_allow_IPI_ops(void);
683extern void xpc_restrict_IPI_ops(void);
684extern int xpc_identify_act_IRQ_sender(void);
685extern int xpc_partition_disengaged(struct xpc_partition *);
686extern enum xpc_retval xpc_mark_partition_active(struct xpc_partition *);
687extern void xpc_mark_partition_inactive(struct xpc_partition *);
688extern void xpc_discovery(void);
689extern void xpc_check_remote_hb(void);
690extern void xpc_deactivate_partition(const int, struct xpc_partition *,
691 enum xpc_retval);
692extern enum xpc_retval xpc_initiate_partid_to_nasids(partid_t, void *);
693
694
695/* found in xpc_channel.c */
696extern void xpc_initiate_connect(int);
697extern void xpc_initiate_disconnect(int);
698extern enum xpc_retval xpc_initiate_allocate(partid_t, int, u32, void **);
699extern enum xpc_retval xpc_initiate_send(partid_t, int, void *);
700extern enum xpc_retval xpc_initiate_send_notify(partid_t, int, void *,
701 xpc_notify_func, void *);
702extern void xpc_initiate_received(partid_t, int, void *);
703extern enum xpc_retval xpc_setup_infrastructure(struct xpc_partition *);
704extern enum xpc_retval xpc_pull_remote_vars_part(struct xpc_partition *);
705extern void xpc_process_channel_activity(struct xpc_partition *);
706extern void xpc_connected_callout(struct xpc_channel *);
707extern void xpc_deliver_msg(struct xpc_channel *);
708extern void xpc_disconnect_channel(const int, struct xpc_channel *,
709 enum xpc_retval, unsigned long *);
710extern void xpc_disconnecting_callout(struct xpc_channel *);
711extern void xpc_partition_going_down(struct xpc_partition *, enum xpc_retval);
712extern void xpc_teardown_infrastructure(struct xpc_partition *);
713
714
715
716static inline void
717xpc_wakeup_channel_mgr(struct xpc_partition *part)
718{
719 if (atomic_inc_return(&part->channel_mgr_requests) == 1) {
720 wake_up(&part->channel_mgr_wq);
721 }
722}
723
724
725
726/*
727 * These next two inlines are used to keep us from tearing down a channel's
728 * msg queues while a thread may be referencing them.
729 */
730static inline void
731xpc_msgqueue_ref(struct xpc_channel *ch)
732{
733 atomic_inc(&ch->references);
734}
735
736static inline void
737xpc_msgqueue_deref(struct xpc_channel *ch)
738{
739 s32 refs = atomic_dec_return(&ch->references);
740
741 DBUG_ON(refs < 0);
742 if (refs == 0) {
743 xpc_wakeup_channel_mgr(&xpc_partitions[ch->partid]);
744 }
745}
746
747
748
749#define XPC_DISCONNECT_CHANNEL(_ch, _reason, _irqflgs) \
750 xpc_disconnect_channel(__LINE__, _ch, _reason, _irqflgs)
751
752
753/*
754 * These two inlines are used to keep us from tearing down a partition's
755 * setup infrastructure while a thread may be referencing it.
756 */
757static inline void
758xpc_part_deref(struct xpc_partition *part)
759{
760 s32 refs = atomic_dec_return(&part->references);
761
762
763 DBUG_ON(refs < 0);
764 if (refs == 0 && part->setup_state == XPC_P_WTEARDOWN) {
765 wake_up(&part->teardown_wq);
766 }
767}
768
769static inline int
770xpc_part_ref(struct xpc_partition *part)
771{
772 int setup;
773
774
775 atomic_inc(&part->references);
776 setup = (part->setup_state == XPC_P_SETUP);
777 if (!setup) {
778 xpc_part_deref(part);
779 }
780 return setup;
781}
782
783
784
785/*
786 * The following macro is to be used for the setting of the reason and
787 * reason_line fields in both the struct xpc_channel and struct xpc_partition
788 * structures.
789 */
790#define XPC_SET_REASON(_p, _reason, _line) \
791 { \
792 (_p)->reason = _reason; \
793 (_p)->reason_line = _line; \
794 }
795
796
797
798/*
799 * This next set of inlines are used to keep track of when a partition is
800 * potentially engaged in accessing memory belonging to another partition.
801 */
802
803static inline void
804xpc_mark_partition_engaged(struct xpc_partition *part)
805{
806 unsigned long irq_flags;
807 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
808 (XPC_ENGAGED_PARTITIONS_AMO * sizeof(AMO_t)));
809
810
811 local_irq_save(irq_flags);
812
813 /* set bit corresponding to our partid in remote partition's AMO */
814 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_OR,
815 (1UL << sn_partition_id));
816 /*
817 * We must always use the nofault function regardless of whether we
818 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
819 * didn't, we'd never know that the other partition is down and would
820 * keep sending IPIs and AMOs to it until the heartbeat times out.
821 */
822 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
823 variable), xp_nofault_PIOR_target));
824
825 local_irq_restore(irq_flags);
826}
827
828static inline void
829xpc_mark_partition_disengaged(struct xpc_partition *part)
830{
831 unsigned long irq_flags;
832 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
833 (XPC_ENGAGED_PARTITIONS_AMO * sizeof(AMO_t)));
834
835
836 local_irq_save(irq_flags);
837
838 /* clear bit corresponding to our partid in remote partition's AMO */
839 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
840 ~(1UL << sn_partition_id));
841 /*
842 * We must always use the nofault function regardless of whether we
843 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
844 * didn't, we'd never know that the other partition is down and would
845 * keep sending IPIs and AMOs to it until the heartbeat times out.
846 */
847 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
848 variable), xp_nofault_PIOR_target));
849
850 local_irq_restore(irq_flags);
851}
852
853static inline void
854xpc_request_partition_disengage(struct xpc_partition *part)
855{
856 unsigned long irq_flags;
857 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
858 (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
859
860
861 local_irq_save(irq_flags);
862
863 /* set bit corresponding to our partid in remote partition's AMO */
864 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_OR,
865 (1UL << sn_partition_id));
866 /*
867 * We must always use the nofault function regardless of whether we
868 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
869 * didn't, we'd never know that the other partition is down and would
870 * keep sending IPIs and AMOs to it until the heartbeat times out.
871 */
872 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
873 variable), xp_nofault_PIOR_target));
874
875 local_irq_restore(irq_flags);
876}
877
878static inline void
879xpc_cancel_partition_disengage_request(struct xpc_partition *part)
880{
881 unsigned long irq_flags;
882 AMO_t *amo = (AMO_t *) __va(part->remote_amos_page_pa +
883 (XPC_DISENGAGE_REQUEST_AMO * sizeof(AMO_t)));
884
885
886 local_irq_save(irq_flags);
887
888 /* clear bit corresponding to our partid in remote partition's AMO */
889 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
890 ~(1UL << sn_partition_id));
891 /*
892 * We must always use the nofault function regardless of whether we
893 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
894 * didn't, we'd never know that the other partition is down and would
895 * keep sending IPIs and AMOs to it until the heartbeat times out.
896 */
897 (void) xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->
898 variable), xp_nofault_PIOR_target));
899
900 local_irq_restore(irq_flags);
901}
902
903static inline u64
904xpc_partition_engaged(u64 partid_mask)
905{
906 AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
907
908
909 /* return our partition's AMO variable ANDed with partid_mask */
910 return (FETCHOP_LOAD_OP(TO_AMO((u64) &amo->variable), FETCHOP_LOAD) &
911 partid_mask);
912}
913
914static inline u64
915xpc_partition_disengage_requested(u64 partid_mask)
916{
917 AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
918
919
920 /* return our partition's AMO variable ANDed with partid_mask */
921 return (FETCHOP_LOAD_OP(TO_AMO((u64) &amo->variable), FETCHOP_LOAD) &
922 partid_mask);
923}
924
925static inline void
926xpc_clear_partition_engaged(u64 partid_mask)
927{
928 AMO_t *amo = xpc_vars->amos_page + XPC_ENGAGED_PARTITIONS_AMO;
929
930
931 /* clear bit(s) based on partid_mask in our partition's AMO */
932 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
933 ~partid_mask);
934}
935
936static inline void
937xpc_clear_partition_disengage_request(u64 partid_mask)
938{
939 AMO_t *amo = xpc_vars->amos_page + XPC_DISENGAGE_REQUEST_AMO;
940
941
942 /* clear bit(s) based on partid_mask in our partition's AMO */
943 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_AND,
944 ~partid_mask);
945}
946
947
948
949/*
950 * The following set of macros and inlines are used for the sending and
951 * receiving of IPIs (also known as IRQs). There are two flavors of IPIs,
952 * one that is associated with partition activity (SGI_XPC_ACTIVATE) and
953 * the other that is associated with channel activity (SGI_XPC_NOTIFY).
954 */
955
956static inline u64
957xpc_IPI_receive(AMO_t *amo)
958{
959 return FETCHOP_LOAD_OP(TO_AMO((u64) &amo->variable), FETCHOP_CLEAR);
960}
961
962
963static inline enum xpc_retval
964xpc_IPI_send(AMO_t *amo, u64 flag, int nasid, int phys_cpuid, int vector)
965{
966 int ret = 0;
967 unsigned long irq_flags;
968
969
970 local_irq_save(irq_flags);
971
972 FETCHOP_STORE_OP(TO_AMO((u64) &amo->variable), FETCHOP_OR, flag);
973 sn_send_IPI_phys(nasid, phys_cpuid, vector, 0);
974
975 /*
976 * We must always use the nofault function regardless of whether we
977 * are on a Shub 1.1 system or a Shub 1.2 slice 0xc processor. If we
978 * didn't, we'd never know that the other partition is down and would
979 * keep sending IPIs and AMOs to it until the heartbeat times out.
980 */
981 ret = xp_nofault_PIOR((u64 *) GLOBAL_MMR_ADDR(NASID_GET(&amo->variable),
982 xp_nofault_PIOR_target));
983
984 local_irq_restore(irq_flags);
985
986 return ((ret == 0) ? xpcSuccess : xpcPioReadError);
987}
988
989
990/*
991 * IPIs associated with SGI_XPC_ACTIVATE IRQ.
992 */
993
994/*
995 * Flag the appropriate AMO variable and send an IPI to the specified node.
996 */
997static inline void
998xpc_activate_IRQ_send(u64 amos_page_pa, int from_nasid, int to_nasid,
999 int to_phys_cpuid)
1000{
1001 int w_index = XPC_NASID_W_INDEX(from_nasid);
1002 int b_index = XPC_NASID_B_INDEX(from_nasid);
1003 AMO_t *amos = (AMO_t *) __va(amos_page_pa +
1004 (XPC_ACTIVATE_IRQ_AMOS * sizeof(AMO_t)));
1005
1006
1007 (void) xpc_IPI_send(&amos[w_index], (1UL << b_index), to_nasid,
1008 to_phys_cpuid, SGI_XPC_ACTIVATE);
1009}
1010
1011static inline void
1012xpc_IPI_send_activate(struct xpc_vars *vars)
1013{
1014 xpc_activate_IRQ_send(vars->amos_page_pa, cnodeid_to_nasid(0),
1015 vars->act_nasid, vars->act_phys_cpuid);
1016}
1017
1018static inline void
1019xpc_IPI_send_activated(struct xpc_partition *part)
1020{
1021 xpc_activate_IRQ_send(part->remote_amos_page_pa, cnodeid_to_nasid(0),
1022 part->remote_act_nasid, part->remote_act_phys_cpuid);
1023}
1024
1025static inline void
1026xpc_IPI_send_reactivate(struct xpc_partition *part)
1027{
1028 xpc_activate_IRQ_send(xpc_vars->amos_page_pa, part->reactivate_nasid,
1029 xpc_vars->act_nasid, xpc_vars->act_phys_cpuid);
1030}
1031
1032static inline void
1033xpc_IPI_send_disengage(struct xpc_partition *part)
1034{
1035 xpc_activate_IRQ_send(part->remote_amos_page_pa, cnodeid_to_nasid(0),
1036 part->remote_act_nasid, part->remote_act_phys_cpuid);
1037}
1038
1039
1040/*
1041 * IPIs associated with SGI_XPC_NOTIFY IRQ.
1042 */
1043
1044/*
1045 * Send an IPI to the remote partition that is associated with the
1046 * specified channel.
1047 */
1048#define XPC_NOTIFY_IRQ_SEND(_ch, _ipi_f, _irq_f) \
1049 xpc_notify_IRQ_send(_ch, _ipi_f, #_ipi_f, _irq_f)
1050
1051static inline void
1052xpc_notify_IRQ_send(struct xpc_channel *ch, u8 ipi_flag, char *ipi_flag_string,
1053 unsigned long *irq_flags)
1054{
1055 struct xpc_partition *part = &xpc_partitions[ch->partid];
1056 enum xpc_retval ret;
1057
1058
1059 if (likely(part->act_state != XPC_P_DEACTIVATING)) {
1060 ret = xpc_IPI_send(part->remote_IPI_amo_va,
1061 (u64) ipi_flag << (ch->number * 8),
1062 part->remote_IPI_nasid,
1063 part->remote_IPI_phys_cpuid,
1064 SGI_XPC_NOTIFY);
1065 dev_dbg(xpc_chan, "%s sent to partid=%d, channel=%d, ret=%d\n",
1066 ipi_flag_string, ch->partid, ch->number, ret);
1067 if (unlikely(ret != xpcSuccess)) {
1068 if (irq_flags != NULL) {
1069 spin_unlock_irqrestore(&ch->lock, *irq_flags);
1070 }
1071 XPC_DEACTIVATE_PARTITION(part, ret);
1072 if (irq_flags != NULL) {
1073 spin_lock_irqsave(&ch->lock, *irq_flags);
1074 }
1075 }
1076 }
1077}
1078
1079
1080/*
1081 * Make it look like the remote partition, which is associated with the
1082 * specified channel, sent us an IPI. This faked IPI will be handled
1083 * by xpc_dropped_IPI_check().
1084 */
1085#define XPC_NOTIFY_IRQ_SEND_LOCAL(_ch, _ipi_f) \
1086 xpc_notify_IRQ_send_local(_ch, _ipi_f, #_ipi_f)
1087
1088static inline void
1089xpc_notify_IRQ_send_local(struct xpc_channel *ch, u8 ipi_flag,
1090 char *ipi_flag_string)
1091{
1092 struct xpc_partition *part = &xpc_partitions[ch->partid];
1093
1094
1095 FETCHOP_STORE_OP(TO_AMO((u64) &part->local_IPI_amo_va->variable),
1096 FETCHOP_OR, ((u64) ipi_flag << (ch->number * 8)));
1097 dev_dbg(xpc_chan, "%s sent local from partid=%d, channel=%d\n",
1098 ipi_flag_string, ch->partid, ch->number);
1099}
1100
1101
1102/*
1103 * The sending and receiving of IPIs includes the setting of an AMO variable
1104 * to indicate the reason the IPI was sent. The 64-bit variable is divided
1105 * up into eight bytes, ordered from right to left. Byte zero pertains to
1106 * channel 0, byte one to channel 1, and so on. Each byte is described by
1107 * the following IPI flags.
1108 */
1109
1110#define XPC_IPI_CLOSEREQUEST 0x01
1111#define XPC_IPI_CLOSEREPLY 0x02
1112#define XPC_IPI_OPENREQUEST 0x04
1113#define XPC_IPI_OPENREPLY 0x08
1114#define XPC_IPI_MSGREQUEST 0x10
1115
1116
1117/* given an AMO variable and a channel#, get its associated IPI flags */
1118#define XPC_GET_IPI_FLAGS(_amo, _c) ((u8) (((_amo) >> ((_c) * 8)) & 0xff))
1119#define XPC_SET_IPI_FLAGS(_amo, _c, _f) (_amo) |= ((u64) (_f) << ((_c) * 8))
1120
1121#define XPC_ANY_OPENCLOSE_IPI_FLAGS_SET(_amo) ((_amo) & 0x0f0f0f0f0f0f0f0f)
1122#define XPC_ANY_MSG_IPI_FLAGS_SET(_amo) ((_amo) & 0x1010101010101010)
1123
1124
1125static inline void
1126xpc_IPI_send_closerequest(struct xpc_channel *ch, unsigned long *irq_flags)
1127{
1128 struct xpc_openclose_args *args = ch->local_openclose_args;
1129
1130
1131 args->reason = ch->reason;
1132
1133 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_CLOSEREQUEST, irq_flags);
1134}
1135
1136static inline void
1137xpc_IPI_send_closereply(struct xpc_channel *ch, unsigned long *irq_flags)
1138{
1139 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_CLOSEREPLY, irq_flags);
1140}
1141
1142static inline void
1143xpc_IPI_send_openrequest(struct xpc_channel *ch, unsigned long *irq_flags)
1144{
1145 struct xpc_openclose_args *args = ch->local_openclose_args;
1146
1147
1148 args->msg_size = ch->msg_size;
1149 args->local_nentries = ch->local_nentries;
1150
1151 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_OPENREQUEST, irq_flags);
1152}
1153
1154static inline void
1155xpc_IPI_send_openreply(struct xpc_channel *ch, unsigned long *irq_flags)
1156{
1157 struct xpc_openclose_args *args = ch->local_openclose_args;
1158
1159
1160 args->remote_nentries = ch->remote_nentries;
1161 args->local_nentries = ch->local_nentries;
1162 args->local_msgqueue_pa = __pa(ch->local_msgqueue);
1163
1164 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_OPENREPLY, irq_flags);
1165}
1166
1167static inline void
1168xpc_IPI_send_msgrequest(struct xpc_channel *ch)
1169{
1170 XPC_NOTIFY_IRQ_SEND(ch, XPC_IPI_MSGREQUEST, NULL);
1171}
1172
1173static inline void
1174xpc_IPI_send_local_msgrequest(struct xpc_channel *ch)
1175{
1176 XPC_NOTIFY_IRQ_SEND_LOCAL(ch, XPC_IPI_MSGREQUEST);
1177}
1178
1179
1180/*
1181 * Memory for XPC's AMO variables is allocated by the MSPEC driver. These
1182 * pages are located in the lowest granule. The lowest granule uses 4k pages
1183 * for cached references and an alternate TLB handler to never provide a
1184 * cacheable mapping for the entire region. This will prevent speculative
1185 * reading of cached copies of our lines from being issued which will cause
1186 * a PI FSB Protocol error to be generated by the SHUB. For XPC, we need 64
1187 * AMO variables (based on XP_MAX_PARTITIONS) for message notification and an
1188 * additional 128 AMO variables (based on XP_NASID_MASK_WORDS) for partition
1189 * activation and 2 AMO variables for partition deactivation.
1190 */
1191static inline AMO_t *
1192xpc_IPI_init(int index)
1193{
1194 AMO_t *amo = xpc_vars->amos_page + index;
1195
1196
1197 (void) xpc_IPI_receive(amo); /* clear AMO variable */
1198 return amo;
1199}
1200
1201
1202
1203static inline enum xpc_retval
1204xpc_map_bte_errors(bte_result_t error)
1205{
1206 switch (error) {
1207 case BTE_SUCCESS: return xpcSuccess;
1208 case BTEFAIL_DIR: return xpcBteDirectoryError;
1209 case BTEFAIL_POISON: return xpcBtePoisonError;
1210 case BTEFAIL_WERR: return xpcBteWriteError;
1211 case BTEFAIL_ACCESS: return xpcBteAccessError;
1212 case BTEFAIL_PWERR: return xpcBtePWriteError;
1213 case BTEFAIL_PRERR: return xpcBtePReadError;
1214 case BTEFAIL_TOUT: return xpcBteTimeOutError;
1215 case BTEFAIL_XTERR: return xpcBteXtalkError;
1216 case BTEFAIL_NOTAVAIL: return xpcBteNotAvailable;
1217 default: return xpcBteUnmappedError;
1218 }
1219}
1220
1221
1222
1223static inline void *
1224xpc_kmalloc_cacheline_aligned(size_t size, gfp_t flags, void **base)
1225{
1226 /* see if kmalloc will give us cachline aligned memory by default */
1227 *base = kmalloc(size, flags);
1228 if (*base == NULL) {
1229 return NULL;
1230 }
1231 if ((u64) *base == L1_CACHE_ALIGN((u64) *base)) {
1232 return *base;
1233 }
1234 kfree(*base);
1235
1236 /* nope, we'll have to do it ourselves */
1237 *base = kmalloc(size + L1_CACHE_BYTES, flags);
1238 if (*base == NULL) {
1239 return NULL;
1240 }
1241 return (void *) L1_CACHE_ALIGN((u64) *base);
1242}
1243
1244
1245/*
1246 * Check to see if there is any channel activity to/from the specified
1247 * partition.
1248 */
1249static inline void
1250xpc_check_for_channel_activity(struct xpc_partition *part)
1251{
1252 u64 IPI_amo;
1253 unsigned long irq_flags;
1254
1255
1256 IPI_amo = xpc_IPI_receive(part->local_IPI_amo_va);
1257 if (IPI_amo == 0) {
1258 return;
1259 }
1260
1261 spin_lock_irqsave(&part->IPI_lock, irq_flags);
1262 part->local_IPI_amo |= IPI_amo;
1263 spin_unlock_irqrestore(&part->IPI_lock, irq_flags);
1264
1265 dev_dbg(xpc_chan, "received IPI from partid=%d, IPI_amo=0x%lx\n",
1266 XPC_PARTID(part), IPI_amo);
1267
1268 xpc_wakeup_channel_mgr(part);
1269}
1270
1271
1272#endif /* _IA64_SN_KERNEL_XPC_H */
1273
diff --git a/arch/ia64/sn/kernel/xpc_channel.c b/arch/ia64/sn/kernel/xpc_channel.c
index abf4fc2a87bb..8d950c778bb6 100644
--- a/arch/ia64/sn/kernel/xpc_channel.c
+++ b/arch/ia64/sn/kernel/xpc_channel.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2004-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -22,9 +22,11 @@
22#include <linux/cache.h> 22#include <linux/cache.h>
23#include <linux/interrupt.h> 23#include <linux/interrupt.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/mutex.h>
26#include <linux/completion.h>
25#include <asm/sn/bte.h> 27#include <asm/sn/bte.h>
26#include <asm/sn/sn_sal.h> 28#include <asm/sn/sn_sal.h>
27#include "xpc.h" 29#include <asm/sn/xpc.h>
28 30
29 31
30/* 32/*
@@ -56,8 +58,8 @@ xpc_initialize_channels(struct xpc_partition *part, partid_t partid)
56 atomic_set(&ch->n_to_notify, 0); 58 atomic_set(&ch->n_to_notify, 0);
57 59
58 spin_lock_init(&ch->lock); 60 spin_lock_init(&ch->lock);
59 sema_init(&ch->msg_to_pull_sema, 1); /* mutex */ 61 mutex_init(&ch->msg_to_pull_mutex);
60 sema_init(&ch->wdisconnect_sema, 0); /* event wait */ 62 init_completion(&ch->wdisconnect_wait);
61 63
62 atomic_set(&ch->n_on_msg_allocate_wq, 0); 64 atomic_set(&ch->n_on_msg_allocate_wq, 0);
63 init_waitqueue_head(&ch->msg_allocate_wq); 65 init_waitqueue_head(&ch->msg_allocate_wq);
@@ -534,7 +536,6 @@ static enum xpc_retval
534xpc_allocate_msgqueues(struct xpc_channel *ch) 536xpc_allocate_msgqueues(struct xpc_channel *ch)
535{ 537{
536 unsigned long irq_flags; 538 unsigned long irq_flags;
537 int i;
538 enum xpc_retval ret; 539 enum xpc_retval ret;
539 540
540 541
@@ -552,11 +553,6 @@ xpc_allocate_msgqueues(struct xpc_channel *ch)
552 return ret; 553 return ret;
553 } 554 }
554 555
555 for (i = 0; i < ch->local_nentries; i++) {
556 /* use a semaphore as an event wait queue */
557 sema_init(&ch->notify_queue[i].sema, 0);
558 }
559
560 spin_lock_irqsave(&ch->lock, irq_flags); 556 spin_lock_irqsave(&ch->lock, irq_flags);
561 ch->flags |= XPC_C_SETUP; 557 ch->flags |= XPC_C_SETUP;
562 spin_unlock_irqrestore(&ch->lock, irq_flags); 558 spin_unlock_irqrestore(&ch->lock, irq_flags);
@@ -779,6 +775,12 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
779 775
780 /* both sides are disconnected now */ 776 /* both sides are disconnected now */
781 777
778 if (ch->flags & XPC_C_CONNECTCALLOUT) {
779 spin_unlock_irqrestore(&ch->lock, *irq_flags);
780 xpc_disconnect_callout(ch, xpcDisconnected);
781 spin_lock_irqsave(&ch->lock, *irq_flags);
782 }
783
782 /* it's now safe to free the channel's message queues */ 784 /* it's now safe to free the channel's message queues */
783 xpc_free_msgqueues(ch); 785 xpc_free_msgqueues(ch);
784 786
@@ -793,10 +795,8 @@ xpc_process_disconnect(struct xpc_channel *ch, unsigned long *irq_flags)
793 } 795 }
794 796
795 if (ch->flags & XPC_C_WDISCONNECT) { 797 if (ch->flags & XPC_C_WDISCONNECT) {
796 spin_unlock_irqrestore(&ch->lock, *irq_flags); 798 /* we won't lose the CPU since we're holding ch->lock */
797 up(&ch->wdisconnect_sema); 799 complete(&ch->wdisconnect_wait);
798 spin_lock_irqsave(&ch->lock, *irq_flags);
799
800 } else if (ch->delayed_IPI_flags) { 800 } else if (ch->delayed_IPI_flags) {
801 if (part->act_state != XPC_P_DEACTIVATING) { 801 if (part->act_state != XPC_P_DEACTIVATING) {
802 /* time to take action on any delayed IPI flags */ 802 /* time to take action on any delayed IPI flags */
@@ -1086,12 +1086,12 @@ xpc_connect_channel(struct xpc_channel *ch)
1086 struct xpc_registration *registration = &xpc_registrations[ch->number]; 1086 struct xpc_registration *registration = &xpc_registrations[ch->number];
1087 1087
1088 1088
1089 if (down_trylock(&registration->sema) != 0) { 1089 if (mutex_trylock(&registration->mutex) == 0) {
1090 return xpcRetry; 1090 return xpcRetry;
1091 } 1091 }
1092 1092
1093 if (!XPC_CHANNEL_REGISTERED(ch->number)) { 1093 if (!XPC_CHANNEL_REGISTERED(ch->number)) {
1094 up(&registration->sema); 1094 mutex_unlock(&registration->mutex);
1095 return xpcUnregistered; 1095 return xpcUnregistered;
1096 } 1096 }
1097 1097
@@ -1102,7 +1102,7 @@ xpc_connect_channel(struct xpc_channel *ch)
1102 1102
1103 if (ch->flags & XPC_C_DISCONNECTING) { 1103 if (ch->flags & XPC_C_DISCONNECTING) {
1104 spin_unlock_irqrestore(&ch->lock, irq_flags); 1104 spin_unlock_irqrestore(&ch->lock, irq_flags);
1105 up(&registration->sema); 1105 mutex_unlock(&registration->mutex);
1106 return ch->reason; 1106 return ch->reason;
1107 } 1107 }
1108 1108
@@ -1134,7 +1134,7 @@ xpc_connect_channel(struct xpc_channel *ch)
1134 * channel lock be locked and will unlock and relock 1134 * channel lock be locked and will unlock and relock
1135 * the channel lock as needed. 1135 * the channel lock as needed.
1136 */ 1136 */
1137 up(&registration->sema); 1137 mutex_unlock(&registration->mutex);
1138 XPC_DISCONNECT_CHANNEL(ch, xpcUnequalMsgSizes, 1138 XPC_DISCONNECT_CHANNEL(ch, xpcUnequalMsgSizes,
1139 &irq_flags); 1139 &irq_flags);
1140 spin_unlock_irqrestore(&ch->lock, irq_flags); 1140 spin_unlock_irqrestore(&ch->lock, irq_flags);
@@ -1149,7 +1149,7 @@ xpc_connect_channel(struct xpc_channel *ch)
1149 atomic_inc(&xpc_partitions[ch->partid].nchannels_active); 1149 atomic_inc(&xpc_partitions[ch->partid].nchannels_active);
1150 } 1150 }
1151 1151
1152 up(&registration->sema); 1152 mutex_unlock(&registration->mutex);
1153 1153
1154 1154
1155 /* initiate the connection */ 1155 /* initiate the connection */
@@ -1645,7 +1645,7 @@ xpc_disconnect_channel(const int line, struct xpc_channel *ch,
1645 1645
1646 1646
1647void 1647void
1648xpc_disconnecting_callout(struct xpc_channel *ch) 1648xpc_disconnect_callout(struct xpc_channel *ch, enum xpc_retval reason)
1649{ 1649{
1650 /* 1650 /*
1651 * Let the channel's registerer know that the channel is being 1651 * Let the channel's registerer know that the channel is being
@@ -1654,15 +1654,13 @@ xpc_disconnecting_callout(struct xpc_channel *ch)
1654 */ 1654 */
1655 1655
1656 if (ch->func != NULL) { 1656 if (ch->func != NULL) {
1657 dev_dbg(xpc_chan, "ch->func() called, reason=xpcDisconnecting," 1657 dev_dbg(xpc_chan, "ch->func() called, reason=%d, partid=%d, "
1658 " partid=%d, channel=%d\n", ch->partid, ch->number); 1658 "channel=%d\n", reason, ch->partid, ch->number);
1659 1659
1660 ch->func(xpcDisconnecting, ch->partid, ch->number, NULL, 1660 ch->func(reason, ch->partid, ch->number, NULL, ch->key);
1661 ch->key);
1662 1661
1663 dev_dbg(xpc_chan, "ch->func() returned, reason=" 1662 dev_dbg(xpc_chan, "ch->func() returned, reason=%d, partid=%d, "
1664 "xpcDisconnecting, partid=%d, channel=%d\n", 1663 "channel=%d\n", reason, ch->partid, ch->number);
1665 ch->partid, ch->number);
1666 } 1664 }
1667} 1665}
1668 1666
@@ -2085,7 +2083,7 @@ xpc_pull_remote_msg(struct xpc_channel *ch, s64 get)
2085 enum xpc_retval ret; 2083 enum xpc_retval ret;
2086 2084
2087 2085
2088 if (down_interruptible(&ch->msg_to_pull_sema) != 0) { 2086 if (mutex_lock_interruptible(&ch->msg_to_pull_mutex) != 0) {
2089 /* we were interrupted by a signal */ 2087 /* we were interrupted by a signal */
2090 return NULL; 2088 return NULL;
2091 } 2089 }
@@ -2121,7 +2119,7 @@ xpc_pull_remote_msg(struct xpc_channel *ch, s64 get)
2121 2119
2122 XPC_DEACTIVATE_PARTITION(part, ret); 2120 XPC_DEACTIVATE_PARTITION(part, ret);
2123 2121
2124 up(&ch->msg_to_pull_sema); 2122 mutex_unlock(&ch->msg_to_pull_mutex);
2125 return NULL; 2123 return NULL;
2126 } 2124 }
2127 2125
@@ -2130,7 +2128,7 @@ xpc_pull_remote_msg(struct xpc_channel *ch, s64 get)
2130 ch->next_msg_to_pull += nmsgs; 2128 ch->next_msg_to_pull += nmsgs;
2131 } 2129 }
2132 2130
2133 up(&ch->msg_to_pull_sema); 2131 mutex_unlock(&ch->msg_to_pull_mutex);
2134 2132
2135 /* return the message we were looking for */ 2133 /* return the message we were looking for */
2136 msg_offset = (get % ch->remote_nentries) * ch->msg_size; 2134 msg_offset = (get % ch->remote_nentries) * ch->msg_size;
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index b617236524c6..c75f8aeefc2b 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2004-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -55,11 +55,12 @@
55#include <linux/slab.h> 55#include <linux/slab.h>
56#include <linux/delay.h> 56#include <linux/delay.h>
57#include <linux/reboot.h> 57#include <linux/reboot.h>
58#include <linux/completion.h>
58#include <asm/sn/intr.h> 59#include <asm/sn/intr.h>
59#include <asm/sn/sn_sal.h> 60#include <asm/sn/sn_sal.h>
60#include <asm/kdebug.h> 61#include <asm/kdebug.h>
61#include <asm/uaccess.h> 62#include <asm/uaccess.h>
62#include "xpc.h" 63#include <asm/sn/xpc.h>
63 64
64 65
65/* define two XPC debug device structures to be used with dev_dbg() et al */ 66/* define two XPC debug device structures to be used with dev_dbg() et al */
@@ -82,6 +83,9 @@ struct device *xpc_part = &xpc_part_dbg_subname;
82struct device *xpc_chan = &xpc_chan_dbg_subname; 83struct device *xpc_chan = &xpc_chan_dbg_subname;
83 84
84 85
86static int xpc_kdebug_ignore;
87
88
85/* systune related variables for /proc/sys directories */ 89/* systune related variables for /proc/sys directories */
86 90
87static int xpc_hb_interval = XPC_HB_DEFAULT_INTERVAL; 91static int xpc_hb_interval = XPC_HB_DEFAULT_INTERVAL;
@@ -162,6 +166,8 @@ static ctl_table xpc_sys_dir[] = {
162}; 166};
163static struct ctl_table_header *xpc_sysctl; 167static struct ctl_table_header *xpc_sysctl;
164 168
169/* non-zero if any remote partition disengage request was timed out */
170int xpc_disengage_request_timedout;
165 171
166/* #of IRQs received */ 172/* #of IRQs received */
167static atomic_t xpc_act_IRQ_rcvd; 173static atomic_t xpc_act_IRQ_rcvd;
@@ -172,10 +178,10 @@ static DECLARE_WAIT_QUEUE_HEAD(xpc_act_IRQ_wq);
172static unsigned long xpc_hb_check_timeout; 178static unsigned long xpc_hb_check_timeout;
173 179
174/* notification that the xpc_hb_checker thread has exited */ 180/* notification that the xpc_hb_checker thread has exited */
175static DECLARE_MUTEX_LOCKED(xpc_hb_checker_exited); 181static DECLARE_COMPLETION(xpc_hb_checker_exited);
176 182
177/* notification that the xpc_discovery thread has exited */ 183/* notification that the xpc_discovery thread has exited */
178static DECLARE_MUTEX_LOCKED(xpc_discovery_exited); 184static DECLARE_COMPLETION(xpc_discovery_exited);
179 185
180 186
181static struct timer_list xpc_hb_timer; 187static struct timer_list xpc_hb_timer;
@@ -316,7 +322,7 @@ xpc_hb_checker(void *ignore)
316 322
317 323
318 /* mark this thread as having exited */ 324 /* mark this thread as having exited */
319 up(&xpc_hb_checker_exited); 325 complete(&xpc_hb_checker_exited);
320 return 0; 326 return 0;
321} 327}
322 328
@@ -336,7 +342,7 @@ xpc_initiate_discovery(void *ignore)
336 dev_dbg(xpc_part, "discovery thread is exiting\n"); 342 dev_dbg(xpc_part, "discovery thread is exiting\n");
337 343
338 /* mark this thread as having exited */ 344 /* mark this thread as having exited */
339 up(&xpc_discovery_exited); 345 complete(&xpc_discovery_exited);
340 return 0; 346 return 0;
341} 347}
342 348
@@ -773,7 +779,7 @@ xpc_daemonize_kthread(void *args)
773 ch->flags |= XPC_C_DISCONNECTCALLOUT; 779 ch->flags |= XPC_C_DISCONNECTCALLOUT;
774 spin_unlock_irqrestore(&ch->lock, irq_flags); 780 spin_unlock_irqrestore(&ch->lock, irq_flags);
775 781
776 xpc_disconnecting_callout(ch); 782 xpc_disconnect_callout(ch, xpcDisconnecting);
777 } else { 783 } else {
778 spin_unlock_irqrestore(&ch->lock, irq_flags); 784 spin_unlock_irqrestore(&ch->lock, irq_flags);
779 } 785 }
@@ -888,7 +894,7 @@ xpc_disconnect_wait(int ch_number)
888 continue; 894 continue;
889 } 895 }
890 896
891 (void) down(&ch->wdisconnect_sema); 897 wait_for_completion(&ch->wdisconnect_wait);
892 898
893 spin_lock_irqsave(&ch->lock, irq_flags); 899 spin_lock_irqsave(&ch->lock, irq_flags);
894 DBUG_ON(!(ch->flags & XPC_C_DISCONNECTED)); 900 DBUG_ON(!(ch->flags & XPC_C_DISCONNECTED));
@@ -921,9 +927,9 @@ static void
921xpc_do_exit(enum xpc_retval reason) 927xpc_do_exit(enum xpc_retval reason)
922{ 928{
923 partid_t partid; 929 partid_t partid;
924 int active_part_count; 930 int active_part_count, printed_waiting_msg = 0;
925 struct xpc_partition *part; 931 struct xpc_partition *part;
926 unsigned long printmsg_time; 932 unsigned long printmsg_time, disengage_request_timeout = 0;
927 933
928 934
929 /* a 'rmmod XPC' and a 'reboot' cannot both end up here together */ 935 /* a 'rmmod XPC' and a 'reboot' cannot both end up here together */
@@ -941,10 +947,10 @@ xpc_do_exit(enum xpc_retval reason)
941 free_irq(SGI_XPC_ACTIVATE, NULL); 947 free_irq(SGI_XPC_ACTIVATE, NULL);
942 948
943 /* wait for the discovery thread to exit */ 949 /* wait for the discovery thread to exit */
944 down(&xpc_discovery_exited); 950 wait_for_completion(&xpc_discovery_exited);
945 951
946 /* wait for the heartbeat checker thread to exit */ 952 /* wait for the heartbeat checker thread to exit */
947 down(&xpc_hb_checker_exited); 953 wait_for_completion(&xpc_hb_checker_exited);
948 954
949 955
950 /* sleep for a 1/3 of a second or so */ 956 /* sleep for a 1/3 of a second or so */
@@ -953,7 +959,8 @@ xpc_do_exit(enum xpc_retval reason)
953 959
954 /* wait for all partitions to become inactive */ 960 /* wait for all partitions to become inactive */
955 961
956 printmsg_time = jiffies; 962 printmsg_time = jiffies + (XPC_DISENGAGE_PRINTMSG_INTERVAL * HZ);
963 xpc_disengage_request_timedout = 0;
957 964
958 do { 965 do {
959 active_part_count = 0; 966 active_part_count = 0;
@@ -969,20 +976,39 @@ xpc_do_exit(enum xpc_retval reason)
969 active_part_count++; 976 active_part_count++;
970 977
971 XPC_DEACTIVATE_PARTITION(part, reason); 978 XPC_DEACTIVATE_PARTITION(part, reason);
972 }
973 979
974 if (active_part_count == 0) { 980 if (part->disengage_request_timeout >
975 break; 981 disengage_request_timeout) {
982 disengage_request_timeout =
983 part->disengage_request_timeout;
984 }
976 } 985 }
977 986
978 if (jiffies >= printmsg_time) { 987 if (xpc_partition_engaged(-1UL)) {
979 dev_info(xpc_part, "waiting for partitions to " 988 if (time_after(jiffies, printmsg_time)) {
980 "deactivate/disengage, active count=%d, remote " 989 dev_info(xpc_part, "waiting for remote "
981 "engaged=0x%lx\n", active_part_count, 990 "partitions to disengage, timeout in "
982 xpc_partition_engaged(1UL << partid)); 991 "%ld seconds\n",
983 992 (disengage_request_timeout - jiffies)
984 printmsg_time = jiffies + 993 / HZ);
994 printmsg_time = jiffies +
985 (XPC_DISENGAGE_PRINTMSG_INTERVAL * HZ); 995 (XPC_DISENGAGE_PRINTMSG_INTERVAL * HZ);
996 printed_waiting_msg = 1;
997 }
998
999 } else if (active_part_count > 0) {
1000 if (printed_waiting_msg) {
1001 dev_info(xpc_part, "waiting for local partition"
1002 " to disengage\n");
1003 printed_waiting_msg = 0;
1004 }
1005
1006 } else {
1007 if (!xpc_disengage_request_timedout) {
1008 dev_info(xpc_part, "all partitions have "
1009 "disengaged\n");
1010 }
1011 break;
986 } 1012 }
987 1013
988 /* sleep for a 1/3 of a second or so */ 1014 /* sleep for a 1/3 of a second or so */
@@ -1000,11 +1026,13 @@ xpc_do_exit(enum xpc_retval reason)
1000 del_timer_sync(&xpc_hb_timer); 1026 del_timer_sync(&xpc_hb_timer);
1001 DBUG_ON(xpc_vars->heartbeating_to_mask != 0); 1027 DBUG_ON(xpc_vars->heartbeating_to_mask != 0);
1002 1028
1003 /* take ourselves off of the reboot_notifier_list */ 1029 if (reason == xpcUnloading) {
1004 (void) unregister_reboot_notifier(&xpc_reboot_notifier); 1030 /* take ourselves off of the reboot_notifier_list */
1031 (void) unregister_reboot_notifier(&xpc_reboot_notifier);
1005 1032
1006 /* take ourselves off of the die_notifier list */ 1033 /* take ourselves off of the die_notifier list */
1007 (void) unregister_die_notifier(&xpc_die_notifier); 1034 (void) unregister_die_notifier(&xpc_die_notifier);
1035 }
1008 1036
1009 /* close down protections for IPI operations */ 1037 /* close down protections for IPI operations */
1010 xpc_restrict_IPI_ops(); 1038 xpc_restrict_IPI_ops();
@@ -1020,7 +1048,35 @@ xpc_do_exit(enum xpc_retval reason)
1020 1048
1021 1049
1022/* 1050/*
1023 * Called when the system is about to be either restarted or halted. 1051 * This function is called when the system is being rebooted.
1052 */
1053static int
1054xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused)
1055{
1056 enum xpc_retval reason;
1057
1058
1059 switch (event) {
1060 case SYS_RESTART:
1061 reason = xpcSystemReboot;
1062 break;
1063 case SYS_HALT:
1064 reason = xpcSystemHalt;
1065 break;
1066 case SYS_POWER_OFF:
1067 reason = xpcSystemPoweroff;
1068 break;
1069 default:
1070 reason = xpcSystemGoingDown;
1071 }
1072
1073 xpc_do_exit(reason);
1074 return NOTIFY_DONE;
1075}
1076
1077
1078/*
1079 * Notify other partitions to disengage from all references to our memory.
1024 */ 1080 */
1025static void 1081static void
1026xpc_die_disengage(void) 1082xpc_die_disengage(void)
@@ -1028,7 +1084,7 @@ xpc_die_disengage(void)
1028 struct xpc_partition *part; 1084 struct xpc_partition *part;
1029 partid_t partid; 1085 partid_t partid;
1030 unsigned long engaged; 1086 unsigned long engaged;
1031 long time, print_time, disengage_request_timeout; 1087 long time, printmsg_time, disengage_request_timeout;
1032 1088
1033 1089
1034 /* keep xpc_hb_checker thread from doing anything (just in case) */ 1090 /* keep xpc_hb_checker thread from doing anything (just in case) */
@@ -1055,57 +1111,53 @@ xpc_die_disengage(void)
1055 } 1111 }
1056 } 1112 }
1057 1113
1058 print_time = rtc_time(); 1114 time = rtc_time();
1059 disengage_request_timeout = print_time + 1115 printmsg_time = time +
1116 (XPC_DISENGAGE_PRINTMSG_INTERVAL * sn_rtc_cycles_per_second);
1117 disengage_request_timeout = time +
1060 (xpc_disengage_request_timelimit * sn_rtc_cycles_per_second); 1118 (xpc_disengage_request_timelimit * sn_rtc_cycles_per_second);
1061 1119
1062 /* wait for all other partitions to disengage from us */ 1120 /* wait for all other partitions to disengage from us */
1063 1121
1064 while ((engaged = xpc_partition_engaged(-1UL)) && 1122 while (1) {
1065 (time = rtc_time()) < disengage_request_timeout) { 1123 engaged = xpc_partition_engaged(-1UL);
1124 if (!engaged) {
1125 dev_info(xpc_part, "all partitions have disengaged\n");
1126 break;
1127 }
1066 1128
1067 if (time >= print_time) { 1129 time = rtc_time();
1130 if (time >= disengage_request_timeout) {
1131 for (partid = 1; partid < XP_MAX_PARTITIONS; partid++) {
1132 if (engaged & (1UL << partid)) {
1133 dev_info(xpc_part, "disengage from "
1134 "remote partition %d timed "
1135 "out\n", partid);
1136 }
1137 }
1138 break;
1139 }
1140
1141 if (time >= printmsg_time) {
1068 dev_info(xpc_part, "waiting for remote partitions to " 1142 dev_info(xpc_part, "waiting for remote partitions to "
1069 "disengage, engaged=0x%lx\n", engaged); 1143 "disengage, timeout in %ld seconds\n",
1070 print_time = time + (XPC_DISENGAGE_PRINTMSG_INTERVAL * 1144 (disengage_request_timeout - time) /
1145 sn_rtc_cycles_per_second);
1146 printmsg_time = time +
1147 (XPC_DISENGAGE_PRINTMSG_INTERVAL *
1071 sn_rtc_cycles_per_second); 1148 sn_rtc_cycles_per_second);
1072 } 1149 }
1073 } 1150 }
1074 dev_info(xpc_part, "finished waiting for remote partitions to "
1075 "disengage, engaged=0x%lx\n", engaged);
1076}
1077
1078
1079/*
1080 * This function is called when the system is being rebooted.
1081 */
1082static int
1083xpc_system_reboot(struct notifier_block *nb, unsigned long event, void *unused)
1084{
1085 enum xpc_retval reason;
1086
1087
1088 switch (event) {
1089 case SYS_RESTART:
1090 reason = xpcSystemReboot;
1091 break;
1092 case SYS_HALT:
1093 reason = xpcSystemHalt;
1094 break;
1095 case SYS_POWER_OFF:
1096 reason = xpcSystemPoweroff;
1097 break;
1098 default:
1099 reason = xpcSystemGoingDown;
1100 }
1101
1102 xpc_do_exit(reason);
1103 return NOTIFY_DONE;
1104} 1151}
1105 1152
1106 1153
1107/* 1154/*
1108 * This function is called when the system is being rebooted. 1155 * This function is called when the system is being restarted or halted due
1156 * to some sort of system failure. If this is the case we need to notify the
1157 * other partitions to disengage from all references to our memory.
1158 * This function can also be called when our heartbeater could be offlined
1159 * for a time. In this case we need to notify other partitions to not worry
1160 * about the lack of a heartbeat.
1109 */ 1161 */
1110static int 1162static int
1111xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused) 1163xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
@@ -1115,11 +1167,25 @@ xpc_system_die(struct notifier_block *nb, unsigned long event, void *unused)
1115 case DIE_MACHINE_HALT: 1167 case DIE_MACHINE_HALT:
1116 xpc_die_disengage(); 1168 xpc_die_disengage();
1117 break; 1169 break;
1170
1171 case DIE_KDEBUG_ENTER:
1172 /* Should lack of heartbeat be ignored by other partitions? */
1173 if (!xpc_kdebug_ignore) {
1174 break;
1175 }
1176 /* fall through */
1118 case DIE_MCA_MONARCH_ENTER: 1177 case DIE_MCA_MONARCH_ENTER:
1119 case DIE_INIT_MONARCH_ENTER: 1178 case DIE_INIT_MONARCH_ENTER:
1120 xpc_vars->heartbeat++; 1179 xpc_vars->heartbeat++;
1121 xpc_vars->heartbeat_offline = 1; 1180 xpc_vars->heartbeat_offline = 1;
1122 break; 1181 break;
1182
1183 case DIE_KDEBUG_LEAVE:
1184 /* Is lack of heartbeat being ignored by other partitions? */
1185 if (!xpc_kdebug_ignore) {
1186 break;
1187 }
1188 /* fall through */
1123 case DIE_MCA_MONARCH_LEAVE: 1189 case DIE_MCA_MONARCH_LEAVE:
1124 case DIE_INIT_MONARCH_LEAVE: 1190 case DIE_INIT_MONARCH_LEAVE:
1125 xpc_vars->heartbeat++; 1191 xpc_vars->heartbeat++;
@@ -1302,7 +1368,7 @@ xpc_init(void)
1302 dev_err(xpc_part, "failed while forking discovery thread\n"); 1368 dev_err(xpc_part, "failed while forking discovery thread\n");
1303 1369
1304 /* mark this new thread as a non-starter */ 1370 /* mark this new thread as a non-starter */
1305 up(&xpc_discovery_exited); 1371 complete(&xpc_discovery_exited);
1306 1372
1307 xpc_do_exit(xpcUnloading); 1373 xpc_do_exit(xpcUnloading);
1308 return -EBUSY; 1374 return -EBUSY;
@@ -1344,3 +1410,7 @@ module_param(xpc_disengage_request_timelimit, int, 0);
1344MODULE_PARM_DESC(xpc_disengage_request_timelimit, "Number of seconds to wait " 1410MODULE_PARM_DESC(xpc_disengage_request_timelimit, "Number of seconds to wait "
1345 "for disengage request to complete."); 1411 "for disengage request to complete.");
1346 1412
1413module_param(xpc_kdebug_ignore, int, 0);
1414MODULE_PARM_DESC(xpc_kdebug_ignore, "Should lack of heartbeat be ignored by "
1415 "other partitions when dropping into kdebug.");
1416
diff --git a/arch/ia64/sn/kernel/xpc_partition.c b/arch/ia64/sn/kernel/xpc_partition.c
index cdd6431853a1..88a730e6cfdb 100644
--- a/arch/ia64/sn/kernel/xpc_partition.c
+++ b/arch/ia64/sn/kernel/xpc_partition.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (c) 2004-2005 Silicon Graphics, Inc. All Rights Reserved. 6 * Copyright (c) 2004-2006 Silicon Graphics, Inc. All Rights Reserved.
7 */ 7 */
8 8
9 9
@@ -28,7 +28,7 @@
28#include <asm/sn/sn_sal.h> 28#include <asm/sn/sn_sal.h>
29#include <asm/sn/nodepda.h> 29#include <asm/sn/nodepda.h>
30#include <asm/sn/addrs.h> 30#include <asm/sn/addrs.h>
31#include "xpc.h" 31#include <asm/sn/xpc.h>
32 32
33 33
34/* XPC is exiting flag */ 34/* XPC is exiting flag */
@@ -771,7 +771,8 @@ xpc_identify_act_IRQ_req(int nasid)
771 } 771 }
772 } 772 }
773 773
774 if (!xpc_partition_disengaged(part)) { 774 if (part->disengage_request_timeout > 0 &&
775 !xpc_partition_disengaged(part)) {
775 /* still waiting on other side to disengage from us */ 776 /* still waiting on other side to disengage from us */
776 return; 777 return;
777 } 778 }
@@ -873,6 +874,9 @@ xpc_partition_disengaged(struct xpc_partition *part)
873 * request in a timely fashion, so assume it's dead. 874 * request in a timely fashion, so assume it's dead.
874 */ 875 */
875 876
877 dev_info(xpc_part, "disengage from remote partition %d "
878 "timed out\n", partid);
879 xpc_disengage_request_timedout = 1;
876 xpc_clear_partition_engaged(1UL << partid); 880 xpc_clear_partition_engaged(1UL << partid);
877 disengaged = 1; 881 disengaged = 1;
878 } 882 }
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_ate.c b/arch/ia64/sn/pci/pcibr/pcibr_ate.c
index d1647b863e61..aa3fa5152a32 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_ate.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_ate.c
@@ -18,10 +18,10 @@ int pcibr_invalidate_ate = 0; /* by default don't invalidate ATE on free */
18 * mark_ate: Mark the ate as either free or inuse. 18 * mark_ate: Mark the ate as either free or inuse.
19 */ 19 */
20static void mark_ate(struct ate_resource *ate_resource, int start, int number, 20static void mark_ate(struct ate_resource *ate_resource, int start, int number,
21 uint64_t value) 21 u64 value)
22{ 22{
23 23
24 uint64_t *ate = ate_resource->ate; 24 u64 *ate = ate_resource->ate;
25 int index; 25 int index;
26 int length = 0; 26 int length = 0;
27 27
@@ -38,7 +38,7 @@ static int find_free_ate(struct ate_resource *ate_resource, int start,
38 int count) 38 int count)
39{ 39{
40 40
41 uint64_t *ate = ate_resource->ate; 41 u64 *ate = ate_resource->ate;
42 int index; 42 int index;
43 int start_free; 43 int start_free;
44 44
@@ -119,7 +119,7 @@ static inline int alloc_ate_resource(struct ate_resource *ate_resource,
119int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count) 119int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count)
120{ 120{
121 int status = 0; 121 int status = 0;
122 uint64_t flag; 122 u64 flag;
123 123
124 flag = pcibr_lock(pcibus_info); 124 flag = pcibr_lock(pcibus_info);
125 status = alloc_ate_resource(&pcibus_info->pbi_int_ate_resource, count); 125 status = alloc_ate_resource(&pcibus_info->pbi_int_ate_resource, count);
@@ -139,7 +139,7 @@ int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count)
139 * Setup an Address Translation Entry as specified. Use either the Bridge 139 * Setup an Address Translation Entry as specified. Use either the Bridge
140 * internal maps or the external map RAM, as appropriate. 140 * internal maps or the external map RAM, as appropriate.
141 */ 141 */
142static inline uint64_t *pcibr_ate_addr(struct pcibus_info *pcibus_info, 142static inline u64 *pcibr_ate_addr(struct pcibus_info *pcibus_info,
143 int ate_index) 143 int ate_index)
144{ 144{
145 if (ate_index < pcibus_info->pbi_int_ate_size) { 145 if (ate_index < pcibus_info->pbi_int_ate_size) {
@@ -153,7 +153,7 @@ static inline uint64_t *pcibr_ate_addr(struct pcibus_info *pcibus_info,
153 */ 153 */
154void inline 154void inline
155ate_write(struct pcibus_info *pcibus_info, int ate_index, int count, 155ate_write(struct pcibus_info *pcibus_info, int ate_index, int count,
156 volatile uint64_t ate) 156 volatile u64 ate)
157{ 157{
158 while (count-- > 0) { 158 while (count-- > 0) {
159 if (ate_index < pcibus_info->pbi_int_ate_size) { 159 if (ate_index < pcibus_info->pbi_int_ate_size) {
@@ -171,9 +171,9 @@ ate_write(struct pcibus_info *pcibus_info, int ate_index, int count,
171void pcibr_ate_free(struct pcibus_info *pcibus_info, int index) 171void pcibr_ate_free(struct pcibus_info *pcibus_info, int index)
172{ 172{
173 173
174 volatile uint64_t ate; 174 volatile u64 ate;
175 int count; 175 int count;
176 uint64_t flags; 176 u64 flags;
177 177
178 if (pcibr_invalidate_ate) { 178 if (pcibr_invalidate_ate) {
179 /* For debugging purposes, clear the valid bit in the ATE */ 179 /* For debugging purposes, clear the valid bit in the ATE */
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index 34093476e965..54ce5b7ceed2 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -41,21 +41,21 @@ extern int sn_ioif_inited;
41 41
42static dma_addr_t 42static dma_addr_t
43pcibr_dmamap_ate32(struct pcidev_info *info, 43pcibr_dmamap_ate32(struct pcidev_info *info,
44 uint64_t paddr, size_t req_size, uint64_t flags) 44 u64 paddr, size_t req_size, u64 flags)
45{ 45{
46 46
47 struct pcidev_info *pcidev_info = info->pdi_host_pcidev_info; 47 struct pcidev_info *pcidev_info = info->pdi_host_pcidev_info;
48 struct pcibus_info *pcibus_info = (struct pcibus_info *)pcidev_info-> 48 struct pcibus_info *pcibus_info = (struct pcibus_info *)pcidev_info->
49 pdi_pcibus_info; 49 pdi_pcibus_info;
50 uint8_t internal_device = (PCI_SLOT(pcidev_info->pdi_host_pcidev_info-> 50 u8 internal_device = (PCI_SLOT(pcidev_info->pdi_host_pcidev_info->
51 pdi_linux_pcidev->devfn)) - 1; 51 pdi_linux_pcidev->devfn)) - 1;
52 int ate_count; 52 int ate_count;
53 int ate_index; 53 int ate_index;
54 uint64_t ate_flags = flags | PCI32_ATE_V; 54 u64 ate_flags = flags | PCI32_ATE_V;
55 uint64_t ate; 55 u64 ate;
56 uint64_t pci_addr; 56 u64 pci_addr;
57 uint64_t xio_addr; 57 u64 xio_addr;
58 uint64_t offset; 58 u64 offset;
59 59
60 /* PIC in PCI-X mode does not supports 32bit PageMap mode */ 60 /* PIC in PCI-X mode does not supports 32bit PageMap mode */
61 if (IS_PIC_SOFT(pcibus_info) && IS_PCIX(pcibus_info)) { 61 if (IS_PIC_SOFT(pcibus_info) && IS_PCIX(pcibus_info)) {
@@ -109,12 +109,12 @@ pcibr_dmamap_ate32(struct pcidev_info *info,
109} 109}
110 110
111static dma_addr_t 111static dma_addr_t
112pcibr_dmatrans_direct64(struct pcidev_info * info, uint64_t paddr, 112pcibr_dmatrans_direct64(struct pcidev_info * info, u64 paddr,
113 uint64_t dma_attributes) 113 u64 dma_attributes)
114{ 114{
115 struct pcibus_info *pcibus_info = (struct pcibus_info *) 115 struct pcibus_info *pcibus_info = (struct pcibus_info *)
116 ((info->pdi_host_pcidev_info)->pdi_pcibus_info); 116 ((info->pdi_host_pcidev_info)->pdi_pcibus_info);
117 uint64_t pci_addr; 117 u64 pci_addr;
118 118
119 /* Translate to Crosstalk View of Physical Address */ 119 /* Translate to Crosstalk View of Physical Address */
120 pci_addr = (IS_PIC_SOFT(pcibus_info) ? PHYS_TO_DMA(paddr) : 120 pci_addr = (IS_PIC_SOFT(pcibus_info) ? PHYS_TO_DMA(paddr) :
@@ -127,7 +127,7 @@ pcibr_dmatrans_direct64(struct pcidev_info * info, uint64_t paddr,
127 /* Handle Bridge Chipset differences */ 127 /* Handle Bridge Chipset differences */
128 if (IS_PIC_SOFT(pcibus_info)) { 128 if (IS_PIC_SOFT(pcibus_info)) {
129 pci_addr |= 129 pci_addr |=
130 ((uint64_t) pcibus_info-> 130 ((u64) pcibus_info->
131 pbi_hub_xid << PIC_PCI64_ATTR_TARG_SHFT); 131 pbi_hub_xid << PIC_PCI64_ATTR_TARG_SHFT);
132 } else 132 } else
133 pci_addr |= TIOCP_PCI64_CMDTYPE_MEM; 133 pci_addr |= TIOCP_PCI64_CMDTYPE_MEM;
@@ -142,17 +142,17 @@ pcibr_dmatrans_direct64(struct pcidev_info * info, uint64_t paddr,
142 142
143static dma_addr_t 143static dma_addr_t
144pcibr_dmatrans_direct32(struct pcidev_info * info, 144pcibr_dmatrans_direct32(struct pcidev_info * info,
145 uint64_t paddr, size_t req_size, uint64_t flags) 145 u64 paddr, size_t req_size, u64 flags)
146{ 146{
147 147
148 struct pcidev_info *pcidev_info = info->pdi_host_pcidev_info; 148 struct pcidev_info *pcidev_info = info->pdi_host_pcidev_info;
149 struct pcibus_info *pcibus_info = (struct pcibus_info *)pcidev_info-> 149 struct pcibus_info *pcibus_info = (struct pcibus_info *)pcidev_info->
150 pdi_pcibus_info; 150 pdi_pcibus_info;
151 uint64_t xio_addr; 151 u64 xio_addr;
152 152
153 uint64_t xio_base; 153 u64 xio_base;
154 uint64_t offset; 154 u64 offset;
155 uint64_t endoff; 155 u64 endoff;
156 156
157 if (IS_PCIX(pcibus_info)) { 157 if (IS_PCIX(pcibus_info)) {
158 return 0; 158 return 0;
@@ -209,16 +209,18 @@ pcibr_dma_unmap(struct pci_dev *hwdev, dma_addr_t dma_handle, int direction)
209 * unlike the PIC Device(x) Write Request Buffer Flush register. 209 * unlike the PIC Device(x) Write Request Buffer Flush register.
210 */ 210 */
211 211
212void sn_dma_flush(uint64_t addr) 212void sn_dma_flush(u64 addr)
213{ 213{
214 nasid_t nasid; 214 nasid_t nasid;
215 int is_tio; 215 int is_tio;
216 int wid_num; 216 int wid_num;
217 int i, j; 217 int i, j;
218 uint64_t flags; 218 u64 flags;
219 uint64_t itte; 219 u64 itte;
220 struct hubdev_info *hubinfo; 220 struct hubdev_info *hubinfo;
221 volatile struct sn_flush_device_list *p; 221 volatile struct sn_flush_device_kernel *p;
222 volatile struct sn_flush_device_common *common;
223
222 struct sn_flush_nasid_entry *flush_nasid_list; 224 struct sn_flush_nasid_entry *flush_nasid_list;
223 225
224 if (!sn_ioif_inited) 226 if (!sn_ioif_inited)
@@ -268,17 +270,17 @@ void sn_dma_flush(uint64_t addr)
268 p = &flush_nasid_list->widget_p[wid_num][0]; 270 p = &flush_nasid_list->widget_p[wid_num][0];
269 271
270 /* find a matching BAR */ 272 /* find a matching BAR */
271 for (i = 0; i < DEV_PER_WIDGET; i++) { 273 for (i = 0; i < DEV_PER_WIDGET; i++,p++) {
274 common = p->common;
272 for (j = 0; j < PCI_ROM_RESOURCE; j++) { 275 for (j = 0; j < PCI_ROM_RESOURCE; j++) {
273 if (p->sfdl_bar_list[j].start == 0) 276 if (common->sfdl_bar_list[j].start == 0)
274 break; 277 break;
275 if (addr >= p->sfdl_bar_list[j].start 278 if (addr >= common->sfdl_bar_list[j].start
276 && addr <= p->sfdl_bar_list[j].end) 279 && addr <= common->sfdl_bar_list[j].end)
277 break; 280 break;
278 } 281 }
279 if (j < PCI_ROM_RESOURCE && p->sfdl_bar_list[j].start != 0) 282 if (j < PCI_ROM_RESOURCE && common->sfdl_bar_list[j].start != 0)
280 break; 283 break;
281 p++;
282 } 284 }
283 285
284 /* if no matching BAR, return without doing anything. */ 286 /* if no matching BAR, return without doing anything. */
@@ -297,31 +299,31 @@ void sn_dma_flush(uint64_t addr)
297 * If CE ever needs the sn_dma_flush mechanism, we will have 299 * If CE ever needs the sn_dma_flush mechanism, we will have
298 * to account for that here and in tioce_bus_fixup(). 300 * to account for that here and in tioce_bus_fixup().
299 */ 301 */
300 uint32_t tio_id = HUB_L(TIO_IOSPACE_ADDR(nasid, TIO_NODE_ID)); 302 u32 tio_id = HUB_L(TIO_IOSPACE_ADDR(nasid, TIO_NODE_ID));
301 uint32_t revnum = XWIDGET_PART_REV_NUM(tio_id); 303 u32 revnum = XWIDGET_PART_REV_NUM(tio_id);
302 304
303 /* TIOCP BRINGUP WAR (PV907516): Don't write buffer flush reg */ 305 /* TIOCP BRINGUP WAR (PV907516): Don't write buffer flush reg */
304 if ((1 << XWIDGET_PART_REV_NUM_REV(revnum)) & PV907516) { 306 if ((1 << XWIDGET_PART_REV_NUM_REV(revnum)) & PV907516) {
305 return; 307 return;
306 } else { 308 } else {
307 pcireg_wrb_flush_get(p->sfdl_pcibus_info, 309 pcireg_wrb_flush_get(common->sfdl_pcibus_info,
308 (p->sfdl_slot - 1)); 310 (common->sfdl_slot - 1));
309 } 311 }
310 } else { 312 } else {
311 spin_lock_irqsave(&((struct sn_flush_device_list *)p)-> 313 spin_lock_irqsave((spinlock_t *)&p->sfdl_flush_lock,
312 sfdl_flush_lock, flags); 314 flags);
313 315 *common->sfdl_flush_addr = 0;
314 *p->sfdl_flush_addr = 0;
315 316
316 /* force an interrupt. */ 317 /* force an interrupt. */
317 *(volatile uint32_t *)(p->sfdl_force_int_addr) = 1; 318 *(volatile u32 *)(common->sfdl_force_int_addr) = 1;
318 319
319 /* wait for the interrupt to come back. */ 320 /* wait for the interrupt to come back. */
320 while (*(p->sfdl_flush_addr) != 0x10f) 321 while (*(common->sfdl_flush_addr) != 0x10f)
321 cpu_relax(); 322 cpu_relax();
322 323
323 /* okay, everything is synched up. */ 324 /* okay, everything is synched up. */
324 spin_unlock_irqrestore((spinlock_t *)&p->sfdl_flush_lock, flags); 325 spin_unlock_irqrestore((spinlock_t *)&p->sfdl_flush_lock,
326 flags);
325 } 327 }
326 return; 328 return;
327} 329}
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
index 1f500c81002c..2fac27049bf6 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
@@ -23,14 +23,16 @@ int
23sal_pcibr_slot_enable(struct pcibus_info *soft, int device, void *resp) 23sal_pcibr_slot_enable(struct pcibus_info *soft, int device, void *resp)
24{ 24{
25 struct ia64_sal_retval ret_stuff; 25 struct ia64_sal_retval ret_stuff;
26 uint64_t busnum; 26 u64 busnum;
27 u64 segment;
27 28
28 ret_stuff.status = 0; 29 ret_stuff.status = 0;
29 ret_stuff.v0 = 0; 30 ret_stuff.v0 = 0;
30 31
32 segment = soft->pbi_buscommon.bs_persist_segment;
31 busnum = soft->pbi_buscommon.bs_persist_busnum; 33 busnum = soft->pbi_buscommon.bs_persist_busnum;
32 SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_SLOT_ENABLE, (u64) busnum, 34 SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_SLOT_ENABLE, segment,
33 (u64) device, (u64) resp, 0, 0, 0, 0); 35 busnum, (u64) device, (u64) resp, 0, 0, 0);
34 36
35 return (int)ret_stuff.v0; 37 return (int)ret_stuff.v0;
36} 38}
@@ -40,15 +42,17 @@ sal_pcibr_slot_disable(struct pcibus_info *soft, int device, int action,
40 void *resp) 42 void *resp)
41{ 43{
42 struct ia64_sal_retval ret_stuff; 44 struct ia64_sal_retval ret_stuff;
43 uint64_t busnum; 45 u64 busnum;
46 u64 segment;
44 47
45 ret_stuff.status = 0; 48 ret_stuff.status = 0;
46 ret_stuff.v0 = 0; 49 ret_stuff.v0 = 0;
47 50
51 segment = soft->pbi_buscommon.bs_persist_segment;
48 busnum = soft->pbi_buscommon.bs_persist_busnum; 52 busnum = soft->pbi_buscommon.bs_persist_busnum;
49 SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_SLOT_DISABLE, 53 SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_SLOT_DISABLE,
50 (u64) busnum, (u64) device, (u64) action, 54 segment, busnum, (u64) device, (u64) action,
51 (u64) resp, 0, 0, 0); 55 (u64) resp, 0, 0);
52 56
53 return (int)ret_stuff.v0; 57 return (int)ret_stuff.v0;
54} 58}
@@ -56,7 +60,7 @@ sal_pcibr_slot_disable(struct pcibus_info *soft, int device, int action,
56static int sal_pcibr_error_interrupt(struct pcibus_info *soft) 60static int sal_pcibr_error_interrupt(struct pcibus_info *soft)
57{ 61{
58 struct ia64_sal_retval ret_stuff; 62 struct ia64_sal_retval ret_stuff;
59 uint64_t busnum; 63 u64 busnum;
60 int segment; 64 int segment;
61 ret_stuff.status = 0; 65 ret_stuff.status = 0;
62 ret_stuff.v0 = 0; 66 ret_stuff.v0 = 0;
@@ -92,7 +96,8 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
92 cnodeid_t near_cnode; 96 cnodeid_t near_cnode;
93 struct hubdev_info *hubdev_info; 97 struct hubdev_info *hubdev_info;
94 struct pcibus_info *soft; 98 struct pcibus_info *soft;
95 struct sn_flush_device_list *sn_flush_device_list; 99 struct sn_flush_device_kernel *sn_flush_device_kernel;
100 struct sn_flush_device_common *common;
96 101
97 if (! IS_PCI_BRIDGE_ASIC(prom_bussoft->bs_asic_type)) { 102 if (! IS_PCI_BRIDGE_ASIC(prom_bussoft->bs_asic_type)) {
98 return NULL; 103 return NULL;
@@ -137,20 +142,19 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
137 hubdev_info = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo); 142 hubdev_info = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
138 143
139 if (hubdev_info->hdi_flush_nasid_list.widget_p) { 144 if (hubdev_info->hdi_flush_nasid_list.widget_p) {
140 sn_flush_device_list = hubdev_info->hdi_flush_nasid_list. 145 sn_flush_device_kernel = hubdev_info->hdi_flush_nasid_list.
141 widget_p[(int)soft->pbi_buscommon.bs_xid]; 146 widget_p[(int)soft->pbi_buscommon.bs_xid];
142 if (sn_flush_device_list) { 147 if (sn_flush_device_kernel) {
143 for (j = 0; j < DEV_PER_WIDGET; 148 for (j = 0; j < DEV_PER_WIDGET;
144 j++, sn_flush_device_list++) { 149 j++, sn_flush_device_kernel++) {
145 if (sn_flush_device_list->sfdl_slot == -1) 150 common = sn_flush_device_kernel->common;
151 if (common->sfdl_slot == -1)
146 continue; 152 continue;
147 if ((sn_flush_device_list-> 153 if ((common->sfdl_persistent_segment ==
148 sfdl_persistent_segment ==
149 soft->pbi_buscommon.bs_persist_segment) && 154 soft->pbi_buscommon.bs_persist_segment) &&
150 (sn_flush_device_list-> 155 (common->sfdl_persistent_busnum ==
151 sfdl_persistent_busnum ==
152 soft->pbi_buscommon.bs_persist_busnum)) 156 soft->pbi_buscommon.bs_persist_busnum))
153 sn_flush_device_list->sfdl_pcibus_info = 157 common->sfdl_pcibus_info =
154 soft; 158 soft;
155 } 159 }
156 } 160 }
@@ -159,9 +163,9 @@ pcibr_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
159 /* Setup the PMU ATE map */ 163 /* Setup the PMU ATE map */
160 soft->pbi_int_ate_resource.lowest_free_index = 0; 164 soft->pbi_int_ate_resource.lowest_free_index = 0;
161 soft->pbi_int_ate_resource.ate = 165 soft->pbi_int_ate_resource.ate =
162 kmalloc(soft->pbi_int_ate_size * sizeof(uint64_t), GFP_KERNEL); 166 kmalloc(soft->pbi_int_ate_size * sizeof(u64), GFP_KERNEL);
163 memset(soft->pbi_int_ate_resource.ate, 0, 167 memset(soft->pbi_int_ate_resource.ate, 0,
164 (soft->pbi_int_ate_size * sizeof(uint64_t))); 168 (soft->pbi_int_ate_size * sizeof(u64)));
165 169
166 if (prom_bussoft->bs_asic_type == PCIIO_ASIC_TYPE_TIOCP) { 170 if (prom_bussoft->bs_asic_type == PCIIO_ASIC_TYPE_TIOCP) {
167 /* TIO PCI Bridge: find nearest node with CPUs */ 171 /* TIO PCI Bridge: find nearest node with CPUs */
@@ -203,7 +207,7 @@ void pcibr_target_interrupt(struct sn_irq_info *sn_irq_info)
203 struct pcidev_info *pcidev_info; 207 struct pcidev_info *pcidev_info;
204 struct pcibus_info *pcibus_info; 208 struct pcibus_info *pcibus_info;
205 int bit = sn_irq_info->irq_int_bit; 209 int bit = sn_irq_info->irq_int_bit;
206 uint64_t xtalk_addr = sn_irq_info->irq_xtalkaddr; 210 u64 xtalk_addr = sn_irq_info->irq_xtalkaddr;
207 211
208 pcidev_info = (struct pcidev_info *)sn_irq_info->irq_pciioinfo; 212 pcidev_info = (struct pcidev_info *)sn_irq_info->irq_pciioinfo;
209 if (pcidev_info) { 213 if (pcidev_info) {
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_reg.c b/arch/ia64/sn/pci/pcibr/pcibr_reg.c
index 5d534091262c..8b8bbd51d433 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_reg.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_reg.c
@@ -23,9 +23,9 @@ union br_ptr {
23/* 23/*
24 * Control Register Access -- Read/Write 0000_0020 24 * Control Register Access -- Read/Write 0000_0020
25 */ 25 */
26void pcireg_control_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits) 26void pcireg_control_bit_clr(struct pcibus_info *pcibus_info, u64 bits)
27{ 27{
28 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 28 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
29 29
30 if (pcibus_info) { 30 if (pcibus_info) {
31 switch (pcibus_info->pbi_bridge_type) { 31 switch (pcibus_info->pbi_bridge_type) {
@@ -38,14 +38,14 @@ void pcireg_control_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
38 default: 38 default:
39 panic 39 panic
40 ("pcireg_control_bit_clr: unknown bridgetype bridge 0x%p", 40 ("pcireg_control_bit_clr: unknown bridgetype bridge 0x%p",
41 (void *)ptr); 41 ptr);
42 } 42 }
43 } 43 }
44} 44}
45 45
46void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits) 46void pcireg_control_bit_set(struct pcibus_info *pcibus_info, u64 bits)
47{ 47{
48 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 48 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
49 49
50 if (pcibus_info) { 50 if (pcibus_info) {
51 switch (pcibus_info->pbi_bridge_type) { 51 switch (pcibus_info->pbi_bridge_type) {
@@ -58,7 +58,7 @@ void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
58 default: 58 default:
59 panic 59 panic
60 ("pcireg_control_bit_set: unknown bridgetype bridge 0x%p", 60 ("pcireg_control_bit_set: unknown bridgetype bridge 0x%p",
61 (void *)ptr); 61 ptr);
62 } 62 }
63 } 63 }
64} 64}
@@ -66,10 +66,10 @@ void pcireg_control_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
66/* 66/*
67 * PCI/PCIX Target Flush Register Access -- Read Only 0000_0050 67 * PCI/PCIX Target Flush Register Access -- Read Only 0000_0050
68 */ 68 */
69uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info) 69u64 pcireg_tflush_get(struct pcibus_info *pcibus_info)
70{ 70{
71 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 71 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
72 uint64_t ret = 0; 72 u64 ret = 0;
73 73
74 if (pcibus_info) { 74 if (pcibus_info) {
75 switch (pcibus_info->pbi_bridge_type) { 75 switch (pcibus_info->pbi_bridge_type) {
@@ -82,7 +82,7 @@ uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info)
82 default: 82 default:
83 panic 83 panic
84 ("pcireg_tflush_get: unknown bridgetype bridge 0x%p", 84 ("pcireg_tflush_get: unknown bridgetype bridge 0x%p",
85 (void *)ptr); 85 ptr);
86 } 86 }
87 } 87 }
88 88
@@ -96,10 +96,10 @@ uint64_t pcireg_tflush_get(struct pcibus_info *pcibus_info)
96/* 96/*
97 * Interrupt Status Register Access -- Read Only 0000_0100 97 * Interrupt Status Register Access -- Read Only 0000_0100
98 */ 98 */
99uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info) 99u64 pcireg_intr_status_get(struct pcibus_info * pcibus_info)
100{ 100{
101 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 101 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
102 uint64_t ret = 0; 102 u64 ret = 0;
103 103
104 if (pcibus_info) { 104 if (pcibus_info) {
105 switch (pcibus_info->pbi_bridge_type) { 105 switch (pcibus_info->pbi_bridge_type) {
@@ -112,7 +112,7 @@ uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info)
112 default: 112 default:
113 panic 113 panic
114 ("pcireg_intr_status_get: unknown bridgetype bridge 0x%p", 114 ("pcireg_intr_status_get: unknown bridgetype bridge 0x%p",
115 (void *)ptr); 115 ptr);
116 } 116 }
117 } 117 }
118 return ret; 118 return ret;
@@ -121,9 +121,9 @@ uint64_t pcireg_intr_status_get(struct pcibus_info * pcibus_info)
121/* 121/*
122 * Interrupt Enable Register Access -- Read/Write 0000_0108 122 * Interrupt Enable Register Access -- Read/Write 0000_0108
123 */ 123 */
124void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits) 124void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, u64 bits)
125{ 125{
126 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 126 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
127 127
128 if (pcibus_info) { 128 if (pcibus_info) {
129 switch (pcibus_info->pbi_bridge_type) { 129 switch (pcibus_info->pbi_bridge_type) {
@@ -136,14 +136,14 @@ void pcireg_intr_enable_bit_clr(struct pcibus_info *pcibus_info, uint64_t bits)
136 default: 136 default:
137 panic 137 panic
138 ("pcireg_intr_enable_bit_clr: unknown bridgetype bridge 0x%p", 138 ("pcireg_intr_enable_bit_clr: unknown bridgetype bridge 0x%p",
139 (void *)ptr); 139 ptr);
140 } 140 }
141 } 141 }
142} 142}
143 143
144void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits) 144void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, u64 bits)
145{ 145{
146 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 146 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
147 147
148 if (pcibus_info) { 148 if (pcibus_info) {
149 switch (pcibus_info->pbi_bridge_type) { 149 switch (pcibus_info->pbi_bridge_type) {
@@ -156,7 +156,7 @@ void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
156 default: 156 default:
157 panic 157 panic
158 ("pcireg_intr_enable_bit_set: unknown bridgetype bridge 0x%p", 158 ("pcireg_intr_enable_bit_set: unknown bridgetype bridge 0x%p",
159 (void *)ptr); 159 ptr);
160 } 160 }
161 } 161 }
162} 162}
@@ -165,9 +165,9 @@ void pcireg_intr_enable_bit_set(struct pcibus_info *pcibus_info, uint64_t bits)
165 * Intr Host Address Register (int_addr) -- Read/Write 0000_0130 - 0000_0168 165 * Intr Host Address Register (int_addr) -- Read/Write 0000_0130 - 0000_0168
166 */ 166 */
167void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n, 167void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n,
168 uint64_t addr) 168 u64 addr)
169{ 169{
170 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 170 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
171 171
172 if (pcibus_info) { 172 if (pcibus_info) {
173 switch (pcibus_info->pbi_bridge_type) { 173 switch (pcibus_info->pbi_bridge_type) {
@@ -186,7 +186,7 @@ void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n,
186 default: 186 default:
187 panic 187 panic
188 ("pcireg_intr_addr_addr_get: unknown bridgetype bridge 0x%p", 188 ("pcireg_intr_addr_addr_get: unknown bridgetype bridge 0x%p",
189 (void *)ptr); 189 ptr);
190 } 190 }
191 } 191 }
192} 192}
@@ -196,7 +196,7 @@ void pcireg_intr_addr_addr_set(struct pcibus_info *pcibus_info, int int_n,
196 */ 196 */
197void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n) 197void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n)
198{ 198{
199 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 199 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
200 200
201 if (pcibus_info) { 201 if (pcibus_info) {
202 switch (pcibus_info->pbi_bridge_type) { 202 switch (pcibus_info->pbi_bridge_type) {
@@ -209,7 +209,7 @@ void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n)
209 default: 209 default:
210 panic 210 panic
211 ("pcireg_force_intr_set: unknown bridgetype bridge 0x%p", 211 ("pcireg_force_intr_set: unknown bridgetype bridge 0x%p",
212 (void *)ptr); 212 ptr);
213 } 213 }
214 } 214 }
215} 215}
@@ -217,10 +217,10 @@ void pcireg_force_intr_set(struct pcibus_info *pcibus_info, int int_n)
217/* 217/*
218 * Device(x) Write Buffer Flush Reg Access -- Read Only 0000_0240 - 0000_0258 218 * Device(x) Write Buffer Flush Reg Access -- Read Only 0000_0240 - 0000_0258
219 */ 219 */
220uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device) 220u64 pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device)
221{ 221{
222 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 222 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
223 uint64_t ret = 0; 223 u64 ret = 0;
224 224
225 if (pcibus_info) { 225 if (pcibus_info) {
226 switch (pcibus_info->pbi_bridge_type) { 226 switch (pcibus_info->pbi_bridge_type) {
@@ -233,7 +233,7 @@ uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device)
233 __sn_readq_relaxed(&ptr->pic.p_wr_req_buf[device]); 233 __sn_readq_relaxed(&ptr->pic.p_wr_req_buf[device]);
234 break; 234 break;
235 default: 235 default:
236 panic("pcireg_wrb_flush_get: unknown bridgetype bridge 0x%p", (void *)ptr); 236 panic("pcireg_wrb_flush_get: unknown bridgetype bridge 0x%p", ptr);
237 } 237 }
238 238
239 } 239 }
@@ -242,9 +242,9 @@ uint64_t pcireg_wrb_flush_get(struct pcibus_info *pcibus_info, int device)
242} 242}
243 243
244void pcireg_int_ate_set(struct pcibus_info *pcibus_info, int ate_index, 244void pcireg_int_ate_set(struct pcibus_info *pcibus_info, int ate_index,
245 uint64_t val) 245 u64 val)
246{ 246{
247 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 247 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
248 248
249 if (pcibus_info) { 249 if (pcibus_info) {
250 switch (pcibus_info->pbi_bridge_type) { 250 switch (pcibus_info->pbi_bridge_type) {
@@ -257,15 +257,15 @@ void pcireg_int_ate_set(struct pcibus_info *pcibus_info, int ate_index,
257 default: 257 default:
258 panic 258 panic
259 ("pcireg_int_ate_set: unknown bridgetype bridge 0x%p", 259 ("pcireg_int_ate_set: unknown bridgetype bridge 0x%p",
260 (void *)ptr); 260 ptr);
261 } 261 }
262 } 262 }
263} 263}
264 264
265uint64_t *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index) 265u64 __iomem *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index)
266{ 266{
267 union br_ptr *ptr = (union br_ptr *)pcibus_info->pbi_buscommon.bs_base; 267 union br_ptr __iomem *ptr = (union br_ptr __iomem *)pcibus_info->pbi_buscommon.bs_base;
268 uint64_t *ret = (uint64_t *) 0; 268 u64 __iomem *ret = NULL;
269 269
270 if (pcibus_info) { 270 if (pcibus_info) {
271 switch (pcibus_info->pbi_bridge_type) { 271 switch (pcibus_info->pbi_bridge_type) {
@@ -278,7 +278,7 @@ uint64_t *pcireg_int_ate_addr(struct pcibus_info *pcibus_info, int ate_index)
278 default: 278 default:
279 panic 279 panic
280 ("pcireg_int_ate_addr: unknown bridgetype bridge 0x%p", 280 ("pcireg_int_ate_addr: unknown bridgetype bridge 0x%p",
281 (void *)ptr); 281 ptr);
282 } 282 }
283 } 283 }
284 return ret; 284 return ret;
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index 46b646a6d345..7571a4025529 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -16,7 +16,7 @@
16#include <asm/sn/pcibus_provider_defs.h> 16#include <asm/sn/pcibus_provider_defs.h>
17#include <asm/sn/tioca_provider.h> 17#include <asm/sn/tioca_provider.h>
18 18
19uint32_t tioca_gart_found; 19u32 tioca_gart_found;
20EXPORT_SYMBOL(tioca_gart_found); /* used by agp-sgi */ 20EXPORT_SYMBOL(tioca_gart_found); /* used by agp-sgi */
21 21
22LIST_HEAD(tioca_list); 22LIST_HEAD(tioca_list);
@@ -34,14 +34,14 @@ static int tioca_gart_init(struct tioca_kernel *);
34static int 34static int
35tioca_gart_init(struct tioca_kernel *tioca_kern) 35tioca_gart_init(struct tioca_kernel *tioca_kern)
36{ 36{
37 uint64_t ap_reg; 37 u64 ap_reg;
38 uint64_t offset; 38 u64 offset;
39 struct page *tmp; 39 struct page *tmp;
40 struct tioca_common *tioca_common; 40 struct tioca_common *tioca_common;
41 struct tioca *ca_base; 41 struct tioca __iomem *ca_base;
42 42
43 tioca_common = tioca_kern->ca_common; 43 tioca_common = tioca_kern->ca_common;
44 ca_base = (struct tioca *)tioca_common->ca_common.bs_base; 44 ca_base = (struct tioca __iomem *)tioca_common->ca_common.bs_base;
45 45
46 if (list_empty(tioca_kern->ca_devices)) 46 if (list_empty(tioca_kern->ca_devices))
47 return 0; 47 return 0;
@@ -214,8 +214,8 @@ void
214tioca_fastwrite_enable(struct tioca_kernel *tioca_kern) 214tioca_fastwrite_enable(struct tioca_kernel *tioca_kern)
215{ 215{
216 int cap_ptr; 216 int cap_ptr;
217 uint32_t reg; 217 u32 reg;
218 struct tioca *tioca_base; 218 struct tioca __iomem *tioca_base;
219 struct pci_dev *pdev; 219 struct pci_dev *pdev;
220 struct tioca_common *common; 220 struct tioca_common *common;
221 221
@@ -257,7 +257,7 @@ tioca_fastwrite_enable(struct tioca_kernel *tioca_kern)
257 * Set ca's fw to match 257 * Set ca's fw to match
258 */ 258 */
259 259
260 tioca_base = (struct tioca *)common->ca_common.bs_base; 260 tioca_base = (struct tioca __iomem*)common->ca_common.bs_base;
261 __sn_setq_relaxed(&tioca_base->ca_control1, CA_AGP_FW_ENABLE); 261 __sn_setq_relaxed(&tioca_base->ca_control1, CA_AGP_FW_ENABLE);
262} 262}
263 263
@@ -276,7 +276,7 @@ EXPORT_SYMBOL(tioca_fastwrite_enable); /* used by agp-sgi */
276 * We will always use 0x1 276 * We will always use 0x1
277 * 55:55 - Swap bytes Currently unused 277 * 55:55 - Swap bytes Currently unused
278 */ 278 */
279static uint64_t 279static u64
280tioca_dma_d64(unsigned long paddr) 280tioca_dma_d64(unsigned long paddr)
281{ 281{
282 dma_addr_t bus_addr; 282 dma_addr_t bus_addr;
@@ -318,19 +318,19 @@ tioca_dma_d64(unsigned long paddr)
318 * and so a given CA can only directly target nodes in the range 318 * and so a given CA can only directly target nodes in the range
319 * xxx - xxx+255. 319 * xxx - xxx+255.
320 */ 320 */
321static uint64_t 321static u64
322tioca_dma_d48(struct pci_dev *pdev, uint64_t paddr) 322tioca_dma_d48(struct pci_dev *pdev, u64 paddr)
323{ 323{
324 struct tioca_common *tioca_common; 324 struct tioca_common *tioca_common;
325 struct tioca *ca_base; 325 struct tioca __iomem *ca_base;
326 uint64_t ct_addr; 326 u64 ct_addr;
327 dma_addr_t bus_addr; 327 dma_addr_t bus_addr;
328 uint32_t node_upper; 328 u32 node_upper;
329 uint64_t agp_dma_extn; 329 u64 agp_dma_extn;
330 struct pcidev_info *pcidev_info = SN_PCIDEV_INFO(pdev); 330 struct pcidev_info *pcidev_info = SN_PCIDEV_INFO(pdev);
331 331
332 tioca_common = (struct tioca_common *)pcidev_info->pdi_pcibus_info; 332 tioca_common = (struct tioca_common *)pcidev_info->pdi_pcibus_info;
333 ca_base = (struct tioca *)tioca_common->ca_common.bs_base; 333 ca_base = (struct tioca __iomem *)tioca_common->ca_common.bs_base;
334 334
335 ct_addr = PHYS_TO_TIODMA(paddr); 335 ct_addr = PHYS_TO_TIODMA(paddr);
336 if (!ct_addr) 336 if (!ct_addr)
@@ -367,10 +367,10 @@ tioca_dma_d48(struct pci_dev *pdev, uint64_t paddr)
367 * dma_addr_t is guarenteed to be contiguous in CA bus space. 367 * dma_addr_t is guarenteed to be contiguous in CA bus space.
368 */ 368 */
369static dma_addr_t 369static dma_addr_t
370tioca_dma_mapped(struct pci_dev *pdev, uint64_t paddr, size_t req_size) 370tioca_dma_mapped(struct pci_dev *pdev, u64 paddr, size_t req_size)
371{ 371{
372 int i, ps, ps_shift, entry, entries, mapsize, last_entry; 372 int i, ps, ps_shift, entry, entries, mapsize, last_entry;
373 uint64_t xio_addr, end_xio_addr; 373 u64 xio_addr, end_xio_addr;
374 struct tioca_common *tioca_common; 374 struct tioca_common *tioca_common;
375 struct tioca_kernel *tioca_kern; 375 struct tioca_kernel *tioca_kern;
376 dma_addr_t bus_addr = 0; 376 dma_addr_t bus_addr = 0;
@@ -514,10 +514,10 @@ tioca_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir)
514 * The mapping mode used is based on the devices dma_mask. As a last resort 514 * The mapping mode used is based on the devices dma_mask. As a last resort
515 * use the GART mapped mode. 515 * use the GART mapped mode.
516 */ 516 */
517static uint64_t 517static u64
518tioca_dma_map(struct pci_dev *pdev, uint64_t paddr, size_t byte_count) 518tioca_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count)
519{ 519{
520 uint64_t mapaddr; 520 u64 mapaddr;
521 521
522 /* 522 /*
523 * If card is 64 or 48 bit addresable, use a direct mapping. 32 523 * If card is 64 or 48 bit addresable, use a direct mapping. 32
@@ -554,8 +554,8 @@ tioca_error_intr_handler(int irq, void *arg, struct pt_regs *pt)
554{ 554{
555 struct tioca_common *soft = arg; 555 struct tioca_common *soft = arg;
556 struct ia64_sal_retval ret_stuff; 556 struct ia64_sal_retval ret_stuff;
557 uint64_t segment; 557 u64 segment;
558 uint64_t busnum; 558 u64 busnum;
559 ret_stuff.status = 0; 559 ret_stuff.status = 0;
560 ret_stuff.v0 = 0; 560 ret_stuff.v0 = 0;
561 561
@@ -620,7 +620,7 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft, struct pci_controller *cont
620 INIT_LIST_HEAD(&tioca_kern->ca_dmamaps); 620 INIT_LIST_HEAD(&tioca_kern->ca_dmamaps);
621 tioca_kern->ca_closest_node = 621 tioca_kern->ca_closest_node =
622 nasid_to_cnodeid(tioca_common->ca_closest_nasid); 622 nasid_to_cnodeid(tioca_common->ca_closest_nasid);
623 tioca_common->ca_kernel_private = (uint64_t) tioca_kern; 623 tioca_common->ca_kernel_private = (u64) tioca_kern;
624 624
625 bus = pci_find_bus(tioca_common->ca_common.bs_persist_segment, 625 bus = pci_find_bus(tioca_common->ca_common.bs_persist_segment,
626 tioca_common->ca_common.bs_persist_busnum); 626 tioca_common->ca_common.bs_persist_busnum);
diff --git a/arch/ia64/sn/pci/tioce_provider.c b/arch/ia64/sn/pci/tioce_provider.c
index dda196c9e324..e52831ed93eb 100644
--- a/arch/ia64/sn/pci/tioce_provider.c
+++ b/arch/ia64/sn/pci/tioce_provider.c
@@ -81,10 +81,10 @@
81 * 61 - 0 since this is not an MSI transaction 81 * 61 - 0 since this is not an MSI transaction
82 * 60:54 - reserved, MBZ 82 * 60:54 - reserved, MBZ
83 */ 83 */
84static uint64_t 84static u64
85tioce_dma_d64(unsigned long ct_addr) 85tioce_dma_d64(unsigned long ct_addr)
86{ 86{
87 uint64_t bus_addr; 87 u64 bus_addr;
88 88
89 bus_addr = ct_addr | (1UL << 63); 89 bus_addr = ct_addr | (1UL << 63);
90 90
@@ -141,9 +141,9 @@ pcidev_to_tioce(struct pci_dev *pdev, struct tioce **base,
141 * length, and if enough resources exist, fill in the ATE's and construct a 141 * length, and if enough resources exist, fill in the ATE's and construct a
142 * tioce_dmamap struct to track the mapping. 142 * tioce_dmamap struct to track the mapping.
143 */ 143 */
144static uint64_t 144static u64
145tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port, 145tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
146 uint64_t ct_addr, int len) 146 u64 ct_addr, int len)
147{ 147{
148 int i; 148 int i;
149 int j; 149 int j;
@@ -152,11 +152,11 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
152 int entries; 152 int entries;
153 int nates; 153 int nates;
154 int pagesize; 154 int pagesize;
155 uint64_t *ate_shadow; 155 u64 *ate_shadow;
156 uint64_t *ate_reg; 156 u64 *ate_reg;
157 uint64_t addr; 157 u64 addr;
158 struct tioce *ce_mmr; 158 struct tioce *ce_mmr;
159 uint64_t bus_base; 159 u64 bus_base;
160 struct tioce_dmamap *map; 160 struct tioce_dmamap *map;
161 161
162 ce_mmr = (struct tioce *)ce_kern->ce_common->ce_pcibus.bs_base; 162 ce_mmr = (struct tioce *)ce_kern->ce_common->ce_pcibus.bs_base;
@@ -224,7 +224,7 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
224 224
225 addr = ct_addr; 225 addr = ct_addr;
226 for (j = 0; j < nates; j++) { 226 for (j = 0; j < nates; j++) {
227 uint64_t ate; 227 u64 ate;
228 228
229 ate = ATE_MAKE(addr, pagesize); 229 ate = ATE_MAKE(addr, pagesize);
230 ate_shadow[i + j] = ate; 230 ate_shadow[i + j] = ate;
@@ -252,15 +252,15 @@ tioce_alloc_map(struct tioce_kernel *ce_kern, int type, int port,
252 * 252 *
253 * Map @paddr into 32-bit bus space of the CE associated with @pcidev_info. 253 * Map @paddr into 32-bit bus space of the CE associated with @pcidev_info.
254 */ 254 */
255static uint64_t 255static u64
256tioce_dma_d32(struct pci_dev *pdev, uint64_t ct_addr) 256tioce_dma_d32(struct pci_dev *pdev, u64 ct_addr)
257{ 257{
258 int dma_ok; 258 int dma_ok;
259 int port; 259 int port;
260 struct tioce *ce_mmr; 260 struct tioce *ce_mmr;
261 struct tioce_kernel *ce_kern; 261 struct tioce_kernel *ce_kern;
262 uint64_t ct_upper; 262 u64 ct_upper;
263 uint64_t ct_lower; 263 u64 ct_lower;
264 dma_addr_t bus_addr; 264 dma_addr_t bus_addr;
265 265
266 ct_upper = ct_addr & ~0x3fffffffUL; 266 ct_upper = ct_addr & ~0x3fffffffUL;
@@ -269,7 +269,7 @@ tioce_dma_d32(struct pci_dev *pdev, uint64_t ct_addr)
269 pcidev_to_tioce(pdev, &ce_mmr, &ce_kern, &port); 269 pcidev_to_tioce(pdev, &ce_mmr, &ce_kern, &port);
270 270
271 if (ce_kern->ce_port[port].dirmap_refcnt == 0) { 271 if (ce_kern->ce_port[port].dirmap_refcnt == 0) {
272 uint64_t tmp; 272 u64 tmp;
273 273
274 ce_kern->ce_port[port].dirmap_shadow = ct_upper; 274 ce_kern->ce_port[port].dirmap_shadow = ct_upper;
275 writeq(ct_upper, &ce_mmr->ce_ure_dir_map[port]); 275 writeq(ct_upper, &ce_mmr->ce_ure_dir_map[port]);
@@ -295,10 +295,10 @@ tioce_dma_d32(struct pci_dev *pdev, uint64_t ct_addr)
295 * Given a TIOCE bus address, set the appropriate bit to indicate barrier 295 * Given a TIOCE bus address, set the appropriate bit to indicate barrier
296 * attributes. 296 * attributes.
297 */ 297 */
298static uint64_t 298static u64
299tioce_dma_barrier(uint64_t bus_addr, int on) 299tioce_dma_barrier(u64 bus_addr, int on)
300{ 300{
301 uint64_t barrier_bit; 301 u64 barrier_bit;
302 302
303 /* barrier not supported in M40/M40S mode */ 303 /* barrier not supported in M40/M40S mode */
304 if (TIOCE_M40_ADDR(bus_addr) || TIOCE_M40S_ADDR(bus_addr)) 304 if (TIOCE_M40_ADDR(bus_addr) || TIOCE_M40S_ADDR(bus_addr))
@@ -351,7 +351,7 @@ tioce_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir)
351 351
352 list_for_each_entry(map, &ce_kern->ce_dmamap_list, 352 list_for_each_entry(map, &ce_kern->ce_dmamap_list,
353 ce_dmamap_list) { 353 ce_dmamap_list) {
354 uint64_t last; 354 u64 last;
355 355
356 last = map->pci_start + map->nbytes - 1; 356 last = map->pci_start + map->nbytes - 1;
357 if (bus_addr >= map->pci_start && bus_addr <= last) 357 if (bus_addr >= map->pci_start && bus_addr <= last)
@@ -385,17 +385,17 @@ tioce_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir)
385 * This is the main wrapper for mapping host physical pages to CE PCI space. 385 * This is the main wrapper for mapping host physical pages to CE PCI space.
386 * The mapping mode used is based on the device's dma_mask. 386 * The mapping mode used is based on the device's dma_mask.
387 */ 387 */
388static uint64_t 388static u64
389tioce_do_dma_map(struct pci_dev *pdev, uint64_t paddr, size_t byte_count, 389tioce_do_dma_map(struct pci_dev *pdev, u64 paddr, size_t byte_count,
390 int barrier) 390 int barrier)
391{ 391{
392 unsigned long flags; 392 unsigned long flags;
393 uint64_t ct_addr; 393 u64 ct_addr;
394 uint64_t mapaddr = 0; 394 u64 mapaddr = 0;
395 struct tioce_kernel *ce_kern; 395 struct tioce_kernel *ce_kern;
396 struct tioce_dmamap *map; 396 struct tioce_dmamap *map;
397 int port; 397 int port;
398 uint64_t dma_mask; 398 u64 dma_mask;
399 399
400 dma_mask = (barrier) ? pdev->dev.coherent_dma_mask : pdev->dma_mask; 400 dma_mask = (barrier) ? pdev->dev.coherent_dma_mask : pdev->dma_mask;
401 401
@@ -425,7 +425,7 @@ tioce_do_dma_map(struct pci_dev *pdev, uint64_t paddr, size_t byte_count,
425 * address bits than this device can support. 425 * address bits than this device can support.
426 */ 426 */
427 list_for_each_entry(map, &ce_kern->ce_dmamap_list, ce_dmamap_list) { 427 list_for_each_entry(map, &ce_kern->ce_dmamap_list, ce_dmamap_list) {
428 uint64_t last; 428 u64 last;
429 429
430 last = map->ct_start + map->nbytes - 1; 430 last = map->ct_start + map->nbytes - 1;
431 if (ct_addr >= map->ct_start && 431 if (ct_addr >= map->ct_start &&
@@ -501,8 +501,8 @@ dma_map_done:
501 * Simply call tioce_do_dma_map() to create a map with the barrier bit clear 501 * Simply call tioce_do_dma_map() to create a map with the barrier bit clear
502 * in the address. 502 * in the address.
503 */ 503 */
504static uint64_t 504static u64
505tioce_dma(struct pci_dev *pdev, uint64_t paddr, size_t byte_count) 505tioce_dma(struct pci_dev *pdev, u64 paddr, size_t byte_count)
506{ 506{
507 return tioce_do_dma_map(pdev, paddr, byte_count, 0); 507 return tioce_do_dma_map(pdev, paddr, byte_count, 0);
508} 508}
@@ -515,8 +515,8 @@ tioce_dma(struct pci_dev *pdev, uint64_t paddr, size_t byte_count)
515 * 515 *
516 * Simply call tioce_do_dma_map() to create a map with the barrier bit set 516 * Simply call tioce_do_dma_map() to create a map with the barrier bit set
517 * in the address. 517 * in the address.
518 */ static uint64_t 518 */ static u64
519tioce_dma_consistent(struct pci_dev *pdev, uint64_t paddr, size_t byte_count) 519tioce_dma_consistent(struct pci_dev *pdev, u64 paddr, size_t byte_count)
520{ 520{
521 return tioce_do_dma_map(pdev, paddr, byte_count, 1); 521 return tioce_do_dma_map(pdev, paddr, byte_count, 1);
522} 522}
@@ -551,7 +551,7 @@ tioce_error_intr_handler(int irq, void *arg, struct pt_regs *pt)
551tioce_kern_init(struct tioce_common *tioce_common) 551tioce_kern_init(struct tioce_common *tioce_common)
552{ 552{
553 int i; 553 int i;
554 uint32_t tmp; 554 u32 tmp;
555 struct tioce *tioce_mmr; 555 struct tioce *tioce_mmr;
556 struct tioce_kernel *tioce_kern; 556 struct tioce_kernel *tioce_kern;
557 557
@@ -563,7 +563,7 @@ tioce_kern_init(struct tioce_common *tioce_common)
563 tioce_kern->ce_common = tioce_common; 563 tioce_kern->ce_common = tioce_common;
564 spin_lock_init(&tioce_kern->ce_lock); 564 spin_lock_init(&tioce_kern->ce_lock);
565 INIT_LIST_HEAD(&tioce_kern->ce_dmamap_list); 565 INIT_LIST_HEAD(&tioce_kern->ce_dmamap_list);
566 tioce_common->ce_kernel_private = (uint64_t) tioce_kern; 566 tioce_common->ce_kernel_private = (u64) tioce_kern;
567 567
568 /* 568 /*
569 * Determine the secondary bus number of the port2 logical PPB. 569 * Determine the secondary bus number of the port2 logical PPB.
@@ -575,7 +575,7 @@ tioce_kern_init(struct tioce_common *tioce_common)
575 raw_pci_ops->read(tioce_common->ce_pcibus.bs_persist_segment, 575 raw_pci_ops->read(tioce_common->ce_pcibus.bs_persist_segment,
576 tioce_common->ce_pcibus.bs_persist_busnum, 576 tioce_common->ce_pcibus.bs_persist_busnum,
577 PCI_DEVFN(2, 0), PCI_SECONDARY_BUS, 1, &tmp); 577 PCI_DEVFN(2, 0), PCI_SECONDARY_BUS, 1, &tmp);
578 tioce_kern->ce_port1_secondary = (uint8_t) tmp; 578 tioce_kern->ce_port1_secondary = (u8) tmp;
579 579
580 /* 580 /*
581 * Set PMU pagesize to the largest size available, and zero out 581 * Set PMU pagesize to the largest size available, and zero out
@@ -615,7 +615,7 @@ tioce_force_interrupt(struct sn_irq_info *sn_irq_info)
615 struct pcidev_info *pcidev_info; 615 struct pcidev_info *pcidev_info;
616 struct tioce_common *ce_common; 616 struct tioce_common *ce_common;
617 struct tioce *ce_mmr; 617 struct tioce *ce_mmr;
618 uint64_t force_int_val; 618 u64 force_int_val;
619 619
620 if (!sn_irq_info->irq_bridge) 620 if (!sn_irq_info->irq_bridge)
621 return; 621 return;
@@ -687,7 +687,7 @@ tioce_target_interrupt(struct sn_irq_info *sn_irq_info)
687 struct tioce_common *ce_common; 687 struct tioce_common *ce_common;
688 struct tioce *ce_mmr; 688 struct tioce *ce_mmr;
689 int bit; 689 int bit;
690 uint64_t vector; 690 u64 vector;
691 691
692 pcidev_info = (struct pcidev_info *)sn_irq_info->irq_pciioinfo; 692 pcidev_info = (struct pcidev_info *)sn_irq_info->irq_pciioinfo;
693 if (!pcidev_info) 693 if (!pcidev_info)
@@ -699,7 +699,7 @@ tioce_target_interrupt(struct sn_irq_info *sn_irq_info)
699 bit = sn_irq_info->irq_int_bit; 699 bit = sn_irq_info->irq_int_bit;
700 700
701 __sn_setq_relaxed(&ce_mmr->ce_adm_int_mask, (1UL << bit)); 701 __sn_setq_relaxed(&ce_mmr->ce_adm_int_mask, (1UL << bit));
702 vector = (uint64_t)sn_irq_info->irq_irq << INTR_VECTOR_SHFT; 702 vector = (u64)sn_irq_info->irq_irq << INTR_VECTOR_SHFT;
703 vector |= sn_irq_info->irq_xtalkaddr; 703 vector |= sn_irq_info->irq_xtalkaddr;
704 writeq(vector, &ce_mmr->ce_adm_int_dest[bit]); 704 writeq(vector, &ce_mmr->ce_adm_int_dest[bit]);
705 __sn_clrq_relaxed(&ce_mmr->ce_adm_int_mask, (1UL << bit)); 705 __sn_clrq_relaxed(&ce_mmr->ce_adm_int_mask, (1UL << bit));
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 4d100f3886e1..a3dcc3fab4b7 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -12,10 +12,6 @@ config M32R
12config SBUS 12config SBUS
13 bool 13 bool
14 14
15config UID16
16 bool
17 default n
18
19config GENERIC_ISA_DMA 15config GENERIC_ISA_DMA
20 bool 16 bool
21 default y 17 default y
@@ -81,6 +77,12 @@ config PLAT_MAPPI2
81config PLAT_MAPPI3 77config PLAT_MAPPI3
82 bool "Mappi-III(M3A-2170)" 78 bool "Mappi-III(M3A-2170)"
83 79
80config PLAT_M32104UT
81 bool "M32104UT"
82 help
83 The M3T-M32104UT is an reference board based on uT-Engine
84 specification. This board has a M32104 chip.
85
84endchoice 86endchoice
85 87
86choice 88choice
@@ -93,6 +95,10 @@ config CHIP_M32700
93config CHIP_M32102 95config CHIP_M32102
94 bool "M32102" 96 bool "M32102"
95 97
98config CHIP_M32104
99 bool "M32104"
100 depends on PLAT_M32104UT
101
96config CHIP_VDEC2 102config CHIP_VDEC2
97 bool "VDEC2" 103 bool "VDEC2"
98 104
@@ -115,7 +121,7 @@ config TLB_ENTRIES
115 121
116config ISA_M32R 122config ISA_M32R
117 bool 123 bool
118 depends on CHIP_M32102 124 depends on CHIP_M32102 || CHIP_M32104
119 default y 125 default y
120 126
121config ISA_M32R2 127config ISA_M32R2
@@ -140,6 +146,7 @@ config BUS_CLOCK
140 default "50000000" if PLAT_MAPPI3 146 default "50000000" if PLAT_MAPPI3
141 default "50000000" if PLAT_M32700UT 147 default "50000000" if PLAT_M32700UT
142 default "50000000" if PLAT_OPSPUT 148 default "50000000" if PLAT_OPSPUT
149 default "54000000" if PLAT_M32104UT
143 default "33333333" if PLAT_OAKS32R 150 default "33333333" if PLAT_OAKS32R
144 default "20000000" if PLAT_MAPPI2 151 default "20000000" if PLAT_MAPPI2
145 152
@@ -157,6 +164,7 @@ config MEMORY_START
157 default "08000000" if PLAT_USRV 164 default "08000000" if PLAT_USRV
158 default "08000000" if PLAT_M32700UT 165 default "08000000" if PLAT_M32700UT
159 default "08000000" if PLAT_OPSPUT 166 default "08000000" if PLAT_OPSPUT
167 default "04000000" if PLAT_M32104UT
160 default "01000000" if PLAT_OAKS32R 168 default "01000000" if PLAT_OAKS32R
161 169
162config MEMORY_SIZE 170config MEMORY_SIZE
@@ -166,6 +174,7 @@ config MEMORY_SIZE
166 default "02000000" if PLAT_USRV 174 default "02000000" if PLAT_USRV
167 default "01000000" if PLAT_M32700UT 175 default "01000000" if PLAT_M32700UT
168 default "01000000" if PLAT_OPSPUT 176 default "01000000" if PLAT_OPSPUT
177 default "01000000" if PLAT_M32104UT
169 default "00800000" if PLAT_OAKS32R 178 default "00800000" if PLAT_OAKS32R
170 179
171config NOHIGHMEM 180config NOHIGHMEM
@@ -174,21 +183,22 @@ config NOHIGHMEM
174 183
175config ARCH_DISCONTIGMEM_ENABLE 184config ARCH_DISCONTIGMEM_ENABLE
176 bool "Internal RAM Support" 185 bool "Internal RAM Support"
177 depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP 186 depends on CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104
178 default y 187 default y
179 188
180source "mm/Kconfig" 189source "mm/Kconfig"
181 190
182config IRAM_START 191config IRAM_START
183 hex "Internal memory start address (hex)" 192 hex "Internal memory start address (hex)"
184 default "00f00000" 193 default "00f00000" if !CHIP_M32104
185 depends on (CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP) && DISCONTIGMEM 194 default "00700000" if CHIP_M32104
195 depends on (CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104) && DISCONTIGMEM
186 196
187config IRAM_SIZE 197config IRAM_SIZE
188 hex "Internal memory size (hex)" 198 hex "Internal memory size (hex)"
189 depends on (CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP) && DISCONTIGMEM 199 depends on (CHIP_M32700 || CHIP_M32102 || CHIP_VDEC2 || CHIP_OPSP || CHIP_M32104) && DISCONTIGMEM
190 default "00080000" if CHIP_M32700 200 default "00080000" if CHIP_M32700
191 default "00010000" if CHIP_M32102 || CHIP_OPSP 201 default "00010000" if CHIP_M32102 || CHIP_OPSP || CHIP_M32104
192 default "00008000" if CHIP_VDEC2 202 default "00008000" if CHIP_VDEC2
193 203
194# 204#
diff --git a/arch/m32r/boot/compressed/head.S b/arch/m32r/boot/compressed/head.S
index 07cfd6ad1ae4..234d8b1e0ac1 100644
--- a/arch/m32r/boot/compressed/head.S
+++ b/arch/m32r/boot/compressed/head.S
@@ -143,6 +143,11 @@ startup:
143 ldi r0, -2 143 ldi r0, -2
144 ldi r1, 0x0100 ; invalidate 144 ldi r1, 0x0100 ; invalidate
145 stb r1, @r0 145 stb r1, @r0
146#elif defined(CONFIG_CHIP_M32104)
147 /* Cache flush */
148 ldi r0, -2
149 ldi r1, 0x0700 ; invalidate i-cache, copy back d-cache
150 sth r1, @r0
146#else 151#else
147#error "put your cache flush function, please" 152#error "put your cache flush function, please"
148#endif 153#endif
diff --git a/arch/m32r/boot/setup.S b/arch/m32r/boot/setup.S
index 5d256434b4ad..398542507d84 100644
--- a/arch/m32r/boot/setup.S
+++ b/arch/m32r/boot/setup.S
@@ -1,11 +1,10 @@
1/* 1/*
2 * linux/arch/m32r/boot/setup.S -- A setup code. 2 * linux/arch/m32r/boot/setup.S -- A setup code.
3 * 3 *
4 * Copyright (C) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, 4 * Copyright (C) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
5 * and Hitoshi Yamamoto 5 * Hitoshi Yamamoto, Hayato Fujiwara
6 * 6 *
7 */ 7 */
8/* $Id$ */
9 8
10#include <linux/linkage.h> 9#include <linux/linkage.h>
11#include <asm/segment.h> 10#include <asm/segment.h>
@@ -80,6 +79,20 @@ ENTRY(boot)
80 ldi r1, #0x101 ; cache on (with invalidation) 79 ldi r1, #0x101 ; cache on (with invalidation)
81; ldi r1, #0x00 ; cache off 80; ldi r1, #0x00 ; cache off
82 st r1, @r0 81 st r1, @r0
82#elif defined(CONFIG_CHIP_M32104)
83 ldi r0, #-96 ; DNCR0
84 seth r1, #0x0060 ; from 0x00600000
85 or3 r1, r1, #0x0005 ; size 2MB
86 st r1, @r0
87 seth r1, #0x0100 ; from 0x01000000
88 or3 r1, r1, #0x0003 ; size 16MB
89 st r1, @+r0
90 seth r1, #0x0200 ; from 0x02000000
91 or3 r1, r1, #0x0002 ; size 32MB
92 st r1, @+r0
93 ldi r0, #-4 ;LDIMM (r0, M32R_MCCR)
94 ldi r1, #0x703 ; cache on (with invalidation)
95 st r1, @r0
83#else 96#else
84#error unknown chip configuration 97#error unknown chip configuration
85#endif 98#endif
@@ -115,10 +128,15 @@ mmu_on:
115 st r1, @(MATM_offset,r0) ; Set MATM (T bit ON) 128 st r1, @(MATM_offset,r0) ; Set MATM (T bit ON)
116 ld r0, @(MATM_offset,r0) ; Check 129 ld r0, @(MATM_offset,r0) ; Check
117#else 130#else
131#if defined(CONFIG_CHIP_M32700)
118 seth r0,#high(M32R_MCDCAR) 132 seth r0,#high(M32R_MCDCAR)
119 or3 r0,r0,#low(M32R_MCDCAR) 133 or3 r0,r0,#low(M32R_MCDCAR)
120 ld24 r1,#0x8080 134 ld24 r1,#0x8080
121 st r1,@r0 135 st r1,@r0
136#elif defined(CONFIG_CHIP_M32104)
137 LDIMM (r2, eit_vector) ; set EVB(cr5)
138 mvtc r2, cr5
139#endif
122#endif /* CONFIG_MMU */ 140#endif /* CONFIG_MMU */
123 jmp r13 141 jmp r13
124 nop 142 nop
diff --git a/arch/m32r/kernel/Makefile b/arch/m32r/kernel/Makefile
index 6c6b6c376638..5a2fa886906f 100644
--- a/arch/m32r/kernel/Makefile
+++ b/arch/m32r/kernel/Makefile
@@ -16,5 +16,6 @@ obj-$(CONFIG_PLAT_M32700UT) += setup_m32700ut.o io_m32700ut.o
16obj-$(CONFIG_PLAT_OPSPUT) += setup_opsput.o io_opsput.o 16obj-$(CONFIG_PLAT_OPSPUT) += setup_opsput.o io_opsput.o
17obj-$(CONFIG_MODULES) += module.o 17obj-$(CONFIG_MODULES) += module.o
18obj-$(CONFIG_PLAT_OAKS32R) += setup_oaks32r.o io_oaks32r.o 18obj-$(CONFIG_PLAT_OAKS32R) += setup_oaks32r.o io_oaks32r.o
19obj-$(CONFIG_PLAT_M32104UT) += setup_m32104ut.o io_m32104ut.o
19 20
20EXTRA_AFLAGS := -traditional 21EXTRA_AFLAGS := -traditional
diff --git a/arch/m32r/kernel/entry.S b/arch/m32r/kernel/entry.S
index 396c94218cc2..3871b65f0c82 100644
--- a/arch/m32r/kernel/entry.S
+++ b/arch/m32r/kernel/entry.S
@@ -315,7 +315,7 @@ ENTRY(ei_handler)
315 mv r1, sp ; arg1(regs) 315 mv r1, sp ; arg1(regs)
316#if defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ 316#if defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \
317 || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ 317 || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \
318 || defined(CONFIG_CHIP_OPSP) 318 || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
319 319
320; GET_ICU_STATUS; 320; GET_ICU_STATUS;
321 seth r0, #shigh(M32R_ICU_ISTS_ADDR) 321 seth r0, #shigh(M32R_ICU_ISTS_ADDR)
@@ -541,7 +541,20 @@ check_int2:
541 bra check_end 541 bra check_end
542 .fillinsn 542 .fillinsn
543check_end: 543check_end:
544#endif /* CONFIG_PLAT_OPSPUT */ 544#elif defined(CONFIG_PLAT_M32104UT)
545 add3 r2, r0, #-(M32R_IRQ_INT1) ; INT1# interrupt
546 bnez r2, check_end
547 ; read ICU status register of PLD
548 seth r0, #high(PLD_ICUISTS)
549 or3 r0, r0, #low(PLD_ICUISTS)
550 lduh r0, @r0
551 slli r0, #21
552 srli r0, #27 ; ISN
553 addi r0, #(M32104UT_PLD_IRQ_BASE)
554 bra check_end
555 .fillinsn
556check_end:
557#endif /* CONFIG_PLAT_M32104UT */
545 bl do_IRQ 558 bl do_IRQ
546#endif /* CONFIG_SMP */ 559#endif /* CONFIG_SMP */
547 ld r14, @sp+ 560 ld r14, @sp+
@@ -651,8 +664,6 @@ ENTRY(rie_handler)
651/* void rie_handler(int error_code) */ 664/* void rie_handler(int error_code) */
652 SWITCH_TO_KERNEL_STACK 665 SWITCH_TO_KERNEL_STACK
653 SAVE_ALL 666 SAVE_ALL
654 mvfc r0, bpc
655 ld r1, @r0
656 ldi r1, #0x20 ; error_code 667 ldi r1, #0x20 ; error_code
657 mv r0, sp ; pt_regs 668 mv r0, sp ; pt_regs
658 bl do_rie_handler 669 bl do_rie_handler
diff --git a/arch/m32r/kernel/io_m32104ut.c b/arch/m32r/kernel/io_m32104ut.c
new file mode 100644
index 000000000000..d26adab9586c
--- /dev/null
+++ b/arch/m32r/kernel/io_m32104ut.c
@@ -0,0 +1,298 @@
1/*
2 * linux/arch/m32r/kernel/io_m32104ut.c
3 *
4 * Typical I/O routines for M32104UT board.
5 *
6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Mamoru Sakugawa,
8 * Naoto Sugai, Hayato Fujiwara
9 */
10
11#include <linux/config.h>
12#include <asm/m32r.h>
13#include <asm/page.h>
14#include <asm/io.h>
15#include <asm/byteorder.h>
16
17#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
18#include <linux/types.h>
19
20#define M32R_PCC_IOMAP_SIZE 0x1000
21
22#define M32R_PCC_IOSTART0 0x1000
23#define M32R_PCC_IOEND0 (M32R_PCC_IOSTART0 + M32R_PCC_IOMAP_SIZE - 1)
24
25extern void pcc_ioread_byte(int, unsigned long, void *, size_t, size_t, int);
26extern void pcc_ioread_word(int, unsigned long, void *, size_t, size_t, int);
27extern void pcc_iowrite_byte(int, unsigned long, void *, size_t, size_t, int);
28extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int);
29#endif /* CONFIG_PCMCIA && CONFIG_M32R_CFC */
30
31#define PORT2ADDR(port) _port2addr(port)
32
33static inline void *_port2addr(unsigned long port)
34{
35 return (void *)(port | NONCACHE_OFFSET);
36}
37
38#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
39static inline void *__port2addr_ata(unsigned long port)
40{
41 static int dummy_reg;
42
43 switch (port) {
44 case 0x1f0: return (void *)(0x0c002000 | NONCACHE_OFFSET);
45 case 0x1f1: return (void *)(0x0c012800 | NONCACHE_OFFSET);
46 case 0x1f2: return (void *)(0x0c012002 | NONCACHE_OFFSET);
47 case 0x1f3: return (void *)(0x0c012802 | NONCACHE_OFFSET);
48 case 0x1f4: return (void *)(0x0c012004 | NONCACHE_OFFSET);
49 case 0x1f5: return (void *)(0x0c012804 | NONCACHE_OFFSET);
50 case 0x1f6: return (void *)(0x0c012006 | NONCACHE_OFFSET);
51 case 0x1f7: return (void *)(0x0c012806 | NONCACHE_OFFSET);
52 case 0x3f6: return (void *)(0x0c01200e | NONCACHE_OFFSET);
53 default: return (void *)&dummy_reg;
54 }
55}
56#endif
57
58/*
59 * M32104T-LAN is located in the extended bus space
60 * from 0x01000000 to 0x01ffffff on physical address.
61 * The base address of LAN controller(LAN91C111) is 0x300.
62 */
63#define LAN_IOSTART (0x300 | NONCACHE_OFFSET)
64#define LAN_IOEND (0x320 | NONCACHE_OFFSET)
65static inline void *_port2addr_ne(unsigned long port)
66{
67 return (void *)(port + NONCACHE_OFFSET + 0x01000000);
68}
69
70static inline void delay(void)
71{
72 __asm__ __volatile__ ("push r0; \n\t pop r0;" : : :"memory");
73}
74
75/*
76 * NIC I/O function
77 */
78
79#define PORT2ADDR_NE(port) _port2addr_ne(port)
80
81static inline unsigned char _ne_inb(void *portp)
82{
83 return *(volatile unsigned char *)portp;
84}
85
86static inline unsigned short _ne_inw(void *portp)
87{
88 return (unsigned short)le16_to_cpu(*(volatile unsigned short *)portp);
89}
90
91static inline void _ne_insb(void *portp, void *addr, unsigned long count)
92{
93 unsigned char *buf = (unsigned char *)addr;
94
95 while (count--)
96 *buf++ = _ne_inb(portp);
97}
98
99static inline void _ne_outb(unsigned char b, void *portp)
100{
101 *(volatile unsigned char *)portp = b;
102}
103
104static inline void _ne_outw(unsigned short w, void *portp)
105{
106 *(volatile unsigned short *)portp = cpu_to_le16(w);
107}
108
109unsigned char _inb(unsigned long port)
110{
111 if (port >= LAN_IOSTART && port < LAN_IOEND)
112 return _ne_inb(PORT2ADDR_NE(port));
113
114 return *(volatile unsigned char *)PORT2ADDR(port);
115}
116
117unsigned short _inw(unsigned long port)
118{
119 if (port >= LAN_IOSTART && port < LAN_IOEND)
120 return _ne_inw(PORT2ADDR_NE(port));
121
122 return *(volatile unsigned short *)PORT2ADDR(port);
123}
124
125unsigned long _inl(unsigned long port)
126{
127 return *(volatile unsigned long *)PORT2ADDR(port);
128}
129
130unsigned char _inb_p(unsigned long port)
131{
132 unsigned char v = _inb(port);
133 delay();
134 return (v);
135}
136
137unsigned short _inw_p(unsigned long port)
138{
139 unsigned short v = _inw(port);
140 delay();
141 return (v);
142}
143
144unsigned long _inl_p(unsigned long port)
145{
146 unsigned long v = _inl(port);
147 delay();
148 return (v);
149}
150
151void _outb(unsigned char b, unsigned long port)
152{
153 if (port >= LAN_IOSTART && port < LAN_IOEND)
154 _ne_outb(b, PORT2ADDR_NE(port));
155 else
156 *(volatile unsigned char *)PORT2ADDR(port) = b;
157}
158
159void _outw(unsigned short w, unsigned long port)
160{
161 if (port >= LAN_IOSTART && port < LAN_IOEND)
162 _ne_outw(w, PORT2ADDR_NE(port));
163 else
164 *(volatile unsigned short *)PORT2ADDR(port) = w;
165}
166
167void _outl(unsigned long l, unsigned long port)
168{
169 *(volatile unsigned long *)PORT2ADDR(port) = l;
170}
171
172void _outb_p(unsigned char b, unsigned long port)
173{
174 _outb(b, port);
175 delay();
176}
177
178void _outw_p(unsigned short w, unsigned long port)
179{
180 _outw(w, port);
181 delay();
182}
183
184void _outl_p(unsigned long l, unsigned long port)
185{
186 _outl(l, port);
187 delay();
188}
189
190void _insb(unsigned int port, void *addr, unsigned long count)
191{
192 if (port >= LAN_IOSTART && port < LAN_IOEND)
193 _ne_insb(PORT2ADDR_NE(port), addr, count);
194 else {
195 unsigned char *buf = addr;
196 unsigned char *portp = PORT2ADDR(port);
197 while (count--)
198 *buf++ = *(volatile unsigned char *)portp;
199 }
200}
201
202void _insw(unsigned int port, void *addr, unsigned long count)
203{
204 unsigned short *buf = addr;
205 unsigned short *portp;
206
207 if (port >= LAN_IOSTART && port < LAN_IOEND) {
208 /*
209 * This portion is only used by smc91111.c to read data
210 * from the DATA_REG. Do not swap the data.
211 */
212 portp = PORT2ADDR_NE(port);
213 while (count--)
214 *buf++ = *(volatile unsigned short *)portp;
215#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
216 } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
217 pcc_ioread_word(9, port, (void *)addr, sizeof(unsigned short),
218 count, 1);
219#endif
220#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
221 } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
222 portp = __port2addr_ata(port);
223 while (count--)
224 *buf++ = *(volatile unsigned short *)portp;
225#endif
226 } else {
227 portp = PORT2ADDR(port);
228 while (count--)
229 *buf++ = *(volatile unsigned short *)portp;
230 }
231}
232
233void _insl(unsigned int port, void *addr, unsigned long count)
234{
235 unsigned long *buf = addr;
236 unsigned long *portp;
237
238 portp = PORT2ADDR(port);
239 while (count--)
240 *buf++ = *(volatile unsigned long *)portp;
241}
242
243void _outsb(unsigned int port, const void *addr, unsigned long count)
244{
245 const unsigned char *buf = addr;
246 unsigned char *portp;
247
248 if (port >= LAN_IOSTART && port < LAN_IOEND) {
249 portp = PORT2ADDR_NE(port);
250 while (count--)
251 _ne_outb(*buf++, portp);
252 } else {
253 portp = PORT2ADDR(port);
254 while (count--)
255 *(volatile unsigned char *)portp = *buf++;
256 }
257}
258
259void _outsw(unsigned int port, const void *addr, unsigned long count)
260{
261 const unsigned short *buf = addr;
262 unsigned short *portp;
263
264 if (port >= LAN_IOSTART && port < LAN_IOEND) {
265 /*
266 * This portion is only used by smc91111.c to write data
267 * into the DATA_REG. Do not swap the data.
268 */
269 portp = PORT2ADDR_NE(port);
270 while (count--)
271 *(volatile unsigned short *)portp = *buf++;
272#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
273 } else if ((port >= 0x1f0 && port <=0x1f7) || port == 0x3f6) {
274 portp = __port2addr_ata(port);
275 while (count--)
276 *(volatile unsigned short *)portp = *buf++;
277#endif
278#if defined(CONFIG_PCMCIA) && defined(CONFIG_M32R_CFC)
279 } else if (port >= M32R_PCC_IOSTART0 && port <= M32R_PCC_IOEND0) {
280 pcc_iowrite_word(9, port, (void *)addr, sizeof(unsigned short),
281 count, 1);
282#endif
283 } else {
284 portp = PORT2ADDR(port);
285 while (count--)
286 *(volatile unsigned short *)portp = *buf++;
287 }
288}
289
290void _outsl(unsigned int port, const void *addr, unsigned long count)
291{
292 const unsigned long *buf = addr;
293 unsigned char *portp;
294
295 portp = PORT2ADDR(port);
296 while (count--)
297 *(volatile unsigned long *)portp = *buf++;
298}
diff --git a/arch/m32r/kernel/io_m32700ut.c b/arch/m32r/kernel/io_m32700ut.c
index eda9f963c1eb..939932d6cc00 100644
--- a/arch/m32r/kernel/io_m32700ut.c
+++ b/arch/m32r/kernel/io_m32700ut.c
@@ -36,7 +36,7 @@ extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int);
36 36
37static inline void *_port2addr(unsigned long port) 37static inline void *_port2addr(unsigned long port)
38{ 38{
39 return (void *)(port + NONCACHE_OFFSET); 39 return (void *)(port | NONCACHE_OFFSET);
40} 40}
41 41
42#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 42#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
@@ -45,15 +45,15 @@ static inline void *__port2addr_ata(unsigned long port)
45 static int dummy_reg; 45 static int dummy_reg;
46 46
47 switch (port) { 47 switch (port) {
48 case 0x1f0: return (void *)0xac002000; 48 case 0x1f0: return (void *)(0x0c002000 | NONCACHE_OFFSET);
49 case 0x1f1: return (void *)0xac012800; 49 case 0x1f1: return (void *)(0x0c012800 | NONCACHE_OFFSET);
50 case 0x1f2: return (void *)0xac012002; 50 case 0x1f2: return (void *)(0x0c012002 | NONCACHE_OFFSET);
51 case 0x1f3: return (void *)0xac012802; 51 case 0x1f3: return (void *)(0x0c012802 | NONCACHE_OFFSET);
52 case 0x1f4: return (void *)0xac012004; 52 case 0x1f4: return (void *)(0x0c012004 | NONCACHE_OFFSET);
53 case 0x1f5: return (void *)0xac012804; 53 case 0x1f5: return (void *)(0x0c012804 | NONCACHE_OFFSET);
54 case 0x1f6: return (void *)0xac012006; 54 case 0x1f6: return (void *)(0x0c012006 | NONCACHE_OFFSET);
55 case 0x1f7: return (void *)0xac012806; 55 case 0x1f7: return (void *)(0x0c012806 | NONCACHE_OFFSET);
56 case 0x3f6: return (void *)0xac01200e; 56 case 0x3f6: return (void *)(0x0c01200e | NONCACHE_OFFSET);
57 default: return (void *)&dummy_reg; 57 default: return (void *)&dummy_reg;
58 } 58 }
59} 59}
@@ -64,8 +64,8 @@ static inline void *__port2addr_ata(unsigned long port)
64 * from 0x10000000 to 0x13ffffff on physical address. 64 * from 0x10000000 to 0x13ffffff on physical address.
65 * The base address of LAN controller(LAN91C111) is 0x300. 65 * The base address of LAN controller(LAN91C111) is 0x300.
66 */ 66 */
67#define LAN_IOSTART 0xa0000300 67#define LAN_IOSTART (0x300 | NONCACHE_OFFSET)
68#define LAN_IOEND 0xa0000320 68#define LAN_IOEND (0x320 | NONCACHE_OFFSET)
69static inline void *_port2addr_ne(unsigned long port) 69static inline void *_port2addr_ne(unsigned long port)
70{ 70{
71 return (void *)(port + 0x10000000); 71 return (void *)(port + 0x10000000);
diff --git a/arch/m32r/kernel/io_mappi.c b/arch/m32r/kernel/io_mappi.c
index 3c3da042fbd1..a662b537c5ba 100644
--- a/arch/m32r/kernel/io_mappi.c
+++ b/arch/m32r/kernel/io_mappi.c
@@ -31,7 +31,7 @@ extern void pcc_iowrite(int, unsigned long, void *, size_t, size_t, int);
31 31
32static inline void *_port2addr(unsigned long port) 32static inline void *_port2addr(unsigned long port)
33{ 33{
34 return (void *)(port | (NONCACHE_OFFSET)); 34 return (void *)(port | NONCACHE_OFFSET);
35} 35}
36 36
37static inline void *_port2addr_ne(unsigned long port) 37static inline void *_port2addr_ne(unsigned long port)
diff --git a/arch/m32r/kernel/io_mappi2.c b/arch/m32r/kernel/io_mappi2.c
index df3c729cb3e0..e72d725606af 100644
--- a/arch/m32r/kernel/io_mappi2.c
+++ b/arch/m32r/kernel/io_mappi2.c
@@ -33,7 +33,7 @@ extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int);
33 33
34static inline void *_port2addr(unsigned long port) 34static inline void *_port2addr(unsigned long port)
35{ 35{
36 return (void *)(port | (NONCACHE_OFFSET)); 36 return (void *)(port | NONCACHE_OFFSET);
37} 37}
38 38
39#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC) 39#if defined(CONFIG_IDE) && !defined(CONFIG_M32R_CFC)
@@ -42,22 +42,22 @@ static inline void *__port2addr_ata(unsigned long port)
42 static int dummy_reg; 42 static int dummy_reg;
43 43
44 switch (port) { 44 switch (port) {
45 case 0x1f0: return (void *)0xac002000; 45 case 0x1f0: return (void *)(0x0c002000 | NONCACHE_OFFSET);
46 case 0x1f1: return (void *)0xac012800; 46 case 0x1f1: return (void *)(0x0c012800 | NONCACHE_OFFSET);
47 case 0x1f2: return (void *)0xac012002; 47 case 0x1f2: return (void *)(0x0c012002 | NONCACHE_OFFSET);
48 case 0x1f3: return (void *)0xac012802; 48 case 0x1f3: return (void *)(0x0c012802 | NONCACHE_OFFSET);
49 case 0x1f4: return (void *)0xac012004; 49 case 0x1f4: return (void *)(0x0c012004 | NONCACHE_OFFSET);
50 case 0x1f5: return (void *)0xac012804; 50 case 0x1f5: return (void *)(0x0c012804 | NONCACHE_OFFSET);
51 case 0x1f6: return (void *)0xac012006; 51 case 0x1f6: return (void *)(0x0c012006 | NONCACHE_OFFSET);
52 case 0x1f7: return (void *)0xac012806; 52 case 0x1f7: return (void *)(0x0c012806 | NONCACHE_OFFSET);
53 case 0x3f6: return (void *)0xac01200e; 53 case 0x3f6: return (void *)(0x0c01200e | NONCACHE_OFFSET);
54 default: return (void *)&dummy_reg; 54 default: return (void *)&dummy_reg;
55 } 55 }
56} 56}
57#endif 57#endif
58 58
59#define LAN_IOSTART 0xa0000300 59#define LAN_IOSTART (0x300 | NONCACHE_OFFSET)
60#define LAN_IOEND 0xa0000320 60#define LAN_IOEND (0x320 | NONCACHE_OFFSET)
61#ifdef CONFIG_CHIP_OPSP 61#ifdef CONFIG_CHIP_OPSP
62static inline void *_port2addr_ne(unsigned long port) 62static inline void *_port2addr_ne(unsigned long port)
63{ 63{
diff --git a/arch/m32r/kernel/io_mappi3.c b/arch/m32r/kernel/io_mappi3.c
index f80321a58764..ed6da930bc64 100644
--- a/arch/m32r/kernel/io_mappi3.c
+++ b/arch/m32r/kernel/io_mappi3.c
@@ -33,7 +33,7 @@ extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int);
33 33
34static inline void *_port2addr(unsigned long port) 34static inline void *_port2addr(unsigned long port)
35{ 35{
36 return (void *)(port + NONCACHE_OFFSET); 36 return (void *)(port | NONCACHE_OFFSET);
37} 37}
38 38
39#if defined(CONFIG_IDE) 39#if defined(CONFIG_IDE)
@@ -43,33 +43,42 @@ static inline void *__port2addr_ata(unsigned long port)
43 43
44 switch (port) { 44 switch (port) {
45 /* IDE0 CF */ 45 /* IDE0 CF */
46 case 0x1f0: return (void *)0xb4002000; 46 case 0x1f0: return (void *)(0x14002000 | NONCACHE_OFFSET);
47 case 0x1f1: return (void *)0xb4012800; 47 case 0x1f1: return (void *)(0x14012800 | NONCACHE_OFFSET);
48 case 0x1f2: return (void *)0xb4012002; 48 case 0x1f2: return (void *)(0x14012002 | NONCACHE_OFFSET);
49 case 0x1f3: return (void *)0xb4012802; 49 case 0x1f3: return (void *)(0x14012802 | NONCACHE_OFFSET);
50 case 0x1f4: return (void *)0xb4012004; 50 case 0x1f4: return (void *)(0x14012004 | NONCACHE_OFFSET);
51 case 0x1f5: return (void *)0xb4012804; 51 case 0x1f5: return (void *)(0x14012804 | NONCACHE_OFFSET);
52 case 0x1f6: return (void *)0xb4012006; 52 case 0x1f6: return (void *)(0x14012006 | NONCACHE_OFFSET);
53 case 0x1f7: return (void *)0xb4012806; 53 case 0x1f7: return (void *)(0x14012806 | NONCACHE_OFFSET);
54 case 0x3f6: return (void *)0xb401200e; 54 case 0x3f6: return (void *)(0x1401200e | NONCACHE_OFFSET);
55 /* IDE1 IDE */ 55 /* IDE1 IDE */
56 case 0x170: return (void *)0xb4810000; /* Data 16bit */ 56 case 0x170: /* Data 16bit */
57 case 0x171: return (void *)0xb4810002; /* Features / Error */ 57 return (void *)(0x14810000 | NONCACHE_OFFSET);
58 case 0x172: return (void *)0xb4810004; /* Sector count */ 58 case 0x171: /* Features / Error */
59 case 0x173: return (void *)0xb4810006; /* Sector number */ 59 return (void *)(0x14810002 | NONCACHE_OFFSET);
60 case 0x174: return (void *)0xb4810008; /* Cylinder low */ 60 case 0x172: /* Sector count */
61 case 0x175: return (void *)0xb481000a; /* Cylinder high */ 61 return (void *)(0x14810004 | NONCACHE_OFFSET);
62 case 0x176: return (void *)0xb481000c; /* Device head */ 62 case 0x173: /* Sector number */
63 case 0x177: return (void *)0xb481000e; /* Command */ 63 return (void *)(0x14810006 | NONCACHE_OFFSET);
64 case 0x376: return (void *)0xb480800c; /* Device control / Alt status */ 64 case 0x174: /* Cylinder low */
65 return (void *)(0x14810008 | NONCACHE_OFFSET);
66 case 0x175: /* Cylinder high */
67 return (void *)(0x1481000a | NONCACHE_OFFSET);
68 case 0x176: /* Device head */
69 return (void *)(0x1481000c | NONCACHE_OFFSET);
70 case 0x177: /* Command */
71 return (void *)(0x1481000e | NONCACHE_OFFSET);
72 case 0x376: /* Device control / Alt status */
73 return (void *)(0x1480800c | NONCACHE_OFFSET);
65 74
66 default: return (void *)&dummy_reg; 75 default: return (void *)&dummy_reg;
67 } 76 }
68} 77}
69#endif 78#endif
70 79
71#define LAN_IOSTART 0xa0000300 80#define LAN_IOSTART (0x300 | NONCACHE_OFFSET)
72#define LAN_IOEND 0xa0000320 81#define LAN_IOEND (0x320 | NONCACHE_OFFSET)
73static inline void *_port2addr_ne(unsigned long port) 82static inline void *_port2addr_ne(unsigned long port)
74{ 83{
75 return (void *)(port + 0x10000000); 84 return (void *)(port + 0x10000000);
diff --git a/arch/m32r/kernel/io_oaks32r.c b/arch/m32r/kernel/io_oaks32r.c
index 8be323931e4a..910dd131c227 100644
--- a/arch/m32r/kernel/io_oaks32r.c
+++ b/arch/m32r/kernel/io_oaks32r.c
@@ -16,7 +16,7 @@
16 16
17static inline void *_port2addr(unsigned long port) 17static inline void *_port2addr(unsigned long port)
18{ 18{
19 return (void *)(port | (NONCACHE_OFFSET)); 19 return (void *)(port | NONCACHE_OFFSET);
20} 20}
21 21
22static inline void *_port2addr_ne(unsigned long port) 22static inline void *_port2addr_ne(unsigned long port)
diff --git a/arch/m32r/kernel/io_opsput.c b/arch/m32r/kernel/io_opsput.c
index 4793bd18e115..bec69297db3c 100644
--- a/arch/m32r/kernel/io_opsput.c
+++ b/arch/m32r/kernel/io_opsput.c
@@ -36,7 +36,7 @@ extern void pcc_iowrite_word(int, unsigned long, void *, size_t, size_t, int);
36 36
37static inline void *_port2addr(unsigned long port) 37static inline void *_port2addr(unsigned long port)
38{ 38{
39 return (void *)(port | (NONCACHE_OFFSET)); 39 return (void *)(port | NONCACHE_OFFSET);
40} 40}
41 41
42/* 42/*
@@ -44,8 +44,8 @@ static inline void *_port2addr(unsigned long port)
44 * from 0x10000000 to 0x13ffffff on physical address. 44 * from 0x10000000 to 0x13ffffff on physical address.
45 * The base address of LAN controller(LAN91C111) is 0x300. 45 * The base address of LAN controller(LAN91C111) is 0x300.
46 */ 46 */
47#define LAN_IOSTART 0xa0000300 47#define LAN_IOSTART (0x300 | NONCACHE_OFFSET)
48#define LAN_IOEND 0xa0000320 48#define LAN_IOEND (0x320 | NONCACHE_OFFSET)
49static inline void *_port2addr_ne(unsigned long port) 49static inline void *_port2addr_ne(unsigned long port)
50{ 50{
51 return (void *)(port + 0x10000000); 51 return (void *)(port + 0x10000000);
diff --git a/arch/m32r/kernel/m32r_ksyms.c b/arch/m32r/kernel/m32r_ksyms.c
index e5ec134d81d9..dbc8a392105f 100644
--- a/arch/m32r/kernel/m32r_ksyms.c
+++ b/arch/m32r/kernel/m32r_ksyms.c
@@ -18,8 +18,6 @@
18#include <asm/irq.h> 18#include <asm/irq.h>
19#include <asm/tlbflush.h> 19#include <asm/tlbflush.h>
20 20
21extern void dump_thread(struct pt_regs *, struct user *);
22
23#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE) 21#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_HD) || defined(CONFIG_BLK_DEV_IDE_MODULE) || defined(CONFIG_BLK_DEV_HD_MODULE)
24extern struct drive_info_struct drive_info; 22extern struct drive_info_struct drive_info;
25EXPORT_SYMBOL(drive_info); 23EXPORT_SYMBOL(drive_info);
@@ -27,7 +25,6 @@ EXPORT_SYMBOL(drive_info);
27 25
28/* platform dependent support */ 26/* platform dependent support */
29EXPORT_SYMBOL(boot_cpu_data); 27EXPORT_SYMBOL(boot_cpu_data);
30EXPORT_SYMBOL(dump_thread);
31EXPORT_SYMBOL(dump_fpu); 28EXPORT_SYMBOL(dump_fpu);
32EXPORT_SYMBOL(__ioremap); 29EXPORT_SYMBOL(__ioremap);
33EXPORT_SYMBOL(iounmap); 30EXPORT_SYMBOL(iounmap);
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index cc4b571e5db7..5dfc7ea45cf7 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -50,6 +50,10 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
50 * Powermanagement idle function, if any.. 50 * Powermanagement idle function, if any..
51 */ 51 */
52void (*pm_idle)(void) = NULL; 52void (*pm_idle)(void) = NULL;
53EXPORT_SYMBOL(pm_idle);
54
55void (*pm_power_off)(void) = NULL;
56EXPORT_SYMBOL(pm_power_off);
53 57
54void disable_hlt(void) 58void disable_hlt(void)
55{ 59{
@@ -238,13 +242,10 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu)
238int copy_thread(int nr, unsigned long clone_flags, unsigned long spu, 242int copy_thread(int nr, unsigned long clone_flags, unsigned long spu,
239 unsigned long unused, struct task_struct *tsk, struct pt_regs *regs) 243 unsigned long unused, struct task_struct *tsk, struct pt_regs *regs)
240{ 244{
241 struct pt_regs *childregs; 245 struct pt_regs *childregs = task_pt_regs(tsk);
242 unsigned long sp = (unsigned long)tsk->thread_info + THREAD_SIZE;
243 extern void ret_from_fork(void); 246 extern void ret_from_fork(void);
244 247
245 /* Copy registers */ 248 /* Copy registers */
246 sp -= sizeof (struct pt_regs);
247 childregs = (struct pt_regs *)sp;
248 *childregs = *regs; 249 *childregs = *regs;
249 250
250 childregs->spu = spu; 251 childregs->spu = spu;
@@ -257,14 +258,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long spu,
257} 258}
258 259
259/* 260/*
260 * fill in the user structure for a core dump..
261 */
262void dump_thread(struct pt_regs * regs, struct user * dump)
263{
264 /* M32R_FIXME */
265}
266
267/*
268 * Capture the user space registers if the task is not running (in user space) 261 * Capture the user space registers if the task is not running (in user space)
269 */ 262 */
270int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs) 263int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
diff --git a/arch/m32r/kernel/ptrace.c b/arch/m32r/kernel/ptrace.c
index 078d2a0e71c2..340a3bf59b88 100644
--- a/arch/m32r/kernel/ptrace.c
+++ b/arch/m32r/kernel/ptrace.c
@@ -35,23 +35,6 @@
35#include <asm/mmu_context.h> 35#include <asm/mmu_context.h>
36 36
37/* 37/*
38 * Get the address of the live pt_regs for the specified task.
39 * These are saved onto the top kernel stack when the process
40 * is not running.
41 *
42 * Note: if a user thread is execve'd from kernel space, the
43 * kernel stack will not be empty on entry to the kernel, so
44 * ptracing these tasks will fail.
45 */
46static inline struct pt_regs *
47get_user_regs(struct task_struct *task)
48{
49 return (struct pt_regs *)
50 ((unsigned long)task->thread_info + THREAD_SIZE
51 - sizeof(struct pt_regs));
52}
53
54/*
55 * This routine will get a word off of the process kernel stack. 38 * This routine will get a word off of the process kernel stack.
56 */ 39 */
57static inline unsigned long int 40static inline unsigned long int
@@ -59,7 +42,7 @@ get_stack_long(struct task_struct *task, int offset)
59{ 42{
60 unsigned long *stack; 43 unsigned long *stack;
61 44
62 stack = (unsigned long *)get_user_regs(task); 45 stack = (unsigned long *)task_pt_regs(task);
63 46
64 return stack[offset]; 47 return stack[offset];
65} 48}
@@ -72,7 +55,7 @@ put_stack_long(struct task_struct *task, int offset, unsigned long data)
72{ 55{
73 unsigned long *stack; 56 unsigned long *stack;
74 57
75 stack = (unsigned long *)get_user_regs(task); 58 stack = (unsigned long *)task_pt_regs(task);
76 stack[offset] = data; 59 stack[offset] = data;
77 60
78 return 0; 61 return 0;
@@ -208,7 +191,7 @@ static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
208 */ 191 */
209static int ptrace_getregs(struct task_struct *tsk, void __user *uregs) 192static int ptrace_getregs(struct task_struct *tsk, void __user *uregs)
210{ 193{
211 struct pt_regs *regs = get_user_regs(tsk); 194 struct pt_regs *regs = task_pt_regs(tsk);
212 195
213 return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0; 196 return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
214} 197}
@@ -223,7 +206,7 @@ static int ptrace_setregs(struct task_struct *tsk, void __user *uregs)
223 206
224 ret = -EFAULT; 207 ret = -EFAULT;
225 if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) { 208 if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {
226 struct pt_regs *regs = get_user_regs(tsk); 209 struct pt_regs *regs = task_pt_regs(tsk);
227 *regs = newregs; 210 *regs = newregs;
228 ret = 0; 211 ret = 0;
229 } 212 }
@@ -762,28 +745,16 @@ asmlinkage long sys_ptrace(long request, long pid, long addr, long data)
762 int ret; 745 int ret;
763 746
764 lock_kernel(); 747 lock_kernel();
765 ret = -EPERM;
766 if (request == PTRACE_TRACEME) { 748 if (request == PTRACE_TRACEME) {
767 /* are we already being traced? */ 749 ret = ptrace_traceme();
768 if (current->ptrace & PT_PTRACED)
769 goto out;
770 /* set the ptrace bit in the process flags. */
771 current->ptrace |= PT_PTRACED;
772 ret = 0;
773 goto out; 750 goto out;
774 } 751 }
775 ret = -ESRCH;
776 read_lock(&tasklist_lock);
777 child = find_task_by_pid(pid);
778 if (child)
779 get_task_struct(child);
780 read_unlock(&tasklist_lock);
781 if (!child)
782 goto out;
783 752
784 ret = -EPERM; 753 child = ptrace_get_task_struct(pid);
785 if (pid == 1) /* you may not mess with init */ 754 if (IS_ERR(child)) {
755 ret = PTR_ERR(child);
786 goto out; 756 goto out;
757 }
787 758
788 if (request == PTRACE_ATTACH) { 759 if (request == PTRACE_ATTACH) {
789 ret = ptrace_attach(child); 760 ret = ptrace_attach(child);
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index f722ec8eb021..c2e4dccf0112 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -320,6 +320,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
320#elif defined(CONFIG_CHIP_MP) 320#elif defined(CONFIG_CHIP_MP)
321 seq_printf(m, "cpu family\t: M32R-MP\n" 321 seq_printf(m, "cpu family\t: M32R-MP\n"
322 "cache size\t: I-xxKB/D-xxKB\n"); 322 "cache size\t: I-xxKB/D-xxKB\n");
323#elif defined(CONFIG_CHIP_M32104)
324 seq_printf(m,"cpu family\t: M32104\n"
325 "cache size\t: I-8KB/D-8KB\n");
323#else 326#else
324 seq_printf(m, "cpu family\t: Unknown\n"); 327 seq_printf(m, "cpu family\t: Unknown\n");
325#endif 328#endif
@@ -340,6 +343,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
340 seq_printf(m, "Machine\t\t: uServer\n"); 343 seq_printf(m, "Machine\t\t: uServer\n");
341#elif defined(CONFIG_PLAT_OAKS32R) 344#elif defined(CONFIG_PLAT_OAKS32R)
342 seq_printf(m, "Machine\t\t: OAKS32R\n"); 345 seq_printf(m, "Machine\t\t: OAKS32R\n");
346#elif defined(CONFIG_PLAT_M32104UT)
347 seq_printf(m, "Machine\t\t: M3T-M32104UT uT Engine board\n");
343#else 348#else
344 seq_printf(m, "Machine\t\t: Unknown\n"); 349 seq_printf(m, "Machine\t\t: Unknown\n");
345#endif 350#endif
@@ -389,7 +394,7 @@ unsigned long cpu_initialized __initdata = 0;
389 */ 394 */
390#if defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \ 395#if defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_XNUX2) \
391 || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \ 396 || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_M32102) \
392 || defined(CONFIG_CHIP_OPSP) 397 || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
393void __init cpu_init (void) 398void __init cpu_init (void)
394{ 399{
395 int cpu_id = smp_processor_id(); 400 int cpu_id = smp_processor_id();
diff --git a/arch/m32r/kernel/setup_m32104ut.c b/arch/m32r/kernel/setup_m32104ut.c
new file mode 100644
index 000000000000..6328e1357a80
--- /dev/null
+++ b/arch/m32r/kernel/setup_m32104ut.c
@@ -0,0 +1,156 @@
1/*
2 * linux/arch/m32r/kernel/setup_m32104ut.c
3 *
4 * Setup routines for M32104UT Board
5 *
6 * Copyright (c) 2002-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Mamoru Sakugawa,
8 * Naoto Sugai, Hayato Fujiwara
9 */
10
11#include <linux/config.h>
12#include <linux/irq.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/device.h>
16
17#include <asm/system.h>
18#include <asm/m32r.h>
19#include <asm/io.h>
20
21#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
22
23icu_data_t icu_data[NR_IRQS];
24
25static void disable_m32104ut_irq(unsigned int irq)
26{
27 unsigned long port, data;
28
29 port = irq2port(irq);
30 data = icu_data[irq].icucr|M32R_ICUCR_ILEVEL7;
31 outl(data, port);
32}
33
34static void enable_m32104ut_irq(unsigned int irq)
35{
36 unsigned long port, data;
37
38 port = irq2port(irq);
39 data = icu_data[irq].icucr|M32R_ICUCR_IEN|M32R_ICUCR_ILEVEL6;
40 outl(data, port);
41}
42
43static void mask_and_ack_m32104ut(unsigned int irq)
44{
45 disable_m32104ut_irq(irq);
46}
47
48static void end_m32104ut_irq(unsigned int irq)
49{
50 enable_m32104ut_irq(irq);
51}
52
53static unsigned int startup_m32104ut_irq(unsigned int irq)
54{
55 enable_m32104ut_irq(irq);
56 return (0);
57}
58
59static void shutdown_m32104ut_irq(unsigned int irq)
60{
61 unsigned long port;
62
63 port = irq2port(irq);
64 outl(M32R_ICUCR_ILEVEL7, port);
65}
66
67static struct hw_interrupt_type m32104ut_irq_type =
68{
69 .typename = "M32104UT-IRQ",
70 .startup = startup_m32104ut_irq,
71 .shutdown = shutdown_m32104ut_irq,
72 .enable = enable_m32104ut_irq,
73 .disable = disable_m32104ut_irq,
74 .ack = mask_and_ack_m32104ut,
75 .end = end_m32104ut_irq
76};
77
78void __init init_IRQ(void)
79{
80 static int once = 0;
81
82 if (once)
83 return;
84 else
85 once++;
86
87#if defined(CONFIG_SMC91X)
88 /* INT#0: LAN controller on M32104UT-LAN (SMC91C111)*/
89 irq_desc[M32R_IRQ_INT0].status = IRQ_DISABLED;
90 irq_desc[M32R_IRQ_INT0].handler = &m32104ut_irq_type;
91 irq_desc[M32R_IRQ_INT0].action = 0;
92 irq_desc[M32R_IRQ_INT0].depth = 1;
93 icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN | M32R_ICUCR_ISMOD11; /* "H" level sense */
94 disable_m32104ut_irq(M32R_IRQ_INT0);
95#endif /* CONFIG_SMC91X */
96
97 /* MFT2 : system timer */
98 irq_desc[M32R_IRQ_MFT2].status = IRQ_DISABLED;
99 irq_desc[M32R_IRQ_MFT2].handler = &m32104ut_irq_type;
100 irq_desc[M32R_IRQ_MFT2].action = 0;
101 irq_desc[M32R_IRQ_MFT2].depth = 1;
102 icu_data[M32R_IRQ_MFT2].icucr = M32R_ICUCR_IEN;
103 disable_m32104ut_irq(M32R_IRQ_MFT2);
104
105#ifdef CONFIG_SERIAL_M32R_SIO
106 /* SIO0_R : uart receive data */
107 irq_desc[M32R_IRQ_SIO0_R].status = IRQ_DISABLED;
108 irq_desc[M32R_IRQ_SIO0_R].handler = &m32104ut_irq_type;
109 irq_desc[M32R_IRQ_SIO0_R].action = 0;
110 irq_desc[M32R_IRQ_SIO0_R].depth = 1;
111 icu_data[M32R_IRQ_SIO0_R].icucr = M32R_ICUCR_IEN;
112 disable_m32104ut_irq(M32R_IRQ_SIO0_R);
113
114 /* SIO0_S : uart send data */
115 irq_desc[M32R_IRQ_SIO0_S].status = IRQ_DISABLED;
116 irq_desc[M32R_IRQ_SIO0_S].handler = &m32104ut_irq_type;
117 irq_desc[M32R_IRQ_SIO0_S].action = 0;
118 irq_desc[M32R_IRQ_SIO0_S].depth = 1;
119 icu_data[M32R_IRQ_SIO0_S].icucr = M32R_ICUCR_IEN;
120 disable_m32104ut_irq(M32R_IRQ_SIO0_S);
121#endif /* CONFIG_SERIAL_M32R_SIO */
122}
123
124#if defined(CONFIG_SMC91X)
125
126#define LAN_IOSTART 0x300
127#define LAN_IOEND 0x320
128static struct resource smc91x_resources[] = {
129 [0] = {
130 .start = (LAN_IOSTART),
131 .end = (LAN_IOEND),
132 .flags = IORESOURCE_MEM,
133 },
134 [1] = {
135 .start = M32R_IRQ_INT0,
136 .end = M32R_IRQ_INT0,
137 .flags = IORESOURCE_IRQ,
138 }
139};
140
141static struct platform_device smc91x_device = {
142 .name = "smc91x",
143 .id = 0,
144 .num_resources = ARRAY_SIZE(smc91x_resources),
145 .resource = smc91x_resources,
146};
147#endif
148
149static int __init platform_init(void)
150{
151#if defined(CONFIG_SMC91X)
152 platform_device_register(&smc91x_device);
153#endif
154 return 0;
155}
156arch_initcall(platform_init);
diff --git a/arch/m32r/kernel/setup_m32700ut.c b/arch/m32r/kernel/setup_m32700ut.c
index cb76916b014d..fad1fc99bb27 100644
--- a/arch/m32r/kernel/setup_m32700ut.c
+++ b/arch/m32r/kernel/setup_m32700ut.c
@@ -26,15 +26,7 @@
26 */ 26 */
27#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) 27#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
28 28
29#ifndef CONFIG_SMP
30typedef struct {
31 unsigned long icucr; /* ICU Control Register */
32} icu_data_t;
33static icu_data_t icu_data[M32700UT_NUM_CPU_IRQ];
34#else
35icu_data_t icu_data[M32700UT_NUM_CPU_IRQ]; 29icu_data_t icu_data[M32700UT_NUM_CPU_IRQ];
36#endif /* CONFIG_SMP */
37
38 30
39static void disable_m32700ut_irq(unsigned int irq) 31static void disable_m32700ut_irq(unsigned int irq)
40{ 32{
diff --git a/arch/m32r/kernel/setup_mappi.c b/arch/m32r/kernel/setup_mappi.c
index 501d798cf050..00f253209cb3 100644
--- a/arch/m32r/kernel/setup_mappi.c
+++ b/arch/m32r/kernel/setup_mappi.c
@@ -19,12 +19,6 @@
19 19
20#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) 20#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
21 21
22#ifndef CONFIG_SMP
23typedef struct {
24 unsigned long icucr; /* ICU Control Register */
25} icu_data_t;
26#endif /* CONFIG_SMP */
27
28icu_data_t icu_data[NR_IRQS]; 22icu_data_t icu_data[NR_IRQS];
29 23
30static void disable_mappi_irq(unsigned int irq) 24static void disable_mappi_irq(unsigned int irq)
diff --git a/arch/m32r/kernel/setup_mappi2.c b/arch/m32r/kernel/setup_mappi2.c
index 7f2db5bfd626..eebc9d8b4e72 100644
--- a/arch/m32r/kernel/setup_mappi2.c
+++ b/arch/m32r/kernel/setup_mappi2.c
@@ -19,12 +19,6 @@
19 19
20#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) 20#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
21 21
22#ifndef CONFIG_SMP
23typedef struct {
24 unsigned long icucr; /* ICU Control Register */
25} icu_data_t;
26#endif /* CONFIG_SMP */
27
28icu_data_t icu_data[NR_IRQS]; 22icu_data_t icu_data[NR_IRQS];
29 23
30static void disable_mappi2_irq(unsigned int irq) 24static void disable_mappi2_irq(unsigned int irq)
diff --git a/arch/m32r/kernel/setup_mappi3.c b/arch/m32r/kernel/setup_mappi3.c
index f6ecdf7f555c..d2ff021e2d3d 100644
--- a/arch/m32r/kernel/setup_mappi3.c
+++ b/arch/m32r/kernel/setup_mappi3.c
@@ -19,12 +19,6 @@
19 19
20#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) 20#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
21 21
22#ifndef CONFIG_SMP
23typedef struct {
24 unsigned long icucr; /* ICU Control Register */
25} icu_data_t;
26#endif /* CONFIG_SMP */
27
28icu_data_t icu_data[NR_IRQS]; 22icu_data_t icu_data[NR_IRQS];
29 23
30static void disable_mappi3_irq(unsigned int irq) 24static void disable_mappi3_irq(unsigned int irq)
diff --git a/arch/m32r/kernel/setup_oaks32r.c b/arch/m32r/kernel/setup_oaks32r.c
index 45add5b76f19..0e9e63538c0f 100644
--- a/arch/m32r/kernel/setup_oaks32r.c
+++ b/arch/m32r/kernel/setup_oaks32r.c
@@ -18,12 +18,6 @@
18 18
19#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) 19#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
20 20
21#ifndef CONFIG_SMP
22typedef struct {
23 unsigned long icucr; /* ICU Control Register */
24} icu_data_t;
25#endif /* CONFIG_SMP */
26
27icu_data_t icu_data[NR_IRQS]; 21icu_data_t icu_data[NR_IRQS];
28 22
29static void disable_oaks32r_irq(unsigned int irq) 23static void disable_oaks32r_irq(unsigned int irq)
diff --git a/arch/m32r/kernel/setup_opsput.c b/arch/m32r/kernel/setup_opsput.c
index 1fbb140854e7..548e8fc7949b 100644
--- a/arch/m32r/kernel/setup_opsput.c
+++ b/arch/m32r/kernel/setup_opsput.c
@@ -27,15 +27,7 @@
27 */ 27 */
28#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) 28#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
29 29
30#ifndef CONFIG_SMP
31typedef struct {
32 unsigned long icucr; /* ICU Control Register */
33} icu_data_t;
34static icu_data_t icu_data[OPSPUT_NUM_CPU_IRQ];
35#else
36icu_data_t icu_data[OPSPUT_NUM_CPU_IRQ]; 30icu_data_t icu_data[OPSPUT_NUM_CPU_IRQ];
37#endif /* CONFIG_SMP */
38
39 31
40static void disable_opsput_irq(unsigned int irq) 32static void disable_opsput_irq(unsigned int irq)
41{ 33{
diff --git a/arch/m32r/kernel/setup_usrv.c b/arch/m32r/kernel/setup_usrv.c
index 634741bf9d35..64be659a23e7 100644
--- a/arch/m32r/kernel/setup_usrv.c
+++ b/arch/m32r/kernel/setup_usrv.c
@@ -18,12 +18,6 @@
18 18
19#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long))) 19#define irq2port(x) (M32R_ICU_CR1_PORTL + ((x - 1) * sizeof(unsigned long)))
20 20
21#if !defined(CONFIG_SMP)
22typedef struct {
23 unsigned long icucr; /* ICU Control Register */
24} icu_data_t;
25#endif /* CONFIG_SMP */
26
27icu_data_t icu_data[M32700UT_NUM_CPU_IRQ]; 21icu_data_t icu_data[M32700UT_NUM_CPU_IRQ];
28 22
29static void disable_mappi_irq(unsigned int irq) 23static void disable_mappi_irq(unsigned int irq)
diff --git a/arch/m32r/kernel/smpboot.c b/arch/m32r/kernel/smpboot.c
index b90c54169fa5..d7ec16e7fb25 100644
--- a/arch/m32r/kernel/smpboot.c
+++ b/arch/m32r/kernel/smpboot.c
@@ -286,7 +286,7 @@ static void __init do_boot_cpu(int phys_id)
286 /* So we see what's up */ 286 /* So we see what's up */
287 printk("Booting processor %d/%d\n", phys_id, cpu_id); 287 printk("Booting processor %d/%d\n", phys_id, cpu_id);
288 stack_start.spi = (void *)idle->thread.sp; 288 stack_start.spi = (void *)idle->thread.sp;
289 idle->thread_info->cpu = cpu_id; 289 task_thread_info(idle)->cpu = cpu_id;
290 290
291 /* 291 /*
292 * Send Startup IPI 292 * Send Startup IPI
diff --git a/arch/m32r/kernel/time.c b/arch/m32r/kernel/time.c
index 2ebce2063fea..b8e68b542302 100644
--- a/arch/m32r/kernel/time.c
+++ b/arch/m32r/kernel/time.c
@@ -57,7 +57,7 @@ static unsigned long do_gettimeoffset(void)
57 57
58#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \ 58#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \
59 || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \ 59 || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \
60 || defined(CONFIG_CHIP_OPSP) 60 || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
61#ifndef CONFIG_SMP 61#ifndef CONFIG_SMP
62 62
63 unsigned long count; 63 unsigned long count;
@@ -268,7 +268,7 @@ void __init time_init(void)
268 268
269#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \ 269#if defined(CONFIG_CHIP_M32102) || defined(CONFIG_CHIP_XNUX2) \
270 || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \ 270 || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_M32700) \
271 || defined(CONFIG_CHIP_OPSP) 271 || defined(CONFIG_CHIP_OPSP) || defined(CONFIG_CHIP_M32104)
272 272
273 /* M32102 MFT setup */ 273 /* M32102 MFT setup */
274 setup_irq(M32R_IRQ_MFT2, &irq0); 274 setup_irq(M32R_IRQ_MFT2, &irq0);
diff --git a/arch/arm/configs/epxa10db_defconfig b/arch/m32r/m32104ut/defconfig.m32104ut
index 9fb8b58c4954..454de336803a 100644
--- a/arch/arm/configs/epxa10db_defconfig
+++ b/arch/m32r/m32104ut/defconfig.m32104ut
@@ -1,14 +1,13 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc1-bk2 3# Linux kernel version: 2.6.14
4# Sun Mar 27 22:46:51 2005 4# Wed Nov 9 16:04:51 2005
5# 5#
6CONFIG_ARM=y 6CONFIG_M32R=y
7CONFIG_MMU=y 7# CONFIG_UID16 is not set
8CONFIG_UID16=y 8CONFIG_GENERIC_ISA_DMA=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_GENERIC_HARDIRQS=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y 10CONFIG_GENERIC_IRQ_PROBE=y
11CONFIG_GENERIC_IOMAP=y
12 11
13# 12#
14# Code maturity level options 13# Code maturity level options
@@ -16,147 +15,174 @@ CONFIG_GENERIC_IOMAP=y
16CONFIG_EXPERIMENTAL=y 15CONFIG_EXPERIMENTAL=y
17CONFIG_CLEAN_COMPILE=y 16CONFIG_CLEAN_COMPILE=y
18CONFIG_BROKEN_ON_SMP=y 17CONFIG_BROKEN_ON_SMP=y
18CONFIG_INIT_ENV_ARG_LIMIT=32
19 19
20# 20#
21# General setup 21# General setup
22# 22#
23CONFIG_LOCALVERSION="" 23CONFIG_LOCALVERSION=""
24CONFIG_SWAP=y 24CONFIG_LOCALVERSION_AUTO=y
25CONFIG_SYSVIPC=y
26# CONFIG_POSIX_MQUEUE is not set 25# CONFIG_POSIX_MQUEUE is not set
27# CONFIG_BSD_PROCESS_ACCT is not set 26# CONFIG_BSD_PROCESS_ACCT is not set
28CONFIG_SYSCTL=y 27CONFIG_SYSCTL=y
29# CONFIG_AUDIT is not set 28# CONFIG_AUDIT is not set
30# CONFIG_HOTPLUG is not set 29CONFIG_HOTPLUG=y
31CONFIG_KOBJECT_UEVENT=y 30# CONFIG_KOBJECT_UEVENT is not set
32# CONFIG_IKCONFIG is not set 31# CONFIG_IKCONFIG is not set
33# CONFIG_EMBEDDED is not set 32CONFIG_INITRAMFS_SOURCE=""
34CONFIG_KALLSYMS=y 33CONFIG_EMBEDDED=y
35# CONFIG_KALLSYMS_EXTRA_PASS is not set 34# CONFIG_KALLSYMS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
36CONFIG_BASE_FULL=y 37CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y 38# CONFIG_FUTEX is not set
38CONFIG_EPOLL=y 39# CONFIG_EPOLL is not set
39CONFIG_CC_OPTIMIZE_FOR_SIZE=y 40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0 41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0 42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0 43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0 44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set 45CONFIG_TINY_SHMEM=y
46CONFIG_BASE_SMALL=0 46CONFIG_BASE_SMALL=0
47 47
48# 48#
49# Loadable module support 49# Loadable module support
50# 50#
51CONFIG_MODULES=y 51# CONFIG_MODULES is not set
52CONFIG_MODULE_UNLOAD=y 52
53# CONFIG_MODULE_FORCE_UNLOAD is not set 53#
54CONFIG_OBSOLETE_MODPARM=y 54# Processor type and features
55# CONFIG_MODVERSIONS is not set 55#
56# CONFIG_MODULE_SRCVERSION_ALL is not set 56# CONFIG_PLAT_MAPPI is not set
57# CONFIG_KMOD is not set 57# CONFIG_PLAT_USRV is not set
58 58# CONFIG_PLAT_M32700UT is not set
59# 59# CONFIG_PLAT_OPSPUT is not set
60# System Type 60# CONFIG_PLAT_OAKS32R is not set
61# 61# CONFIG_PLAT_MAPPI2 is not set
62# CONFIG_ARCH_CLPS7500 is not set 62# CONFIG_PLAT_MAPPI3 is not set
63# CONFIG_ARCH_CLPS711X is not set 63CONFIG_PLAT_M32104UT=y
64# CONFIG_ARCH_CO285 is not set 64# CONFIG_CHIP_M32700 is not set
65# CONFIG_ARCH_EBSA110 is not set 65# CONFIG_CHIP_M32102 is not set
66CONFIG_ARCH_CAMELOT=y 66CONFIG_CHIP_M32104=y
67# CONFIG_ARCH_FOOTBRIDGE is not set 67# CONFIG_CHIP_VDEC2 is not set
68# CONFIG_ARCH_INTEGRATOR is not set 68# CONFIG_CHIP_OPSP is not set
69# CONFIG_ARCH_IOP3XX is not set 69CONFIG_ISA_M32R=y
70# CONFIG_ARCH_IXP4XX is not set 70CONFIG_BUS_CLOCK=54000000
71# CONFIG_ARCH_IXP2000 is not set 71CONFIG_TIMER_DIVIDE=128
72# CONFIG_ARCH_L7200 is not set 72# CONFIG_CPU_LITTLE_ENDIAN is not set
73# CONFIG_ARCH_PXA is not set 73CONFIG_MEMORY_START=04000000
74# CONFIG_ARCH_RPC is not set 74CONFIG_MEMORY_SIZE=01000000
75# CONFIG_ARCH_SA1100 is not set 75CONFIG_NOHIGHMEM=y
76# CONFIG_ARCH_S3C2410 is not set 76# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
77# CONFIG_ARCH_SHARK is not set 77CONFIG_SELECT_MEMORY_MODEL=y
78# CONFIG_ARCH_LH7A40X is not set 78CONFIG_FLATMEM_MANUAL=y
79# CONFIG_ARCH_OMAP is not set 79# CONFIG_DISCONTIGMEM_MANUAL is not set
80# CONFIG_ARCH_VERSATILE is not set 80# CONFIG_SPARSEMEM_MANUAL is not set
81# CONFIG_ARCH_IMX is not set 81CONFIG_FLATMEM=y
82# CONFIG_ARCH_H720X is not set 82CONFIG_FLAT_NODE_MEM_MAP=y
83 83# CONFIG_SPARSEMEM_STATIC is not set
84# 84CONFIG_RWSEM_GENERIC_SPINLOCK=y
85# Epxa10db 85# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
86# 86CONFIG_GENERIC_CALIBRATE_DELAY=y
87 87# CONFIG_PREEMPT is not set
88# 88# CONFIG_SMP is not set
89# PLD hotswap support
90#
91CONFIG_PLD=y
92# CONFIG_PLD_HOTSWAP is not set
93 89
94# 90#
95# Processor Type 91# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
96# 92#
97CONFIG_CPU_32=y 93# CONFIG_ISA is not set
98CONFIG_CPU_ARM922T=y
99CONFIG_CPU_32v4=y
100CONFIG_CPU_ABRT_EV4T=y
101CONFIG_CPU_CACHE_V4WT=y
102CONFIG_CPU_CACHE_VIVT=y
103CONFIG_CPU_COPY_V4WB=y
104CONFIG_CPU_TLB_V4WBI=y
105 94
106# 95#
107# Processor Features 96# PCCARD (PCMCIA/CardBus) support
108# 97#
109# CONFIG_ARM_THUMB is not set 98CONFIG_PCCARD=y
110# CONFIG_CPU_ICACHE_DISABLE is not set 99# CONFIG_PCMCIA_DEBUG is not set
111# CONFIG_CPU_DCACHE_DISABLE is not set 100CONFIG_PCMCIA=y
112# CONFIG_CPU_DCACHE_WRITETHROUGH is not set 101CONFIG_PCMCIA_LOAD_CIS=y
102CONFIG_PCMCIA_IOCTL=y
113 103
114# 104#
115# Bus support 105# PC-card bridges
116# 106#
117 107
118# 108#
119# PCCARD (PCMCIA/CardBus) support 109# PCI Hotplug Support
120# 110#
121# CONFIG_PCCARD is not set
122 111
123# 112#
124# Kernel Features 113# Executable file formats
125# 114#
126# CONFIG_PREEMPT is not set 115CONFIG_BINFMT_FLAT=y
127CONFIG_ALIGNMENT_TRAP=y 116# CONFIG_BINFMT_ZFLAT is not set
117# CONFIG_BINFMT_SHARED_FLAT is not set
118# CONFIG_BINFMT_MISC is not set
128 119
129# 120#
130# Boot options 121# Networking
131# 122#
132CONFIG_ZBOOT_ROM_TEXT=0x0 123CONFIG_NET=y
133CONFIG_ZBOOT_ROM_BSS=0x0
134CONFIG_CMDLINE="mem=32M console=ttyUA0,115200 initrd=0x00200000,8M root=/dev/ram0 rw"
135# CONFIG_XIP_KERNEL is not set
136 124
137# 125#
138# Floating point emulation 126# Networking options
139# 127#
128# CONFIG_PACKET is not set
129CONFIG_UNIX=y
130# CONFIG_NET_KEY is not set
131CONFIG_INET=y
132# CONFIG_IP_MULTICAST is not set
133# CONFIG_IP_ADVANCED_ROUTER is not set
134CONFIG_IP_FIB_HASH=y
135CONFIG_IP_PNP=y
136CONFIG_IP_PNP_DHCP=y
137# CONFIG_IP_PNP_BOOTP is not set
138# CONFIG_IP_PNP_RARP is not set
139# CONFIG_NET_IPIP is not set
140# CONFIG_NET_IPGRE is not set
141# CONFIG_ARPD is not set
142# CONFIG_SYN_COOKIES is not set
143# CONFIG_INET_AH is not set
144# CONFIG_INET_ESP is not set
145# CONFIG_INET_IPCOMP is not set
146# CONFIG_INET_TUNNEL is not set
147CONFIG_INET_DIAG=y
148CONFIG_INET_TCP_DIAG=y
149# CONFIG_TCP_CONG_ADVANCED is not set
150CONFIG_TCP_CONG_BIC=y
151# CONFIG_IPV6 is not set
152# CONFIG_NETFILTER is not set
140 153
141# 154#
142# At least one emulation must be selected 155# DCCP Configuration (EXPERIMENTAL)
143# 156#
144CONFIG_FPE_NWFPE=y 157# CONFIG_IP_DCCP is not set
145# CONFIG_FPE_NWFPE_XP is not set
146# CONFIG_FPE_FASTFPE is not set
147 158
148# 159#
149# Userspace binary formats 160# SCTP Configuration (EXPERIMENTAL)
150# 161#
151CONFIG_BINFMT_ELF=y 162# CONFIG_IP_SCTP is not set
152# CONFIG_BINFMT_AOUT is not set 163# CONFIG_ATM is not set
153# CONFIG_BINFMT_MISC is not set 164# CONFIG_BRIDGE is not set
154# CONFIG_ARTHUR is not set 165# CONFIG_VLAN_8021Q is not set
166# CONFIG_DECNET is not set
167# CONFIG_LLC2 is not set
168# CONFIG_IPX is not set
169# CONFIG_ATALK is not set
170# CONFIG_X25 is not set
171# CONFIG_LAPB is not set
172# CONFIG_NET_DIVERT is not set
173# CONFIG_ECONET is not set
174# CONFIG_WAN_ROUTER is not set
175# CONFIG_NET_SCHED is not set
176# CONFIG_NET_CLS_ROUTE is not set
155 177
156# 178#
157# Power management options 179# Network testing
158# 180#
159# CONFIG_PM is not set 181# CONFIG_NET_PKTGEN is not set
182# CONFIG_HAMRADIO is not set
183# CONFIG_IRDA is not set
184# CONFIG_BT is not set
185# CONFIG_IEEE80211 is not set
160 186
161# 187#
162# Device Drivers 188# Device Drivers
@@ -167,7 +193,13 @@ CONFIG_BINFMT_ELF=y
167# 193#
168CONFIG_STANDALONE=y 194CONFIG_STANDALONE=y
169CONFIG_PREVENT_FIRMWARE_BUILD=y 195CONFIG_PREVENT_FIRMWARE_BUILD=y
170# CONFIG_FW_LOADER is not set 196CONFIG_FW_LOADER=y
197# CONFIG_DEBUG_DRIVER is not set
198
199#
200# Connector - unified userspace <-> kernelspace linker
201#
202# CONFIG_CONNECTOR is not set
171 203
172# 204#
173# Memory Technology Devices (MTD) 205# Memory Technology Devices (MTD)
@@ -186,30 +218,34 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
186# 218#
187# Block devices 219# Block devices
188# 220#
189# CONFIG_BLK_DEV_FD is not set
190# CONFIG_BLK_DEV_COW_COMMON is not set 221# CONFIG_BLK_DEV_COW_COMMON is not set
191CONFIG_BLK_DEV_LOOP=y 222CONFIG_BLK_DEV_LOOP=y
192# CONFIG_BLK_DEV_CRYPTOLOOP is not set 223# CONFIG_BLK_DEV_CRYPTOLOOP is not set
193# CONFIG_BLK_DEV_NBD is not set 224CONFIG_BLK_DEV_NBD=y
194CONFIG_BLK_DEV_RAM=y 225CONFIG_BLK_DEV_RAM=y
195CONFIG_BLK_DEV_RAM_COUNT=16 226CONFIG_BLK_DEV_RAM_COUNT=16
196CONFIG_BLK_DEV_RAM_SIZE=8192 227CONFIG_BLK_DEV_RAM_SIZE=4096
197CONFIG_BLK_DEV_INITRD=y 228CONFIG_BLK_DEV_INITRD=y
198CONFIG_INITRAMFS_SOURCE=""
199# CONFIG_CDROM_PKTCDVD is not set 229# CONFIG_CDROM_PKTCDVD is not set
200 230
201# 231#
202# IO Schedulers 232# IO Schedulers
203# 233#
204CONFIG_IOSCHED_NOOP=y 234CONFIG_IOSCHED_NOOP=y
205CONFIG_IOSCHED_AS=y 235# CONFIG_IOSCHED_AS is not set
206CONFIG_IOSCHED_DEADLINE=y 236# CONFIG_IOSCHED_DEADLINE is not set
207CONFIG_IOSCHED_CFQ=y 237# CONFIG_IOSCHED_CFQ is not set
208# CONFIG_ATA_OVER_ETH is not set 238# CONFIG_ATA_OVER_ETH is not set
209 239
210# 240#
241# ATA/ATAPI/MFM/RLL support
242#
243# CONFIG_IDE is not set
244
245#
211# SCSI device support 246# SCSI device support
212# 247#
248# CONFIG_RAID_ATTRS is not set
213# CONFIG_SCSI is not set 249# CONFIG_SCSI is not set
214 250
215# 251#
@@ -220,6 +256,7 @@ CONFIG_IOSCHED_CFQ=y
220# 256#
221# Fusion MPT device support 257# Fusion MPT device support
222# 258#
259# CONFIG_FUSION is not set
223 260
224# 261#
225# IEEE 1394 (FireWire) support 262# IEEE 1394 (FireWire) support
@@ -230,81 +267,26 @@ CONFIG_IOSCHED_CFQ=y
230# 267#
231 268
232# 269#
233# Networking support 270# Network device support
234#
235CONFIG_NET=y
236
237#
238# Networking options
239# 271#
240CONFIG_PACKET=y
241# CONFIG_PACKET_MMAP is not set
242# CONFIG_NETLINK_DEV is not set
243CONFIG_UNIX=y
244# CONFIG_NET_KEY is not set
245CONFIG_INET=y
246CONFIG_IP_MULTICAST=y
247# CONFIG_IP_ADVANCED_ROUTER is not set
248CONFIG_IP_PNP=y
249# CONFIG_IP_PNP_DHCP is not set
250# CONFIG_IP_PNP_BOOTP is not set
251# CONFIG_IP_PNP_RARP is not set
252# CONFIG_NET_IPIP is not set
253# CONFIG_NET_IPGRE is not set
254# CONFIG_IP_MROUTE is not set
255# CONFIG_ARPD is not set
256# CONFIG_SYN_COOKIES is not set
257# CONFIG_INET_AH is not set
258# CONFIG_INET_ESP is not set
259# CONFIG_INET_IPCOMP is not set
260# CONFIG_INET_TUNNEL is not set
261# CONFIG_IP_TCPDIAG is not set
262# CONFIG_IP_TCPDIAG_IPV6 is not set
263# CONFIG_IPV6 is not set
264# CONFIG_NETFILTER is not set
265
266#
267# SCTP Configuration (EXPERIMENTAL)
268#
269# CONFIG_IP_SCTP is not set
270# CONFIG_ATM is not set
271# CONFIG_BRIDGE is not set
272# CONFIG_VLAN_8021Q is not set
273# CONFIG_DECNET is not set
274# CONFIG_LLC2 is not set
275# CONFIG_IPX is not set
276# CONFIG_ATALK is not set
277# CONFIG_X25 is not set
278# CONFIG_LAPB is not set
279# CONFIG_NET_DIVERT is not set
280# CONFIG_ECONET is not set
281# CONFIG_WAN_ROUTER is not set
282
283#
284# QoS and/or fair queueing
285#
286# CONFIG_NET_SCHED is not set
287# CONFIG_NET_CLS_ROUTE is not set
288
289#
290# Network testing
291#
292# CONFIG_NET_PKTGEN is not set
293# CONFIG_NETPOLL is not set
294# CONFIG_NET_POLL_CONTROLLER is not set
295# CONFIG_HAMRADIO is not set
296# CONFIG_IRDA is not set
297# CONFIG_BT is not set
298CONFIG_NETDEVICES=y 272CONFIG_NETDEVICES=y
299# CONFIG_DUMMY is not set 273CONFIG_DUMMY=y
300# CONFIG_BONDING is not set 274# CONFIG_BONDING is not set
301# CONFIG_EQUALIZER is not set 275# CONFIG_EQUALIZER is not set
302# CONFIG_TUN is not set 276# CONFIG_TUN is not set
303 277
304# 278#
279# PHY device support
280#
281# CONFIG_PHYLIB is not set
282
283#
305# Ethernet (10 or 100Mbit) 284# Ethernet (10 or 100Mbit)
306# 285#
307# CONFIG_NET_ETHERNET is not set 286CONFIG_NET_ETHERNET=y
287CONFIG_MII=y
288CONFIG_SMC91X=y
289# CONFIG_NE2000 is not set
308 290
309# 291#
310# Ethernet (1000 Mbit) 292# Ethernet (1000 Mbit)
@@ -324,20 +306,20 @@ CONFIG_NETDEVICES=y
324# CONFIG_NET_RADIO is not set 306# CONFIG_NET_RADIO is not set
325 307
326# 308#
309# PCMCIA network device support
310#
311# CONFIG_NET_PCMCIA is not set
312
313#
327# Wan interfaces 314# Wan interfaces
328# 315#
329# CONFIG_WAN is not set 316# CONFIG_WAN is not set
330CONFIG_PPP=y 317# CONFIG_PPP is not set
331CONFIG_PPP_MULTILINK=y
332# CONFIG_PPP_FILTER is not set
333CONFIG_PPP_ASYNC=y
334CONFIG_PPP_SYNC_TTY=y
335CONFIG_PPP_DEFLATE=y
336# CONFIG_PPP_BSDCOMP is not set
337# CONFIG_PPPOE is not set
338# CONFIG_SLIP is not set 318# CONFIG_SLIP is not set
339# CONFIG_SHAPER is not set 319# CONFIG_SHAPER is not set
340# CONFIG_NETCONSOLE is not set 320# CONFIG_NETCONSOLE is not set
321# CONFIG_NETPOLL is not set
322# CONFIG_NET_POLL_CONTROLLER is not set
341 323
342# 324#
343# ISDN subsystem 325# ISDN subsystem
@@ -345,46 +327,25 @@ CONFIG_PPP_DEFLATE=y
345# CONFIG_ISDN is not set 327# CONFIG_ISDN is not set
346 328
347# 329#
348# Input device support 330# Telephony Support
349#
350CONFIG_INPUT=y
351
352#
353# Userland interfaces
354# 331#
355CONFIG_INPUT_MOUSEDEV=y 332# CONFIG_PHONE is not set
356CONFIG_INPUT_MOUSEDEV_PSAUX=y
357CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
358CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
359# CONFIG_INPUT_JOYDEV is not set
360# CONFIG_INPUT_TSDEV is not set
361# CONFIG_INPUT_EVDEV is not set
362# CONFIG_INPUT_EVBUG is not set
363 333
364# 334#
365# Input Device Drivers 335# Input device support
366# 336#
367# CONFIG_INPUT_KEYBOARD is not set 337# CONFIG_INPUT is not set
368# CONFIG_INPUT_MOUSE is not set
369# CONFIG_INPUT_JOYSTICK is not set
370# CONFIG_INPUT_TOUCHSCREEN is not set
371# CONFIG_INPUT_MISC is not set
372 338
373# 339#
374# Hardware I/O ports 340# Hardware I/O ports
375# 341#
376CONFIG_SERIO=y 342# CONFIG_SERIO is not set
377CONFIG_SERIO_SERPORT=y
378# CONFIG_SERIO_RAW is not set
379# CONFIG_GAMEPORT is not set 343# CONFIG_GAMEPORT is not set
380CONFIG_SOUND_GAMEPORT=y
381 344
382# 345#
383# Character devices 346# Character devices
384# 347#
385CONFIG_VT=y 348# CONFIG_VT is not set
386CONFIG_VT_CONSOLE=y
387CONFIG_HW_CONSOLE=y
388# CONFIG_SERIAL_NONSTANDARD is not set 349# CONFIG_SERIAL_NONSTANDARD is not set
389 350
390# 351#
@@ -395,10 +356,10 @@ CONFIG_HW_CONSOLE=y
395# 356#
396# Non-8250 serial port support 357# Non-8250 serial port support
397# 358#
398CONFIG_SERIAL_UART00=y
399CONFIG_SERIAL_UART00_CONSOLE=y
400CONFIG_SERIAL_CORE=y 359CONFIG_SERIAL_CORE=y
401CONFIG_SERIAL_CORE_CONSOLE=y 360CONFIG_SERIAL_CORE_CONSOLE=y
361CONFIG_SERIAL_M32R_SIO=y
362CONFIG_SERIAL_M32R_SIO_CONSOLE=y
402CONFIG_UNIX98_PTYS=y 363CONFIG_UNIX98_PTYS=y
403CONFIG_LEGACY_PTYS=y 364CONFIG_LEGACY_PTYS=y
404CONFIG_LEGACY_PTY_COUNT=256 365CONFIG_LEGACY_PTY_COUNT=256
@@ -411,8 +372,13 @@ CONFIG_LEGACY_PTY_COUNT=256
411# 372#
412# Watchdog Cards 373# Watchdog Cards
413# 374#
414# CONFIG_WATCHDOG is not set 375CONFIG_WATCHDOG=y
415# CONFIG_NVRAM is not set 376# CONFIG_WATCHDOG_NOWAYOUT is not set
377
378#
379# Watchdog Device Drivers
380#
381CONFIG_SOFT_WATCHDOG=y
416# CONFIG_RTC is not set 382# CONFIG_RTC is not set
417# CONFIG_DTLK is not set 383# CONFIG_DTLK is not set
418# CONFIG_R3964 is not set 384# CONFIG_R3964 is not set
@@ -420,13 +386,16 @@ CONFIG_LEGACY_PTY_COUNT=256
420# 386#
421# Ftape, the floppy tape device driver 387# Ftape, the floppy tape device driver
422# 388#
423# CONFIG_DRM is not set 389
390#
391# PCMCIA character devices
392#
393# CONFIG_SYNCLINK_CS is not set
424# CONFIG_RAW_DRIVER is not set 394# CONFIG_RAW_DRIVER is not set
425 395
426# 396#
427# TPM devices 397# TPM devices
428# 398#
429# CONFIG_TCG_TPM is not set
430 399
431# 400#
432# I2C support 401# I2C support
@@ -434,10 +403,25 @@ CONFIG_LEGACY_PTY_COUNT=256
434# CONFIG_I2C is not set 403# CONFIG_I2C is not set
435 404
436# 405#
406# Dallas's 1-wire bus
407#
408# CONFIG_W1 is not set
409
410#
411# Hardware Monitoring support
412#
413# CONFIG_HWMON is not set
414# CONFIG_HWMON_VID is not set
415
416#
437# Misc devices 417# Misc devices
438# 418#
439 419
440# 420#
421# Multimedia Capabilities Port drivers
422#
423
424#
441# Multimedia devices 425# Multimedia devices
442# 426#
443# CONFIG_VIDEO_DEV is not set 427# CONFIG_VIDEO_DEV is not set
@@ -453,12 +437,6 @@ CONFIG_LEGACY_PTY_COUNT=256
453# CONFIG_FB is not set 437# CONFIG_FB is not set
454 438
455# 439#
456# Console display driver support
457#
458# CONFIG_VGA_CONSOLE is not set
459CONFIG_DUMMY_CONSOLE=y
460
461#
462# Sound 440# Sound
463# 441#
464# CONFIG_SOUND is not set 442# CONFIG_SOUND is not set
@@ -466,9 +444,8 @@ CONFIG_DUMMY_CONSOLE=y
466# 444#
467# USB support 445# USB support
468# 446#
469CONFIG_USB_ARCH_HAS_HCD=y 447# CONFIG_USB_ARCH_HAS_HCD is not set
470# CONFIG_USB_ARCH_HAS_OHCI is not set 448# CONFIG_USB_ARCH_HAS_OHCI is not set
471# CONFIG_USB is not set
472 449
473# 450#
474# USB Gadget Support 451# USB Gadget Support
@@ -481,25 +458,38 @@ CONFIG_USB_ARCH_HAS_HCD=y
481# CONFIG_MMC is not set 458# CONFIG_MMC is not set
482 459
483# 460#
461# InfiniBand support
462#
463
464#
465# SN Devices
466#
467
468#
484# File systems 469# File systems
485# 470#
486CONFIG_EXT2_FS=y 471CONFIG_EXT2_FS=y
487# CONFIG_EXT2_FS_XATTR is not set 472# CONFIG_EXT2_FS_XATTR is not set
488# CONFIG_EXT3_FS is not set 473# CONFIG_EXT2_FS_XIP is not set
489# CONFIG_JBD is not set 474CONFIG_EXT3_FS=y
475CONFIG_EXT3_FS_XATTR=y
476CONFIG_EXT3_FS_POSIX_ACL=y
477# CONFIG_EXT3_FS_SECURITY is not set
478CONFIG_JBD=y
479# CONFIG_JBD_DEBUG is not set
480CONFIG_FS_MBCACHE=y
490# CONFIG_REISERFS_FS is not set 481# CONFIG_REISERFS_FS is not set
491# CONFIG_JFS_FS is not set 482# CONFIG_JFS_FS is not set
492 483CONFIG_FS_POSIX_ACL=y
493#
494# XFS support
495#
496# CONFIG_XFS_FS is not set 484# CONFIG_XFS_FS is not set
497# CONFIG_MINIX_FS is not set 485# CONFIG_MINIX_FS is not set
498# CONFIG_ROMFS_FS is not set 486# CONFIG_ROMFS_FS is not set
487# CONFIG_INOTIFY is not set
499# CONFIG_QUOTA is not set 488# CONFIG_QUOTA is not set
500CONFIG_DNOTIFY=y 489CONFIG_DNOTIFY=y
501CONFIG_AUTOFS_FS=y 490# CONFIG_AUTOFS_FS is not set
502CONFIG_AUTOFS4_FS=y 491# CONFIG_AUTOFS4_FS is not set
492# CONFIG_FUSE_FS is not set
503 493
504# 494#
505# CD-ROM/DVD Filesystems 495# CD-ROM/DVD Filesystems
@@ -510,8 +500,11 @@ CONFIG_AUTOFS4_FS=y
510# 500#
511# DOS/FAT/NT Filesystems 501# DOS/FAT/NT Filesystems
512# 502#
513# CONFIG_MSDOS_FS is not set 503CONFIG_FAT_FS=y
514# CONFIG_VFAT_FS is not set 504CONFIG_MSDOS_FS=y
505CONFIG_VFAT_FS=y
506CONFIG_FAT_DEFAULT_CODEPAGE=932
507CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
515# CONFIG_NTFS_FS is not set 508# CONFIG_NTFS_FS is not set
516 509
517# 510#
@@ -519,11 +512,10 @@ CONFIG_AUTOFS4_FS=y
519# 512#
520CONFIG_PROC_FS=y 513CONFIG_PROC_FS=y
521CONFIG_SYSFS=y 514CONFIG_SYSFS=y
522# CONFIG_DEVFS_FS is not set 515CONFIG_TMPFS=y
523# CONFIG_DEVPTS_FS_XATTR is not set
524# CONFIG_TMPFS is not set
525# CONFIG_HUGETLB_PAGE is not set 516# CONFIG_HUGETLB_PAGE is not set
526CONFIG_RAMFS=y 517CONFIG_RAMFS=y
518# CONFIG_RELAYFS_FS is not set
527 519
528# 520#
529# Miscellaneous filesystems 521# Miscellaneous filesystems
@@ -535,7 +527,7 @@ CONFIG_RAMFS=y
535# CONFIG_BEFS_FS is not set 527# CONFIG_BEFS_FS is not set
536# CONFIG_BFS_FS is not set 528# CONFIG_BFS_FS is not set
537# CONFIG_EFS_FS is not set 529# CONFIG_EFS_FS is not set
538# CONFIG_CRAMFS is not set 530CONFIG_CRAMFS=y
539# CONFIG_VXFS_FS is not set 531# CONFIG_VXFS_FS is not set
540# CONFIG_HPFS_FS is not set 532# CONFIG_HPFS_FS is not set
541# CONFIG_QNX4FS_FS is not set 533# CONFIG_QNX4FS_FS is not set
@@ -545,14 +537,25 @@ CONFIG_RAMFS=y
545# 537#
546# Network File Systems 538# Network File Systems
547# 539#
548# CONFIG_NFS_FS is not set 540CONFIG_NFS_FS=y
541CONFIG_NFS_V3=y
542# CONFIG_NFS_V3_ACL is not set
543# CONFIG_NFS_V4 is not set
544# CONFIG_NFS_DIRECTIO is not set
549# CONFIG_NFSD is not set 545# CONFIG_NFSD is not set
550CONFIG_SMB_FS=y 546CONFIG_ROOT_NFS=y
551# CONFIG_SMB_NLS_DEFAULT is not set 547CONFIG_LOCKD=y
548CONFIG_LOCKD_V4=y
549CONFIG_NFS_COMMON=y
550CONFIG_SUNRPC=y
551# CONFIG_RPCSEC_GSS_KRB5 is not set
552# CONFIG_RPCSEC_GSS_SPKM3 is not set
553# CONFIG_SMB_FS is not set
552# CONFIG_CIFS is not set 554# CONFIG_CIFS is not set
553# CONFIG_NCP_FS is not set 555# CONFIG_NCP_FS is not set
554# CONFIG_CODA_FS is not set 556# CONFIG_CODA_FS is not set
555# CONFIG_AFS_FS is not set 557# CONFIG_AFS_FS is not set
558# CONFIG_9P_FS is not set
556 559
557# 560#
558# Partition Types 561# Partition Types
@@ -565,7 +568,7 @@ CONFIG_MSDOS_PARTITION=y
565# 568#
566CONFIG_NLS=y 569CONFIG_NLS=y
567CONFIG_NLS_DEFAULT="iso8859-1" 570CONFIG_NLS_DEFAULT="iso8859-1"
568# CONFIG_NLS_CODEPAGE_437 is not set 571CONFIG_NLS_CODEPAGE_437=y
569# CONFIG_NLS_CODEPAGE_737 is not set 572# CONFIG_NLS_CODEPAGE_737 is not set
570# CONFIG_NLS_CODEPAGE_775 is not set 573# CONFIG_NLS_CODEPAGE_775 is not set
571# CONFIG_NLS_CODEPAGE_850 is not set 574# CONFIG_NLS_CODEPAGE_850 is not set
@@ -582,7 +585,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
582# CONFIG_NLS_CODEPAGE_869 is not set 585# CONFIG_NLS_CODEPAGE_869 is not set
583# CONFIG_NLS_CODEPAGE_936 is not set 586# CONFIG_NLS_CODEPAGE_936 is not set
584# CONFIG_NLS_CODEPAGE_950 is not set 587# CONFIG_NLS_CODEPAGE_950 is not set
585# CONFIG_NLS_CODEPAGE_932 is not set 588CONFIG_NLS_CODEPAGE_932=y
586# CONFIG_NLS_CODEPAGE_949 is not set 589# CONFIG_NLS_CODEPAGE_949 is not set
587# CONFIG_NLS_CODEPAGE_874 is not set 590# CONFIG_NLS_CODEPAGE_874 is not set
588# CONFIG_NLS_ISO8859_8 is not set 591# CONFIG_NLS_ISO8859_8 is not set
@@ -602,7 +605,7 @@ CONFIG_NLS_DEFAULT="iso8859-1"
602# CONFIG_NLS_ISO8859_15 is not set 605# CONFIG_NLS_ISO8859_15 is not set
603# CONFIG_NLS_KOI8_R is not set 606# CONFIG_NLS_KOI8_R is not set
604# CONFIG_NLS_KOI8_U is not set 607# CONFIG_NLS_KOI8_U is not set
605# CONFIG_NLS_UTF8 is not set 608CONFIG_NLS_UTF8=y
606 609
607# 610#
608# Profiling support 611# Profiling support
@@ -613,11 +616,21 @@ CONFIG_NLS_DEFAULT="iso8859-1"
613# Kernel hacking 616# Kernel hacking
614# 617#
615# CONFIG_PRINTK_TIME is not set 618# CONFIG_PRINTK_TIME is not set
616# CONFIG_DEBUG_KERNEL is not set 619CONFIG_DEBUG_KERNEL=y
620CONFIG_MAGIC_SYSRQ=y
617CONFIG_LOG_BUF_SHIFT=14 621CONFIG_LOG_BUF_SHIFT=14
618CONFIG_DEBUG_BUGVERBOSE=y 622CONFIG_DETECT_SOFTLOCKUP=y
619CONFIG_FRAME_POINTER=y 623# CONFIG_SCHEDSTATS is not set
620# CONFIG_DEBUG_USER is not set 624# CONFIG_DEBUG_SLAB is not set
625# CONFIG_DEBUG_SPINLOCK is not set
626# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
627# CONFIG_DEBUG_KOBJECT is not set
628# CONFIG_DEBUG_BUGVERBOSE is not set
629CONFIG_DEBUG_INFO=y
630# CONFIG_DEBUG_FS is not set
631# CONFIG_FRAME_POINTER is not set
632# CONFIG_DEBUG_STACKOVERFLOW is not set
633# CONFIG_DEBUG_STACK_USAGE is not set
621 634
622# 635#
623# Security options 636# Security options
@@ -637,8 +650,8 @@ CONFIG_FRAME_POINTER=y
637# 650#
638# Library routines 651# Library routines
639# 652#
640CONFIG_CRC_CCITT=y 653# CONFIG_CRC_CCITT is not set
654# CONFIG_CRC16 is not set
641CONFIG_CRC32=y 655CONFIG_CRC32=y
642# CONFIG_LIBCRC32C is not set 656CONFIG_LIBCRC32C=y
643CONFIG_ZLIB_INFLATE=y 657CONFIG_ZLIB_INFLATE=y
644CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/m32r/mm/cache.c b/arch/m32r/mm/cache.c
index 31b0789c1992..9f54dd937013 100644
--- a/arch/m32r/mm/cache.c
+++ b/arch/m32r/mm/cache.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/arch/m32r/mm/cache.c 2 * linux/arch/m32r/mm/cache.c
3 * 3 *
4 * Copyright (C) 2002 Hirokazu Takata 4 * Copyright (C) 2002-2005 Hirokazu Takata, Hayato Fujiwara
5 */ 5 */
6 6
7#include <linux/config.h> 7#include <linux/config.h>
@@ -9,7 +9,8 @@
9 9
10#undef MCCR 10#undef MCCR
11 11
12#if defined(CONFIG_CHIP_XNUX2) || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_OPSP) 12#if defined(CONFIG_CHIP_XNUX2) || defined(CONFIG_CHIP_M32700) \
13 || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_OPSP)
13/* Cache Control Register */ 14/* Cache Control Register */
14#define MCCR ((volatile unsigned long*)0xfffffffc) 15#define MCCR ((volatile unsigned long*)0xfffffffc)
15#define MCCR_CC (1UL << 7) /* Cache mode modify bit */ 16#define MCCR_CC (1UL << 7) /* Cache mode modify bit */
@@ -26,7 +27,17 @@
26#define MCCR ((volatile unsigned char*)0xfffffffe) 27#define MCCR ((volatile unsigned char*)0xfffffffe)
27#define MCCR_IIV (1UL << 0) /* I-cache invalidate */ 28#define MCCR_IIV (1UL << 0) /* I-cache invalidate */
28#define MCCR_ICACHE_INV MCCR_IIV 29#define MCCR_ICACHE_INV MCCR_IIV
29#endif /* CONFIG_CHIP_XNUX2 || CONFIG_CHIP_M32700 */ 30#elif defined(CONFIG_CHIP_M32104)
31#define MCCR ((volatile unsigned short*)0xfffffffe)
32#define MCCR_IIV (1UL << 8) /* I-cache invalidate */
33#define MCCR_DIV (1UL << 9) /* D-cache invalidate */
34#define MCCR_DCB (1UL << 10) /* D-cache copy back */
35#define MCCR_ICM (1UL << 0) /* I-cache mode [0:off,1:on] */
36#define MCCR_DCM (1UL << 1) /* D-cache mode [0:off,1:on] */
37#define MCCR_ICACHE_INV MCCR_IIV
38#define MCCR_DCACHE_CB MCCR_DCB
39#define MCCR_DCACHE_CBINV (MCCR_DIV|MCCR_DCB)
40#endif
30 41
31#ifndef MCCR 42#ifndef MCCR
32#error Unknown cache type. 43#error Unknown cache type.
@@ -37,29 +48,42 @@
37void _flush_cache_all(void) 48void _flush_cache_all(void)
38{ 49{
39#if defined(CONFIG_CHIP_M32102) 50#if defined(CONFIG_CHIP_M32102)
51 unsigned char mccr;
40 *MCCR = MCCR_ICACHE_INV; 52 *MCCR = MCCR_ICACHE_INV;
53#elif defined(CONFIG_CHIP_M32104)
54 unsigned short mccr;
55
56 /* Copyback and invalidate D-cache */
57 /* Invalidate I-cache */
58 *MCCR |= (MCCR_ICACHE_INV | MCCR_DCACHE_CBINV);
41#else 59#else
42 unsigned long mccr; 60 unsigned long mccr;
43 61
44 /* Copyback and invalidate D-cache */ 62 /* Copyback and invalidate D-cache */
45 /* Invalidate I-cache */ 63 /* Invalidate I-cache */
46 *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CBINV; 64 *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CBINV;
47 while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */
48#endif 65#endif
66 while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */
49} 67}
50 68
51/* Copy back D-cache and invalidate I-cache all */ 69/* Copy back D-cache and invalidate I-cache all */
52void _flush_cache_copyback_all(void) 70void _flush_cache_copyback_all(void)
53{ 71{
54#if defined(CONFIG_CHIP_M32102) 72#if defined(CONFIG_CHIP_M32102)
73 unsigned char mccr;
55 *MCCR = MCCR_ICACHE_INV; 74 *MCCR = MCCR_ICACHE_INV;
75#elif defined(CONFIG_CHIP_M32104)
76 unsigned short mccr;
77
78 /* Copyback and invalidate D-cache */
79 /* Invalidate I-cache */
80 *MCCR |= (MCCR_ICACHE_INV | MCCR_DCACHE_CB);
56#else 81#else
57 unsigned long mccr; 82 unsigned long mccr;
58 83
59 /* Copyback D-cache */ 84 /* Copyback D-cache */
60 /* Invalidate I-cache */ 85 /* Invalidate I-cache */
61 *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CB; 86 *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CB;
62 while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */
63
64#endif 87#endif
88 while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */
65} 89}
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 1dd5d18b2201..96b919828053 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -10,10 +10,6 @@ config MMU
10 bool 10 bool
11 default y 11 default y
12 12
13config UID16
14 bool
15 default y
16
17config RWSEM_GENERIC_SPINLOCK 13config RWSEM_GENERIC_SPINLOCK
18 bool 14 bool
19 default y 15 default y
diff --git a/arch/m68k/amiga/amiints.c b/arch/m68k/amiga/amiints.c
index d9edf2d1a492..b0aa61bf8700 100644
--- a/arch/m68k/amiga/amiints.c
+++ b/arch/m68k/amiga/amiints.c
@@ -126,9 +126,9 @@ void __init amiga_init_IRQ(void)
126 gayle.inten = GAYLE_IRQ_IDE; 126 gayle.inten = GAYLE_IRQ_IDE;
127 127
128 /* turn off all interrupts and enable the master interrupt bit */ 128 /* turn off all interrupts and enable the master interrupt bit */
129 custom.intena = 0x7fff; 129 amiga_custom.intena = 0x7fff;
130 custom.intreq = 0x7fff; 130 amiga_custom.intreq = 0x7fff;
131 custom.intena = IF_SETCLR | IF_INTEN; 131 amiga_custom.intena = IF_SETCLR | IF_INTEN;
132 132
133 cia_init_IRQ(&ciaa_base); 133 cia_init_IRQ(&ciaa_base);
134 cia_init_IRQ(&ciab_base); 134 cia_init_IRQ(&ciab_base);
@@ -245,7 +245,7 @@ int amiga_request_irq(unsigned int irq,
245 245
246 /* enable the interrupt */ 246 /* enable the interrupt */
247 if (irq < IRQ_AMIGA_PORTS && !ami_ablecount[irq]) 247 if (irq < IRQ_AMIGA_PORTS && !ami_ablecount[irq])
248 custom.intena = IF_SETCLR | amiga_intena_vals[irq]; 248 amiga_custom.intena = IF_SETCLR | amiga_intena_vals[irq];
249 249
250 return error; 250 return error;
251} 251}
@@ -274,7 +274,7 @@ void amiga_free_irq(unsigned int irq, void *dev_id)
274 amiga_delete_irq(&ami_irq_list[irq], dev_id); 274 amiga_delete_irq(&ami_irq_list[irq], dev_id);
275 /* if server list empty, disable the interrupt */ 275 /* if server list empty, disable the interrupt */
276 if (!ami_irq_list[irq] && irq < IRQ_AMIGA_PORTS) 276 if (!ami_irq_list[irq] && irq < IRQ_AMIGA_PORTS)
277 custom.intena = amiga_intena_vals[irq]; 277 amiga_custom.intena = amiga_intena_vals[irq];
278 } else { 278 } else {
279 if (ami_irq_list[irq]->dev_id != dev_id) 279 if (ami_irq_list[irq]->dev_id != dev_id)
280 printk("%s: removing probably wrong IRQ %d from %s\n", 280 printk("%s: removing probably wrong IRQ %d from %s\n",
@@ -283,7 +283,7 @@ void amiga_free_irq(unsigned int irq, void *dev_id)
283 ami_irq_list[irq]->flags = 0; 283 ami_irq_list[irq]->flags = 0;
284 ami_irq_list[irq]->dev_id = NULL; 284 ami_irq_list[irq]->dev_id = NULL;
285 ami_irq_list[irq]->devname = NULL; 285 ami_irq_list[irq]->devname = NULL;
286 custom.intena = amiga_intena_vals[irq]; 286 amiga_custom.intena = amiga_intena_vals[irq];
287 } 287 }
288} 288}
289 289
@@ -327,7 +327,7 @@ void amiga_enable_irq(unsigned int irq)
327 } 327 }
328 328
329 /* enable the interrupt */ 329 /* enable the interrupt */
330 custom.intena = IF_SETCLR | amiga_intena_vals[irq]; 330 amiga_custom.intena = IF_SETCLR | amiga_intena_vals[irq];
331} 331}
332 332
333void amiga_disable_irq(unsigned int irq) 333void amiga_disable_irq(unsigned int irq)
@@ -358,7 +358,7 @@ void amiga_disable_irq(unsigned int irq)
358 } 358 }
359 359
360 /* disable the interrupt */ 360 /* disable the interrupt */
361 custom.intena = amiga_intena_vals[irq]; 361 amiga_custom.intena = amiga_intena_vals[irq];
362} 362}
363 363
364inline void amiga_do_irq(int irq, struct pt_regs *fp) 364inline void amiga_do_irq(int irq, struct pt_regs *fp)
@@ -373,7 +373,7 @@ void amiga_do_irq_list(int irq, struct pt_regs *fp)
373 373
374 kstat_cpu(0).irqs[SYS_IRQS + irq]++; 374 kstat_cpu(0).irqs[SYS_IRQS + irq]++;
375 375
376 custom.intreq = amiga_intena_vals[irq]; 376 amiga_custom.intreq = amiga_intena_vals[irq];
377 377
378 for (node = ami_irq_list[irq]; node; node = node->next) 378 for (node = ami_irq_list[irq]; node; node = node->next)
379 node->handler(irq, node->dev_id, fp); 379 node->handler(irq, node->dev_id, fp);
@@ -385,23 +385,23 @@ void amiga_do_irq_list(int irq, struct pt_regs *fp)
385 385
386static irqreturn_t ami_int1(int irq, void *dev_id, struct pt_regs *fp) 386static irqreturn_t ami_int1(int irq, void *dev_id, struct pt_regs *fp)
387{ 387{
388 unsigned short ints = custom.intreqr & custom.intenar; 388 unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
389 389
390 /* if serial transmit buffer empty, interrupt */ 390 /* if serial transmit buffer empty, interrupt */
391 if (ints & IF_TBE) { 391 if (ints & IF_TBE) {
392 custom.intreq = IF_TBE; 392 amiga_custom.intreq = IF_TBE;
393 amiga_do_irq(IRQ_AMIGA_TBE, fp); 393 amiga_do_irq(IRQ_AMIGA_TBE, fp);
394 } 394 }
395 395
396 /* if floppy disk transfer complete, interrupt */ 396 /* if floppy disk transfer complete, interrupt */
397 if (ints & IF_DSKBLK) { 397 if (ints & IF_DSKBLK) {
398 custom.intreq = IF_DSKBLK; 398 amiga_custom.intreq = IF_DSKBLK;
399 amiga_do_irq(IRQ_AMIGA_DSKBLK, fp); 399 amiga_do_irq(IRQ_AMIGA_DSKBLK, fp);
400 } 400 }
401 401
402 /* if software interrupt set, interrupt */ 402 /* if software interrupt set, interrupt */
403 if (ints & IF_SOFT) { 403 if (ints & IF_SOFT) {
404 custom.intreq = IF_SOFT; 404 amiga_custom.intreq = IF_SOFT;
405 amiga_do_irq(IRQ_AMIGA_SOFT, fp); 405 amiga_do_irq(IRQ_AMIGA_SOFT, fp);
406 } 406 }
407 return IRQ_HANDLED; 407 return IRQ_HANDLED;
@@ -409,17 +409,17 @@ static irqreturn_t ami_int1(int irq, void *dev_id, struct pt_regs *fp)
409 409
410static irqreturn_t ami_int3(int irq, void *dev_id, struct pt_regs *fp) 410static irqreturn_t ami_int3(int irq, void *dev_id, struct pt_regs *fp)
411{ 411{
412 unsigned short ints = custom.intreqr & custom.intenar; 412 unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
413 413
414 /* if a blitter interrupt */ 414 /* if a blitter interrupt */
415 if (ints & IF_BLIT) { 415 if (ints & IF_BLIT) {
416 custom.intreq = IF_BLIT; 416 amiga_custom.intreq = IF_BLIT;
417 amiga_do_irq(IRQ_AMIGA_BLIT, fp); 417 amiga_do_irq(IRQ_AMIGA_BLIT, fp);
418 } 418 }
419 419
420 /* if a copper interrupt */ 420 /* if a copper interrupt */
421 if (ints & IF_COPER) { 421 if (ints & IF_COPER) {
422 custom.intreq = IF_COPER; 422 amiga_custom.intreq = IF_COPER;
423 amiga_do_irq(IRQ_AMIGA_COPPER, fp); 423 amiga_do_irq(IRQ_AMIGA_COPPER, fp);
424 } 424 }
425 425
@@ -431,29 +431,29 @@ static irqreturn_t ami_int3(int irq, void *dev_id, struct pt_regs *fp)
431 431
432static irqreturn_t ami_int4(int irq, void *dev_id, struct pt_regs *fp) 432static irqreturn_t ami_int4(int irq, void *dev_id, struct pt_regs *fp)
433{ 433{
434 unsigned short ints = custom.intreqr & custom.intenar; 434 unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
435 435
436 /* if audio 0 interrupt */ 436 /* if audio 0 interrupt */
437 if (ints & IF_AUD0) { 437 if (ints & IF_AUD0) {
438 custom.intreq = IF_AUD0; 438 amiga_custom.intreq = IF_AUD0;
439 amiga_do_irq(IRQ_AMIGA_AUD0, fp); 439 amiga_do_irq(IRQ_AMIGA_AUD0, fp);
440 } 440 }
441 441
442 /* if audio 1 interrupt */ 442 /* if audio 1 interrupt */
443 if (ints & IF_AUD1) { 443 if (ints & IF_AUD1) {
444 custom.intreq = IF_AUD1; 444 amiga_custom.intreq = IF_AUD1;
445 amiga_do_irq(IRQ_AMIGA_AUD1, fp); 445 amiga_do_irq(IRQ_AMIGA_AUD1, fp);
446 } 446 }
447 447
448 /* if audio 2 interrupt */ 448 /* if audio 2 interrupt */
449 if (ints & IF_AUD2) { 449 if (ints & IF_AUD2) {
450 custom.intreq = IF_AUD2; 450 amiga_custom.intreq = IF_AUD2;
451 amiga_do_irq(IRQ_AMIGA_AUD2, fp); 451 amiga_do_irq(IRQ_AMIGA_AUD2, fp);
452 } 452 }
453 453
454 /* if audio 3 interrupt */ 454 /* if audio 3 interrupt */
455 if (ints & IF_AUD3) { 455 if (ints & IF_AUD3) {
456 custom.intreq = IF_AUD3; 456 amiga_custom.intreq = IF_AUD3;
457 amiga_do_irq(IRQ_AMIGA_AUD3, fp); 457 amiga_do_irq(IRQ_AMIGA_AUD3, fp);
458 } 458 }
459 return IRQ_HANDLED; 459 return IRQ_HANDLED;
@@ -461,7 +461,7 @@ static irqreturn_t ami_int4(int irq, void *dev_id, struct pt_regs *fp)
461 461
462static irqreturn_t ami_int5(int irq, void *dev_id, struct pt_regs *fp) 462static irqreturn_t ami_int5(int irq, void *dev_id, struct pt_regs *fp)
463{ 463{
464 unsigned short ints = custom.intreqr & custom.intenar; 464 unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
465 465
466 /* if serial receive buffer full interrupt */ 466 /* if serial receive buffer full interrupt */
467 if (ints & IF_RBF) { 467 if (ints & IF_RBF) {
@@ -471,7 +471,7 @@ static irqreturn_t ami_int5(int irq, void *dev_id, struct pt_regs *fp)
471 471
472 /* if a disk sync interrupt */ 472 /* if a disk sync interrupt */
473 if (ints & IF_DSKSYN) { 473 if (ints & IF_DSKSYN) {
474 custom.intreq = IF_DSKSYN; 474 amiga_custom.intreq = IF_DSKSYN;
475 amiga_do_irq(IRQ_AMIGA_DSKSYN, fp); 475 amiga_do_irq(IRQ_AMIGA_DSKSYN, fp);
476 } 476 }
477 return IRQ_HANDLED; 477 return IRQ_HANDLED;
diff --git a/arch/m68k/amiga/amisound.c b/arch/m68k/amiga/amisound.c
index bd5d134e9f12..ae94db5d93b2 100644
--- a/arch/m68k/amiga/amisound.c
+++ b/arch/m68k/amiga/amisound.c
@@ -24,6 +24,8 @@ static const signed char sine_data[] = {
24}; 24};
25#define DATA_SIZE (sizeof(sine_data)/sizeof(sine_data[0])) 25#define DATA_SIZE (sizeof(sine_data)/sizeof(sine_data[0]))
26 26
27#define custom amiga_custom
28
27 /* 29 /*
28 * The minimum period for audio may be modified by the frame buffer 30 * The minimum period for audio may be modified by the frame buffer
29 * device since it depends on htotal (for OCS/ECS/AGA) 31 * device since it depends on htotal (for OCS/ECS/AGA)
diff --git a/arch/m68k/amiga/cia.c b/arch/m68k/amiga/cia.c
index 7d55682615e3..9476eb9440f5 100644
--- a/arch/m68k/amiga/cia.c
+++ b/arch/m68k/amiga/cia.c
@@ -60,7 +60,7 @@ unsigned char cia_set_irq(struct ciabase *base, unsigned char mask)
60 else 60 else
61 base->icr_data &= ~mask; 61 base->icr_data &= ~mask;
62 if (base->icr_data & base->icr_mask) 62 if (base->icr_data & base->icr_mask)
63 custom.intreq = IF_SETCLR | base->int_mask; 63 amiga_custom.intreq = IF_SETCLR | base->int_mask;
64 return old & base->icr_mask; 64 return old & base->icr_mask;
65} 65}
66 66
@@ -89,7 +89,7 @@ unsigned char cia_able_irq(struct ciabase *base, unsigned char mask)
89 } 89 }
90 } 90 }
91 if (base->icr_data & base->icr_mask) 91 if (base->icr_data & base->icr_mask)
92 custom.intreq = IF_SETCLR | base->int_mask; 92 amiga_custom.intreq = IF_SETCLR | base->int_mask;
93 return old; 93 return old;
94} 94}
95 95
@@ -133,7 +133,7 @@ static irqreturn_t cia_handler(int irq, void *dev_id, struct pt_regs *fp)
133 mach_irq = base->cia_irq; 133 mach_irq = base->cia_irq;
134 irq = SYS_IRQS + mach_irq; 134 irq = SYS_IRQS + mach_irq;
135 ints = cia_set_irq(base, CIA_ICR_ALL); 135 ints = cia_set_irq(base, CIA_ICR_ALL);
136 custom.intreq = base->int_mask; 136 amiga_custom.intreq = base->int_mask;
137 for (i = 0; i < CIA_IRQS; i++, irq++, mach_irq++) { 137 for (i = 0; i < CIA_IRQS; i++, irq++, mach_irq++) {
138 if (ints & 1) { 138 if (ints & 1) {
139 kstat_cpu(0).irqs[irq]++; 139 kstat_cpu(0).irqs[irq]++;
@@ -162,7 +162,7 @@ void __init cia_init_IRQ(struct ciabase *base)
162 /* install CIA handler */ 162 /* install CIA handler */
163 request_irq(base->handler_irq, cia_handler, 0, base->name, base); 163 request_irq(base->handler_irq, cia_handler, 0, base->name, base);
164 164
165 custom.intena = IF_SETCLR | base->int_mask; 165 amiga_custom.intena = IF_SETCLR | base->int_mask;
166} 166}
167 167
168int cia_get_irq_list(struct ciabase *base, struct seq_file *p) 168int cia_get_irq_list(struct ciabase *base, struct seq_file *p)
diff --git a/arch/m68k/amiga/config.c b/arch/m68k/amiga/config.c
index 4775e18a78f0..12e3706fe02c 100644
--- a/arch/m68k/amiga/config.c
+++ b/arch/m68k/amiga/config.c
@@ -105,9 +105,6 @@ static int a2000_hwclk (int, struct rtc_time *);
105static int amiga_set_clock_mmss (unsigned long); 105static int amiga_set_clock_mmss (unsigned long);
106static unsigned int amiga_get_ss (void); 106static unsigned int amiga_get_ss (void);
107extern void amiga_mksound( unsigned int count, unsigned int ticks ); 107extern void amiga_mksound( unsigned int count, unsigned int ticks );
108#ifdef CONFIG_AMIGA_FLOPPY
109extern void amiga_floppy_setup(char *, int *);
110#endif
111static void amiga_reset (void); 108static void amiga_reset (void);
112extern void amiga_init_sound(void); 109extern void amiga_init_sound(void);
113static void amiga_savekmsg_init(void); 110static void amiga_savekmsg_init(void);
@@ -290,7 +287,7 @@ static void __init amiga_identify(void)
290 case CS_OCS: 287 case CS_OCS:
291 case CS_ECS: 288 case CS_ECS:
292 case CS_AGA: 289 case CS_AGA:
293 switch (custom.deniseid & 0xf) { 290 switch (amiga_custom.deniseid & 0xf) {
294 case 0x0c: 291 case 0x0c:
295 AMIGAHW_SET(DENISE_HR); 292 AMIGAHW_SET(DENISE_HR);
296 break; 293 break;
@@ -303,7 +300,7 @@ static void __init amiga_identify(void)
303 AMIGAHW_SET(DENISE); 300 AMIGAHW_SET(DENISE);
304 break; 301 break;
305 } 302 }
306 switch ((custom.vposr>>8) & 0x7f) { 303 switch ((amiga_custom.vposr>>8) & 0x7f) {
307 case 0x00: 304 case 0x00:
308 AMIGAHW_SET(AGNUS_PAL); 305 AMIGAHW_SET(AGNUS_PAL);
309 break; 306 break;
@@ -427,13 +424,7 @@ void __init config_amiga(void)
427 424
428 mach_set_clock_mmss = amiga_set_clock_mmss; 425 mach_set_clock_mmss = amiga_set_clock_mmss;
429 mach_get_ss = amiga_get_ss; 426 mach_get_ss = amiga_get_ss;
430#ifdef CONFIG_AMIGA_FLOPPY
431 mach_floppy_setup = amiga_floppy_setup;
432#endif
433 mach_reset = amiga_reset; 427 mach_reset = amiga_reset;
434#ifdef CONFIG_DUMMY_CONSOLE
435 conswitchp = &dummy_con;
436#endif
437#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 428#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
438 mach_beep = amiga_mksound; 429 mach_beep = amiga_mksound;
439#endif 430#endif
@@ -447,9 +438,9 @@ void __init config_amiga(void)
447 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */ 438 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
448 439
449 /* clear all DMA bits */ 440 /* clear all DMA bits */
450 custom.dmacon = DMAF_ALL; 441 amiga_custom.dmacon = DMAF_ALL;
451 /* ensure that the DMA master bit is set */ 442 /* ensure that the DMA master bit is set */
452 custom.dmacon = DMAF_SETCLR | DMAF_MASTER; 443 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
453 444
454 /* don't use Z2 RAM as system memory on Z3 capable machines */ 445 /* don't use Z2 RAM as system memory on Z3 capable machines */
455 if (AMIGAHW_PRESENT(ZORRO3)) { 446 if (AMIGAHW_PRESENT(ZORRO3)) {
@@ -830,8 +821,8 @@ static void amiga_savekmsg_init(void)
830 821
831static void amiga_serial_putc(char c) 822static void amiga_serial_putc(char c)
832{ 823{
833 custom.serdat = (unsigned char)c | 0x100; 824 amiga_custom.serdat = (unsigned char)c | 0x100;
834 while (!(custom.serdatr & 0x2000)) 825 while (!(amiga_custom.serdatr & 0x2000))
835 ; 826 ;
836} 827}
837 828
@@ -855,11 +846,11 @@ int amiga_serial_console_wait_key(struct console *co)
855{ 846{
856 int ch; 847 int ch;
857 848
858 while (!(custom.intreqr & IF_RBF)) 849 while (!(amiga_custom.intreqr & IF_RBF))
859 barrier(); 850 barrier();
860 ch = custom.serdatr & 0xff; 851 ch = amiga_custom.serdatr & 0xff;
861 /* clear the interrupt, so that another character can be read */ 852 /* clear the interrupt, so that another character can be read */
862 custom.intreq = IF_RBF; 853 amiga_custom.intreq = IF_RBF;
863 return ch; 854 return ch;
864} 855}
865 856
diff --git a/arch/m68k/apollo/config.c b/arch/m68k/apollo/config.c
index 264929471253..d401962d9b25 100644
--- a/arch/m68k/apollo/config.c
+++ b/arch/m68k/apollo/config.c
@@ -176,9 +176,6 @@ void config_apollo(void) {
176 mach_set_clock_mmss = dn_dummy_set_clock_mmss; /* */ 176 mach_set_clock_mmss = dn_dummy_set_clock_mmss; /* */
177 mach_process_int = dn_process_int; 177 mach_process_int = dn_process_int;
178 mach_reset = dn_dummy_reset; /* */ 178 mach_reset = dn_dummy_reset; /* */
179#ifdef CONFIG_DUMMY_CONSOLE
180 conswitchp = &dummy_con;
181#endif
182#ifdef CONFIG_HEARTBEAT 179#ifdef CONFIG_HEARTBEAT
183 mach_heartbeat = dn_heartbeat; 180 mach_heartbeat = dn_heartbeat;
184#endif 181#endif
diff --git a/arch/m68k/atari/config.c b/arch/m68k/atari/config.c
index 9261d2deeaf5..1012b08e5522 100644
--- a/arch/m68k/atari/config.c
+++ b/arch/m68k/atari/config.c
@@ -52,9 +52,6 @@ int atari_rtc_year_offset;
52 52
53/* local function prototypes */ 53/* local function prototypes */
54static void atari_reset( void ); 54static void atari_reset( void );
55#ifdef CONFIG_ATARI_FLOPPY
56extern void atari_floppy_setup(char *, int *);
57#endif
58static void atari_get_model(char *model); 55static void atari_get_model(char *model);
59static int atari_get_hardware_list(char *buffer); 56static int atari_get_hardware_list(char *buffer);
60 57
@@ -244,12 +241,6 @@ void __init config_atari(void)
244 mach_get_irq_list = show_atari_interrupts; 241 mach_get_irq_list = show_atari_interrupts;
245 mach_gettimeoffset = atari_gettimeoffset; 242 mach_gettimeoffset = atari_gettimeoffset;
246 mach_reset = atari_reset; 243 mach_reset = atari_reset;
247#ifdef CONFIG_ATARI_FLOPPY
248 mach_floppy_setup = atari_floppy_setup;
249#endif
250#ifdef CONFIG_DUMMY_CONSOLE
251 conswitchp = &dummy_con;
252#endif
253 mach_max_dma_address = 0xffffff; 244 mach_max_dma_address = 0xffffff;
254#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE) 245#if defined(CONFIG_INPUT_M68K_BEEP) || defined(CONFIG_INPUT_M68K_BEEP_MODULE)
255 mach_beep = atari_mksound; 246 mach_beep = atari_mksound;
diff --git a/arch/m68k/bvme6000/rtc.c b/arch/m68k/bvme6000/rtc.c
index eb63ca6ed94c..703cbc6dc9cc 100644
--- a/arch/m68k/bvme6000/rtc.c
+++ b/arch/m68k/bvme6000/rtc.c
@@ -11,6 +11,7 @@
11#include <linux/miscdevice.h> 11#include <linux/miscdevice.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/ioport.h> 13#include <linux/ioport.h>
14#include <linux/capability.h>
14#include <linux/fcntl.h> 15#include <linux/fcntl.h>
15#include <linux/init.h> 16#include <linux/init.h>
16#include <linux/poll.h> 17#include <linux/poll.h>
@@ -46,6 +47,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
46 unsigned char msr; 47 unsigned char msr;
47 unsigned long flags; 48 unsigned long flags;
48 struct rtc_time wtime; 49 struct rtc_time wtime;
50 void __user *argp = (void __user *)arg;
49 51
50 switch (cmd) { 52 switch (cmd) {
51 case RTC_RD_TIME: /* Read the time/date from RTC */ 53 case RTC_RD_TIME: /* Read the time/date from RTC */
@@ -68,7 +70,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
68 } while (wtime.tm_sec != BCD2BIN(rtc->bcd_sec)); 70 } while (wtime.tm_sec != BCD2BIN(rtc->bcd_sec));
69 rtc->msr = msr; 71 rtc->msr = msr;
70 local_irq_restore(flags); 72 local_irq_restore(flags);
71 return copy_to_user((void *)arg, &wtime, sizeof wtime) ? 73 return copy_to_user(argp, &wtime, sizeof wtime) ?
72 -EFAULT : 0; 74 -EFAULT : 0;
73 } 75 }
74 case RTC_SET_TIME: /* Set the RTC */ 76 case RTC_SET_TIME: /* Set the RTC */
@@ -80,8 +82,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
80 if (!capable(CAP_SYS_ADMIN)) 82 if (!capable(CAP_SYS_ADMIN))
81 return -EACCES; 83 return -EACCES;
82 84
83 if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, 85 if (copy_from_user(&rtc_tm, argp, sizeof(struct rtc_time)))
84 sizeof(struct rtc_time)))
85 return -EFAULT; 86 return -EFAULT;
86 87
87 yrs = rtc_tm.tm_year; 88 yrs = rtc_tm.tm_year;
diff --git a/arch/m68k/hp300/config.c b/arch/m68k/hp300/config.c
index a0b854f3f94a..6d129eef370f 100644
--- a/arch/m68k/hp300/config.c
+++ b/arch/m68k/hp300/config.c
@@ -261,9 +261,6 @@ void __init config_hp300(void)
261#ifdef CONFIG_HEARTBEAT 261#ifdef CONFIG_HEARTBEAT
262 mach_heartbeat = hp300_pulse; 262 mach_heartbeat = hp300_pulse;
263#endif 263#endif
264#ifdef CONFIG_DUMMY_CONSOLE
265 conswitchp = &dummy_con;
266#endif
267 mach_max_dma_address = 0xffffffff; 264 mach_max_dma_address = 0xffffffff;
268 265
269 if (hp300_model >= HP_330 && hp300_model <= HP_433S && hp300_model != HP_350) { 266 if (hp300_model >= HP_330 && hp300_model <= HP_433S && hp300_model != HP_350) {
diff --git a/arch/m68k/kernel/asm-offsets.c b/arch/m68k/kernel/asm-offsets.c
index c787c5ba9513..246a8820c223 100644
--- a/arch/m68k/kernel/asm-offsets.c
+++ b/arch/m68k/kernel/asm-offsets.c
@@ -92,7 +92,7 @@ int main(void)
92 DEFINE(TRAP_TRACE, TRAP_TRACE); 92 DEFINE(TRAP_TRACE, TRAP_TRACE);
93 93
94 /* offsets into the custom struct */ 94 /* offsets into the custom struct */
95 DEFINE(CUSTOMBASE, &custom); 95 DEFINE(CUSTOMBASE, &amiga_custom);
96 DEFINE(C_INTENAR, offsetof(struct CUSTOM, intenar)); 96 DEFINE(C_INTENAR, offsetof(struct CUSTOM, intenar));
97 DEFINE(C_INTREQR, offsetof(struct CUSTOM, intreqr)); 97 DEFINE(C_INTREQR, offsetof(struct CUSTOM, intreqr));
98 DEFINE(C_INTENA, offsetof(struct CUSTOM, intena)); 98 DEFINE(C_INTENA, offsetof(struct CUSTOM, intena));
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S
index d4336d846df1..70002c146eed 100644
--- a/arch/m68k/kernel/head.S
+++ b/arch/m68k/kernel/head.S
@@ -273,8 +273,10 @@
273 * Macintosh console support 273 * Macintosh console support
274 */ 274 */
275 275
276#ifdef CONFIG_FRAMEBUFFER_CONSOLE
276#define CONSOLE 277#define CONSOLE
277#define CONSOLE_PENGUIN 278#define CONSOLE_PENGUIN
279#endif
278 280
279/* 281/*
280 * Macintosh serial debug support; outputs boot info to the printer 282 * Macintosh serial debug support; outputs boot info to the printer
diff --git a/arch/m68k/kernel/m68k_ksyms.c b/arch/m68k/kernel/m68k_ksyms.c
index 73e2f5e168dd..3d7f2000b714 100644
--- a/arch/m68k/kernel/m68k_ksyms.c
+++ b/arch/m68k/kernel/m68k_ksyms.c
@@ -23,8 +23,6 @@ asmlinkage long long __lshrdi3 (long long, int);
23asmlinkage long long __muldi3 (long long, long long); 23asmlinkage long long __muldi3 (long long, long long);
24extern char m68k_debug_device[]; 24extern char m68k_debug_device[];
25 25
26extern void dump_thread(struct pt_regs *, struct user *);
27
28/* platform dependent support */ 26/* platform dependent support */
29 27
30EXPORT_SYMBOL(m68k_machtype); 28EXPORT_SYMBOL(m68k_machtype);
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 13d109328a42..3f9cb55d0356 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -238,10 +238,9 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
238{ 238{
239 struct pt_regs * childregs; 239 struct pt_regs * childregs;
240 struct switch_stack * childstack, *stack; 240 struct switch_stack * childstack, *stack;
241 unsigned long stack_offset, *retp; 241 unsigned long *retp;
242 242
243 stack_offset = THREAD_SIZE - sizeof(struct pt_regs); 243 childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1;
244 childregs = (struct pt_regs *) ((unsigned long) (p->thread_info) + stack_offset);
245 244
246 *childregs = *regs; 245 *childregs = *regs;
247 childregs->d0 = 0; 246 childregs->d0 = 0;
@@ -386,7 +385,7 @@ unsigned long get_wchan(struct task_struct *p)
386 if (!p || p == current || p->state == TASK_RUNNING) 385 if (!p || p == current || p->state == TASK_RUNNING)
387 return 0; 386 return 0;
388 387
389 stack_page = (unsigned long)(p->thread_info); 388 stack_page = (unsigned long)task_stack_page(p);
390 fp = ((struct switch_stack *)p->thread.ksp)->a6; 389 fp = ((struct switch_stack *)p->thread.ksp)->a6;
391 do { 390 do {
392 if (fp < stack_page+sizeof(struct thread_info) || 391 if (fp < stack_page+sizeof(struct thread_info) ||
diff --git a/arch/m68k/kernel/setup.c b/arch/m68k/kernel/setup.c
index d6ca99242e5a..750d5b3c971f 100644
--- a/arch/m68k/kernel/setup.c
+++ b/arch/m68k/kernel/setup.c
@@ -84,9 +84,6 @@ void (*mach_reset)( void );
84void (*mach_halt)( void ); 84void (*mach_halt)( void );
85void (*mach_power_off)( void ); 85void (*mach_power_off)( void );
86long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */ 86long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */
87#if defined(CONFIG_AMIGA_FLOPPY) || defined(CONFIG_ATARI_FLOPPY)
88void (*mach_floppy_setup) (char *, int *) __initdata = NULL;
89#endif
90#ifdef CONFIG_HEARTBEAT 87#ifdef CONFIG_HEARTBEAT
91void (*mach_heartbeat) (int); 88void (*mach_heartbeat) (int);
92EXPORT_SYMBOL(mach_heartbeat); 89EXPORT_SYMBOL(mach_heartbeat);
@@ -100,6 +97,8 @@ void (*mach_beep)(unsigned int, unsigned int);
100#if defined(CONFIG_ISA) && defined(MULTI_ISA) 97#if defined(CONFIG_ISA) && defined(MULTI_ISA)
101int isa_type; 98int isa_type;
102int isa_sex; 99int isa_sex;
100EXPORT_SYMBOL(isa_type);
101EXPORT_SYMBOL(isa_sex);
103#endif 102#endif
104 103
105extern int amiga_parse_bootinfo(const struct bi_record *); 104extern int amiga_parse_bootinfo(const struct bi_record *);
@@ -280,6 +279,10 @@ void __init setup_arch(char **cmdline_p)
280 } 279 }
281 } 280 }
282 281
282#ifdef CONFIG_DUMMY_CONSOLE
283 conswitchp = &dummy_con;
284#endif
285
283 switch (m68k_machtype) { 286 switch (m68k_machtype) {
284#ifdef CONFIG_AMIGA 287#ifdef CONFIG_AMIGA
285 case MACH_AMIGA: 288 case MACH_AMIGA:
@@ -521,16 +524,6 @@ int get_hardware_list(char *buffer)
521 return(len); 524 return(len);
522} 525}
523 526
524
525#if defined(CONFIG_AMIGA_FLOPPY) || defined(CONFIG_ATARI_FLOPPY)
526void __init floppy_setup(char *str, int *ints)
527{
528 if (mach_floppy_setup)
529 mach_floppy_setup (str, ints);
530}
531
532#endif
533
534void check_bugs(void) 527void check_bugs(void)
535{ 528{
536#ifndef CONFIG_M68KFPU_EMU 529#ifndef CONFIG_M68KFPU_EMU
diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
index 9c636a4c238d..866917bfa028 100644
--- a/arch/m68k/kernel/signal.c
+++ b/arch/m68k/kernel/signal.c
@@ -96,7 +96,7 @@ asmlinkage int do_sigsuspend(struct pt_regs *regs)
96asmlinkage int 96asmlinkage int
97do_rt_sigsuspend(struct pt_regs *regs) 97do_rt_sigsuspend(struct pt_regs *regs)
98{ 98{
99 sigset_t *unewset = (sigset_t *)regs->d1; 99 sigset_t __user *unewset = (sigset_t __user *)regs->d1;
100 size_t sigsetsize = (size_t)regs->d2; 100 size_t sigsetsize = (size_t)regs->d2;
101 sigset_t saveset, newset; 101 sigset_t saveset, newset;
102 102
@@ -122,8 +122,8 @@ do_rt_sigsuspend(struct pt_regs *regs)
122} 122}
123 123
124asmlinkage int 124asmlinkage int
125sys_sigaction(int sig, const struct old_sigaction *act, 125sys_sigaction(int sig, const struct old_sigaction __user *act,
126 struct old_sigaction *oact) 126 struct old_sigaction __user *oact)
127{ 127{
128 struct k_sigaction new_ka, old_ka; 128 struct k_sigaction new_ka, old_ka;
129 int ret; 129 int ret;
@@ -154,7 +154,7 @@ sys_sigaction(int sig, const struct old_sigaction *act,
154} 154}
155 155
156asmlinkage int 156asmlinkage int
157sys_sigaltstack(const stack_t *uss, stack_t *uoss) 157sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
158{ 158{
159 return do_sigaltstack(uss, uoss, rdusp()); 159 return do_sigaltstack(uss, uoss, rdusp());
160} 160}
@@ -169,10 +169,10 @@ sys_sigaltstack(const stack_t *uss, stack_t *uoss)
169 169
170struct sigframe 170struct sigframe
171{ 171{
172 char *pretcode; 172 char __user *pretcode;
173 int sig; 173 int sig;
174 int code; 174 int code;
175 struct sigcontext *psc; 175 struct sigcontext __user *psc;
176 char retcode[8]; 176 char retcode[8];
177 unsigned long extramask[_NSIG_WORDS-1]; 177 unsigned long extramask[_NSIG_WORDS-1];
178 struct sigcontext sc; 178 struct sigcontext sc;
@@ -180,10 +180,10 @@ struct sigframe
180 180
181struct rt_sigframe 181struct rt_sigframe
182{ 182{
183 char *pretcode; 183 char __user *pretcode;
184 int sig; 184 int sig;
185 struct siginfo *pinfo; 185 struct siginfo __user *pinfo;
186 void *puc; 186 void __user *puc;
187 char retcode[8]; 187 char retcode[8];
188 struct siginfo info; 188 struct siginfo info;
189 struct ucontext uc; 189 struct ucontext uc;
@@ -248,7 +248,7 @@ out:
248#define uc_formatvec uc_filler[FPCONTEXT_SIZE/4] 248#define uc_formatvec uc_filler[FPCONTEXT_SIZE/4]
249#define uc_extra uc_filler[FPCONTEXT_SIZE/4+1] 249#define uc_extra uc_filler[FPCONTEXT_SIZE/4+1]
250 250
251static inline int rt_restore_fpu_state(struct ucontext *uc) 251static inline int rt_restore_fpu_state(struct ucontext __user *uc)
252{ 252{
253 unsigned char fpstate[FPCONTEXT_SIZE]; 253 unsigned char fpstate[FPCONTEXT_SIZE];
254 int context_size = CPU_IS_060 ? 8 : 0; 254 int context_size = CPU_IS_060 ? 8 : 0;
@@ -267,7 +267,7 @@ static inline int rt_restore_fpu_state(struct ucontext *uc)
267 return 0; 267 return 0;
268 } 268 }
269 269
270 if (__get_user(*(long *)fpstate, (long *)&uc->uc_fpstate)) 270 if (__get_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate))
271 goto out; 271 goto out;
272 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) { 272 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) {
273 if (!CPU_IS_060) 273 if (!CPU_IS_060)
@@ -306,7 +306,7 @@ static inline int rt_restore_fpu_state(struct ucontext *uc)
306 "m" (*fpregs.f_fpcntl)); 306 "m" (*fpregs.f_fpcntl));
307 } 307 }
308 if (context_size && 308 if (context_size &&
309 __copy_from_user(fpstate + 4, (long *)&uc->uc_fpstate + 1, 309 __copy_from_user(fpstate + 4, (long __user *)&uc->uc_fpstate + 1,
310 context_size)) 310 context_size))
311 goto out; 311 goto out;
312 __asm__ volatile (".chip 68k/68881\n\t" 312 __asm__ volatile (".chip 68k/68881\n\t"
@@ -319,7 +319,7 @@ out:
319} 319}
320 320
321static inline int 321static inline int
322restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc, void *fp, 322restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *usc, void __user *fp,
323 int *pd0) 323 int *pd0)
324{ 324{
325 int fsize, formatvec; 325 int fsize, formatvec;
@@ -404,10 +404,10 @@ badframe:
404 404
405static inline int 405static inline int
406rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw, 406rt_restore_ucontext(struct pt_regs *regs, struct switch_stack *sw,
407 struct ucontext *uc, int *pd0) 407 struct ucontext __user *uc, int *pd0)
408{ 408{
409 int fsize, temp; 409 int fsize, temp;
410 greg_t *gregs = uc->uc_mcontext.gregs; 410 greg_t __user *gregs = uc->uc_mcontext.gregs;
411 unsigned long usp; 411 unsigned long usp;
412 int err; 412 int err;
413 413
@@ -506,7 +506,7 @@ asmlinkage int do_sigreturn(unsigned long __unused)
506 struct switch_stack *sw = (struct switch_stack *) &__unused; 506 struct switch_stack *sw = (struct switch_stack *) &__unused;
507 struct pt_regs *regs = (struct pt_regs *) (sw + 1); 507 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
508 unsigned long usp = rdusp(); 508 unsigned long usp = rdusp();
509 struct sigframe *frame = (struct sigframe *)(usp - 4); 509 struct sigframe __user *frame = (struct sigframe __user *)(usp - 4);
510 sigset_t set; 510 sigset_t set;
511 int d0; 511 int d0;
512 512
@@ -536,7 +536,7 @@ asmlinkage int do_rt_sigreturn(unsigned long __unused)
536 struct switch_stack *sw = (struct switch_stack *) &__unused; 536 struct switch_stack *sw = (struct switch_stack *) &__unused;
537 struct pt_regs *regs = (struct pt_regs *) (sw + 1); 537 struct pt_regs *regs = (struct pt_regs *) (sw + 1);
538 unsigned long usp = rdusp(); 538 unsigned long usp = rdusp();
539 struct rt_sigframe *frame = (struct rt_sigframe *)(usp - 4); 539 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(usp - 4);
540 sigset_t set; 540 sigset_t set;
541 int d0; 541 int d0;
542 542
@@ -596,7 +596,7 @@ static inline void save_fpu_state(struct sigcontext *sc, struct pt_regs *regs)
596 } 596 }
597} 597}
598 598
599static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs) 599static inline int rt_save_fpu_state(struct ucontext __user *uc, struct pt_regs *regs)
600{ 600{
601 unsigned char fpstate[FPCONTEXT_SIZE]; 601 unsigned char fpstate[FPCONTEXT_SIZE];
602 int context_size = CPU_IS_060 ? 8 : 0; 602 int context_size = CPU_IS_060 ? 8 : 0;
@@ -617,7 +617,7 @@ static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs)
617 ".chip 68k" 617 ".chip 68k"
618 : : "m" (*fpstate) : "memory"); 618 : : "m" (*fpstate) : "memory");
619 619
620 err |= __put_user(*(long *)fpstate, (long *)&uc->uc_fpstate); 620 err |= __put_user(*(long *)fpstate, (long __user *)&uc->uc_fpstate);
621 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) { 621 if (CPU_IS_060 ? fpstate[2] : fpstate[0]) {
622 fpregset_t fpregs; 622 fpregset_t fpregs;
623 if (!CPU_IS_060) 623 if (!CPU_IS_060)
@@ -642,7 +642,7 @@ static inline int rt_save_fpu_state(struct ucontext *uc, struct pt_regs *regs)
642 sizeof(fpregs)); 642 sizeof(fpregs));
643 } 643 }
644 if (context_size) 644 if (context_size)
645 err |= copy_to_user((long *)&uc->uc_fpstate + 1, fpstate + 4, 645 err |= copy_to_user((long __user *)&uc->uc_fpstate + 1, fpstate + 4,
646 context_size); 646 context_size);
647 return err; 647 return err;
648} 648}
@@ -662,10 +662,10 @@ static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
662 save_fpu_state(sc, regs); 662 save_fpu_state(sc, regs);
663} 663}
664 664
665static inline int rt_setup_ucontext(struct ucontext *uc, struct pt_regs *regs) 665static inline int rt_setup_ucontext(struct ucontext __user *uc, struct pt_regs *regs)
666{ 666{
667 struct switch_stack *sw = (struct switch_stack *)regs - 1; 667 struct switch_stack *sw = (struct switch_stack *)regs - 1;
668 greg_t *gregs = uc->uc_mcontext.gregs; 668 greg_t __user *gregs = uc->uc_mcontext.gregs;
669 int err = 0; 669 int err = 0;
670 670
671 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version); 671 err |= __put_user(MCONTEXT_VERSION, &uc->uc_mcontext.version);
@@ -753,7 +753,7 @@ static inline void push_cache (unsigned long vaddr)
753 } 753 }
754} 754}
755 755
756static inline void * 756static inline void __user *
757get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size) 757get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
758{ 758{
759 unsigned long usp; 759 unsigned long usp;
@@ -766,13 +766,13 @@ get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
766 if (!on_sig_stack(usp)) 766 if (!on_sig_stack(usp))
767 usp = current->sas_ss_sp + current->sas_ss_size; 767 usp = current->sas_ss_sp + current->sas_ss_size;
768 } 768 }
769 return (void *)((usp - frame_size) & -8UL); 769 return (void __user *)((usp - frame_size) & -8UL);
770} 770}
771 771
772static void setup_frame (int sig, struct k_sigaction *ka, 772static void setup_frame (int sig, struct k_sigaction *ka,
773 sigset_t *set, struct pt_regs *regs) 773 sigset_t *set, struct pt_regs *regs)
774{ 774{
775 struct sigframe *frame; 775 struct sigframe __user *frame;
776 int fsize = frame_extra_sizes[regs->format]; 776 int fsize = frame_extra_sizes[regs->format];
777 struct sigcontext context; 777 struct sigcontext context;
778 int err = 0; 778 int err = 0;
@@ -813,7 +813,7 @@ static void setup_frame (int sig, struct k_sigaction *ka,
813 err |= __put_user(frame->retcode, &frame->pretcode); 813 err |= __put_user(frame->retcode, &frame->pretcode);
814 /* moveq #,d0; trap #0 */ 814 /* moveq #,d0; trap #0 */
815 err |= __put_user(0x70004e40 + (__NR_sigreturn << 16), 815 err |= __put_user(0x70004e40 + (__NR_sigreturn << 16),
816 (long *)(frame->retcode)); 816 (long __user *)(frame->retcode));
817 817
818 if (err) 818 if (err)
819 goto give_sigsegv; 819 goto give_sigsegv;
@@ -849,7 +849,7 @@ give_sigsegv:
849static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info, 849static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
850 sigset_t *set, struct pt_regs *regs) 850 sigset_t *set, struct pt_regs *regs)
851{ 851{
852 struct rt_sigframe *frame; 852 struct rt_sigframe __user *frame;
853 int fsize = frame_extra_sizes[regs->format]; 853 int fsize = frame_extra_sizes[regs->format];
854 int err = 0; 854 int err = 0;
855 855
@@ -880,8 +880,8 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
880 880
881 /* Create the ucontext. */ 881 /* Create the ucontext. */
882 err |= __put_user(0, &frame->uc.uc_flags); 882 err |= __put_user(0, &frame->uc.uc_flags);
883 err |= __put_user(0, &frame->uc.uc_link); 883 err |= __put_user(NULL, &frame->uc.uc_link);
884 err |= __put_user((void *)current->sas_ss_sp, 884 err |= __put_user((void __user *)current->sas_ss_sp,
885 &frame->uc.uc_stack.ss_sp); 885 &frame->uc.uc_stack.ss_sp);
886 err |= __put_user(sas_ss_flags(rdusp()), 886 err |= __put_user(sas_ss_flags(rdusp()),
887 &frame->uc.uc_stack.ss_flags); 887 &frame->uc.uc_stack.ss_flags);
@@ -893,8 +893,8 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
893 err |= __put_user(frame->retcode, &frame->pretcode); 893 err |= __put_user(frame->retcode, &frame->pretcode);
894 /* moveq #,d0; notb d0; trap #0 */ 894 /* moveq #,d0; notb d0; trap #0 */
895 err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16), 895 err |= __put_user(0x70004600 + ((__NR_rt_sigreturn ^ 0xff) << 16),
896 (long *)(frame->retcode + 0)); 896 (long __user *)(frame->retcode + 0));
897 err |= __put_user(0x4e40, (short *)(frame->retcode + 4)); 897 err |= __put_user(0x4e40, (short __user *)(frame->retcode + 4));
898 898
899 if (err) 899 if (err)
900 goto give_sigsegv; 900 goto give_sigsegv;
diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c
index 2ed7b783f654..143c552d38f3 100644
--- a/arch/m68k/kernel/sys_m68k.c
+++ b/arch/m68k/kernel/sys_m68k.c
@@ -6,6 +6,7 @@
6 * platform. 6 * platform.
7 */ 7 */
8 8
9#include <linux/capability.h>
9#include <linux/errno.h> 10#include <linux/errno.h>
10#include <linux/sched.h> 11#include <linux/sched.h>
11#include <linux/mm.h> 12#include <linux/mm.h>
@@ -31,7 +32,7 @@
31 * sys_pipe() is the normal C calling standard for creating 32 * sys_pipe() is the normal C calling standard for creating
32 * a pipe. It's not the way unix traditionally does this, though. 33 * a pipe. It's not the way unix traditionally does this, though.
33 */ 34 */
34asmlinkage int sys_pipe(unsigned long * fildes) 35asmlinkage int sys_pipe(unsigned long __user * fildes)
35{ 36{
36 int fd[2]; 37 int fd[2];
37 int error; 38 int error;
@@ -93,7 +94,7 @@ struct mmap_arg_struct {
93 unsigned long offset; 94 unsigned long offset;
94}; 95};
95 96
96asmlinkage int old_mmap(struct mmap_arg_struct *arg) 97asmlinkage int old_mmap(struct mmap_arg_struct __user *arg)
97{ 98{
98 struct mmap_arg_struct a; 99 struct mmap_arg_struct a;
99 int error = -EFAULT; 100 int error = -EFAULT;
@@ -159,11 +160,11 @@ out:
159 160
160struct sel_arg_struct { 161struct sel_arg_struct {
161 unsigned long n; 162 unsigned long n;
162 fd_set *inp, *outp, *exp; 163 fd_set __user *inp, *outp, *exp;
163 struct timeval *tvp; 164 struct timeval __user *tvp;
164}; 165};
165 166
166asmlinkage int old_select(struct sel_arg_struct *arg) 167asmlinkage int old_select(struct sel_arg_struct __user *arg)
167{ 168{
168 struct sel_arg_struct a; 169 struct sel_arg_struct a;
169 170
@@ -179,7 +180,7 @@ asmlinkage int old_select(struct sel_arg_struct *arg)
179 * This is really horribly ugly. 180 * This is really horribly ugly.
180 */ 181 */
181asmlinkage int sys_ipc (uint call, int first, int second, 182asmlinkage int sys_ipc (uint call, int first, int second,
182 int third, void *ptr, long fifth) 183 int third, void __user *ptr, long fifth)
183{ 184{
184 int version, ret; 185 int version, ret;
185 186
@@ -189,14 +190,14 @@ asmlinkage int sys_ipc (uint call, int first, int second,
189 if (call <= SEMCTL) 190 if (call <= SEMCTL)
190 switch (call) { 191 switch (call) {
191 case SEMOP: 192 case SEMOP:
192 return sys_semop (first, (struct sembuf *)ptr, second); 193 return sys_semop (first, ptr, second);
193 case SEMGET: 194 case SEMGET:
194 return sys_semget (first, second, third); 195 return sys_semget (first, second, third);
195 case SEMCTL: { 196 case SEMCTL: {
196 union semun fourth; 197 union semun fourth;
197 if (!ptr) 198 if (!ptr)
198 return -EINVAL; 199 return -EINVAL;
199 if (get_user(fourth.__pad, (void **) ptr)) 200 if (get_user(fourth.__pad, (void __user *__user *) ptr))
200 return -EFAULT; 201 return -EFAULT;
201 return sys_semctl (first, second, third, fourth); 202 return sys_semctl (first, second, third, fourth);
202 } 203 }
@@ -206,31 +207,26 @@ asmlinkage int sys_ipc (uint call, int first, int second,
206 if (call <= MSGCTL) 207 if (call <= MSGCTL)
207 switch (call) { 208 switch (call) {
208 case MSGSND: 209 case MSGSND:
209 return sys_msgsnd (first, (struct msgbuf *) ptr, 210 return sys_msgsnd (first, ptr, second, third);
210 second, third);
211 case MSGRCV: 211 case MSGRCV:
212 switch (version) { 212 switch (version) {
213 case 0: { 213 case 0: {
214 struct ipc_kludge tmp; 214 struct ipc_kludge tmp;
215 if (!ptr) 215 if (!ptr)
216 return -EINVAL; 216 return -EINVAL;
217 if (copy_from_user (&tmp, 217 if (copy_from_user (&tmp, ptr, sizeof (tmp)))
218 (struct ipc_kludge *)ptr,
219 sizeof (tmp)))
220 return -EFAULT; 218 return -EFAULT;
221 return sys_msgrcv (first, tmp.msgp, second, 219 return sys_msgrcv (first, tmp.msgp, second,
222 tmp.msgtyp, third); 220 tmp.msgtyp, third);
223 } 221 }
224 default: 222 default:
225 return sys_msgrcv (first, 223 return sys_msgrcv (first, ptr,
226 (struct msgbuf *) ptr,
227 second, fifth, third); 224 second, fifth, third);
228 } 225 }
229 case MSGGET: 226 case MSGGET:
230 return sys_msgget ((key_t) first, second); 227 return sys_msgget ((key_t) first, second);
231 case MSGCTL: 228 case MSGCTL:
232 return sys_msgctl (first, second, 229 return sys_msgctl (first, second, ptr);
233 (struct msqid_ds *) ptr);
234 default: 230 default:
235 return -ENOSYS; 231 return -ENOSYS;
236 } 232 }
@@ -240,20 +236,18 @@ asmlinkage int sys_ipc (uint call, int first, int second,
240 switch (version) { 236 switch (version) {
241 default: { 237 default: {
242 ulong raddr; 238 ulong raddr;
243 ret = do_shmat (first, (char *) ptr, 239 ret = do_shmat (first, ptr, second, &raddr);
244 second, &raddr);
245 if (ret) 240 if (ret)
246 return ret; 241 return ret;
247 return put_user (raddr, (ulong *) third); 242 return put_user (raddr, (ulong __user *) third);
248 } 243 }
249 } 244 }
250 case SHMDT: 245 case SHMDT:
251 return sys_shmdt ((char *)ptr); 246 return sys_shmdt (ptr);
252 case SHMGET: 247 case SHMGET:
253 return sys_shmget (first, second, third); 248 return sys_shmget (first, second, third);
254 case SHMCTL: 249 case SHMCTL:
255 return sys_shmctl (first, second, 250 return sys_shmctl (first, second, ptr);
256 (struct shmid_ds *) ptr);
257 default: 251 default:
258 return -ENOSYS; 252 return -ENOSYS;
259 } 253 }
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index deb36e8b04a2..cdf58fbb3e73 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -169,25 +169,25 @@ void __init trap_init (void)
169 169
170 if (CPU_IS_060 && !FPU_IS_EMU) { 170 if (CPU_IS_060 && !FPU_IS_EMU) {
171 /* set up IFPSP entry points */ 171 /* set up IFPSP entry points */
172 asmlinkage void snan_vec(void) asm ("_060_fpsp_snan"); 172 asmlinkage void snan_vec6(void) asm ("_060_fpsp_snan");
173 asmlinkage void operr_vec(void) asm ("_060_fpsp_operr"); 173 asmlinkage void operr_vec6(void) asm ("_060_fpsp_operr");
174 asmlinkage void ovfl_vec(void) asm ("_060_fpsp_ovfl"); 174 asmlinkage void ovfl_vec6(void) asm ("_060_fpsp_ovfl");
175 asmlinkage void unfl_vec(void) asm ("_060_fpsp_unfl"); 175 asmlinkage void unfl_vec6(void) asm ("_060_fpsp_unfl");
176 asmlinkage void dz_vec(void) asm ("_060_fpsp_dz"); 176 asmlinkage void dz_vec6(void) asm ("_060_fpsp_dz");
177 asmlinkage void inex_vec(void) asm ("_060_fpsp_inex"); 177 asmlinkage void inex_vec6(void) asm ("_060_fpsp_inex");
178 asmlinkage void fline_vec(void) asm ("_060_fpsp_fline"); 178 asmlinkage void fline_vec6(void) asm ("_060_fpsp_fline");
179 asmlinkage void unsupp_vec(void) asm ("_060_fpsp_unsupp"); 179 asmlinkage void unsupp_vec6(void) asm ("_060_fpsp_unsupp");
180 asmlinkage void effadd_vec(void) asm ("_060_fpsp_effadd"); 180 asmlinkage void effadd_vec6(void) asm ("_060_fpsp_effadd");
181 181
182 vectors[VEC_FPNAN] = snan_vec; 182 vectors[VEC_FPNAN] = snan_vec6;
183 vectors[VEC_FPOE] = operr_vec; 183 vectors[VEC_FPOE] = operr_vec6;
184 vectors[VEC_FPOVER] = ovfl_vec; 184 vectors[VEC_FPOVER] = ovfl_vec6;
185 vectors[VEC_FPUNDER] = unfl_vec; 185 vectors[VEC_FPUNDER] = unfl_vec6;
186 vectors[VEC_FPDIVZ] = dz_vec; 186 vectors[VEC_FPDIVZ] = dz_vec6;
187 vectors[VEC_FPIR] = inex_vec; 187 vectors[VEC_FPIR] = inex_vec6;
188 vectors[VEC_LINE11] = fline_vec; 188 vectors[VEC_LINE11] = fline_vec6;
189 vectors[VEC_FPUNSUP] = unsupp_vec; 189 vectors[VEC_FPUNSUP] = unsupp_vec6;
190 vectors[VEC_UNIMPEA] = effadd_vec; 190 vectors[VEC_UNIMPEA] = effadd_vec6;
191 } 191 }
192 192
193 /* if running on an amiga, make the NMI interrupt do nothing */ 193 /* if running on an amiga, make the NMI interrupt do nothing */
diff --git a/arch/m68k/kernel/vmlinux-std.lds b/arch/m68k/kernel/vmlinux-std.lds
index e58654f3f8dd..69d1d3d30c78 100644
--- a/arch/m68k/kernel/vmlinux-std.lds
+++ b/arch/m68k/kernel/vmlinux-std.lds
@@ -13,6 +13,7 @@ SECTIONS
13 .text : { 13 .text : {
14 *(.text) 14 *(.text)
15 SCHED_TEXT 15 SCHED_TEXT
16 LOCK_TEXT
16 *(.fixup) 17 *(.fixup)
17 *(.gnu.warning) 18 *(.gnu.warning)
18 } :text = 0x4e75 19 } :text = 0x4e75
diff --git a/arch/m68k/kernel/vmlinux-sun3.lds b/arch/m68k/kernel/vmlinux-sun3.lds
index cc37e8d3c1e2..65cc39c24185 100644
--- a/arch/m68k/kernel/vmlinux-sun3.lds
+++ b/arch/m68k/kernel/vmlinux-sun3.lds
@@ -14,6 +14,7 @@ SECTIONS
14 *(.head) 14 *(.head)
15 *(.text) 15 *(.text)
16 SCHED_TEXT 16 SCHED_TEXT
17 LOCK_TEXT
17 *(.fixup) 18 *(.fixup)
18 *(.gnu.warning) 19 *(.gnu.warning)
19 } :text = 0x4e75 20 } :text = 0x4e75
@@ -66,7 +67,7 @@ __init_begin = .;
66 __initramfs_end = .; 67 __initramfs_end = .;
67 . = ALIGN(8192); 68 . = ALIGN(8192);
68 __init_end = .; 69 __init_end = .;
69 .init.task : { *(init_task) } 70 .data.init.task : { *(.data.init_task) }
70 71
71 72
72 .bss : { *(.bss) } /* BSS */ 73 .bss : { *(.bss) } /* BSS */
diff --git a/arch/m68k/lib/checksum.c b/arch/m68k/lib/checksum.c
index 4a5c5445c610..cb13c6e3ccae 100644
--- a/arch/m68k/lib/checksum.c
+++ b/arch/m68k/lib/checksum.c
@@ -134,7 +134,7 @@ EXPORT_SYMBOL(csum_partial);
134 */ 134 */
135 135
136unsigned int 136unsigned int
137csum_partial_copy_from_user(const unsigned char *src, unsigned char *dst, 137csum_partial_copy_from_user(const unsigned char __user *src, unsigned char *dst,
138 int len, int sum, int *csum_err) 138 int len, int sum, int *csum_err)
139{ 139{
140 /* 140 /*
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c
index cd19cbb213e8..14f8d3f4e195 100644
--- a/arch/m68k/mac/config.c
+++ b/arch/m68k/mac/config.c
@@ -212,9 +212,6 @@ void __init config_mac(void)
212 mach_reset = mac_reset; 212 mach_reset = mac_reset;
213 mach_halt = mac_poweroff; 213 mach_halt = mac_poweroff;
214 mach_power_off = mac_poweroff; 214 mach_power_off = mac_poweroff;
215#ifdef CONFIG_DUMMY_CONSOLE
216 conswitchp = &dummy_con;
217#endif
218 mach_max_dma_address = 0xffffffff; 215 mach_max_dma_address = 0xffffffff;
219#if 0 216#if 0
220 mach_debug_init = mac_debug_init; 217 mach_debug_init = mac_debug_init;
diff --git a/arch/m68k/mac/iop.c b/arch/m68k/mac/iop.c
index d889ba80ccdc..9179a3798407 100644
--- a/arch/m68k/mac/iop.c
+++ b/arch/m68k/mac/iop.c
@@ -293,8 +293,8 @@ void __init iop_init(void)
293 } 293 }
294 294
295 for (i = 0 ; i < NUM_IOP_CHAN ; i++) { 295 for (i = 0 ; i < NUM_IOP_CHAN ; i++) {
296 iop_send_queue[IOP_NUM_SCC][i] = 0; 296 iop_send_queue[IOP_NUM_SCC][i] = NULL;
297 iop_send_queue[IOP_NUM_ISM][i] = 0; 297 iop_send_queue[IOP_NUM_ISM][i] = NULL;
298 iop_listeners[IOP_NUM_SCC][i].devname = NULL; 298 iop_listeners[IOP_NUM_SCC][i].devname = NULL;
299 iop_listeners[IOP_NUM_SCC][i].handler = NULL; 299 iop_listeners[IOP_NUM_SCC][i].handler = NULL;
300 iop_listeners[IOP_NUM_ISM][i].devname = NULL; 300 iop_listeners[IOP_NUM_ISM][i].devname = NULL;
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index 5b80d7cd954a..bbb0c3b95e9c 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -39,72 +39,163 @@
39extern struct mac_booter_data mac_bi_data; 39extern struct mac_booter_data mac_bi_data;
40static void (*rom_reset)(void); 40static void (*rom_reset)(void);
41 41
42#ifdef CONFIG_ADB 42#ifdef CONFIG_ADB_CUDA
43/* 43static long cuda_read_time(void)
44 * Return the current time as the number of seconds since January 1, 1904.
45 */
46
47static long adb_read_time(void)
48{ 44{
49 volatile struct adb_request req; 45 struct adb_request req;
50 long time; 46 long time;
51 47
52 adb_request((struct adb_request *) &req, NULL, 48 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0)
53 ADBREQ_RAW|ADBREQ_SYNC, 49 return 0;
54 2, CUDA_PACKET, CUDA_GET_TIME); 50 while (!req.complete)
51 cuda_poll();
55 52
56 time = (req.reply[3] << 24) | (req.reply[4] << 16) 53 time = (req.reply[3] << 24) | (req.reply[4] << 16)
57 | (req.reply[5] << 8) | req.reply[6]; 54 | (req.reply[5] << 8) | req.reply[6];
58 return time - RTC_OFFSET; 55 return time - RTC_OFFSET;
59} 56}
60 57
61/* 58static void cuda_write_time(long data)
62 * Set the current system time 59{
63 */ 60 struct adb_request req;
61 data += RTC_OFFSET;
62 if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
63 (data >> 24) & 0xFF, (data >> 16) & 0xFF,
64 (data >> 8) & 0xFF, data & 0xFF) < 0)
65 return;
66 while (!req.complete)
67 cuda_poll();
68}
64 69
65static void adb_write_time(long data) 70static __u8 cuda_read_pram(int offset)
66{ 71{
67 volatile struct adb_request req; 72 struct adb_request req;
73 if (cuda_request(&req, NULL, 4, CUDA_PACKET, CUDA_GET_PRAM,
74 (offset >> 8) & 0xFF, offset & 0xFF) < 0)
75 return 0;
76 while (!req.complete)
77 cuda_poll();
78 return req.reply[3];
79}
68 80
69 data += RTC_OFFSET; 81static void cuda_write_pram(int offset, __u8 data)
82{
83 struct adb_request req;
84 if (cuda_request(&req, NULL, 5, CUDA_PACKET, CUDA_SET_PRAM,
85 (offset >> 8) & 0xFF, offset & 0xFF, data) < 0)
86 return;
87 while (!req.complete)
88 cuda_poll();
89}
90#else
91#define cuda_read_time() 0
92#define cuda_write_time(n)
93#define cuda_read_pram NULL
94#define cuda_write_pram NULL
95#endif
96
97#ifdef CONFIG_ADB_PMU68K
98static long pmu_read_time(void)
99{
100 struct adb_request req;
101 long time;
102
103 if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0)
104 return 0;
105 while (!req.complete)
106 pmu_poll();
70 107
71 adb_request((struct adb_request *) &req, NULL, 108 time = (req.reply[0] << 24) | (req.reply[1] << 16)
72 ADBREQ_RAW|ADBREQ_SYNC, 109 | (req.reply[2] << 8) | req.reply[3];
73 6, CUDA_PACKET, CUDA_SET_TIME, 110 return time - RTC_OFFSET;
111}
112
113static void pmu_write_time(long data)
114{
115 struct adb_request req;
116 data += RTC_OFFSET;
117 if (pmu_request(&req, NULL, 5, PMU_SET_RTC,
74 (data >> 24) & 0xFF, (data >> 16) & 0xFF, 118 (data >> 24) & 0xFF, (data >> 16) & 0xFF,
75 (data >> 8) & 0xFF, data & 0xFF); 119 (data >> 8) & 0xFF, data & 0xFF) < 0)
120 return;
121 while (!req.complete)
122 pmu_poll();
76} 123}
77 124
78/* 125static __u8 pmu_read_pram(int offset)
79 * Get a byte from the NVRAM 126{
80 */ 127 struct adb_request req;
128 if (pmu_request(&req, NULL, 3, PMU_READ_NVRAM,
129 (offset >> 8) & 0xFF, offset & 0xFF) < 0)
130 return 0;
131 while (!req.complete)
132 pmu_poll();
133 return req.reply[3];
134}
81 135
82static __u8 adb_read_pram(int offset) 136static void pmu_write_pram(int offset, __u8 data)
83{ 137{
84 volatile struct adb_request req; 138 struct adb_request req;
139 if (pmu_request(&req, NULL, 4, PMU_WRITE_NVRAM,
140 (offset >> 8) & 0xFF, offset & 0xFF, data) < 0)
141 return;
142 while (!req.complete)
143 pmu_poll();
144}
145#else
146#define pmu_read_time() 0
147#define pmu_write_time(n)
148#define pmu_read_pram NULL
149#define pmu_write_pram NULL
150#endif
85 151
86 adb_request((struct adb_request *) &req, NULL, 152#ifdef CONFIG_ADB_MACIISI
87 ADBREQ_RAW|ADBREQ_SYNC, 153extern int maciisi_request(struct adb_request *req,
88 4, CUDA_PACKET, CUDA_GET_PRAM, 154 void (*done)(struct adb_request *), int nbytes, ...);
89 (offset >> 8) & 0xFF, offset & 0xFF); 155
90 return req.reply[3]; 156static long maciisi_read_time(void)
157{
158 struct adb_request req;
159 long time;
160
161 if (maciisi_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME))
162 return 0;
163
164 time = (req.reply[3] << 24) | (req.reply[4] << 16)
165 | (req.reply[5] << 8) | req.reply[6];
166 return time - RTC_OFFSET;
91} 167}
92 168
93/* 169static void maciisi_write_time(long data)
94 * Write a byte to the NVRAM 170{
95 */ 171 struct adb_request req;
172 data += RTC_OFFSET;
173 maciisi_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
174 (data >> 24) & 0xFF, (data >> 16) & 0xFF,
175 (data >> 8) & 0xFF, data & 0xFF);
176}
96 177
97static void adb_write_pram(int offset, __u8 data) 178static __u8 maciisi_read_pram(int offset)
98{ 179{
99 volatile struct adb_request req; 180 struct adb_request req;
181 if (maciisi_request(&req, NULL, 4, CUDA_PACKET, CUDA_GET_PRAM,
182 (offset >> 8) & 0xFF, offset & 0xFF))
183 return 0;
184 return req.reply[3];
185}
100 186
101 adb_request((struct adb_request *) &req, NULL, 187static void maciisi_write_pram(int offset, __u8 data)
102 ADBREQ_RAW|ADBREQ_SYNC, 188{
103 5, CUDA_PACKET, CUDA_SET_PRAM, 189 struct adb_request req;
104 (offset >> 8) & 0xFF, offset & 0xFF, 190 maciisi_request(&req, NULL, 5, CUDA_PACKET, CUDA_SET_PRAM,
105 data); 191 (offset >> 8) & 0xFF, offset & 0xFF, data);
106} 192}
107#endif /* CONFIG_ADB */ 193#else
194#define maciisi_read_time() 0
195#define maciisi_write_time(n)
196#define maciisi_read_pram NULL
197#define maciisi_write_pram NULL
198#endif
108 199
109/* 200/*
110 * VIA PRAM/RTC access routines 201 * VIA PRAM/RTC access routines
@@ -305,42 +396,55 @@ static void oss_shutdown(void)
305 396
306static void cuda_restart(void) 397static void cuda_restart(void)
307{ 398{
308 adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, 399 struct adb_request req;
309 2, CUDA_PACKET, CUDA_RESET_SYSTEM); 400 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_RESET_SYSTEM) < 0)
401 return;
402 while (!req.complete)
403 cuda_poll();
310} 404}
311 405
312static void cuda_shutdown(void) 406static void cuda_shutdown(void)
313{ 407{
314 adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, 408 struct adb_request req;
315 2, CUDA_PACKET, CUDA_POWERDOWN); 409 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_POWERDOWN) < 0)
410 return;
411 while (!req.complete)
412 cuda_poll();
316} 413}
317 414
318#endif /* CONFIG_ADB_CUDA */ 415#endif /* CONFIG_ADB_CUDA */
319 416
320#ifdef CONFIG_ADB_PMU 417#ifdef CONFIG_ADB_PMU68K
321 418
322void pmu_restart(void) 419void pmu_restart(void)
323{ 420{
324 adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, 421 struct adb_request req;
325 3, PMU_PACKET, PMU_SET_INTR_MASK, 422 if (pmu_request(&req, NULL,
326 PMU_INT_ADB|PMU_INT_TICK); 423 2, PMU_SET_INTR_MASK, PMU_INT_ADB|PMU_INT_TICK) < 0)
327 424 return;
328 adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, 425 while (!req.complete)
329 2, PMU_PACKET, PMU_RESET); 426 pmu_poll();
427 if (pmu_request(&req, NULL, 1, PMU_RESET) < 0)
428 return;
429 while (!req.complete)
430 pmu_poll();
330} 431}
331 432
332void pmu_shutdown(void) 433void pmu_shutdown(void)
333{ 434{
334 adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, 435 struct adb_request req;
335 3, PMU_PACKET, PMU_SET_INTR_MASK, 436 if (pmu_request(&req, NULL,
336 PMU_INT_ADB|PMU_INT_TICK); 437 2, PMU_SET_INTR_MASK, PMU_INT_ADB|PMU_INT_TICK) < 0)
337 438 return;
338 adb_request(NULL, NULL, ADBREQ_RAW|ADBREQ_SYNC, 439 while (!req.complete)
339 6, PMU_PACKET, PMU_SHUTDOWN, 440 pmu_poll();
340 'M', 'A', 'T', 'T'); 441 if (pmu_request(&req, NULL, 5, PMU_SHUTDOWN, 'M', 'A', 'T', 'T') < 0)
442 return;
443 while (!req.complete)
444 pmu_poll();
341} 445}
342 446
343#endif /* CONFIG_ADB_PMU */ 447#endif
344 448
345/* 449/*
346 *------------------------------------------------------------------- 450 *-------------------------------------------------------------------
@@ -351,21 +455,22 @@ void pmu_shutdown(void)
351 455
352void mac_pram_read(int offset, __u8 *buffer, int len) 456void mac_pram_read(int offset, __u8 *buffer, int len)
353{ 457{
354 __u8 (*func)(int) = NULL; 458 __u8 (*func)(int);
355 int i; 459 int i;
356 460
357 if (macintosh_config->adb_type == MAC_ADB_IISI || 461 switch(macintosh_config->adb_type) {
358 macintosh_config->adb_type == MAC_ADB_PB1 || 462 case MAC_ADB_IISI:
359 macintosh_config->adb_type == MAC_ADB_PB2 || 463 func = maciisi_read_pram; break;
360 macintosh_config->adb_type == MAC_ADB_CUDA) { 464 case MAC_ADB_PB1:
361#ifdef CONFIG_ADB 465 case MAC_ADB_PB2:
362 func = adb_read_pram; 466 func = pmu_read_pram; break;
363#else 467 case MAC_ADB_CUDA:
364 return; 468 func = cuda_read_pram; break;
365#endif 469 default:
366 } else {
367 func = via_read_pram; 470 func = via_read_pram;
368 } 471 }
472 if (!func)
473 return;
369 for (i = 0 ; i < len ; i++) { 474 for (i = 0 ; i < len ; i++) {
370 buffer[i] = (*func)(offset++); 475 buffer[i] = (*func)(offset++);
371 } 476 }
@@ -373,21 +478,22 @@ void mac_pram_read(int offset, __u8 *buffer, int len)
373 478
374void mac_pram_write(int offset, __u8 *buffer, int len) 479void mac_pram_write(int offset, __u8 *buffer, int len)
375{ 480{
376 void (*func)(int, __u8) = NULL; 481 void (*func)(int, __u8);
377 int i; 482 int i;
378 483
379 if (macintosh_config->adb_type == MAC_ADB_IISI || 484 switch(macintosh_config->adb_type) {
380 macintosh_config->adb_type == MAC_ADB_PB1 || 485 case MAC_ADB_IISI:
381 macintosh_config->adb_type == MAC_ADB_PB2 || 486 func = maciisi_write_pram; break;
382 macintosh_config->adb_type == MAC_ADB_CUDA) { 487 case MAC_ADB_PB1:
383#ifdef CONFIG_ADB 488 case MAC_ADB_PB2:
384 func = adb_write_pram; 489 func = pmu_write_pram; break;
385#else 490 case MAC_ADB_CUDA:
386 return; 491 func = cuda_write_pram; break;
387#endif 492 default:
388 } else {
389 func = via_write_pram; 493 func = via_write_pram;
390 } 494 }
495 if (!func)
496 return;
391 for (i = 0 ; i < len ; i++) { 497 for (i = 0 ; i < len ; i++) {
392 (*func)(offset++, buffer[i]); 498 (*func)(offset++, buffer[i]);
393 } 499 }
@@ -408,7 +514,7 @@ void mac_poweroff(void)
408 } else if (macintosh_config->adb_type == MAC_ADB_CUDA) { 514 } else if (macintosh_config->adb_type == MAC_ADB_CUDA) {
409 cuda_shutdown(); 515 cuda_shutdown();
410#endif 516#endif
411#ifdef CONFIG_ADB_PMU 517#ifdef CONFIG_ADB_PMU68K
412 } else if (macintosh_config->adb_type == MAC_ADB_PB1 518 } else if (macintosh_config->adb_type == MAC_ADB_PB1
413 || macintosh_config->adb_type == MAC_ADB_PB2) { 519 || macintosh_config->adb_type == MAC_ADB_PB2) {
414 pmu_shutdown(); 520 pmu_shutdown();
@@ -448,7 +554,7 @@ void mac_reset(void)
448 } else if (macintosh_config->adb_type == MAC_ADB_CUDA) { 554 } else if (macintosh_config->adb_type == MAC_ADB_CUDA) {
449 cuda_restart(); 555 cuda_restart();
450#endif 556#endif
451#ifdef CONFIG_ADB_PMU 557#ifdef CONFIG_ADB_PMU68K
452 } else if (macintosh_config->adb_type == MAC_ADB_PB1 558 } else if (macintosh_config->adb_type == MAC_ADB_PB1
453 || macintosh_config->adb_type == MAC_ADB_PB2) { 559 || macintosh_config->adb_type == MAC_ADB_PB2) {
454 pmu_restart(); 560 pmu_restart();
@@ -466,12 +572,13 @@ void mac_reset(void)
466 /* make a 1-to-1 mapping, using the transparent tran. reg. */ 572 /* make a 1-to-1 mapping, using the transparent tran. reg. */
467 unsigned long virt = (unsigned long) mac_reset; 573 unsigned long virt = (unsigned long) mac_reset;
468 unsigned long phys = virt_to_phys(mac_reset); 574 unsigned long phys = virt_to_phys(mac_reset);
575 unsigned long addr = (phys&0xFF000000)|0x8777;
469 unsigned long offset = phys-virt; 576 unsigned long offset = phys-virt;
470 local_irq_disable(); /* lets not screw this up, ok? */ 577 local_irq_disable(); /* lets not screw this up, ok? */
471 __asm__ __volatile__(".chip 68030\n\t" 578 __asm__ __volatile__(".chip 68030\n\t"
472 "pmove %0,%/tt0\n\t" 579 "pmove %0,%/tt0\n\t"
473 ".chip 68k" 580 ".chip 68k"
474 : : "m" ((phys&0xFF000000)|0x8777)); 581 : : "m" (addr));
475 /* Now jump to physical address so we can disable MMU */ 582 /* Now jump to physical address so we can disable MMU */
476 __asm__ __volatile__( 583 __asm__ __volatile__(
477 ".chip 68030\n\t" 584 ".chip 68030\n\t"
@@ -588,20 +695,22 @@ int mac_hwclk(int op, struct rtc_time *t)
588 unsigned long now; 695 unsigned long now;
589 696
590 if (!op) { /* read */ 697 if (!op) { /* read */
591 if (macintosh_config->adb_type == MAC_ADB_II) { 698 switch (macintosh_config->adb_type) {
699 case MAC_ADB_II:
700 case MAC_ADB_IOP:
592 now = via_read_time(); 701 now = via_read_time();
593 } else 702 break;
594#ifdef CONFIG_ADB 703 case MAC_ADB_IISI:
595 if ((macintosh_config->adb_type == MAC_ADB_IISI) || 704 now = maciisi_read_time();
596 (macintosh_config->adb_type == MAC_ADB_PB1) || 705 break;
597 (macintosh_config->adb_type == MAC_ADB_PB2) || 706 case MAC_ADB_PB1:
598 (macintosh_config->adb_type == MAC_ADB_CUDA)) { 707 case MAC_ADB_PB2:
599 now = adb_read_time(); 708 now = pmu_read_time();
600 } else 709 break;
601#endif 710 case MAC_ADB_CUDA:
602 if (macintosh_config->adb_type == MAC_ADB_IOP) { 711 now = cuda_read_time();
603 now = via_read_time(); 712 break;
604 } else { 713 default:
605 now = 0; 714 now = 0;
606 } 715 }
607 716
@@ -619,15 +728,20 @@ int mac_hwclk(int op, struct rtc_time *t)
619 now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, 728 now = mktime(t->tm_year + 1900, t->tm_mon + 1, t->tm_mday,
620 t->tm_hour, t->tm_min, t->tm_sec); 729 t->tm_hour, t->tm_min, t->tm_sec);
621 730
622 if (macintosh_config->adb_type == MAC_ADB_II) { 731 switch (macintosh_config->adb_type) {
623 via_write_time(now); 732 case MAC_ADB_II:
624 } else if ((macintosh_config->adb_type == MAC_ADB_IISI) || 733 case MAC_ADB_IOP:
625 (macintosh_config->adb_type == MAC_ADB_PB1) ||
626 (macintosh_config->adb_type == MAC_ADB_PB2) ||
627 (macintosh_config->adb_type == MAC_ADB_CUDA)) {
628 adb_write_time(now);
629 } else if (macintosh_config->adb_type == MAC_ADB_IOP) {
630 via_write_time(now); 734 via_write_time(now);
735 break;
736 case MAC_ADB_CUDA:
737 cuda_write_time(now);
738 break;
739 case MAC_ADB_PB1:
740 case MAC_ADB_PB2:
741 pmu_write_time(now);
742 break;
743 case MAC_ADB_IISI:
744 maciisi_write_time(now);
631 } 745 }
632#endif 746#endif
633 } 747 }
diff --git a/arch/m68k/math-emu/multi_arith.h b/arch/m68k/math-emu/multi_arith.h
index 02251e5afd89..4ad0ca918e2e 100644
--- a/arch/m68k/math-emu/multi_arith.h
+++ b/arch/m68k/math-emu/multi_arith.h
@@ -366,7 +366,7 @@ static inline void fp_submant(struct fp_ext *dest, struct fp_ext *src1,
366 366
367#define fp_mul64(desth, destl, src1, src2) ({ \ 367#define fp_mul64(desth, destl, src1, src2) ({ \
368 asm ("mulu.l %2,%1:%0" : "=d" (destl), "=d" (desth) \ 368 asm ("mulu.l %2,%1:%0" : "=d" (destl), "=d" (desth) \
369 : "g" (src1), "0" (src2)); \ 369 : "dm" (src1), "0" (src2)); \
370}) 370})
371#define fp_div64(quot, rem, srch, srcl, div) \ 371#define fp_div64(quot, rem, srch, srcl, div) \
372 asm ("divu.l %2,%1:%0" : "=d" (quot), "=d" (rem) \ 372 asm ("divu.l %2,%1:%0" : "=d" (quot), "=d" (rem) \
diff --git a/arch/m68k/mm/kmap.c b/arch/m68k/mm/kmap.c
index fe2383e36b06..85ad19a0ac79 100644
--- a/arch/m68k/mm/kmap.c
+++ b/arch/m68k/mm/kmap.c
@@ -102,7 +102,7 @@ static inline void free_io_area(void *addr)
102 */ 102 */
103/* Rewritten by Andreas Schwab to remove all races. */ 103/* Rewritten by Andreas Schwab to remove all races. */
104 104
105void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag) 105void __iomem *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
106{ 106{
107 struct vm_struct *area; 107 struct vm_struct *area;
108 unsigned long virtaddr, retaddr; 108 unsigned long virtaddr, retaddr;
@@ -121,7 +121,7 @@ void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
121 if (MACH_IS_AMIGA) { 121 if (MACH_IS_AMIGA) {
122 if ((physaddr >= 0x40000000) && (physaddr + size < 0x60000000) 122 if ((physaddr >= 0x40000000) && (physaddr + size < 0x60000000)
123 && (cacheflag == IOMAP_NOCACHE_SER)) 123 && (cacheflag == IOMAP_NOCACHE_SER))
124 return (void *)physaddr; 124 return (void __iomem *)physaddr;
125 } 125 }
126#endif 126#endif
127 127
@@ -218,21 +218,21 @@ void *__ioremap(unsigned long physaddr, unsigned long size, int cacheflag)
218#endif 218#endif
219 flush_tlb_all(); 219 flush_tlb_all();
220 220
221 return (void *)retaddr; 221 return (void __iomem *)retaddr;
222} 222}
223 223
224/* 224/*
225 * Unmap a ioremap()ed region again 225 * Unmap a ioremap()ed region again
226 */ 226 */
227void iounmap(void *addr) 227void iounmap(void __iomem *addr)
228{ 228{
229#ifdef CONFIG_AMIGA 229#ifdef CONFIG_AMIGA
230 if ((!MACH_IS_AMIGA) || 230 if ((!MACH_IS_AMIGA) ||
231 (((unsigned long)addr < 0x40000000) || 231 (((unsigned long)addr < 0x40000000) ||
232 ((unsigned long)addr > 0x60000000))) 232 ((unsigned long)addr > 0x60000000)))
233 free_io_area(addr); 233 free_io_area((__force void *)addr);
234#else 234#else
235 free_io_area(addr); 235 free_io_area((__force void *)addr);
236#endif 236#endif
237} 237}
238 238
diff --git a/arch/m68k/mvme16x/rtc.c b/arch/m68k/mvme16x/rtc.c
index 7977eae50af2..a69fe3048edc 100644
--- a/arch/m68k/mvme16x/rtc.c
+++ b/arch/m68k/mvme16x/rtc.c
@@ -11,6 +11,7 @@
11#include <linux/miscdevice.h> 11#include <linux/miscdevice.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/ioport.h> 13#include <linux/ioport.h>
14#include <linux/capability.h>
14#include <linux/fcntl.h> 15#include <linux/fcntl.h>
15#include <linux/init.h> 16#include <linux/init.h>
16#include <linux/poll.h> 17#include <linux/poll.h>
@@ -44,6 +45,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
44 volatile MK48T08ptr_t rtc = (MK48T08ptr_t)MVME_RTC_BASE; 45 volatile MK48T08ptr_t rtc = (MK48T08ptr_t)MVME_RTC_BASE;
45 unsigned long flags; 46 unsigned long flags;
46 struct rtc_time wtime; 47 struct rtc_time wtime;
48 void __user *argp = (void __user *)arg;
47 49
48 switch (cmd) { 50 switch (cmd) {
49 case RTC_RD_TIME: /* Read the time/date from RTC */ 51 case RTC_RD_TIME: /* Read the time/date from RTC */
@@ -63,7 +65,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
63 wtime.tm_wday = BCD2BIN(rtc->bcd_dow)-1; 65 wtime.tm_wday = BCD2BIN(rtc->bcd_dow)-1;
64 rtc->ctrl = 0; 66 rtc->ctrl = 0;
65 local_irq_restore(flags); 67 local_irq_restore(flags);
66 return copy_to_user((void *)arg, &wtime, sizeof wtime) ? 68 return copy_to_user(argp, &wtime, sizeof wtime) ?
67 -EFAULT : 0; 69 -EFAULT : 0;
68 } 70 }
69 case RTC_SET_TIME: /* Set the RTC */ 71 case RTC_SET_TIME: /* Set the RTC */
@@ -75,8 +77,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
75 if (!capable(CAP_SYS_ADMIN)) 77 if (!capable(CAP_SYS_ADMIN))
76 return -EACCES; 78 return -EACCES;
77 79
78 if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, 80 if (copy_from_user(&rtc_tm, argp, sizeof(struct rtc_time)))
79 sizeof(struct rtc_time)))
80 return -EFAULT; 81 return -EFAULT;
81 82
82 yrs = rtc_tm.tm_year; 83 yrs = rtc_tm.tm_year;
diff --git a/arch/m68k/q40/config.c b/arch/m68k/q40/config.c
index 02b626bae4ae..5e0f9b04d45e 100644
--- a/arch/m68k/q40/config.c
+++ b/arch/m68k/q40/config.c
@@ -36,8 +36,6 @@
36#include <asm/machdep.h> 36#include <asm/machdep.h>
37#include <asm/q40_master.h> 37#include <asm/q40_master.h>
38 38
39extern void floppy_setup(char *str, int *ints);
40
41extern irqreturn_t q40_process_int (int level, struct pt_regs *regs); 39extern irqreturn_t q40_process_int (int level, struct pt_regs *regs);
42extern irqreturn_t (*q40_default_handler[]) (int, void *, struct pt_regs *); /* added just for debugging */ 40extern irqreturn_t (*q40_default_handler[]) (int, void *, struct pt_regs *); /* added just for debugging */
43extern void q40_init_IRQ (void); 41extern void q40_init_IRQ (void);
@@ -194,9 +192,6 @@ void __init config_q40(void)
194 mach_heartbeat = q40_heartbeat; 192 mach_heartbeat = q40_heartbeat;
195#endif 193#endif
196 mach_halt = q40_halt; 194 mach_halt = q40_halt;
197#ifdef CONFIG_DUMMY_CONSOLE
198 conswitchp = &dummy_con;
199#endif
200 195
201 /* disable a few things that SMSQ might have left enabled */ 196 /* disable a few things that SMSQ might have left enabled */
202 q40_disable_irqs(); 197 q40_disable_irqs();
diff --git a/arch/m68k/sun3/config.c b/arch/m68k/sun3/config.c
index 77d05bcc3221..f1ca0dfbaa67 100644
--- a/arch/m68k/sun3/config.c
+++ b/arch/m68k/sun3/config.c
@@ -160,9 +160,6 @@ void __init config_sun3(void)
160 mach_hwclk = sun3_hwclk; 160 mach_hwclk = sun3_hwclk;
161 mach_halt = sun3_halt; 161 mach_halt = sun3_halt;
162 mach_get_hardware_list = sun3_get_hardware_list; 162 mach_get_hardware_list = sun3_get_hardware_list;
163#if defined(CONFIG_DUMMY_CONSOLE)
164 conswitchp = &dummy_con;
165#endif
166 163
167 memory_start = ((((int)&_end) + 0x2000) & ~0x1fff); 164 memory_start = ((((int)&_end) + 0x2000) & ~0x1fff);
168// PROM seems to want the last couple of physical pages. --m 165// PROM seems to want the last couple of physical pages. --m
diff --git a/arch/m68k/sun3x/config.c b/arch/m68k/sun3x/config.c
index 0ef547f5494d..0920f5d33606 100644
--- a/arch/m68k/sun3x/config.c
+++ b/arch/m68k/sun3x/config.c
@@ -71,10 +71,6 @@ void __init config_sun3x(void)
71 mach_get_model = sun3_get_model; 71 mach_get_model = sun3_get_model;
72 mach_get_hardware_list = sun3x_get_hardware_list; 72 mach_get_hardware_list = sun3x_get_hardware_list;
73 73
74#ifdef CONFIG_DUMMY_CONSOLE
75 conswitchp = &dummy_con;
76#endif
77
78 sun3_intreg = (unsigned char *)SUN3X_INTREG; 74 sun3_intreg = (unsigned char *)SUN3X_INTREG;
79 75
80 /* only the serial console is known to work anyway... */ 76 /* only the serial console is known to work anyway... */
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index b96498120fe9..e2a6e8648960 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -17,10 +17,6 @@ config FPU
17 bool 17 bool
18 default n 18 default n
19 19
20config UID16
21 bool
22 default y
23
24config RWSEM_GENERIC_SPINLOCK 20config RWSEM_GENERIC_SPINLOCK
25 bool 21 bool
26 default y 22 default y
diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile
index b6b5c14e55fd..6f880cbff1c8 100644
--- a/arch/m68knommu/Makefile
+++ b/arch/m68knommu/Makefile
@@ -99,7 +99,6 @@ cflags-$(CONFIG_M68360) := -m68332
99AFLAGS += $(cflags-y) 99AFLAGS += $(cflags-y)
100 100
101CFLAGS += $(cflags-y) 101CFLAGS += $(cflags-y)
102CFLAGS += -O1 -g
103CFLAGS += -D__linux__ 102CFLAGS += -D__linux__
104CFLAGS += -DUTS_SYSNAME=\"uClinux\" 103CFLAGS += -DUTS_SYSNAME=\"uClinux\"
105 104
diff --git a/arch/m68knommu/kernel/m68k_ksyms.c b/arch/m68knommu/kernel/m68k_ksyms.c
index e93a5ad56496..eddb8d3e130a 100644
--- a/arch/m68knommu/kernel/m68k_ksyms.c
+++ b/arch/m68knommu/kernel/m68k_ksyms.c
@@ -18,7 +18,6 @@
18#include <asm/checksum.h> 18#include <asm/checksum.h>
19#include <asm/current.h> 19#include <asm/current.h>
20 20
21extern void dump_thread(struct pt_regs *, struct user *);
22extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); 21extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
23 22
24/* platform dependent support */ 23/* platform dependent support */
@@ -26,7 +25,6 @@ extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
26EXPORT_SYMBOL(__ioremap); 25EXPORT_SYMBOL(__ioremap);
27EXPORT_SYMBOL(iounmap); 26EXPORT_SYMBOL(iounmap);
28EXPORT_SYMBOL(dump_fpu); 27EXPORT_SYMBOL(dump_fpu);
29EXPORT_SYMBOL(dump_thread);
30EXPORT_SYMBOL(strnlen); 28EXPORT_SYMBOL(strnlen);
31EXPORT_SYMBOL(strrchr); 29EXPORT_SYMBOL(strrchr);
32EXPORT_SYMBOL(strstr); 30EXPORT_SYMBOL(strstr);
@@ -38,8 +36,6 @@ EXPORT_SYMBOL(strncmp);
38 36
39EXPORT_SYMBOL(ip_fast_csum); 37EXPORT_SYMBOL(ip_fast_csum);
40 38
41EXPORT_SYMBOL(mach_enable_irq);
42EXPORT_SYMBOL(mach_disable_irq);
43EXPORT_SYMBOL(kernel_thread); 39EXPORT_SYMBOL(kernel_thread);
44 40
45/* Networking helper routines. */ 41/* Networking helper routines. */
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index 82e7ec888806..99bf43824795 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -198,10 +198,9 @@ int copy_thread(int nr, unsigned long clone_flags,
198{ 198{
199 struct pt_regs * childregs; 199 struct pt_regs * childregs;
200 struct switch_stack * childstack, *stack; 200 struct switch_stack * childstack, *stack;
201 unsigned long stack_offset, *retp; 201 unsigned long *retp;
202 202
203 stack_offset = THREAD_SIZE - sizeof(struct pt_regs); 203 childregs = (struct pt_regs *) (task_stack_page(p) + THREAD_SIZE) - 1;
204 childregs = (struct pt_regs *) ((unsigned long) p->thread_info + stack_offset);
205 204
206 *childregs = *regs; 205 *childregs = *regs;
207 childregs->d0 = 0; 206 childregs->d0 = 0;
@@ -276,52 +275,6 @@ int dump_fpu(struct pt_regs *regs, struct user_m68kfp_struct *fpu)
276} 275}
277 276
278/* 277/*
279 * fill in the user structure for a core dump..
280 */
281void dump_thread(struct pt_regs * regs, struct user * dump)
282{
283 struct switch_stack *sw;
284
285 /* changed the size calculations - should hopefully work better. lbt */
286 dump->magic = CMAGIC;
287 dump->start_code = 0;
288 dump->start_stack = rdusp() & ~(PAGE_SIZE - 1);
289 dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT;
290 dump->u_dsize = ((unsigned long) (current->mm->brk +
291 (PAGE_SIZE-1))) >> PAGE_SHIFT;
292 dump->u_dsize -= dump->u_tsize;
293 dump->u_ssize = 0;
294
295 if (dump->start_stack < TASK_SIZE)
296 dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT;
297
298 dump->u_ar0 = (struct user_regs_struct *)((int)&dump->regs - (int)dump);
299 sw = ((struct switch_stack *)regs) - 1;
300 dump->regs.d1 = regs->d1;
301 dump->regs.d2 = regs->d2;
302 dump->regs.d3 = regs->d3;
303 dump->regs.d4 = regs->d4;
304 dump->regs.d5 = regs->d5;
305 dump->regs.d6 = sw->d6;
306 dump->regs.d7 = sw->d7;
307 dump->regs.a0 = regs->a0;
308 dump->regs.a1 = regs->a1;
309 dump->regs.a2 = regs->a2;
310 dump->regs.a3 = sw->a3;
311 dump->regs.a4 = sw->a4;
312 dump->regs.a5 = sw->a5;
313 dump->regs.a6 = sw->a6;
314 dump->regs.d0 = regs->d0;
315 dump->regs.orig_d0 = regs->orig_d0;
316 dump->regs.stkadj = regs->stkadj;
317 dump->regs.sr = regs->sr;
318 dump->regs.pc = regs->pc;
319 dump->regs.fmtvec = (regs->format << 12) | regs->vector;
320 /* dump floating point stuff */
321 dump->u_fpvalid = dump_fpu (regs, &dump->m68kfp);
322}
323
324/*
325 * Generic dumping code. Used for panic and debug. 278 * Generic dumping code. Used for panic and debug.
326 */ 279 */
327void dump(struct pt_regs *fp) 280void dump(struct pt_regs *fp)
diff --git a/arch/m68knommu/kernel/ptrace.c b/arch/m68knommu/kernel/ptrace.c
index 262ab8c72e5f..382ca5797b97 100644
--- a/arch/m68knommu/kernel/ptrace.c
+++ b/arch/m68knommu/kernel/ptrace.c
@@ -101,7 +101,7 @@ void ptrace_disable(struct task_struct *child)
101 put_reg(child, PT_SR, tmp); 101 put_reg(child, PT_SR, tmp);
102} 102}
103 103
104long arch_ptrace(truct task_struct *child, long request, long addr, long data) 104long arch_ptrace(struct task_struct *child, long request, long addr, long data)
105{ 105{
106 int ret; 106 int ret;
107 107
diff --git a/arch/m68knommu/kernel/setup.c b/arch/m68knommu/kernel/setup.c
index abb80fa2b940..93120b9bfff1 100644
--- a/arch/m68knommu/kernel/setup.c
+++ b/arch/m68knommu/kernel/setup.c
@@ -65,8 +65,6 @@ void (*mach_kbd_leds) (unsigned int) = NULL;
65/* machine dependent irq functions */ 65/* machine dependent irq functions */
66void (*mach_init_IRQ) (void) = NULL; 66void (*mach_init_IRQ) (void) = NULL;
67irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *) = NULL; 67irqreturn_t (*(*mach_default_handler)[]) (int, void *, struct pt_regs *) = NULL;
68void (*mach_enable_irq) (unsigned int) = NULL;
69void (*mach_disable_irq) (unsigned int) = NULL;
70int (*mach_get_irq_list) (struct seq_file *, void *) = NULL; 68int (*mach_get_irq_list) (struct seq_file *, void *) = NULL;
71void (*mach_process_int) (int irq, struct pt_regs *fp) = NULL; 69void (*mach_process_int) (int irq, struct pt_regs *fp) = NULL;
72void (*mach_trap_init) (void); 70void (*mach_trap_init) (void);
diff --git a/arch/m68knommu/kernel/signal.c b/arch/m68knommu/kernel/signal.c
index 43a2726c0d0a..e1b3aa39e270 100644
--- a/arch/m68knommu/kernel/signal.c
+++ b/arch/m68knommu/kernel/signal.c
@@ -285,6 +285,7 @@ restore_sigcontext(struct pt_regs *regs, struct sigcontext *usc, void *fp,
285 regs->d1 = context.sc_d1; 285 regs->d1 = context.sc_d1;
286 regs->a0 = context.sc_a0; 286 regs->a0 = context.sc_a0;
287 regs->a1 = context.sc_a1; 287 regs->a1 = context.sc_a1;
288 ((struct switch_stack *)regs - 1)->a5 = context.sc_a5;
288 regs->sr = (regs->sr & 0xff00) | (context.sc_sr & 0xff); 289 regs->sr = (regs->sr & 0xff00) | (context.sc_sr & 0xff);
289 regs->pc = context.sc_pc; 290 regs->pc = context.sc_pc;
290 regs->orig_d0 = -1; /* disable syscall checks */ 291 regs->orig_d0 = -1; /* disable syscall checks */
@@ -498,6 +499,7 @@ static void setup_sigcontext(struct sigcontext *sc, struct pt_regs *regs,
498 sc->sc_d1 = regs->d1; 499 sc->sc_d1 = regs->d1;
499 sc->sc_a0 = regs->a0; 500 sc->sc_a0 = regs->a0;
500 sc->sc_a1 = regs->a1; 501 sc->sc_a1 = regs->a1;
502 sc->sc_a5 = ((struct switch_stack *)regs - 1)->a5;
501 sc->sc_sr = regs->sr; 503 sc->sc_sr = regs->sr;
502 sc->sc_pc = regs->pc; 504 sc->sc_pc = regs->pc;
503 sc->sc_formatvec = regs->format << 12 | regs->vector; 505 sc->sc_formatvec = regs->format << 12 | regs->vector;
@@ -597,6 +599,9 @@ static void setup_frame (int sig, struct k_sigaction *ka,
597 /* Set up registers for signal handler */ 599 /* Set up registers for signal handler */
598 wrusp ((unsigned long) frame); 600 wrusp ((unsigned long) frame);
599 regs->pc = (unsigned long) ka->sa.sa_handler; 601 regs->pc = (unsigned long) ka->sa.sa_handler;
602 ((struct switch_stack *)regs - 1)->a5 = current->mm->start_data;
603 regs->format = 0x4; /*set format byte to make stack appear modulo 4
604 which it will be when doing the rte */
600 605
601adjust_stack: 606adjust_stack:
602 /* Prepare to skip over the extra stuff in the exception frame. */ 607 /* Prepare to skip over the extra stuff in the exception frame. */
@@ -664,6 +669,9 @@ static void setup_rt_frame (int sig, struct k_sigaction *ka, siginfo_t *info,
664 /* Set up registers for signal handler */ 669 /* Set up registers for signal handler */
665 wrusp ((unsigned long) frame); 670 wrusp ((unsigned long) frame);
666 regs->pc = (unsigned long) ka->sa.sa_handler; 671 regs->pc = (unsigned long) ka->sa.sa_handler;
672 ((struct switch_stack *)regs - 1)->a5 = current->mm->start_data;
673 regs->format = 0x4; /*set format byte to make stack appear modulo 4
674 which it will be when doing the rte */
667 675
668adjust_stack: 676adjust_stack:
669 /* Prepare to skip over the extra stuff in the exception frame. */ 677 /* Prepare to skip over the extra stuff in the exception frame. */
diff --git a/arch/m68knommu/kernel/vmlinux.lds.S b/arch/m68knommu/kernel/vmlinux.lds.S
index 0eab92ca4b97..ac9de2661c0b 100644
--- a/arch/m68knommu/kernel/vmlinux.lds.S
+++ b/arch/m68knommu/kernel/vmlinux.lds.S
@@ -129,7 +129,7 @@
129 */ 129 */
130#if defined(CONFIG_M5208EVB) 130#if defined(CONFIG_M5208EVB)
131#define RAM_START 0x40020000 131#define RAM_START 0x40020000
132#define RAM_LENGTH 0x01e00000 132#define RAM_LENGTH 0x01fe0000
133#endif 133#endif
134 134
135/* 135/*
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index e380a8322a94..c3e852e9953e 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -6,8 +6,6 @@ config MIPS
6 6
7mainmenu "Linux/MIPS Kernel Configuration" 7mainmenu "Linux/MIPS Kernel Configuration"
8 8
9source "init/Kconfig"
10
11menu "Machine selection" 9menu "Machine selection"
12 10
13choice 11choice
@@ -1473,7 +1471,7 @@ config SB1_PASS_2_1_WORKAROUNDS
1473 1471
1474config 64BIT_PHYS_ADDR 1472config 64BIT_PHYS_ADDR
1475 bool "Support for 64-bit physical address space" 1473 bool "Support for 64-bit physical address space"
1476 depends on (CPU_R4X00 || CPU_R5000 || CPU_RM7000 || CPU_RM9000 || CPU_R10000 || CPU_SB1 || CPU_MIPS32_R1 || CPU_MIPS64_R1) && 32BIT 1474 depends on (CPU_R4X00 || CPU_R5000 || CPU_RM7000 || CPU_RM9000 || CPU_R10000 || CPU_SB1 || CPU_MIPS32 || CPU_MIPS64) && 32BIT
1477 1475
1478config CPU_ADVANCED 1476config CPU_ADVANCED
1479 bool "Override CPU Options" 1477 bool "Override CPU Options"
@@ -1494,14 +1492,6 @@ config CPU_HAS_LLSC
1494 for better performance, N if you don't know. You must say Y here 1492 for better performance, N if you don't know. You must say Y here
1495 for multiprocessor machines. 1493 for multiprocessor machines.
1496 1494
1497config CPU_HAS_LLDSCD
1498 bool "lld/scd Instructions available" if CPU_ADVANCED
1499 default y if !CPU_ADVANCED && !CPU_R3000 && !CPU_VR41XX && !CPU_TX39XX && !CPU_MIPS32_R1
1500 help
1501 Say Y here if your CPU has the lld and scd instructions, the 64-bit
1502 equivalents of ll and sc. Say Y here for better performance, N if
1503 you don't know. You must say Y here for multiprocessor machines.
1504
1505config CPU_HAS_WB 1495config CPU_HAS_WB
1506 bool "Writeback Buffer available" if CPU_ADVANCED 1496 bool "Writeback Buffer available" if CPU_ADVANCED
1507 default y if !CPU_ADVANCED && CPU_R3000 && MACH_DECSTATION 1497 default y if !CPU_ADVANCED && CPU_R3000 && MACH_DECSTATION
@@ -1643,6 +1633,8 @@ config RWSEM_GENERIC_SPINLOCK
1643 bool 1633 bool
1644 default y 1634 default y
1645 1635
1636source "init/Kconfig"
1637
1646menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)" 1638menu "Bus options (PCI, PCMCIA, EISA, ISA, TC)"
1647 1639
1648config HW_HAS_EISA 1640config HW_HAS_EISA
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index e14ba5e01a36..2a9f2ef27b29 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -93,7 +93,6 @@ endif
93# 93#
94cflags-y += -I $(TOPDIR)/include/asm/gcc 94cflags-y += -I $(TOPDIR)/include/asm/gcc
95cflags-y += -G 0 -mno-abicalls -fno-pic -pipe 95cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
96cflags-y += $(call cc-option, -finline-limit=100000)
97LDFLAGS_vmlinux += -G 0 -static -n -nostdlib 96LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
98MODFLAGS += -mlong-calls 97MODFLAGS += -mlong-calls
99 98
diff --git a/arch/mips/au1000/db1x00/board_setup.c b/arch/mips/au1000/db1x00/board_setup.c
index ac05ba0ff63f..f00ec3b175d8 100644
--- a/arch/mips/au1000/db1x00/board_setup.c
+++ b/arch/mips/au1000/db1x00/board_setup.c
@@ -45,13 +45,12 @@
45#include <asm/mach-au1x00/au1000.h> 45#include <asm/mach-au1x00/au1000.h>
46#include <asm/mach-db1x00/db1x00.h> 46#include <asm/mach-db1x00/db1x00.h>
47 47
48/* not correct for db1550 */ 48static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
49static BCSR * const bcsr = (BCSR *)0xAE000000;
50 49
51void board_reset (void) 50void board_reset (void)
52{ 51{
53 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */ 52 /* Hit BCSR.SYSTEM_CONTROL[SW_RST] */
54 au_writel(0x00000000, 0xAE00001C); 53 bcsr->swreset = 0x0000;
55} 54}
56 55
57void __init board_setup(void) 56void __init board_setup(void)
@@ -75,7 +74,7 @@ void __init board_setup(void)
75 bcsr->resets |= BCSR_RESETS_IRDA_MODE_OFF; 74 bcsr->resets |= BCSR_RESETS_IRDA_MODE_OFF;
76 au_sync(); 75 au_sync();
77#endif 76#endif
78 au_writel(0, 0xAE000010); /* turn off pcmcia power */ 77 bcsr->pcmcia = 0x0000; /* turn off PCMCIA power */
79 78
80#ifdef CONFIG_MIPS_MIRAGE 79#ifdef CONFIG_MIPS_MIRAGE
81 /* enable GPIO[31:0] inputs */ 80 /* enable GPIO[31:0] inputs */
diff --git a/arch/mips/au1000/db1x00/init.c b/arch/mips/au1000/db1x00/init.c
index 4b9d5e46edbb..41e0522f3cf1 100644
--- a/arch/mips/au1000/db1x00/init.c
+++ b/arch/mips/au1000/db1x00/init.c
@@ -61,7 +61,17 @@ void __init prom_init(void)
61 prom_envp = (char **) fw_arg2; 61 prom_envp = (char **) fw_arg2;
62 62
63 mips_machgroup = MACH_GROUP_ALCHEMY; 63 mips_machgroup = MACH_GROUP_ALCHEMY;
64 mips_machtype = MACH_DB1000; /* set the platform # */ 64
65 /* Set the platform # */
66#if defined (CONFIG_MIPS_DB1550)
67 mips_machtype = MACH_DB1550;
68#elif defined (CONFIG_MIPS_DB1500)
69 mips_machtype = MACH_DB1500;
70#elif defined (CONFIG_MIPS_DB1100)
71 mips_machtype = MACH_DB1100;
72#else
73 mips_machtype = MACH_DB1000;
74#endif
65 75
66 prom_init_cmdline(); 76 prom_init_cmdline();
67 77
diff --git a/arch/mips/configs/atlas_defconfig b/arch/mips/configs/atlas_defconfig
index 74990758154b..89c21572a59c 100644
--- a/arch/mips/configs/atlas_defconfig
+++ b/arch/mips/configs/atlas_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Thu Nov 10 12:14:02 2005 4# Thu Nov 24 01:05:52 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -215,6 +146,75 @@ CONFIG_PREEMPT_NONE=y
215# CONFIG_PREEMPT is not set 146# CONFIG_PREEMPT is not set
216 147
217# 148#
149# Code maturity level options
150#
151CONFIG_EXPERIMENTAL=y
152CONFIG_CLEAN_COMPILE=y
153CONFIG_BROKEN_ON_SMP=y
154CONFIG_INIT_ENV_ARG_LIMIT=32
155
156#
157# General setup
158#
159CONFIG_LOCALVERSION=""
160CONFIG_LOCALVERSION_AUTO=y
161CONFIG_SWAP=y
162CONFIG_SYSVIPC=y
163# CONFIG_POSIX_MQUEUE is not set
164# CONFIG_BSD_PROCESS_ACCT is not set
165CONFIG_SYSCTL=y
166# CONFIG_AUDIT is not set
167CONFIG_HOTPLUG=y
168CONFIG_KOBJECT_UEVENT=y
169# CONFIG_IKCONFIG is not set
170CONFIG_INITRAMFS_SOURCE=""
171CONFIG_EMBEDDED=y
172CONFIG_KALLSYMS=y
173# CONFIG_KALLSYMS_EXTRA_PASS is not set
174CONFIG_PRINTK=y
175CONFIG_BUG=y
176CONFIG_BASE_FULL=y
177CONFIG_FUTEX=y
178CONFIG_EPOLL=y
179# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
180CONFIG_SHMEM=y
181CONFIG_CC_ALIGN_FUNCTIONS=0
182CONFIG_CC_ALIGN_LABELS=0
183CONFIG_CC_ALIGN_LOOPS=0
184CONFIG_CC_ALIGN_JUMPS=0
185# CONFIG_TINY_SHMEM is not set
186CONFIG_BASE_SMALL=0
187
188#
189# Loadable module support
190#
191CONFIG_MODULES=y
192CONFIG_MODULE_UNLOAD=y
193# CONFIG_MODULE_FORCE_UNLOAD is not set
194CONFIG_OBSOLETE_MODPARM=y
195CONFIG_MODVERSIONS=y
196CONFIG_MODULE_SRCVERSION_ALL=y
197CONFIG_KMOD=y
198
199#
200# Block layer
201#
202# CONFIG_LBD is not set
203
204#
205# IO Schedulers
206#
207CONFIG_IOSCHED_NOOP=y
208CONFIG_IOSCHED_AS=y
209CONFIG_IOSCHED_DEADLINE=y
210CONFIG_IOSCHED_CFQ=y
211CONFIG_DEFAULT_AS=y
212# CONFIG_DEFAULT_DEADLINE is not set
213# CONFIG_DEFAULT_CFQ is not set
214# CONFIG_DEFAULT_NOOP is not set
215CONFIG_DEFAULT_IOSCHED="anticipatory"
216
217#
218# Bus options (PCI, PCMCIA, EISA, ISA, TC) 218# Bus options (PCI, PCMCIA, EISA, ISA, TC)
219# 219#
220CONFIG_HW_HAS_PCI=y 220CONFIG_HW_HAS_PCI=y
diff --git a/arch/mips/configs/bigsur_defconfig b/arch/mips/configs/bigsur_defconfig
index ea4b75604c23..6fd353779813 100644
--- a/arch/mips/configs/bigsur_defconfig
+++ b/arch/mips/configs/bigsur_defconfig
@@ -1,83 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:04:36 2005 4# Thu Nov 24 01:05:54 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_LOCK_KERNEL=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27# CONFIG_HOTPLUG is not set
28CONFIG_KOBJECT_UEVENT=y
29CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y
31# CONFIG_CPUSETS is not set
32CONFIG_INITRAMFS_SOURCE=""
33CONFIG_EMBEDDED=y
34CONFIG_KALLSYMS=y
35# CONFIG_KALLSYMS_ALL is not set
36# CONFIG_KALLSYMS_EXTRA_PASS is not set
37CONFIG_PRINTK=y
38CONFIG_BUG=y
39CONFIG_BASE_FULL=y
40CONFIG_FUTEX=y
41CONFIG_EPOLL=y
42# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
43CONFIG_SHMEM=y
44CONFIG_CC_ALIGN_FUNCTIONS=0
45CONFIG_CC_ALIGN_LABELS=0
46CONFIG_CC_ALIGN_LOOPS=0
47CONFIG_CC_ALIGN_JUMPS=0
48# CONFIG_TINY_SHMEM is not set
49CONFIG_BASE_SMALL=0
50
51#
52# Loadable module support
53#
54CONFIG_MODULES=y
55CONFIG_MODULE_UNLOAD=y
56# CONFIG_MODULE_FORCE_UNLOAD is not set
57CONFIG_OBSOLETE_MODPARM=y
58CONFIG_MODVERSIONS=y
59CONFIG_MODULE_SRCVERSION_ALL=y
60CONFIG_KMOD=y
61CONFIG_STOP_MACHINE=y
62
63#
64# Block layer
65#
66
67#
68# IO Schedulers
69#
70CONFIG_IOSCHED_NOOP=y
71CONFIG_IOSCHED_AS=y
72CONFIG_IOSCHED_DEADLINE=y
73CONFIG_IOSCHED_CFQ=y
74CONFIG_DEFAULT_AS=y
75# CONFIG_DEFAULT_DEADLINE is not set
76# CONFIG_DEFAULT_CFQ is not set
77# CONFIG_DEFAULT_NOOP is not set
78CONFIG_DEFAULT_IOSCHED="anticipatory"
79
80#
81# Machine selection 9# Machine selection
82# 10#
83# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -202,7 +130,6 @@ CONFIG_PAGE_SIZE_4KB=y
202# CONFIG_SIBYTE_DMA_PAGEOPS is not set 130# CONFIG_SIBYTE_DMA_PAGEOPS is not set
203# CONFIG_MIPS_MT is not set 131# CONFIG_MIPS_MT is not set
204CONFIG_CPU_HAS_LLSC=y 132CONFIG_CPU_HAS_LLSC=y
205CONFIG_CPU_HAS_LLDSCD=y
206CONFIG_CPU_HAS_SYNC=y 133CONFIG_CPU_HAS_SYNC=y
207CONFIG_GENERIC_HARDIRQS=y 134CONFIG_GENERIC_HARDIRQS=y
208CONFIG_GENERIC_IRQ_PROBE=y 135CONFIG_GENERIC_IRQ_PROBE=y
@@ -224,6 +151,78 @@ CONFIG_PREEMPT_NONE=y
224# CONFIG_PREEMPT_BKL is not set 151# CONFIG_PREEMPT_BKL is not set
225 152
226# 153#
154# Code maturity level options
155#
156CONFIG_EXPERIMENTAL=y
157CONFIG_CLEAN_COMPILE=y
158CONFIG_LOCK_KERNEL=y
159CONFIG_INIT_ENV_ARG_LIMIT=32
160
161#
162# General setup
163#
164CONFIG_LOCALVERSION=""
165CONFIG_LOCALVERSION_AUTO=y
166CONFIG_SWAP=y
167CONFIG_SYSVIPC=y
168# CONFIG_POSIX_MQUEUE is not set
169# CONFIG_BSD_PROCESS_ACCT is not set
170CONFIG_SYSCTL=y
171# CONFIG_AUDIT is not set
172# CONFIG_HOTPLUG is not set
173CONFIG_KOBJECT_UEVENT=y
174CONFIG_IKCONFIG=y
175CONFIG_IKCONFIG_PROC=y
176# CONFIG_CPUSETS is not set
177CONFIG_INITRAMFS_SOURCE=""
178CONFIG_EMBEDDED=y
179CONFIG_KALLSYMS=y
180# CONFIG_KALLSYMS_ALL is not set
181# CONFIG_KALLSYMS_EXTRA_PASS is not set
182CONFIG_PRINTK=y
183CONFIG_BUG=y
184CONFIG_BASE_FULL=y
185CONFIG_FUTEX=y
186CONFIG_EPOLL=y
187# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
188CONFIG_SHMEM=y
189CONFIG_CC_ALIGN_FUNCTIONS=0
190CONFIG_CC_ALIGN_LABELS=0
191CONFIG_CC_ALIGN_LOOPS=0
192CONFIG_CC_ALIGN_JUMPS=0
193# CONFIG_TINY_SHMEM is not set
194CONFIG_BASE_SMALL=0
195
196#
197# Loadable module support
198#
199CONFIG_MODULES=y
200CONFIG_MODULE_UNLOAD=y
201# CONFIG_MODULE_FORCE_UNLOAD is not set
202CONFIG_OBSOLETE_MODPARM=y
203CONFIG_MODVERSIONS=y
204CONFIG_MODULE_SRCVERSION_ALL=y
205CONFIG_KMOD=y
206CONFIG_STOP_MACHINE=y
207
208#
209# Block layer
210#
211
212#
213# IO Schedulers
214#
215CONFIG_IOSCHED_NOOP=y
216CONFIG_IOSCHED_AS=y
217CONFIG_IOSCHED_DEADLINE=y
218CONFIG_IOSCHED_CFQ=y
219CONFIG_DEFAULT_AS=y
220# CONFIG_DEFAULT_DEADLINE is not set
221# CONFIG_DEFAULT_CFQ is not set
222# CONFIG_DEFAULT_NOOP is not set
223CONFIG_DEFAULT_IOSCHED="anticipatory"
224
225#
227# Bus options (PCI, PCMCIA, EISA, ISA, TC) 226# Bus options (PCI, PCMCIA, EISA, ISA, TC)
228# 227#
229CONFIG_HW_HAS_PCI=y 228CONFIG_HW_HAS_PCI=y
@@ -318,7 +317,6 @@ CONFIG_TCP_CONG_BIC=y
318# QoS and/or fair queueing 317# QoS and/or fair queueing
319# 318#
320# CONFIG_NET_SCHED is not set 319# CONFIG_NET_SCHED is not set
321# CONFIG_NET_CLS_ROUTE is not set
322 320
323# 321#
324# Network testing 322# Network testing
diff --git a/arch/mips/configs/capcella_defconfig b/arch/mips/configs/capcella_defconfig
index a86cc9d9bdae..5261e29ccf37 100644
--- a/arch/mips/configs/capcella_defconfig
+++ b/arch/mips/configs/capcella_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:04:39 2005 4# Thu Nov 24 01:05:55 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -206,6 +137,75 @@ CONFIG_PREEMPT_NONE=y
206# CONFIG_PREEMPT is not set 137# CONFIG_PREEMPT is not set
207 138
208# 139#
140# Code maturity level options
141#
142CONFIG_EXPERIMENTAL=y
143CONFIG_CLEAN_COMPILE=y
144CONFIG_BROKEN_ON_SMP=y
145CONFIG_INIT_ENV_ARG_LIMIT=32
146
147#
148# General setup
149#
150CONFIG_LOCALVERSION=""
151CONFIG_LOCALVERSION_AUTO=y
152CONFIG_SWAP=y
153CONFIG_SYSVIPC=y
154# CONFIG_POSIX_MQUEUE is not set
155# CONFIG_BSD_PROCESS_ACCT is not set
156CONFIG_SYSCTL=y
157# CONFIG_AUDIT is not set
158CONFIG_HOTPLUG=y
159CONFIG_KOBJECT_UEVENT=y
160# CONFIG_IKCONFIG is not set
161CONFIG_INITRAMFS_SOURCE=""
162CONFIG_EMBEDDED=y
163CONFIG_KALLSYMS=y
164# CONFIG_KALLSYMS_EXTRA_PASS is not set
165CONFIG_PRINTK=y
166CONFIG_BUG=y
167CONFIG_BASE_FULL=y
168CONFIG_FUTEX=y
169CONFIG_EPOLL=y
170# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
171CONFIG_SHMEM=y
172CONFIG_CC_ALIGN_FUNCTIONS=0
173CONFIG_CC_ALIGN_LABELS=0
174CONFIG_CC_ALIGN_LOOPS=0
175CONFIG_CC_ALIGN_JUMPS=0
176# CONFIG_TINY_SHMEM is not set
177CONFIG_BASE_SMALL=0
178
179#
180# Loadable module support
181#
182CONFIG_MODULES=y
183CONFIG_MODULE_UNLOAD=y
184# CONFIG_MODULE_FORCE_UNLOAD is not set
185CONFIG_OBSOLETE_MODPARM=y
186CONFIG_MODVERSIONS=y
187CONFIG_MODULE_SRCVERSION_ALL=y
188CONFIG_KMOD=y
189
190#
191# Block layer
192#
193# CONFIG_LBD is not set
194
195#
196# IO Schedulers
197#
198CONFIG_IOSCHED_NOOP=y
199CONFIG_IOSCHED_AS=y
200CONFIG_IOSCHED_DEADLINE=y
201CONFIG_IOSCHED_CFQ=y
202CONFIG_DEFAULT_AS=y
203# CONFIG_DEFAULT_DEADLINE is not set
204# CONFIG_DEFAULT_CFQ is not set
205# CONFIG_DEFAULT_NOOP is not set
206CONFIG_DEFAULT_IOSCHED="anticipatory"
207
208#
209# Bus options (PCI, PCMCIA, EISA, ISA, TC) 209# Bus options (PCI, PCMCIA, EISA, ISA, TC)
210# 210#
211CONFIG_HW_HAS_PCI=y 211CONFIG_HW_HAS_PCI=y
@@ -294,7 +294,6 @@ CONFIG_TCP_CONG_BIC=y
294# QoS and/or fair queueing 294# QoS and/or fair queueing
295# 295#
296# CONFIG_NET_SCHED is not set 296# CONFIG_NET_SCHED is not set
297# CONFIG_NET_CLS_ROUTE is not set
298 297
299# 298#
300# Network testing 299# Network testing
diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
index 3558c79b0eb7..1d3ee18ea8bb 100644
--- a/arch/mips/configs/cobalt_defconfig
+++ b/arch/mips/configs/cobalt_defconfig
@@ -1,74 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:04:42 2005 4# Thu Nov 24 01:05:57 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Block layer
55#
56# CONFIG_LBD is not set
57
58#
59# IO Schedulers
60#
61CONFIG_IOSCHED_NOOP=y
62CONFIG_IOSCHED_AS=y
63CONFIG_IOSCHED_DEADLINE=y
64CONFIG_IOSCHED_CFQ=y
65CONFIG_DEFAULT_AS=y
66# CONFIG_DEFAULT_DEADLINE is not set
67# CONFIG_DEFAULT_CFQ is not set
68# CONFIG_DEFAULT_NOOP is not set
69CONFIG_DEFAULT_IOSCHED="anticipatory"
70
71#
72# Machine selection 9# Machine selection
73# 10#
74# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -178,7 +115,6 @@ CONFIG_PAGE_SIZE_4KB=y
178# CONFIG_MIPS_MT is not set 115# CONFIG_MIPS_MT is not set
179# CONFIG_CPU_ADVANCED is not set 116# CONFIG_CPU_ADVANCED is not set
180CONFIG_CPU_HAS_LLSC=y 117CONFIG_CPU_HAS_LLSC=y
181CONFIG_CPU_HAS_LLDSCD=y
182CONFIG_CPU_HAS_SYNC=y 118CONFIG_CPU_HAS_SYNC=y
183CONFIG_GENERIC_HARDIRQS=y 119CONFIG_GENERIC_HARDIRQS=y
184CONFIG_GENERIC_IRQ_PROBE=y 120CONFIG_GENERIC_IRQ_PROBE=y
@@ -196,6 +132,69 @@ CONFIG_PREEMPT_NONE=y
196# CONFIG_PREEMPT is not set 132# CONFIG_PREEMPT is not set
197 133
198# 134#
135# Code maturity level options
136#
137CONFIG_EXPERIMENTAL=y
138CONFIG_CLEAN_COMPILE=y
139CONFIG_BROKEN_ON_SMP=y
140CONFIG_INIT_ENV_ARG_LIMIT=32
141
142#
143# General setup
144#
145CONFIG_LOCALVERSION=""
146CONFIG_LOCALVERSION_AUTO=y
147CONFIG_SWAP=y
148CONFIG_SYSVIPC=y
149# CONFIG_POSIX_MQUEUE is not set
150# CONFIG_BSD_PROCESS_ACCT is not set
151CONFIG_SYSCTL=y
152# CONFIG_AUDIT is not set
153CONFIG_HOTPLUG=y
154CONFIG_KOBJECT_UEVENT=y
155# CONFIG_IKCONFIG is not set
156CONFIG_INITRAMFS_SOURCE=""
157CONFIG_EMBEDDED=y
158CONFIG_KALLSYMS=y
159# CONFIG_KALLSYMS_EXTRA_PASS is not set
160CONFIG_PRINTK=y
161CONFIG_BUG=y
162CONFIG_BASE_FULL=y
163CONFIG_FUTEX=y
164CONFIG_EPOLL=y
165# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
166CONFIG_SHMEM=y
167CONFIG_CC_ALIGN_FUNCTIONS=0
168CONFIG_CC_ALIGN_LABELS=0
169CONFIG_CC_ALIGN_LOOPS=0
170CONFIG_CC_ALIGN_JUMPS=0
171# CONFIG_TINY_SHMEM is not set
172CONFIG_BASE_SMALL=0
173
174#
175# Loadable module support
176#
177# CONFIG_MODULES is not set
178
179#
180# Block layer
181#
182# CONFIG_LBD is not set
183
184#
185# IO Schedulers
186#
187CONFIG_IOSCHED_NOOP=y
188CONFIG_IOSCHED_AS=y
189CONFIG_IOSCHED_DEADLINE=y
190CONFIG_IOSCHED_CFQ=y
191CONFIG_DEFAULT_AS=y
192# CONFIG_DEFAULT_DEADLINE is not set
193# CONFIG_DEFAULT_CFQ is not set
194# CONFIG_DEFAULT_NOOP is not set
195CONFIG_DEFAULT_IOSCHED="anticipatory"
196
197#
199# Bus options (PCI, PCMCIA, EISA, ISA, TC) 198# Bus options (PCI, PCMCIA, EISA, ISA, TC)
200# 199#
201CONFIG_HW_HAS_PCI=y 200CONFIG_HW_HAS_PCI=y
@@ -280,7 +279,6 @@ CONFIG_TCP_CONG_BIC=y
280# QoS and/or fair queueing 279# QoS and/or fair queueing
281# 280#
282# CONFIG_NET_SCHED is not set 281# CONFIG_NET_SCHED is not set
283# CONFIG_NET_CLS_ROUTE is not set
284 282
285# 283#
286# Network testing 284# Network testing
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index 3b103fec7b86..18ac7926c058 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.15-rc2
4# Tue Nov 15 11:11:04 2005 4# Thu Nov 24 01:05:59 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -202,6 +133,75 @@ CONFIG_PREEMPT_NONE=y
202# CONFIG_PREEMPT is not set 133# CONFIG_PREEMPT is not set
203 134
204# 135#
136# Code maturity level options
137#
138CONFIG_EXPERIMENTAL=y
139CONFIG_CLEAN_COMPILE=y
140CONFIG_BROKEN_ON_SMP=y
141CONFIG_INIT_ENV_ARG_LIMIT=32
142
143#
144# General setup
145#
146CONFIG_LOCALVERSION=""
147CONFIG_LOCALVERSION_AUTO=y
148CONFIG_SWAP=y
149CONFIG_SYSVIPC=y
150# CONFIG_POSIX_MQUEUE is not set
151# CONFIG_BSD_PROCESS_ACCT is not set
152CONFIG_SYSCTL=y
153# CONFIG_AUDIT is not set
154CONFIG_HOTPLUG=y
155CONFIG_KOBJECT_UEVENT=y
156# CONFIG_IKCONFIG is not set
157CONFIG_INITRAMFS_SOURCE=""
158CONFIG_EMBEDDED=y
159CONFIG_KALLSYMS=y
160# CONFIG_KALLSYMS_EXTRA_PASS is not set
161CONFIG_PRINTK=y
162CONFIG_BUG=y
163CONFIG_BASE_FULL=y
164CONFIG_FUTEX=y
165CONFIG_EPOLL=y
166# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
167CONFIG_SHMEM=y
168CONFIG_CC_ALIGN_FUNCTIONS=0
169CONFIG_CC_ALIGN_LABELS=0
170CONFIG_CC_ALIGN_LOOPS=0
171CONFIG_CC_ALIGN_JUMPS=0
172# CONFIG_TINY_SHMEM is not set
173CONFIG_BASE_SMALL=0
174
175#
176# Loadable module support
177#
178CONFIG_MODULES=y
179CONFIG_MODULE_UNLOAD=y
180# CONFIG_MODULE_FORCE_UNLOAD is not set
181CONFIG_OBSOLETE_MODPARM=y
182CONFIG_MODVERSIONS=y
183CONFIG_MODULE_SRCVERSION_ALL=y
184CONFIG_KMOD=y
185
186#
187# Block layer
188#
189# CONFIG_LBD is not set
190
191#
192# IO Schedulers
193#
194CONFIG_IOSCHED_NOOP=y
195CONFIG_IOSCHED_AS=y
196CONFIG_IOSCHED_DEADLINE=y
197CONFIG_IOSCHED_CFQ=y
198CONFIG_DEFAULT_AS=y
199# CONFIG_DEFAULT_DEADLINE is not set
200# CONFIG_DEFAULT_CFQ is not set
201# CONFIG_DEFAULT_NOOP is not set
202CONFIG_DEFAULT_IOSCHED="anticipatory"
203
204#
205# Bus options (PCI, PCMCIA, EISA, ISA, TC) 205# Bus options (PCI, PCMCIA, EISA, ISA, TC)
206# 206#
207CONFIG_HW_HAS_PCI=y 207CONFIG_HW_HAS_PCI=y
@@ -320,7 +320,6 @@ CONFIG_NETFILTER_NETLINK_LOG=m
320# QoS and/or fair queueing 320# QoS and/or fair queueing
321# 321#
322# CONFIG_NET_SCHED is not set 322# CONFIG_NET_SCHED is not set
323# CONFIG_NET_CLS_ROUTE is not set
324 323
325# 324#
326# Network testing 325# Network testing
@@ -668,6 +667,7 @@ CONFIG_SYNCLINK_CS=m
668# 667#
669# TPM devices 668# TPM devices
670# 669#
670# CONFIG_TCG_TPM is not set
671# CONFIG_TELCLOCK is not set 671# CONFIG_TELCLOCK is not set
672 672
673# 673#
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
index 79cdd940c6a8..4f55f7414c9c 100644
--- a/arch/mips/configs/db1100_defconfig
+++ b/arch/mips/configs/db1100_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.15-rc2
4# Tue Nov 15 11:11:07 2005 4# Thu Nov 24 01:06:00 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -202,6 +133,75 @@ CONFIG_PREEMPT_NONE=y
202# CONFIG_PREEMPT is not set 133# CONFIG_PREEMPT is not set
203 134
204# 135#
136# Code maturity level options
137#
138CONFIG_EXPERIMENTAL=y
139CONFIG_CLEAN_COMPILE=y
140CONFIG_BROKEN_ON_SMP=y
141CONFIG_INIT_ENV_ARG_LIMIT=32
142
143#
144# General setup
145#
146CONFIG_LOCALVERSION=""
147CONFIG_LOCALVERSION_AUTO=y
148CONFIG_SWAP=y
149CONFIG_SYSVIPC=y
150# CONFIG_POSIX_MQUEUE is not set
151# CONFIG_BSD_PROCESS_ACCT is not set
152CONFIG_SYSCTL=y
153# CONFIG_AUDIT is not set
154CONFIG_HOTPLUG=y
155CONFIG_KOBJECT_UEVENT=y
156# CONFIG_IKCONFIG is not set
157CONFIG_INITRAMFS_SOURCE=""
158CONFIG_EMBEDDED=y
159CONFIG_KALLSYMS=y
160# CONFIG_KALLSYMS_EXTRA_PASS is not set
161CONFIG_PRINTK=y
162CONFIG_BUG=y
163CONFIG_BASE_FULL=y
164CONFIG_FUTEX=y
165CONFIG_EPOLL=y
166# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
167CONFIG_SHMEM=y
168CONFIG_CC_ALIGN_FUNCTIONS=0
169CONFIG_CC_ALIGN_LABELS=0
170CONFIG_CC_ALIGN_LOOPS=0
171CONFIG_CC_ALIGN_JUMPS=0
172# CONFIG_TINY_SHMEM is not set
173CONFIG_BASE_SMALL=0
174
175#
176# Loadable module support
177#
178CONFIG_MODULES=y
179CONFIG_MODULE_UNLOAD=y
180# CONFIG_MODULE_FORCE_UNLOAD is not set
181CONFIG_OBSOLETE_MODPARM=y
182CONFIG_MODVERSIONS=y
183CONFIG_MODULE_SRCVERSION_ALL=y
184CONFIG_KMOD=y
185
186#
187# Block layer
188#
189# CONFIG_LBD is not set
190
191#
192# IO Schedulers
193#
194CONFIG_IOSCHED_NOOP=y
195CONFIG_IOSCHED_AS=y
196CONFIG_IOSCHED_DEADLINE=y
197CONFIG_IOSCHED_CFQ=y
198CONFIG_DEFAULT_AS=y
199# CONFIG_DEFAULT_DEADLINE is not set
200# CONFIG_DEFAULT_CFQ is not set
201# CONFIG_DEFAULT_NOOP is not set
202CONFIG_DEFAULT_IOSCHED="anticipatory"
203
204#
205# Bus options (PCI, PCMCIA, EISA, ISA, TC) 205# Bus options (PCI, PCMCIA, EISA, ISA, TC)
206# 206#
207CONFIG_MMU=y 207CONFIG_MMU=y
@@ -309,7 +309,6 @@ CONFIG_NETFILTER_NETLINK_LOG=m
309# QoS and/or fair queueing 309# QoS and/or fair queueing
310# 310#
311# CONFIG_NET_SCHED is not set 311# CONFIG_NET_SCHED is not set
312# CONFIG_NET_CLS_ROUTE is not set
313 312
314# 313#
315# Network testing 314# Network testing
@@ -636,6 +635,7 @@ CONFIG_LEGACY_PTY_COUNT=256
636# 635#
637# TPM devices 636# TPM devices
638# 637#
638# CONFIG_TCG_TPM is not set
639# CONFIG_TELCLOCK is not set 639# CONFIG_TELCLOCK is not set
640 640
641# 641#
diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index b6bad69398e1..0e5de7d05f23 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -1,81 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.15-rc2
4# Tue Nov 15 11:11:10 2005 4# Thu Nov 24 01:06:03 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y
54# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y
57CONFIG_MODULE_SRCVERSION_ALL=y
58CONFIG_KMOD=y
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Machine selection 9# Machine selection
80# 10#
81# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -203,6 +133,76 @@ CONFIG_PREEMPT_NONE=y
203# CONFIG_PREEMPT is not set 133# CONFIG_PREEMPT is not set
204 134
205# 135#
136# Code maturity level options
137#
138CONFIG_EXPERIMENTAL=y
139CONFIG_CLEAN_COMPILE=y
140CONFIG_BROKEN_ON_SMP=y
141CONFIG_INIT_ENV_ARG_LIMIT=32
142
143#
144# General setup
145#
146CONFIG_LOCALVERSION=""
147CONFIG_LOCALVERSION_AUTO=y
148CONFIG_SWAP=y
149CONFIG_SYSVIPC=y
150# CONFIG_POSIX_MQUEUE is not set
151# CONFIG_BSD_PROCESS_ACCT is not set
152CONFIG_SYSCTL=y
153# CONFIG_AUDIT is not set
154CONFIG_HOTPLUG=y
155CONFIG_KOBJECT_UEVENT=y
156CONFIG_IKCONFIG=y
157CONFIG_IKCONFIG_PROC=y
158CONFIG_INITRAMFS_SOURCE=""
159CONFIG_EMBEDDED=y
160CONFIG_KALLSYMS=y
161# CONFIG_KALLSYMS_EXTRA_PASS is not set
162CONFIG_PRINTK=y
163CONFIG_BUG=y
164CONFIG_BASE_FULL=y
165CONFIG_FUTEX=y
166CONFIG_EPOLL=y
167# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
168CONFIG_SHMEM=y
169CONFIG_CC_ALIGN_FUNCTIONS=0
170CONFIG_CC_ALIGN_LABELS=0
171CONFIG_CC_ALIGN_LOOPS=0
172CONFIG_CC_ALIGN_JUMPS=0
173# CONFIG_TINY_SHMEM is not set
174CONFIG_BASE_SMALL=0
175
176#
177# Loadable module support
178#
179CONFIG_MODULES=y
180CONFIG_MODULE_UNLOAD=y
181# CONFIG_MODULE_FORCE_UNLOAD is not set
182CONFIG_OBSOLETE_MODPARM=y
183CONFIG_MODVERSIONS=y
184CONFIG_MODULE_SRCVERSION_ALL=y
185CONFIG_KMOD=y
186
187#
188# Block layer
189#
190# CONFIG_LBD is not set
191
192#
193# IO Schedulers
194#
195CONFIG_IOSCHED_NOOP=y
196CONFIG_IOSCHED_AS=y
197CONFIG_IOSCHED_DEADLINE=y
198CONFIG_IOSCHED_CFQ=y
199CONFIG_DEFAULT_AS=y
200# CONFIG_DEFAULT_DEADLINE is not set
201# CONFIG_DEFAULT_CFQ is not set
202# CONFIG_DEFAULT_NOOP is not set
203CONFIG_DEFAULT_IOSCHED="anticipatory"
204
205#
206# Bus options (PCI, PCMCIA, EISA, ISA, TC) 206# Bus options (PCI, PCMCIA, EISA, ISA, TC)
207# 207#
208CONFIG_MMU=y 208CONFIG_MMU=y
@@ -314,7 +314,6 @@ CONFIG_NETFILTER=y
314# QoS and/or fair queueing 314# QoS and/or fair queueing
315# 315#
316# CONFIG_NET_SCHED is not set 316# CONFIG_NET_SCHED is not set
317# CONFIG_NET_CLS_ROUTE is not set
318 317
319# 318#
320# Network testing 319# Network testing
@@ -475,7 +474,6 @@ CONFIG_IDE_GENERIC=y
475CONFIG_BLK_DEV_IDE_AU1XXX=y 474CONFIG_BLK_DEV_IDE_AU1XXX=y
476CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA=y 475CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA=y
477# CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA is not set 476# CONFIG_BLK_DEV_IDE_AU1XXX_MDMA2_DBDMA is not set
478# CONFIG_BLK_DEV_IDE_AU1XXX_BURSTABLE_ON is not set
479CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128 477CONFIG_BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ=128
480# CONFIG_IDE_ARM is not set 478# CONFIG_IDE_ARM is not set
481# CONFIG_BLK_DEV_IDEDMA is not set 479# CONFIG_BLK_DEV_IDEDMA is not set
@@ -709,6 +707,7 @@ CONFIG_LEGACY_PTY_COUNT=256
709# 707#
710# TPM devices 708# TPM devices
711# 709#
710# CONFIG_TCG_TPM is not set
712# CONFIG_TELCLOCK is not set 711# CONFIG_TELCLOCK is not set
713 712
714# 713#
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
index dbaf189fc9c0..86e7be8412f3 100644
--- a/arch/mips/configs/db1500_defconfig
+++ b/arch/mips/configs/db1500_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.15-rc2
4# Tue Nov 15 11:11:15 2005 4# Thu Nov 24 01:06:05 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -204,6 +135,75 @@ CONFIG_PREEMPT_NONE=y
204# CONFIG_PREEMPT is not set 135# CONFIG_PREEMPT is not set
205 136
206# 137#
138# Code maturity level options
139#
140CONFIG_EXPERIMENTAL=y
141CONFIG_CLEAN_COMPILE=y
142CONFIG_BROKEN_ON_SMP=y
143CONFIG_INIT_ENV_ARG_LIMIT=32
144
145#
146# General setup
147#
148CONFIG_LOCALVERSION=""
149CONFIG_LOCALVERSION_AUTO=y
150CONFIG_SWAP=y
151CONFIG_SYSVIPC=y
152# CONFIG_POSIX_MQUEUE is not set
153# CONFIG_BSD_PROCESS_ACCT is not set
154CONFIG_SYSCTL=y
155# CONFIG_AUDIT is not set
156CONFIG_HOTPLUG=y
157CONFIG_KOBJECT_UEVENT=y
158# CONFIG_IKCONFIG is not set
159CONFIG_INITRAMFS_SOURCE=""
160CONFIG_EMBEDDED=y
161CONFIG_KALLSYMS=y
162# CONFIG_KALLSYMS_EXTRA_PASS is not set
163CONFIG_PRINTK=y
164CONFIG_BUG=y
165CONFIG_BASE_FULL=y
166CONFIG_FUTEX=y
167CONFIG_EPOLL=y
168# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
169CONFIG_SHMEM=y
170CONFIG_CC_ALIGN_FUNCTIONS=0
171CONFIG_CC_ALIGN_LABELS=0
172CONFIG_CC_ALIGN_LOOPS=0
173CONFIG_CC_ALIGN_JUMPS=0
174# CONFIG_TINY_SHMEM is not set
175CONFIG_BASE_SMALL=0
176
177#
178# Loadable module support
179#
180CONFIG_MODULES=y
181CONFIG_MODULE_UNLOAD=y
182# CONFIG_MODULE_FORCE_UNLOAD is not set
183CONFIG_OBSOLETE_MODPARM=y
184CONFIG_MODVERSIONS=y
185CONFIG_MODULE_SRCVERSION_ALL=y
186CONFIG_KMOD=y
187
188#
189# Block layer
190#
191# CONFIG_LBD is not set
192
193#
194# IO Schedulers
195#
196CONFIG_IOSCHED_NOOP=y
197CONFIG_IOSCHED_AS=y
198CONFIG_IOSCHED_DEADLINE=y
199CONFIG_IOSCHED_CFQ=y
200CONFIG_DEFAULT_AS=y
201# CONFIG_DEFAULT_DEADLINE is not set
202# CONFIG_DEFAULT_CFQ is not set
203# CONFIG_DEFAULT_NOOP is not set
204CONFIG_DEFAULT_IOSCHED="anticipatory"
205
206#
207# Bus options (PCI, PCMCIA, EISA, ISA, TC) 207# Bus options (PCI, PCMCIA, EISA, ISA, TC)
208# 208#
209CONFIG_HW_HAS_PCI=y 209CONFIG_HW_HAS_PCI=y
@@ -328,7 +328,6 @@ CONFIG_NETFILTER_NETLINK_LOG=m
328# QoS and/or fair queueing 328# QoS and/or fair queueing
329# 329#
330# CONFIG_NET_SCHED is not set 330# CONFIG_NET_SCHED is not set
331# CONFIG_NET_CLS_ROUTE is not set
332 331
333# 332#
334# Network testing 333# Network testing
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
index 59c1ef214fc0..ea5ab0ca5774 100644
--- a/arch/mips/configs/db1550_defconfig
+++ b/arch/mips/configs/db1550_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.15-rc2
4# Tue Nov 15 11:11:18 2005 4# Thu Nov 24 01:06:07 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -203,6 +134,75 @@ CONFIG_PREEMPT_NONE=y
203# CONFIG_PREEMPT is not set 134# CONFIG_PREEMPT is not set
204 135
205# 136#
137# Code maturity level options
138#
139CONFIG_EXPERIMENTAL=y
140CONFIG_CLEAN_COMPILE=y
141CONFIG_BROKEN_ON_SMP=y
142CONFIG_INIT_ENV_ARG_LIMIT=32
143
144#
145# General setup
146#
147CONFIG_LOCALVERSION=""
148CONFIG_LOCALVERSION_AUTO=y
149CONFIG_SWAP=y
150CONFIG_SYSVIPC=y
151# CONFIG_POSIX_MQUEUE is not set
152# CONFIG_BSD_PROCESS_ACCT is not set
153CONFIG_SYSCTL=y
154# CONFIG_AUDIT is not set
155CONFIG_HOTPLUG=y
156CONFIG_KOBJECT_UEVENT=y
157# CONFIG_IKCONFIG is not set
158CONFIG_INITRAMFS_SOURCE=""
159CONFIG_EMBEDDED=y
160CONFIG_KALLSYMS=y
161# CONFIG_KALLSYMS_EXTRA_PASS is not set
162CONFIG_PRINTK=y
163CONFIG_BUG=y
164CONFIG_BASE_FULL=y
165CONFIG_FUTEX=y
166CONFIG_EPOLL=y
167# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
168CONFIG_SHMEM=y
169CONFIG_CC_ALIGN_FUNCTIONS=0
170CONFIG_CC_ALIGN_LABELS=0
171CONFIG_CC_ALIGN_LOOPS=0
172CONFIG_CC_ALIGN_JUMPS=0
173# CONFIG_TINY_SHMEM is not set
174CONFIG_BASE_SMALL=0
175
176#
177# Loadable module support
178#
179CONFIG_MODULES=y
180CONFIG_MODULE_UNLOAD=y
181# CONFIG_MODULE_FORCE_UNLOAD is not set
182CONFIG_OBSOLETE_MODPARM=y
183CONFIG_MODVERSIONS=y
184CONFIG_MODULE_SRCVERSION_ALL=y
185CONFIG_KMOD=y
186
187#
188# Block layer
189#
190# CONFIG_LBD is not set
191
192#
193# IO Schedulers
194#
195CONFIG_IOSCHED_NOOP=y
196CONFIG_IOSCHED_AS=y
197CONFIG_IOSCHED_DEADLINE=y
198CONFIG_IOSCHED_CFQ=y
199CONFIG_DEFAULT_AS=y
200# CONFIG_DEFAULT_DEADLINE is not set
201# CONFIG_DEFAULT_CFQ is not set
202# CONFIG_DEFAULT_NOOP is not set
203CONFIG_DEFAULT_IOSCHED="anticipatory"
204
205#
206# Bus options (PCI, PCMCIA, EISA, ISA, TC) 206# Bus options (PCI, PCMCIA, EISA, ISA, TC)
207# 207#
208CONFIG_HW_HAS_PCI=y 208CONFIG_HW_HAS_PCI=y
@@ -327,7 +327,6 @@ CONFIG_NETFILTER_NETLINK_LOG=m
327# QoS and/or fair queueing 327# QoS and/or fair queueing
328# 328#
329# CONFIG_NET_SCHED is not set 329# CONFIG_NET_SCHED is not set
330# CONFIG_NET_CLS_ROUTE is not set
331 330
332# 331#
333# Network testing 332# Network testing
diff --git a/arch/mips/configs/ddb5476_defconfig b/arch/mips/configs/ddb5476_defconfig
index 4ba29e612bdf..a81e2de6947f 100644
--- a/arch/mips/configs/ddb5476_defconfig
+++ b/arch/mips/configs/ddb5476_defconfig
@@ -1,74 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:05:04 2005 4# Thu Nov 24 01:06:09 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Block layer
55#
56# CONFIG_LBD is not set
57
58#
59# IO Schedulers
60#
61CONFIG_IOSCHED_NOOP=y
62CONFIG_IOSCHED_AS=y
63CONFIG_IOSCHED_DEADLINE=y
64CONFIG_IOSCHED_CFQ=y
65CONFIG_DEFAULT_AS=y
66# CONFIG_DEFAULT_DEADLINE is not set
67# CONFIG_DEFAULT_CFQ is not set
68# CONFIG_DEFAULT_NOOP is not set
69CONFIG_DEFAULT_IOSCHED="anticipatory"
70
71#
72# Machine selection 9# Machine selection
73# 10#
74# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -179,7 +116,6 @@ CONFIG_PAGE_SIZE_4KB=y
179# CONFIG_MIPS_MT is not set 116# CONFIG_MIPS_MT is not set
180# CONFIG_CPU_ADVANCED is not set 117# CONFIG_CPU_ADVANCED is not set
181CONFIG_CPU_HAS_LLSC=y 118CONFIG_CPU_HAS_LLSC=y
182CONFIG_CPU_HAS_LLDSCD=y
183CONFIG_CPU_HAS_SYNC=y 119CONFIG_CPU_HAS_SYNC=y
184CONFIG_GENERIC_HARDIRQS=y 120CONFIG_GENERIC_HARDIRQS=y
185CONFIG_GENERIC_IRQ_PROBE=y 121CONFIG_GENERIC_IRQ_PROBE=y
@@ -197,6 +133,69 @@ CONFIG_PREEMPT_NONE=y
197# CONFIG_PREEMPT is not set 133# CONFIG_PREEMPT is not set
198 134
199# 135#
136# Code maturity level options
137#
138CONFIG_EXPERIMENTAL=y
139CONFIG_CLEAN_COMPILE=y
140CONFIG_BROKEN_ON_SMP=y
141CONFIG_INIT_ENV_ARG_LIMIT=32
142
143#
144# General setup
145#
146CONFIG_LOCALVERSION=""
147CONFIG_LOCALVERSION_AUTO=y
148CONFIG_SWAP=y
149CONFIG_SYSVIPC=y
150# CONFIG_POSIX_MQUEUE is not set
151# CONFIG_BSD_PROCESS_ACCT is not set
152CONFIG_SYSCTL=y
153# CONFIG_AUDIT is not set
154CONFIG_HOTPLUG=y
155CONFIG_KOBJECT_UEVENT=y
156# CONFIG_IKCONFIG is not set
157CONFIG_INITRAMFS_SOURCE=""
158CONFIG_EMBEDDED=y
159CONFIG_KALLSYMS=y
160# CONFIG_KALLSYMS_EXTRA_PASS is not set
161CONFIG_PRINTK=y
162CONFIG_BUG=y
163CONFIG_BASE_FULL=y
164CONFIG_FUTEX=y
165CONFIG_EPOLL=y
166# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
167CONFIG_SHMEM=y
168CONFIG_CC_ALIGN_FUNCTIONS=0
169CONFIG_CC_ALIGN_LABELS=0
170CONFIG_CC_ALIGN_LOOPS=0
171CONFIG_CC_ALIGN_JUMPS=0
172# CONFIG_TINY_SHMEM is not set
173CONFIG_BASE_SMALL=0
174
175#
176# Loadable module support
177#
178# CONFIG_MODULES is not set
179
180#
181# Block layer
182#
183# CONFIG_LBD is not set
184
185#
186# IO Schedulers
187#
188CONFIG_IOSCHED_NOOP=y
189CONFIG_IOSCHED_AS=y
190CONFIG_IOSCHED_DEADLINE=y
191CONFIG_IOSCHED_CFQ=y
192CONFIG_DEFAULT_AS=y
193# CONFIG_DEFAULT_DEADLINE is not set
194# CONFIG_DEFAULT_CFQ is not set
195# CONFIG_DEFAULT_NOOP is not set
196CONFIG_DEFAULT_IOSCHED="anticipatory"
197
198#
200# Bus options (PCI, PCMCIA, EISA, ISA, TC) 199# Bus options (PCI, PCMCIA, EISA, ISA, TC)
201# 200#
202CONFIG_HW_HAS_PCI=y 201CONFIG_HW_HAS_PCI=y
@@ -285,7 +284,6 @@ CONFIG_TCP_CONG_BIC=y
285# QoS and/or fair queueing 284# QoS and/or fair queueing
286# 285#
287# CONFIG_NET_SCHED is not set 286# CONFIG_NET_SCHED is not set
288# CONFIG_NET_CLS_ROUTE is not set
289 287
290# 288#
291# Network testing 289# Network testing
diff --git a/arch/mips/configs/ddb5477_defconfig b/arch/mips/configs/ddb5477_defconfig
index ea4e9046bbee..f1c27c2fb033 100644
--- a/arch/mips/configs/ddb5477_defconfig
+++ b/arch/mips/configs/ddb5477_defconfig
@@ -1,74 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:05:08 2005 4# Thu Nov 24 01:06:11 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Block layer
55#
56# CONFIG_LBD is not set
57
58#
59# IO Schedulers
60#
61CONFIG_IOSCHED_NOOP=y
62CONFIG_IOSCHED_AS=y
63CONFIG_IOSCHED_DEADLINE=y
64CONFIG_IOSCHED_CFQ=y
65CONFIG_DEFAULT_AS=y
66# CONFIG_DEFAULT_DEADLINE is not set
67# CONFIG_DEFAULT_CFQ is not set
68# CONFIG_DEFAULT_NOOP is not set
69CONFIG_DEFAULT_IOSCHED="anticipatory"
70
71#
72# Machine selection 9# Machine selection
73# 10#
74# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -179,7 +116,6 @@ CONFIG_PAGE_SIZE_4KB=y
179# CONFIG_MIPS_MT is not set 116# CONFIG_MIPS_MT is not set
180# CONFIG_CPU_ADVANCED is not set 117# CONFIG_CPU_ADVANCED is not set
181CONFIG_CPU_HAS_LLSC=y 118CONFIG_CPU_HAS_LLSC=y
182CONFIG_CPU_HAS_LLDSCD=y
183CONFIG_CPU_HAS_SYNC=y 119CONFIG_CPU_HAS_SYNC=y
184CONFIG_GENERIC_HARDIRQS=y 120CONFIG_GENERIC_HARDIRQS=y
185CONFIG_GENERIC_IRQ_PROBE=y 121CONFIG_GENERIC_IRQ_PROBE=y
@@ -197,6 +133,69 @@ CONFIG_PREEMPT_NONE=y
197# CONFIG_PREEMPT is not set 133# CONFIG_PREEMPT is not set
198 134
199# 135#
136# Code maturity level options
137#
138CONFIG_EXPERIMENTAL=y
139CONFIG_CLEAN_COMPILE=y
140CONFIG_BROKEN_ON_SMP=y
141CONFIG_INIT_ENV_ARG_LIMIT=32
142
143#
144# General setup
145#
146CONFIG_LOCALVERSION=""
147CONFIG_LOCALVERSION_AUTO=y
148CONFIG_SWAP=y
149CONFIG_SYSVIPC=y
150# CONFIG_POSIX_MQUEUE is not set
151# CONFIG_BSD_PROCESS_ACCT is not set
152CONFIG_SYSCTL=y
153# CONFIG_AUDIT is not set
154CONFIG_HOTPLUG=y
155CONFIG_KOBJECT_UEVENT=y
156# CONFIG_IKCONFIG is not set
157CONFIG_INITRAMFS_SOURCE=""
158CONFIG_EMBEDDED=y
159CONFIG_KALLSYMS=y
160# CONFIG_KALLSYMS_EXTRA_PASS is not set
161CONFIG_PRINTK=y
162CONFIG_BUG=y
163CONFIG_BASE_FULL=y
164CONFIG_FUTEX=y
165CONFIG_EPOLL=y
166# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
167CONFIG_SHMEM=y
168CONFIG_CC_ALIGN_FUNCTIONS=0
169CONFIG_CC_ALIGN_LABELS=0
170CONFIG_CC_ALIGN_LOOPS=0
171CONFIG_CC_ALIGN_JUMPS=0
172# CONFIG_TINY_SHMEM is not set
173CONFIG_BASE_SMALL=0
174
175#
176# Loadable module support
177#
178# CONFIG_MODULES is not set
179
180#
181# Block layer
182#
183# CONFIG_LBD is not set
184
185#
186# IO Schedulers
187#
188CONFIG_IOSCHED_NOOP=y
189CONFIG_IOSCHED_AS=y
190CONFIG_IOSCHED_DEADLINE=y
191CONFIG_IOSCHED_CFQ=y
192CONFIG_DEFAULT_AS=y
193# CONFIG_DEFAULT_DEADLINE is not set
194# CONFIG_DEFAULT_CFQ is not set
195# CONFIG_DEFAULT_NOOP is not set
196CONFIG_DEFAULT_IOSCHED="anticipatory"
197
198#
200# Bus options (PCI, PCMCIA, EISA, ISA, TC) 199# Bus options (PCI, PCMCIA, EISA, ISA, TC)
201# 200#
202CONFIG_HW_HAS_PCI=y 201CONFIG_HW_HAS_PCI=y
@@ -284,7 +283,6 @@ CONFIG_TCP_CONG_BIC=y
284# QoS and/or fair queueing 283# QoS and/or fair queueing
285# 284#
286# CONFIG_NET_SCHED is not set 285# CONFIG_NET_SCHED is not set
287# CONFIG_NET_CLS_ROUTE is not set
288 286
289# 287#
290# Network testing 288# Network testing
diff --git a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
index 1ac6c9b7ef96..08a4de6ec4a6 100644
--- a/arch/mips/configs/decstation_defconfig
+++ b/arch/mips/configs/decstation_defconfig
@@ -1,81 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Fri Nov 11 13:29:30 2005 4# Thu Nov 24 01:06:13 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27# CONFIG_HOTPLUG is not set
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_ALL is not set
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y
54# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56# CONFIG_MODVERSIONS is not set
57CONFIG_MODULE_SRCVERSION_ALL=y
58CONFIG_KMOD=y
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Machine selection 9# Machine selection
80# 10#
81# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -202,6 +132,76 @@ CONFIG_PREEMPT_NONE=y
202# CONFIG_PREEMPT is not set 132# CONFIG_PREEMPT is not set
203 133
204# 134#
135# Code maturity level options
136#
137CONFIG_EXPERIMENTAL=y
138CONFIG_CLEAN_COMPILE=y
139CONFIG_BROKEN_ON_SMP=y
140CONFIG_INIT_ENV_ARG_LIMIT=32
141
142#
143# General setup
144#
145CONFIG_LOCALVERSION=""
146CONFIG_LOCALVERSION_AUTO=y
147CONFIG_SWAP=y
148CONFIG_SYSVIPC=y
149# CONFIG_POSIX_MQUEUE is not set
150# CONFIG_BSD_PROCESS_ACCT is not set
151CONFIG_SYSCTL=y
152# CONFIG_AUDIT is not set
153# CONFIG_HOTPLUG is not set
154CONFIG_KOBJECT_UEVENT=y
155# CONFIG_IKCONFIG is not set
156CONFIG_INITRAMFS_SOURCE=""
157CONFIG_EMBEDDED=y
158CONFIG_KALLSYMS=y
159# CONFIG_KALLSYMS_ALL is not set
160# CONFIG_KALLSYMS_EXTRA_PASS is not set
161CONFIG_PRINTK=y
162CONFIG_BUG=y
163CONFIG_BASE_FULL=y
164CONFIG_FUTEX=y
165CONFIG_EPOLL=y
166# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
167CONFIG_SHMEM=y
168CONFIG_CC_ALIGN_FUNCTIONS=0
169CONFIG_CC_ALIGN_LABELS=0
170CONFIG_CC_ALIGN_LOOPS=0
171CONFIG_CC_ALIGN_JUMPS=0
172# CONFIG_TINY_SHMEM is not set
173CONFIG_BASE_SMALL=0
174
175#
176# Loadable module support
177#
178CONFIG_MODULES=y
179CONFIG_MODULE_UNLOAD=y
180# CONFIG_MODULE_FORCE_UNLOAD is not set
181CONFIG_OBSOLETE_MODPARM=y
182# CONFIG_MODVERSIONS is not set
183CONFIG_MODULE_SRCVERSION_ALL=y
184CONFIG_KMOD=y
185
186#
187# Block layer
188#
189# CONFIG_LBD is not set
190
191#
192# IO Schedulers
193#
194CONFIG_IOSCHED_NOOP=y
195CONFIG_IOSCHED_AS=y
196CONFIG_IOSCHED_DEADLINE=y
197CONFIG_IOSCHED_CFQ=y
198CONFIG_DEFAULT_AS=y
199# CONFIG_DEFAULT_DEADLINE is not set
200# CONFIG_DEFAULT_CFQ is not set
201# CONFIG_DEFAULT_NOOP is not set
202CONFIG_DEFAULT_IOSCHED="anticipatory"
203
204#
205# Bus options (PCI, PCMCIA, EISA, ISA, TC) 205# Bus options (PCI, PCMCIA, EISA, ISA, TC)
206# 206#
207CONFIG_TC=y 207CONFIG_TC=y
@@ -286,7 +286,6 @@ CONFIG_TCP_CONG_BIC=y
286# QoS and/or fair queueing 286# QoS and/or fair queueing
287# 287#
288# CONFIG_NET_SCHED is not set 288# CONFIG_NET_SCHED is not set
289# CONFIG_NET_CLS_ROUTE is not set
290 289
291# 290#
292# Network testing 291# Network testing
@@ -531,6 +530,7 @@ CONFIG_RTC=y
531# 530#
532# TPM devices 531# TPM devices
533# 532#
533# CONFIG_TCG_TPM is not set
534# CONFIG_TELCLOCK is not set 534# CONFIG_TELCLOCK is not set
535 535
536# 536#
diff --git a/arch/mips/configs/e55_defconfig b/arch/mips/configs/e55_defconfig
index a89d2f66cdfa..c9070cef08b1 100644
--- a/arch/mips/configs/e55_defconfig
+++ b/arch/mips/configs/e55_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:05:15 2005 4# Thu Nov 24 01:06:14 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27# CONFIG_HOTPLUG is not set
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -204,6 +135,75 @@ CONFIG_PREEMPT_NONE=y
204# CONFIG_PREEMPT is not set 135# CONFIG_PREEMPT is not set
205 136
206# 137#
138# Code maturity level options
139#
140CONFIG_EXPERIMENTAL=y
141CONFIG_CLEAN_COMPILE=y
142CONFIG_BROKEN_ON_SMP=y
143CONFIG_INIT_ENV_ARG_LIMIT=32
144
145#
146# General setup
147#
148CONFIG_LOCALVERSION=""
149CONFIG_LOCALVERSION_AUTO=y
150CONFIG_SWAP=y
151CONFIG_SYSVIPC=y
152# CONFIG_POSIX_MQUEUE is not set
153# CONFIG_BSD_PROCESS_ACCT is not set
154CONFIG_SYSCTL=y
155# CONFIG_AUDIT is not set
156# CONFIG_HOTPLUG is not set
157CONFIG_KOBJECT_UEVENT=y
158# CONFIG_IKCONFIG is not set
159CONFIG_INITRAMFS_SOURCE=""
160CONFIG_EMBEDDED=y
161CONFIG_KALLSYMS=y
162# CONFIG_KALLSYMS_EXTRA_PASS is not set
163CONFIG_PRINTK=y
164CONFIG_BUG=y
165CONFIG_BASE_FULL=y
166CONFIG_FUTEX=y
167CONFIG_EPOLL=y
168# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
169CONFIG_SHMEM=y
170CONFIG_CC_ALIGN_FUNCTIONS=0
171CONFIG_CC_ALIGN_LABELS=0
172CONFIG_CC_ALIGN_LOOPS=0
173CONFIG_CC_ALIGN_JUMPS=0
174# CONFIG_TINY_SHMEM is not set
175CONFIG_BASE_SMALL=0
176
177#
178# Loadable module support
179#
180CONFIG_MODULES=y
181CONFIG_MODULE_UNLOAD=y
182# CONFIG_MODULE_FORCE_UNLOAD is not set
183CONFIG_OBSOLETE_MODPARM=y
184CONFIG_MODVERSIONS=y
185CONFIG_MODULE_SRCVERSION_ALL=y
186CONFIG_KMOD=y
187
188#
189# Block layer
190#
191# CONFIG_LBD is not set
192
193#
194# IO Schedulers
195#
196CONFIG_IOSCHED_NOOP=y
197CONFIG_IOSCHED_AS=y
198CONFIG_IOSCHED_DEADLINE=y
199CONFIG_IOSCHED_CFQ=y
200CONFIG_DEFAULT_AS=y
201# CONFIG_DEFAULT_DEADLINE is not set
202# CONFIG_DEFAULT_CFQ is not set
203# CONFIG_DEFAULT_NOOP is not set
204CONFIG_DEFAULT_IOSCHED="anticipatory"
205
206#
207# Bus options (PCI, PCMCIA, EISA, ISA, TC) 207# Bus options (PCI, PCMCIA, EISA, ISA, TC)
208# 208#
209CONFIG_ISA=y 209CONFIG_ISA=y
@@ -286,7 +286,6 @@ CONFIG_TCP_CONG_BIC=y
286# QoS and/or fair queueing 286# QoS and/or fair queueing
287# 287#
288# CONFIG_NET_SCHED is not set 288# CONFIG_NET_SCHED is not set
289# CONFIG_NET_CLS_ROUTE is not set
290 289
291# 290#
292# Network testing 291# Network testing
@@ -577,6 +576,7 @@ CONFIG_GPIO_VR41XX=y
577# 576#
578# TPM devices 577# TPM devices
579# 578#
579# CONFIG_TCG_TPM is not set
580# CONFIG_TELCLOCK is not set 580# CONFIG_TELCLOCK is not set
581 581
582# 582#
diff --git a/arch/mips/configs/ev64120_defconfig b/arch/mips/configs/ev64120_defconfig
index e6c3c27f41fe..aa24d85ea94d 100644
--- a/arch/mips/configs/ev64120_defconfig
+++ b/arch/mips/configs/ev64120_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Wed Nov 9 11:05:12 2005 4# Thu Nov 24 01:06:16 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57# CONFIG_KMOD is not set
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -187,7 +118,6 @@ CONFIG_PAGE_SIZE_4KB=y
187# CONFIG_64BIT_PHYS_ADDR is not set 118# CONFIG_64BIT_PHYS_ADDR is not set
188# CONFIG_CPU_ADVANCED is not set 119# CONFIG_CPU_ADVANCED is not set
189CONFIG_CPU_HAS_LLSC=y 120CONFIG_CPU_HAS_LLSC=y
190CONFIG_CPU_HAS_LLDSCD=y
191CONFIG_CPU_HAS_SYNC=y 121CONFIG_CPU_HAS_SYNC=y
192CONFIG_GENERIC_HARDIRQS=y 122CONFIG_GENERIC_HARDIRQS=y
193CONFIG_GENERIC_IRQ_PROBE=y 123CONFIG_GENERIC_IRQ_PROBE=y
@@ -205,6 +135,75 @@ CONFIG_PREEMPT_NONE=y
205# CONFIG_PREEMPT is not set 135# CONFIG_PREEMPT is not set
206 136
207# 137#
138# Code maturity level options
139#
140CONFIG_EXPERIMENTAL=y
141CONFIG_CLEAN_COMPILE=y
142CONFIG_BROKEN_ON_SMP=y
143CONFIG_INIT_ENV_ARG_LIMIT=32
144
145#
146# General setup
147#
148CONFIG_LOCALVERSION=""
149CONFIG_LOCALVERSION_AUTO=y
150CONFIG_SWAP=y
151CONFIG_SYSVIPC=y
152# CONFIG_POSIX_MQUEUE is not set
153# CONFIG_BSD_PROCESS_ACCT is not set
154CONFIG_SYSCTL=y
155# CONFIG_AUDIT is not set
156CONFIG_HOTPLUG=y
157CONFIG_KOBJECT_UEVENT=y
158# CONFIG_IKCONFIG is not set
159CONFIG_INITRAMFS_SOURCE=""
160CONFIG_EMBEDDED=y
161CONFIG_KALLSYMS=y
162# CONFIG_KALLSYMS_EXTRA_PASS is not set
163CONFIG_PRINTK=y
164CONFIG_BUG=y
165CONFIG_BASE_FULL=y
166CONFIG_FUTEX=y
167CONFIG_EPOLL=y
168# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
169CONFIG_SHMEM=y
170CONFIG_CC_ALIGN_FUNCTIONS=0
171CONFIG_CC_ALIGN_LABELS=0
172CONFIG_CC_ALIGN_LOOPS=0
173CONFIG_CC_ALIGN_JUMPS=0
174# CONFIG_TINY_SHMEM is not set
175CONFIG_BASE_SMALL=0
176
177#
178# Loadable module support
179#
180CONFIG_MODULES=y
181CONFIG_MODULE_UNLOAD=y
182# CONFIG_MODULE_FORCE_UNLOAD is not set
183CONFIG_OBSOLETE_MODPARM=y
184CONFIG_MODVERSIONS=y
185CONFIG_MODULE_SRCVERSION_ALL=y
186# CONFIG_KMOD is not set
187
188#
189# Block layer
190#
191# CONFIG_LBD is not set
192
193#
194# IO Schedulers
195#
196CONFIG_IOSCHED_NOOP=y
197CONFIG_IOSCHED_AS=y
198CONFIG_IOSCHED_DEADLINE=y
199CONFIG_IOSCHED_CFQ=y
200CONFIG_DEFAULT_AS=y
201# CONFIG_DEFAULT_DEADLINE is not set
202# CONFIG_DEFAULT_CFQ is not set
203# CONFIG_DEFAULT_NOOP is not set
204CONFIG_DEFAULT_IOSCHED="anticipatory"
205
206#
208# Bus options (PCI, PCMCIA, EISA, ISA, TC) 207# Bus options (PCI, PCMCIA, EISA, ISA, TC)
209# 208#
210CONFIG_HW_HAS_PCI=y 209CONFIG_HW_HAS_PCI=y
@@ -291,7 +290,6 @@ CONFIG_TCP_CONG_BIC=y
291# QoS and/or fair queueing 290# QoS and/or fair queueing
292# 291#
293# CONFIG_NET_SCHED is not set 292# CONFIG_NET_SCHED is not set
294# CONFIG_NET_CLS_ROUTE is not set
295 293
296# 294#
297# Network testing 295# Network testing
diff --git a/arch/mips/configs/ev96100_defconfig b/arch/mips/configs/ev96100_defconfig
index 52ca6bf5be66..eeed0e5ad260 100644
--- a/arch/mips/configs/ev96100_defconfig
+++ b/arch/mips/configs/ev96100_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:05:22 2005 4# Thu Nov 24 01:06:18 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27# CONFIG_HOTPLUG is not set
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57# CONFIG_KMOD is not set
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -190,7 +121,6 @@ CONFIG_CPU_HAS_PREFETCH=y
190# CONFIG_64BIT_PHYS_ADDR is not set 121# CONFIG_64BIT_PHYS_ADDR is not set
191# CONFIG_CPU_ADVANCED is not set 122# CONFIG_CPU_ADVANCED is not set
192CONFIG_CPU_HAS_LLSC=y 123CONFIG_CPU_HAS_LLSC=y
193CONFIG_CPU_HAS_LLDSCD=y
194CONFIG_CPU_HAS_SYNC=y 124CONFIG_CPU_HAS_SYNC=y
195CONFIG_GENERIC_HARDIRQS=y 125CONFIG_GENERIC_HARDIRQS=y
196CONFIG_GENERIC_IRQ_PROBE=y 126CONFIG_GENERIC_IRQ_PROBE=y
@@ -209,6 +139,75 @@ CONFIG_PREEMPT_NONE=y
209# CONFIG_PREEMPT is not set 139# CONFIG_PREEMPT is not set
210 140
211# 141#
142# Code maturity level options
143#
144CONFIG_EXPERIMENTAL=y
145CONFIG_CLEAN_COMPILE=y
146CONFIG_BROKEN_ON_SMP=y
147CONFIG_INIT_ENV_ARG_LIMIT=32
148
149#
150# General setup
151#
152CONFIG_LOCALVERSION=""
153CONFIG_LOCALVERSION_AUTO=y
154CONFIG_SWAP=y
155CONFIG_SYSVIPC=y
156# CONFIG_POSIX_MQUEUE is not set
157# CONFIG_BSD_PROCESS_ACCT is not set
158CONFIG_SYSCTL=y
159# CONFIG_AUDIT is not set
160# CONFIG_HOTPLUG is not set
161CONFIG_KOBJECT_UEVENT=y
162# CONFIG_IKCONFIG is not set
163CONFIG_INITRAMFS_SOURCE=""
164CONFIG_EMBEDDED=y
165CONFIG_KALLSYMS=y
166# CONFIG_KALLSYMS_EXTRA_PASS is not set
167CONFIG_PRINTK=y
168CONFIG_BUG=y
169CONFIG_BASE_FULL=y
170CONFIG_FUTEX=y
171CONFIG_EPOLL=y
172# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
173CONFIG_SHMEM=y
174CONFIG_CC_ALIGN_FUNCTIONS=0
175CONFIG_CC_ALIGN_LABELS=0
176CONFIG_CC_ALIGN_LOOPS=0
177CONFIG_CC_ALIGN_JUMPS=0
178# CONFIG_TINY_SHMEM is not set
179CONFIG_BASE_SMALL=0
180
181#
182# Loadable module support
183#
184CONFIG_MODULES=y
185CONFIG_MODULE_UNLOAD=y
186# CONFIG_MODULE_FORCE_UNLOAD is not set
187CONFIG_OBSOLETE_MODPARM=y
188CONFIG_MODVERSIONS=y
189CONFIG_MODULE_SRCVERSION_ALL=y
190# CONFIG_KMOD is not set
191
192#
193# Block layer
194#
195# CONFIG_LBD is not set
196
197#
198# IO Schedulers
199#
200CONFIG_IOSCHED_NOOP=y
201CONFIG_IOSCHED_AS=y
202CONFIG_IOSCHED_DEADLINE=y
203CONFIG_IOSCHED_CFQ=y
204CONFIG_DEFAULT_AS=y
205# CONFIG_DEFAULT_DEADLINE is not set
206# CONFIG_DEFAULT_CFQ is not set
207# CONFIG_DEFAULT_NOOP is not set
208CONFIG_DEFAULT_IOSCHED="anticipatory"
209
210#
212# Bus options (PCI, PCMCIA, EISA, ISA, TC) 211# Bus options (PCI, PCMCIA, EISA, ISA, TC)
213# 212#
214CONFIG_HW_HAS_PCI=y 213CONFIG_HW_HAS_PCI=y
@@ -293,7 +292,6 @@ CONFIG_TCP_CONG_BIC=y
293# QoS and/or fair queueing 292# QoS and/or fair queueing
294# 293#
295# CONFIG_NET_SCHED is not set 294# CONFIG_NET_SCHED is not set
296# CONFIG_NET_CLS_ROUTE is not set
297 295
298# 296#
299# Network testing 297# Network testing
@@ -531,6 +529,7 @@ CONFIG_LEGACY_PTY_COUNT=256
531# 529#
532# TPM devices 530# TPM devices
533# 531#
532# CONFIG_TCG_TPM is not set
534# CONFIG_TELCLOCK is not set 533# CONFIG_TELCLOCK is not set
535 534
536# 535#
diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
index 79e3fe7e2d54..e56351abf87a 100644
--- a/arch/mips/configs/ip22_defconfig
+++ b/arch/mips/configs/ip22_defconfig
@@ -1,81 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Thu Nov 10 13:38:41 2005 4# Thu Nov 24 01:06:20 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27# CONFIG_HOTPLUG is not set
28CONFIG_KOBJECT_UEVENT=y
29CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y
54# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y
57CONFIG_MODULE_SRCVERSION_ALL=y
58CONFIG_KMOD=y
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Machine selection 9# Machine selection
80# 10#
81# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -193,7 +123,6 @@ CONFIG_IP22_CPU_SCACHE=y
193# CONFIG_64BIT_PHYS_ADDR is not set 123# CONFIG_64BIT_PHYS_ADDR is not set
194# CONFIG_CPU_ADVANCED is not set 124# CONFIG_CPU_ADVANCED is not set
195CONFIG_CPU_HAS_LLSC=y 125CONFIG_CPU_HAS_LLSC=y
196CONFIG_CPU_HAS_LLDSCD=y
197CONFIG_CPU_HAS_SYNC=y 126CONFIG_CPU_HAS_SYNC=y
198CONFIG_GENERIC_HARDIRQS=y 127CONFIG_GENERIC_HARDIRQS=y
199CONFIG_GENERIC_IRQ_PROBE=y 128CONFIG_GENERIC_IRQ_PROBE=y
@@ -211,6 +140,76 @@ CONFIG_PREEMPT_VOLUNTARY=y
211# CONFIG_PREEMPT is not set 140# CONFIG_PREEMPT is not set
212 141
213# 142#
143# Code maturity level options
144#
145CONFIG_EXPERIMENTAL=y
146CONFIG_CLEAN_COMPILE=y
147CONFIG_BROKEN_ON_SMP=y
148CONFIG_INIT_ENV_ARG_LIMIT=32
149
150#
151# General setup
152#
153CONFIG_LOCALVERSION=""
154CONFIG_LOCALVERSION_AUTO=y
155CONFIG_SWAP=y
156CONFIG_SYSVIPC=y
157# CONFIG_POSIX_MQUEUE is not set
158# CONFIG_BSD_PROCESS_ACCT is not set
159CONFIG_SYSCTL=y
160# CONFIG_AUDIT is not set
161# CONFIG_HOTPLUG is not set
162CONFIG_KOBJECT_UEVENT=y
163CONFIG_IKCONFIG=y
164CONFIG_IKCONFIG_PROC=y
165CONFIG_INITRAMFS_SOURCE=""
166CONFIG_EMBEDDED=y
167CONFIG_KALLSYMS=y
168# CONFIG_KALLSYMS_EXTRA_PASS is not set
169CONFIG_PRINTK=y
170CONFIG_BUG=y
171CONFIG_BASE_FULL=y
172CONFIG_FUTEX=y
173CONFIG_EPOLL=y
174# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
175CONFIG_SHMEM=y
176CONFIG_CC_ALIGN_FUNCTIONS=0
177CONFIG_CC_ALIGN_LABELS=0
178CONFIG_CC_ALIGN_LOOPS=0
179CONFIG_CC_ALIGN_JUMPS=0
180# CONFIG_TINY_SHMEM is not set
181CONFIG_BASE_SMALL=0
182
183#
184# Loadable module support
185#
186CONFIG_MODULES=y
187CONFIG_MODULE_UNLOAD=y
188# CONFIG_MODULE_FORCE_UNLOAD is not set
189CONFIG_OBSOLETE_MODPARM=y
190CONFIG_MODVERSIONS=y
191CONFIG_MODULE_SRCVERSION_ALL=y
192CONFIG_KMOD=y
193
194#
195# Block layer
196#
197# CONFIG_LBD is not set
198
199#
200# IO Schedulers
201#
202CONFIG_IOSCHED_NOOP=y
203CONFIG_IOSCHED_AS=y
204CONFIG_IOSCHED_DEADLINE=y
205CONFIG_IOSCHED_CFQ=y
206CONFIG_DEFAULT_AS=y
207# CONFIG_DEFAULT_DEADLINE is not set
208# CONFIG_DEFAULT_CFQ is not set
209# CONFIG_DEFAULT_NOOP is not set
210CONFIG_DEFAULT_IOSCHED="anticipatory"
211
212#
214# Bus options (PCI, PCMCIA, EISA, ISA, TC) 213# Bus options (PCI, PCMCIA, EISA, ISA, TC)
215# 214#
216CONFIG_HW_HAS_EISA=y 215CONFIG_HW_HAS_EISA=y
@@ -779,6 +778,7 @@ CONFIG_MAX_RAW_DEVS=256
779# 778#
780# TPM devices 779# TPM devices
781# 780#
781# CONFIG_TCG_TPM is not set
782# CONFIG_TELCLOCK is not set 782# CONFIG_TELCLOCK is not set
783 783
784# 784#
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index 72998ec35b0b..e17d3adff021 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -1,82 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.15-rc2
4# Sun Nov 13 23:56:52 2005 4# Thu Nov 24 01:06:21 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_LOCK_KERNEL=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23CONFIG_POSIX_MQUEUE=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y
31CONFIG_CPUSETS=y
32CONFIG_INITRAMFS_SOURCE=""
33CONFIG_EMBEDDED=y
34CONFIG_KALLSYMS=y
35# CONFIG_KALLSYMS_EXTRA_PASS is not set
36CONFIG_PRINTK=y
37CONFIG_BUG=y
38CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y
40CONFIG_EPOLL=y
41# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
42CONFIG_SHMEM=y
43CONFIG_CC_ALIGN_FUNCTIONS=0
44CONFIG_CC_ALIGN_LABELS=0
45CONFIG_CC_ALIGN_LOOPS=0
46CONFIG_CC_ALIGN_JUMPS=0
47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0
49
50#
51# Loadable module support
52#
53CONFIG_MODULES=y
54CONFIG_MODULE_UNLOAD=y
55# CONFIG_MODULE_FORCE_UNLOAD is not set
56CONFIG_OBSOLETE_MODPARM=y
57# CONFIG_MODVERSIONS is not set
58CONFIG_MODULE_SRCVERSION_ALL=y
59CONFIG_KMOD=y
60CONFIG_STOP_MACHINE=y
61
62#
63# Block layer
64#
65
66#
67# IO Schedulers
68#
69CONFIG_IOSCHED_NOOP=y
70CONFIG_IOSCHED_AS=y
71CONFIG_IOSCHED_DEADLINE=y
72CONFIG_IOSCHED_CFQ=y
73CONFIG_DEFAULT_AS=y
74# CONFIG_DEFAULT_DEADLINE is not set
75# CONFIG_DEFAULT_CFQ is not set
76# CONFIG_DEFAULT_NOOP is not set
77CONFIG_DEFAULT_IOSCHED="anticipatory"
78
79#
80# Machine selection 9# Machine selection
81# 10#
82# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -190,7 +119,6 @@ CONFIG_PAGE_SIZE_4KB=y
190CONFIG_CPU_HAS_PREFETCH=y 119CONFIG_CPU_HAS_PREFETCH=y
191# CONFIG_MIPS_MT is not set 120# CONFIG_MIPS_MT is not set
192CONFIG_CPU_HAS_LLSC=y 121CONFIG_CPU_HAS_LLSC=y
193CONFIG_CPU_HAS_LLDSCD=y
194CONFIG_CPU_HAS_SYNC=y 122CONFIG_CPU_HAS_SYNC=y
195CONFIG_GENERIC_HARDIRQS=y 123CONFIG_GENERIC_HARDIRQS=y
196CONFIG_GENERIC_IRQ_PROBE=y 124CONFIG_GENERIC_IRQ_PROBE=y
@@ -213,6 +141,77 @@ CONFIG_PREEMPT_BKL=y
213# CONFIG_MIPS_INSANE_LARGE is not set 141# CONFIG_MIPS_INSANE_LARGE is not set
214 142
215# 143#
144# Code maturity level options
145#
146CONFIG_EXPERIMENTAL=y
147CONFIG_CLEAN_COMPILE=y
148CONFIG_LOCK_KERNEL=y
149CONFIG_INIT_ENV_ARG_LIMIT=32
150
151#
152# General setup
153#
154CONFIG_LOCALVERSION=""
155CONFIG_LOCALVERSION_AUTO=y
156CONFIG_SWAP=y
157CONFIG_SYSVIPC=y
158CONFIG_POSIX_MQUEUE=y
159# CONFIG_BSD_PROCESS_ACCT is not set
160CONFIG_SYSCTL=y
161# CONFIG_AUDIT is not set
162CONFIG_HOTPLUG=y
163CONFIG_KOBJECT_UEVENT=y
164CONFIG_IKCONFIG=y
165CONFIG_IKCONFIG_PROC=y
166CONFIG_CPUSETS=y
167CONFIG_INITRAMFS_SOURCE=""
168CONFIG_EMBEDDED=y
169CONFIG_KALLSYMS=y
170# CONFIG_KALLSYMS_EXTRA_PASS is not set
171CONFIG_PRINTK=y
172CONFIG_BUG=y
173CONFIG_BASE_FULL=y
174CONFIG_FUTEX=y
175CONFIG_EPOLL=y
176# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
177CONFIG_SHMEM=y
178CONFIG_CC_ALIGN_FUNCTIONS=0
179CONFIG_CC_ALIGN_LABELS=0
180CONFIG_CC_ALIGN_LOOPS=0
181CONFIG_CC_ALIGN_JUMPS=0
182# CONFIG_TINY_SHMEM is not set
183CONFIG_BASE_SMALL=0
184
185#
186# Loadable module support
187#
188CONFIG_MODULES=y
189CONFIG_MODULE_UNLOAD=y
190# CONFIG_MODULE_FORCE_UNLOAD is not set
191CONFIG_OBSOLETE_MODPARM=y
192# CONFIG_MODVERSIONS is not set
193CONFIG_MODULE_SRCVERSION_ALL=y
194CONFIG_KMOD=y
195CONFIG_STOP_MACHINE=y
196
197#
198# Block layer
199#
200
201#
202# IO Schedulers
203#
204CONFIG_IOSCHED_NOOP=y
205CONFIG_IOSCHED_AS=y
206CONFIG_IOSCHED_DEADLINE=y
207CONFIG_IOSCHED_CFQ=y
208CONFIG_DEFAULT_AS=y
209# CONFIG_DEFAULT_DEADLINE is not set
210# CONFIG_DEFAULT_CFQ is not set
211# CONFIG_DEFAULT_NOOP is not set
212CONFIG_DEFAULT_IOSCHED="anticipatory"
213
214#
216# Bus options (PCI, PCMCIA, EISA, ISA, TC) 215# Bus options (PCI, PCMCIA, EISA, ISA, TC)
217# 216#
218CONFIG_HW_HAS_PCI=y 217CONFIG_HW_HAS_PCI=y
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
index 955e30f1b1ad..967e7acd8e1f 100644
--- a/arch/mips/configs/ip32_defconfig
+++ b/arch/mips/configs/ip32_defconfig
@@ -1,74 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:05:32 2005 4# Thu Nov 24 01:06:24 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24CONFIG_BSD_PROCESS_ACCT=y
25# CONFIG_BSD_PROCESS_ACCT_V3 is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_HOTPLUG=y
29CONFIG_KOBJECT_UEVENT=y
30# CONFIG_IKCONFIG is not set
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52# CONFIG_MODULES is not set
53
54#
55# Block layer
56#
57
58#
59# IO Schedulers
60#
61CONFIG_IOSCHED_NOOP=y
62CONFIG_IOSCHED_AS=y
63CONFIG_IOSCHED_DEADLINE=y
64CONFIG_IOSCHED_CFQ=y
65CONFIG_DEFAULT_AS=y
66# CONFIG_DEFAULT_DEADLINE is not set
67# CONFIG_DEFAULT_CFQ is not set
68# CONFIG_DEFAULT_NOOP is not set
69CONFIG_DEFAULT_IOSCHED="anticipatory"
70
71#
72# Machine selection 9# Machine selection
73# 10#
74# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -184,7 +121,6 @@ CONFIG_R5000_CPU_SCACHE=y
184CONFIG_RM7000_CPU_SCACHE=y 121CONFIG_RM7000_CPU_SCACHE=y
185# CONFIG_MIPS_MT is not set 122# CONFIG_MIPS_MT is not set
186CONFIG_CPU_HAS_LLSC=y 123CONFIG_CPU_HAS_LLSC=y
187CONFIG_CPU_HAS_LLDSCD=y
188CONFIG_CPU_HAS_SYNC=y 124CONFIG_CPU_HAS_SYNC=y
189CONFIG_GENERIC_HARDIRQS=y 125CONFIG_GENERIC_HARDIRQS=y
190CONFIG_GENERIC_IRQ_PROBE=y 126CONFIG_GENERIC_IRQ_PROBE=y
@@ -202,6 +138,69 @@ CONFIG_PREEMPT_VOLUNTARY=y
202# CONFIG_PREEMPT is not set 138# CONFIG_PREEMPT is not set
203 139
204# 140#
141# Code maturity level options
142#
143CONFIG_EXPERIMENTAL=y
144CONFIG_CLEAN_COMPILE=y
145CONFIG_BROKEN_ON_SMP=y
146CONFIG_INIT_ENV_ARG_LIMIT=32
147
148#
149# General setup
150#
151CONFIG_LOCALVERSION=""
152CONFIG_LOCALVERSION_AUTO=y
153CONFIG_SWAP=y
154CONFIG_SYSVIPC=y
155# CONFIG_POSIX_MQUEUE is not set
156CONFIG_BSD_PROCESS_ACCT=y
157# CONFIG_BSD_PROCESS_ACCT_V3 is not set
158CONFIG_SYSCTL=y
159# CONFIG_AUDIT is not set
160CONFIG_HOTPLUG=y
161CONFIG_KOBJECT_UEVENT=y
162# CONFIG_IKCONFIG is not set
163CONFIG_INITRAMFS_SOURCE=""
164CONFIG_EMBEDDED=y
165CONFIG_KALLSYMS=y
166# CONFIG_KALLSYMS_EXTRA_PASS is not set
167CONFIG_PRINTK=y
168CONFIG_BUG=y
169CONFIG_BASE_FULL=y
170CONFIG_FUTEX=y
171CONFIG_EPOLL=y
172# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
173CONFIG_SHMEM=y
174CONFIG_CC_ALIGN_FUNCTIONS=0
175CONFIG_CC_ALIGN_LABELS=0
176CONFIG_CC_ALIGN_LOOPS=0
177CONFIG_CC_ALIGN_JUMPS=0
178# CONFIG_TINY_SHMEM is not set
179CONFIG_BASE_SMALL=0
180
181#
182# Loadable module support
183#
184# CONFIG_MODULES is not set
185
186#
187# Block layer
188#
189
190#
191# IO Schedulers
192#
193CONFIG_IOSCHED_NOOP=y
194CONFIG_IOSCHED_AS=y
195CONFIG_IOSCHED_DEADLINE=y
196CONFIG_IOSCHED_CFQ=y
197CONFIG_DEFAULT_AS=y
198# CONFIG_DEFAULT_DEADLINE is not set
199# CONFIG_DEFAULT_CFQ is not set
200# CONFIG_DEFAULT_NOOP is not set
201CONFIG_DEFAULT_IOSCHED="anticipatory"
202
203#
205# Bus options (PCI, PCMCIA, EISA, ISA, TC) 204# Bus options (PCI, PCMCIA, EISA, ISA, TC)
206# 205#
207CONFIG_HW_HAS_PCI=y 206CONFIG_HW_HAS_PCI=y
@@ -294,7 +293,6 @@ CONFIG_TCP_CONG_BIC=y
294# QoS and/or fair queueing 293# QoS and/or fair queueing
295# 294#
296# CONFIG_NET_SCHED is not set 295# CONFIG_NET_SCHED is not set
297# CONFIG_NET_CLS_ROUTE is not set
298 296
299# 297#
300# Network testing 298# Network testing
diff --git a/arch/mips/configs/it8172_defconfig b/arch/mips/configs/it8172_defconfig
index f631385217db..b5fa9639db6f 100644
--- a/arch/mips/configs/it8172_defconfig
+++ b/arch/mips/configs/it8172_defconfig
@@ -1,81 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Thu Nov 10 13:42:45 2005 4# Thu Nov 24 01:06:26 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24CONFIG_BSD_PROCESS_ACCT=y
25# CONFIG_BSD_PROCESS_ACCT_V3 is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28# CONFIG_HOTPLUG is not set
29CONFIG_KOBJECT_UEVENT=y
30# CONFIG_IKCONFIG is not set
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y
54# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y
57CONFIG_MODULE_SRCVERSION_ALL=y
58CONFIG_KMOD=y
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Machine selection 9# Machine selection
80# 10#
81# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -187,7 +117,6 @@ CONFIG_PAGE_SIZE_4KB=y
187# CONFIG_MIPS_MT is not set 117# CONFIG_MIPS_MT is not set
188# CONFIG_CPU_ADVANCED is not set 118# CONFIG_CPU_ADVANCED is not set
189CONFIG_CPU_HAS_LLSC=y 119CONFIG_CPU_HAS_LLSC=y
190CONFIG_CPU_HAS_LLDSCD=y
191CONFIG_CPU_HAS_SYNC=y 120CONFIG_CPU_HAS_SYNC=y
192CONFIG_GENERIC_HARDIRQS=y 121CONFIG_GENERIC_HARDIRQS=y
193CONFIG_GENERIC_IRQ_PROBE=y 122CONFIG_GENERIC_IRQ_PROBE=y
@@ -205,6 +134,76 @@ CONFIG_PREEMPT_NONE=y
205# CONFIG_PREEMPT is not set 134# CONFIG_PREEMPT is not set
206 135
207# 136#
137# Code maturity level options
138#
139CONFIG_EXPERIMENTAL=y
140CONFIG_CLEAN_COMPILE=y
141CONFIG_BROKEN_ON_SMP=y
142CONFIG_INIT_ENV_ARG_LIMIT=32
143
144#
145# General setup
146#
147CONFIG_LOCALVERSION=""
148CONFIG_LOCALVERSION_AUTO=y
149CONFIG_SWAP=y
150CONFIG_SYSVIPC=y
151# CONFIG_POSIX_MQUEUE is not set
152CONFIG_BSD_PROCESS_ACCT=y
153# CONFIG_BSD_PROCESS_ACCT_V3 is not set
154CONFIG_SYSCTL=y
155# CONFIG_AUDIT is not set
156# CONFIG_HOTPLUG is not set
157CONFIG_KOBJECT_UEVENT=y
158# CONFIG_IKCONFIG is not set
159CONFIG_INITRAMFS_SOURCE=""
160CONFIG_EMBEDDED=y
161CONFIG_KALLSYMS=y
162# CONFIG_KALLSYMS_EXTRA_PASS is not set
163CONFIG_PRINTK=y
164CONFIG_BUG=y
165CONFIG_BASE_FULL=y
166CONFIG_FUTEX=y
167CONFIG_EPOLL=y
168# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
169CONFIG_SHMEM=y
170CONFIG_CC_ALIGN_FUNCTIONS=0
171CONFIG_CC_ALIGN_LABELS=0
172CONFIG_CC_ALIGN_LOOPS=0
173CONFIG_CC_ALIGN_JUMPS=0
174# CONFIG_TINY_SHMEM is not set
175CONFIG_BASE_SMALL=0
176
177#
178# Loadable module support
179#
180CONFIG_MODULES=y
181CONFIG_MODULE_UNLOAD=y
182# CONFIG_MODULE_FORCE_UNLOAD is not set
183CONFIG_OBSOLETE_MODPARM=y
184CONFIG_MODVERSIONS=y
185CONFIG_MODULE_SRCVERSION_ALL=y
186CONFIG_KMOD=y
187
188#
189# Block layer
190#
191# CONFIG_LBD is not set
192
193#
194# IO Schedulers
195#
196CONFIG_IOSCHED_NOOP=y
197CONFIG_IOSCHED_AS=y
198CONFIG_IOSCHED_DEADLINE=y
199CONFIG_IOSCHED_CFQ=y
200CONFIG_DEFAULT_AS=y
201# CONFIG_DEFAULT_DEADLINE is not set
202# CONFIG_DEFAULT_CFQ is not set
203# CONFIG_DEFAULT_NOOP is not set
204CONFIG_DEFAULT_IOSCHED="anticipatory"
205
206#
208# Bus options (PCI, PCMCIA, EISA, ISA, TC) 207# Bus options (PCI, PCMCIA, EISA, ISA, TC)
209# 208#
210CONFIG_HW_HAS_PCI=y 209CONFIG_HW_HAS_PCI=y
@@ -290,7 +289,6 @@ CONFIG_TCP_CONG_BIC=y
290# QoS and/or fair queueing 289# QoS and/or fair queueing
291# 290#
292# CONFIG_NET_SCHED is not set 291# CONFIG_NET_SCHED is not set
293# CONFIG_NET_CLS_ROUTE is not set
294 292
295# 293#
296# Network testing 294# Network testing
@@ -628,6 +626,7 @@ CONFIG_LEGACY_PTY_COUNT=256
628# 626#
629# TPM devices 627# TPM devices
630# 628#
629# CONFIG_TCG_TPM is not set
631# CONFIG_TELCLOCK is not set 630# CONFIG_TELCLOCK is not set
632 631
633# 632#
diff --git a/arch/mips/configs/ivr_defconfig b/arch/mips/configs/ivr_defconfig
index 8d94ac753e78..71386938d47f 100644
--- a/arch/mips/configs/ivr_defconfig
+++ b/arch/mips/configs/ivr_defconfig
@@ -1,81 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:05:38 2005 4# Thu Nov 24 01:06:27 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24CONFIG_BSD_PROCESS_ACCT=y
25# CONFIG_BSD_PROCESS_ACCT_V3 is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_HOTPLUG=y
29CONFIG_KOBJECT_UEVENT=y
30# CONFIG_IKCONFIG is not set
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y
54# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y
57CONFIG_MODULE_SRCVERSION_ALL=y
58CONFIG_KMOD=y
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Machine selection 9# Machine selection
80# 10#
81# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -184,7 +114,6 @@ CONFIG_PAGE_SIZE_4KB=y
184# CONFIG_MIPS_MT is not set 114# CONFIG_MIPS_MT is not set
185# CONFIG_CPU_ADVANCED is not set 115# CONFIG_CPU_ADVANCED is not set
186CONFIG_CPU_HAS_LLSC=y 116CONFIG_CPU_HAS_LLSC=y
187CONFIG_CPU_HAS_LLDSCD=y
188CONFIG_CPU_HAS_SYNC=y 117CONFIG_CPU_HAS_SYNC=y
189CONFIG_GENERIC_HARDIRQS=y 118CONFIG_GENERIC_HARDIRQS=y
190CONFIG_GENERIC_IRQ_PROBE=y 119CONFIG_GENERIC_IRQ_PROBE=y
@@ -202,6 +131,76 @@ CONFIG_PREEMPT_NONE=y
202# CONFIG_PREEMPT is not set 131# CONFIG_PREEMPT is not set
203 132
204# 133#
134# Code maturity level options
135#
136CONFIG_EXPERIMENTAL=y
137CONFIG_CLEAN_COMPILE=y
138CONFIG_BROKEN_ON_SMP=y
139CONFIG_INIT_ENV_ARG_LIMIT=32
140
141#
142# General setup
143#
144CONFIG_LOCALVERSION=""
145CONFIG_LOCALVERSION_AUTO=y
146CONFIG_SWAP=y
147CONFIG_SYSVIPC=y
148# CONFIG_POSIX_MQUEUE is not set
149CONFIG_BSD_PROCESS_ACCT=y
150# CONFIG_BSD_PROCESS_ACCT_V3 is not set
151CONFIG_SYSCTL=y
152# CONFIG_AUDIT is not set
153CONFIG_HOTPLUG=y
154CONFIG_KOBJECT_UEVENT=y
155# CONFIG_IKCONFIG is not set
156CONFIG_INITRAMFS_SOURCE=""
157CONFIG_EMBEDDED=y
158CONFIG_KALLSYMS=y
159# CONFIG_KALLSYMS_EXTRA_PASS is not set
160CONFIG_PRINTK=y
161CONFIG_BUG=y
162CONFIG_BASE_FULL=y
163CONFIG_FUTEX=y
164CONFIG_EPOLL=y
165# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
166CONFIG_SHMEM=y
167CONFIG_CC_ALIGN_FUNCTIONS=0
168CONFIG_CC_ALIGN_LABELS=0
169CONFIG_CC_ALIGN_LOOPS=0
170CONFIG_CC_ALIGN_JUMPS=0
171# CONFIG_TINY_SHMEM is not set
172CONFIG_BASE_SMALL=0
173
174#
175# Loadable module support
176#
177CONFIG_MODULES=y
178CONFIG_MODULE_UNLOAD=y
179# CONFIG_MODULE_FORCE_UNLOAD is not set
180CONFIG_OBSOLETE_MODPARM=y
181CONFIG_MODVERSIONS=y
182CONFIG_MODULE_SRCVERSION_ALL=y
183CONFIG_KMOD=y
184
185#
186# Block layer
187#
188# CONFIG_LBD is not set
189
190#
191# IO Schedulers
192#
193CONFIG_IOSCHED_NOOP=y
194CONFIG_IOSCHED_AS=y
195CONFIG_IOSCHED_DEADLINE=y
196CONFIG_IOSCHED_CFQ=y
197CONFIG_DEFAULT_AS=y
198# CONFIG_DEFAULT_DEADLINE is not set
199# CONFIG_DEFAULT_CFQ is not set
200# CONFIG_DEFAULT_NOOP is not set
201CONFIG_DEFAULT_IOSCHED="anticipatory"
202
203#
205# Bus options (PCI, PCMCIA, EISA, ISA, TC) 204# Bus options (PCI, PCMCIA, EISA, ISA, TC)
206# 205#
207CONFIG_HW_HAS_PCI=y 206CONFIG_HW_HAS_PCI=y
@@ -289,7 +288,6 @@ CONFIG_TCP_CONG_BIC=y
289# QoS and/or fair queueing 288# QoS and/or fair queueing
290# 289#
291# CONFIG_NET_SCHED is not set 290# CONFIG_NET_SCHED is not set
292# CONFIG_NET_CLS_ROUTE is not set
293 291
294# 292#
295# Network testing 293# Network testing
diff --git a/arch/mips/configs/jaguar-atx_defconfig b/arch/mips/configs/jaguar-atx_defconfig
index a8b4c9a9a63b..14fb46886708 100644
--- a/arch/mips/configs/jaguar-atx_defconfig
+++ b/arch/mips/configs/jaguar-atx_defconfig
@@ -1,78 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:05:41 2005 4# Thu Nov 24 01:06:29 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11# CONFIG_EXPERIMENTAL is not set
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_BSD_PROCESS_ACCT is not set
24CONFIG_SYSCTL=y
25# CONFIG_AUDIT is not set
26CONFIG_HOTPLUG=y
27CONFIG_KOBJECT_UEVENT=y
28CONFIG_IKCONFIG=y
29CONFIG_IKCONFIG_PROC=y
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53CONFIG_OBSOLETE_MODPARM=y
54CONFIG_MODULE_SRCVERSION_ALL=y
55CONFIG_KMOD=y
56
57#
58# Block layer
59#
60# CONFIG_LBD is not set
61
62#
63# IO Schedulers
64#
65CONFIG_IOSCHED_NOOP=y
66CONFIG_IOSCHED_AS=y
67CONFIG_IOSCHED_DEADLINE=y
68CONFIG_IOSCHED_CFQ=y
69CONFIG_DEFAULT_AS=y
70# CONFIG_DEFAULT_DEADLINE is not set
71# CONFIG_DEFAULT_CFQ is not set
72# CONFIG_DEFAULT_NOOP is not set
73CONFIG_DEFAULT_IOSCHED="anticipatory"
74
75#
76# Machine selection 9# Machine selection
77# 10#
78# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -191,7 +124,6 @@ CONFIG_CPU_HAS_PREFETCH=y
191# CONFIG_64BIT_PHYS_ADDR is not set 124# CONFIG_64BIT_PHYS_ADDR is not set
192# CONFIG_CPU_ADVANCED is not set 125# CONFIG_CPU_ADVANCED is not set
193CONFIG_CPU_HAS_LLSC=y 126CONFIG_CPU_HAS_LLSC=y
194CONFIG_CPU_HAS_LLDSCD=y
195CONFIG_CPU_HAS_SYNC=y 127CONFIG_CPU_HAS_SYNC=y
196CONFIG_GENERIC_HARDIRQS=y 128CONFIG_GENERIC_HARDIRQS=y
197CONFIG_GENERIC_IRQ_PROBE=y 129CONFIG_GENERIC_IRQ_PROBE=y
@@ -209,6 +141,73 @@ CONFIG_PREEMPT_NONE=y
209# CONFIG_PREEMPT is not set 141# CONFIG_PREEMPT is not set
210 142
211# 143#
144# Code maturity level options
145#
146# CONFIG_EXPERIMENTAL is not set
147CONFIG_CLEAN_COMPILE=y
148CONFIG_BROKEN_ON_SMP=y
149CONFIG_INIT_ENV_ARG_LIMIT=32
150
151#
152# General setup
153#
154CONFIG_LOCALVERSION=""
155CONFIG_LOCALVERSION_AUTO=y
156CONFIG_SWAP=y
157CONFIG_SYSVIPC=y
158# CONFIG_BSD_PROCESS_ACCT is not set
159CONFIG_SYSCTL=y
160# CONFIG_AUDIT is not set
161CONFIG_HOTPLUG=y
162CONFIG_KOBJECT_UEVENT=y
163CONFIG_IKCONFIG=y
164CONFIG_IKCONFIG_PROC=y
165CONFIG_INITRAMFS_SOURCE=""
166CONFIG_EMBEDDED=y
167CONFIG_KALLSYMS=y
168# CONFIG_KALLSYMS_EXTRA_PASS is not set
169CONFIG_PRINTK=y
170CONFIG_BUG=y
171CONFIG_BASE_FULL=y
172CONFIG_FUTEX=y
173CONFIG_EPOLL=y
174# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
175CONFIG_SHMEM=y
176CONFIG_CC_ALIGN_FUNCTIONS=0
177CONFIG_CC_ALIGN_LABELS=0
178CONFIG_CC_ALIGN_LOOPS=0
179CONFIG_CC_ALIGN_JUMPS=0
180# CONFIG_TINY_SHMEM is not set
181CONFIG_BASE_SMALL=0
182
183#
184# Loadable module support
185#
186CONFIG_MODULES=y
187CONFIG_MODULE_UNLOAD=y
188CONFIG_OBSOLETE_MODPARM=y
189CONFIG_MODULE_SRCVERSION_ALL=y
190CONFIG_KMOD=y
191
192#
193# Block layer
194#
195# CONFIG_LBD is not set
196
197#
198# IO Schedulers
199#
200CONFIG_IOSCHED_NOOP=y
201CONFIG_IOSCHED_AS=y
202CONFIG_IOSCHED_DEADLINE=y
203CONFIG_IOSCHED_CFQ=y
204CONFIG_DEFAULT_AS=y
205# CONFIG_DEFAULT_DEADLINE is not set
206# CONFIG_DEFAULT_CFQ is not set
207# CONFIG_DEFAULT_NOOP is not set
208CONFIG_DEFAULT_IOSCHED="anticipatory"
209
210#
212# Bus options (PCI, PCMCIA, EISA, ISA, TC) 211# Bus options (PCI, PCMCIA, EISA, ISA, TC)
213# 212#
214CONFIG_HW_HAS_PCI=y 213CONFIG_HW_HAS_PCI=y
@@ -283,7 +282,6 @@ CONFIG_IPV6_TUNNEL=m
283# QoS and/or fair queueing 282# QoS and/or fair queueing
284# 283#
285# CONFIG_NET_SCHED is not set 284# CONFIG_NET_SCHED is not set
286# CONFIG_NET_CLS_ROUTE is not set
287 285
288# 286#
289# Network testing 287# Network testing
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
index c0ac5c793ec7..a8ded3d74152 100644
--- a/arch/mips/configs/jmr3927_defconfig
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -1,74 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:05:44 2005 4# Thu Nov 24 01:06:31 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Block layer
55#
56# CONFIG_LBD is not set
57
58#
59# IO Schedulers
60#
61CONFIG_IOSCHED_NOOP=y
62CONFIG_IOSCHED_AS=y
63CONFIG_IOSCHED_DEADLINE=y
64CONFIG_IOSCHED_CFQ=y
65CONFIG_DEFAULT_AS=y
66# CONFIG_DEFAULT_DEADLINE is not set
67# CONFIG_DEFAULT_CFQ is not set
68# CONFIG_DEFAULT_NOOP is not set
69CONFIG_DEFAULT_IOSCHED="anticipatory"
70
71#
72# Machine selection 9# Machine selection
73# 10#
74# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -193,6 +130,69 @@ CONFIG_PREEMPT_NONE=y
193CONFIG_RTC_DS1742=y 130CONFIG_RTC_DS1742=y
194 131
195# 132#
133# Code maturity level options
134#
135CONFIG_EXPERIMENTAL=y
136CONFIG_CLEAN_COMPILE=y
137CONFIG_BROKEN_ON_SMP=y
138CONFIG_INIT_ENV_ARG_LIMIT=32
139
140#
141# General setup
142#
143CONFIG_LOCALVERSION=""
144CONFIG_LOCALVERSION_AUTO=y
145CONFIG_SWAP=y
146CONFIG_SYSVIPC=y
147# CONFIG_POSIX_MQUEUE is not set
148# CONFIG_BSD_PROCESS_ACCT is not set
149CONFIG_SYSCTL=y
150# CONFIG_AUDIT is not set
151CONFIG_HOTPLUG=y
152CONFIG_KOBJECT_UEVENT=y
153# CONFIG_IKCONFIG is not set
154CONFIG_INITRAMFS_SOURCE=""
155CONFIG_EMBEDDED=y
156CONFIG_KALLSYMS=y
157# CONFIG_KALLSYMS_EXTRA_PASS is not set
158CONFIG_PRINTK=y
159CONFIG_BUG=y
160CONFIG_BASE_FULL=y
161CONFIG_FUTEX=y
162CONFIG_EPOLL=y
163# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
164CONFIG_SHMEM=y
165CONFIG_CC_ALIGN_FUNCTIONS=0
166CONFIG_CC_ALIGN_LABELS=0
167CONFIG_CC_ALIGN_LOOPS=0
168CONFIG_CC_ALIGN_JUMPS=0
169# CONFIG_TINY_SHMEM is not set
170CONFIG_BASE_SMALL=0
171
172#
173# Loadable module support
174#
175# CONFIG_MODULES is not set
176
177#
178# Block layer
179#
180# CONFIG_LBD is not set
181
182#
183# IO Schedulers
184#
185CONFIG_IOSCHED_NOOP=y
186CONFIG_IOSCHED_AS=y
187CONFIG_IOSCHED_DEADLINE=y
188CONFIG_IOSCHED_CFQ=y
189CONFIG_DEFAULT_AS=y
190# CONFIG_DEFAULT_DEADLINE is not set
191# CONFIG_DEFAULT_CFQ is not set
192# CONFIG_DEFAULT_NOOP is not set
193CONFIG_DEFAULT_IOSCHED="anticipatory"
194
195#
196# Bus options (PCI, PCMCIA, EISA, ISA, TC) 196# Bus options (PCI, PCMCIA, EISA, ISA, TC)
197# 197#
198CONFIG_HW_HAS_PCI=y 198CONFIG_HW_HAS_PCI=y
@@ -280,7 +280,6 @@ CONFIG_TCP_CONG_BIC=y
280# QoS and/or fair queueing 280# QoS and/or fair queueing
281# 281#
282# CONFIG_NET_SCHED is not set 282# CONFIG_NET_SCHED is not set
283# CONFIG_NET_CLS_ROUTE is not set
284 283
285# 284#
286# Network testing 285# Network testing
diff --git a/arch/mips/configs/lasat200_defconfig b/arch/mips/configs/lasat200_defconfig
index f2bd620ff0fa..6c5df76d48d9 100644
--- a/arch/mips/configs/lasat200_defconfig
+++ b/arch/mips/configs/lasat200_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:05:47 2005 4# Thu Nov 24 01:06:33 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -190,7 +121,6 @@ CONFIG_R5000_CPU_SCACHE=y
190# CONFIG_64BIT_PHYS_ADDR is not set 121# CONFIG_64BIT_PHYS_ADDR is not set
191# CONFIG_CPU_ADVANCED is not set 122# CONFIG_CPU_ADVANCED is not set
192CONFIG_CPU_HAS_LLSC=y 123CONFIG_CPU_HAS_LLSC=y
193CONFIG_CPU_HAS_LLDSCD=y
194CONFIG_CPU_HAS_SYNC=y 124CONFIG_CPU_HAS_SYNC=y
195CONFIG_GENERIC_HARDIRQS=y 125CONFIG_GENERIC_HARDIRQS=y
196CONFIG_GENERIC_IRQ_PROBE=y 126CONFIG_GENERIC_IRQ_PROBE=y
@@ -208,6 +138,75 @@ CONFIG_PREEMPT_NONE=y
208# CONFIG_PREEMPT is not set 138# CONFIG_PREEMPT is not set
209 139
210# 140#
141# Code maturity level options
142#
143CONFIG_EXPERIMENTAL=y
144CONFIG_CLEAN_COMPILE=y
145CONFIG_BROKEN_ON_SMP=y
146CONFIG_INIT_ENV_ARG_LIMIT=32
147
148#
149# General setup
150#
151CONFIG_LOCALVERSION=""
152CONFIG_LOCALVERSION_AUTO=y
153CONFIG_SWAP=y
154CONFIG_SYSVIPC=y
155# CONFIG_POSIX_MQUEUE is not set
156# CONFIG_BSD_PROCESS_ACCT is not set
157CONFIG_SYSCTL=y
158# CONFIG_AUDIT is not set
159CONFIG_HOTPLUG=y
160CONFIG_KOBJECT_UEVENT=y
161# CONFIG_IKCONFIG is not set
162CONFIG_INITRAMFS_SOURCE=""
163CONFIG_EMBEDDED=y
164CONFIG_KALLSYMS=y
165# CONFIG_KALLSYMS_EXTRA_PASS is not set
166CONFIG_PRINTK=y
167CONFIG_BUG=y
168CONFIG_BASE_FULL=y
169CONFIG_FUTEX=y
170CONFIG_EPOLL=y
171# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
172CONFIG_SHMEM=y
173CONFIG_CC_ALIGN_FUNCTIONS=0
174CONFIG_CC_ALIGN_LABELS=0
175CONFIG_CC_ALIGN_LOOPS=0
176CONFIG_CC_ALIGN_JUMPS=0
177# CONFIG_TINY_SHMEM is not set
178CONFIG_BASE_SMALL=0
179
180#
181# Loadable module support
182#
183CONFIG_MODULES=y
184CONFIG_MODULE_UNLOAD=y
185# CONFIG_MODULE_FORCE_UNLOAD is not set
186CONFIG_OBSOLETE_MODPARM=y
187CONFIG_MODVERSIONS=y
188CONFIG_MODULE_SRCVERSION_ALL=y
189CONFIG_KMOD=y
190
191#
192# Block layer
193#
194# CONFIG_LBD is not set
195
196#
197# IO Schedulers
198#
199CONFIG_IOSCHED_NOOP=y
200CONFIG_IOSCHED_AS=y
201CONFIG_IOSCHED_DEADLINE=y
202CONFIG_IOSCHED_CFQ=y
203CONFIG_DEFAULT_AS=y
204# CONFIG_DEFAULT_DEADLINE is not set
205# CONFIG_DEFAULT_CFQ is not set
206# CONFIG_DEFAULT_NOOP is not set
207CONFIG_DEFAULT_IOSCHED="anticipatory"
208
209#
211# Bus options (PCI, PCMCIA, EISA, ISA, TC) 210# Bus options (PCI, PCMCIA, EISA, ISA, TC)
212# 211#
213CONFIG_HW_HAS_PCI=y 212CONFIG_HW_HAS_PCI=y
@@ -291,7 +290,6 @@ CONFIG_TCP_CONG_BIC=y
291# QoS and/or fair queueing 290# QoS and/or fair queueing
292# 291#
293# CONFIG_NET_SCHED is not set 292# CONFIG_NET_SCHED is not set
294# CONFIG_NET_CLS_ROUTE is not set
295 293
296# 294#
297# Network testing 295# Network testing
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index e48e1de442b4..da0677a03c1d 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc5
4# Thu Nov 10 13:42:55 2005 4# Fri Dec 23 02:21:03 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -156,8 +87,8 @@ CONFIG_HAVE_STD_PC_SERIAL_PORT=y
156# 87#
157# CPU selection 88# CPU selection
158# 89#
159CONFIG_CPU_MIPS32_R1=y 90# CONFIG_CPU_MIPS32_R1 is not set
160# CONFIG_CPU_MIPS32_R2 is not set 91CONFIG_CPU_MIPS32_R2=y
161# CONFIG_CPU_MIPS64_R1 is not set 92# CONFIG_CPU_MIPS64_R1 is not set
162# CONFIG_CPU_MIPS64_R2 is not set 93# CONFIG_CPU_MIPS64_R2 is not set
163# CONFIG_CPU_R3000 is not set 94# CONFIG_CPU_R3000 is not set
@@ -181,7 +112,7 @@ CONFIG_SYS_HAS_CPU_MIPS64_R1=y
181CONFIG_SYS_HAS_CPU_NEVADA=y 112CONFIG_SYS_HAS_CPU_NEVADA=y
182CONFIG_SYS_HAS_CPU_RM7000=y 113CONFIG_SYS_HAS_CPU_RM7000=y
183CONFIG_CPU_MIPS32=y 114CONFIG_CPU_MIPS32=y
184CONFIG_CPU_MIPSR1=y 115CONFIG_CPU_MIPSR2=y
185CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y 116CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
186CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y 117CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
187CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y 118CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
@@ -221,6 +152,75 @@ CONFIG_PREEMPT_NONE=y
221# CONFIG_PREEMPT is not set 152# CONFIG_PREEMPT is not set
222 153
223# 154#
155# Code maturity level options
156#
157CONFIG_EXPERIMENTAL=y
158CONFIG_CLEAN_COMPILE=y
159CONFIG_BROKEN_ON_SMP=y
160CONFIG_INIT_ENV_ARG_LIMIT=32
161
162#
163# General setup
164#
165CONFIG_LOCALVERSION=""
166CONFIG_LOCALVERSION_AUTO=y
167CONFIG_SWAP=y
168CONFIG_SYSVIPC=y
169# CONFIG_POSIX_MQUEUE is not set
170# CONFIG_BSD_PROCESS_ACCT is not set
171CONFIG_SYSCTL=y
172# CONFIG_AUDIT is not set
173CONFIG_HOTPLUG=y
174CONFIG_KOBJECT_UEVENT=y
175# CONFIG_IKCONFIG is not set
176CONFIG_INITRAMFS_SOURCE=""
177CONFIG_EMBEDDED=y
178CONFIG_KALLSYMS=y
179# CONFIG_KALLSYMS_EXTRA_PASS is not set
180CONFIG_PRINTK=y
181CONFIG_BUG=y
182CONFIG_BASE_FULL=y
183CONFIG_FUTEX=y
184CONFIG_EPOLL=y
185# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
186CONFIG_SHMEM=y
187CONFIG_CC_ALIGN_FUNCTIONS=0
188CONFIG_CC_ALIGN_LABELS=0
189CONFIG_CC_ALIGN_LOOPS=0
190CONFIG_CC_ALIGN_JUMPS=0
191# CONFIG_TINY_SHMEM is not set
192CONFIG_BASE_SMALL=0
193
194#
195# Loadable module support
196#
197CONFIG_MODULES=y
198CONFIG_MODULE_UNLOAD=y
199# CONFIG_MODULE_FORCE_UNLOAD is not set
200CONFIG_OBSOLETE_MODPARM=y
201CONFIG_MODVERSIONS=y
202CONFIG_MODULE_SRCVERSION_ALL=y
203CONFIG_KMOD=y
204
205#
206# Block layer
207#
208# CONFIG_LBD is not set
209
210#
211# IO Schedulers
212#
213CONFIG_IOSCHED_NOOP=y
214CONFIG_IOSCHED_AS=y
215CONFIG_IOSCHED_DEADLINE=y
216CONFIG_IOSCHED_CFQ=y
217CONFIG_DEFAULT_AS=y
218# CONFIG_DEFAULT_DEADLINE is not set
219# CONFIG_DEFAULT_CFQ is not set
220# CONFIG_DEFAULT_NOOP is not set
221CONFIG_DEFAULT_IOSCHED="anticipatory"
222
223#
224# Bus options (PCI, PCMCIA, EISA, ISA, TC) 224# Bus options (PCI, PCMCIA, EISA, ISA, TC)
225# 225#
226CONFIG_HW_HAS_PCI=y 226CONFIG_HW_HAS_PCI=y
diff --git a/arch/mips/configs/mipssim_defconfig b/arch/mips/configs/mipssim_defconfig
index 04abd1b3202b..ac39ab7feeb7 100644
--- a/arch/mips/configs/mipssim_defconfig
+++ b/arch/mips/configs/mipssim_defconfig
@@ -1,81 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:05:55 2005 4# Thu Nov 24 01:06:37 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_ALL is not set
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y
54# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y
57CONFIG_MODULE_SRCVERSION_ALL=y
58CONFIG_KMOD=y
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Machine selection 9# Machine selection
80# 10#
81# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -208,6 +138,76 @@ CONFIG_PREEMPT_NONE=y
208# CONFIG_PREEMPT is not set 138# CONFIG_PREEMPT is not set
209 139
210# 140#
141# Code maturity level options
142#
143CONFIG_EXPERIMENTAL=y
144CONFIG_CLEAN_COMPILE=y
145CONFIG_BROKEN_ON_SMP=y
146CONFIG_INIT_ENV_ARG_LIMIT=32
147
148#
149# General setup
150#
151CONFIG_LOCALVERSION=""
152CONFIG_LOCALVERSION_AUTO=y
153CONFIG_SWAP=y
154CONFIG_SYSVIPC=y
155# CONFIG_POSIX_MQUEUE is not set
156# CONFIG_BSD_PROCESS_ACCT is not set
157CONFIG_SYSCTL=y
158# CONFIG_AUDIT is not set
159CONFIG_HOTPLUG=y
160CONFIG_KOBJECT_UEVENT=y
161# CONFIG_IKCONFIG is not set
162CONFIG_INITRAMFS_SOURCE=""
163CONFIG_EMBEDDED=y
164CONFIG_KALLSYMS=y
165# CONFIG_KALLSYMS_ALL is not set
166# CONFIG_KALLSYMS_EXTRA_PASS is not set
167CONFIG_PRINTK=y
168CONFIG_BUG=y
169CONFIG_BASE_FULL=y
170CONFIG_FUTEX=y
171CONFIG_EPOLL=y
172# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
173CONFIG_SHMEM=y
174CONFIG_CC_ALIGN_FUNCTIONS=0
175CONFIG_CC_ALIGN_LABELS=0
176CONFIG_CC_ALIGN_LOOPS=0
177CONFIG_CC_ALIGN_JUMPS=0
178# CONFIG_TINY_SHMEM is not set
179CONFIG_BASE_SMALL=0
180
181#
182# Loadable module support
183#
184CONFIG_MODULES=y
185CONFIG_MODULE_UNLOAD=y
186# CONFIG_MODULE_FORCE_UNLOAD is not set
187CONFIG_OBSOLETE_MODPARM=y
188CONFIG_MODVERSIONS=y
189CONFIG_MODULE_SRCVERSION_ALL=y
190CONFIG_KMOD=y
191
192#
193# Block layer
194#
195# CONFIG_LBD is not set
196
197#
198# IO Schedulers
199#
200CONFIG_IOSCHED_NOOP=y
201CONFIG_IOSCHED_AS=y
202CONFIG_IOSCHED_DEADLINE=y
203CONFIG_IOSCHED_CFQ=y
204CONFIG_DEFAULT_AS=y
205# CONFIG_DEFAULT_DEADLINE is not set
206# CONFIG_DEFAULT_CFQ is not set
207# CONFIG_DEFAULT_NOOP is not set
208CONFIG_DEFAULT_IOSCHED="anticipatory"
209
210#
211# Bus options (PCI, PCMCIA, EISA, ISA, TC) 211# Bus options (PCI, PCMCIA, EISA, ISA, TC)
212# 212#
213CONFIG_MMU=y 213CONFIG_MMU=y
@@ -558,6 +558,7 @@ CONFIG_LEGACY_PTY_COUNT=256
558# 558#
559# TPM devices 559# TPM devices
560# 560#
561# CONFIG_TCG_TPM is not set
561# CONFIG_TELCLOCK is not set 562# CONFIG_TELCLOCK is not set
562 563
563# 564#
diff --git a/arch/mips/configs/mpc30x_defconfig b/arch/mips/configs/mpc30x_defconfig
index 46814be0ac38..2b5ea37484e4 100644
--- a/arch/mips/configs/mpc30x_defconfig
+++ b/arch/mips/configs/mpc30x_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.15-rc2
4# Tue Nov 15 11:12:01 2005 4# Thu Nov 24 01:06:39 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -206,6 +137,75 @@ CONFIG_PREEMPT_NONE=y
206# CONFIG_PREEMPT is not set 137# CONFIG_PREEMPT is not set
207 138
208# 139#
140# Code maturity level options
141#
142CONFIG_EXPERIMENTAL=y
143CONFIG_CLEAN_COMPILE=y
144CONFIG_BROKEN_ON_SMP=y
145CONFIG_INIT_ENV_ARG_LIMIT=32
146
147#
148# General setup
149#
150CONFIG_LOCALVERSION=""
151CONFIG_LOCALVERSION_AUTO=y
152CONFIG_SWAP=y
153CONFIG_SYSVIPC=y
154# CONFIG_POSIX_MQUEUE is not set
155# CONFIG_BSD_PROCESS_ACCT is not set
156CONFIG_SYSCTL=y
157# CONFIG_AUDIT is not set
158CONFIG_HOTPLUG=y
159CONFIG_KOBJECT_UEVENT=y
160# CONFIG_IKCONFIG is not set
161CONFIG_INITRAMFS_SOURCE=""
162CONFIG_EMBEDDED=y
163CONFIG_KALLSYMS=y
164# CONFIG_KALLSYMS_EXTRA_PASS is not set
165CONFIG_PRINTK=y
166CONFIG_BUG=y
167CONFIG_BASE_FULL=y
168CONFIG_FUTEX=y
169CONFIG_EPOLL=y
170# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
171CONFIG_SHMEM=y
172CONFIG_CC_ALIGN_FUNCTIONS=0
173CONFIG_CC_ALIGN_LABELS=0
174CONFIG_CC_ALIGN_LOOPS=0
175CONFIG_CC_ALIGN_JUMPS=0
176# CONFIG_TINY_SHMEM is not set
177CONFIG_BASE_SMALL=0
178
179#
180# Loadable module support
181#
182CONFIG_MODULES=y
183CONFIG_MODULE_UNLOAD=y
184# CONFIG_MODULE_FORCE_UNLOAD is not set
185CONFIG_OBSOLETE_MODPARM=y
186CONFIG_MODVERSIONS=y
187CONFIG_MODULE_SRCVERSION_ALL=y
188CONFIG_KMOD=y
189
190#
191# Block layer
192#
193# CONFIG_LBD is not set
194
195#
196# IO Schedulers
197#
198CONFIG_IOSCHED_NOOP=y
199CONFIG_IOSCHED_AS=y
200CONFIG_IOSCHED_DEADLINE=y
201CONFIG_IOSCHED_CFQ=y
202CONFIG_DEFAULT_AS=y
203# CONFIG_DEFAULT_DEADLINE is not set
204# CONFIG_DEFAULT_CFQ is not set
205# CONFIG_DEFAULT_NOOP is not set
206CONFIG_DEFAULT_IOSCHED="anticipatory"
207
208#
209# Bus options (PCI, PCMCIA, EISA, ISA, TC) 209# Bus options (PCI, PCMCIA, EISA, ISA, TC)
210# 210#
211CONFIG_HW_HAS_PCI=y 211CONFIG_HW_HAS_PCI=y
@@ -304,7 +304,6 @@ CONFIG_TCP_CONG_BIC=y
304# QoS and/or fair queueing 304# QoS and/or fair queueing
305# 305#
306# CONFIG_NET_SCHED is not set 306# CONFIG_NET_SCHED is not set
307# CONFIG_NET_CLS_ROUTE is not set
308 307
309# 308#
310# Network testing 309# Network testing
diff --git a/arch/mips/configs/ocelot_3_defconfig b/arch/mips/configs/ocelot_3_defconfig
index e12118c30db4..7ad8718c1b69 100644
--- a/arch/mips/configs/ocelot_3_defconfig
+++ b/arch/mips/configs/ocelot_3_defconfig
@@ -1,81 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Thu Nov 10 14:01:36 2005 4# Thu Nov 24 01:06:41 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y
54# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y
57# CONFIG_MODULE_SRCVERSION_ALL is not set
58CONFIG_KMOD=y
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Machine selection 9# Machine selection
80# 10#
81# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -192,7 +122,6 @@ CONFIG_CPU_HAS_PREFETCH=y
192# CONFIG_64BIT_PHYS_ADDR is not set 122# CONFIG_64BIT_PHYS_ADDR is not set
193# CONFIG_CPU_ADVANCED is not set 123# CONFIG_CPU_ADVANCED is not set
194CONFIG_CPU_HAS_LLSC=y 124CONFIG_CPU_HAS_LLSC=y
195CONFIG_CPU_HAS_LLDSCD=y
196CONFIG_CPU_HAS_SYNC=y 125CONFIG_CPU_HAS_SYNC=y
197CONFIG_GENERIC_HARDIRQS=y 126CONFIG_GENERIC_HARDIRQS=y
198CONFIG_GENERIC_IRQ_PROBE=y 127CONFIG_GENERIC_IRQ_PROBE=y
@@ -212,6 +141,76 @@ CONFIG_PREEMPT_NONE=y
212# CONFIG_PREEMPT is not set 141# CONFIG_PREEMPT is not set
213 142
214# 143#
144# Code maturity level options
145#
146CONFIG_EXPERIMENTAL=y
147CONFIG_CLEAN_COMPILE=y
148CONFIG_BROKEN_ON_SMP=y
149CONFIG_INIT_ENV_ARG_LIMIT=32
150
151#
152# General setup
153#
154CONFIG_LOCALVERSION=""
155CONFIG_LOCALVERSION_AUTO=y
156CONFIG_SWAP=y
157CONFIG_SYSVIPC=y
158# CONFIG_POSIX_MQUEUE is not set
159# CONFIG_BSD_PROCESS_ACCT is not set
160CONFIG_SYSCTL=y
161# CONFIG_AUDIT is not set
162CONFIG_HOTPLUG=y
163CONFIG_KOBJECT_UEVENT=y
164CONFIG_IKCONFIG=y
165CONFIG_IKCONFIG_PROC=y
166CONFIG_INITRAMFS_SOURCE=""
167CONFIG_EMBEDDED=y
168CONFIG_KALLSYMS=y
169# CONFIG_KALLSYMS_EXTRA_PASS is not set
170CONFIG_PRINTK=y
171CONFIG_BUG=y
172CONFIG_BASE_FULL=y
173CONFIG_FUTEX=y
174CONFIG_EPOLL=y
175# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
176CONFIG_SHMEM=y
177CONFIG_CC_ALIGN_FUNCTIONS=0
178CONFIG_CC_ALIGN_LABELS=0
179CONFIG_CC_ALIGN_LOOPS=0
180CONFIG_CC_ALIGN_JUMPS=0
181# CONFIG_TINY_SHMEM is not set
182CONFIG_BASE_SMALL=0
183
184#
185# Loadable module support
186#
187CONFIG_MODULES=y
188CONFIG_MODULE_UNLOAD=y
189# CONFIG_MODULE_FORCE_UNLOAD is not set
190CONFIG_OBSOLETE_MODPARM=y
191CONFIG_MODVERSIONS=y
192# CONFIG_MODULE_SRCVERSION_ALL is not set
193CONFIG_KMOD=y
194
195#
196# Block layer
197#
198# CONFIG_LBD is not set
199
200#
201# IO Schedulers
202#
203CONFIG_IOSCHED_NOOP=y
204CONFIG_IOSCHED_AS=y
205CONFIG_IOSCHED_DEADLINE=y
206CONFIG_IOSCHED_CFQ=y
207CONFIG_DEFAULT_AS=y
208# CONFIG_DEFAULT_DEADLINE is not set
209# CONFIG_DEFAULT_CFQ is not set
210# CONFIG_DEFAULT_NOOP is not set
211CONFIG_DEFAULT_IOSCHED="anticipatory"
212
213#
215# Bus options (PCI, PCMCIA, EISA, ISA, TC) 214# Bus options (PCI, PCMCIA, EISA, ISA, TC)
216# 215#
217CONFIG_HW_HAS_PCI=y 216CONFIG_HW_HAS_PCI=y
@@ -333,7 +332,6 @@ CONFIG_NETFILTER_NETLINK_LOG=m
333# QoS and/or fair queueing 332# QoS and/or fair queueing
334# 333#
335# CONFIG_NET_SCHED is not set 334# CONFIG_NET_SCHED is not set
336# CONFIG_NET_CLS_ROUTE is not set
337 335
338# 336#
339# Network testing 337# Network testing
diff --git a/arch/mips/configs/ocelot_c_defconfig b/arch/mips/configs/ocelot_c_defconfig
index 99f0c980aee7..e8d6bb3551a2 100644
--- a/arch/mips/configs/ocelot_c_defconfig
+++ b/arch/mips/configs/ocelot_c_defconfig
@@ -1,73 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:06:05 2005 4# Thu Nov 24 01:06:43 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Block layer
55#
56
57#
58# IO Schedulers
59#
60CONFIG_IOSCHED_NOOP=y
61CONFIG_IOSCHED_AS=y
62CONFIG_IOSCHED_DEADLINE=y
63CONFIG_IOSCHED_CFQ=y
64CONFIG_DEFAULT_AS=y
65# CONFIG_DEFAULT_DEADLINE is not set
66# CONFIG_DEFAULT_CFQ is not set
67# CONFIG_DEFAULT_NOOP is not set
68CONFIG_DEFAULT_IOSCHED="anticipatory"
69
70#
71# Machine selection 9# Machine selection
72# 10#
73# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -180,7 +118,6 @@ CONFIG_RM7000_CPU_SCACHE=y
180CONFIG_CPU_HAS_PREFETCH=y 118CONFIG_CPU_HAS_PREFETCH=y
181# CONFIG_MIPS_MT is not set 119# CONFIG_MIPS_MT is not set
182CONFIG_CPU_HAS_LLSC=y 120CONFIG_CPU_HAS_LLSC=y
183CONFIG_CPU_HAS_LLDSCD=y
184CONFIG_CPU_HAS_SYNC=y 121CONFIG_CPU_HAS_SYNC=y
185CONFIG_GENERIC_HARDIRQS=y 122CONFIG_GENERIC_HARDIRQS=y
186CONFIG_GENERIC_IRQ_PROBE=y 123CONFIG_GENERIC_IRQ_PROBE=y
@@ -199,6 +136,68 @@ CONFIG_PREEMPT_NONE=y
199# CONFIG_PREEMPT is not set 136# CONFIG_PREEMPT is not set
200 137
201# 138#
139# Code maturity level options
140#
141CONFIG_EXPERIMENTAL=y
142CONFIG_CLEAN_COMPILE=y
143CONFIG_BROKEN_ON_SMP=y
144CONFIG_INIT_ENV_ARG_LIMIT=32
145
146#
147# General setup
148#
149CONFIG_LOCALVERSION=""
150CONFIG_LOCALVERSION_AUTO=y
151CONFIG_SWAP=y
152CONFIG_SYSVIPC=y
153# CONFIG_POSIX_MQUEUE is not set
154# CONFIG_BSD_PROCESS_ACCT is not set
155CONFIG_SYSCTL=y
156# CONFIG_AUDIT is not set
157CONFIG_HOTPLUG=y
158CONFIG_KOBJECT_UEVENT=y
159# CONFIG_IKCONFIG is not set
160CONFIG_INITRAMFS_SOURCE=""
161CONFIG_EMBEDDED=y
162CONFIG_KALLSYMS=y
163# CONFIG_KALLSYMS_EXTRA_PASS is not set
164CONFIG_PRINTK=y
165CONFIG_BUG=y
166CONFIG_BASE_FULL=y
167CONFIG_FUTEX=y
168CONFIG_EPOLL=y
169# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
170CONFIG_SHMEM=y
171CONFIG_CC_ALIGN_FUNCTIONS=0
172CONFIG_CC_ALIGN_LABELS=0
173CONFIG_CC_ALIGN_LOOPS=0
174CONFIG_CC_ALIGN_JUMPS=0
175# CONFIG_TINY_SHMEM is not set
176CONFIG_BASE_SMALL=0
177
178#
179# Loadable module support
180#
181# CONFIG_MODULES is not set
182
183#
184# Block layer
185#
186
187#
188# IO Schedulers
189#
190CONFIG_IOSCHED_NOOP=y
191CONFIG_IOSCHED_AS=y
192CONFIG_IOSCHED_DEADLINE=y
193CONFIG_IOSCHED_CFQ=y
194CONFIG_DEFAULT_AS=y
195# CONFIG_DEFAULT_DEADLINE is not set
196# CONFIG_DEFAULT_CFQ is not set
197# CONFIG_DEFAULT_NOOP is not set
198CONFIG_DEFAULT_IOSCHED="anticipatory"
199
200#
202# Bus options (PCI, PCMCIA, EISA, ISA, TC) 201# Bus options (PCI, PCMCIA, EISA, ISA, TC)
203# 202#
204CONFIG_HW_HAS_PCI=y 203CONFIG_HW_HAS_PCI=y
@@ -290,7 +289,6 @@ CONFIG_TCP_CONG_BIC=y
290# QoS and/or fair queueing 289# QoS and/or fair queueing
291# 290#
292# CONFIG_NET_SCHED is not set 291# CONFIG_NET_SCHED is not set
293# CONFIG_NET_CLS_ROUTE is not set
294 292
295# 293#
296# Network testing 294# Network testing
diff --git a/arch/mips/configs/ocelot_defconfig b/arch/mips/configs/ocelot_defconfig
index 11c7d74ee1e5..f3787b68bdd1 100644
--- a/arch/mips/configs/ocelot_defconfig
+++ b/arch/mips/configs/ocelot_defconfig
@@ -1,74 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:06:08 2005 4# Thu Nov 24 01:06:44 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27# CONFIG_HOTPLUG is not set
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Block layer
55#
56# CONFIG_LBD is not set
57
58#
59# IO Schedulers
60#
61CONFIG_IOSCHED_NOOP=y
62CONFIG_IOSCHED_AS=y
63CONFIG_IOSCHED_DEADLINE=y
64CONFIG_IOSCHED_CFQ=y
65CONFIG_DEFAULT_AS=y
66# CONFIG_DEFAULT_DEADLINE is not set
67# CONFIG_DEFAULT_CFQ is not set
68# CONFIG_DEFAULT_NOOP is not set
69CONFIG_DEFAULT_IOSCHED="anticipatory"
70
71#
72# Machine selection 9# Machine selection
73# 10#
74# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -186,7 +123,6 @@ CONFIG_CPU_HAS_PREFETCH=y
186# CONFIG_64BIT_PHYS_ADDR is not set 123# CONFIG_64BIT_PHYS_ADDR is not set
187# CONFIG_CPU_ADVANCED is not set 124# CONFIG_CPU_ADVANCED is not set
188CONFIG_CPU_HAS_LLSC=y 125CONFIG_CPU_HAS_LLSC=y
189CONFIG_CPU_HAS_LLDSCD=y
190CONFIG_CPU_HAS_SYNC=y 126CONFIG_CPU_HAS_SYNC=y
191CONFIG_GENERIC_HARDIRQS=y 127CONFIG_GENERIC_HARDIRQS=y
192CONFIG_GENERIC_IRQ_PROBE=y 128CONFIG_GENERIC_IRQ_PROBE=y
@@ -205,6 +141,69 @@ CONFIG_PREEMPT_NONE=y
205# CONFIG_PREEMPT is not set 141# CONFIG_PREEMPT is not set
206 142
207# 143#
144# Code maturity level options
145#
146CONFIG_EXPERIMENTAL=y
147CONFIG_CLEAN_COMPILE=y
148CONFIG_BROKEN_ON_SMP=y
149CONFIG_INIT_ENV_ARG_LIMIT=32
150
151#
152# General setup
153#
154CONFIG_LOCALVERSION=""
155CONFIG_LOCALVERSION_AUTO=y
156CONFIG_SWAP=y
157CONFIG_SYSVIPC=y
158# CONFIG_POSIX_MQUEUE is not set
159# CONFIG_BSD_PROCESS_ACCT is not set
160CONFIG_SYSCTL=y
161# CONFIG_AUDIT is not set
162# CONFIG_HOTPLUG is not set
163CONFIG_KOBJECT_UEVENT=y
164# CONFIG_IKCONFIG is not set
165CONFIG_INITRAMFS_SOURCE=""
166CONFIG_EMBEDDED=y
167CONFIG_KALLSYMS=y
168# CONFIG_KALLSYMS_EXTRA_PASS is not set
169CONFIG_PRINTK=y
170CONFIG_BUG=y
171CONFIG_BASE_FULL=y
172CONFIG_FUTEX=y
173CONFIG_EPOLL=y
174# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
175CONFIG_SHMEM=y
176CONFIG_CC_ALIGN_FUNCTIONS=0
177CONFIG_CC_ALIGN_LABELS=0
178CONFIG_CC_ALIGN_LOOPS=0
179CONFIG_CC_ALIGN_JUMPS=0
180# CONFIG_TINY_SHMEM is not set
181CONFIG_BASE_SMALL=0
182
183#
184# Loadable module support
185#
186# CONFIG_MODULES is not set
187
188#
189# Block layer
190#
191# CONFIG_LBD is not set
192
193#
194# IO Schedulers
195#
196CONFIG_IOSCHED_NOOP=y
197CONFIG_IOSCHED_AS=y
198CONFIG_IOSCHED_DEADLINE=y
199CONFIG_IOSCHED_CFQ=y
200CONFIG_DEFAULT_AS=y
201# CONFIG_DEFAULT_DEADLINE is not set
202# CONFIG_DEFAULT_CFQ is not set
203# CONFIG_DEFAULT_NOOP is not set
204CONFIG_DEFAULT_IOSCHED="anticipatory"
205
206#
208# Bus options (PCI, PCMCIA, EISA, ISA, TC) 207# Bus options (PCI, PCMCIA, EISA, ISA, TC)
209# 208#
210CONFIG_HW_HAS_PCI=y 209CONFIG_HW_HAS_PCI=y
@@ -289,7 +288,6 @@ CONFIG_TCP_CONG_BIC=y
289# QoS and/or fair queueing 288# QoS and/or fair queueing
290# 289#
291# CONFIG_NET_SCHED is not set 290# CONFIG_NET_SCHED is not set
292# CONFIG_NET_CLS_ROUTE is not set
293 291
294# 292#
295# Network testing 293# Network testing
@@ -527,6 +525,7 @@ CONFIG_LEGACY_PTY_COUNT=256
527# 525#
528# TPM devices 526# TPM devices
529# 527#
528# CONFIG_TCG_TPM is not set
530# CONFIG_TELCLOCK is not set 529# CONFIG_TELCLOCK is not set
531 530
532# 531#
diff --git a/arch/mips/configs/ocelot_g_defconfig b/arch/mips/configs/ocelot_g_defconfig
index 9ced1a9029d4..b6126ad4d06d 100644
--- a/arch/mips/configs/ocelot_g_defconfig
+++ b/arch/mips/configs/ocelot_g_defconfig
@@ -1,73 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:06:11 2005 4# Thu Nov 24 01:06:46 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51# CONFIG_MODULES is not set
52
53#
54# Block layer
55#
56
57#
58# IO Schedulers
59#
60CONFIG_IOSCHED_NOOP=y
61CONFIG_IOSCHED_AS=y
62CONFIG_IOSCHED_DEADLINE=y
63CONFIG_IOSCHED_CFQ=y
64CONFIG_DEFAULT_AS=y
65# CONFIG_DEFAULT_DEADLINE is not set
66# CONFIG_DEFAULT_CFQ is not set
67# CONFIG_DEFAULT_NOOP is not set
68CONFIG_DEFAULT_IOSCHED="anticipatory"
69
70#
71# Machine selection 9# Machine selection
72# 10#
73# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -183,7 +121,6 @@ CONFIG_RM7000_CPU_SCACHE=y
183CONFIG_CPU_HAS_PREFETCH=y 121CONFIG_CPU_HAS_PREFETCH=y
184# CONFIG_MIPS_MT is not set 122# CONFIG_MIPS_MT is not set
185CONFIG_CPU_HAS_LLSC=y 123CONFIG_CPU_HAS_LLSC=y
186CONFIG_CPU_HAS_LLDSCD=y
187CONFIG_CPU_HAS_SYNC=y 124CONFIG_CPU_HAS_SYNC=y
188CONFIG_GENERIC_HARDIRQS=y 125CONFIG_GENERIC_HARDIRQS=y
189CONFIG_GENERIC_IRQ_PROBE=y 126CONFIG_GENERIC_IRQ_PROBE=y
@@ -202,6 +139,68 @@ CONFIG_PREEMPT_NONE=y
202# CONFIG_PREEMPT is not set 139# CONFIG_PREEMPT is not set
203 140
204# 141#
142# Code maturity level options
143#
144CONFIG_EXPERIMENTAL=y
145CONFIG_CLEAN_COMPILE=y
146CONFIG_BROKEN_ON_SMP=y
147CONFIG_INIT_ENV_ARG_LIMIT=32
148
149#
150# General setup
151#
152CONFIG_LOCALVERSION=""
153CONFIG_LOCALVERSION_AUTO=y
154CONFIG_SWAP=y
155CONFIG_SYSVIPC=y
156# CONFIG_POSIX_MQUEUE is not set
157# CONFIG_BSD_PROCESS_ACCT is not set
158CONFIG_SYSCTL=y
159# CONFIG_AUDIT is not set
160CONFIG_HOTPLUG=y
161CONFIG_KOBJECT_UEVENT=y
162# CONFIG_IKCONFIG is not set
163CONFIG_INITRAMFS_SOURCE=""
164CONFIG_EMBEDDED=y
165CONFIG_KALLSYMS=y
166# CONFIG_KALLSYMS_EXTRA_PASS is not set
167CONFIG_PRINTK=y
168CONFIG_BUG=y
169CONFIG_BASE_FULL=y
170CONFIG_FUTEX=y
171CONFIG_EPOLL=y
172# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
173CONFIG_SHMEM=y
174CONFIG_CC_ALIGN_FUNCTIONS=0
175CONFIG_CC_ALIGN_LABELS=0
176CONFIG_CC_ALIGN_LOOPS=0
177CONFIG_CC_ALIGN_JUMPS=0
178# CONFIG_TINY_SHMEM is not set
179CONFIG_BASE_SMALL=0
180
181#
182# Loadable module support
183#
184# CONFIG_MODULES is not set
185
186#
187# Block layer
188#
189
190#
191# IO Schedulers
192#
193CONFIG_IOSCHED_NOOP=y
194CONFIG_IOSCHED_AS=y
195CONFIG_IOSCHED_DEADLINE=y
196CONFIG_IOSCHED_CFQ=y
197CONFIG_DEFAULT_AS=y
198# CONFIG_DEFAULT_DEADLINE is not set
199# CONFIG_DEFAULT_CFQ is not set
200# CONFIG_DEFAULT_NOOP is not set
201CONFIG_DEFAULT_IOSCHED="anticipatory"
202
203#
205# Bus options (PCI, PCMCIA, EISA, ISA, TC) 204# Bus options (PCI, PCMCIA, EISA, ISA, TC)
206# 205#
207CONFIG_HW_HAS_PCI=y 206CONFIG_HW_HAS_PCI=y
@@ -293,7 +292,6 @@ CONFIG_TCP_CONG_BIC=y
293# QoS and/or fair queueing 292# QoS and/or fair queueing
294# 293#
295# CONFIG_NET_SCHED is not set 294# CONFIG_NET_SCHED is not set
296# CONFIG_NET_CLS_ROUTE is not set
297 295
298# 296#
299# Network testing 297# Network testing
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
index dbcaa77add7c..883626afc47d 100644
--- a/arch/mips/configs/pb1100_defconfig
+++ b/arch/mips/configs/pb1100_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.15-rc2
4# Tue Nov 15 11:12:31 2005 4# Thu Nov 24 01:06:48 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -204,6 +135,75 @@ CONFIG_PREEMPT_NONE=y
204# CONFIG_PREEMPT is not set 135# CONFIG_PREEMPT is not set
205 136
206# 137#
138# Code maturity level options
139#
140CONFIG_EXPERIMENTAL=y
141CONFIG_CLEAN_COMPILE=y
142CONFIG_BROKEN_ON_SMP=y
143CONFIG_INIT_ENV_ARG_LIMIT=32
144
145#
146# General setup
147#
148CONFIG_LOCALVERSION=""
149CONFIG_LOCALVERSION_AUTO=y
150CONFIG_SWAP=y
151CONFIG_SYSVIPC=y
152# CONFIG_POSIX_MQUEUE is not set
153# CONFIG_BSD_PROCESS_ACCT is not set
154CONFIG_SYSCTL=y
155# CONFIG_AUDIT is not set
156CONFIG_HOTPLUG=y
157CONFIG_KOBJECT_UEVENT=y
158# CONFIG_IKCONFIG is not set
159CONFIG_INITRAMFS_SOURCE=""
160CONFIG_EMBEDDED=y
161CONFIG_KALLSYMS=y
162# CONFIG_KALLSYMS_EXTRA_PASS is not set
163CONFIG_PRINTK=y
164CONFIG_BUG=y
165CONFIG_BASE_FULL=y
166CONFIG_FUTEX=y
167CONFIG_EPOLL=y
168# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
169CONFIG_SHMEM=y
170CONFIG_CC_ALIGN_FUNCTIONS=0
171CONFIG_CC_ALIGN_LABELS=0
172CONFIG_CC_ALIGN_LOOPS=0
173CONFIG_CC_ALIGN_JUMPS=0
174# CONFIG_TINY_SHMEM is not set
175CONFIG_BASE_SMALL=0
176
177#
178# Loadable module support
179#
180CONFIG_MODULES=y
181CONFIG_MODULE_UNLOAD=y
182# CONFIG_MODULE_FORCE_UNLOAD is not set
183CONFIG_OBSOLETE_MODPARM=y
184CONFIG_MODVERSIONS=y
185CONFIG_MODULE_SRCVERSION_ALL=y
186CONFIG_KMOD=y
187
188#
189# Block layer
190#
191# CONFIG_LBD is not set
192
193#
194# IO Schedulers
195#
196CONFIG_IOSCHED_NOOP=y
197CONFIG_IOSCHED_AS=y
198CONFIG_IOSCHED_DEADLINE=y
199CONFIG_IOSCHED_CFQ=y
200CONFIG_DEFAULT_AS=y
201# CONFIG_DEFAULT_DEADLINE is not set
202# CONFIG_DEFAULT_CFQ is not set
203# CONFIG_DEFAULT_NOOP is not set
204CONFIG_DEFAULT_IOSCHED="anticipatory"
205
206#
207# Bus options (PCI, PCMCIA, EISA, ISA, TC) 207# Bus options (PCI, PCMCIA, EISA, ISA, TC)
208# 208#
209CONFIG_HW_HAS_PCI=y 209CONFIG_HW_HAS_PCI=y
@@ -322,7 +322,6 @@ CONFIG_NETFILTER_NETLINK_LOG=m
322# QoS and/or fair queueing 322# QoS and/or fair queueing
323# 323#
324# CONFIG_NET_SCHED is not set 324# CONFIG_NET_SCHED is not set
325# CONFIG_NET_CLS_ROUTE is not set
326 325
327# 326#
328# Network testing 327# Network testing
@@ -662,6 +661,7 @@ CONFIG_SYNCLINK_CS=m
662# 661#
663# TPM devices 662# TPM devices
664# 663#
664# CONFIG_TCG_TPM is not set
665# CONFIG_TELCLOCK is not set 665# CONFIG_TELCLOCK is not set
666 666
667# 667#
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index 5b685ceb6fde..f8fbc77f924e 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.15-rc2
4# Tue Nov 15 11:14:25 2005 4# Thu Nov 24 01:06:50 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -203,6 +134,75 @@ CONFIG_PREEMPT_NONE=y
203# CONFIG_PREEMPT is not set 134# CONFIG_PREEMPT is not set
204 135
205# 136#
137# Code maturity level options
138#
139CONFIG_EXPERIMENTAL=y
140CONFIG_CLEAN_COMPILE=y
141CONFIG_BROKEN_ON_SMP=y
142CONFIG_INIT_ENV_ARG_LIMIT=32
143
144#
145# General setup
146#
147CONFIG_LOCALVERSION=""
148CONFIG_LOCALVERSION_AUTO=y
149CONFIG_SWAP=y
150CONFIG_SYSVIPC=y
151# CONFIG_POSIX_MQUEUE is not set
152# CONFIG_BSD_PROCESS_ACCT is not set
153CONFIG_SYSCTL=y
154# CONFIG_AUDIT is not set
155CONFIG_HOTPLUG=y
156CONFIG_KOBJECT_UEVENT=y
157# CONFIG_IKCONFIG is not set
158CONFIG_INITRAMFS_SOURCE=""
159CONFIG_EMBEDDED=y
160CONFIG_KALLSYMS=y
161# CONFIG_KALLSYMS_EXTRA_PASS is not set
162CONFIG_PRINTK=y
163CONFIG_BUG=y
164CONFIG_BASE_FULL=y
165CONFIG_FUTEX=y
166CONFIG_EPOLL=y
167# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
168CONFIG_SHMEM=y
169CONFIG_CC_ALIGN_FUNCTIONS=0
170CONFIG_CC_ALIGN_LABELS=0
171CONFIG_CC_ALIGN_LOOPS=0
172CONFIG_CC_ALIGN_JUMPS=0
173# CONFIG_TINY_SHMEM is not set
174CONFIG_BASE_SMALL=0
175
176#
177# Loadable module support
178#
179CONFIG_MODULES=y
180CONFIG_MODULE_UNLOAD=y
181# CONFIG_MODULE_FORCE_UNLOAD is not set
182CONFIG_OBSOLETE_MODPARM=y
183CONFIG_MODVERSIONS=y
184CONFIG_MODULE_SRCVERSION_ALL=y
185CONFIG_KMOD=y
186
187#
188# Block layer
189#
190# CONFIG_LBD is not set
191
192#
193# IO Schedulers
194#
195CONFIG_IOSCHED_NOOP=y
196CONFIG_IOSCHED_AS=y
197CONFIG_IOSCHED_DEADLINE=y
198CONFIG_IOSCHED_CFQ=y
199CONFIG_DEFAULT_AS=y
200# CONFIG_DEFAULT_DEADLINE is not set
201# CONFIG_DEFAULT_CFQ is not set
202# CONFIG_DEFAULT_NOOP is not set
203CONFIG_DEFAULT_IOSCHED="anticipatory"
204
205#
206# Bus options (PCI, PCMCIA, EISA, ISA, TC) 206# Bus options (PCI, PCMCIA, EISA, ISA, TC)
207# 207#
208CONFIG_HW_HAS_PCI=y 208CONFIG_HW_HAS_PCI=y
@@ -328,7 +328,6 @@ CONFIG_NETFILTER_NETLINK_LOG=m
328# QoS and/or fair queueing 328# QoS and/or fair queueing
329# 329#
330# CONFIG_NET_SCHED is not set 330# CONFIG_NET_SCHED is not set
331# CONFIG_NET_CLS_ROUTE is not set
332 331
333# 332#
334# Network testing 333# Network testing
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
index f8f32e99f72d..3d694cd68d38 100644
--- a/arch/mips/configs/pb1550_defconfig
+++ b/arch/mips/configs/pb1550_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.15-rc2
4# Tue Nov 15 11:15:34 2005 4# Thu Nov 24 01:06:52 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -203,6 +134,75 @@ CONFIG_PREEMPT_NONE=y
203# CONFIG_PREEMPT is not set 134# CONFIG_PREEMPT is not set
204 135
205# 136#
137# Code maturity level options
138#
139CONFIG_EXPERIMENTAL=y
140CONFIG_CLEAN_COMPILE=y
141CONFIG_BROKEN_ON_SMP=y
142CONFIG_INIT_ENV_ARG_LIMIT=32
143
144#
145# General setup
146#
147CONFIG_LOCALVERSION=""
148CONFIG_LOCALVERSION_AUTO=y
149CONFIG_SWAP=y
150CONFIG_SYSVIPC=y
151# CONFIG_POSIX_MQUEUE is not set
152# CONFIG_BSD_PROCESS_ACCT is not set
153CONFIG_SYSCTL=y
154# CONFIG_AUDIT is not set
155CONFIG_HOTPLUG=y
156CONFIG_KOBJECT_UEVENT=y
157# CONFIG_IKCONFIG is not set
158CONFIG_INITRAMFS_SOURCE=""
159CONFIG_EMBEDDED=y
160CONFIG_KALLSYMS=y
161# CONFIG_KALLSYMS_EXTRA_PASS is not set
162CONFIG_PRINTK=y
163CONFIG_BUG=y
164CONFIG_BASE_FULL=y
165CONFIG_FUTEX=y
166CONFIG_EPOLL=y
167# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
168CONFIG_SHMEM=y
169CONFIG_CC_ALIGN_FUNCTIONS=0
170CONFIG_CC_ALIGN_LABELS=0
171CONFIG_CC_ALIGN_LOOPS=0
172CONFIG_CC_ALIGN_JUMPS=0
173# CONFIG_TINY_SHMEM is not set
174CONFIG_BASE_SMALL=0
175
176#
177# Loadable module support
178#
179CONFIG_MODULES=y
180CONFIG_MODULE_UNLOAD=y
181# CONFIG_MODULE_FORCE_UNLOAD is not set
182CONFIG_OBSOLETE_MODPARM=y
183CONFIG_MODVERSIONS=y
184CONFIG_MODULE_SRCVERSION_ALL=y
185CONFIG_KMOD=y
186
187#
188# Block layer
189#
190# CONFIG_LBD is not set
191
192#
193# IO Schedulers
194#
195CONFIG_IOSCHED_NOOP=y
196CONFIG_IOSCHED_AS=y
197CONFIG_IOSCHED_DEADLINE=y
198CONFIG_IOSCHED_CFQ=y
199CONFIG_DEFAULT_AS=y
200# CONFIG_DEFAULT_DEADLINE is not set
201# CONFIG_DEFAULT_CFQ is not set
202# CONFIG_DEFAULT_NOOP is not set
203CONFIG_DEFAULT_IOSCHED="anticipatory"
204
205#
206# Bus options (PCI, PCMCIA, EISA, ISA, TC) 206# Bus options (PCI, PCMCIA, EISA, ISA, TC)
207# 207#
208CONFIG_HW_HAS_PCI=y 208CONFIG_HW_HAS_PCI=y
@@ -328,7 +328,6 @@ CONFIG_NETFILTER_NETLINK_LOG=m
328# QoS and/or fair queueing 328# QoS and/or fair queueing
329# 329#
330# CONFIG_NET_SCHED is not set 330# CONFIG_NET_SCHED is not set
331# CONFIG_NET_CLS_ROUTE is not set
332 331
333# 332#
334# Network testing 333# Network testing
diff --git a/arch/mips/configs/pnx8550-jbs_defconfig b/arch/mips/configs/pnx8550-jbs_defconfig
index 5820e5f2295e..fba624a792a9 100644
--- a/arch/mips/configs/pnx8550-jbs_defconfig
+++ b/arch/mips/configs/pnx8550-jbs_defconfig
@@ -1,81 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:06:25 2005 4# Thu Nov 24 01:06:54 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27# CONFIG_HOTPLUG is not set
28CONFIG_KOBJECT_UEVENT=y
29CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_ALL is not set
35# CONFIG_KALLSYMS_EXTRA_PASS is not set
36CONFIG_PRINTK=y
37CONFIG_BUG=y
38CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y
40CONFIG_EPOLL=y
41# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
42CONFIG_SHMEM=y
43CONFIG_CC_ALIGN_FUNCTIONS=0
44CONFIG_CC_ALIGN_LABELS=0
45CONFIG_CC_ALIGN_LOOPS=0
46CONFIG_CC_ALIGN_JUMPS=0
47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0
49
50#
51# Loadable module support
52#
53CONFIG_MODULES=y
54# CONFIG_MODULE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56# CONFIG_MODVERSIONS is not set
57# CONFIG_MODULE_SRCVERSION_ALL is not set
58CONFIG_KMOD=y
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Machine selection 9# Machine selection
80# 10#
81# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -203,6 +133,76 @@ CONFIG_PREEMPT_NONE=y
203# CONFIG_PREEMPT is not set 133# CONFIG_PREEMPT is not set
204 134
205# 135#
136# Code maturity level options
137#
138CONFIG_EXPERIMENTAL=y
139CONFIG_CLEAN_COMPILE=y
140CONFIG_BROKEN_ON_SMP=y
141CONFIG_INIT_ENV_ARG_LIMIT=32
142
143#
144# General setup
145#
146CONFIG_LOCALVERSION=""
147CONFIG_LOCALVERSION_AUTO=y
148CONFIG_SWAP=y
149CONFIG_SYSVIPC=y
150# CONFIG_POSIX_MQUEUE is not set
151# CONFIG_BSD_PROCESS_ACCT is not set
152CONFIG_SYSCTL=y
153# CONFIG_AUDIT is not set
154# CONFIG_HOTPLUG is not set
155CONFIG_KOBJECT_UEVENT=y
156CONFIG_IKCONFIG=y
157CONFIG_IKCONFIG_PROC=y
158CONFIG_INITRAMFS_SOURCE=""
159CONFIG_EMBEDDED=y
160CONFIG_KALLSYMS=y
161# CONFIG_KALLSYMS_ALL is not set
162# CONFIG_KALLSYMS_EXTRA_PASS is not set
163CONFIG_PRINTK=y
164CONFIG_BUG=y
165CONFIG_BASE_FULL=y
166CONFIG_FUTEX=y
167CONFIG_EPOLL=y
168# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
169CONFIG_SHMEM=y
170CONFIG_CC_ALIGN_FUNCTIONS=0
171CONFIG_CC_ALIGN_LABELS=0
172CONFIG_CC_ALIGN_LOOPS=0
173CONFIG_CC_ALIGN_JUMPS=0
174# CONFIG_TINY_SHMEM is not set
175CONFIG_BASE_SMALL=0
176
177#
178# Loadable module support
179#
180CONFIG_MODULES=y
181# CONFIG_MODULE_UNLOAD is not set
182CONFIG_OBSOLETE_MODPARM=y
183# CONFIG_MODVERSIONS is not set
184# CONFIG_MODULE_SRCVERSION_ALL is not set
185CONFIG_KMOD=y
186
187#
188# Block layer
189#
190# CONFIG_LBD is not set
191
192#
193# IO Schedulers
194#
195CONFIG_IOSCHED_NOOP=y
196CONFIG_IOSCHED_AS=y
197CONFIG_IOSCHED_DEADLINE=y
198CONFIG_IOSCHED_CFQ=y
199CONFIG_DEFAULT_AS=y
200# CONFIG_DEFAULT_DEADLINE is not set
201# CONFIG_DEFAULT_CFQ is not set
202# CONFIG_DEFAULT_NOOP is not set
203CONFIG_DEFAULT_IOSCHED="anticipatory"
204
205#
206# Bus options (PCI, PCMCIA, EISA, ISA, TC) 206# Bus options (PCI, PCMCIA, EISA, ISA, TC)
207# 207#
208CONFIG_HW_HAS_PCI=y 208CONFIG_HW_HAS_PCI=y
@@ -289,7 +289,6 @@ CONFIG_TCP_CONG_BIC=y
289# QoS and/or fair queueing 289# QoS and/or fair queueing
290# 290#
291# CONFIG_NET_SCHED is not set 291# CONFIG_NET_SCHED is not set
292# CONFIG_NET_CLS_ROUTE is not set
293 292
294# 293#
295# Network testing 294# Network testing
diff --git a/arch/mips/configs/pnx8550-v2pci_defconfig b/arch/mips/configs/pnx8550-v2pci_defconfig
index a4ebb538e15c..4c650e708133 100644
--- a/arch/mips/configs/pnx8550-v2pci_defconfig
+++ b/arch/mips/configs/pnx8550-v2pci_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Thu Nov 10 14:02:38 2005 4# Thu Nov 24 01:06:58 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27# CONFIG_HOTPLUG is not set
28CONFIG_KOBJECT_UEVENT=y
29CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53# CONFIG_MODULE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55# CONFIG_MODVERSIONS is not set
56# CONFIG_MODULE_SRCVERSION_ALL is not set
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -185,7 +116,6 @@ CONFIG_CPU_HAS_PREFETCH=y
185# CONFIG_64BIT_PHYS_ADDR is not set 116# CONFIG_64BIT_PHYS_ADDR is not set
186CONFIG_CPU_ADVANCED=y 117CONFIG_CPU_ADVANCED=y
187CONFIG_CPU_HAS_LLSC=y 118CONFIG_CPU_HAS_LLSC=y
188# CONFIG_CPU_HAS_LLDSCD is not set
189# CONFIG_CPU_HAS_WB is not set 119# CONFIG_CPU_HAS_WB is not set
190CONFIG_CPU_HAS_SYNC=y 120CONFIG_CPU_HAS_SYNC=y
191CONFIG_GENERIC_HARDIRQS=y 121CONFIG_GENERIC_HARDIRQS=y
@@ -204,6 +134,75 @@ CONFIG_PREEMPT_NONE=y
204# CONFIG_PREEMPT is not set 134# CONFIG_PREEMPT is not set
205 135
206# 136#
137# Code maturity level options
138#
139CONFIG_EXPERIMENTAL=y
140CONFIG_CLEAN_COMPILE=y
141CONFIG_BROKEN_ON_SMP=y
142CONFIG_INIT_ENV_ARG_LIMIT=32
143
144#
145# General setup
146#
147CONFIG_LOCALVERSION=""
148CONFIG_LOCALVERSION_AUTO=y
149CONFIG_SWAP=y
150CONFIG_SYSVIPC=y
151# CONFIG_POSIX_MQUEUE is not set
152# CONFIG_BSD_PROCESS_ACCT is not set
153CONFIG_SYSCTL=y
154# CONFIG_AUDIT is not set
155# CONFIG_HOTPLUG is not set
156CONFIG_KOBJECT_UEVENT=y
157CONFIG_IKCONFIG=y
158CONFIG_IKCONFIG_PROC=y
159CONFIG_INITRAMFS_SOURCE=""
160CONFIG_EMBEDDED=y
161CONFIG_KALLSYMS=y
162# CONFIG_KALLSYMS_EXTRA_PASS is not set
163CONFIG_PRINTK=y
164CONFIG_BUG=y
165CONFIG_BASE_FULL=y
166CONFIG_FUTEX=y
167CONFIG_EPOLL=y
168# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
169CONFIG_SHMEM=y
170CONFIG_CC_ALIGN_FUNCTIONS=0
171CONFIG_CC_ALIGN_LABELS=0
172CONFIG_CC_ALIGN_LOOPS=0
173CONFIG_CC_ALIGN_JUMPS=0
174# CONFIG_TINY_SHMEM is not set
175CONFIG_BASE_SMALL=0
176
177#
178# Loadable module support
179#
180CONFIG_MODULES=y
181# CONFIG_MODULE_UNLOAD is not set
182CONFIG_OBSOLETE_MODPARM=y
183# CONFIG_MODVERSIONS is not set
184# CONFIG_MODULE_SRCVERSION_ALL is not set
185CONFIG_KMOD=y
186
187#
188# Block layer
189#
190# CONFIG_LBD is not set
191
192#
193# IO Schedulers
194#
195CONFIG_IOSCHED_NOOP=y
196CONFIG_IOSCHED_AS=y
197CONFIG_IOSCHED_DEADLINE=y
198CONFIG_IOSCHED_CFQ=y
199CONFIG_DEFAULT_AS=y
200# CONFIG_DEFAULT_DEADLINE is not set
201# CONFIG_DEFAULT_CFQ is not set
202# CONFIG_DEFAULT_NOOP is not set
203CONFIG_DEFAULT_IOSCHED="anticipatory"
204
205#
207# Bus options (PCI, PCMCIA, EISA, ISA, TC) 206# Bus options (PCI, PCMCIA, EISA, ISA, TC)
208# 207#
209CONFIG_HW_HAS_PCI=y 208CONFIG_HW_HAS_PCI=y
@@ -321,7 +320,6 @@ CONFIG_NETFILTER=y
321# QoS and/or fair queueing 320# QoS and/or fair queueing
322# 321#
323# CONFIG_NET_SCHED is not set 322# CONFIG_NET_SCHED is not set
324# CONFIG_NET_CLS_ROUTE is not set
325 323
326# 324#
327# Network testing 325# Network testing
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
index 5d39162077f4..dee44606164c 100644
--- a/arch/mips/configs/qemu_defconfig
+++ b/arch/mips/configs/qemu_defconfig
@@ -1,73 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:06:31 2005 4# Thu Nov 24 01:07:00 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11# CONFIG_EXPERIMENTAL is not set
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21# CONFIG_SWAP is not set
22# CONFIG_SYSVIPC is not set
23# CONFIG_BSD_PROCESS_ACCT is not set
24# CONFIG_SYSCTL is not set
25# CONFIG_AUDIT is not set
26# CONFIG_HOTPLUG is not set
27CONFIG_KOBJECT_UEVENT=y
28# CONFIG_IKCONFIG is not set
29CONFIG_INITRAMFS_SOURCE=""
30CONFIG_EMBEDDED=y
31CONFIG_KALLSYMS=y
32# CONFIG_KALLSYMS_EXTRA_PASS is not set
33CONFIG_PRINTK=y
34# CONFIG_BUG is not set
35# CONFIG_BASE_FULL is not set
36# CONFIG_FUTEX is not set
37# CONFIG_EPOLL is not set
38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39# CONFIG_SHMEM is not set
40CONFIG_CC_ALIGN_FUNCTIONS=0
41CONFIG_CC_ALIGN_LABELS=0
42CONFIG_CC_ALIGN_LOOPS=0
43CONFIG_CC_ALIGN_JUMPS=0
44CONFIG_TINY_SHMEM=y
45CONFIG_BASE_SMALL=1
46
47#
48# Loadable module support
49#
50# CONFIG_MODULES is not set
51
52#
53# Block layer
54#
55# CONFIG_LBD is not set
56
57#
58# IO Schedulers
59#
60CONFIG_IOSCHED_NOOP=y
61# CONFIG_IOSCHED_AS is not set
62# CONFIG_IOSCHED_DEADLINE is not set
63# CONFIG_IOSCHED_CFQ is not set
64# CONFIG_DEFAULT_AS is not set
65# CONFIG_DEFAULT_DEADLINE is not set
66# CONFIG_DEFAULT_CFQ is not set
67CONFIG_DEFAULT_NOOP=y
68CONFIG_DEFAULT_IOSCHED="noop"
69
70#
71# Machine selection 9# Machine selection
72# 10#
73# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -192,6 +130,68 @@ CONFIG_PREEMPT_NONE=y
192# CONFIG_PREEMPT is not set 130# CONFIG_PREEMPT is not set
193 131
194# 132#
133# Code maturity level options
134#
135# CONFIG_EXPERIMENTAL is not set
136CONFIG_CLEAN_COMPILE=y
137CONFIG_BROKEN_ON_SMP=y
138CONFIG_INIT_ENV_ARG_LIMIT=32
139
140#
141# General setup
142#
143CONFIG_LOCALVERSION=""
144CONFIG_LOCALVERSION_AUTO=y
145# CONFIG_SWAP is not set
146# CONFIG_SYSVIPC is not set
147# CONFIG_BSD_PROCESS_ACCT is not set
148# CONFIG_SYSCTL is not set
149# CONFIG_AUDIT is not set
150# CONFIG_HOTPLUG is not set
151CONFIG_KOBJECT_UEVENT=y
152# CONFIG_IKCONFIG is not set
153CONFIG_INITRAMFS_SOURCE=""
154CONFIG_EMBEDDED=y
155CONFIG_KALLSYMS=y
156# CONFIG_KALLSYMS_EXTRA_PASS is not set
157CONFIG_PRINTK=y
158# CONFIG_BUG is not set
159# CONFIG_BASE_FULL is not set
160# CONFIG_FUTEX is not set
161# CONFIG_EPOLL is not set
162# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
163# CONFIG_SHMEM is not set
164CONFIG_CC_ALIGN_FUNCTIONS=0
165CONFIG_CC_ALIGN_LABELS=0
166CONFIG_CC_ALIGN_LOOPS=0
167CONFIG_CC_ALIGN_JUMPS=0
168CONFIG_TINY_SHMEM=y
169CONFIG_BASE_SMALL=1
170
171#
172# Loadable module support
173#
174# CONFIG_MODULES is not set
175
176#
177# Block layer
178#
179# CONFIG_LBD is not set
180
181#
182# IO Schedulers
183#
184CONFIG_IOSCHED_NOOP=y
185# CONFIG_IOSCHED_AS is not set
186# CONFIG_IOSCHED_DEADLINE is not set
187# CONFIG_IOSCHED_CFQ is not set
188# CONFIG_DEFAULT_AS is not set
189# CONFIG_DEFAULT_DEADLINE is not set
190# CONFIG_DEFAULT_CFQ is not set
191CONFIG_DEFAULT_NOOP=y
192CONFIG_DEFAULT_IOSCHED="noop"
193
194#
195# Bus options (PCI, PCMCIA, EISA, ISA, TC) 195# Bus options (PCI, PCMCIA, EISA, ISA, TC)
196# 196#
197CONFIG_ISA=y 197CONFIG_ISA=y
@@ -258,7 +258,6 @@ CONFIG_TCP_CONG_BIC=y
258# QoS and/or fair queueing 258# QoS and/or fair queueing
259# 259#
260# CONFIG_NET_SCHED is not set 260# CONFIG_NET_SCHED is not set
261# CONFIG_NET_CLS_ROUTE is not set
262 261
263# 262#
264# Network testing 263# Network testing
diff --git a/arch/mips/configs/rbhma4500_defconfig b/arch/mips/configs/rbhma4500_defconfig
index 047e0b4236f8..9aaa43024aec 100644
--- a/arch/mips/configs/rbhma4500_defconfig
+++ b/arch/mips/configs/rbhma4500_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Thu Nov 10 14:02:45 2005 4# Thu Nov 24 01:07:03 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28# CONFIG_KOBJECT_UEVENT is not set
29CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38# CONFIG_FUTEX is not set
39# CONFIG_EPOLL is not set
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53# CONFIG_MODULE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55# CONFIG_MODVERSIONS is not set
56# CONFIG_MODULE_SRCVERSION_ALL is not set
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -193,7 +124,6 @@ CONFIG_PAGE_SIZE_4KB=y
193# CONFIG_MIPS_MT is not set 124# CONFIG_MIPS_MT is not set
194CONFIG_CPU_ADVANCED=y 125CONFIG_CPU_ADVANCED=y
195CONFIG_CPU_HAS_LLSC=y 126CONFIG_CPU_HAS_LLSC=y
196CONFIG_CPU_HAS_LLDSCD=y
197CONFIG_CPU_HAS_WB=y 127CONFIG_CPU_HAS_WB=y
198CONFIG_CPU_HAS_SYNC=y 128CONFIG_CPU_HAS_SYNC=y
199CONFIG_GENERIC_HARDIRQS=y 129CONFIG_GENERIC_HARDIRQS=y
@@ -212,6 +142,75 @@ CONFIG_PREEMPT_NONE=y
212# CONFIG_PREEMPT is not set 142# CONFIG_PREEMPT is not set
213 143
214# 144#
145# Code maturity level options
146#
147CONFIG_EXPERIMENTAL=y
148CONFIG_CLEAN_COMPILE=y
149CONFIG_BROKEN_ON_SMP=y
150CONFIG_INIT_ENV_ARG_LIMIT=32
151
152#
153# General setup
154#
155CONFIG_LOCALVERSION=""
156CONFIG_LOCALVERSION_AUTO=y
157CONFIG_SWAP=y
158CONFIG_SYSVIPC=y
159# CONFIG_POSIX_MQUEUE is not set
160# CONFIG_BSD_PROCESS_ACCT is not set
161CONFIG_SYSCTL=y
162# CONFIG_AUDIT is not set
163CONFIG_HOTPLUG=y
164# CONFIG_KOBJECT_UEVENT is not set
165CONFIG_IKCONFIG=y
166CONFIG_IKCONFIG_PROC=y
167CONFIG_INITRAMFS_SOURCE=""
168CONFIG_EMBEDDED=y
169CONFIG_KALLSYMS=y
170# CONFIG_KALLSYMS_EXTRA_PASS is not set
171CONFIG_PRINTK=y
172CONFIG_BUG=y
173CONFIG_BASE_FULL=y
174# CONFIG_FUTEX is not set
175# CONFIG_EPOLL is not set
176# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
177CONFIG_SHMEM=y
178CONFIG_CC_ALIGN_FUNCTIONS=0
179CONFIG_CC_ALIGN_LABELS=0
180CONFIG_CC_ALIGN_LOOPS=0
181CONFIG_CC_ALIGN_JUMPS=0
182# CONFIG_TINY_SHMEM is not set
183CONFIG_BASE_SMALL=0
184
185#
186# Loadable module support
187#
188CONFIG_MODULES=y
189# CONFIG_MODULE_UNLOAD is not set
190CONFIG_OBSOLETE_MODPARM=y
191# CONFIG_MODVERSIONS is not set
192# CONFIG_MODULE_SRCVERSION_ALL is not set
193CONFIG_KMOD=y
194
195#
196# Block layer
197#
198# CONFIG_LBD is not set
199
200#
201# IO Schedulers
202#
203CONFIG_IOSCHED_NOOP=y
204CONFIG_IOSCHED_AS=y
205CONFIG_IOSCHED_DEADLINE=y
206CONFIG_IOSCHED_CFQ=y
207CONFIG_DEFAULT_AS=y
208# CONFIG_DEFAULT_DEADLINE is not set
209# CONFIG_DEFAULT_CFQ is not set
210# CONFIG_DEFAULT_NOOP is not set
211CONFIG_DEFAULT_IOSCHED="anticipatory"
212
213#
215# Bus options (PCI, PCMCIA, EISA, ISA, TC) 214# Bus options (PCI, PCMCIA, EISA, ISA, TC)
216# 215#
217CONFIG_HW_HAS_PCI=y 216CONFIG_HW_HAS_PCI=y
@@ -333,7 +332,6 @@ CONFIG_NETFILTER_NETLINK_LOG=m
333# QoS and/or fair queueing 332# QoS and/or fair queueing
334# 333#
335# CONFIG_NET_SCHED is not set 334# CONFIG_NET_SCHED is not set
336# CONFIG_NET_CLS_ROUTE is not set
337 335
338# 336#
339# Network testing 337# Network testing
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
index 55458062352e..abf61095931e 100644
--- a/arch/mips/configs/rm200_defconfig
+++ b/arch/mips/configs/rm200_defconfig
@@ -1,82 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Thu Nov 10 14:02:50 2005 4# Thu Nov 24 01:07:06 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23CONFIG_POSIX_MQUEUE=y
24CONFIG_BSD_PROCESS_ACCT=y
25# CONFIG_BSD_PROCESS_ACCT_V3 is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_HOTPLUG=y
29CONFIG_KOBJECT_UEVENT=y
30CONFIG_IKCONFIG=y
31CONFIG_IKCONFIG_PROC=y
32CONFIG_INITRAMFS_SOURCE=""
33CONFIG_EMBEDDED=y
34CONFIG_KALLSYMS=y
35# CONFIG_KALLSYMS_EXTRA_PASS is not set
36CONFIG_PRINTK=y
37CONFIG_BUG=y
38CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y
40CONFIG_EPOLL=y
41# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
42CONFIG_SHMEM=y
43CONFIG_CC_ALIGN_FUNCTIONS=0
44CONFIG_CC_ALIGN_LABELS=0
45CONFIG_CC_ALIGN_LOOPS=0
46CONFIG_CC_ALIGN_JUMPS=0
47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0
49
50#
51# Loadable module support
52#
53CONFIG_MODULES=y
54CONFIG_MODULE_UNLOAD=y
55# CONFIG_MODULE_FORCE_UNLOAD is not set
56CONFIG_OBSOLETE_MODPARM=y
57CONFIG_MODVERSIONS=y
58# CONFIG_MODULE_SRCVERSION_ALL is not set
59CONFIG_KMOD=y
60
61#
62# Block layer
63#
64# CONFIG_LBD is not set
65
66#
67# IO Schedulers
68#
69CONFIG_IOSCHED_NOOP=y
70CONFIG_IOSCHED_AS=y
71CONFIG_IOSCHED_DEADLINE=y
72CONFIG_IOSCHED_CFQ=y
73CONFIG_DEFAULT_AS=y
74# CONFIG_DEFAULT_DEADLINE is not set
75# CONFIG_DEFAULT_CFQ is not set
76# CONFIG_DEFAULT_NOOP is not set
77CONFIG_DEFAULT_IOSCHED="anticipatory"
78
79#
80# Machine selection 9# Machine selection
81# 10#
82# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -195,7 +124,6 @@ CONFIG_PAGE_SIZE_4KB=y
195# CONFIG_64BIT_PHYS_ADDR is not set 124# CONFIG_64BIT_PHYS_ADDR is not set
196# CONFIG_CPU_ADVANCED is not set 125# CONFIG_CPU_ADVANCED is not set
197CONFIG_CPU_HAS_LLSC=y 126CONFIG_CPU_HAS_LLSC=y
198CONFIG_CPU_HAS_LLDSCD=y
199CONFIG_CPU_HAS_SYNC=y 127CONFIG_CPU_HAS_SYNC=y
200CONFIG_GENERIC_HARDIRQS=y 128CONFIG_GENERIC_HARDIRQS=y
201CONFIG_GENERIC_IRQ_PROBE=y 129CONFIG_GENERIC_IRQ_PROBE=y
@@ -214,6 +142,77 @@ CONFIG_PREEMPT_VOLUNTARY=y
214# CONFIG_PREEMPT is not set 142# CONFIG_PREEMPT is not set
215 143
216# 144#
145# Code maturity level options
146#
147CONFIG_EXPERIMENTAL=y
148CONFIG_CLEAN_COMPILE=y
149CONFIG_BROKEN_ON_SMP=y
150CONFIG_INIT_ENV_ARG_LIMIT=32
151
152#
153# General setup
154#
155CONFIG_LOCALVERSION=""
156CONFIG_LOCALVERSION_AUTO=y
157CONFIG_SWAP=y
158CONFIG_SYSVIPC=y
159CONFIG_POSIX_MQUEUE=y
160CONFIG_BSD_PROCESS_ACCT=y
161# CONFIG_BSD_PROCESS_ACCT_V3 is not set
162CONFIG_SYSCTL=y
163# CONFIG_AUDIT is not set
164CONFIG_HOTPLUG=y
165CONFIG_KOBJECT_UEVENT=y
166CONFIG_IKCONFIG=y
167CONFIG_IKCONFIG_PROC=y
168CONFIG_INITRAMFS_SOURCE=""
169CONFIG_EMBEDDED=y
170CONFIG_KALLSYMS=y
171# CONFIG_KALLSYMS_EXTRA_PASS is not set
172CONFIG_PRINTK=y
173CONFIG_BUG=y
174CONFIG_BASE_FULL=y
175CONFIG_FUTEX=y
176CONFIG_EPOLL=y
177# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
178CONFIG_SHMEM=y
179CONFIG_CC_ALIGN_FUNCTIONS=0
180CONFIG_CC_ALIGN_LABELS=0
181CONFIG_CC_ALIGN_LOOPS=0
182CONFIG_CC_ALIGN_JUMPS=0
183# CONFIG_TINY_SHMEM is not set
184CONFIG_BASE_SMALL=0
185
186#
187# Loadable module support
188#
189CONFIG_MODULES=y
190CONFIG_MODULE_UNLOAD=y
191# CONFIG_MODULE_FORCE_UNLOAD is not set
192CONFIG_OBSOLETE_MODPARM=y
193CONFIG_MODVERSIONS=y
194# CONFIG_MODULE_SRCVERSION_ALL is not set
195CONFIG_KMOD=y
196
197#
198# Block layer
199#
200# CONFIG_LBD is not set
201
202#
203# IO Schedulers
204#
205CONFIG_IOSCHED_NOOP=y
206CONFIG_IOSCHED_AS=y
207CONFIG_IOSCHED_DEADLINE=y
208CONFIG_IOSCHED_CFQ=y
209CONFIG_DEFAULT_AS=y
210# CONFIG_DEFAULT_DEADLINE is not set
211# CONFIG_DEFAULT_CFQ is not set
212# CONFIG_DEFAULT_NOOP is not set
213CONFIG_DEFAULT_IOSCHED="anticipatory"
214
215#
217# Bus options (PCI, PCMCIA, EISA, ISA, TC) 216# Bus options (PCI, PCMCIA, EISA, ISA, TC)
218# 217#
219CONFIG_HW_HAS_EISA=y 218CONFIG_HW_HAS_EISA=y
@@ -1199,6 +1198,7 @@ CONFIG_USB_USS720=m
1199CONFIG_USB_SERIAL=m 1198CONFIG_USB_SERIAL=m
1200CONFIG_USB_SERIAL_GENERIC=y 1199CONFIG_USB_SERIAL_GENERIC=y
1201CONFIG_USB_SERIAL_AIRPRIME=m 1200CONFIG_USB_SERIAL_AIRPRIME=m
1201CONFIG_USB_SERIAL_ANYDATA=m
1202CONFIG_USB_SERIAL_BELKIN=m 1202CONFIG_USB_SERIAL_BELKIN=m
1203CONFIG_USB_SERIAL_WHITEHEAT=m 1203CONFIG_USB_SERIAL_WHITEHEAT=m
1204CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m 1204CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
@@ -1230,7 +1230,6 @@ CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1230CONFIG_USB_SERIAL_KLSI=m 1230CONFIG_USB_SERIAL_KLSI=m
1231CONFIG_USB_SERIAL_KOBIL_SCT=m 1231CONFIG_USB_SERIAL_KOBIL_SCT=m
1232CONFIG_USB_SERIAL_MCT_U232=m 1232CONFIG_USB_SERIAL_MCT_U232=m
1233# CONFIG_USB_SERIAL_NOKIA_DKU2 is not set
1234CONFIG_USB_SERIAL_PL2303=m 1233CONFIG_USB_SERIAL_PL2303=m
1235CONFIG_USB_SERIAL_HP4X=m 1234CONFIG_USB_SERIAL_HP4X=m
1236CONFIG_USB_SERIAL_SAFE=m 1235CONFIG_USB_SERIAL_SAFE=m
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
index dc453a1e4806..52048c906079 100644
--- a/arch/mips/configs/sb1250-swarm_defconfig
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -1,81 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:06:43 2005 4# Thu Nov 24 01:07:09 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_LOCK_KERNEL=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_CPUSETS=y
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y
54# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y
57CONFIG_MODULE_SRCVERSION_ALL=y
58CONFIG_KMOD=y
59CONFIG_STOP_MACHINE=y
60
61#
62# Block layer
63#
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Machine selection 9# Machine selection
80# 10#
81# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -203,7 +133,6 @@ CONFIG_CPU_HAS_PREFETCH=y
203# CONFIG_MIPS_MT is not set 133# CONFIG_MIPS_MT is not set
204CONFIG_SB1_PASS_1_WORKAROUNDS=y 134CONFIG_SB1_PASS_1_WORKAROUNDS=y
205CONFIG_CPU_HAS_LLSC=y 135CONFIG_CPU_HAS_LLSC=y
206CONFIG_CPU_HAS_LLDSCD=y
207CONFIG_CPU_HAS_SYNC=y 136CONFIG_CPU_HAS_SYNC=y
208CONFIG_GENERIC_HARDIRQS=y 137CONFIG_GENERIC_HARDIRQS=y
209CONFIG_GENERIC_IRQ_PROBE=y 138CONFIG_GENERIC_IRQ_PROBE=y
@@ -226,6 +155,76 @@ CONFIG_PREEMPT_NONE=y
226CONFIG_PREEMPT_BKL=y 155CONFIG_PREEMPT_BKL=y
227 156
228# 157#
158# Code maturity level options
159#
160CONFIG_EXPERIMENTAL=y
161CONFIG_CLEAN_COMPILE=y
162CONFIG_LOCK_KERNEL=y
163CONFIG_INIT_ENV_ARG_LIMIT=32
164
165#
166# General setup
167#
168CONFIG_LOCALVERSION=""
169CONFIG_LOCALVERSION_AUTO=y
170CONFIG_SWAP=y
171CONFIG_SYSVIPC=y
172# CONFIG_POSIX_MQUEUE is not set
173# CONFIG_BSD_PROCESS_ACCT is not set
174CONFIG_SYSCTL=y
175# CONFIG_AUDIT is not set
176CONFIG_HOTPLUG=y
177CONFIG_KOBJECT_UEVENT=y
178# CONFIG_IKCONFIG is not set
179CONFIG_CPUSETS=y
180CONFIG_INITRAMFS_SOURCE=""
181CONFIG_EMBEDDED=y
182CONFIG_KALLSYMS=y
183# CONFIG_KALLSYMS_EXTRA_PASS is not set
184CONFIG_PRINTK=y
185CONFIG_BUG=y
186CONFIG_BASE_FULL=y
187CONFIG_FUTEX=y
188CONFIG_EPOLL=y
189# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
190CONFIG_SHMEM=y
191CONFIG_CC_ALIGN_FUNCTIONS=0
192CONFIG_CC_ALIGN_LABELS=0
193CONFIG_CC_ALIGN_LOOPS=0
194CONFIG_CC_ALIGN_JUMPS=0
195# CONFIG_TINY_SHMEM is not set
196CONFIG_BASE_SMALL=0
197
198#
199# Loadable module support
200#
201CONFIG_MODULES=y
202CONFIG_MODULE_UNLOAD=y
203# CONFIG_MODULE_FORCE_UNLOAD is not set
204CONFIG_OBSOLETE_MODPARM=y
205CONFIG_MODVERSIONS=y
206CONFIG_MODULE_SRCVERSION_ALL=y
207CONFIG_KMOD=y
208CONFIG_STOP_MACHINE=y
209
210#
211# Block layer
212#
213
214#
215# IO Schedulers
216#
217CONFIG_IOSCHED_NOOP=y
218CONFIG_IOSCHED_AS=y
219CONFIG_IOSCHED_DEADLINE=y
220CONFIG_IOSCHED_CFQ=y
221CONFIG_DEFAULT_AS=y
222# CONFIG_DEFAULT_DEADLINE is not set
223# CONFIG_DEFAULT_CFQ is not set
224# CONFIG_DEFAULT_NOOP is not set
225CONFIG_DEFAULT_IOSCHED="anticipatory"
226
227#
229# Bus options (PCI, PCMCIA, EISA, ISA, TC) 228# Bus options (PCI, PCMCIA, EISA, ISA, TC)
230# 229#
231CONFIG_HW_HAS_PCI=y 230CONFIG_HW_HAS_PCI=y
@@ -318,7 +317,6 @@ CONFIG_TCP_CONG_BIC=y
318# QoS and/or fair queueing 317# QoS and/or fair queueing
319# 318#
320# CONFIG_NET_SCHED is not set 319# CONFIG_NET_SCHED is not set
321# CONFIG_NET_CLS_ROUTE is not set
322 320
323# 321#
324# Network testing 322# Network testing
diff --git a/arch/mips/configs/sead_defconfig b/arch/mips/configs/sead_defconfig
index aa27d583162d..41dd70824976 100644
--- a/arch/mips/configs/sead_defconfig
+++ b/arch/mips/configs/sead_defconfig
@@ -1,71 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:06:45 2005 4# Thu Nov 24 01:07:10 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21# CONFIG_SWAP is not set
22CONFIG_SYSVIPC=y
23# CONFIG_BSD_PROCESS_ACCT is not set
24CONFIG_SYSCTL=y
25# CONFIG_HOTPLUG is not set
26# CONFIG_IKCONFIG is not set
27CONFIG_INITRAMFS_SOURCE=""
28CONFIG_EMBEDDED=y
29CONFIG_KALLSYMS=y
30# CONFIG_KALLSYMS_EXTRA_PASS is not set
31CONFIG_PRINTK=y
32CONFIG_BUG=y
33CONFIG_BASE_FULL=y
34CONFIG_FUTEX=y
35CONFIG_EPOLL=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
37CONFIG_SHMEM=y
38CONFIG_CC_ALIGN_FUNCTIONS=0
39CONFIG_CC_ALIGN_LABELS=0
40CONFIG_CC_ALIGN_LOOPS=0
41CONFIG_CC_ALIGN_JUMPS=0
42# CONFIG_TINY_SHMEM is not set
43CONFIG_BASE_SMALL=0
44
45#
46# Loadable module support
47#
48# CONFIG_MODULES is not set
49
50#
51# Block layer
52#
53# CONFIG_LBD is not set
54
55#
56# IO Schedulers
57#
58CONFIG_IOSCHED_NOOP=y
59CONFIG_IOSCHED_AS=y
60CONFIG_IOSCHED_DEADLINE=y
61CONFIG_IOSCHED_CFQ=y
62CONFIG_DEFAULT_AS=y
63# CONFIG_DEFAULT_DEADLINE is not set
64# CONFIG_DEFAULT_CFQ is not set
65# CONFIG_DEFAULT_NOOP is not set
66CONFIG_DEFAULT_IOSCHED="anticipatory"
67
68#
69# Machine selection 9# Machine selection
70# 10#
71# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -197,6 +137,66 @@ CONFIG_PREEMPT_NONE=y
197# CONFIG_PREEMPT is not set 137# CONFIG_PREEMPT is not set
198 138
199# 139#
140# Code maturity level options
141#
142CONFIG_EXPERIMENTAL=y
143CONFIG_CLEAN_COMPILE=y
144CONFIG_BROKEN_ON_SMP=y
145CONFIG_INIT_ENV_ARG_LIMIT=32
146
147#
148# General setup
149#
150CONFIG_LOCALVERSION=""
151CONFIG_LOCALVERSION_AUTO=y
152# CONFIG_SWAP is not set
153CONFIG_SYSVIPC=y
154# CONFIG_BSD_PROCESS_ACCT is not set
155CONFIG_SYSCTL=y
156# CONFIG_HOTPLUG is not set
157# CONFIG_IKCONFIG is not set
158CONFIG_INITRAMFS_SOURCE=""
159CONFIG_EMBEDDED=y
160CONFIG_KALLSYMS=y
161# CONFIG_KALLSYMS_EXTRA_PASS is not set
162CONFIG_PRINTK=y
163CONFIG_BUG=y
164CONFIG_BASE_FULL=y
165CONFIG_FUTEX=y
166CONFIG_EPOLL=y
167# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
168CONFIG_SHMEM=y
169CONFIG_CC_ALIGN_FUNCTIONS=0
170CONFIG_CC_ALIGN_LABELS=0
171CONFIG_CC_ALIGN_LOOPS=0
172CONFIG_CC_ALIGN_JUMPS=0
173# CONFIG_TINY_SHMEM is not set
174CONFIG_BASE_SMALL=0
175
176#
177# Loadable module support
178#
179# CONFIG_MODULES is not set
180
181#
182# Block layer
183#
184# CONFIG_LBD is not set
185
186#
187# IO Schedulers
188#
189CONFIG_IOSCHED_NOOP=y
190CONFIG_IOSCHED_AS=y
191CONFIG_IOSCHED_DEADLINE=y
192CONFIG_IOSCHED_CFQ=y
193CONFIG_DEFAULT_AS=y
194# CONFIG_DEFAULT_DEADLINE is not set
195# CONFIG_DEFAULT_CFQ is not set
196# CONFIG_DEFAULT_NOOP is not set
197CONFIG_DEFAULT_IOSCHED="anticipatory"
198
199#
200# Bus options (PCI, PCMCIA, EISA, ISA, TC) 200# Bus options (PCI, PCMCIA, EISA, ISA, TC)
201# 201#
202CONFIG_MMU=y 202CONFIG_MMU=y
@@ -363,6 +363,7 @@ CONFIG_LEGACY_PTY_COUNT=256
363# 363#
364# TPM devices 364# TPM devices
365# 365#
366# CONFIG_TCG_TPM is not set
366# CONFIG_TELCLOCK is not set 367# CONFIG_TELCLOCK is not set
367 368
368# 369#
diff --git a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
index ddc7e45996f2..83969466ecf6 100644
--- a/arch/mips/configs/tb0226_defconfig
+++ b/arch/mips/configs/tb0226_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:06:49 2005 4# Thu Nov 24 01:07:12 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27# CONFIG_HOTPLUG is not set
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -207,6 +138,75 @@ CONFIG_PREEMPT_NONE=y
207# CONFIG_PREEMPT is not set 138# CONFIG_PREEMPT is not set
208 139
209# 140#
141# Code maturity level options
142#
143CONFIG_EXPERIMENTAL=y
144CONFIG_CLEAN_COMPILE=y
145CONFIG_BROKEN_ON_SMP=y
146CONFIG_INIT_ENV_ARG_LIMIT=32
147
148#
149# General setup
150#
151CONFIG_LOCALVERSION=""
152CONFIG_LOCALVERSION_AUTO=y
153CONFIG_SWAP=y
154CONFIG_SYSVIPC=y
155# CONFIG_POSIX_MQUEUE is not set
156# CONFIG_BSD_PROCESS_ACCT is not set
157CONFIG_SYSCTL=y
158# CONFIG_AUDIT is not set
159# CONFIG_HOTPLUG is not set
160CONFIG_KOBJECT_UEVENT=y
161# CONFIG_IKCONFIG is not set
162CONFIG_INITRAMFS_SOURCE=""
163CONFIG_EMBEDDED=y
164CONFIG_KALLSYMS=y
165# CONFIG_KALLSYMS_EXTRA_PASS is not set
166CONFIG_PRINTK=y
167CONFIG_BUG=y
168CONFIG_BASE_FULL=y
169CONFIG_FUTEX=y
170CONFIG_EPOLL=y
171# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
172CONFIG_SHMEM=y
173CONFIG_CC_ALIGN_FUNCTIONS=0
174CONFIG_CC_ALIGN_LABELS=0
175CONFIG_CC_ALIGN_LOOPS=0
176CONFIG_CC_ALIGN_JUMPS=0
177# CONFIG_TINY_SHMEM is not set
178CONFIG_BASE_SMALL=0
179
180#
181# Loadable module support
182#
183CONFIG_MODULES=y
184CONFIG_MODULE_UNLOAD=y
185# CONFIG_MODULE_FORCE_UNLOAD is not set
186CONFIG_OBSOLETE_MODPARM=y
187CONFIG_MODVERSIONS=y
188CONFIG_MODULE_SRCVERSION_ALL=y
189CONFIG_KMOD=y
190
191#
192# Block layer
193#
194# CONFIG_LBD is not set
195
196#
197# IO Schedulers
198#
199CONFIG_IOSCHED_NOOP=y
200CONFIG_IOSCHED_AS=y
201CONFIG_IOSCHED_DEADLINE=y
202CONFIG_IOSCHED_CFQ=y
203CONFIG_DEFAULT_AS=y
204# CONFIG_DEFAULT_DEADLINE is not set
205# CONFIG_DEFAULT_CFQ is not set
206# CONFIG_DEFAULT_NOOP is not set
207CONFIG_DEFAULT_IOSCHED="anticipatory"
208
209#
210# Bus options (PCI, PCMCIA, EISA, ISA, TC) 210# Bus options (PCI, PCMCIA, EISA, ISA, TC)
211# 211#
212CONFIG_HW_HAS_PCI=y 212CONFIG_HW_HAS_PCI=y
@@ -301,7 +301,6 @@ CONFIG_TCP_CONG_BIC=y
301# QoS and/or fair queueing 301# QoS and/or fair queueing
302# 302#
303# CONFIG_NET_SCHED is not set 303# CONFIG_NET_SCHED is not set
304# CONFIG_NET_CLS_ROUTE is not set
305 304
306# 305#
307# Network testing 306# Network testing
diff --git a/arch/mips/configs/tb0229_defconfig b/arch/mips/configs/tb0229_defconfig
index e8c82f011e98..ce7b9ed44432 100644
--- a/arch/mips/configs/tb0229_defconfig
+++ b/arch/mips/configs/tb0229_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Wed Nov 9 11:11:47 2005 4# Thu Nov 24 01:07:15 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -207,6 +138,75 @@ CONFIG_PREEMPT_NONE=y
207# CONFIG_PREEMPT is not set 138# CONFIG_PREEMPT is not set
208 139
209# 140#
141# Code maturity level options
142#
143CONFIG_EXPERIMENTAL=y
144CONFIG_CLEAN_COMPILE=y
145CONFIG_BROKEN_ON_SMP=y
146CONFIG_INIT_ENV_ARG_LIMIT=32
147
148#
149# General setup
150#
151CONFIG_LOCALVERSION=""
152CONFIG_LOCALVERSION_AUTO=y
153CONFIG_SWAP=y
154CONFIG_SYSVIPC=y
155# CONFIG_POSIX_MQUEUE is not set
156# CONFIG_BSD_PROCESS_ACCT is not set
157CONFIG_SYSCTL=y
158# CONFIG_AUDIT is not set
159CONFIG_HOTPLUG=y
160CONFIG_KOBJECT_UEVENT=y
161# CONFIG_IKCONFIG is not set
162CONFIG_INITRAMFS_SOURCE=""
163CONFIG_EMBEDDED=y
164CONFIG_KALLSYMS=y
165# CONFIG_KALLSYMS_EXTRA_PASS is not set
166CONFIG_PRINTK=y
167CONFIG_BUG=y
168CONFIG_BASE_FULL=y
169CONFIG_FUTEX=y
170CONFIG_EPOLL=y
171# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
172CONFIG_SHMEM=y
173CONFIG_CC_ALIGN_FUNCTIONS=0
174CONFIG_CC_ALIGN_LABELS=0
175CONFIG_CC_ALIGN_LOOPS=0
176CONFIG_CC_ALIGN_JUMPS=0
177# CONFIG_TINY_SHMEM is not set
178CONFIG_BASE_SMALL=0
179
180#
181# Loadable module support
182#
183CONFIG_MODULES=y
184CONFIG_MODULE_UNLOAD=y
185# CONFIG_MODULE_FORCE_UNLOAD is not set
186CONFIG_OBSOLETE_MODPARM=y
187CONFIG_MODVERSIONS=y
188CONFIG_MODULE_SRCVERSION_ALL=y
189CONFIG_KMOD=y
190
191#
192# Block layer
193#
194# CONFIG_LBD is not set
195
196#
197# IO Schedulers
198#
199CONFIG_IOSCHED_NOOP=y
200CONFIG_IOSCHED_AS=y
201CONFIG_IOSCHED_DEADLINE=y
202CONFIG_IOSCHED_CFQ=y
203CONFIG_DEFAULT_AS=y
204# CONFIG_DEFAULT_DEADLINE is not set
205# CONFIG_DEFAULT_CFQ is not set
206# CONFIG_DEFAULT_NOOP is not set
207CONFIG_DEFAULT_IOSCHED="anticipatory"
208
209#
210# Bus options (PCI, PCMCIA, EISA, ISA, TC) 210# Bus options (PCI, PCMCIA, EISA, ISA, TC)
211# 211#
212CONFIG_HW_HAS_PCI=y 212CONFIG_HW_HAS_PCI=y
@@ -302,7 +302,6 @@ CONFIG_TCP_CONG_BIC=y
302# QoS and/or fair queueing 302# QoS and/or fair queueing
303# 303#
304# CONFIG_NET_SCHED is not set 304# CONFIG_NET_SCHED is not set
305# CONFIG_NET_CLS_ROUTE is not set
306 305
307# 306#
308# Network testing 307# Network testing
diff --git a/arch/mips/configs/workpad_defconfig b/arch/mips/configs/workpad_defconfig
index 125b2997abfe..02b2551023d4 100644
--- a/arch/mips/configs/workpad_defconfig
+++ b/arch/mips/configs/workpad_defconfig
@@ -1,80 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc1 3# Linux kernel version: 2.6.15-rc2
4# Tue Nov 15 11:17:02 2005 4# Thu Nov 24 01:07:17 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27CONFIG_HOTPLUG=y
28CONFIG_KOBJECT_UEVENT=y
29# CONFIG_IKCONFIG is not set
30CONFIG_INITRAMFS_SOURCE=""
31CONFIG_EMBEDDED=y
32CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_BASE_FULL=y
37CONFIG_FUTEX=y
38CONFIG_EPOLL=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45# CONFIG_TINY_SHMEM is not set
46CONFIG_BASE_SMALL=0
47
48#
49# Loadable module support
50#
51CONFIG_MODULES=y
52CONFIG_MODULE_UNLOAD=y
53# CONFIG_MODULE_FORCE_UNLOAD is not set
54CONFIG_OBSOLETE_MODPARM=y
55CONFIG_MODVERSIONS=y
56CONFIG_MODULE_SRCVERSION_ALL=y
57CONFIG_KMOD=y
58
59#
60# Block layer
61#
62# CONFIG_LBD is not set
63
64#
65# IO Schedulers
66#
67CONFIG_IOSCHED_NOOP=y
68CONFIG_IOSCHED_AS=y
69CONFIG_IOSCHED_DEADLINE=y
70CONFIG_IOSCHED_CFQ=y
71CONFIG_DEFAULT_AS=y
72# CONFIG_DEFAULT_DEADLINE is not set
73# CONFIG_DEFAULT_CFQ is not set
74# CONFIG_DEFAULT_NOOP is not set
75CONFIG_DEFAULT_IOSCHED="anticipatory"
76
77#
78# Machine selection 9# Machine selection
79# 10#
80# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -204,6 +135,75 @@ CONFIG_PREEMPT_NONE=y
204# CONFIG_PREEMPT is not set 135# CONFIG_PREEMPT is not set
205 136
206# 137#
138# Code maturity level options
139#
140CONFIG_EXPERIMENTAL=y
141CONFIG_CLEAN_COMPILE=y
142CONFIG_BROKEN_ON_SMP=y
143CONFIG_INIT_ENV_ARG_LIMIT=32
144
145#
146# General setup
147#
148CONFIG_LOCALVERSION=""
149CONFIG_LOCALVERSION_AUTO=y
150CONFIG_SWAP=y
151CONFIG_SYSVIPC=y
152# CONFIG_POSIX_MQUEUE is not set
153# CONFIG_BSD_PROCESS_ACCT is not set
154CONFIG_SYSCTL=y
155# CONFIG_AUDIT is not set
156CONFIG_HOTPLUG=y
157CONFIG_KOBJECT_UEVENT=y
158# CONFIG_IKCONFIG is not set
159CONFIG_INITRAMFS_SOURCE=""
160CONFIG_EMBEDDED=y
161CONFIG_KALLSYMS=y
162# CONFIG_KALLSYMS_EXTRA_PASS is not set
163CONFIG_PRINTK=y
164CONFIG_BUG=y
165CONFIG_BASE_FULL=y
166CONFIG_FUTEX=y
167CONFIG_EPOLL=y
168# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
169CONFIG_SHMEM=y
170CONFIG_CC_ALIGN_FUNCTIONS=0
171CONFIG_CC_ALIGN_LABELS=0
172CONFIG_CC_ALIGN_LOOPS=0
173CONFIG_CC_ALIGN_JUMPS=0
174# CONFIG_TINY_SHMEM is not set
175CONFIG_BASE_SMALL=0
176
177#
178# Loadable module support
179#
180CONFIG_MODULES=y
181CONFIG_MODULE_UNLOAD=y
182# CONFIG_MODULE_FORCE_UNLOAD is not set
183CONFIG_OBSOLETE_MODPARM=y
184CONFIG_MODVERSIONS=y
185CONFIG_MODULE_SRCVERSION_ALL=y
186CONFIG_KMOD=y
187
188#
189# Block layer
190#
191# CONFIG_LBD is not set
192
193#
194# IO Schedulers
195#
196CONFIG_IOSCHED_NOOP=y
197CONFIG_IOSCHED_AS=y
198CONFIG_IOSCHED_DEADLINE=y
199CONFIG_IOSCHED_CFQ=y
200CONFIG_DEFAULT_AS=y
201# CONFIG_DEFAULT_DEADLINE is not set
202# CONFIG_DEFAULT_CFQ is not set
203# CONFIG_DEFAULT_NOOP is not set
204CONFIG_DEFAULT_IOSCHED="anticipatory"
205
206#
207# Bus options (PCI, PCMCIA, EISA, ISA, TC) 207# Bus options (PCI, PCMCIA, EISA, ISA, TC)
208# 208#
209CONFIG_ISA=y 209CONFIG_ISA=y
@@ -297,7 +297,6 @@ CONFIG_TCP_CONG_BIC=y
297# QoS and/or fair queueing 297# QoS and/or fair queueing
298# 298#
299# CONFIG_NET_SCHED is not set 299# CONFIG_NET_SCHED is not set
300# CONFIG_NET_CLS_ROUTE is not set
301 300
302# 301#
303# Network testing 302# Network testing
@@ -609,6 +608,7 @@ CONFIG_WATCHDOG=y
609# 608#
610# TPM devices 609# TPM devices
611# 610#
611# CONFIG_TCG_TPM is not set
612# CONFIG_TELCLOCK is not set 612# CONFIG_TELCLOCK is not set
613 613
614# 614#
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
index d90790b2ab30..468c2e443d71 100644
--- a/arch/mips/configs/yosemite_defconfig
+++ b/arch/mips/configs/yosemite_defconfig
@@ -1,81 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Mon Nov 7 23:06:59 2005 4# Thu Nov 24 01:07:19 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11# CONFIG_EXPERIMENTAL is not set
12CONFIG_CLEAN_COMPILE=y
13CONFIG_LOCK_KERNEL=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_BSD_PROCESS_ACCT is not set
24CONFIG_SYSCTL=y
25# CONFIG_AUDIT is not set
26CONFIG_HOTPLUG=y
27CONFIG_KOBJECT_UEVENT=y
28CONFIG_IKCONFIG=y
29CONFIG_IKCONFIG_PROC=y
30# CONFIG_CPUSETS is not set
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_ALL is not set
35# CONFIG_KALLSYMS_EXTRA_PASS is not set
36CONFIG_PRINTK=y
37CONFIG_BUG=y
38CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y
40CONFIG_EPOLL=y
41# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
42CONFIG_SHMEM=y
43CONFIG_CC_ALIGN_FUNCTIONS=0
44CONFIG_CC_ALIGN_LABELS=0
45CONFIG_CC_ALIGN_LOOPS=0
46CONFIG_CC_ALIGN_JUMPS=0
47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0
49
50#
51# Loadable module support
52#
53CONFIG_MODULES=y
54CONFIG_MODULE_UNLOAD=y
55CONFIG_OBSOLETE_MODPARM=y
56# CONFIG_MODULE_SRCVERSION_ALL is not set
57CONFIG_KMOD=y
58CONFIG_STOP_MACHINE=y
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Machine selection 9# Machine selection
80# 10#
81# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -188,7 +118,6 @@ CONFIG_CPU_HAS_PREFETCH=y
188# CONFIG_64BIT_PHYS_ADDR is not set 118# CONFIG_64BIT_PHYS_ADDR is not set
189# CONFIG_CPU_ADVANCED is not set 119# CONFIG_CPU_ADVANCED is not set
190CONFIG_CPU_HAS_LLSC=y 120CONFIG_CPU_HAS_LLSC=y
191CONFIG_CPU_HAS_LLDSCD=y
192CONFIG_CPU_HAS_SYNC=y 121CONFIG_CPU_HAS_SYNC=y
193CONFIG_GENERIC_HARDIRQS=y 122CONFIG_GENERIC_HARDIRQS=y
194CONFIG_GENERIC_IRQ_PROBE=y 123CONFIG_GENERIC_IRQ_PROBE=y
@@ -208,6 +137,76 @@ CONFIG_PREEMPT_NONE=y
208CONFIG_PREEMPT_BKL=y 137CONFIG_PREEMPT_BKL=y
209 138
210# 139#
140# Code maturity level options
141#
142# CONFIG_EXPERIMENTAL is not set
143CONFIG_CLEAN_COMPILE=y
144CONFIG_LOCK_KERNEL=y
145CONFIG_INIT_ENV_ARG_LIMIT=32
146
147#
148# General setup
149#
150CONFIG_LOCALVERSION=""
151CONFIG_LOCALVERSION_AUTO=y
152CONFIG_SWAP=y
153CONFIG_SYSVIPC=y
154# CONFIG_BSD_PROCESS_ACCT is not set
155CONFIG_SYSCTL=y
156# CONFIG_AUDIT is not set
157CONFIG_HOTPLUG=y
158CONFIG_KOBJECT_UEVENT=y
159CONFIG_IKCONFIG=y
160CONFIG_IKCONFIG_PROC=y
161# CONFIG_CPUSETS is not set
162CONFIG_INITRAMFS_SOURCE=""
163CONFIG_EMBEDDED=y
164CONFIG_KALLSYMS=y
165# CONFIG_KALLSYMS_ALL is not set
166# CONFIG_KALLSYMS_EXTRA_PASS is not set
167CONFIG_PRINTK=y
168CONFIG_BUG=y
169CONFIG_BASE_FULL=y
170CONFIG_FUTEX=y
171CONFIG_EPOLL=y
172# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
173CONFIG_SHMEM=y
174CONFIG_CC_ALIGN_FUNCTIONS=0
175CONFIG_CC_ALIGN_LABELS=0
176CONFIG_CC_ALIGN_LOOPS=0
177CONFIG_CC_ALIGN_JUMPS=0
178# CONFIG_TINY_SHMEM is not set
179CONFIG_BASE_SMALL=0
180
181#
182# Loadable module support
183#
184CONFIG_MODULES=y
185CONFIG_MODULE_UNLOAD=y
186CONFIG_OBSOLETE_MODPARM=y
187# CONFIG_MODULE_SRCVERSION_ALL is not set
188CONFIG_KMOD=y
189CONFIG_STOP_MACHINE=y
190
191#
192# Block layer
193#
194# CONFIG_LBD is not set
195
196#
197# IO Schedulers
198#
199CONFIG_IOSCHED_NOOP=y
200CONFIG_IOSCHED_AS=y
201CONFIG_IOSCHED_DEADLINE=y
202CONFIG_IOSCHED_CFQ=y
203CONFIG_DEFAULT_AS=y
204# CONFIG_DEFAULT_DEADLINE is not set
205# CONFIG_DEFAULT_CFQ is not set
206# CONFIG_DEFAULT_NOOP is not set
207CONFIG_DEFAULT_IOSCHED="anticipatory"
208
209#
211# Bus options (PCI, PCMCIA, EISA, ISA, TC) 210# Bus options (PCI, PCMCIA, EISA, ISA, TC)
212# 211#
213CONFIG_HW_HAS_PCI=y 212CONFIG_HW_HAS_PCI=y
@@ -284,7 +283,6 @@ CONFIG_IPV6_TUNNEL=m
284# QoS and/or fair queueing 283# QoS and/or fair queueing
285# 284#
286# CONFIG_NET_SCHED is not set 285# CONFIG_NET_SCHED is not set
287# CONFIG_NET_CLS_ROUTE is not set
288 286
289# 287#
290# Network testing 288# Network testing
diff --git a/arch/mips/defconfig b/arch/mips/defconfig
index e9086da02e48..4f125e9e8e0b 100644
--- a/arch/mips/defconfig
+++ b/arch/mips/defconfig
@@ -1,81 +1,11 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14 3# Linux kernel version: 2.6.15-rc2
4# Thu Nov 10 12:13:58 2005 4# Thu Nov 24 01:05:49 2005
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
8# 8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y
13CONFIG_BROKEN_ON_SMP=y
14CONFIG_INIT_ENV_ARG_LIMIT=32
15
16#
17# General setup
18#
19CONFIG_LOCALVERSION=""
20CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y
22CONFIG_SYSVIPC=y
23# CONFIG_POSIX_MQUEUE is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set
27# CONFIG_HOTPLUG is not set
28CONFIG_KOBJECT_UEVENT=y
29CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_EMBEDDED=y
33CONFIG_KALLSYMS=y
34# CONFIG_KALLSYMS_EXTRA_PASS is not set
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48
49#
50# Loadable module support
51#
52CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y
54# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y
57CONFIG_MODULE_SRCVERSION_ALL=y
58CONFIG_KMOD=y
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Machine selection 9# Machine selection
80# 10#
81# CONFIG_MIPS_MTX1 is not set 11# CONFIG_MIPS_MTX1 is not set
@@ -193,7 +123,6 @@ CONFIG_IP22_CPU_SCACHE=y
193# CONFIG_64BIT_PHYS_ADDR is not set 123# CONFIG_64BIT_PHYS_ADDR is not set
194# CONFIG_CPU_ADVANCED is not set 124# CONFIG_CPU_ADVANCED is not set
195CONFIG_CPU_HAS_LLSC=y 125CONFIG_CPU_HAS_LLSC=y
196CONFIG_CPU_HAS_LLDSCD=y
197CONFIG_CPU_HAS_SYNC=y 126CONFIG_CPU_HAS_SYNC=y
198CONFIG_GENERIC_HARDIRQS=y 127CONFIG_GENERIC_HARDIRQS=y
199CONFIG_GENERIC_IRQ_PROBE=y 128CONFIG_GENERIC_IRQ_PROBE=y
@@ -211,6 +140,76 @@ CONFIG_PREEMPT_VOLUNTARY=y
211# CONFIG_PREEMPT is not set 140# CONFIG_PREEMPT is not set
212 141
213# 142#
143# Code maturity level options
144#
145CONFIG_EXPERIMENTAL=y
146CONFIG_CLEAN_COMPILE=y
147CONFIG_BROKEN_ON_SMP=y
148CONFIG_INIT_ENV_ARG_LIMIT=32
149
150#
151# General setup
152#
153CONFIG_LOCALVERSION=""
154CONFIG_LOCALVERSION_AUTO=y
155CONFIG_SWAP=y
156CONFIG_SYSVIPC=y
157# CONFIG_POSIX_MQUEUE is not set
158# CONFIG_BSD_PROCESS_ACCT is not set
159CONFIG_SYSCTL=y
160# CONFIG_AUDIT is not set
161# CONFIG_HOTPLUG is not set
162CONFIG_KOBJECT_UEVENT=y
163CONFIG_IKCONFIG=y
164CONFIG_IKCONFIG_PROC=y
165CONFIG_INITRAMFS_SOURCE=""
166CONFIG_EMBEDDED=y
167CONFIG_KALLSYMS=y
168# CONFIG_KALLSYMS_EXTRA_PASS is not set
169CONFIG_PRINTK=y
170CONFIG_BUG=y
171CONFIG_BASE_FULL=y
172CONFIG_FUTEX=y
173CONFIG_EPOLL=y
174# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
175CONFIG_SHMEM=y
176CONFIG_CC_ALIGN_FUNCTIONS=0
177CONFIG_CC_ALIGN_LABELS=0
178CONFIG_CC_ALIGN_LOOPS=0
179CONFIG_CC_ALIGN_JUMPS=0
180# CONFIG_TINY_SHMEM is not set
181CONFIG_BASE_SMALL=0
182
183#
184# Loadable module support
185#
186CONFIG_MODULES=y
187CONFIG_MODULE_UNLOAD=y
188# CONFIG_MODULE_FORCE_UNLOAD is not set
189CONFIG_OBSOLETE_MODPARM=y
190CONFIG_MODVERSIONS=y
191CONFIG_MODULE_SRCVERSION_ALL=y
192CONFIG_KMOD=y
193
194#
195# Block layer
196#
197# CONFIG_LBD is not set
198
199#
200# IO Schedulers
201#
202CONFIG_IOSCHED_NOOP=y
203CONFIG_IOSCHED_AS=y
204CONFIG_IOSCHED_DEADLINE=y
205CONFIG_IOSCHED_CFQ=y
206CONFIG_DEFAULT_AS=y
207# CONFIG_DEFAULT_DEADLINE is not set
208# CONFIG_DEFAULT_CFQ is not set
209# CONFIG_DEFAULT_NOOP is not set
210CONFIG_DEFAULT_IOSCHED="anticipatory"
211
212#
214# Bus options (PCI, PCMCIA, EISA, ISA, TC) 213# Bus options (PCI, PCMCIA, EISA, ISA, TC)
215# 214#
216CONFIG_HW_HAS_EISA=y 215CONFIG_HW_HAS_EISA=y
@@ -779,6 +778,7 @@ CONFIG_MAX_RAW_DEVS=256
779# 778#
780# TPM devices 779# TPM devices
781# 780#
781# CONFIG_TCG_TPM is not set
782# CONFIG_TELCLOCK is not set 782# CONFIG_TELCLOCK is not set
783 783
784# 784#
diff --git a/arch/mips/jmr3927/rbhma3100/irq.c b/arch/mips/jmr3927/rbhma3100/irq.c
index 7cbe14483f13..2810727f1d4e 100644
--- a/arch/mips/jmr3927/rbhma3100/irq.c
+++ b/arch/mips/jmr3927/rbhma3100/irq.c
@@ -113,7 +113,8 @@ static void jmr3927_irq_ack(unsigned int irq)
113 113
114static void jmr3927_irq_end(unsigned int irq) 114static void jmr3927_irq_end(unsigned int irq)
115{ 115{
116 jmr3927_irq_enable(irq); 116 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
117 jmr3927_irq_enable(irq);
117} 118}
118 119
119static void jmr3927_irq_disable(unsigned int irq_nr) 120static void jmr3927_irq_disable(unsigned int irq_nr)
@@ -121,7 +122,7 @@ static void jmr3927_irq_disable(unsigned int irq_nr)
121 struct tb_irq_space* sp; 122 struct tb_irq_space* sp;
122 unsigned long flags; 123 unsigned long flags;
123 124
124 spinlock_irqsave(&jmr3927_irq_lock, flags); 125 spin_lock_irqsave(&jmr3927_irq_lock, flags);
125 for (sp = tb_irq_spaces; sp; sp = sp->next) { 126 for (sp = tb_irq_spaces; sp; sp = sp->next) {
126 if (sp->start_irqno <= irq_nr && 127 if (sp->start_irqno <= irq_nr &&
127 irq_nr < sp->start_irqno + sp->nr_irqs) { 128 irq_nr < sp->start_irqno + sp->nr_irqs) {
@@ -131,7 +132,7 @@ static void jmr3927_irq_disable(unsigned int irq_nr)
131 break; 132 break;
132 } 133 }
133 } 134 }
134 spinlock_irqrestore(&jmr3927_irq_lock, flags); 135 spin_unlock_irqrestore(&jmr3927_irq_lock, flags);
135} 136}
136 137
137static void jmr3927_irq_enable(unsigned int irq_nr) 138static void jmr3927_irq_enable(unsigned int irq_nr)
@@ -139,7 +140,7 @@ static void jmr3927_irq_enable(unsigned int irq_nr)
139 struct tb_irq_space* sp; 140 struct tb_irq_space* sp;
140 unsigned long flags; 141 unsigned long flags;
141 142
142 spinlock_irqsave(&jmr3927_irq_lock, flags); 143 spin_lock_irqsave(&jmr3927_irq_lock, flags);
143 for (sp = tb_irq_spaces; sp; sp = sp->next) { 144 for (sp = tb_irq_spaces; sp; sp = sp->next) {
144 if (sp->start_irqno <= irq_nr && 145 if (sp->start_irqno <= irq_nr &&
145 irq_nr < sp->start_irqno + sp->nr_irqs) { 146 irq_nr < sp->start_irqno + sp->nr_irqs) {
@@ -149,7 +150,7 @@ static void jmr3927_irq_enable(unsigned int irq_nr)
149 break; 150 break;
150 } 151 }
151 } 152 }
152 spinlock_irqrestore(&jmr3927_irq_lock, flags); 153 spin_unlock_irqrestore(&jmr3927_irq_lock, flags);
153} 154}
154 155
155/* 156/*
@@ -205,7 +206,10 @@ static void mask_irq_irc(int irq_nr, int space_id)
205 /* update IRCSR */ 206 /* update IRCSR */
206 tx3927_ircptr->imr = 0; 207 tx3927_ircptr->imr = 0;
207 tx3927_ircptr->imr = irc_elevel; 208 tx3927_ircptr->imr = irc_elevel;
209 /* flush write buffer */
210 (void)tx3927_ircptr->ssr;
208} 211}
212
209static void unmask_irq_irc(int irq_nr, int space_id) 213static void unmask_irq_irc(int irq_nr, int space_id)
210{ 214{
211 volatile unsigned long *ilrp = &tx3927_ircptr->ilr[irq_nr / 2]; 215 volatile unsigned long *ilrp = &tx3927_ircptr->ilr[irq_nr / 2];
@@ -276,7 +280,7 @@ void jmr3927_irc_irqdispatch(struct pt_regs *regs)
276 do_IRQ(irq + JMR3927_IRQ_IRC, regs); 280 do_IRQ(irq + JMR3927_IRQ_IRC, regs);
277} 281}
278 282
279static void jmr3927_ioc_interrupt(int irq, void *dev_id, struct pt_regs *regs) 283static irqreturn_t jmr3927_ioc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
280{ 284{
281 unsigned char istat = jmr3927_ioc_reg_in(JMR3927_IOC_INTS2_ADDR); 285 unsigned char istat = jmr3927_ioc_reg_in(JMR3927_IOC_INTS2_ADDR);
282 int i; 286 int i;
@@ -287,13 +291,14 @@ static void jmr3927_ioc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
287 do_IRQ(irq, regs); 291 do_IRQ(irq, regs);
288 } 292 }
289 } 293 }
294 return IRQ_HANDLED;
290} 295}
291 296
292static struct irqaction ioc_action = { 297static struct irqaction ioc_action = {
293 jmr3927_ioc_interrupt, 0, CPU_MASK_NONE, "IOC", NULL, NULL, 298 jmr3927_ioc_interrupt, 0, CPU_MASK_NONE, "IOC", NULL, NULL,
294}; 299};
295 300
296static void jmr3927_isac_interrupt(int irq, void *dev_id, struct pt_regs *regs) 301static irqreturn_t jmr3927_isac_interrupt(int irq, void *dev_id, struct pt_regs *regs)
297{ 302{
298 unsigned char istat = jmr3927_isac_reg_in(JMR3927_ISAC_INTS2_ADDR); 303 unsigned char istat = jmr3927_isac_reg_in(JMR3927_ISAC_INTS2_ADDR);
299 int i; 304 int i;
@@ -304,6 +309,7 @@ static void jmr3927_isac_interrupt(int irq, void *dev_id, struct pt_regs *regs)
304 do_IRQ(irq, regs); 309 do_IRQ(irq, regs);
305 } 310 }
306 } 311 }
312 return IRQ_HANDLED;
307} 313}
308 314
309static struct irqaction isac_action = { 315static struct irqaction isac_action = {
@@ -311,19 +317,23 @@ static struct irqaction isac_action = {
311}; 317};
312 318
313 319
314static void jmr3927_isaerr_interrupt(int irq, void * dev_id, struct pt_regs * regs) 320static irqreturn_t jmr3927_isaerr_interrupt(int irq, void * dev_id, struct pt_regs * regs)
315{ 321{
316 printk(KERN_WARNING "ISA error interrupt (irq 0x%x).\n", irq); 322 printk(KERN_WARNING "ISA error interrupt (irq 0x%x).\n", irq);
323
324 return IRQ_HANDLED;
317} 325}
318static struct irqaction isaerr_action = { 326static struct irqaction isaerr_action = {
319 jmr3927_isaerr_interrupt, 0, CPU_MASK_NONE, "ISA error", NULL, NULL, 327 jmr3927_isaerr_interrupt, 0, CPU_MASK_NONE, "ISA error", NULL, NULL,
320}; 328};
321 329
322static void jmr3927_pcierr_interrupt(int irq, void * dev_id, struct pt_regs * regs) 330static irqreturn_t jmr3927_pcierr_interrupt(int irq, void * dev_id, struct pt_regs * regs)
323{ 331{
324 printk(KERN_WARNING "PCI error interrupt (irq 0x%x).\n", irq); 332 printk(KERN_WARNING "PCI error interrupt (irq 0x%x).\n", irq);
325 printk(KERN_WARNING "pcistat:%02x, lbstat:%04lx\n", 333 printk(KERN_WARNING "pcistat:%02x, lbstat:%04lx\n",
326 tx3927_pcicptr->pcistat, tx3927_pcicptr->lbstat); 334 tx3927_pcicptr->pcistat, tx3927_pcicptr->lbstat);
335
336 return IRQ_HANDLED;
327} 337}
328static struct irqaction pcierr_action = { 338static struct irqaction pcierr_action = {
329 jmr3927_pcierr_interrupt, 0, CPU_MASK_NONE, "PCI error", NULL, NULL, 339 jmr3927_pcierr_interrupt, 0, CPU_MASK_NONE, "PCI error", NULL, NULL,
diff --git a/arch/mips/jmr3927/rbhma3100/setup.c b/arch/mips/jmr3927/rbhma3100/setup.c
index 55ad0a578794..4763957df8fc 100644
--- a/arch/mips/jmr3927/rbhma3100/setup.c
+++ b/arch/mips/jmr3927/rbhma3100/setup.c
@@ -60,6 +60,8 @@
60#include <asm/mipsregs.h> 60#include <asm/mipsregs.h>
61#include <asm/traps.h> 61#include <asm/traps.h>
62 62
63extern void puts(unsigned char *cp);
64
63/* Tick Timer divider */ 65/* Tick Timer divider */
64#define JMR3927_TIMER_CCD 0 /* 1/2 */ 66#define JMR3927_TIMER_CCD 0 /* 1/2 */
65#define JMR3927_TIMER_CLK (JMR3927_IMCLK / (2 << JMR3927_TIMER_CCD)) 67#define JMR3927_TIMER_CLK (JMR3927_IMCLK / (2 << JMR3927_TIMER_CCD))
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 72f2126ad19d..f36c4f20ee8a 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -50,7 +50,7 @@ obj-$(CONFIG_MIPS_BOARDS_GEN) += irq-msc01.o
50obj-$(CONFIG_32BIT) += scall32-o32.o 50obj-$(CONFIG_32BIT) += scall32-o32.o
51obj-$(CONFIG_64BIT) += scall64-64.o 51obj-$(CONFIG_64BIT) += scall64-64.o
52obj-$(CONFIG_BINFMT_IRIX) += binfmt_irix.o 52obj-$(CONFIG_BINFMT_IRIX) += binfmt_irix.o
53obj-$(CONFIG_MIPS32_COMPAT) += ioctl32.o linux32.o signal32.o 53obj-$(CONFIG_MIPS32_COMPAT) += linux32.o signal32.o
54obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o 54obj-$(CONFIG_MIPS32_N32) += binfmt_elfn32.o scall64-n32.o signal_n32.o
55obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o ptrace32.o 55obj-$(CONFIG_MIPS32_O32) += binfmt_elfo32.o scall64-o32.o ptrace32.o
56 56
@@ -60,6 +60,5 @@ obj-$(CONFIG_PROC_FS) += proc.o
60obj-$(CONFIG_64BIT) += cpu-bugs64.o 60obj-$(CONFIG_64BIT) += cpu-bugs64.o
61 61
62CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) 62CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
63CFLAGS_ioctl32.o += -Ifs/
64 63
65EXTRA_AFLAGS := $(CFLAGS) 64EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index a263fb7a3971..fac48ad27b34 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -417,7 +417,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
417 case PRID_IMP_R10000: 417 case PRID_IMP_R10000:
418 c->cputype = CPU_R10000; 418 c->cputype = CPU_R10000;
419 c->isa_level = MIPS_CPU_ISA_IV; 419 c->isa_level = MIPS_CPU_ISA_IV;
420 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | 420 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
421 MIPS_CPU_FPU | MIPS_CPU_32FPR | 421 MIPS_CPU_FPU | MIPS_CPU_32FPR |
422 MIPS_CPU_COUNTER | MIPS_CPU_WATCH | 422 MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
423 MIPS_CPU_LLSC; 423 MIPS_CPU_LLSC;
@@ -426,7 +426,7 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
426 case PRID_IMP_R12000: 426 case PRID_IMP_R12000:
427 c->cputype = CPU_R12000; 427 c->cputype = CPU_R12000;
428 c->isa_level = MIPS_CPU_ISA_IV; 428 c->isa_level = MIPS_CPU_ISA_IV;
429 c->options = MIPS_CPU_TLB | MIPS_CPU_4KEX | 429 c->options = MIPS_CPU_TLB | MIPS_CPU_4K_CACHE | MIPS_CPU_4KEX |
430 MIPS_CPU_FPU | MIPS_CPU_32FPR | 430 MIPS_CPU_FPU | MIPS_CPU_32FPR |
431 MIPS_CPU_COUNTER | MIPS_CPU_WATCH | 431 MIPS_CPU_COUNTER | MIPS_CPU_WATCH |
432 MIPS_CPU_LLSC; 432 MIPS_CPU_LLSC;
@@ -435,6 +435,9 @@ static inline void cpu_probe_legacy(struct cpuinfo_mips *c)
435 } 435 }
436} 436}
437 437
438static char unknown_isa[] __initdata = KERN_ERR \
439 "Unsupported ISA type, c0.config0: %d.";
440
438static inline unsigned int decode_config0(struct cpuinfo_mips *c) 441static inline unsigned int decode_config0(struct cpuinfo_mips *c)
439{ 442{
440 unsigned int config0; 443 unsigned int config0;
@@ -447,16 +450,37 @@ static inline unsigned int decode_config0(struct cpuinfo_mips *c)
447 isa = (config0 & MIPS_CONF_AT) >> 13; 450 isa = (config0 & MIPS_CONF_AT) >> 13;
448 switch (isa) { 451 switch (isa) {
449 case 0: 452 case 0:
450 c->isa_level = MIPS_CPU_ISA_M32; 453 switch ((config0 >> 10) & 7) {
454 case 0:
455 c->isa_level = MIPS_CPU_ISA_M32R1;
456 break;
457 case 1:
458 c->isa_level = MIPS_CPU_ISA_M32R2;
459 break;
460 default:
461 goto unknown;
462 }
451 break; 463 break;
452 case 2: 464 case 2:
453 c->isa_level = MIPS_CPU_ISA_M64; 465 switch ((config0 >> 10) & 7) {
466 case 0:
467 c->isa_level = MIPS_CPU_ISA_M64R1;
468 break;
469 case 1:
470 c->isa_level = MIPS_CPU_ISA_M64R2;
471 break;
472 default:
473 goto unknown;
474 }
454 break; 475 break;
455 default: 476 default:
456 panic("Unsupported ISA type, cp0.config0.at: %d.", isa); 477 goto unknown;
457 } 478 }
458 479
459 return config0 & MIPS_CONF_M; 480 return config0 & MIPS_CONF_M;
481
482unknown:
483 panic(unknown_isa, config0);
460} 484}
461 485
462static inline unsigned int decode_config1(struct cpuinfo_mips *c) 486static inline unsigned int decode_config1(struct cpuinfo_mips *c)
@@ -568,7 +592,6 @@ static inline void cpu_probe_mips(struct cpuinfo_mips *c)
568 break; 592 break;
569 case PRID_IMP_34K: 593 case PRID_IMP_34K:
570 c->cputype = CPU_34K; 594 c->cputype = CPU_34K;
571 c->isa_level = MIPS_CPU_ISA_M32;
572 break; 595 break;
573 } 596 }
574} 597}
@@ -647,7 +670,7 @@ static inline void cpu_probe_philips(struct cpuinfo_mips *c)
647 switch (c->processor_id & 0xff00) { 670 switch (c->processor_id & 0xff00) {
648 case PRID_IMP_PR4450: 671 case PRID_IMP_PR4450:
649 c->cputype = CPU_PR4450; 672 c->cputype = CPU_PR4450;
650 c->isa_level = MIPS_CPU_ISA_M32; 673 c->isa_level = MIPS_CPU_ISA_M32R1;
651 break; 674 break;
652 default: 675 default:
653 panic("Unknown Philips Core!"); /* REVISIT: die? */ 676 panic("Unknown Philips Core!"); /* REVISIT: die? */
@@ -690,8 +713,10 @@ __init void cpu_probe(void)
690 if (c->options & MIPS_CPU_FPU) { 713 if (c->options & MIPS_CPU_FPU) {
691 c->fpu_id = cpu_get_fpu_id(); 714 c->fpu_id = cpu_get_fpu_id();
692 715
693 if (c->isa_level == MIPS_CPU_ISA_M32 || 716 if (c->isa_level == MIPS_CPU_ISA_M32R1 ||
694 c->isa_level == MIPS_CPU_ISA_M64) { 717 c->isa_level == MIPS_CPU_ISA_M32R2 ||
718 c->isa_level == MIPS_CPU_ISA_M64R1 ||
719 c->isa_level == MIPS_CPU_ISA_M64R2) {
695 if (c->fpu_id & MIPS_FPIR_3D) 720 if (c->fpu_id & MIPS_FPIR_3D)
696 c->ases |= MIPS_ASE_MIPS3D; 721 c->ases |= MIPS_ASE_MIPS3D;
697 } 722 }
diff --git a/arch/mips/kernel/ioctl32.c b/arch/mips/kernel/ioctl32.c
deleted file mode 100644
index 9ea1fc748864..000000000000
--- a/arch/mips/kernel/ioctl32.c
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
3 *
4 * Copyright (C) 2000 Silicon Graphics, Inc.
5 * Written by Ulf Carlsson (ulfc@engr.sgi.com)
6 * Copyright (C) 2000, 2004 Ralf Baechle
7 * Copyright (C) 2002, 2003 Maciej W. Rozycki
8 */
9#define INCLUDES
10#include "compat_ioctl.c"
11
12#include <linux/config.h>
13#include <linux/types.h>
14#include <linux/compat.h>
15#include <linux/ioctl32.h>
16#include <linux/syscalls.h>
17
18#ifdef CONFIG_SIBYTE_TBPROF
19#include <asm/sibyte/trace_prof.h>
20#endif
21
22#define A(__x) ((unsigned long)(__x))
23
24long sys_ioctl(unsigned int fd, unsigned int cmd, unsigned long arg);
25
26#define CODE
27#include "compat_ioctl.c"
28
29#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl)
30#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL },
31#define IOCTL_TABLE_START \
32 struct ioctl_trans ioctl_start[] = {
33#define IOCTL_TABLE_END \
34 };
35
36IOCTL_TABLE_START
37
38#include <linux/compat_ioctl.h>
39#define DECLARES
40#include "compat_ioctl.c"
41
42/*HANDLE_IOCTL(RTC_IRQP_READ, w_long)
43COMPATIBLE_IOCTL(RTC_IRQP_SET)
44HANDLE_IOCTL(RTC_EPOCH_READ, w_long)
45COMPATIBLE_IOCTL(RTC_EPOCH_SET)
46*/
47
48IOCTL_TABLE_END
49
50int ioctl_table_size = ARRAY_SIZE(ioctl_start);
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index dd118c60bcd0..08273a2a501d 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -279,8 +279,6 @@ irix_sigreturn(struct pt_regs *regs)
279 /* 279 /*
280 * Don't let your children do this ... 280 * Don't let your children do this ...
281 */ 281 */
282 if (current_thread_info()->flags & TIF_SYSCALL_TRACE)
283 do_syscall_trace(regs, 1);
284 __asm__ __volatile__( 282 __asm__ __volatile__(
285 "move\t$29,%0\n\t" 283 "move\t$29,%0\n\t"
286 "j\tsyscall_exit" 284 "j\tsyscall_exit"
@@ -783,8 +781,6 @@ asmlinkage void irix_setcontext(struct pt_regs *regs)
783 /* 781 /*
784 * Don't let your children do this ... 782 * Don't let your children do this ...
785 */ 783 */
786 if (current_thread_info()->flags & TIF_SYSCALL_TRACE)
787 do_syscall_trace(regs, 1);
788 __asm__ __volatile__( 784 __asm__ __volatile__(
789 "move\t$29,%0\n\t" 785 "move\t$29,%0\n\t"
790 "j\tsyscall_exit" 786 "j\tsyscall_exit"
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 330cf84d21fe..60353f5acc48 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -420,7 +420,7 @@ asmlinkage ssize_t sys32_pread(unsigned int fd, char * buf,
420 goto out; 420 goto out;
421 pos = merge_64(a4, a5); 421 pos = merge_64(a4, a5);
422 ret = rw_verify_area(READ, file, &pos, count); 422 ret = rw_verify_area(READ, file, &pos, count);
423 if (ret) 423 if (ret < 0)
424 goto out; 424 goto out;
425 ret = -EINVAL; 425 ret = -EINVAL;
426 if (!file->f_op || !(read = file->f_op->read)) 426 if (!file->f_op || !(read = file->f_op->read))
@@ -455,7 +455,7 @@ asmlinkage ssize_t sys32_pwrite(unsigned int fd, const char * buf,
455 goto out; 455 goto out;
456 pos = merge_64(a4, a5); 456 pos = merge_64(a4, a5);
457 ret = rw_verify_area(WRITE, file, &pos, count); 457 ret = rw_verify_area(WRITE, file, &pos, count);
458 if (ret) 458 if (ret < 0)
459 goto out; 459 goto out;
460 ret = -EINVAL; 460 ret = -EINVAL;
461 if (!file->f_op || !(write = file->f_op->write)) 461 if (!file->f_op || !(write = file->f_op->write))
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index dd725779d91f..fa98f10d0132 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -140,12 +140,12 @@ void flush_thread(void)
140int copy_thread(int nr, unsigned long clone_flags, unsigned long usp, 140int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
141 unsigned long unused, struct task_struct *p, struct pt_regs *regs) 141 unsigned long unused, struct task_struct *p, struct pt_regs *regs)
142{ 142{
143 struct thread_info *ti = p->thread_info; 143 struct thread_info *ti = task_thread_info(p);
144 struct pt_regs *childregs; 144 struct pt_regs *childregs;
145 long childksp; 145 long childksp;
146 p->set_child_tid = p->clear_child_tid = NULL; 146 p->set_child_tid = p->clear_child_tid = NULL;
147 147
148 childksp = (unsigned long)ti + THREAD_SIZE - 32; 148 childksp = (unsigned long)task_stack_page(p) + THREAD_SIZE - 32;
149 149
150 preempt_disable(); 150 preempt_disable();
151 151
@@ -205,7 +205,7 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *r)
205 return 1; 205 return 1;
206} 206}
207 207
208void dump_regs(elf_greg_t *gp, struct pt_regs *regs) 208void elf_dump_regs(elf_greg_t *gp, struct pt_regs *regs)
209{ 209{
210 int i; 210 int i;
211 211
@@ -229,9 +229,7 @@ void dump_regs(elf_greg_t *gp, struct pt_regs *regs)
229 229
230int dump_task_regs (struct task_struct *tsk, elf_gregset_t *regs) 230int dump_task_regs (struct task_struct *tsk, elf_gregset_t *regs)
231{ 231{
232 struct thread_info *ti = tsk->thread_info; 232 elf_dump_regs(*regs, task_pt_regs(tsk));
233 long ksp = (unsigned long)ti + THREAD_SIZE - 32;
234 dump_regs(&(*regs)[0], (struct pt_regs *) ksp - 1);
235 return 1; 233 return 1;
236} 234}
237 235
@@ -409,7 +407,7 @@ unsigned long get_wchan(struct task_struct *p)
409 if (!p || p == current || p->state == TASK_RUNNING) 407 if (!p || p == current || p->state == TASK_RUNNING)
410 return 0; 408 return 0;
411 409
412 stack_page = (unsigned long)p->thread_info; 410 stack_page = (unsigned long)task_stack_page(p);
413 if (!stack_page || !mips_frame_info_initialized) 411 if (!stack_page || !mips_frame_info_initialized)
414 return 0; 412 return 0;
415 413
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 510da5fda567..f838b36cc765 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -64,8 +64,7 @@ int ptrace_getregs (struct task_struct *child, __s64 __user *data)
64 if (!access_ok(VERIFY_WRITE, data, 38 * 8)) 64 if (!access_ok(VERIFY_WRITE, data, 38 * 8))
65 return -EIO; 65 return -EIO;
66 66
67 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 67 regs = task_pt_regs(child);
68 THREAD_SIZE - 32 - sizeof(struct pt_regs));
69 68
70 for (i = 0; i < 32; i++) 69 for (i = 0; i < 32; i++)
71 __put_user (regs->regs[i], data + i); 70 __put_user (regs->regs[i], data + i);
@@ -92,8 +91,7 @@ int ptrace_setregs (struct task_struct *child, __s64 __user *data)
92 if (!access_ok(VERIFY_READ, data, 38 * 8)) 91 if (!access_ok(VERIFY_READ, data, 38 * 8))
93 return -EIO; 92 return -EIO;
94 93
95 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 94 regs = task_pt_regs(child);
96 THREAD_SIZE - 32 - sizeof(struct pt_regs));
97 95
98 for (i = 0; i < 32; i++) 96 for (i = 0; i < 32; i++)
99 __get_user (regs->regs[i], data + i); 97 __get_user (regs->regs[i], data + i);
@@ -198,8 +196,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
198 struct pt_regs *regs; 196 struct pt_regs *regs;
199 unsigned long tmp = 0; 197 unsigned long tmp = 0;
200 198
201 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 199 regs = task_pt_regs(child);
202 THREAD_SIZE - 32 - sizeof(struct pt_regs));
203 ret = 0; /* Default return value. */ 200 ret = 0; /* Default return value. */
204 201
205 switch (addr) { 202 switch (addr) {
@@ -280,12 +277,8 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
280 ret = -EIO; 277 ret = -EIO;
281 goto out; 278 goto out;
282 } 279 }
283 if (child->thread.dsp.used_dsp) { 280 dregs = __get_dsp_regs(child);
284 dregs = __get_dsp_regs(child); 281 tmp = (unsigned long) (dregs[addr - DSP_BASE]);
285 tmp = (unsigned long) (dregs[addr - DSP_BASE]);
286 } else {
287 tmp = -1; /* DSP registers yet used */
288 }
289 break; 282 break;
290 } 283 }
291 case DSP_CONTROL: 284 case DSP_CONTROL:
@@ -318,8 +311,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
318 case PTRACE_POKEUSR: { 311 case PTRACE_POKEUSR: {
319 struct pt_regs *regs; 312 struct pt_regs *regs;
320 ret = 0; 313 ret = 0;
321 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 314 regs = task_pt_regs(child);
322 THREAD_SIZE - 32 - sizeof(struct pt_regs));
323 315
324 switch (addr) { 316 switch (addr) {
325 case 0 ... 31: 317 case 0 ... 31:
@@ -446,7 +438,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
446 break; 438 break;
447 439
448 case PTRACE_GET_THREAD_AREA: 440 case PTRACE_GET_THREAD_AREA:
449 ret = put_user(child->thread_info->tp_value, 441 ret = put_user(task_thread_info(child)->tp_value,
450 (unsigned long __user *) data); 442 (unsigned long __user *) data);
451 break; 443 break;
452 444
diff --git a/arch/mips/kernel/ptrace32.c b/arch/mips/kernel/ptrace32.c
index 9a9b04972132..0c82b25d8c6d 100644
--- a/arch/mips/kernel/ptrace32.c
+++ b/arch/mips/kernel/ptrace32.c
@@ -57,30 +57,16 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
57 (unsigned long) data); 57 (unsigned long) data);
58#endif 58#endif
59 lock_kernel(); 59 lock_kernel();
60 ret = -EPERM;
61 if (request == PTRACE_TRACEME) { 60 if (request == PTRACE_TRACEME) {
62 /* are we already being traced? */ 61 ret = ptrace_traceme();
63 if (current->ptrace & PT_PTRACED)
64 goto out;
65 if ((ret = security_ptrace(current->parent, current)))
66 goto out;
67 /* set the ptrace bit in the process flags. */
68 current->ptrace |= PT_PTRACED;
69 ret = 0;
70 goto out; 62 goto out;
71 } 63 }
72 ret = -ESRCH;
73 read_lock(&tasklist_lock);
74 child = find_task_by_pid(pid);
75 if (child)
76 get_task_struct(child);
77 read_unlock(&tasklist_lock);
78 if (!child)
79 goto out;
80 64
81 ret = -EPERM; 65 child = ptrace_get_task_struct(pid);
82 if (pid == 1) /* you may not mess with init */ 66 if (IS_ERR(child)) {
83 goto out_tsk; 67 ret = PTR_ERR(child);
68 goto out;
69 }
84 70
85 if (request == PTRACE_ATTACH) { 71 if (request == PTRACE_ATTACH) {
86 ret = ptrace_attach(child); 72 ret = ptrace_attach(child);
@@ -140,8 +126,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
140 struct pt_regs *regs; 126 struct pt_regs *regs;
141 unsigned int tmp; 127 unsigned int tmp;
142 128
143 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 129 regs = task_pt_regs(child);
144 THREAD_SIZE - 32 - sizeof(struct pt_regs));
145 ret = 0; /* Default return value. */ 130 ret = 0; /* Default return value. */
146 131
147 switch (addr) { 132 switch (addr) {
@@ -215,12 +200,8 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
215 ret = -EIO; 200 ret = -EIO;
216 goto out_tsk; 201 goto out_tsk;
217 } 202 }
218 if (child->thread.dsp.used_dsp) { 203 dspreg_t *dregs = __get_dsp_regs(child);
219 dspreg_t *dregs = __get_dsp_regs(child); 204 tmp = (unsigned long) (dregs[addr - DSP_BASE]);
220 tmp = (unsigned long) (dregs[addr - DSP_BASE]);
221 } else {
222 tmp = -1; /* DSP registers yet used */
223 }
224 break; 205 break;
225 case DSP_CONTROL: 206 case DSP_CONTROL:
226 if (!cpu_has_dsp) { 207 if (!cpu_has_dsp) {
@@ -277,8 +258,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
277 case PTRACE_POKEUSR: { 258 case PTRACE_POKEUSR: {
278 struct pt_regs *regs; 259 struct pt_regs *regs;
279 ret = 0; 260 ret = 0;
280 regs = (struct pt_regs *) ((unsigned long) child->thread_info + 261 regs = task_pt_regs(child);
281 THREAD_SIZE - 32 - sizeof(struct pt_regs));
282 262
283 switch (addr) { 263 switch (addr) {
284 case 0 ... 31: 264 case 0 ... 31:
@@ -395,7 +375,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
395 break; 375 break;
396 376
397 case PTRACE_GET_THREAD_AREA: 377 case PTRACE_GET_THREAD_AREA:
398 ret = put_user(child->thread_info->tp_value, 378 ret = put_user(task_thread_info(child)->tp_value,
399 (unsigned int __user *) (unsigned long) data); 379 (unsigned int __user *) (unsigned long) data);
400 break; 380 break;
401 381
@@ -409,7 +389,7 @@ asmlinkage int sys32_ptrace(int request, int pid, int addr, int data)
409 break; 389 break;
410 390
411 case PTRACE_GET_THREAD_AREA_3264: 391 case PTRACE_GET_THREAD_AREA_3264:
412 ret = put_user(child->thread_info->tp_value, 392 ret = put_user(task_thread_info(child)->tp_value,
413 (unsigned long __user *) (unsigned long) data); 393 (unsigned long __user *) (unsigned long) data);
414 break; 394 break;
415 395
diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
index ae2ba67b7ef6..5e37df3111ad 100644
--- a/arch/mips/kernel/reset.c
+++ b/arch/mips/kernel/reset.c
@@ -12,6 +12,9 @@
12#include <linux/reboot.h> 12#include <linux/reboot.h>
13#include <asm/reboot.h> 13#include <asm/reboot.h>
14 14
15void (*pm_power_off)(void);
16EXPORT_SYMBOL(pm_power_off);
17
15/* 18/*
16 * Urgs ... Too many MIPS machines to handle this in a generic way. 19 * Urgs ... Too many MIPS machines to handle this in a generic way.
17 * So handle all using function pointers to machine specific 20 * So handle all using function pointers to machine specific
@@ -33,6 +36,9 @@ void machine_halt(void)
33 36
34void machine_power_off(void) 37void machine_power_off(void)
35{ 38{
39 if (pm_power_off)
40 pm_power_off();
41
36 _machine_power_off(); 42 _machine_power_off();
37} 43}
38 44
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index 4dd8e8b4fbc2..a42e0e8caa7b 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -94,11 +94,13 @@ syscall_trace_entry:
94 li a1, 0 94 li a1, 0
95 jal do_syscall_trace 95 jal do_syscall_trace
96 96
97 move t0, s0
98 RESTORE_STATIC
97 lw a0, PT_R4(sp) # Restore argument registers 99 lw a0, PT_R4(sp) # Restore argument registers
98 lw a1, PT_R5(sp) 100 lw a1, PT_R5(sp)
99 lw a2, PT_R6(sp) 101 lw a2, PT_R6(sp)
100 lw a3, PT_R7(sp) 102 lw a3, PT_R7(sp)
101 jalr s0 103 jalr t0
102 104
103 li t0, -EMAXERRNO - 1 # error? 105 li t0, -EMAXERRNO - 1 # error?
104 sltu t0, t0, v0 106 sltu t0, t0, v0
@@ -241,19 +243,7 @@ illegal_syscall:
241 sw zero, PT_R7(sp) # success 243 sw zero, PT_R7(sp) # success
242 sw v0, PT_R2(sp) # result 244 sw v0, PT_R2(sp) # result
243 245
244 /* Success, so skip usual error handling garbage. */ 246 j o32_syscall_exit # continue like a normal syscall
245 lw a2, TI_FLAGS($28) # syscall tracing enabled?
246 li t0, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
247 and t0, a2, t0
248 bnez t0, 1f
249
250 j o32_syscall_exit
251
2521: SAVE_STATIC
253 move a0, sp
254 li a1, 1
255 jal do_syscall_trace
256 j syscall_exit
257 247
258no_mem: li v0, -ENOMEM 248no_mem: li v0, -ENOMEM
259 jr ra 249 jr ra
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 9085838d6ce3..47bfbd416709 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -93,13 +93,15 @@ syscall_trace_entry:
93 li a1, 0 93 li a1, 0
94 jal do_syscall_trace 94 jal do_syscall_trace
95 95
96 move t0, s0
97 RESTORE_STATIC
96 ld a0, PT_R4(sp) # Restore argument registers 98 ld a0, PT_R4(sp) # Restore argument registers
97 ld a1, PT_R5(sp) 99 ld a1, PT_R5(sp)
98 ld a2, PT_R6(sp) 100 ld a2, PT_R6(sp)
99 ld a3, PT_R7(sp) 101 ld a3, PT_R7(sp)
100 ld a4, PT_R8(sp) 102 ld a4, PT_R8(sp)
101 ld a5, PT_R9(sp) 103 ld a5, PT_R9(sp)
102 jalr s0 104 jalr t0
103 105
104 li t0, -EMAXERRNO - 1 # error? 106 li t0, -EMAXERRNO - 1 # error?
105 sltu t0, t0, v0 107 sltu t0, t0, v0
@@ -174,19 +176,7 @@ illegal_syscall:
174 sd zero, PT_R7(sp) # success 176 sd zero, PT_R7(sp) # success
175 sd v0, PT_R2(sp) # result 177 sd v0, PT_R2(sp) # result
176 178
177 /* Success, so skip usual error handling garbage. */ 179 j n64_syscall_exit # continue like a normal syscall
178 li t0, _TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT
179 LONG_L a2, TI_FLAGS($28) # syscall tracing enabled?
180 and t0, a2, t0
181 bnez t0, 1f
182
183 j n64_syscall_exit
184
1851: SAVE_STATIC
186 move a0, sp
187 li a1, 1
188 jal do_syscall_trace
189 j syscall_exit
190 180
191no_mem: li v0, -ENOMEM 181no_mem: li v0, -ENOMEM
192 jr ra 182 jr ra
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 7e66eb823bf6..b465ced1758f 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -90,13 +90,15 @@ n32_syscall_trace_entry:
90 li a1, 0 90 li a1, 0
91 jal do_syscall_trace 91 jal do_syscall_trace
92 92
93 move t0, s0
94 RESTORE_STATIC
93 ld a0, PT_R4(sp) # Restore argument registers 95 ld a0, PT_R4(sp) # Restore argument registers
94 ld a1, PT_R5(sp) 96 ld a1, PT_R5(sp)
95 ld a2, PT_R6(sp) 97 ld a2, PT_R6(sp)
96 ld a3, PT_R7(sp) 98 ld a3, PT_R7(sp)
97 ld a4, PT_R8(sp) 99 ld a4, PT_R8(sp)
98 ld a5, PT_R9(sp) 100 ld a5, PT_R9(sp)
99 jalr s0 101 jalr t0
100 102
101 li t0, -EMAXERRNO - 1 # error? 103 li t0, -EMAXERRNO - 1 # error?
102 sltu t0, t0, v0 104 sltu t0, t0, v0
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 5a16401e443a..3d338ca7eeeb 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -124,6 +124,8 @@ trace_a_syscall:
124 li a1, 0 124 li a1, 0
125 jal do_syscall_trace 125 jal do_syscall_trace
126 126
127 move t0, s0
128 RESTORE_STATIC
127 ld a0, PT_R4(sp) # Restore argument registers 129 ld a0, PT_R4(sp) # Restore argument registers
128 ld a1, PT_R5(sp) 130 ld a1, PT_R5(sp)
129 ld a2, PT_R6(sp) 131 ld a2, PT_R6(sp)
@@ -132,7 +134,7 @@ trace_a_syscall:
132 ld a5, PT_R9(sp) 134 ld a5, PT_R9(sp)
133 ld a6, PT_R10(sp) 135 ld a6, PT_R10(sp)
134 ld a7, PT_R11(sp) # For indirect syscalls 136 ld a7, PT_R11(sp) # For indirect syscalls
135 jalr s0 137 jalr t0
136 138
137 li t0, -EMAXERRNO - 1 # error? 139 li t0, -EMAXERRNO - 1 # error?
138 sltu t0, t0, v0 140 sltu t0, t0, v0
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index 05e09eedabff..7d1800fe7038 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -220,8 +220,6 @@ _sys_sigreturn(nabi_no_regargs struct pt_regs regs)
220 /* 220 /*
221 * Don't let your children do this ... 221 * Don't let your children do this ...
222 */ 222 */
223 if (current_thread_info()->flags & TIF_SYSCALL_TRACE)
224 do_syscall_trace(&regs, 1);
225 __asm__ __volatile__( 223 __asm__ __volatile__(
226 "move\t$29, %0\n\t" 224 "move\t$29, %0\n\t"
227 "j\tsyscall_exit" 225 "j\tsyscall_exit"
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index e315d3f6aa6e..98b185bbc947 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -497,8 +497,6 @@ _sys32_sigreturn(nabi_no_regargs struct pt_regs regs)
497 /* 497 /*
498 * Don't let your children do this ... 498 * Don't let your children do this ...
499 */ 499 */
500 if (current_thread_info()->flags & TIF_SYSCALL_TRACE)
501 do_syscall_trace(&regs, 1);
502 __asm__ __volatile__( 500 __asm__ __volatile__(
503 "move\t$29, %0\n\t" 501 "move\t$29, %0\n\t"
504 "j\tsyscall_exit" 502 "j\tsyscall_exit"
@@ -590,7 +588,7 @@ static inline int setup_sigcontext32(struct pt_regs *regs,
590 err |= __put_user(regs->hi, &sc->sc_mdhi); 588 err |= __put_user(regs->hi, &sc->sc_mdhi);
591 err |= __put_user(regs->lo, &sc->sc_mdlo); 589 err |= __put_user(regs->lo, &sc->sc_mdlo);
592 if (cpu_has_dsp) { 590 if (cpu_has_dsp) {
593 err |= __put_user(rddsp(DSP_MASK), &sc->sc_hi1); 591 err |= __put_user(rddsp(DSP_MASK), &sc->sc_dsp);
594 err |= __put_user(mfhi1(), &sc->sc_hi1); 592 err |= __put_user(mfhi1(), &sc->sc_hi1);
595 err |= __put_user(mflo1(), &sc->sc_lo1); 593 err |= __put_user(mflo1(), &sc->sc_lo1);
596 err |= __put_user(mfhi2(), &sc->sc_hi2); 594 err |= __put_user(mfhi2(), &sc->sc_hi2);
diff --git a/arch/mips/kernel/smp_mt.c b/arch/mips/kernel/smp_mt.c
index d429544ba4bc..794a1c3de2a4 100644
--- a/arch/mips/kernel/smp_mt.c
+++ b/arch/mips/kernel/smp_mt.c
@@ -287,6 +287,7 @@ void prom_prepare_cpus(unsigned int max_cpus)
287 */ 287 */
288void prom_boot_secondary(int cpu, struct task_struct *idle) 288void prom_boot_secondary(int cpu, struct task_struct *idle)
289{ 289{
290 struct thread_info *gp = task_thread_info(idle);
290 dvpe(); 291 dvpe();
291 set_c0_mvpcontrol(MVPCONTROL_VPC); 292 set_c0_mvpcontrol(MVPCONTROL_VPC);
292 293
@@ -307,11 +308,9 @@ void prom_boot_secondary(int cpu, struct task_struct *idle)
307 write_tc_gpr_sp( __KSTK_TOS(idle)); 308 write_tc_gpr_sp( __KSTK_TOS(idle));
308 309
309 /* global pointer */ 310 /* global pointer */
310 write_tc_gpr_gp((unsigned long)idle->thread_info); 311 write_tc_gpr_gp((unsigned long)gp);
311 312
312 flush_icache_range((unsigned long)idle->thread_info, 313 flush_icache_range((unsigned long)gp, (unsigned long)(gp + 1));
313 (unsigned long)idle->thread_info +
314 sizeof(struct thread_info));
315 314
316 /* finally out of configuration and into chaos */ 315 /* finally out of configuration and into chaos */
317 clear_c0_mvpcontrol(MVPCONTROL_VPC); 316 clear_c0_mvpcontrol(MVPCONTROL_VPC);
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index ee98eeb65e85..332358430ff5 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -9,6 +9,7 @@
9 */ 9 */
10#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/a.out.h> 11#include <linux/a.out.h>
12#include <linux/capability.h>
12#include <linux/errno.h> 13#include <linux/errno.h>
13#include <linux/linkage.h> 14#include <linux/linkage.h>
14#include <linux/mm.h> 15#include <linux/mm.h>
@@ -262,7 +263,7 @@ asmlinkage int sys_olduname(struct oldold_utsname * name)
262 263
263void sys_set_thread_area(unsigned long addr) 264void sys_set_thread_area(unsigned long addr)
264{ 265{
265 struct thread_info *ti = current->thread_info; 266 struct thread_info *ti = task_thread_info(current);
266 267
267 ti->tp_value = addr; 268 ti->tp_value = addr;
268 269
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c
index 52924f8ce23c..0fc3730a294f 100644
--- a/arch/mips/kernel/sysirix.c
+++ b/arch/mips/kernel/sysirix.c
@@ -8,6 +8,7 @@
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/binfmts.h> 10#include <linux/binfmts.h>
11#include <linux/capability.h>
11#include <linux/highuid.h> 12#include <linux/highuid.h>
12#include <linux/pagemap.h> 13#include <linux/pagemap.h>
13#include <linux/mm.h> 14#include <linux/mm.h>
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 787ed541d442..7050b4ffffcd 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -507,14 +507,38 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
507 return IRQ_HANDLED; 507 return IRQ_HANDLED;
508} 508}
509 509
510int null_perf_irq(struct pt_regs *regs)
511{
512 return 0;
513}
514
515int (*perf_irq)(struct pt_regs *regs) = null_perf_irq;
516
517EXPORT_SYMBOL(null_perf_irq);
518EXPORT_SYMBOL(perf_irq);
519
510asmlinkage void ll_timer_interrupt(int irq, struct pt_regs *regs) 520asmlinkage void ll_timer_interrupt(int irq, struct pt_regs *regs)
511{ 521{
522 int r2 = cpu_has_mips_r2;
523
512 irq_enter(); 524 irq_enter();
513 kstat_this_cpu.irqs[irq]++; 525 kstat_this_cpu.irqs[irq]++;
514 526
527 /*
528 * Suckage alert:
529 * Before R2 of the architecture there was no way to see if a
530 * performance counter interrupt was pending, so we have to run the
531 * performance counter interrupt handler anyway.
532 */
533 if (!r2 || (read_c0_cause() & (1 << 26)))
534 if (perf_irq(regs))
535 goto out;
536
515 /* we keep interrupt disabled all the time */ 537 /* we keep interrupt disabled all the time */
516 timer_interrupt(irq, NULL, regs); 538 if (!r2 || (read_c0_cause() & (1 << 30)))
539 timer_interrupt(irq, NULL, regs);
517 540
541out:
518 irq_exit(); 542 irq_exit();
519} 543}
520 544
@@ -628,9 +652,9 @@ void __init time_init(void)
628 mips_hpt_init = c0_hpt_init; 652 mips_hpt_init = c0_hpt_init;
629 } 653 }
630 654
631 if ((current_cpu_data.isa_level == MIPS_CPU_ISA_M32) || 655 if (cpu_has_mips32r1 || cpu_has_mips32r2 ||
632 (current_cpu_data.isa_level == MIPS_CPU_ISA_I) || 656 (current_cpu_data.isa_level == MIPS_CPU_ISA_I) ||
633 (current_cpu_data.isa_level == MIPS_CPU_ISA_II)) 657 (current_cpu_data.isa_level == MIPS_CPU_ISA_II))
634 /* 658 /*
635 * We need to calibrate the counter but we don't have 659 * We need to calibrate the counter but we don't have
636 * 64-bit division. 660 * 64-bit division.
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 6f3ff9690686..59a187956de0 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -519,7 +519,7 @@ static inline int simulate_llsc(struct pt_regs *regs)
519 */ 519 */
520static inline int simulate_rdhwr(struct pt_regs *regs) 520static inline int simulate_rdhwr(struct pt_regs *regs)
521{ 521{
522 struct thread_info *ti = current->thread_info; 522 struct thread_info *ti = task_thread_info(current);
523 unsigned int opcode; 523 unsigned int opcode;
524 524
525 if (unlikely(get_insn_opcode(regs, &opcode))) 525 if (unlikely(get_insn_opcode(regs, &opcode)))
@@ -534,13 +534,14 @@ static inline int simulate_rdhwr(struct pt_regs *regs)
534 switch (rd) { 534 switch (rd) {
535 case 29: 535 case 29:
536 regs->regs[rt] = ti->tp_value; 536 regs->regs[rt] = ti->tp_value;
537 break; 537 return 0;
538 default: 538 default:
539 return -EFAULT; 539 return -EFAULT;
540 } 540 }
541 } 541 }
542 542
543 return 0; 543 /* Not ours. */
544 return -EFAULT;
544} 545}
545 546
546asmlinkage void do_ov(struct pt_regs *regs) 547asmlinkage void do_ov(struct pt_regs *regs)
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 06be405be399..ae83b755cf4a 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -99,9 +99,9 @@ struct vpe {
99 99
100 /* elfloader stuff */ 100 /* elfloader stuff */
101 void *load_addr; 101 void *load_addr;
102 u32 len; 102 unsigned long len;
103 char *pbuffer; 103 char *pbuffer;
104 u32 plen; 104 unsigned long plen;
105 105
106 unsigned long __start; 106 unsigned long __start;
107 107
@@ -253,11 +253,11 @@ void dump_mtregs(void)
253} 253}
254 254
255/* Find some VPE program space */ 255/* Find some VPE program space */
256static void *alloc_progmem(u32 len) 256static void *alloc_progmem(unsigned long len)
257{ 257{
258#ifdef CONFIG_MIPS_VPE_LOADER_TOM 258#ifdef CONFIG_MIPS_VPE_LOADER_TOM
259 /* this means you must tell linux to use less memory than you physically have */ 259 /* this means you must tell linux to use less memory than you physically have */
260 return (void *)((max_pfn * PAGE_SIZE) + KSEG0); 260 return pfn_to_kaddr(max_pfn);
261#else 261#else
262 // simple grab some mem for now 262 // simple grab some mem for now
263 return kmalloc(len, GFP_KERNEL); 263 return kmalloc(len, GFP_KERNEL);
@@ -1171,7 +1171,8 @@ static int __init vpe_module_init(void)
1171 return -ENODEV; 1171 return -ENODEV;
1172 } 1172 }
1173 1173
1174 if ((major = register_chrdev(0, module_name, &vpe_fops) < 0)) { 1174 major = register_chrdev(0, module_name, &vpe_fops);
1175 if (major < 0) {
1175 printk("VPE loader: unable to register character device\n"); 1176 printk("VPE loader: unable to register character device\n");
1176 return major; 1177 return major;
1177 } 1178 }
diff --git a/arch/mips/lib/iomap.c b/arch/mips/lib/iomap.c
index b5d5fa833762..7e2ced715cfb 100644
--- a/arch/mips/lib/iomap.c
+++ b/arch/mips/lib/iomap.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * This code is based on lib/iomap.c, by Linus Torvalds. 4 * This code is based on lib/iomap.c, by Linus Torvalds.
5 * 5 *
6 * Copyright (C) 2004-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 6 * Copyright (C) 2004-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/math-emu/dp_fint.c b/arch/mips/math-emu/dp_fint.c
index 0065deaee24b..a1962eb460f8 100644
--- a/arch/mips/math-emu/dp_fint.c
+++ b/arch/mips/math-emu/dp_fint.c
@@ -33,8 +33,6 @@ ieee754dp ieee754dp_fint(int x)
33 33
34 CLEARCX; 34 CLEARCX;
35 35
36 xc = ( 0 ? xc : xc );
37
38 if (x == 0) 36 if (x == 0)
39 return ieee754dp_zero(0); 37 return ieee754dp_zero(0);
40 if (x == 1 || x == -1) 38 if (x == 1 || x == -1)
diff --git a/arch/mips/math-emu/dp_flong.c b/arch/mips/math-emu/dp_flong.c
index cb105b1dd860..eae90a866aa1 100644
--- a/arch/mips/math-emu/dp_flong.c
+++ b/arch/mips/math-emu/dp_flong.c
@@ -33,8 +33,6 @@ ieee754dp ieee754dp_flong(s64 x)
33 33
34 CLEARCX; 34 CLEARCX;
35 35
36 xc = ( 0 ? xc : xc );
37
38 if (x == 0) 36 if (x == 0)
39 return ieee754dp_zero(0); 37 return ieee754dp_zero(0);
40 if (x == 1 || x == -1) 38 if (x == 1 || x == -1)
diff --git a/arch/mips/math-emu/sp_fint.c b/arch/mips/math-emu/sp_fint.c
index 42d9ed4b9a94..7aac13afb09a 100644
--- a/arch/mips/math-emu/sp_fint.c
+++ b/arch/mips/math-emu/sp_fint.c
@@ -33,8 +33,6 @@ ieee754sp ieee754sp_fint(int x)
33 33
34 CLEARCX; 34 CLEARCX;
35 35
36 xc = ( 0 ? xc : xc );
37
38 if (x == 0) 36 if (x == 0)
39 return ieee754sp_zero(0); 37 return ieee754sp_zero(0);
40 if (x == 1 || x == -1) 38 if (x == 1 || x == -1)
diff --git a/arch/mips/math-emu/sp_flong.c b/arch/mips/math-emu/sp_flong.c
index 1e26795ccecb..3d6c1d11c178 100644
--- a/arch/mips/math-emu/sp_flong.c
+++ b/arch/mips/math-emu/sp_flong.c
@@ -33,8 +33,6 @@ ieee754sp ieee754sp_flong(s64 x)
33 33
34 CLEARCX; 34 CLEARCX;
35 35
36 xc = ( 0 ? xc : xc );
37
38 if (x == 0) 36 if (x == 0)
39 return ieee754sp_zero(0); 37 return ieee754sp_zero(0);
40 if (x == 1 || x == -1) 38 if (x == 1 || x == -1)
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index 72a12d931cba..93f3bf2c2b22 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -75,20 +75,31 @@ static void mips_timer_dispatch (struct pt_regs *regs)
75 do_IRQ (mips_cpu_timer_irq, regs); 75 do_IRQ (mips_cpu_timer_irq, regs);
76} 76}
77 77
78extern int null_perf_irq(struct pt_regs *regs);
79
80extern int (*perf_irq)(struct pt_regs *regs);
81
78irqreturn_t mips_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs) 82irqreturn_t mips_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
79{ 83{
80#ifdef CONFIG_SMP 84 int r2 = cpu_has_mips_r2;
81 int cpu = smp_processor_id(); 85 int cpu = smp_processor_id();
82 86
83 if (cpu == 0) { 87 if (cpu == 0) {
84 /* 88 /*
85 * CPU 0 handles the global timer interrupt job and process accounting 89 * CPU 0 handles the global timer interrupt job and process
86 * resets count/compare registers to trigger next timer int. 90 * accounting resets count/compare registers to trigger next
91 * timer int.
87 */ 92 */
88 (void) timer_interrupt(irq, dev_id, regs); 93 if (!r2 || (read_c0_cause() & (1 << 26)))
94 if (perf_irq(regs))
95 goto out;
96
97 /* we keep interrupt disabled all the time */
98 if (!r2 || (read_c0_cause() & (1 << 30)))
99 timer_interrupt(irq, NULL, regs);
100
89 scroll_display_message(); 101 scroll_display_message();
90 } 102 } else {
91 else {
92 /* Everyone else needs to reset the timer int here as 103 /* Everyone else needs to reset the timer int here as
93 ll_local_timer_interrupt doesn't */ 104 ll_local_timer_interrupt doesn't */
94 /* 105 /*
@@ -103,16 +114,8 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
103 local_timer_interrupt (irq, dev_id, regs); 114 local_timer_interrupt (irq, dev_id, regs);
104 } 115 }
105 116
117out:
106 return IRQ_HANDLED; 118 return IRQ_HANDLED;
107#else
108 irqreturn_t r;
109
110 r = timer_interrupt(irq, dev_id, regs);
111
112 scroll_display_message();
113
114 return r;
115#endif
116} 119}
117 120
118/* 121/*
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index 38223b44d962..422b55fab07a 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -1183,8 +1183,8 @@ static void __init setup_scache(void)
1183 if (!sc_present) 1183 if (!sc_present)
1184 return; 1184 return;
1185 1185
1186 if ((c->isa_level == MIPS_CPU_ISA_M32 || 1186 if ((c->isa_level == MIPS_CPU_ISA_M32R1 ||
1187 c->isa_level == MIPS_CPU_ISA_M64) && 1187 c->isa_level == MIPS_CPU_ISA_M64R1) &&
1188 !(c->scache.flags & MIPS_CACHE_NOT_PRESENT)) 1188 !(c->scache.flags & MIPS_CACHE_NOT_PRESENT))
1189 panic("Dunno how to handle MIPS32 / MIPS64 second level cache"); 1189 panic("Dunno how to handle MIPS32 / MIPS64 second level cache");
1190 1190
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index f75ab748e8cd..4ee91c9a556f 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -67,8 +67,8 @@ unsigned long setup_zero_pages(void)
67 67
68 page = virt_to_page(empty_zero_page); 68 page = virt_to_page(empty_zero_page);
69 while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) { 69 while (page < virt_to_page(empty_zero_page + (PAGE_SIZE << order))) {
70 set_bit(PG_reserved, &page->flags); 70 SetPageReserved(page);
71 set_page_count(page, 0); 71 set_page_count(page, 1);
72 page++; 72 page++;
73 } 73 }
74 74
diff --git a/arch/mips/oprofile/common.c b/arch/mips/oprofile/common.c
index dd2cc42f1b6d..53f9889b30ed 100644
--- a/arch/mips/oprofile/common.c
+++ b/arch/mips/oprofile/common.c
@@ -75,7 +75,10 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
75 int res; 75 int res;
76 76
77 switch (current_cpu_data.cputype) { 77 switch (current_cpu_data.cputype) {
78 case CPU_5KC:
79 case CPU_20KC:
78 case CPU_24K: 80 case CPU_24K:
81 case CPU_25KF:
79 lmodel = &op_model_mipsxx; 82 lmodel = &op_model_mipsxx;
80 break; 83 break;
81 84
diff --git a/arch/mips/oprofile/op_impl.h b/arch/mips/oprofile/op_impl.h
index f0121557047d..5cfce7d87a4d 100644
--- a/arch/mips/oprofile/op_impl.h
+++ b/arch/mips/oprofile/op_impl.h
@@ -12,8 +12,8 @@
12 12
13struct pt_regs; 13struct pt_regs;
14 14
15extern void null_perf_irq(struct pt_regs *regs); 15extern int null_perf_irq(struct pt_regs *regs);
16extern void (*perf_irq)(struct pt_regs *regs); 16extern int (*perf_irq)(struct pt_regs *regs);
17 17
18/* Per-counter configuration as set via oprofilefs. */ 18/* Per-counter configuration as set via oprofilefs. */
19struct op_counter_config { 19struct op_counter_config {
diff --git a/arch/mips/oprofile/op_model_mipsxx.c b/arch/mips/oprofile/op_model_mipsxx.c
index d36b64dfcb2f..1d1eee407faf 100644
--- a/arch/mips/oprofile/op_model_mipsxx.c
+++ b/arch/mips/oprofile/op_model_mipsxx.c
@@ -114,11 +114,12 @@ static void mipsxx_cpu_stop(void *args)
114 } 114 }
115} 115}
116 116
117static void mipsxx_perfcount_handler(struct pt_regs *regs) 117static int mipsxx_perfcount_handler(struct pt_regs *regs)
118{ 118{
119 unsigned int counters = op_model_mipsxx.num_counters; 119 unsigned int counters = op_model_mipsxx.num_counters;
120 unsigned int control; 120 unsigned int control;
121 unsigned int counter; 121 unsigned int counter;
122 int handled = 0;
122 123
123 switch (counters) { 124 switch (counters) {
124#define HANDLE_COUNTER(n) \ 125#define HANDLE_COUNTER(n) \
@@ -129,12 +130,15 @@ static void mipsxx_perfcount_handler(struct pt_regs *regs)
129 (counter & M_COUNTER_OVERFLOW)) { \ 130 (counter & M_COUNTER_OVERFLOW)) { \
130 oprofile_add_sample(regs, n); \ 131 oprofile_add_sample(regs, n); \
131 write_c0_perfcntr ## n(reg.counter[n]); \ 132 write_c0_perfcntr ## n(reg.counter[n]); \
133 handled = 1; \
132 } 134 }
133 HANDLE_COUNTER(3) 135 HANDLE_COUNTER(3)
134 HANDLE_COUNTER(2) 136 HANDLE_COUNTER(2)
135 HANDLE_COUNTER(1) 137 HANDLE_COUNTER(1)
136 HANDLE_COUNTER(0) 138 HANDLE_COUNTER(0)
137 } 139 }
140
141 return handled;
138} 142}
139 143
140#define M_CONFIG1_PC (1 << 4) 144#define M_CONFIG1_PC (1 << 4)
@@ -176,17 +180,31 @@ static int __init mipsxx_init(void)
176 int counters; 180 int counters;
177 181
178 counters = n_counters(); 182 counters = n_counters();
179 if (counters == 0) 183 if (counters == 0) {
184 printk(KERN_ERR "Oprofile: CPU has no performance counters\n");
180 return -ENODEV; 185 return -ENODEV;
186 }
181 187
182 reset_counters(counters); 188 reset_counters(counters);
183 189
184 op_model_mipsxx.num_counters = counters; 190 op_model_mipsxx.num_counters = counters;
185 switch (current_cpu_data.cputype) { 191 switch (current_cpu_data.cputype) {
192 case CPU_20KC:
193 op_model_mipsxx.cpu_type = "mips/20K";
194 break;
195
186 case CPU_24K: 196 case CPU_24K:
187 op_model_mipsxx.cpu_type = "mips/24K"; 197 op_model_mipsxx.cpu_type = "mips/24K";
188 break; 198 break;
189 199
200 case CPU_25KF:
201 op_model_mipsxx.cpu_type = "mips/25K";
202 break;
203
204 case CPU_5KC:
205 op_model_mipsxx.cpu_type = "mips/5K";
206 break;
207
190 default: 208 default:
191 printk(KERN_ERR "Profiling unsupported for this CPU\n"); 209 printk(KERN_ERR "Profiling unsupported for this CPU\n");
192 210
diff --git a/arch/mips/pci/fixup-capcella.c b/arch/mips/pci/fixup-capcella.c
index f2fc82c1c7c5..1e530751936c 100644
--- a/arch/mips/pci/fixup-capcella.c
+++ b/arch/mips/pci/fixup-capcella.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * fixup-cappcela.c, The ZAO Networks Capcella specific PCI fixups. 2 * fixup-cappcela.c, The ZAO Networks Capcella specific PCI fixups.
3 * 3 *
4 * Copyright (C) 2002,2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002,2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/pci/fixup-mpc30x.c b/arch/mips/pci/fixup-mpc30x.c
index 4975846da75a..b67ddaa47122 100644
--- a/arch/mips/pci/fixup-mpc30x.c
+++ b/arch/mips/pci/fixup-mpc30x.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * fixup-mpc30x.c, The Victor MP-C303/304 specific PCI fixups. 2 * fixup-mpc30x.c, The Victor MP-C303/304 specific PCI fixups.
3 * 3 *
4 * Copyright (C) 2002,2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002,2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/pci/fixup-tb0219.c b/arch/mips/pci/fixup-tb0219.c
index bc55b06e1904..734f2b71e164 100644
--- a/arch/mips/pci/fixup-tb0219.c
+++ b/arch/mips/pci/fixup-tb0219.c
@@ -2,7 +2,7 @@
2 * fixup-tb0219.c, The TANBAC TB0219 specific PCI fixups. 2 * fixup-tb0219.c, The TANBAC TB0219 specific PCI fixups.
3 * 3 *
4 * Copyright (C) 2003 Megasolution Inc. <matsu@megasolution.jp> 4 * Copyright (C) 2003 Megasolution Inc. <matsu@megasolution.jp>
5 * Copyright (C) 2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 5 * Copyright (C) 2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by 8 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/pci/fixup-tb0226.c b/arch/mips/pci/fixup-tb0226.c
index b5d42b12de10..c9e7cb4361a1 100644
--- a/arch/mips/pci/fixup-tb0226.c
+++ b/arch/mips/pci/fixup-tb0226.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * fixup-tb0226.c, The TANBAC TB0226 specific PCI fixups. 2 * fixup-tb0226.c, The TANBAC TB0226 specific PCI fixups.
3 * 3 *
4 * Copyright (C) 2002-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/pci/fixup-tb0287.c b/arch/mips/pci/fixup-tb0287.c
index 8436d7f1fdb2..fbe6bcb28199 100644
--- a/arch/mips/pci/fixup-tb0287.c
+++ b/arch/mips/pci/fixup-tb0287.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * fixup-tb0287.c, The TANBAC TB0287 specific PCI fixups. 2 * fixup-tb0287.c, The TANBAC TB0287 specific PCI fixups.
3 * 3 *
4 * Copyright (C) 2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/pci/ops-vr41xx.c b/arch/mips/pci/ops-vr41xx.c
index 430429b22ae1..900c6b32576c 100644
--- a/arch/mips/pci/ops-vr41xx.c
+++ b/arch/mips/pci/ops-vr41xx.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001-2003 MontaVista Software Inc. 4 * Copyright (C) 2001-2003 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com> 5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2004-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 6 * Copyright (C) 2004-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/pci/pci-vr41xx.c b/arch/mips/pci/pci-vr41xx.c
index 91df4da7ddb9..9885fa403603 100644
--- a/arch/mips/pci/pci-vr41xx.c
+++ b/arch/mips/pci/pci-vr41xx.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001-2003 MontaVista Software Inc. 4 * Copyright (C) 2001-2003 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com> 5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2004-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 6 * Copyright (C) 2004-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
7 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org) 7 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
diff --git a/arch/mips/pci/pci-vr41xx.h b/arch/mips/pci/pci-vr41xx.h
index e087ec55641d..8a35e32b8376 100644
--- a/arch/mips/pci/pci-vr41xx.h
+++ b/arch/mips/pci/pci-vr41xx.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2002 MontaVista Software Inc. 4 * Copyright (C) 2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com> 5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2004-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 6 * Copyright (C) 2004-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c
index 0527170d6adb..f17f575f58f0 100644
--- a/arch/mips/pmc-sierra/yosemite/smp.c
+++ b/arch/mips/pmc-sierra/yosemite/smp.c
@@ -93,8 +93,8 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
93 */ 93 */
94void prom_boot_secondary(int cpu, struct task_struct *idle) 94void prom_boot_secondary(int cpu, struct task_struct *idle)
95{ 95{
96 unsigned long gp = (unsigned long) idle->thread_info; 96 unsigned long gp = (unsigned long) task_thread_info(idle);
97 unsigned long sp = gp + THREAD_SIZE - 32; 97 unsigned long sp = __KSTK_TOP(idle);
98 98
99 secondary_sp = sp; 99 secondary_sp = sp;
100 secondary_gp = gp; 100 secondary_gp = gp;
diff --git a/arch/mips/qemu/q-firmware.c b/arch/mips/qemu/q-firmware.c
index 5980f02b2df9..fb2a8673a6bf 100644
--- a/arch/mips/qemu/q-firmware.c
+++ b/arch/mips/qemu/q-firmware.c
@@ -1,7 +1,18 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/string.h>
3#include <asm/addrspace.h>
2#include <asm/bootinfo.h> 4#include <asm/bootinfo.h>
3 5
4void __init prom_init(void) 6void __init prom_init(void)
5{ 7{
6 add_memory_region(0x0<<20, 0x10<<20, BOOT_MEM_RAM); 8 int *cmdline;
9
10 cmdline = (int *) (CKSEG0 + (0x10 << 20) - 260);
11 if (*cmdline == 0x12345678) {
12 if (*(char *)(cmdline + 1))
13 strcpy (arcs_cmdline, (char *)(cmdline + 1));
14 add_memory_region(0x0<<20, cmdline[-1], BOOT_MEM_RAM);
15 } else {
16 add_memory_region(0x0<<20, 0x10<<20, BOOT_MEM_RAM);
17 }
7} 18}
diff --git a/arch/mips/sgi-ip27/ip27-berr.c b/arch/mips/sgi-ip27/ip27-berr.c
index 07631a97670b..ce907eda221b 100644
--- a/arch/mips/sgi-ip27/ip27-berr.c
+++ b/arch/mips/sgi-ip27/ip27-berr.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/signal.h> /* for SIGBUS */ 13#include <linux/signal.h> /* for SIGBUS */
14#include <linux/sched.h> /* schow_regs(), force_sig() */
14 15
15#include <asm/module.h> 16#include <asm/module.h>
16#include <asm/sn/addrs.h> 17#include <asm/sn/addrs.h>
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index 3a8291b7d26d..dbef3f6b5650 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -168,8 +168,8 @@ void __init prom_prepare_cpus(unsigned int max_cpus)
168 */ 168 */
169void __init prom_boot_secondary(int cpu, struct task_struct *idle) 169void __init prom_boot_secondary(int cpu, struct task_struct *idle)
170{ 170{
171 unsigned long gp = (unsigned long) idle->thread_info; 171 unsigned long gp = (unsigned long)task_thread_info(idle);
172 unsigned long sp = gp + THREAD_SIZE - 32; 172 unsigned long sp = __KSTK_TOS(idle);
173 173
174 LAUNCH_SLAVE(cputonasid(cpu),cputoslice(cpu), 174 LAUNCH_SLAVE(cputonasid(cpu),cputoslice(cpu),
175 (launch_proc_t)MAPPED_KERN_RW_TO_K0(smp_bootstrap), 175 (launch_proc_t)MAPPED_KERN_RW_TO_K0(smp_bootstrap),
diff --git a/arch/mips/sibyte/cfe/smp.c b/arch/mips/sibyte/cfe/smp.c
index e8485124b8fc..4477af3d8074 100644
--- a/arch/mips/sibyte/cfe/smp.c
+++ b/arch/mips/sibyte/cfe/smp.c
@@ -60,7 +60,7 @@ void prom_boot_secondary(int cpu, struct task_struct *idle)
60 60
61 retval = cfe_cpu_start(cpu_logical_map(cpu), &smp_bootstrap, 61 retval = cfe_cpu_start(cpu_logical_map(cpu), &smp_bootstrap,
62 __KSTK_TOS(idle), 62 __KSTK_TOS(idle),
63 (unsigned long)idle->thread_info, 0); 63 (unsigned long)task_thread_info(idle), 0);
64 if (retval != 0) 64 if (retval != 0)
65 printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval); 65 printk("cfe_start_cpu(%i) returned %i\n" , cpu, retval);
66} 66}
diff --git a/arch/mips/vr41xx/casio-e55/setup.c b/arch/mips/vr41xx/casio-e55/setup.c
index d29201acc4f3..814900915c28 100644
--- a/arch/mips/vr41xx/casio-e55/setup.c
+++ b/arch/mips/vr41xx/casio-e55/setup.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * setup.c, Setup for the CASIO CASSIOPEIA E-11/15/55/65. 2 * setup.c, Setup for the CASIO CASSIOPEIA E-11/15/55/65.
3 * 3 *
4 * Copyright (C) 2002-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/vr41xx/common/bcu.c b/arch/mips/vr41xx/common/bcu.c
index cdfa4273a1c5..de0c1b35f11c 100644
--- a/arch/mips/vr41xx/common/bcu.c
+++ b/arch/mips/vr41xx/common/bcu.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2002 MontaVista Software Inc. 4 * Copyright (C) 2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> 5 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com>
6 * Copyright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 6 * Copyright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
25 * - New creation, NEC VR4122 and VR4131 are supported. 25 * - New creation, NEC VR4122 and VR4131 are supported.
26 * - Added support for NEC VR4111 and VR4121. 26 * - Added support for NEC VR4111 and VR4121.
27 * 27 *
28 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 28 * Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
29 * - Added support for NEC VR4133. 29 * - Added support for NEC VR4133.
30 */ 30 */
31#include <linux/kernel.h> 31#include <linux/kernel.h>
diff --git a/arch/mips/vr41xx/common/cmu.c b/arch/mips/vr41xx/common/cmu.c
index d758e432961b..657c5133c933 100644
--- a/arch/mips/vr41xx/common/cmu.c
+++ b/arch/mips/vr41xx/common/cmu.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001-2002 MontaVista Software Inc. 4 * Copyright (C) 2001-2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com> 5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copuright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 6 * Copuright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
25 * - New creation, NEC VR4122 and VR4131 are supported. 25 * - New creation, NEC VR4122 and VR4131 are supported.
26 * - Added support for NEC VR4111 and VR4121. 26 * - Added support for NEC VR4111 and VR4121.
27 * 27 *
28 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 28 * Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
29 * - Added support for NEC VR4133. 29 * - Added support for NEC VR4133.
30 */ 30 */
31#include <linux/init.h> 31#include <linux/init.h>
diff --git a/arch/mips/vr41xx/common/icu.c b/arch/mips/vr41xx/common/icu.c
index 0b73c5ab3c0c..07ae19cf0c29 100644
--- a/arch/mips/vr41xx/common/icu.c
+++ b/arch/mips/vr41xx/common/icu.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001-2002 MontaVista Software Inc. 4 * Copyright (C) 2001-2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com> 5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 6 * Copyright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
25 * - New creation, NEC VR4122 and VR4131 are supported. 25 * - New creation, NEC VR4122 and VR4131 are supported.
26 * - Added support for NEC VR4111 and VR4121. 26 * - Added support for NEC VR4111 and VR4121.
27 * 27 *
28 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 28 * Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
29 * - Coped with INTASSIGN of NEC VR4133. 29 * - Coped with INTASSIGN of NEC VR4133.
30 */ 30 */
31#include <linux/errno.h> 31#include <linux/errno.h>
diff --git a/arch/mips/vr41xx/common/init.c b/arch/mips/vr41xx/common/init.c
index 578f6496ffd4..707bd0933eed 100644
--- a/arch/mips/vr41xx/common/init.c
+++ b/arch/mips/vr41xx/common/init.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * init.c, Common initialization routines for NEC VR4100 series. 2 * init.c, Common initialization routines for NEC VR4100 series.
3 * 3 *
4 * Copyright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/vr41xx/common/int-handler.S b/arch/mips/vr41xx/common/int-handler.S
index 272c13aee4fd..2b6043f16d09 100644
--- a/arch/mips/vr41xx/common/int-handler.S
+++ b/arch/mips/vr41xx/common/int-handler.S
@@ -35,7 +35,7 @@
35 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com> 35 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
36 * - New creation, NEC VR4100 series are supported. 36 * - New creation, NEC VR4100 series are supported.
37 * 37 *
38 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 38 * Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
39 * - Coped with INTASSIGN of NEC VR4133. 39 * - Coped with INTASSIGN of NEC VR4133.
40 */ 40 */
41#include <asm/asm.h> 41#include <asm/asm.h>
diff --git a/arch/mips/vr41xx/common/irq.c b/arch/mips/vr41xx/common/irq.c
index 43b214d39438..61aa264275ff 100644
--- a/arch/mips/vr41xx/common/irq.c
+++ b/arch/mips/vr41xx/common/irq.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Interrupt handing routines for NEC VR4100 series. 2 * Interrupt handing routines for NEC VR4100 series.
3 * 3 *
4 * Copyright (C) 2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/vr41xx/common/pmu.c b/arch/mips/vr41xx/common/pmu.c
index 53166f3598b2..02bf4f7d06ba 100644
--- a/arch/mips/vr41xx/common/pmu.c
+++ b/arch/mips/vr41xx/common/pmu.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * pmu.c, Power Management Unit routines for NEC VR4100 series. 2 * pmu.c, Power Management Unit routines for NEC VR4100 series.
3 * 3 *
4 * Copyright (C) 2003-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2003-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/vr41xx/common/type.c b/arch/mips/vr41xx/common/type.c
index bcb5f71b5026..e0c1ac5e988e 100644
--- a/arch/mips/vr41xx/common/type.c
+++ b/arch/mips/vr41xx/common/type.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * type.c, System type for NEC VR4100 series. 2 * type.c, System type for NEC VR4100 series.
3 * 3 *
4 * Copyright (C) 2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/arch/mips/vr41xx/common/vrc4173.c b/arch/mips/vr41xx/common/vrc4173.c
index 462a9af30eef..3e31f8193d21 100644
--- a/arch/mips/vr41xx/common/vrc4173.c
+++ b/arch/mips/vr41xx/common/vrc4173.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2001-2003 MontaVista Software Inc. 4 * Copyright (C) 2001-2003 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com> 5 * Author: Yoichi Yuasa <yyuasa@mvista.com, or source@mvista.com>
6 * Copyright (C) 2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 6 * Copyright (C) 2004 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org) 7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 * 8 *
9 * This program is free software; you can redistribute it and/or modify 9 * This program is free software; you can redistribute it and/or modify
@@ -561,7 +561,7 @@ static int __devinit vrc4173_init(void)
561{ 561{
562 int err; 562 int err;
563 563
564 err = pci_module_init(&vrc4173_driver); 564 err = pci_register_driver(&vrc4173_driver);
565 if (err < 0) 565 if (err < 0)
566 return err; 566 return err;
567 567
diff --git a/arch/mips/vr41xx/ibm-workpad/setup.c b/arch/mips/vr41xx/ibm-workpad/setup.c
index e4b34ad6ea61..50fe8af4c52c 100644
--- a/arch/mips/vr41xx/ibm-workpad/setup.c
+++ b/arch/mips/vr41xx/ibm-workpad/setup.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * setup.c, Setup for the IBM WorkPad z50. 2 * setup.c, Setup for the IBM WorkPad z50.
3 * 3 *
4 * Copyright (C) 2002-2005 Yoichi Yuasa <yuasa@hh.iij4u.or.jp> 4 * Copyright (C) 2002-2005 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by 7 * it under the terms of the GNU General Public License as published by
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 874a283edb95..e77a06e9621e 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -19,9 +19,6 @@ config MMU
19config STACK_GROWSUP 19config STACK_GROWSUP
20 def_bool y 20 def_bool y
21 21
22config UID16
23 bool
24
25config RWSEM_GENERIC_SPINLOCK 22config RWSEM_GENERIC_SPINLOCK
26 def_bool y 23 def_bool y
27 24
diff --git a/arch/parisc/configs/a500_defconfig b/arch/parisc/configs/a500_defconfig
index 955ef5084f3e..959ad3c4e372 100644
--- a/arch/parisc/configs/a500_defconfig
+++ b/arch/parisc/configs/a500_defconfig
@@ -602,6 +602,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
602# CONFIG_DL2K is not set 602# CONFIG_DL2K is not set
603CONFIG_E1000=m 603CONFIG_E1000=m
604CONFIG_E1000_NAPI=y 604CONFIG_E1000_NAPI=y
605# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
605# CONFIG_NS83820 is not set 606# CONFIG_NS83820 is not set
606# CONFIG_HAMACHI is not set 607# CONFIG_HAMACHI is not set
607# CONFIG_YELLOWFIN is not set 608# CONFIG_YELLOWFIN is not set
diff --git a/arch/parisc/configs/c3000_defconfig b/arch/parisc/configs/c3000_defconfig
index 9d86b6b1ebd1..0b1c8c1fa8a3 100644
--- a/arch/parisc/configs/c3000_defconfig
+++ b/arch/parisc/configs/c3000_defconfig
@@ -626,6 +626,7 @@ CONFIG_ACENIC=m
626# CONFIG_DL2K is not set 626# CONFIG_DL2K is not set
627CONFIG_E1000=m 627CONFIG_E1000=m
628# CONFIG_E1000_NAPI is not set 628# CONFIG_E1000_NAPI is not set
629# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
629# CONFIG_NS83820 is not set 630# CONFIG_NS83820 is not set
630# CONFIG_HAMACHI is not set 631# CONFIG_HAMACHI is not set
631# CONFIG_YELLOWFIN is not set 632# CONFIG_YELLOWFIN is not set
diff --git a/arch/parisc/hpux/sys_hpux.c b/arch/parisc/hpux/sys_hpux.c
index a64fd48fbfb5..29b4d61898f2 100644
--- a/arch/parisc/hpux/sys_hpux.c
+++ b/arch/parisc/hpux/sys_hpux.c
@@ -22,6 +22,7 @@
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 23 */
24 24
25#include <linux/capability.h>
25#include <linux/file.h> 26#include <linux/file.h>
26#include <linux/fs.h> 27#include <linux/fs.h>
27#include <linux/namei.h> 28#include <linux/namei.h>
diff --git a/arch/parisc/kernel/Makefile b/arch/parisc/kernel/Makefile
index 171f9c239f60..27827bc3717e 100644
--- a/arch/parisc/kernel/Makefile
+++ b/arch/parisc/kernel/Makefile
@@ -6,7 +6,6 @@ extra-y := init_task.o head.o vmlinux.lds
6 6
7AFLAGS_entry.o := -traditional 7AFLAGS_entry.o := -traditional
8AFLAGS_pacache.o := -traditional 8AFLAGS_pacache.o := -traditional
9CFLAGS_ioctl32.o := -Ifs/
10 9
11obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \ 10obj-y := cache.o pacache.o setup.o traps.o time.o irq.o \
12 pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \ 11 pa7300lc.o syscall.o entry.o sys_parisc.o firmware.o \
@@ -19,6 +18,6 @@ obj-$(CONFIG_SMP) += smp.o
19obj-$(CONFIG_PA11) += pci-dma.o 18obj-$(CONFIG_PA11) += pci-dma.o
20obj-$(CONFIG_PCI) += pci.o 19obj-$(CONFIG_PCI) += pci.o
21obj-$(CONFIG_MODULES) += module.o 20obj-$(CONFIG_MODULES) += module.o
22obj-$(CONFIG_64BIT) += binfmt_elf32.o sys_parisc32.o ioctl32.o signal32.o 21obj-$(CONFIG_64BIT) += binfmt_elf32.o sys_parisc32.o signal32.o
23# only supported for PCX-W/U in 64-bit mode at the moment 22# only supported for PCX-W/U in 64-bit mode at the moment
24obj-$(CONFIG_64BIT) += perf.o perf_asm.o 23obj-$(CONFIG_64BIT) += perf.o perf_asm.o
diff --git a/arch/parisc/kernel/cache.c b/arch/parisc/kernel/cache.c
index a065349aee37..d8a4ca021aac 100644
--- a/arch/parisc/kernel/cache.c
+++ b/arch/parisc/kernel/cache.c
@@ -29,9 +29,9 @@
29#include <asm/processor.h> 29#include <asm/processor.h>
30#include <asm/sections.h> 30#include <asm/sections.h>
31 31
32int split_tlb; 32int split_tlb __read_mostly;
33int dcache_stride; 33int dcache_stride __read_mostly;
34int icache_stride; 34int icache_stride __read_mostly;
35EXPORT_SYMBOL(dcache_stride); 35EXPORT_SYMBOL(dcache_stride);
36 36
37 37
@@ -45,29 +45,29 @@ DEFINE_SPINLOCK(pa_tlb_lock);
45EXPORT_SYMBOL(pa_tlb_lock); 45EXPORT_SYMBOL(pa_tlb_lock);
46#endif 46#endif
47 47
48struct pdc_cache_info cache_info; 48struct pdc_cache_info cache_info __read_mostly;
49#ifndef CONFIG_PA20 49#ifndef CONFIG_PA20
50static struct pdc_btlb_info btlb_info; 50static struct pdc_btlb_info btlb_info __read_mostly;
51#endif 51#endif
52 52
53#ifdef CONFIG_SMP 53#ifdef CONFIG_SMP
54void 54void
55flush_data_cache(void) 55flush_data_cache(void)
56{ 56{
57 on_each_cpu((void (*)(void *))flush_data_cache_local, NULL, 1, 1); 57 on_each_cpu(flush_data_cache_local, NULL, 1, 1);
58} 58}
59void 59void
60flush_instruction_cache(void) 60flush_instruction_cache(void)
61{ 61{
62 on_each_cpu((void (*)(void *))flush_instruction_cache_local, NULL, 1, 1); 62 on_each_cpu(flush_instruction_cache_local, NULL, 1, 1);
63} 63}
64#endif 64#endif
65 65
66void 66void
67flush_cache_all_local(void) 67flush_cache_all_local(void)
68{ 68{
69 flush_instruction_cache_local(); 69 flush_instruction_cache_local(NULL);
70 flush_data_cache_local(); 70 flush_data_cache_local(NULL);
71} 71}
72EXPORT_SYMBOL(flush_cache_all_local); 72EXPORT_SYMBOL(flush_cache_all_local);
73 73
@@ -332,7 +332,7 @@ void clear_user_page_asm(void *page, unsigned long vaddr)
332} 332}
333 333
334#define FLUSH_THRESHOLD 0x80000 /* 0.5MB */ 334#define FLUSH_THRESHOLD 0x80000 /* 0.5MB */
335int parisc_cache_flush_threshold = FLUSH_THRESHOLD; 335int parisc_cache_flush_threshold __read_mostly = FLUSH_THRESHOLD;
336 336
337void parisc_setup_cache_timing(void) 337void parisc_setup_cache_timing(void)
338{ 338{
diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
index d016d672ec2b..2d804e2d16d1 100644
--- a/arch/parisc/kernel/drivers.c
+++ b/arch/parisc/kernel/drivers.c
@@ -39,7 +39,7 @@
39#include <asm/parisc-device.h> 39#include <asm/parisc-device.h>
40 40
41/* See comments in include/asm-parisc/pci.h */ 41/* See comments in include/asm-parisc/pci.h */
42struct hppa_dma_ops *hppa_dma_ops; 42struct hppa_dma_ops *hppa_dma_ops __read_mostly;
43EXPORT_SYMBOL(hppa_dma_ops); 43EXPORT_SYMBOL(hppa_dma_ops);
44 44
45static struct device root = { 45static struct device root = {
@@ -173,8 +173,6 @@ int register_parisc_driver(struct parisc_driver *driver)
173 WARN_ON(driver->drv.probe != NULL); 173 WARN_ON(driver->drv.probe != NULL);
174 WARN_ON(driver->drv.remove != NULL); 174 WARN_ON(driver->drv.remove != NULL);
175 175
176 driver->drv.probe = parisc_driver_probe;
177 driver->drv.remove = parisc_driver_remove;
178 driver->drv.name = driver->name; 176 driver->drv.name = driver->name;
179 177
180 return driver_register(&driver->drv); 178 return driver_register(&driver->drv);
@@ -515,8 +513,13 @@ alloc_pa_dev(unsigned long hpa, struct hardware_path *mod_path)
515 (iodc_data[5] << 8) | iodc_data[6]; 513 (iodc_data[5] << 8) | iodc_data[6];
516 dev->hpa.name = parisc_pathname(dev); 514 dev->hpa.name = parisc_pathname(dev);
517 dev->hpa.start = hpa; 515 dev->hpa.start = hpa;
518 if (hpa == 0xf4000000 || hpa == 0xf6000000 || 516 /* This is awkward. The STI spec says that gfx devices may occupy
519 hpa == 0xf8000000 || hpa == 0xfa000000) { 517 * 32MB or 64MB. Unfortunately, we don't know how to tell whether
518 * it's the former or the latter. Assumptions either way can hurt us.
519 */
520 if (hpa == 0xf4000000 || hpa == 0xf8000000) {
521 dev->hpa.end = hpa + 0x03ffffff;
522 } else if (hpa == 0xf6000000 || hpa == 0xfa000000) {
520 dev->hpa.end = hpa + 0x01ffffff; 523 dev->hpa.end = hpa + 0x01ffffff;
521 } else { 524 } else {
522 dev->hpa.end = hpa + 0xfff; 525 dev->hpa.end = hpa + 0xfff;
@@ -570,6 +573,8 @@ struct bus_type parisc_bus_type = {
570 .name = "parisc", 573 .name = "parisc",
571 .match = parisc_generic_match, 574 .match = parisc_generic_match,
572 .dev_attrs = parisc_device_attrs, 575 .dev_attrs = parisc_device_attrs,
576 .probe = parisc_driver_probe,
577 .remove = parisc_driver_remove,
573}; 578};
574 579
575/** 580/**
@@ -834,7 +839,7 @@ static void print_parisc_device(struct parisc_device *dev)
834 839
835 if (dev->num_addrs) { 840 if (dev->num_addrs) {
836 int k; 841 int k;
837 printk(", additional addresses: "); 842 printk(", additional addresses: ");
838 for (k = 0; k < dev->num_addrs; k++) 843 for (k = 0; k < dev->num_addrs; k++)
839 printk("0x%lx ", dev->addr[k]); 844 printk("0x%lx ", dev->addr[k]);
840 } 845 }
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index 553f8fe03224..2dc06b8e1817 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -80,7 +80,7 @@ static unsigned long pdc_result2[32] __attribute__ ((aligned (8)));
80 80
81/* Firmware needs to be initially set to narrow to determine the 81/* Firmware needs to be initially set to narrow to determine the
82 * actual firmware width. */ 82 * actual firmware width. */
83int parisc_narrow_firmware = 1; 83int parisc_narrow_firmware __read_mostly = 1;
84#endif 84#endif
85 85
86/* On most currently-supported platforms, IODC I/O calls are 32-bit calls 86/* On most currently-supported platforms, IODC I/O calls are 32-bit calls
diff --git a/arch/parisc/kernel/hardware.c b/arch/parisc/kernel/hardware.c
index 2071b5bba15c..3058bffd8a2c 100644
--- a/arch/parisc/kernel/hardware.c
+++ b/arch/parisc/kernel/hardware.c
@@ -551,6 +551,7 @@ static struct hp_hardware hp_hardware_list[] __initdata = {
551 {HPHW_BCPORT, 0x804, 0x0000C, 0x10, "REO I/O BC Merced Port"}, 551 {HPHW_BCPORT, 0x804, 0x0000C, 0x10, "REO I/O BC Merced Port"},
552 {HPHW_BCPORT, 0x782, 0x0000C, 0x00, "REO I/O BC Ropes Port"}, 552 {HPHW_BCPORT, 0x782, 0x0000C, 0x00, "REO I/O BC Ropes Port"},
553 {HPHW_BCPORT, 0x784, 0x0000C, 0x00, "Pluto I/O BC Ropes Port"}, 553 {HPHW_BCPORT, 0x784, 0x0000C, 0x00, "Pluto I/O BC Ropes Port"},
554 {HPHW_BRIDGE, 0x05D, 0x0000A, 0x00, "SummitHawk Dino PCI Bridge"},
554 {HPHW_BRIDGE, 0x680, 0x0000A, 0x00, "Dino PCI Bridge"}, 555 {HPHW_BRIDGE, 0x680, 0x0000A, 0x00, "Dino PCI Bridge"},
555 {HPHW_BRIDGE, 0x682, 0x0000A, 0x00, "Cujo PCI Bridge"}, 556 {HPHW_BRIDGE, 0x682, 0x0000A, 0x00, "Cujo PCI Bridge"},
556 {HPHW_BRIDGE, 0x782, 0x0000A, 0x00, "Elroy PCI Bridge"}, 557 {HPHW_BRIDGE, 0x782, 0x0000A, 0x00, "Elroy PCI Bridge"},
diff --git a/arch/parisc/kernel/inventory.c b/arch/parisc/kernel/inventory.c
index 8f563871e83c..4e847ba53180 100644
--- a/arch/parisc/kernel/inventory.c
+++ b/arch/parisc/kernel/inventory.c
@@ -38,7 +38,7 @@
38*/ 38*/
39#undef DEBUG_PAT 39#undef DEBUG_PAT
40 40
41int pdc_type = PDC_TYPE_ILLEGAL; 41int pdc_type __read_mostly = PDC_TYPE_ILLEGAL;
42 42
43void __init setup_pdc(void) 43void __init setup_pdc(void)
44{ 44{
@@ -120,8 +120,8 @@ set_pmem_entry(physmem_range_t *pmem_ptr, unsigned long start,
120 * pdc info is bad in this case). 120 * pdc info is bad in this case).
121 */ 121 */
122 122
123 if ( ((start & (PAGE_SIZE - 1)) != 0) 123 if (unlikely( ((start & (PAGE_SIZE - 1)) != 0)
124 || ((pages4k & ((1UL << PDC_PAGE_ADJ_SHIFT) - 1)) != 0) ) { 124 || ((pages4k & ((1UL << PDC_PAGE_ADJ_SHIFT) - 1)) != 0) )) {
125 125
126 panic("Memory range doesn't align with page size!\n"); 126 panic("Memory range doesn't align with page size!\n");
127 } 127 }
diff --git a/arch/parisc/kernel/ioctl32.c b/arch/parisc/kernel/ioctl32.c
deleted file mode 100644
index 4eada1bb27f0..000000000000
--- a/arch/parisc/kernel/ioctl32.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/* $Id: ioctl32.c,v 1.5 2002/10/18 00:21:43 varenet Exp $
2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
3 *
4 * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com)
5 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
6 *
7 * These routines maintain argument size conversion between 32bit and 64bit
8 * ioctls.
9 */
10
11#include <linux/syscalls.h>
12
13#define INCLUDES
14#include "compat_ioctl.c"
15
16#include <asm/perf.h>
17#include <asm/ioctls.h>
18
19#define CODE
20#include "compat_ioctl.c"
21
22#define HANDLE_IOCTL(cmd, handler) { cmd, (ioctl_trans_handler_t)handler, NULL },
23#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd, sys_ioctl)
24
25#define IOCTL_TABLE_START struct ioctl_trans ioctl_start[] = {
26#define IOCTL_TABLE_END };
27
28IOCTL_TABLE_START
29#include <linux/compat_ioctl.h>
30
31#define DECLARES
32#include "compat_ioctl.c"
33
34/* And these ioctls need translation */
35HANDLE_IOCTL(SIOCGPPPSTATS, dev_ifsioc)
36HANDLE_IOCTL(SIOCGPPPCSTATS, dev_ifsioc)
37HANDLE_IOCTL(SIOCGPPPVER, dev_ifsioc)
38
39#if defined(CONFIG_GEN_RTC)
40COMPATIBLE_IOCTL(RTC_AIE_ON)
41COMPATIBLE_IOCTL(RTC_AIE_OFF)
42COMPATIBLE_IOCTL(RTC_UIE_ON)
43COMPATIBLE_IOCTL(RTC_UIE_OFF)
44COMPATIBLE_IOCTL(RTC_PIE_ON)
45COMPATIBLE_IOCTL(RTC_PIE_OFF)
46COMPATIBLE_IOCTL(RTC_WIE_ON)
47COMPATIBLE_IOCTL(RTC_WIE_OFF)
48COMPATIBLE_IOCTL(RTC_ALM_SET) /* struct rtc_time only has ints */
49COMPATIBLE_IOCTL(RTC_ALM_READ) /* struct rtc_time only has ints */
50COMPATIBLE_IOCTL(RTC_RD_TIME) /* struct rtc_time only has ints */
51COMPATIBLE_IOCTL(RTC_SET_TIME) /* struct rtc_time only has ints */
52HANDLE_IOCTL(RTC_IRQP_READ, w_long)
53COMPATIBLE_IOCTL(RTC_IRQP_SET)
54HANDLE_IOCTL(RTC_EPOCH_READ, w_long)
55COMPATIBLE_IOCTL(RTC_EPOCH_SET)
56#endif
57
58IOCTL_TABLE_END
59
60int ioctl_table_size = ARRAY_SIZE(ioctl_start);
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index f94a02ef3d95..a6caf1073085 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -33,10 +33,10 @@
33#include <asm/uaccess.h> 33#include <asm/uaccess.h>
34#include <asm/tlbflush.h> /* for purge_tlb_*() macros */ 34#include <asm/tlbflush.h> /* for purge_tlb_*() macros */
35 35
36static struct proc_dir_entry * proc_gsc_root = NULL; 36static struct proc_dir_entry * proc_gsc_root __read_mostly = NULL;
37static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length); 37static int pcxl_proc_info(char *buffer, char **start, off_t offset, int length);
38static unsigned long pcxl_used_bytes = 0; 38static unsigned long pcxl_used_bytes __read_mostly = 0;
39static unsigned long pcxl_used_pages = 0; 39static unsigned long pcxl_used_pages __read_mostly = 0;
40 40
41extern unsigned long pcxl_dma_start; /* Start of pcxl dma mapping area */ 41extern unsigned long pcxl_dma_start; /* Start of pcxl dma mapping area */
42static spinlock_t pcxl_res_lock; 42static spinlock_t pcxl_res_lock;
diff --git a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c
index 52004ae28d20..2a01fe1bdc98 100644
--- a/arch/parisc/kernel/pdc_chassis.c
+++ b/arch/parisc/kernel/pdc_chassis.c
@@ -30,6 +30,7 @@
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/reboot.h> 31#include <linux/reboot.h>
32#include <linux/notifier.h> 32#include <linux/notifier.h>
33#include <linux/cache.h>
33 34
34#include <asm/pdc_chassis.h> 35#include <asm/pdc_chassis.h>
35#include <asm/processor.h> 36#include <asm/processor.h>
@@ -38,8 +39,8 @@
38 39
39 40
40#ifdef CONFIG_PDC_CHASSIS 41#ifdef CONFIG_PDC_CHASSIS
41static int pdc_chassis_old = 0; 42static int pdc_chassis_old __read_mostly = 0;
42static unsigned int pdc_chassis_enabled = 1; 43static unsigned int pdc_chassis_enabled __read_mostly = 1;
43 44
44 45
45/** 46/**
@@ -132,7 +133,7 @@ void __init parisc_pdc_chassis_init(void)
132{ 133{
133#ifdef CONFIG_PDC_CHASSIS 134#ifdef CONFIG_PDC_CHASSIS
134 int handle = 0; 135 int handle = 0;
135 if (pdc_chassis_enabled) { 136 if (likely(pdc_chassis_enabled)) {
136 DPRINTK(KERN_DEBUG "%s: parisc_pdc_chassis_init()\n", __FILE__); 137 DPRINTK(KERN_DEBUG "%s: parisc_pdc_chassis_init()\n", __FILE__);
137 138
138 /* Let see if we have something to handle... */ 139 /* Let see if we have something to handle... */
@@ -142,7 +143,7 @@ void __init parisc_pdc_chassis_init(void)
142 printk(KERN_INFO "Enabling PDC_PAT chassis codes support.\n"); 143 printk(KERN_INFO "Enabling PDC_PAT chassis codes support.\n");
143 handle = 1; 144 handle = 1;
144 } 145 }
145 else if (pdc_chassis_old) { 146 else if (unlikely(pdc_chassis_old)) {
146 printk(KERN_INFO "Enabling old style chassis LED panel support.\n"); 147 printk(KERN_INFO "Enabling old style chassis LED panel support.\n");
147 handle = 1; 148 handle = 1;
148 } 149 }
@@ -178,7 +179,7 @@ int pdc_chassis_send_status(int message)
178 /* Maybe we should do that in an other way ? */ 179 /* Maybe we should do that in an other way ? */
179 int retval = 0; 180 int retval = 0;
180#ifdef CONFIG_PDC_CHASSIS 181#ifdef CONFIG_PDC_CHASSIS
181 if (pdc_chassis_enabled) { 182 if (likely(pdc_chassis_enabled)) {
182 183
183 DPRINTK(KERN_DEBUG "%s: pdc_chassis_send_status(%d)\n", __FILE__, message); 184 DPRINTK(KERN_DEBUG "%s: pdc_chassis_send_status(%d)\n", __FILE__, message);
184 185
@@ -214,7 +215,7 @@ int pdc_chassis_send_status(int message)
214 } 215 }
215 } else retval = -1; 216 } else retval = -1;
216#else 217#else
217 if (pdc_chassis_old) { 218 if (unlikely(pdc_chassis_old)) {
218 switch (message) { 219 switch (message) {
219 case PDC_CHASSIS_DIRECT_BSTART: 220 case PDC_CHASSIS_DIRECT_BSTART:
220 case PDC_CHASSIS_DIRECT_BCOMPLETE: 221 case PDC_CHASSIS_DIRECT_BCOMPLETE:
diff --git a/arch/parisc/kernel/perf.c b/arch/parisc/kernel/perf.c
index f6fec62b6a2f..11d406cd0b3e 100644
--- a/arch/parisc/kernel/perf.c
+++ b/arch/parisc/kernel/perf.c
@@ -42,6 +42,7 @@
42 * on every box. 42 * on every box.
43 */ 43 */
44 44
45#include <linux/capability.h>
45#include <linux/init.h> 46#include <linux/init.h>
46#include <linux/proc_fs.h> 47#include <linux/proc_fs.h>
47#include <linux/miscdevice.h> 48#include <linux/miscdevice.h>
@@ -66,10 +67,10 @@ struct rdr_tbl_ent {
66 uint8_t write_control; 67 uint8_t write_control;
67}; 68};
68 69
69static int perf_processor_interface = UNKNOWN_INTF; 70static int perf_processor_interface __read_mostly = UNKNOWN_INTF;
70static int perf_enabled = 0; 71static int perf_enabled __read_mostly = 0;
71static spinlock_t perf_lock; 72static spinlock_t perf_lock;
72struct parisc_device *cpu_device = NULL; 73struct parisc_device *cpu_device __read_mostly = NULL;
73 74
74/* RDRs to write for PCX-W */ 75/* RDRs to write for PCX-W */
75static int perf_rdrs_W[] = 76static int perf_rdrs_W[] =
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index fee4f1f09adc..5da41677e70b 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -54,7 +54,7 @@
54#include <asm/uaccess.h> 54#include <asm/uaccess.h>
55#include <asm/unwind.h> 55#include <asm/unwind.h>
56 56
57static int hlt_counter; 57static int hlt_counter __read_mostly;
58 58
59/* 59/*
60 * Power off function, if any 60 * Power off function, if any
@@ -295,7 +295,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
295 struct task_struct * p, struct pt_regs * pregs) 295 struct task_struct * p, struct pt_regs * pregs)
296{ 296{
297 struct pt_regs * cregs = &(p->thread.regs); 297 struct pt_regs * cregs = &(p->thread.regs);
298 struct thread_info *ti = p->thread_info; 298 void *stack = task_stack_page(p);
299 299
300 /* We have to use void * instead of a function pointer, because 300 /* We have to use void * instead of a function pointer, because
301 * function pointers aren't a pointer to the function on 64-bit. 301 * function pointers aren't a pointer to the function on 64-bit.
@@ -322,7 +322,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
322 */ 322 */
323 if (usp == 1) { 323 if (usp == 1) {
324 /* kernel thread */ 324 /* kernel thread */
325 cregs->ksp = (((unsigned long)(ti)) + THREAD_SZ_ALGN); 325 cregs->ksp = (unsigned long)stack + THREAD_SZ_ALGN;
326 /* Must exit via ret_from_kernel_thread in order 326 /* Must exit via ret_from_kernel_thread in order
327 * to call schedule_tail() 327 * to call schedule_tail()
328 */ 328 */
@@ -344,7 +344,7 @@ copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
344 */ 344 */
345 345
346 /* Use same stack depth as parent */ 346 /* Use same stack depth as parent */
347 cregs->ksp = ((unsigned long)(ti)) 347 cregs->ksp = (unsigned long)stack
348 + (pregs->gr[21] & (THREAD_SIZE - 1)); 348 + (pregs->gr[21] & (THREAD_SIZE - 1));
349 cregs->gr[30] = usp; 349 cregs->gr[30] = usp;
350 if (p->personality == PER_HPUX) { 350 if (p->personality == PER_HPUX) {
diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
index 4f5bbcf1f5a4..6df9f62cecb5 100644
--- a/arch/parisc/kernel/processor.c
+++ b/arch/parisc/kernel/processor.c
@@ -44,10 +44,10 @@
44#include <asm/irq.h> /* for struct irq_region */ 44#include <asm/irq.h> /* for struct irq_region */
45#include <asm/parisc-device.h> 45#include <asm/parisc-device.h>
46 46
47struct system_cpuinfo_parisc boot_cpu_data; 47struct system_cpuinfo_parisc boot_cpu_data __read_mostly;
48EXPORT_SYMBOL(boot_cpu_data); 48EXPORT_SYMBOL(boot_cpu_data);
49 49
50struct cpuinfo_parisc cpu_data[NR_CPUS]; 50struct cpuinfo_parisc cpu_data[NR_CPUS] __read_mostly;
51 51
52/* 52/*
53** PARISC CPU driver - claim "device" and initialize CPU data structures. 53** PARISC CPU driver - claim "device" and initialize CPU data structures.
@@ -378,12 +378,12 @@ show_cpuinfo (struct seq_file *m, void *v)
378 return 0; 378 return 0;
379} 379}
380 380
381static struct parisc_device_id processor_tbl[] = { 381static struct parisc_device_id processor_tbl[] __read_mostly = {
382 { HPHW_NPROC, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, SVERSION_ANY_ID }, 382 { HPHW_NPROC, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, SVERSION_ANY_ID },
383 { 0, } 383 { 0, }
384}; 384};
385 385
386static struct parisc_driver cpu_driver = { 386static struct parisc_driver cpu_driver __read_mostly = {
387 .name = "CPU", 387 .name = "CPU",
388 .id_table = processor_tbl, 388 .id_table = processor_tbl,
389 .probe = processor_probe 389 .probe = processor_probe
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 73e9c34b0948..4a36ec3f6ac1 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -46,15 +46,15 @@
46#include <asm/io.h> 46#include <asm/io.h>
47#include <asm/setup.h> 47#include <asm/setup.h>
48 48
49char command_line[COMMAND_LINE_SIZE]; 49char command_line[COMMAND_LINE_SIZE] __read_mostly;
50 50
51/* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */ 51/* Intended for ccio/sba/cpu statistics under /proc/bus/{runway|gsc} */
52struct proc_dir_entry * proc_runway_root = NULL; 52struct proc_dir_entry * proc_runway_root __read_mostly = NULL;
53struct proc_dir_entry * proc_gsc_root = NULL; 53struct proc_dir_entry * proc_gsc_root __read_mostly = NULL;
54struct proc_dir_entry * proc_mckinley_root = NULL; 54struct proc_dir_entry * proc_mckinley_root __read_mostly = NULL;
55 55
56#if !defined(CONFIG_PA20) && (defined(CONFIG_IOMMU_CCIO) || defined(CONFIG_IOMMU_SBA)) 56#if !defined(CONFIG_PA20) && (defined(CONFIG_IOMMU_CCIO) || defined(CONFIG_IOMMU_SBA))
57int parisc_bus_is_phys = 1; /* Assume no IOMMU is present */ 57int parisc_bus_is_phys __read_mostly = 1; /* Assume no IOMMU is present */
58EXPORT_SYMBOL(parisc_bus_is_phys); 58EXPORT_SYMBOL(parisc_bus_is_phys);
59#endif 59#endif
60 60
diff --git a/arch/parisc/kernel/smp.c b/arch/parisc/kernel/smp.c
index ce89da0f654d..25564b7ca6bb 100644
--- a/arch/parisc/kernel/smp.c
+++ b/arch/parisc/kernel/smp.c
@@ -39,7 +39,7 @@
39#include <asm/atomic.h> 39#include <asm/atomic.h>
40#include <asm/current.h> 40#include <asm/current.h>
41#include <asm/delay.h> 41#include <asm/delay.h>
42#include <asm/pgalloc.h> /* for flush_tlb_all() proto/macro */ 42#include <asm/tlbflush.h>
43 43
44#include <asm/io.h> 44#include <asm/io.h>
45#include <asm/irq.h> /* for CPU_IRQ_REGION and friends */ 45#include <asm/irq.h> /* for CPU_IRQ_REGION and friends */
@@ -58,9 +58,9 @@ DEFINE_SPINLOCK(smp_lock);
58 58
59volatile struct task_struct *smp_init_current_idle_task; 59volatile struct task_struct *smp_init_current_idle_task;
60 60
61static volatile int cpu_now_booting = 0; /* track which CPU is booting */ 61static volatile int cpu_now_booting __read_mostly = 0; /* track which CPU is booting */
62 62
63static int parisc_max_cpus = 1; 63static int parisc_max_cpus __read_mostly = 1;
64 64
65/* online cpus are ones that we've managed to bring up completely 65/* online cpus are ones that we've managed to bring up completely
66 * possible cpus are all valid cpu 66 * possible cpus are all valid cpu
@@ -71,8 +71,8 @@ static int parisc_max_cpus = 1;
71 * empty in the beginning. 71 * empty in the beginning.
72 */ 72 */
73 73
74cpumask_t cpu_online_map = CPU_MASK_NONE; /* Bitmap of online CPUs */ 74cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE; /* Bitmap of online CPUs */
75cpumask_t cpu_possible_map = CPU_MASK_ALL; /* Bitmap of Present CPUs */ 75cpumask_t cpu_possible_map __read_mostly = CPU_MASK_ALL; /* Bitmap of Present CPUs */
76 76
77EXPORT_SYMBOL(cpu_online_map); 77EXPORT_SYMBOL(cpu_online_map);
78EXPORT_SYMBOL(cpu_possible_map); 78EXPORT_SYMBOL(cpu_possible_map);
@@ -406,12 +406,10 @@ EXPORT_SYMBOL(smp_call_function);
406 * as we want to ensure all TLB's flushed before proceeding. 406 * as we want to ensure all TLB's flushed before proceeding.
407 */ 407 */
408 408
409extern void flush_tlb_all_local(void);
410
411void 409void
412smp_flush_tlb_all(void) 410smp_flush_tlb_all(void)
413{ 411{
414 on_each_cpu((void (*)(void *))flush_tlb_all_local, NULL, 1, 1); 412 on_each_cpu(flush_tlb_all_local, NULL, 1, 1);
415} 413}
416 414
417 415
@@ -487,7 +485,7 @@ void __init smp_callin(void)
487#endif 485#endif
488 486
489 flush_cache_all_local(); /* start with known state */ 487 flush_cache_all_local(); /* start with known state */
490 flush_tlb_all_local(); 488 flush_tlb_all_local(NULL);
491 489
492 local_irq_enable(); /* Interrupts have been off until now */ 490 local_irq_enable(); /* Interrupts have been off until now */
493 491
@@ -519,7 +517,7 @@ int __init smp_boot_one_cpu(int cpuid)
519 if (IS_ERR(idle)) 517 if (IS_ERR(idle))
520 panic("SMP: fork failed for CPU:%d", cpuid); 518 panic("SMP: fork failed for CPU:%d", cpuid);
521 519
522 idle->thread_info->cpu = cpuid; 520 task_thread_info(idle)->cpu = cpuid;
523 521
524 /* Let _start know what logical CPU we're booting 522 /* Let _start know what logical CPU we're booting
525 ** (offset into init_tasks[],cpu_data[]) 523 ** (offset into init_tasks[],cpu_data[])
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c
index cded25680787..594930bc4bcf 100644
--- a/arch/parisc/kernel/time.c
+++ b/arch/parisc/kernel/time.c
@@ -36,8 +36,8 @@
36/* xtime and wall_jiffies keep wall-clock time */ 36/* xtime and wall_jiffies keep wall-clock time */
37extern unsigned long wall_jiffies; 37extern unsigned long wall_jiffies;
38 38
39static long clocktick; /* timer cycles per tick */ 39static long clocktick __read_mostly; /* timer cycles per tick */
40static long halftick; 40static long halftick __read_mostly;
41 41
42#ifdef CONFIG_SMP 42#ifdef CONFIG_SMP
43extern void smp_do_timer(struct pt_regs *regs); 43extern void smp_do_timer(struct pt_regs *regs);
diff --git a/arch/parisc/kernel/topology.c b/arch/parisc/kernel/topology.c
index ac2a40681414..3ba040050e4c 100644
--- a/arch/parisc/kernel/topology.c
+++ b/arch/parisc/kernel/topology.c
@@ -20,8 +20,9 @@
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/smp.h> 21#include <linux/smp.h>
22#include <linux/cpu.h> 22#include <linux/cpu.h>
23#include <linux/cache.h>
23 24
24static struct cpu cpu_devices[NR_CPUS]; 25static struct cpu cpu_devices[NR_CPUS] __read_mostly;
25 26
26static int __init topology_init(void) 27static int __init topology_init(void)
27{ 28{
diff --git a/arch/parisc/kernel/unaligned.c b/arch/parisc/kernel/unaligned.c
index eaae8a021f9f..de0a1b21cb40 100644
--- a/arch/parisc/kernel/unaligned.c
+++ b/arch/parisc/kernel/unaligned.c
@@ -122,7 +122,7 @@
122#define ERR_NOTHANDLED -1 122#define ERR_NOTHANDLED -1
123#define ERR_PAGEFAULT -2 123#define ERR_PAGEFAULT -2
124 124
125int unaligned_enabled = 1; 125int unaligned_enabled __read_mostly = 1;
126 126
127void die_if_kernel (char *str, struct pt_regs *regs, long err); 127void die_if_kernel (char *str, struct pt_regs *regs, long err);
128 128
diff --git a/arch/parisc/kernel/unwind.c b/arch/parisc/kernel/unwind.c
index db141108412e..cc1c1afc3187 100644
--- a/arch/parisc/kernel/unwind.c
+++ b/arch/parisc/kernel/unwind.c
@@ -35,7 +35,7 @@ static spinlock_t unwind_lock;
35 * we can call unwind_init as early in the bootup process as 35 * we can call unwind_init as early in the bootup process as
36 * possible (before the slab allocator is initialized) 36 * possible (before the slab allocator is initialized)
37 */ 37 */
38static struct unwind_table kernel_unwind_table; 38static struct unwind_table kernel_unwind_table __read_mostly;
39static LIST_HEAD(unwind_tables); 39static LIST_HEAD(unwind_tables);
40 40
41static inline const struct unwind_table_entry * 41static inline const struct unwind_table_entry *
diff --git a/arch/parisc/kernel/vmlinux.lds.S b/arch/parisc/kernel/vmlinux.lds.S
index e5fac3e08c7a..6d6436a6b624 100644
--- a/arch/parisc/kernel/vmlinux.lds.S
+++ b/arch/parisc/kernel/vmlinux.lds.S
@@ -68,7 +68,7 @@ SECTIONS
68 RODATA 68 RODATA
69 69
70 /* writeable */ 70 /* writeable */
71 . = ALIGN(4096); /* Make sure this is paged aligned so 71 . = ALIGN(4096); /* Make sure this is page aligned so
72 that we can properly leave these 72 that we can properly leave these
73 as writable */ 73 as writable */
74 data_start = .; 74 data_start = .;
@@ -105,6 +105,10 @@ SECTIONS
105 . = ALIGN(16); 105 . = ALIGN(16);
106 .data.lock_aligned : { *(.data.lock_aligned) } 106 .data.lock_aligned : { *(.data.lock_aligned) }
107 107
108 /* rarely changed data like cpu maps */
109 . = ALIGN(16);
110 .data.read_mostly : { *(.data.read_mostly) }
111
108 _edata = .; /* End of data section */ 112 _edata = .; /* End of data section */
109 113
110 . = ALIGN(16384); /* init_task */ 114 . = ALIGN(16384); /* init_task */
@@ -194,14 +198,7 @@ SECTIONS
194#endif 198#endif
195 } 199 }
196 200
197 /* Stabs debugging sections. */ 201 STABS_DEBUG
198 .stab 0 : { *(.stab) }
199 .stabstr 0 : { *(.stabstr) }
200 .stab.excl 0 : { *(.stab.excl) }
201 .stab.exclstr 0 : { *(.stab.exclstr) }
202 .stab.index 0 : { *(.stab.index) }
203 .stab.indexstr 0 : { *(.stab.indexstr) }
204 .comment 0 : { *(.comment) }
205 .note 0 : { *(.note) } 202 .note 0 : { *(.note) }
206 203
207} 204}
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index 29b998e430e6..720287d46e55 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -36,9 +36,9 @@ extern char _end; /* end of BSS, defined by linker */
36extern char __init_begin, __init_end; 36extern char __init_begin, __init_end;
37 37
38#ifdef CONFIG_DISCONTIGMEM 38#ifdef CONFIG_DISCONTIGMEM
39struct node_map_data node_data[MAX_NUMNODES]; 39struct node_map_data node_data[MAX_NUMNODES] __read_mostly;
40bootmem_data_t bmem_data[MAX_NUMNODES]; 40bootmem_data_t bmem_data[MAX_NUMNODES] __read_mostly;
41unsigned char pfnnid_map[PFNNID_MAP_MAX]; 41unsigned char pfnnid_map[PFNNID_MAP_MAX] __read_mostly;
42#endif 42#endif
43 43
44static struct resource data_resource = { 44static struct resource data_resource = {
@@ -58,14 +58,14 @@ static struct resource pdcdata_resource = {
58 .flags = IORESOURCE_BUSY | IORESOURCE_MEM, 58 .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
59}; 59};
60 60
61static struct resource sysram_resources[MAX_PHYSMEM_RANGES]; 61static struct resource sysram_resources[MAX_PHYSMEM_RANGES] __read_mostly;
62 62
63/* The following array is initialized from the firmware specific 63/* The following array is initialized from the firmware specific
64 * information retrieved in kernel/inventory.c. 64 * information retrieved in kernel/inventory.c.
65 */ 65 */
66 66
67physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES]; 67physmem_range_t pmem_ranges[MAX_PHYSMEM_RANGES] __read_mostly;
68int npmem_ranges; 68int npmem_ranges __read_mostly;
69 69
70#ifdef __LP64__ 70#ifdef __LP64__
71#define MAX_MEM (~0UL) 71#define MAX_MEM (~0UL)
@@ -73,7 +73,7 @@ int npmem_ranges;
73#define MAX_MEM (3584U*1024U*1024U) 73#define MAX_MEM (3584U*1024U*1024U)
74#endif /* !__LP64__ */ 74#endif /* !__LP64__ */
75 75
76static unsigned long mem_limit = MAX_MEM; 76static unsigned long mem_limit __read_mostly = MAX_MEM;
77 77
78static void __init mem_limit_func(void) 78static void __init mem_limit_func(void)
79{ 79{
@@ -300,6 +300,13 @@ static void __init setup_bootmem(void)
300 max_pfn = start_pfn + npages; 300 max_pfn = start_pfn + npages;
301 } 301 }
302 302
303 /* IOMMU is always used to access "high mem" on those boxes
304 * that can support enough mem that a PCI device couldn't
305 * directly DMA to any physical addresses.
306 * ISA DMA support will need to revisit this.
307 */
308 max_low_pfn = max_pfn;
309
303 if ((bootmap_pfn - bootmap_start_pfn) != bootmap_pages) { 310 if ((bootmap_pfn - bootmap_start_pfn) != bootmap_pages) {
304 printk(KERN_WARNING "WARNING! bootmap sizing is messed up!\n"); 311 printk(KERN_WARNING "WARNING! bootmap sizing is messed up!\n");
305 BUG(); 312 BUG();
@@ -431,11 +438,11 @@ void free_initmem(void)
431#define SET_MAP_OFFSET(x) ((void *)(((unsigned long)(x) + VM_MAP_OFFSET) \ 438#define SET_MAP_OFFSET(x) ((void *)(((unsigned long)(x) + VM_MAP_OFFSET) \
432 & ~(VM_MAP_OFFSET-1))) 439 & ~(VM_MAP_OFFSET-1)))
433 440
434void *vmalloc_start; 441void *vmalloc_start __read_mostly;
435EXPORT_SYMBOL(vmalloc_start); 442EXPORT_SYMBOL(vmalloc_start);
436 443
437#ifdef CONFIG_PA11 444#ifdef CONFIG_PA11
438unsigned long pcxl_dma_start; 445unsigned long pcxl_dma_start __read_mostly;
439#endif 446#endif
440 447
441void __init mem_init(void) 448void __init mem_init(void)
@@ -475,7 +482,7 @@ int do_check_pgt_cache(int low, int high)
475 return 0; 482 return 0;
476} 483}
477 484
478unsigned long *empty_zero_page; 485unsigned long *empty_zero_page __read_mostly;
479 486
480void show_mem(void) 487void show_mem(void)
481{ 488{
@@ -998,7 +1005,7 @@ void flush_tlb_all(void)
998void flush_tlb_all(void) 1005void flush_tlb_all(void)
999{ 1006{
1000 spin_lock(&sid_lock); 1007 spin_lock(&sid_lock);
1001 flush_tlb_all_local(); 1008 flush_tlb_all_local(NULL);
1002 recycle_sids(); 1009 recycle_sids();
1003 spin_unlock(&sid_lock); 1010 spin_unlock(&sid_lock);
1004} 1011}
diff --git a/arch/parisc/mm/ioremap.c b/arch/parisc/mm/ioremap.c
index 5c7a1b3b9326..edd9a9559cba 100644
--- a/arch/parisc/mm/ioremap.c
+++ b/arch/parisc/mm/ioremap.c
@@ -1,12 +1,9 @@
1/* 1/*
2 * arch/parisc/mm/ioremap.c 2 * arch/parisc/mm/ioremap.c
3 * 3 *
4 * Re-map IO memory to kernel address space so that we can access it.
5 * This is needed for high PCI addresses that aren't mapped in the
6 * 640k-1MB IO memory area on PC's
7 *
8 * (C) Copyright 1995 1996 Linus Torvalds 4 * (C) Copyright 1995 1996 Linus Torvalds
9 * (C) Copyright 2001 Helge Deller <deller@gmx.de> 5 * (C) Copyright 2001 Helge Deller <deller@gmx.de>
6 * (C) Copyright 2005 Kyle McMartin <kyle@parisc-linux.org>
10 */ 7 */
11 8
12#include <linux/vmalloc.h> 9#include <linux/vmalloc.h>
@@ -14,81 +11,107 @@
14#include <linux/module.h> 11#include <linux/module.h>
15#include <asm/io.h> 12#include <asm/io.h>
16#include <asm/pgalloc.h> 13#include <asm/pgalloc.h>
14#include <asm/tlbflush.h>
15#include <asm/cacheflush.h>
17 16
18static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, 17static inline void
19 unsigned long phys_addr, unsigned long flags) 18remap_area_pte(pte_t *pte, unsigned long address, unsigned long size,
19 unsigned long phys_addr, unsigned long flags)
20{ 20{
21 unsigned long end; 21 unsigned long end, pfn;
22 pgprot_t pgprot = __pgprot(_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY |
23 _PAGE_ACCESSED | flags);
22 24
23 address &= ~PMD_MASK; 25 address &= ~PMD_MASK;
26
24 end = address + size; 27 end = address + size;
25 if (end > PMD_SIZE) 28 if (end > PMD_SIZE)
26 end = PMD_SIZE; 29 end = PMD_SIZE;
27 if (address >= end) 30
28 BUG(); 31 BUG_ON(address >= end);
32
33 pfn = phys_addr >> PAGE_SHIFT;
29 do { 34 do {
30 if (!pte_none(*pte)) { 35 BUG_ON(!pte_none(*pte));
31 printk(KERN_ERR "remap_area_pte: page already exists\n"); 36
32 BUG(); 37 set_pte(pte, pfn_pte(pfn, pgprot));
33 } 38
34 set_pte(pte, mk_pte_phys(phys_addr, __pgprot(_PAGE_PRESENT | _PAGE_RW |
35 _PAGE_DIRTY | _PAGE_ACCESSED | flags)));
36 address += PAGE_SIZE; 39 address += PAGE_SIZE;
37 phys_addr += PAGE_SIZE; 40 pfn++;
38 pte++; 41 pte++;
39 } while (address && (address < end)); 42 } while (address && (address < end));
40} 43}
41 44
42static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size, 45static inline int
43 unsigned long phys_addr, unsigned long flags) 46remap_area_pmd(pmd_t *pmd, unsigned long address, unsigned long size,
47 unsigned long phys_addr, unsigned long flags)
44{ 48{
45 unsigned long end; 49 unsigned long end;
46 50
47 address &= ~PGDIR_MASK; 51 address &= ~PGDIR_MASK;
52
48 end = address + size; 53 end = address + size;
49 if (end > PGDIR_SIZE) 54 if (end > PGDIR_SIZE)
50 end = PGDIR_SIZE; 55 end = PGDIR_SIZE;
56
57 BUG_ON(address >= end);
58
51 phys_addr -= address; 59 phys_addr -= address;
52 if (address >= end)
53 BUG();
54 do { 60 do {
55 pte_t * pte = pte_alloc_kernel(pmd, address); 61 pte_t *pte = pte_alloc_kernel(pmd, address);
56 if (!pte) 62 if (!pte)
57 return -ENOMEM; 63 return -ENOMEM;
58 remap_area_pte(pte, address, end - address, address + phys_addr, flags); 64
65 remap_area_pte(pte, address, end - address,
66 address + phys_addr, flags);
67
59 address = (address + PMD_SIZE) & PMD_MASK; 68 address = (address + PMD_SIZE) & PMD_MASK;
60 pmd++; 69 pmd++;
61 } while (address && (address < end)); 70 } while (address && (address < end));
71
62 return 0; 72 return 0;
63} 73}
64 74
65#if (USE_HPPA_IOREMAP) 75#if USE_HPPA_IOREMAP
66static int remap_area_pages(unsigned long address, unsigned long phys_addr, 76static int
67 unsigned long size, unsigned long flags) 77remap_area_pages(unsigned long address, unsigned long phys_addr,
78 unsigned long size, unsigned long flags)
68{ 79{
69 int error; 80 pgd_t *dir;
70 pgd_t * dir; 81 int error = 0;
71 unsigned long end = address + size; 82 unsigned long end = address + size;
72 83
84 BUG_ON(address >= end);
85
73 phys_addr -= address; 86 phys_addr -= address;
74 dir = pgd_offset(&init_mm, address); 87 dir = pgd_offset_k(address);
88
75 flush_cache_all(); 89 flush_cache_all();
76 if (address >= end) 90
77 BUG();
78 do { 91 do {
92 pud_t *pud;
79 pmd_t *pmd; 93 pmd_t *pmd;
80 pmd = pmd_alloc(&init_mm, dir, address); 94
81 error = -ENOMEM; 95 error = -ENOMEM;
96 pud = pud_alloc(&init_mm, dir, address);
97 if (!pud)
98 break;
99
100 pmd = pmd_alloc(&init_mm, pud, address);
82 if (!pmd) 101 if (!pmd)
83 break; 102 break;
103
84 if (remap_area_pmd(pmd, address, end - address, 104 if (remap_area_pmd(pmd, address, end - address,
85 phys_addr + address, flags)) 105 phys_addr + address, flags))
86 break; 106 break;
107
87 error = 0; 108 error = 0;
88 address = (address + PGDIR_SIZE) & PGDIR_MASK; 109 address = (address + PGDIR_SIZE) & PGDIR_MASK;
89 dir++; 110 dir++;
90 } while (address && (address < end)); 111 } while (address && (address < end));
112
91 flush_tlb_all(); 113 flush_tlb_all();
114
92 return error; 115 return error;
93} 116}
94#endif /* USE_HPPA_IOREMAP */ 117#endif /* USE_HPPA_IOREMAP */
@@ -123,8 +146,7 @@ EXPORT_SYMBOL(__raw_bad_addr);
123 146
124/* 147/*
125 * Remap an arbitrary physical address space into the kernel virtual 148 * Remap an arbitrary physical address space into the kernel virtual
126 * address space. Needed when the kernel wants to access high addresses 149 * address space.
127 * directly.
128 * 150 *
129 * NOTE! We need to allow non-page-aligned mappings too: we will obviously 151 * NOTE! We need to allow non-page-aligned mappings too: we will obviously
130 * have to convert them into an offset in a page-aligned mapping, but the 152 * have to convert them into an offset in a page-aligned mapping, but the
@@ -148,8 +170,8 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
148#endif 170#endif
149 171
150#else 172#else
151 void * addr; 173 void *addr;
152 struct vm_struct * area; 174 struct vm_struct *area;
153 unsigned long offset, last_addr; 175 unsigned long offset, last_addr;
154 176
155 /* Don't allow wraparound or zero size */ 177 /* Don't allow wraparound or zero size */
@@ -167,9 +189,11 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
167 t_addr = __va(phys_addr); 189 t_addr = __va(phys_addr);
168 t_end = t_addr + (size - 1); 190 t_end = t_addr + (size - 1);
169 191
170 for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++) 192 for (page = virt_to_page(t_addr);
193 page <= virt_to_page(t_end); page++) {
171 if(!PageReserved(page)) 194 if(!PageReserved(page))
172 return NULL; 195 return NULL;
196 }
173 } 197 }
174 198
175 /* 199 /*
@@ -185,11 +209,13 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
185 area = get_vm_area(size, VM_IOREMAP); 209 area = get_vm_area(size, VM_IOREMAP);
186 if (!area) 210 if (!area)
187 return NULL; 211 return NULL;
212
188 addr = area->addr; 213 addr = area->addr;
189 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { 214 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) {
190 vfree(addr); 215 vfree(addr);
191 return NULL; 216 return NULL;
192 } 217 }
218
193 return (void __iomem *) (offset + (char *)addr); 219 return (void __iomem *) (offset + (char *)addr);
194#endif 220#endif
195} 221}
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index bb2efdd566a9..df338c5cc910 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -26,9 +26,6 @@ config MMU
26 bool 26 bool
27 default y 27 default y
28 28
29config UID16
30 bool
31
32config GENERIC_HARDIRQS 29config GENERIC_HARDIRQS
33 bool 30 bool
34 default y 31 default y
@@ -50,7 +47,7 @@ config PPC
50 47
51config EARLY_PRINTK 48config EARLY_PRINTK
52 bool 49 bool
53 default y if PPC64 50 default y
54 51
55config COMPAT 52config COMPAT
56 bool 53 bool
@@ -74,15 +71,28 @@ config ARCH_MAY_HAVE_PC_FDC
74 bool 71 bool
75 default y 72 default y
76 73
74config PPC_OF
75 def_bool y
76
77config PPC_UDBG_16550
78 bool
79 default n
80
81config GENERIC_TBSYNC
82 bool
83 default y if PPC32 && SMP
84 default n
85
77menu "Processor support" 86menu "Processor support"
78choice 87choice
79 prompt "Processor Type" 88 prompt "Processor Type"
80 depends on PPC32 89 depends on PPC32
81 default 6xx 90 default 6xx
82 91
83config 6xx 92config CLASSIC32
84 bool "6xx/7xx/74xx" 93 bool "6xx/7xx/74xx"
85 select PPC_FPU 94 select PPC_FPU
95 select 6xx
86 help 96 help
87 There are four families of PowerPC chips supported. The more common 97 There are four families of PowerPC chips supported. The more common
88 types (601, 603, 604, 740, 750, 7400), the Motorola embedded 98 types (601, 603, 604, 740, 750, 7400), the Motorola embedded
@@ -96,12 +106,20 @@ config 6xx
96 106
97config PPC_52xx 107config PPC_52xx
98 bool "Freescale 52xx" 108 bool "Freescale 52xx"
109 select 6xx
110 select PPC_FPU
99 111
100config PPC_82xx 112config PPC_82xx
101 bool "Freescale 82xx" 113 bool "Freescale 82xx"
114 select 6xx
115 select PPC_FPU
102 116
103config PPC_83xx 117config PPC_83xx
104 bool "Freescale 83xx" 118 bool "Freescale 83xx"
119 select 6xx
120 select FSL_SOC
121 select 83xx
122 select PPC_FPU
105 123
106config 40x 124config 40x
107 bool "AMCC 40x" 125 bool "AMCC 40x"
@@ -137,6 +155,13 @@ config POWER4
137 depends on PPC64 155 depends on PPC64
138 def_bool y 156 def_bool y
139 157
158config 6xx
159 bool
160
161# this is temp to handle compat with arch=ppc
162config 83xx
163 bool
164
140config PPC_FPU 165config PPC_FPU
141 bool 166 bool
142 default y if PPC64 167 default y if PPC64
@@ -169,7 +194,7 @@ config PHYS_64BIT
169 194
170config ALTIVEC 195config ALTIVEC
171 bool "AltiVec Support" 196 bool "AltiVec Support"
172 depends on 6xx || POWER4 197 depends on CLASSIC32 || POWER4
173 ---help--- 198 ---help---
174 This option enables kernel support for the Altivec extensions to the 199 This option enables kernel support for the Altivec extensions to the
175 PowerPC processor. The kernel currently supports saving and restoring 200 PowerPC processor. The kernel currently supports saving and restoring
@@ -227,7 +252,7 @@ config SMP
227 If you don't know what to do here, say N. 252 If you don't know what to do here, say N.
228 253
229config NR_CPUS 254config NR_CPUS
230 int "Maximum number of CPUs (2-32)" 255 int "Maximum number of CPUs (2-128)"
231 range 2 128 256 range 2 128
232 depends on SMP 257 depends on SMP
233 default "32" if PPC64 258 default "32" if PPC64
@@ -242,7 +267,7 @@ endmenu
242source "init/Kconfig" 267source "init/Kconfig"
243 268
244menu "Platform support" 269menu "Platform support"
245 depends on PPC64 || 6xx 270 depends on PPC64 || CLASSIC32
246 271
247choice 272choice
248 prompt "Machine type" 273 prompt "Machine type"
@@ -278,6 +303,7 @@ config PPC_PSERIES
278 select PPC_I8259 303 select PPC_I8259
279 select PPC_RTAS 304 select PPC_RTAS
280 select RTAS_ERROR_LOGGING 305 select RTAS_ERROR_LOGGING
306 select PPC_UDBG_16550
281 default y 307 default y
282 308
283config PPC_CHRP 309config PPC_CHRP
@@ -287,6 +313,7 @@ config PPC_CHRP
287 select PPC_INDIRECT_PCI 313 select PPC_INDIRECT_PCI
288 select PPC_RTAS 314 select PPC_RTAS
289 select PPC_MPC106 315 select PPC_MPC106
316 select PPC_UDBG_16550
290 default y 317 default y
291 318
292config PPC_PMAC 319config PPC_PMAC
@@ -300,6 +327,7 @@ config PPC_PMAC64
300 bool 327 bool
301 depends on PPC_PMAC && POWER4 328 depends on PPC_PMAC && POWER4
302 select U3_DART 329 select U3_DART
330 select MPIC_BROKEN_U3
303 select GENERIC_TBSYNC 331 select GENERIC_TBSYNC
304 default y 332 default y
305 333
@@ -308,6 +336,7 @@ config PPC_PREP
308 depends on PPC_MULTIPLATFORM && PPC32 && BROKEN 336 depends on PPC_MULTIPLATFORM && PPC32 && BROKEN
309 select PPC_I8259 337 select PPC_I8259
310 select PPC_INDIRECT_PCI 338 select PPC_INDIRECT_PCI
339 select PPC_UDBG_16550
311 default y 340 default y
312 341
313config PPC_MAPLE 342config PPC_MAPLE
@@ -316,6 +345,7 @@ config PPC_MAPLE
316 select U3_DART 345 select U3_DART
317 select MPIC_BROKEN_U3 346 select MPIC_BROKEN_U3
318 select GENERIC_TBSYNC 347 select GENERIC_TBSYNC
348 select PPC_UDBG_16550
319 default n 349 default n
320 help 350 help
321 This option enables support for the Maple 970FX Evaluation Board. 351 This option enables support for the Maple 970FX Evaluation Board.
@@ -326,11 +356,7 @@ config PPC_CELL
326 depends on PPC_MULTIPLATFORM && PPC64 356 depends on PPC_MULTIPLATFORM && PPC64
327 select PPC_RTAS 357 select PPC_RTAS
328 select MMIO_NVRAM 358 select MMIO_NVRAM
329 359 select PPC_UDBG_16550
330config PPC_OF
331 bool
332 depends on PPC_MULTIPLATFORM # for now
333 default y
334 360
335config XICS 361config XICS
336 depends on PPC_PSERIES 362 depends on PPC_PSERIES
@@ -384,13 +410,14 @@ config IBMVIO
384 bool 410 bool
385 default y 411 default y
386 412
387config PPC_MPC106 413config IBMEBUS
388 bool 414 depends on PPC_PSERIES
389 default n 415 bool "Support for GX bus based adapters"
416 help
417 Bus device driver for GX bus based adapters.
390 418
391config GENERIC_TBSYNC 419config PPC_MPC106
392 bool 420 bool
393 default y if CONFIG_PPC32 && CONFIG_SMP
394 default n 421 default n
395 422
396source "drivers/cpufreq/Kconfig" 423source "drivers/cpufreq/Kconfig"
@@ -473,8 +500,10 @@ endmenu
473 500
474source arch/powerpc/platforms/embedded6xx/Kconfig 501source arch/powerpc/platforms/embedded6xx/Kconfig
475source arch/powerpc/platforms/4xx/Kconfig 502source arch/powerpc/platforms/4xx/Kconfig
503source arch/powerpc/platforms/83xx/Kconfig
476source arch/powerpc/platforms/85xx/Kconfig 504source arch/powerpc/platforms/85xx/Kconfig
477source arch/powerpc/platforms/8xx/Kconfig 505source arch/powerpc/platforms/8xx/Kconfig
506source arch/powerpc/platforms/cell/Kconfig
478 507
479menu "Kernel options" 508menu "Kernel options"
480 509
@@ -544,6 +573,16 @@ config KEXEC
544 support. As of this writing the exact hardware interface is 573 support. As of this writing the exact hardware interface is
545 strongly in flux, so no good recommendation can be made. 574 strongly in flux, so no good recommendation can be made.
546 575
576config CRASH_DUMP
577 bool "kernel crash dumps (EXPERIMENTAL)"
578 depends on PPC_MULTIPLATFORM && PPC64 && EXPERIMENTAL
579 help
580 Build a kernel suitable for use as a kdump capture kernel.
581 The kernel will be linked at a different address than normal, and
582 so can only be used for Kdump.
583
584 Don't change this unless you know what you are doing.
585
547config EMBEDDEDBOOT 586config EMBEDDEDBOOT
548 bool 587 bool
549 depends on 8xx || 8260 588 depends on 8xx || 8260
@@ -578,11 +617,12 @@ config ARCH_SELECT_MEMORY_MODEL
578 depends on PPC64 617 depends on PPC64
579 618
580config ARCH_FLATMEM_ENABLE 619config ARCH_FLATMEM_ENABLE
581 def_bool y 620 def_bool y
582 depends on PPC64 && !NUMA 621 depends on (PPC64 && !NUMA) || PPC32
583 622
584config ARCH_SPARSEMEM_ENABLE 623config ARCH_SPARSEMEM_ENABLE
585 def_bool y 624 def_bool y
625 depends on PPC64
586 626
587config ARCH_SPARSEMEM_DEFAULT 627config ARCH_SPARSEMEM_DEFAULT
588 def_bool y 628 def_bool y
@@ -694,7 +734,7 @@ config PPC_I8259
694config PPC_INDIRECT_PCI 734config PPC_INDIRECT_PCI
695 bool 735 bool
696 depends on PCI 736 depends on PCI
697 default y if 40x || 44x || 85xx || 83xx 737 default y if 40x || 44x || 85xx
698 default n 738 default n
699 739
700config EISA 740config EISA
@@ -703,13 +743,16 @@ config EISA
703config SBUS 743config SBUS
704 bool 744 bool
705 745
746config FSL_SOC
747 bool
748
706# Yes MCA RS/6000s exist but Linux-PPC does not currently support any 749# Yes MCA RS/6000s exist but Linux-PPC does not currently support any
707config MCA 750config MCA
708 bool 751 bool
709 752
710config PCI 753config PCI
711 bool "PCI support" if 40x || CPM2 || 83xx || 85xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES) 754 bool "PCI support" if 40x || CPM2 || PPC_83xx || 85xx || PPC_MPC52xx || (EMBEDDED && PPC_ISERIES)
712 default y if !40x && !CPM2 && !8xx && !APUS && !83xx && !85xx 755 default y if !40x && !CPM2 && !8xx && !APUS && !PPC_83xx && !85xx
713 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS 756 default PCI_PERMEDIA if !4xx && !CPM2 && !8xx && APUS
714 default PCI_QSPAN if !4xx && !CPM2 && 8xx 757 default PCI_QSPAN if !4xx && !CPM2 && 8xx
715 help 758 help
@@ -722,11 +765,6 @@ config PCI_DOMAINS
722 bool 765 bool
723 default PCI 766 default PCI
724 767
725config MPC83xx_PCI2
726 bool " Supprt for 2nd PCI host controller"
727 depends on PCI && MPC834x
728 default y if MPC834x_SYS
729
730config PCI_QSPAN 768config PCI_QSPAN
731 bool "QSpan PCI" 769 bool "QSpan PCI"
732 depends on !4xx && !CPM2 && 8xx 770 depends on !4xx && !CPM2 && 8xx
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 30a30bf559ea..9254806f7032 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -115,4 +115,46 @@ config PPC_OCP
115 depends on IBM_OCP || XILINX_OCP 115 depends on IBM_OCP || XILINX_OCP
116 default y 116 default y
117 117
118choice
119 prompt "Early debugging (dangerous)"
120 bool
121 optional
122 help
123 Enable early debugging. Careful, if you enable debugging for the
124 wrong type of machine your kernel _will not boot_.
125
126config PPC_EARLY_DEBUG_LPAR
127 bool "LPAR HV Console"
128 depends on PPC_PSERIES
129 help
130 Select this to enable early debugging for a machine with a HVC
131 console on vterm 0.
132
133config PPC_EARLY_DEBUG_G5
134 bool "Apple G5"
135 depends on PPC_PMAC64
136 help
137 Select this to enable early debugging for Apple G5 machines.
138
139config PPC_EARLY_DEBUG_RTAS
140 bool "RTAS Panel"
141 depends on PPC_RTAS
142 help
143 Select this to enable early debugging via the RTAS panel.
144
145config PPC_EARLY_DEBUG_MAPLE
146 bool "Maple real mode"
147 depends on PPC_MAPLE
148 help
149 Select this to enable early debugging for Maple.
150
151config PPC_EARLY_DEBUG_ISERIES
152 bool "iSeries HV Console"
153 depends on PPC_ISERIES
154 help
155 Select this to enable early debugging for legacy iSeries. You need
156 to hit "Ctrl-x Ctrl-x" to see the messages on the console.
157
158endchoice
159
118endmenu 160endmenu
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index a13eb575f834..44dd82b791d1 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -76,8 +76,7 @@ LINUXINCLUDE += $(LINUXINCLUDE-y)
76CHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__ 76CHECKFLAGS += -m$(SZ) -D__powerpc__ -D__powerpc$(SZ)__
77 77
78ifeq ($(CONFIG_PPC64),y) 78ifeq ($(CONFIG_PPC64),y)
79GCC_VERSION := $(call cc-version) 79GCC_BROKEN_VEC := $(shell if [ $(call cc-version) -lt 0400 ] ; then echo "y"; fi)
80GCC_BROKEN_VEC := $(shell if [ $(GCC_VERSION) -lt 0400 ] ; then echo "y"; fi)
81 80
82ifeq ($(CONFIG_POWER4_ONLY),y) 81ifeq ($(CONFIG_POWER4_ONLY),y)
83ifeq ($(CONFIG_ALTIVEC),y) 82ifeq ($(CONFIG_ALTIVEC),y)
@@ -140,18 +139,15 @@ drivers-$(CONFIG_CPM2) += arch/ppc/8260_io/
140 139
141drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ 140drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
142 141
143defaultimage-$(CONFIG_PPC32) := zImage 142# Default to zImage, override when needed
143defaultimage-y := zImage
144defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux 144defaultimage-$(CONFIG_PPC_ISERIES) := vmlinux
145defaultimage-$(CONFIG_PPC_PSERIES) := zImage
146KBUILD_IMAGE := $(defaultimage-y) 145KBUILD_IMAGE := $(defaultimage-y)
147all: $(KBUILD_IMAGE) 146all: $(KBUILD_IMAGE)
148 147
149CPPFLAGS_vmlinux.lds := -Upowerpc 148CPPFLAGS_vmlinux.lds := -Upowerpc
150 149
151# All the instructions talk about "make bzImage". 150BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm uImage
152bzImage: zImage
153
154BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd vmlinux.sm
155 151
156.PHONY: $(BOOT_TARGETS) 152.PHONY: $(BOOT_TARGETS)
157 153
@@ -189,10 +185,9 @@ TOUT := .tmp_gas_check
189# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec 185# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec
190# instructions. 186# instructions.
191# gcc-3.4 and binutils-2.14 are a fatal combination. 187# gcc-3.4 and binutils-2.14 are a fatal combination.
192GCC_VERSION := $(call cc-version)
193 188
194checkbin: 189checkbin:
195 @if test "$(GCC_VERSION)" = "0304" ; then \ 190 @if test "$(call cc-version)" = "0304" ; then \
196 if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ 191 if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
197 echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ 192 echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
198 echo 'correctly with gcc-3.4 and your version of binutils.'; \ 193 echo 'correctly with gcc-3.4 and your version of binutils.'; \
diff --git a/arch/powerpc/boot/.gitignore b/arch/powerpc/boot/.gitignore
new file mode 100644
index 000000000000..45c9ad23526e
--- /dev/null
+++ b/arch/powerpc/boot/.gitignore
@@ -0,0 +1,20 @@
1addnote
2infblock.c
3infblock.h
4infcodes.c
5infcodes.h
6inffast.c
7inffast.h
8inflate.c
9inftrees.c
10inftrees.h
11infutil.c
12infutil.h
13kernel-vmlinux.strip.c
14kernel-vmlinux.strip.gz
15uImage
16zImage
17zImage.vmode
18zconf.h
19zlib.h
20zutil.h
diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 9770f587af73..840ae595a617 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -25,8 +25,9 @@ HOSTCC := gcc
25BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \ 25BOOTCFLAGS := $(HOSTCFLAGS) -fno-builtin -nostdinc -isystem \
26 $(shell $(CROSS32CC) -print-file-name=include) -fPIC 26 $(shell $(CROSS32CC) -print-file-name=include) -fPIC
27BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc 27BOOTAFLAGS := -D__ASSEMBLY__ $(BOOTCFLAGS) -traditional -nostdinc
28BOOTLFLAGS := -T $(srctree)/$(src)/zImage.lds
29OBJCOPYFLAGS := contents,alloc,load,readonly,data 28OBJCOPYFLAGS := contents,alloc,load,readonly,data
29OBJCOPY_COFF_ARGS := -O aixcoff-rs6000 --set-start 0x500000
30OBJCOPY_MIB_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
30 31
31zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c 32zlib := infblock.c infcodes.c inffast.c inflate.c inftrees.c infutil.c
32zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h 33zlibheader := infblock.h infcodes.h inffast.h inftrees.h infutil.h
@@ -35,7 +36,7 @@ zliblinuxheader := zlib.h zconf.h zutil.h
35$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) 36$(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader))
36#$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h) 37#$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h)
37 38
38src-boot := string.S prom.c main.c div64.S crt0.S 39src-boot := crt0.S string.S prom.c stdio.c main.c div64.S
39src-boot += $(zlib) 40src-boot += $(zlib)
40src-boot := $(addprefix $(obj)/, $(src-boot)) 41src-boot := $(addprefix $(obj)/, $(src-boot))
41obj-boot := $(addsuffix .o, $(basename $(src-boot))) 42obj-boot := $(addsuffix .o, $(basename $(src-boot)))
@@ -70,7 +71,7 @@ quiet_cmd_bootas = BOOTAS $@
70 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $< 71 cmd_bootas = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTAFLAGS) -c -o $@ $<
71 72
72quiet_cmd_bootld = BOOTLD $@ 73quiet_cmd_bootld = BOOTLD $@
73 cmd_bootld = $(CROSS32LD) $(BOOTLFLAGS) -o $@ $(2) 74 cmd_bootld = $(CROSS32LD) -T $(srctree)/$(src)/$(3) -o $@ $(2)
74 75
75$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c 76$(patsubst %.c,%.o, $(filter %.c, $(src-boot))): %.o: %.c
76 $(call if_changed_dep,bootcc) 77 $(call if_changed_dep,bootcc)
@@ -87,12 +88,14 @@ obj-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.o, $(section)))
87src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section))) 88src-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.c, $(section)))
88gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section))) 89gz-sec = $(foreach section, $(1), $(patsubst %,$(obj)/kernel-%.gz, $(section)))
89 90
90hostprogs-y := addnote addRamDisk 91hostprogs-y := addnote addRamDisk hack-coff
91targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \ 92
92 $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \ 93targets += zImage.vmode zImage.initrd.vmode zImage zImage.initrd \
93 $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \ 94 zImage.coff zImage.initrd.coff miboot.image miboot.initrd.image \
94 $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \ 95 $(patsubst $(obj)/%,%, $(call obj-sec, $(required) $(initrd))) \
95 vmlinux.initrd 96 $(patsubst $(obj)/%,%, $(call src-sec, $(required) $(initrd))) \
97 $(patsubst $(obj)/%,%, $(call gz-sec, $(required) $(initrd))) \
98 vmlinux.initrd dummy.o
96extra-y := initrd.o 99extra-y := initrd.o
97 100
98quiet_cmd_ramdisk = RAMDISK $@ 101quiet_cmd_ramdisk = RAMDISK $@
@@ -114,6 +117,14 @@ quiet_cmd_addsection = ADDSEC $@
114quiet_cmd_addnote = ADDNOTE $@ 117quiet_cmd_addnote = ADDNOTE $@
115 cmd_addnote = $(obj)/addnote $@ 118 cmd_addnote = $(obj)/addnote $@
116 119
120quiet_cmd_gen-miboot = GEN $@
121 cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_MIB_ARGS) \
122 --add-section=$1=$(word 2, $^) $< $@
123
124quiet_cmd_gencoff = COFF $@
125 cmd_gencoff = $(OBJCOPY) $(OBJCOPY_COFF_ARGS) $@ && \
126 $(obj)/hack-coff $@
127
117$(call gz-sec, $(required)): $(obj)/kernel-%.gz: % 128$(call gz-sec, $(required)): $(obj)/kernel-%.gz: %
118 $(call if_changed,gzip) 129 $(call if_changed,gzip)
119 130
@@ -127,23 +138,78 @@ $(call obj-sec, $(required) $(initrd)): $(obj)/kernel-%.o: $(obj)/kernel-%.c
127 $(call if_changed_dep,bootcc) 138 $(call if_changed_dep,bootcc)
128 $(call cmd,addsection) 139 $(call cmd,addsection)
129 140
130$(obj)/zImage.vmode: obj-boot += $(call obj-sec, $(required)) 141$(obj)/zImage.vmode $(obj)/zImage.coff: obj-boot += $(call obj-sec, $(required))
131$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds 142$(obj)/zImage.vmode: $(call obj-sec, $(required)) $(obj-boot) $(srctree)/$(src)/zImage.lds
132 $(call cmd,bootld,$(obj-boot)) 143 $(call cmd,bootld,$(obj-boot),zImage.lds)
133 144
134$(obj)/zImage.initrd.vmode: obj-boot += $(call obj-sec, $(required) $(initrd)) 145$(obj)/zImage.initrd.vmode $(obj)/zImage.initrd.coff: obj-boot += $(call obj-sec, $(required) $(initrd))
135$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds 146$(obj)/zImage.initrd.vmode: $(call obj-sec, $(required) $(initrd)) $(obj-boot) $(srctree)/$(src)/zImage.lds
136 $(call cmd,bootld,$(obj-boot)) 147 $(call cmd,bootld,$(obj-boot),zImage.lds)
137 148
138$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote 149# For 32-bit powermacs, build the COFF and miboot images
150# as well as the ELF images.
151coffimage-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.coff
152coffrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/zImage.initrd.coff
153mibootimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.image
154mibrdimg-$(CONFIG_PPC_PMAC)-$(CONFIG_PPC32) := $(obj)/miboot.initrd.image
155
156$(obj)/zImage: $(obj)/zImage.vmode $(obj)/addnote $(coffimage-y-y) \
157 $(mibootimg-y-y)
139 @cp -f $< $@ 158 @cp -f $< $@
140 $(call if_changed,addnote) 159 $(call if_changed,addnote)
141 160
142$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote 161$(obj)/zImage.initrd: $(obj)/zImage.initrd.vmode $(obj)/addnote \
162 $(coffrdimg-y-y) $(mibrdimg-y-y)
143 @cp -f $< $@ 163 @cp -f $< $@
144 $(call if_changed,addnote) 164 $(call if_changed,addnote)
145 165
166$(obj)/zImage.coff: $(call obj-sec, $(required)) $(obj-boot) \
167 $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
168 $(call cmd,bootld,$(obj-boot),zImage.coff.lds)
169 $(call cmd,gencoff)
170
171$(obj)/zImage.initrd.coff: $(call obj-sec, $(required) $(initrd)) $(obj-boot) \
172 $(srctree)/$(src)/zImage.coff.lds $(obj)/hack-coff
173 $(call cmd,bootld,$(obj-boot),zImage.coff.lds)
174 $(call cmd,gencoff)
175
176$(obj)/miboot.image: $(obj)/dummy.o $(obj)/vmlinux.gz
177 $(call cmd,gen-miboot,image)
178
179$(obj)/miboot.initrd.image: $(obj)/miboot.image $(images)/ramdisk.image.gz
180 $(call cmd,gen-miboot,initrd)
181
182#-----------------------------------------------------------
183# build u-boot images
184#-----------------------------------------------------------
185quiet_cmd_mygzip = GZIP $@
186cmd_mygzip = gzip -f -9 < $< > $@.$$$$ && mv $@.$$$$ $@
187
188quiet_cmd_objbin = OBJCOPY $@
189 cmd_objbin = $(OBJCOPY) -O binary $< $@
190
191quiet_cmd_uimage = UIMAGE $@
192 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A ppc -O linux -T kernel \
193 -C gzip -a 00000000 -e 00000000 -n 'Linux-$(KERNELRELEASE)' \
194 -d $< $@
195
196MKIMAGE := $(srctree)/scripts/mkuboot.sh
197targets += uImage
198extra-y += vmlinux.bin vmlinux.gz
199
200$(obj)/vmlinux.bin: vmlinux FORCE
201 $(call if_changed,objbin)
202
203$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
204 $(call if_changed,mygzip)
205
206$(obj)/uImage: $(obj)/vmlinux.gz
207 $(Q)rm -f $@
208 $(call cmd,uimage)
209 @echo -n ' Image: $@ '
210 @if [ -f $@ ]; then echo 'is ready' ; else echo 'not made'; fi
211
146install: $(CONFIGURE) $(BOOTIMAGE) 212install: $(CONFIGURE) $(BOOTIMAGE)
147 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)" 213 sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux System.map "$(INSTALL_PATH)" "$(BOOTIMAGE)"
148 214
149clean-files := $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip) 215clean-files += $(addprefix $(objtree)/, $(obj-boot) vmlinux.strip)
diff --git a/arch/powerpc/boot/crt0.S b/arch/powerpc/boot/crt0.S
index d2f2ace56cd3..e0192c26037b 100644
--- a/arch/powerpc/boot/crt0.S
+++ b/arch/powerpc/boot/crt0.S
@@ -12,17 +12,23 @@
12#include "ppc_asm.h" 12#include "ppc_asm.h"
13 13
14 .text 14 .text
15 /* a procedure descriptor used when booting this as a COFF file */
16_zimage_start_opd:
17 .long _zimage_start, 0, 0, 0
18
15 .globl _zimage_start 19 .globl _zimage_start
16_zimage_start: 20_zimage_start:
21 /* Work out the offset between the address we were linked at
22 and the address where we're running. */
17 bl 1f 23 bl 1f
18 241: mflr r0
191:
20 mflr r0
21 lis r9,1b@ha 25 lis r9,1b@ha
22 addi r9,r9,1b@l 26 addi r9,r9,1b@l
23 subf. r0,r9,r0 27 subf. r0,r9,r0
24 beq 3f 28 beq 3f /* if running at same address as linked */
25 29
30 /* The .got2 section contains a list of addresses, so add
31 the address offset onto each entry. */
26 lis r9,__got2_start@ha 32 lis r9,__got2_start@ha
27 addi r9,r9,__got2_start@l 33 addi r9,r9,__got2_start@l
28 lis r8,__got2_end@ha 34 lis r8,__got2_end@ha
@@ -32,15 +38,14 @@ _zimage_start:
32 srwi. r8,r8,2 38 srwi. r8,r8,2
33 mtctr r8 39 mtctr r8
34 add r9,r0,r9 40 add r9,r0,r9
352: 412: lwz r8,0(r9)
36 lwz r8,0(r9)
37 add r8,r8,r0 42 add r8,r8,r0
38 stw r8,0(r9) 43 stw r8,0(r9)
39 addi r9,r9,4 44 addi r9,r9,4
40 bdnz 2b 45 bdnz 2b
41 46
423: 47 /* Do a cache flush for our text, in case OF didn't */
43 lis r9,_start@h 483: lis r9,_start@h
44 add r9,r0,r9 49 add r9,r0,r9
45 lis r8,_etext@ha 50 lis r8,_etext@ha
46 addi r8,r8,_etext@l 51 addi r8,r8,_etext@l
diff --git a/arch/powerpc/boot/dummy.c b/arch/powerpc/boot/dummy.c
new file mode 100644
index 000000000000..31dbf45bf99c
--- /dev/null
+++ b/arch/powerpc/boot/dummy.c
@@ -0,0 +1,4 @@
1int main(void)
2{
3 return 0;
4}
diff --git a/arch/powerpc/boot/hack-coff.c b/arch/powerpc/boot/hack-coff.c
new file mode 100644
index 000000000000..5e5a6573a1ef
--- /dev/null
+++ b/arch/powerpc/boot/hack-coff.c
@@ -0,0 +1,84 @@
1/*
2 * hack-coff.c - hack the header of an xcoff file to fill in
3 * a few fields needed by the Open Firmware xcoff loader on
4 * Power Macs but not initialized by objcopy.
5 *
6 * Copyright (C) Paul Mackerras 1997.
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version
11 * 2 of the License, or (at your option) any later version.
12 */
13#include <stdio.h>
14#include <stdlib.h>
15#include <unistd.h>
16#include <fcntl.h>
17#include <string.h>
18#include "rs6000.h"
19
20#define AOUT_MAGIC 0x010b
21
22#define get_16be(x) ((((unsigned char *)(x))[0] << 8) \
23 + ((unsigned char *)(x))[1])
24#define put_16be(x, v) (((unsigned char *)(x))[0] = (v) >> 8, \
25 ((unsigned char *)(x))[1] = (v) & 0xff)
26#define get_32be(x) ((((unsigned char *)(x))[0] << 24) \
27 + (((unsigned char *)(x))[1] << 16) \
28 + (((unsigned char *)(x))[2] << 8) \
29 + ((unsigned char *)(x))[3])
30
31int
32main(int ac, char **av)
33{
34 int fd;
35 int i, nsect;
36 int aoutsz;
37 struct external_filehdr fhdr;
38 AOUTHDR aout;
39 struct external_scnhdr shdr;
40
41 if (ac != 2) {
42 fprintf(stderr, "Usage: hack-coff coff-file\n");
43 exit(1);
44 }
45 if ((fd = open(av[1], 2)) == -1) {
46 perror(av[2]);
47 exit(1);
48 }
49 if (read(fd, &fhdr, sizeof(fhdr)) != sizeof(fhdr))
50 goto readerr;
51 i = get_16be(fhdr.f_magic);
52 if (i != U802TOCMAGIC && i != U802WRMAGIC && i != U802ROMAGIC) {
53 fprintf(stderr, "%s: not an xcoff file\n", av[1]);
54 exit(1);
55 }
56 aoutsz = get_16be(fhdr.f_opthdr);
57 if (read(fd, &aout, aoutsz) != aoutsz)
58 goto readerr;
59 nsect = get_16be(fhdr.f_nscns);
60 for (i = 0; i < nsect; ++i) {
61 if (read(fd, &shdr, sizeof(shdr)) != sizeof(shdr))
62 goto readerr;
63 if (strcmp(shdr.s_name, ".text") == 0) {
64 put_16be(aout.o_snentry, i+1);
65 put_16be(aout.o_sntext, i+1);
66 } else if (strcmp(shdr.s_name, ".data") == 0) {
67 put_16be(aout.o_sndata, i+1);
68 } else if (strcmp(shdr.s_name, ".bss") == 0) {
69 put_16be(aout.o_snbss, i+1);
70 }
71 }
72 put_16be(aout.magic, AOUT_MAGIC);
73 if (lseek(fd, (long) sizeof(struct external_filehdr), 0) == -1
74 || write(fd, &aout, aoutsz) != aoutsz) {
75 fprintf(stderr, "%s: write error\n", av[1]);
76 exit(1);
77 }
78 close(fd);
79 exit(0);
80
81readerr:
82 fprintf(stderr, "%s: read error or file too short\n", av[1]);
83 exit(1);
84}
diff --git a/arch/powerpc/boot/main.c b/arch/powerpc/boot/main.c
index 64ec93116fa6..55ec59867250 100644
--- a/arch/powerpc/boot/main.c
+++ b/arch/powerpc/boot/main.c
@@ -21,8 +21,8 @@ extern void flush_cache(void *, unsigned long);
21 21
22 22
23/* Value picked to match that used by yaboot */ 23/* Value picked to match that used by yaboot */
24#define PROG_START 0x01400000 24#define PROG_START 0x01400000 /* only used on 64-bit systems */
25#define RAM_END (512<<20) // Fixme: use OF */ 25#define RAM_END (512<<20) /* Fixme: use OF */
26#define ONE_MB 0x100000 26#define ONE_MB 0x100000
27 27
28extern char _start[]; 28extern char _start[];
@@ -160,6 +160,17 @@ static int is_elf64(void *hdr)
160 elfoffset = (unsigned long)elf64ph->p_offset; 160 elfoffset = (unsigned long)elf64ph->p_offset;
161 vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset; 161 vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset;
162 vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset; 162 vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset;
163
164#if defined(PROG_START)
165 /*
166 * Maintain a "magic" minimum address. This keeps some older
167 * firmware platforms running.
168 */
169
170 if (claim_base < PROG_START)
171 claim_base = PROG_START;
172#endif
173
163 return 1; 174 return 1;
164} 175}
165 176
@@ -206,12 +217,18 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
206 exit(); 217 exit();
207 if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4) 218 if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4)
208 exit(); 219 exit();
209 stderr = stdout;
210 if (getprop(chosen_handle, "stdin", &stdin, sizeof(stdin)) != 4)
211 exit();
212 220
213 printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp); 221 printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp);
214 222
223 /*
224 * The first available claim_base must be above the end of the
225 * the loaded kernel wrapper file (_start to _end includes the
226 * initrd image if it is present) and rounded up to a nice
227 * 1 MB boundary for good measure.
228 */
229
230 claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
231
215 vmlinuz.addr = (unsigned long)_vmlinux_start; 232 vmlinuz.addr = (unsigned long)_vmlinux_start;
216 vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start); 233 vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start);
217 234
@@ -228,25 +245,6 @@ void start(unsigned long a1, unsigned long a2, void *promptr, void *sp)
228 exit(); 245 exit();
229 } 246 }
230 247
231 /*
232 * The first available claim_base must be above the end of the
233 * the loaded kernel wrapper file (_start to _end includes the
234 * initrd image if it is present) and rounded up to a nice
235 * 1 MB boundary for good measure.
236 */
237
238 claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB);
239
240#if defined(PROG_START)
241 /*
242 * Maintain a "magic" minimum address. This keeps some older
243 * firmware platforms running.
244 */
245
246 if (claim_base < PROG_START)
247 claim_base = PROG_START;
248#endif
249
250 /* We need to claim the memsize plus the file offset since gzip 248 /* We need to claim the memsize plus the file offset since gzip
251 * will expand the header (file offset), then the kernel, then 249 * will expand the header (file offset), then the kernel, then
252 * possible rubbish we don't care about. But the kernel bss must 250 * possible rubbish we don't care about. But the kernel bss must
diff --git a/arch/powerpc/boot/prom.c b/arch/powerpc/boot/prom.c
index 4bea2f4dcb06..fa0057736f6b 100644
--- a/arch/powerpc/boot/prom.c
+++ b/arch/powerpc/boot/prom.c
@@ -13,487 +13,153 @@
13#include "prom.h" 13#include "prom.h"
14 14
15int (*prom)(void *); 15int (*prom)(void *);
16phandle chosen_handle;
17ihandle stdout;
16 18
17void *chosen_handle; 19int call_prom(const char *service, int nargs, int nret, ...)
18
19void *stdin;
20void *stdout;
21void *stderr;
22
23
24int
25write(void *handle, void *ptr, int nb)
26{
27 struct prom_args {
28 char *service;
29 int nargs;
30 int nret;
31 void *ihandle;
32 void *addr;
33 int len;
34 int actual;
35 } args;
36
37 args.service = "write";
38 args.nargs = 3;
39 args.nret = 1;
40 args.ihandle = handle;
41 args.addr = ptr;
42 args.len = nb;
43 args.actual = -1;
44 (*prom)(&args);
45 return args.actual;
46}
47
48int
49read(void *handle, void *ptr, int nb)
50{ 20{
21 int i;
51 struct prom_args { 22 struct prom_args {
52 char *service; 23 const char *service;
53 int nargs; 24 int nargs;
54 int nret; 25 int nret;
55 void *ihandle; 26 unsigned int args[12];
56 void *addr;
57 int len;
58 int actual;
59 } args;
60
61 args.service = "read";
62 args.nargs = 3;
63 args.nret = 1;
64 args.ihandle = handle;
65 args.addr = ptr;
66 args.len = nb;
67 args.actual = -1;
68 (*prom)(&args);
69 return args.actual;
70}
71
72void
73exit()
74{
75 struct prom_args {
76 char *service;
77 } args;
78
79 for (;;) {
80 args.service = "exit";
81 (*prom)(&args);
82 }
83}
84
85void
86pause(void)
87{
88 struct prom_args {
89 char *service;
90 } args; 27 } args;
28 va_list list;
91 29
92 args.service = "enter"; 30 args.service = service;
93 (*prom)(&args); 31 args.nargs = nargs;
94} 32 args.nret = nret;
95 33
96void * 34 va_start(list, nret);
97finddevice(const char *name) 35 for (i = 0; i < nargs; i++)
98{ 36 args.args[i] = va_arg(list, unsigned int);
99 struct prom_args { 37 va_end(list);
100 char *service;
101 int nargs;
102 int nret;
103 const char *devspec;
104 void *phandle;
105 } args;
106 38
107 args.service = "finddevice"; 39 for (i = 0; i < nret; i++)
108 args.nargs = 1; 40 args.args[nargs+i] = 0;
109 args.nret = 1;
110 args.devspec = name;
111 args.phandle = (void *) -1;
112 (*prom)(&args);
113 return args.phandle;
114}
115 41
116void * 42 if (prom(&args) < 0)
117claim(unsigned long virt, unsigned long size, unsigned long align) 43 return -1;
118{
119 struct prom_args {
120 char *service;
121 int nargs;
122 int nret;
123 unsigned int virt;
124 unsigned int size;
125 unsigned int align;
126 void *ret;
127 } args;
128 44
129 args.service = "claim"; 45 return (nret > 0)? args.args[nargs]: 0;
130 args.nargs = 3;
131 args.nret = 1;
132 args.virt = virt;
133 args.size = size;
134 args.align = align;
135 (*prom)(&args);
136 return args.ret;
137} 46}
138 47
139int 48int call_prom_ret(const char *service, int nargs, int nret,
140getprop(void *phandle, const char *name, void *buf, int buflen) 49 unsigned int *rets, ...)
141{ 50{
51 int i;
142 struct prom_args { 52 struct prom_args {
143 char *service; 53 const char *service;
144 int nargs; 54 int nargs;
145 int nret; 55 int nret;
146 void *phandle; 56 unsigned int args[12];
147 const char *name;
148 void *buf;
149 int buflen;
150 int size;
151 } args; 57 } args;
58 va_list list;
152 59
153 args.service = "getprop"; 60 args.service = service;
154 args.nargs = 4; 61 args.nargs = nargs;
155 args.nret = 1; 62 args.nret = nret;
156 args.phandle = phandle;
157 args.name = name;
158 args.buf = buf;
159 args.buflen = buflen;
160 args.size = -1;
161 (*prom)(&args);
162 return args.size;
163}
164 63
165int 64 va_start(list, rets);
166putc(int c, void *f) 65 for (i = 0; i < nargs; i++)
167{ 66 args.args[i] = va_arg(list, unsigned int);
168 char ch = c; 67 va_end(list);
169 68
170 if (c == '\n') 69 for (i = 0; i < nret; i++)
171 putc('\r', f); 70 args.args[nargs+i] = 0;
172 return write(f, &ch, 1) == 1? c: -1;
173}
174 71
175int 72 if (prom(&args) < 0)
176putchar(int c) 73 return -1;
177{
178 return putc(c, stdout);
179}
180 74
181int 75 if (rets != (void *) 0)
182fputs(char *str, void *f) 76 for (i = 1; i < nret; ++i)
183{ 77 rets[i-1] = args.args[nargs+i];
184 int n = strlen(str);
185 78
186 return write(f, str, n) == n? 0: -1; 79 return (nret > 0)? args.args[nargs]: 0;
187} 80}
188 81
189size_t strnlen(const char * s, size_t count) 82int write(void *handle, void *ptr, int nb)
190{ 83{
191 const char *sc; 84 return call_prom("write", 3, 1, handle, ptr, nb);
192
193 for (sc = s; count-- && *sc != '\0'; ++sc)
194 /* nothing */;
195 return sc - s;
196} 85}
197 86
198extern unsigned int __div64_32(unsigned long long *dividend, 87/*
199 unsigned int divisor); 88 * Older OF's require that when claiming a specific range of addresses,
200 89 * we claim the physical space in the /memory node and the virtual
201/* The unnecessary pointer compare is there 90 * space in the chosen mmu node, and then do a map operation to
202 * to check for type safety (n must be 64bit) 91 * map virtual to physical.
203 */ 92 */
204# define do_div(n,base) ({ \ 93static int need_map = -1;
205 unsigned int __base = (base); \ 94static ihandle chosen_mmu;
206 unsigned int __rem; \ 95static phandle memory;
207 (void)(((typeof((n)) *)0) == ((unsigned long long *)0)); \
208 if (((n) >> 32) == 0) { \
209 __rem = (unsigned int)(n) % __base; \
210 (n) = (unsigned int)(n) / __base; \
211 } else \
212 __rem = __div64_32(&(n), __base); \
213 __rem; \
214 })
215 96
216static int skip_atoi(const char **s) 97/* returns true if s2 is a prefix of s1 */
98static int string_match(const char *s1, const char *s2)
217{ 99{
218 int i, c; 100 for (; *s2; ++s2)
219 101 if (*s1++ != *s2)
220 for (i = 0; '0' <= (c = **s) && c <= '9'; ++*s) 102 return 0;
221 i = i*10 + c - '0'; 103 return 1;
222 return i;
223} 104}
224 105
225#define ZEROPAD 1 /* pad with zero */ 106static int check_of_version(void)
226#define SIGN 2 /* unsigned/signed long */
227#define PLUS 4 /* show plus */
228#define SPACE 8 /* space if plus */
229#define LEFT 16 /* left justified */
230#define SPECIAL 32 /* 0x */
231#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
232
233static char * number(char * str, unsigned long long num, int base, int size, int precision, int type)
234{ 107{
235 char c,sign,tmp[66]; 108 phandle oprom, chosen;
236 const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; 109 char version[64];
237 int i;
238 110
239 if (type & LARGE) 111 oprom = finddevice("/openprom");
240 digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 112 if (oprom == (phandle) -1)
241 if (type & LEFT)
242 type &= ~ZEROPAD;
243 if (base < 2 || base > 36)
244 return 0; 113 return 0;
245 c = (type & ZEROPAD) ? '0' : ' '; 114 if (getprop(oprom, "model", version, sizeof(version)) <= 0)
246 sign = 0; 115 return 0;
247 if (type & SIGN) { 116 version[sizeof(version)-1] = 0;
248 if ((signed long long)num < 0) { 117 printf("OF version = '%s'\r\n", version);
249 sign = '-'; 118 if (!string_match(version, "Open Firmware, 1.")
250 num = - (signed long long)num; 119 && !string_match(version, "FirmWorks,3."))
251 size--; 120 return 0;
252 } else if (type & PLUS) { 121 chosen = finddevice("/chosen");
253 sign = '+'; 122 if (chosen == (phandle) -1) {
254 size--; 123 chosen = finddevice("/chosen@0");
255 } else if (type & SPACE) { 124 if (chosen == (phandle) -1) {
256 sign = ' '; 125 printf("no chosen\n");
257 size--; 126 return 0;
258 } 127 }
259 } 128 }
260 if (type & SPECIAL) { 129 if (getprop(chosen, "mmu", &chosen_mmu, sizeof(chosen_mmu)) <= 0) {
261 if (base == 16) 130 printf("no mmu\n");
262 size -= 2; 131 return 0;
263 else if (base == 8)
264 size--;
265 }
266 i = 0;
267 if (num == 0)
268 tmp[i++]='0';
269 else while (num != 0) {
270 tmp[i++] = digits[do_div(num, base)];
271 } 132 }
272 if (i > precision) 133 memory = (ihandle) call_prom("open", 1, 1, "/memory");
273 precision = i; 134 if (memory == (ihandle) -1) {
274 size -= precision; 135 memory = (ihandle) call_prom("open", 1, 1, "/memory@0");
275 if (!(type&(ZEROPAD+LEFT))) 136 if (memory == (ihandle) -1) {
276 while(size-->0) 137 printf("no memory node\n");
277 *str++ = ' '; 138 return 0;
278 if (sign)
279 *str++ = sign;
280 if (type & SPECIAL) {
281 if (base==8)
282 *str++ = '0';
283 else if (base==16) {
284 *str++ = '0';
285 *str++ = digits[33];
286 } 139 }
287 } 140 }
288 if (!(type & LEFT)) 141 printf("old OF detected\r\n");
289 while (size-- > 0) 142 return 1;
290 *str++ = c;
291 while (i < precision--)
292 *str++ = '0';
293 while (i-- > 0)
294 *str++ = tmp[i];
295 while (size-- > 0)
296 *str++ = ' ';
297 return str;
298} 143}
299 144
300int vsprintf(char *buf, const char *fmt, va_list args) 145void *claim(unsigned long virt, unsigned long size, unsigned long align)
301{ 146{
302 int len; 147 int ret;
303 unsigned long long num; 148 unsigned int result;
304 int i, base;
305 char * str;
306 const char *s;
307
308 int flags; /* flags to number() */
309
310 int field_width; /* width of output field */
311 int precision; /* min. # of digits for integers; max
312 number of chars for from string */
313 int qualifier; /* 'h', 'l', or 'L' for integer fields */
314 /* 'z' support added 23/7/1999 S.H. */
315 /* 'z' changed to 'Z' --davidm 1/25/99 */
316 149
150 if (need_map < 0)
151 need_map = check_of_version();
152 if (align || !need_map)
153 return (void *) call_prom("claim", 3, 1, virt, size, align);
317 154
318 for (str=buf ; *fmt ; ++fmt) { 155 ret = call_prom_ret("call-method", 5, 2, &result, "claim", memory,
319 if (*fmt != '%') { 156 align, size, virt);
320 *str++ = *fmt; 157 if (ret != 0 || result == -1)
321 continue; 158 return (void *) -1;
322 } 159 ret = call_prom_ret("call-method", 5, 2, &result, "claim", chosen_mmu,
323 160 align, size, virt);
324 /* process flags */ 161 /* 0x12 == coherent + read/write */
325 flags = 0; 162 ret = call_prom("call-method", 6, 1, "map", chosen_mmu,
326 repeat: 163 0x12, size, virt, virt);
327 ++fmt; /* this also skips first '%' */ 164 return (void *) virt;
328 switch (*fmt) {
329 case '-': flags |= LEFT; goto repeat;
330 case '+': flags |= PLUS; goto repeat;
331 case ' ': flags |= SPACE; goto repeat;
332 case '#': flags |= SPECIAL; goto repeat;
333 case '0': flags |= ZEROPAD; goto repeat;
334 }
335
336 /* get field width */
337 field_width = -1;
338 if ('0' <= *fmt && *fmt <= '9')
339 field_width = skip_atoi(&fmt);
340 else if (*fmt == '*') {
341 ++fmt;
342 /* it's the next argument */
343 field_width = va_arg(args, int);
344 if (field_width < 0) {
345 field_width = -field_width;
346 flags |= LEFT;
347 }
348 }
349
350 /* get the precision */
351 precision = -1;
352 if (*fmt == '.') {
353 ++fmt;
354 if ('0' <= *fmt && *fmt <= '9')
355 precision = skip_atoi(&fmt);
356 else if (*fmt == '*') {
357 ++fmt;
358 /* it's the next argument */
359 precision = va_arg(args, int);
360 }
361 if (precision < 0)
362 precision = 0;
363 }
364
365 /* get the conversion qualifier */
366 qualifier = -1;
367 if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z') {
368 qualifier = *fmt;
369 ++fmt;
370 }
371
372 /* default base */
373 base = 10;
374
375 switch (*fmt) {
376 case 'c':
377 if (!(flags & LEFT))
378 while (--field_width > 0)
379 *str++ = ' ';
380 *str++ = (unsigned char) va_arg(args, int);
381 while (--field_width > 0)
382 *str++ = ' ';
383 continue;
384
385 case 's':
386 s = va_arg(args, char *);
387 if (!s)
388 s = "<NULL>";
389
390 len = strnlen(s, precision);
391
392 if (!(flags & LEFT))
393 while (len < field_width--)
394 *str++ = ' ';
395 for (i = 0; i < len; ++i)
396 *str++ = *s++;
397 while (len < field_width--)
398 *str++ = ' ';
399 continue;
400
401 case 'p':
402 if (field_width == -1) {
403 field_width = 2*sizeof(void *);
404 flags |= ZEROPAD;
405 }
406 str = number(str,
407 (unsigned long) va_arg(args, void *), 16,
408 field_width, precision, flags);
409 continue;
410
411
412 case 'n':
413 if (qualifier == 'l') {
414 long * ip = va_arg(args, long *);
415 *ip = (str - buf);
416 } else if (qualifier == 'Z') {
417 size_t * ip = va_arg(args, size_t *);
418 *ip = (str - buf);
419 } else {
420 int * ip = va_arg(args, int *);
421 *ip = (str - buf);
422 }
423 continue;
424
425 case '%':
426 *str++ = '%';
427 continue;
428
429 /* integer number formats - set up the flags and "break" */
430 case 'o':
431 base = 8;
432 break;
433
434 case 'X':
435 flags |= LARGE;
436 case 'x':
437 base = 16;
438 break;
439
440 case 'd':
441 case 'i':
442 flags |= SIGN;
443 case 'u':
444 break;
445
446 default:
447 *str++ = '%';
448 if (*fmt)
449 *str++ = *fmt;
450 else
451 --fmt;
452 continue;
453 }
454 if (qualifier == 'l') {
455 num = va_arg(args, unsigned long);
456 if (flags & SIGN)
457 num = (signed long) num;
458 } else if (qualifier == 'Z') {
459 num = va_arg(args, size_t);
460 } else if (qualifier == 'h') {
461 num = (unsigned short) va_arg(args, int);
462 if (flags & SIGN)
463 num = (signed short) num;
464 } else {
465 num = va_arg(args, unsigned int);
466 if (flags & SIGN)
467 num = (signed int) num;
468 }
469 str = number(str, num, base, field_width, precision, flags);
470 }
471 *str = '\0';
472 return str-buf;
473}
474
475int sprintf(char * buf, const char *fmt, ...)
476{
477 va_list args;
478 int i;
479
480 va_start(args, fmt);
481 i=vsprintf(buf,fmt,args);
482 va_end(args);
483 return i;
484}
485
486static char sprint_buf[1024];
487
488int
489printf(const char *fmt, ...)
490{
491 va_list args;
492 int n;
493
494 va_start(args, fmt);
495 n = vsprintf(sprint_buf, fmt, args);
496 va_end(args);
497 write(stdout, sprint_buf, n);
498 return n;
499} 165}
diff --git a/arch/powerpc/boot/prom.h b/arch/powerpc/boot/prom.h
index 96ab5aec740c..3e2ddd4a5a81 100644
--- a/arch/powerpc/boot/prom.h
+++ b/arch/powerpc/boot/prom.h
@@ -1,18 +1,34 @@
1#ifndef _PPC_BOOT_PROM_H_ 1#ifndef _PPC_BOOT_PROM_H_
2#define _PPC_BOOT_PROM_H_ 2#define _PPC_BOOT_PROM_H_
3 3
4typedef void *phandle;
5typedef void *ihandle;
6
4extern int (*prom) (void *); 7extern int (*prom) (void *);
5extern void *chosen_handle; 8extern phandle chosen_handle;
9extern ihandle stdout;
6 10
7extern void *stdin; 11int call_prom(const char *service, int nargs, int nret, ...);
8extern void *stdout; 12int call_prom_ret(const char *service, int nargs, int nret,
9extern void *stderr; 13 unsigned int *rets, ...);
10 14
11extern int write(void *handle, void *ptr, int nb); 15extern int write(void *handle, void *ptr, int nb);
12extern int read(void *handle, void *ptr, int nb); 16extern void *claim(unsigned long virt, unsigned long size, unsigned long aln);
13extern void exit(void); 17
14extern void pause(void); 18static inline void exit(void)
15extern void *finddevice(const char *); 19{
16extern void *claim(unsigned long virt, unsigned long size, unsigned long align); 20 call_prom("exit", 0, 0);
17extern int getprop(void *phandle, const char *name, void *buf, int buflen); 21}
22
23static inline phandle finddevice(const char *name)
24{
25 return (phandle) call_prom("finddevice", 1, 1, name);
26}
27
28static inline int getprop(void *phandle, const char *name,
29 void *buf, int buflen)
30{
31 return call_prom("getprop", 4, 1, phandle, name, buf, buflen);
32}
33
18#endif /* _PPC_BOOT_PROM_H_ */ 34#endif /* _PPC_BOOT_PROM_H_ */
diff --git a/arch/powerpc/boot/rs6000.h b/arch/powerpc/boot/rs6000.h
new file mode 100644
index 000000000000..433f45084e41
--- /dev/null
+++ b/arch/powerpc/boot/rs6000.h
@@ -0,0 +1,243 @@
1/* IBM RS/6000 "XCOFF" file definitions for BFD.
2 Copyright (C) 1990, 1991 Free Software Foundation, Inc.
3 FIXME: Can someone provide a transliteration of this name into ASCII?
4 Using the following chars caused a compiler warning on HIUX (so I replaced
5 them with octal escapes), and isn't useful without an understanding of what
6 character set it is.
7 Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM
8 and John Gilmore of Cygnus Support. */
9
10/********************** FILE HEADER **********************/
11
12struct external_filehdr {
13 char f_magic[2]; /* magic number */
14 char f_nscns[2]; /* number of sections */
15 char f_timdat[4]; /* time & date stamp */
16 char f_symptr[4]; /* file pointer to symtab */
17 char f_nsyms[4]; /* number of symtab entries */
18 char f_opthdr[2]; /* sizeof(optional hdr) */
19 char f_flags[2]; /* flags */
20};
21
22 /* IBM RS/6000 */
23#define U802WRMAGIC 0730 /* writeable text segments **chh** */
24#define U802ROMAGIC 0735 /* readonly sharable text segments */
25#define U802TOCMAGIC 0737 /* readonly text segments and TOC */
26
27#define BADMAG(x) \
28 ((x).f_magic != U802ROMAGIC && (x).f_magic != U802WRMAGIC && \
29 (x).f_magic != U802TOCMAGIC)
30
31#define FILHDR struct external_filehdr
32#define FILHSZ 20
33
34
35/********************** AOUT "OPTIONAL HEADER" **********************/
36
37
38typedef struct
39{
40 unsigned char magic[2]; /* type of file */
41 unsigned char vstamp[2]; /* version stamp */
42 unsigned char tsize[4]; /* text size in bytes, padded to FW bdry */
43 unsigned char dsize[4]; /* initialized data " " */
44 unsigned char bsize[4]; /* uninitialized data " " */
45 unsigned char entry[4]; /* entry pt. */
46 unsigned char text_start[4]; /* base of text used for this file */
47 unsigned char data_start[4]; /* base of data used for this file */
48 unsigned char o_toc[4]; /* address of TOC */
49 unsigned char o_snentry[2]; /* section number of entry point */
50 unsigned char o_sntext[2]; /* section number of .text section */
51 unsigned char o_sndata[2]; /* section number of .data section */
52 unsigned char o_sntoc[2]; /* section number of TOC */
53 unsigned char o_snloader[2]; /* section number of .loader section */
54 unsigned char o_snbss[2]; /* section number of .bss section */
55 unsigned char o_algntext[2]; /* .text alignment */
56 unsigned char o_algndata[2]; /* .data alignment */
57 unsigned char o_modtype[2]; /* module type (??) */
58 unsigned char o_cputype[2]; /* cpu type */
59 unsigned char o_maxstack[4]; /* max stack size (??) */
60 unsigned char o_maxdata[4]; /* max data size (??) */
61 unsigned char o_resv2[12]; /* reserved */
62}
63AOUTHDR;
64
65#define AOUTSZ 72
66#define SMALL_AOUTSZ (28)
67#define AOUTHDRSZ 72
68
69#define RS6K_AOUTHDR_OMAGIC 0x0107 /* old: text & data writeable */
70#define RS6K_AOUTHDR_NMAGIC 0x0108 /* new: text r/o, data r/w */
71#define RS6K_AOUTHDR_ZMAGIC 0x010B /* paged: text r/o, both page-aligned */
72
73
74/********************** SECTION HEADER **********************/
75
76
77struct external_scnhdr {
78 char s_name[8]; /* section name */
79 char s_paddr[4]; /* physical address, aliased s_nlib */
80 char s_vaddr[4]; /* virtual address */
81 char s_size[4]; /* section size */
82 char s_scnptr[4]; /* file ptr to raw data for section */
83 char s_relptr[4]; /* file ptr to relocation */
84 char s_lnnoptr[4]; /* file ptr to line numbers */
85 char s_nreloc[2]; /* number of relocation entries */
86 char s_nlnno[2]; /* number of line number entries*/
87 char s_flags[4]; /* flags */
88};
89
90/*
91 * names of "special" sections
92 */
93#define _TEXT ".text"
94#define _DATA ".data"
95#define _BSS ".bss"
96#define _PAD ".pad"
97#define _LOADER ".loader"
98
99#define SCNHDR struct external_scnhdr
100#define SCNHSZ 40
101
102/* XCOFF uses a special .loader section with type STYP_LOADER. */
103#define STYP_LOADER 0x1000
104
105/* XCOFF uses a special .debug section with type STYP_DEBUG. */
106#define STYP_DEBUG 0x2000
107
108/* XCOFF handles line number or relocation overflow by creating
109 another section header with STYP_OVRFLO set. */
110#define STYP_OVRFLO 0x8000
111
112/********************** LINE NUMBERS **********************/
113
114/* 1 line number entry for every "breakpointable" source line in a section.
115 * Line numbers are grouped on a per function basis; first entry in a function
116 * grouping will have l_lnno = 0 and in place of physical address will be the
117 * symbol table index of the function name.
118 */
119struct external_lineno {
120 union {
121 char l_symndx[4]; /* function name symbol index, iff l_lnno == 0*/
122 char l_paddr[4]; /* (physical) address of line number */
123 } l_addr;
124 char l_lnno[2]; /* line number */
125};
126
127
128#define LINENO struct external_lineno
129#define LINESZ 6
130
131
132/********************** SYMBOLS **********************/
133
134#define E_SYMNMLEN 8 /* # characters in a symbol name */
135#define E_FILNMLEN 14 /* # characters in a file name */
136#define E_DIMNUM 4 /* # array dimensions in auxiliary entry */
137
138struct external_syment
139{
140 union {
141 char e_name[E_SYMNMLEN];
142 struct {
143 char e_zeroes[4];
144 char e_offset[4];
145 } e;
146 } e;
147 char e_value[4];
148 char e_scnum[2];
149 char e_type[2];
150 char e_sclass[1];
151 char e_numaux[1];
152};
153
154
155
156#define N_BTMASK (017)
157#define N_TMASK (060)
158#define N_BTSHFT (4)
159#define N_TSHIFT (2)
160
161
162union external_auxent {
163 struct {
164 char x_tagndx[4]; /* str, un, or enum tag indx */
165 union {
166 struct {
167 char x_lnno[2]; /* declaration line number */
168 char x_size[2]; /* str/union/array size */
169 } x_lnsz;
170 char x_fsize[4]; /* size of function */
171 } x_misc;
172 union {
173 struct { /* if ISFCN, tag, or .bb */
174 char x_lnnoptr[4]; /* ptr to fcn line # */
175 char x_endndx[4]; /* entry ndx past block end */
176 } x_fcn;
177 struct { /* if ISARY, up to 4 dimen. */
178 char x_dimen[E_DIMNUM][2];
179 } x_ary;
180 } x_fcnary;
181 char x_tvndx[2]; /* tv index */
182 } x_sym;
183
184 union {
185 char x_fname[E_FILNMLEN];
186 struct {
187 char x_zeroes[4];
188 char x_offset[4];
189 } x_n;
190 } x_file;
191
192 struct {
193 char x_scnlen[4]; /* section length */
194 char x_nreloc[2]; /* # relocation entries */
195 char x_nlinno[2]; /* # line numbers */
196 } x_scn;
197
198 struct {
199 char x_tvfill[4]; /* tv fill value */
200 char x_tvlen[2]; /* length of .tv */
201 char x_tvran[2][2]; /* tv range */
202 } x_tv; /* info about .tv section (in auxent of symbol .tv)) */
203
204 struct {
205 unsigned char x_scnlen[4];
206 unsigned char x_parmhash[4];
207 unsigned char x_snhash[2];
208 unsigned char x_smtyp[1];
209 unsigned char x_smclas[1];
210 unsigned char x_stab[4];
211 unsigned char x_snstab[2];
212 } x_csect;
213
214};
215
216#define SYMENT struct external_syment
217#define SYMESZ 18
218#define AUXENT union external_auxent
219#define AUXESZ 18
220#define DBXMASK 0x80 /* for dbx storage mask */
221#define SYMNAME_IN_DEBUG(symptr) ((symptr)->n_sclass & DBXMASK)
222
223
224
225/********************** RELOCATION DIRECTIVES **********************/
226
227
228struct external_reloc {
229 char r_vaddr[4];
230 char r_symndx[4];
231 char r_size[1];
232 char r_type[1];
233};
234
235
236#define RELOC struct external_reloc
237#define RELSZ 10
238
239#define DEFAULT_DATA_SECTION_ALIGNMENT 4
240#define DEFAULT_BSS_SECTION_ALIGNMENT 4
241#define DEFAULT_TEXT_SECTION_ALIGNMENT 4
242/* For new sections we havn't heard of before */
243#define DEFAULT_SECTION_ALIGNMENT 4
diff --git a/arch/powerpc/boot/stdio.c b/arch/powerpc/boot/stdio.c
new file mode 100644
index 000000000000..b5aa522f8b77
--- /dev/null
+++ b/arch/powerpc/boot/stdio.c
@@ -0,0 +1,325 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <stdarg.h>
10#include <stddef.h>
11#include "string.h"
12#include "stdio.h"
13#include "prom.h"
14
15size_t strnlen(const char * s, size_t count)
16{
17 const char *sc;
18
19 for (sc = s; count-- && *sc != '\0'; ++sc)
20 /* nothing */;
21 return sc - s;
22}
23
24extern unsigned int __div64_32(unsigned long long *dividend,
25 unsigned int divisor);
26
27/* The unnecessary pointer compare is there
28 * to check for type safety (n must be 64bit)
29 */
30# define do_div(n,base) ({ \
31 unsigned int __base = (base); \
32 unsigned int __rem; \
33 (void)(((typeof((n)) *)0) == ((unsigned long long *)0)); \
34 if (((n) >> 32) == 0) { \
35 __rem = (unsigned int)(n) % __base; \
36 (n) = (unsigned int)(n) / __base; \
37 } else \
38 __rem = __div64_32(&(n), __base); \
39 __rem; \
40 })
41
42static int skip_atoi(const char **s)
43{
44 int i, c;
45
46 for (i = 0; '0' <= (c = **s) && c <= '9'; ++*s)
47 i = i*10 + c - '0';
48 return i;
49}
50
51#define ZEROPAD 1 /* pad with zero */
52#define SIGN 2 /* unsigned/signed long */
53#define PLUS 4 /* show plus */
54#define SPACE 8 /* space if plus */
55#define LEFT 16 /* left justified */
56#define SPECIAL 32 /* 0x */
57#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */
58
59static char * number(char * str, unsigned long long num, int base, int size, int precision, int type)
60{
61 char c,sign,tmp[66];
62 const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
63 int i;
64
65 if (type & LARGE)
66 digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
67 if (type & LEFT)
68 type &= ~ZEROPAD;
69 if (base < 2 || base > 36)
70 return 0;
71 c = (type & ZEROPAD) ? '0' : ' ';
72 sign = 0;
73 if (type & SIGN) {
74 if ((signed long long)num < 0) {
75 sign = '-';
76 num = - (signed long long)num;
77 size--;
78 } else if (type & PLUS) {
79 sign = '+';
80 size--;
81 } else if (type & SPACE) {
82 sign = ' ';
83 size--;
84 }
85 }
86 if (type & SPECIAL) {
87 if (base == 16)
88 size -= 2;
89 else if (base == 8)
90 size--;
91 }
92 i = 0;
93 if (num == 0)
94 tmp[i++]='0';
95 else while (num != 0) {
96 tmp[i++] = digits[do_div(num, base)];
97 }
98 if (i > precision)
99 precision = i;
100 size -= precision;
101 if (!(type&(ZEROPAD+LEFT)))
102 while(size-->0)
103 *str++ = ' ';
104 if (sign)
105 *str++ = sign;
106 if (type & SPECIAL) {
107 if (base==8)
108 *str++ = '0';
109 else if (base==16) {
110 *str++ = '0';
111 *str++ = digits[33];
112 }
113 }
114 if (!(type & LEFT))
115 while (size-- > 0)
116 *str++ = c;
117 while (i < precision--)
118 *str++ = '0';
119 while (i-- > 0)
120 *str++ = tmp[i];
121 while (size-- > 0)
122 *str++ = ' ';
123 return str;
124}
125
126int vsprintf(char *buf, const char *fmt, va_list args)
127{
128 int len;
129 unsigned long long num;
130 int i, base;
131 char * str;
132 const char *s;
133
134 int flags; /* flags to number() */
135
136 int field_width; /* width of output field */
137 int precision; /* min. # of digits for integers; max
138 number of chars for from string */
139 int qualifier; /* 'h', 'l', or 'L' for integer fields */
140 /* 'z' support added 23/7/1999 S.H. */
141 /* 'z' changed to 'Z' --davidm 1/25/99 */
142
143
144 for (str=buf ; *fmt ; ++fmt) {
145 if (*fmt != '%') {
146 *str++ = *fmt;
147 continue;
148 }
149
150 /* process flags */
151 flags = 0;
152 repeat:
153 ++fmt; /* this also skips first '%' */
154 switch (*fmt) {
155 case '-': flags |= LEFT; goto repeat;
156 case '+': flags |= PLUS; goto repeat;
157 case ' ': flags |= SPACE; goto repeat;
158 case '#': flags |= SPECIAL; goto repeat;
159 case '0': flags |= ZEROPAD; goto repeat;
160 }
161
162 /* get field width */
163 field_width = -1;
164 if ('0' <= *fmt && *fmt <= '9')
165 field_width = skip_atoi(&fmt);
166 else if (*fmt == '*') {
167 ++fmt;
168 /* it's the next argument */
169 field_width = va_arg(args, int);
170 if (field_width < 0) {
171 field_width = -field_width;
172 flags |= LEFT;
173 }
174 }
175
176 /* get the precision */
177 precision = -1;
178 if (*fmt == '.') {
179 ++fmt;
180 if ('0' <= *fmt && *fmt <= '9')
181 precision = skip_atoi(&fmt);
182 else if (*fmt == '*') {
183 ++fmt;
184 /* it's the next argument */
185 precision = va_arg(args, int);
186 }
187 if (precision < 0)
188 precision = 0;
189 }
190
191 /* get the conversion qualifier */
192 qualifier = -1;
193 if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L' || *fmt =='Z') {
194 qualifier = *fmt;
195 ++fmt;
196 }
197
198 /* default base */
199 base = 10;
200
201 switch (*fmt) {
202 case 'c':
203 if (!(flags & LEFT))
204 while (--field_width > 0)
205 *str++ = ' ';
206 *str++ = (unsigned char) va_arg(args, int);
207 while (--field_width > 0)
208 *str++ = ' ';
209 continue;
210
211 case 's':
212 s = va_arg(args, char *);
213 if (!s)
214 s = "<NULL>";
215
216 len = strnlen(s, precision);
217
218 if (!(flags & LEFT))
219 while (len < field_width--)
220 *str++ = ' ';
221 for (i = 0; i < len; ++i)
222 *str++ = *s++;
223 while (len < field_width--)
224 *str++ = ' ';
225 continue;
226
227 case 'p':
228 if (field_width == -1) {
229 field_width = 2*sizeof(void *);
230 flags |= ZEROPAD;
231 }
232 str = number(str,
233 (unsigned long) va_arg(args, void *), 16,
234 field_width, precision, flags);
235 continue;
236
237
238 case 'n':
239 if (qualifier == 'l') {
240 long * ip = va_arg(args, long *);
241 *ip = (str - buf);
242 } else if (qualifier == 'Z') {
243 size_t * ip = va_arg(args, size_t *);
244 *ip = (str - buf);
245 } else {
246 int * ip = va_arg(args, int *);
247 *ip = (str - buf);
248 }
249 continue;
250
251 case '%':
252 *str++ = '%';
253 continue;
254
255 /* integer number formats - set up the flags and "break" */
256 case 'o':
257 base = 8;
258 break;
259
260 case 'X':
261 flags |= LARGE;
262 case 'x':
263 base = 16;
264 break;
265
266 case 'd':
267 case 'i':
268 flags |= SIGN;
269 case 'u':
270 break;
271
272 default:
273 *str++ = '%';
274 if (*fmt)
275 *str++ = *fmt;
276 else
277 --fmt;
278 continue;
279 }
280 if (qualifier == 'l') {
281 num = va_arg(args, unsigned long);
282 if (flags & SIGN)
283 num = (signed long) num;
284 } else if (qualifier == 'Z') {
285 num = va_arg(args, size_t);
286 } else if (qualifier == 'h') {
287 num = (unsigned short) va_arg(args, int);
288 if (flags & SIGN)
289 num = (signed short) num;
290 } else {
291 num = va_arg(args, unsigned int);
292 if (flags & SIGN)
293 num = (signed int) num;
294 }
295 str = number(str, num, base, field_width, precision, flags);
296 }
297 *str = '\0';
298 return str-buf;
299}
300
301int sprintf(char * buf, const char *fmt, ...)
302{
303 va_list args;
304 int i;
305
306 va_start(args, fmt);
307 i=vsprintf(buf,fmt,args);
308 va_end(args);
309 return i;
310}
311
312static char sprint_buf[1024];
313
314int
315printf(const char *fmt, ...)
316{
317 va_list args;
318 int n;
319
320 va_start(args, fmt);
321 n = vsprintf(sprint_buf, fmt, args);
322 va_end(args);
323 write(stdout, sprint_buf, n);
324 return n;
325}
diff --git a/arch/powerpc/boot/stdio.h b/arch/powerpc/boot/stdio.h
index 24bd3a8dee94..eb9e16c87aef 100644
--- a/arch/powerpc/boot/stdio.h
+++ b/arch/powerpc/boot/stdio.h
@@ -7,10 +7,4 @@ extern int sprintf(char *buf, const char *fmt, ...);
7 7
8extern int vsprintf(char *buf, const char *fmt, va_list args); 8extern int vsprintf(char *buf, const char *fmt, va_list args);
9 9
10extern int putc(int c, void *f);
11extern int putchar(int c);
12extern int getchar(void);
13
14extern int fputs(char *str, void *f);
15
16#endif /* _PPC_BOOT_STDIO_H_ */ 10#endif /* _PPC_BOOT_STDIO_H_ */
diff --git a/arch/powerpc/boot/string.S b/arch/powerpc/boot/string.S
index b1eeaed7db17..ac3d43b6a324 100644
--- a/arch/powerpc/boot/string.S
+++ b/arch/powerpc/boot/string.S
@@ -107,10 +107,12 @@ memcpy:
107 rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */ 107 rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */
108 addi r6,r3,-4 108 addi r6,r3,-4
109 addi r4,r4,-4 109 addi r4,r4,-4
110 beq 2f /* if less than 8 bytes to do */ 110 beq 3f /* if less than 8 bytes to do */
111 andi. r0,r6,3 /* get dest word aligned */ 111 andi. r0,r6,3 /* get dest word aligned */
112 mtctr r7 112 mtctr r7
113 bne 5f 113 bne 5f
114 andi. r0,r4,3 /* check src word aligned too */
115 bne 3f
1141: lwz r7,4(r4) 1161: lwz r7,4(r4)
115 lwzu r8,8(r4) 117 lwzu r8,8(r4)
116 stw r7,4(r6) 118 stw r7,4(r6)
@@ -132,6 +134,11 @@ memcpy:
132 bdnz 4b 134 bdnz 4b
133 blr 135 blr
1345: subfic r0,r0,4 1365: subfic r0,r0,4
137 cmpw cr1,r0,r5
138 add r7,r0,r4
139 andi. r7,r7,3 /* will source be word-aligned too? */
140 ble cr1,3b
141 bne 3b /* do byte-by-byte if not */
135 mtctr r0 142 mtctr r0
1366: lbz r7,4(r4) 1436: lbz r7,4(r4)
137 addi r4,r4,1 144 addi r4,r4,1
@@ -149,10 +156,12 @@ backwards_memcpy:
149 rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */ 156 rlwinm. r7,r5,32-3,3,31 /* r7 = r5 >> 3 */
150 add r6,r3,r5 157 add r6,r3,r5
151 add r4,r4,r5 158 add r4,r4,r5
152 beq 2f 159 beq 3f
153 andi. r0,r6,3 160 andi. r0,r6,3
154 mtctr r7 161 mtctr r7
155 bne 5f 162 bne 5f
163 andi. r0,r4,3
164 bne 3f
1561: lwz r7,-4(r4) 1651: lwz r7,-4(r4)
157 lwzu r8,-8(r4) 166 lwzu r8,-8(r4)
158 stw r7,-4(r6) 167 stw r7,-4(r6)
@@ -171,7 +180,12 @@ backwards_memcpy:
171 stbu r0,-1(r6) 180 stbu r0,-1(r6)
172 bdnz 4b 181 bdnz 4b
173 blr 182 blr
1745: mtctr r0 1835: cmpw cr1,r0,r5
184 subf r7,r0,r4
185 andi. r7,r7,3
186 ble cr1,3b
187 bne 3b
188 mtctr r0
1756: lbzu r7,-1(r4) 1896: lbzu r7,-1(r4)
176 stbu r7,-1(r6) 190 stbu r7,-1(r6)
177 bdnz 6b 191 bdnz 6b
diff --git a/arch/powerpc/boot/zImage.coff.lds b/arch/powerpc/boot/zImage.coff.lds
new file mode 100644
index 000000000000..6016251a1a2c
--- /dev/null
+++ b/arch/powerpc/boot/zImage.coff.lds
@@ -0,0 +1,46 @@
1OUTPUT_ARCH(powerpc:common)
2ENTRY(_start)
3SECTIONS
4{
5 . = (5*1024*1024);
6 _start = .;
7 .text :
8 {
9 *(.text)
10 *(.fixup)
11 }
12 _etext = .;
13 . = ALIGN(4096);
14 .data :
15 {
16 *(.rodata*)
17 *(.data*)
18 *(.sdata*)
19 __got2_start = .;
20 *(.got2)
21 __got2_end = .;
22
23 _vmlinux_start = .;
24 *(.kernel:vmlinux.strip)
25 _vmlinux_end = .;
26
27 _initrd_start = .;
28 *(.kernel:initrd)
29 _initrd_end = .;
30 }
31
32 . = ALIGN(4096);
33 _edata = .;
34 __bss_start = .;
35 .bss :
36 {
37 *(.sbss)
38 *(.bss)
39 }
40 _end = . ;
41
42 /DISCARD/ :
43 {
44 *(.comment)
45 }
46}
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index 4b433411b9e3..063b84f2cbea 100644
--- a/arch/powerpc/configs/cell_defconfig
+++ b/arch/powerpc/configs/cell_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.15-rc1 3# Linux kernel version: 2.6.15-rc5
4# Tue Nov 15 14:36:20 2005 4# Tue Dec 20 15:59:26 2005
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -53,6 +53,7 @@ CONFIG_KOBJECT_UEVENT=y
53# CONFIG_IKCONFIG is not set 53# CONFIG_IKCONFIG is not set
54# CONFIG_CPUSETS is not set 54# CONFIG_CPUSETS is not set
55CONFIG_INITRAMFS_SOURCE="" 55CONFIG_INITRAMFS_SOURCE=""
56CONFIG_CC_OPTIMIZE_FOR_SIZE=y
56# CONFIG_EMBEDDED is not set 57# CONFIG_EMBEDDED is not set
57CONFIG_KALLSYMS=y 58CONFIG_KALLSYMS=y
58# CONFIG_KALLSYMS_ALL is not set 59# CONFIG_KALLSYMS_ALL is not set
@@ -151,7 +152,7 @@ CONFIG_FLATMEM_MANUAL=y
151CONFIG_FLATMEM=y 152CONFIG_FLATMEM=y
152CONFIG_FLAT_NODE_MEM_MAP=y 153CONFIG_FLAT_NODE_MEM_MAP=y
153# CONFIG_SPARSEMEM_STATIC is not set 154# CONFIG_SPARSEMEM_STATIC is not set
154CONFIG_SPLIT_PTLOCK_CPUS=4096 155CONFIG_SPLIT_PTLOCK_CPUS=4
155# CONFIG_PPC_64K_PAGES is not set 156# CONFIG_PPC_64K_PAGES is not set
156CONFIG_SCHED_SMT=y 157CONFIG_SCHED_SMT=y
157CONFIG_PROC_DEVICETREE=y 158CONFIG_PROC_DEVICETREE=y
@@ -532,6 +533,7 @@ CONFIG_MII=y
532# CONFIG_DL2K is not set 533# CONFIG_DL2K is not set
533CONFIG_E1000=m 534CONFIG_E1000=m
534# CONFIG_E1000_NAPI is not set 535# CONFIG_E1000_NAPI is not set
536# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
535# CONFIG_NS83820 is not set 537# CONFIG_NS83820 is not set
536# CONFIG_HAMACHI is not set 538# CONFIG_HAMACHI is not set
537# CONFIG_YELLOWFIN is not set 539# CONFIG_YELLOWFIN is not set
diff --git a/arch/powerpc/configs/g5_defconfig b/arch/powerpc/configs/g5_defconfig
index e7c23e3902b8..d6fed3f56580 100644
--- a/arch/powerpc/configs/g5_defconfig
+++ b/arch/powerpc/configs/g5_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.15-rc1 3# Linux kernel version: 2.6.15-rc5
4# Tue Nov 15 14:39:20 2005 4# Tue Dec 20 15:59:30 2005
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -53,6 +53,7 @@ CONFIG_IKCONFIG=y
53CONFIG_IKCONFIG_PROC=y 53CONFIG_IKCONFIG_PROC=y
54# CONFIG_CPUSETS is not set 54# CONFIG_CPUSETS is not set
55CONFIG_INITRAMFS_SOURCE="" 55CONFIG_INITRAMFS_SOURCE=""
56CONFIG_CC_OPTIMIZE_FOR_SIZE=y
56# CONFIG_EMBEDDED is not set 57# CONFIG_EMBEDDED is not set
57CONFIG_KALLSYMS=y 58CONFIG_KALLSYMS=y
58# CONFIG_KALLSYMS_ALL is not set 59# CONFIG_KALLSYMS_ALL is not set
@@ -162,7 +163,7 @@ CONFIG_FLATMEM_MANUAL=y
162CONFIG_FLATMEM=y 163CONFIG_FLATMEM=y
163CONFIG_FLAT_NODE_MEM_MAP=y 164CONFIG_FLAT_NODE_MEM_MAP=y
164# CONFIG_SPARSEMEM_STATIC is not set 165# CONFIG_SPARSEMEM_STATIC is not set
165CONFIG_SPLIT_PTLOCK_CPUS=4096 166CONFIG_SPLIT_PTLOCK_CPUS=4
166# CONFIG_PPC_64K_PAGES is not set 167# CONFIG_PPC_64K_PAGES is not set
167# CONFIG_SCHED_SMT is not set 168# CONFIG_SCHED_SMT is not set
168CONFIG_PROC_DEVICETREE=y 169CONFIG_PROC_DEVICETREE=y
@@ -674,6 +675,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
674# CONFIG_DL2K is not set 675# CONFIG_DL2K is not set
675CONFIG_E1000=y 676CONFIG_E1000=y
676# CONFIG_E1000_NAPI is not set 677# CONFIG_E1000_NAPI is not set
678# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
677# CONFIG_NS83820 is not set 679# CONFIG_NS83820 is not set
678# CONFIG_HAMACHI is not set 680# CONFIG_HAMACHI is not set
679# CONFIG_YELLOWFIN is not set 681# CONFIG_YELLOWFIN is not set
@@ -1203,6 +1205,7 @@ CONFIG_USB_MON=y
1203CONFIG_USB_SERIAL=m 1205CONFIG_USB_SERIAL=m
1204CONFIG_USB_SERIAL_GENERIC=y 1206CONFIG_USB_SERIAL_GENERIC=y
1205# CONFIG_USB_SERIAL_AIRPRIME is not set 1207# CONFIG_USB_SERIAL_AIRPRIME is not set
1208# CONFIG_USB_SERIAL_ANYDATA is not set
1206CONFIG_USB_SERIAL_BELKIN=m 1209CONFIG_USB_SERIAL_BELKIN=m
1207CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m 1210CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
1208# CONFIG_USB_SERIAL_CP2101 is not set 1211# CONFIG_USB_SERIAL_CP2101 is not set
@@ -1233,7 +1236,6 @@ CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1233CONFIG_USB_SERIAL_KLSI=m 1236CONFIG_USB_SERIAL_KLSI=m
1234CONFIG_USB_SERIAL_KOBIL_SCT=m 1237CONFIG_USB_SERIAL_KOBIL_SCT=m
1235CONFIG_USB_SERIAL_MCT_U232=m 1238CONFIG_USB_SERIAL_MCT_U232=m
1236# CONFIG_USB_SERIAL_NOKIA_DKU2 is not set
1237CONFIG_USB_SERIAL_PL2303=m 1239CONFIG_USB_SERIAL_PL2303=m
1238# CONFIG_USB_SERIAL_HP4X is not set 1240# CONFIG_USB_SERIAL_HP4X is not set
1239CONFIG_USB_SERIAL_SAFE=m 1241CONFIG_USB_SERIAL_SAFE=m
diff --git a/arch/powerpc/configs/iseries_defconfig b/arch/powerpc/configs/iseries_defconfig
index 5d0866707a75..c775027947f9 100644
--- a/arch/powerpc/configs/iseries_defconfig
+++ b/arch/powerpc/configs/iseries_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.15-rc1 3# Linux kernel version: 2.6.15-rc5
4# Tue Nov 15 14:38:09 2005 4# Tue Dec 20 15:59:32 2005
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -55,6 +55,7 @@ CONFIG_IKCONFIG=y
55CONFIG_IKCONFIG_PROC=y 55CONFIG_IKCONFIG_PROC=y
56# CONFIG_CPUSETS is not set 56# CONFIG_CPUSETS is not set
57CONFIG_INITRAMFS_SOURCE="" 57CONFIG_INITRAMFS_SOURCE=""
58CONFIG_CC_OPTIMIZE_FOR_SIZE=y
58# CONFIG_EMBEDDED is not set 59# CONFIG_EMBEDDED is not set
59CONFIG_KALLSYMS=y 60CONFIG_KALLSYMS=y
60# CONFIG_KALLSYMS_ALL is not set 61# CONFIG_KALLSYMS_ALL is not set
@@ -144,7 +145,7 @@ CONFIG_FLATMEM_MANUAL=y
144CONFIG_FLATMEM=y 145CONFIG_FLATMEM=y
145CONFIG_FLAT_NODE_MEM_MAP=y 146CONFIG_FLAT_NODE_MEM_MAP=y
146# CONFIG_SPARSEMEM_STATIC is not set 147# CONFIG_SPARSEMEM_STATIC is not set
147CONFIG_SPLIT_PTLOCK_CPUS=4096 148CONFIG_SPLIT_PTLOCK_CPUS=4
148# CONFIG_PPC_64K_PAGES is not set 149# CONFIG_PPC_64K_PAGES is not set
149# CONFIG_SCHED_SMT is not set 150# CONFIG_SCHED_SMT is not set
150CONFIG_PROC_DEVICETREE=y 151CONFIG_PROC_DEVICETREE=y
@@ -566,6 +567,7 @@ CONFIG_ACENIC=m
566# CONFIG_DL2K is not set 567# CONFIG_DL2K is not set
567CONFIG_E1000=m 568CONFIG_E1000=m
568# CONFIG_E1000_NAPI is not set 569# CONFIG_E1000_NAPI is not set
570# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
569# CONFIG_NS83820 is not set 571# CONFIG_NS83820 is not set
570# CONFIG_HAMACHI is not set 572# CONFIG_HAMACHI is not set
571# CONFIG_YELLOWFIN is not set 573# CONFIG_YELLOWFIN is not set
diff --git a/arch/powerpc/configs/maple_defconfig b/arch/powerpc/configs/maple_defconfig
index 92e42613ef06..68194c03f6d1 100644
--- a/arch/powerpc/configs/maple_defconfig
+++ b/arch/powerpc/configs/maple_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.15-rc1 3# Linux kernel version: 2.6.15-rc5
4# Tue Nov 15 14:38:58 2005 4# Tue Dec 20 15:59:36 2005
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -53,6 +53,7 @@ CONFIG_IKCONFIG=y
53CONFIG_IKCONFIG_PROC=y 53CONFIG_IKCONFIG_PROC=y
54# CONFIG_CPUSETS is not set 54# CONFIG_CPUSETS is not set
55CONFIG_INITRAMFS_SOURCE="" 55CONFIG_INITRAMFS_SOURCE=""
56CONFIG_CC_OPTIMIZE_FOR_SIZE=y
56# CONFIG_EMBEDDED is not set 57# CONFIG_EMBEDDED is not set
57CONFIG_KALLSYMS=y 58CONFIG_KALLSYMS=y
58CONFIG_KALLSYMS_ALL=y 59CONFIG_KALLSYMS_ALL=y
@@ -149,7 +150,7 @@ CONFIG_FLATMEM_MANUAL=y
149CONFIG_FLATMEM=y 150CONFIG_FLATMEM=y
150CONFIG_FLAT_NODE_MEM_MAP=y 151CONFIG_FLAT_NODE_MEM_MAP=y
151# CONFIG_SPARSEMEM_STATIC is not set 152# CONFIG_SPARSEMEM_STATIC is not set
152CONFIG_SPLIT_PTLOCK_CPUS=4096 153CONFIG_SPLIT_PTLOCK_CPUS=4
153# CONFIG_PPC_64K_PAGES is not set 154# CONFIG_PPC_64K_PAGES is not set
154# CONFIG_SCHED_SMT is not set 155# CONFIG_SCHED_SMT is not set
155CONFIG_PROC_DEVICETREE=y 156CONFIG_PROC_DEVICETREE=y
@@ -242,7 +243,6 @@ CONFIG_TCP_CONG_BIC=y
242# QoS and/or fair queueing 243# QoS and/or fair queueing
243# 244#
244# CONFIG_NET_SCHED is not set 245# CONFIG_NET_SCHED is not set
245# CONFIG_NET_CLS_ROUTE is not set
246 246
247# 247#
248# Network testing 248# Network testing
@@ -454,6 +454,7 @@ CONFIG_AMD8111_ETH=y
454# CONFIG_DL2K is not set 454# CONFIG_DL2K is not set
455CONFIG_E1000=y 455CONFIG_E1000=y
456# CONFIG_E1000_NAPI is not set 456# CONFIG_E1000_NAPI is not set
457# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
457# CONFIG_NS83820 is not set 458# CONFIG_NS83820 is not set
458# CONFIG_HAMACHI is not set 459# CONFIG_HAMACHI is not set
459# CONFIG_YELLOWFIN is not set 460# CONFIG_YELLOWFIN is not set
@@ -794,6 +795,7 @@ CONFIG_USB_SERIAL=y
794# CONFIG_USB_SERIAL_CONSOLE is not set 795# CONFIG_USB_SERIAL_CONSOLE is not set
795CONFIG_USB_SERIAL_GENERIC=y 796CONFIG_USB_SERIAL_GENERIC=y
796# CONFIG_USB_SERIAL_AIRPRIME is not set 797# CONFIG_USB_SERIAL_AIRPRIME is not set
798# CONFIG_USB_SERIAL_ANYDATA is not set
797# CONFIG_USB_SERIAL_BELKIN is not set 799# CONFIG_USB_SERIAL_BELKIN is not set
798# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set 800# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
799# CONFIG_USB_SERIAL_CP2101 is not set 801# CONFIG_USB_SERIAL_CP2101 is not set
@@ -824,7 +826,6 @@ CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
824# CONFIG_USB_SERIAL_KLSI is not set 826# CONFIG_USB_SERIAL_KLSI is not set
825# CONFIG_USB_SERIAL_KOBIL_SCT is not set 827# CONFIG_USB_SERIAL_KOBIL_SCT is not set
826# CONFIG_USB_SERIAL_MCT_U232 is not set 828# CONFIG_USB_SERIAL_MCT_U232 is not set
827# CONFIG_USB_SERIAL_NOKIA_DKU2 is not set
828# CONFIG_USB_SERIAL_PL2303 is not set 829# CONFIG_USB_SERIAL_PL2303 is not set
829# CONFIG_USB_SERIAL_HP4X is not set 830# CONFIG_USB_SERIAL_HP4X is not set
830# CONFIG_USB_SERIAL_SAFE is not set 831# CONFIG_USB_SERIAL_SAFE is not set
diff --git a/arch/powerpc/configs/mpc834x_sys_defconfig b/arch/powerpc/configs/mpc834x_sys_defconfig
new file mode 100644
index 000000000000..3bff761965c2
--- /dev/null
+++ b/arch/powerpc/configs/mpc834x_sys_defconfig
@@ -0,0 +1,911 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-g461d4edf-dirty
4# Fri Jan 13 11:01:47 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_PPC=y
14CONFIG_EARLY_PRINTK=y
15CONFIG_GENERIC_NVRAM=y
16CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
17CONFIG_ARCH_MAY_HAVE_PC_FDC=y
18CONFIG_PPC_OF=y
19CONFIG_PPC_UDBG_16550=y
20# CONFIG_GENERIC_TBSYNC is not set
21CONFIG_DEFAULT_UIMAGE=y
22
23#
24# Processor support
25#
26# CONFIG_CLASSIC32 is not set
27# CONFIG_PPC_52xx is not set
28# CONFIG_PPC_82xx is not set
29CONFIG_PPC_83xx=y
30# CONFIG_40x is not set
31# CONFIG_44x is not set
32# CONFIG_8xx is not set
33# CONFIG_E200 is not set
34# CONFIG_E500 is not set
35CONFIG_6xx=y
36CONFIG_83xx=y
37CONFIG_PPC_FPU=y
38CONFIG_PPC_STD_MMU=y
39CONFIG_PPC_STD_MMU_32=y
40# CONFIG_SMP is not set
41
42#
43# Code maturity level options
44#
45CONFIG_EXPERIMENTAL=y
46CONFIG_CLEAN_COMPILE=y
47CONFIG_BROKEN_ON_SMP=y
48CONFIG_INIT_ENV_ARG_LIMIT=32
49
50#
51# General setup
52#
53CONFIG_LOCALVERSION=""
54CONFIG_LOCALVERSION_AUTO=y
55CONFIG_SWAP=y
56CONFIG_SYSVIPC=y
57# CONFIG_POSIX_MQUEUE is not set
58# CONFIG_BSD_PROCESS_ACCT is not set
59CONFIG_SYSCTL=y
60# CONFIG_AUDIT is not set
61# CONFIG_IKCONFIG is not set
62CONFIG_INITRAMFS_SOURCE=""
63# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
64CONFIG_EMBEDDED=y
65# CONFIG_KALLSYMS is not set
66CONFIG_HOTPLUG=y
67CONFIG_PRINTK=y
68CONFIG_BUG=y
69CONFIG_ELF_CORE=y
70CONFIG_BASE_FULL=y
71CONFIG_FUTEX=y
72# CONFIG_EPOLL is not set
73CONFIG_SHMEM=y
74CONFIG_CC_ALIGN_FUNCTIONS=0
75CONFIG_CC_ALIGN_LABELS=0
76CONFIG_CC_ALIGN_LOOPS=0
77CONFIG_CC_ALIGN_JUMPS=0
78CONFIG_SLAB=y
79# CONFIG_TINY_SHMEM is not set
80CONFIG_BASE_SMALL=0
81# CONFIG_SLOB is not set
82
83#
84# Loadable module support
85#
86CONFIG_MODULES=y
87CONFIG_MODULE_UNLOAD=y
88# CONFIG_MODULE_FORCE_UNLOAD is not set
89CONFIG_OBSOLETE_MODPARM=y
90# CONFIG_MODVERSIONS is not set
91# CONFIG_MODULE_SRCVERSION_ALL is not set
92# CONFIG_KMOD is not set
93
94#
95# Block layer
96#
97# CONFIG_LBD is not set
98
99#
100# IO Schedulers
101#
102CONFIG_IOSCHED_NOOP=y
103CONFIG_IOSCHED_AS=y
104CONFIG_IOSCHED_DEADLINE=y
105CONFIG_IOSCHED_CFQ=y
106CONFIG_DEFAULT_AS=y
107# CONFIG_DEFAULT_DEADLINE is not set
108# CONFIG_DEFAULT_CFQ is not set
109# CONFIG_DEFAULT_NOOP is not set
110CONFIG_DEFAULT_IOSCHED="anticipatory"
111CONFIG_PPC_GEN550=y
112# CONFIG_WANT_EARLY_SERIAL is not set
113
114#
115# Platform support
116#
117CONFIG_MPC834x_SYS=y
118CONFIG_MPC834x=y
119
120#
121# Kernel options
122#
123# CONFIG_HIGHMEM is not set
124# CONFIG_HZ_100 is not set
125CONFIG_HZ_250=y
126# CONFIG_HZ_1000 is not set
127CONFIG_HZ=250
128CONFIG_PREEMPT_NONE=y
129# CONFIG_PREEMPT_VOLUNTARY is not set
130# CONFIG_PREEMPT is not set
131CONFIG_BINFMT_ELF=y
132# CONFIG_BINFMT_MISC is not set
133CONFIG_ARCH_FLATMEM_ENABLE=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
142CONFIG_PROC_DEVICETREE=y
143# CONFIG_CMDLINE_BOOL is not set
144# CONFIG_PM is not set
145# CONFIG_SOFTWARE_SUSPEND is not set
146CONFIG_SECCOMP=y
147CONFIG_ISA_DMA_API=y
148
149#
150# Bus options
151#
152CONFIG_GENERIC_ISA_DMA=y
153# CONFIG_PPC_I8259 is not set
154CONFIG_PPC_INDIRECT_PCI=y
155CONFIG_FSL_SOC=y
156CONFIG_PCI=y
157CONFIG_PCI_DOMAINS=y
158# CONFIG_PCI_LEGACY_PROC is not set
159
160#
161# PCCARD (PCMCIA/CardBus) support
162#
163# CONFIG_PCCARD is not set
164
165#
166# PCI Hotplug Support
167#
168# CONFIG_HOTPLUG_PCI is not set
169
170#
171# Advanced setup
172#
173# CONFIG_ADVANCED_OPTIONS is not set
174
175#
176# Default settings for advanced configuration options are used
177#
178CONFIG_HIGHMEM_START=0xfe000000
179CONFIG_LOWMEM_SIZE=0x30000000
180CONFIG_KERNEL_START=0xc0000000
181CONFIG_TASK_SIZE=0x80000000
182CONFIG_BOOT_LOAD=0x00800000
183
184#
185# Networking
186#
187CONFIG_NET=y
188
189#
190# Networking options
191#
192CONFIG_PACKET=y
193# CONFIG_PACKET_MMAP is not set
194CONFIG_UNIX=y
195# CONFIG_NET_KEY is not set
196CONFIG_INET=y
197CONFIG_IP_MULTICAST=y
198# CONFIG_IP_ADVANCED_ROUTER is not set
199CONFIG_IP_FIB_HASH=y
200CONFIG_IP_PNP=y
201CONFIG_IP_PNP_DHCP=y
202CONFIG_IP_PNP_BOOTP=y
203# CONFIG_IP_PNP_RARP is not set
204# CONFIG_NET_IPIP is not set
205# CONFIG_NET_IPGRE is not set
206# CONFIG_IP_MROUTE is not set
207# CONFIG_ARPD is not set
208CONFIG_SYN_COOKIES=y
209# CONFIG_INET_AH is not set
210# CONFIG_INET_ESP is not set
211# CONFIG_INET_IPCOMP is not set
212# CONFIG_INET_TUNNEL is not set
213CONFIG_INET_DIAG=y
214CONFIG_INET_TCP_DIAG=y
215# CONFIG_TCP_CONG_ADVANCED is not set
216CONFIG_TCP_CONG_BIC=y
217# CONFIG_IPV6 is not set
218# CONFIG_NETFILTER is not set
219
220#
221# DCCP Configuration (EXPERIMENTAL)
222#
223# CONFIG_IP_DCCP is not set
224
225#
226# SCTP Configuration (EXPERIMENTAL)
227#
228# CONFIG_IP_SCTP is not set
229# CONFIG_ATM is not set
230# CONFIG_BRIDGE is not set
231# CONFIG_VLAN_8021Q is not set
232# CONFIG_DECNET is not set
233# CONFIG_LLC2 is not set
234# CONFIG_IPX is not set
235# CONFIG_ATALK is not set
236# CONFIG_X25 is not set
237# CONFIG_LAPB is not set
238# CONFIG_NET_DIVERT is not set
239# CONFIG_ECONET is not set
240# CONFIG_WAN_ROUTER is not set
241
242#
243# QoS and/or fair queueing
244#
245# CONFIG_NET_SCHED is not set
246
247#
248# Network testing
249#
250# CONFIG_NET_PKTGEN is not set
251# CONFIG_HAMRADIO is not set
252# CONFIG_IRDA is not set
253# CONFIG_BT is not set
254# CONFIG_IEEE80211 is not set
255
256#
257# Device Drivers
258#
259
260#
261# Generic Driver Options
262#
263CONFIG_STANDALONE=y
264CONFIG_PREVENT_FIRMWARE_BUILD=y
265# CONFIG_FW_LOADER is not set
266
267#
268# Connector - unified userspace <-> kernelspace linker
269#
270# CONFIG_CONNECTOR is not set
271
272#
273# Memory Technology Devices (MTD)
274#
275# CONFIG_MTD is not set
276
277#
278# Parallel port support
279#
280# CONFIG_PARPORT is not set
281
282#
283# Plug and Play support
284#
285
286#
287# Block devices
288#
289# CONFIG_BLK_DEV_FD is not set
290# CONFIG_BLK_CPQ_DA is not set
291# CONFIG_BLK_CPQ_CISS_DA is not set
292# CONFIG_BLK_DEV_DAC960 is not set
293# CONFIG_BLK_DEV_UMEM is not set
294# CONFIG_BLK_DEV_COW_COMMON is not set
295CONFIG_BLK_DEV_LOOP=y
296# CONFIG_BLK_DEV_CRYPTOLOOP is not set
297# CONFIG_BLK_DEV_NBD is not set
298# CONFIG_BLK_DEV_SX8 is not set
299CONFIG_BLK_DEV_RAM=y
300CONFIG_BLK_DEV_RAM_COUNT=16
301CONFIG_BLK_DEV_RAM_SIZE=32768
302CONFIG_BLK_DEV_INITRD=y
303# CONFIG_CDROM_PKTCDVD is not set
304# CONFIG_ATA_OVER_ETH is not set
305
306#
307# ATA/ATAPI/MFM/RLL support
308#
309# CONFIG_IDE is not set
310
311#
312# SCSI device support
313#
314# CONFIG_RAID_ATTRS is not set
315# CONFIG_SCSI is not set
316
317#
318# Multi-device support (RAID and LVM)
319#
320# CONFIG_MD is not set
321
322#
323# Fusion MPT device support
324#
325# CONFIG_FUSION is not set
326
327#
328# IEEE 1394 (FireWire) support
329#
330# CONFIG_IEEE1394 is not set
331
332#
333# I2O device support
334#
335# CONFIG_I2O is not set
336
337#
338# Macintosh device drivers
339#
340# CONFIG_WINDFARM is not set
341
342#
343# Network device support
344#
345CONFIG_NETDEVICES=y
346# CONFIG_DUMMY is not set
347# CONFIG_BONDING is not set
348# CONFIG_EQUALIZER is not set
349# CONFIG_TUN is not set
350
351#
352# ARCnet devices
353#
354# CONFIG_ARCNET is not set
355
356#
357# PHY device support
358#
359CONFIG_PHYLIB=y
360
361#
362# MII PHY device drivers
363#
364CONFIG_MARVELL_PHY=y
365# CONFIG_DAVICOM_PHY is not set
366# CONFIG_QSEMI_PHY is not set
367# CONFIG_LXT_PHY is not set
368# CONFIG_CICADA_PHY is not set
369
370#
371# Ethernet (10 or 100Mbit)
372#
373CONFIG_NET_ETHERNET=y
374CONFIG_MII=y
375# CONFIG_HAPPYMEAL is not set
376# CONFIG_SUNGEM is not set
377# CONFIG_CASSINI is not set
378# CONFIG_NET_VENDOR_3COM is not set
379
380#
381# Tulip family network device support
382#
383# CONFIG_NET_TULIP is not set
384# CONFIG_HP100 is not set
385CONFIG_NET_PCI=y
386# CONFIG_PCNET32 is not set
387# CONFIG_AMD8111_ETH is not set
388# CONFIG_ADAPTEC_STARFIRE is not set
389# CONFIG_B44 is not set
390# CONFIG_FORCEDETH is not set
391# CONFIG_DGRS is not set
392# CONFIG_EEPRO100 is not set
393CONFIG_E100=y
394# CONFIG_FEALNX is not set
395# CONFIG_NATSEMI is not set
396# CONFIG_NE2K_PCI is not set
397# CONFIG_8139CP is not set
398# CONFIG_8139TOO is not set
399# CONFIG_SIS900 is not set
400# CONFIG_EPIC100 is not set
401# CONFIG_SUNDANCE is not set
402# CONFIG_TLAN is not set
403# CONFIG_VIA_RHINE is not set
404
405#
406# Ethernet (1000 Mbit)
407#
408# CONFIG_ACENIC is not set
409# CONFIG_DL2K is not set
410# CONFIG_E1000 is not set
411# CONFIG_NS83820 is not set
412# CONFIG_HAMACHI is not set
413# CONFIG_YELLOWFIN is not set
414# CONFIG_R8169 is not set
415# CONFIG_SIS190 is not set
416# CONFIG_SKGE is not set
417# CONFIG_SKY2 is not set
418# CONFIG_SK98LIN is not set
419# CONFIG_VIA_VELOCITY is not set
420# CONFIG_TIGON3 is not set
421# CONFIG_BNX2 is not set
422CONFIG_GIANFAR=y
423# CONFIG_GFAR_NAPI is not set
424
425#
426# Ethernet (10000 Mbit)
427#
428# CONFIG_CHELSIO_T1 is not set
429# CONFIG_IXGB is not set
430# CONFIG_S2IO is not set
431
432#
433# Token Ring devices
434#
435# CONFIG_TR is not set
436
437#
438# Wireless LAN (non-hamradio)
439#
440# CONFIG_NET_RADIO is not set
441
442#
443# Wan interfaces
444#
445# CONFIG_WAN is not set
446# CONFIG_FDDI is not set
447# CONFIG_HIPPI is not set
448# CONFIG_PPP is not set
449# CONFIG_SLIP is not set
450# CONFIG_SHAPER is not set
451# CONFIG_NETCONSOLE is not set
452# CONFIG_NETPOLL is not set
453# CONFIG_NET_POLL_CONTROLLER is not set
454
455#
456# ISDN subsystem
457#
458# CONFIG_ISDN is not set
459
460#
461# Telephony Support
462#
463# CONFIG_PHONE is not set
464
465#
466# Input device support
467#
468CONFIG_INPUT=y
469
470#
471# Userland interfaces
472#
473# CONFIG_INPUT_MOUSEDEV is not set
474# CONFIG_INPUT_JOYDEV is not set
475# CONFIG_INPUT_TSDEV is not set
476# CONFIG_INPUT_EVDEV is not set
477# CONFIG_INPUT_EVBUG is not set
478
479#
480# Input Device Drivers
481#
482# CONFIG_INPUT_KEYBOARD is not set
483# CONFIG_INPUT_MOUSE is not set
484# CONFIG_INPUT_JOYSTICK is not set
485# CONFIG_INPUT_TOUCHSCREEN is not set
486# CONFIG_INPUT_MISC is not set
487
488#
489# Hardware I/O ports
490#
491# CONFIG_SERIO is not set
492# CONFIG_GAMEPORT is not set
493
494#
495# Character devices
496#
497# CONFIG_VT is not set
498# CONFIG_SERIAL_NONSTANDARD is not set
499
500#
501# Serial drivers
502#
503CONFIG_SERIAL_8250=y
504CONFIG_SERIAL_8250_CONSOLE=y
505CONFIG_SERIAL_8250_NR_UARTS=4
506CONFIG_SERIAL_8250_RUNTIME_UARTS=4
507# CONFIG_SERIAL_8250_EXTENDED is not set
508
509#
510# Non-8250 serial port support
511#
512CONFIG_SERIAL_CORE=y
513CONFIG_SERIAL_CORE_CONSOLE=y
514CONFIG_UNIX98_PTYS=y
515CONFIG_LEGACY_PTYS=y
516CONFIG_LEGACY_PTY_COUNT=256
517
518#
519# IPMI
520#
521# CONFIG_IPMI_HANDLER is not set
522
523#
524# Watchdog Cards
525#
526CONFIG_WATCHDOG=y
527# CONFIG_WATCHDOG_NOWAYOUT is not set
528
529#
530# Watchdog Device Drivers
531#
532# CONFIG_SOFT_WATCHDOG is not set
533CONFIG_83xx_WDT=y
534
535#
536# PCI-based Watchdog Cards
537#
538# CONFIG_PCIPCWATCHDOG is not set
539# CONFIG_WDTPCI is not set
540# CONFIG_NVRAM is not set
541CONFIG_GEN_RTC=y
542# CONFIG_GEN_RTC_X is not set
543# CONFIG_DTLK is not set
544# CONFIG_R3964 is not set
545# CONFIG_APPLICOM is not set
546
547#
548# Ftape, the floppy tape device driver
549#
550# CONFIG_AGP is not set
551# CONFIG_DRM is not set
552# CONFIG_RAW_DRIVER is not set
553
554#
555# TPM devices
556#
557# CONFIG_TCG_TPM is not set
558# CONFIG_TELCLOCK is not set
559
560#
561# I2C support
562#
563CONFIG_I2C=y
564CONFIG_I2C_CHARDEV=y
565
566#
567# I2C Algorithms
568#
569# CONFIG_I2C_ALGOBIT is not set
570# CONFIG_I2C_ALGOPCF is not set
571# CONFIG_I2C_ALGOPCA is not set
572
573#
574# I2C Hardware Bus support
575#
576# CONFIG_I2C_ALI1535 is not set
577# CONFIG_I2C_ALI1563 is not set
578# CONFIG_I2C_ALI15X3 is not set
579# CONFIG_I2C_AMD756 is not set
580# CONFIG_I2C_AMD8111 is not set
581# CONFIG_I2C_I801 is not set
582# CONFIG_I2C_I810 is not set
583# CONFIG_I2C_PIIX4 is not set
584CONFIG_I2C_MPC=y
585# CONFIG_I2C_NFORCE2 is not set
586# CONFIG_I2C_PARPORT_LIGHT is not set
587# CONFIG_I2C_PROSAVAGE is not set
588# CONFIG_I2C_SAVAGE4 is not set
589# CONFIG_SCx200_ACB is not set
590# CONFIG_I2C_SIS5595 is not set
591# CONFIG_I2C_SIS630 is not set
592# CONFIG_I2C_SIS96X is not set
593# CONFIG_I2C_STUB is not set
594# CONFIG_I2C_VIA is not set
595# CONFIG_I2C_VIAPRO is not set
596# CONFIG_I2C_VOODOO3 is not set
597# CONFIG_I2C_PCA_ISA is not set
598
599#
600# Miscellaneous I2C Chip support
601#
602# CONFIG_SENSORS_DS1337 is not set
603# CONFIG_SENSORS_DS1374 is not set
604# CONFIG_SENSORS_EEPROM is not set
605# CONFIG_SENSORS_PCF8574 is not set
606# CONFIG_SENSORS_PCA9539 is not set
607# CONFIG_SENSORS_PCF8591 is not set
608# CONFIG_SENSORS_RTC8564 is not set
609# CONFIG_SENSORS_M41T00 is not set
610# CONFIG_SENSORS_MAX6875 is not set
611# CONFIG_RTC_X1205_I2C is not set
612# CONFIG_I2C_DEBUG_CORE is not set
613# CONFIG_I2C_DEBUG_ALGO is not set
614# CONFIG_I2C_DEBUG_BUS is not set
615# CONFIG_I2C_DEBUG_CHIP is not set
616
617#
618# Dallas's 1-wire bus
619#
620# CONFIG_W1 is not set
621
622#
623# Hardware Monitoring support
624#
625CONFIG_HWMON=y
626# CONFIG_HWMON_VID is not set
627# CONFIG_SENSORS_ADM1021 is not set
628# CONFIG_SENSORS_ADM1025 is not set
629# CONFIG_SENSORS_ADM1026 is not set
630# CONFIG_SENSORS_ADM1031 is not set
631# CONFIG_SENSORS_ADM9240 is not set
632# CONFIG_SENSORS_ASB100 is not set
633# CONFIG_SENSORS_ATXP1 is not set
634# CONFIG_SENSORS_DS1621 is not set
635# CONFIG_SENSORS_FSCHER is not set
636# CONFIG_SENSORS_FSCPOS is not set
637# CONFIG_SENSORS_GL518SM is not set
638# CONFIG_SENSORS_GL520SM is not set
639# CONFIG_SENSORS_IT87 is not set
640# CONFIG_SENSORS_LM63 is not set
641# CONFIG_SENSORS_LM75 is not set
642# CONFIG_SENSORS_LM77 is not set
643# CONFIG_SENSORS_LM78 is not set
644# CONFIG_SENSORS_LM80 is not set
645# CONFIG_SENSORS_LM83 is not set
646# CONFIG_SENSORS_LM85 is not set
647# CONFIG_SENSORS_LM87 is not set
648# CONFIG_SENSORS_LM90 is not set
649# CONFIG_SENSORS_LM92 is not set
650# CONFIG_SENSORS_MAX1619 is not set
651# CONFIG_SENSORS_PC87360 is not set
652# CONFIG_SENSORS_SIS5595 is not set
653# CONFIG_SENSORS_SMSC47M1 is not set
654# CONFIG_SENSORS_SMSC47B397 is not set
655# CONFIG_SENSORS_VIA686A is not set
656# CONFIG_SENSORS_VT8231 is not set
657# CONFIG_SENSORS_W83781D is not set
658# CONFIG_SENSORS_W83792D is not set
659# CONFIG_SENSORS_W83L785TS is not set
660# CONFIG_SENSORS_W83627HF is not set
661# CONFIG_SENSORS_W83627EHF is not set
662# CONFIG_HWMON_DEBUG_CHIP is not set
663
664#
665# Misc devices
666#
667
668#
669# Multimedia Capabilities Port drivers
670#
671
672#
673# Multimedia devices
674#
675# CONFIG_VIDEO_DEV is not set
676
677#
678# Digital Video Broadcasting Devices
679#
680# CONFIG_DVB is not set
681
682#
683# Graphics support
684#
685# CONFIG_FB is not set
686
687#
688# Sound
689#
690# CONFIG_SOUND is not set
691
692#
693# USB support
694#
695CONFIG_USB_ARCH_HAS_HCD=y
696CONFIG_USB_ARCH_HAS_OHCI=y
697# CONFIG_USB is not set
698
699#
700# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
701#
702
703#
704# USB Gadget Support
705#
706# CONFIG_USB_GADGET is not set
707
708#
709# MMC/SD Card support
710#
711# CONFIG_MMC is not set
712
713#
714# InfiniBand support
715#
716# CONFIG_INFINIBAND is not set
717
718#
719# SN Devices
720#
721
722#
723# File systems
724#
725CONFIG_EXT2_FS=y
726# CONFIG_EXT2_FS_XATTR is not set
727# CONFIG_EXT2_FS_XIP is not set
728CONFIG_EXT3_FS=y
729CONFIG_EXT3_FS_XATTR=y
730# CONFIG_EXT3_FS_POSIX_ACL is not set
731# CONFIG_EXT3_FS_SECURITY is not set
732CONFIG_JBD=y
733# CONFIG_JBD_DEBUG is not set
734CONFIG_FS_MBCACHE=y
735# CONFIG_REISERFS_FS is not set
736# CONFIG_JFS_FS is not set
737# CONFIG_FS_POSIX_ACL is not set
738# CONFIG_XFS_FS is not set
739# CONFIG_OCFS2_FS is not set
740# CONFIG_MINIX_FS is not set
741# CONFIG_ROMFS_FS is not set
742CONFIG_INOTIFY=y
743# CONFIG_QUOTA is not set
744CONFIG_DNOTIFY=y
745# CONFIG_AUTOFS_FS is not set
746# CONFIG_AUTOFS4_FS is not set
747# CONFIG_FUSE_FS is not set
748
749#
750# CD-ROM/DVD Filesystems
751#
752# CONFIG_ISO9660_FS is not set
753# CONFIG_UDF_FS is not set
754
755#
756# DOS/FAT/NT Filesystems
757#
758# CONFIG_MSDOS_FS is not set
759# CONFIG_VFAT_FS is not set
760# CONFIG_NTFS_FS is not set
761
762#
763# Pseudo filesystems
764#
765CONFIG_PROC_FS=y
766CONFIG_PROC_KCORE=y
767CONFIG_SYSFS=y
768CONFIG_TMPFS=y
769# CONFIG_HUGETLB_PAGE is not set
770CONFIG_RAMFS=y
771# CONFIG_RELAYFS_FS is not set
772# CONFIG_CONFIGFS_FS is not set
773
774#
775# Miscellaneous filesystems
776#
777# CONFIG_ADFS_FS is not set
778# CONFIG_AFFS_FS is not set
779# CONFIG_HFS_FS is not set
780# CONFIG_HFSPLUS_FS is not set
781# CONFIG_BEFS_FS is not set
782# CONFIG_BFS_FS is not set
783# CONFIG_EFS_FS is not set
784# CONFIG_CRAMFS is not set
785# CONFIG_VXFS_FS is not set
786# CONFIG_HPFS_FS is not set
787# CONFIG_QNX4FS_FS is not set
788# CONFIG_SYSV_FS is not set
789# CONFIG_UFS_FS is not set
790
791#
792# Network File Systems
793#
794CONFIG_NFS_FS=y
795CONFIG_NFS_V3=y
796# CONFIG_NFS_V3_ACL is not set
797CONFIG_NFS_V4=y
798# CONFIG_NFS_DIRECTIO is not set
799# CONFIG_NFSD is not set
800CONFIG_ROOT_NFS=y
801CONFIG_LOCKD=y
802CONFIG_LOCKD_V4=y
803CONFIG_NFS_COMMON=y
804CONFIG_SUNRPC=y
805CONFIG_SUNRPC_GSS=y
806CONFIG_RPCSEC_GSS_KRB5=y
807# CONFIG_RPCSEC_GSS_SPKM3 is not set
808# CONFIG_SMB_FS is not set
809# CONFIG_CIFS is not set
810# CONFIG_NCP_FS is not set
811# CONFIG_CODA_FS is not set
812# CONFIG_AFS_FS is not set
813# CONFIG_9P_FS is not set
814
815#
816# Partition Types
817#
818CONFIG_PARTITION_ADVANCED=y
819# CONFIG_ACORN_PARTITION is not set
820# CONFIG_OSF_PARTITION is not set
821# CONFIG_AMIGA_PARTITION is not set
822# CONFIG_ATARI_PARTITION is not set
823# CONFIG_MAC_PARTITION is not set
824# CONFIG_MSDOS_PARTITION is not set
825# CONFIG_LDM_PARTITION is not set
826# CONFIG_SGI_PARTITION is not set
827# CONFIG_ULTRIX_PARTITION is not set
828# CONFIG_SUN_PARTITION is not set
829# CONFIG_EFI_PARTITION is not set
830
831#
832# Native Language Support
833#
834# CONFIG_NLS is not set
835
836#
837# Library routines
838#
839# CONFIG_CRC_CCITT is not set
840# CONFIG_CRC16 is not set
841CONFIG_CRC32=y
842# CONFIG_LIBCRC32C is not set
843
844#
845# Instrumentation Support
846#
847# CONFIG_PROFILING is not set
848
849#
850# Kernel hacking
851#
852# CONFIG_PRINTK_TIME is not set
853# CONFIG_MAGIC_SYSRQ is not set
854# CONFIG_DEBUG_KERNEL is not set
855CONFIG_LOG_BUF_SHIFT=14
856# CONFIG_BOOTX_TEXT is not set
857# CONFIG_SERIAL_TEXT_DEBUG is not set
858# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
859# CONFIG_PPC_EARLY_DEBUG_G5 is not set
860# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
861# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
862# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
863
864#
865# Security options
866#
867# CONFIG_KEYS is not set
868# CONFIG_SECURITY is not set
869
870#
871# Cryptographic options
872#
873CONFIG_CRYPTO=y
874# CONFIG_CRYPTO_HMAC is not set
875# CONFIG_CRYPTO_NULL is not set
876# CONFIG_CRYPTO_MD4 is not set
877CONFIG_CRYPTO_MD5=y
878# CONFIG_CRYPTO_SHA1 is not set
879# CONFIG_CRYPTO_SHA256 is not set
880# CONFIG_CRYPTO_SHA512 is not set
881# CONFIG_CRYPTO_WP512 is not set
882# CONFIG_CRYPTO_TGR192 is not set
883CONFIG_CRYPTO_DES=y
884# CONFIG_CRYPTO_BLOWFISH is not set
885# CONFIG_CRYPTO_TWOFISH is not set
886# CONFIG_CRYPTO_SERPENT is not set
887# CONFIG_CRYPTO_AES is not set
888# CONFIG_CRYPTO_CAST5 is not set
889# CONFIG_CRYPTO_CAST6 is not set
890# CONFIG_CRYPTO_TEA is not set
891# CONFIG_CRYPTO_ARC4 is not set
892# CONFIG_CRYPTO_KHAZAD is not set
893# CONFIG_CRYPTO_ANUBIS is not set
894# CONFIG_CRYPTO_DEFLATE is not set
895# CONFIG_CRYPTO_MICHAEL_MIC is not set
896# CONFIG_CRYPTO_CRC32C is not set
897# CONFIG_CRYPTO_TEST is not set
898
899#
900# Hardware crypto devices
901#
902
903#
904# SEC2.x Options
905#
906CONFIG_MPC8349E_SEC2x=y
907
908#
909# SEC2.x Test Options
910#
911CONFIG_MPC8349E_SEC2xTEST=y
diff --git a/arch/powerpc/configs/pmac32_defconfig b/arch/powerpc/configs/pmac32_defconfig
new file mode 100644
index 000000000000..2ace57d1e333
--- /dev/null
+++ b/arch/powerpc/configs/pmac32_defconfig
@@ -0,0 +1,1744 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15
4# Sat Jan 14 16:26:08 2006
5#
6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y
8CONFIG_PPC_MERGE=y
9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_PPC=y
14CONFIG_EARLY_PRINTK=y
15CONFIG_GENERIC_NVRAM=y
16CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
17CONFIG_ARCH_MAY_HAVE_PC_FDC=y
18CONFIG_PPC_OF=y
19# CONFIG_PPC_UDBG_16550 is not set
20# CONFIG_CRASH_DUMP is not set
21# CONFIG_GENERIC_TBSYNC is not set
22
23#
24# Processor support
25#
26CONFIG_CLASSIC32=y
27# CONFIG_PPC_52xx is not set
28# CONFIG_PPC_82xx is not set
29# CONFIG_PPC_83xx is not set
30# CONFIG_40x is not set
31# CONFIG_44x is not set
32# CONFIG_8xx is not set
33# CONFIG_E200 is not set
34# CONFIG_E500 is not set
35CONFIG_6xx=y
36CONFIG_PPC_FPU=y
37CONFIG_ALTIVEC=y
38CONFIG_PPC_STD_MMU=y
39CONFIG_PPC_STD_MMU_32=y
40# CONFIG_SMP is not set
41
42#
43# Code maturity level options
44#
45CONFIG_EXPERIMENTAL=y
46CONFIG_CLEAN_COMPILE=y
47CONFIG_BROKEN_ON_SMP=y
48CONFIG_INIT_ENV_ARG_LIMIT=32
49
50#
51# General setup
52#
53CONFIG_LOCALVERSION=""
54# CONFIG_LOCALVERSION_AUTO is not set
55CONFIG_SWAP=y
56CONFIG_SYSVIPC=y
57CONFIG_POSIX_MQUEUE=y
58# CONFIG_BSD_PROCESS_ACCT is not set
59CONFIG_SYSCTL=y
60# CONFIG_AUDIT is not set
61CONFIG_IKCONFIG=y
62CONFIG_IKCONFIG_PROC=y
63CONFIG_INITRAMFS_SOURCE=""
64# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
65# CONFIG_EMBEDDED is not set
66CONFIG_KALLSYMS=y
67# CONFIG_KALLSYMS_ALL is not set
68# CONFIG_KALLSYMS_EXTRA_PASS is not set
69CONFIG_HOTPLUG=y
70CONFIG_PRINTK=y
71CONFIG_BUG=y
72CONFIG_ELF_CORE=y
73CONFIG_BASE_FULL=y
74CONFIG_FUTEX=y
75CONFIG_EPOLL=y
76CONFIG_SHMEM=y
77CONFIG_CC_ALIGN_FUNCTIONS=0
78CONFIG_CC_ALIGN_LABELS=0
79CONFIG_CC_ALIGN_LOOPS=0
80CONFIG_CC_ALIGN_JUMPS=0
81CONFIG_SLAB=y
82# CONFIG_TINY_SHMEM is not set
83CONFIG_BASE_SMALL=0
84# CONFIG_SLOB is not set
85
86#
87# Loadable module support
88#
89CONFIG_MODULES=y
90CONFIG_MODULE_UNLOAD=y
91CONFIG_MODULE_FORCE_UNLOAD=y
92CONFIG_OBSOLETE_MODPARM=y
93# CONFIG_MODVERSIONS is not set
94# CONFIG_MODULE_SRCVERSION_ALL is not set
95CONFIG_KMOD=y
96
97#
98# Block layer
99#
100CONFIG_LBD=y
101
102#
103# IO Schedulers
104#
105CONFIG_IOSCHED_NOOP=y
106CONFIG_IOSCHED_AS=y
107CONFIG_IOSCHED_DEADLINE=y
108CONFIG_IOSCHED_CFQ=y
109CONFIG_DEFAULT_AS=y
110# CONFIG_DEFAULT_DEADLINE is not set
111# CONFIG_DEFAULT_CFQ is not set
112# CONFIG_DEFAULT_NOOP is not set
113CONFIG_DEFAULT_IOSCHED="anticipatory"
114
115#
116# Platform support
117#
118CONFIG_PPC_MULTIPLATFORM=y
119# CONFIG_PPC_ISERIES is not set
120# CONFIG_EMBEDDED6xx is not set
121# CONFIG_APUS is not set
122# CONFIG_PPC_CHRP is not set
123CONFIG_PPC_PMAC=y
124CONFIG_MPIC=y
125# CONFIG_PPC_RTAS is not set
126# CONFIG_MMIO_NVRAM is not set
127CONFIG_PPC_MPC106=y
128CONFIG_CPU_FREQ=y
129CONFIG_CPU_FREQ_TABLE=y
130# CONFIG_CPU_FREQ_DEBUG is not set
131CONFIG_CPU_FREQ_STAT=y
132# CONFIG_CPU_FREQ_STAT_DETAILS is not set
133CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
134# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
135CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
136CONFIG_CPU_FREQ_GOV_POWERSAVE=y
137CONFIG_CPU_FREQ_GOV_USERSPACE=y
138# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
139# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
140CONFIG_CPU_FREQ_PMAC=y
141CONFIG_PPC601_SYNC_FIX=y
142# CONFIG_TAU is not set
143# CONFIG_WANT_EARLY_SERIAL is not set
144
145#
146# Kernel options
147#
148# CONFIG_HIGHMEM is not set
149# CONFIG_HZ_100 is not set
150CONFIG_HZ_250=y
151# CONFIG_HZ_1000 is not set
152CONFIG_HZ=250
153CONFIG_PREEMPT_NONE=y
154# CONFIG_PREEMPT_VOLUNTARY is not set
155# CONFIG_PREEMPT is not set
156CONFIG_BINFMT_ELF=y
157CONFIG_BINFMT_MISC=m
158# CONFIG_KEXEC is not set
159CONFIG_ARCH_FLATMEM_ENABLE=y
160CONFIG_SELECT_MEMORY_MODEL=y
161CONFIG_FLATMEM_MANUAL=y
162# CONFIG_DISCONTIGMEM_MANUAL is not set
163# CONFIG_SPARSEMEM_MANUAL is not set
164CONFIG_FLATMEM=y
165CONFIG_FLAT_NODE_MEM_MAP=y
166# CONFIG_SPARSEMEM_STATIC is not set
167CONFIG_SPLIT_PTLOCK_CPUS=4
168CONFIG_PROC_DEVICETREE=y
169# CONFIG_CMDLINE_BOOL is not set
170CONFIG_PM=y
171# CONFIG_PM_LEGACY is not set
172CONFIG_PM_DEBUG=y
173CONFIG_SOFTWARE_SUSPEND=y
174CONFIG_PM_STD_PARTITION=""
175CONFIG_SECCOMP=y
176CONFIG_ISA_DMA_API=y
177
178#
179# Bus options
180#
181CONFIG_GENERIC_ISA_DMA=y
182# CONFIG_PPC_I8259 is not set
183CONFIG_PPC_INDIRECT_PCI=y
184CONFIG_PCI=y
185CONFIG_PCI_DOMAINS=y
186CONFIG_PCI_LEGACY_PROC=y
187# CONFIG_PCI_DEBUG is not set
188
189#
190# PCCARD (PCMCIA/CardBus) support
191#
192CONFIG_PCCARD=m
193# CONFIG_PCMCIA_DEBUG is not set
194CONFIG_PCMCIA=m
195CONFIG_PCMCIA_LOAD_CIS=y
196CONFIG_PCMCIA_IOCTL=y
197CONFIG_CARDBUS=y
198
199#
200# PC-card bridges
201#
202CONFIG_YENTA=m
203CONFIG_YENTA_O2=y
204CONFIG_YENTA_RICOH=y
205CONFIG_YENTA_TI=y
206CONFIG_YENTA_ENE_TUNE=y
207CONFIG_YENTA_TOSHIBA=y
208# CONFIG_PD6729 is not set
209# CONFIG_I82092 is not set
210CONFIG_PCCARD_NONSTATIC=m
211
212#
213# PCI Hotplug Support
214#
215# CONFIG_HOTPLUG_PCI is not set
216
217#
218# Advanced setup
219#
220# CONFIG_ADVANCED_OPTIONS is not set
221
222#
223# Default settings for advanced configuration options are used
224#
225CONFIG_HIGHMEM_START=0xfe000000
226CONFIG_LOWMEM_SIZE=0x30000000
227CONFIG_KERNEL_START=0xc0000000
228CONFIG_TASK_SIZE=0x80000000
229CONFIG_BOOT_LOAD=0x00800000
230
231#
232# Networking
233#
234CONFIG_NET=y
235
236#
237# Networking options
238#
239CONFIG_PACKET=y
240# CONFIG_PACKET_MMAP is not set
241CONFIG_UNIX=y
242# CONFIG_NET_KEY is not set
243CONFIG_INET=y
244CONFIG_IP_MULTICAST=y
245# CONFIG_IP_ADVANCED_ROUTER is not set
246CONFIG_IP_FIB_HASH=y
247# CONFIG_IP_PNP is not set
248# CONFIG_NET_IPIP is not set
249# CONFIG_NET_IPGRE is not set
250# CONFIG_IP_MROUTE is not set
251# CONFIG_ARPD is not set
252CONFIG_SYN_COOKIES=y
253# CONFIG_INET_AH is not set
254# CONFIG_INET_ESP is not set
255# CONFIG_INET_IPCOMP is not set
256# CONFIG_INET_TUNNEL is not set
257CONFIG_INET_DIAG=y
258CONFIG_INET_TCP_DIAG=y
259# CONFIG_TCP_CONG_ADVANCED is not set
260CONFIG_TCP_CONG_BIC=y
261
262#
263# IP: Virtual Server Configuration
264#
265# CONFIG_IP_VS is not set
266# CONFIG_IPV6 is not set
267CONFIG_NETFILTER=y
268# CONFIG_NETFILTER_DEBUG is not set
269
270#
271# Core Netfilter Configuration
272#
273# CONFIG_NETFILTER_NETLINK is not set
274
275#
276# IP: Netfilter Configuration
277#
278CONFIG_IP_NF_CONNTRACK=m
279# CONFIG_IP_NF_CT_ACCT is not set
280# CONFIG_IP_NF_CONNTRACK_MARK is not set
281# CONFIG_IP_NF_CONNTRACK_EVENTS is not set
282# CONFIG_IP_NF_CT_PROTO_SCTP is not set
283CONFIG_IP_NF_FTP=m
284CONFIG_IP_NF_IRC=m
285CONFIG_IP_NF_NETBIOS_NS=m
286CONFIG_IP_NF_TFTP=m
287CONFIG_IP_NF_AMANDA=m
288CONFIG_IP_NF_PPTP=m
289# CONFIG_IP_NF_QUEUE is not set
290CONFIG_IP_NF_IPTABLES=m
291CONFIG_IP_NF_MATCH_LIMIT=m
292CONFIG_IP_NF_MATCH_IPRANGE=m
293CONFIG_IP_NF_MATCH_MAC=m
294CONFIG_IP_NF_MATCH_PKTTYPE=m
295CONFIG_IP_NF_MATCH_MARK=m
296CONFIG_IP_NF_MATCH_MULTIPORT=m
297CONFIG_IP_NF_MATCH_TOS=m
298CONFIG_IP_NF_MATCH_RECENT=m
299CONFIG_IP_NF_MATCH_ECN=m
300CONFIG_IP_NF_MATCH_DSCP=m
301CONFIG_IP_NF_MATCH_AH_ESP=m
302CONFIG_IP_NF_MATCH_LENGTH=m
303CONFIG_IP_NF_MATCH_TTL=m
304CONFIG_IP_NF_MATCH_TCPMSS=m
305CONFIG_IP_NF_MATCH_HELPER=m
306CONFIG_IP_NF_MATCH_STATE=m
307CONFIG_IP_NF_MATCH_CONNTRACK=m
308CONFIG_IP_NF_MATCH_OWNER=m
309# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
310# CONFIG_IP_NF_MATCH_REALM is not set
311# CONFIG_IP_NF_MATCH_SCTP is not set
312CONFIG_IP_NF_MATCH_DCCP=m
313# CONFIG_IP_NF_MATCH_COMMENT is not set
314# CONFIG_IP_NF_MATCH_HASHLIMIT is not set
315CONFIG_IP_NF_MATCH_STRING=m
316CONFIG_IP_NF_FILTER=m
317CONFIG_IP_NF_TARGET_REJECT=m
318# CONFIG_IP_NF_TARGET_LOG is not set
319CONFIG_IP_NF_TARGET_ULOG=m
320CONFIG_IP_NF_TARGET_TCPMSS=m
321# CONFIG_IP_NF_TARGET_NFQUEUE is not set
322CONFIG_IP_NF_NAT=m
323CONFIG_IP_NF_NAT_NEEDED=y
324CONFIG_IP_NF_TARGET_MASQUERADE=m
325CONFIG_IP_NF_TARGET_REDIRECT=m
326CONFIG_IP_NF_TARGET_NETMAP=m
327CONFIG_IP_NF_TARGET_SAME=m
328CONFIG_IP_NF_NAT_SNMP_BASIC=m
329CONFIG_IP_NF_NAT_IRC=m
330CONFIG_IP_NF_NAT_FTP=m
331CONFIG_IP_NF_NAT_TFTP=m
332CONFIG_IP_NF_NAT_AMANDA=m
333CONFIG_IP_NF_NAT_PPTP=m
334# CONFIG_IP_NF_MANGLE is not set
335CONFIG_IP_NF_RAW=m
336CONFIG_IP_NF_TARGET_NOTRACK=m
337CONFIG_IP_NF_ARPTABLES=m
338CONFIG_IP_NF_ARPFILTER=m
339CONFIG_IP_NF_ARP_MANGLE=m
340
341#
342# DCCP Configuration (EXPERIMENTAL)
343#
344CONFIG_IP_DCCP=m
345CONFIG_INET_DCCP_DIAG=m
346
347#
348# DCCP CCIDs Configuration (EXPERIMENTAL)
349#
350CONFIG_IP_DCCP_CCID3=m
351CONFIG_IP_DCCP_TFRC_LIB=m
352
353#
354# DCCP Kernel Hacking
355#
356# CONFIG_IP_DCCP_DEBUG is not set
357# CONFIG_IP_DCCP_UNLOAD_HACK is not set
358
359#
360# SCTP Configuration (EXPERIMENTAL)
361#
362# CONFIG_IP_SCTP 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_NET_DIVERT is not set
373# CONFIG_ECONET is not set
374# CONFIG_WAN_ROUTER is not set
375
376#
377# QoS and/or fair queueing
378#
379# CONFIG_NET_SCHED is not set
380
381#
382# Network testing
383#
384# CONFIG_NET_PKTGEN is not set
385# CONFIG_HAMRADIO is not set
386CONFIG_IRDA=m
387
388#
389# IrDA protocols
390#
391CONFIG_IRLAN=m
392CONFIG_IRNET=m
393CONFIG_IRCOMM=m
394# CONFIG_IRDA_ULTRA is not set
395
396#
397# IrDA options
398#
399CONFIG_IRDA_CACHE_LAST_LSAP=y
400CONFIG_IRDA_FAST_RR=y
401# CONFIG_IRDA_DEBUG is not set
402
403#
404# Infrared-port device drivers
405#
406
407#
408# SIR device drivers
409#
410CONFIG_IRTTY_SIR=m
411
412#
413# Dongle support
414#
415# CONFIG_DONGLE is not set
416
417#
418# Old SIR device drivers
419#
420# CONFIG_IRPORT_SIR is not set
421
422#
423# Old Serial dongle support
424#
425
426#
427# FIR device drivers
428#
429# CONFIG_USB_IRDA is not set
430# CONFIG_SIGMATEL_FIR is not set
431# CONFIG_NSC_FIR is not set
432# CONFIG_WINBOND_FIR is not set
433# CONFIG_TOSHIBA_FIR is not set
434# CONFIG_SMC_IRCC_FIR is not set
435# CONFIG_ALI_FIR is not set
436# CONFIG_VLSI_FIR is not set
437# CONFIG_VIA_FIR is not set
438CONFIG_BT=m
439CONFIG_BT_L2CAP=m
440CONFIG_BT_SCO=m
441CONFIG_BT_RFCOMM=m
442CONFIG_BT_RFCOMM_TTY=y
443CONFIG_BT_BNEP=m
444CONFIG_BT_BNEP_MC_FILTER=y
445CONFIG_BT_BNEP_PROTO_FILTER=y
446CONFIG_BT_HIDP=m
447
448#
449# Bluetooth device drivers
450#
451CONFIG_BT_HCIUSB=m
452# CONFIG_BT_HCIUSB_SCO is not set
453# CONFIG_BT_HCIUART is not set
454CONFIG_BT_HCIBCM203X=m
455# CONFIG_BT_HCIBPA10X is not set
456CONFIG_BT_HCIBFUSB=m
457# CONFIG_BT_HCIDTL1 is not set
458# CONFIG_BT_HCIBT3C is not set
459# CONFIG_BT_HCIBLUECARD is not set
460# CONFIG_BT_HCIBTUART is not set
461# CONFIG_BT_HCIVHCI is not set
462CONFIG_IEEE80211=m
463# CONFIG_IEEE80211_DEBUG is not set
464CONFIG_IEEE80211_CRYPT_WEP=m
465CONFIG_IEEE80211_CRYPT_CCMP=m
466CONFIG_IEEE80211_CRYPT_TKIP=m
467
468#
469# Device Drivers
470#
471
472#
473# Generic Driver Options
474#
475# CONFIG_STANDALONE is not set
476CONFIG_PREVENT_FIRMWARE_BUILD=y
477CONFIG_FW_LOADER=y
478# CONFIG_DEBUG_DRIVER is not set
479
480#
481# Connector - unified userspace <-> kernelspace linker
482#
483CONFIG_CONNECTOR=y
484CONFIG_PROC_EVENTS=y
485
486#
487# Memory Technology Devices (MTD)
488#
489# CONFIG_MTD is not set
490
491#
492# Parallel port support
493#
494# CONFIG_PARPORT is not set
495
496#
497# Plug and Play support
498#
499
500#
501# Block devices
502#
503# CONFIG_BLK_DEV_FD is not set
504CONFIG_MAC_FLOPPY=m
505# CONFIG_BLK_CPQ_DA is not set
506# CONFIG_BLK_CPQ_CISS_DA is not set
507# CONFIG_BLK_DEV_DAC960 is not set
508# CONFIG_BLK_DEV_UMEM is not set
509# CONFIG_BLK_DEV_COW_COMMON is not set
510CONFIG_BLK_DEV_LOOP=y
511# CONFIG_BLK_DEV_CRYPTOLOOP is not set
512# CONFIG_BLK_DEV_NBD is not set
513# CONFIG_BLK_DEV_SX8 is not set
514CONFIG_BLK_DEV_UB=m
515CONFIG_BLK_DEV_RAM=y
516CONFIG_BLK_DEV_RAM_COUNT=16
517CONFIG_BLK_DEV_RAM_SIZE=4096
518CONFIG_BLK_DEV_INITRD=y
519# CONFIG_CDROM_PKTCDVD is not set
520# CONFIG_ATA_OVER_ETH is not set
521
522#
523# ATA/ATAPI/MFM/RLL support
524#
525CONFIG_IDE=y
526CONFIG_BLK_DEV_IDE=y
527
528#
529# Please see Documentation/ide.txt for help/info on IDE drives
530#
531# CONFIG_BLK_DEV_IDE_SATA is not set
532CONFIG_BLK_DEV_IDEDISK=y
533# CONFIG_IDEDISK_MULTI_MODE is not set
534CONFIG_BLK_DEV_IDECS=m
535CONFIG_BLK_DEV_IDECD=y
536# CONFIG_BLK_DEV_IDETAPE is not set
537CONFIG_BLK_DEV_IDEFLOPPY=y
538CONFIG_BLK_DEV_IDESCSI=y
539# CONFIG_IDE_TASK_IOCTL is not set
540
541#
542# IDE chipset support/bugfixes
543#
544# CONFIG_IDE_GENERIC is not set
545CONFIG_BLK_DEV_IDEPCI=y
546CONFIG_IDEPCI_SHARE_IRQ=y
547# CONFIG_BLK_DEV_OFFBOARD is not set
548CONFIG_BLK_DEV_GENERIC=y
549# CONFIG_BLK_DEV_OPTI621 is not set
550CONFIG_BLK_DEV_SL82C105=y
551CONFIG_BLK_DEV_IDEDMA_PCI=y
552# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
553CONFIG_IDEDMA_PCI_AUTO=y
554# CONFIG_IDEDMA_ONLYDISK is not set
555# CONFIG_BLK_DEV_AEC62XX is not set
556# CONFIG_BLK_DEV_ALI15X3 is not set
557# CONFIG_BLK_DEV_AMD74XX is not set
558# CONFIG_BLK_DEV_CMD64X is not set
559# CONFIG_BLK_DEV_TRIFLEX is not set
560# CONFIG_BLK_DEV_CY82C693 is not set
561# CONFIG_BLK_DEV_CS5520 is not set
562# CONFIG_BLK_DEV_CS5530 is not set
563# CONFIG_BLK_DEV_HPT34X is not set
564# CONFIG_BLK_DEV_HPT366 is not set
565# CONFIG_BLK_DEV_SC1200 is not set
566# CONFIG_BLK_DEV_PIIX is not set
567# CONFIG_BLK_DEV_IT821X is not set
568# CONFIG_BLK_DEV_NS87415 is not set
569# CONFIG_BLK_DEV_PDC202XX_OLD is not set
570CONFIG_BLK_DEV_PDC202XX_NEW=y
571# CONFIG_PDC202XX_FORCE is not set
572# CONFIG_BLK_DEV_SVWKS is not set
573# CONFIG_BLK_DEV_SIIMAGE is not set
574# CONFIG_BLK_DEV_SLC90E66 is not set
575# CONFIG_BLK_DEV_TRM290 is not set
576# CONFIG_BLK_DEV_VIA82CXXX is not set
577CONFIG_BLK_DEV_IDE_PMAC=y
578CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
579CONFIG_BLK_DEV_IDEDMA_PMAC=y
580CONFIG_BLK_DEV_IDE_PMAC_BLINK=y
581# CONFIG_IDE_ARM is not set
582CONFIG_BLK_DEV_IDEDMA=y
583# CONFIG_IDEDMA_IVB is not set
584CONFIG_IDEDMA_AUTO=y
585# CONFIG_BLK_DEV_HD is not set
586
587#
588# SCSI device support
589#
590# CONFIG_RAID_ATTRS is not set
591CONFIG_SCSI=y
592CONFIG_SCSI_PROC_FS=y
593
594#
595# SCSI support type (disk, tape, CD-ROM)
596#
597CONFIG_BLK_DEV_SD=y
598CONFIG_CHR_DEV_ST=y
599# CONFIG_CHR_DEV_OSST is not set
600CONFIG_BLK_DEV_SR=y
601CONFIG_BLK_DEV_SR_VENDOR=y
602CONFIG_CHR_DEV_SG=y
603# CONFIG_CHR_DEV_SCH is not set
604
605#
606# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
607#
608# CONFIG_SCSI_MULTI_LUN is not set
609CONFIG_SCSI_CONSTANTS=y
610# CONFIG_SCSI_LOGGING is not set
611
612#
613# SCSI Transport Attributes
614#
615CONFIG_SCSI_SPI_ATTRS=y
616CONFIG_SCSI_FC_ATTRS=y
617# CONFIG_SCSI_ISCSI_ATTRS is not set
618# CONFIG_SCSI_SAS_ATTRS is not set
619
620#
621# SCSI low-level drivers
622#
623# CONFIG_ISCSI_TCP is not set
624# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
625# CONFIG_SCSI_3W_9XXX is not set
626# CONFIG_SCSI_ACARD is not set
627# CONFIG_SCSI_AACRAID is not set
628CONFIG_SCSI_AIC7XXX=m
629CONFIG_AIC7XXX_CMDS_PER_DEVICE=253
630CONFIG_AIC7XXX_RESET_DELAY_MS=15000
631CONFIG_AIC7XXX_DEBUG_ENABLE=y
632CONFIG_AIC7XXX_DEBUG_MASK=0
633CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
634CONFIG_SCSI_AIC7XXX_OLD=m
635# CONFIG_SCSI_AIC79XX is not set
636# CONFIG_SCSI_DPT_I2O is not set
637# CONFIG_MEGARAID_NEWGEN is not set
638# CONFIG_MEGARAID_LEGACY is not set
639# CONFIG_MEGARAID_SAS is not set
640# CONFIG_SCSI_SATA is not set
641# CONFIG_SCSI_BUSLOGIC is not set
642# CONFIG_SCSI_DMX3191D is not set
643# CONFIG_SCSI_EATA is not set
644# CONFIG_SCSI_FUTURE_DOMAIN is not set
645# CONFIG_SCSI_GDTH is not set
646# CONFIG_SCSI_IPS is not set
647# CONFIG_SCSI_INITIO is not set
648# CONFIG_SCSI_INIA100 is not set
649CONFIG_SCSI_SYM53C8XX_2=y
650CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
651CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
652CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
653# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
654# CONFIG_SCSI_IPR is not set
655# CONFIG_SCSI_QLOGIC_FC is not set
656# CONFIG_SCSI_QLOGIC_1280 is not set
657CONFIG_SCSI_QLA2XXX=y
658# CONFIG_SCSI_QLA2XXX_EMBEDDED_FIRMWARE is not set
659# CONFIG_SCSI_LPFC is not set
660# CONFIG_SCSI_DC395x is not set
661# CONFIG_SCSI_DC390T is not set
662# CONFIG_SCSI_NSP32 is not set
663# CONFIG_SCSI_DEBUG is not set
664CONFIG_SCSI_MESH=y
665CONFIG_SCSI_MESH_SYNC_RATE=5
666CONFIG_SCSI_MESH_RESET_DELAY_MS=4000
667CONFIG_SCSI_MAC53C94=y
668
669#
670# PCMCIA SCSI adapter support
671#
672# CONFIG_PCMCIA_AHA152X is not set
673# CONFIG_PCMCIA_FDOMAIN is not set
674# CONFIG_PCMCIA_NINJA_SCSI is not set
675# CONFIG_PCMCIA_QLOGIC is not set
676# CONFIG_PCMCIA_SYM53C500 is not set
677
678#
679# Multi-device support (RAID and LVM)
680#
681CONFIG_MD=y
682CONFIG_BLK_DEV_MD=m
683CONFIG_MD_LINEAR=m
684CONFIG_MD_RAID0=m
685CONFIG_MD_RAID1=m
686# CONFIG_MD_RAID10 is not set
687CONFIG_MD_RAID5=m
688CONFIG_MD_RAID6=m
689CONFIG_MD_MULTIPATH=m
690CONFIG_MD_FAULTY=m
691CONFIG_BLK_DEV_DM=m
692CONFIG_DM_CRYPT=m
693# CONFIG_DM_SNAPSHOT is not set
694# CONFIG_DM_MIRROR is not set
695# CONFIG_DM_ZERO is not set
696# CONFIG_DM_MULTIPATH is not set
697
698#
699# Fusion MPT device support
700#
701# CONFIG_FUSION is not set
702# CONFIG_FUSION_SPI is not set
703# CONFIG_FUSION_FC is not set
704# CONFIG_FUSION_SAS is not set
705
706#
707# IEEE 1394 (FireWire) support
708#
709CONFIG_IEEE1394=m
710
711#
712# Subsystem Options
713#
714# CONFIG_IEEE1394_VERBOSEDEBUG is not set
715# CONFIG_IEEE1394_OUI_DB is not set
716CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
717CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
718# CONFIG_IEEE1394_EXPORT_FULL_API is not set
719
720#
721# Device Drivers
722#
723# CONFIG_IEEE1394_PCILYNX is not set
724CONFIG_IEEE1394_OHCI1394=m
725
726#
727# Protocol Drivers
728#
729CONFIG_IEEE1394_VIDEO1394=m
730CONFIG_IEEE1394_SBP2=m
731# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
732CONFIG_IEEE1394_ETH1394=m
733CONFIG_IEEE1394_DV1394=m
734CONFIG_IEEE1394_RAWIO=m
735
736#
737# I2O device support
738#
739# CONFIG_I2O is not set
740
741#
742# Macintosh device drivers
743#
744CONFIG_ADB=y
745CONFIG_ADB_CUDA=y
746CONFIG_ADB_PMU=y
747CONFIG_PMAC_APM_EMU=m
748CONFIG_PMAC_MEDIABAY=y
749CONFIG_PMAC_BACKLIGHT=y
750CONFIG_INPUT_ADBHID=y
751CONFIG_MAC_EMUMOUSEBTN=y
752CONFIG_THERM_WINDTUNNEL=m
753CONFIG_THERM_ADT746X=m
754# CONFIG_WINDFARM is not set
755# CONFIG_ANSLCD is not set
756
757#
758# Network device support
759#
760CONFIG_NETDEVICES=y
761# CONFIG_DUMMY is not set
762# CONFIG_BONDING is not set
763# CONFIG_EQUALIZER is not set
764# CONFIG_TUN is not set
765
766#
767# ARCnet devices
768#
769# CONFIG_ARCNET is not set
770
771#
772# PHY device support
773#
774# CONFIG_PHYLIB is not set
775
776#
777# Ethernet (10 or 100Mbit)
778#
779CONFIG_NET_ETHERNET=y
780CONFIG_MII=y
781CONFIG_MACE=y
782# CONFIG_MACE_AAUI_PORT is not set
783CONFIG_BMAC=y
784# CONFIG_HAPPYMEAL is not set
785CONFIG_SUNGEM=y
786# CONFIG_CASSINI is not set
787# CONFIG_NET_VENDOR_3COM is not set
788
789#
790# Tulip family network device support
791#
792# CONFIG_NET_TULIP is not set
793# CONFIG_HP100 is not set
794CONFIG_NET_PCI=y
795CONFIG_PCNET32=y
796# CONFIG_AMD8111_ETH is not set
797# CONFIG_ADAPTEC_STARFIRE is not set
798# CONFIG_B44 is not set
799# CONFIG_FORCEDETH is not set
800# CONFIG_DGRS is not set
801# CONFIG_EEPRO100 is not set
802# CONFIG_E100 is not set
803# CONFIG_FEALNX is not set
804# CONFIG_NATSEMI is not set
805# CONFIG_NE2K_PCI is not set
806# CONFIG_8139CP is not set
807# CONFIG_8139TOO is not set
808# CONFIG_SIS900 is not set
809# CONFIG_EPIC100 is not set
810# CONFIG_SUNDANCE is not set
811# CONFIG_TLAN is not set
812# CONFIG_VIA_RHINE is not set
813
814#
815# Ethernet (1000 Mbit)
816#
817# CONFIG_ACENIC is not set
818# CONFIG_DL2K is not set
819# CONFIG_E1000 is not set
820# CONFIG_NS83820 is not set
821# CONFIG_HAMACHI is not set
822# CONFIG_YELLOWFIN is not set
823# CONFIG_R8169 is not set
824# CONFIG_SIS190 is not set
825# CONFIG_SKGE is not set
826# CONFIG_SKY2 is not set
827# CONFIG_SK98LIN is not set
828# CONFIG_VIA_VELOCITY is not set
829# CONFIG_TIGON3 is not set
830# CONFIG_BNX2 is not set
831# CONFIG_MV643XX_ETH is not set
832
833#
834# Ethernet (10000 Mbit)
835#
836# CONFIG_CHELSIO_T1 is not set
837# CONFIG_IXGB is not set
838# CONFIG_S2IO is not set
839
840#
841# Token Ring devices
842#
843# CONFIG_TR is not set
844
845#
846# Wireless LAN (non-hamradio)
847#
848CONFIG_NET_RADIO=y
849
850#
851# Obsolete Wireless cards support (pre-802.11)
852#
853# CONFIG_STRIP is not set
854# CONFIG_PCMCIA_WAVELAN is not set
855# CONFIG_PCMCIA_NETWAVE is not set
856
857#
858# Wireless 802.11 Frequency Hopping cards support
859#
860# CONFIG_PCMCIA_RAYCS is not set
861
862#
863# Wireless 802.11b ISA/PCI cards support
864#
865# CONFIG_IPW2100 is not set
866# CONFIG_IPW2200 is not set
867# CONFIG_AIRO is not set
868CONFIG_HERMES=m
869CONFIG_APPLE_AIRPORT=m
870# CONFIG_PLX_HERMES is not set
871# CONFIG_TMD_HERMES is not set
872# CONFIG_NORTEL_HERMES is not set
873# CONFIG_PCI_HERMES is not set
874# CONFIG_ATMEL is not set
875
876#
877# Wireless 802.11b Pcmcia/Cardbus cards support
878#
879# CONFIG_PCMCIA_HERMES is not set
880# CONFIG_PCMCIA_SPECTRUM is not set
881# CONFIG_AIRO_CS is not set
882# CONFIG_PCMCIA_WL3501 is not set
883
884#
885# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
886#
887CONFIG_PRISM54=m
888# CONFIG_HOSTAP is not set
889CONFIG_NET_WIRELESS=y
890
891#
892# PCMCIA network device support
893#
894# CONFIG_NET_PCMCIA is not set
895
896#
897# Wan interfaces
898#
899# CONFIG_WAN is not set
900# CONFIG_FDDI is not set
901# CONFIG_HIPPI is not set
902CONFIG_PPP=y
903CONFIG_PPP_MULTILINK=y
904# CONFIG_PPP_FILTER is not set
905CONFIG_PPP_ASYNC=y
906CONFIG_PPP_SYNC_TTY=m
907CONFIG_PPP_DEFLATE=y
908CONFIG_PPP_BSDCOMP=m
909# CONFIG_PPP_MPPE is not set
910# CONFIG_PPPOE is not set
911# CONFIG_SLIP is not set
912# CONFIG_NET_FC is not set
913# CONFIG_SHAPER is not set
914# CONFIG_NETCONSOLE is not set
915# CONFIG_NETPOLL is not set
916# CONFIG_NET_POLL_CONTROLLER is not set
917
918#
919# ISDN subsystem
920#
921# CONFIG_ISDN is not set
922
923#
924# Telephony Support
925#
926# CONFIG_PHONE is not set
927
928#
929# Input device support
930#
931CONFIG_INPUT=y
932
933#
934# Userland interfaces
935#
936CONFIG_INPUT_MOUSEDEV=y
937CONFIG_INPUT_MOUSEDEV_PSAUX=y
938CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
939CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
940# CONFIG_INPUT_JOYDEV is not set
941# CONFIG_INPUT_TSDEV is not set
942CONFIG_INPUT_EVDEV=y
943# CONFIG_INPUT_EVBUG is not set
944
945#
946# Input Device Drivers
947#
948CONFIG_INPUT_KEYBOARD=y
949# CONFIG_KEYBOARD_ATKBD is not set
950# CONFIG_KEYBOARD_SUNKBD is not set
951# CONFIG_KEYBOARD_LKKBD is not set
952# CONFIG_KEYBOARD_XTKBD is not set
953# CONFIG_KEYBOARD_NEWTON is not set
954CONFIG_INPUT_MOUSE=y
955# CONFIG_MOUSE_PS2 is not set
956# CONFIG_MOUSE_SERIAL is not set
957# CONFIG_MOUSE_VSXXXAA is not set
958# CONFIG_INPUT_JOYSTICK is not set
959# CONFIG_INPUT_TOUCHSCREEN is not set
960# CONFIG_INPUT_MISC is not set
961
962#
963# Hardware I/O ports
964#
965CONFIG_SERIO=y
966# CONFIG_SERIO_I8042 is not set
967# CONFIG_SERIO_SERPORT is not set
968# CONFIG_SERIO_PCIPS2 is not set
969# CONFIG_SERIO_RAW is not set
970# CONFIG_GAMEPORT is not set
971
972#
973# Character devices
974#
975CONFIG_VT=y
976CONFIG_VT_CONSOLE=y
977CONFIG_HW_CONSOLE=y
978# CONFIG_SERIAL_NONSTANDARD is not set
979
980#
981# Serial drivers
982#
983CONFIG_SERIAL_8250=m
984# CONFIG_SERIAL_8250_CS is not set
985CONFIG_SERIAL_8250_NR_UARTS=4
986CONFIG_SERIAL_8250_RUNTIME_UARTS=4
987# CONFIG_SERIAL_8250_EXTENDED is not set
988
989#
990# Non-8250 serial port support
991#
992CONFIG_SERIAL_CORE=m
993CONFIG_SERIAL_PMACZILOG=m
994CONFIG_UNIX98_PTYS=y
995CONFIG_LEGACY_PTYS=y
996CONFIG_LEGACY_PTY_COUNT=256
997
998#
999# IPMI
1000#
1001# CONFIG_IPMI_HANDLER is not set
1002
1003#
1004# Watchdog Cards
1005#
1006# CONFIG_WATCHDOG is not set
1007CONFIG_NVRAM=y
1008CONFIG_GEN_RTC=y
1009# CONFIG_GEN_RTC_X is not set
1010# CONFIG_DTLK is not set
1011# CONFIG_R3964 is not set
1012# CONFIG_APPLICOM is not set
1013
1014#
1015# Ftape, the floppy tape device driver
1016#
1017CONFIG_AGP=m
1018CONFIG_AGP_UNINORTH=m
1019CONFIG_DRM=m
1020# CONFIG_DRM_TDFX is not set
1021CONFIG_DRM_R128=m
1022CONFIG_DRM_RADEON=m
1023# CONFIG_DRM_MGA is not set
1024# CONFIG_DRM_SIS is not set
1025# CONFIG_DRM_VIA is not set
1026# CONFIG_DRM_SAVAGE is not set
1027
1028#
1029# PCMCIA character devices
1030#
1031# CONFIG_SYNCLINK_CS is not set
1032# CONFIG_CARDMAN_4000 is not set
1033# CONFIG_CARDMAN_4040 is not set
1034# CONFIG_RAW_DRIVER is not set
1035
1036#
1037# TPM devices
1038#
1039# CONFIG_TCG_TPM is not set
1040# CONFIG_TELCLOCK is not set
1041
1042#
1043# I2C support
1044#
1045CONFIG_I2C=y
1046CONFIG_I2C_CHARDEV=m
1047
1048#
1049# I2C Algorithms
1050#
1051CONFIG_I2C_ALGOBIT=y
1052# CONFIG_I2C_ALGOPCF is not set
1053# CONFIG_I2C_ALGOPCA is not set
1054
1055#
1056# I2C Hardware Bus support
1057#
1058# CONFIG_I2C_ALI1535 is not set
1059# CONFIG_I2C_ALI1563 is not set
1060# CONFIG_I2C_ALI15X3 is not set
1061# CONFIG_I2C_AMD756 is not set
1062# CONFIG_I2C_AMD8111 is not set
1063# CONFIG_I2C_I801 is not set
1064# CONFIG_I2C_I810 is not set
1065# CONFIG_I2C_PIIX4 is not set
1066CONFIG_I2C_POWERMAC=y
1067# CONFIG_I2C_MPC is not set
1068# CONFIG_I2C_NFORCE2 is not set
1069# CONFIG_I2C_PARPORT_LIGHT is not set
1070# CONFIG_I2C_PROSAVAGE is not set
1071# CONFIG_I2C_SAVAGE4 is not set
1072# CONFIG_SCx200_ACB is not set
1073# CONFIG_I2C_SIS5595 is not set
1074# CONFIG_I2C_SIS630 is not set
1075# CONFIG_I2C_SIS96X is not set
1076# CONFIG_I2C_STUB is not set
1077# CONFIG_I2C_VIA is not set
1078# CONFIG_I2C_VIAPRO is not set
1079# CONFIG_I2C_VOODOO3 is not set
1080# CONFIG_I2C_PCA_ISA is not set
1081
1082#
1083# Miscellaneous I2C Chip support
1084#
1085# CONFIG_SENSORS_DS1337 is not set
1086# CONFIG_SENSORS_DS1374 is not set
1087# CONFIG_SENSORS_EEPROM is not set
1088# CONFIG_SENSORS_PCF8574 is not set
1089# CONFIG_SENSORS_PCA9539 is not set
1090# CONFIG_SENSORS_PCF8591 is not set
1091# CONFIG_SENSORS_RTC8564 is not set
1092# CONFIG_SENSORS_M41T00 is not set
1093# CONFIG_SENSORS_MAX6875 is not set
1094# CONFIG_RTC_X1205_I2C is not set
1095# CONFIG_I2C_DEBUG_CORE is not set
1096# CONFIG_I2C_DEBUG_ALGO is not set
1097# CONFIG_I2C_DEBUG_BUS is not set
1098# CONFIG_I2C_DEBUG_CHIP is not set
1099
1100#
1101# Dallas's 1-wire bus
1102#
1103# CONFIG_W1 is not set
1104
1105#
1106# Hardware Monitoring support
1107#
1108# CONFIG_HWMON is not set
1109# CONFIG_HWMON_VID is not set
1110
1111#
1112# Misc devices
1113#
1114
1115#
1116# Multimedia Capabilities Port drivers
1117#
1118
1119#
1120# Multimedia devices
1121#
1122# CONFIG_VIDEO_DEV is not set
1123
1124#
1125# Digital Video Broadcasting Devices
1126#
1127# CONFIG_DVB is not set
1128
1129#
1130# Graphics support
1131#
1132CONFIG_FB=y
1133CONFIG_FB_CFB_FILLRECT=y
1134CONFIG_FB_CFB_COPYAREA=y
1135CONFIG_FB_CFB_IMAGEBLIT=y
1136CONFIG_FB_MACMODES=y
1137CONFIG_FB_MODE_HELPERS=y
1138CONFIG_FB_TILEBLITTING=y
1139# CONFIG_FB_CIRRUS is not set
1140# CONFIG_FB_PM2 is not set
1141# CONFIG_FB_CYBER2000 is not set
1142CONFIG_FB_OF=y
1143CONFIG_FB_CONTROL=y
1144CONFIG_FB_PLATINUM=y
1145CONFIG_FB_VALKYRIE=y
1146CONFIG_FB_CT65550=y
1147# CONFIG_FB_ASILIANT is not set
1148CONFIG_FB_IMSTT=y
1149# CONFIG_FB_VGA16 is not set
1150# CONFIG_FB_S1D13XXX is not set
1151CONFIG_FB_NVIDIA=y
1152CONFIG_FB_NVIDIA_I2C=y
1153# CONFIG_FB_RIVA is not set
1154CONFIG_FB_MATROX=y
1155CONFIG_FB_MATROX_MILLENIUM=y
1156CONFIG_FB_MATROX_MYSTIQUE=y
1157# CONFIG_FB_MATROX_G is not set
1158# CONFIG_FB_MATROX_I2C is not set
1159# CONFIG_FB_MATROX_MULTIHEAD is not set
1160# CONFIG_FB_RADEON_OLD is not set
1161CONFIG_FB_RADEON=y
1162CONFIG_FB_RADEON_I2C=y
1163# CONFIG_FB_RADEON_DEBUG is not set
1164CONFIG_FB_ATY128=y
1165CONFIG_FB_ATY=y
1166CONFIG_FB_ATY_CT=y
1167# CONFIG_FB_ATY_GENERIC_LCD is not set
1168CONFIG_FB_ATY_GX=y
1169# CONFIG_FB_SAVAGE is not set
1170# CONFIG_FB_SIS is not set
1171# CONFIG_FB_NEOMAGIC is not set
1172# CONFIG_FB_KYRO is not set
1173CONFIG_FB_3DFX=y
1174# CONFIG_FB_3DFX_ACCEL is not set
1175# CONFIG_FB_VOODOO1 is not set
1176# CONFIG_FB_TRIDENT is not set
1177# CONFIG_FB_VIRTUAL is not set
1178
1179#
1180# Console display driver support
1181#
1182# CONFIG_VGA_CONSOLE is not set
1183CONFIG_DUMMY_CONSOLE=y
1184CONFIG_FRAMEBUFFER_CONSOLE=y
1185# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
1186# CONFIG_FONTS is not set
1187CONFIG_FONT_8x8=y
1188CONFIG_FONT_8x16=y
1189
1190#
1191# Logo configuration
1192#
1193CONFIG_LOGO=y
1194CONFIG_LOGO_LINUX_MONO=y
1195CONFIG_LOGO_LINUX_VGA16=y
1196CONFIG_LOGO_LINUX_CLUT224=y
1197# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1198
1199#
1200# Sound
1201#
1202CONFIG_SOUND=m
1203CONFIG_DMASOUND_PMAC=m
1204CONFIG_DMASOUND=m
1205
1206#
1207# Advanced Linux Sound Architecture
1208#
1209CONFIG_SND=m
1210CONFIG_SND_TIMER=m
1211CONFIG_SND_PCM=m
1212CONFIG_SND_HWDEP=m
1213CONFIG_SND_RAWMIDI=m
1214CONFIG_SND_SEQUENCER=m
1215CONFIG_SND_SEQ_DUMMY=m
1216CONFIG_SND_OSSEMUL=y
1217CONFIG_SND_MIXER_OSS=m
1218CONFIG_SND_PCM_OSS=m
1219CONFIG_SND_SEQUENCER_OSS=y
1220# CONFIG_SND_DYNAMIC_MINORS is not set
1221CONFIG_SND_SUPPORT_OLD_API=y
1222# CONFIG_SND_VERBOSE_PRINTK is not set
1223# CONFIG_SND_DEBUG is not set
1224
1225#
1226# Generic devices
1227#
1228CONFIG_SND_DUMMY=m
1229# CONFIG_SND_VIRMIDI is not set
1230# CONFIG_SND_MTPAV is not set
1231# CONFIG_SND_SERIAL_U16550 is not set
1232# CONFIG_SND_MPU401 is not set
1233
1234#
1235# PCI devices
1236#
1237# CONFIG_SND_AD1889 is not set
1238# CONFIG_SND_ALS4000 is not set
1239# CONFIG_SND_ALI5451 is not set
1240# CONFIG_SND_ATIIXP is not set
1241# CONFIG_SND_ATIIXP_MODEM is not set
1242# CONFIG_SND_AU8810 is not set
1243# CONFIG_SND_AU8820 is not set
1244# CONFIG_SND_AU8830 is not set
1245# CONFIG_SND_AZT3328 is not set
1246# CONFIG_SND_BT87X is not set
1247# CONFIG_SND_CA0106 is not set
1248# CONFIG_SND_CMIPCI is not set
1249# CONFIG_SND_CS4281 is not set
1250# CONFIG_SND_CS46XX is not set
1251# CONFIG_SND_EMU10K1 is not set
1252# CONFIG_SND_EMU10K1X is not set
1253# CONFIG_SND_ENS1370 is not set
1254# CONFIG_SND_ENS1371 is not set
1255# CONFIG_SND_ES1938 is not set
1256# CONFIG_SND_ES1968 is not set
1257# CONFIG_SND_FM801 is not set
1258# CONFIG_SND_HDA_INTEL is not set
1259# CONFIG_SND_HDSP is not set
1260# CONFIG_SND_HDSPM is not set
1261# CONFIG_SND_ICE1712 is not set
1262# CONFIG_SND_ICE1724 is not set
1263# CONFIG_SND_INTEL8X0 is not set
1264# CONFIG_SND_INTEL8X0M is not set
1265# CONFIG_SND_KORG1212 is not set
1266# CONFIG_SND_MAESTRO3 is not set
1267# CONFIG_SND_MIXART is not set
1268# CONFIG_SND_NM256 is not set
1269# CONFIG_SND_PCXHR is not set
1270# CONFIG_SND_RME32 is not set
1271# CONFIG_SND_RME96 is not set
1272# CONFIG_SND_RME9652 is not set
1273# CONFIG_SND_SONICVIBES is not set
1274# CONFIG_SND_TRIDENT is not set
1275# CONFIG_SND_VIA82XX is not set
1276# CONFIG_SND_VIA82XX_MODEM is not set
1277# CONFIG_SND_VX222 is not set
1278# CONFIG_SND_YMFPCI is not set
1279
1280#
1281# ALSA PowerMac devices
1282#
1283CONFIG_SND_POWERMAC=m
1284CONFIG_SND_POWERMAC_AUTO_DRC=y
1285
1286#
1287# USB devices
1288#
1289CONFIG_SND_USB_AUDIO=m
1290# CONFIG_SND_USB_USX2Y is not set
1291
1292#
1293# PCMCIA devices
1294#
1295
1296#
1297# Open Sound System
1298#
1299# CONFIG_SOUND_PRIME is not set
1300
1301#
1302# USB support
1303#
1304CONFIG_USB_ARCH_HAS_HCD=y
1305CONFIG_USB_ARCH_HAS_OHCI=y
1306CONFIG_USB=y
1307# CONFIG_USB_DEBUG is not set
1308
1309#
1310# Miscellaneous USB options
1311#
1312CONFIG_USB_DEVICEFS=y
1313# CONFIG_USB_BANDWIDTH is not set
1314CONFIG_USB_DYNAMIC_MINORS=y
1315# CONFIG_USB_SUSPEND is not set
1316# CONFIG_USB_OTG is not set
1317
1318#
1319# USB Host Controller Drivers
1320#
1321# CONFIG_USB_EHCI_HCD is not set
1322# CONFIG_USB_ISP116X_HCD is not set
1323CONFIG_USB_OHCI_HCD=y
1324# CONFIG_USB_OHCI_BIG_ENDIAN is not set
1325CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1326# CONFIG_USB_UHCI_HCD is not set
1327# CONFIG_USB_SL811_HCD is not set
1328
1329#
1330# USB Device Class drivers
1331#
1332# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
1333CONFIG_USB_ACM=m
1334CONFIG_USB_PRINTER=m
1335
1336#
1337# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1338#
1339
1340#
1341# may also be needed; see USB_STORAGE Help for more information
1342#
1343# CONFIG_USB_STORAGE is not set
1344# CONFIG_USB_LIBUSUAL is not set
1345
1346#
1347# USB Input Devices
1348#
1349CONFIG_USB_HID=y
1350CONFIG_USB_HIDINPUT=y
1351# CONFIG_HID_FF is not set
1352# CONFIG_USB_HIDDEV is not set
1353# CONFIG_USB_AIPTEK is not set
1354# CONFIG_USB_WACOM is not set
1355# CONFIG_USB_ACECAD is not set
1356# CONFIG_USB_KBTAB is not set
1357# CONFIG_USB_POWERMATE is not set
1358# CONFIG_USB_MTOUCH is not set
1359# CONFIG_USB_ITMTOUCH is not set
1360# CONFIG_USB_EGALAX is not set
1361# CONFIG_USB_YEALINK is not set
1362# CONFIG_USB_XPAD is not set
1363# CONFIG_USB_ATI_REMOTE is not set
1364# CONFIG_USB_ATI_REMOTE2 is not set
1365# CONFIG_USB_KEYSPAN_REMOTE is not set
1366CONFIG_USB_APPLETOUCH=y
1367
1368#
1369# USB Imaging devices
1370#
1371# CONFIG_USB_MDC800 is not set
1372# CONFIG_USB_MICROTEK is not set
1373
1374#
1375# USB Multimedia devices
1376#
1377# CONFIG_USB_DABUSB is not set
1378
1379#
1380# Video4Linux support is needed for USB Multimedia device support
1381#
1382
1383#
1384# USB Network Adapters
1385#
1386# CONFIG_USB_CATC is not set
1387# CONFIG_USB_KAWETH is not set
1388# CONFIG_USB_PEGASUS is not set
1389# CONFIG_USB_RTL8150 is not set
1390CONFIG_USB_USBNET=m
1391CONFIG_USB_NET_AX8817X=m
1392CONFIG_USB_NET_CDCETHER=m
1393# CONFIG_USB_NET_GL620A is not set
1394CONFIG_USB_NET_NET1080=m
1395# CONFIG_USB_NET_PLUSB is not set
1396# CONFIG_USB_NET_RNDIS_HOST is not set
1397# CONFIG_USB_NET_CDC_SUBSET is not set
1398CONFIG_USB_NET_ZAURUS=m
1399# CONFIG_USB_ZD1201 is not set
1400CONFIG_USB_MON=y
1401
1402#
1403# USB port drivers
1404#
1405
1406#
1407# USB Serial Converter support
1408#
1409CONFIG_USB_SERIAL=m
1410# CONFIG_USB_SERIAL_GENERIC is not set
1411# CONFIG_USB_SERIAL_AIRPRIME is not set
1412# CONFIG_USB_SERIAL_ANYDATA is not set
1413# CONFIG_USB_SERIAL_BELKIN is not set
1414# CONFIG_USB_SERIAL_WHITEHEAT is not set
1415# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1416# CONFIG_USB_SERIAL_CP2101 is not set
1417# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1418# CONFIG_USB_SERIAL_EMPEG is not set
1419# CONFIG_USB_SERIAL_FTDI_SIO is not set
1420CONFIG_USB_SERIAL_VISOR=m
1421CONFIG_USB_SERIAL_IPAQ=m
1422# CONFIG_USB_SERIAL_IR is not set
1423# CONFIG_USB_SERIAL_EDGEPORT is not set
1424# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1425# CONFIG_USB_SERIAL_GARMIN is not set
1426# CONFIG_USB_SERIAL_IPW is not set
1427CONFIG_USB_SERIAL_KEYSPAN_PDA=m
1428CONFIG_USB_SERIAL_KEYSPAN=m
1429CONFIG_USB_SERIAL_KEYSPAN_MPR=y
1430CONFIG_USB_SERIAL_KEYSPAN_USA28=y
1431CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
1432CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
1433CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
1434CONFIG_USB_SERIAL_KEYSPAN_USA19=y
1435CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
1436CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
1437CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
1438CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
1439CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
1440CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1441# CONFIG_USB_SERIAL_KLSI is not set
1442# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1443# CONFIG_USB_SERIAL_MCT_U232 is not set
1444# CONFIG_USB_SERIAL_PL2303 is not set
1445# CONFIG_USB_SERIAL_HP4X is not set
1446# CONFIG_USB_SERIAL_SAFE is not set
1447# CONFIG_USB_SERIAL_TI is not set
1448# CONFIG_USB_SERIAL_CYBERJACK is not set
1449# CONFIG_USB_SERIAL_XIRCOM is not set
1450# CONFIG_USB_SERIAL_OPTION is not set
1451# CONFIG_USB_SERIAL_OMNINET is not set
1452CONFIG_USB_EZUSB=y
1453
1454#
1455# USB Miscellaneous drivers
1456#
1457# CONFIG_USB_EMI62 is not set
1458# CONFIG_USB_EMI26 is not set
1459# CONFIG_USB_AUERSWALD is not set
1460# CONFIG_USB_RIO500 is not set
1461# CONFIG_USB_LEGOTOWER is not set
1462# CONFIG_USB_LCD is not set
1463# CONFIG_USB_LED is not set
1464# CONFIG_USB_CYTHERM is not set
1465# CONFIG_USB_PHIDGETKIT is not set
1466# CONFIG_USB_PHIDGETSERVO is not set
1467# CONFIG_USB_IDMOUSE is not set
1468# CONFIG_USB_LD is not set
1469# CONFIG_USB_TEST is not set
1470
1471#
1472# USB DSL modem support
1473#
1474
1475#
1476# USB Gadget Support
1477#
1478# CONFIG_USB_GADGET is not set
1479
1480#
1481# MMC/SD Card support
1482#
1483# CONFIG_MMC is not set
1484
1485#
1486# InfiniBand support
1487#
1488# CONFIG_INFINIBAND is not set
1489
1490#
1491# SN Devices
1492#
1493
1494#
1495# File systems
1496#
1497CONFIG_EXT2_FS=y
1498# CONFIG_EXT2_FS_XATTR is not set
1499# CONFIG_EXT2_FS_XIP is not set
1500CONFIG_EXT3_FS=y
1501CONFIG_EXT3_FS_XATTR=y
1502# CONFIG_EXT3_FS_POSIX_ACL is not set
1503# CONFIG_EXT3_FS_SECURITY is not set
1504CONFIG_JBD=y
1505# CONFIG_JBD_DEBUG is not set
1506CONFIG_FS_MBCACHE=y
1507# CONFIG_REISERFS_FS is not set
1508# CONFIG_JFS_FS is not set
1509# CONFIG_FS_POSIX_ACL is not set
1510# CONFIG_XFS_FS is not set
1511# CONFIG_OCFS2_FS is not set
1512# CONFIG_MINIX_FS is not set
1513# CONFIG_ROMFS_FS is not set
1514CONFIG_INOTIFY=y
1515# CONFIG_QUOTA is not set
1516CONFIG_DNOTIFY=y
1517# CONFIG_AUTOFS_FS is not set
1518# CONFIG_AUTOFS4_FS is not set
1519CONFIG_FUSE_FS=m
1520
1521#
1522# CD-ROM/DVD Filesystems
1523#
1524CONFIG_ISO9660_FS=y
1525CONFIG_JOLIET=y
1526CONFIG_ZISOFS=y
1527CONFIG_ZISOFS_FS=y
1528CONFIG_UDF_FS=m
1529CONFIG_UDF_NLS=y
1530
1531#
1532# DOS/FAT/NT Filesystems
1533#
1534CONFIG_FAT_FS=m
1535CONFIG_MSDOS_FS=m
1536CONFIG_VFAT_FS=m
1537CONFIG_FAT_DEFAULT_CODEPAGE=437
1538CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1539# CONFIG_NTFS_FS is not set
1540
1541#
1542# Pseudo filesystems
1543#
1544CONFIG_PROC_FS=y
1545CONFIG_PROC_KCORE=y
1546CONFIG_SYSFS=y
1547CONFIG_TMPFS=y
1548# CONFIG_HUGETLB_PAGE is not set
1549CONFIG_RAMFS=y
1550CONFIG_RELAYFS_FS=m
1551# CONFIG_CONFIGFS_FS is not set
1552
1553#
1554# Miscellaneous filesystems
1555#
1556# CONFIG_ADFS_FS is not set
1557# CONFIG_AFFS_FS is not set
1558CONFIG_HFS_FS=m
1559CONFIG_HFSPLUS_FS=m
1560# CONFIG_BEFS_FS is not set
1561# CONFIG_BFS_FS is not set
1562# CONFIG_EFS_FS is not set
1563# CONFIG_CRAMFS is not set
1564# CONFIG_VXFS_FS is not set
1565# CONFIG_HPFS_FS is not set
1566# CONFIG_QNX4FS_FS is not set
1567# CONFIG_SYSV_FS is not set
1568# CONFIG_UFS_FS is not set
1569
1570#
1571# Network File Systems
1572#
1573CONFIG_NFS_FS=y
1574# CONFIG_NFS_V3 is not set
1575# CONFIG_NFS_V4 is not set
1576# CONFIG_NFS_DIRECTIO is not set
1577CONFIG_NFSD=y
1578# CONFIG_NFSD_V3 is not set
1579# CONFIG_NFSD_TCP is not set
1580CONFIG_LOCKD=y
1581CONFIG_EXPORTFS=y
1582CONFIG_NFS_COMMON=y
1583CONFIG_SUNRPC=y
1584# CONFIG_RPCSEC_GSS_KRB5 is not set
1585# CONFIG_RPCSEC_GSS_SPKM3 is not set
1586CONFIG_SMB_FS=m
1587# CONFIG_SMB_NLS_DEFAULT is not set
1588# CONFIG_CIFS is not set
1589# CONFIG_NCP_FS is not set
1590# CONFIG_CODA_FS is not set
1591# CONFIG_AFS_FS is not set
1592# CONFIG_9P_FS is not set
1593
1594#
1595# Partition Types
1596#
1597CONFIG_PARTITION_ADVANCED=y
1598# CONFIG_ACORN_PARTITION is not set
1599# CONFIG_OSF_PARTITION is not set
1600# CONFIG_AMIGA_PARTITION is not set
1601# CONFIG_ATARI_PARTITION is not set
1602CONFIG_MAC_PARTITION=y
1603CONFIG_MSDOS_PARTITION=y
1604# CONFIG_BSD_DISKLABEL is not set
1605# CONFIG_MINIX_SUBPARTITION is not set
1606# CONFIG_SOLARIS_X86_PARTITION is not set
1607# CONFIG_UNIXWARE_DISKLABEL is not set
1608# CONFIG_LDM_PARTITION is not set
1609# CONFIG_SGI_PARTITION is not set
1610# CONFIG_ULTRIX_PARTITION is not set
1611# CONFIG_SUN_PARTITION is not set
1612# CONFIG_EFI_PARTITION is not set
1613
1614#
1615# Native Language Support
1616#
1617CONFIG_NLS=y
1618CONFIG_NLS_DEFAULT="iso8859-1"
1619CONFIG_NLS_CODEPAGE_437=m
1620# CONFIG_NLS_CODEPAGE_737 is not set
1621# CONFIG_NLS_CODEPAGE_775 is not set
1622# CONFIG_NLS_CODEPAGE_850 is not set
1623# CONFIG_NLS_CODEPAGE_852 is not set
1624# CONFIG_NLS_CODEPAGE_855 is not set
1625# CONFIG_NLS_CODEPAGE_857 is not set
1626# CONFIG_NLS_CODEPAGE_860 is not set
1627# CONFIG_NLS_CODEPAGE_861 is not set
1628# CONFIG_NLS_CODEPAGE_862 is not set
1629# CONFIG_NLS_CODEPAGE_863 is not set
1630# CONFIG_NLS_CODEPAGE_864 is not set
1631# CONFIG_NLS_CODEPAGE_865 is not set
1632# CONFIG_NLS_CODEPAGE_866 is not set
1633# CONFIG_NLS_CODEPAGE_869 is not set
1634# CONFIG_NLS_CODEPAGE_936 is not set
1635# CONFIG_NLS_CODEPAGE_950 is not set
1636# CONFIG_NLS_CODEPAGE_932 is not set
1637# CONFIG_NLS_CODEPAGE_949 is not set
1638# CONFIG_NLS_CODEPAGE_874 is not set
1639# CONFIG_NLS_ISO8859_8 is not set
1640# CONFIG_NLS_CODEPAGE_1250 is not set
1641# CONFIG_NLS_CODEPAGE_1251 is not set
1642# CONFIG_NLS_ASCII is not set
1643CONFIG_NLS_ISO8859_1=m
1644# CONFIG_NLS_ISO8859_2 is not set
1645# CONFIG_NLS_ISO8859_3 is not set
1646# CONFIG_NLS_ISO8859_4 is not set
1647# CONFIG_NLS_ISO8859_5 is not set
1648# CONFIG_NLS_ISO8859_6 is not set
1649# CONFIG_NLS_ISO8859_7 is not set
1650# CONFIG_NLS_ISO8859_9 is not set
1651# CONFIG_NLS_ISO8859_13 is not set
1652# CONFIG_NLS_ISO8859_14 is not set
1653# CONFIG_NLS_ISO8859_15 is not set
1654# CONFIG_NLS_KOI8_R is not set
1655# CONFIG_NLS_KOI8_U is not set
1656CONFIG_NLS_UTF8=m
1657
1658#
1659# Library routines
1660#
1661CONFIG_CRC_CCITT=y
1662CONFIG_CRC16=y
1663CONFIG_CRC32=y
1664# CONFIG_LIBCRC32C is not set
1665CONFIG_ZLIB_INFLATE=y
1666CONFIG_ZLIB_DEFLATE=y
1667CONFIG_TEXTSEARCH=y
1668CONFIG_TEXTSEARCH_KMP=m
1669CONFIG_TEXTSEARCH_BM=m
1670CONFIG_TEXTSEARCH_FSM=m
1671
1672#
1673# Instrumentation Support
1674#
1675CONFIG_PROFILING=y
1676CONFIG_OPROFILE=y
1677
1678#
1679# Kernel hacking
1680#
1681# CONFIG_PRINTK_TIME is not set
1682# CONFIG_MAGIC_SYSRQ is not set
1683CONFIG_DEBUG_KERNEL=y
1684CONFIG_LOG_BUF_SHIFT=14
1685CONFIG_DETECT_SOFTLOCKUP=y
1686# CONFIG_SCHEDSTATS is not set
1687# CONFIG_DEBUG_SLAB is not set
1688# CONFIG_DEBUG_MUTEXES is not set
1689# CONFIG_DEBUG_SPINLOCK is not set
1690# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1691# CONFIG_DEBUG_KOBJECT is not set
1692# CONFIG_DEBUG_INFO is not set
1693# CONFIG_DEBUG_FS is not set
1694# CONFIG_DEBUG_VM is not set
1695# CONFIG_RCU_TORTURE_TEST is not set
1696CONFIG_DEBUGGER=y
1697CONFIG_XMON=y
1698CONFIG_XMON_DEFAULT=y
1699# CONFIG_BDI_SWITCH is not set
1700CONFIG_BOOTX_TEXT=y
1701# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
1702# CONFIG_PPC_EARLY_DEBUG_G5 is not set
1703# CONFIG_PPC_EARLY_DEBUG_RTAS is not set
1704# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
1705# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
1706
1707#
1708# Security options
1709#
1710# CONFIG_KEYS is not set
1711# CONFIG_SECURITY is not set
1712
1713#
1714# Cryptographic options
1715#
1716CONFIG_CRYPTO=y
1717# CONFIG_CRYPTO_HMAC is not set
1718# CONFIG_CRYPTO_NULL is not set
1719# CONFIG_CRYPTO_MD4 is not set
1720# CONFIG_CRYPTO_MD5 is not set
1721# CONFIG_CRYPTO_SHA1 is not set
1722# CONFIG_CRYPTO_SHA256 is not set
1723# CONFIG_CRYPTO_SHA512 is not set
1724# CONFIG_CRYPTO_WP512 is not set
1725# CONFIG_CRYPTO_TGR192 is not set
1726# CONFIG_CRYPTO_DES is not set
1727# CONFIG_CRYPTO_BLOWFISH is not set
1728# CONFIG_CRYPTO_TWOFISH is not set
1729# CONFIG_CRYPTO_SERPENT is not set
1730CONFIG_CRYPTO_AES=m
1731# CONFIG_CRYPTO_CAST5 is not set
1732# CONFIG_CRYPTO_CAST6 is not set
1733# CONFIG_CRYPTO_TEA is not set
1734CONFIG_CRYPTO_ARC4=m
1735# CONFIG_CRYPTO_KHAZAD is not set
1736# CONFIG_CRYPTO_ANUBIS is not set
1737# CONFIG_CRYPTO_DEFLATE is not set
1738CONFIG_CRYPTO_MICHAEL_MIC=m
1739# CONFIG_CRYPTO_CRC32C is not set
1740# CONFIG_CRYPTO_TEST is not set
1741
1742#
1743# Hardware crypto devices
1744#
diff --git a/arch/powerpc/configs/ppc64_defconfig b/arch/powerpc/configs/ppc64_defconfig
index b5ba3bbd96fb..6f6c6bed1aa5 100644
--- a/arch/powerpc/configs/ppc64_defconfig
+++ b/arch/powerpc/configs/ppc64_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.15-rc1 3# Linux kernel version: 2.6.15-rc5
4# Fri Nov 18 16:23:24 2005 4# Tue Dec 20 15:59:38 2005
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -54,6 +54,7 @@ CONFIG_IKCONFIG=y
54CONFIG_IKCONFIG_PROC=y 54CONFIG_IKCONFIG_PROC=y
55CONFIG_CPUSETS=y 55CONFIG_CPUSETS=y
56CONFIG_INITRAMFS_SOURCE="" 56CONFIG_INITRAMFS_SOURCE=""
57CONFIG_CC_OPTIMIZE_FOR_SIZE=y
57# CONFIG_EMBEDDED is not set 58# CONFIG_EMBEDDED is not set
58CONFIG_KALLSYMS=y 59CONFIG_KALLSYMS=y
59CONFIG_KALLSYMS_ALL=y 60CONFIG_KALLSYMS_ALL=y
@@ -176,7 +177,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y
176# CONFIG_SPARSEMEM_STATIC is not set 177# CONFIG_SPARSEMEM_STATIC is not set
177CONFIG_SPARSEMEM_EXTREME=y 178CONFIG_SPARSEMEM_EXTREME=y
178# CONFIG_MEMORY_HOTPLUG is not set 179# CONFIG_MEMORY_HOTPLUG is not set
179CONFIG_SPLIT_PTLOCK_CPUS=4096 180CONFIG_SPLIT_PTLOCK_CPUS=4
180# CONFIG_PPC_64K_PAGES is not set 181# CONFIG_PPC_64K_PAGES is not set
181# CONFIG_SCHED_SMT is not set 182# CONFIG_SCHED_SMT is not set
182CONFIG_PROC_DEVICETREE=y 183CONFIG_PROC_DEVICETREE=y
@@ -723,6 +724,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
723# CONFIG_DL2K is not set 724# CONFIG_DL2K is not set
724CONFIG_E1000=y 725CONFIG_E1000=y
725# CONFIG_E1000_NAPI is not set 726# CONFIG_E1000_NAPI is not set
727# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
726# CONFIG_NS83820 is not set 728# CONFIG_NS83820 is not set
727# CONFIG_HAMACHI is not set 729# CONFIG_HAMACHI is not set
728# CONFIG_YELLOWFIN is not set 730# CONFIG_YELLOWFIN is not set
@@ -860,7 +862,7 @@ CONFIG_SERIAL_CORE=y
860CONFIG_SERIAL_CORE_CONSOLE=y 862CONFIG_SERIAL_CORE_CONSOLE=y
861# CONFIG_SERIAL_PMACZILOG is not set 863# CONFIG_SERIAL_PMACZILOG is not set
862CONFIG_SERIAL_ICOM=m 864CONFIG_SERIAL_ICOM=m
863CONFIG_SERIAL_JSM=m 865# CONFIG_SERIAL_JSM is not set
864CONFIG_UNIX98_PTYS=y 866CONFIG_UNIX98_PTYS=y
865CONFIG_LEGACY_PTYS=y 867CONFIG_LEGACY_PTYS=y
866CONFIG_LEGACY_PTY_COUNT=256 868CONFIG_LEGACY_PTY_COUNT=256
@@ -877,7 +879,7 @@ CONFIG_HVCS=m
877# 879#
878# CONFIG_WATCHDOG is not set 880# CONFIG_WATCHDOG is not set
879# CONFIG_RTC is not set 881# CONFIG_RTC is not set
880# CONFIG_GEN_RTC is not set 882CONFIG_GEN_RTC=y
881# CONFIG_DTLK is not set 883# CONFIG_DTLK is not set
882# CONFIG_R3964 is not set 884# CONFIG_R3964 is not set
883# CONFIG_APPLICOM is not set 885# CONFIG_APPLICOM is not set
diff --git a/arch/powerpc/configs/pseries_defconfig b/arch/powerpc/configs/pseries_defconfig
index b589b196eb3f..aa9893a1f6e8 100644
--- a/arch/powerpc/configs/pseries_defconfig
+++ b/arch/powerpc/configs/pseries_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.15-rc1 3# Linux kernel version: 2.6.15-rc5
4# Tue Nov 15 14:36:55 2005 4# Tue Dec 20 15:59:40 2005
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -55,6 +55,7 @@ CONFIG_IKCONFIG=y
55CONFIG_IKCONFIG_PROC=y 55CONFIG_IKCONFIG_PROC=y
56CONFIG_CPUSETS=y 56CONFIG_CPUSETS=y
57CONFIG_INITRAMFS_SOURCE="" 57CONFIG_INITRAMFS_SOURCE=""
58CONFIG_CC_OPTIMIZE_FOR_SIZE=y
58# CONFIG_EMBEDDED is not set 59# CONFIG_EMBEDDED is not set
59CONFIG_KALLSYMS=y 60CONFIG_KALLSYMS=y
60CONFIG_KALLSYMS_ALL=y 61CONFIG_KALLSYMS_ALL=y
@@ -163,7 +164,7 @@ CONFIG_HAVE_MEMORY_PRESENT=y
163# CONFIG_SPARSEMEM_STATIC is not set 164# CONFIG_SPARSEMEM_STATIC is not set
164CONFIG_SPARSEMEM_EXTREME=y 165CONFIG_SPARSEMEM_EXTREME=y
165# CONFIG_MEMORY_HOTPLUG is not set 166# CONFIG_MEMORY_HOTPLUG is not set
166CONFIG_SPLIT_PTLOCK_CPUS=4096 167CONFIG_SPLIT_PTLOCK_CPUS=4
167CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y 168CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
168# CONFIG_PPC_64K_PAGES is not set 169# CONFIG_PPC_64K_PAGES is not set
169CONFIG_SCHED_SMT=y 170CONFIG_SCHED_SMT=y
@@ -670,6 +671,7 @@ CONFIG_ACENIC_OMIT_TIGON_I=y
670# CONFIG_DL2K is not set 671# CONFIG_DL2K is not set
671CONFIG_E1000=y 672CONFIG_E1000=y
672# CONFIG_E1000_NAPI is not set 673# CONFIG_E1000_NAPI is not set
674# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
673# CONFIG_NS83820 is not set 675# CONFIG_NS83820 is not set
674# CONFIG_HAMACHI is not set 676# CONFIG_HAMACHI is not set
675# CONFIG_YELLOWFIN is not set 677# CONFIG_YELLOWFIN is not set
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 9ed551b6c172..c287980b7e65 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -4,7 +4,6 @@
4 4
5ifeq ($(CONFIG_PPC64),y) 5ifeq ($(CONFIG_PPC64),y)
6EXTRA_CFLAGS += -mno-minimal-toc 6EXTRA_CFLAGS += -mno-minimal-toc
7CFLAGS_ioctl32.o += -Ifs/
8endif 7endif
9ifeq ($(CONFIG_PPC32),y) 8ifeq ($(CONFIG_PPC32),y)
10CFLAGS_prom_init.o += -fPIC 9CFLAGS_prom_init.o += -fPIC
@@ -12,16 +11,17 @@ CFLAGS_btext.o += -fPIC
12endif 11endif
13 12
14obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ 13obj-y := semaphore.o cputable.o ptrace.o syscalls.o \
15 irq.o align.o signal_32.o pmc.o vdso.o 14 irq.o align.o signal_32.o pmc.o vdso.o \
15 init_task.o process.o
16obj-y += vdso32/ 16obj-y += vdso32/
17obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ 17obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \
18 signal_64.o ptrace32.o systbl.o \ 18 signal_64.o ptrace32.o systbl.o \
19 paca.o ioctl32.o cpu_setup_power4.o \ 19 paca.o cpu_setup_power4.o \
20 firmware.o sysfs.o udbg.o idle_64.o 20 firmware.o sysfs.o idle_64.o
21obj-$(CONFIG_PPC64) += vdso64/ 21obj-$(CONFIG_PPC64) += vdso64/
22obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o 22obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o
23obj-$(CONFIG_POWER4) += idle_power4.o 23obj-$(CONFIG_POWER4) += idle_power4.o
24obj-$(CONFIG_PPC_OF) += of_device.o 24obj-$(CONFIG_PPC_OF) += of_device.o prom_parse.o
25procfs-$(CONFIG_PPC64) := proc_ppc64.o 25procfs-$(CONFIG_PPC64) := proc_ppc64.o
26obj-$(CONFIG_PROC_FS) += $(procfs-y) 26obj-$(CONFIG_PROC_FS) += $(procfs-y)
27rtaspci-$(CONFIG_PPC64) := rtas_pci.o 27rtaspci-$(CONFIG_PPC64) := rtas_pci.o
@@ -30,12 +30,10 @@ obj-$(CONFIG_RTAS_FLASH) += rtas_flash.o
30obj-$(CONFIG_RTAS_PROC) += rtas-proc.o 30obj-$(CONFIG_RTAS_PROC) += rtas-proc.o
31obj-$(CONFIG_LPARCFG) += lparcfg.o 31obj-$(CONFIG_LPARCFG) += lparcfg.o
32obj-$(CONFIG_IBMVIO) += vio.o 32obj-$(CONFIG_IBMVIO) += vio.o
33obj-$(CONFIG_IBMEBUS) += ibmebus.o
33obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o 34obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o
34obj-$(CONFIG_PPC_PSERIES) += udbg_16550.o
35obj-$(CONFIG_PPC_MAPLE) += udbg_16550.o
36udbgscc-$(CONFIG_PPC64) := udbg_scc.o
37obj-$(CONFIG_PPC_PMAC) += $(udbgscc-y)
38obj64-$(CONFIG_PPC_MULTIPLATFORM) += nvram_64.o 35obj64-$(CONFIG_PPC_MULTIPLATFORM) += nvram_64.o
36obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
39 37
40ifeq ($(CONFIG_PPC_MERGE),y) 38ifeq ($(CONFIG_PPC_MERGE),y)
41 39
@@ -47,26 +45,26 @@ extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o
47extra-$(CONFIG_8xx) := head_8xx.o 45extra-$(CONFIG_8xx) := head_8xx.o
48extra-y += vmlinux.lds 46extra-y += vmlinux.lds
49 47
50obj-y += process.o init_task.o time.o \ 48obj-y += time.o prom.o traps.o setup-common.o udbg.o
51 prom.o traps.o setup-common.o
52obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o systbl.o 49obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o systbl.o
53obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o 50obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o
54obj-$(CONFIG_PPC_OF) += prom_init.o 51obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
55obj-$(CONFIG_MODULES) += ppc_ksyms.o 52obj-$(CONFIG_MODULES) += ppc_ksyms.o
56obj-$(CONFIG_BOOTX_TEXT) += btext.o 53obj-$(CONFIG_BOOTX_TEXT) += btext.o
57obj-$(CONFIG_6xx) += idle_6xx.o 54obj-$(CONFIG_6xx) += idle_6xx.o
58obj-$(CONFIG_SMP) += smp.o 55obj-$(CONFIG_SMP) += smp.o
59obj-$(CONFIG_KPROBES) += kprobes.o 56obj-$(CONFIG_KPROBES) += kprobes.o
60 57obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o
61module-$(CONFIG_PPC64) += module_64.o 58module-$(CONFIG_PPC64) += module_64.o
62obj-$(CONFIG_MODULES) += $(module-y) 59obj-$(CONFIG_MODULES) += $(module-y)
63 60
64pci64-$(CONFIG_PPC64) += pci_64.o pci_dn.o pci_iommu.o \ 61pci64-$(CONFIG_PPC64) += pci_64.o pci_dn.o pci_iommu.o \
65 pci_direct_iommu.o iomap.o 62 pci_direct_iommu.o iomap.o
66obj-$(CONFIG_PCI) += $(pci64-y) 63pci32-$(CONFIG_PPC32) := pci_32.o
67 64obj-$(CONFIG_PCI) += $(pci64-y) $(pci32-y)
68kexec64-$(CONFIG_PPC64) += machine_kexec_64.o 65kexec-$(CONFIG_PPC64) := machine_kexec_64.o crash.o
69obj-$(CONFIG_KEXEC) += $(kexec64-y) 66kexec-$(CONFIG_PPC32) := machine_kexec_32.o
67obj-$(CONFIG_KEXEC) += machine_kexec.o $(kexec-y)
70 68
71ifeq ($(CONFIG_PPC_ISERIES),y) 69ifeq ($(CONFIG_PPC_ISERIES),y)
72$(obj)/head_64.o: $(obj)/lparmap.s 70$(obj)/head_64.o: $(obj)/lparmap.s
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 91538d2445bf..840aad43a98b 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -92,9 +92,9 @@ int main(void)
92 92
93 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 93 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
94 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); 94 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
95 DEFINE(TI_SC_NOERR, offsetof(struct thread_info, syscall_noerror)); 95 DEFINE(TI_SIGFRAME, offsetof(struct thread_info, nvgprs_frame));
96#ifdef CONFIG_PPC32
97 DEFINE(TI_TASK, offsetof(struct thread_info, task)); 96 DEFINE(TI_TASK, offsetof(struct thread_info, task));
97#ifdef CONFIG_PPC32
98 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); 98 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
99 DEFINE(TI_CPU, offsetof(struct thread_info, cpu)); 99 DEFINE(TI_CPU, offsetof(struct thread_info, cpu));
100#endif /* CONFIG_PPC32 */ 100#endif /* CONFIG_PPC32 */
@@ -131,13 +131,11 @@ int main(void)
131 DEFINE(PACALOWHTLBAREAS, offsetof(struct paca_struct, context.low_htlb_areas)); 131 DEFINE(PACALOWHTLBAREAS, offsetof(struct paca_struct, context.low_htlb_areas));
132 DEFINE(PACAHIGHHTLBAREAS, offsetof(struct paca_struct, context.high_htlb_areas)); 132 DEFINE(PACAHIGHHTLBAREAS, offsetof(struct paca_struct, context.high_htlb_areas));
133#endif /* CONFIG_HUGETLB_PAGE */ 133#endif /* CONFIG_HUGETLB_PAGE */
134 DEFINE(PACADEFAULTDECR, offsetof(struct paca_struct, default_decr));
135 DEFINE(PACA_EXGEN, offsetof(struct paca_struct, exgen)); 134 DEFINE(PACA_EXGEN, offsetof(struct paca_struct, exgen));
136 DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc)); 135 DEFINE(PACA_EXMC, offsetof(struct paca_struct, exmc));
137 DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb)); 136 DEFINE(PACA_EXSLB, offsetof(struct paca_struct, exslb));
138 DEFINE(PACA_EXDSI, offsetof(struct paca_struct, exdsi));
139 DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp)); 137 DEFINE(PACAEMERGSP, offsetof(struct paca_struct, emergency_sp));
140 DEFINE(PACALPPACA, offsetof(struct paca_struct, lppaca)); 138 DEFINE(PACALPPACAPTR, offsetof(struct paca_struct, lppaca_ptr));
141 DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id)); 139 DEFINE(PACAHWCPUID, offsetof(struct paca_struct, hw_cpu_id));
142 140
143 DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0)); 141 DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0));
diff --git a/arch/powerpc/kernel/btext.c b/arch/powerpc/kernel/btext.c
index bdfba92b2b38..6223d39177cb 100644
--- a/arch/powerpc/kernel/btext.c
+++ b/arch/powerpc/kernel/btext.c
@@ -31,15 +31,18 @@ static void draw_byte_32(unsigned char *bits, unsigned int *base, int rb);
31static void draw_byte_16(unsigned char *bits, unsigned int *base, int rb); 31static void draw_byte_16(unsigned char *bits, unsigned int *base, int rb);
32static void draw_byte_8(unsigned char *bits, unsigned int *base, int rb); 32static void draw_byte_8(unsigned char *bits, unsigned int *base, int rb);
33 33
34static int g_loc_X; 34#define __force_data __attribute__((__section__(".data")))
35static int g_loc_Y;
36static int g_max_loc_X;
37static int g_max_loc_Y;
38 35
39static int dispDeviceRowBytes; 36static int g_loc_X __force_data;
40static int dispDeviceDepth; 37static int g_loc_Y __force_data;
41static int dispDeviceRect[4]; 38static int g_max_loc_X __force_data;
42static unsigned char *dispDeviceBase, *logicalDisplayBase; 39static int g_max_loc_Y __force_data;
40
41static int dispDeviceRowBytes __force_data;
42static int dispDeviceDepth __force_data;
43static int dispDeviceRect[4] __force_data;
44static unsigned char *dispDeviceBase __force_data;
45static unsigned char *logicalDisplayBase __force_data;
43 46
44unsigned long disp_BAT[2] __initdata = {0, 0}; 47unsigned long disp_BAT[2] __initdata = {0, 0};
45 48
@@ -47,7 +50,7 @@ unsigned long disp_BAT[2] __initdata = {0, 0};
47 50
48static unsigned char vga_font[cmapsz]; 51static unsigned char vga_font[cmapsz];
49 52
50int boot_text_mapped; 53int boot_text_mapped __force_data = 0;
51int force_printk_to_btext = 0; 54int force_printk_to_btext = 0;
52 55
53#ifdef CONFIG_PPC32 56#ifdef CONFIG_PPC32
@@ -57,7 +60,7 @@ int force_printk_to_btext = 0;
57 * 60 *
58 * The display is mapped to virtual address 0xD0000000, rather 61 * The display is mapped to virtual address 0xD0000000, rather
59 * than 1:1, because some some CHRP machines put the frame buffer 62 * than 1:1, because some some CHRP machines put the frame buffer
60 * in the region starting at 0xC0000000 (KERNELBASE). 63 * in the region starting at 0xC0000000 (PAGE_OFFSET).
61 * This mapping is temporary and will disappear as soon as the 64 * This mapping is temporary and will disappear as soon as the
62 * setup done by MMU_Init() is applied. 65 * setup done by MMU_Init() is applied.
63 * 66 *
@@ -66,10 +69,9 @@ int force_printk_to_btext = 0;
66 * is really badly aligned, but I didn't encounter this case 69 * is really badly aligned, but I didn't encounter this case
67 * yet. 70 * yet.
68 */ 71 */
69void __init 72void __init btext_prepare_BAT(void)
70btext_prepare_BAT(void)
71{ 73{
72 unsigned long vaddr = KERNELBASE + 0x10000000; 74 unsigned long vaddr = PAGE_OFFSET + 0x10000000;
73 unsigned long addr; 75 unsigned long addr;
74 unsigned long lowbits; 76 unsigned long lowbits;
75 77
@@ -95,12 +97,13 @@ btext_prepare_BAT(void)
95} 97}
96#endif 98#endif
97 99
98/* This function will enable the early boot text when doing OF booting. This 100
99 * way, xmon output should work too 101/* This function can be used to enable the early boot text when doing
102 * OF booting or within bootx init. It must be followed by a btext_unmap()
103 * call before the logical address becomes unuseable
100 */ 104 */
101void __init 105void __init btext_setup_display(int width, int height, int depth, int pitch,
102btext_setup_display(int width, int height, int depth, int pitch, 106 unsigned long address)
103 unsigned long address)
104{ 107{
105 g_loc_X = 0; 108 g_loc_X = 0;
106 g_loc_Y = 0; 109 g_loc_Y = 0;
@@ -116,6 +119,11 @@ btext_setup_display(int width, int height, int depth, int pitch,
116 boot_text_mapped = 1; 119 boot_text_mapped = 1;
117} 120}
118 121
122void __init btext_unmap(void)
123{
124 boot_text_mapped = 0;
125}
126
119/* Here's a small text engine to use during early boot 127/* Here's a small text engine to use during early boot
120 * or for debugging purposes 128 * or for debugging purposes
121 * 129 *
@@ -127,7 +135,7 @@ btext_setup_display(int width, int height, int depth, int pitch,
127 * changes. 135 * changes.
128 */ 136 */
129 137
130void map_boot_text(void) 138static void map_boot_text(void)
131{ 139{
132 unsigned long base, offset, size; 140 unsigned long base, offset, size;
133 unsigned char *vbase; 141 unsigned char *vbase;
@@ -175,8 +183,9 @@ int btext_initialize(struct device_node *np)
175 if (prop) 183 if (prop)
176 address = *prop; 184 address = *prop;
177 185
178 /* FIXME: Add support for PCI reg properties */ 186 /* FIXME: Add support for PCI reg properties. Right now, only
179 187 * reliable on macs
188 */
180 if (address == 0) 189 if (address == 0)
181 return -EINVAL; 190 return -EINVAL;
182 191
@@ -184,7 +193,6 @@ int btext_initialize(struct device_node *np)
184 g_loc_Y = 0; 193 g_loc_Y = 0;
185 g_max_loc_X = width / 8; 194 g_max_loc_X = width / 8;
186 g_max_loc_Y = height / 16; 195 g_max_loc_Y = height / 16;
187 logicalDisplayBase = (unsigned char *)address;
188 dispDeviceBase = (unsigned char *)address; 196 dispDeviceBase = (unsigned char *)address;
189 dispDeviceRowBytes = pitch; 197 dispDeviceRowBytes = pitch;
190 dispDeviceDepth = depth; 198 dispDeviceDepth = depth;
@@ -197,14 +205,12 @@ int btext_initialize(struct device_node *np)
197 return 0; 205 return 0;
198} 206}
199 207
200void __init init_boot_display(void) 208int __init btext_find_display(int allow_nonstdout)
201{ 209{
202 char *name; 210 char *name;
203 struct device_node *np = NULL; 211 struct device_node *np = NULL;
204 int rc = -ENODEV; 212 int rc = -ENODEV;
205 213
206 printk("trying to initialize btext ...\n");
207
208 name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); 214 name = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
209 if (name != NULL) { 215 if (name != NULL) {
210 np = of_find_node_by_path(name); 216 np = of_find_node_by_path(name);
@@ -218,8 +224,8 @@ void __init init_boot_display(void)
218 } 224 }
219 if (np) 225 if (np)
220 rc = btext_initialize(np); 226 rc = btext_initialize(np);
221 if (rc == 0) 227 if (rc == 0 || !allow_nonstdout)
222 return; 228 return rc;
223 229
224 for (np = NULL; (np = of_find_node_by_type(np, "display"));) { 230 for (np = NULL; (np = of_find_node_by_type(np, "display"));) {
225 if (get_property(np, "linux,opened", NULL)) { 231 if (get_property(np, "linux,opened", NULL)) {
@@ -228,8 +234,9 @@ void __init init_boot_display(void)
228 printk("result: %d\n", rc); 234 printk("result: %d\n", rc);
229 } 235 }
230 if (rc == 0) 236 if (rc == 0)
231 return; 237 break;
232 } 238 }
239 return rc;
233} 240}
234 241
235/* Calc the base address of a given point (x,y) */ 242/* Calc the base address of a given point (x,y) */
@@ -277,44 +284,83 @@ EXPORT_SYMBOL(btext_update_display);
277 284
278void btext_clearscreen(void) 285void btext_clearscreen(void)
279{ 286{
280 unsigned long *base = (unsigned long *)calc_base(0, 0); 287 unsigned int *base = (unsigned int *)calc_base(0, 0);
281 unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) * 288 unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) *
282 (dispDeviceDepth >> 3)) >> 3; 289 (dispDeviceDepth >> 3)) >> 2;
283 int i,j; 290 int i,j;
284 291
285 for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1]); i++) 292 for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1]); i++)
286 { 293 {
287 unsigned long *ptr = base; 294 unsigned int *ptr = base;
288 for(j=width; j; --j) 295 for(j=width; j; --j)
289 *(ptr++) = 0; 296 *(ptr++) = 0;
290 base += (dispDeviceRowBytes >> 3); 297 base += (dispDeviceRowBytes >> 2);
291 } 298 }
292} 299}
293 300
301void btext_flushscreen(void)
302{
303 unsigned int *base = (unsigned int *)calc_base(0, 0);
304 unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) *
305 (dispDeviceDepth >> 3)) >> 2;
306 int i,j;
307
308 for (i=0; i < (dispDeviceRect[3] - dispDeviceRect[1]); i++)
309 {
310 unsigned int *ptr = base;
311 for(j = width; j > 0; j -= 8) {
312 __asm__ __volatile__ ("dcbst 0,%0" :: "r" (ptr));
313 ptr += 8;
314 }
315 base += (dispDeviceRowBytes >> 2);
316 }
317 __asm__ __volatile__ ("sync" ::: "memory");
318}
319
320void btext_flushline(void)
321{
322 unsigned int *base = (unsigned int *)calc_base(0, g_loc_Y << 4);
323 unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) *
324 (dispDeviceDepth >> 3)) >> 2;
325 int i,j;
326
327 for (i=0; i < 16; i++)
328 {
329 unsigned int *ptr = base;
330 for(j = width; j > 0; j -= 8) {
331 __asm__ __volatile__ ("dcbst 0,%0" :: "r" (ptr));
332 ptr += 8;
333 }
334 base += (dispDeviceRowBytes >> 2);
335 }
336 __asm__ __volatile__ ("sync" ::: "memory");
337}
338
339
294#ifndef NO_SCROLL 340#ifndef NO_SCROLL
295static void scrollscreen(void) 341static void scrollscreen(void)
296{ 342{
297 unsigned long *src = (unsigned long *)calc_base(0,16); 343 unsigned int *src = (unsigned int *)calc_base(0,16);
298 unsigned long *dst = (unsigned long *)calc_base(0,0); 344 unsigned int *dst = (unsigned int *)calc_base(0,0);
299 unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) * 345 unsigned long width = ((dispDeviceRect[2] - dispDeviceRect[0]) *
300 (dispDeviceDepth >> 3)) >> 3; 346 (dispDeviceDepth >> 3)) >> 2;
301 int i,j; 347 int i,j;
302 348
303 for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1] - 16); i++) 349 for (i=0; i<(dispDeviceRect[3] - dispDeviceRect[1] - 16); i++)
304 { 350 {
305 unsigned long *src_ptr = src; 351 unsigned int *src_ptr = src;
306 unsigned long *dst_ptr = dst; 352 unsigned int *dst_ptr = dst;
307 for(j=width; j; --j) 353 for(j=width; j; --j)
308 *(dst_ptr++) = *(src_ptr++); 354 *(dst_ptr++) = *(src_ptr++);
309 src += (dispDeviceRowBytes >> 3); 355 src += (dispDeviceRowBytes >> 2);
310 dst += (dispDeviceRowBytes >> 3); 356 dst += (dispDeviceRowBytes >> 2);
311 } 357 }
312 for (i=0; i<16; i++) 358 for (i=0; i<16; i++)
313 { 359 {
314 unsigned long *dst_ptr = dst; 360 unsigned int *dst_ptr = dst;
315 for(j=width; j; --j) 361 for(j=width; j; --j)
316 *(dst_ptr++) = 0; 362 *(dst_ptr++) = 0;
317 dst += (dispDeviceRowBytes >> 3); 363 dst += (dispDeviceRowBytes >> 2);
318 } 364 }
319} 365}
320#endif /* ndef NO_SCROLL */ 366#endif /* ndef NO_SCROLL */
@@ -377,6 +423,14 @@ void btext_drawstring(const char *c)
377 btext_drawchar(*c++); 423 btext_drawchar(*c++);
378} 424}
379 425
426void btext_drawtext(const char *c, unsigned int len)
427{
428 if (!boot_text_mapped)
429 return;
430 while (len--)
431 btext_drawchar(*c++);
432}
433
380void btext_drawhex(unsigned long v) 434void btext_drawhex(unsigned long v)
381{ 435{
382 char *hex_table = "0123456789abcdef"; 436 char *hex_table = "0123456789abcdef";
diff --git a/arch/powerpc/kernel/cpu_setup_power4.S b/arch/powerpc/kernel/cpu_setup_power4.S
index cca942fe6115..b61d86e7ceb6 100644
--- a/arch/powerpc/kernel/cpu_setup_power4.S
+++ b/arch/powerpc/kernel/cpu_setup_power4.S
@@ -130,7 +130,7 @@ _GLOBAL(__save_cpu_setup)
130 mfcr r7 130 mfcr r7
131 131
132 /* Get storage ptr */ 132 /* Get storage ptr */
133 LOADADDR(r5,cpu_state_storage) 133 LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
134 134
135 /* We only deal with 970 for now */ 135 /* We only deal with 970 for now */
136 mfspr r0,SPRN_PVR 136 mfspr r0,SPRN_PVR
@@ -164,7 +164,7 @@ _GLOBAL(__restore_cpu_setup)
164 /* Get storage ptr (FIXME when using anton reloc as we 164 /* Get storage ptr (FIXME when using anton reloc as we
165 * are running with translation disabled here 165 * are running with translation disabled here
166 */ 166 */
167 LOADADDR(r5,cpu_state_storage) 167 LOAD_REG_IMMEDIATE(r5,cpu_state_storage)
168 168
169 /* We only deal with 970 for now */ 169 /* We only deal with 970 for now */
170 mfspr r0,SPRN_PVR 170 mfspr r0,SPRN_PVR
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 1d85cedbbb7b..10696456a4c6 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -55,7 +55,8 @@ extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec);
55#define COMMON_USER_POWER4 (COMMON_USER_PPC64 | PPC_FEATURE_POWER4) 55#define COMMON_USER_POWER4 (COMMON_USER_PPC64 | PPC_FEATURE_POWER4)
56#define COMMON_USER_POWER5 (COMMON_USER_PPC64 | PPC_FEATURE_POWER5) 56#define COMMON_USER_POWER5 (COMMON_USER_PPC64 | PPC_FEATURE_POWER5)
57#define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS) 57#define COMMON_USER_POWER5_PLUS (COMMON_USER_PPC64 | PPC_FEATURE_POWER5_PLUS)
58 58#define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \
59 PPC_FEATURE_BOOKE)
59 60
60/* We only set the spe features if the kernel was compiled with 61/* We only set the spe features if the kernel was compiled with
61 * spe support 62 * spe support
@@ -78,10 +79,9 @@ struct cpu_spec cpu_specs[] = {
78 .dcache_bsize = 128, 79 .dcache_bsize = 128,
79 .num_pmcs = 8, 80 .num_pmcs = 8,
80 .cpu_setup = __setup_cpu_power3, 81 .cpu_setup = __setup_cpu_power3,
81#ifdef CONFIG_OPROFILE
82 .oprofile_cpu_type = "ppc64/power3", 82 .oprofile_cpu_type = "ppc64/power3",
83 .oprofile_model = &op_model_rs64, 83 .oprofile_type = PPC_OPROFILE_RS64,
84#endif 84 .platform = "power3",
85 }, 85 },
86 { /* Power3+ */ 86 { /* Power3+ */
87 .pvr_mask = 0xffff0000, 87 .pvr_mask = 0xffff0000,
@@ -93,10 +93,9 @@ struct cpu_spec cpu_specs[] = {
93 .dcache_bsize = 128, 93 .dcache_bsize = 128,
94 .num_pmcs = 8, 94 .num_pmcs = 8,
95 .cpu_setup = __setup_cpu_power3, 95 .cpu_setup = __setup_cpu_power3,
96#ifdef CONFIG_OPROFILE
97 .oprofile_cpu_type = "ppc64/power3", 96 .oprofile_cpu_type = "ppc64/power3",
98 .oprofile_model = &op_model_rs64, 97 .oprofile_type = PPC_OPROFILE_RS64,
99#endif 98 .platform = "power3",
100 }, 99 },
101 { /* Northstar */ 100 { /* Northstar */
102 .pvr_mask = 0xffff0000, 101 .pvr_mask = 0xffff0000,
@@ -108,10 +107,9 @@ struct cpu_spec cpu_specs[] = {
108 .dcache_bsize = 128, 107 .dcache_bsize = 128,
109 .num_pmcs = 8, 108 .num_pmcs = 8,
110 .cpu_setup = __setup_cpu_power3, 109 .cpu_setup = __setup_cpu_power3,
111#ifdef CONFIG_OPROFILE
112 .oprofile_cpu_type = "ppc64/rs64", 110 .oprofile_cpu_type = "ppc64/rs64",
113 .oprofile_model = &op_model_rs64, 111 .oprofile_type = PPC_OPROFILE_RS64,
114#endif 112 .platform = "rs64",
115 }, 113 },
116 { /* Pulsar */ 114 { /* Pulsar */
117 .pvr_mask = 0xffff0000, 115 .pvr_mask = 0xffff0000,
@@ -123,10 +121,9 @@ struct cpu_spec cpu_specs[] = {
123 .dcache_bsize = 128, 121 .dcache_bsize = 128,
124 .num_pmcs = 8, 122 .num_pmcs = 8,
125 .cpu_setup = __setup_cpu_power3, 123 .cpu_setup = __setup_cpu_power3,
126#ifdef CONFIG_OPROFILE
127 .oprofile_cpu_type = "ppc64/rs64", 124 .oprofile_cpu_type = "ppc64/rs64",
128 .oprofile_model = &op_model_rs64, 125 .oprofile_type = PPC_OPROFILE_RS64,
129#endif 126 .platform = "rs64",
130 }, 127 },
131 { /* I-star */ 128 { /* I-star */
132 .pvr_mask = 0xffff0000, 129 .pvr_mask = 0xffff0000,
@@ -138,10 +135,9 @@ struct cpu_spec cpu_specs[] = {
138 .dcache_bsize = 128, 135 .dcache_bsize = 128,
139 .num_pmcs = 8, 136 .num_pmcs = 8,
140 .cpu_setup = __setup_cpu_power3, 137 .cpu_setup = __setup_cpu_power3,
141#ifdef CONFIG_OPROFILE
142 .oprofile_cpu_type = "ppc64/rs64", 138 .oprofile_cpu_type = "ppc64/rs64",
143 .oprofile_model = &op_model_rs64, 139 .oprofile_type = PPC_OPROFILE_RS64,
144#endif 140 .platform = "rs64",
145 }, 141 },
146 { /* S-star */ 142 { /* S-star */
147 .pvr_mask = 0xffff0000, 143 .pvr_mask = 0xffff0000,
@@ -153,10 +149,9 @@ struct cpu_spec cpu_specs[] = {
153 .dcache_bsize = 128, 149 .dcache_bsize = 128,
154 .num_pmcs = 8, 150 .num_pmcs = 8,
155 .cpu_setup = __setup_cpu_power3, 151 .cpu_setup = __setup_cpu_power3,
156#ifdef CONFIG_OPROFILE
157 .oprofile_cpu_type = "ppc64/rs64", 152 .oprofile_cpu_type = "ppc64/rs64",
158 .oprofile_model = &op_model_rs64, 153 .oprofile_type = PPC_OPROFILE_RS64,
159#endif 154 .platform = "rs64",
160 }, 155 },
161 { /* Power4 */ 156 { /* Power4 */
162 .pvr_mask = 0xffff0000, 157 .pvr_mask = 0xffff0000,
@@ -168,10 +163,9 @@ struct cpu_spec cpu_specs[] = {
168 .dcache_bsize = 128, 163 .dcache_bsize = 128,
169 .num_pmcs = 8, 164 .num_pmcs = 8,
170 .cpu_setup = __setup_cpu_power4, 165 .cpu_setup = __setup_cpu_power4,
171#ifdef CONFIG_OPROFILE
172 .oprofile_cpu_type = "ppc64/power4", 166 .oprofile_cpu_type = "ppc64/power4",
173 .oprofile_model = &op_model_rs64, 167 .oprofile_type = PPC_OPROFILE_POWER4,
174#endif 168 .platform = "power4",
175 }, 169 },
176 { /* Power4+ */ 170 { /* Power4+ */
177 .pvr_mask = 0xffff0000, 171 .pvr_mask = 0xffff0000,
@@ -183,10 +177,9 @@ struct cpu_spec cpu_specs[] = {
183 .dcache_bsize = 128, 177 .dcache_bsize = 128,
184 .num_pmcs = 8, 178 .num_pmcs = 8,
185 .cpu_setup = __setup_cpu_power4, 179 .cpu_setup = __setup_cpu_power4,
186#ifdef CONFIG_OPROFILE
187 .oprofile_cpu_type = "ppc64/power4", 180 .oprofile_cpu_type = "ppc64/power4",
188 .oprofile_model = &op_model_power4, 181 .oprofile_type = PPC_OPROFILE_POWER4,
189#endif 182 .platform = "power4",
190 }, 183 },
191 { /* PPC970 */ 184 { /* PPC970 */
192 .pvr_mask = 0xffff0000, 185 .pvr_mask = 0xffff0000,
@@ -199,10 +192,9 @@ struct cpu_spec cpu_specs[] = {
199 .dcache_bsize = 128, 192 .dcache_bsize = 128,
200 .num_pmcs = 8, 193 .num_pmcs = 8,
201 .cpu_setup = __setup_cpu_ppc970, 194 .cpu_setup = __setup_cpu_ppc970,
202#ifdef CONFIG_OPROFILE
203 .oprofile_cpu_type = "ppc64/970", 195 .oprofile_cpu_type = "ppc64/970",
204 .oprofile_model = &op_model_power4, 196 .oprofile_type = PPC_OPROFILE_POWER4,
205#endif 197 .platform = "ppc970",
206 }, 198 },
207#endif /* CONFIG_PPC64 */ 199#endif /* CONFIG_PPC64 */
208#if defined(CONFIG_PPC64) || defined(CONFIG_POWER4) 200#if defined(CONFIG_PPC64) || defined(CONFIG_POWER4)
@@ -221,10 +213,9 @@ struct cpu_spec cpu_specs[] = {
221 .dcache_bsize = 128, 213 .dcache_bsize = 128,
222 .num_pmcs = 8, 214 .num_pmcs = 8,
223 .cpu_setup = __setup_cpu_ppc970, 215 .cpu_setup = __setup_cpu_ppc970,
224#ifdef CONFIG_OPROFILE
225 .oprofile_cpu_type = "ppc64/970", 216 .oprofile_cpu_type = "ppc64/970",
226 .oprofile_model = &op_model_power4, 217 .oprofile_type = PPC_OPROFILE_POWER4,
227#endif 218 .platform = "ppc970",
228 }, 219 },
229#endif /* defined(CONFIG_PPC64) || defined(CONFIG_POWER4) */ 220#endif /* defined(CONFIG_PPC64) || defined(CONFIG_POWER4) */
230#ifdef CONFIG_PPC64 221#ifdef CONFIG_PPC64
@@ -238,10 +229,9 @@ struct cpu_spec cpu_specs[] = {
238 .icache_bsize = 128, 229 .icache_bsize = 128,
239 .dcache_bsize = 128, 230 .dcache_bsize = 128,
240 .cpu_setup = __setup_cpu_ppc970, 231 .cpu_setup = __setup_cpu_ppc970,
241#ifdef CONFIG_OPROFILE
242 .oprofile_cpu_type = "ppc64/970", 232 .oprofile_cpu_type = "ppc64/970",
243 .oprofile_model = &op_model_power4, 233 .oprofile_type = PPC_OPROFILE_POWER4,
244#endif 234 .platform = "ppc970",
245 }, 235 },
246 { /* Power5 GR */ 236 { /* Power5 GR */
247 .pvr_mask = 0xffff0000, 237 .pvr_mask = 0xffff0000,
@@ -253,27 +243,25 @@ struct cpu_spec cpu_specs[] = {
253 .dcache_bsize = 128, 243 .dcache_bsize = 128,
254 .num_pmcs = 6, 244 .num_pmcs = 6,
255 .cpu_setup = __setup_cpu_power4, 245 .cpu_setup = __setup_cpu_power4,
256#ifdef CONFIG_OPROFILE
257 .oprofile_cpu_type = "ppc64/power5", 246 .oprofile_cpu_type = "ppc64/power5",
258 .oprofile_model = &op_model_power4, 247 .oprofile_type = PPC_OPROFILE_POWER4,
259#endif 248 .platform = "power5",
260 }, 249 },
261 { /* Power5 GS */ 250 { /* Power5 GS */
262 .pvr_mask = 0xffff0000, 251 .pvr_mask = 0xffff0000,
263 .pvr_value = 0x003b0000, 252 .pvr_value = 0x003b0000,
264 .cpu_name = "POWER5 (gs)", 253 .cpu_name = "POWER5+ (gs)",
265 .cpu_features = CPU_FTRS_POWER5, 254 .cpu_features = CPU_FTRS_POWER5,
266 .cpu_user_features = COMMON_USER_POWER5_PLUS, 255 .cpu_user_features = COMMON_USER_POWER5_PLUS,
267 .icache_bsize = 128, 256 .icache_bsize = 128,
268 .dcache_bsize = 128, 257 .dcache_bsize = 128,
269 .num_pmcs = 6, 258 .num_pmcs = 6,
270 .cpu_setup = __setup_cpu_power4, 259 .cpu_setup = __setup_cpu_power4,
271#ifdef CONFIG_OPROFILE 260 .oprofile_cpu_type = "ppc64/power5+",
272 .oprofile_cpu_type = "ppc64/power5", 261 .oprofile_type = PPC_OPROFILE_POWER4,
273 .oprofile_model = &op_model_power4, 262 .platform = "power5+",
274#endif
275 }, 263 },
276 { /* BE DD1.x */ 264 { /* Cell Broadband Engine */
277 .pvr_mask = 0xffff0000, 265 .pvr_mask = 0xffff0000,
278 .pvr_value = 0x00700000, 266 .pvr_value = 0x00700000,
279 .cpu_name = "Cell Broadband Engine", 267 .cpu_name = "Cell Broadband Engine",
@@ -283,6 +271,7 @@ struct cpu_spec cpu_specs[] = {
283 .icache_bsize = 128, 271 .icache_bsize = 128,
284 .dcache_bsize = 128, 272 .dcache_bsize = 128,
285 .cpu_setup = __setup_cpu_be, 273 .cpu_setup = __setup_cpu_be,
274 .platform = "ppc-cell-be",
286 }, 275 },
287 { /* default match */ 276 { /* default match */
288 .pvr_mask = 0x00000000, 277 .pvr_mask = 0x00000000,
@@ -294,6 +283,7 @@ struct cpu_spec cpu_specs[] = {
294 .dcache_bsize = 128, 283 .dcache_bsize = 128,
295 .num_pmcs = 6, 284 .num_pmcs = 6,
296 .cpu_setup = __setup_cpu_power4, 285 .cpu_setup = __setup_cpu_power4,
286 .platform = "power4",
297 } 287 }
298#endif /* CONFIG_PPC64 */ 288#endif /* CONFIG_PPC64 */
299#ifdef CONFIG_PPC32 289#ifdef CONFIG_PPC32
@@ -307,6 +297,7 @@ struct cpu_spec cpu_specs[] = {
307 PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB, 297 PPC_FEATURE_UNIFIED_CACHE | PPC_FEATURE_NO_TB,
308 .icache_bsize = 32, 298 .icache_bsize = 32,
309 .dcache_bsize = 32, 299 .dcache_bsize = 32,
300 .platform = "ppc601",
310 }, 301 },
311 { /* 603 */ 302 { /* 603 */
312 .pvr_mask = 0xffff0000, 303 .pvr_mask = 0xffff0000,
@@ -316,7 +307,8 @@ struct cpu_spec cpu_specs[] = {
316 .cpu_user_features = COMMON_USER, 307 .cpu_user_features = COMMON_USER,
317 .icache_bsize = 32, 308 .icache_bsize = 32,
318 .dcache_bsize = 32, 309 .dcache_bsize = 32,
319 .cpu_setup = __setup_cpu_603 310 .cpu_setup = __setup_cpu_603,
311 .platform = "ppc603",
320 }, 312 },
321 { /* 603e */ 313 { /* 603e */
322 .pvr_mask = 0xffff0000, 314 .pvr_mask = 0xffff0000,
@@ -326,7 +318,8 @@ struct cpu_spec cpu_specs[] = {
326 .cpu_user_features = COMMON_USER, 318 .cpu_user_features = COMMON_USER,
327 .icache_bsize = 32, 319 .icache_bsize = 32,
328 .dcache_bsize = 32, 320 .dcache_bsize = 32,
329 .cpu_setup = __setup_cpu_603 321 .cpu_setup = __setup_cpu_603,
322 .platform = "ppc603",
330 }, 323 },
331 { /* 603ev */ 324 { /* 603ev */
332 .pvr_mask = 0xffff0000, 325 .pvr_mask = 0xffff0000,
@@ -336,7 +329,8 @@ struct cpu_spec cpu_specs[] = {
336 .cpu_user_features = COMMON_USER, 329 .cpu_user_features = COMMON_USER,
337 .icache_bsize = 32, 330 .icache_bsize = 32,
338 .dcache_bsize = 32, 331 .dcache_bsize = 32,
339 .cpu_setup = __setup_cpu_603 332 .cpu_setup = __setup_cpu_603,
333 .platform = "ppc603",
340 }, 334 },
341 { /* 604 */ 335 { /* 604 */
342 .pvr_mask = 0xffff0000, 336 .pvr_mask = 0xffff0000,
@@ -347,7 +341,8 @@ struct cpu_spec cpu_specs[] = {
347 .icache_bsize = 32, 341 .icache_bsize = 32,
348 .dcache_bsize = 32, 342 .dcache_bsize = 32,
349 .num_pmcs = 2, 343 .num_pmcs = 2,
350 .cpu_setup = __setup_cpu_604 344 .cpu_setup = __setup_cpu_604,
345 .platform = "ppc604",
351 }, 346 },
352 { /* 604e */ 347 { /* 604e */
353 .pvr_mask = 0xfffff000, 348 .pvr_mask = 0xfffff000,
@@ -358,7 +353,8 @@ struct cpu_spec cpu_specs[] = {
358 .icache_bsize = 32, 353 .icache_bsize = 32,
359 .dcache_bsize = 32, 354 .dcache_bsize = 32,
360 .num_pmcs = 4, 355 .num_pmcs = 4,
361 .cpu_setup = __setup_cpu_604 356 .cpu_setup = __setup_cpu_604,
357 .platform = "ppc604",
362 }, 358 },
363 { /* 604r */ 359 { /* 604r */
364 .pvr_mask = 0xffff0000, 360 .pvr_mask = 0xffff0000,
@@ -369,7 +365,8 @@ struct cpu_spec cpu_specs[] = {
369 .icache_bsize = 32, 365 .icache_bsize = 32,
370 .dcache_bsize = 32, 366 .dcache_bsize = 32,
371 .num_pmcs = 4, 367 .num_pmcs = 4,
372 .cpu_setup = __setup_cpu_604 368 .cpu_setup = __setup_cpu_604,
369 .platform = "ppc604",
373 }, 370 },
374 { /* 604ev */ 371 { /* 604ev */
375 .pvr_mask = 0xffff0000, 372 .pvr_mask = 0xffff0000,
@@ -380,7 +377,8 @@ struct cpu_spec cpu_specs[] = {
380 .icache_bsize = 32, 377 .icache_bsize = 32,
381 .dcache_bsize = 32, 378 .dcache_bsize = 32,
382 .num_pmcs = 4, 379 .num_pmcs = 4,
383 .cpu_setup = __setup_cpu_604 380 .cpu_setup = __setup_cpu_604,
381 .platform = "ppc604",
384 }, 382 },
385 { /* 740/750 (0x4202, don't support TAU ?) */ 383 { /* 740/750 (0x4202, don't support TAU ?) */
386 .pvr_mask = 0xffffffff, 384 .pvr_mask = 0xffffffff,
@@ -391,7 +389,8 @@ struct cpu_spec cpu_specs[] = {
391 .icache_bsize = 32, 389 .icache_bsize = 32,
392 .dcache_bsize = 32, 390 .dcache_bsize = 32,
393 .num_pmcs = 4, 391 .num_pmcs = 4,
394 .cpu_setup = __setup_cpu_750 392 .cpu_setup = __setup_cpu_750,
393 .platform = "ppc750",
395 }, 394 },
396 { /* 750CX (80100 and 8010x?) */ 395 { /* 750CX (80100 and 8010x?) */
397 .pvr_mask = 0xfffffff0, 396 .pvr_mask = 0xfffffff0,
@@ -402,7 +401,8 @@ struct cpu_spec cpu_specs[] = {
402 .icache_bsize = 32, 401 .icache_bsize = 32,
403 .dcache_bsize = 32, 402 .dcache_bsize = 32,
404 .num_pmcs = 4, 403 .num_pmcs = 4,
405 .cpu_setup = __setup_cpu_750cx 404 .cpu_setup = __setup_cpu_750cx,
405 .platform = "ppc750",
406 }, 406 },
407 { /* 750CX (82201 and 82202) */ 407 { /* 750CX (82201 and 82202) */
408 .pvr_mask = 0xfffffff0, 408 .pvr_mask = 0xfffffff0,
@@ -413,7 +413,8 @@ struct cpu_spec cpu_specs[] = {
413 .icache_bsize = 32, 413 .icache_bsize = 32,
414 .dcache_bsize = 32, 414 .dcache_bsize = 32,
415 .num_pmcs = 4, 415 .num_pmcs = 4,
416 .cpu_setup = __setup_cpu_750cx 416 .cpu_setup = __setup_cpu_750cx,
417 .platform = "ppc750",
417 }, 418 },
418 { /* 750CXe (82214) */ 419 { /* 750CXe (82214) */
419 .pvr_mask = 0xfffffff0, 420 .pvr_mask = 0xfffffff0,
@@ -424,7 +425,8 @@ struct cpu_spec cpu_specs[] = {
424 .icache_bsize = 32, 425 .icache_bsize = 32,
425 .dcache_bsize = 32, 426 .dcache_bsize = 32,
426 .num_pmcs = 4, 427 .num_pmcs = 4,
427 .cpu_setup = __setup_cpu_750cx 428 .cpu_setup = __setup_cpu_750cx,
429 .platform = "ppc750",
428 }, 430 },
429 { /* 750CXe "Gekko" (83214) */ 431 { /* 750CXe "Gekko" (83214) */
430 .pvr_mask = 0xffffffff, 432 .pvr_mask = 0xffffffff,
@@ -435,7 +437,8 @@ struct cpu_spec cpu_specs[] = {
435 .icache_bsize = 32, 437 .icache_bsize = 32,
436 .dcache_bsize = 32, 438 .dcache_bsize = 32,
437 .num_pmcs = 4, 439 .num_pmcs = 4,
438 .cpu_setup = __setup_cpu_750cx 440 .cpu_setup = __setup_cpu_750cx,
441 .platform = "ppc750",
439 }, 442 },
440 { /* 745/755 */ 443 { /* 745/755 */
441 .pvr_mask = 0xfffff000, 444 .pvr_mask = 0xfffff000,
@@ -446,7 +449,8 @@ struct cpu_spec cpu_specs[] = {
446 .icache_bsize = 32, 449 .icache_bsize = 32,
447 .dcache_bsize = 32, 450 .dcache_bsize = 32,
448 .num_pmcs = 4, 451 .num_pmcs = 4,
449 .cpu_setup = __setup_cpu_750 452 .cpu_setup = __setup_cpu_750,
453 .platform = "ppc750",
450 }, 454 },
451 { /* 750FX rev 1.x */ 455 { /* 750FX rev 1.x */
452 .pvr_mask = 0xffffff00, 456 .pvr_mask = 0xffffff00,
@@ -457,7 +461,8 @@ struct cpu_spec cpu_specs[] = {
457 .icache_bsize = 32, 461 .icache_bsize = 32,
458 .dcache_bsize = 32, 462 .dcache_bsize = 32,
459 .num_pmcs = 4, 463 .num_pmcs = 4,
460 .cpu_setup = __setup_cpu_750 464 .cpu_setup = __setup_cpu_750,
465 .platform = "ppc750",
461 }, 466 },
462 { /* 750FX rev 2.0 must disable HID0[DPM] */ 467 { /* 750FX rev 2.0 must disable HID0[DPM] */
463 .pvr_mask = 0xffffffff, 468 .pvr_mask = 0xffffffff,
@@ -468,7 +473,8 @@ struct cpu_spec cpu_specs[] = {
468 .icache_bsize = 32, 473 .icache_bsize = 32,
469 .dcache_bsize = 32, 474 .dcache_bsize = 32,
470 .num_pmcs = 4, 475 .num_pmcs = 4,
471 .cpu_setup = __setup_cpu_750 476 .cpu_setup = __setup_cpu_750,
477 .platform = "ppc750",
472 }, 478 },
473 { /* 750FX (All revs except 2.0) */ 479 { /* 750FX (All revs except 2.0) */
474 .pvr_mask = 0xffff0000, 480 .pvr_mask = 0xffff0000,
@@ -479,7 +485,8 @@ struct cpu_spec cpu_specs[] = {
479 .icache_bsize = 32, 485 .icache_bsize = 32,
480 .dcache_bsize = 32, 486 .dcache_bsize = 32,
481 .num_pmcs = 4, 487 .num_pmcs = 4,
482 .cpu_setup = __setup_cpu_750fx 488 .cpu_setup = __setup_cpu_750fx,
489 .platform = "ppc750",
483 }, 490 },
484 { /* 750GX */ 491 { /* 750GX */
485 .pvr_mask = 0xffff0000, 492 .pvr_mask = 0xffff0000,
@@ -490,7 +497,8 @@ struct cpu_spec cpu_specs[] = {
490 .icache_bsize = 32, 497 .icache_bsize = 32,
491 .dcache_bsize = 32, 498 .dcache_bsize = 32,
492 .num_pmcs = 4, 499 .num_pmcs = 4,
493 .cpu_setup = __setup_cpu_750fx 500 .cpu_setup = __setup_cpu_750fx,
501 .platform = "ppc750",
494 }, 502 },
495 { /* 740/750 (L2CR bit need fixup for 740) */ 503 { /* 740/750 (L2CR bit need fixup for 740) */
496 .pvr_mask = 0xffff0000, 504 .pvr_mask = 0xffff0000,
@@ -501,7 +509,8 @@ struct cpu_spec cpu_specs[] = {
501 .icache_bsize = 32, 509 .icache_bsize = 32,
502 .dcache_bsize = 32, 510 .dcache_bsize = 32,
503 .num_pmcs = 4, 511 .num_pmcs = 4,
504 .cpu_setup = __setup_cpu_750 512 .cpu_setup = __setup_cpu_750,
513 .platform = "ppc750",
505 }, 514 },
506 { /* 7400 rev 1.1 ? (no TAU) */ 515 { /* 7400 rev 1.1 ? (no TAU) */
507 .pvr_mask = 0xffffffff, 516 .pvr_mask = 0xffffffff,
@@ -512,7 +521,8 @@ struct cpu_spec cpu_specs[] = {
512 .icache_bsize = 32, 521 .icache_bsize = 32,
513 .dcache_bsize = 32, 522 .dcache_bsize = 32,
514 .num_pmcs = 4, 523 .num_pmcs = 4,
515 .cpu_setup = __setup_cpu_7400 524 .cpu_setup = __setup_cpu_7400,
525 .platform = "ppc7400",
516 }, 526 },
517 { /* 7400 */ 527 { /* 7400 */
518 .pvr_mask = 0xffff0000, 528 .pvr_mask = 0xffff0000,
@@ -523,7 +533,8 @@ struct cpu_spec cpu_specs[] = {
523 .icache_bsize = 32, 533 .icache_bsize = 32,
524 .dcache_bsize = 32, 534 .dcache_bsize = 32,
525 .num_pmcs = 4, 535 .num_pmcs = 4,
526 .cpu_setup = __setup_cpu_7400 536 .cpu_setup = __setup_cpu_7400,
537 .platform = "ppc7400",
527 }, 538 },
528 { /* 7410 */ 539 { /* 7410 */
529 .pvr_mask = 0xffff0000, 540 .pvr_mask = 0xffff0000,
@@ -534,7 +545,8 @@ struct cpu_spec cpu_specs[] = {
534 .icache_bsize = 32, 545 .icache_bsize = 32,
535 .dcache_bsize = 32, 546 .dcache_bsize = 32,
536 .num_pmcs = 4, 547 .num_pmcs = 4,
537 .cpu_setup = __setup_cpu_7410 548 .cpu_setup = __setup_cpu_7410,
549 .platform = "ppc7400",
538 }, 550 },
539 { /* 7450 2.0 - no doze/nap */ 551 { /* 7450 2.0 - no doze/nap */
540 .pvr_mask = 0xffffffff, 552 .pvr_mask = 0xffffffff,
@@ -545,7 +557,10 @@ struct cpu_spec cpu_specs[] = {
545 .icache_bsize = 32, 557 .icache_bsize = 32,
546 .dcache_bsize = 32, 558 .dcache_bsize = 32,
547 .num_pmcs = 6, 559 .num_pmcs = 6,
548 .cpu_setup = __setup_cpu_745x 560 .cpu_setup = __setup_cpu_745x,
561 .oprofile_cpu_type = "ppc/7450",
562 .oprofile_type = PPC_OPROFILE_G4,
563 .platform = "ppc7450",
549 }, 564 },
550 { /* 7450 2.1 */ 565 { /* 7450 2.1 */
551 .pvr_mask = 0xffffffff, 566 .pvr_mask = 0xffffffff,
@@ -556,7 +571,10 @@ struct cpu_spec cpu_specs[] = {
556 .icache_bsize = 32, 571 .icache_bsize = 32,
557 .dcache_bsize = 32, 572 .dcache_bsize = 32,
558 .num_pmcs = 6, 573 .num_pmcs = 6,
559 .cpu_setup = __setup_cpu_745x 574 .cpu_setup = __setup_cpu_745x,
575 .oprofile_cpu_type = "ppc/7450",
576 .oprofile_type = PPC_OPROFILE_G4,
577 .platform = "ppc7450",
560 }, 578 },
561 { /* 7450 2.3 and newer */ 579 { /* 7450 2.3 and newer */
562 .pvr_mask = 0xffff0000, 580 .pvr_mask = 0xffff0000,
@@ -567,7 +585,10 @@ struct cpu_spec cpu_specs[] = {
567 .icache_bsize = 32, 585 .icache_bsize = 32,
568 .dcache_bsize = 32, 586 .dcache_bsize = 32,
569 .num_pmcs = 6, 587 .num_pmcs = 6,
570 .cpu_setup = __setup_cpu_745x 588 .cpu_setup = __setup_cpu_745x,
589 .oprofile_cpu_type = "ppc/7450",
590 .oprofile_type = PPC_OPROFILE_G4,
591 .platform = "ppc7450",
571 }, 592 },
572 { /* 7455 rev 1.x */ 593 { /* 7455 rev 1.x */
573 .pvr_mask = 0xffffff00, 594 .pvr_mask = 0xffffff00,
@@ -578,7 +599,10 @@ struct cpu_spec cpu_specs[] = {
578 .icache_bsize = 32, 599 .icache_bsize = 32,
579 .dcache_bsize = 32, 600 .dcache_bsize = 32,
580 .num_pmcs = 6, 601 .num_pmcs = 6,
581 .cpu_setup = __setup_cpu_745x 602 .cpu_setup = __setup_cpu_745x,
603 .oprofile_cpu_type = "ppc/7450",
604 .oprofile_type = PPC_OPROFILE_G4,
605 .platform = "ppc7450",
582 }, 606 },
583 { /* 7455 rev 2.0 */ 607 { /* 7455 rev 2.0 */
584 .pvr_mask = 0xffffffff, 608 .pvr_mask = 0xffffffff,
@@ -589,7 +613,10 @@ struct cpu_spec cpu_specs[] = {
589 .icache_bsize = 32, 613 .icache_bsize = 32,
590 .dcache_bsize = 32, 614 .dcache_bsize = 32,
591 .num_pmcs = 6, 615 .num_pmcs = 6,
592 .cpu_setup = __setup_cpu_745x 616 .cpu_setup = __setup_cpu_745x,
617 .oprofile_cpu_type = "ppc/7450",
618 .oprofile_type = PPC_OPROFILE_G4,
619 .platform = "ppc7450",
593 }, 620 },
594 { /* 7455 others */ 621 { /* 7455 others */
595 .pvr_mask = 0xffff0000, 622 .pvr_mask = 0xffff0000,
@@ -600,7 +627,10 @@ struct cpu_spec cpu_specs[] = {
600 .icache_bsize = 32, 627 .icache_bsize = 32,
601 .dcache_bsize = 32, 628 .dcache_bsize = 32,
602 .num_pmcs = 6, 629 .num_pmcs = 6,
603 .cpu_setup = __setup_cpu_745x 630 .cpu_setup = __setup_cpu_745x,
631 .oprofile_cpu_type = "ppc/7450",
632 .oprofile_type = PPC_OPROFILE_G4,
633 .platform = "ppc7450",
604 }, 634 },
605 { /* 7447/7457 Rev 1.0 */ 635 { /* 7447/7457 Rev 1.0 */
606 .pvr_mask = 0xffffffff, 636 .pvr_mask = 0xffffffff,
@@ -611,7 +641,10 @@ struct cpu_spec cpu_specs[] = {
611 .icache_bsize = 32, 641 .icache_bsize = 32,
612 .dcache_bsize = 32, 642 .dcache_bsize = 32,
613 .num_pmcs = 6, 643 .num_pmcs = 6,
614 .cpu_setup = __setup_cpu_745x 644 .cpu_setup = __setup_cpu_745x,
645 .oprofile_cpu_type = "ppc/7450",
646 .oprofile_type = PPC_OPROFILE_G4,
647 .platform = "ppc7450",
615 }, 648 },
616 { /* 7447/7457 Rev 1.1 */ 649 { /* 7447/7457 Rev 1.1 */
617 .pvr_mask = 0xffffffff, 650 .pvr_mask = 0xffffffff,
@@ -622,7 +655,10 @@ struct cpu_spec cpu_specs[] = {
622 .icache_bsize = 32, 655 .icache_bsize = 32,
623 .dcache_bsize = 32, 656 .dcache_bsize = 32,
624 .num_pmcs = 6, 657 .num_pmcs = 6,
625 .cpu_setup = __setup_cpu_745x 658 .cpu_setup = __setup_cpu_745x,
659 .oprofile_cpu_type = "ppc/7450",
660 .oprofile_type = PPC_OPROFILE_G4,
661 .platform = "ppc7450",
626 }, 662 },
627 { /* 7447/7457 Rev 1.2 and later */ 663 { /* 7447/7457 Rev 1.2 and later */
628 .pvr_mask = 0xffff0000, 664 .pvr_mask = 0xffff0000,
@@ -633,7 +669,10 @@ struct cpu_spec cpu_specs[] = {
633 .icache_bsize = 32, 669 .icache_bsize = 32,
634 .dcache_bsize = 32, 670 .dcache_bsize = 32,
635 .num_pmcs = 6, 671 .num_pmcs = 6,
636 .cpu_setup = __setup_cpu_745x 672 .cpu_setup = __setup_cpu_745x,
673 .oprofile_cpu_type = "ppc/7450",
674 .oprofile_type = PPC_OPROFILE_G4,
675 .platform = "ppc7450",
637 }, 676 },
638 { /* 7447A */ 677 { /* 7447A */
639 .pvr_mask = 0xffff0000, 678 .pvr_mask = 0xffff0000,
@@ -644,7 +683,10 @@ struct cpu_spec cpu_specs[] = {
644 .icache_bsize = 32, 683 .icache_bsize = 32,
645 .dcache_bsize = 32, 684 .dcache_bsize = 32,
646 .num_pmcs = 6, 685 .num_pmcs = 6,
647 .cpu_setup = __setup_cpu_745x 686 .cpu_setup = __setup_cpu_745x,
687 .oprofile_cpu_type = "ppc/7450",
688 .oprofile_type = PPC_OPROFILE_G4,
689 .platform = "ppc7450",
648 }, 690 },
649 { /* 7448 */ 691 { /* 7448 */
650 .pvr_mask = 0xffff0000, 692 .pvr_mask = 0xffff0000,
@@ -655,7 +697,10 @@ struct cpu_spec cpu_specs[] = {
655 .icache_bsize = 32, 697 .icache_bsize = 32,
656 .dcache_bsize = 32, 698 .dcache_bsize = 32,
657 .num_pmcs = 6, 699 .num_pmcs = 6,
658 .cpu_setup = __setup_cpu_745x 700 .cpu_setup = __setup_cpu_745x,
701 .oprofile_cpu_type = "ppc/7450",
702 .oprofile_type = PPC_OPROFILE_G4,
703 .platform = "ppc7450",
659 }, 704 },
660 { /* 82xx (8240, 8245, 8260 are all 603e cores) */ 705 { /* 82xx (8240, 8245, 8260 are all 603e cores) */
661 .pvr_mask = 0x7fff0000, 706 .pvr_mask = 0x7fff0000,
@@ -665,7 +710,8 @@ struct cpu_spec cpu_specs[] = {
665 .cpu_user_features = COMMON_USER, 710 .cpu_user_features = COMMON_USER,
666 .icache_bsize = 32, 711 .icache_bsize = 32,
667 .dcache_bsize = 32, 712 .dcache_bsize = 32,
668 .cpu_setup = __setup_cpu_603 713 .cpu_setup = __setup_cpu_603,
714 .platform = "ppc603",
669 }, 715 },
670 { /* All G2_LE (603e core, plus some) have the same pvr */ 716 { /* All G2_LE (603e core, plus some) have the same pvr */
671 .pvr_mask = 0x7fff0000, 717 .pvr_mask = 0x7fff0000,
@@ -675,7 +721,8 @@ struct cpu_spec cpu_specs[] = {
675 .cpu_user_features = COMMON_USER, 721 .cpu_user_features = COMMON_USER,
676 .icache_bsize = 32, 722 .icache_bsize = 32,
677 .dcache_bsize = 32, 723 .dcache_bsize = 32,
678 .cpu_setup = __setup_cpu_603 724 .cpu_setup = __setup_cpu_603,
725 .platform = "ppc603",
679 }, 726 },
680 { /* e300 (a 603e core, plus some) on 83xx */ 727 { /* e300 (a 603e core, plus some) on 83xx */
681 .pvr_mask = 0x7fff0000, 728 .pvr_mask = 0x7fff0000,
@@ -685,7 +732,8 @@ struct cpu_spec cpu_specs[] = {
685 .cpu_user_features = COMMON_USER, 732 .cpu_user_features = COMMON_USER,
686 .icache_bsize = 32, 733 .icache_bsize = 32,
687 .dcache_bsize = 32, 734 .dcache_bsize = 32,
688 .cpu_setup = __setup_cpu_603 735 .cpu_setup = __setup_cpu_603,
736 .platform = "ppc603",
689 }, 737 },
690 { /* default match, we assume split I/D cache & TB (non-601)... */ 738 { /* default match, we assume split I/D cache & TB (non-601)... */
691 .pvr_mask = 0x00000000, 739 .pvr_mask = 0x00000000,
@@ -695,6 +743,7 @@ struct cpu_spec cpu_specs[] = {
695 .cpu_user_features = COMMON_USER, 743 .cpu_user_features = COMMON_USER,
696 .icache_bsize = 32, 744 .icache_bsize = 32,
697 .dcache_bsize = 32, 745 .dcache_bsize = 32,
746 .platform = "ppc603",
698 }, 747 },
699#endif /* CLASSIC_PPC */ 748#endif /* CLASSIC_PPC */
700#ifdef CONFIG_8xx 749#ifdef CONFIG_8xx
@@ -708,6 +757,7 @@ struct cpu_spec cpu_specs[] = {
708 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 757 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
709 .icache_bsize = 16, 758 .icache_bsize = 16,
710 .dcache_bsize = 16, 759 .dcache_bsize = 16,
760 .platform = "ppc823",
711 }, 761 },
712#endif /* CONFIG_8xx */ 762#endif /* CONFIG_8xx */
713#ifdef CONFIG_40x 763#ifdef CONFIG_40x
@@ -719,6 +769,7 @@ struct cpu_spec cpu_specs[] = {
719 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 769 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
720 .icache_bsize = 16, 770 .icache_bsize = 16,
721 .dcache_bsize = 16, 771 .dcache_bsize = 16,
772 .platform = "ppc403",
722 }, 773 },
723 { /* 403GCX */ 774 { /* 403GCX */
724 .pvr_mask = 0xffffff00, 775 .pvr_mask = 0xffffff00,
@@ -729,6 +780,7 @@ struct cpu_spec cpu_specs[] = {
729 PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB, 780 PPC_FEATURE_HAS_MMU | PPC_FEATURE_NO_TB,
730 .icache_bsize = 16, 781 .icache_bsize = 16,
731 .dcache_bsize = 16, 782 .dcache_bsize = 16,
783 .platform = "ppc403",
732 }, 784 },
733 { /* 403G ?? */ 785 { /* 403G ?? */
734 .pvr_mask = 0xffff0000, 786 .pvr_mask = 0xffff0000,
@@ -738,6 +790,7 @@ struct cpu_spec cpu_specs[] = {
738 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 790 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
739 .icache_bsize = 16, 791 .icache_bsize = 16,
740 .dcache_bsize = 16, 792 .dcache_bsize = 16,
793 .platform = "ppc403",
741 }, 794 },
742 { /* 405GP */ 795 { /* 405GP */
743 .pvr_mask = 0xffff0000, 796 .pvr_mask = 0xffff0000,
@@ -748,6 +801,7 @@ struct cpu_spec cpu_specs[] = {
748 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 801 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
749 .icache_bsize = 32, 802 .icache_bsize = 32,
750 .dcache_bsize = 32, 803 .dcache_bsize = 32,
804 .platform = "ppc405",
751 }, 805 },
752 { /* STB 03xxx */ 806 { /* STB 03xxx */
753 .pvr_mask = 0xffff0000, 807 .pvr_mask = 0xffff0000,
@@ -758,6 +812,7 @@ struct cpu_spec cpu_specs[] = {
758 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 812 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
759 .icache_bsize = 32, 813 .icache_bsize = 32,
760 .dcache_bsize = 32, 814 .dcache_bsize = 32,
815 .platform = "ppc405",
761 }, 816 },
762 { /* STB 04xxx */ 817 { /* STB 04xxx */
763 .pvr_mask = 0xffff0000, 818 .pvr_mask = 0xffff0000,
@@ -768,6 +823,7 @@ struct cpu_spec cpu_specs[] = {
768 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 823 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
769 .icache_bsize = 32, 824 .icache_bsize = 32,
770 .dcache_bsize = 32, 825 .dcache_bsize = 32,
826 .platform = "ppc405",
771 }, 827 },
772 { /* NP405L */ 828 { /* NP405L */
773 .pvr_mask = 0xffff0000, 829 .pvr_mask = 0xffff0000,
@@ -778,6 +834,7 @@ struct cpu_spec cpu_specs[] = {
778 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 834 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
779 .icache_bsize = 32, 835 .icache_bsize = 32,
780 .dcache_bsize = 32, 836 .dcache_bsize = 32,
837 .platform = "ppc405",
781 }, 838 },
782 { /* NP4GS3 */ 839 { /* NP4GS3 */
783 .pvr_mask = 0xffff0000, 840 .pvr_mask = 0xffff0000,
@@ -788,6 +845,7 @@ struct cpu_spec cpu_specs[] = {
788 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 845 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
789 .icache_bsize = 32, 846 .icache_bsize = 32,
790 .dcache_bsize = 32, 847 .dcache_bsize = 32,
848 .platform = "ppc405",
791 }, 849 },
792 { /* NP405H */ 850 { /* NP405H */
793 .pvr_mask = 0xffff0000, 851 .pvr_mask = 0xffff0000,
@@ -798,6 +856,7 @@ struct cpu_spec cpu_specs[] = {
798 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 856 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
799 .icache_bsize = 32, 857 .icache_bsize = 32,
800 .dcache_bsize = 32, 858 .dcache_bsize = 32,
859 .platform = "ppc405",
801 }, 860 },
802 { /* 405GPr */ 861 { /* 405GPr */
803 .pvr_mask = 0xffff0000, 862 .pvr_mask = 0xffff0000,
@@ -808,6 +867,7 @@ struct cpu_spec cpu_specs[] = {
808 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 867 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
809 .icache_bsize = 32, 868 .icache_bsize = 32,
810 .dcache_bsize = 32, 869 .dcache_bsize = 32,
870 .platform = "ppc405",
811 }, 871 },
812 { /* STBx25xx */ 872 { /* STBx25xx */
813 .pvr_mask = 0xffff0000, 873 .pvr_mask = 0xffff0000,
@@ -818,6 +878,7 @@ struct cpu_spec cpu_specs[] = {
818 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 878 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
819 .icache_bsize = 32, 879 .icache_bsize = 32,
820 .dcache_bsize = 32, 880 .dcache_bsize = 32,
881 .platform = "ppc405",
821 }, 882 },
822 { /* 405LP */ 883 { /* 405LP */
823 .pvr_mask = 0xffff0000, 884 .pvr_mask = 0xffff0000,
@@ -827,6 +888,7 @@ struct cpu_spec cpu_specs[] = {
827 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 888 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU,
828 .icache_bsize = 32, 889 .icache_bsize = 32,
829 .dcache_bsize = 32, 890 .dcache_bsize = 32,
891 .platform = "ppc405",
830 }, 892 },
831 { /* Xilinx Virtex-II Pro */ 893 { /* Xilinx Virtex-II Pro */
832 .pvr_mask = 0xffff0000, 894 .pvr_mask = 0xffff0000,
@@ -837,6 +899,7 @@ struct cpu_spec cpu_specs[] = {
837 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 899 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
838 .icache_bsize = 32, 900 .icache_bsize = 32,
839 .dcache_bsize = 32, 901 .dcache_bsize = 32,
902 .platform = "ppc405",
840 }, 903 },
841 { /* 405EP */ 904 { /* 405EP */
842 .pvr_mask = 0xffff0000, 905 .pvr_mask = 0xffff0000,
@@ -847,6 +910,7 @@ struct cpu_spec cpu_specs[] = {
847 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 910 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
848 .icache_bsize = 32, 911 .icache_bsize = 32,
849 .dcache_bsize = 32, 912 .dcache_bsize = 32,
913 .platform = "ppc405",
850 }, 914 },
851 915
852#endif /* CONFIG_40x */ 916#endif /* CONFIG_40x */
@@ -856,81 +920,90 @@ struct cpu_spec cpu_specs[] = {
856 .pvr_value = 0x40000850, 920 .pvr_value = 0x40000850,
857 .cpu_name = "440EP Rev. A", 921 .cpu_name = "440EP Rev. A",
858 .cpu_features = CPU_FTRS_44X, 922 .cpu_features = CPU_FTRS_44X,
859 .cpu_user_features = COMMON_USER, /* 440EP has an FPU */ 923 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
860 .icache_bsize = 32, 924 .icache_bsize = 32,
861 .dcache_bsize = 32, 925 .dcache_bsize = 32,
926 .platform = "ppc440",
862 }, 927 },
863 { 928 {
864 .pvr_mask = 0xf0000fff, 929 .pvr_mask = 0xf0000fff,
865 .pvr_value = 0x400008d3, 930 .pvr_value = 0x400008d3,
866 .cpu_name = "440EP Rev. B", 931 .cpu_name = "440EP Rev. B",
867 .cpu_features = CPU_FTRS_44X, 932 .cpu_features = CPU_FTRS_44X,
868 .cpu_user_features = COMMON_USER, /* 440EP has an FPU */ 933 .cpu_user_features = COMMON_USER_BOOKE | PPC_FEATURE_HAS_FPU,
869 .icache_bsize = 32, 934 .icache_bsize = 32,
870 .dcache_bsize = 32, 935 .dcache_bsize = 32,
936 .platform = "ppc440",
871 }, 937 },
872 { /* 440GP Rev. B */ 938 { /* 440GP Rev. B */
873 .pvr_mask = 0xf0000fff, 939 .pvr_mask = 0xf0000fff,
874 .pvr_value = 0x40000440, 940 .pvr_value = 0x40000440,
875 .cpu_name = "440GP Rev. B", 941 .cpu_name = "440GP Rev. B",
876 .cpu_features = CPU_FTRS_44X, 942 .cpu_features = CPU_FTRS_44X,
877 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 943 .cpu_user_features = COMMON_USER_BOOKE,
878 .icache_bsize = 32, 944 .icache_bsize = 32,
879 .dcache_bsize = 32, 945 .dcache_bsize = 32,
946 .platform = "ppc440gp",
880 }, 947 },
881 { /* 440GP Rev. C */ 948 { /* 440GP Rev. C */
882 .pvr_mask = 0xf0000fff, 949 .pvr_mask = 0xf0000fff,
883 .pvr_value = 0x40000481, 950 .pvr_value = 0x40000481,
884 .cpu_name = "440GP Rev. C", 951 .cpu_name = "440GP Rev. C",
885 .cpu_features = CPU_FTRS_44X, 952 .cpu_features = CPU_FTRS_44X,
886 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 953 .cpu_user_features = COMMON_USER_BOOKE,
887 .icache_bsize = 32, 954 .icache_bsize = 32,
888 .dcache_bsize = 32, 955 .dcache_bsize = 32,
956 .platform = "ppc440gp",
889 }, 957 },
890 { /* 440GX Rev. A */ 958 { /* 440GX Rev. A */
891 .pvr_mask = 0xf0000fff, 959 .pvr_mask = 0xf0000fff,
892 .pvr_value = 0x50000850, 960 .pvr_value = 0x50000850,
893 .cpu_name = "440GX Rev. A", 961 .cpu_name = "440GX Rev. A",
894 .cpu_features = CPU_FTRS_44X, 962 .cpu_features = CPU_FTRS_44X,
895 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 963 .cpu_user_features = COMMON_USER_BOOKE,
896 .icache_bsize = 32, 964 .icache_bsize = 32,
897 .dcache_bsize = 32, 965 .dcache_bsize = 32,
966 .platform = "ppc440",
898 }, 967 },
899 { /* 440GX Rev. B */ 968 { /* 440GX Rev. B */
900 .pvr_mask = 0xf0000fff, 969 .pvr_mask = 0xf0000fff,
901 .pvr_value = 0x50000851, 970 .pvr_value = 0x50000851,
902 .cpu_name = "440GX Rev. B", 971 .cpu_name = "440GX Rev. B",
903 .cpu_features = CPU_FTRS_44X, 972 .cpu_features = CPU_FTRS_44X,
904 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 973 .cpu_user_features = COMMON_USER_BOOKE,
905 .icache_bsize = 32, 974 .icache_bsize = 32,
906 .dcache_bsize = 32, 975 .dcache_bsize = 32,
976 .platform = "ppc440",
907 }, 977 },
908 { /* 440GX Rev. C */ 978 { /* 440GX Rev. C */
909 .pvr_mask = 0xf0000fff, 979 .pvr_mask = 0xf0000fff,
910 .pvr_value = 0x50000892, 980 .pvr_value = 0x50000892,
911 .cpu_name = "440GX Rev. C", 981 .cpu_name = "440GX Rev. C",
912 .cpu_features = CPU_FTRS_44X, 982 .cpu_features = CPU_FTRS_44X,
913 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 983 .cpu_user_features = COMMON_USER_BOOKE,
914 .icache_bsize = 32, 984 .icache_bsize = 32,
915 .dcache_bsize = 32, 985 .dcache_bsize = 32,
986 .platform = "ppc440",
916 }, 987 },
917 { /* 440GX Rev. F */ 988 { /* 440GX Rev. F */
918 .pvr_mask = 0xf0000fff, 989 .pvr_mask = 0xf0000fff,
919 .pvr_value = 0x50000894, 990 .pvr_value = 0x50000894,
920 .cpu_name = "440GX Rev. F", 991 .cpu_name = "440GX Rev. F",
921 .cpu_features = CPU_FTRS_44X, 992 .cpu_features = CPU_FTRS_44X,
922 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 993 .cpu_user_features = COMMON_USER_BOOKE,
923 .icache_bsize = 32, 994 .icache_bsize = 32,
924 .dcache_bsize = 32, 995 .dcache_bsize = 32,
996 .platform = "ppc440",
925 }, 997 },
926 { /* 440SP Rev. A */ 998 { /* 440SP Rev. A */
927 .pvr_mask = 0xff000fff, 999 .pvr_mask = 0xff000fff,
928 .pvr_value = 0x53000891, 1000 .pvr_value = 0x53000891,
929 .cpu_name = "440SP Rev. A", 1001 .cpu_name = "440SP Rev. A",
930 .cpu_features = CPU_FTRS_44X, 1002 .cpu_features = CPU_FTRS_44X,
931 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 1003 .cpu_user_features = COMMON_USER_BOOKE,
932 .icache_bsize = 32, 1004 .icache_bsize = 32,
933 .dcache_bsize = 32, 1005 .dcache_bsize = 32,
1006 .platform = "ppc440",
934 }, 1007 },
935 { /* 440SPe Rev. A */ 1008 { /* 440SPe Rev. A */
936 .pvr_mask = 0xff000fff, 1009 .pvr_mask = 0xff000fff,
@@ -938,9 +1011,10 @@ struct cpu_spec cpu_specs[] = {
938 .cpu_name = "440SPe Rev. A", 1011 .cpu_name = "440SPe Rev. A",
939 .cpu_features = CPU_FTR_SPLIT_ID_CACHE | 1012 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
940 CPU_FTR_USE_TB, 1013 CPU_FTR_USE_TB,
941 .cpu_user_features = PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU, 1014 .cpu_user_features = COMMON_USER_BOOKE,
942 .icache_bsize = 32, 1015 .icache_bsize = 32,
943 .dcache_bsize = 32, 1016 .dcache_bsize = 32,
1017 .platform = "ppc440",
944 }, 1018 },
945#endif /* CONFIG_44x */ 1019#endif /* CONFIG_44x */
946#ifdef CONFIG_FSL_BOOKE 1020#ifdef CONFIG_FSL_BOOKE
@@ -950,10 +1024,11 @@ struct cpu_spec cpu_specs[] = {
950 .cpu_name = "e200z5", 1024 .cpu_name = "e200z5",
951 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */ 1025 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
952 .cpu_features = CPU_FTRS_E200, 1026 .cpu_features = CPU_FTRS_E200,
953 .cpu_user_features = PPC_FEATURE_32 | 1027 .cpu_user_features = COMMON_USER_BOOKE |
954 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_EFP_SINGLE | 1028 PPC_FEATURE_HAS_EFP_SINGLE |
955 PPC_FEATURE_UNIFIED_CACHE, 1029 PPC_FEATURE_UNIFIED_CACHE,
956 .dcache_bsize = 32, 1030 .dcache_bsize = 32,
1031 .platform = "ppc5554",
957 }, 1032 },
958 { /* e200z6 */ 1033 { /* e200z6 */
959 .pvr_mask = 0xfff00000, 1034 .pvr_mask = 0xfff00000,
@@ -961,11 +1036,12 @@ struct cpu_spec cpu_specs[] = {
961 .cpu_name = "e200z6", 1036 .cpu_name = "e200z6",
962 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */ 1037 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
963 .cpu_features = CPU_FTRS_E200, 1038 .cpu_features = CPU_FTRS_E200,
964 .cpu_user_features = PPC_FEATURE_32 | 1039 .cpu_user_features = COMMON_USER_BOOKE |
965 PPC_FEATURE_HAS_MMU | PPC_FEATURE_SPE_COMP | 1040 PPC_FEATURE_SPE_COMP |
966 PPC_FEATURE_HAS_EFP_SINGLE | 1041 PPC_FEATURE_HAS_EFP_SINGLE |
967 PPC_FEATURE_UNIFIED_CACHE, 1042 PPC_FEATURE_UNIFIED_CACHE,
968 .dcache_bsize = 32, 1043 .dcache_bsize = 32,
1044 .platform = "ppc5554",
969 }, 1045 },
970 { /* e500 */ 1046 { /* e500 */
971 .pvr_mask = 0xffff0000, 1047 .pvr_mask = 0xffff0000,
@@ -973,12 +1049,15 @@ struct cpu_spec cpu_specs[] = {
973 .cpu_name = "e500", 1049 .cpu_name = "e500",
974 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */ 1050 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
975 .cpu_features = CPU_FTRS_E500, 1051 .cpu_features = CPU_FTRS_E500,
976 .cpu_user_features = PPC_FEATURE_32 | 1052 .cpu_user_features = COMMON_USER_BOOKE |
977 PPC_FEATURE_HAS_MMU | PPC_FEATURE_SPE_COMP | 1053 PPC_FEATURE_SPE_COMP |
978 PPC_FEATURE_HAS_EFP_SINGLE, 1054 PPC_FEATURE_HAS_EFP_SINGLE,
979 .icache_bsize = 32, 1055 .icache_bsize = 32,
980 .dcache_bsize = 32, 1056 .dcache_bsize = 32,
981 .num_pmcs = 4, 1057 .num_pmcs = 4,
1058 .oprofile_cpu_type = "ppc/e500",
1059 .oprofile_type = PPC_OPROFILE_BOOKE,
1060 .platform = "ppc8540",
982 }, 1061 },
983 { /* e500v2 */ 1062 { /* e500v2 */
984 .pvr_mask = 0xffff0000, 1063 .pvr_mask = 0xffff0000,
@@ -986,12 +1065,16 @@ struct cpu_spec cpu_specs[] = {
986 .cpu_name = "e500v2", 1065 .cpu_name = "e500v2",
987 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */ 1066 /* xxx - galak: add CPU_FTR_MAYBE_CAN_DOZE */
988 .cpu_features = CPU_FTRS_E500_2, 1067 .cpu_features = CPU_FTRS_E500_2,
989 .cpu_user_features = PPC_FEATURE_32 | 1068 .cpu_user_features = COMMON_USER_BOOKE |
990 PPC_FEATURE_HAS_MMU | PPC_FEATURE_SPE_COMP | 1069 PPC_FEATURE_SPE_COMP |
991 PPC_FEATURE_HAS_EFP_SINGLE | PPC_FEATURE_HAS_EFP_DOUBLE, 1070 PPC_FEATURE_HAS_EFP_SINGLE |
1071 PPC_FEATURE_HAS_EFP_DOUBLE,
992 .icache_bsize = 32, 1072 .icache_bsize = 32,
993 .dcache_bsize = 32, 1073 .dcache_bsize = 32,
994 .num_pmcs = 4, 1074 .num_pmcs = 4,
1075 .oprofile_cpu_type = "ppc/e500",
1076 .oprofile_type = PPC_OPROFILE_BOOKE,
1077 .platform = "ppc8548",
995 }, 1078 },
996#endif 1079#endif
997#if !CLASSIC_PPC 1080#if !CLASSIC_PPC
@@ -1003,6 +1086,7 @@ struct cpu_spec cpu_specs[] = {
1003 .cpu_user_features = PPC_FEATURE_32, 1086 .cpu_user_features = PPC_FEATURE_32,
1004 .icache_bsize = 32, 1087 .icache_bsize = 32,
1005 .dcache_bsize = 32, 1088 .dcache_bsize = 32,
1089 .platform = "powerpc",
1006 } 1090 }
1007#endif /* !CLASSIC_PPC */ 1091#endif /* !CLASSIC_PPC */
1008#endif /* CONFIG_PPC32 */ 1092#endif /* CONFIG_PPC32 */
diff --git a/arch/powerpc/kernel/crash.c b/arch/powerpc/kernel/crash.c
new file mode 100644
index 000000000000..8c21d378f5d2
--- /dev/null
+++ b/arch/powerpc/kernel/crash.c
@@ -0,0 +1,197 @@
1/*
2 * Architecture specific (PPC64) functions for kexec based crash dumps.
3 *
4 * Copyright (C) 2005, IBM Corp.
5 *
6 * Created by: Haren Myneni
7 *
8 * This source code is licensed under the GNU General Public License,
9 * Version 2. See the file COPYING for more details.
10 *
11 */
12
13#undef DEBUG
14
15#include <linux/kernel.h>
16#include <linux/smp.h>
17#include <linux/reboot.h>
18#include <linux/kexec.h>
19#include <linux/bootmem.h>
20#include <linux/crash_dump.h>
21#include <linux/delay.h>
22#include <linux/elf.h>
23#include <linux/elfcore.h>
24#include <linux/init.h>
25#include <linux/types.h>
26
27#include <asm/processor.h>
28#include <asm/machdep.h>
29#include <asm/kdump.h>
30#include <asm/lmb.h>
31#include <asm/firmware.h>
32#include <asm/smp.h>
33
34#ifdef DEBUG
35#include <asm/udbg.h>
36#define DBG(fmt...) udbg_printf(fmt)
37#else
38#define DBG(fmt...)
39#endif
40
41/* This keeps a track of which one is crashing cpu. */
42int crashing_cpu = -1;
43
44static u32 *append_elf_note(u32 *buf, char *name, unsigned type, void *data,
45 size_t data_len)
46{
47 struct elf_note note;
48
49 note.n_namesz = strlen(name) + 1;
50 note.n_descsz = data_len;
51 note.n_type = type;
52 memcpy(buf, &note, sizeof(note));
53 buf += (sizeof(note) +3)/4;
54 memcpy(buf, name, note.n_namesz);
55 buf += (note.n_namesz + 3)/4;
56 memcpy(buf, data, note.n_descsz);
57 buf += (note.n_descsz + 3)/4;
58
59 return buf;
60}
61
62static void final_note(u32 *buf)
63{
64 struct elf_note note;
65
66 note.n_namesz = 0;
67 note.n_descsz = 0;
68 note.n_type = 0;
69 memcpy(buf, &note, sizeof(note));
70}
71
72static void crash_save_this_cpu(struct pt_regs *regs, int cpu)
73{
74 struct elf_prstatus prstatus;
75 u32 *buf;
76
77 if ((cpu < 0) || (cpu >= NR_CPUS))
78 return;
79
80 /* Using ELF notes here is opportunistic.
81 * I need a well defined structure format
82 * for the data I pass, and I need tags
83 * on the data to indicate what information I have
84 * squirrelled away. ELF notes happen to provide
85 * all of that that no need to invent something new.
86 */
87 buf = (u32*)per_cpu_ptr(crash_notes, cpu);
88 if (!buf)
89 return;
90
91 memset(&prstatus, 0, sizeof(prstatus));
92 prstatus.pr_pid = current->pid;
93 elf_core_copy_regs(&prstatus.pr_reg, regs);
94 buf = append_elf_note(buf, "CORE", NT_PRSTATUS, &prstatus,
95 sizeof(prstatus));
96 final_note(buf);
97}
98
99#ifdef CONFIG_SMP
100static atomic_t waiting_for_crash_ipi;
101
102void crash_ipi_callback(struct pt_regs *regs)
103{
104 int cpu = smp_processor_id();
105
106 if (cpu == crashing_cpu)
107 return;
108
109 if (!cpu_online(cpu))
110 return;
111
112 if (ppc_md.kexec_cpu_down)
113 ppc_md.kexec_cpu_down(1, 1);
114
115 local_irq_disable();
116
117 crash_save_this_cpu(regs, cpu);
118 atomic_dec(&waiting_for_crash_ipi);
119 kexec_smp_wait();
120 /* NOTREACHED */
121}
122
123static void crash_kexec_prepare_cpus(void)
124{
125 unsigned int msecs;
126
127 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
128
129 crash_send_ipi(crash_ipi_callback);
130 smp_wmb();
131
132 /*
133 * FIXME: Until we will have the way to stop other CPUSs reliabally,
134 * the crash CPU will send an IPI and wait for other CPUs to
135 * respond. If not, proceed the kexec boot even though we failed to
136 * capture other CPU states.
137 */
138 msecs = 1000000;
139 while ((atomic_read(&waiting_for_crash_ipi) > 0) && (--msecs > 0)) {
140 barrier();
141 mdelay(1);
142 }
143
144 /* Would it be better to replace the trap vector here? */
145
146 /*
147 * FIXME: In case if we do not get all CPUs, one possibility: ask the
148 * user to do soft reset such that we get all.
149 * IPI handler is already set by the panic cpu initially. Therefore,
150 * all cpus could invoke this handler from die() and the panic CPU
151 * will call machine_kexec() directly from this handler to do
152 * kexec boot.
153 */
154 if (atomic_read(&waiting_for_crash_ipi))
155 printk(KERN_ALERT "done waiting: %d cpus not responding\n",
156 atomic_read(&waiting_for_crash_ipi));
157 /* Leave the IPI callback set */
158}
159#else
160static void crash_kexec_prepare_cpus(void)
161{
162 /*
163 * move the secondarys to us so that we can copy
164 * the new kernel 0-0x100 safely
165 *
166 * do this if kexec in setup.c ?
167 */
168 smp_release_cpus();
169}
170
171#endif
172
173void default_machine_crash_shutdown(struct pt_regs *regs)
174{
175 /*
176 * This function is only called after the system
177 * has paniced or is otherwise in a critical state.
178 * The minimum amount of code to allow a kexec'd kernel
179 * to run successfully needs to happen here.
180 *
181 * In practice this means stopping other cpus in
182 * an SMP system.
183 * The kernel is broken so disable interrupts.
184 */
185 local_irq_disable();
186
187 if (ppc_md.kexec_cpu_down)
188 ppc_md.kexec_cpu_down(1, 0);
189
190 /*
191 * Make a note of crashing cpu. Will be used in machine_kexec
192 * such that another IPI will not be sent.
193 */
194 crashing_cpu = smp_processor_id();
195 crash_kexec_prepare_cpus();
196 crash_save_this_cpu(regs, crashing_cpu);
197}
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
new file mode 100644
index 000000000000..211d72653ea6
--- /dev/null
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -0,0 +1,111 @@
1/*
2 * Routines for doing kexec-based kdump.
3 *
4 * Copyright (C) 2005, IBM Corp.
5 *
6 * Created by: Michael Ellerman
7 *
8 * This source code is licensed under the GNU General Public License,
9 * Version 2. See the file COPYING for more details.
10 */
11
12#undef DEBUG
13
14#include <linux/crash_dump.h>
15#include <linux/bootmem.h>
16#include <asm/kdump.h>
17#include <asm/lmb.h>
18#include <asm/firmware.h>
19#include <asm/uaccess.h>
20
21#ifdef DEBUG
22#include <asm/udbg.h>
23#define DBG(fmt...) udbg_printf(fmt)
24#else
25#define DBG(fmt...)
26#endif
27
28static void __init create_trampoline(unsigned long addr)
29{
30 /* The maximum range of a single instruction branch, is the current
31 * instruction's address + (32 MB - 4) bytes. For the trampoline we
32 * need to branch to current address + 32 MB. So we insert a nop at
33 * the trampoline address, then the next instruction (+ 4 bytes)
34 * does a branch to (32 MB - 4). The net effect is that when we
35 * branch to "addr" we jump to ("addr" + 32 MB). Although it requires
36 * two instructions it doesn't require any registers.
37 */
38 create_instruction(addr, 0x60000000); /* nop */
39 create_branch(addr + 4, addr + PHYSICAL_START, 0);
40}
41
42void __init kdump_setup(void)
43{
44 unsigned long i;
45
46 DBG(" -> kdump_setup()\n");
47
48 for (i = KDUMP_TRAMPOLINE_START; i < KDUMP_TRAMPOLINE_END; i += 8) {
49 create_trampoline(i);
50 }
51
52 create_trampoline(__pa(system_reset_fwnmi) - PHYSICAL_START);
53 create_trampoline(__pa(machine_check_fwnmi) - PHYSICAL_START);
54
55 DBG(" <- kdump_setup()\n");
56}
57
58#ifdef CONFIG_PROC_VMCORE
59static int __init parse_elfcorehdr(char *p)
60{
61 if (p)
62 elfcorehdr_addr = memparse(p, &p);
63
64 return 0;
65}
66__setup("elfcorehdr=", parse_elfcorehdr);
67#endif
68
69static int __init parse_savemaxmem(char *p)
70{
71 if (p)
72 saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT) - 1;
73
74 return 0;
75}
76__setup("savemaxmem=", parse_savemaxmem);
77
78/*
79 * copy_oldmem_page - copy one page from "oldmem"
80 * @pfn: page frame number to be copied
81 * @buf: target memory address for the copy; this can be in kernel address
82 * space or user address space (see @userbuf)
83 * @csize: number of bytes to copy
84 * @offset: offset in bytes into the page (based on pfn) to begin the copy
85 * @userbuf: if set, @buf is in user address space, use copy_to_user(),
86 * otherwise @buf is in kernel address space, use memcpy().
87 *
88 * Copy a page from "oldmem". For this page, there is no pte mapped
89 * in the current kernel. We stitch up a pte, similar to kmap_atomic.
90 */
91ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
92 size_t csize, unsigned long offset, int userbuf)
93{
94 void *vaddr;
95
96 if (!csize)
97 return 0;
98
99 vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
100
101 if (userbuf) {
102 if (copy_to_user((char __user *)buf, (vaddr + offset), csize)) {
103 iounmap(vaddr);
104 return -EFAULT;
105 }
106 } else
107 memcpy(buf, (vaddr + offset), csize);
108
109 iounmap(vaddr);
110 return csize;
111}
diff --git a/arch/powerpc/kernel/dma_64.c b/arch/powerpc/kernel/dma_64.c
index 7c3419656ccc..36aaa7663f02 100644
--- a/arch/powerpc/kernel/dma_64.c
+++ b/arch/powerpc/kernel/dma_64.c
@@ -10,6 +10,7 @@
10/* Include the busses we support */ 10/* Include the busses we support */
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <asm/vio.h> 12#include <asm/vio.h>
13#include <asm/ibmebus.h>
13#include <asm/scatterlist.h> 14#include <asm/scatterlist.h>
14#include <asm/bug.h> 15#include <asm/bug.h>
15 16
@@ -23,6 +24,10 @@ static struct dma_mapping_ops *get_dma_ops(struct device *dev)
23 if (dev->bus == &vio_bus_type) 24 if (dev->bus == &vio_bus_type)
24 return &vio_dma_ops; 25 return &vio_dma_ops;
25#endif 26#endif
27#ifdef CONFIG_IBMEBUS
28 if (dev->bus == &ibmebus_bus_type)
29 return &ibmebus_dma_ops;
30#endif
26 return NULL; 31 return NULL;
27} 32}
28 33
@@ -47,6 +52,10 @@ int dma_set_mask(struct device *dev, u64 dma_mask)
47 if (dev->bus == &vio_bus_type) 52 if (dev->bus == &vio_bus_type)
48 return -EIO; 53 return -EIO;
49#endif /* CONFIG_IBMVIO */ 54#endif /* CONFIG_IBMVIO */
55#ifdef CONFIG_IBMEBUS
56 if (dev->bus == &ibmebus_bus_type)
57 return -EIO;
58#endif
50 BUG(); 59 BUG();
51 return 0; 60 return 0;
52} 61}
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 2e99ae41723c..f20a67261ec7 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -200,8 +200,6 @@ _GLOBAL(DoSyscall)
200 bl do_show_syscall 200 bl do_show_syscall
201#endif /* SHOW_SYSCALLS */ 201#endif /* SHOW_SYSCALLS */
202 rlwinm r10,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */ 202 rlwinm r10,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
203 li r11,0
204 stb r11,TI_SC_NOERR(r10)
205 lwz r11,TI_FLAGS(r10) 203 lwz r11,TI_FLAGS(r10)
206 andi. r11,r11,_TIF_SYSCALL_T_OR_A 204 andi. r11,r11,_TIF_SYSCALL_T_OR_A
207 bne- syscall_dotrace 205 bne- syscall_dotrace
@@ -222,25 +220,21 @@ ret_from_syscall:
222 bl do_show_syscall_exit 220 bl do_show_syscall_exit
223#endif 221#endif
224 mr r6,r3 222 mr r6,r3
225 li r11,-_LAST_ERRNO
226 cmplw 0,r3,r11
227 rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */ 223 rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
228 blt+ 30f
229 lbz r11,TI_SC_NOERR(r12)
230 cmpwi r11,0
231 bne 30f
232 neg r3,r3
233 lwz r10,_CCR(r1) /* Set SO bit in CR */
234 oris r10,r10,0x1000
235 stw r10,_CCR(r1)
236
237 /* disable interrupts so current_thread_info()->flags can't change */ 224 /* disable interrupts so current_thread_info()->flags can't change */
23830: LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */ 225 LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
239 SYNC 226 SYNC
240 MTMSRD(r10) 227 MTMSRD(r10)
241 lwz r9,TI_FLAGS(r12) 228 lwz r9,TI_FLAGS(r12)
242 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SIGPENDING|_TIF_NEED_RESCHED) 229 li r8,-_LAST_ERRNO
230 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL|_TIF_RESTORE_SIGMASK)
243 bne- syscall_exit_work 231 bne- syscall_exit_work
232 cmplw 0,r3,r8
233 blt+ syscall_exit_cont
234 lwz r11,_CCR(r1) /* Load CR */
235 neg r3,r3
236 oris r11,r11,0x1000 /* Set SO bit in CR */
237 stw r11,_CCR(r1)
244syscall_exit_cont: 238syscall_exit_cont:
245#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 239#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
246 /* If the process has its own DBCR0 value, load it up. The single 240 /* If the process has its own DBCR0 value, load it up. The single
@@ -292,46 +286,113 @@ syscall_dotrace:
292 b syscall_dotrace_cont 286 b syscall_dotrace_cont
293 287
294syscall_exit_work: 288syscall_exit_work:
295 stw r6,RESULT(r1) /* Save result */ 289 andi. r0,r9,_TIF_RESTOREALL
290 bne- 2f
291 cmplw 0,r3,r8
292 blt+ 1f
293 andi. r0,r9,_TIF_NOERROR
294 bne- 1f
295 lwz r11,_CCR(r1) /* Load CR */
296 neg r3,r3
297 oris r11,r11,0x1000 /* Set SO bit in CR */
298 stw r11,_CCR(r1)
299
3001: stw r6,RESULT(r1) /* Save result */
296 stw r3,GPR3(r1) /* Update return value */ 301 stw r3,GPR3(r1) /* Update return value */
297 andi. r0,r9,_TIF_SYSCALL_T_OR_A 3022: andi. r0,r9,(_TIF_PERSYSCALL_MASK)
298 beq 5f 303 beq 4f
299 ori r10,r10,MSR_EE 304
300 SYNC 305 /* Clear per-syscall TIF flags if any are set, but _leave_
301 MTMSRD(r10) /* re-enable interrupts */ 306 _TIF_SAVE_NVGPRS set in r9 since we haven't dealt with that
307 yet. */
308
309 li r11,_TIF_PERSYSCALL_MASK
310 addi r12,r12,TI_FLAGS
3113: lwarx r8,0,r12
312 andc r8,r8,r11
313#ifdef CONFIG_IBM405_ERR77
314 dcbt 0,r12
315#endif
316 stwcx. r8,0,r12
317 bne- 3b
318 subi r12,r12,TI_FLAGS
319
3204: /* Anything which requires enabling interrupts? */
321 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SAVE_NVGPRS)
322 beq 7f
323
324 /* Save NVGPRS if they're not saved already */
302 lwz r4,_TRAP(r1) 325 lwz r4,_TRAP(r1)
303 andi. r4,r4,1 326 andi. r4,r4,1
304 beq 4f 327 beq 5f
305 SAVE_NVGPRS(r1) 328 SAVE_NVGPRS(r1)
306 li r4,0xc00 329 li r4,0xc00
307 stw r4,_TRAP(r1) 330 stw r4,_TRAP(r1)
3084: 331
332 /* Re-enable interrupts */
3335: ori r10,r10,MSR_EE
334 SYNC
335 MTMSRD(r10)
336
337 andi. r0,r9,_TIF_SAVE_NVGPRS
338 bne save_user_nvgprs
339
340save_user_nvgprs_cont:
341 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP)
342 beq 7f
343
309 addi r3,r1,STACK_FRAME_OVERHEAD 344 addi r3,r1,STACK_FRAME_OVERHEAD
310 bl do_syscall_trace_leave 345 bl do_syscall_trace_leave
311 REST_NVGPRS(r1) 346 REST_NVGPRS(r1)
3122: 347
313 lwz r3,GPR3(r1) 3486: lwz r3,GPR3(r1)
314 LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */ 349 LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
315 SYNC 350 SYNC
316 MTMSRD(r10) /* disable interrupts again */ 351 MTMSRD(r10) /* disable interrupts again */
317 rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */ 352 rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
318 lwz r9,TI_FLAGS(r12) 353 lwz r9,TI_FLAGS(r12)
3195: 3547:
320 andi. r0,r9,_TIF_NEED_RESCHED 355 andi. r0,r9,_TIF_NEED_RESCHED
321 bne 1f 356 bne 8f
322 lwz r5,_MSR(r1) 357 lwz r5,_MSR(r1)
323 andi. r5,r5,MSR_PR 358 andi. r5,r5,MSR_PR
324 beq syscall_exit_cont 359 beq ret_from_except
325 andi. r0,r9,_TIF_SIGPENDING 360 andi. r0,r9,_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK
326 beq syscall_exit_cont 361 beq ret_from_except
327 b do_user_signal 362 b do_user_signal
3281: 3638:
329 ori r10,r10,MSR_EE 364 ori r10,r10,MSR_EE
330 SYNC 365 SYNC
331 MTMSRD(r10) /* re-enable interrupts */ 366 MTMSRD(r10) /* re-enable interrupts */
332 bl schedule 367 bl schedule
333 b 2b 368 b 6b
369
370save_user_nvgprs:
371 lwz r8,TI_SIGFRAME(r12)
372
373.macro savewords start, end
374 1: stw \start,4*(\start)(r8)
375 .section __ex_table,"a"
376 .align 2
377 .long 1b,save_user_nvgprs_fault
378 .previous
379 .if \end - \start
380 savewords "(\start+1)",\end
381 .endif
382.endm
383 savewords 14,31
384 b save_user_nvgprs_cont
385
386
387save_user_nvgprs_fault:
388 li r3,11 /* SIGSEGV */
389 lwz r4,TI_TASK(r12)
390 bl force_sigsegv
334 391
392 rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
393 lwz r9,TI_FLAGS(r12)
394 b save_user_nvgprs_cont
395
335#ifdef SHOW_SYSCALLS 396#ifdef SHOW_SYSCALLS
336do_show_syscall: 397do_show_syscall:
337#ifdef SHOW_SYSCALLS_TASK 398#ifdef SHOW_SYSCALLS_TASK
@@ -401,28 +462,10 @@ show_syscalls_task:
401#endif /* SHOW_SYSCALLS */ 462#endif /* SHOW_SYSCALLS */
402 463
403/* 464/*
404 * The sigsuspend and rt_sigsuspend system calls can call do_signal 465 * The fork/clone functions need to copy the full register set into
405 * and thus put the process into the stopped state where we might 466 * the child process. Therefore we need to save all the nonvolatile
406 * want to examine its user state with ptrace. Therefore we need 467 * registers (r13 - r31) before calling the C code.
407 * to save all the nonvolatile registers (r13 - r31) before calling
408 * the C code.
409 */ 468 */
410 .globl ppc_sigsuspend
411ppc_sigsuspend:
412 SAVE_NVGPRS(r1)
413 lwz r0,_TRAP(r1)
414 rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
415 stw r0,_TRAP(r1) /* register set saved */
416 b sys_sigsuspend
417
418 .globl ppc_rt_sigsuspend
419ppc_rt_sigsuspend:
420 SAVE_NVGPRS(r1)
421 lwz r0,_TRAP(r1)
422 rlwinm r0,r0,0,0,30
423 stw r0,_TRAP(r1)
424 b sys_rt_sigsuspend
425
426 .globl ppc_fork 469 .globl ppc_fork
427ppc_fork: 470ppc_fork:
428 SAVE_NVGPRS(r1) 471 SAVE_NVGPRS(r1)
@@ -447,14 +490,6 @@ ppc_clone:
447 stw r0,_TRAP(r1) /* register set saved */ 490 stw r0,_TRAP(r1) /* register set saved */
448 b sys_clone 491 b sys_clone
449 492
450 .globl ppc_swapcontext
451ppc_swapcontext:
452 SAVE_NVGPRS(r1)
453 lwz r0,_TRAP(r1)
454 rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
455 stw r0,_TRAP(r1) /* register set saved */
456 b sys_swapcontext
457
458/* 493/*
459 * Top-level page fault handling. 494 * Top-level page fault handling.
460 * This is in assembler because if do_page_fault tells us that 495 * This is in assembler because if do_page_fault tells us that
@@ -626,16 +661,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_601)
626 .long ret_from_except 661 .long ret_from_except
627#endif 662#endif
628 663
629 .globl sigreturn_exit
630sigreturn_exit:
631 subi r1,r3,STACK_FRAME_OVERHEAD
632 rlwinm r12,r1,0,0,(31-THREAD_SHIFT) /* current_thread_info() */
633 lwz r9,TI_FLAGS(r12)
634 andi. r0,r9,_TIF_SYSCALL_T_OR_A
635 beq+ ret_from_except_full
636 bl do_syscall_trace_leave
637 /* fall through */
638
639 .globl ret_from_except_full 664 .globl ret_from_except_full
640ret_from_except_full: 665ret_from_except_full:
641 REST_NVGPRS(r1) 666 REST_NVGPRS(r1)
@@ -658,7 +683,7 @@ user_exc_return: /* r10 contains MSR_KERNEL here */
658 /* Check current_thread_info()->flags */ 683 /* Check current_thread_info()->flags */
659 rlwinm r9,r1,0,0,(31-THREAD_SHIFT) 684 rlwinm r9,r1,0,0,(31-THREAD_SHIFT)
660 lwz r9,TI_FLAGS(r9) 685 lwz r9,TI_FLAGS(r9)
661 andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED) 686 andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL|_TIF_RESTORE_SIGMASK)
662 bne do_work 687 bne do_work
663 688
664restore_user: 689restore_user:
@@ -892,7 +917,7 @@ recheck:
892 lwz r9,TI_FLAGS(r9) 917 lwz r9,TI_FLAGS(r9)
893 andi. r0,r9,_TIF_NEED_RESCHED 918 andi. r0,r9,_TIF_NEED_RESCHED
894 bne- do_resched 919 bne- do_resched
895 andi. r0,r9,_TIF_SIGPENDING 920 andi. r0,r9,_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK
896 beq restore_user 921 beq restore_user
897do_user_signal: /* r10 contains MSR_KERNEL here */ 922do_user_signal: /* r10 contains MSR_KERNEL here */
898 ori r10,r10,MSR_EE 923 ori r10,r10,MSR_EE
@@ -963,7 +988,7 @@ _GLOBAL(enter_rtas)
963 stwu r1,-INT_FRAME_SIZE(r1) 988 stwu r1,-INT_FRAME_SIZE(r1)
964 mflr r0 989 mflr r0
965 stw r0,INT_FRAME_SIZE+4(r1) 990 stw r0,INT_FRAME_SIZE+4(r1)
966 LOADADDR(r4, rtas) 991 LOAD_REG_ADDR(r4, rtas)
967 lis r6,1f@ha /* physical return address for rtas */ 992 lis r6,1f@ha /* physical return address for rtas */
968 addi r6,r6,1f@l 993 addi r6,r6,1f@l
969 tophys(r6,r6) 994 tophys(r6,r6)
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 2d22bf03484e..388f861b8ed1 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -113,9 +113,7 @@ system_call_common:
113 addi r9,r1,STACK_FRAME_OVERHEAD 113 addi r9,r1,STACK_FRAME_OVERHEAD
114#endif 114#endif
115 clrrdi r11,r1,THREAD_SHIFT 115 clrrdi r11,r1,THREAD_SHIFT
116 li r12,0
117 ld r10,TI_FLAGS(r11) 116 ld r10,TI_FLAGS(r11)
118 stb r12,TI_SC_NOERR(r11)
119 andi. r11,r10,_TIF_SYSCALL_T_OR_A 117 andi. r11,r10,_TIF_SYSCALL_T_OR_A
120 bne- syscall_dotrace 118 bne- syscall_dotrace
121syscall_dotrace_cont: 119syscall_dotrace_cont:
@@ -144,24 +142,12 @@ system_call: /* label this so stack traces look sane */
144 bctrl /* Call handler */ 142 bctrl /* Call handler */
145 143
146syscall_exit: 144syscall_exit:
145 std r3,RESULT(r1)
147#ifdef SHOW_SYSCALLS 146#ifdef SHOW_SYSCALLS
148 std r3,GPR3(r1)
149 bl .do_show_syscall_exit 147 bl .do_show_syscall_exit
150 ld r3,GPR3(r1) 148 ld r3,RESULT(r1)
151#endif 149#endif
152 std r3,RESULT(r1)
153 ld r5,_CCR(r1)
154 li r10,-_LAST_ERRNO
155 cmpld r3,r10
156 clrrdi r12,r1,THREAD_SHIFT 150 clrrdi r12,r1,THREAD_SHIFT
157 bge- syscall_error
158syscall_error_cont:
159
160 /* check for syscall tracing or audit */
161 ld r9,TI_FLAGS(r12)
162 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP)
163 bne- syscall_exit_trace
164syscall_exit_trace_cont:
165 151
166 /* disable interrupts so current_thread_info()->flags can't change, 152 /* disable interrupts so current_thread_info()->flags can't change,
167 and so that we don't get interrupted after loading SRR0/1. */ 153 and so that we don't get interrupted after loading SRR0/1. */
@@ -173,8 +159,13 @@ syscall_exit_trace_cont:
173 rotldi r10,r10,16 159 rotldi r10,r10,16
174 mtmsrd r10,1 160 mtmsrd r10,1
175 ld r9,TI_FLAGS(r12) 161 ld r9,TI_FLAGS(r12)
176 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SIGPENDING|_TIF_NEED_RESCHED) 162 li r11,-_LAST_ERRNO
163 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL|_TIF_SAVE_NVGPRS|_TIF_NOERROR|_TIF_RESTORE_SIGMASK)
177 bne- syscall_exit_work 164 bne- syscall_exit_work
165 cmpld r3,r11
166 ld r5,_CCR(r1)
167 bge- syscall_error
168syscall_error_cont:
178 ld r7,_NIP(r1) 169 ld r7,_NIP(r1)
179 stdcx. r0,0,r1 /* to clear the reservation */ 170 stdcx. r0,0,r1 /* to clear the reservation */
180 andi. r6,r8,MSR_PR 171 andi. r6,r8,MSR_PR
@@ -183,8 +174,8 @@ syscall_exit_trace_cont:
183 ld r13,GPR13(r1) /* returning to usermode */ 174 ld r13,GPR13(r1) /* returning to usermode */
1841: ld r2,GPR2(r1) 1751: ld r2,GPR2(r1)
185 li r12,MSR_RI 176 li r12,MSR_RI
186 andc r10,r10,r12 177 andc r11,r10,r12
187 mtmsrd r10,1 /* clear MSR.RI */ 178 mtmsrd r11,1 /* clear MSR.RI */
188 ld r1,GPR1(r1) 179 ld r1,GPR1(r1)
189 mtlr r4 180 mtlr r4
190 mtcr r5 181 mtcr r5
@@ -193,21 +184,12 @@ syscall_exit_trace_cont:
193 rfid 184 rfid
194 b . /* prevent speculative execution */ 185 b . /* prevent speculative execution */
195 186
196syscall_enosys: 187syscall_error:
197 li r3,-ENOSYS
198 std r3,RESULT(r1)
199 clrrdi r12,r1,THREAD_SHIFT
200 ld r5,_CCR(r1)
201
202syscall_error:
203 lbz r11,TI_SC_NOERR(r12)
204 cmpwi 0,r11,0
205 bne- syscall_error_cont
206 neg r3,r3
207 oris r5,r5,0x1000 /* Set SO bit in CR */ 188 oris r5,r5,0x1000 /* Set SO bit in CR */
189 neg r3,r3
208 std r5,_CCR(r1) 190 std r5,_CCR(r1)
209 b syscall_error_cont 191 b syscall_error_cont
210 192
211/* Traced system call support */ 193/* Traced system call support */
212syscall_dotrace: 194syscall_dotrace:
213 bl .save_nvgprs 195 bl .save_nvgprs
@@ -225,21 +207,69 @@ syscall_dotrace:
225 ld r10,TI_FLAGS(r10) 207 ld r10,TI_FLAGS(r10)
226 b syscall_dotrace_cont 208 b syscall_dotrace_cont
227 209
228syscall_exit_trace: 210syscall_enosys:
229 std r3,GPR3(r1) 211 li r3,-ENOSYS
230 bl .save_nvgprs 212 b syscall_exit
213
214syscall_exit_work:
215 /* If TIF_RESTOREALL is set, don't scribble on either r3 or ccr.
216 If TIF_NOERROR is set, just save r3 as it is. */
217
218 andi. r0,r9,_TIF_RESTOREALL
219 bne- 2f
220 cmpld r3,r11 /* r10 is -LAST_ERRNO */
221 blt+ 1f
222 andi. r0,r9,_TIF_NOERROR
223 bne- 1f
224 ld r5,_CCR(r1)
225 neg r3,r3
226 oris r5,r5,0x1000 /* Set SO bit in CR */
227 std r5,_CCR(r1)
2281: std r3,GPR3(r1)
2292: andi. r0,r9,(_TIF_PERSYSCALL_MASK)
230 beq 4f
231
232 /* Clear per-syscall TIF flags if any are set, but _leave_
233 _TIF_SAVE_NVGPRS set in r9 since we haven't dealt with that
234 yet. */
235
236 li r11,_TIF_PERSYSCALL_MASK
237 addi r12,r12,TI_FLAGS
2383: ldarx r10,0,r12
239 andc r10,r10,r11
240 stdcx. r10,0,r12
241 bne- 3b
242 subi r12,r12,TI_FLAGS
243
2444: bl .save_nvgprs
245 /* Anything else left to do? */
246 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SAVE_NVGPRS)
247 beq .ret_from_except_lite
248
249 /* Re-enable interrupts */
250 mfmsr r10
251 ori r10,r10,MSR_EE
252 mtmsrd r10,1
253
254 andi. r0,r9,_TIF_SAVE_NVGPRS
255 bne save_user_nvgprs
256
257 /* If tracing, re-enable interrupts and do it */
258save_user_nvgprs_cont:
259 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP)
260 beq 5f
261
231 addi r3,r1,STACK_FRAME_OVERHEAD 262 addi r3,r1,STACK_FRAME_OVERHEAD
232 bl .do_syscall_trace_leave 263 bl .do_syscall_trace_leave
233 REST_NVGPRS(r1) 264 REST_NVGPRS(r1)
234 ld r3,GPR3(r1)
235 ld r5,_CCR(r1)
236 clrrdi r12,r1,THREAD_SHIFT 265 clrrdi r12,r1,THREAD_SHIFT
237 b syscall_exit_trace_cont
238 266
239/* Stuff to do on exit from a system call. */ 267 /* Disable interrupts again and handle other work if any */
240syscall_exit_work: 2685: mfmsr r10
241 std r3,GPR3(r1) 269 rldicl r10,r10,48,1
242 std r5,_CCR(r1) 270 rotldi r10,r10,16
271 mtmsrd r10,1
272
243 b .ret_from_except_lite 273 b .ret_from_except_lite
244 274
245/* Save non-volatile GPRs, if not already saved. */ 275/* Save non-volatile GPRs, if not already saved. */
@@ -252,6 +282,52 @@ _GLOBAL(save_nvgprs)
252 std r0,_TRAP(r1) 282 std r0,_TRAP(r1)
253 blr 283 blr
254 284
285
286save_user_nvgprs:
287 ld r10,TI_SIGFRAME(r12)
288 andi. r0,r9,_TIF_32BIT
289 beq- save_user_nvgprs_64
290
291 /* 32-bit save to userspace */
292
293.macro savewords start, end
294 1: stw \start,4*(\start)(r10)
295 .section __ex_table,"a"
296 .align 3
297 .llong 1b,save_user_nvgprs_fault
298 .previous
299 .if \end - \start
300 savewords "(\start+1)",\end
301 .endif
302.endm
303 savewords 14,31
304 b save_user_nvgprs_cont
305
306save_user_nvgprs_64:
307 /* 64-bit save to userspace */
308
309.macro savelongs start, end
310 1: std \start,8*(\start)(r10)
311 .section __ex_table,"a"
312 .align 3
313 .llong 1b,save_user_nvgprs_fault
314 .previous
315 .if \end - \start
316 savelongs "(\start+1)",\end
317 .endif
318.endm
319 savelongs 14,31
320 b save_user_nvgprs_cont
321
322save_user_nvgprs_fault:
323 li r3,11 /* SIGSEGV */
324 ld r4,TI_TASK(r12)
325 bl .force_sigsegv
326
327 clrrdi r12,r1,THREAD_SHIFT
328 ld r9,TI_FLAGS(r12)
329 b save_user_nvgprs_cont
330
255/* 331/*
256 * The sigsuspend and rt_sigsuspend system calls can call do_signal 332 * The sigsuspend and rt_sigsuspend system calls can call do_signal
257 * and thus put the process into the stopped state where we might 333 * and thus put the process into the stopped state where we might
@@ -260,35 +336,6 @@ _GLOBAL(save_nvgprs)
260 * the C code. Similarly, fork, vfork and clone need the full 336 * the C code. Similarly, fork, vfork and clone need the full
261 * register state on the stack so that it can be copied to the child. 337 * register state on the stack so that it can be copied to the child.
262 */ 338 */
263_GLOBAL(ppc32_sigsuspend)
264 bl .save_nvgprs
265 bl .compat_sys_sigsuspend
266 b 70f
267
268_GLOBAL(ppc64_rt_sigsuspend)
269 bl .save_nvgprs
270 bl .sys_rt_sigsuspend
271 b 70f
272
273_GLOBAL(ppc32_rt_sigsuspend)
274 bl .save_nvgprs
275 bl .compat_sys_rt_sigsuspend
27670: cmpdi 0,r3,0
277 /* If it returned an error, we need to return via syscall_exit to set
278 the SO bit in cr0 and potentially stop for ptrace. */
279 bne syscall_exit
280 /* If sigsuspend() returns zero, we are going into a signal handler. We
281 may need to call audit_syscall_exit() to mark the exit from sigsuspend() */
282#ifdef CONFIG_AUDITSYSCALL
283 ld r3,PACACURRENT(r13)
284 ld r4,AUDITCONTEXT(r3)
285 cmpdi 0,r4,0
286 beq .ret_from_except /* No audit_context: Leave immediately. */
287 li r4, 2 /* AUDITSC_FAILURE */
288 li r5,-4 /* It's always -EINTR */
289 bl .audit_syscall_exit
290#endif
291 b .ret_from_except
292 339
293_GLOBAL(ppc_fork) 340_GLOBAL(ppc_fork)
294 bl .save_nvgprs 341 bl .save_nvgprs
@@ -305,37 +352,6 @@ _GLOBAL(ppc_clone)
305 bl .sys_clone 352 bl .sys_clone
306 b syscall_exit 353 b syscall_exit
307 354
308_GLOBAL(ppc32_swapcontext)
309 bl .save_nvgprs
310 bl .compat_sys_swapcontext
311 b 80f
312
313_GLOBAL(ppc64_swapcontext)
314 bl .save_nvgprs
315 bl .sys_swapcontext
316 b 80f
317
318_GLOBAL(ppc32_sigreturn)
319 bl .compat_sys_sigreturn
320 b 80f
321
322_GLOBAL(ppc32_rt_sigreturn)
323 bl .compat_sys_rt_sigreturn
324 b 80f
325
326_GLOBAL(ppc64_rt_sigreturn)
327 bl .sys_rt_sigreturn
328
32980: cmpdi 0,r3,0
330 blt syscall_exit
331 clrrdi r4,r1,THREAD_SHIFT
332 ld r4,TI_FLAGS(r4)
333 andi. r4,r4,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP)
334 beq+ 81f
335 addi r3,r1,STACK_FRAME_OVERHEAD
336 bl .do_syscall_trace_leave
33781: b .ret_from_except
338
339_GLOBAL(ret_from_fork) 355_GLOBAL(ret_from_fork)
340 bl .schedule_tail 356 bl .schedule_tail
341 REST_NVGPRS(r1) 357 REST_NVGPRS(r1)
@@ -495,7 +511,8 @@ restore:
495 cmpdi 0,r5,0 511 cmpdi 0,r5,0
496 beq 4f 512 beq 4f
497 /* Check for pending interrupts (iSeries) */ 513 /* Check for pending interrupts (iSeries) */
498 ld r3,PACALPPACA+LPPACAANYINT(r13) 514 ld r3,PACALPPACAPTR(r13)
515 ld r3,LPPACAANYINT(r3)
499 cmpdi r3,0 516 cmpdi r3,0
500 beq+ 4f /* skip do_IRQ if no interrupts */ 517 beq+ 4f /* skip do_IRQ if no interrupts */
501 518
@@ -673,9 +690,8 @@ _GLOBAL(enter_rtas)
673 std r6,PACASAVEDMSR(r13) 690 std r6,PACASAVEDMSR(r13)
674 691
675 /* Setup our real return addr */ 692 /* Setup our real return addr */
676 SET_REG_TO_LABEL(r4,.rtas_return_loc) 693 LOAD_REG_ADDR(r4,.rtas_return_loc)
677 SET_REG_TO_CONST(r9,KERNELBASE) 694 clrldi r4,r4,2 /* convert to realmode address */
678 sub r4,r4,r9
679 mtlr r4 695 mtlr r4
680 696
681 li r0,0 697 li r0,0
@@ -690,7 +706,7 @@ _GLOBAL(enter_rtas)
690 sync /* disable interrupts so SRR0/1 */ 706 sync /* disable interrupts so SRR0/1 */
691 mtmsrd r0 /* don't get trashed */ 707 mtmsrd r0 /* don't get trashed */
692 708
693 SET_REG_TO_LABEL(r4,rtas) 709 LOAD_REG_ADDR(r4, rtas)
694 ld r5,RTASENTRY(r4) /* get the rtas->entry value */ 710 ld r5,RTASENTRY(r4) /* get the rtas->entry value */
695 ld r4,RTASBASE(r4) /* get the rtas->base value */ 711 ld r4,RTASBASE(r4) /* get the rtas->base value */
696 712
@@ -702,8 +718,7 @@ _GLOBAL(enter_rtas)
702_STATIC(rtas_return_loc) 718_STATIC(rtas_return_loc)
703 /* relocation is off at this point */ 719 /* relocation is off at this point */
704 mfspr r4,SPRN_SPRG3 /* Get PACA */ 720 mfspr r4,SPRN_SPRG3 /* Get PACA */
705 SET_REG_TO_CONST(r5, KERNELBASE) 721 clrldi r4,r4,2 /* convert to realmode address */
706 sub r4,r4,r5 /* RELOC the PACA base pointer */
707 722
708 mfmsr r6 723 mfmsr r6
709 li r0,MSR_RI 724 li r0,MSR_RI
@@ -712,7 +727,7 @@ _STATIC(rtas_return_loc)
712 mtmsrd r6 727 mtmsrd r6
713 728
714 ld r1,PACAR1(r4) /* Restore our SP */ 729 ld r1,PACAR1(r4) /* Restore our SP */
715 LOADADDR(r3,.rtas_restore_regs) 730 LOAD_REG_IMMEDIATE(r3,.rtas_restore_regs)
716 ld r4,PACASAVEDMSR(r4) /* Restore our MSR */ 731 ld r4,PACASAVEDMSR(r4) /* Restore our MSR */
717 732
718 mtspr SPRN_SRR0,r3 733 mtspr SPRN_SRR0,r3
diff --git a/arch/powerpc/kernel/fpu.S b/arch/powerpc/kernel/fpu.S
index b780b42c95fc..e4362dfa37fb 100644
--- a/arch/powerpc/kernel/fpu.S
+++ b/arch/powerpc/kernel/fpu.S
@@ -39,9 +39,9 @@ _GLOBAL(load_up_fpu)
39 * to another. Instead we call giveup_fpu in switch_to. 39 * to another. Instead we call giveup_fpu in switch_to.
40 */ 40 */
41#ifndef CONFIG_SMP 41#ifndef CONFIG_SMP
42 LOADBASE(r3, last_task_used_math) 42 LOAD_REG_ADDRBASE(r3, last_task_used_math)
43 toreal(r3) 43 toreal(r3)
44 PPC_LL r4,OFF(last_task_used_math)(r3) 44 PPC_LL r4,ADDROFF(last_task_used_math)(r3)
45 PPC_LCMPI 0,r4,0 45 PPC_LCMPI 0,r4,0
46 beq 1f 46 beq 1f
47 toreal(r4) 47 toreal(r4)
@@ -77,7 +77,7 @@ _GLOBAL(load_up_fpu)
77#ifndef CONFIG_SMP 77#ifndef CONFIG_SMP
78 subi r4,r5,THREAD 78 subi r4,r5,THREAD
79 fromreal(r4) 79 fromreal(r4)
80 PPC_STL r4,OFF(last_task_used_math)(r3) 80 PPC_STL r4,ADDROFF(last_task_used_math)(r3)
81#endif /* CONFIG_SMP */ 81#endif /* CONFIG_SMP */
82 /* restore registers and return */ 82 /* restore registers and return */
83 /* we haven't used ctr or xer or lr */ 83 /* we haven't used ctr or xer or lr */
@@ -113,8 +113,8 @@ _GLOBAL(giveup_fpu)
1131: 1131:
114#ifndef CONFIG_SMP 114#ifndef CONFIG_SMP
115 li r5,0 115 li r5,0
116 LOADBASE(r4,last_task_used_math) 116 LOAD_REG_ADDRBASE(r4,last_task_used_math)
117 PPC_STL r5,OFF(last_task_used_math)(r4) 117 PPC_STL r5,ADDROFF(last_task_used_math)(r4)
118#endif /* CONFIG_SMP */ 118#endif /* CONFIG_SMP */
119 blr 119 blr
120 120
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index ccdf94731e30..03b25f9359f8 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -120,10 +120,25 @@ __start:
120 * because OF may have I/O devices mapped into that area 120 * because OF may have I/O devices mapped into that area
121 * (particularly on CHRP). 121 * (particularly on CHRP).
122 */ 122 */
123#ifdef CONFIG_PPC_MULTIPLATFORM
123 cmpwi 0,r5,0 124 cmpwi 0,r5,0
124 beq 1f 125 beq 1f
125 bl prom_init 126 bl prom_init
126 trap 127 trap
128#endif
129
130/*
131 * Check for BootX signature when supporting PowerMac and branch to
132 * appropriate trampoline if it's present
133 */
134#ifdef CONFIG_PPC_PMAC
1351: lis r31,0x426f
136 ori r31,r31,0x6f58
137 cmpw 0,r3,r31
138 bne 1f
139 bl bootx_init
140 trap
141#endif /* CONFIG_PPC_PMAC */
127 142
1281: mr r31,r3 /* save parameters */ 1431: mr r31,r3 /* save parameters */
129 mr r30,r4 144 mr r30,r4
@@ -153,6 +168,9 @@ __after_mmu_off:
153 bl flush_tlbs 168 bl flush_tlbs
154 169
155 bl initial_bats 170 bl initial_bats
171#if !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT)
172 bl setup_disp_bat
173#endif
156 174
157/* 175/*
158 * Call setup_cpu for CPU 0 and initialize 6xx Idle 176 * Call setup_cpu for CPU 0 and initialize 6xx Idle
@@ -450,16 +468,11 @@ SystemCall:
450 * by executing an altivec instruction. 468 * by executing an altivec instruction.
451 */ 469 */
452 . = 0xf00 470 . = 0xf00
453 b Trap_0f 471 b PerformanceMonitor
454 472
455 . = 0xf20 473 . = 0xf20
456 b AltiVecUnavailable 474 b AltiVecUnavailable
457 475
458Trap_0f:
459 EXCEPTION_PROLOG
460 addi r3,r1,STACK_FRAME_OVERHEAD
461 EXC_XFER_EE(0xf00, unknown_exception)
462
463/* 476/*
464 * Handle TLB miss for instruction on 603/603e. 477 * Handle TLB miss for instruction on 603/603e.
465 * Note: we get an alternate set of r0 - r3 to use automatically. 478 * Note: we get an alternate set of r0 - r3 to use automatically.
@@ -703,6 +716,11 @@ AltiVecUnavailable:
703#endif /* CONFIG_ALTIVEC */ 716#endif /* CONFIG_ALTIVEC */
704 EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception) 717 EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception)
705 718
719PerformanceMonitor:
720 EXCEPTION_PROLOG
721 addi r3,r1,STACK_FRAME_OVERHEAD
722 EXC_XFER_STD(0xf00, performance_monitor_exception)
723
706#ifdef CONFIG_ALTIVEC 724#ifdef CONFIG_ALTIVEC
707/* Note that the AltiVec support is closely modeled after the FP 725/* Note that the AltiVec support is closely modeled after the FP
708 * support. Changes to one are likely to be applicable to the 726 * support. Changes to one are likely to be applicable to the
@@ -1306,6 +1324,32 @@ initial_bats:
1306 blr 1324 blr
1307 1325
1308 1326
1327#if !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT)
1328setup_disp_bat:
1329 /*
1330 * setup the display bat prepared for us in prom.c
1331 */
1332 mflr r8
1333 bl reloc_offset
1334 mtlr r8
1335 addis r8,r3,disp_BAT@ha
1336 addi r8,r8,disp_BAT@l
1337 cmpwi cr0,r8,0
1338 beqlr
1339 lwz r11,0(r8)
1340 lwz r8,4(r8)
1341 mfspr r9,SPRN_PVR
1342 rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1343 cmpwi 0,r9,1
1344 beq 1f
1345 mtspr SPRN_DBAT3L,r8
1346 mtspr SPRN_DBAT3U,r11
1347 blr
13481: mtspr SPRN_IBAT3L,r8
1349 mtspr SPRN_IBAT3U,r11
1350 blr
1351#endif /* !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT) */
1352
1309#ifdef CONFIG_8260 1353#ifdef CONFIG_8260
1310/* Jump into the system reset for the rom. 1354/* Jump into the system reset for the rom.
1311 * We first disable the MMU, and then jump to the ROM reset address. 1355 * We first disable the MMU, and then jump to the ROM reset address.
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 8a8bf79ef044..308268466342 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -154,11 +154,15 @@ _GLOBAL(__secondary_hold)
154 bne 100b 154 bne 100b
155 155
156#ifdef CONFIG_HMT 156#ifdef CONFIG_HMT
157 b .hmt_init 157 SET_REG_IMMEDIATE(r4, .hmt_init)
158 mtctr r4
159 bctr
158#else 160#else
159#ifdef CONFIG_SMP 161#ifdef CONFIG_SMP
162 LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init)
163 mtctr r4
160 mr r3,r24 164 mr r3,r24
161 b .pSeries_secondary_smp_init 165 bctr
162#else 166#else
163 BUG_OPCODE 167 BUG_OPCODE
164#endif 168#endif
@@ -200,6 +204,21 @@ exception_marker:
200#define EX_R3 64 204#define EX_R3 64
201#define EX_LR 72 205#define EX_LR 72
202 206
207/*
208 * We're short on space and time in the exception prolog, so we can't
209 * use the normal SET_REG_IMMEDIATE macro. Normally we just need the
210 * low halfword of the address, but for Kdump we need the whole low
211 * word.
212 */
213#ifdef CONFIG_CRASH_DUMP
214#define LOAD_HANDLER(reg, label) \
215 oris reg,reg,(label)@h; /* virt addr of handler ... */ \
216 ori reg,reg,(label)@l; /* .. and the rest */
217#else
218#define LOAD_HANDLER(reg, label) \
219 ori reg,reg,(label)@l; /* virt addr of handler ... */
220#endif
221
203#define EXCEPTION_PROLOG_PSERIES(area, label) \ 222#define EXCEPTION_PROLOG_PSERIES(area, label) \
204 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \ 223 mfspr r13,SPRN_SPRG3; /* get paca address into r13 */ \
205 std r9,area+EX_R9(r13); /* save r9 - r12 */ \ 224 std r9,area+EX_R9(r13); /* save r9 - r12 */ \
@@ -212,7 +231,7 @@ exception_marker:
212 clrrdi r12,r13,32; /* get high part of &label */ \ 231 clrrdi r12,r13,32; /* get high part of &label */ \
213 mfmsr r10; \ 232 mfmsr r10; \
214 mfspr r11,SPRN_SRR0; /* save SRR0 */ \ 233 mfspr r11,SPRN_SRR0; /* save SRR0 */ \
215 ori r12,r12,(label)@l; /* virt addr of handler */ \ 234 LOAD_HANDLER(r12,label) \
216 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \ 235 ori r10,r10,MSR_IR|MSR_DR|MSR_RI; \
217 mtspr SPRN_SRR0,r12; \ 236 mtspr SPRN_SRR0,r12; \
218 mfspr r12,SPRN_SRR1; /* and SRR1 */ \ 237 mfspr r12,SPRN_SRR1; /* and SRR1 */ \
@@ -236,8 +255,9 @@ exception_marker:
236 255
237#define EXCEPTION_PROLOG_ISERIES_2 \ 256#define EXCEPTION_PROLOG_ISERIES_2 \
238 mfmsr r10; \ 257 mfmsr r10; \
239 ld r11,PACALPPACA+LPPACASRR0(r13); \ 258 ld r12,PACALPPACAPTR(r13); \
240 ld r12,PACALPPACA+LPPACASRR1(r13); \ 259 ld r11,LPPACASRR0(r12); \
260 ld r12,LPPACASRR1(r12); \
241 ori r10,r10,MSR_RI; \ 261 ori r10,r10,MSR_RI; \
242 mtmsrd r10,1 262 mtmsrd r10,1
243 263
@@ -553,6 +573,7 @@ slb_miss_user_pseries:
553 * Vectors for the FWNMI option. Share common code. 573 * Vectors for the FWNMI option. Share common code.
554 */ 574 */
555 .globl system_reset_fwnmi 575 .globl system_reset_fwnmi
576 .align 7
556system_reset_fwnmi: 577system_reset_fwnmi:
557 HMT_MEDIUM 578 HMT_MEDIUM
558 mtspr SPRN_SPRG1,r13 /* save r13 */ 579 mtspr SPRN_SPRG1,r13 /* save r13 */
@@ -560,6 +581,7 @@ system_reset_fwnmi:
560 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) 581 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common)
561 582
562 .globl machine_check_fwnmi 583 .globl machine_check_fwnmi
584 .align 7
563machine_check_fwnmi: 585machine_check_fwnmi:
564 HMT_MEDIUM 586 HMT_MEDIUM
565 mtspr SPRN_SPRG1,r13 /* save r13 */ 587 mtspr SPRN_SPRG1,r13 /* save r13 */
@@ -614,7 +636,8 @@ data_access_slb_iSeries:
614 std r12,PACA_EXSLB+EX_R12(r13) 636 std r12,PACA_EXSLB+EX_R12(r13)
615 mfspr r10,SPRN_SPRG1 637 mfspr r10,SPRN_SPRG1
616 std r10,PACA_EXSLB+EX_R13(r13) 638 std r10,PACA_EXSLB+EX_R13(r13)
617 ld r12,PACALPPACA+LPPACASRR1(r13); 639 ld r12,PACALPPACAPTR(r13)
640 ld r12,LPPACASRR1(r12)
618 b .slb_miss_realmode 641 b .slb_miss_realmode
619 642
620 STD_EXCEPTION_ISERIES(0x400, instruction_access, PACA_EXGEN) 643 STD_EXCEPTION_ISERIES(0x400, instruction_access, PACA_EXGEN)
@@ -624,7 +647,8 @@ instruction_access_slb_iSeries:
624 mtspr SPRN_SPRG1,r13 /* save r13 */ 647 mtspr SPRN_SPRG1,r13 /* save r13 */
625 mfspr r13,SPRN_SPRG3 /* get paca address into r13 */ 648 mfspr r13,SPRN_SPRG3 /* get paca address into r13 */
626 std r3,PACA_EXSLB+EX_R3(r13) 649 std r3,PACA_EXSLB+EX_R3(r13)
627 ld r3,PACALPPACA+LPPACASRR0(r13) /* get SRR0 value */ 650 ld r3,PACALPPACAPTR(r13)
651 ld r3,LPPACASRR0(r3) /* get SRR0 value */
628 std r9,PACA_EXSLB+EX_R9(r13) 652 std r9,PACA_EXSLB+EX_R9(r13)
629 mfcr r9 653 mfcr r9
630#ifdef __DISABLED__ 654#ifdef __DISABLED__
@@ -636,7 +660,8 @@ instruction_access_slb_iSeries:
636 std r12,PACA_EXSLB+EX_R12(r13) 660 std r12,PACA_EXSLB+EX_R12(r13)
637 mfspr r10,SPRN_SPRG1 661 mfspr r10,SPRN_SPRG1
638 std r10,PACA_EXSLB+EX_R13(r13) 662 std r10,PACA_EXSLB+EX_R13(r13)
639 ld r12,PACALPPACA+LPPACASRR1(r13); 663 ld r12,PACALPPACAPTR(r13)
664 ld r12,LPPACASRR1(r12)
640 b .slb_miss_realmode 665 b .slb_miss_realmode
641 666
642#ifdef __DISABLED__ 667#ifdef __DISABLED__
@@ -693,7 +718,7 @@ system_reset_iSeries:
693 lbz r23,PACAPROCSTART(r13) /* Test if this processor 718 lbz r23,PACAPROCSTART(r13) /* Test if this processor
694 * should start */ 719 * should start */
695 sync 720 sync
696 LOADADDR(r3,current_set) 721 LOAD_REG_IMMEDIATE(r3,current_set)
697 sldi r28,r24,3 /* get current_set[cpu#] */ 722 sldi r28,r24,3 /* get current_set[cpu#] */
698 ldx r3,r3,r28 723 ldx r3,r3,r28
699 addi r1,r3,THREAD_SIZE 724 addi r1,r3,THREAD_SIZE
@@ -725,16 +750,19 @@ iSeries_secondary_smp_loop:
725 .globl decrementer_iSeries_masked 750 .globl decrementer_iSeries_masked
726decrementer_iSeries_masked: 751decrementer_iSeries_masked:
727 li r11,1 752 li r11,1
728 stb r11,PACALPPACA+LPPACADECRINT(r13) 753 ld r12,PACALPPACAPTR(r13)
729 lwz r12,PACADEFAULTDECR(r13) 754 stb r11,LPPACADECRINT(r12)
755 LOAD_REG_ADDRBASE(r12,tb_ticks_per_jiffy)
756 lwz r12,ADDROFF(tb_ticks_per_jiffy)(r12)
730 mtspr SPRN_DEC,r12 757 mtspr SPRN_DEC,r12
731 /* fall through */ 758 /* fall through */
732 759
733 .globl hardware_interrupt_iSeries_masked 760 .globl hardware_interrupt_iSeries_masked
734hardware_interrupt_iSeries_masked: 761hardware_interrupt_iSeries_masked:
735 mtcrf 0x80,r9 /* Restore regs */ 762 mtcrf 0x80,r9 /* Restore regs */
736 ld r11,PACALPPACA+LPPACASRR0(r13) 763 ld r12,PACALPPACAPTR(r13)
737 ld r12,PACALPPACA+LPPACASRR1(r13) 764 ld r11,LPPACASRR0(r12)
765 ld r12,LPPACASRR1(r12)
738 mtspr SPRN_SRR0,r11 766 mtspr SPRN_SRR0,r11
739 mtspr SPRN_SRR1,r12 767 mtspr SPRN_SRR1,r12
740 ld r9,PACA_EXGEN+EX_R9(r13) 768 ld r9,PACA_EXGEN+EX_R9(r13)
@@ -973,7 +1001,8 @@ _GLOBAL(slb_miss_realmode)
973 ld r3,PACA_EXSLB+EX_R3(r13) 1001 ld r3,PACA_EXSLB+EX_R3(r13)
974 lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */ 1002 lwz r9,PACA_EXSLB+EX_CCR(r13) /* get saved CR */
975#ifdef CONFIG_PPC_ISERIES 1003#ifdef CONFIG_PPC_ISERIES
976 ld r11,PACALPPACA+LPPACASRR0(r13) /* get SRR0 value */ 1004 ld r11,PACALPPACAPTR(r13)
1005 ld r11,LPPACASRR0(r11) /* get SRR0 value */
977#endif /* CONFIG_PPC_ISERIES */ 1006#endif /* CONFIG_PPC_ISERIES */
978 1007
979 mtlr r10 1008 mtlr r10
@@ -1345,7 +1374,7 @@ _GLOBAL(do_stab_bolted)
1345 * fixed address (the linker can't compute (u64)&initial_stab >> 1374 * fixed address (the linker can't compute (u64)&initial_stab >>
1346 * PAGE_SHIFT). 1375 * PAGE_SHIFT).
1347 */ 1376 */
1348 . = STAB0_PHYS_ADDR /* 0x6000 */ 1377 . = STAB0_OFFSET /* 0x6000 */
1349 .globl initial_stab 1378 .globl initial_stab
1350initial_stab: 1379initial_stab:
1351 .space 4096 1380 .space 4096
@@ -1391,7 +1420,7 @@ _GLOBAL(pSeries_secondary_smp_init)
1391 * physical cpu id in r24, we need to search the pacas to find 1420 * physical cpu id in r24, we need to search the pacas to find
1392 * which logical id maps to our physical one. 1421 * which logical id maps to our physical one.
1393 */ 1422 */
1394 LOADADDR(r13, paca) /* Get base vaddr of paca array */ 1423 LOAD_REG_IMMEDIATE(r13, paca) /* Get base vaddr of paca array */
1395 li r5,0 /* logical cpu id */ 1424 li r5,0 /* logical cpu id */
13961: lhz r6,PACAHWCPUID(r13) /* Load HW procid from paca */ 14251: lhz r6,PACAHWCPUID(r13) /* Load HW procid from paca */
1397 cmpw r6,r24 /* Compare to our id */ 1426 cmpw r6,r24 /* Compare to our id */
@@ -1425,8 +1454,8 @@ _GLOBAL(pSeries_secondary_smp_init)
1425#ifdef CONFIG_PPC_ISERIES 1454#ifdef CONFIG_PPC_ISERIES
1426_STATIC(__start_initialization_iSeries) 1455_STATIC(__start_initialization_iSeries)
1427 /* Clear out the BSS */ 1456 /* Clear out the BSS */
1428 LOADADDR(r11,__bss_stop) 1457 LOAD_REG_IMMEDIATE(r11,__bss_stop)
1429 LOADADDR(r8,__bss_start) 1458 LOAD_REG_IMMEDIATE(r8,__bss_start)
1430 sub r11,r11,r8 /* bss size */ 1459 sub r11,r11,r8 /* bss size */
1431 addi r11,r11,7 /* round up to an even double word */ 1460 addi r11,r11,7 /* round up to an even double word */
1432 rldicl. r11,r11,61,3 /* shift right by 3 */ 1461 rldicl. r11,r11,61,3 /* shift right by 3 */
@@ -1437,17 +1466,17 @@ _STATIC(__start_initialization_iSeries)
14373: stdu r0,8(r8) 14663: stdu r0,8(r8)
1438 bdnz 3b 1467 bdnz 3b
14394: 14684:
1440 LOADADDR(r1,init_thread_union) 1469 LOAD_REG_IMMEDIATE(r1,init_thread_union)
1441 addi r1,r1,THREAD_SIZE 1470 addi r1,r1,THREAD_SIZE
1442 li r0,0 1471 li r0,0
1443 stdu r0,-STACK_FRAME_OVERHEAD(r1) 1472 stdu r0,-STACK_FRAME_OVERHEAD(r1)
1444 1473
1445 LOADADDR(r3,cpu_specs) 1474 LOAD_REG_IMMEDIATE(r3,cpu_specs)
1446 LOADADDR(r4,cur_cpu_spec) 1475 LOAD_REG_IMMEDIATE(r4,cur_cpu_spec)
1447 li r5,0 1476 li r5,0
1448 bl .identify_cpu 1477 bl .identify_cpu
1449 1478
1450 LOADADDR(r2,__toc_start) 1479 LOAD_REG_IMMEDIATE(r2,__toc_start)
1451 addi r2,r2,0x4000 1480 addi r2,r2,0x4000
1452 addi r2,r2,0x4000 1481 addi r2,r2,0x4000
1453 1482
@@ -1485,11 +1514,13 @@ _STATIC(__mmu_off)
1485 * 1514 *
1486 */ 1515 */
1487_GLOBAL(__start_initialization_multiplatform) 1516_GLOBAL(__start_initialization_multiplatform)
1517#ifdef CONFIG_PPC_MULTIPLATFORM
1488 /* 1518 /*
1489 * Are we booted from a PROM Of-type client-interface ? 1519 * Are we booted from a PROM Of-type client-interface ?
1490 */ 1520 */
1491 cmpldi cr0,r5,0 1521 cmpldi cr0,r5,0
1492 bne .__boot_from_prom /* yes -> prom */ 1522 bne .__boot_from_prom /* yes -> prom */
1523#endif
1493 1524
1494 /* Save parameters */ 1525 /* Save parameters */
1495 mr r31,r3 1526 mr r31,r3
@@ -1505,11 +1536,12 @@ _GLOBAL(__start_initialization_multiplatform)
1505 li r24,0 1536 li r24,0
1506 1537
1507 /* Switch off MMU if not already */ 1538 /* Switch off MMU if not already */
1508 LOADADDR(r4, .__after_prom_start - KERNELBASE) 1539 LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE)
1509 add r4,r4,r30 1540 add r4,r4,r30
1510 bl .__mmu_off 1541 bl .__mmu_off
1511 b .__after_prom_start 1542 b .__after_prom_start
1512 1543
1544#ifdef CONFIG_PPC_MULTIPLATFORM
1513_STATIC(__boot_from_prom) 1545_STATIC(__boot_from_prom)
1514 /* Save parameters */ 1546 /* Save parameters */
1515 mr r31,r3 1547 mr r31,r3
@@ -1524,7 +1556,7 @@ _STATIC(__boot_from_prom)
1524 /* put a relocation offset into r3 */ 1556 /* put a relocation offset into r3 */
1525 bl .reloc_offset 1557 bl .reloc_offset
1526 1558
1527 LOADADDR(r2,__toc_start) 1559 LOAD_REG_IMMEDIATE(r2,__toc_start)
1528 addi r2,r2,0x4000 1560 addi r2,r2,0x4000
1529 addi r2,r2,0x4000 1561 addi r2,r2,0x4000
1530 1562
@@ -1542,6 +1574,7 @@ _STATIC(__boot_from_prom)
1542 bl .prom_init 1574 bl .prom_init
1543 /* We never return */ 1575 /* We never return */
1544 trap 1576 trap
1577#endif
1545 1578
1546/* 1579/*
1547 * At this point, r3 contains the physical address we are running at, 1580 * At this point, r3 contains the physical address we are running at,
@@ -1550,7 +1583,7 @@ _STATIC(__boot_from_prom)
1550_STATIC(__after_prom_start) 1583_STATIC(__after_prom_start)
1551 1584
1552/* 1585/*
1553 * We need to run with __start at physical address 0. 1586 * We need to run with __start at physical address PHYSICAL_START.
1554 * This will leave some code in the first 256B of 1587 * This will leave some code in the first 256B of
1555 * real memory, which are reserved for software use. 1588 * real memory, which are reserved for software use.
1556 * The remainder of the first page is loaded with the fixed 1589 * The remainder of the first page is loaded with the fixed
@@ -1563,9 +1596,9 @@ _STATIC(__after_prom_start)
1563 */ 1596 */
1564 bl .reloc_offset 1597 bl .reloc_offset
1565 mr r26,r3 1598 mr r26,r3
1566 SET_REG_TO_CONST(r27,KERNELBASE) 1599 LOAD_REG_IMMEDIATE(r27, KERNELBASE)
1567 1600
1568 li r3,0 /* target addr */ 1601 LOAD_REG_IMMEDIATE(r3, PHYSICAL_START) /* target addr */
1569 1602
1570 // XXX FIXME: Use phys returned by OF (r30) 1603 // XXX FIXME: Use phys returned by OF (r30)
1571 add r4,r27,r26 /* source addr */ 1604 add r4,r27,r26 /* source addr */
@@ -1573,7 +1606,7 @@ _STATIC(__after_prom_start)
1573 /* i.e. where we are running */ 1606 /* i.e. where we are running */
1574 /* the source addr */ 1607 /* the source addr */
1575 1608
1576 LOADADDR(r5,copy_to_here) /* # bytes of memory to copy */ 1609 LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */
1577 sub r5,r5,r27 1610 sub r5,r5,r27
1578 1611
1579 li r6,0x100 /* Start offset, the first 0x100 */ 1612 li r6,0x100 /* Start offset, the first 0x100 */
@@ -1583,11 +1616,11 @@ _STATIC(__after_prom_start)
1583 /* this includes the code being */ 1616 /* this includes the code being */
1584 /* executed here. */ 1617 /* executed here. */
1585 1618
1586 LOADADDR(r0, 4f) /* Jump to the copy of this code */ 1619 LOAD_REG_IMMEDIATE(r0, 4f) /* Jump to the copy of this code */
1587 mtctr r0 /* that we just made/relocated */ 1620 mtctr r0 /* that we just made/relocated */
1588 bctr 1621 bctr
1589 1622
15904: LOADADDR(r5,klimit) 16234: LOAD_REG_IMMEDIATE(r5,klimit)
1591 add r5,r5,r26 1624 add r5,r5,r26
1592 ld r5,0(r5) /* get the value of klimit */ 1625 ld r5,0(r5) /* get the value of klimit */
1593 sub r5,r5,r27 1626 sub r5,r5,r27
@@ -1669,7 +1702,7 @@ _GLOBAL(pmac_secondary_start)
1669 mtmsrd r3 /* RI on */ 1702 mtmsrd r3 /* RI on */
1670 1703
1671 /* Set up a paca value for this processor. */ 1704 /* Set up a paca value for this processor. */
1672 LOADADDR(r4, paca) /* Get base vaddr of paca array */ 1705 LOAD_REG_IMMEDIATE(r4, paca) /* Get base vaddr of paca array */
1673 mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */ 1706 mulli r13,r24,PACA_SIZE /* Calculate vaddr of right paca */
1674 add r13,r13,r4 /* for this processor. */ 1707 add r13,r13,r4 /* for this processor. */
1675 mtspr SPRN_SPRG3,r13 /* Save vaddr of paca in SPRG3 */ 1708 mtspr SPRN_SPRG3,r13 /* Save vaddr of paca in SPRG3 */
@@ -1706,7 +1739,7 @@ _GLOBAL(__secondary_start)
1706 bl .early_setup_secondary 1739 bl .early_setup_secondary
1707 1740
1708 /* Initialize the kernel stack. Just a repeat for iSeries. */ 1741 /* Initialize the kernel stack. Just a repeat for iSeries. */
1709 LOADADDR(r3,current_set) 1742 LOAD_REG_ADDR(r3, current_set)
1710 sldi r28,r24,3 /* get current_set[cpu#] */ 1743 sldi r28,r24,3 /* get current_set[cpu#] */
1711 ldx r1,r3,r28 1744 ldx r1,r3,r28
1712 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD 1745 addi r1,r1,THREAD_SIZE-STACK_FRAME_OVERHEAD
@@ -1717,8 +1750,8 @@ _GLOBAL(__secondary_start)
1717 mtlr r7 1750 mtlr r7
1718 1751
1719 /* enable MMU and jump to start_secondary */ 1752 /* enable MMU and jump to start_secondary */
1720 LOADADDR(r3,.start_secondary_prolog) 1753 LOAD_REG_ADDR(r3, .start_secondary_prolog)
1721 SET_REG_TO_CONST(r4, MSR_KERNEL) 1754 LOAD_REG_IMMEDIATE(r4, MSR_KERNEL)
1722#ifdef DO_SOFT_DISABLE 1755#ifdef DO_SOFT_DISABLE
1723 ori r4,r4,MSR_EE 1756 ori r4,r4,MSR_EE
1724#endif 1757#endif
@@ -1767,8 +1800,8 @@ _STATIC(start_here_multiplatform)
1767 * be detached from the kernel completely. Besides, we need 1800 * be detached from the kernel completely. Besides, we need
1768 * to clear it now for kexec-style entry. 1801 * to clear it now for kexec-style entry.
1769 */ 1802 */
1770 LOADADDR(r11,__bss_stop) 1803 LOAD_REG_IMMEDIATE(r11,__bss_stop)
1771 LOADADDR(r8,__bss_start) 1804 LOAD_REG_IMMEDIATE(r8,__bss_start)
1772 sub r11,r11,r8 /* bss size */ 1805 sub r11,r11,r8 /* bss size */
1773 addi r11,r11,7 /* round up to an even double word */ 1806 addi r11,r11,7 /* round up to an even double word */
1774 rldicl. r11,r11,61,3 /* shift right by 3 */ 1807 rldicl. r11,r11,61,3 /* shift right by 3 */
@@ -1806,7 +1839,7 @@ _STATIC(start_here_multiplatform)
1806 /* up the htab. This is done because we have relocated the */ 1839 /* up the htab. This is done because we have relocated the */
1807 /* kernel but are still running in real mode. */ 1840 /* kernel but are still running in real mode. */
1808 1841
1809 LOADADDR(r3,init_thread_union) 1842 LOAD_REG_IMMEDIATE(r3,init_thread_union)
1810 add r3,r3,r26 1843 add r3,r3,r26
1811 1844
1812 /* set up a stack pointer (physical address) */ 1845 /* set up a stack pointer (physical address) */
@@ -1815,14 +1848,14 @@ _STATIC(start_here_multiplatform)
1815 stdu r0,-STACK_FRAME_OVERHEAD(r1) 1848 stdu r0,-STACK_FRAME_OVERHEAD(r1)
1816 1849
1817 /* set up the TOC (physical address) */ 1850 /* set up the TOC (physical address) */
1818 LOADADDR(r2,__toc_start) 1851 LOAD_REG_IMMEDIATE(r2,__toc_start)
1819 addi r2,r2,0x4000 1852 addi r2,r2,0x4000
1820 addi r2,r2,0x4000 1853 addi r2,r2,0x4000
1821 add r2,r2,r26 1854 add r2,r2,r26
1822 1855
1823 LOADADDR(r3,cpu_specs) 1856 LOAD_REG_IMMEDIATE(r3, cpu_specs)
1824 add r3,r3,r26 1857 add r3,r3,r26
1825 LOADADDR(r4,cur_cpu_spec) 1858 LOAD_REG_IMMEDIATE(r4,cur_cpu_spec)
1826 add r4,r4,r26 1859 add r4,r4,r26
1827 mr r5,r26 1860 mr r5,r26
1828 bl .identify_cpu 1861 bl .identify_cpu
@@ -1838,15 +1871,15 @@ _STATIC(start_here_multiplatform)
1838 * nowhere it can be initialized differently before we reach this 1871 * nowhere it can be initialized differently before we reach this
1839 * code 1872 * code
1840 */ 1873 */
1841 LOADADDR(r27, boot_cpuid) 1874 LOAD_REG_IMMEDIATE(r27, boot_cpuid)
1842 add r27,r27,r26 1875 add r27,r27,r26
1843 lwz r27,0(r27) 1876 lwz r27,0(r27)
1844 1877
1845 LOADADDR(r24, paca) /* Get base vaddr of paca array */ 1878 LOAD_REG_IMMEDIATE(r24, paca) /* Get base vaddr of paca array */
1846 mulli r13,r27,PACA_SIZE /* Calculate vaddr of right paca */ 1879 mulli r13,r27,PACA_SIZE /* Calculate vaddr of right paca */
1847 add r13,r13,r24 /* for this processor. */ 1880 add r13,r13,r24 /* for this processor. */
1848 add r13,r13,r26 /* convert to physical addr */ 1881 add r13,r13,r26 /* convert to physical addr */
1849 mtspr SPRN_SPRG3,r13 /* PPPBBB: Temp... -Peter */ 1882 mtspr SPRN_SPRG3,r13
1850 1883
1851 /* Do very early kernel initializations, including initial hash table, 1884 /* Do very early kernel initializations, including initial hash table,
1852 * stab and slb setup before we turn on relocation. */ 1885 * stab and slb setup before we turn on relocation. */
@@ -1855,8 +1888,8 @@ _STATIC(start_here_multiplatform)
1855 mr r3,r31 1888 mr r3,r31
1856 bl .early_setup 1889 bl .early_setup
1857 1890
1858 LOADADDR(r3,.start_here_common) 1891 LOAD_REG_IMMEDIATE(r3, .start_here_common)
1859 SET_REG_TO_CONST(r4, MSR_KERNEL) 1892 LOAD_REG_IMMEDIATE(r4, MSR_KERNEL)
1860 mtspr SPRN_SRR0,r3 1893 mtspr SPRN_SRR0,r3
1861 mtspr SPRN_SRR1,r4 1894 mtspr SPRN_SRR1,r4
1862 rfid 1895 rfid
@@ -1870,7 +1903,7 @@ _STATIC(start_here_common)
1870 /* The following code sets up the SP and TOC now that we are */ 1903 /* The following code sets up the SP and TOC now that we are */
1871 /* running with translation enabled. */ 1904 /* running with translation enabled. */
1872 1905
1873 LOADADDR(r3,init_thread_union) 1906 LOAD_REG_IMMEDIATE(r3,init_thread_union)
1874 1907
1875 /* set up the stack */ 1908 /* set up the stack */
1876 addi r1,r3,THREAD_SIZE 1909 addi r1,r3,THREAD_SIZE
@@ -1883,16 +1916,16 @@ _STATIC(start_here_common)
1883 li r3,0 1916 li r3,0
1884 bl .do_cpu_ftr_fixups 1917 bl .do_cpu_ftr_fixups
1885 1918
1886 LOADADDR(r26, boot_cpuid) 1919 LOAD_REG_IMMEDIATE(r26, boot_cpuid)
1887 lwz r26,0(r26) 1920 lwz r26,0(r26)
1888 1921
1889 LOADADDR(r24, paca) /* Get base vaddr of paca array */ 1922 LOAD_REG_IMMEDIATE(r24, paca) /* Get base vaddr of paca array */
1890 mulli r13,r26,PACA_SIZE /* Calculate vaddr of right paca */ 1923 mulli r13,r26,PACA_SIZE /* Calculate vaddr of right paca */
1891 add r13,r13,r24 /* for this processor. */ 1924 add r13,r13,r24 /* for this processor. */
1892 mtspr SPRN_SPRG3,r13 1925 mtspr SPRN_SPRG3,r13
1893 1926
1894 /* ptr to current */ 1927 /* ptr to current */
1895 LOADADDR(r4,init_task) 1928 LOAD_REG_IMMEDIATE(r4, init_task)
1896 std r4,PACACURRENT(r13) 1929 std r4,PACACURRENT(r13)
1897 1930
1898 /* Load the TOC */ 1931 /* Load the TOC */
@@ -1915,7 +1948,7 @@ _STATIC(start_here_common)
1915 1948
1916_GLOBAL(hmt_init) 1949_GLOBAL(hmt_init)
1917#ifdef CONFIG_HMT 1950#ifdef CONFIG_HMT
1918 LOADADDR(r5, hmt_thread_data) 1951 LOAD_REG_IMMEDIATE(r5, hmt_thread_data)
1919 mfspr r7,SPRN_PVR 1952 mfspr r7,SPRN_PVR
1920 srwi r7,r7,16 1953 srwi r7,r7,16
1921 cmpwi r7,0x34 /* Pulsar */ 1954 cmpwi r7,0x34 /* Pulsar */
@@ -1936,7 +1969,7 @@ _GLOBAL(hmt_init)
1936 b 101f 1969 b 101f
1937 1970
1938__hmt_secondary_hold: 1971__hmt_secondary_hold:
1939 LOADADDR(r5, hmt_thread_data) 1972 LOAD_REG_IMMEDIATE(r5, hmt_thread_data)
1940 clrldi r5,r5,4 1973 clrldi r5,r5,4
1941 li r7,0 1974 li r7,0
1942 mfspr r6,SPRN_PIR 1975 mfspr r6,SPRN_PIR
@@ -1964,7 +1997,7 @@ __hmt_secondary_hold:
1964 1997
1965#ifdef CONFIG_HMT 1998#ifdef CONFIG_HMT
1966_GLOBAL(hmt_start_secondary) 1999_GLOBAL(hmt_start_secondary)
1967 LOADADDR(r4,__hmt_secondary_hold) 2000 LOAD_REG_IMMEDIATE(r4,__hmt_secondary_hold)
1968 clrldi r4,r4,4 2001 clrldi r4,r4,4
1969 mtspr SPRN_NIADORM, r4 2002 mtspr SPRN_NIADORM, r4
1970 mfspr r4, SPRN_MSRDORM 2003 mfspr r4, SPRN_MSRDORM
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
new file mode 100644
index 000000000000..e47d40ac6f39
--- /dev/null
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -0,0 +1,396 @@
1/*
2 * IBM PowerPC IBM eBus Infrastructure Support.
3 *
4 * Copyright (c) 2005 IBM Corporation
5 * Heiko J Schick <schickhj@de.ibm.com>
6 *
7 * All rights reserved.
8 *
9 * This source code is distributed under a dual license of GPL v2.0 and OpenIB
10 * BSD.
11 *
12 * OpenIB BSD License
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are met:
16 *
17 * Redistributions of source code must retain the above copyright notice, this
18 * list of conditions and the following disclaimer.
19 *
20 * Redistributions in binary form must reproduce the above copyright notice,
21 * this list of conditions and the following disclaimer in the documentation
22 * and/or other materials
23 * provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
32 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
33 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#include <linux/init.h>
39#include <linux/console.h>
40#include <linux/kobject.h>
41#include <linux/dma-mapping.h>
42#include <linux/interrupt.h>
43#include <asm/ibmebus.h>
44#include <asm/abs_addr.h>
45
46static struct ibmebus_dev ibmebus_bus_device = { /* fake "parent" device */
47 .name = ibmebus_bus_device.ofdev.dev.bus_id,
48 .ofdev.dev.bus_id = "ibmebus",
49 .ofdev.dev.bus = &ibmebus_bus_type,
50};
51
52static void *ibmebus_alloc_coherent(struct device *dev,
53 size_t size,
54 dma_addr_t *dma_handle,
55 gfp_t flag)
56{
57 void *mem;
58
59 mem = kmalloc(size, flag);
60 *dma_handle = (dma_addr_t)mem;
61
62 return mem;
63}
64
65static void ibmebus_free_coherent(struct device *dev,
66 size_t size, void *vaddr,
67 dma_addr_t dma_handle)
68{
69 kfree(vaddr);
70}
71
72static dma_addr_t ibmebus_map_single(struct device *dev,
73 void *ptr,
74 size_t size,
75 enum dma_data_direction direction)
76{
77 return (dma_addr_t)(ptr);
78}
79
80static void ibmebus_unmap_single(struct device *dev,
81 dma_addr_t dma_addr,
82 size_t size,
83 enum dma_data_direction direction)
84{
85 return;
86}
87
88static int ibmebus_map_sg(struct device *dev,
89 struct scatterlist *sg,
90 int nents, enum dma_data_direction direction)
91{
92 int i;
93
94 for (i = 0; i < nents; i++) {
95 sg[i].dma_address = (dma_addr_t)page_address(sg[i].page)
96 + sg[i].offset;
97 sg[i].dma_length = sg[i].length;
98 }
99
100 return nents;
101}
102
103static void ibmebus_unmap_sg(struct device *dev,
104 struct scatterlist *sg,
105 int nents, enum dma_data_direction direction)
106{
107 return;
108}
109
110static int ibmebus_dma_supported(struct device *dev, u64 mask)
111{
112 return 1;
113}
114
115struct dma_mapping_ops ibmebus_dma_ops = {
116 .alloc_coherent = ibmebus_alloc_coherent,
117 .free_coherent = ibmebus_free_coherent,
118 .map_single = ibmebus_map_single,
119 .unmap_single = ibmebus_unmap_single,
120 .map_sg = ibmebus_map_sg,
121 .unmap_sg = ibmebus_unmap_sg,
122 .dma_supported = ibmebus_dma_supported,
123};
124
125static int ibmebus_bus_probe(struct device *dev)
126{
127 struct ibmebus_dev *ibmebusdev = to_ibmebus_dev(dev);
128 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver);
129 const struct of_device_id *id;
130 int error = -ENODEV;
131
132 if (!ibmebusdrv->probe)
133 return error;
134
135 id = of_match_device(ibmebusdrv->id_table, &ibmebusdev->ofdev);
136 if (id) {
137 error = ibmebusdrv->probe(ibmebusdev, id);
138 }
139
140 return error;
141}
142
143static int ibmebus_bus_remove(struct device *dev)
144{
145 struct ibmebus_dev *ibmebusdev = to_ibmebus_dev(dev);
146 struct ibmebus_driver *ibmebusdrv = to_ibmebus_driver(dev->driver);
147
148 if (ibmebusdrv->remove) {
149 return ibmebusdrv->remove(ibmebusdev);
150 }
151
152 return 0;
153}
154
155static void __devinit ibmebus_dev_release(struct device *dev)
156{
157 of_node_put(to_ibmebus_dev(dev)->ofdev.node);
158 kfree(to_ibmebus_dev(dev));
159}
160
161static ssize_t ibmebusdev_show_name(struct device *dev,
162 struct device_attribute *attr, char *buf)
163{
164 return sprintf(buf, "%s\n", to_ibmebus_dev(dev)->name);
165}
166static DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, ibmebusdev_show_name,
167 NULL);
168
169static struct ibmebus_dev* __devinit ibmebus_register_device_common(
170 struct ibmebus_dev *dev, char *name)
171{
172 int err = 0;
173
174 dev->name = name;
175 dev->ofdev.dev.parent = &ibmebus_bus_device.ofdev.dev;
176 dev->ofdev.dev.bus = &ibmebus_bus_type;
177 dev->ofdev.dev.release = ibmebus_dev_release;
178
179 /* An ibmebusdev is based on a of_device. We have to change the
180 * bus type to use our own DMA mapping operations.
181 */
182 if ((err = of_device_register(&dev->ofdev)) != 0) {
183 printk(KERN_ERR "%s: failed to register device (%d).\n",
184 __FUNCTION__, err);
185 return NULL;
186 }
187
188 device_create_file(&dev->ofdev.dev, &dev_attr_name);
189
190 return dev;
191}
192
193static struct ibmebus_dev* __devinit ibmebus_register_device_node(
194 struct device_node *dn)
195{
196 struct ibmebus_dev *dev;
197 char *loc_code;
198 int length;
199
200 loc_code = (char *)get_property(dn, "ibm,loc-code", NULL);
201 if (!loc_code) {
202 printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n",
203 __FUNCTION__, dn->name ? dn->name : "<unknown>");
204 return NULL;
205 }
206
207 if (strlen(loc_code) == 0) {
208 printk(KERN_WARNING "%s: 'ibm,loc-code' is invalid\n",
209 __FUNCTION__);
210 return NULL;
211 }
212
213 dev = kmalloc(sizeof(struct ibmebus_dev), GFP_KERNEL);
214 if (!dev) {
215 return NULL;
216 }
217 memset(dev, 0, sizeof(struct ibmebus_dev));
218
219 dev->ofdev.node = of_node_get(dn);
220
221 length = strlen(loc_code);
222 memcpy(dev->ofdev.dev.bus_id, loc_code
223 + (length - min(length, BUS_ID_SIZE - 1)),
224 min(length, BUS_ID_SIZE - 1));
225
226 /* Register with generic device framework. */
227 if (ibmebus_register_device_common(dev, dn->name) == NULL) {
228 kfree(dev);
229 return NULL;
230 }
231
232 return dev;
233}
234
235static void ibmebus_probe_of_nodes(char* name)
236{
237 struct device_node *dn = NULL;
238
239 while ((dn = of_find_node_by_name(dn, name))) {
240 if (ibmebus_register_device_node(dn) == NULL) {
241 of_node_put(dn);
242
243 return;
244 }
245 }
246
247 of_node_put(dn);
248
249 return;
250}
251
252static void ibmebus_add_devices_by_id(struct of_device_id *idt)
253{
254 while (strlen(idt->name) > 0) {
255 ibmebus_probe_of_nodes(idt->name);
256 idt++;
257 }
258
259 return;
260}
261
262static int ibmebus_match_helper(struct device *dev, void *data)
263{
264 if (strcmp((char*)data, to_ibmebus_dev(dev)->name) == 0)
265 return 1;
266
267 return 0;
268}
269
270static int ibmebus_unregister_device(struct device *dev)
271{
272 device_remove_file(dev, &dev_attr_name);
273 of_device_unregister(to_of_device(dev));
274
275 return 0;
276}
277
278static void ibmebus_remove_devices_by_id(struct of_device_id *idt)
279{
280 struct device *dev;
281
282 while (strlen(idt->name) > 0) {
283 while ((dev = bus_find_device(&ibmebus_bus_type, NULL,
284 (void*)idt->name,
285 ibmebus_match_helper))) {
286 ibmebus_unregister_device(dev);
287 }
288 idt++;
289
290 }
291
292 return;
293}
294
295int ibmebus_register_driver(struct ibmebus_driver *drv)
296{
297 int err = 0;
298
299 drv->driver.name = drv->name;
300 drv->driver.bus = &ibmebus_bus_type;
301 drv->driver.probe = ibmebus_bus_probe;
302 drv->driver.remove = ibmebus_bus_remove;
303
304 if ((err = driver_register(&drv->driver) != 0))
305 return err;
306
307 ibmebus_add_devices_by_id(drv->id_table);
308
309 return 0;
310}
311EXPORT_SYMBOL(ibmebus_register_driver);
312
313void ibmebus_unregister_driver(struct ibmebus_driver *drv)
314{
315 driver_unregister(&drv->driver);
316 ibmebus_remove_devices_by_id(drv->id_table);
317}
318EXPORT_SYMBOL(ibmebus_unregister_driver);
319
320int ibmebus_request_irq(struct ibmebus_dev *dev,
321 u32 ist,
322 irqreturn_t (*handler)(int, void*, struct pt_regs *),
323 unsigned long irq_flags, const char * devname,
324 void *dev_id)
325{
326 unsigned int irq = virt_irq_create_mapping(ist);
327
328 if (irq == NO_IRQ)
329 return -EINVAL;
330
331 irq = irq_offset_up(irq);
332
333 return request_irq(irq, handler,
334 irq_flags, devname, dev_id);
335}
336EXPORT_SYMBOL(ibmebus_request_irq);
337
338void ibmebus_free_irq(struct ibmebus_dev *dev, u32 ist, void *dev_id)
339{
340 unsigned int irq = virt_irq_create_mapping(ist);
341
342 irq = irq_offset_up(irq);
343 free_irq(irq, dev_id);
344
345 return;
346}
347EXPORT_SYMBOL(ibmebus_free_irq);
348
349static int ibmebus_bus_match(struct device *dev, struct device_driver *drv)
350{
351 const struct ibmebus_dev *ebus_dev = to_ibmebus_dev(dev);
352 struct ibmebus_driver *ebus_drv = to_ibmebus_driver(drv);
353 const struct of_device_id *ids = ebus_drv->id_table;
354 const struct of_device_id *found_id;
355
356 if (!ids)
357 return 0;
358
359 found_id = of_match_device(ids, &ebus_dev->ofdev);
360 if (found_id)
361 return 1;
362
363 return 0;
364}
365
366struct bus_type ibmebus_bus_type = {
367 .name = "ibmebus",
368 .match = ibmebus_bus_match,
369};
370EXPORT_SYMBOL(ibmebus_bus_type);
371
372static int __init ibmebus_bus_init(void)
373{
374 int err;
375
376 printk(KERN_INFO "IBM eBus Device Driver\n");
377
378 err = bus_register(&ibmebus_bus_type);
379 if (err) {
380 printk(KERN_ERR ":%s: failed to register IBM eBus.\n",
381 __FUNCTION__);
382 return err;
383 }
384
385 err = device_register(&ibmebus_bus_device.ofdev.dev);
386 if (err) {
387 printk(KERN_WARNING "%s: device_register returned %i\n",
388 __FUNCTION__, err);
389 bus_unregister(&ibmebus_bus_type);
390
391 return err;
392 }
393
394 return 0;
395}
396__initcall(ibmebus_bus_init);
diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
index 1494e2f177f7..c16b4afab582 100644
--- a/arch/powerpc/kernel/idle_power4.S
+++ b/arch/powerpc/kernel/idle_power4.S
@@ -38,14 +38,14 @@ END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
38 /* We must dynamically check for the NAP feature as it 38 /* We must dynamically check for the NAP feature as it
39 * can be cleared by CPU init after the fixups are done 39 * can be cleared by CPU init after the fixups are done
40 */ 40 */
41 LOADBASE(r3,cur_cpu_spec) 41 LOAD_REG_ADDRBASE(r3,cur_cpu_spec)
42 ld r4,OFF(cur_cpu_spec)(r3) 42 ld r4,ADDROFF(cur_cpu_spec)(r3)
43 ld r4,CPU_SPEC_FEATURES(r4) 43 ld r4,CPU_SPEC_FEATURES(r4)
44 andi. r0,r4,CPU_FTR_CAN_NAP 44 andi. r0,r4,CPU_FTR_CAN_NAP
45 beqlr 45 beqlr
46 /* Now check if user or arch enabled NAP mode */ 46 /* Now check if user or arch enabled NAP mode */
47 LOADBASE(r3,powersave_nap) 47 LOAD_REG_ADDRBASE(r3,powersave_nap)
48 lwz r4,OFF(powersave_nap)(r3) 48 lwz r4,ADDROFF(powersave_nap)(r3)
49 cmpwi 0,r4,0 49 cmpwi 0,r4,0
50 beqlr 50 beqlr
51 51
diff --git a/arch/powerpc/kernel/ioctl32.c b/arch/powerpc/kernel/ioctl32.c
deleted file mode 100644
index 0fa3d27fef01..000000000000
--- a/arch/powerpc/kernel/ioctl32.c
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
3 *
4 * Based on sparc64 ioctl32.c by:
5 *
6 * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com)
7 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
8 *
9 * ppc64 changes:
10 *
11 * Copyright (C) 2000 Ken Aaker (kdaaker@rchland.vnet.ibm.com)
12 * Copyright (C) 2001 Anton Blanchard (antonb@au.ibm.com)
13 *
14 * These routines maintain argument size conversion between 32bit and 64bit
15 * ioctls.
16 *
17 * This program is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU General Public License
19 * as published by the Free Software Foundation; either version
20 * 2 of the License, or (at your option) any later version.
21 */
22
23#define INCLUDES
24#include "compat_ioctl.c"
25#include <linux/syscalls.h>
26
27#define CODE
28#include "compat_ioctl.c"
29
30#define HANDLE_IOCTL(cmd,handler) { cmd, (ioctl_trans_handler_t)handler, NULL },
31#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd,sys_ioctl)
32
33#define IOCTL_TABLE_START \
34 struct ioctl_trans ioctl_start[] = {
35#define IOCTL_TABLE_END \
36 };
37
38IOCTL_TABLE_START
39#include <linux/compat_ioctl.h>
40#define DECLARES
41#include "compat_ioctl.c"
42
43IOCTL_TABLE_END
44
45int ioctl_table_size = ARRAY_SIZE(ioctl_start);
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 5a71ed9612fe..d1fffce86df9 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -31,7 +31,6 @@
31 * to reduce code space and undefined function references. 31 * to reduce code space and undefined function references.
32 */ 32 */
33 33
34#include <linux/errno.h>
35#include <linux/module.h> 34#include <linux/module.h>
36#include <linux/threads.h> 35#include <linux/threads.h>
37#include <linux/kernel_stat.h> 36#include <linux/kernel_stat.h>
@@ -44,18 +43,12 @@
44#include <linux/config.h> 43#include <linux/config.h>
45#include <linux/init.h> 44#include <linux/init.h>
46#include <linux/slab.h> 45#include <linux/slab.h>
47#include <linux/pci.h>
48#include <linux/delay.h> 46#include <linux/delay.h>
49#include <linux/irq.h> 47#include <linux/irq.h>
50#include <linux/proc_fs.h>
51#include <linux/random.h>
52#include <linux/seq_file.h> 48#include <linux/seq_file.h>
53#include <linux/cpumask.h> 49#include <linux/cpumask.h>
54#include <linux/profile.h> 50#include <linux/profile.h>
55#include <linux/bitops.h> 51#include <linux/bitops.h>
56#ifdef CONFIG_PPC64
57#include <linux/kallsyms.h>
58#endif
59 52
60#include <asm/uaccess.h> 53#include <asm/uaccess.h>
61#include <asm/system.h> 54#include <asm/system.h>
@@ -66,8 +59,7 @@
66#include <asm/prom.h> 59#include <asm/prom.h>
67#include <asm/ptrace.h> 60#include <asm/ptrace.h>
68#include <asm/machdep.h> 61#include <asm/machdep.h>
69#ifdef CONFIG_PPC64 62#ifdef CONFIG_PPC_ISERIES
70#include <asm/iseries/it_lp_queue.h>
71#include <asm/paca.h> 63#include <asm/paca.h>
72#endif 64#endif
73 65
@@ -78,10 +70,6 @@ EXPORT_SYMBOL(__irq_offset_value);
78 70
79static int ppc_spurious_interrupts; 71static int ppc_spurious_interrupts;
80 72
81#if defined(CONFIG_PPC_ISERIES) && defined(CONFIG_SMP)
82extern void iSeries_smp_message_recv(struct pt_regs *);
83#endif
84
85#ifdef CONFIG_PPC32 73#ifdef CONFIG_PPC32
86#define NR_MASK_WORDS ((NR_IRQS + 31) / 32) 74#define NR_MASK_WORDS ((NR_IRQS + 31) / 32)
87 75
@@ -195,49 +183,6 @@ void fixup_irqs(cpumask_t map)
195} 183}
196#endif 184#endif
197 185
198#ifdef CONFIG_PPC_ISERIES
199void do_IRQ(struct pt_regs *regs)
200{
201 struct paca_struct *lpaca;
202
203 irq_enter();
204
205#ifdef CONFIG_DEBUG_STACKOVERFLOW
206 /* Debugging check for stack overflow: is there less than 2KB free? */
207 {
208 long sp;
209
210 sp = __get_SP() & (THREAD_SIZE-1);
211
212 if (unlikely(sp < (sizeof(struct thread_info) + 2048))) {
213 printk("do_IRQ: stack overflow: %ld\n",
214 sp - sizeof(struct thread_info));
215 dump_stack();
216 }
217 }
218#endif
219
220 lpaca = get_paca();
221#ifdef CONFIG_SMP
222 if (lpaca->lppaca.int_dword.fields.ipi_cnt) {
223 lpaca->lppaca.int_dword.fields.ipi_cnt = 0;
224 iSeries_smp_message_recv(regs);
225 }
226#endif /* CONFIG_SMP */
227 if (hvlpevent_is_pending())
228 process_hvlpevents(regs);
229
230 irq_exit();
231
232 if (lpaca->lppaca.int_dword.fields.decr_int) {
233 lpaca->lppaca.int_dword.fields.decr_int = 0;
234 /* Signal a fake decrementer interrupt */
235 timer_interrupt(regs);
236 }
237}
238
239#else /* CONFIG_PPC_ISERIES */
240
241void do_IRQ(struct pt_regs *regs) 186void do_IRQ(struct pt_regs *regs)
242{ 187{
243 int irq; 188 int irq;
@@ -286,16 +231,20 @@ void do_IRQ(struct pt_regs *regs)
286 } else 231 } else
287#endif 232#endif
288 __do_IRQ(irq, regs); 233 __do_IRQ(irq, regs);
289 } else 234 } else if (irq != -2)
290#ifdef CONFIG_PPC32 235 /* That's not SMP safe ... but who cares ? */
291 if (irq != -2) 236 ppc_spurious_interrupts++;
292#endif 237
293 /* That's not SMP safe ... but who cares ? */
294 ppc_spurious_interrupts++;
295 irq_exit(); 238 irq_exit();
296}
297 239
298#endif /* CONFIG_PPC_ISERIES */ 240#ifdef CONFIG_PPC_ISERIES
241 if (get_lppaca()->int_dword.fields.decr_int) {
242 get_lppaca()->int_dword.fields.decr_int = 0;
243 /* Signal a fake decrementer interrupt */
244 timer_interrupt(regs);
245 }
246#endif
247}
299 248
300void __init init_IRQ(void) 249void __init init_IRQ(void)
301{ 250{
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 511af54e6230..cfab48566db1 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -35,7 +35,6 @@
35#include <asm/kdebug.h> 35#include <asm/kdebug.h>
36#include <asm/sstep.h> 36#include <asm/sstep.h>
37 37
38static DECLARE_MUTEX(kprobe_mutex);
39DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 38DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
40DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 39DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
41 40
@@ -54,19 +53,17 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
54 53
55 /* insn must be on a special executable page on ppc64 */ 54 /* insn must be on a special executable page on ppc64 */
56 if (!ret) { 55 if (!ret) {
57 down(&kprobe_mutex);
58 p->ainsn.insn = get_insn_slot(); 56 p->ainsn.insn = get_insn_slot();
59 up(&kprobe_mutex);
60 if (!p->ainsn.insn) 57 if (!p->ainsn.insn)
61 ret = -ENOMEM; 58 ret = -ENOMEM;
62 } 59 }
63 return ret;
64}
65 60
66void __kprobes arch_copy_kprobe(struct kprobe *p) 61 if (!ret) {
67{ 62 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t));
68 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); 63 p->opcode = *p->addr;
69 p->opcode = *p->addr; 64 }
65
66 return ret;
70} 67}
71 68
72void __kprobes arch_arm_kprobe(struct kprobe *p) 69void __kprobes arch_arm_kprobe(struct kprobe *p)
@@ -177,11 +174,23 @@ static inline int kprobe_handler(struct pt_regs *regs)
177 save_previous_kprobe(kcb); 174 save_previous_kprobe(kcb);
178 set_current_kprobe(p, regs, kcb); 175 set_current_kprobe(p, regs, kcb);
179 kcb->kprobe_saved_msr = regs->msr; 176 kcb->kprobe_saved_msr = regs->msr;
180 p->nmissed++; 177 kprobes_inc_nmissed_count(p);
181 prepare_singlestep(p, regs); 178 prepare_singlestep(p, regs);
182 kcb->kprobe_status = KPROBE_REENTER; 179 kcb->kprobe_status = KPROBE_REENTER;
183 return 1; 180 return 1;
184 } else { 181 } else {
182 if (*addr != BREAKPOINT_INSTRUCTION) {
183 /* If trap variant, then it belongs not to us */
184 kprobe_opcode_t cur_insn = *addr;
185 if (is_trap(cur_insn))
186 goto no_kprobe;
187 /* The breakpoint instruction was removed by
188 * another cpu right after we hit, no further
189 * handling of this interrupt is appropriate
190 */
191 ret = 1;
192 goto no_kprobe;
193 }
185 p = __get_cpu_var(current_kprobe); 194 p = __get_cpu_var(current_kprobe);
186 if (p->break_handler && p->break_handler(p, regs)) { 195 if (p->break_handler && p->break_handler(p, regs)) {
187 goto ss_probe; 196 goto ss_probe;
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
new file mode 100644
index 000000000000..f970ace208d3
--- /dev/null
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -0,0 +1,557 @@
1#include <linux/config.h>
2#include <linux/kernel.h>
3#include <linux/serial.h>
4#include <linux/serial_8250.h>
5#include <linux/serial_core.h>
6#include <linux/console.h>
7#include <linux/pci.h>
8#include <asm/io.h>
9#include <asm/mmu.h>
10#include <asm/prom.h>
11#include <asm/serial.h>
12#include <asm/udbg.h>
13#include <asm/pci-bridge.h>
14#include <asm/ppc-pci.h>
15
16#undef DEBUG
17
18#ifdef DEBUG
19#define DBG(fmt...) do { printk(fmt); } while(0)
20#else
21#define DBG(fmt...) do { } while(0)
22#endif
23
24#define MAX_LEGACY_SERIAL_PORTS 8
25
26static struct plat_serial8250_port
27legacy_serial_ports[MAX_LEGACY_SERIAL_PORTS+1];
28static struct legacy_serial_info {
29 struct device_node *np;
30 unsigned int speed;
31 unsigned int clock;
32 phys_addr_t taddr;
33} legacy_serial_infos[MAX_LEGACY_SERIAL_PORTS];
34static unsigned int legacy_serial_count;
35static int legacy_serial_console = -1;
36
37static int __init add_legacy_port(struct device_node *np, int want_index,
38 int iotype, phys_addr_t base,
39 phys_addr_t taddr, unsigned long irq,
40 unsigned int flags)
41{
42 u32 *clk, *spd, clock = BASE_BAUD * 16;
43 int index;
44
45 /* get clock freq. if present */
46 clk = (u32 *)get_property(np, "clock-frequency", NULL);
47 if (clk && *clk)
48 clock = *clk;
49
50 /* get default speed if present */
51 spd = (u32 *)get_property(np, "current-speed", NULL);
52
53 /* If we have a location index, then try to use it */
54 if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS)
55 index = want_index;
56 else
57 index = legacy_serial_count;
58
59 /* if our index is still out of range, that mean that
60 * array is full, we could scan for a free slot but that
61 * make little sense to bother, just skip the port
62 */
63 if (index >= MAX_LEGACY_SERIAL_PORTS)
64 return -1;
65 if (index >= legacy_serial_count)
66 legacy_serial_count = index + 1;
67
68 /* Check if there is a port who already claimed our slot */
69 if (legacy_serial_infos[index].np != 0) {
70 /* if we still have some room, move it, else override */
71 if (legacy_serial_count < MAX_LEGACY_SERIAL_PORTS) {
72 printk(KERN_INFO "Moved legacy port %d -> %d\n",
73 index, legacy_serial_count);
74 legacy_serial_ports[legacy_serial_count] =
75 legacy_serial_ports[index];
76 legacy_serial_infos[legacy_serial_count] =
77 legacy_serial_infos[index];
78 legacy_serial_count++;
79 } else {
80 printk(KERN_INFO "Replacing legacy port %d\n", index);
81 }
82 }
83
84 /* Now fill the entry */
85 memset(&legacy_serial_ports[index], 0,
86 sizeof(struct plat_serial8250_port));
87 if (iotype == UPIO_PORT)
88 legacy_serial_ports[index].iobase = base;
89 else
90 legacy_serial_ports[index].mapbase = base;
91 legacy_serial_ports[index].iotype = iotype;
92 legacy_serial_ports[index].uartclk = clock;
93 legacy_serial_ports[index].irq = irq;
94 legacy_serial_ports[index].flags = flags;
95 legacy_serial_infos[index].taddr = taddr;
96 legacy_serial_infos[index].np = of_node_get(np);
97 legacy_serial_infos[index].clock = clock;
98 legacy_serial_infos[index].speed = spd ? *spd : 0;
99
100 printk(KERN_INFO "Found legacy serial port %d for %s\n",
101 index, np->full_name);
102 printk(KERN_INFO " %s=%llx, taddr=%llx, irq=%lx, clk=%d, speed=%d\n",
103 (iotype == UPIO_PORT) ? "port" : "mem",
104 (unsigned long long)base, (unsigned long long)taddr, irq,
105 legacy_serial_ports[index].uartclk,
106 legacy_serial_infos[index].speed);
107
108 return index;
109}
110
111static int __init add_legacy_soc_port(struct device_node *np,
112 struct device_node *soc_dev)
113{
114 phys_addr_t addr;
115 u32 *addrp;
116 unsigned int flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ;
117
118 /* We only support ports that have a clock frequency properly
119 * encoded in the device-tree.
120 */
121 if (get_property(np, "clock-frequency", NULL) == NULL)
122 return -1;
123
124 /* Get the address */
125 addrp = of_get_address(soc_dev, 0, NULL, NULL);
126 if (addrp == NULL)
127 return -1;
128
129 addr = of_translate_address(soc_dev, addrp);
130
131 /* Add port, irq will be dealt with later. We passed a translated
132 * IO port value. It will be fixed up later along with the irq
133 */
134 return add_legacy_port(np, -1, UPIO_MEM, addr, addr, NO_IRQ, flags);
135}
136
137#ifdef CONFIG_ISA
138static int __init add_legacy_isa_port(struct device_node *np,
139 struct device_node *isa_brg)
140{
141 u32 *reg;
142 char *typep;
143 int index = -1;
144 phys_addr_t taddr;
145
146 /* Get the ISA port number */
147 reg = (u32 *)get_property(np, "reg", NULL);
148 if (reg == NULL)
149 return -1;
150
151 /* Verify it's an IO port, we don't support anything else */
152 if (!(reg[0] & 0x00000001))
153 return -1;
154
155 /* Now look for an "ibm,aix-loc" property that gives us ordering
156 * if any...
157 */
158 typep = (char *)get_property(np, "ibm,aix-loc", NULL);
159
160 /* If we have a location index, then use it */
161 if (typep && *typep == 'S')
162 index = simple_strtol(typep+1, NULL, 0) - 1;
163
164 /* Translate ISA address */
165 taddr = of_translate_address(np, reg);
166
167 /* Add port, irq will be dealt with later */
168 return add_legacy_port(np, index, UPIO_PORT, reg[1], taddr, NO_IRQ, UPF_BOOT_AUTOCONF);
169
170}
171#endif
172
173#ifdef CONFIG_PCI
174static int __init add_legacy_pci_port(struct device_node *np,
175 struct device_node *pci_dev)
176{
177 phys_addr_t addr, base;
178 u32 *addrp;
179 unsigned int flags;
180 int iotype, index = -1, lindex = 0;
181
182 /* We only support ports that have a clock frequency properly
183 * encoded in the device-tree (that is have an fcode). Anything
184 * else can't be used that early and will be normally probed by
185 * the generic 8250_pci driver later on. The reason is that 8250
186 * compatible UARTs on PCI need all sort of quirks (port offsets
187 * etc...) that this code doesn't know about
188 */
189 if (get_property(np, "clock-frequency", NULL) == NULL)
190 return -1;
191
192 /* Get the PCI address. Assume BAR 0 */
193 addrp = of_get_pci_address(pci_dev, 0, NULL, &flags);
194 if (addrp == NULL)
195 return -1;
196
197 /* We only support BAR 0 for now */
198 iotype = (flags & IORESOURCE_MEM) ? UPIO_MEM : UPIO_PORT;
199 addr = of_translate_address(pci_dev, addrp);
200
201 /* Set the IO base to the same as the translated address for MMIO,
202 * or to the domain local IO base for PIO (it will be fixed up later)
203 */
204 if (iotype == UPIO_MEM)
205 base = addr;
206 else
207 base = addrp[2];
208
209 /* Try to guess an index... If we have subdevices of the pci dev,
210 * we get to their "reg" property
211 */
212 if (np != pci_dev) {
213 u32 *reg = (u32 *)get_property(np, "reg", NULL);
214 if (reg && (*reg < 4))
215 index = lindex = *reg;
216 }
217
218 /* Local index means it's the Nth port in the PCI chip. Unfortunately
219 * the offset to add here is device specific. We know about those
220 * EXAR ports and we default to the most common case. If your UART
221 * doesn't work for these settings, you'll have to add your own special
222 * cases here
223 */
224 if (device_is_compatible(pci_dev, "pci13a8,152") ||
225 device_is_compatible(pci_dev, "pci13a8,154") ||
226 device_is_compatible(pci_dev, "pci13a8,158")) {
227 addr += 0x200 * lindex;
228 base += 0x200 * lindex;
229 } else {
230 addr += 8 * lindex;
231 base += 8 * lindex;
232 }
233
234 /* Add port, irq will be dealt with later. We passed a translated
235 * IO port value. It will be fixed up later along with the irq
236 */
237 return add_legacy_port(np, index, iotype, base, addr, NO_IRQ, UPF_BOOT_AUTOCONF);
238}
239#endif
240
241/*
242 * This is called very early, as part of setup_system() or eventually
243 * setup_arch(), basically before anything else in this file. This function
244 * will try to build a list of all the available 8250-compatible serial ports
245 * in the machine using the Open Firmware device-tree. It currently only deals
246 * with ISA and PCI busses but could be extended. It allows a very early boot
247 * console to be initialized, that list is also used later to provide 8250 with
248 * the machine non-PCI ports and to properly pick the default console port
249 */
250void __init find_legacy_serial_ports(void)
251{
252 struct device_node *np, *stdout = NULL;
253 char *path;
254 int index;
255
256 DBG(" -> find_legacy_serial_port()\n");
257
258 /* Now find out if one of these is out firmware console */
259 path = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
260 if (path != NULL) {
261 stdout = of_find_node_by_path(path);
262 if (stdout)
263 DBG("stdout is %s\n", stdout->full_name);
264 } else {
265 DBG(" no linux,stdout-path !\n");
266 }
267
268 /* First fill our array with SOC ports */
269 for (np = NULL; (np = of_find_compatible_node(np, "serial", "ns16550")) != NULL;) {
270 struct device_node *soc = of_get_parent(np);
271 if (soc && !strcmp(soc->type, "soc")) {
272 index = add_legacy_soc_port(np, np);
273 if (index >= 0 && np == stdout)
274 legacy_serial_console = index;
275 }
276 of_node_put(soc);
277 }
278
279#ifdef CONFIG_ISA
280 /* First fill our array with ISA ports */
281 for (np = NULL; (np = of_find_node_by_type(np, "serial"));) {
282 struct device_node *isa = of_get_parent(np);
283 if (isa && !strcmp(isa->name, "isa")) {
284 index = add_legacy_isa_port(np, isa);
285 if (index >= 0 && np == stdout)
286 legacy_serial_console = index;
287 }
288 of_node_put(isa);
289 }
290#endif
291
292#ifdef CONFIG_PCI
293 /* Next, try to locate PCI ports */
294 for (np = NULL; (np = of_find_all_nodes(np));) {
295 struct device_node *pci, *parent = of_get_parent(np);
296 if (parent && !strcmp(parent->name, "isa")) {
297 of_node_put(parent);
298 continue;
299 }
300 if (strcmp(np->name, "serial") && strcmp(np->type, "serial")) {
301 of_node_put(parent);
302 continue;
303 }
304 /* Check for known pciclass, and also check wether we have
305 * a device with child nodes for ports or not
306 */
307 if (device_is_compatible(np, "pciclass,0700") ||
308 device_is_compatible(np, "pciclass,070002"))
309 pci = np;
310 else if (device_is_compatible(parent, "pciclass,0700") ||
311 device_is_compatible(parent, "pciclass,070002"))
312 pci = parent;
313 else {
314 of_node_put(parent);
315 continue;
316 }
317 index = add_legacy_pci_port(np, pci);
318 if (index >= 0 && np == stdout)
319 legacy_serial_console = index;
320 of_node_put(parent);
321 }
322#endif
323
324 DBG("legacy_serial_console = %d\n", legacy_serial_console);
325
326 /* udbg is 64 bits only for now, that will change soon though ... */
327 while (legacy_serial_console >= 0) {
328 struct legacy_serial_info *info =
329 &legacy_serial_infos[legacy_serial_console];
330 void __iomem *addr;
331
332 if (info->taddr == 0)
333 break;
334 addr = ioremap(info->taddr, 0x1000);
335 if (addr == NULL)
336 break;
337 if (info->speed == 0)
338 info->speed = udbg_probe_uart_speed(addr, info->clock);
339 DBG("default console speed = %d\n", info->speed);
340 udbg_init_uart(addr, info->speed, info->clock);
341 break;
342 }
343
344 DBG(" <- find_legacy_serial_port()\n");
345}
346
347static struct platform_device serial_device = {
348 .name = "serial8250",
349 .id = PLAT8250_DEV_PLATFORM,
350 .dev = {
351 .platform_data = legacy_serial_ports,
352 },
353};
354
355static void __init fixup_port_irq(int index,
356 struct device_node *np,
357 struct plat_serial8250_port *port)
358{
359 DBG("fixup_port_irq(%d)\n", index);
360
361 /* Check for interrupts in that node */
362 if (np->n_intrs > 0) {
363 port->irq = np->intrs[0].line;
364 DBG(" port %d (%s), irq=%d\n",
365 index, np->full_name, port->irq);
366 return;
367 }
368
369 /* Check for interrupts in the parent */
370 np = of_get_parent(np);
371 if (np == NULL)
372 return;
373
374 if (np->n_intrs > 0) {
375 port->irq = np->intrs[0].line;
376 DBG(" port %d (%s), irq=%d\n",
377 index, np->full_name, port->irq);
378 }
379 of_node_put(np);
380}
381
382static void __init fixup_port_pio(int index,
383 struct device_node *np,
384 struct plat_serial8250_port *port)
385{
386#ifdef CONFIG_PCI
387 struct pci_controller *hose;
388
389 DBG("fixup_port_pio(%d)\n", index);
390
391 hose = pci_find_hose_for_OF_device(np);
392 if (hose) {
393 unsigned long offset = (unsigned long)hose->io_base_virt -
394#ifdef CONFIG_PPC64
395 pci_io_base;
396#else
397 isa_io_base;
398#endif
399 DBG("port %d, IO %lx -> %lx\n",
400 index, port->iobase, port->iobase + offset);
401 port->iobase += offset;
402 }
403#endif
404}
405
406static void __init fixup_port_mmio(int index,
407 struct device_node *np,
408 struct plat_serial8250_port *port)
409{
410 DBG("fixup_port_mmio(%d)\n", index);
411
412 port->membase = ioremap(port->mapbase, 0x100);
413}
414
415/*
416 * This is called as an arch initcall, hopefully before the PCI bus is
417 * probed and/or the 8250 driver loaded since we need to register our
418 * platform devices before 8250 PCI ones are detected as some of them
419 * must properly "override" the platform ones.
420 *
421 * This function fixes up the interrupt value for platform ports as it
422 * couldn't be done earlier before interrupt maps have been parsed. It
423 * also "corrects" the IO address for PIO ports for the same reason,
424 * since earlier, the PHBs virtual IO space wasn't assigned yet. It then
425 * registers all those platform ports for use by the 8250 driver when it
426 * finally loads.
427 */
428static int __init serial_dev_init(void)
429{
430 int i;
431
432 if (legacy_serial_count == 0)
433 return -ENODEV;
434
435 /*
436 * Before we register the platfrom serial devices, we need
437 * to fixup their interrutps and their IO ports.
438 */
439 DBG("Fixing serial ports interrupts and IO ports ...\n");
440
441 for (i = 0; i < legacy_serial_count; i++) {
442 struct plat_serial8250_port *port = &legacy_serial_ports[i];
443 struct device_node *np = legacy_serial_infos[i].np;
444
445 if (port->irq == NO_IRQ)
446 fixup_port_irq(i, np, port);
447 if (port->iotype == UPIO_PORT)
448 fixup_port_pio(i, np, port);
449 if (port->iotype == UPIO_MEM)
450 fixup_port_mmio(i, np, port);
451 }
452
453 DBG("Registering platform serial ports\n");
454
455 return platform_device_register(&serial_device);
456}
457arch_initcall(serial_dev_init);
458
459
460/*
461 * This is called very early, as part of console_init() (typically just after
462 * time_init()). This function is respondible for trying to find a good
463 * default console on serial ports. It tries to match the open firmware
464 * default output with one of the available serial console drivers, either
465 * one of the platform serial ports that have been probed earlier by
466 * find_legacy_serial_ports() or some more platform specific ones.
467 */
468static int __init check_legacy_serial_console(void)
469{
470 struct device_node *prom_stdout = NULL;
471 int speed = 0, offset = 0;
472 char *name;
473 u32 *spd;
474
475 DBG(" -> check_legacy_serial_console()\n");
476
477 /* The user has requested a console so this is already set up. */
478 if (strstr(saved_command_line, "console=")) {
479 DBG(" console was specified !\n");
480 return -EBUSY;
481 }
482
483 if (!of_chosen) {
484 DBG(" of_chosen is NULL !\n");
485 return -ENODEV;
486 }
487
488 if (legacy_serial_console < 0) {
489 DBG(" legacy_serial_console not found !\n");
490 return -ENODEV;
491 }
492 /* We are getting a weird phandle from OF ... */
493 /* ... So use the full path instead */
494 name = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
495 if (name == NULL) {
496 DBG(" no linux,stdout-path !\n");
497 return -ENODEV;
498 }
499 prom_stdout = of_find_node_by_path(name);
500 if (!prom_stdout) {
501 DBG(" can't find stdout package %s !\n", name);
502 return -ENODEV;
503 }
504 DBG("stdout is %s\n", prom_stdout->full_name);
505
506 name = (char *)get_property(prom_stdout, "name", NULL);
507 if (!name) {
508 DBG(" stdout package has no name !\n");
509 goto not_found;
510 }
511 spd = (u32 *)get_property(prom_stdout, "current-speed", NULL);
512 if (spd)
513 speed = *spd;
514
515 if (0)
516 ;
517#ifdef CONFIG_SERIAL_8250_CONSOLE
518 else if (strcmp(name, "serial") == 0) {
519 int i;
520 /* Look for it in probed array */
521 for (i = 0; i < legacy_serial_count; i++) {
522 if (prom_stdout != legacy_serial_infos[i].np)
523 continue;
524 offset = i;
525 speed = legacy_serial_infos[i].speed;
526 break;
527 }
528 if (i >= legacy_serial_count)
529 goto not_found;
530 }
531#endif /* CONFIG_SERIAL_8250_CONSOLE */
532#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
533 else if (strcmp(name, "ch-a") == 0)
534 offset = 0;
535 else if (strcmp(name, "ch-b") == 0)
536 offset = 1;
537#endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
538 else
539 goto not_found;
540 of_node_put(prom_stdout);
541
542 DBG("Found serial console at ttyS%d\n", offset);
543
544 if (speed) {
545 static char __initdata opt[16];
546 sprintf(opt, "%d", speed);
547 return add_preferred_console("ttyS", offset, opt);
548 } else
549 return add_preferred_console("ttyS", offset, NULL);
550
551 not_found:
552 DBG("No preferred console found !\n");
553 of_node_put(prom_stdout);
554 return -ENODEV;
555}
556console_initcall(check_legacy_serial_console);
557
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index 9dda16ccde78..1ae96a8ed7e2 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -55,15 +55,13 @@ static unsigned long get_purr(void)
55{ 55{
56 unsigned long sum_purr = 0; 56 unsigned long sum_purr = 0;
57 int cpu; 57 int cpu;
58 struct paca_struct *lpaca;
59 58
60 for_each_cpu(cpu) { 59 for_each_cpu(cpu) {
61 lpaca = paca + cpu; 60 sum_purr += lppaca[cpu].emulated_time_base;
62 sum_purr += lpaca->lppaca.emulated_time_base;
63 61
64#ifdef PURR_DEBUG 62#ifdef PURR_DEBUG
65 printk(KERN_INFO "get_purr for cpu (%d) has value (%ld) \n", 63 printk(KERN_INFO "get_purr for cpu (%d) has value (%ld) \n",
66 cpu, lpaca->lppaca.emulated_time_base); 64 cpu, lppaca[cpu].emulated_time_base);
67#endif 65#endif
68 } 66 }
69 return sum_purr; 67 return sum_purr;
@@ -79,12 +77,11 @@ static int lparcfg_data(struct seq_file *m, void *v)
79 unsigned long pool_id, lp_index; 77 unsigned long pool_id, lp_index;
80 int shared, entitled_capacity, max_entitled_capacity; 78 int shared, entitled_capacity, max_entitled_capacity;
81 int processors, max_processors; 79 int processors, max_processors;
82 struct paca_struct *lpaca = get_paca();
83 unsigned long purr = get_purr(); 80 unsigned long purr = get_purr();
84 81
85 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); 82 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS);
86 83
87 shared = (int)(lpaca->lppaca_ptr->shared_proc); 84 shared = (int)(get_lppaca()->shared_proc);
88 seq_printf(m, "serial_number=%c%c%c%c%c%c%c\n", 85 seq_printf(m, "serial_number=%c%c%c%c%c%c%c\n",
89 e2a(xItExtVpdPanel.mfgID[2]), 86 e2a(xItExtVpdPanel.mfgID[2]),
90 e2a(xItExtVpdPanel.mfgID[3]), 87 e2a(xItExtVpdPanel.mfgID[3]),
@@ -402,7 +399,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
402 (h_resource >> 0 * 8) & 0xffff); 399 (h_resource >> 0 * 8) & 0xffff);
403 400
404 /* pool related entries are apropriate for shared configs */ 401 /* pool related entries are apropriate for shared configs */
405 if (paca[0].lppaca.shared_proc) { 402 if (lppaca[0].shared_proc) {
406 403
407 h_pic(&pool_idle_time, &pool_procs); 404 h_pic(&pool_idle_time, &pool_procs);
408 405
@@ -451,7 +448,7 @@ static int lparcfg_data(struct seq_file *m, void *v)
451 seq_printf(m, "partition_potential_processors=%d\n", 448 seq_printf(m, "partition_potential_processors=%d\n",
452 partition_potential_processors); 449 partition_potential_processors);
453 450
454 seq_printf(m, "shared_processor_mode=%d\n", paca[0].lppaca.shared_proc); 451 seq_printf(m, "shared_processor_mode=%d\n", lppaca[0].shared_proc);
455 452
456 return 0; 453 return 0;
457} 454}
diff --git a/arch/powerpc/kernel/lparmap.c b/arch/powerpc/kernel/lparmap.c
index 5a05a797485f..584d1e3c013d 100644
--- a/arch/powerpc/kernel/lparmap.c
+++ b/arch/powerpc/kernel/lparmap.c
@@ -7,7 +7,7 @@
7 * 2 of the License, or (at your option) any later version. 7 * 2 of the License, or (at your option) any later version.
8 */ 8 */
9#include <asm/mmu.h> 9#include <asm/mmu.h>
10#include <asm/page.h> 10#include <asm/pgtable.h>
11#include <asm/iseries/lpar_map.h> 11#include <asm/iseries/lpar_map.h>
12 12
13const struct LparMap __attribute__((__section__(".text"))) xLparMap = { 13const struct LparMap __attribute__((__section__(".text"))) xLparMap = {
@@ -16,16 +16,16 @@ const struct LparMap __attribute__((__section__(".text"))) xLparMap = {
16 .xSegmentTableOffs = STAB0_PAGE, 16 .xSegmentTableOffs = STAB0_PAGE,
17 17
18 .xEsids = { 18 .xEsids = {
19 { .xKernelEsid = GET_ESID(KERNELBASE), 19 { .xKernelEsid = GET_ESID(PAGE_OFFSET),
20 .xKernelVsid = KERNEL_VSID(KERNELBASE), }, 20 .xKernelVsid = KERNEL_VSID(PAGE_OFFSET), },
21 { .xKernelEsid = GET_ESID(VMALLOCBASE), 21 { .xKernelEsid = GET_ESID(VMALLOC_START),
22 .xKernelVsid = KERNEL_VSID(VMALLOCBASE), }, 22 .xKernelVsid = KERNEL_VSID(VMALLOC_START), },
23 }, 23 },
24 24
25 .xRanges = { 25 .xRanges = {
26 { .xPages = HvPagesToMap, 26 { .xPages = HvPagesToMap,
27 .xOffset = 0, 27 .xOffset = 0,
28 .xVPN = KERNEL_VSID(KERNELBASE) << (SID_SHIFT - HW_PAGE_SHIFT), 28 .xVPN = KERNEL_VSID(PAGE_OFFSET) << (SID_SHIFT - HW_PAGE_SHIFT),
29 }, 29 },
30 }, 30 },
31}; 31};
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
new file mode 100644
index 000000000000..a81ca1b841ec
--- /dev/null
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -0,0 +1,61 @@
1/*
2 * Code to handle transition of Linux booting another kernel.
3 *
4 * Copyright (C) 2002-2003 Eric Biederman <ebiederm@xmission.com>
5 * GameCube/ppc32 port Copyright (C) 2004 Albert Herranz
6 * Copyright (C) 2005 IBM Corporation.
7 *
8 * This source code is licensed under the GNU General Public License,
9 * Version 2. See the file COPYING for more details.
10 */
11
12#include <linux/kexec.h>
13#include <linux/reboot.h>
14#include <linux/threads.h>
15#include <asm/machdep.h>
16
17void machine_crash_shutdown(struct pt_regs *regs)
18{
19 if (ppc_md.machine_crash_shutdown)
20 ppc_md.machine_crash_shutdown(regs);
21}
22
23/*
24 * Do what every setup is needed on image and the
25 * reboot code buffer to allow us to avoid allocations
26 * later.
27 */
28int machine_kexec_prepare(struct kimage *image)
29{
30 if (ppc_md.machine_kexec_prepare)
31 return ppc_md.machine_kexec_prepare(image);
32 /*
33 * Fail if platform doesn't provide its own machine_kexec_prepare
34 * implementation.
35 */
36 return -ENOSYS;
37}
38
39void machine_kexec_cleanup(struct kimage *image)
40{
41 if (ppc_md.machine_kexec_cleanup)
42 ppc_md.machine_kexec_cleanup(image);
43}
44
45/*
46 * Do not allocate memory (or fail in any way) in machine_kexec().
47 * We are past the point of no return, committed to rebooting now.
48 */
49NORET_TYPE void machine_kexec(struct kimage *image)
50{
51 if (ppc_md.machine_kexec)
52 ppc_md.machine_kexec(image);
53 else {
54 /*
55 * Fall back to normal restart if platform doesn't provide
56 * its own kexec function, and user insist to kexec...
57 */
58 machine_restart(NULL);
59 }
60 for(;;);
61}
diff --git a/arch/powerpc/kernel/machine_kexec_32.c b/arch/powerpc/kernel/machine_kexec_32.c
new file mode 100644
index 000000000000..443606134dff
--- /dev/null
+++ b/arch/powerpc/kernel/machine_kexec_32.c
@@ -0,0 +1,65 @@
1/*
2 * PPC32 code to handle Linux booting another kernel.
3 *
4 * Copyright (C) 2002-2003 Eric Biederman <ebiederm@xmission.com>
5 * GameCube/ppc32 port Copyright (C) 2004 Albert Herranz
6 * Copyright (C) 2005 IBM Corporation.
7 *
8 * This source code is licensed under the GNU General Public License,
9 * Version 2. See the file COPYING for more details.
10 */
11
12#include <linux/kexec.h>
13#include <linux/mm.h>
14#include <linux/string.h>
15#include <asm/cacheflush.h>
16#include <asm/hw_irq.h>
17#include <asm/io.h>
18
19typedef NORET_TYPE void (*relocate_new_kernel_t)(
20 unsigned long indirection_page,
21 unsigned long reboot_code_buffer,
22 unsigned long start_address) ATTRIB_NORET;
23
24/*
25 * This is a generic machine_kexec function suitable at least for
26 * non-OpenFirmware embedded platforms.
27 * It merely copies the image relocation code to the control page and
28 * jumps to it.
29 * A platform specific function may just call this one.
30 */
31void default_machine_kexec(struct kimage *image)
32{
33 const extern unsigned char relocate_new_kernel[];
34 const extern unsigned int relocate_new_kernel_size;
35 unsigned long page_list;
36 unsigned long reboot_code_buffer, reboot_code_buffer_phys;
37 relocate_new_kernel_t rnk;
38
39 /* Interrupts aren't acceptable while we reboot */
40 local_irq_disable();
41
42 page_list = image->head;
43
44 /* we need both effective and real address here */
45 reboot_code_buffer =
46 (unsigned long)page_address(image->control_code_page);
47 reboot_code_buffer_phys = virt_to_phys((void *)reboot_code_buffer);
48
49 /* copy our kernel relocation code to the control code page */
50 memcpy((void *)reboot_code_buffer, relocate_new_kernel,
51 relocate_new_kernel_size);
52
53 flush_icache_range(reboot_code_buffer,
54 reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE);
55 printk(KERN_INFO "Bye!\n");
56
57 /* now call it */
58 rnk = (relocate_new_kernel_t) reboot_code_buffer;
59 (*rnk)(page_list, reboot_code_buffer_phys, image->start);
60}
61
62int default_machine_kexec_prepare(struct kimage *image)
63{
64 return 0;
65}
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index 97c51e452be7..d6431440c54f 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * machine_kexec.c - handle transition of Linux booting another kernel 2 * PPC64 code to handle Linux booting another kernel.
3 * 3 *
4 * Copyright (C) 2004-2005, IBM Corp. 4 * Copyright (C) 2004-2005, IBM Corp.
5 * 5 *
@@ -28,21 +28,7 @@
28 28
29#define HASH_GROUP_SIZE 0x80 /* size of each hash group, asm/mmu.h */ 29#define HASH_GROUP_SIZE 0x80 /* size of each hash group, asm/mmu.h */
30 30
31/* Have this around till we move it into crash specific file */ 31int default_machine_kexec_prepare(struct kimage *image)
32note_buf_t crash_notes[NR_CPUS];
33
34/* Dummy for now. Not sure if we need to have a crash shutdown in here
35 * and if what it will achieve. Letting it be now to compile the code
36 * in generic kexec environment
37 */
38void machine_crash_shutdown(struct pt_regs *regs)
39{
40 /* do nothing right now */
41 /* smp_relase_cpus() if we want smp on panic kernel */
42 /* cpu_irq_down to isolate us until we are ready */
43}
44
45int machine_kexec_prepare(struct kimage *image)
46{ 32{
47 int i; 33 int i;
48 unsigned long begin, end; /* limits of segment */ 34 unsigned long begin, end; /* limits of segment */
@@ -111,11 +97,6 @@ int machine_kexec_prepare(struct kimage *image)
111 return 0; 97 return 0;
112} 98}
113 99
114void machine_kexec_cleanup(struct kimage *image)
115{
116 /* we do nothing in prepare that needs to be undone */
117}
118
119#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE) 100#define IND_FLAGS (IND_DESTINATION | IND_INDIRECTION | IND_DONE | IND_SOURCE)
120 101
121static void copy_segments(unsigned long ind) 102static void copy_segments(unsigned long ind)
@@ -172,9 +153,8 @@ void kexec_copy_flush(struct kimage *image)
172 * including ones that were in place on the original copy 153 * including ones that were in place on the original copy
173 */ 154 */
174 for (i = 0; i < nr_segments; i++) 155 for (i = 0; i < nr_segments; i++)
175 flush_icache_range(ranges[i].mem + KERNELBASE, 156 flush_icache_range((unsigned long)__va(ranges[i].mem),
176 ranges[i].mem + KERNELBASE + 157 (unsigned long)__va(ranges[i].mem + ranges[i].memsz));
177 ranges[i].memsz);
178} 158}
179 159
180#ifdef CONFIG_SMP 160#ifdef CONFIG_SMP
@@ -283,13 +263,20 @@ extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start,
283 void (*clear_all)(void)) ATTRIB_NORET; 263 void (*clear_all)(void)) ATTRIB_NORET;
284 264
285/* too late to fail here */ 265/* too late to fail here */
286void machine_kexec(struct kimage *image) 266void default_machine_kexec(struct kimage *image)
287{ 267{
288
289 /* prepare control code if any */ 268 /* prepare control code if any */
290 269
291 /* shutdown other cpus into our wait loop and quiesce interrupts */ 270 /*
292 kexec_prepare_cpus(); 271 * If the kexec boot is the normal one, need to shutdown other cpus
272 * into our wait loop and quiesce interrupts.
273 * Otherwise, in the case of crashed mode (crashing_cpu >= 0),
274 * stopping other CPUs and collecting their pt_regs is done before
275 * using debugger IPI.
276 */
277
278 if (crashing_cpu == -1)
279 kexec_prepare_cpus();
293 280
294 /* switch to a staticly allocated stack. Based on irq stack code. 281 /* switch to a staticly allocated stack. Based on irq stack code.
295 * XXX: the task struct will likely be invalid once we do the copy! 282 * XXX: the task struct will likely be invalid once we do the copy!
diff --git a/arch/powerpc/kernel/misc_32.S b/arch/powerpc/kernel/misc_32.S
index 624a983a9676..be982023409e 100644
--- a/arch/powerpc/kernel/misc_32.S
+++ b/arch/powerpc/kernel/misc_32.S
@@ -5,6 +5,10 @@
5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu) 5 * Largely rewritten by Cort Dougan (cort@cs.nmt.edu)
6 * and Paul Mackerras. 6 * and Paul Mackerras.
7 * 7 *
8 * kexec bits:
9 * Copyright (C) 2002-2003 Eric Biederman <ebiederm@xmission.com>
10 * GameCube/ppc32 port Copyright (C) 2004 Albert Herranz
11 *
8 * This program is free software; you can redistribute it and/or 12 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License 13 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 14 * as published by the Free Software Foundation; either version
@@ -24,6 +28,8 @@
24#include <asm/ppc_asm.h> 28#include <asm/ppc_asm.h>
25#include <asm/thread_info.h> 29#include <asm/thread_info.h>
26#include <asm/asm-offsets.h> 30#include <asm/asm-offsets.h>
31#include <asm/processor.h>
32#include <asm/kexec.h>
27 33
28 .text 34 .text
29 35
@@ -62,7 +68,7 @@ _GLOBAL(reloc_offset)
62 mflr r0 68 mflr r0
63 bl 1f 69 bl 1f
641: mflr r3 701: mflr r3
65 LOADADDR(r4,1b) 71 LOAD_REG_IMMEDIATE(r4,1b)
66 subf r3,r4,r3 72 subf r3,r4,r3
67 mtlr r0 73 mtlr r0
68 blr 74 blr
@@ -74,7 +80,7 @@ _GLOBAL(add_reloc_offset)
74 mflr r0 80 mflr r0
75 bl 1f 81 bl 1f
761: mflr r5 821: mflr r5
77 LOADADDR(r4,1b) 83 LOAD_REG_IMMEDIATE(r4,1b)
78 subf r5,r4,r5 84 subf r5,r4,r5
79 add r3,r3,r5 85 add r3,r3,r5
80 mtlr r0 86 mtlr r0
@@ -1006,3 +1012,110 @@ _GLOBAL(execve)
1006 */ 1012 */
1007_GLOBAL(__main) 1013_GLOBAL(__main)
1008 blr 1014 blr
1015
1016#ifdef CONFIG_KEXEC
1017 /*
1018 * Must be relocatable PIC code callable as a C function.
1019 */
1020 .globl relocate_new_kernel
1021relocate_new_kernel:
1022 /* r3 = page_list */
1023 /* r4 = reboot_code_buffer */
1024 /* r5 = start_address */
1025
1026 li r0, 0
1027
1028 /*
1029 * Set Machine Status Register to a known status,
1030 * switch the MMU off and jump to 1: in a single step.
1031 */
1032
1033 mr r8, r0
1034 ori r8, r8, MSR_RI|MSR_ME
1035 mtspr SPRN_SRR1, r8
1036 addi r8, r4, 1f - relocate_new_kernel
1037 mtspr SPRN_SRR0, r8
1038 sync
1039 rfi
1040
10411:
1042 /* from this point address translation is turned off */
1043 /* and interrupts are disabled */
1044
1045 /* set a new stack at the bottom of our page... */
1046 /* (not really needed now) */
1047 addi r1, r4, KEXEC_CONTROL_CODE_SIZE - 8 /* for LR Save+Back Chain */
1048 stw r0, 0(r1)
1049
1050 /* Do the copies */
1051 li r6, 0 /* checksum */
1052 mr r0, r3
1053 b 1f
1054
10550: /* top, read another word for the indirection page */
1056 lwzu r0, 4(r3)
1057
10581:
1059 /* is it a destination page? (r8) */
1060 rlwinm. r7, r0, 0, 31, 31 /* IND_DESTINATION (1<<0) */
1061 beq 2f
1062
1063 rlwinm r8, r0, 0, 0, 19 /* clear kexec flags, page align */
1064 b 0b
1065
10662: /* is it an indirection page? (r3) */
1067 rlwinm. r7, r0, 0, 30, 30 /* IND_INDIRECTION (1<<1) */
1068 beq 2f
1069
1070 rlwinm r3, r0, 0, 0, 19 /* clear kexec flags, page align */
1071 subi r3, r3, 4
1072 b 0b
1073
10742: /* are we done? */
1075 rlwinm. r7, r0, 0, 29, 29 /* IND_DONE (1<<2) */
1076 beq 2f
1077 b 3f
1078
10792: /* is it a source page? (r9) */
1080 rlwinm. r7, r0, 0, 28, 28 /* IND_SOURCE (1<<3) */
1081 beq 0b
1082
1083 rlwinm r9, r0, 0, 0, 19 /* clear kexec flags, page align */
1084
1085 li r7, PAGE_SIZE / 4
1086 mtctr r7
1087 subi r9, r9, 4
1088 subi r8, r8, 4
10899:
1090 lwzu r0, 4(r9) /* do the copy */
1091 xor r6, r6, r0
1092 stwu r0, 4(r8)
1093 dcbst 0, r8
1094 sync
1095 icbi 0, r8
1096 bdnz 9b
1097
1098 addi r9, r9, 4
1099 addi r8, r8, 4
1100 b 0b
1101
11023:
1103
1104 /* To be certain of avoiding problems with self-modifying code
1105 * execute a serializing instruction here.
1106 */
1107 isync
1108 sync
1109
1110 /* jump to the entry point, usually the setup routine */
1111 mtlr r5
1112 blrl
1113
11141: b 1b
1115
1116relocate_new_kernel_end:
1117
1118 .globl relocate_new_kernel_size
1119relocate_new_kernel_size:
1120 .long relocate_new_kernel_end - relocate_new_kernel
1121#endif
diff --git a/arch/powerpc/kernel/misc_64.S b/arch/powerpc/kernel/misc_64.S
index ae48a002f81a..2778cce058e2 100644
--- a/arch/powerpc/kernel/misc_64.S
+++ b/arch/powerpc/kernel/misc_64.S
@@ -39,7 +39,7 @@ _GLOBAL(reloc_offset)
39 mflr r0 39 mflr r0
40 bl 1f 40 bl 1f
411: mflr r3 411: mflr r3
42 LOADADDR(r4,1b) 42 LOAD_REG_IMMEDIATE(r4,1b)
43 subf r3,r4,r3 43 subf r3,r4,r3
44 mtlr r0 44 mtlr r0
45 blr 45 blr
@@ -51,7 +51,7 @@ _GLOBAL(add_reloc_offset)
51 mflr r0 51 mflr r0
52 bl 1f 52 bl 1f
531: mflr r5 531: mflr r5
54 LOADADDR(r4,1b) 54 LOAD_REG_IMMEDIATE(r4,1b)
55 subf r5,r4,r5 55 subf r5,r4,r5
56 add r3,r3,r5 56 add r3,r3,r5
57 mtlr r0 57 mtlr r0
@@ -498,15 +498,15 @@ _GLOBAL(identify_cpu)
498 */ 498 */
499_GLOBAL(do_cpu_ftr_fixups) 499_GLOBAL(do_cpu_ftr_fixups)
500 /* Get CPU 0 features */ 500 /* Get CPU 0 features */
501 LOADADDR(r6,cur_cpu_spec) 501 LOAD_REG_IMMEDIATE(r6,cur_cpu_spec)
502 sub r6,r6,r3 502 sub r6,r6,r3
503 ld r4,0(r6) 503 ld r4,0(r6)
504 sub r4,r4,r3 504 sub r4,r4,r3
505 ld r4,CPU_SPEC_FEATURES(r4) 505 ld r4,CPU_SPEC_FEATURES(r4)
506 /* Get the fixup table */ 506 /* Get the fixup table */
507 LOADADDR(r6,__start___ftr_fixup) 507 LOAD_REG_IMMEDIATE(r6,__start___ftr_fixup)
508 sub r6,r6,r3 508 sub r6,r6,r3
509 LOADADDR(r7,__stop___ftr_fixup) 509 LOAD_REG_IMMEDIATE(r7,__stop___ftr_fixup)
510 sub r7,r7,r3 510 sub r7,r7,r3
511 /* Do the fixup */ 511 /* Do the fixup */
5121: cmpld r6,r7 5121: cmpld r6,r7
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index c0fcd29918ce..fd7db8d542db 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -80,80 +80,74 @@ static loff_t dev_nvram_llseek(struct file *file, loff_t offset, int origin)
80static ssize_t dev_nvram_read(struct file *file, char __user *buf, 80static ssize_t dev_nvram_read(struct file *file, char __user *buf,
81 size_t count, loff_t *ppos) 81 size_t count, loff_t *ppos)
82{ 82{
83 ssize_t len; 83 ssize_t ret;
84 char *tmp_buffer; 84 char *tmp = NULL;
85 int size; 85 ssize_t size;
86 86
87 if (ppc_md.nvram_size == NULL) 87 ret = -ENODEV;
88 return -ENODEV; 88 if (!ppc_md.nvram_size)
89 goto out;
90
91 ret = 0;
89 size = ppc_md.nvram_size(); 92 size = ppc_md.nvram_size();
93 if (*ppos >= size || size < 0)
94 goto out;
90 95
91 if (!access_ok(VERIFY_WRITE, buf, count)) 96 count = min_t(size_t, count, size - *ppos);
92 return -EFAULT; 97 count = min(count, PAGE_SIZE);
93 if (*ppos >= size)
94 return 0;
95 if (count > size)
96 count = size;
97 98
98 tmp_buffer = (char *) kmalloc(count, GFP_KERNEL); 99 ret = -ENOMEM;
99 if (!tmp_buffer) { 100 tmp = kmalloc(count, GFP_KERNEL);
100 printk(KERN_ERR "dev_read_nvram: kmalloc failed\n"); 101 if (!tmp)
101 return -ENOMEM; 102 goto out;
102 }
103 103
104 len = ppc_md.nvram_read(tmp_buffer, count, ppos); 104 ret = ppc_md.nvram_read(tmp, count, ppos);
105 if ((long)len <= 0) { 105 if (ret <= 0)
106 kfree(tmp_buffer); 106 goto out;
107 return len;
108 }
109 107
110 if (copy_to_user(buf, tmp_buffer, len)) { 108 if (copy_to_user(buf, tmp, ret))
111 kfree(tmp_buffer); 109 ret = -EFAULT;
112 return -EFAULT;
113 }
114 110
115 kfree(tmp_buffer); 111out:
116 return len; 112 kfree(tmp);
113 return ret;
117 114
118} 115}
119 116
120static ssize_t dev_nvram_write(struct file *file, const char __user *buf, 117static ssize_t dev_nvram_write(struct file *file, const char __user *buf,
121 size_t count, loff_t *ppos) 118 size_t count, loff_t *ppos)
122{ 119{
123 ssize_t len; 120 ssize_t ret;
124 char * tmp_buffer; 121 char *tmp = NULL;
125 int size; 122 ssize_t size;
126 123
127 if (ppc_md.nvram_size == NULL) 124 ret = -ENODEV;
128 return -ENODEV; 125 if (!ppc_md.nvram_size)
126 goto out;
127
128 ret = 0;
129 size = ppc_md.nvram_size(); 129 size = ppc_md.nvram_size();
130 if (*ppos >= size || size < 0)
131 goto out;
130 132
131 if (!access_ok(VERIFY_READ, buf, count)) 133 count = min_t(size_t, count, size - *ppos);
132 return -EFAULT; 134 count = min(count, PAGE_SIZE);
133 if (*ppos >= size)
134 return 0;
135 if (count > size)
136 count = size;
137 135
138 tmp_buffer = (char *) kmalloc(count, GFP_KERNEL); 136 ret = -ENOMEM;
139 if (!tmp_buffer) { 137 tmp = kmalloc(count, GFP_KERNEL);
140 printk(KERN_ERR "dev_nvram_write: kmalloc failed\n"); 138 if (!tmp)
141 return -ENOMEM; 139 goto out;
142 }
143
144 if (copy_from_user(tmp_buffer, buf, count)) {
145 kfree(tmp_buffer);
146 return -EFAULT;
147 }
148 140
149 len = ppc_md.nvram_write(tmp_buffer, count, ppos); 141 ret = -EFAULT;
150 if ((long)len <= 0) { 142 if (copy_from_user(tmp, buf, count))
151 kfree(tmp_buffer); 143 goto out;
152 return len; 144
153 } 145 ret = ppc_md.nvram_write(tmp, count, ppos);
146
147out:
148 kfree(tmp);
149 return ret;
154 150
155 kfree(tmp_buffer);
156 return len;
157} 151}
158 152
159static int dev_nvram_ioctl(struct inode *inode, struct file *file, 153static int dev_nvram_ioctl(struct inode *inode, struct file *file,
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
index 7065e40e2f42..22d83d4d1af5 100644
--- a/arch/powerpc/kernel/of_device.c
+++ b/arch/powerpc/kernel/of_device.c
@@ -132,6 +132,8 @@ static int of_device_resume(struct device * dev)
132struct bus_type of_platform_bus_type = { 132struct bus_type of_platform_bus_type = {
133 .name = "of_platform", 133 .name = "of_platform",
134 .match = of_platform_bus_match, 134 .match = of_platform_bus_match,
135 .probe = of_device_probe,
136 .remove = of_device_remove,
135 .suspend = of_device_suspend, 137 .suspend = of_device_suspend,
136 .resume = of_device_resume, 138 .resume = of_device_resume,
137}; 139};
@@ -150,8 +152,6 @@ int of_register_driver(struct of_platform_driver *drv)
150 /* initialize common driver fields */ 152 /* initialize common driver fields */
151 drv->driver.name = drv->name; 153 drv->driver.name = drv->name;
152 drv->driver.bus = &of_platform_bus_type; 154 drv->driver.bus = &of_platform_bus_type;
153 drv->driver.probe = of_device_probe;
154 drv->driver.remove = of_device_remove;
155 155
156 /* register with core */ 156 /* register with core */
157 count = driver_register(&drv->driver); 157 count = driver_register(&drv->driver);
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index a7b68f911eb1..5d1b708086bd 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -17,6 +17,7 @@
17#include <asm/page.h> 17#include <asm/page.h>
18#include <asm/lppaca.h> 18#include <asm/lppaca.h>
19#include <asm/iseries/it_lp_queue.h> 19#include <asm/iseries/it_lp_queue.h>
20#include <asm/iseries/it_lp_reg_save.h>
20#include <asm/paca.h> 21#include <asm/paca.h>
21 22
22 23
@@ -24,10 +25,31 @@
24 * field correctly */ 25 * field correctly */
25extern unsigned long __toc_start; 26extern unsigned long __toc_start;
26 27
28/*
29 * iSeries structure which the hypervisor knows about - this structure
30 * should not cross a page boundary. The vpa_init/register_vpa call
31 * is now known to fail if the lppaca structure crosses a page
32 * boundary. The lppaca is also used on POWER5 pSeries boxes. The
33 * lppaca is 640 bytes long, and cannot readily change since the
34 * hypervisor knows its layout, so a 1kB alignment will suffice to
35 * ensure that it doesn't cross a page boundary.
36 */
37struct lppaca lppaca[] = {
38 [0 ... (NR_CPUS-1)] = {
39 .desc = 0xd397d781, /* "LpPa" */
40 .size = sizeof(struct lppaca),
41 .dyn_proc_status = 2,
42 .decr_val = 0x00ff0000,
43 .fpregs_in_use = 1,
44 .end_of_quantum = 0xfffffffffffffffful,
45 .slb_count = 64,
46 .vmxregs_in_use = 0,
47 },
48};
49
27/* The Paca is an array with one entry per processor. Each contains an 50/* The Paca is an array with one entry per processor. Each contains an
28 * lppaca, which contains the information shared between the 51 * lppaca, which contains the information shared between the
29 * hypervisor and Linux. Each also contains an ItLpRegSave area which 52 * hypervisor and Linux.
30 * is used by the hypervisor to save registers.
31 * On systems with hardware multi-threading, there are two threads 53 * On systems with hardware multi-threading, there are two threads
32 * per processor. The Paca array must contain an entry for each thread. 54 * per processor. The Paca array must contain an entry for each thread.
33 * The VPD Areas will give a max logical processors = 2 * max physical 55 * The VPD Areas will give a max logical processors = 2 * max physical
@@ -35,33 +57,18 @@ extern unsigned long __toc_start;
35 * processor (not thread). 57 * processor (not thread).
36 */ 58 */
37#define PACA_INIT_COMMON(number, start, asrr, asrv) \ 59#define PACA_INIT_COMMON(number, start, asrr, asrv) \
60 .lppaca_ptr = &lppaca[number], \
38 .lock_token = 0x8000, \ 61 .lock_token = 0x8000, \
39 .paca_index = (number), /* Paca Index */ \ 62 .paca_index = (number), /* Paca Index */ \
40 .default_decr = 0x00ff0000, /* Initial Decr */ \
41 .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \ 63 .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \
42 .stab_real = (asrr), /* Real pointer to segment table */ \ 64 .stab_real = (asrr), /* Real pointer to segment table */ \
43 .stab_addr = (asrv), /* Virt pointer to segment table */ \ 65 .stab_addr = (asrv), /* Virt pointer to segment table */ \
44 .cpu_start = (start), /* Processor start */ \ 66 .cpu_start = (start), /* Processor start */ \
45 .hw_cpu_id = 0xffff, \ 67 .hw_cpu_id = 0xffff,
46 .lppaca = { \
47 .desc = 0xd397d781, /* "LpPa" */ \
48 .size = sizeof(struct lppaca), \
49 .dyn_proc_status = 2, \
50 .decr_val = 0x00ff0000, \
51 .fpregs_in_use = 1, \
52 .end_of_quantum = 0xfffffffffffffffful, \
53 .slb_count = 64, \
54 .vmxregs_in_use = 0, \
55 }, \
56 68
57#ifdef CONFIG_PPC_ISERIES 69#ifdef CONFIG_PPC_ISERIES
58#define PACA_INIT_ISERIES(number) \ 70#define PACA_INIT_ISERIES(number) \
59 .lppaca_ptr = &paca[number].lppaca, \ 71 .reg_save_ptr = &iseries_reg_save[number],
60 .reg_save_ptr = &paca[number].reg_save, \
61 .reg_save = { \
62 .xDesc = 0xd397d9e2, /* "LpRS" */ \
63 .xSize = sizeof(struct ItLpRegSave) \
64 }
65 72
66#define PACA_INIT(number) \ 73#define PACA_INIT(number) \
67{ \ 74{ \
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
new file mode 100644
index 000000000000..704c846b2b0f
--- /dev/null
+++ b/arch/powerpc/kernel/pci_32.c
@@ -0,0 +1,1897 @@
1/*
2 * Common pmac/prep/chrp pci routines. -- Cort
3 */
4
5#include <linux/config.h>
6#include <linux/kernel.h>
7#include <linux/pci.h>
8#include <linux/delay.h>
9#include <linux/string.h>
10#include <linux/init.h>
11#include <linux/capability.h>
12#include <linux/sched.h>
13#include <linux/errno.h>
14#include <linux/bootmem.h>
15
16#include <asm/processor.h>
17#include <asm/io.h>
18#include <asm/prom.h>
19#include <asm/sections.h>
20#include <asm/pci-bridge.h>
21#include <asm/byteorder.h>
22#include <asm/irq.h>
23#include <asm/uaccess.h>
24#include <asm/machdep.h>
25
26#undef DEBUG
27
28#ifdef DEBUG
29#define DBG(x...) printk(x)
30#else
31#define DBG(x...)
32#endif
33
34unsigned long isa_io_base = 0;
35unsigned long isa_mem_base = 0;
36unsigned long pci_dram_offset = 0;
37int pcibios_assign_bus_offset = 1;
38
39void pcibios_make_OF_bus_map(void);
40
41static int pci_relocate_bridge_resource(struct pci_bus *bus, int i);
42static int probe_resource(struct pci_bus *parent, struct resource *pr,
43 struct resource *res, struct resource **conflict);
44static void update_bridge_base(struct pci_bus *bus, int i);
45static void pcibios_fixup_resources(struct pci_dev* dev);
46static void fixup_broken_pcnet32(struct pci_dev* dev);
47static int reparent_resources(struct resource *parent, struct resource *res);
48static void fixup_cpc710_pci64(struct pci_dev* dev);
49#ifdef CONFIG_PPC_OF
50static u8* pci_to_OF_bus_map;
51#endif
52
53/* By default, we don't re-assign bus numbers. We do this only on
54 * some pmacs
55 */
56int pci_assign_all_buses;
57
58struct pci_controller* hose_head;
59struct pci_controller** hose_tail = &hose_head;
60
61static int pci_bus_count;
62
63static void
64fixup_broken_pcnet32(struct pci_dev* dev)
65{
66 if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
67 dev->vendor = PCI_VENDOR_ID_AMD;
68 pci_write_config_word(dev, PCI_VENDOR_ID, PCI_VENDOR_ID_AMD);
69 }
70}
71DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TRIDENT, PCI_ANY_ID, fixup_broken_pcnet32);
72
73static void
74fixup_cpc710_pci64(struct pci_dev* dev)
75{
76 /* Hide the PCI64 BARs from the kernel as their content doesn't
77 * fit well in the resource management
78 */
79 dev->resource[0].start = dev->resource[0].end = 0;
80 dev->resource[0].flags = 0;
81 dev->resource[1].start = dev->resource[1].end = 0;
82 dev->resource[1].flags = 0;
83}
84DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_IBM, PCI_DEVICE_ID_IBM_CPC710_PCI64, fixup_cpc710_pci64);
85
86static void
87pcibios_fixup_resources(struct pci_dev *dev)
88{
89 struct pci_controller* hose = (struct pci_controller *)dev->sysdata;
90 int i;
91 unsigned long offset;
92
93 if (!hose) {
94 printk(KERN_ERR "No hose for PCI dev %s!\n", pci_name(dev));
95 return;
96 }
97 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
98 struct resource *res = dev->resource + i;
99 if (!res->flags)
100 continue;
101 if (res->end == 0xffffffff) {
102 DBG("PCI:%s Resource %d [%08lx-%08lx] is unassigned\n",
103 pci_name(dev), i, res->start, res->end);
104 res->end -= res->start;
105 res->start = 0;
106 res->flags |= IORESOURCE_UNSET;
107 continue;
108 }
109 offset = 0;
110 if (res->flags & IORESOURCE_MEM) {
111 offset = hose->pci_mem_offset;
112 } else if (res->flags & IORESOURCE_IO) {
113 offset = (unsigned long) hose->io_base_virt
114 - isa_io_base;
115 }
116 if (offset != 0) {
117 res->start += offset;
118 res->end += offset;
119#ifdef DEBUG
120 printk("Fixup res %d (%lx) of dev %s: %lx -> %lx\n",
121 i, res->flags, pci_name(dev),
122 res->start - offset, res->start);
123#endif
124 }
125 }
126
127 /* Call machine specific resource fixup */
128 if (ppc_md.pcibios_fixup_resources)
129 ppc_md.pcibios_fixup_resources(dev);
130}
131DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources);
132
133void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
134 struct resource *res)
135{
136 unsigned long offset = 0;
137 struct pci_controller *hose = dev->sysdata;
138
139 if (hose && res->flags & IORESOURCE_IO)
140 offset = (unsigned long)hose->io_base_virt - isa_io_base;
141 else if (hose && res->flags & IORESOURCE_MEM)
142 offset = hose->pci_mem_offset;
143 region->start = res->start - offset;
144 region->end = res->end - offset;
145}
146EXPORT_SYMBOL(pcibios_resource_to_bus);
147
148void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
149 struct pci_bus_region *region)
150{
151 unsigned long offset = 0;
152 struct pci_controller *hose = dev->sysdata;
153
154 if (hose && res->flags & IORESOURCE_IO)
155 offset = (unsigned long)hose->io_base_virt - isa_io_base;
156 else if (hose && res->flags & IORESOURCE_MEM)
157 offset = hose->pci_mem_offset;
158 res->start = region->start + offset;
159 res->end = region->end + offset;
160}
161EXPORT_SYMBOL(pcibios_bus_to_resource);
162
163/*
164 * We need to avoid collisions with `mirrored' VGA ports
165 * and other strange ISA hardware, so we always want the
166 * addresses to be allocated in the 0x000-0x0ff region
167 * modulo 0x400.
168 *
169 * Why? Because some silly external IO cards only decode
170 * the low 10 bits of the IO address. The 0x00-0xff region
171 * is reserved for motherboard devices that decode all 16
172 * bits, so it's ok to allocate at, say, 0x2800-0x28ff,
173 * but we want to try to avoid allocating at 0x2900-0x2bff
174 * which might have be mirrored at 0x0100-0x03ff..
175 */
176void pcibios_align_resource(void *data, struct resource *res, unsigned long size,
177 unsigned long align)
178{
179 struct pci_dev *dev = data;
180
181 if (res->flags & IORESOURCE_IO) {
182 unsigned long start = res->start;
183
184 if (size > 0x100) {
185 printk(KERN_ERR "PCI: I/O Region %s/%d too large"
186 " (%ld bytes)\n", pci_name(dev),
187 dev->resource - res, size);
188 }
189
190 if (start & 0x300) {
191 start = (start + 0x3ff) & ~0x3ff;
192 res->start = start;
193 }
194 }
195}
196EXPORT_SYMBOL(pcibios_align_resource);
197
198/*
199 * Handle resources of PCI devices. If the world were perfect, we could
200 * just allocate all the resource regions and do nothing more. It isn't.
201 * On the other hand, we cannot just re-allocate all devices, as it would
202 * require us to know lots of host bridge internals. So we attempt to
203 * keep as much of the original configuration as possible, but tweak it
204 * when it's found to be wrong.
205 *
206 * Known BIOS problems we have to work around:
207 * - I/O or memory regions not configured
208 * - regions configured, but not enabled in the command register
209 * - bogus I/O addresses above 64K used
210 * - expansion ROMs left enabled (this may sound harmless, but given
211 * the fact the PCI specs explicitly allow address decoders to be
212 * shared between expansion ROMs and other resource regions, it's
213 * at least dangerous)
214 *
215 * Our solution:
216 * (1) Allocate resources for all buses behind PCI-to-PCI bridges.
217 * This gives us fixed barriers on where we can allocate.
218 * (2) Allocate resources for all enabled devices. If there is
219 * a collision, just mark the resource as unallocated. Also
220 * disable expansion ROMs during this step.
221 * (3) Try to allocate resources for disabled devices. If the
222 * resources were assigned correctly, everything goes well,
223 * if they weren't, they won't disturb allocation of other
224 * resources.
225 * (4) Assign new addresses to resources which were either
226 * not configured at all or misconfigured. If explicitly
227 * requested by the user, configure expansion ROM address
228 * as well.
229 */
230
231static void __init
232pcibios_allocate_bus_resources(struct list_head *bus_list)
233{
234 struct pci_bus *bus;
235 int i;
236 struct resource *res, *pr;
237
238 /* Depth-First Search on bus tree */
239 list_for_each_entry(bus, bus_list, node) {
240 for (i = 0; i < 4; ++i) {
241 if ((res = bus->resource[i]) == NULL || !res->flags
242 || res->start > res->end)
243 continue;
244 if (bus->parent == NULL)
245 pr = (res->flags & IORESOURCE_IO)?
246 &ioport_resource: &iomem_resource;
247 else {
248 pr = pci_find_parent_resource(bus->self, res);
249 if (pr == res) {
250 /* this happens when the generic PCI
251 * code (wrongly) decides that this
252 * bridge is transparent -- paulus
253 */
254 continue;
255 }
256 }
257
258 DBG("PCI: bridge rsrc %lx..%lx (%lx), parent %p\n",
259 res->start, res->end, res->flags, pr);
260 if (pr) {
261 if (request_resource(pr, res) == 0)
262 continue;
263 /*
264 * Must be a conflict with an existing entry.
265 * Move that entry (or entries) under the
266 * bridge resource and try again.
267 */
268 if (reparent_resources(pr, res) == 0)
269 continue;
270 }
271 printk(KERN_ERR "PCI: Cannot allocate resource region "
272 "%d of PCI bridge %d\n", i, bus->number);
273 if (pci_relocate_bridge_resource(bus, i))
274 bus->resource[i] = NULL;
275 }
276 pcibios_allocate_bus_resources(&bus->children);
277 }
278}
279
280/*
281 * Reparent resource children of pr that conflict with res
282 * under res, and make res replace those children.
283 */
284static int __init
285reparent_resources(struct resource *parent, struct resource *res)
286{
287 struct resource *p, **pp;
288 struct resource **firstpp = NULL;
289
290 for (pp = &parent->child; (p = *pp) != NULL; pp = &p->sibling) {
291 if (p->end < res->start)
292 continue;
293 if (res->end < p->start)
294 break;
295 if (p->start < res->start || p->end > res->end)
296 return -1; /* not completely contained */
297 if (firstpp == NULL)
298 firstpp = pp;
299 }
300 if (firstpp == NULL)
301 return -1; /* didn't find any conflicting entries? */
302 res->parent = parent;
303 res->child = *firstpp;
304 res->sibling = *pp;
305 *firstpp = res;
306 *pp = NULL;
307 for (p = res->child; p != NULL; p = p->sibling) {
308 p->parent = res;
309 DBG(KERN_INFO "PCI: reparented %s [%lx..%lx] under %s\n",
310 p->name, p->start, p->end, res->name);
311 }
312 return 0;
313}
314
315/*
316 * A bridge has been allocated a range which is outside the range
317 * of its parent bridge, so it needs to be moved.
318 */
319static int __init
320pci_relocate_bridge_resource(struct pci_bus *bus, int i)
321{
322 struct resource *res, *pr, *conflict;
323 unsigned long try, size;
324 int j;
325 struct pci_bus *parent = bus->parent;
326
327 if (parent == NULL) {
328 /* shouldn't ever happen */
329 printk(KERN_ERR "PCI: can't move host bridge resource\n");
330 return -1;
331 }
332 res = bus->resource[i];
333 if (res == NULL)
334 return -1;
335 pr = NULL;
336 for (j = 0; j < 4; j++) {
337 struct resource *r = parent->resource[j];
338 if (!r)
339 continue;
340 if ((res->flags ^ r->flags) & (IORESOURCE_IO | IORESOURCE_MEM))
341 continue;
342 if (!((res->flags ^ r->flags) & IORESOURCE_PREFETCH)) {
343 pr = r;
344 break;
345 }
346 if (res->flags & IORESOURCE_PREFETCH)
347 pr = r;
348 }
349 if (pr == NULL)
350 return -1;
351 size = res->end - res->start;
352 if (pr->start > pr->end || size > pr->end - pr->start)
353 return -1;
354 try = pr->end;
355 for (;;) {
356 res->start = try - size;
357 res->end = try;
358 if (probe_resource(bus->parent, pr, res, &conflict) == 0)
359 break;
360 if (conflict->start <= pr->start + size)
361 return -1;
362 try = conflict->start - 1;
363 }
364 if (request_resource(pr, res)) {
365 DBG(KERN_ERR "PCI: huh? couldn't move to %lx..%lx\n",
366 res->start, res->end);
367 return -1; /* "can't happen" */
368 }
369 update_bridge_base(bus, i);
370 printk(KERN_INFO "PCI: bridge %d resource %d moved to %lx..%lx\n",
371 bus->number, i, res->start, res->end);
372 return 0;
373}
374
375static int __init
376probe_resource(struct pci_bus *parent, struct resource *pr,
377 struct resource *res, struct resource **conflict)
378{
379 struct pci_bus *bus;
380 struct pci_dev *dev;
381 struct resource *r;
382 int i;
383
384 for (r = pr->child; r != NULL; r = r->sibling) {
385 if (r->end >= res->start && res->end >= r->start) {
386 *conflict = r;
387 return 1;
388 }
389 }
390 list_for_each_entry(bus, &parent->children, node) {
391 for (i = 0; i < 4; ++i) {
392 if ((r = bus->resource[i]) == NULL)
393 continue;
394 if (!r->flags || r->start > r->end || r == res)
395 continue;
396 if (pci_find_parent_resource(bus->self, r) != pr)
397 continue;
398 if (r->end >= res->start && res->end >= r->start) {
399 *conflict = r;
400 return 1;
401 }
402 }
403 }
404 list_for_each_entry(dev, &parent->devices, bus_list) {
405 for (i = 0; i < 6; ++i) {
406 r = &dev->resource[i];
407 if (!r->flags || (r->flags & IORESOURCE_UNSET))
408 continue;
409 if (pci_find_parent_resource(dev, r) != pr)
410 continue;
411 if (r->end >= res->start && res->end >= r->start) {
412 *conflict = r;
413 return 1;
414 }
415 }
416 }
417 return 0;
418}
419
420static void __init
421update_bridge_base(struct pci_bus *bus, int i)
422{
423 struct resource *res = bus->resource[i];
424 u8 io_base_lo, io_limit_lo;
425 u16 mem_base, mem_limit;
426 u16 cmd;
427 unsigned long start, end, off;
428 struct pci_dev *dev = bus->self;
429 struct pci_controller *hose = dev->sysdata;
430
431 if (!hose) {
432 printk("update_bridge_base: no hose?\n");
433 return;
434 }
435 pci_read_config_word(dev, PCI_COMMAND, &cmd);
436 pci_write_config_word(dev, PCI_COMMAND,
437 cmd & ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY));
438 if (res->flags & IORESOURCE_IO) {
439 off = (unsigned long) hose->io_base_virt - isa_io_base;
440 start = res->start - off;
441 end = res->end - off;
442 io_base_lo = (start >> 8) & PCI_IO_RANGE_MASK;
443 io_limit_lo = (end >> 8) & PCI_IO_RANGE_MASK;
444 if (end > 0xffff) {
445 pci_write_config_word(dev, PCI_IO_BASE_UPPER16,
446 start >> 16);
447 pci_write_config_word(dev, PCI_IO_LIMIT_UPPER16,
448 end >> 16);
449 io_base_lo |= PCI_IO_RANGE_TYPE_32;
450 } else
451 io_base_lo |= PCI_IO_RANGE_TYPE_16;
452 pci_write_config_byte(dev, PCI_IO_BASE, io_base_lo);
453 pci_write_config_byte(dev, PCI_IO_LIMIT, io_limit_lo);
454
455 } else if ((res->flags & (IORESOURCE_MEM | IORESOURCE_PREFETCH))
456 == IORESOURCE_MEM) {
457 off = hose->pci_mem_offset;
458 mem_base = ((res->start - off) >> 16) & PCI_MEMORY_RANGE_MASK;
459 mem_limit = ((res->end - off) >> 16) & PCI_MEMORY_RANGE_MASK;
460 pci_write_config_word(dev, PCI_MEMORY_BASE, mem_base);
461 pci_write_config_word(dev, PCI_MEMORY_LIMIT, mem_limit);
462
463 } else if ((res->flags & (IORESOURCE_MEM | IORESOURCE_PREFETCH))
464 == (IORESOURCE_MEM | IORESOURCE_PREFETCH)) {
465 off = hose->pci_mem_offset;
466 mem_base = ((res->start - off) >> 16) & PCI_PREF_RANGE_MASK;
467 mem_limit = ((res->end - off) >> 16) & PCI_PREF_RANGE_MASK;
468 pci_write_config_word(dev, PCI_PREF_MEMORY_BASE, mem_base);
469 pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, mem_limit);
470
471 } else {
472 DBG(KERN_ERR "PCI: ugh, bridge %s res %d has flags=%lx\n",
473 pci_name(dev), i, res->flags);
474 }
475 pci_write_config_word(dev, PCI_COMMAND, cmd);
476}
477
478static inline void alloc_resource(struct pci_dev *dev, int idx)
479{
480 struct resource *pr, *r = &dev->resource[idx];
481
482 DBG("PCI:%s: Resource %d: %08lx-%08lx (f=%lx)\n",
483 pci_name(dev), idx, r->start, r->end, r->flags);
484 pr = pci_find_parent_resource(dev, r);
485 if (!pr || request_resource(pr, r) < 0) {
486 printk(KERN_ERR "PCI: Cannot allocate resource region %d"
487 " of device %s\n", idx, pci_name(dev));
488 if (pr)
489 DBG("PCI: parent is %p: %08lx-%08lx (f=%lx)\n",
490 pr, pr->start, pr->end, pr->flags);
491 /* We'll assign a new address later */
492 r->flags |= IORESOURCE_UNSET;
493 r->end -= r->start;
494 r->start = 0;
495 }
496}
497
498static void __init
499pcibios_allocate_resources(int pass)
500{
501 struct pci_dev *dev = NULL;
502 int idx, disabled;
503 u16 command;
504 struct resource *r;
505
506 for_each_pci_dev(dev) {
507 pci_read_config_word(dev, PCI_COMMAND, &command);
508 for (idx = 0; idx < 6; idx++) {
509 r = &dev->resource[idx];
510 if (r->parent) /* Already allocated */
511 continue;
512 if (!r->flags || (r->flags & IORESOURCE_UNSET))
513 continue; /* Not assigned at all */
514 if (r->flags & IORESOURCE_IO)
515 disabled = !(command & PCI_COMMAND_IO);
516 else
517 disabled = !(command & PCI_COMMAND_MEMORY);
518 if (pass == disabled)
519 alloc_resource(dev, idx);
520 }
521 if (pass)
522 continue;
523 r = &dev->resource[PCI_ROM_RESOURCE];
524 if (r->flags & IORESOURCE_ROM_ENABLE) {
525 /* Turn the ROM off, leave the resource region, but keep it unregistered. */
526 u32 reg;
527 DBG("PCI: Switching off ROM of %s\n", pci_name(dev));
528 r->flags &= ~IORESOURCE_ROM_ENABLE;
529 pci_read_config_dword(dev, dev->rom_base_reg, &reg);
530 pci_write_config_dword(dev, dev->rom_base_reg,
531 reg & ~PCI_ROM_ADDRESS_ENABLE);
532 }
533 }
534}
535
536static void __init
537pcibios_assign_resources(void)
538{
539 struct pci_dev *dev = NULL;
540 int idx;
541 struct resource *r;
542
543 for_each_pci_dev(dev) {
544 int class = dev->class >> 8;
545
546 /* Don't touch classless devices and host bridges */
547 if (!class || class == PCI_CLASS_BRIDGE_HOST)
548 continue;
549
550 for (idx = 0; idx < 6; idx++) {
551 r = &dev->resource[idx];
552
553 /*
554 * We shall assign a new address to this resource,
555 * either because the BIOS (sic) forgot to do so
556 * or because we have decided the old address was
557 * unusable for some reason.
558 */
559 if ((r->flags & IORESOURCE_UNSET) && r->end &&
560 (!ppc_md.pcibios_enable_device_hook ||
561 !ppc_md.pcibios_enable_device_hook(dev, 1))) {
562 r->flags &= ~IORESOURCE_UNSET;
563 pci_assign_resource(dev, idx);
564 }
565 }
566
567#if 0 /* don't assign ROMs */
568 r = &dev->resource[PCI_ROM_RESOURCE];
569 r->end -= r->start;
570 r->start = 0;
571 if (r->end)
572 pci_assign_resource(dev, PCI_ROM_RESOURCE);
573#endif
574 }
575}
576
577
578int
579pcibios_enable_resources(struct pci_dev *dev, int mask)
580{
581 u16 cmd, old_cmd;
582 int idx;
583 struct resource *r;
584
585 pci_read_config_word(dev, PCI_COMMAND, &cmd);
586 old_cmd = cmd;
587 for (idx=0; idx<6; idx++) {
588 /* Only set up the requested stuff */
589 if (!(mask & (1<<idx)))
590 continue;
591
592 r = &dev->resource[idx];
593 if (r->flags & IORESOURCE_UNSET) {
594 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
595 return -EINVAL;
596 }
597 if (r->flags & IORESOURCE_IO)
598 cmd |= PCI_COMMAND_IO;
599 if (r->flags & IORESOURCE_MEM)
600 cmd |= PCI_COMMAND_MEMORY;
601 }
602 if (dev->resource[PCI_ROM_RESOURCE].start)
603 cmd |= PCI_COMMAND_MEMORY;
604 if (cmd != old_cmd) {
605 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
606 pci_write_config_word(dev, PCI_COMMAND, cmd);
607 }
608 return 0;
609}
610
611static int next_controller_index;
612
613struct pci_controller * __init
614pcibios_alloc_controller(void)
615{
616 struct pci_controller *hose;
617
618 hose = (struct pci_controller *)alloc_bootmem(sizeof(*hose));
619 memset(hose, 0, sizeof(struct pci_controller));
620
621 *hose_tail = hose;
622 hose_tail = &hose->next;
623
624 hose->index = next_controller_index++;
625
626 return hose;
627}
628
629#ifdef CONFIG_PPC_OF
630/*
631 * Functions below are used on OpenFirmware machines.
632 */
633static void
634make_one_node_map(struct device_node* node, u8 pci_bus)
635{
636 int *bus_range;
637 int len;
638
639 if (pci_bus >= pci_bus_count)
640 return;
641 bus_range = (int *) get_property(node, "bus-range", &len);
642 if (bus_range == NULL || len < 2 * sizeof(int)) {
643 printk(KERN_WARNING "Can't get bus-range for %s, "
644 "assuming it starts at 0\n", node->full_name);
645 pci_to_OF_bus_map[pci_bus] = 0;
646 } else
647 pci_to_OF_bus_map[pci_bus] = bus_range[0];
648
649 for (node=node->child; node != 0;node = node->sibling) {
650 struct pci_dev* dev;
651 unsigned int *class_code, *reg;
652
653 class_code = (unsigned int *) get_property(node, "class-code", NULL);
654 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
655 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
656 continue;
657 reg = (unsigned int *)get_property(node, "reg", NULL);
658 if (!reg)
659 continue;
660 dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff));
661 if (!dev || !dev->subordinate)
662 continue;
663 make_one_node_map(node, dev->subordinate->number);
664 }
665}
666
667void
668pcibios_make_OF_bus_map(void)
669{
670 int i;
671 struct pci_controller* hose;
672 u8* of_prop_map;
673
674 pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL);
675 if (!pci_to_OF_bus_map) {
676 printk(KERN_ERR "Can't allocate OF bus map !\n");
677 return;
678 }
679
680 /* We fill the bus map with invalid values, that helps
681 * debugging.
682 */
683 for (i=0; i<pci_bus_count; i++)
684 pci_to_OF_bus_map[i] = 0xff;
685
686 /* For each hose, we begin searching bridges */
687 for(hose=hose_head; hose; hose=hose->next) {
688 struct device_node* node;
689 node = (struct device_node *)hose->arch_data;
690 if (!node)
691 continue;
692 make_one_node_map(node, hose->first_busno);
693 }
694 of_prop_map = get_property(find_path_device("/"), "pci-OF-bus-map", NULL);
695 if (of_prop_map)
696 memcpy(of_prop_map, pci_to_OF_bus_map, pci_bus_count);
697#ifdef DEBUG
698 printk("PCI->OF bus map:\n");
699 for (i=0; i<pci_bus_count; i++) {
700 if (pci_to_OF_bus_map[i] == 0xff)
701 continue;
702 printk("%d -> %d\n", i, pci_to_OF_bus_map[i]);
703 }
704#endif
705}
706
707typedef int (*pci_OF_scan_iterator)(struct device_node* node, void* data);
708
709static struct device_node*
710scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* data)
711{
712 struct device_node* sub_node;
713
714 for (; node != 0;node = node->sibling) {
715 unsigned int *class_code;
716
717 if (filter(node, data))
718 return node;
719
720 /* For PCI<->PCI bridges or CardBus bridges, we go down
721 * Note: some OFs create a parent node "multifunc-device" as
722 * a fake root for all functions of a multi-function device,
723 * we go down them as well.
724 */
725 class_code = (unsigned int *) get_property(node, "class-code", NULL);
726 if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
727 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) &&
728 strcmp(node->name, "multifunc-device"))
729 continue;
730 sub_node = scan_OF_pci_childs(node->child, filter, data);
731 if (sub_node)
732 return sub_node;
733 }
734 return NULL;
735}
736
737static int
738scan_OF_pci_childs_iterator(struct device_node* node, void* data)
739{
740 unsigned int *reg;
741 u8* fdata = (u8*)data;
742
743 reg = (unsigned int *) get_property(node, "reg", NULL);
744 if (reg && ((reg[0] >> 8) & 0xff) == fdata[1]
745 && ((reg[0] >> 16) & 0xff) == fdata[0])
746 return 1;
747 return 0;
748}
749
750static struct device_node*
751scan_OF_childs_for_device(struct device_node* node, u8 bus, u8 dev_fn)
752{
753 u8 filter_data[2] = {bus, dev_fn};
754
755 return scan_OF_pci_childs(node, scan_OF_pci_childs_iterator, filter_data);
756}
757
758/*
759 * Scans the OF tree for a device node matching a PCI device
760 */
761struct device_node *
762pci_busdev_to_OF_node(struct pci_bus *bus, int devfn)
763{
764 struct pci_controller *hose;
765 struct device_node *node;
766 int busnr;
767
768 if (!have_of)
769 return NULL;
770
771 /* Lookup the hose */
772 busnr = bus->number;
773 hose = pci_bus_to_hose(busnr);
774 if (!hose)
775 return NULL;
776
777 /* Check it has an OF node associated */
778 node = (struct device_node *) hose->arch_data;
779 if (!node)
780 return NULL;
781
782 /* Fixup bus number according to what OF think it is. */
783#ifdef CONFIG_PPC_PMAC
784 /* The G5 need a special case here. Basically, we don't remap all
785 * busses on it so we don't create the pci-OF-map. However, we do
786 * remap the AGP bus and so have to deal with it. A future better
787 * fix has to be done by making the remapping per-host and always
788 * filling the pci_to_OF map. --BenH
789 */
790 if (_machine == _MACH_Pmac && busnr >= 0xf0)
791 busnr -= 0xf0;
792 else
793#endif
794 if (pci_to_OF_bus_map)
795 busnr = pci_to_OF_bus_map[busnr];
796 if (busnr == 0xff)
797 return NULL;
798
799 /* Now, lookup childs of the hose */
800 return scan_OF_childs_for_device(node->child, busnr, devfn);
801}
802EXPORT_SYMBOL(pci_busdev_to_OF_node);
803
804struct device_node*
805pci_device_to_OF_node(struct pci_dev *dev)
806{
807 return pci_busdev_to_OF_node(dev->bus, dev->devfn);
808}
809EXPORT_SYMBOL(pci_device_to_OF_node);
810
811/* This routine is meant to be used early during boot, when the
812 * PCI bus numbers have not yet been assigned, and you need to
813 * issue PCI config cycles to an OF device.
814 * It could also be used to "fix" RTAS config cycles if you want
815 * to set pci_assign_all_buses to 1 and still use RTAS for PCI
816 * config cycles.
817 */
818struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
819{
820 if (!have_of)
821 return NULL;
822 while(node) {
823 struct pci_controller* hose;
824 for (hose=hose_head;hose;hose=hose->next)
825 if (hose->arch_data == node)
826 return hose;
827 node=node->parent;
828 }
829 return NULL;
830}
831
832static int
833find_OF_pci_device_filter(struct device_node* node, void* data)
834{
835 return ((void *)node == data);
836}
837
838/*
839 * Returns the PCI device matching a given OF node
840 */
841int
842pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
843{
844 unsigned int *reg;
845 struct pci_controller* hose;
846 struct pci_dev* dev = NULL;
847
848 if (!have_of)
849 return -ENODEV;
850 /* Make sure it's really a PCI device */
851 hose = pci_find_hose_for_OF_device(node);
852 if (!hose || !hose->arch_data)
853 return -ENODEV;
854 if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child,
855 find_OF_pci_device_filter, (void *)node))
856 return -ENODEV;
857 reg = (unsigned int *) get_property(node, "reg", NULL);
858 if (!reg)
859 return -ENODEV;
860 *bus = (reg[0] >> 16) & 0xff;
861 *devfn = ((reg[0] >> 8) & 0xff);
862
863 /* Ok, here we need some tweak. If we have already renumbered
864 * all busses, we can't rely on the OF bus number any more.
865 * the pci_to_OF_bus_map is not enough as several PCI busses
866 * may match the same OF bus number.
867 */
868 if (!pci_to_OF_bus_map)
869 return 0;
870
871 for_each_pci_dev(dev)
872 if (pci_to_OF_bus_map[dev->bus->number] == *bus &&
873 dev->devfn == *devfn) {
874 *bus = dev->bus->number;
875 pci_dev_put(dev);
876 return 0;
877 }
878
879 return -ENODEV;
880}
881EXPORT_SYMBOL(pci_device_from_OF_node);
882
883void __init
884pci_process_bridge_OF_ranges(struct pci_controller *hose,
885 struct device_node *dev, int primary)
886{
887 static unsigned int static_lc_ranges[256] __initdata;
888 unsigned int *dt_ranges, *lc_ranges, *ranges, *prev;
889 unsigned int size;
890 int rlen = 0, orig_rlen;
891 int memno = 0;
892 struct resource *res;
893 int np, na = prom_n_addr_cells(dev);
894 np = na + 5;
895
896 /* First we try to merge ranges to fix a problem with some pmacs
897 * that can have more than 3 ranges, fortunately using contiguous
898 * addresses -- BenH
899 */
900 dt_ranges = (unsigned int *) get_property(dev, "ranges", &rlen);
901 if (!dt_ranges)
902 return;
903 /* Sanity check, though hopefully that never happens */
904 if (rlen > sizeof(static_lc_ranges)) {
905 printk(KERN_WARNING "OF ranges property too large !\n");
906 rlen = sizeof(static_lc_ranges);
907 }
908 lc_ranges = static_lc_ranges;
909 memcpy(lc_ranges, dt_ranges, rlen);
910 orig_rlen = rlen;
911
912 /* Let's work on a copy of the "ranges" property instead of damaging
913 * the device-tree image in memory
914 */
915 ranges = lc_ranges;
916 prev = NULL;
917 while ((rlen -= np * sizeof(unsigned int)) >= 0) {
918 if (prev) {
919 if (prev[0] == ranges[0] && prev[1] == ranges[1] &&
920 (prev[2] + prev[na+4]) == ranges[2] &&
921 (prev[na+2] + prev[na+4]) == ranges[na+2]) {
922 prev[na+4] += ranges[na+4];
923 ranges[0] = 0;
924 ranges += np;
925 continue;
926 }
927 }
928 prev = ranges;
929 ranges += np;
930 }
931
932 /*
933 * The ranges property is laid out as an array of elements,
934 * each of which comprises:
935 * cells 0 - 2: a PCI address
936 * cells 3 or 3+4: a CPU physical address
937 * (size depending on dev->n_addr_cells)
938 * cells 4+5 or 5+6: the size of the range
939 */
940 ranges = lc_ranges;
941 rlen = orig_rlen;
942 while (ranges && (rlen -= np * sizeof(unsigned int)) >= 0) {
943 res = NULL;
944 size = ranges[na+4];
945 switch ((ranges[0] >> 24) & 0x3) {
946 case 1: /* I/O space */
947 if (ranges[2] != 0)
948 break;
949 hose->io_base_phys = ranges[na+2];
950 /* limit I/O space to 16MB */
951 if (size > 0x01000000)
952 size = 0x01000000;
953 hose->io_base_virt = ioremap(ranges[na+2], size);
954 if (primary)
955 isa_io_base = (unsigned long) hose->io_base_virt;
956 res = &hose->io_resource;
957 res->flags = IORESOURCE_IO;
958 res->start = ranges[2];
959 DBG("PCI: IO 0x%lx -> 0x%lx\n",
960 res->start, res->start + size - 1);
961 break;
962 case 2: /* memory space */
963 memno = 0;
964 if (ranges[1] == 0 && ranges[2] == 0
965 && ranges[na+4] <= (16 << 20)) {
966 /* 1st 16MB, i.e. ISA memory area */
967 if (primary)
968 isa_mem_base = ranges[na+2];
969 memno = 1;
970 }
971 while (memno < 3 && hose->mem_resources[memno].flags)
972 ++memno;
973 if (memno == 0)
974 hose->pci_mem_offset = ranges[na+2] - ranges[2];
975 if (memno < 3) {
976 res = &hose->mem_resources[memno];
977 res->flags = IORESOURCE_MEM;
978 if(ranges[0] & 0x40000000)
979 res->flags |= IORESOURCE_PREFETCH;
980 res->start = ranges[na+2];
981 DBG("PCI: MEM[%d] 0x%lx -> 0x%lx\n", memno,
982 res->start, res->start + size - 1);
983 }
984 break;
985 }
986 if (res != NULL) {
987 res->name = dev->full_name;
988 res->end = res->start + size - 1;
989 res->parent = NULL;
990 res->sibling = NULL;
991 res->child = NULL;
992 }
993 ranges += np;
994 }
995}
996
997/* We create the "pci-OF-bus-map" property now so it appears in the
998 * /proc device tree
999 */
1000void __init
1001pci_create_OF_bus_map(void)
1002{
1003 struct property* of_prop;
1004
1005 of_prop = (struct property*) alloc_bootmem(sizeof(struct property) + 256);
1006 if (of_prop && find_path_device("/")) {
1007 memset(of_prop, -1, sizeof(struct property) + 256);
1008 of_prop->name = "pci-OF-bus-map";
1009 of_prop->length = 256;
1010 of_prop->value = (unsigned char *)&of_prop[1];
1011 prom_add_property(find_path_device("/"), of_prop);
1012 }
1013}
1014
1015static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *attr, char *buf)
1016{
1017 struct pci_dev *pdev;
1018 struct device_node *np;
1019
1020 pdev = to_pci_dev (dev);
1021 np = pci_device_to_OF_node(pdev);
1022 if (np == NULL || np->full_name == NULL)
1023 return 0;
1024 return sprintf(buf, "%s", np->full_name);
1025}
1026static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
1027
1028#else /* CONFIG_PPC_OF */
1029void pcibios_make_OF_bus_map(void)
1030{
1031}
1032#endif /* CONFIG_PPC_OF */
1033
1034/* Add sysfs properties */
1035void pcibios_add_platform_entries(struct pci_dev *pdev)
1036{
1037#ifdef CONFIG_PPC_OF
1038 device_create_file(&pdev->dev, &dev_attr_devspec);
1039#endif /* CONFIG_PPC_OF */
1040}
1041
1042
1043#ifdef CONFIG_PPC_PMAC
1044/*
1045 * This set of routines checks for PCI<->PCI bridges that have closed
1046 * IO resources and have child devices. It tries to re-open an IO
1047 * window on them.
1048 *
1049 * This is a _temporary_ fix to workaround a problem with Apple's OF
1050 * closing IO windows on P2P bridges when the OF drivers of cards
1051 * below this bridge don't claim any IO range (typically ATI or
1052 * Adaptec).
1053 *
1054 * A more complete fix would be to use drivers/pci/setup-bus.c, which
1055 * involves a working pcibios_fixup_pbus_ranges(), some more care about
1056 * ordering when creating the host bus resources, and maybe a few more
1057 * minor tweaks
1058 */
1059
1060/* Initialize bridges with base/limit values we have collected */
1061static void __init
1062do_update_p2p_io_resource(struct pci_bus *bus, int enable_vga)
1063{
1064 struct pci_dev *bridge = bus->self;
1065 struct pci_controller* hose = (struct pci_controller *)bridge->sysdata;
1066 u32 l;
1067 u16 w;
1068 struct resource res;
1069
1070 if (bus->resource[0] == NULL)
1071 return;
1072 res = *(bus->resource[0]);
1073
1074 DBG("Remapping Bus %d, bridge: %s\n", bus->number, pci_name(bridge));
1075 res.start -= ((unsigned long) hose->io_base_virt - isa_io_base);
1076 res.end -= ((unsigned long) hose->io_base_virt - isa_io_base);
1077 DBG(" IO window: %08lx-%08lx\n", res.start, res.end);
1078
1079 /* Set up the top and bottom of the PCI I/O segment for this bus. */
1080 pci_read_config_dword(bridge, PCI_IO_BASE, &l);
1081 l &= 0xffff000f;
1082 l |= (res.start >> 8) & 0x00f0;
1083 l |= res.end & 0xf000;
1084 pci_write_config_dword(bridge, PCI_IO_BASE, l);
1085
1086 if ((l & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) {
1087 l = (res.start >> 16) | (res.end & 0xffff0000);
1088 pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, l);
1089 }
1090
1091 pci_read_config_word(bridge, PCI_COMMAND, &w);
1092 w |= PCI_COMMAND_IO;
1093 pci_write_config_word(bridge, PCI_COMMAND, w);
1094
1095#if 0 /* Enabling this causes XFree 4.2.0 to hang during PCI probe */
1096 if (enable_vga) {
1097 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, &w);
1098 w |= PCI_BRIDGE_CTL_VGA;
1099 pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, w);
1100 }
1101#endif
1102}
1103
1104/* This function is pretty basic and actually quite broken for the
1105 * general case, it's enough for us right now though. It's supposed
1106 * to tell us if we need to open an IO range at all or not and what
1107 * size.
1108 */
1109static int __init
1110check_for_io_childs(struct pci_bus *bus, struct resource* res, int *found_vga)
1111{
1112 struct pci_dev *dev;
1113 int i;
1114 int rc = 0;
1115
1116#define push_end(res, size) do { unsigned long __sz = (size) ; \
1117 res->end = ((res->end + __sz) / (__sz + 1)) * (__sz + 1) + __sz; \
1118 } while (0)
1119
1120 list_for_each_entry(dev, &bus->devices, bus_list) {
1121 u16 class = dev->class >> 8;
1122
1123 if (class == PCI_CLASS_DISPLAY_VGA ||
1124 class == PCI_CLASS_NOT_DEFINED_VGA)
1125 *found_vga = 1;
1126 if (class >> 8 == PCI_BASE_CLASS_BRIDGE && dev->subordinate)
1127 rc |= check_for_io_childs(dev->subordinate, res, found_vga);
1128 if (class == PCI_CLASS_BRIDGE_CARDBUS)
1129 push_end(res, 0xfff);
1130
1131 for (i=0; i<PCI_NUM_RESOURCES; i++) {
1132 struct resource *r;
1133 unsigned long r_size;
1134
1135 if (dev->class >> 8 == PCI_CLASS_BRIDGE_PCI
1136 && i >= PCI_BRIDGE_RESOURCES)
1137 continue;
1138 r = &dev->resource[i];
1139 r_size = r->end - r->start;
1140 if (r_size < 0xfff)
1141 r_size = 0xfff;
1142 if (r->flags & IORESOURCE_IO && (r_size) != 0) {
1143 rc = 1;
1144 push_end(res, r_size);
1145 }
1146 }
1147 }
1148
1149 return rc;
1150}
1151
1152/* Here we scan all P2P bridges of a given level that have a closed
1153 * IO window. Note that the test for the presence of a VGA card should
1154 * be improved to take into account already configured P2P bridges,
1155 * currently, we don't see them and might end up configuring 2 bridges
1156 * with VGA pass through enabled
1157 */
1158static void __init
1159do_fixup_p2p_level(struct pci_bus *bus)
1160{
1161 struct pci_bus *b;
1162 int i, parent_io;
1163 int has_vga = 0;
1164
1165 for (parent_io=0; parent_io<4; parent_io++)
1166 if (bus->resource[parent_io]
1167 && bus->resource[parent_io]->flags & IORESOURCE_IO)
1168 break;
1169 if (parent_io >= 4)
1170 return;
1171
1172 list_for_each_entry(b, &bus->children, node) {
1173 struct pci_dev *d = b->self;
1174 struct pci_controller* hose = (struct pci_controller *)d->sysdata;
1175 struct resource *res = b->resource[0];
1176 struct resource tmp_res;
1177 unsigned long max;
1178 int found_vga = 0;
1179
1180 memset(&tmp_res, 0, sizeof(tmp_res));
1181 tmp_res.start = bus->resource[parent_io]->start;
1182
1183 /* We don't let low addresses go through that closed P2P bridge, well,
1184 * that may not be necessary but I feel safer that way
1185 */
1186 if (tmp_res.start == 0)
1187 tmp_res.start = 0x1000;
1188
1189 if (!list_empty(&b->devices) && res && res->flags == 0 &&
1190 res != bus->resource[parent_io] &&
1191 (d->class >> 8) == PCI_CLASS_BRIDGE_PCI &&
1192 check_for_io_childs(b, &tmp_res, &found_vga)) {
1193 u8 io_base_lo;
1194
1195 printk(KERN_INFO "Fixing up IO bus %s\n", b->name);
1196
1197 if (found_vga) {
1198 if (has_vga) {
1199 printk(KERN_WARNING "Skipping VGA, already active"
1200 " on bus segment\n");
1201 found_vga = 0;
1202 } else
1203 has_vga = 1;
1204 }
1205 pci_read_config_byte(d, PCI_IO_BASE, &io_base_lo);
1206
1207 if ((io_base_lo & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32)
1208 max = ((unsigned long) hose->io_base_virt
1209 - isa_io_base) + 0xffffffff;
1210 else
1211 max = ((unsigned long) hose->io_base_virt
1212 - isa_io_base) + 0xffff;
1213
1214 *res = tmp_res;
1215 res->flags = IORESOURCE_IO;
1216 res->name = b->name;
1217
1218 /* Find a resource in the parent where we can allocate */
1219 for (i = 0 ; i < 4; i++) {
1220 struct resource *r = bus->resource[i];
1221 if (!r)
1222 continue;
1223 if ((r->flags & IORESOURCE_IO) == 0)
1224 continue;
1225 DBG("Trying to allocate from %08lx, size %08lx from parent"
1226 " res %d: %08lx -> %08lx\n",
1227 res->start, res->end, i, r->start, r->end);
1228
1229 if (allocate_resource(r, res, res->end + 1, res->start, max,
1230 res->end + 1, NULL, NULL) < 0) {
1231 DBG("Failed !\n");
1232 continue;
1233 }
1234 do_update_p2p_io_resource(b, found_vga);
1235 break;
1236 }
1237 }
1238 do_fixup_p2p_level(b);
1239 }
1240}
1241
1242static void
1243pcibios_fixup_p2p_bridges(void)
1244{
1245 struct pci_bus *b;
1246
1247 list_for_each_entry(b, &pci_root_buses, node)
1248 do_fixup_p2p_level(b);
1249}
1250
1251#endif /* CONFIG_PPC_PMAC */
1252
1253static int __init
1254pcibios_init(void)
1255{
1256 struct pci_controller *hose;
1257 struct pci_bus *bus;
1258 int next_busno;
1259
1260 printk(KERN_INFO "PCI: Probing PCI hardware\n");
1261
1262 /* Scan all of the recorded PCI controllers. */
1263 for (next_busno = 0, hose = hose_head; hose; hose = hose->next) {
1264 if (pci_assign_all_buses)
1265 hose->first_busno = next_busno;
1266 hose->last_busno = 0xff;
1267 bus = pci_scan_bus(hose->first_busno, hose->ops, hose);
1268 hose->last_busno = bus->subordinate;
1269 if (pci_assign_all_buses || next_busno <= hose->last_busno)
1270 next_busno = hose->last_busno + pcibios_assign_bus_offset;
1271 }
1272 pci_bus_count = next_busno;
1273
1274 /* OpenFirmware based machines need a map of OF bus
1275 * numbers vs. kernel bus numbers since we may have to
1276 * remap them.
1277 */
1278 if (pci_assign_all_buses && have_of)
1279 pcibios_make_OF_bus_map();
1280
1281 /* Do machine dependent PCI interrupt routing */
1282 if (ppc_md.pci_swizzle && ppc_md.pci_map_irq)
1283 pci_fixup_irqs(ppc_md.pci_swizzle, ppc_md.pci_map_irq);
1284
1285 /* Call machine dependent fixup */
1286 if (ppc_md.pcibios_fixup)
1287 ppc_md.pcibios_fixup();
1288
1289 /* Allocate and assign resources */
1290 pcibios_allocate_bus_resources(&pci_root_buses);
1291 pcibios_allocate_resources(0);
1292 pcibios_allocate_resources(1);
1293#ifdef CONFIG_PPC_PMAC
1294 pcibios_fixup_p2p_bridges();
1295#endif /* CONFIG_PPC_PMAC */
1296 pcibios_assign_resources();
1297
1298 /* Call machine dependent post-init code */
1299 if (ppc_md.pcibios_after_init)
1300 ppc_md.pcibios_after_init();
1301
1302 return 0;
1303}
1304
1305subsys_initcall(pcibios_init);
1306
1307unsigned char __init
1308common_swizzle(struct pci_dev *dev, unsigned char *pinp)
1309{
1310 struct pci_controller *hose = dev->sysdata;
1311
1312 if (dev->bus->number != hose->first_busno) {
1313 u8 pin = *pinp;
1314 do {
1315 pin = bridge_swizzle(pin, PCI_SLOT(dev->devfn));
1316 /* Move up the chain of bridges. */
1317 dev = dev->bus->self;
1318 } while (dev->bus->self);
1319 *pinp = pin;
1320
1321 /* The slot is the idsel of the last bridge. */
1322 }
1323 return PCI_SLOT(dev->devfn);
1324}
1325
1326unsigned long resource_fixup(struct pci_dev * dev, struct resource * res,
1327 unsigned long start, unsigned long size)
1328{
1329 return start;
1330}
1331
1332void __init pcibios_fixup_bus(struct pci_bus *bus)
1333{
1334 struct pci_controller *hose = (struct pci_controller *) bus->sysdata;
1335 unsigned long io_offset;
1336 struct resource *res;
1337 int i;
1338
1339 io_offset = (unsigned long)hose->io_base_virt - isa_io_base;
1340 if (bus->parent == NULL) {
1341 /* This is a host bridge - fill in its resources */
1342 hose->bus = bus;
1343
1344 bus->resource[0] = res = &hose->io_resource;
1345 if (!res->flags) {
1346 if (io_offset)
1347 printk(KERN_ERR "I/O resource not set for host"
1348 " bridge %d\n", hose->index);
1349 res->start = 0;
1350 res->end = IO_SPACE_LIMIT;
1351 res->flags = IORESOURCE_IO;
1352 }
1353 res->start += io_offset;
1354 res->end += io_offset;
1355
1356 for (i = 0; i < 3; ++i) {
1357 res = &hose->mem_resources[i];
1358 if (!res->flags) {
1359 if (i > 0)
1360 continue;
1361 printk(KERN_ERR "Memory resource not set for "
1362 "host bridge %d\n", hose->index);
1363 res->start = hose->pci_mem_offset;
1364 res->end = ~0U;
1365 res->flags = IORESOURCE_MEM;
1366 }
1367 bus->resource[i+1] = res;
1368 }
1369 } else {
1370 /* This is a subordinate bridge */
1371 pci_read_bridge_bases(bus);
1372
1373 for (i = 0; i < 4; ++i) {
1374 if ((res = bus->resource[i]) == NULL)
1375 continue;
1376 if (!res->flags)
1377 continue;
1378 if (io_offset && (res->flags & IORESOURCE_IO)) {
1379 res->start += io_offset;
1380 res->end += io_offset;
1381 } else if (hose->pci_mem_offset
1382 && (res->flags & IORESOURCE_MEM)) {
1383 res->start += hose->pci_mem_offset;
1384 res->end += hose->pci_mem_offset;
1385 }
1386 }
1387 }
1388
1389 if (ppc_md.pcibios_fixup_bus)
1390 ppc_md.pcibios_fixup_bus(bus);
1391}
1392
1393char __init *pcibios_setup(char *str)
1394{
1395 return str;
1396}
1397
1398/* the next one is stolen from the alpha port... */
1399void __init
1400pcibios_update_irq(struct pci_dev *dev, int irq)
1401{
1402 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
1403 /* XXX FIXME - update OF device tree node interrupt property */
1404}
1405
1406int pcibios_enable_device(struct pci_dev *dev, int mask)
1407{
1408 u16 cmd, old_cmd;
1409 int idx;
1410 struct resource *r;
1411
1412 if (ppc_md.pcibios_enable_device_hook)
1413 if (ppc_md.pcibios_enable_device_hook(dev, 0))
1414 return -EINVAL;
1415
1416 pci_read_config_word(dev, PCI_COMMAND, &cmd);
1417 old_cmd = cmd;
1418 for (idx=0; idx<6; idx++) {
1419 r = &dev->resource[idx];
1420 if (r->flags & IORESOURCE_UNSET) {
1421 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
1422 return -EINVAL;
1423 }
1424 if (r->flags & IORESOURCE_IO)
1425 cmd |= PCI_COMMAND_IO;
1426 if (r->flags & IORESOURCE_MEM)
1427 cmd |= PCI_COMMAND_MEMORY;
1428 }
1429 if (cmd != old_cmd) {
1430 printk("PCI: Enabling device %s (%04x -> %04x)\n",
1431 pci_name(dev), old_cmd, cmd);
1432 pci_write_config_word(dev, PCI_COMMAND, cmd);
1433 }
1434 return 0;
1435}
1436
1437struct pci_controller*
1438pci_bus_to_hose(int bus)
1439{
1440 struct pci_controller* hose = hose_head;
1441
1442 for (; hose; hose = hose->next)
1443 if (bus >= hose->first_busno && bus <= hose->last_busno)
1444 return hose;
1445 return NULL;
1446}
1447
1448void __iomem *
1449pci_bus_io_base(unsigned int bus)
1450{
1451 struct pci_controller *hose;
1452
1453 hose = pci_bus_to_hose(bus);
1454 if (!hose)
1455 return NULL;
1456 return hose->io_base_virt;
1457}
1458
1459unsigned long
1460pci_bus_io_base_phys(unsigned int bus)
1461{
1462 struct pci_controller *hose;
1463
1464 hose = pci_bus_to_hose(bus);
1465 if (!hose)
1466 return 0;
1467 return hose->io_base_phys;
1468}
1469
1470unsigned long
1471pci_bus_mem_base_phys(unsigned int bus)
1472{
1473 struct pci_controller *hose;
1474
1475 hose = pci_bus_to_hose(bus);
1476 if (!hose)
1477 return 0;
1478 return hose->pci_mem_offset;
1479}
1480
1481unsigned long
1482pci_resource_to_bus(struct pci_dev *pdev, struct resource *res)
1483{
1484 /* Hack alert again ! See comments in chrp_pci.c
1485 */
1486 struct pci_controller* hose =
1487 (struct pci_controller *)pdev->sysdata;
1488 if (hose && res->flags & IORESOURCE_MEM)
1489 return res->start - hose->pci_mem_offset;
1490 /* We may want to do something with IOs here... */
1491 return res->start;
1492}
1493
1494
1495static struct resource *__pci_mmap_make_offset(struct pci_dev *dev,
1496 unsigned long *offset,
1497 enum pci_mmap_state mmap_state)
1498{
1499 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
1500 unsigned long io_offset = 0;
1501 int i, res_bit;
1502
1503 if (hose == 0)
1504 return NULL; /* should never happen */
1505
1506 /* If memory, add on the PCI bridge address offset */
1507 if (mmap_state == pci_mmap_mem) {
1508 *offset += hose->pci_mem_offset;
1509 res_bit = IORESOURCE_MEM;
1510 } else {
1511 io_offset = hose->io_base_virt - ___IO_BASE;
1512 *offset += io_offset;
1513 res_bit = IORESOURCE_IO;
1514 }
1515
1516 /*
1517 * Check that the offset requested corresponds to one of the
1518 * resources of the device.
1519 */
1520 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
1521 struct resource *rp = &dev->resource[i];
1522 int flags = rp->flags;
1523
1524 /* treat ROM as memory (should be already) */
1525 if (i == PCI_ROM_RESOURCE)
1526 flags |= IORESOURCE_MEM;
1527
1528 /* Active and same type? */
1529 if ((flags & res_bit) == 0)
1530 continue;
1531
1532 /* In the range of this resource? */
1533 if (*offset < (rp->start & PAGE_MASK) || *offset > rp->end)
1534 continue;
1535
1536 /* found it! construct the final physical address */
1537 if (mmap_state == pci_mmap_io)
1538 *offset += hose->io_base_phys - io_offset;
1539 return rp;
1540 }
1541
1542 return NULL;
1543}
1544
1545/*
1546 * Set vm_page_prot of VMA, as appropriate for this architecture, for a pci
1547 * device mapping.
1548 */
1549static pgprot_t __pci_mmap_set_pgprot(struct pci_dev *dev, struct resource *rp,
1550 pgprot_t protection,
1551 enum pci_mmap_state mmap_state,
1552 int write_combine)
1553{
1554 unsigned long prot = pgprot_val(protection);
1555
1556 /* Write combine is always 0 on non-memory space mappings. On
1557 * memory space, if the user didn't pass 1, we check for a
1558 * "prefetchable" resource. This is a bit hackish, but we use
1559 * this to workaround the inability of /sysfs to provide a write
1560 * combine bit
1561 */
1562 if (mmap_state != pci_mmap_mem)
1563 write_combine = 0;
1564 else if (write_combine == 0) {
1565 if (rp->flags & IORESOURCE_PREFETCH)
1566 write_combine = 1;
1567 }
1568
1569 /* XXX would be nice to have a way to ask for write-through */
1570 prot |= _PAGE_NO_CACHE;
1571 if (write_combine)
1572 prot &= ~_PAGE_GUARDED;
1573 else
1574 prot |= _PAGE_GUARDED;
1575
1576 printk("PCI map for %s:%lx, prot: %lx\n", pci_name(dev), rp->start,
1577 prot);
1578
1579 return __pgprot(prot);
1580}
1581
1582/*
1583 * This one is used by /dev/mem and fbdev who have no clue about the
1584 * PCI device, it tries to find the PCI device first and calls the
1585 * above routine
1586 */
1587pgprot_t pci_phys_mem_access_prot(struct file *file,
1588 unsigned long pfn,
1589 unsigned long size,
1590 pgprot_t protection)
1591{
1592 struct pci_dev *pdev = NULL;
1593 struct resource *found = NULL;
1594 unsigned long prot = pgprot_val(protection);
1595 unsigned long offset = pfn << PAGE_SHIFT;
1596 int i;
1597
1598 if (page_is_ram(pfn))
1599 return prot;
1600
1601 prot |= _PAGE_NO_CACHE | _PAGE_GUARDED;
1602
1603 for_each_pci_dev(pdev) {
1604 for (i = 0; i <= PCI_ROM_RESOURCE; i++) {
1605 struct resource *rp = &pdev->resource[i];
1606 int flags = rp->flags;
1607
1608 /* Active and same type? */
1609 if ((flags & IORESOURCE_MEM) == 0)
1610 continue;
1611 /* In the range of this resource? */
1612 if (offset < (rp->start & PAGE_MASK) ||
1613 offset > rp->end)
1614 continue;
1615 found = rp;
1616 break;
1617 }
1618 if (found)
1619 break;
1620 }
1621 if (found) {
1622 if (found->flags & IORESOURCE_PREFETCH)
1623 prot &= ~_PAGE_GUARDED;
1624 pci_dev_put(pdev);
1625 }
1626
1627 DBG("non-PCI map for %lx, prot: %lx\n", offset, prot);
1628
1629 return __pgprot(prot);
1630}
1631
1632
1633/*
1634 * Perform the actual remap of the pages for a PCI device mapping, as
1635 * appropriate for this architecture. The region in the process to map
1636 * is described by vm_start and vm_end members of VMA, the base physical
1637 * address is found in vm_pgoff.
1638 * The pci device structure is provided so that architectures may make mapping
1639 * decisions on a per-device or per-bus basis.
1640 *
1641 * Returns a negative error code on failure, zero on success.
1642 */
1643int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
1644 enum pci_mmap_state mmap_state,
1645 int write_combine)
1646{
1647 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
1648 struct resource *rp;
1649 int ret;
1650
1651 rp = __pci_mmap_make_offset(dev, &offset, mmap_state);
1652 if (rp == NULL)
1653 return -EINVAL;
1654
1655 vma->vm_pgoff = offset >> PAGE_SHIFT;
1656 vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO;
1657 vma->vm_page_prot = __pci_mmap_set_pgprot(dev, rp,
1658 vma->vm_page_prot,
1659 mmap_state, write_combine);
1660
1661 ret = remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
1662 vma->vm_end - vma->vm_start, vma->vm_page_prot);
1663
1664 return ret;
1665}
1666
1667/* Obsolete functions. Should be removed once the symbios driver
1668 * is fixed
1669 */
1670unsigned long
1671phys_to_bus(unsigned long pa)
1672{
1673 struct pci_controller *hose;
1674 int i;
1675
1676 for (hose = hose_head; hose; hose = hose->next) {
1677 for (i = 0; i < 3; ++i) {
1678 if (pa >= hose->mem_resources[i].start
1679 && pa <= hose->mem_resources[i].end) {
1680 /*
1681 * XXX the hose->pci_mem_offset really
1682 * only applies to mem_resources[0].
1683 * We need a way to store an offset for
1684 * the others. -- paulus
1685 */
1686 if (i == 0)
1687 pa -= hose->pci_mem_offset;
1688 return pa;
1689 }
1690 }
1691 }
1692 /* hmmm, didn't find it */
1693 return 0;
1694}
1695
1696unsigned long
1697pci_phys_to_bus(unsigned long pa, int busnr)
1698{
1699 struct pci_controller* hose = pci_bus_to_hose(busnr);
1700 if (!hose)
1701 return pa;
1702 return pa - hose->pci_mem_offset;
1703}
1704
1705unsigned long
1706pci_bus_to_phys(unsigned int ba, int busnr)
1707{
1708 struct pci_controller* hose = pci_bus_to_hose(busnr);
1709 if (!hose)
1710 return ba;
1711 return ba + hose->pci_mem_offset;
1712}
1713
1714/* Provide information on locations of various I/O regions in physical
1715 * memory. Do this on a per-card basis so that we choose the right
1716 * root bridge.
1717 * Note that the returned IO or memory base is a physical address
1718 */
1719
1720long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
1721{
1722 struct pci_controller* hose;
1723 long result = -EOPNOTSUPP;
1724
1725 /* Argh ! Please forgive me for that hack, but that's the
1726 * simplest way to get existing XFree to not lockup on some
1727 * G5 machines... So when something asks for bus 0 io base
1728 * (bus 0 is HT root), we return the AGP one instead.
1729 */
1730#ifdef CONFIG_PPC_PMAC
1731 if (_machine == _MACH_Pmac && machine_is_compatible("MacRISC4"))
1732 if (bus == 0)
1733 bus = 0xf0;
1734#endif /* CONFIG_PPC_PMAC */
1735
1736 hose = pci_bus_to_hose(bus);
1737 if (!hose)
1738 return -ENODEV;
1739
1740 switch (which) {
1741 case IOBASE_BRIDGE_NUMBER:
1742 return (long)hose->first_busno;
1743 case IOBASE_MEMORY:
1744 return (long)hose->pci_mem_offset;
1745 case IOBASE_IO:
1746 return (long)hose->io_base_phys;
1747 case IOBASE_ISA_IO:
1748 return (long)isa_io_base;
1749 case IOBASE_ISA_MEM:
1750 return (long)isa_mem_base;
1751 }
1752
1753 return result;
1754}
1755
1756void pci_resource_to_user(const struct pci_dev *dev, int bar,
1757 const struct resource *rsrc,
1758 u64 *start, u64 *end)
1759{
1760 struct pci_controller *hose = pci_bus_to_hose(dev->bus->number);
1761 unsigned long offset = 0;
1762
1763 if (hose == NULL)
1764 return;
1765
1766 if (rsrc->flags & IORESOURCE_IO)
1767 offset = ___IO_BASE - hose->io_base_virt + hose->io_base_phys;
1768
1769 *start = rsrc->start + offset;
1770 *end = rsrc->end + offset;
1771}
1772
1773void __init
1774pci_init_resource(struct resource *res, unsigned long start, unsigned long end,
1775 int flags, char *name)
1776{
1777 res->start = start;
1778 res->end = end;
1779 res->flags = flags;
1780 res->name = name;
1781 res->parent = NULL;
1782 res->sibling = NULL;
1783 res->child = NULL;
1784}
1785
1786void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
1787{
1788 unsigned long start = pci_resource_start(dev, bar);
1789 unsigned long len = pci_resource_len(dev, bar);
1790 unsigned long flags = pci_resource_flags(dev, bar);
1791
1792 if (!len)
1793 return NULL;
1794 if (max && len > max)
1795 len = max;
1796 if (flags & IORESOURCE_IO)
1797 return ioport_map(start, len);
1798 if (flags & IORESOURCE_MEM)
1799 /* Not checking IORESOURCE_CACHEABLE because PPC does
1800 * not currently distinguish between ioremap and
1801 * ioremap_nocache.
1802 */
1803 return ioremap(start, len);
1804 /* What? */
1805 return NULL;
1806}
1807
1808void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
1809{
1810 /* Nothing to do */
1811}
1812EXPORT_SYMBOL(pci_iomap);
1813EXPORT_SYMBOL(pci_iounmap);
1814
1815unsigned long pci_address_to_pio(phys_addr_t address)
1816{
1817 struct pci_controller* hose = hose_head;
1818
1819 for (; hose; hose = hose->next) {
1820 unsigned int size = hose->io_resource.end -
1821 hose->io_resource.start + 1;
1822 if (address >= hose->io_base_phys &&
1823 address < (hose->io_base_phys + size)) {
1824 unsigned long base =
1825 (unsigned long)hose->io_base_virt - _IO_BASE;
1826 return base + (address - hose->io_base_phys);
1827 }
1828 }
1829 return (unsigned int)-1;
1830}
1831EXPORT_SYMBOL(pci_address_to_pio);
1832
1833/*
1834 * Null PCI config access functions, for the case when we can't
1835 * find a hose.
1836 */
1837#define NULL_PCI_OP(rw, size, type) \
1838static int \
1839null_##rw##_config_##size(struct pci_dev *dev, int offset, type val) \
1840{ \
1841 return PCIBIOS_DEVICE_NOT_FOUND; \
1842}
1843
1844static int
1845null_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
1846 int len, u32 *val)
1847{
1848 return PCIBIOS_DEVICE_NOT_FOUND;
1849}
1850
1851static int
1852null_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
1853 int len, u32 val)
1854{
1855 return PCIBIOS_DEVICE_NOT_FOUND;
1856}
1857
1858static struct pci_ops null_pci_ops =
1859{
1860 null_read_config,
1861 null_write_config
1862};
1863
1864/*
1865 * These functions are used early on before PCI scanning is done
1866 * and all of the pci_dev and pci_bus structures have been created.
1867 */
1868static struct pci_bus *
1869fake_pci_bus(struct pci_controller *hose, int busnr)
1870{
1871 static struct pci_bus bus;
1872
1873 if (hose == 0) {
1874 hose = pci_bus_to_hose(busnr);
1875 if (hose == 0)
1876 printk(KERN_ERR "Can't find hose for PCI bus %d!\n", busnr);
1877 }
1878 bus.number = busnr;
1879 bus.sysdata = hose;
1880 bus.ops = hose? hose->ops: &null_pci_ops;
1881 return &bus;
1882}
1883
1884#define EARLY_PCI_OP(rw, size, type) \
1885int early_##rw##_config_##size(struct pci_controller *hose, int bus, \
1886 int devfn, int offset, type value) \
1887{ \
1888 return pci_bus_##rw##_config_##size(fake_pci_bus(hose, bus), \
1889 devfn, offset, value); \
1890}
1891
1892EARLY_PCI_OP(read, byte, u8 *)
1893EARLY_PCI_OP(read, word, u16 *)
1894EARLY_PCI_OP(read, dword, u32 *)
1895EARLY_PCI_OP(write, byte, u8)
1896EARLY_PCI_OP(write, word, u16)
1897EARLY_PCI_OP(write, dword, u32)
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index 8b6008ab217d..c367520bc1c3 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -34,7 +34,7 @@
34 34
35#ifdef DEBUG 35#ifdef DEBUG
36#include <asm/udbg.h> 36#include <asm/udbg.h>
37#define DBG(fmt...) udbg_printf(fmt) 37#define DBG(fmt...) printk(fmt)
38#else 38#else
39#define DBG(fmt...) 39#define DBG(fmt...)
40#endif 40#endif
@@ -53,6 +53,7 @@ EXPORT_SYMBOL(io_page_mask);
53#ifdef CONFIG_PPC_MULTIPLATFORM 53#ifdef CONFIG_PPC_MULTIPLATFORM
54static void fixup_resource(struct resource *res, struct pci_dev *dev); 54static void fixup_resource(struct resource *res, struct pci_dev *dev);
55static void do_bus_setup(struct pci_bus *bus); 55static void do_bus_setup(struct pci_bus *bus);
56static void phbs_remap_io(void);
56#endif 57#endif
57 58
58/* pci_io_base -- the base address from which io bars are offsets. 59/* pci_io_base -- the base address from which io bars are offsets.
@@ -251,7 +252,8 @@ void pcibios_free_controller(struct pci_controller *phb)
251 kfree(phb); 252 kfree(phb);
252} 253}
253 254
254static void __init pcibios_claim_one_bus(struct pci_bus *b) 255#ifndef CONFIG_PPC_ISERIES
256void __devinit pcibios_claim_one_bus(struct pci_bus *b)
255{ 257{
256 struct pci_dev *dev; 258 struct pci_dev *dev;
257 struct pci_bus *child_bus; 259 struct pci_bus *child_bus;
@@ -271,8 +273,10 @@ static void __init pcibios_claim_one_bus(struct pci_bus *b)
271 list_for_each_entry(child_bus, &b->children, node) 273 list_for_each_entry(child_bus, &b->children, node)
272 pcibios_claim_one_bus(child_bus); 274 pcibios_claim_one_bus(child_bus);
273} 275}
276#ifdef CONFIG_HOTPLUG
277EXPORT_SYMBOL_GPL(pcibios_claim_one_bus);
278#endif
274 279
275#ifndef CONFIG_PPC_ISERIES
276static void __init pcibios_claim_of_setup(void) 280static void __init pcibios_claim_of_setup(void)
277{ 281{
278 struct pci_bus *b; 282 struct pci_bus *b;
@@ -323,6 +327,7 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
323 addrs = (u32 *) get_property(node, "assigned-addresses", &proplen); 327 addrs = (u32 *) get_property(node, "assigned-addresses", &proplen);
324 if (!addrs) 328 if (!addrs)
325 return; 329 return;
330 DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs);
326 for (; proplen >= 20; proplen -= 20, addrs += 5) { 331 for (; proplen >= 20; proplen -= 20, addrs += 5) {
327 flags = pci_parse_of_flags(addrs[0]); 332 flags = pci_parse_of_flags(addrs[0]);
328 if (!flags) 333 if (!flags)
@@ -332,6 +337,9 @@ static void pci_parse_of_addrs(struct device_node *node, struct pci_dev *dev)
332 if (!size) 337 if (!size)
333 continue; 338 continue;
334 i = addrs[0] & 0xff; 339 i = addrs[0] & 0xff;
340 DBG(" base: %llx, size: %llx, i: %x\n",
341 (unsigned long long)base, (unsigned long long)size, i);
342
335 if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) { 343 if (PCI_BASE_ADDRESS_0 <= i && i <= PCI_BASE_ADDRESS_5) {
336 res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2]; 344 res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2];
337 } else if (i == dev->rom_base_reg) { 345 } else if (i == dev->rom_base_reg) {
@@ -362,6 +370,8 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
362 if (type == NULL) 370 if (type == NULL)
363 type = ""; 371 type = "";
364 372
373 DBG(" create device, devfn: %x, type: %s\n", devfn, type);
374
365 memset(dev, 0, sizeof(struct pci_dev)); 375 memset(dev, 0, sizeof(struct pci_dev));
366 dev->bus = bus; 376 dev->bus = bus;
367 dev->sysdata = node; 377 dev->sysdata = node;
@@ -375,12 +385,14 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
375 dev->subsystem_vendor = get_int_prop(node, "subsystem-vendor-id", 0); 385 dev->subsystem_vendor = get_int_prop(node, "subsystem-vendor-id", 0);
376 dev->subsystem_device = get_int_prop(node, "subsystem-id", 0); 386 dev->subsystem_device = get_int_prop(node, "subsystem-id", 0);
377 387
378 dev->cfg_size = 256; /*pci_cfg_space_size(dev);*/ 388 dev->cfg_size = pci_cfg_space_size(dev);
379 389
380 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus), 390 sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
381 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn)); 391 dev->bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
382 dev->class = get_int_prop(node, "class-code", 0); 392 dev->class = get_int_prop(node, "class-code", 0);
383 393
394 DBG(" class: 0x%x\n", dev->class);
395
384 dev->current_state = 4; /* unknown power state */ 396 dev->current_state = 4; /* unknown power state */
385 397
386 if (!strcmp(type, "pci")) { 398 if (!strcmp(type, "pci")) {
@@ -402,6 +414,8 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
402 414
403 pci_parse_of_addrs(node, dev); 415 pci_parse_of_addrs(node, dev);
404 416
417 DBG(" adding to system ...\n");
418
405 pci_device_add(dev, bus); 419 pci_device_add(dev, bus);
406 420
407 /* XXX pci_scan_msi_device(dev); */ 421 /* XXX pci_scan_msi_device(dev); */
@@ -418,15 +432,21 @@ void __devinit of_scan_bus(struct device_node *node,
418 int reglen, devfn; 432 int reglen, devfn;
419 struct pci_dev *dev; 433 struct pci_dev *dev;
420 434
435 DBG("of_scan_bus(%s) bus no %d... \n", node->full_name, bus->number);
436
421 while ((child = of_get_next_child(node, child)) != NULL) { 437 while ((child = of_get_next_child(node, child)) != NULL) {
438 DBG(" * %s\n", child->full_name);
422 reg = (u32 *) get_property(child, "reg", &reglen); 439 reg = (u32 *) get_property(child, "reg", &reglen);
423 if (reg == NULL || reglen < 20) 440 if (reg == NULL || reglen < 20)
424 continue; 441 continue;
425 devfn = (reg[0] >> 8) & 0xff; 442 devfn = (reg[0] >> 8) & 0xff;
443
426 /* create a new pci_dev for this device */ 444 /* create a new pci_dev for this device */
427 dev = of_create_pci_dev(child, bus, devfn); 445 dev = of_create_pci_dev(child, bus, devfn);
428 if (!dev) 446 if (!dev)
429 continue; 447 continue;
448 DBG("dev header type: %x\n", dev->hdr_type);
449
430 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE || 450 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE ||
431 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS) 451 dev->hdr_type == PCI_HEADER_TYPE_CARDBUS)
432 of_scan_pci_bridge(child, dev); 452 of_scan_pci_bridge(child, dev);
@@ -446,16 +466,18 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
446 unsigned int flags; 466 unsigned int flags;
447 u64 size; 467 u64 size;
448 468
469 DBG("of_scan_pci_bridge(%s)\n", node->full_name);
470
449 /* parse bus-range property */ 471 /* parse bus-range property */
450 busrange = (u32 *) get_property(node, "bus-range", &len); 472 busrange = (u32 *) get_property(node, "bus-range", &len);
451 if (busrange == NULL || len != 8) { 473 if (busrange == NULL || len != 8) {
452 printk(KERN_ERR "Can't get bus-range for PCI-PCI bridge %s\n", 474 printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n",
453 node->full_name); 475 node->full_name);
454 return; 476 return;
455 } 477 }
456 ranges = (u32 *) get_property(node, "ranges", &len); 478 ranges = (u32 *) get_property(node, "ranges", &len);
457 if (ranges == NULL) { 479 if (ranges == NULL) {
458 printk(KERN_ERR "Can't get ranges for PCI-PCI bridge %s\n", 480 printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n",
459 node->full_name); 481 node->full_name);
460 return; 482 return;
461 } 483 }
@@ -509,10 +531,13 @@ void __devinit of_scan_pci_bridge(struct device_node *node,
509 } 531 }
510 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus), 532 sprintf(bus->name, "PCI Bus %04x:%02x", pci_domain_nr(bus),
511 bus->number); 533 bus->number);
534 DBG(" bus name: %s\n", bus->name);
512 535
513 mode = PCI_PROBE_NORMAL; 536 mode = PCI_PROBE_NORMAL;
514 if (ppc_md.pci_probe_mode) 537 if (ppc_md.pci_probe_mode)
515 mode = ppc_md.pci_probe_mode(bus); 538 mode = ppc_md.pci_probe_mode(bus);
539 DBG(" probe mode: %d\n", mode);
540
516 if (mode == PCI_PROBE_DEVTREE) 541 if (mode == PCI_PROBE_DEVTREE)
517 of_scan_bus(node, bus); 542 of_scan_bus(node, bus);
518 else if (mode == PCI_PROBE_NORMAL) 543 else if (mode == PCI_PROBE_NORMAL)
@@ -528,6 +553,8 @@ void __devinit scan_phb(struct pci_controller *hose)
528 int i, mode; 553 int i, mode;
529 struct resource *res; 554 struct resource *res;
530 555
556 DBG("Scanning PHB %s\n", node ? node->full_name : "<NO NAME>");
557
531 bus = pci_create_bus(NULL, hose->first_busno, hose->ops, node); 558 bus = pci_create_bus(NULL, hose->first_busno, hose->ops, node);
532 if (bus == NULL) { 559 if (bus == NULL) {
533 printk(KERN_ERR "Failed to create bus for PCI domain %04x\n", 560 printk(KERN_ERR "Failed to create bus for PCI domain %04x\n",
@@ -552,8 +579,9 @@ void __devinit scan_phb(struct pci_controller *hose)
552 579
553 mode = PCI_PROBE_NORMAL; 580 mode = PCI_PROBE_NORMAL;
554#ifdef CONFIG_PPC_MULTIPLATFORM 581#ifdef CONFIG_PPC_MULTIPLATFORM
555 if (ppc_md.pci_probe_mode) 582 if (node && ppc_md.pci_probe_mode)
556 mode = ppc_md.pci_probe_mode(bus); 583 mode = ppc_md.pci_probe_mode(bus);
584 DBG(" probe mode: %d\n", mode);
557 if (mode == PCI_PROBE_DEVTREE) { 585 if (mode == PCI_PROBE_DEVTREE) {
558 bus->subordinate = hose->last_busno; 586 bus->subordinate = hose->last_busno;
559 of_scan_bus(node, bus); 587 of_scan_bus(node, bus);
@@ -842,8 +870,7 @@ pgprot_t pci_phys_mem_access_prot(struct file *file,
842 * Returns a negative error code on failure, zero on success. 870 * Returns a negative error code on failure, zero on success.
843 */ 871 */
844int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 872int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
845 enum pci_mmap_state mmap_state, 873 enum pci_mmap_state mmap_state, int write_combine)
846 int write_combine)
847{ 874{
848 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; 875 unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
849 struct resource *rp; 876 struct resource *rp;
@@ -896,6 +923,25 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node,
896 unsigned long phb_io_base_phys, 923 unsigned long phb_io_base_phys,
897 void __iomem * phb_io_base_virt) 924 void __iomem * phb_io_base_virt)
898{ 925{
926 /* Remove these asap */
927
928 struct pci_address {
929 u32 a_hi;
930 u32 a_mid;
931 u32 a_lo;
932 };
933
934 struct isa_address {
935 u32 a_hi;
936 u32 a_lo;
937 };
938
939 struct isa_range {
940 struct isa_address isa_addr;
941 struct pci_address pci_addr;
942 unsigned int size;
943 };
944
899 struct isa_range *range; 945 struct isa_range *range;
900 unsigned long pci_addr; 946 unsigned long pci_addr;
901 unsigned int isa_addr; 947 unsigned int isa_addr;
@@ -1173,7 +1219,7 @@ int remap_bus_range(struct pci_bus *bus)
1173} 1219}
1174EXPORT_SYMBOL(remap_bus_range); 1220EXPORT_SYMBOL(remap_bus_range);
1175 1221
1176void phbs_remap_io(void) 1222static void phbs_remap_io(void)
1177{ 1223{
1178 struct pci_controller *hose, *tmp; 1224 struct pci_controller *hose, *tmp;
1179 1225
@@ -1223,6 +1269,7 @@ void __devinit pcibios_fixup_device_resources(struct pci_dev *dev,
1223} 1269}
1224EXPORT_SYMBOL(pcibios_fixup_device_resources); 1270EXPORT_SYMBOL(pcibios_fixup_device_resources);
1225 1271
1272
1226static void __devinit do_bus_setup(struct pci_bus *bus) 1273static void __devinit do_bus_setup(struct pci_bus *bus)
1227{ 1274{
1228 struct pci_dev *dev; 1275 struct pci_dev *dev;
@@ -1306,8 +1353,38 @@ void pci_resource_to_user(const struct pci_dev *dev, int bar,
1306 *end = rsrc->end + offset; 1353 *end = rsrc->end + offset;
1307} 1354}
1308 1355
1356struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
1357{
1358 if (!have_of)
1359 return NULL;
1360 while(node) {
1361 struct pci_controller *hose, *tmp;
1362 list_for_each_entry_safe(hose, tmp, &hose_list, list_node)
1363 if (hose->arch_data == node)
1364 return hose;
1365 node = node->parent;
1366 }
1367 return NULL;
1368}
1369
1309#endif /* CONFIG_PPC_MULTIPLATFORM */ 1370#endif /* CONFIG_PPC_MULTIPLATFORM */
1310 1371
1372unsigned long pci_address_to_pio(phys_addr_t address)
1373{
1374 struct pci_controller *hose, *tmp;
1375
1376 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
1377 if (address >= hose->io_base_phys &&
1378 address < (hose->io_base_phys + hose->pci_io_size)) {
1379 unsigned long base =
1380 (unsigned long)hose->io_base_virt - pci_io_base;
1381 return base + (address - hose->io_base_phys);
1382 }
1383 }
1384 return (unsigned int)-1;
1385}
1386EXPORT_SYMBOL_GPL(pci_address_to_pio);
1387
1311 1388
1312#define IOBASE_BRIDGE_NUMBER 0 1389#define IOBASE_BRIDGE_NUMBER 0
1313#define IOBASE_MEMORY 1 1390#define IOBASE_MEMORY 1
diff --git a/arch/powerpc/kernel/pmc.c b/arch/powerpc/kernel/pmc.c
index 2d333cc84082..e6fb194fe537 100644
--- a/arch/powerpc/kernel/pmc.c
+++ b/arch/powerpc/kernel/pmc.c
@@ -43,8 +43,13 @@ static void dummy_perf(struct pt_regs *regs)
43 mtspr(SPRN_MMCR0, mmcr0); 43 mtspr(SPRN_MMCR0, mmcr0);
44} 44}
45#else 45#else
46/* Ensure exceptions are disabled */
46static void dummy_perf(struct pt_regs *regs) 47static void dummy_perf(struct pt_regs *regs)
47{ 48{
49 unsigned int mmcr0 = mfspr(SPRN_MMCR0);
50
51 mmcr0 &= ~(MMCR0_PMXE);
52 mtspr(SPRN_MMCR0, mmcr0);
48} 53}
49#endif 54#endif
50 55
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 94db25708456..d9a459c144d8 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -76,11 +76,6 @@ EXPORT_SYMBOL(single_step_exception);
76EXPORT_SYMBOL(sys_sigreturn); 76EXPORT_SYMBOL(sys_sigreturn);
77#endif 77#endif
78 78
79#if defined(CONFIG_PPC_PREP)
80EXPORT_SYMBOL(_prep_type);
81EXPORT_SYMBOL(ucSystemType);
82#endif
83
84EXPORT_SYMBOL(strcpy); 79EXPORT_SYMBOL(strcpy);
85EXPORT_SYMBOL(strncpy); 80EXPORT_SYMBOL(strncpy);
86EXPORT_SYMBOL(strcat); 81EXPORT_SYMBOL(strcat);
@@ -235,8 +230,7 @@ EXPORT_SYMBOL(__down_interruptible);
235EXPORT_SYMBOL(cpm_install_handler); 230EXPORT_SYMBOL(cpm_install_handler);
236EXPORT_SYMBOL(cpm_free_handler); 231EXPORT_SYMBOL(cpm_free_handler);
237#endif /* CONFIG_8xx */ 232#endif /* CONFIG_8xx */
238#if defined(CONFIG_8xx) || defined(CONFIG_40x) || defined(CONFIG_85xx) ||\ 233#if defined(CONFIG_8xx) || defined(CONFIG_40x)
239 defined(CONFIG_83xx)
240EXPORT_SYMBOL(__res); 234EXPORT_SYMBOL(__res);
241#endif 235#endif
242 236
@@ -249,7 +243,6 @@ EXPORT_SYMBOL(set_context);
249extern long mol_trampoline; 243extern long mol_trampoline;
250EXPORT_SYMBOL(mol_trampoline); /* For MOL */ 244EXPORT_SYMBOL(mol_trampoline); /* For MOL */
251EXPORT_SYMBOL(flush_hash_pages); /* For MOL */ 245EXPORT_SYMBOL(flush_hash_pages); /* For MOL */
252EXPORT_SYMBOL_GPL(__handle_mm_fault); /* For MOL */
253#ifdef CONFIG_SMP 246#ifdef CONFIG_SMP
254extern int mmu_hash_lock; 247extern int mmu_hash_lock;
255EXPORT_SYMBOL(mmu_hash_lock); /* For MOL */ 248EXPORT_SYMBOL(mmu_hash_lock); /* For MOL */
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 105d5609ff57..57703994a063 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -201,13 +201,13 @@ int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs)
201} 201}
202#endif /* CONFIG_SPE */ 202#endif /* CONFIG_SPE */
203 203
204#ifndef CONFIG_SMP
204/* 205/*
205 * If we are doing lazy switching of CPU state (FP, altivec or SPE), 206 * If we are doing lazy switching of CPU state (FP, altivec or SPE),
206 * and the current task has some state, discard it. 207 * and the current task has some state, discard it.
207 */ 208 */
208static inline void discard_lazy_cpu_state(void) 209void discard_lazy_cpu_state(void)
209{ 210{
210#ifndef CONFIG_SMP
211 preempt_disable(); 211 preempt_disable();
212 if (last_task_used_math == current) 212 if (last_task_used_math == current)
213 last_task_used_math = NULL; 213 last_task_used_math = NULL;
@@ -220,9 +220,10 @@ static inline void discard_lazy_cpu_state(void)
220 last_task_used_spe = NULL; 220 last_task_used_spe = NULL;
221#endif 221#endif
222 preempt_enable(); 222 preempt_enable();
223#endif /* CONFIG_SMP */
224} 223}
224#endif /* CONFIG_SMP */
225 225
226#ifdef CONFIG_PPC_MERGE /* XXX for now */
226int set_dabr(unsigned long dabr) 227int set_dabr(unsigned long dabr)
227{ 228{
228 if (ppc_md.set_dabr) 229 if (ppc_md.set_dabr)
@@ -231,6 +232,7 @@ int set_dabr(unsigned long dabr)
231 mtspr(SPRN_DABR, dabr); 232 mtspr(SPRN_DABR, dabr);
232 return 0; 233 return 0;
233} 234}
235#endif
234 236
235#ifdef CONFIG_PPC64 237#ifdef CONFIG_PPC64
236DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array); 238DEFINE_PER_CPU(struct cpu_usage, cpu_usage_array);
@@ -424,7 +426,7 @@ void show_regs(struct pt_regs * regs)
424 if (trap == 0x300 || trap == 0x600) 426 if (trap == 0x300 || trap == 0x600)
425 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr); 427 printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
426 printk("TASK = %p[%d] '%s' THREAD: %p", 428 printk("TASK = %p[%d] '%s' THREAD: %p",
427 current, current->pid, current->comm, current->thread_info); 429 current, current->pid, current->comm, task_thread_info(current));
428 430
429#ifdef CONFIG_SMP 431#ifdef CONFIG_SMP
430 printk(" CPU: %d", smp_processor_id()); 432 printk(" CPU: %d", smp_processor_id());
@@ -503,7 +505,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
503{ 505{
504 struct pt_regs *childregs, *kregs; 506 struct pt_regs *childregs, *kregs;
505 extern void ret_from_fork(void); 507 extern void ret_from_fork(void);
506 unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE; 508 unsigned long sp = (unsigned long)task_stack_page(p) + THREAD_SIZE;
507 509
508 CHECK_FULL_REGS(regs); 510 CHECK_FULL_REGS(regs);
509 /* Copy registers */ 511 /* Copy registers */
@@ -516,7 +518,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
516#ifdef CONFIG_PPC32 518#ifdef CONFIG_PPC32
517 childregs->gpr[2] = (unsigned long) p; 519 childregs->gpr[2] = (unsigned long) p;
518#else 520#else
519 clear_ti_thread_flag(p->thread_info, TIF_32BIT); 521 clear_tsk_thread_flag(p, TIF_32BIT);
520#endif 522#endif
521 p->thread.regs = NULL; /* no user register state */ 523 p->thread.regs = NULL; /* no user register state */
522 } else { 524 } else {
@@ -588,10 +590,8 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
588 * set. Do it now. 590 * set. Do it now.
589 */ 591 */
590 if (!current->thread.regs) { 592 if (!current->thread.regs) {
591 unsigned long childregs = (unsigned long)current->thread_info + 593 struct pt_regs *regs = task_stack_page(current) + THREAD_SIZE;
592 THREAD_SIZE; 594 current->thread.regs = regs - 1;
593 childregs -= sizeof(struct pt_regs);
594 current->thread.regs = (struct pt_regs *)childregs;
595 } 595 }
596 596
597 memset(regs->gpr, 0, sizeof(regs->gpr)); 597 memset(regs->gpr, 0, sizeof(regs->gpr));
@@ -767,7 +767,7 @@ out:
767static int validate_sp(unsigned long sp, struct task_struct *p, 767static int validate_sp(unsigned long sp, struct task_struct *p,
768 unsigned long nbytes) 768 unsigned long nbytes)
769{ 769{
770 unsigned long stack_page = (unsigned long)p->thread_info; 770 unsigned long stack_page = (unsigned long)task_stack_page(p);
771 771
772 if (sp >= stack_page + sizeof(struct thread_struct) 772 if (sp >= stack_page + sizeof(struct thread_struct)
773 && sp <= stack_page + THREAD_SIZE - nbytes) 773 && sp <= stack_page + THREAD_SIZE - nbytes)
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 3bf968e74095..d50c8df0183e 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -29,6 +29,7 @@
29#include <linux/initrd.h> 29#include <linux/initrd.h>
30#include <linux/bitops.h> 30#include <linux/bitops.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/kexec.h>
32 33
33#include <asm/prom.h> 34#include <asm/prom.h>
34#include <asm/rtas.h> 35#include <asm/rtas.h>
@@ -37,6 +38,7 @@
37#include <asm/processor.h> 38#include <asm/processor.h>
38#include <asm/irq.h> 39#include <asm/irq.h>
39#include <asm/io.h> 40#include <asm/io.h>
41#include <asm/kdump.h>
40#include <asm/smp.h> 42#include <asm/smp.h>
41#include <asm/system.h> 43#include <asm/system.h>
42#include <asm/mmu.h> 44#include <asm/mmu.h>
@@ -55,21 +57,6 @@
55#define DBG(fmt...) 57#define DBG(fmt...)
56#endif 58#endif
57 59
58struct pci_reg_property {
59 struct pci_address addr;
60 u32 size_hi;
61 u32 size_lo;
62};
63
64struct isa_reg_property {
65 u32 space;
66 u32 address;
67 u32 size;
68};
69
70
71typedef int interpret_func(struct device_node *, unsigned long *,
72 int, int, int);
73 60
74static int __initdata dt_root_addr_cells; 61static int __initdata dt_root_addr_cells;
75static int __initdata dt_root_size_cells; 62static int __initdata dt_root_size_cells;
@@ -311,6 +298,16 @@ static int __devinit finish_node_interrupts(struct device_node *np,
311 int i, j, n, sense; 298 int i, j, n, sense;
312 unsigned int *irq, virq; 299 unsigned int *irq, virq;
313 struct device_node *ic; 300 struct device_node *ic;
301 int trace = 0;
302
303 //#define TRACE(fmt...) do { if (trace) { printk(fmt); mdelay(1000); } } while(0)
304#define TRACE(fmt...)
305
306 if (!strcmp(np->name, "smu-doorbell"))
307 trace = 1;
308
309 TRACE("Finishing SMU doorbell ! num_interrupt_controllers = %d\n",
310 num_interrupt_controllers);
314 311
315 if (num_interrupt_controllers == 0) { 312 if (num_interrupt_controllers == 0) {
316 /* 313 /*
@@ -345,11 +342,12 @@ static int __devinit finish_node_interrupts(struct device_node *np,
345 } 342 }
346 343
347 ints = (unsigned int *) get_property(np, "interrupts", &intlen); 344 ints = (unsigned int *) get_property(np, "interrupts", &intlen);
345 TRACE("ints=%p, intlen=%d\n", ints, intlen);
348 if (ints == NULL) 346 if (ints == NULL)
349 return 0; 347 return 0;
350 intrcells = prom_n_intr_cells(np); 348 intrcells = prom_n_intr_cells(np);
351 intlen /= intrcells * sizeof(unsigned int); 349 intlen /= intrcells * sizeof(unsigned int);
352 350 TRACE("intrcells=%d, new intlen=%d\n", intrcells, intlen);
353 np->intrs = prom_alloc(intlen * sizeof(*(np->intrs)), mem_start); 351 np->intrs = prom_alloc(intlen * sizeof(*(np->intrs)), mem_start);
354 if (!np->intrs) 352 if (!np->intrs)
355 return -ENOMEM; 353 return -ENOMEM;
@@ -360,6 +358,7 @@ static int __devinit finish_node_interrupts(struct device_node *np,
360 intrcount = 0; 358 intrcount = 0;
361 for (i = 0; i < intlen; ++i, ints += intrcells) { 359 for (i = 0; i < intlen; ++i, ints += intrcells) {
362 n = map_interrupt(&irq, &ic, np, ints, intrcells); 360 n = map_interrupt(&irq, &ic, np, ints, intrcells);
361 TRACE("map, irq=%d, ic=%p, n=%d\n", irq, ic, n);
363 if (n <= 0) 362 if (n <= 0)
364 continue; 363 continue;
365 364
@@ -370,6 +369,7 @@ static int __devinit finish_node_interrupts(struct device_node *np,
370 np->intrs[intrcount].sense = map_isa_senses[sense]; 369 np->intrs[intrcount].sense = map_isa_senses[sense];
371 } else { 370 } else {
372 virq = virt_irq_create_mapping(irq[0]); 371 virq = virt_irq_create_mapping(irq[0]);
372 TRACE("virq=%d\n", virq);
373#ifdef CONFIG_PPC64 373#ifdef CONFIG_PPC64
374 if (virq == NO_IRQ) { 374 if (virq == NO_IRQ) {
375 printk(KERN_CRIT "Could not allocate interrupt" 375 printk(KERN_CRIT "Could not allocate interrupt"
@@ -379,6 +379,12 @@ static int __devinit finish_node_interrupts(struct device_node *np,
379#endif 379#endif
380 np->intrs[intrcount].line = irq_offset_up(virq); 380 np->intrs[intrcount].line = irq_offset_up(virq);
381 sense = (n > 1)? (irq[1] & 3): 1; 381 sense = (n > 1)? (irq[1] & 3): 1;
382
383 /* Apple uses bits in there in a different way, let's
384 * only keep the real sense bit on macs
385 */
386 if (_machine == PLATFORM_POWERMAC)
387 sense &= 0x1;
382 np->intrs[intrcount].sense = map_mpic_senses[sense]; 388 np->intrs[intrcount].sense = map_mpic_senses[sense];
383 } 389 }
384 390
@@ -388,12 +394,13 @@ static int __devinit finish_node_interrupts(struct device_node *np,
388 char *name = get_property(ic->parent, "name", NULL); 394 char *name = get_property(ic->parent, "name", NULL);
389 if (name && !strcmp(name, "u3")) 395 if (name && !strcmp(name, "u3"))
390 np->intrs[intrcount].line += 128; 396 np->intrs[intrcount].line += 128;
391 else if (!(name && !strcmp(name, "mac-io"))) 397 else if (!(name && (!strcmp(name, "mac-io") ||
398 !strcmp(name, "u4"))))
392 /* ignore other cascaded controllers, such as 399 /* ignore other cascaded controllers, such as
393 the k2-sata-root */ 400 the k2-sata-root */
394 break; 401 break;
395 } 402 }
396#endif 403#endif /* CONFIG_PPC64 */
397 if (n > 2) { 404 if (n > 2) {
398 printk("hmmm, got %d intr cells for %s:", n, 405 printk("hmmm, got %d intr cells for %s:", n,
399 np->full_name); 406 np->full_name);
@@ -408,234 +415,19 @@ static int __devinit finish_node_interrupts(struct device_node *np,
408 return 0; 415 return 0;
409} 416}
410 417
411static int __devinit interpret_pci_props(struct device_node *np,
412 unsigned long *mem_start,
413 int naddrc, int nsizec,
414 int measure_only)
415{
416 struct address_range *adr;
417 struct pci_reg_property *pci_addrs;
418 int i, l, n_addrs;
419
420 pci_addrs = (struct pci_reg_property *)
421 get_property(np, "assigned-addresses", &l);
422 if (!pci_addrs)
423 return 0;
424
425 n_addrs = l / sizeof(*pci_addrs);
426
427 adr = prom_alloc(n_addrs * sizeof(*adr), mem_start);
428 if (!adr)
429 return -ENOMEM;
430
431 if (measure_only)
432 return 0;
433
434 np->addrs = adr;
435 np->n_addrs = n_addrs;
436
437 for (i = 0; i < n_addrs; i++) {
438 adr[i].space = pci_addrs[i].addr.a_hi;
439 adr[i].address = pci_addrs[i].addr.a_lo |
440 ((u64)pci_addrs[i].addr.a_mid << 32);
441 adr[i].size = pci_addrs[i].size_lo;
442 }
443
444 return 0;
445}
446
447static int __init interpret_dbdma_props(struct device_node *np,
448 unsigned long *mem_start,
449 int naddrc, int nsizec,
450 int measure_only)
451{
452 struct reg_property32 *rp;
453 struct address_range *adr;
454 unsigned long base_address;
455 int i, l;
456 struct device_node *db;
457
458 base_address = 0;
459 if (!measure_only) {
460 for (db = np->parent; db != NULL; db = db->parent) {
461 if (!strcmp(db->type, "dbdma") && db->n_addrs != 0) {
462 base_address = db->addrs[0].address;
463 break;
464 }
465 }
466 }
467
468 rp = (struct reg_property32 *) get_property(np, "reg", &l);
469 if (rp != 0 && l >= sizeof(struct reg_property32)) {
470 i = 0;
471 adr = (struct address_range *) (*mem_start);
472 while ((l -= sizeof(struct reg_property32)) >= 0) {
473 if (!measure_only) {
474 adr[i].space = 2;
475 adr[i].address = rp[i].address + base_address;
476 adr[i].size = rp[i].size;
477 }
478 ++i;
479 }
480 np->addrs = adr;
481 np->n_addrs = i;
482 (*mem_start) += i * sizeof(struct address_range);
483 }
484
485 return 0;
486}
487
488static int __init interpret_macio_props(struct device_node *np,
489 unsigned long *mem_start,
490 int naddrc, int nsizec,
491 int measure_only)
492{
493 struct reg_property32 *rp;
494 struct address_range *adr;
495 unsigned long base_address;
496 int i, l;
497 struct device_node *db;
498
499 base_address = 0;
500 if (!measure_only) {
501 for (db = np->parent; db != NULL; db = db->parent) {
502 if (!strcmp(db->type, "mac-io") && db->n_addrs != 0) {
503 base_address = db->addrs[0].address;
504 break;
505 }
506 }
507 }
508
509 rp = (struct reg_property32 *) get_property(np, "reg", &l);
510 if (rp != 0 && l >= sizeof(struct reg_property32)) {
511 i = 0;
512 adr = (struct address_range *) (*mem_start);
513 while ((l -= sizeof(struct reg_property32)) >= 0) {
514 if (!measure_only) {
515 adr[i].space = 2;
516 adr[i].address = rp[i].address + base_address;
517 adr[i].size = rp[i].size;
518 }
519 ++i;
520 }
521 np->addrs = adr;
522 np->n_addrs = i;
523 (*mem_start) += i * sizeof(struct address_range);
524 }
525
526 return 0;
527}
528
529static int __init interpret_isa_props(struct device_node *np,
530 unsigned long *mem_start,
531 int naddrc, int nsizec,
532 int measure_only)
533{
534 struct isa_reg_property *rp;
535 struct address_range *adr;
536 int i, l;
537
538 rp = (struct isa_reg_property *) get_property(np, "reg", &l);
539 if (rp != 0 && l >= sizeof(struct isa_reg_property)) {
540 i = 0;
541 adr = (struct address_range *) (*mem_start);
542 while ((l -= sizeof(struct isa_reg_property)) >= 0) {
543 if (!measure_only) {
544 adr[i].space = rp[i].space;
545 adr[i].address = rp[i].address;
546 adr[i].size = rp[i].size;
547 }
548 ++i;
549 }
550 np->addrs = adr;
551 np->n_addrs = i;
552 (*mem_start) += i * sizeof(struct address_range);
553 }
554
555 return 0;
556}
557
558static int __init interpret_root_props(struct device_node *np,
559 unsigned long *mem_start,
560 int naddrc, int nsizec,
561 int measure_only)
562{
563 struct address_range *adr;
564 int i, l;
565 unsigned int *rp;
566 int rpsize = (naddrc + nsizec) * sizeof(unsigned int);
567
568 rp = (unsigned int *) get_property(np, "reg", &l);
569 if (rp != 0 && l >= rpsize) {
570 i = 0;
571 adr = (struct address_range *) (*mem_start);
572 while ((l -= rpsize) >= 0) {
573 if (!measure_only) {
574 adr[i].space = 0;
575 adr[i].address = rp[naddrc - 1];
576 adr[i].size = rp[naddrc + nsizec - 1];
577 }
578 ++i;
579 rp += naddrc + nsizec;
580 }
581 np->addrs = adr;
582 np->n_addrs = i;
583 (*mem_start) += i * sizeof(struct address_range);
584 }
585
586 return 0;
587}
588
589static int __devinit finish_node(struct device_node *np, 418static int __devinit finish_node(struct device_node *np,
590 unsigned long *mem_start, 419 unsigned long *mem_start,
591 interpret_func *ifunc,
592 int naddrc, int nsizec,
593 int measure_only) 420 int measure_only)
594{ 421{
595 struct device_node *child; 422 struct device_node *child;
596 int *ip, rc = 0; 423 int rc = 0;
597
598 /* get the device addresses and interrupts */
599 if (ifunc != NULL)
600 rc = ifunc(np, mem_start, naddrc, nsizec, measure_only);
601 if (rc)
602 goto out;
603 424
604 rc = finish_node_interrupts(np, mem_start, measure_only); 425 rc = finish_node_interrupts(np, mem_start, measure_only);
605 if (rc) 426 if (rc)
606 goto out; 427 goto out;
607 428
608 /* Look for #address-cells and #size-cells properties. */
609 ip = (int *) get_property(np, "#address-cells", NULL);
610 if (ip != NULL)
611 naddrc = *ip;
612 ip = (int *) get_property(np, "#size-cells", NULL);
613 if (ip != NULL)
614 nsizec = *ip;
615
616 if (!strcmp(np->name, "device-tree") || np->parent == NULL)
617 ifunc = interpret_root_props;
618 else if (np->type == 0)
619 ifunc = NULL;
620 else if (!strcmp(np->type, "pci") || !strcmp(np->type, "vci"))
621 ifunc = interpret_pci_props;
622 else if (!strcmp(np->type, "dbdma"))
623 ifunc = interpret_dbdma_props;
624 else if (!strcmp(np->type, "mac-io") || ifunc == interpret_macio_props)
625 ifunc = interpret_macio_props;
626 else if (!strcmp(np->type, "isa"))
627 ifunc = interpret_isa_props;
628 else if (!strcmp(np->name, "uni-n") || !strcmp(np->name, "u3"))
629 ifunc = interpret_root_props;
630 else if (!((ifunc == interpret_dbdma_props
631 || ifunc == interpret_macio_props)
632 && (!strcmp(np->type, "escc")
633 || !strcmp(np->type, "media-bay"))))
634 ifunc = NULL;
635
636 for (child = np->child; child != NULL; child = child->sibling) { 429 for (child = np->child; child != NULL; child = child->sibling) {
637 rc = finish_node(child, mem_start, ifunc, 430 rc = finish_node(child, mem_start, measure_only);
638 naddrc, nsizec, measure_only);
639 if (rc) 431 if (rc)
640 goto out; 432 goto out;
641 } 433 }
@@ -697,10 +489,10 @@ void __init finish_device_tree(void)
697 * reason and then remove those additional 16 bytes 489 * reason and then remove those additional 16 bytes
698 */ 490 */
699 size = 16; 491 size = 16;
700 finish_node(allnodes, &size, NULL, 0, 0, 1); 492 finish_node(allnodes, &size, 1);
701 size -= 16; 493 size -= 16;
702 end = start = (unsigned long) __va(lmb_alloc(size, 128)); 494 end = start = (unsigned long) __va(lmb_alloc(size, 128));
703 finish_node(allnodes, &end, NULL, 0, 0, 0); 495 finish_node(allnodes, &end, 0);
704 BUG_ON(end != start + size); 496 BUG_ON(end != start + size);
705 497
706 DBG(" <- finish_device_tree\n"); 498 DBG(" <- finish_device_tree\n");
@@ -1180,7 +972,7 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1180#endif 972#endif
1181 973
1182#ifdef CONFIG_PPC_RTAS 974#ifdef CONFIG_PPC_RTAS
1183 /* To help early debugging via the front panel, we retreive a minimal 975 /* To help early debugging via the front panel, we retrieve a minimal
1184 * set of RTAS infos now if available 976 * set of RTAS infos now if available
1185 */ 977 */
1186 { 978 {
@@ -1197,6 +989,16 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1197 } 989 }
1198#endif /* CONFIG_PPC_RTAS */ 990#endif /* CONFIG_PPC_RTAS */
1199 991
992#ifdef CONFIG_KEXEC
993 lprop = (u64*)of_get_flat_dt_prop(node, "linux,crashkernel-base", NULL);
994 if (lprop)
995 crashk_res.start = *lprop;
996
997 lprop = (u64*)of_get_flat_dt_prop(node, "linux,crashkernel-size", NULL);
998 if (lprop)
999 crashk_res.end = crashk_res.start + *lprop - 1;
1000#endif
1001
1200 /* break now */ 1002 /* break now */
1201 return 1; 1003 return 1;
1202} 1004}
@@ -1263,7 +1065,9 @@ static int __init early_init_dt_scan_memory(unsigned long node,
1263 } else if (strcmp(type, "memory") != 0) 1065 } else if (strcmp(type, "memory") != 0)
1264 return 0; 1066 return 0;
1265 1067
1266 reg = (cell_t *)of_get_flat_dt_prop(node, "reg", &l); 1068 reg = (cell_t *)of_get_flat_dt_prop(node, "linux,usable-memory", &l);
1069 if (reg == NULL)
1070 reg = (cell_t *)of_get_flat_dt_prop(node, "reg", &l);
1267 if (reg == NULL) 1071 if (reg == NULL)
1268 return 0; 1072 return 0;
1269 1073
@@ -1296,17 +1100,37 @@ static int __init early_init_dt_scan_memory(unsigned long node,
1296 1100
1297static void __init early_reserve_mem(void) 1101static void __init early_reserve_mem(void)
1298{ 1102{
1299 unsigned long base, size; 1103 u64 base, size;
1300 unsigned long *reserve_map; 1104 u64 *reserve_map;
1301 1105
1302 reserve_map = (unsigned long *)(((unsigned long)initial_boot_params) + 1106 reserve_map = (u64 *)(((unsigned long)initial_boot_params) +
1303 initial_boot_params->off_mem_rsvmap); 1107 initial_boot_params->off_mem_rsvmap);
1108#ifdef CONFIG_PPC32
1109 /*
1110 * Handle the case where we might be booting from an old kexec
1111 * image that setup the mem_rsvmap as pairs of 32-bit values
1112 */
1113 if (*reserve_map > 0xffffffffull) {
1114 u32 base_32, size_32;
1115 u32 *reserve_map_32 = (u32 *)reserve_map;
1116
1117 while (1) {
1118 base_32 = *(reserve_map_32++);
1119 size_32 = *(reserve_map_32++);
1120 if (size_32 == 0)
1121 break;
1122 DBG("reserving: %lx -> %lx\n", base_32, size_32);
1123 lmb_reserve(base_32, size_32);
1124 }
1125 return;
1126 }
1127#endif
1304 while (1) { 1128 while (1) {
1305 base = *(reserve_map++); 1129 base = *(reserve_map++);
1306 size = *(reserve_map++); 1130 size = *(reserve_map++);
1307 if (size == 0) 1131 if (size == 0)
1308 break; 1132 break;
1309 DBG("reserving: %lx -> %lx\n", base, size); 1133 DBG("reserving: %llx -> %llx\n", base, size);
1310 lmb_reserve(base, size); 1134 lmb_reserve(base, size);
1311 } 1135 }
1312 1136
@@ -1335,11 +1159,14 @@ void __init early_init_devtree(void *params)
1335 of_scan_flat_dt(early_init_dt_scan_memory, NULL); 1159 of_scan_flat_dt(early_init_dt_scan_memory, NULL);
1336 lmb_enforce_memory_limit(memory_limit); 1160 lmb_enforce_memory_limit(memory_limit);
1337 lmb_analyze(); 1161 lmb_analyze();
1338 lmb_reserve(0, __pa(klimit));
1339 1162
1340 DBG("Phys. mem: %lx\n", lmb_phys_mem_size()); 1163 DBG("Phys. mem: %lx\n", lmb_phys_mem_size());
1341 1164
1342 /* Reserve LMB regions used by kernel, initrd, dt, etc... */ 1165 /* Reserve LMB regions used by kernel, initrd, dt, etc... */
1166 lmb_reserve(PHYSICAL_START, __pa(klimit) - PHYSICAL_START);
1167#ifdef CONFIG_CRASH_DUMP
1168 lmb_reserve(0, KDUMP_RESERVE_LIMIT);
1169#endif
1343 early_reserve_mem(); 1170 early_reserve_mem();
1344 1171
1345 DBG("Scanning CPUs ...\n"); 1172 DBG("Scanning CPUs ...\n");
@@ -1800,9 +1627,13 @@ static void of_node_release(struct kref *kref)
1800 kfree(prop->value); 1627 kfree(prop->value);
1801 kfree(prop); 1628 kfree(prop);
1802 prop = next; 1629 prop = next;
1630
1631 if (!prop) {
1632 prop = node->deadprops;
1633 node->deadprops = NULL;
1634 }
1803 } 1635 }
1804 kfree(node->intrs); 1636 kfree(node->intrs);
1805 kfree(node->addrs);
1806 kfree(node->full_name); 1637 kfree(node->full_name);
1807 kfree(node->data); 1638 kfree(node->data);
1808 kfree(node); 1639 kfree(node);
@@ -1884,9 +1715,7 @@ void of_detach_node(const struct device_node *np)
1884 * This should probably be split up into smaller chunks. 1715 * This should probably be split up into smaller chunks.
1885 */ 1716 */
1886 1717
1887static int of_finish_dynamic_node(struct device_node *node, 1718static int of_finish_dynamic_node(struct device_node *node)
1888 unsigned long *unused1, int unused2,
1889 int unused3, int unused4)
1890{ 1719{
1891 struct device_node *parent = of_get_parent(node); 1720 struct device_node *parent = of_get_parent(node);
1892 int err = 0; 1721 int err = 0;
@@ -1907,7 +1736,8 @@ static int of_finish_dynamic_node(struct device_node *node,
1907 return -ENODEV; 1736 return -ENODEV;
1908 1737
1909 /* fix up new node's linux_phandle field */ 1738 /* fix up new node's linux_phandle field */
1910 if ((ibm_phandle = (unsigned int *)get_property(node, "ibm,phandle", NULL))) 1739 if ((ibm_phandle = (unsigned int *)get_property(node,
1740 "ibm,phandle", NULL)))
1911 node->linux_phandle = *ibm_phandle; 1741 node->linux_phandle = *ibm_phandle;
1912 1742
1913out: 1743out:
@@ -1922,7 +1752,9 @@ static int prom_reconfig_notifier(struct notifier_block *nb,
1922 1752
1923 switch (action) { 1753 switch (action) {
1924 case PSERIES_RECONFIG_ADD: 1754 case PSERIES_RECONFIG_ADD:
1925 err = finish_node(node, NULL, of_finish_dynamic_node, 0, 0, 0); 1755 err = of_finish_dynamic_node(node);
1756 if (!err)
1757 finish_node(node, NULL, 0);
1926 if (err < 0) { 1758 if (err < 0) {
1927 printk(KERN_ERR "finish_node returned %d\n", err); 1759 printk(KERN_ERR "finish_node returned %d\n", err);
1928 err = NOTIFY_BAD; 1760 err = NOTIFY_BAD;
@@ -1947,22 +1779,32 @@ static int __init prom_reconfig_setup(void)
1947__initcall(prom_reconfig_setup); 1779__initcall(prom_reconfig_setup);
1948#endif 1780#endif
1949 1781
1950/* 1782struct property *of_find_property(struct device_node *np, const char *name,
1951 * Find a property with a given name for a given node 1783 int *lenp)
1952 * and return the value.
1953 */
1954unsigned char *get_property(struct device_node *np, const char *name,
1955 int *lenp)
1956{ 1784{
1957 struct property *pp; 1785 struct property *pp;
1958 1786
1787 read_lock(&devtree_lock);
1959 for (pp = np->properties; pp != 0; pp = pp->next) 1788 for (pp = np->properties; pp != 0; pp = pp->next)
1960 if (strcmp(pp->name, name) == 0) { 1789 if (strcmp(pp->name, name) == 0) {
1961 if (lenp != 0) 1790 if (lenp != 0)
1962 *lenp = pp->length; 1791 *lenp = pp->length;
1963 return pp->value; 1792 break;
1964 } 1793 }
1965 return NULL; 1794 read_unlock(&devtree_lock);
1795
1796 return pp;
1797}
1798
1799/*
1800 * Find a property with a given name for a given node
1801 * and return the value.
1802 */
1803unsigned char *get_property(struct device_node *np, const char *name,
1804 int *lenp)
1805{
1806 struct property *pp = of_find_property(np,name,lenp);
1807 return pp ? pp->value : NULL;
1966} 1808}
1967EXPORT_SYMBOL(get_property); 1809EXPORT_SYMBOL(get_property);
1968 1810
@@ -1996,175 +1838,82 @@ int prom_add_property(struct device_node* np, struct property* prop)
1996 return 0; 1838 return 0;
1997} 1839}
1998 1840
1999/* I quickly hacked that one, check against spec ! */ 1841/*
2000static inline unsigned long 1842 * Remove a property from a node. Note that we don't actually
2001bus_space_to_resource_flags(unsigned int bus_space) 1843 * remove it, since we have given out who-knows-how-many pointers
1844 * to the data using get-property. Instead we just move the property
1845 * to the "dead properties" list, so it won't be found any more.
1846 */
1847int prom_remove_property(struct device_node *np, struct property *prop)
2002{ 1848{
2003 u8 space = (bus_space >> 24) & 0xf; 1849 struct property **next;
2004 if (space == 0) 1850 int found = 0;
2005 space = 0x02;
2006 if (space == 0x02)
2007 return IORESOURCE_MEM;
2008 else if (space == 0x01)
2009 return IORESOURCE_IO;
2010 else {
2011 printk(KERN_WARNING "prom.c: bus_space_to_resource_flags(), space: %x\n",
2012 bus_space);
2013 return 0;
2014 }
2015}
2016 1851
2017#ifdef CONFIG_PCI 1852 write_lock(&devtree_lock);
2018static struct resource *find_parent_pci_resource(struct pci_dev* pdev, 1853 next = &np->properties;
2019 struct address_range *range) 1854 while (*next) {
2020{ 1855 if (*next == prop) {
2021 unsigned long mask; 1856 /* found the node */
2022 int i; 1857 *next = prop->next;
2023 1858 prop->next = np->deadprops;
2024 /* Check this one */ 1859 np->deadprops = prop;
2025 mask = bus_space_to_resource_flags(range->space); 1860 found = 1;
2026 for (i=0; i<DEVICE_COUNT_RESOURCE; i++) { 1861 break;
2027 if ((pdev->resource[i].flags & mask) == mask && 1862 }
2028 pdev->resource[i].start <= range->address && 1863 next = &(*next)->next;
2029 pdev->resource[i].end > range->address) {
2030 if ((range->address + range->size - 1) > pdev->resource[i].end) {
2031 /* Add better message */
2032 printk(KERN_WARNING "PCI/OF resource overlap !\n");
2033 return NULL;
2034 }
2035 break;
2036 }
2037 } 1864 }
2038 if (i == DEVICE_COUNT_RESOURCE) 1865 write_unlock(&devtree_lock);
2039 return NULL; 1866
2040 return &pdev->resource[i]; 1867 if (!found)
1868 return -ENODEV;
1869
1870#ifdef CONFIG_PROC_DEVICETREE
1871 /* try to remove the proc node as well */
1872 if (np->pde)
1873 proc_device_tree_remove_prop(np->pde, prop);
1874#endif /* CONFIG_PROC_DEVICETREE */
1875
1876 return 0;
2041} 1877}
2042 1878
2043/* 1879/*
2044 * Request an OF device resource. Currently handles child of PCI devices, 1880 * Update a property in a node. Note that we don't actually
2045 * or other nodes attached to the root node. Ultimately, put some 1881 * remove it, since we have given out who-knows-how-many pointers
2046 * link to resources in the OF node. 1882 * to the data using get-property. Instead we just move the property
1883 * to the "dead properties" list, and add the new property to the
1884 * property list
2047 */ 1885 */
2048struct resource *request_OF_resource(struct device_node* node, int index, 1886int prom_update_property(struct device_node *np,
2049 const char* name_postfix) 1887 struct property *newprop,
1888 struct property *oldprop)
2050{ 1889{
2051 struct pci_dev* pcidev; 1890 struct property **next;
2052 u8 pci_bus, pci_devfn; 1891 int found = 0;
2053 unsigned long iomask;
2054 struct device_node* nd;
2055 struct resource* parent;
2056 struct resource *res = NULL;
2057 int nlen, plen;
2058
2059 if (index >= node->n_addrs)
2060 goto fail;
2061
2062 /* Sanity check on bus space */
2063 iomask = bus_space_to_resource_flags(node->addrs[index].space);
2064 if (iomask & IORESOURCE_MEM)
2065 parent = &iomem_resource;
2066 else if (iomask & IORESOURCE_IO)
2067 parent = &ioport_resource;
2068 else
2069 goto fail;
2070
2071 /* Find a PCI parent if any */
2072 nd = node;
2073 pcidev = NULL;
2074 while (nd) {
2075 if (!pci_device_from_OF_node(nd, &pci_bus, &pci_devfn))
2076 pcidev = pci_find_slot(pci_bus, pci_devfn);
2077 if (pcidev) break;
2078 nd = nd->parent;
2079 }
2080 if (pcidev)
2081 parent = find_parent_pci_resource(pcidev, &node->addrs[index]);
2082 if (!parent) {
2083 printk(KERN_WARNING "request_OF_resource(%s), parent not found\n",
2084 node->name);
2085 goto fail;
2086 }
2087
2088 res = __request_region(parent, node->addrs[index].address,
2089 node->addrs[index].size, NULL);
2090 if (!res)
2091 goto fail;
2092 nlen = strlen(node->name);
2093 plen = name_postfix ? strlen(name_postfix) : 0;
2094 res->name = (const char *)kmalloc(nlen+plen+1, GFP_KERNEL);
2095 if (res->name) {
2096 strcpy((char *)res->name, node->name);
2097 if (plen)
2098 strcpy((char *)res->name+nlen, name_postfix);
2099 }
2100 return res;
2101fail:
2102 return NULL;
2103}
2104EXPORT_SYMBOL(request_OF_resource);
2105 1892
2106int release_OF_resource(struct device_node *node, int index) 1893 write_lock(&devtree_lock);
2107{ 1894 next = &np->properties;
2108 struct pci_dev* pcidev; 1895 while (*next) {
2109 u8 pci_bus, pci_devfn; 1896 if (*next == oldprop) {
2110 unsigned long iomask, start, end; 1897 /* found the node */
2111 struct device_node* nd; 1898 newprop->next = oldprop->next;
2112 struct resource* parent; 1899 *next = newprop;
2113 struct resource *res = NULL; 1900 oldprop->next = np->deadprops;
2114 1901 np->deadprops = oldprop;
2115 if (index >= node->n_addrs) 1902 found = 1;
2116 return -EINVAL; 1903 break;
2117 1904 }
2118 /* Sanity check on bus space */ 1905 next = &(*next)->next;
2119 iomask = bus_space_to_resource_flags(node->addrs[index].space);
2120 if (iomask & IORESOURCE_MEM)
2121 parent = &iomem_resource;
2122 else if (iomask & IORESOURCE_IO)
2123 parent = &ioport_resource;
2124 else
2125 return -EINVAL;
2126
2127 /* Find a PCI parent if any */
2128 nd = node;
2129 pcidev = NULL;
2130 while(nd) {
2131 if (!pci_device_from_OF_node(nd, &pci_bus, &pci_devfn))
2132 pcidev = pci_find_slot(pci_bus, pci_devfn);
2133 if (pcidev) break;
2134 nd = nd->parent;
2135 }
2136 if (pcidev)
2137 parent = find_parent_pci_resource(pcidev, &node->addrs[index]);
2138 if (!parent) {
2139 printk(KERN_WARNING "release_OF_resource(%s), parent not found\n",
2140 node->name);
2141 return -ENODEV;
2142 } 1906 }
1907 write_unlock(&devtree_lock);
2143 1908
2144 /* Find us in the parent and its childs */ 1909 if (!found)
2145 res = parent->child;
2146 start = node->addrs[index].address;
2147 end = start + node->addrs[index].size - 1;
2148 while (res) {
2149 if (res->start == start && res->end == end &&
2150 (res->flags & IORESOURCE_BUSY))
2151 break;
2152 if (res->start <= start && res->end >= end)
2153 res = res->child;
2154 else
2155 res = res->sibling;
2156 }
2157 if (!res)
2158 return -ENODEV; 1910 return -ENODEV;
2159 1911
2160 if (res->name) { 1912#ifdef CONFIG_PROC_DEVICETREE
2161 kfree(res->name); 1913 /* try to add to proc as well if it was initialized */
2162 res->name = NULL; 1914 if (np->pde)
2163 } 1915 proc_device_tree_update_prop(np->pde, newprop, oldprop);
2164 release_resource(res); 1916#endif /* CONFIG_PROC_DEVICETREE */
2165 kfree(res);
2166 1917
2167 return 0; 1918 return 0;
2168} 1919}
2169EXPORT_SYMBOL(release_OF_resource);
2170#endif /* CONFIG_PCI */
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index bcdc209dca85..7881ec96ef11 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -137,8 +137,8 @@ struct prom_t {
137}; 137};
138 138
139struct mem_map_entry { 139struct mem_map_entry {
140 unsigned long base; 140 u64 base;
141 unsigned long size; 141 u64 size;
142}; 142};
143 143
144typedef u32 cell_t; 144typedef u32 cell_t;
@@ -192,6 +192,11 @@ static unsigned long __initdata alloc_bottom;
192static unsigned long __initdata rmo_top; 192static unsigned long __initdata rmo_top;
193static unsigned long __initdata ram_top; 193static unsigned long __initdata ram_top;
194 194
195#ifdef CONFIG_KEXEC
196static unsigned long __initdata prom_crashk_base;
197static unsigned long __initdata prom_crashk_size;
198#endif
199
195static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE]; 200static struct mem_map_entry __initdata mem_reserve_map[MEM_RESERVE_MAP_SIZE];
196static int __initdata mem_reserve_cnt; 201static int __initdata mem_reserve_cnt;
197 202
@@ -553,7 +558,8 @@ unsigned long prom_memparse(const char *ptr, const char **retptr)
553static void __init early_cmdline_parse(void) 558static void __init early_cmdline_parse(void)
554{ 559{
555 struct prom_t *_prom = &RELOC(prom); 560 struct prom_t *_prom = &RELOC(prom);
556 char *opt, *p; 561 const char *opt;
562 char *p;
557 int l = 0; 563 int l = 0;
558 564
559 RELOC(prom_cmd_line[0]) = 0; 565 RELOC(prom_cmd_line[0]) = 0;
@@ -590,6 +596,35 @@ static void __init early_cmdline_parse(void)
590 RELOC(prom_memory_limit) = ALIGN(RELOC(prom_memory_limit), 0x1000000); 596 RELOC(prom_memory_limit) = ALIGN(RELOC(prom_memory_limit), 0x1000000);
591#endif 597#endif
592 } 598 }
599
600#ifdef CONFIG_KEXEC
601 /*
602 * crashkernel=size@addr specifies the location to reserve for
603 * crash kernel.
604 */
605 opt = strstr(RELOC(prom_cmd_line), RELOC("crashkernel="));
606 if (opt) {
607 opt += 12;
608 RELOC(prom_crashk_size) =
609 prom_memparse(opt, (const char **)&opt);
610
611 if (ALIGN(RELOC(prom_crashk_size), 0x1000000) !=
612 RELOC(prom_crashk_size)) {
613 prom_printf("Warning: crashkernel size is not "
614 "aligned to 16MB\n");
615 }
616
617 /*
618 * At present, the crash kernel always run at 32MB.
619 * Just ignore whatever user passed.
620 */
621 RELOC(prom_crashk_base) = 0x2000000;
622 if (*opt == '@') {
623 prom_printf("Warning: PPC64 kdump kernel always runs "
624 "at 32 MB\n");
625 }
626 }
627#endif
593} 628}
594 629
595#ifdef CONFIG_PPC_PSERIES 630#ifdef CONFIG_PPC_PSERIES
@@ -863,9 +898,9 @@ static unsigned long __init prom_next_cell(int s, cell_t **cellp)
863 * If problems seem to show up, it would be a good start to track 898 * If problems seem to show up, it would be a good start to track
864 * them down. 899 * them down.
865 */ 900 */
866static void reserve_mem(unsigned long base, unsigned long size) 901static void reserve_mem(u64 base, u64 size)
867{ 902{
868 unsigned long top = base + size; 903 u64 top = base + size;
869 unsigned long cnt = RELOC(mem_reserve_cnt); 904 unsigned long cnt = RELOC(mem_reserve_cnt);
870 905
871 if (size == 0) 906 if (size == 0)
@@ -1011,6 +1046,12 @@ static void __init prom_init_mem(void)
1011 prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high)); 1046 prom_printf(" alloc_top_hi : %x\n", RELOC(alloc_top_high));
1012 prom_printf(" rmo_top : %x\n", RELOC(rmo_top)); 1047 prom_printf(" rmo_top : %x\n", RELOC(rmo_top));
1013 prom_printf(" ram_top : %x\n", RELOC(ram_top)); 1048 prom_printf(" ram_top : %x\n", RELOC(ram_top));
1049#ifdef CONFIG_KEXEC
1050 if (RELOC(prom_crashk_base)) {
1051 prom_printf(" crashk_base : %x\n", RELOC(prom_crashk_base));
1052 prom_printf(" crashk_size : %x\n", RELOC(prom_crashk_size));
1053 }
1054#endif
1014} 1055}
1015 1056
1016 1057
@@ -1500,6 +1541,8 @@ static int __init prom_find_machine_type(void)
1500#ifdef CONFIG_PPC64 1541#ifdef CONFIG_PPC64
1501 if (strstr(p, RELOC("Momentum,Maple"))) 1542 if (strstr(p, RELOC("Momentum,Maple")))
1502 return PLATFORM_MAPLE; 1543 return PLATFORM_MAPLE;
1544 if (strstr(p, RELOC("IBM,CPB")))
1545 return PLATFORM_CELL;
1503#endif 1546#endif
1504 i += sl + 1; 1547 i += sl + 1;
1505 } 1548 }
@@ -1994,7 +2037,7 @@ static void __init prom_check_initrd(unsigned long r3, unsigned long r4)
1994 if (r3 && r4 && r4 != 0xdeadbeef) { 2037 if (r3 && r4 && r4 != 0xdeadbeef) {
1995 unsigned long val; 2038 unsigned long val;
1996 2039
1997 RELOC(prom_initrd_start) = (r3 >= KERNELBASE) ? __pa(r3) : r3; 2040 RELOC(prom_initrd_start) = is_kernel_addr(r3) ? __pa(r3) : r3;
1998 RELOC(prom_initrd_end) = RELOC(prom_initrd_start) + r4; 2041 RELOC(prom_initrd_end) = RELOC(prom_initrd_start) + r4;
1999 2042
2000 val = RELOC(prom_initrd_start); 2043 val = RELOC(prom_initrd_start);
@@ -2094,6 +2137,10 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2094 */ 2137 */
2095 prom_init_mem(); 2138 prom_init_mem();
2096 2139
2140#ifdef CONFIG_KEXEC
2141 if (RELOC(prom_crashk_base))
2142 reserve_mem(RELOC(prom_crashk_base), RELOC(prom_crashk_size));
2143#endif
2097 /* 2144 /*
2098 * Determine which cpu is actually running right _now_ 2145 * Determine which cpu is actually running right _now_
2099 */ 2146 */
@@ -2150,6 +2197,16 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2150 } 2197 }
2151#endif 2198#endif
2152 2199
2200#ifdef CONFIG_KEXEC
2201 if (RELOC(prom_crashk_base)) {
2202 prom_setprop(_prom->chosen, "/chosen", "linux,crashkernel-base",
2203 PTRRELOC(&prom_crashk_base),
2204 sizeof(RELOC(prom_crashk_base)));
2205 prom_setprop(_prom->chosen, "/chosen", "linux,crashkernel-size",
2206 PTRRELOC(&prom_crashk_size),
2207 sizeof(RELOC(prom_crashk_size)));
2208 }
2209#endif
2153 /* 2210 /*
2154 * Fixup any known bugs in the device-tree 2211 * Fixup any known bugs in the device-tree
2155 */ 2212 */
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
new file mode 100644
index 000000000000..a8099c806150
--- /dev/null
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -0,0 +1,548 @@
1#undef DEBUG
2
3#include <linux/kernel.h>
4#include <linux/string.h>
5#include <linux/pci_regs.h>
6#include <linux/module.h>
7#include <linux/ioport.h>
8#include <asm/prom.h>
9#include <asm/pci-bridge.h>
10
11#ifdef DEBUG
12#define DBG(fmt...) do { printk(fmt); } while(0)
13#else
14#define DBG(fmt...) do { } while(0)
15#endif
16
17#ifdef CONFIG_PPC64
18#define PRu64 "%lx"
19#else
20#define PRu64 "%llx"
21#endif
22
23/* Max address size we deal with */
24#define OF_MAX_ADDR_CELLS 4
25#define OF_CHECK_COUNTS(na, ns) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
26 (ns) > 0)
27
28/* Debug utility */
29#ifdef DEBUG
30static void of_dump_addr(const char *s, u32 *addr, int na)
31{
32 printk("%s", s);
33 while(na--)
34 printk(" %08x", *(addr++));
35 printk("\n");
36}
37#else
38static void of_dump_addr(const char *s, u32 *addr, int na) { }
39#endif
40
41/* Read a big address */
42static inline u64 of_read_addr(u32 *cell, int size)
43{
44 u64 r = 0;
45 while (size--)
46 r = (r << 32) | *(cell++);
47 return r;
48}
49
50/* Callbacks for bus specific translators */
51struct of_bus {
52 const char *name;
53 const char *addresses;
54 int (*match)(struct device_node *parent);
55 void (*count_cells)(struct device_node *child,
56 int *addrc, int *sizec);
57 u64 (*map)(u32 *addr, u32 *range, int na, int ns, int pna);
58 int (*translate)(u32 *addr, u64 offset, int na);
59 unsigned int (*get_flags)(u32 *addr);
60};
61
62
63/*
64 * Default translator (generic bus)
65 */
66
67static void of_bus_default_count_cells(struct device_node *dev,
68 int *addrc, int *sizec)
69{
70 if (addrc)
71 *addrc = prom_n_addr_cells(dev);
72 if (sizec)
73 *sizec = prom_n_size_cells(dev);
74}
75
76static u64 of_bus_default_map(u32 *addr, u32 *range, int na, int ns, int pna)
77{
78 u64 cp, s, da;
79
80 cp = of_read_addr(range, na);
81 s = of_read_addr(range + na + pna, ns);
82 da = of_read_addr(addr, na);
83
84 DBG("OF: default map, cp="PRu64", s="PRu64", da="PRu64"\n",
85 cp, s, da);
86
87 if (da < cp || da >= (cp + s))
88 return OF_BAD_ADDR;
89 return da - cp;
90}
91
92static int of_bus_default_translate(u32 *addr, u64 offset, int na)
93{
94 u64 a = of_read_addr(addr, na);
95 memset(addr, 0, na * 4);
96 a += offset;
97 if (na > 1)
98 addr[na - 2] = a >> 32;
99 addr[na - 1] = a & 0xffffffffu;
100
101 return 0;
102}
103
104static unsigned int of_bus_default_get_flags(u32 *addr)
105{
106 return IORESOURCE_MEM;
107}
108
109
110/*
111 * PCI bus specific translator
112 */
113
114static int of_bus_pci_match(struct device_node *np)
115{
116 /* "vci" is for the /chaos bridge on 1st-gen PCI powermacs */
117 return !strcmp(np->type, "pci") || !strcmp(np->type, "vci");
118}
119
120static void of_bus_pci_count_cells(struct device_node *np,
121 int *addrc, int *sizec)
122{
123 if (addrc)
124 *addrc = 3;
125 if (sizec)
126 *sizec = 2;
127}
128
129static u64 of_bus_pci_map(u32 *addr, u32 *range, int na, int ns, int pna)
130{
131 u64 cp, s, da;
132
133 /* Check address type match */
134 if ((addr[0] ^ range[0]) & 0x03000000)
135 return OF_BAD_ADDR;
136
137 /* Read address values, skipping high cell */
138 cp = of_read_addr(range + 1, na - 1);
139 s = of_read_addr(range + na + pna, ns);
140 da = of_read_addr(addr + 1, na - 1);
141
142 DBG("OF: PCI map, cp="PRu64", s="PRu64", da="PRu64"\n", cp, s, da);
143
144 if (da < cp || da >= (cp + s))
145 return OF_BAD_ADDR;
146 return da - cp;
147}
148
149static int of_bus_pci_translate(u32 *addr, u64 offset, int na)
150{
151 return of_bus_default_translate(addr + 1, offset, na - 1);
152}
153
154static unsigned int of_bus_pci_get_flags(u32 *addr)
155{
156 unsigned int flags = 0;
157 u32 w = addr[0];
158
159 switch((w >> 24) & 0x03) {
160 case 0x01:
161 flags |= IORESOURCE_IO;
162 case 0x02: /* 32 bits */
163 case 0x03: /* 64 bits */
164 flags |= IORESOURCE_MEM;
165 }
166 if (w & 0x40000000)
167 flags |= IORESOURCE_PREFETCH;
168 return flags;
169}
170
171/*
172 * ISA bus specific translator
173 */
174
175static int of_bus_isa_match(struct device_node *np)
176{
177 return !strcmp(np->name, "isa");
178}
179
180static void of_bus_isa_count_cells(struct device_node *child,
181 int *addrc, int *sizec)
182{
183 if (addrc)
184 *addrc = 2;
185 if (sizec)
186 *sizec = 1;
187}
188
189static u64 of_bus_isa_map(u32 *addr, u32 *range, int na, int ns, int pna)
190{
191 u64 cp, s, da;
192
193 /* Check address type match */
194 if ((addr[0] ^ range[0]) & 0x00000001)
195 return OF_BAD_ADDR;
196
197 /* Read address values, skipping high cell */
198 cp = of_read_addr(range + 1, na - 1);
199 s = of_read_addr(range + na + pna, ns);
200 da = of_read_addr(addr + 1, na - 1);
201
202 DBG("OF: ISA map, cp="PRu64", s="PRu64", da="PRu64"\n", cp, s, da);
203
204 if (da < cp || da >= (cp + s))
205 return OF_BAD_ADDR;
206 return da - cp;
207}
208
209static int of_bus_isa_translate(u32 *addr, u64 offset, int na)
210{
211 return of_bus_default_translate(addr + 1, offset, na - 1);
212}
213
214static unsigned int of_bus_isa_get_flags(u32 *addr)
215{
216 unsigned int flags = 0;
217 u32 w = addr[0];
218
219 if (w & 1)
220 flags |= IORESOURCE_IO;
221 else
222 flags |= IORESOURCE_MEM;
223 return flags;
224}
225
226
227/*
228 * Array of bus specific translators
229 */
230
231static struct of_bus of_busses[] = {
232 /* PCI */
233 {
234 .name = "pci",
235 .addresses = "assigned-addresses",
236 .match = of_bus_pci_match,
237 .count_cells = of_bus_pci_count_cells,
238 .map = of_bus_pci_map,
239 .translate = of_bus_pci_translate,
240 .get_flags = of_bus_pci_get_flags,
241 },
242 /* ISA */
243 {
244 .name = "isa",
245 .addresses = "reg",
246 .match = of_bus_isa_match,
247 .count_cells = of_bus_isa_count_cells,
248 .map = of_bus_isa_map,
249 .translate = of_bus_isa_translate,
250 .get_flags = of_bus_isa_get_flags,
251 },
252 /* Default */
253 {
254 .name = "default",
255 .addresses = "reg",
256 .match = NULL,
257 .count_cells = of_bus_default_count_cells,
258 .map = of_bus_default_map,
259 .translate = of_bus_default_translate,
260 .get_flags = of_bus_default_get_flags,
261 },
262};
263
264static struct of_bus *of_match_bus(struct device_node *np)
265{
266 int i;
267
268 for (i = 0; i < ARRAY_SIZE(of_busses); i ++)
269 if (!of_busses[i].match || of_busses[i].match(np))
270 return &of_busses[i];
271 BUG();
272 return NULL;
273}
274
275static int of_translate_one(struct device_node *parent, struct of_bus *bus,
276 struct of_bus *pbus, u32 *addr,
277 int na, int ns, int pna)
278{
279 u32 *ranges;
280 unsigned int rlen;
281 int rone;
282 u64 offset = OF_BAD_ADDR;
283
284 /* Normally, an absence of a "ranges" property means we are
285 * crossing a non-translatable boundary, and thus the addresses
286 * below the current not cannot be converted to CPU physical ones.
287 * Unfortunately, while this is very clear in the spec, it's not
288 * what Apple understood, and they do have things like /uni-n or
289 * /ht nodes with no "ranges" property and a lot of perfectly
290 * useable mapped devices below them. Thus we treat the absence of
291 * "ranges" as equivalent to an empty "ranges" property which means
292 * a 1:1 translation at that level. It's up to the caller not to try
293 * to translate addresses that aren't supposed to be translated in
294 * the first place. --BenH.
295 */
296 ranges = (u32 *)get_property(parent, "ranges", &rlen);
297 if (ranges == NULL || rlen == 0) {
298 offset = of_read_addr(addr, na);
299 memset(addr, 0, pna * 4);
300 DBG("OF: no ranges, 1:1 translation\n");
301 goto finish;
302 }
303
304 DBG("OF: walking ranges...\n");
305
306 /* Now walk through the ranges */
307 rlen /= 4;
308 rone = na + pna + ns;
309 for (; rlen >= rone; rlen -= rone, ranges += rone) {
310 offset = bus->map(addr, ranges, na, ns, pna);
311 if (offset != OF_BAD_ADDR)
312 break;
313 }
314 if (offset == OF_BAD_ADDR) {
315 DBG("OF: not found !\n");
316 return 1;
317 }
318 memcpy(addr, ranges + na, 4 * pna);
319
320 finish:
321 of_dump_addr("OF: parent translation for:", addr, pna);
322 DBG("OF: with offset: "PRu64"\n", offset);
323
324 /* Translate it into parent bus space */
325 return pbus->translate(addr, offset, pna);
326}
327
328
329/*
330 * Translate an address from the device-tree into a CPU physical address,
331 * this walks up the tree and applies the various bus mappings on the
332 * way.
333 *
334 * Note: We consider that crossing any level with #size-cells == 0 to mean
335 * that translation is impossible (that is we are not dealing with a value
336 * that can be mapped to a cpu physical address). This is not really specified
337 * that way, but this is traditionally the way IBM at least do things
338 */
339u64 of_translate_address(struct device_node *dev, u32 *in_addr)
340{
341 struct device_node *parent = NULL;
342 struct of_bus *bus, *pbus;
343 u32 addr[OF_MAX_ADDR_CELLS];
344 int na, ns, pna, pns;
345 u64 result = OF_BAD_ADDR;
346
347 DBG("OF: ** translation for device %s **\n", dev->full_name);
348
349 /* Increase refcount at current level */
350 of_node_get(dev);
351
352 /* Get parent & match bus type */
353 parent = of_get_parent(dev);
354 if (parent == NULL)
355 goto bail;
356 bus = of_match_bus(parent);
357
358 /* Cound address cells & copy address locally */
359 bus->count_cells(dev, &na, &ns);
360 if (!OF_CHECK_COUNTS(na, ns)) {
361 printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
362 dev->full_name);
363 goto bail;
364 }
365 memcpy(addr, in_addr, na * 4);
366
367 DBG("OF: bus is %s (na=%d, ns=%d) on %s\n",
368 bus->name, na, ns, parent->full_name);
369 of_dump_addr("OF: translating address:", addr, na);
370
371 /* Translate */
372 for (;;) {
373 /* Switch to parent bus */
374 of_node_put(dev);
375 dev = parent;
376 parent = of_get_parent(dev);
377
378 /* If root, we have finished */
379 if (parent == NULL) {
380 DBG("OF: reached root node\n");
381 result = of_read_addr(addr, na);
382 break;
383 }
384
385 /* Get new parent bus and counts */
386 pbus = of_match_bus(parent);
387 pbus->count_cells(dev, &pna, &pns);
388 if (!OF_CHECK_COUNTS(pna, pns)) {
389 printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
390 dev->full_name);
391 break;
392 }
393
394 DBG("OF: parent bus is %s (na=%d, ns=%d) on %s\n",
395 pbus->name, pna, pns, parent->full_name);
396
397 /* Apply bus translation */
398 if (of_translate_one(dev, bus, pbus, addr, na, ns, pna))
399 break;
400
401 /* Complete the move up one level */
402 na = pna;
403 ns = pns;
404 bus = pbus;
405
406 of_dump_addr("OF: one level translation:", addr, na);
407 }
408 bail:
409 of_node_put(parent);
410 of_node_put(dev);
411
412 return result;
413}
414EXPORT_SYMBOL(of_translate_address);
415
416u32 *of_get_address(struct device_node *dev, int index, u64 *size,
417 unsigned int *flags)
418{
419 u32 *prop;
420 unsigned int psize;
421 struct device_node *parent;
422 struct of_bus *bus;
423 int onesize, i, na, ns;
424
425 /* Get parent & match bus type */
426 parent = of_get_parent(dev);
427 if (parent == NULL)
428 return NULL;
429 bus = of_match_bus(parent);
430 bus->count_cells(dev, &na, &ns);
431 of_node_put(parent);
432 if (!OF_CHECK_COUNTS(na, ns))
433 return NULL;
434
435 /* Get "reg" or "assigned-addresses" property */
436 prop = (u32 *)get_property(dev, bus->addresses, &psize);
437 if (prop == NULL)
438 return NULL;
439 psize /= 4;
440
441 onesize = na + ns;
442 for (i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++)
443 if (i == index) {
444 if (size)
445 *size = of_read_addr(prop + na, ns);
446 if (flags)
447 *flags = bus->get_flags(prop);
448 return prop;
449 }
450 return NULL;
451}
452EXPORT_SYMBOL(of_get_address);
453
454u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
455 unsigned int *flags)
456{
457 u32 *prop;
458 unsigned int psize;
459 struct device_node *parent;
460 struct of_bus *bus;
461 int onesize, i, na, ns;
462
463 /* Get parent & match bus type */
464 parent = of_get_parent(dev);
465 if (parent == NULL)
466 return NULL;
467 bus = of_match_bus(parent);
468 if (strcmp(bus->name, "pci"))
469 return NULL;
470 bus->count_cells(dev, &na, &ns);
471 of_node_put(parent);
472 if (!OF_CHECK_COUNTS(na, ns))
473 return NULL;
474
475 /* Get "reg" or "assigned-addresses" property */
476 prop = (u32 *)get_property(dev, bus->addresses, &psize);
477 if (prop == NULL)
478 return NULL;
479 psize /= 4;
480
481 onesize = na + ns;
482 for (i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++)
483 if ((prop[0] & 0xff) == ((bar_no * 4) + PCI_BASE_ADDRESS_0)) {
484 if (size)
485 *size = of_read_addr(prop + na, ns);
486 if (flags)
487 *flags = bus->get_flags(prop);
488 return prop;
489 }
490 return NULL;
491}
492EXPORT_SYMBOL(of_get_pci_address);
493
494static int __of_address_to_resource(struct device_node *dev, u32 *addrp,
495 u64 size, unsigned int flags,
496 struct resource *r)
497{
498 u64 taddr;
499
500 if ((flags & (IORESOURCE_IO | IORESOURCE_MEM)) == 0)
501 return -EINVAL;
502 taddr = of_translate_address(dev, addrp);
503 if (taddr == OF_BAD_ADDR)
504 return -EINVAL;
505 memset(r, 0, sizeof(struct resource));
506 if (flags & IORESOURCE_IO) {
507 unsigned long port;
508 port = pci_address_to_pio(taddr);
509 if (port == (unsigned long)-1)
510 return -EINVAL;
511 r->start = port;
512 r->end = port + size - 1;
513 } else {
514 r->start = taddr;
515 r->end = taddr + size - 1;
516 }
517 r->flags = flags;
518 r->name = dev->name;
519 return 0;
520}
521
522int of_address_to_resource(struct device_node *dev, int index,
523 struct resource *r)
524{
525 u32 *addrp;
526 u64 size;
527 unsigned int flags;
528
529 addrp = of_get_address(dev, index, &size, &flags);
530 if (addrp == NULL)
531 return -EINVAL;
532 return __of_address_to_resource(dev, addrp, size, flags, r);
533}
534EXPORT_SYMBOL_GPL(of_address_to_resource);
535
536int of_pci_address_to_resource(struct device_node *dev, int bar,
537 struct resource *r)
538{
539 u32 *addrp;
540 u64 size;
541 unsigned int flags;
542
543 addrp = of_get_pci_address(dev, bar, &size, &flags);
544 if (addrp == NULL)
545 return -EINVAL;
546 return __of_address_to_resource(dev, addrp, size, flags, r);
547}
548EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
diff --git a/arch/powerpc/kernel/ptrace-common.h b/arch/powerpc/kernel/ptrace-common.h
index b1babb729673..5ccbdbe0d5c9 100644
--- a/arch/powerpc/kernel/ptrace-common.h
+++ b/arch/powerpc/kernel/ptrace-common.h
@@ -62,7 +62,7 @@ static inline void set_single_step(struct task_struct *task)
62 struct pt_regs *regs = task->thread.regs; 62 struct pt_regs *regs = task->thread.regs;
63 if (regs != NULL) 63 if (regs != NULL)
64 regs->msr |= MSR_SE; 64 regs->msr |= MSR_SE;
65 set_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); 65 set_tsk_thread_flag(task, TIF_SINGLESTEP);
66} 66}
67 67
68static inline void clear_single_step(struct task_struct *task) 68static inline void clear_single_step(struct task_struct *task)
@@ -70,7 +70,7 @@ static inline void clear_single_step(struct task_struct *task)
70 struct pt_regs *regs = task->thread.regs; 70 struct pt_regs *regs = task->thread.regs;
71 if (regs != NULL) 71 if (regs != NULL)
72 regs->msr &= ~MSR_SE; 72 regs->msr &= ~MSR_SE;
73 clear_ti_thread_flag(task->thread_info, TIF_SINGLESTEP); 73 clear_tsk_thread_flag(task, TIF_SINGLESTEP);
74} 74}
75 75
76#ifdef CONFIG_ALTIVEC 76#ifdef CONFIG_ALTIVEC
diff --git a/arch/powerpc/kernel/ptrace32.c b/arch/powerpc/kernel/ptrace32.c
index 61762640b877..826ee3d056de 100644
--- a/arch/powerpc/kernel/ptrace32.c
+++ b/arch/powerpc/kernel/ptrace32.c
@@ -45,33 +45,19 @@ long compat_sys_ptrace(int request, int pid, unsigned long addr,
45 unsigned long data) 45 unsigned long data)
46{ 46{
47 struct task_struct *child; 47 struct task_struct *child;
48 int ret = -EPERM; 48 int ret;
49 49
50 lock_kernel(); 50 lock_kernel();
51 if (request == PTRACE_TRACEME) { 51 if (request == PTRACE_TRACEME) {
52 /* are we already being traced? */ 52 ret = ptrace_traceme();
53 if (current->ptrace & PT_PTRACED)
54 goto out;
55 ret = security_ptrace(current->parent, current);
56 if (ret)
57 goto out;
58 /* set the ptrace bit in the process flags. */
59 current->ptrace |= PT_PTRACED;
60 ret = 0;
61 goto out; 53 goto out;
62 } 54 }
63 ret = -ESRCH;
64 read_lock(&tasklist_lock);
65 child = find_task_by_pid(pid);
66 if (child)
67 get_task_struct(child);
68 read_unlock(&tasklist_lock);
69 if (!child)
70 goto out;
71 55
72 ret = -EPERM; 56 child = ptrace_get_task_struct(pid);
73 if (pid == 1) /* you may not mess with init */ 57 if (IS_ERR(child)) {
74 goto out_tsk; 58 ret = PTR_ERR(child);
59 goto out;
60 }
75 61
76 if (request == PTRACE_ATTACH) { 62 if (request == PTRACE_ATTACH) {
77 ret = ptrace_attach(child); 63 ret = ptrace_attach(child);
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index 4283fa33f784..7fe4a5c944c9 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -17,6 +17,7 @@
17#include <linux/spinlock.h> 17#include <linux/spinlock.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/capability.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
21 22
22#include <asm/prom.h> 23#include <asm/prom.h>
@@ -29,11 +30,17 @@
29#include <asm/delay.h> 30#include <asm/delay.h>
30#include <asm/uaccess.h> 31#include <asm/uaccess.h>
31#include <asm/lmb.h> 32#include <asm/lmb.h>
33#include <asm/udbg.h>
32 34
33struct rtas_t rtas = { 35struct rtas_t rtas = {
34 .lock = SPIN_LOCK_UNLOCKED 36 .lock = SPIN_LOCK_UNLOCKED
35}; 37};
36 38
39struct rtas_suspend_me_data {
40 long waiting;
41 struct rtas_args *args;
42};
43
37EXPORT_SYMBOL(rtas); 44EXPORT_SYMBOL(rtas);
38 45
39DEFINE_SPINLOCK(rtas_data_buf_lock); 46DEFINE_SPINLOCK(rtas_data_buf_lock);
@@ -52,7 +59,7 @@ EXPORT_SYMBOL(rtas_flash_term_hook);
52 * are designed only for very early low-level debugging, which 59 * are designed only for very early low-level debugging, which
53 * is why the token is hard-coded to 10. 60 * is why the token is hard-coded to 10.
54 */ 61 */
55void call_rtas_display_status(unsigned char c) 62static void call_rtas_display_status(char c)
56{ 63{
57 struct rtas_args *args = &rtas.args; 64 struct rtas_args *args = &rtas.args;
58 unsigned long s; 65 unsigned long s;
@@ -65,14 +72,14 @@ void call_rtas_display_status(unsigned char c)
65 args->nargs = 1; 72 args->nargs = 1;
66 args->nret = 1; 73 args->nret = 1;
67 args->rets = (rtas_arg_t *)&(args->args[1]); 74 args->rets = (rtas_arg_t *)&(args->args[1]);
68 args->args[0] = (int)c; 75 args->args[0] = (unsigned char)c;
69 76
70 enter_rtas(__pa(args)); 77 enter_rtas(__pa(args));
71 78
72 spin_unlock_irqrestore(&rtas.lock, s); 79 spin_unlock_irqrestore(&rtas.lock, s);
73} 80}
74 81
75void call_rtas_display_status_delay(unsigned char c) 82static void call_rtas_display_status_delay(char c)
76{ 83{
77 static int pending_newline = 0; /* did last write end with unprinted newline? */ 84 static int pending_newline = 0; /* did last write end with unprinted newline? */
78 static int width = 16; 85 static int width = 16;
@@ -96,6 +103,11 @@ void call_rtas_display_status_delay(unsigned char c)
96 } 103 }
97} 104}
98 105
106void __init udbg_init_rtas(void)
107{
108 udbg_putc = call_rtas_display_status_delay;
109}
110
99void rtas_progress(char *s, unsigned short hex) 111void rtas_progress(char *s, unsigned short hex)
100{ 112{
101 struct device_node *root; 113 struct device_node *root;
@@ -549,6 +561,80 @@ void rtas_os_term(char *str)
549 } while (status == RTAS_BUSY); 561 } while (status == RTAS_BUSY);
550} 562}
551 563
564static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE;
565#ifdef CONFIG_PPC_PSERIES
566static void rtas_percpu_suspend_me(void *info)
567{
568 long rc;
569 long flags;
570 struct rtas_suspend_me_data *data =
571 (struct rtas_suspend_me_data *)info;
572
573 /*
574 * We use "waiting" to indicate our state. As long
575 * as it is >0, we are still trying to all join up.
576 * If it goes to 0, we have successfully joined up and
577 * one thread got H_Continue. If any error happens,
578 * we set it to <0.
579 */
580 local_irq_save(flags);
581 do {
582 rc = plpar_hcall_norets(H_JOIN);
583 smp_rmb();
584 } while (rc == H_Success && data->waiting > 0);
585 if (rc == H_Success)
586 goto out;
587
588 if (rc == H_Continue) {
589 data->waiting = 0;
590 rtas_call(ibm_suspend_me_token, 0, 1,
591 data->args->args);
592 } else {
593 data->waiting = -EBUSY;
594 printk(KERN_ERR "Error on H_Join hypervisor call\n");
595 }
596
597out:
598 /* before we restore interrupts, make sure we don't
599 * generate a spurious soft lockup errors
600 */
601 touch_softlockup_watchdog();
602 local_irq_restore(flags);
603 return;
604}
605
606static int rtas_ibm_suspend_me(struct rtas_args *args)
607{
608 int i;
609
610 struct rtas_suspend_me_data data;
611
612 data.waiting = 1;
613 data.args = args;
614
615 /* Call function on all CPUs. One of us will make the
616 * rtas call
617 */
618 if (on_each_cpu(rtas_percpu_suspend_me, &data, 1, 0))
619 data.waiting = -EINVAL;
620
621 if (data.waiting != 0)
622 printk(KERN_ERR "Error doing global join\n");
623
624 /* Prod each CPU. This won't hurt, and will wake
625 * anyone we successfully put to sleep with H_Join
626 */
627 for_each_cpu(i)
628 plpar_hcall_norets(H_PROD, i);
629
630 return data.waiting;
631}
632#else /* CONFIG_PPC_PSERIES */
633static int rtas_ibm_suspend_me(struct rtas_args *args)
634{
635 return -ENOSYS;
636}
637#endif
552 638
553asmlinkage int ppc_rtas(struct rtas_args __user *uargs) 639asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
554{ 640{
@@ -556,6 +642,7 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
556 unsigned long flags; 642 unsigned long flags;
557 char *buff_copy, *errbuf = NULL; 643 char *buff_copy, *errbuf = NULL;
558 int nargs; 644 int nargs;
645 int rc;
559 646
560 if (!capable(CAP_SYS_ADMIN)) 647 if (!capable(CAP_SYS_ADMIN))
561 return -EPERM; 648 return -EPERM;
@@ -574,6 +661,17 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
574 nargs * sizeof(rtas_arg_t)) != 0) 661 nargs * sizeof(rtas_arg_t)) != 0)
575 return -EFAULT; 662 return -EFAULT;
576 663
664 if (args.token == RTAS_UNKNOWN_SERVICE)
665 return -EINVAL;
666
667 /* Need to handle ibm,suspend_me call specially */
668 if (args.token == ibm_suspend_me_token) {
669 rc = rtas_ibm_suspend_me(&args);
670 if (rc)
671 return rc;
672 goto copy_return;
673 }
674
577 buff_copy = get_errorlog_buffer(); 675 buff_copy = get_errorlog_buffer();
578 676
579 spin_lock_irqsave(&rtas.lock, flags); 677 spin_lock_irqsave(&rtas.lock, flags);
@@ -597,6 +695,7 @@ asmlinkage int ppc_rtas(struct rtas_args __user *uargs)
597 kfree(buff_copy); 695 kfree(buff_copy);
598 } 696 }
599 697
698 copy_return:
600 /* Copy out args. */ 699 /* Copy out args. */
601 if (copy_to_user(uargs->args + nargs, 700 if (copy_to_user(uargs->args + nargs,
602 args.args + nargs, 701 args.args + nargs,
@@ -632,7 +731,7 @@ void rtas_stop_self(void)
632} 731}
633 732
634/* 733/*
635 * Call early during boot, before mem init or bootmem, to retreive the RTAS 734 * Call early during boot, before mem init or bootmem, to retrieve the RTAS
636 * informations from the device-tree and allocate the RMO buffer for userland 735 * informations from the device-tree and allocate the RMO buffer for userland
637 * accesses. 736 * accesses.
638 */ 737 */
@@ -668,8 +767,10 @@ void __init rtas_initialize(void)
668 * the stop-self token if any 767 * the stop-self token if any
669 */ 768 */
670#ifdef CONFIG_PPC64 769#ifdef CONFIG_PPC64
671 if (_machine == PLATFORM_PSERIES_LPAR) 770 if (_machine == PLATFORM_PSERIES_LPAR) {
672 rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX); 771 rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX);
772 ibm_suspend_me_token = rtas_token("ibm,suspend-me");
773 }
673#endif 774#endif
674 rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region); 775 rtas_rmo_buf = lmb_alloc_base(RTAS_RMOBUF_MAX, PAGE_SIZE, rtas_region);
675 776
diff --git a/arch/powerpc/kernel/rtas_pci.c b/arch/powerpc/kernel/rtas_pci.c
index 60dec2401c26..5579f6559912 100644
--- a/arch/powerpc/kernel/rtas_pci.c
+++ b/arch/powerpc/kernel/rtas_pci.c
@@ -72,7 +72,7 @@ static int of_device_available(struct device_node * dn)
72 return 0; 72 return 0;
73} 73}
74 74
75static int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val) 75int rtas_read_config(struct pci_dn *pdn, int where, int size, u32 *val)
76{ 76{
77 int returnval = -1; 77 int returnval = -1;
78 unsigned long buid, addr; 78 unsigned long buid, addr;
@@ -188,39 +188,19 @@ int is_python(struct device_node *dev)
188 return 0; 188 return 0;
189} 189}
190 190
191static int get_phb_reg_prop(struct device_node *dev, 191static void python_countermeasures(struct device_node *dev)
192 unsigned int addr_size_words,
193 struct reg_property64 *reg)
194{ 192{
195 unsigned int *ui_ptr = NULL, len; 193 struct resource registers;
196
197 /* Found a PHB, now figure out where his registers are mapped. */
198 ui_ptr = (unsigned int *)get_property(dev, "reg", &len);
199 if (ui_ptr == NULL)
200 return 1;
201
202 if (addr_size_words == 1) {
203 reg->address = ((struct reg_property32 *)ui_ptr)->address;
204 reg->size = ((struct reg_property32 *)ui_ptr)->size;
205 } else {
206 *reg = *((struct reg_property64 *)ui_ptr);
207 }
208
209 return 0;
210}
211
212static void python_countermeasures(struct device_node *dev,
213 unsigned int addr_size_words)
214{
215 struct reg_property64 reg_struct;
216 void __iomem *chip_regs; 194 void __iomem *chip_regs;
217 volatile u32 val; 195 volatile u32 val;
218 196
219 if (get_phb_reg_prop(dev, addr_size_words, &reg_struct)) 197 if (of_address_to_resource(dev, 0, &registers)) {
198 printk(KERN_ERR "Can't get address for Python workarounds !\n");
220 return; 199 return;
200 }
221 201
222 /* Python's register file is 1 MB in size. */ 202 /* Python's register file is 1 MB in size. */
223 chip_regs = ioremap(reg_struct.address & ~(0xfffffUL), 0x100000); 203 chip_regs = ioremap(registers.start & ~(0xfffffUL), 0x100000);
224 204
225 /* 205 /*
226 * Firmware doesn't always clear this bit which is critical 206 * Firmware doesn't always clear this bit which is critical
@@ -301,11 +281,10 @@ static int phb_set_bus_ranges(struct device_node *dev,
301} 281}
302 282
303static int __devinit setup_phb(struct device_node *dev, 283static int __devinit setup_phb(struct device_node *dev,
304 struct pci_controller *phb, 284 struct pci_controller *phb)
305 unsigned int addr_size_words)
306{ 285{
307 if (is_python(dev)) 286 if (is_python(dev))
308 python_countermeasures(dev, addr_size_words); 287 python_countermeasures(dev);
309 288
310 if (phb_set_bus_ranges(dev, phb)) 289 if (phb_set_bus_ranges(dev, phb))
311 return 1; 290 return 1;
@@ -320,8 +299,8 @@ unsigned long __init find_and_init_phbs(void)
320{ 299{
321 struct device_node *node; 300 struct device_node *node;
322 struct pci_controller *phb; 301 struct pci_controller *phb;
323 unsigned int root_size_cells = 0;
324 unsigned int index; 302 unsigned int index;
303 unsigned int root_size_cells = 0;
325 unsigned int *opprop = NULL; 304 unsigned int *opprop = NULL;
326 struct device_node *root = of_find_node_by_path("/"); 305 struct device_node *root = of_find_node_by_path("/");
327 306
@@ -343,10 +322,11 @@ unsigned long __init find_and_init_phbs(void)
343 phb = pcibios_alloc_controller(node); 322 phb = pcibios_alloc_controller(node);
344 if (!phb) 323 if (!phb)
345 continue; 324 continue;
346 setup_phb(node, phb, root_size_cells); 325 setup_phb(node, phb);
347 pci_process_bridge_OF_ranges(phb, node, 0); 326 pci_process_bridge_OF_ranges(phb, node, 0);
348 pci_setup_phb_io(phb, index == 0); 327 pci_setup_phb_io(phb, index == 0);
349#ifdef CONFIG_PPC_PSERIES 328#ifdef CONFIG_PPC_PSERIES
329 /* XXX This code need serious fixing ... --BenH */
350 if (ppc64_interrupt_controller == IC_OPEN_PIC && pSeries_mpic) { 330 if (ppc64_interrupt_controller == IC_OPEN_PIC && pSeries_mpic) {
351 int addr = root_size_cells * (index + 2) - 1; 331 int addr = root_size_cells * (index + 2) - 1;
352 mpic_assign_isu(pSeries_mpic, index, opprop[addr]); 332 mpic_assign_isu(pSeries_mpic, index, opprop[addr]);
@@ -381,22 +361,17 @@ unsigned long __init find_and_init_phbs(void)
381 361
382struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn) 362struct pci_controller * __devinit init_phb_dynamic(struct device_node *dn)
383{ 363{
384 struct device_node *root = of_find_node_by_path("/");
385 unsigned int root_size_cells = 0;
386 struct pci_controller *phb; 364 struct pci_controller *phb;
387 int primary; 365 int primary;
388 366
389 root_size_cells = prom_n_size_cells(root);
390
391 primary = list_empty(&hose_list); 367 primary = list_empty(&hose_list);
392 phb = pcibios_alloc_controller(dn); 368 phb = pcibios_alloc_controller(dn);
393 if (!phb) 369 if (!phb)
394 return NULL; 370 return NULL;
395 setup_phb(dn, phb, root_size_cells); 371 setup_phb(dn, phb);
396 pci_process_bridge_OF_ranges(phb, dn, primary); 372 pci_process_bridge_OF_ranges(phb, dn, primary);
397 373
398 pci_setup_phb_io_dynamic(phb, primary); 374 pci_setup_phb_io_dynamic(phb, primary);
399 of_node_put(root);
400 375
401 pci_devs_phb_init_dynamic(phb); 376 pci_devs_phb_init_dynamic(phb);
402 scan_phb(phb); 377 scan_phb(phb);
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index bd3eb4292b53..be12041c0fc5 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -93,14 +93,15 @@ EXPORT_SYMBOL(ppc_do_canonicalize_irqs);
93/* also used by kexec */ 93/* also used by kexec */
94void machine_shutdown(void) 94void machine_shutdown(void)
95{ 95{
96 if (ppc_md.nvram_sync) 96 if (ppc_md.machine_shutdown)
97 ppc_md.nvram_sync(); 97 ppc_md.machine_shutdown();
98} 98}
99 99
100void machine_restart(char *cmd) 100void machine_restart(char *cmd)
101{ 101{
102 machine_shutdown(); 102 machine_shutdown();
103 ppc_md.restart(cmd); 103 if (ppc_md.restart)
104 ppc_md.restart(cmd);
104#ifdef CONFIG_SMP 105#ifdef CONFIG_SMP
105 smp_send_stop(); 106 smp_send_stop();
106#endif 107#endif
@@ -112,7 +113,8 @@ void machine_restart(char *cmd)
112void machine_power_off(void) 113void machine_power_off(void)
113{ 114{
114 machine_shutdown(); 115 machine_shutdown();
115 ppc_md.power_off(); 116 if (ppc_md.power_off)
117 ppc_md.power_off();
116#ifdef CONFIG_SMP 118#ifdef CONFIG_SMP
117 smp_send_stop(); 119 smp_send_stop();
118#endif 120#endif
@@ -129,7 +131,8 @@ EXPORT_SYMBOL_GPL(pm_power_off);
129void machine_halt(void) 131void machine_halt(void)
130{ 132{
131 machine_shutdown(); 133 machine_shutdown();
132 ppc_md.halt(); 134 if (ppc_md.halt)
135 ppc_md.halt();
133#ifdef CONFIG_SMP 136#ifdef CONFIG_SMP
134 smp_send_stop(); 137 smp_send_stop();
135#endif 138#endif
@@ -294,129 +297,6 @@ struct seq_operations cpuinfo_op = {
294 .show = show_cpuinfo, 297 .show = show_cpuinfo,
295}; 298};
296 299
297#ifdef CONFIG_PPC_MULTIPLATFORM
298static int __init set_preferred_console(void)
299{
300 struct device_node *prom_stdout = NULL;
301 char *name;
302 u32 *spd;
303 int offset = 0;
304
305 DBG(" -> set_preferred_console()\n");
306
307 /* The user has requested a console so this is already set up. */
308 if (strstr(saved_command_line, "console=")) {
309 DBG(" console was specified !\n");
310 return -EBUSY;
311 }
312
313 if (!of_chosen) {
314 DBG(" of_chosen is NULL !\n");
315 return -ENODEV;
316 }
317 /* We are getting a weird phandle from OF ... */
318 /* ... So use the full path instead */
319 name = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
320 if (name == NULL) {
321 DBG(" no linux,stdout-path !\n");
322 return -ENODEV;
323 }
324 prom_stdout = of_find_node_by_path(name);
325 if (!prom_stdout) {
326 DBG(" can't find stdout package %s !\n", name);
327 return -ENODEV;
328 }
329 DBG("stdout is %s\n", prom_stdout->full_name);
330
331 name = (char *)get_property(prom_stdout, "name", NULL);
332 if (!name) {
333 DBG(" stdout package has no name !\n");
334 goto not_found;
335 }
336 spd = (u32 *)get_property(prom_stdout, "current-speed", NULL);
337
338 if (0)
339 ;
340#ifdef CONFIG_SERIAL_8250_CONSOLE
341 else if (strcmp(name, "serial") == 0) {
342 int i;
343 u32 *reg = (u32 *)get_property(prom_stdout, "reg", &i);
344 if (i > 8) {
345 switch (reg[1]) {
346 case 0x3f8:
347 offset = 0;
348 break;
349 case 0x2f8:
350 offset = 1;
351 break;
352 case 0x898:
353 offset = 2;
354 break;
355 case 0x890:
356 offset = 3;
357 break;
358 default:
359 /* We dont recognise the serial port */
360 goto not_found;
361 }
362 }
363 }
364#endif /* CONFIG_SERIAL_8250_CONSOLE */
365#ifdef CONFIG_PPC_PSERIES
366 else if (strcmp(name, "vty") == 0) {
367 u32 *reg = (u32 *)get_property(prom_stdout, "reg", NULL);
368 char *compat = (char *)get_property(prom_stdout, "compatible", NULL);
369
370 if (reg && compat && (strcmp(compat, "hvterm-protocol") == 0)) {
371 /* Host Virtual Serial Interface */
372 switch (reg[0]) {
373 case 0x30000000:
374 offset = 0;
375 break;
376 case 0x30000001:
377 offset = 1;
378 break;
379 default:
380 goto not_found;
381 }
382 of_node_put(prom_stdout);
383 DBG("Found hvsi console at offset %d\n", offset);
384 return add_preferred_console("hvsi", offset, NULL);
385 } else {
386 /* pSeries LPAR virtual console */
387 of_node_put(prom_stdout);
388 DBG("Found hvc console\n");
389 return add_preferred_console("hvc", 0, NULL);
390 }
391 }
392#endif /* CONFIG_PPC_PSERIES */
393#ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
394 else if (strcmp(name, "ch-a") == 0)
395 offset = 0;
396 else if (strcmp(name, "ch-b") == 0)
397 offset = 1;
398#endif /* CONFIG_SERIAL_PMACZILOG_CONSOLE */
399 else
400 goto not_found;
401 of_node_put(prom_stdout);
402
403 DBG("Found serial console at ttyS%d\n", offset);
404
405 if (spd) {
406 static char __initdata opt[16];
407 sprintf(opt, "%d", *spd);
408 return add_preferred_console("ttyS", offset, opt);
409 } else
410 return add_preferred_console("ttyS", offset, NULL);
411
412 not_found:
413 DBG("No preferred console found !\n");
414 of_node_put(prom_stdout);
415 return -ENODEV;
416}
417console_initcall(set_preferred_console);
418#endif /* CONFIG_PPC_MULTIPLATFORM */
419
420void __init check_for_initrd(void) 300void __init check_for_initrd(void)
421{ 301{
422#ifdef CONFIG_BLK_DEV_INITRD 302#ifdef CONFIG_BLK_DEV_INITRD
@@ -442,7 +322,7 @@ void __init check_for_initrd(void)
442 /* If we were passed an initrd, set the ROOT_DEV properly if the values 322 /* If we were passed an initrd, set the ROOT_DEV properly if the values
443 * look sensible. If not, clear initrd reference. 323 * look sensible. If not, clear initrd reference.
444 */ 324 */
445 if (initrd_start >= KERNELBASE && initrd_end >= KERNELBASE && 325 if (is_kernel_addr(initrd_start) && is_kernel_addr(initrd_end) &&
446 initrd_end > initrd_start) 326 initrd_end > initrd_start)
447 ROOT_DEV = Root_RAM0; 327 ROOT_DEV = Root_RAM0;
448 else 328 else
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index e5694335bf10..db72a92943bf 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -39,6 +39,8 @@
39#include <asm/nvram.h> 39#include <asm/nvram.h>
40#include <asm/xmon.h> 40#include <asm/xmon.h>
41#include <asm/time.h> 41#include <asm/time.h>
42#include <asm/serial.h>
43#include <asm/udbg.h>
42 44
43#include "setup.h" 45#include "setup.h"
44 46
@@ -172,12 +174,23 @@ void __init platform_init(void)
172 */ 174 */
173void __init machine_init(unsigned long dt_ptr, unsigned long phys) 175void __init machine_init(unsigned long dt_ptr, unsigned long phys)
174{ 176{
177 /* If btext is enabled, we might have a BAT setup for early display,
178 * thus we do enable some very basic udbg output
179 */
180#ifdef CONFIG_BOOTX_TEXT
181 udbg_putc = btext_drawchar;
182#endif
183
184 /* Do some early initialization based on the flat device tree */
175 early_init_devtree(__va(dt_ptr)); 185 early_init_devtree(__va(dt_ptr));
176 186
187 /* Check default command line */
177#ifdef CONFIG_CMDLINE 188#ifdef CONFIG_CMDLINE
178 strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line)); 189 if (cmd_line[0] == 0)
190 strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
179#endif /* CONFIG_CMDLINE */ 191#endif /* CONFIG_CMDLINE */
180 192
193 /* Base init based on machine type */
181 platform_init(); 194 platform_init();
182 195
183#ifdef CONFIG_6xx 196#ifdef CONFIG_6xx
@@ -282,25 +295,20 @@ void __init setup_arch(char **cmdline_p)
282 295
283 unflatten_device_tree(); 296 unflatten_device_tree();
284 check_for_initrd(); 297 check_for_initrd();
285 finish_device_tree();
286 298
287 smp_setup_cpu_maps(); 299 if (ppc_md.init_early)
300 ppc_md.init_early();
288 301
289#ifdef CONFIG_BOOTX_TEXT 302 find_legacy_serial_ports();
290 init_boot_display(); 303 finish_device_tree();
291#endif
292 304
293#ifdef CONFIG_PPC_PMAC 305 smp_setup_cpu_maps();
294 /* This could be called "early setup arch", it must be done
295 * now because xmon need it
296 */
297 if (_machine == _MACH_Pmac)
298 pmac_feature_init(); /* New cool way */
299#endif
300 306
301#ifdef CONFIG_XMON_DEFAULT 307#ifdef CONFIG_XMON_DEFAULT
302 xmon_init(1); 308 xmon_init(1);
303#endif 309#endif
310 /* Register early console */
311 register_early_udbg_console();
304 312
305#if defined(CONFIG_KGDB) 313#if defined(CONFIG_KGDB)
306 if (ppc_md.kgdb_map_scc) 314 if (ppc_md.kgdb_map_scc)
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 608fee7c7e20..e29b275e09e0 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -33,7 +33,9 @@
33#include <linux/unistd.h> 33#include <linux/unistd.h>
34#include <linux/serial.h> 34#include <linux/serial.h>
35#include <linux/serial_8250.h> 35#include <linux/serial_8250.h>
36#include <linux/bootmem.h>
36#include <asm/io.h> 37#include <asm/io.h>
38#include <asm/kdump.h>
37#include <asm/prom.h> 39#include <asm/prom.h>
38#include <asm/processor.h> 40#include <asm/processor.h>
39#include <asm/pgtable.h> 41#include <asm/pgtable.h>
@@ -69,40 +71,21 @@
69#define DBG(fmt...) 71#define DBG(fmt...)
70#endif 72#endif
71 73
72/*
73 * Here are some early debugging facilities. You can enable one
74 * but your kernel will not boot on anything else if you do so
75 */
76
77/* This one is for use on LPAR machines that support an HVC console
78 * on vterm 0
79 */
80extern void udbg_init_debug_lpar(void);
81/* This one is for use on Apple G5 machines
82 */
83extern void udbg_init_pmac_realmode(void);
84/* That's RTAS panel debug */
85extern void call_rtas_display_status_delay(unsigned char c);
86/* Here's maple real mode debug */
87extern void udbg_init_maple_realmode(void);
88
89#define EARLY_DEBUG_INIT() do {} while(0)
90
91#if 0
92#define EARLY_DEBUG_INIT() udbg_init_debug_lpar()
93#define EARLY_DEBUG_INIT() udbg_init_maple_realmode()
94#define EARLY_DEBUG_INIT() udbg_init_pmac_realmode()
95#define EARLY_DEBUG_INIT() \
96 do { udbg_putc = call_rtas_display_status_delay; } while(0)
97#endif
98
99int have_of = 1; 74int have_of = 1;
100int boot_cpuid = 0; 75int boot_cpuid = 0;
101int boot_cpuid_phys = 0; 76int boot_cpuid_phys = 0;
102dev_t boot_dev; 77dev_t boot_dev;
103u64 ppc64_pft_size; 78u64 ppc64_pft_size;
104 79
105struct ppc64_caches ppc64_caches; 80/* Pick defaults since we might want to patch instructions
81 * before we've read this from the device tree.
82 */
83struct ppc64_caches ppc64_caches = {
84 .dline_size = 0x80,
85 .log_dline_size = 7,
86 .iline_size = 0x80,
87 .log_iline_size = 7
88};
106EXPORT_SYMBOL_GPL(ppc64_caches); 89EXPORT_SYMBOL_GPL(ppc64_caches);
107 90
108/* 91/*
@@ -228,11 +211,8 @@ void __init early_setup(unsigned long dt_ptr)
228 struct paca_struct *lpaca = get_paca(); 211 struct paca_struct *lpaca = get_paca();
229 static struct machdep_calls **mach; 212 static struct machdep_calls **mach;
230 213
231 /* 214 /* Enable early debugging if any specified (see udbg.h) */
232 * Enable early debugging if any specified (see top of 215 udbg_early_init();
233 * this file)
234 */
235 EARLY_DEBUG_INIT();
236 216
237 DBG(" -> early_setup()\n"); 217 DBG(" -> early_setup()\n");
238 218
@@ -260,6 +240,10 @@ void __init early_setup(unsigned long dt_ptr)
260 } 240 }
261 ppc_md = **mach; 241 ppc_md = **mach;
262 242
243#ifdef CONFIG_CRASH_DUMP
244 kdump_setup();
245#endif
246
263 DBG("Found, Initializing memory management...\n"); 247 DBG("Found, Initializing memory management...\n");
264 248
265 /* 249 /*
@@ -309,6 +293,7 @@ void early_setup_secondary(void)
309void smp_release_cpus(void) 293void smp_release_cpus(void)
310{ 294{
311 extern unsigned long __secondary_hold_spinloop; 295 extern unsigned long __secondary_hold_spinloop;
296 unsigned long *ptr;
312 297
313 DBG(" -> smp_release_cpus()\n"); 298 DBG(" -> smp_release_cpus()\n");
314 299
@@ -319,7 +304,9 @@ void smp_release_cpus(void)
319 * This is useless but harmless on iSeries, secondaries are already 304 * This is useless but harmless on iSeries, secondaries are already
320 * waiting on their paca spinloops. */ 305 * waiting on their paca spinloops. */
321 306
322 __secondary_hold_spinloop = 1; 307 ptr = (unsigned long *)((unsigned long)&__secondary_hold_spinloop
308 - PHYSICAL_START);
309 *ptr = 1;
323 mb(); 310 mb();
324 311
325 DBG(" <- smp_release_cpus()\n"); 312 DBG(" <- smp_release_cpus()\n");
@@ -422,7 +409,7 @@ void __init setup_system(void)
422 409
423 /* 410 /*
424 * Fill the ppc64_caches & systemcfg structures with informations 411 * Fill the ppc64_caches & systemcfg structures with informations
425 * retreived from the device-tree. Need to be called before 412 * retrieved from the device-tree. Need to be called before
426 * finish_device_tree() since the later requires some of the 413 * finish_device_tree() since the later requires some of the
427 * informations filled up here to properly parse the interrupt 414 * informations filled up here to properly parse the interrupt
428 * tree. 415 * tree.
@@ -451,16 +438,19 @@ void __init setup_system(void)
451 */ 438 */
452 ppc_md.init_early(); 439 ppc_md.init_early();
453 440
441 /*
442 * We can discover serial ports now since the above did setup the
443 * hash table management for us, thus ioremap works. We do that early
444 * so that further code can be debugged
445 */
446 find_legacy_serial_ports();
447
454 /* 448 /*
455 * "Finish" the device-tree, that is do the actual parsing of 449 * "Finish" the device-tree, that is do the actual parsing of
456 * some of the properties like the interrupt map 450 * some of the properties like the interrupt map
457 */ 451 */
458 finish_device_tree(); 452 finish_device_tree();
459 453
460#ifdef CONFIG_BOOTX_TEXT
461 init_boot_display();
462#endif
463
464 /* 454 /*
465 * Initialize xmon 455 * Initialize xmon
466 */ 456 */
@@ -499,6 +489,9 @@ void __init setup_system(void)
499 ppc64_caches.iline_size); 489 ppc64_caches.iline_size);
500 printk("htab_address = 0x%p\n", htab_address); 490 printk("htab_address = 0x%p\n", htab_address);
501 printk("htab_hash_mask = 0x%lx\n", htab_hash_mask); 491 printk("htab_hash_mask = 0x%lx\n", htab_hash_mask);
492#if PHYSICAL_START > 0
493 printk("physical_start = 0x%x\n", PHYSICAL_START);
494#endif
502 printk("-----------------------------------------------------\n"); 495 printk("-----------------------------------------------------\n");
503 496
504 mm_init_ppc64(); 497 mm_init_ppc64();
@@ -649,187 +642,6 @@ void ppc64_terminate_msg(unsigned int src, const char *msg)
649 printk("[terminate]%04x %s\n", src, msg); 642 printk("[terminate]%04x %s\n", src, msg);
650} 643}
651 644
652#ifndef CONFIG_PPC_ISERIES
653/*
654 * This function can be used by platforms to "find" legacy serial ports.
655 * It works for "serial" nodes under an "isa" node, and will try to
656 * respect the "ibm,aix-loc" property if any. It works with up to 8
657 * ports.
658 */
659
660#define MAX_LEGACY_SERIAL_PORTS 8
661static struct plat_serial8250_port serial_ports[MAX_LEGACY_SERIAL_PORTS+1];
662static unsigned int old_serial_count;
663
664void __init generic_find_legacy_serial_ports(u64 *physport,
665 unsigned int *default_speed)
666{
667 struct device_node *np;
668 u32 *sizeprop;
669
670 struct isa_reg_property {
671 u32 space;
672 u32 address;
673 u32 size;
674 };
675 struct pci_reg_property {
676 struct pci_address addr;
677 u32 size_hi;
678 u32 size_lo;
679 };
680
681 DBG(" -> generic_find_legacy_serial_port()\n");
682
683 *physport = 0;
684 if (default_speed)
685 *default_speed = 0;
686
687 np = of_find_node_by_path("/");
688 if (!np)
689 return;
690
691 /* First fill our array */
692 for (np = NULL; (np = of_find_node_by_type(np, "serial"));) {
693 struct device_node *isa, *pci;
694 struct isa_reg_property *reg;
695 unsigned long phys_size, addr_size, io_base;
696 u32 *rangesp;
697 u32 *interrupts, *clk, *spd;
698 char *typep;
699 int index, rlen, rentsize;
700
701 /* Ok, first check if it's under an "isa" parent */
702 isa = of_get_parent(np);
703 if (!isa || strcmp(isa->name, "isa")) {
704 DBG("%s: no isa parent found\n", np->full_name);
705 continue;
706 }
707
708 /* Now look for an "ibm,aix-loc" property that gives us ordering
709 * if any...
710 */
711 typep = (char *)get_property(np, "ibm,aix-loc", NULL);
712
713 /* Get the ISA port number */
714 reg = (struct isa_reg_property *)get_property(np, "reg", NULL);
715 if (reg == NULL)
716 goto next_port;
717 /* We assume the interrupt number isn't translated ... */
718 interrupts = (u32 *)get_property(np, "interrupts", NULL);
719 /* get clock freq. if present */
720 clk = (u32 *)get_property(np, "clock-frequency", NULL);
721 /* get default speed if present */
722 spd = (u32 *)get_property(np, "current-speed", NULL);
723 /* Default to locate at end of array */
724 index = old_serial_count; /* end of the array by default */
725
726 /* If we have a location index, then use it */
727 if (typep && *typep == 'S') {
728 index = simple_strtol(typep+1, NULL, 0) - 1;
729 /* if index is out of range, use end of array instead */
730 if (index >= MAX_LEGACY_SERIAL_PORTS)
731 index = old_serial_count;
732 /* if our index is still out of range, that mean that
733 * array is full, we could scan for a free slot but that
734 * make little sense to bother, just skip the port
735 */
736 if (index >= MAX_LEGACY_SERIAL_PORTS)
737 goto next_port;
738 if (index >= old_serial_count)
739 old_serial_count = index + 1;
740 /* Check if there is a port who already claimed our slot */
741 if (serial_ports[index].iobase != 0) {
742 /* if we still have some room, move it, else override */
743 if (old_serial_count < MAX_LEGACY_SERIAL_PORTS) {
744 DBG("Moved legacy port %d -> %d\n", index,
745 old_serial_count);
746 serial_ports[old_serial_count++] =
747 serial_ports[index];
748 } else {
749 DBG("Replacing legacy port %d\n", index);
750 }
751 }
752 }
753 if (index >= MAX_LEGACY_SERIAL_PORTS)
754 goto next_port;
755 if (index >= old_serial_count)
756 old_serial_count = index + 1;
757
758 /* Now fill the entry */
759 memset(&serial_ports[index], 0, sizeof(struct plat_serial8250_port));
760 serial_ports[index].uartclk = clk ? *clk : BASE_BAUD * 16;
761 serial_ports[index].iobase = reg->address;
762 serial_ports[index].irq = interrupts ? interrupts[0] : 0;
763 serial_ports[index].flags = ASYNC_BOOT_AUTOCONF;
764
765 DBG("Added legacy port, index: %d, port: %x, irq: %d, clk: %d\n",
766 index,
767 serial_ports[index].iobase,
768 serial_ports[index].irq,
769 serial_ports[index].uartclk);
770
771 /* Get phys address of IO reg for port 1 */
772 if (index != 0)
773 goto next_port;
774
775 pci = of_get_parent(isa);
776 if (!pci) {
777 DBG("%s: no pci parent found\n", np->full_name);
778 goto next_port;
779 }
780
781 rangesp = (u32 *)get_property(pci, "ranges", &rlen);
782 if (rangesp == NULL) {
783 of_node_put(pci);
784 goto next_port;
785 }
786 rlen /= 4;
787
788 /* we need the #size-cells of the PCI bridge node itself */
789 phys_size = 1;
790 sizeprop = (u32 *)get_property(pci, "#size-cells", NULL);
791 if (sizeprop != NULL)
792 phys_size = *sizeprop;
793 /* we need the parent #addr-cells */
794 addr_size = prom_n_addr_cells(pci);
795 rentsize = 3 + addr_size + phys_size;
796 io_base = 0;
797 for (;rlen >= rentsize; rlen -= rentsize,rangesp += rentsize) {
798 if (((rangesp[0] >> 24) & 0x3) != 1)
799 continue; /* not IO space */
800 io_base = rangesp[3];
801 if (addr_size == 2)
802 io_base = (io_base << 32) | rangesp[4];
803 }
804 if (io_base != 0) {
805 *physport = io_base + reg->address;
806 if (default_speed && spd)
807 *default_speed = *spd;
808 }
809 of_node_put(pci);
810 next_port:
811 of_node_put(isa);
812 }
813
814 DBG(" <- generic_find_legacy_serial_port()\n");
815}
816
817static struct platform_device serial_device = {
818 .name = "serial8250",
819 .id = PLAT8250_DEV_PLATFORM,
820 .dev = {
821 .platform_data = serial_ports,
822 },
823};
824
825static int __init serial_dev_init(void)
826{
827 return platform_device_register(&serial_device);
828}
829arch_initcall(serial_dev_init);
830
831#endif /* CONFIG_PPC_ISERIES */
832
833int check_legacy_ioport(unsigned long base_port) 645int check_legacy_ioport(unsigned long base_port)
834{ 646{
835 if (ppc_md.check_legacy_ioport == NULL) 647 if (ppc_md.check_legacy_ioport == NULL)
@@ -843,3 +655,28 @@ void cpu_die(void)
843 if (ppc_md.cpu_die) 655 if (ppc_md.cpu_die)
844 ppc_md.cpu_die(); 656 ppc_md.cpu_die();
845} 657}
658
659#ifdef CONFIG_SMP
660void __init setup_per_cpu_areas(void)
661{
662 int i;
663 unsigned long size;
664 char *ptr;
665
666 /* Copy section for each CPU (we discard the original) */
667 size = ALIGN(__per_cpu_end - __per_cpu_start, SMP_CACHE_BYTES);
668#ifdef CONFIG_MODULES
669 if (size < PERCPU_ENOUGH_ROOM)
670 size = PERCPU_ENOUGH_ROOM;
671#endif
672
673 for_each_cpu(i) {
674 ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size);
675 if (!ptr)
676 panic("Cannot allocate cpu data for CPU %d\n", i);
677
678 paca[i].data_offset = ptr - __per_cpu_start;
679 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
680 }
681}
682#endif
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 5a2eba60dd39..3747ab0dac3f 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -76,7 +76,6 @@
76 * registers from *regs. This is what we need 76 * registers from *regs. This is what we need
77 * to do when a signal has been delivered. 77 * to do when a signal has been delivered.
78 */ 78 */
79#define sigreturn_exit(regs) return 0
80 79
81#define GP_REGS_SIZE min(sizeof(elf_gregset_t32), sizeof(struct pt_regs32)) 80#define GP_REGS_SIZE min(sizeof(elf_gregset_t32), sizeof(struct pt_regs32))
82#undef __SIGNAL_FRAMESIZE 81#undef __SIGNAL_FRAMESIZE
@@ -156,9 +155,17 @@ static inline int save_general_regs(struct pt_regs *regs,
156 elf_greg_t64 *gregs = (elf_greg_t64 *)regs; 155 elf_greg_t64 *gregs = (elf_greg_t64 *)regs;
157 int i; 156 int i;
158 157
159 for (i = 0; i <= PT_RESULT; i ++) 158 if (!FULL_REGS(regs)) {
159 set_thread_flag(TIF_SAVE_NVGPRS);
160 current_thread_info()->nvgprs_frame = frame->mc_gregs;
161 }
162
163 for (i = 0; i <= PT_RESULT; i ++) {
164 if (i == 14 && !FULL_REGS(regs))
165 i = 32;
160 if (__put_user((unsigned int)gregs[i], &frame->mc_gregs[i])) 166 if (__put_user((unsigned int)gregs[i], &frame->mc_gregs[i]))
161 return -EFAULT; 167 return -EFAULT;
168 }
162 return 0; 169 return 0;
163} 170}
164 171
@@ -179,8 +186,6 @@ static inline int restore_general_regs(struct pt_regs *regs,
179 186
180#else /* CONFIG_PPC64 */ 187#else /* CONFIG_PPC64 */
181 188
182extern void sigreturn_exit(struct pt_regs *);
183
184#define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs)) 189#define GP_REGS_SIZE min(sizeof(elf_gregset_t), sizeof(struct pt_regs))
185 190
186static inline int put_sigset_t(sigset_t __user *uset, sigset_t *set) 191static inline int put_sigset_t(sigset_t __user *uset, sigset_t *set)
@@ -214,6 +219,15 @@ static inline int get_old_sigaction(struct k_sigaction *new_ka,
214static inline int save_general_regs(struct pt_regs *regs, 219static inline int save_general_regs(struct pt_regs *regs,
215 struct mcontext __user *frame) 220 struct mcontext __user *frame)
216{ 221{
222 if (!FULL_REGS(regs)) {
223 /* Zero out the unsaved GPRs to avoid information
224 leak, and set TIF_SAVE_NVGPRS to ensure that the
225 registers do actually get saved later. */
226 memset(&regs->gpr[14], 0, 18 * sizeof(unsigned long));
227 current_thread_info()->nvgprs_frame = &frame->mc_gregs;
228 set_thread_flag(TIF_SAVE_NVGPRS);
229 }
230
217 return __copy_to_user(&frame->mc_gregs, regs, GP_REGS_SIZE); 231 return __copy_to_user(&frame->mc_gregs, regs, GP_REGS_SIZE);
218} 232}
219 233
@@ -238,8 +252,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs);
238/* 252/*
239 * Atomically swap in the new signal mask, and wait for a signal. 253 * Atomically swap in the new signal mask, and wait for a signal.
240 */ 254 */
241long sys_sigsuspend(old_sigset_t mask, int p2, int p3, int p4, int p6, int p7, 255long sys_sigsuspend(old_sigset_t mask)
242 struct pt_regs *regs)
243{ 256{
244 sigset_t saveset; 257 sigset_t saveset;
245 258
@@ -250,51 +263,10 @@ long sys_sigsuspend(old_sigset_t mask, int p2, int p3, int p4, int p6, int p7,
250 recalc_sigpending(); 263 recalc_sigpending();
251 spin_unlock_irq(&current->sighand->siglock); 264 spin_unlock_irq(&current->sighand->siglock);
252 265
253 regs->result = -EINTR; 266 current->state = TASK_INTERRUPTIBLE;
254 regs->gpr[3] = EINTR; 267 schedule();
255 regs->ccr |= 0x10000000; 268 set_thread_flag(TIF_RESTORE_SIGMASK);
256 while (1) { 269 return -ERESTARTNOHAND;
257 current->state = TASK_INTERRUPTIBLE;
258 schedule();
259 if (do_signal(&saveset, regs))
260 sigreturn_exit(regs);
261 }
262}
263
264long sys_rt_sigsuspend(
265#ifdef CONFIG_PPC64
266 compat_sigset_t __user *unewset,
267#else
268 sigset_t __user *unewset,
269#endif
270 size_t sigsetsize, int p3, int p4,
271 int p6, int p7, struct pt_regs *regs)
272{
273 sigset_t saveset, newset;
274
275 /* XXX: Don't preclude handling different sized sigset_t's. */
276 if (sigsetsize != sizeof(sigset_t))
277 return -EINVAL;
278
279 if (get_sigset_t(&newset, unewset))
280 return -EFAULT;
281 sigdelsetmask(&newset, ~_BLOCKABLE);
282
283 spin_lock_irq(&current->sighand->siglock);
284 saveset = current->blocked;
285 current->blocked = newset;
286 recalc_sigpending();
287 spin_unlock_irq(&current->sighand->siglock);
288
289 regs->result = -EINTR;
290 regs->gpr[3] = EINTR;
291 regs->ccr |= 0x10000000;
292 while (1) {
293 current->state = TASK_INTERRUPTIBLE;
294 schedule();
295 if (do_signal(&saveset, regs))
296 sigreturn_exit(regs);
297 }
298} 270}
299 271
300#ifdef CONFIG_PPC32 272#ifdef CONFIG_PPC32
@@ -391,9 +363,6 @@ struct rt_sigframe {
391static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame, 363static int save_user_regs(struct pt_regs *regs, struct mcontext __user *frame,
392 int sigret) 364 int sigret)
393{ 365{
394#ifdef CONFIG_PPC32
395 CHECK_FULL_REGS(regs);
396#endif
397 /* Make sure floating point registers are stored in regs */ 366 /* Make sure floating point registers are stored in regs */
398 flush_fp_to_thread(current); 367 flush_fp_to_thread(current);
399 368
@@ -482,6 +451,15 @@ static long restore_user_regs(struct pt_regs *regs,
482 if (err) 451 if (err)
483 return 1; 452 return 1;
484 453
454 /*
455 * Do this before updating the thread state in
456 * current->thread.fpr/vr/evr. That way, if we get preempted
457 * and another task grabs the FPU/Altivec/SPE, it won't be
458 * tempted to save the current CPU state into the thread_struct
459 * and corrupt what we are writing there.
460 */
461 discard_lazy_cpu_state();
462
485 /* force the process to reload the FP registers from 463 /* force the process to reload the FP registers from
486 current->thread when it next does FP instructions */ 464 current->thread when it next does FP instructions */
487 regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1); 465 regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1);
@@ -523,18 +501,6 @@ static long restore_user_regs(struct pt_regs *regs,
523 return 1; 501 return 1;
524#endif /* CONFIG_SPE */ 502#endif /* CONFIG_SPE */
525 503
526#ifndef CONFIG_SMP
527 preempt_disable();
528 if (last_task_used_math == current)
529 last_task_used_math = NULL;
530 if (last_task_used_altivec == current)
531 last_task_used_altivec = NULL;
532#ifdef CONFIG_SPE
533 if (last_task_used_spe == current)
534 last_task_used_spe = NULL;
535#endif
536 preempt_enable();
537#endif
538 return 0; 504 return 0;
539} 505}
540 506
@@ -828,12 +794,6 @@ static int handle_rt_signal(unsigned long sig, struct k_sigaction *ka,
828 regs->gpr[6] = (unsigned long) rt_sf; 794 regs->gpr[6] = (unsigned long) rt_sf;
829 regs->nip = (unsigned long) ka->sa.sa_handler; 795 regs->nip = (unsigned long) ka->sa.sa_handler;
830 regs->trap = 0; 796 regs->trap = 0;
831#ifdef CONFIG_PPC64
832 regs->result = 0;
833
834 if (test_thread_flag(TIF_SINGLESTEP))
835 ptrace_notify(SIGTRAP);
836#endif
837 return 1; 797 return 1;
838 798
839badframe: 799badframe:
@@ -911,8 +871,8 @@ long sys_swapcontext(struct ucontext __user *old_ctx,
911 */ 871 */
912 if (do_setcontext(new_ctx, regs, 0)) 872 if (do_setcontext(new_ctx, regs, 0))
913 do_exit(SIGSEGV); 873 do_exit(SIGSEGV);
914 sigreturn_exit(regs); 874
915 /* doesn't actually return back to here */ 875 set_thread_flag(TIF_RESTOREALL);
916 return 0; 876 return 0;
917} 877}
918 878
@@ -945,12 +905,11 @@ long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
945 * nobody does any... 905 * nobody does any...
946 */ 906 */
947 compat_sys_sigaltstack((u32)(u64)&rt_sf->uc.uc_stack, 0, 0, 0, 0, 0, regs); 907 compat_sys_sigaltstack((u32)(u64)&rt_sf->uc.uc_stack, 0, 0, 0, 0, 0, regs);
948 return (int)regs->result;
949#else 908#else
950 do_sigaltstack(&rt_sf->uc.uc_stack, NULL, regs->gpr[1]); 909 do_sigaltstack(&rt_sf->uc.uc_stack, NULL, regs->gpr[1]);
951 sigreturn_exit(regs); /* doesn't return here */
952 return 0;
953#endif 910#endif
911 set_thread_flag(TIF_RESTOREALL);
912 return 0;
954 913
955 bad: 914 bad:
956 force_sig(SIGSEGV, current); 915 force_sig(SIGSEGV, current);
@@ -1041,9 +1000,7 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
1041 */ 1000 */
1042 do_sigaltstack(&ctx->uc_stack, NULL, regs->gpr[1]); 1001 do_sigaltstack(&ctx->uc_stack, NULL, regs->gpr[1]);
1043 1002
1044 sigreturn_exit(regs); 1003 set_thread_flag(TIF_RESTOREALL);
1045 /* doesn't actually return back to here */
1046
1047 out: 1004 out:
1048 return 0; 1005 return 0;
1049} 1006}
@@ -1107,12 +1064,6 @@ static int handle_signal(unsigned long sig, struct k_sigaction *ka,
1107 regs->gpr[4] = (unsigned long) sc; 1064 regs->gpr[4] = (unsigned long) sc;
1108 regs->nip = (unsigned long) ka->sa.sa_handler; 1065 regs->nip = (unsigned long) ka->sa.sa_handler;
1109 regs->trap = 0; 1066 regs->trap = 0;
1110#ifdef CONFIG_PPC64
1111 regs->result = 0;
1112
1113 if (test_thread_flag(TIF_SINGLESTEP))
1114 ptrace_notify(SIGTRAP);
1115#endif
1116 1067
1117 return 1; 1068 return 1;
1118 1069
@@ -1160,12 +1111,8 @@ long sys_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8,
1160 || restore_user_regs(regs, sr, 1)) 1111 || restore_user_regs(regs, sr, 1))
1161 goto badframe; 1112 goto badframe;
1162 1113
1163#ifdef CONFIG_PPC64 1114 set_thread_flag(TIF_RESTOREALL);
1164 return (int)regs->result;
1165#else
1166 sigreturn_exit(regs); /* doesn't return */
1167 return 0; 1115 return 0;
1168#endif
1169 1116
1170badframe: 1117badframe:
1171 force_sig(SIGSEGV, current); 1118 force_sig(SIGSEGV, current);
@@ -1181,7 +1128,7 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
1181{ 1128{
1182 siginfo_t info; 1129 siginfo_t info;
1183 struct k_sigaction ka; 1130 struct k_sigaction ka;
1184 unsigned int frame, newsp; 1131 unsigned int newsp;
1185 int signr, ret; 1132 int signr, ret;
1186 1133
1187#ifdef CONFIG_PPC32 1134#ifdef CONFIG_PPC32
@@ -1192,11 +1139,11 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
1192 } 1139 }
1193#endif 1140#endif
1194 1141
1195 if (!oldset) 1142 if (test_thread_flag(TIF_RESTORE_SIGMASK))
1143 oldset = &current->saved_sigmask;
1144 else if (!oldset)
1196 oldset = &current->blocked; 1145 oldset = &current->blocked;
1197 1146
1198 newsp = frame = 0;
1199
1200 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 1147 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
1201#ifdef CONFIG_PPC32 1148#ifdef CONFIG_PPC32
1202no_signal: 1149no_signal:
@@ -1226,8 +1173,14 @@ no_signal:
1226 } 1173 }
1227 } 1174 }
1228 1175
1229 if (signr == 0) 1176 if (signr == 0) {
1177 /* No signal to deliver -- put the saved sigmask back */
1178 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
1179 clear_thread_flag(TIF_RESTORE_SIGMASK);
1180 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
1181 }
1230 return 0; /* no signals delivered */ 1182 return 0; /* no signals delivered */
1183 }
1231 1184
1232 if ((ka.sa.sa_flags & SA_ONSTACK) && current->sas_ss_size 1185 if ((ka.sa.sa_flags & SA_ONSTACK) && current->sas_ss_size
1233 && !on_sig_stack(regs->gpr[1])) 1186 && !on_sig_stack(regs->gpr[1]))
@@ -1260,6 +1213,10 @@ no_signal:
1260 sigaddset(&current->blocked, signr); 1213 sigaddset(&current->blocked, signr);
1261 recalc_sigpending(); 1214 recalc_sigpending();
1262 spin_unlock_irq(&current->sighand->siglock); 1215 spin_unlock_irq(&current->sighand->siglock);
1216 /* A signal was successfully delivered; the saved sigmask is in
1217 its frame, and we can clear the TIF_RESTORE_SIGMASK flag */
1218 if (test_thread_flag(TIF_RESTORE_SIGMASK))
1219 clear_thread_flag(TIF_RESTORE_SIGMASK);
1263 } 1220 }
1264 1221
1265 return ret; 1222 return ret;
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 1decf2785530..b3193116e686 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -67,40 +67,6 @@ struct rt_sigframe {
67 char abigap[288]; 67 char abigap[288];
68} __attribute__ ((aligned (16))); 68} __attribute__ ((aligned (16)));
69 69
70
71/*
72 * Atomically swap in the new signal mask, and wait for a signal.
73 */
74long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize, int p3, int p4,
75 int p6, int p7, struct pt_regs *regs)
76{
77 sigset_t saveset, newset;
78
79 /* XXX: Don't preclude handling different sized sigset_t's. */
80 if (sigsetsize != sizeof(sigset_t))
81 return -EINVAL;
82
83 if (copy_from_user(&newset, unewset, sizeof(newset)))
84 return -EFAULT;
85 sigdelsetmask(&newset, ~_BLOCKABLE);
86
87 spin_lock_irq(&current->sighand->siglock);
88 saveset = current->blocked;
89 current->blocked = newset;
90 recalc_sigpending();
91 spin_unlock_irq(&current->sighand->siglock);
92
93 regs->result = -EINTR;
94 regs->gpr[3] = EINTR;
95 regs->ccr |= 0x10000000;
96 while (1) {
97 current->state = TASK_INTERRUPTIBLE;
98 schedule();
99 if (do_signal(&saveset, regs))
100 return 0;
101 }
102}
103
104long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, unsigned long r5, 70long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss, unsigned long r5,
105 unsigned long r6, unsigned long r7, unsigned long r8, 71 unsigned long r6, unsigned long r7, unsigned long r8,
106 struct pt_regs *regs) 72 struct pt_regs *regs)
@@ -152,6 +118,14 @@ static long setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
152 err |= __put_user(0, &sc->v_regs); 118 err |= __put_user(0, &sc->v_regs);
153#endif /* CONFIG_ALTIVEC */ 119#endif /* CONFIG_ALTIVEC */
154 err |= __put_user(&sc->gp_regs, &sc->regs); 120 err |= __put_user(&sc->gp_regs, &sc->regs);
121 if (!FULL_REGS(regs)) {
122 /* Zero out the unsaved GPRs to avoid information
123 leak, and set TIF_SAVE_NVGPRS to ensure that the
124 registers do actually get saved later. */
125 memset(&regs->gpr[14], 0, 18 * sizeof(unsigned long));
126 set_thread_flag(TIF_SAVE_NVGPRS);
127 current_thread_info()->nvgprs_frame = &sc->gp_regs;
128 }
155 err |= __copy_to_user(&sc->gp_regs, regs, GP_REGS_SIZE); 129 err |= __copy_to_user(&sc->gp_regs, regs, GP_REGS_SIZE);
156 err |= __copy_to_user(&sc->fp_regs, &current->thread.fpr, FP_REGS_SIZE); 130 err |= __copy_to_user(&sc->fp_regs, &current->thread.fpr, FP_REGS_SIZE);
157 err |= __put_user(signr, &sc->signal); 131 err |= __put_user(signr, &sc->signal);
@@ -197,10 +171,20 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
197 171
198 if (!sig) 172 if (!sig)
199 regs->gpr[13] = save_r13; 173 regs->gpr[13] = save_r13;
200 err |= __copy_from_user(&current->thread.fpr, &sc->fp_regs, FP_REGS_SIZE);
201 if (set != NULL) 174 if (set != NULL)
202 err |= __get_user(set->sig[0], &sc->oldmask); 175 err |= __get_user(set->sig[0], &sc->oldmask);
203 176
177 /*
178 * Do this before updating the thread state in
179 * current->thread.fpr/vr. That way, if we get preempted
180 * and another task grabs the FPU/Altivec, it won't be
181 * tempted to save the current CPU state into the thread_struct
182 * and corrupt what we are writing there.
183 */
184 discard_lazy_cpu_state();
185
186 err |= __copy_from_user(&current->thread.fpr, &sc->fp_regs, FP_REGS_SIZE);
187
204#ifdef CONFIG_ALTIVEC 188#ifdef CONFIG_ALTIVEC
205 err |= __get_user(v_regs, &sc->v_regs); 189 err |= __get_user(v_regs, &sc->v_regs);
206 err |= __get_user(msr, &sc->gp_regs[PT_MSR]); 190 err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
@@ -219,14 +203,6 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
219 current->thread.vrsave = 0; 203 current->thread.vrsave = 0;
220#endif /* CONFIG_ALTIVEC */ 204#endif /* CONFIG_ALTIVEC */
221 205
222#ifndef CONFIG_SMP
223 preempt_disable();
224 if (last_task_used_math == current)
225 last_task_used_math = NULL;
226 if (last_task_used_altivec == current)
227 last_task_used_altivec = NULL;
228 preempt_enable();
229#endif
230 /* Force reload of FP/VEC */ 206 /* Force reload of FP/VEC */
231 regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1 | MSR_VEC); 207 regs->msr &= ~(MSR_FP | MSR_FE0 | MSR_FE1 | MSR_VEC);
232 208
@@ -340,6 +316,7 @@ int sys_swapcontext(struct ucontext __user *old_ctx,
340 do_exit(SIGSEGV); 316 do_exit(SIGSEGV);
341 317
342 /* This returns like rt_sigreturn */ 318 /* This returns like rt_sigreturn */
319 set_thread_flag(TIF_RESTOREALL);
343 return 0; 320 return 0;
344} 321}
345 322
@@ -372,7 +349,8 @@ int sys_rt_sigreturn(unsigned long r3, unsigned long r4, unsigned long r5,
372 */ 349 */
373 do_sigaltstack(&uc->uc_stack, NULL, regs->gpr[1]); 350 do_sigaltstack(&uc->uc_stack, NULL, regs->gpr[1]);
374 351
375 return regs->result; 352 set_thread_flag(TIF_RESTOREALL);
353 return 0;
376 354
377badframe: 355badframe:
378#if DEBUG_SIG 356#if DEBUG_SIG
@@ -454,9 +432,6 @@ static int setup_rt_frame(int signr, struct k_sigaction *ka, siginfo_t *info,
454 if (err) 432 if (err)
455 goto badframe; 433 goto badframe;
456 434
457 if (test_thread_flag(TIF_SINGLESTEP))
458 ptrace_notify(SIGTRAP);
459
460 return 1; 435 return 1;
461 436
462badframe: 437badframe:
@@ -502,6 +477,8 @@ static inline void syscall_restart(struct pt_regs *regs, struct k_sigaction *ka)
502 * we only get here if there is a handler, we dont restart. 477 * we only get here if there is a handler, we dont restart.
503 */ 478 */
504 regs->result = -EINTR; 479 regs->result = -EINTR;
480 regs->gpr[3] = EINTR;
481 regs->ccr |= 0x10000000;
505 break; 482 break;
506 case -ERESTARTSYS: 483 case -ERESTARTSYS:
507 /* ERESTARTSYS means to restart the syscall if there is no 484 /* ERESTARTSYS means to restart the syscall if there is no
@@ -509,6 +486,8 @@ static inline void syscall_restart(struct pt_regs *regs, struct k_sigaction *ka)
509 */ 486 */
510 if (!(ka->sa.sa_flags & SA_RESTART)) { 487 if (!(ka->sa.sa_flags & SA_RESTART)) {
511 regs->result = -EINTR; 488 regs->result = -EINTR;
489 regs->gpr[3] = EINTR;
490 regs->ccr |= 0x10000000;
512 break; 491 break;
513 } 492 }
514 /* fallthrough */ 493 /* fallthrough */
@@ -541,11 +520,15 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
541 if (test_thread_flag(TIF_32BIT)) 520 if (test_thread_flag(TIF_32BIT))
542 return do_signal32(oldset, regs); 521 return do_signal32(oldset, regs);
543 522
544 if (!oldset) 523 if (test_thread_flag(TIF_RESTORE_SIGMASK))
524 oldset = &current->saved_sigmask;
525 else if (!oldset)
545 oldset = &current->blocked; 526 oldset = &current->blocked;
546 527
547 signr = get_signal_to_deliver(&info, &ka, regs, NULL); 528 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
548 if (signr > 0) { 529 if (signr > 0) {
530 int ret;
531
549 /* Whee! Actually deliver the signal. */ 532 /* Whee! Actually deliver the signal. */
550 if (TRAP(regs) == 0x0C00) 533 if (TRAP(regs) == 0x0C00)
551 syscall_restart(regs, &ka); 534 syscall_restart(regs, &ka);
@@ -558,7 +541,14 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
558 if (current->thread.dabr) 541 if (current->thread.dabr)
559 set_dabr(current->thread.dabr); 542 set_dabr(current->thread.dabr);
560 543
561 return handle_signal(signr, &ka, &info, oldset, regs); 544 ret = handle_signal(signr, &ka, &info, oldset, regs);
545
546 /* If a signal was successfully delivered, the saved sigmask is in
547 its frame, and we can clear the TIF_RESTORE_SIGMASK flag */
548 if (ret && test_thread_flag(TIF_RESTORE_SIGMASK))
549 clear_thread_flag(TIF_RESTORE_SIGMASK);
550
551 return ret;
562 } 552 }
563 553
564 if (TRAP(regs) == 0x0C00) { /* System Call! */ 554 if (TRAP(regs) == 0x0C00) { /* System Call! */
@@ -574,6 +564,11 @@ int do_signal(sigset_t *oldset, struct pt_regs *regs)
574 regs->result = 0; 564 regs->result = 0;
575 } 565 }
576 } 566 }
567 /* No signal to deliver -- put the saved sigmask back */
568 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
569 clear_thread_flag(TIF_RESTORE_SIGMASK);
570 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
571 }
577 572
578 return 0; 573 return 0;
579} 574}
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 30374d2f88e5..c8458c531b25 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -31,6 +31,7 @@
31#include <linux/sysdev.h> 31#include <linux/sysdev.h>
32#include <linux/cpu.h> 32#include <linux/cpu.h>
33#include <linux/notifier.h> 33#include <linux/notifier.h>
34#include <linux/topology.h>
34 35
35#include <asm/ptrace.h> 36#include <asm/ptrace.h>
36#include <asm/atomic.h> 37#include <asm/atomic.h>
@@ -75,6 +76,8 @@ void smp_call_function_interrupt(void);
75 76
76int smt_enabled_at_boot = 1; 77int smt_enabled_at_boot = 1;
77 78
79static void (*crash_ipi_function_ptr)(struct pt_regs *) = NULL;
80
78#ifdef CONFIG_MPIC 81#ifdef CONFIG_MPIC
79int __init smp_mpic_probe(void) 82int __init smp_mpic_probe(void)
80{ 83{
@@ -123,11 +126,16 @@ void smp_message_recv(int msg, struct pt_regs *regs)
123 /* XXX Do we have to do this? */ 126 /* XXX Do we have to do this? */
124 set_need_resched(); 127 set_need_resched();
125 break; 128 break;
126#ifdef CONFIG_DEBUGGER
127 case PPC_MSG_DEBUGGER_BREAK: 129 case PPC_MSG_DEBUGGER_BREAK:
130 if (crash_ipi_function_ptr) {
131 crash_ipi_function_ptr(regs);
132 break;
133 }
134#ifdef CONFIG_DEBUGGER
128 debugger_ipi(regs); 135 debugger_ipi(regs);
129 break; 136 break;
130#endif 137#endif /* CONFIG_DEBUGGER */
138 /* FALLTHROUGH */
131 default: 139 default:
132 printk("SMP %d: smp_message_recv(): unknown msg %d\n", 140 printk("SMP %d: smp_message_recv(): unknown msg %d\n",
133 smp_processor_id(), msg); 141 smp_processor_id(), msg);
@@ -147,6 +155,17 @@ void smp_send_debugger_break(int cpu)
147} 155}
148#endif 156#endif
149 157
158#ifdef CONFIG_KEXEC
159void crash_send_ipi(void (*crash_ipi_callback)(struct pt_regs *))
160{
161 crash_ipi_function_ptr = crash_ipi_callback;
162 if (crash_ipi_callback) {
163 mb();
164 smp_ops->message_pass(MSG_ALL_BUT_SELF, PPC_MSG_DEBUGGER_BREAK);
165 }
166}
167#endif
168
150static void stop_this_cpu(void *dummy) 169static void stop_this_cpu(void *dummy)
151{ 170{
152 local_irq_disable(); 171 local_irq_disable();
@@ -319,8 +338,8 @@ static void __init smp_create_idle(unsigned int cpu)
319#ifdef CONFIG_PPC64 338#ifdef CONFIG_PPC64
320 paca[cpu].__current = p; 339 paca[cpu].__current = p;
321#endif 340#endif
322 current_set[cpu] = p->thread_info; 341 current_set[cpu] = task_thread_info(p);
323 p->thread_info->cpu = cpu; 342 task_thread_info(p)->cpu = cpu;
324} 343}
325 344
326void __init smp_prepare_cpus(unsigned int max_cpus) 345void __init smp_prepare_cpus(unsigned int max_cpus)
@@ -356,7 +375,7 @@ void __devinit smp_prepare_boot_cpu(void)
356#ifdef CONFIG_PPC64 375#ifdef CONFIG_PPC64
357 paca[boot_cpuid].__current = current; 376 paca[boot_cpuid].__current = current;
358#endif 377#endif
359 current_set[boot_cpuid] = current->thread_info; 378 current_set[boot_cpuid] = task_thread_info(current);
360} 379}
361 380
362#ifdef CONFIG_HOTPLUG_CPU 381#ifdef CONFIG_HOTPLUG_CPU
@@ -452,10 +471,6 @@ int __devinit __cpu_up(unsigned int cpu)
452 if (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu)) 471 if (smp_ops->cpu_bootable && !smp_ops->cpu_bootable(cpu))
453 return -EINVAL; 472 return -EINVAL;
454 473
455#ifdef CONFIG_PPC64
456 paca[cpu].default_decr = tb_ticks_per_jiffy;
457#endif
458
459 /* Make sure callin-map entry is 0 (can be leftover a CPU 474 /* Make sure callin-map entry is 0 (can be leftover a CPU
460 * hotplug 475 * hotplug
461 */ 476 */
@@ -554,6 +569,8 @@ void __init smp_cpus_done(unsigned int max_cpus)
554 smp_ops->setup_cpu(boot_cpuid); 569 smp_ops->setup_cpu(boot_cpuid);
555 570
556 set_cpus_allowed(current, old_mask); 571 set_cpus_allowed(current, old_mask);
572
573 dump_numa_cpu_topology();
557} 574}
558 575
559#ifdef CONFIG_HOTPLUG_CPU 576#ifdef CONFIG_HOTPLUG_CPU
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 9c921d1c4084..475249dc2350 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -552,30 +552,6 @@ asmlinkage long compat_sys_sched_rr_get_interval(u32 pid, struct compat_timespec
552 return ret; 552 return ret;
553} 553}
554 554
555asmlinkage int compat_sys_pciconfig_read(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
556{
557 return sys_pciconfig_read((unsigned long) bus,
558 (unsigned long) dfn,
559 (unsigned long) off,
560 (unsigned long) len,
561 compat_ptr(ubuf));
562}
563
564asmlinkage int compat_sys_pciconfig_write(u32 bus, u32 dfn, u32 off, u32 len, u32 ubuf)
565{
566 return sys_pciconfig_write((unsigned long) bus,
567 (unsigned long) dfn,
568 (unsigned long) off,
569 (unsigned long) len,
570 compat_ptr(ubuf));
571}
572
573asmlinkage int compat_sys_pciconfig_iobase(u32 which, u32 in_bus, u32 in_devfn)
574{
575 return sys_pciconfig_iobase(which, in_bus, in_devfn);
576}
577
578
579/* Note: it is necessary to treat mode as an unsigned int, 555/* Note: it is necessary to treat mode as an unsigned int,
580 * with the corresponding cast to a signed int to insure that the 556 * with the corresponding cast to a signed int to insure that the
581 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 557 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
@@ -956,38 +932,6 @@ long ppc32_fadvise64(int fd, u32 unused, u32 offset_high, u32 offset_low,
956 advice); 932 advice);
957} 933}
958 934
959long ppc32_timer_create(clockid_t clock,
960 struct compat_sigevent __user *ev32,
961 timer_t __user *timer_id)
962{
963 sigevent_t event;
964 timer_t t;
965 long err;
966 mm_segment_t savefs;
967
968 if (ev32 == NULL)
969 return sys_timer_create(clock, NULL, timer_id);
970
971 if (get_compat_sigevent(&event, ev32))
972 return -EFAULT;
973
974 if (!access_ok(VERIFY_WRITE, timer_id, sizeof(timer_t)))
975 return -EFAULT;
976
977 savefs = get_fs();
978 set_fs(KERNEL_DS);
979 /* The __user pointer casts are valid due to the set_fs() */
980 err = sys_timer_create(clock,
981 (sigevent_t __user *) &event,
982 (timer_t __user *) &t);
983 set_fs(savefs);
984
985 if (err == 0)
986 err = __put_user(t, timer_id);
987
988 return err;
989}
990
991asmlinkage long compat_sys_add_key(const char __user *_type, 935asmlinkage long compat_sys_add_key(const char __user *_type,
992 const char __user *_description, 936 const char __user *_description,
993 const void __user *_payload, 937 const void __user *_payload,
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index f72ced11212d..ad895c99813b 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -43,9 +43,6 @@
43#include <asm/time.h> 43#include <asm/time.h>
44#include <asm/unistd.h> 44#include <asm/unistd.h>
45 45
46extern unsigned long wall_jiffies;
47
48
49/* 46/*
50 * sys_ipc() is the de-multiplexer for the SysV IPC calls.. 47 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
51 * 48 *
@@ -247,7 +244,7 @@ long ppc64_personality(unsigned long personality)
247#define OVERRIDE_MACHINE 0 244#define OVERRIDE_MACHINE 0
248#endif 245#endif
249 246
250static inline int override_machine(char *mach) 247static inline int override_machine(char __user *mach)
251{ 248{
252 if (OVERRIDE_MACHINE) { 249 if (OVERRIDE_MACHINE) {
253 /* change ppc64 to ppc */ 250 /* change ppc64 to ppc */
@@ -311,31 +308,6 @@ int sys_olduname(struct oldold_utsname __user *name)
311 return error? -EFAULT: 0; 308 return error? -EFAULT: 0;
312} 309}
313 310
314#ifdef CONFIG_PPC64
315time_t sys64_time(time_t __user * tloc)
316{
317 time_t secs;
318 time_t usecs;
319
320 long tb_delta = tb_ticks_since(tb_last_stamp);
321 tb_delta += (jiffies - wall_jiffies) * tb_ticks_per_jiffy;
322
323 secs = xtime.tv_sec;
324 usecs = (xtime.tv_nsec/1000) + tb_delta / tb_ticks_per_usec;
325 while (usecs >= USEC_PER_SEC) {
326 ++secs;
327 usecs -= USEC_PER_SEC;
328 }
329
330 if (tloc) {
331 if (put_user(secs,tloc))
332 secs = -EFAULT;
333 }
334
335 return secs;
336}
337#endif
338
339long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low, 311long ppc_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low,
340 u32 len_high, u32 len_low) 312 u32 len_high, u32 len_low)
341{ 313{
diff --git a/arch/powerpc/kernel/systbl.S b/arch/powerpc/kernel/systbl.S
index 65eaea91b499..007b15ee36d2 100644
--- a/arch/powerpc/kernel/systbl.S
+++ b/arch/powerpc/kernel/systbl.S
@@ -54,7 +54,7 @@ SYSCALL(link)
54SYSCALL(unlink) 54SYSCALL(unlink)
55COMPAT_SYS(execve) 55COMPAT_SYS(execve)
56SYSCALL(chdir) 56SYSCALL(chdir)
57SYSX(sys64_time,compat_sys_time,sys_time) 57COMPAT_SYS(time)
58SYSCALL(mknod) 58SYSCALL(mknod)
59SYSCALL(chmod) 59SYSCALL(chmod)
60SYSCALL(lchown) 60SYSCALL(lchown)
@@ -113,7 +113,7 @@ SYSCALL(sgetmask)
113COMPAT_SYS(ssetmask) 113COMPAT_SYS(ssetmask)
114SYSCALL(setreuid) 114SYSCALL(setreuid)
115SYSCALL(setregid) 115SYSCALL(setregid)
116SYSX(sys_ni_syscall,ppc32_sigsuspend,ppc_sigsuspend) 116SYS32ONLY(sigsuspend)
117COMPAT_SYS(sigpending) 117COMPAT_SYS(sigpending)
118COMPAT_SYS(sethostname) 118COMPAT_SYS(sethostname)
119COMPAT_SYS(setrlimit) 119COMPAT_SYS(setrlimit)
@@ -160,7 +160,7 @@ SYSCALL(swapoff)
160COMPAT_SYS(sysinfo) 160COMPAT_SYS(sysinfo)
161COMPAT_SYS(ipc) 161COMPAT_SYS(ipc)
162SYSCALL(fsync) 162SYSCALL(fsync)
163SYSX(sys_ni_syscall,ppc32_sigreturn,sys_sigreturn) 163SYS32ONLY(sigreturn)
164PPC_SYS(clone) 164PPC_SYS(clone)
165COMPAT_SYS(setdomainname) 165COMPAT_SYS(setdomainname)
166PPC_SYS(newuname) 166PPC_SYS(newuname)
@@ -213,13 +213,13 @@ COMPAT_SYS(nfsservctl)
213SYSCALL(setresgid) 213SYSCALL(setresgid)
214SYSCALL(getresgid) 214SYSCALL(getresgid)
215COMPAT_SYS(prctl) 215COMPAT_SYS(prctl)
216SYSX(ppc64_rt_sigreturn,ppc32_rt_sigreturn,sys_rt_sigreturn) 216COMPAT_SYS(rt_sigreturn)
217COMPAT_SYS(rt_sigaction) 217COMPAT_SYS(rt_sigaction)
218COMPAT_SYS(rt_sigprocmask) 218COMPAT_SYS(rt_sigprocmask)
219COMPAT_SYS(rt_sigpending) 219COMPAT_SYS(rt_sigpending)
220COMPAT_SYS(rt_sigtimedwait) 220COMPAT_SYS(rt_sigtimedwait)
221COMPAT_SYS(rt_sigqueueinfo) 221COMPAT_SYS(rt_sigqueueinfo)
222SYSX(ppc64_rt_sigsuspend,ppc32_rt_sigsuspend,ppc_rt_sigsuspend) 222COMPAT_SYS(rt_sigsuspend)
223COMPAT_SYS(pread64) 223COMPAT_SYS(pread64)
224COMPAT_SYS(pwrite64) 224COMPAT_SYS(pwrite64)
225SYSCALL(chown) 225SYSCALL(chown)
@@ -239,9 +239,9 @@ SYS32ONLY(ftruncate64)
239SYSX(sys_ni_syscall,sys_stat64,sys_stat64) 239SYSX(sys_ni_syscall,sys_stat64,sys_stat64)
240SYSX(sys_ni_syscall,sys_lstat64,sys_lstat64) 240SYSX(sys_ni_syscall,sys_lstat64,sys_lstat64)
241SYSX(sys_ni_syscall,sys_fstat64,sys_fstat64) 241SYSX(sys_ni_syscall,sys_fstat64,sys_fstat64)
242COMPAT_SYS(pciconfig_read) 242SYSCALL(pciconfig_read)
243COMPAT_SYS(pciconfig_write) 243SYSCALL(pciconfig_write)
244COMPAT_SYS(pciconfig_iobase) 244SYSCALL(pciconfig_iobase)
245SYSCALL(ni_syscall) 245SYSCALL(ni_syscall)
246SYSCALL(getdents64) 246SYSCALL(getdents64)
247SYSCALL(pivot_root) 247SYSCALL(pivot_root)
@@ -281,7 +281,7 @@ SYSCALL(epoll_create)
281SYSCALL(epoll_ctl) 281SYSCALL(epoll_ctl)
282SYSCALL(epoll_wait) 282SYSCALL(epoll_wait)
283SYSCALL(remap_file_pages) 283SYSCALL(remap_file_pages)
284SYSX(sys_timer_create,ppc32_timer_create,sys_timer_create) 284SYSX(sys_timer_create,compat_sys_timer_create,sys_timer_create)
285COMPAT_SYS(timer_settime) 285COMPAT_SYS(timer_settime)
286COMPAT_SYS(timer_gettime) 286COMPAT_SYS(timer_gettime)
287SYSCALL(timer_getoverrun) 287SYSCALL(timer_getoverrun)
@@ -290,7 +290,7 @@ COMPAT_SYS(clock_settime)
290COMPAT_SYS(clock_gettime) 290COMPAT_SYS(clock_gettime)
291COMPAT_SYS(clock_getres) 291COMPAT_SYS(clock_getres)
292COMPAT_SYS(clock_nanosleep) 292COMPAT_SYS(clock_nanosleep)
293SYSX(ppc64_swapcontext,ppc32_swapcontext,ppc_swapcontext) 293COMPAT_SYS(swapcontext)
294COMPAT_SYS(tgkill) 294COMPAT_SYS(tgkill)
295COMPAT_SYS(utimes) 295COMPAT_SYS(utimes)
296COMPAT_SYS(statfs64) 296COMPAT_SYS(statfs64)
@@ -319,3 +319,7 @@ COMPAT_SYS(ioprio_get)
319SYSCALL(inotify_init) 319SYSCALL(inotify_init)
320SYSCALL(inotify_add_watch) 320SYSCALL(inotify_add_watch)
321SYSCALL(inotify_rm_watch) 321SYSCALL(inotify_rm_watch)
322SYSCALL(spu_run)
323SYSCALL(spu_create)
324COMPAT_SYS(pselect6)
325COMPAT_SYS(ppoll)
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index de8479769bb7..c4a294d657b9 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -431,7 +431,7 @@ void timer_interrupt(struct pt_regs * regs)
431 profile_tick(CPU_PROFILING, regs); 431 profile_tick(CPU_PROFILING, regs);
432 432
433#ifdef CONFIG_PPC_ISERIES 433#ifdef CONFIG_PPC_ISERIES
434 get_paca()->lppaca.int_dword.fields.decr_int = 0; 434 get_lppaca()->int_dword.fields.decr_int = 0;
435#endif 435#endif
436 436
437 while ((ticks = tb_ticks_since(per_cpu(last_jiffy, cpu))) 437 while ((ticks = tb_ticks_since(per_cpu(last_jiffy, cpu)))
@@ -699,10 +699,6 @@ void __init time_init(void)
699 div128_by_32(1024*1024, 0, tb_ticks_per_sec, &res); 699 div128_by_32(1024*1024, 0, tb_ticks_per_sec, &res);
700 tb_to_xs = res.result_low; 700 tb_to_xs = res.result_low;
701 701
702#ifdef CONFIG_PPC64
703 get_paca()->default_decr = tb_ticks_per_jiffy;
704#endif
705
706 /* 702 /*
707 * Compute scale factor for sched_clock. 703 * Compute scale factor for sched_clock.
708 * The calibrate_decr() function has set tb_ticks_per_sec, 704 * The calibrate_decr() function has set tb_ticks_per_sec,
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 1511454c4690..7509aa6474f2 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -31,6 +31,7 @@
31#include <linux/prctl.h> 31#include <linux/prctl.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/kprobes.h> 33#include <linux/kprobes.h>
34#include <linux/kexec.h>
34 35
35#include <asm/kdebug.h> 36#include <asm/kdebug.h>
36#include <asm/pgtable.h> 37#include <asm/pgtable.h>
@@ -95,7 +96,7 @@ static DEFINE_SPINLOCK(die_lock);
95 96
96int die(const char *str, struct pt_regs *regs, long err) 97int die(const char *str, struct pt_regs *regs, long err)
97{ 98{
98 static int die_counter; 99 static int die_counter, crash_dump_start = 0;
99 int nl = 0; 100 int nl = 0;
100 101
101 if (debugger(regs)) 102 if (debugger(regs))
@@ -156,7 +157,21 @@ int die(const char *str, struct pt_regs *regs, long err)
156 print_modules(); 157 print_modules();
157 show_regs(regs); 158 show_regs(regs);
158 bust_spinlocks(0); 159 bust_spinlocks(0);
160
161 if (!crash_dump_start && kexec_should_crash(current)) {
162 crash_dump_start = 1;
163 spin_unlock_irq(&die_lock);
164 crash_kexec(regs);
165 /* NOTREACHED */
166 }
159 spin_unlock_irq(&die_lock); 167 spin_unlock_irq(&die_lock);
168 if (crash_dump_start)
169 /*
170 * Only for soft-reset: Other CPUs will be responded to an IPI
171 * sent by first kexec CPU.
172 */
173 for(;;)
174 ;
160 175
161 if (in_interrupt()) 176 if (in_interrupt())
162 panic("Fatal exception in interrupt"); 177 panic("Fatal exception in interrupt");
@@ -215,8 +230,10 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
215void system_reset_exception(struct pt_regs *regs) 230void system_reset_exception(struct pt_regs *regs)
216{ 231{
217 /* See if any machine dependent calls */ 232 /* See if any machine dependent calls */
218 if (ppc_md.system_reset_exception) 233 if (ppc_md.system_reset_exception) {
219 ppc_md.system_reset_exception(regs); 234 if (ppc_md.system_reset_exception(regs))
235 return;
236 }
220 237
221 die("System Reset", regs, SIGABRT); 238 die("System Reset", regs, SIGABRT);
222 239
@@ -886,12 +903,10 @@ void altivec_unavailable_exception(struct pt_regs *regs)
886 die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT); 903 die("Unrecoverable VMX/Altivec Unavailable Exception", regs, SIGABRT);
887} 904}
888 905
889#if defined(CONFIG_PPC64) || defined(CONFIG_E500)
890void performance_monitor_exception(struct pt_regs *regs) 906void performance_monitor_exception(struct pt_regs *regs)
891{ 907{
892 perf_irq(regs); 908 perf_irq(regs);
893} 909}
894#endif
895 910
896#ifdef CONFIG_8xx 911#ifdef CONFIG_8xx
897void SoftwareEmulation(struct pt_regs *regs) 912void SoftwareEmulation(struct pt_regs *regs)
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index 0d878e72fc44..3774e80094f5 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -15,11 +15,36 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/console.h> 16#include <linux/console.h>
17#include <asm/processor.h> 17#include <asm/processor.h>
18#include <asm/udbg.h>
18 19
19void (*udbg_putc)(unsigned char c); 20void (*udbg_putc)(char c);
20unsigned char (*udbg_getc)(void); 21int (*udbg_getc)(void);
21int (*udbg_getc_poll)(void); 22int (*udbg_getc_poll)(void);
22 23
24/*
25 * Early debugging facilities. You can enable _one_ of these via .config,
26 * if you do so your kernel _will not boot_ on anything else. Be careful.
27 */
28void __init udbg_early_init(void)
29{
30#if defined(CONFIG_PPC_EARLY_DEBUG_LPAR)
31 /* For LPAR machines that have an HVC console on vterm 0 */
32 udbg_init_debug_lpar();
33#elif defined(CONFIG_PPC_EARLY_DEBUG_G5)
34 /* For use on Apple G5 machines */
35 udbg_init_pmac_realmode();
36#elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS)
37 /* RTAS panel debug */
38 udbg_init_rtas();
39#elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE)
40 /* Maple real mode debug */
41 udbg_init_maple_realmode();
42#elif defined(CONFIG_PPC_EARLY_DEBUG_ISERIES)
43 /* For iSeries - hit Ctrl-x Ctrl-x to see the output */
44 udbg_init_iseries();
45#endif
46}
47
23/* udbg library, used by xmon et al */ 48/* udbg library, used by xmon et al */
24void udbg_puts(const char *s) 49void udbg_puts(const char *s)
25{ 50{
@@ -57,8 +82,8 @@ int udbg_write(const char *s, int n)
57 82
58int udbg_read(char *buf, int buflen) 83int udbg_read(char *buf, int buflen)
59{ 84{
60 char c, *p = buf; 85 char *p = buf;
61 int i; 86 int i, c;
62 87
63 if (!udbg_getc) 88 if (!udbg_getc)
64 return 0; 89 return 0;
@@ -66,8 +91,11 @@ int udbg_read(char *buf, int buflen)
66 for (i = 0; i < buflen; ++i) { 91 for (i = 0; i < buflen; ++i) {
67 do { 92 do {
68 c = udbg_getc(); 93 c = udbg_getc();
94 if (c == -1 && i == 0)
95 return -1;
96
69 } while (c == 0x11 || c == 0x13); 97 } while (c == 0x11 || c == 0x13);
70 if (c == 0) 98 if (c == 0 || c == -1)
71 break; 99 break;
72 *p++ = c; 100 *p++ = c;
73 } 101 }
@@ -78,7 +106,7 @@ int udbg_read(char *buf, int buflen)
78#define UDBG_BUFSIZE 256 106#define UDBG_BUFSIZE 256
79void udbg_printf(const char *fmt, ...) 107void udbg_printf(const char *fmt, ...)
80{ 108{
81 unsigned char buf[UDBG_BUFSIZE]; 109 char buf[UDBG_BUFSIZE];
82 va_list args; 110 va_list args;
83 111
84 va_start(args, fmt); 112 va_start(args, fmt);
@@ -87,6 +115,12 @@ void udbg_printf(const char *fmt, ...)
87 va_end(args); 115 va_end(args);
88} 116}
89 117
118void __init udbg_progress(char *s, unsigned short hex)
119{
120 udbg_puts(s);
121 udbg_puts("\n");
122}
123
90/* 124/*
91 * Early boot console based on udbg 125 * Early boot console based on udbg
92 */ 126 */
@@ -99,7 +133,7 @@ static void udbg_console_write(struct console *con, const char *s,
99static struct console udbg_console = { 133static struct console udbg_console = {
100 .name = "udbg", 134 .name = "udbg",
101 .write = udbg_console_write, 135 .write = udbg_console_write,
102 .flags = CON_PRINTBUFFER, 136 .flags = CON_PRINTBUFFER | CON_ENABLED,
103 .index = -1, 137 .index = -1,
104}; 138};
105 139
@@ -107,15 +141,19 @@ static int early_console_initialized;
107 141
108void __init disable_early_printk(void) 142void __init disable_early_printk(void)
109{ 143{
144#if 1
110 if (!early_console_initialized) 145 if (!early_console_initialized)
111 return; 146 return;
112 unregister_console(&udbg_console); 147 unregister_console(&udbg_console);
113 early_console_initialized = 0; 148 early_console_initialized = 0;
149#endif
114} 150}
115 151
116/* called by setup_system */ 152/* called by setup_system */
117void register_early_udbg_console(void) 153void register_early_udbg_console(void)
118{ 154{
155 if (early_console_initialized)
156 return;
119 early_console_initialized = 1; 157 early_console_initialized = 1;
120 register_console(&udbg_console); 158 register_console(&udbg_console);
121} 159}
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c
index 9313574ab935..2da65a9c93f6 100644
--- a/arch/powerpc/kernel/udbg_16550.c
+++ b/arch/powerpc/kernel/udbg_16550.c
@@ -43,9 +43,11 @@ struct NS16550 {
43#define LSR_TEMT 0x40 /* Xmitter empty */ 43#define LSR_TEMT 0x40 /* Xmitter empty */
44#define LSR_ERR 0x80 /* Error */ 44#define LSR_ERR 0x80 /* Error */
45 45
46#define LCR_DLAB 0x80
47
46static volatile struct NS16550 __iomem *udbg_comport; 48static volatile struct NS16550 __iomem *udbg_comport;
47 49
48static void udbg_550_putc(unsigned char c) 50static void udbg_550_putc(char c)
49{ 51{
50 if (udbg_comport) { 52 if (udbg_comport) {
51 while ((in_8(&udbg_comport->lsr) & LSR_THRE) == 0) 53 while ((in_8(&udbg_comport->lsr) & LSR_THRE) == 0)
@@ -67,39 +69,80 @@ static int udbg_550_getc_poll(void)
67 return -1; 69 return -1;
68} 70}
69 71
70static unsigned char udbg_550_getc(void) 72static int udbg_550_getc(void)
71{ 73{
72 if (udbg_comport) { 74 if (udbg_comport) {
73 while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0) 75 while ((in_8(&udbg_comport->lsr) & LSR_DR) == 0)
74 /* wait for char */; 76 /* wait for char */;
75 return in_8(&udbg_comport->rbr); 77 return in_8(&udbg_comport->rbr);
76 } 78 }
77 return 0; 79 return -1;
78} 80}
79 81
80void udbg_init_uart(void __iomem *comport, unsigned int speed) 82void udbg_init_uart(void __iomem *comport, unsigned int speed,
83 unsigned int clock)
81{ 84{
82 u16 dll = speed ? (115200 / speed) : 12; 85 unsigned int dll, base_bauds = clock / 16;
86
87 if (speed == 0)
88 speed = 9600;
89 dll = base_bauds / speed;
83 90
84 if (comport) { 91 if (comport) {
85 udbg_comport = (struct NS16550 __iomem *)comport; 92 udbg_comport = (struct NS16550 __iomem *)comport;
86 out_8(&udbg_comport->lcr, 0x00); 93 out_8(&udbg_comport->lcr, 0x00);
87 out_8(&udbg_comport->ier, 0xff); 94 out_8(&udbg_comport->ier, 0xff);
88 out_8(&udbg_comport->ier, 0x00); 95 out_8(&udbg_comport->ier, 0x00);
89 out_8(&udbg_comport->lcr, 0x80); /* Access baud rate */ 96 out_8(&udbg_comport->lcr, LCR_DLAB);
90 out_8(&udbg_comport->dll, dll & 0xff); /* 1 = 115200, 2 = 57600, 97 out_8(&udbg_comport->dll, dll & 0xff);
91 3 = 38400, 12 = 9600 baud */ 98 out_8(&udbg_comport->dlm, dll >> 8);
92 out_8(&udbg_comport->dlm, dll >> 8); /* dll >> 8 which should be zero 99 /* 8 data, 1 stop, no parity */
93 for fast rates; */ 100 out_8(&udbg_comport->lcr, 0x03);
94 out_8(&udbg_comport->lcr, 0x03); /* 8 data, 1 stop, no parity */ 101 /* RTS/DTR */
95 out_8(&udbg_comport->mcr, 0x03); /* RTS/DTR */ 102 out_8(&udbg_comport->mcr, 0x03);
96 out_8(&udbg_comport->fcr ,0x07); /* Clear & enable FIFOs */ 103 /* Clear & enable FIFOs */
104 out_8(&udbg_comport->fcr ,0x07);
97 udbg_putc = udbg_550_putc; 105 udbg_putc = udbg_550_putc;
98 udbg_getc = udbg_550_getc; 106 udbg_getc = udbg_550_getc;
99 udbg_getc_poll = udbg_550_getc_poll; 107 udbg_getc_poll = udbg_550_getc_poll;
100 } 108 }
101} 109}
102 110
111unsigned int udbg_probe_uart_speed(void __iomem *comport, unsigned int clock)
112{
113 unsigned int dll, dlm, divisor, prescaler, speed;
114 u8 old_lcr;
115 volatile struct NS16550 __iomem *port = comport;
116
117 old_lcr = in_8(&port->lcr);
118
119 /* select divisor latch registers. */
120 out_8(&port->lcr, LCR_DLAB);
121
122 /* now, read the divisor */
123 dll = in_8(&port->dll);
124 dlm = in_8(&port->dlm);
125 divisor = dlm << 8 | dll;
126
127 /* check prescaling */
128 if (in_8(&port->mcr) & 0x80)
129 prescaler = 4;
130 else
131 prescaler = 1;
132
133 /* restore the LCR */
134 out_8(&port->lcr, old_lcr);
135
136 /* calculate speed */
137 speed = (clock / prescaler) / (divisor * 16);
138
139 /* sanity check */
140 if (speed < 0 || speed > (clock / 16))
141 speed = 9600;
142
143 return speed;
144}
145
103#ifdef CONFIG_PPC_MAPLE 146#ifdef CONFIG_PPC_MAPLE
104void udbg_maple_real_putc(unsigned char c) 147void udbg_maple_real_putc(unsigned char c)
105{ 148{
@@ -112,7 +155,7 @@ void udbg_maple_real_putc(unsigned char c)
112 } 155 }
113} 156}
114 157
115void udbg_init_maple_realmode(void) 158void __init udbg_init_maple_realmode(void)
116{ 159{
117 udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8; 160 udbg_comport = (volatile struct NS16550 __iomem *)0xf40003f8;
118 161
diff --git a/arch/powerpc/kernel/vdso32/.gitignore b/arch/powerpc/kernel/vdso32/.gitignore
new file mode 100644
index 000000000000..e45fba9d0ced
--- /dev/null
+++ b/arch/powerpc/kernel/vdso32/.gitignore
@@ -0,0 +1 @@
vdso32.lds
diff --git a/arch/powerpc/kernel/vdso64/.gitignore b/arch/powerpc/kernel/vdso64/.gitignore
new file mode 100644
index 000000000000..3fd18cf9fec2
--- /dev/null
+++ b/arch/powerpc/kernel/vdso64/.gitignore
@@ -0,0 +1 @@
vdso64.lds
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 71a6addf9f7f..13c655ba2841 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -76,7 +76,7 @@ static void vio_bus_shutdown(struct device *dev)
76 struct vio_dev *viodev = to_vio_dev(dev); 76 struct vio_dev *viodev = to_vio_dev(dev);
77 struct vio_driver *viodrv = to_vio_driver(dev->driver); 77 struct vio_driver *viodrv = to_vio_driver(dev->driver);
78 78
79 if (viodrv->shutdown) 79 if (dev->driver && viodrv->shutdown)
80 viodrv->shutdown(viodev); 80 viodrv->shutdown(viodev);
81} 81}
82 82
@@ -91,9 +91,6 @@ int vio_register_driver(struct vio_driver *viodrv)
91 91
92 /* fill in 'struct driver' fields */ 92 /* fill in 'struct driver' fields */
93 viodrv->driver.bus = &vio_bus_type; 93 viodrv->driver.bus = &vio_bus_type;
94 viodrv->driver.probe = vio_bus_probe;
95 viodrv->driver.remove = vio_bus_remove;
96 viodrv->driver.shutdown = vio_bus_shutdown;
97 94
98 return driver_register(&viodrv->driver); 95 return driver_register(&viodrv->driver);
99} 96}
@@ -293,6 +290,9 @@ static int vio_hotplug(struct device *dev, char **envp, int num_envp,
293 290
294struct bus_type vio_bus_type = { 291struct bus_type vio_bus_type = {
295 .name = "vio", 292 .name = "vio",
296 .hotplug = vio_hotplug, 293 .uevent = vio_hotplug,
297 .match = vio_bus_match, 294 .match = vio_bus_match,
295 .probe = vio_bus_probe,
296 .remove = vio_bus_remove,
297 .shutdown = vio_bus_shutdown,
298}; 298};
diff --git a/arch/powerpc/lib/locks.c b/arch/powerpc/lib/locks.c
index 35bd03c41dd1..8362fa272ca5 100644
--- a/arch/powerpc/lib/locks.c
+++ b/arch/powerpc/lib/locks.c
@@ -28,15 +28,13 @@
28void __spin_yield(raw_spinlock_t *lock) 28void __spin_yield(raw_spinlock_t *lock)
29{ 29{
30 unsigned int lock_value, holder_cpu, yield_count; 30 unsigned int lock_value, holder_cpu, yield_count;
31 struct paca_struct *holder_paca;
32 31
33 lock_value = lock->slock; 32 lock_value = lock->slock;
34 if (lock_value == 0) 33 if (lock_value == 0)
35 return; 34 return;
36 holder_cpu = lock_value & 0xffff; 35 holder_cpu = lock_value & 0xffff;
37 BUG_ON(holder_cpu >= NR_CPUS); 36 BUG_ON(holder_cpu >= NR_CPUS);
38 holder_paca = &paca[holder_cpu]; 37 yield_count = lppaca[holder_cpu].yield_count;
39 yield_count = holder_paca->lppaca.yield_count;
40 if ((yield_count & 1) == 0) 38 if ((yield_count & 1) == 0)
41 return; /* virtual cpu is currently running */ 39 return; /* virtual cpu is currently running */
42 rmb(); 40 rmb();
@@ -60,15 +58,13 @@ void __rw_yield(raw_rwlock_t *rw)
60{ 58{
61 int lock_value; 59 int lock_value;
62 unsigned int holder_cpu, yield_count; 60 unsigned int holder_cpu, yield_count;
63 struct paca_struct *holder_paca;
64 61
65 lock_value = rw->lock; 62 lock_value = rw->lock;
66 if (lock_value >= 0) 63 if (lock_value >= 0)
67 return; /* no write lock at present */ 64 return; /* no write lock at present */
68 holder_cpu = lock_value & 0xffff; 65 holder_cpu = lock_value & 0xffff;
69 BUG_ON(holder_cpu >= NR_CPUS); 66 BUG_ON(holder_cpu >= NR_CPUS);
70 holder_paca = &paca[holder_cpu]; 67 yield_count = lppaca[holder_cpu].yield_count;
71 yield_count = holder_paca->lppaca.yield_count;
72 if ((yield_count & 1) == 0) 68 if ((yield_count & 1) == 0)
73 return; /* virtual cpu is currently running */ 69 return; /* virtual cpu is currently running */
74 rmb(); 70 rmb();
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index 93d4fbfdb724..a4815d316722 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -81,7 +81,8 @@ static int store_updates_sp(struct pt_regs *regs)
81} 81}
82 82
83#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) 83#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
84static void do_dabr(struct pt_regs *regs, unsigned long error_code) 84static void do_dabr(struct pt_regs *regs, unsigned long address,
85 unsigned long error_code)
85{ 86{
86 siginfo_t info; 87 siginfo_t info;
87 88
@@ -99,7 +100,7 @@ static void do_dabr(struct pt_regs *regs, unsigned long error_code)
99 info.si_signo = SIGTRAP; 100 info.si_signo = SIGTRAP;
100 info.si_errno = 0; 101 info.si_errno = 0;
101 info.si_code = TRAP_HWBKPT; 102 info.si_code = TRAP_HWBKPT;
102 info.si_addr = (void __user *)regs->nip; 103 info.si_addr = (void __user *)address;
103 force_sig_info(SIGTRAP, &info, current); 104 force_sig_info(SIGTRAP, &info, current);
104} 105}
105#endif /* !(CONFIG_4xx || CONFIG_BOOKE)*/ 106#endif /* !(CONFIG_4xx || CONFIG_BOOKE)*/
@@ -159,7 +160,7 @@ int __kprobes do_page_fault(struct pt_regs *regs, unsigned long address,
159#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE)) 160#if !(defined(CONFIG_4xx) || defined(CONFIG_BOOKE))
160 if (error_code & DSISR_DABRMATCH) { 161 if (error_code & DSISR_DABRMATCH) {
161 /* DABR match */ 162 /* DABR match */
162 do_dabr(regs, error_code); 163 do_dabr(regs, address, error_code);
163 return 0; 164 return 0;
164 } 165 }
165#endif /* !(CONFIG_4xx || CONFIG_BOOKE)*/ 166#endif /* !(CONFIG_4xx || CONFIG_BOOKE)*/
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 706e8a63ced9..149351a84b94 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -368,7 +368,7 @@ static unsigned long __init htab_get_table_size(void)
368 unsigned long mem_size, rnd_mem_size, pteg_count; 368 unsigned long mem_size, rnd_mem_size, pteg_count;
369 369
370 /* If hash size isn't already provided by the platform, we try to 370 /* If hash size isn't already provided by the platform, we try to
371 * retreive it from the device-tree. If it's not there neither, we 371 * retrieve it from the device-tree. If it's not there neither, we
372 * calculate it now based on the total RAM size 372 * calculate it now based on the total RAM size
373 */ 373 */
374 if (ppc64_pft_size == 0) 374 if (ppc64_pft_size == 0)
@@ -456,7 +456,7 @@ void __init htab_initialize(void)
456 456
457 /* create bolted the linear mapping in the hash table */ 457 /* create bolted the linear mapping in the hash table */
458 for (i=0; i < lmb.memory.cnt; i++) { 458 for (i=0; i < lmb.memory.cnt; i++) {
459 base = lmb.memory.region[i].base + KERNELBASE; 459 base = (unsigned long)__va(lmb.memory.region[i].base);
460 size = lmb.memory.region[i].size; 460 size = lmb.memory.region[i].size;
461 461
462 DBG("creating mapping for region: %lx : %lx\n", base, size); 462 DBG("creating mapping for region: %lx : %lx\n", base, size);
@@ -498,8 +498,8 @@ void __init htab_initialize(void)
498 * for either 4K or 16MB pages. 498 * for either 4K or 16MB pages.
499 */ 499 */
500 if (tce_alloc_start) { 500 if (tce_alloc_start) {
501 tce_alloc_start += KERNELBASE; 501 tce_alloc_start = (unsigned long)__va(tce_alloc_start);
502 tce_alloc_end += KERNELBASE; 502 tce_alloc_end = (unsigned long)__va(tce_alloc_end);
503 503
504 if (base + size >= tce_alloc_start) 504 if (base + size >= tce_alloc_start)
505 tce_alloc_start = base + size + 1; 505 tce_alloc_start = base + size + 1;
@@ -514,7 +514,7 @@ void __init htab_initialize(void)
514#undef KB 514#undef KB
515#undef MB 515#undef MB
516 516
517void __init htab_initialize_secondary(void) 517void htab_initialize_secondary(void)
518{ 518{
519 if (!platform_is_lpar()) 519 if (!platform_is_lpar())
520 mtspr(SPRN_SDR1, _SDR1); 520 mtspr(SPRN_SDR1, _SDR1);
@@ -601,7 +601,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
601 /* Handle hugepage regions */ 601 /* Handle hugepage regions */
602 if (unlikely(in_hugepage_area(mm->context, ea))) { 602 if (unlikely(in_hugepage_area(mm->context, ea))) {
603 DBG_LOW(" -> huge page !\n"); 603 DBG_LOW(" -> huge page !\n");
604 return hash_huge_page(mm, access, ea, vsid, local); 604 return hash_huge_page(mm, access, ea, vsid, local, trap);
605 } 605 }
606 606
607 /* Get PTE and page size from page tables */ 607 /* Get PTE and page size from page tables */
@@ -644,6 +644,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
644 DBG_LOW(" -> rc=%d\n", rc); 644 DBG_LOW(" -> rc=%d\n", rc);
645 return rc; 645 return rc;
646} 646}
647EXPORT_SYMBOL_GPL(hash_page);
647 648
648void hash_preload(struct mm_struct *mm, unsigned long ea, 649void hash_preload(struct mm_struct *mm, unsigned long ea,
649 unsigned long access, unsigned long trap) 650 unsigned long access, unsigned long trap)
diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c
index 6bc9dbad7dea..b51bb28c054b 100644
--- a/arch/powerpc/mm/hugetlbpage.c
+++ b/arch/powerpc/mm/hugetlbpage.c
@@ -148,43 +148,63 @@ int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
148 return 0; 148 return 0;
149} 149}
150 150
151struct slb_flush_info {
152 struct mm_struct *mm;
153 u16 newareas;
154};
155
151static void flush_low_segments(void *parm) 156static void flush_low_segments(void *parm)
152{ 157{
153 u16 areas = (unsigned long) parm; 158 struct slb_flush_info *fi = parm;
154 unsigned long i; 159 unsigned long i;
155 160
156 asm volatile("isync" : : : "memory"); 161 BUILD_BUG_ON((sizeof(fi->newareas)*8) != NUM_LOW_AREAS);
162
163 if (current->active_mm != fi->mm)
164 return;
157 165
158 BUILD_BUG_ON((sizeof(areas)*8) != NUM_LOW_AREAS); 166 /* Only need to do anything if this CPU is working in the same
167 * mm as the one which has changed */
159 168
169 /* update the paca copy of the context struct */
170 get_paca()->context = current->active_mm->context;
171
172 asm volatile("isync" : : : "memory");
160 for (i = 0; i < NUM_LOW_AREAS; i++) { 173 for (i = 0; i < NUM_LOW_AREAS; i++) {
161 if (! (areas & (1U << i))) 174 if (! (fi->newareas & (1U << i)))
162 continue; 175 continue;
163 asm volatile("slbie %0" 176 asm volatile("slbie %0"
164 : : "r" ((i << SID_SHIFT) | SLBIE_C)); 177 : : "r" ((i << SID_SHIFT) | SLBIE_C));
165 } 178 }
166
167 asm volatile("isync" : : : "memory"); 179 asm volatile("isync" : : : "memory");
168} 180}
169 181
170static void flush_high_segments(void *parm) 182static void flush_high_segments(void *parm)
171{ 183{
172 u16 areas = (unsigned long) parm; 184 struct slb_flush_info *fi = parm;
173 unsigned long i, j; 185 unsigned long i, j;
174 186
175 asm volatile("isync" : : : "memory");
176 187
177 BUILD_BUG_ON((sizeof(areas)*8) != NUM_HIGH_AREAS); 188 BUILD_BUG_ON((sizeof(fi->newareas)*8) != NUM_HIGH_AREAS);
189
190 if (current->active_mm != fi->mm)
191 return;
192
193 /* Only need to do anything if this CPU is working in the same
194 * mm as the one which has changed */
195
196 /* update the paca copy of the context struct */
197 get_paca()->context = current->active_mm->context;
178 198
199 asm volatile("isync" : : : "memory");
179 for (i = 0; i < NUM_HIGH_AREAS; i++) { 200 for (i = 0; i < NUM_HIGH_AREAS; i++) {
180 if (! (areas & (1U << i))) 201 if (! (fi->newareas & (1U << i)))
181 continue; 202 continue;
182 for (j = 0; j < (1UL << (HTLB_AREA_SHIFT-SID_SHIFT)); j++) 203 for (j = 0; j < (1UL << (HTLB_AREA_SHIFT-SID_SHIFT)); j++)
183 asm volatile("slbie %0" 204 asm volatile("slbie %0"
184 :: "r" (((i << HTLB_AREA_SHIFT) 205 :: "r" (((i << HTLB_AREA_SHIFT)
185 + (j << SID_SHIFT)) | SLBIE_C)); 206 + (j << SID_SHIFT)) | SLBIE_C));
186 } 207 }
187
188 asm volatile("isync" : : : "memory"); 208 asm volatile("isync" : : : "memory");
189} 209}
190 210
@@ -229,6 +249,7 @@ static int prepare_high_area_for_htlb(struct mm_struct *mm, unsigned long area)
229static int open_low_hpage_areas(struct mm_struct *mm, u16 newareas) 249static int open_low_hpage_areas(struct mm_struct *mm, u16 newareas)
230{ 250{
231 unsigned long i; 251 unsigned long i;
252 struct slb_flush_info fi;
232 253
233 BUILD_BUG_ON((sizeof(newareas)*8) != NUM_LOW_AREAS); 254 BUILD_BUG_ON((sizeof(newareas)*8) != NUM_LOW_AREAS);
234 BUILD_BUG_ON((sizeof(mm->context.low_htlb_areas)*8) != NUM_LOW_AREAS); 255 BUILD_BUG_ON((sizeof(mm->context.low_htlb_areas)*8) != NUM_LOW_AREAS);
@@ -244,19 +265,20 @@ static int open_low_hpage_areas(struct mm_struct *mm, u16 newareas)
244 265
245 mm->context.low_htlb_areas |= newareas; 266 mm->context.low_htlb_areas |= newareas;
246 267
247 /* update the paca copy of the context struct */
248 get_paca()->context = mm->context;
249
250 /* the context change must make it to memory before the flush, 268 /* the context change must make it to memory before the flush,
251 * so that further SLB misses do the right thing. */ 269 * so that further SLB misses do the right thing. */
252 mb(); 270 mb();
253 on_each_cpu(flush_low_segments, (void *)(unsigned long)newareas, 0, 1); 271
272 fi.mm = mm;
273 fi.newareas = newareas;
274 on_each_cpu(flush_low_segments, &fi, 0, 1);
254 275
255 return 0; 276 return 0;
256} 277}
257 278
258static int open_high_hpage_areas(struct mm_struct *mm, u16 newareas) 279static int open_high_hpage_areas(struct mm_struct *mm, u16 newareas)
259{ 280{
281 struct slb_flush_info fi;
260 unsigned long i; 282 unsigned long i;
261 283
262 BUILD_BUG_ON((sizeof(newareas)*8) != NUM_HIGH_AREAS); 284 BUILD_BUG_ON((sizeof(newareas)*8) != NUM_HIGH_AREAS);
@@ -280,7 +302,10 @@ static int open_high_hpage_areas(struct mm_struct *mm, u16 newareas)
280 /* the context change must make it to memory before the flush, 302 /* the context change must make it to memory before the flush,
281 * so that further SLB misses do the right thing. */ 303 * so that further SLB misses do the right thing. */
282 mb(); 304 mb();
283 on_each_cpu(flush_high_segments, (void *)(unsigned long)newareas, 0, 1); 305
306 fi.mm = mm;
307 fi.newareas = newareas;
308 on_each_cpu(flush_high_segments, &fi, 0, 1);
284 309
285 return 0; 310 return 0;
286} 311}
@@ -524,6 +549,17 @@ fail:
524 return addr; 549 return addr;
525} 550}
526 551
552static int htlb_check_hinted_area(unsigned long addr, unsigned long len)
553{
554 struct vm_area_struct *vma;
555
556 vma = find_vma(current->mm, addr);
557 if (!vma || ((addr + len) <= vma->vm_start))
558 return 0;
559
560 return -ENOMEM;
561}
562
527static unsigned long htlb_get_low_area(unsigned long len, u16 segmask) 563static unsigned long htlb_get_low_area(unsigned long len, u16 segmask)
528{ 564{
529 unsigned long addr = 0; 565 unsigned long addr = 0;
@@ -593,15 +629,28 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
593 if (!cpu_has_feature(CPU_FTR_16M_PAGE)) 629 if (!cpu_has_feature(CPU_FTR_16M_PAGE))
594 return -EINVAL; 630 return -EINVAL;
595 631
632 /* Paranoia, caller should have dealt with this */
633 BUG_ON((addr + len) < addr);
634
596 if (test_thread_flag(TIF_32BIT)) { 635 if (test_thread_flag(TIF_32BIT)) {
636 /* Paranoia, caller should have dealt with this */
637 BUG_ON((addr + len) > 0x100000000UL);
638
597 curareas = current->mm->context.low_htlb_areas; 639 curareas = current->mm->context.low_htlb_areas;
598 640
599 /* First see if we can do the mapping in the existing 641 /* First see if we can use the hint address */
600 * low areas */ 642 if (addr && (htlb_check_hinted_area(addr, len) == 0)) {
643 areamask = LOW_ESID_MASK(addr, len);
644 if (open_low_hpage_areas(current->mm, areamask) == 0)
645 return addr;
646 }
647
648 /* Next see if we can map in the existing low areas */
601 addr = htlb_get_low_area(len, curareas); 649 addr = htlb_get_low_area(len, curareas);
602 if (addr != -ENOMEM) 650 if (addr != -ENOMEM)
603 return addr; 651 return addr;
604 652
653 /* Finally go looking for areas to open */
605 lastshift = 0; 654 lastshift = 0;
606 for (areamask = LOW_ESID_MASK(0x100000000UL-len, len); 655 for (areamask = LOW_ESID_MASK(0x100000000UL-len, len);
607 ! lastshift; areamask >>=1) { 656 ! lastshift; areamask >>=1) {
@@ -616,12 +665,22 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
616 } else { 665 } else {
617 curareas = current->mm->context.high_htlb_areas; 666 curareas = current->mm->context.high_htlb_areas;
618 667
619 /* First see if we can do the mapping in the existing 668 /* First see if we can use the hint address */
620 * high areas */ 669 /* We discourage 64-bit processes from doing hugepage
670 * mappings below 4GB (must use MAP_FIXED) */
671 if ((addr >= 0x100000000UL)
672 && (htlb_check_hinted_area(addr, len) == 0)) {
673 areamask = HTLB_AREA_MASK(addr, len);
674 if (open_high_hpage_areas(current->mm, areamask) == 0)
675 return addr;
676 }
677
678 /* Next see if we can map in the existing high areas */
621 addr = htlb_get_high_area(len, curareas); 679 addr = htlb_get_high_area(len, curareas);
622 if (addr != -ENOMEM) 680 if (addr != -ENOMEM)
623 return addr; 681 return addr;
624 682
683 /* Finally go looking for areas to open */
625 lastshift = 0; 684 lastshift = 0;
626 for (areamask = HTLB_AREA_MASK(TASK_SIZE_USER64-len, len); 685 for (areamask = HTLB_AREA_MASK(TASK_SIZE_USER64-len, len);
627 ! lastshift; areamask >>=1) { 686 ! lastshift; areamask >>=1) {
@@ -639,8 +698,36 @@ unsigned long hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
639 return -ENOMEM; 698 return -ENOMEM;
640} 699}
641 700
701/*
702 * Called by asm hashtable.S for doing lazy icache flush
703 */
704static unsigned int hash_huge_page_do_lazy_icache(unsigned long rflags,
705 pte_t pte, int trap)
706{
707 struct page *page;
708 int i;
709
710 if (!pfn_valid(pte_pfn(pte)))
711 return rflags;
712
713 page = pte_page(pte);
714
715 /* page is dirty */
716 if (!test_bit(PG_arch_1, &page->flags) && !PageReserved(page)) {
717 if (trap == 0x400) {
718 for (i = 0; i < (HPAGE_SIZE / PAGE_SIZE); i++)
719 __flush_dcache_icache(page_address(page+i));
720 set_bit(PG_arch_1, &page->flags);
721 } else {
722 rflags |= HPTE_R_N;
723 }
724 }
725 return rflags;
726}
727
642int hash_huge_page(struct mm_struct *mm, unsigned long access, 728int hash_huge_page(struct mm_struct *mm, unsigned long access,
643 unsigned long ea, unsigned long vsid, int local) 729 unsigned long ea, unsigned long vsid, int local,
730 unsigned long trap)
644{ 731{
645 pte_t *ptep; 732 pte_t *ptep;
646 unsigned long old_pte, new_pte; 733 unsigned long old_pte, new_pte;
@@ -691,6 +778,11 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
691 rflags = 0x2 | (!(new_pte & _PAGE_RW)); 778 rflags = 0x2 | (!(new_pte & _PAGE_RW));
692 /* _PAGE_EXEC -> HW_NO_EXEC since it's inverted */ 779 /* _PAGE_EXEC -> HW_NO_EXEC since it's inverted */
693 rflags |= ((new_pte & _PAGE_EXEC) ? 0 : HPTE_R_N); 780 rflags |= ((new_pte & _PAGE_EXEC) ? 0 : HPTE_R_N);
781 if (!cpu_has_feature(CPU_FTR_COHERENT_ICACHE))
782 /* No CPU has hugepages but lacks no execute, so we
783 * don't need to worry about that case */
784 rflags = hash_huge_page_do_lazy_icache(rflags, __pte(old_pte),
785 trap);
694 786
695 /* Check if pte already has an hpte (case 2) */ 787 /* Check if pte already has an hpte (case 2) */
696 if (unlikely(old_pte & _PAGE_HASHPTE)) { 788 if (unlikely(old_pte & _PAGE_HASHPTE)) {
@@ -703,7 +795,8 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
703 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 795 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
704 slot += (old_pte & _PAGE_F_GIX) >> 12; 796 slot += (old_pte & _PAGE_F_GIX) >> 12;
705 797
706 if (ppc_md.hpte_updatepp(slot, rflags, va, 1, local) == -1) 798 if (ppc_md.hpte_updatepp(slot, rflags, va, mmu_huge_psize,
799 local) == -1)
707 old_pte &= ~_PAGE_HPTEFLAGS; 800 old_pte &= ~_PAGE_HPTEFLAGS;
708 } 801 }
709 802
diff --git a/arch/powerpc/mm/imalloc.c b/arch/powerpc/mm/imalloc.c
index f9587bcc6a48..8b0c132bc163 100644
--- a/arch/powerpc/mm/imalloc.c
+++ b/arch/powerpc/mm/imalloc.c
@@ -107,6 +107,7 @@ static int im_region_status(unsigned long v_addr, unsigned long size,
107 if (v_addr < (unsigned long) tmp->addr + tmp->size) 107 if (v_addr < (unsigned long) tmp->addr + tmp->size)
108 break; 108 break;
109 109
110 *vm = NULL;
110 if (tmp) { 111 if (tmp) {
111 if (im_region_overlaps(v_addr, size, tmp)) 112 if (im_region_overlaps(v_addr, size, tmp))
112 return IM_REGION_OVERLAP; 113 return IM_REGION_OVERLAP;
@@ -127,7 +128,6 @@ static int im_region_status(unsigned long v_addr, unsigned long size,
127 } 128 }
128 } 129 }
129 130
130 *vm = NULL;
131 return IM_REGION_UNUSED; 131 return IM_REGION_UNUSED;
132} 132}
133 133
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 7d4b8b5f0606..7d0d75c11848 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -188,6 +188,11 @@ void __init MMU_init(void)
188 188
189 if (ppc_md.progress) 189 if (ppc_md.progress)
190 ppc_md.progress("MMU:exit", 0x211); 190 ppc_md.progress("MMU:exit", 0x211);
191
192 /* From now on, btext is no longer BAT mapped if it was at all */
193#ifdef CONFIG_BOOTX_TEXT
194 btext_unmap();
195#endif
191} 196}
192 197
193/* This is only called until mem_init is done. */ 198/* This is only called until mem_init is done. */
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index ed6ed2e30dac..15aac0d78dfa 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -114,19 +114,18 @@ void online_page(struct page *page)
114 num_physpages++; 114 num_physpages++;
115} 115}
116 116
117/*
118 * This works only for the non-NUMA case. Later, we'll need a lookup
119 * to convert from real physical addresses to nid, that doesn't use
120 * pfn_to_nid().
121 */
122int __devinit add_memory(u64 start, u64 size) 117int __devinit add_memory(u64 start, u64 size)
123{ 118{
124 struct pglist_data *pgdata = NODE_DATA(0); 119 struct pglist_data *pgdata;
125 struct zone *zone; 120 struct zone *zone;
121 int nid;
126 unsigned long start_pfn = start >> PAGE_SHIFT; 122 unsigned long start_pfn = start >> PAGE_SHIFT;
127 unsigned long nr_pages = size >> PAGE_SHIFT; 123 unsigned long nr_pages = size >> PAGE_SHIFT;
128 124
129 start += KERNELBASE; 125 nid = hot_add_scn_to_nid(start);
126 pgdata = NODE_DATA(nid);
127
128 start = __va(start);
130 create_section_mapping(start, start + size); 129 create_section_mapping(start, start + size);
131 130
132 /* this should work for most non-highmem platforms */ 131 /* this should work for most non-highmem platforms */
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f72cf87364cb..2863a912bcd0 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -37,6 +37,7 @@ EXPORT_SYMBOL(node_data);
37 37
38static bootmem_data_t __initdata plat_node_bdata[MAX_NUMNODES]; 38static bootmem_data_t __initdata plat_node_bdata[MAX_NUMNODES];
39static int min_common_depth; 39static int min_common_depth;
40static int n_mem_addr_cells, n_mem_size_cells;
40 41
41/* 42/*
42 * We need somewhere to store start/end/node for each region until we have 43 * We need somewhere to store start/end/node for each region until we have
@@ -125,7 +126,7 @@ void __init get_region(unsigned int nid, unsigned long *start_pfn,
125 126
126 /* We didnt find a matching region, return start/end as 0 */ 127 /* We didnt find a matching region, return start/end as 0 */
127 if (*start_pfn == -1UL) 128 if (*start_pfn == -1UL)
128 start_pfn = 0; 129 *start_pfn = 0;
129} 130}
130 131
131static inline void map_cpu_to_node(int cpu, int node) 132static inline void map_cpu_to_node(int cpu, int node)
@@ -254,32 +255,20 @@ static int __init find_min_common_depth(void)
254 return depth; 255 return depth;
255} 256}
256 257
257static int __init get_mem_addr_cells(void) 258static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells)
258{ 259{
259 struct device_node *memory = NULL; 260 struct device_node *memory = NULL;
260 int rc;
261 261
262 memory = of_find_node_by_type(memory, "memory"); 262 memory = of_find_node_by_type(memory, "memory");
263 if (!memory) 263 if (!memory)
264 return 0; /* it won't matter */ 264 panic("numa.c: No memory nodes found!");
265 265
266 rc = prom_n_addr_cells(memory); 266 *n_addr_cells = prom_n_addr_cells(memory);
267 return rc; 267 *n_size_cells = prom_n_size_cells(memory);
268 of_node_put(memory);
268} 269}
269 270
270static int __init get_mem_size_cells(void) 271static unsigned long __devinit read_n_cells(int n, unsigned int **buf)
271{
272 struct device_node *memory = NULL;
273 int rc;
274
275 memory = of_find_node_by_type(memory, "memory");
276 if (!memory)
277 return 0; /* it won't matter */
278 rc = prom_n_size_cells(memory);
279 return rc;
280}
281
282static unsigned long __init read_n_cells(int n, unsigned int **buf)
283{ 272{
284 unsigned long result = 0; 273 unsigned long result = 0;
285 274
@@ -386,7 +375,6 @@ static int __init parse_numa_properties(void)
386{ 375{
387 struct device_node *cpu = NULL; 376 struct device_node *cpu = NULL;
388 struct device_node *memory = NULL; 377 struct device_node *memory = NULL;
389 int addr_cells, size_cells;
390 int max_domain; 378 int max_domain;
391 unsigned long i; 379 unsigned long i;
392 380
@@ -425,8 +413,7 @@ static int __init parse_numa_properties(void)
425 } 413 }
426 } 414 }
427 415
428 addr_cells = get_mem_addr_cells(); 416 get_n_mem_cells(&n_mem_addr_cells, &n_mem_size_cells);
429 size_cells = get_mem_size_cells();
430 memory = NULL; 417 memory = NULL;
431 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { 418 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
432 unsigned long start; 419 unsigned long start;
@@ -436,15 +423,21 @@ static int __init parse_numa_properties(void)
436 unsigned int *memcell_buf; 423 unsigned int *memcell_buf;
437 unsigned int len; 424 unsigned int len;
438 425
439 memcell_buf = (unsigned int *)get_property(memory, "reg", &len); 426 memcell_buf = (unsigned int *)get_property(memory,
427 "linux,usable-memory", &len);
428 if (!memcell_buf || len <= 0)
429 memcell_buf =
430 (unsigned int *)get_property(memory, "reg",
431 &len);
440 if (!memcell_buf || len <= 0) 432 if (!memcell_buf || len <= 0)
441 continue; 433 continue;
442 434
443 ranges = memory->n_addrs; 435 /* ranges in cell */
436 ranges = (len >> 2) / (n_mem_addr_cells + n_mem_size_cells);
444new_range: 437new_range:
445 /* these are order-sensitive, and modify the buffer pointer */ 438 /* these are order-sensitive, and modify the buffer pointer */
446 start = read_n_cells(addr_cells, &memcell_buf); 439 start = read_n_cells(n_mem_addr_cells, &memcell_buf);
447 size = read_n_cells(size_cells, &memcell_buf); 440 size = read_n_cells(n_mem_size_cells, &memcell_buf);
448 441
449 numa_domain = of_node_numa_domain(memory); 442 numa_domain = of_node_numa_domain(memory);
450 443
@@ -497,7 +490,41 @@ static void __init setup_nonnuma(void)
497 node_set_online(0); 490 node_set_online(0);
498} 491}
499 492
500static void __init dump_numa_topology(void) 493void __init dump_numa_cpu_topology(void)
494{
495 unsigned int node;
496 unsigned int cpu, count;
497
498 if (min_common_depth == -1 || !numa_enabled)
499 return;
500
501 for_each_online_node(node) {
502 printk(KERN_INFO "Node %d CPUs:", node);
503
504 count = 0;
505 /*
506 * If we used a CPU iterator here we would miss printing
507 * the holes in the cpumap.
508 */
509 for (cpu = 0; cpu < NR_CPUS; cpu++) {
510 if (cpu_isset(cpu, numa_cpumask_lookup_table[node])) {
511 if (count == 0)
512 printk(" %u", cpu);
513 ++count;
514 } else {
515 if (count > 1)
516 printk("-%u", cpu - 1);
517 count = 0;
518 }
519 }
520
521 if (count > 1)
522 printk("-%u", NR_CPUS - 1);
523 printk("\n");
524 }
525}
526
527static void __init dump_numa_memory_topology(void)
501{ 528{
502 unsigned int node; 529 unsigned int node;
503 unsigned int count; 530 unsigned int count;
@@ -529,7 +556,6 @@ static void __init dump_numa_topology(void)
529 printk("-0x%lx", i); 556 printk("-0x%lx", i);
530 printk("\n"); 557 printk("\n");
531 } 558 }
532 return;
533} 559}
534 560
535/* 561/*
@@ -591,7 +617,7 @@ void __init do_init_bootmem(void)
591 if (parse_numa_properties()) 617 if (parse_numa_properties())
592 setup_nonnuma(); 618 setup_nonnuma();
593 else 619 else
594 dump_numa_topology(); 620 dump_numa_memory_topology();
595 621
596 register_cpu_notifier(&ppc64_numa_nb); 622 register_cpu_notifier(&ppc64_numa_nb);
597 623
@@ -730,3 +756,60 @@ static int __init early_numa(char *p)
730 return 0; 756 return 0;
731} 757}
732early_param("numa", early_numa); 758early_param("numa", early_numa);
759
760#ifdef CONFIG_MEMORY_HOTPLUG
761/*
762 * Find the node associated with a hot added memory section. Section
763 * corresponds to a SPARSEMEM section, not an LMB. It is assumed that
764 * sections are fully contained within a single LMB.
765 */
766int hot_add_scn_to_nid(unsigned long scn_addr)
767{
768 struct device_node *memory = NULL;
769 nodemask_t nodes;
770 int numa_domain = 0;
771
772 if (!numa_enabled || (min_common_depth < 0))
773 return numa_domain;
774
775 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) {
776 unsigned long start, size;
777 int ranges;
778 unsigned int *memcell_buf;
779 unsigned int len;
780
781 memcell_buf = (unsigned int *)get_property(memory, "reg", &len);
782 if (!memcell_buf || len <= 0)
783 continue;
784
785 /* ranges in cell */
786 ranges = (len >> 2) / (n_mem_addr_cells + n_mem_size_cells);
787ha_new_range:
788 start = read_n_cells(n_mem_addr_cells, &memcell_buf);
789 size = read_n_cells(n_mem_size_cells, &memcell_buf);
790 numa_domain = of_node_numa_domain(memory);
791
792 /* Domains not present at boot default to 0 */
793 if (!node_online(numa_domain))
794 numa_domain = any_online_node(NODE_MASK_ALL);
795
796 if ((scn_addr >= start) && (scn_addr < (start + size))) {
797 of_node_put(memory);
798 goto got_numa_domain;
799 }
800
801 if (--ranges) /* process all ranges in cell */
802 goto ha_new_range;
803 }
804 BUG(); /* section address should be found above */
805
806 /* Temporary code to ensure that returned node is not empty */
807got_numa_domain:
808 nodes_setall(nodes);
809 while (NODE_DATA(numa_domain)->node_spanned_pages == 0) {
810 node_clear(numa_domain, nodes);
811 numa_domain = any_online_node(nodes);
812 }
813 return numa_domain;
814}
815#endif /* CONFIG_MEMORY_HOTPLUG */
diff --git a/arch/powerpc/mm/pgtable_64.c b/arch/powerpc/mm/pgtable_64.c
index 2ffca63602c5..7b278d83739e 100644
--- a/arch/powerpc/mm/pgtable_64.c
+++ b/arch/powerpc/mm/pgtable_64.c
@@ -174,7 +174,7 @@ void __iomem * __ioremap(unsigned long addr, unsigned long size,
174 pa = addr & PAGE_MASK; 174 pa = addr & PAGE_MASK;
175 size = PAGE_ALIGN(addr + size) - pa; 175 size = PAGE_ALIGN(addr + size) - pa;
176 176
177 if (size == 0) 177 if ((size == 0) || (pa == 0))
178 return NULL; 178 return NULL;
179 179
180 if (mem_init_done) { 180 if (mem_init_done) {
diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c
index 60e852f2f8e5..ffc8ed4de62d 100644
--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -75,7 +75,7 @@ static void slb_flush_and_rebolt(void)
75 vflags = SLB_VSID_KERNEL | virtual_llp; 75 vflags = SLB_VSID_KERNEL | virtual_llp;
76 76
77 ksp_esid_data = mk_esid_data(get_paca()->kstack, 2); 77 ksp_esid_data = mk_esid_data(get_paca()->kstack, 2);
78 if ((ksp_esid_data & ESID_MASK) == KERNELBASE) 78 if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET)
79 ksp_esid_data &= ~SLB_ESID_V; 79 ksp_esid_data &= ~SLB_ESID_V;
80 80
81 /* We need to do this all in asm, so we're sure we don't touch 81 /* We need to do this all in asm, so we're sure we don't touch
@@ -87,8 +87,8 @@ static void slb_flush_and_rebolt(void)
87 /* Slot 2 - kernel stack */ 87 /* Slot 2 - kernel stack */
88 "slbmte %2,%3\n" 88 "slbmte %2,%3\n"
89 "isync" 89 "isync"
90 :: "r"(mk_vsid_data(VMALLOCBASE, vflags)), 90 :: "r"(mk_vsid_data(VMALLOC_START, vflags)),
91 "r"(mk_esid_data(VMALLOCBASE, 1)), 91 "r"(mk_esid_data(VMALLOC_START, 1)),
92 "r"(mk_vsid_data(ksp_esid_data, lflags)), 92 "r"(mk_vsid_data(ksp_esid_data, lflags)),
93 "r"(ksp_esid_data) 93 "r"(ksp_esid_data)
94 : "memory"); 94 : "memory");
@@ -134,14 +134,14 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
134 else 134 else
135 unmapped_base = TASK_UNMAPPED_BASE_USER64; 135 unmapped_base = TASK_UNMAPPED_BASE_USER64;
136 136
137 if (pc >= KERNELBASE) 137 if (is_kernel_addr(pc))
138 return; 138 return;
139 slb_allocate(pc); 139 slb_allocate(pc);
140 140
141 if (GET_ESID(pc) == GET_ESID(stack)) 141 if (GET_ESID(pc) == GET_ESID(stack))
142 return; 142 return;
143 143
144 if (stack >= KERNELBASE) 144 if (is_kernel_addr(stack))
145 return; 145 return;
146 slb_allocate(stack); 146 slb_allocate(stack);
147 147
@@ -149,7 +149,7 @@ void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
149 || (GET_ESID(stack) == GET_ESID(unmapped_base))) 149 || (GET_ESID(stack) == GET_ESID(unmapped_base)))
150 return; 150 return;
151 151
152 if (unmapped_base >= KERNELBASE) 152 if (is_kernel_addr(unmapped_base))
153 return; 153 return;
154 slb_allocate(unmapped_base); 154 slb_allocate(unmapped_base);
155} 155}
@@ -213,10 +213,10 @@ void slb_initialize(void)
213 asm volatile("isync":::"memory"); 213 asm volatile("isync":::"memory");
214 asm volatile("slbmte %0,%0"::"r" (0) : "memory"); 214 asm volatile("slbmte %0,%0"::"r" (0) : "memory");
215 asm volatile("isync; slbia; isync":::"memory"); 215 asm volatile("isync; slbia; isync":::"memory");
216 create_slbe(KERNELBASE, lflags, 0); 216 create_slbe(PAGE_OFFSET, lflags, 0);
217 217
218 /* VMALLOC space has 4K pages always for now */ 218 /* VMALLOC space has 4K pages always for now */
219 create_slbe(VMALLOCBASE, vflags, 1); 219 create_slbe(VMALLOC_START, vflags, 1);
220 220
221 /* We don't bolt the stack for the time being - we're in boot, 221 /* We don't bolt the stack for the time being - we're in boot,
222 * so the stack is in the bolted segment. By the time it goes 222 * so the stack is in the bolted segment. By the time it goes
diff --git a/arch/powerpc/mm/slb_low.S b/arch/powerpc/mm/slb_low.S
index 950ffc5848c7..d1acee38f163 100644
--- a/arch/powerpc/mm/slb_low.S
+++ b/arch/powerpc/mm/slb_low.S
@@ -37,9 +37,9 @@ _GLOBAL(slb_allocate_realmode)
37 37
38 srdi r9,r3,60 /* get region */ 38 srdi r9,r3,60 /* get region */
39 srdi r10,r3,28 /* get esid */ 39 srdi r10,r3,28 /* get esid */
40 cmpldi cr7,r9,0xc /* cmp KERNELBASE for later use */ 40 cmpldi cr7,r9,0xc /* cmp PAGE_OFFSET for later use */
41 41
42 /* r3 = address, r10 = esid, cr7 = <>KERNELBASE */ 42 /* r3 = address, r10 = esid, cr7 = <> PAGE_OFFSET */
43 blt cr7,0f /* user or kernel? */ 43 blt cr7,0f /* user or kernel? */
44 44
45 /* kernel address: proto-VSID = ESID */ 45 /* kernel address: proto-VSID = ESID */
@@ -166,7 +166,7 @@ _GLOBAL(slb_allocate_user)
166/* 166/*
167 * Finish loading of an SLB entry and return 167 * Finish loading of an SLB entry and return
168 * 168 *
169 * r3 = EA, r10 = proto-VSID, r11 = flags, clobbers r9, cr7 = <>KERNELBASE 169 * r3 = EA, r10 = proto-VSID, r11 = flags, clobbers r9, cr7 = <> PAGE_OFFSET
170 */ 170 */
171slb_finish_load: 171slb_finish_load:
172 ASM_VSID_SCRAMBLE(r10,r9) 172 ASM_VSID_SCRAMBLE(r10,r9)
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index cfbb4e1f966b..82e4951826bc 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -40,7 +40,7 @@ static int make_ste(unsigned long stab, unsigned long esid, unsigned long vsid)
40 unsigned long entry, group, old_esid, castout_entry, i; 40 unsigned long entry, group, old_esid, castout_entry, i;
41 unsigned int global_entry; 41 unsigned int global_entry;
42 struct stab_entry *ste, *castout_ste; 42 struct stab_entry *ste, *castout_ste;
43 unsigned long kernel_segment = (esid << SID_SHIFT) >= KERNELBASE; 43 unsigned long kernel_segment = (esid << SID_SHIFT) >= PAGE_OFFSET;
44 44
45 vsid_data = vsid << STE_VSID_SHIFT; 45 vsid_data = vsid << STE_VSID_SHIFT;
46 esid_data = esid << SID_SHIFT | STE_ESID_KP | STE_ESID_V; 46 esid_data = esid << SID_SHIFT | STE_ESID_KP | STE_ESID_V;
@@ -83,7 +83,7 @@ static int make_ste(unsigned long stab, unsigned long esid, unsigned long vsid)
83 } 83 }
84 84
85 /* Dont cast out the first kernel segment */ 85 /* Dont cast out the first kernel segment */
86 if ((castout_ste->esid_data & ESID_MASK) != KERNELBASE) 86 if ((castout_ste->esid_data & ESID_MASK) != PAGE_OFFSET)
87 break; 87 break;
88 88
89 castout_entry = (castout_entry + 1) & 0xf; 89 castout_entry = (castout_entry + 1) & 0xf;
@@ -122,7 +122,7 @@ static int __ste_allocate(unsigned long ea, struct mm_struct *mm)
122 unsigned long offset; 122 unsigned long offset;
123 123
124 /* Kernel or user address? */ 124 /* Kernel or user address? */
125 if (ea >= KERNELBASE) { 125 if (is_kernel_addr(ea)) {
126 vsid = get_kernel_vsid(ea); 126 vsid = get_kernel_vsid(ea);
127 } else { 127 } else {
128 if ((ea >= TASK_SIZE_USER64) || (! mm)) 128 if ((ea >= TASK_SIZE_USER64) || (! mm))
@@ -133,7 +133,7 @@ static int __ste_allocate(unsigned long ea, struct mm_struct *mm)
133 133
134 stab_entry = make_ste(get_paca()->stab_addr, GET_ESID(ea), vsid); 134 stab_entry = make_ste(get_paca()->stab_addr, GET_ESID(ea), vsid);
135 135
136 if (ea < KERNELBASE) { 136 if (!is_kernel_addr(ea)) {
137 offset = __get_cpu_var(stab_cache_ptr); 137 offset = __get_cpu_var(stab_cache_ptr);
138 if (offset < NR_STAB_CACHE_ENTRIES) 138 if (offset < NR_STAB_CACHE_ENTRIES)
139 __get_cpu_var(stab_cache[offset++]) = stab_entry; 139 __get_cpu_var(stab_cache[offset++]) = stab_entry;
@@ -190,7 +190,7 @@ void switch_stab(struct task_struct *tsk, struct mm_struct *mm)
190 entry++, ste++) { 190 entry++, ste++) {
191 unsigned long ea; 191 unsigned long ea;
192 ea = ste->esid_data & ESID_MASK; 192 ea = ste->esid_data & ESID_MASK;
193 if (ea < KERNELBASE) { 193 if (!is_kernel_addr(ea)) {
194 ste->esid_data = 0; 194 ste->esid_data = 0;
195 } 195 }
196 } 196 }
@@ -251,7 +251,7 @@ void stabs_alloc(void)
251 panic("Unable to allocate segment table for CPU %d.\n", 251 panic("Unable to allocate segment table for CPU %d.\n",
252 cpu); 252 cpu);
253 253
254 newstab += KERNELBASE; 254 newstab = (unsigned long)__va(newstab);
255 255
256 memset((void *)newstab, 0, HW_PAGE_SIZE); 256 memset((void *)newstab, 0, HW_PAGE_SIZE);
257 257
@@ -270,11 +270,11 @@ void stabs_alloc(void)
270 */ 270 */
271void stab_initialize(unsigned long stab) 271void stab_initialize(unsigned long stab)
272{ 272{
273 unsigned long vsid = get_kernel_vsid(KERNELBASE); 273 unsigned long vsid = get_kernel_vsid(PAGE_OFFSET);
274 unsigned long stabreal; 274 unsigned long stabreal;
275 275
276 asm volatile("isync; slbia; isync":::"memory"); 276 asm volatile("isync; slbia; isync":::"memory");
277 make_ste(stab, GET_ESID(KERNELBASE), vsid); 277 make_ste(stab, GET_ESID(PAGE_OFFSET), vsid);
278 278
279 /* Order update */ 279 /* Order update */
280 asm volatile("sync":::"memory"); 280 asm volatile("sync":::"memory");
@@ -288,11 +288,6 @@ void stab_initialize(unsigned long stab)
288 return; 288 return;
289 } 289 }
290#endif /* CONFIG_PPC_ISERIES */ 290#endif /* CONFIG_PPC_ISERIES */
291#ifdef CONFIG_PPC_PSERIES 291
292 if (platform_is_lpar()) {
293 plpar_hcall_norets(H_SET_ASR, stabreal);
294 return;
295 }
296#endif
297 mtspr(SPRN_ASR, stabreal); 292 mtspr(SPRN_ASR, stabreal);
298} 293}
diff --git a/arch/powerpc/mm/tlb_64.c b/arch/powerpc/mm/tlb_64.c
index 859d29a0cac5..bb3afb6e6317 100644
--- a/arch/powerpc/mm/tlb_64.c
+++ b/arch/powerpc/mm/tlb_64.c
@@ -168,7 +168,7 @@ void hpte_update(struct mm_struct *mm, unsigned long addr,
168 batch->mm = mm; 168 batch->mm = mm;
169 batch->psize = psize; 169 batch->psize = psize;
170 } 170 }
171 if (addr < KERNELBASE) { 171 if (!is_kernel_addr(addr)) {
172 vsid = get_vsid(mm->context.id, addr); 172 vsid = get_vsid(mm->context.id, addr);
173 WARN_ON(vsid == 0); 173 WARN_ON(vsid == 0);
174 } else 174 } else
diff --git a/arch/powerpc/oprofile/Makefile b/arch/powerpc/oprofile/Makefile
index 0782d0cca89c..554cd7c75321 100644
--- a/arch/powerpc/oprofile/Makefile
+++ b/arch/powerpc/oprofile/Makefile
@@ -9,3 +9,4 @@ DRIVER_OBJS := $(addprefix ../../../drivers/oprofile/, \
9oprofile-y := $(DRIVER_OBJS) common.o 9oprofile-y := $(DRIVER_OBJS) common.o
10oprofile-$(CONFIG_PPC64) += op_model_rs64.o op_model_power4.o 10oprofile-$(CONFIG_PPC64) += op_model_rs64.o op_model_power4.o
11oprofile-$(CONFIG_FSL_BOOKE) += op_model_fsl_booke.o 11oprofile-$(CONFIG_FSL_BOOKE) += op_model_fsl_booke.o
12oprofile-$(CONFIG_PPC32) += op_model_7450.o
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index af2c05d20ba5..cc2535be3a73 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -14,9 +14,6 @@
14 */ 14 */
15 15
16#include <linux/oprofile.h> 16#include <linux/oprofile.h>
17#ifndef __powerpc64__
18#include <linux/slab.h>
19#endif /* ! __powerpc64__ */
20#include <linux/init.h> 17#include <linux/init.h>
21#include <linux/smp.h> 18#include <linux/smp.h>
22#include <linux/errno.h> 19#include <linux/errno.h>
@@ -31,10 +28,6 @@ static struct op_powerpc_model *model;
31static struct op_counter_config ctr[OP_MAX_COUNTER]; 28static struct op_counter_config ctr[OP_MAX_COUNTER];
32static struct op_system_config sys; 29static struct op_system_config sys;
33 30
34#ifndef __powerpc64__
35static char *cpu_type;
36#endif /* ! __powerpc64__ */
37
38static void op_handle_interrupt(struct pt_regs *regs) 31static void op_handle_interrupt(struct pt_regs *regs)
39{ 32{
40 model->handle_interrupt(regs, ctr); 33 model->handle_interrupt(regs, ctr);
@@ -53,14 +46,7 @@ static int op_powerpc_setup(void)
53 model->reg_setup(ctr, &sys, model->num_counters); 46 model->reg_setup(ctr, &sys, model->num_counters);
54 47
55 /* Configure the registers on all cpus. */ 48 /* Configure the registers on all cpus. */
56#ifdef __powerpc64__
57 on_each_cpu(model->cpu_setup, NULL, 0, 1); 49 on_each_cpu(model->cpu_setup, NULL, 0, 1);
58#else /* __powerpc64__ */
59#if 0
60 /* FIXME: Make multi-cpu work */
61 on_each_cpu(model->reg_setup, NULL, 0, 1);
62#endif
63#endif /* __powerpc64__ */
64 50
65 return 0; 51 return 0;
66} 52}
@@ -95,7 +81,7 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root)
95{ 81{
96 int i; 82 int i;
97 83
98#ifdef __powerpc64__ 84#ifdef CONFIG_PPC64
99 /* 85 /*
100 * There is one mmcr0, mmcr1 and mmcra for setting the events for 86 * There is one mmcr0, mmcr1 and mmcra for setting the events for
101 * all of the counters. 87 * all of the counters.
@@ -103,7 +89,7 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root)
103 oprofilefs_create_ulong(sb, root, "mmcr0", &sys.mmcr0); 89 oprofilefs_create_ulong(sb, root, "mmcr0", &sys.mmcr0);
104 oprofilefs_create_ulong(sb, root, "mmcr1", &sys.mmcr1); 90 oprofilefs_create_ulong(sb, root, "mmcr1", &sys.mmcr1);
105 oprofilefs_create_ulong(sb, root, "mmcra", &sys.mmcra); 91 oprofilefs_create_ulong(sb, root, "mmcra", &sys.mmcra);
106#endif /* __powerpc64__ */ 92#endif
107 93
108 for (i = 0; i < model->num_counters; ++i) { 94 for (i = 0; i < model->num_counters; ++i) {
109 struct dentry *dir; 95 struct dentry *dir;
@@ -115,65 +101,68 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root)
115 oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled); 101 oprofilefs_create_ulong(sb, dir, "enabled", &ctr[i].enabled);
116 oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event); 102 oprofilefs_create_ulong(sb, dir, "event", &ctr[i].event);
117 oprofilefs_create_ulong(sb, dir, "count", &ctr[i].count); 103 oprofilefs_create_ulong(sb, dir, "count", &ctr[i].count);
118#ifdef __powerpc64__ 104
119 /* 105 /*
120 * We dont support per counter user/kernel selection, but 106 * Classic PowerPC doesn't support per-counter
121 * we leave the entries because userspace expects them 107 * control like this, but the options are
108 * expected, so they remain. For Freescale
109 * Book-E style performance monitors, we do
110 * support them.
122 */ 111 */
123#endif /* __powerpc64__ */
124 oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel); 112 oprofilefs_create_ulong(sb, dir, "kernel", &ctr[i].kernel);
125 oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user); 113 oprofilefs_create_ulong(sb, dir, "user", &ctr[i].user);
126 114
127#ifndef __powerpc64__
128 /* FIXME: Not sure if this is used */
129#endif /* ! __powerpc64__ */
130 oprofilefs_create_ulong(sb, dir, "unit_mask", &ctr[i].unit_mask); 115 oprofilefs_create_ulong(sb, dir, "unit_mask", &ctr[i].unit_mask);
131 } 116 }
132 117
133 oprofilefs_create_ulong(sb, root, "enable_kernel", &sys.enable_kernel); 118 oprofilefs_create_ulong(sb, root, "enable_kernel", &sys.enable_kernel);
134 oprofilefs_create_ulong(sb, root, "enable_user", &sys.enable_user); 119 oprofilefs_create_ulong(sb, root, "enable_user", &sys.enable_user);
135#ifdef __powerpc64__ 120#ifdef CONFIG_PPC64
136 oprofilefs_create_ulong(sb, root, "backtrace_spinlocks", 121 oprofilefs_create_ulong(sb, root, "backtrace_spinlocks",
137 &sys.backtrace_spinlocks); 122 &sys.backtrace_spinlocks);
138#endif /* __powerpc64__ */ 123#endif
139 124
140 /* Default to tracing both kernel and user */ 125 /* Default to tracing both kernel and user */
141 sys.enable_kernel = 1; 126 sys.enable_kernel = 1;
142 sys.enable_user = 1; 127 sys.enable_user = 1;
143#ifdef __powerpc64__ 128#ifdef CONFIG_PPC64
144 /* Turn on backtracing through spinlocks by default */ 129 /* Turn on backtracing through spinlocks by default */
145 sys.backtrace_spinlocks = 1; 130 sys.backtrace_spinlocks = 1;
146#endif /* __powerpc64__ */ 131#endif
147 132
148 return 0; 133 return 0;
149} 134}
150 135
151int __init oprofile_arch_init(struct oprofile_operations *ops) 136int __init oprofile_arch_init(struct oprofile_operations *ops)
152{ 137{
153#ifndef __powerpc64__ 138 if (!cur_cpu_spec->oprofile_cpu_type)
154#ifdef CONFIG_FSL_BOOKE 139 return -ENODEV;
155 model = &op_model_fsl_booke; 140
141 switch (cur_cpu_spec->oprofile_type) {
142#ifdef CONFIG_PPC64
143 case PPC_OPROFILE_RS64:
144 model = &op_model_rs64;
145 break;
146 case PPC_OPROFILE_POWER4:
147 model = &op_model_power4;
148 break;
156#else 149#else
157 return -ENODEV; 150 case PPC_OPROFILE_G4:
151 model = &op_model_7450;
152 break;
158#endif 153#endif
154#ifdef CONFIG_FSL_BOOKE
155 case PPC_OPROFILE_BOOKE:
156 model = &op_model_fsl_booke;
157 break;
158#endif
159 default:
160 return -ENODEV;
161 }
159 162
160 cpu_type = kmalloc(32, GFP_KERNEL);
161 if (NULL == cpu_type)
162 return -ENOMEM;
163
164 sprintf(cpu_type, "ppc/%s", cur_cpu_spec->cpu_name);
165
166 model->num_counters = cur_cpu_spec->num_pmcs;
167
168 ops->cpu_type = cpu_type;
169#else /* __powerpc64__ */
170 if (!cur_cpu_spec->oprofile_model || !cur_cpu_spec->oprofile_cpu_type)
171 return -ENODEV;
172 model = cur_cpu_spec->oprofile_model;
173 model->num_counters = cur_cpu_spec->num_pmcs; 163 model->num_counters = cur_cpu_spec->num_pmcs;
174 164
175 ops->cpu_type = cur_cpu_spec->oprofile_cpu_type; 165 ops->cpu_type = cur_cpu_spec->oprofile_cpu_type;
176#endif /* __powerpc64__ */
177 ops->create_files = op_powerpc_create_files; 166 ops->create_files = op_powerpc_create_files;
178 ops->setup = op_powerpc_setup; 167 ops->setup = op_powerpc_setup;
179 ops->shutdown = op_powerpc_shutdown; 168 ops->shutdown = op_powerpc_shutdown;
@@ -188,8 +177,4 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
188 177
189void oprofile_arch_exit(void) 178void oprofile_arch_exit(void)
190{ 179{
191#ifndef __powerpc64__
192 kfree(cpu_type);
193 cpu_type = NULL;
194#endif /* ! __powerpc64__ */
195} 180}
diff --git a/arch/powerpc/oprofile/op_model_7450.c b/arch/powerpc/oprofile/op_model_7450.c
new file mode 100644
index 000000000000..32abfdbb0eb1
--- /dev/null
+++ b/arch/powerpc/oprofile/op_model_7450.c
@@ -0,0 +1,206 @@
1/*
2 * oprofile/op_model_7450.c
3 *
4 * Freescale 745x/744x oprofile support, based on fsl_booke support
5 * Copyright (C) 2004 Anton Blanchard <anton@au.ibm.com>, IBM
6 *
7 * Copyright (c) 2004 Freescale Semiconductor, Inc
8 *
9 * Author: Andy Fleming
10 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
16 */
17
18#include <linux/oprofile.h>
19#include <linux/init.h>
20#include <linux/smp.h>
21#include <asm/ptrace.h>
22#include <asm/system.h>
23#include <asm/processor.h>
24#include <asm/cputable.h>
25#include <asm/page.h>
26#include <asm/pmc.h>
27#include <asm/oprofile_impl.h>
28
29static unsigned long reset_value[OP_MAX_COUNTER];
30
31static int oprofile_running;
32static u32 mmcr0_val, mmcr1_val, mmcr2_val;
33
34#define MMCR0_PMC1_SHIFT 6
35#define MMCR0_PMC2_SHIFT 0
36#define MMCR1_PMC3_SHIFT 27
37#define MMCR1_PMC4_SHIFT 22
38#define MMCR1_PMC5_SHIFT 17
39#define MMCR1_PMC6_SHIFT 11
40
41#define mmcr0_event1(event) \
42 ((event << MMCR0_PMC1_SHIFT) & MMCR0_PMC1SEL)
43#define mmcr0_event2(event) \
44 ((event << MMCR0_PMC2_SHIFT) & MMCR0_PMC2SEL)
45
46#define mmcr1_event3(event) \
47 ((event << MMCR1_PMC3_SHIFT) & MMCR1_PMC3SEL)
48#define mmcr1_event4(event) \
49 ((event << MMCR1_PMC4_SHIFT) & MMCR1_PMC4SEL)
50#define mmcr1_event5(event) \
51 ((event << MMCR1_PMC5_SHIFT) & MMCR1_PMC5SEL)
52#define mmcr1_event6(event) \
53 ((event << MMCR1_PMC6_SHIFT) & MMCR1_PMC6SEL)
54
55#define MMCR0_INIT (MMCR0_FC | MMCR0_FCS | MMCR0_FCP | MMCR0_FCM1 | MMCR0_FCM0)
56
57/* Unfreezes the counters on this CPU, enables the interrupt,
58 * enables the counters to trigger the interrupt, and sets the
59 * counters to only count when the mark bit is not set.
60 */
61static void pmc_start_ctrs(void)
62{
63 u32 mmcr0 = mfspr(SPRN_MMCR0);
64
65 mmcr0 &= ~(MMCR0_FC | MMCR0_FCM0);
66 mmcr0 |= (MMCR0_FCECE | MMCR0_PMC1CE | MMCR0_PMCnCE | MMCR0_PMXE);
67
68 mtspr(SPRN_MMCR0, mmcr0);
69}
70
71/* Disables the counters on this CPU, and freezes them */
72static void pmc_stop_ctrs(void)
73{
74 u32 mmcr0 = mfspr(SPRN_MMCR0);
75
76 mmcr0 |= MMCR0_FC;
77 mmcr0 &= ~(MMCR0_FCECE | MMCR0_PMC1CE | MMCR0_PMCnCE | MMCR0_PMXE);
78
79 mtspr(SPRN_MMCR0, mmcr0);
80}
81
82/* Configures the counters on this CPU based on the global
83 * settings */
84static void fsl7450_cpu_setup(void *unused)
85{
86 /* freeze all counters */
87 pmc_stop_ctrs();
88
89 mtspr(SPRN_MMCR0, mmcr0_val);
90 mtspr(SPRN_MMCR1, mmcr1_val);
91 mtspr(SPRN_MMCR2, mmcr2_val);
92}
93
94#define NUM_CTRS 6
95
96/* Configures the global settings for the countes on all CPUs. */
97static void fsl7450_reg_setup(struct op_counter_config *ctr,
98 struct op_system_config *sys,
99 int num_ctrs)
100{
101 int i;
102
103 /* Our counters count up, and "count" refers to
104 * how much before the next interrupt, and we interrupt
105 * on overflow. So we calculate the starting value
106 * which will give us "count" until overflow.
107 * Then we set the events on the enabled counters */
108 for (i = 0; i < NUM_CTRS; ++i)
109 reset_value[i] = 0x80000000UL - ctr[i].count;
110
111 /* Set events for Counters 1 & 2 */
112 mmcr0_val = MMCR0_INIT | mmcr0_event1(ctr[0].event)
113 | mmcr0_event2(ctr[1].event);
114
115 /* Setup user/kernel bits */
116 if (sys->enable_kernel)
117 mmcr0_val &= ~(MMCR0_FCS);
118
119 if (sys->enable_user)
120 mmcr0_val &= ~(MMCR0_FCP);
121
122 /* Set events for Counters 3-6 */
123 mmcr1_val = mmcr1_event3(ctr[2].event)
124 | mmcr1_event4(ctr[3].event)
125 | mmcr1_event5(ctr[4].event)
126 | mmcr1_event6(ctr[5].event);
127
128 mmcr2_val = 0;
129}
130
131/* Sets the counters on this CPU to the chosen values, and starts them */
132static void fsl7450_start(struct op_counter_config *ctr)
133{
134 int i;
135
136 mtmsr(mfmsr() | MSR_PMM);
137
138 for (i = 0; i < NUM_CTRS; ++i) {
139 if (ctr[i].enabled)
140 ctr_write(i, reset_value[i]);
141 else
142 ctr_write(i, 0);
143 }
144
145 /* Clear the freeze bit, and enable the interrupt.
146 * The counters won't actually start until the rfi clears
147 * the PMM bit */
148 pmc_start_ctrs();
149
150 oprofile_running = 1;
151}
152
153/* Stop the counters on this CPU */
154static void fsl7450_stop(void)
155{
156 /* freeze counters */
157 pmc_stop_ctrs();
158
159 oprofile_running = 0;
160
161 mb();
162}
163
164
165/* Handle the interrupt on this CPU, and log a sample for each
166 * event that triggered the interrupt */
167static void fsl7450_handle_interrupt(struct pt_regs *regs,
168 struct op_counter_config *ctr)
169{
170 unsigned long pc;
171 int is_kernel;
172 int val;
173 int i;
174
175 /* set the PMM bit (see comment below) */
176 mtmsr(mfmsr() | MSR_PMM);
177
178 pc = mfspr(SPRN_SIAR);
179 is_kernel = (pc >= KERNELBASE);
180
181 for (i = 0; i < NUM_CTRS; ++i) {
182 val = ctr_read(i);
183 if (val < 0) {
184 if (oprofile_running && ctr[i].enabled) {
185 oprofile_add_pc(pc, is_kernel, i);
186 ctr_write(i, reset_value[i]);
187 } else {
188 ctr_write(i, 0);
189 }
190 }
191 }
192
193 /* The freeze bit was set by the interrupt. */
194 /* Clear the freeze bit, and reenable the interrupt.
195 * The counters won't actually start until the rfi clears
196 * the PMM bit */
197 pmc_start_ctrs();
198}
199
200struct op_powerpc_model op_model_7450= {
201 .reg_setup = fsl7450_reg_setup,
202 .cpu_setup = fsl7450_cpu_setup,
203 .start = fsl7450_start,
204 .stop = fsl7450_stop,
205 .handle_interrupt = fsl7450_handle_interrupt,
206};
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index a3401b46f3ba..659a021da0c7 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -252,7 +252,7 @@ static unsigned long get_pc(struct pt_regs *regs)
252 return (unsigned long)__va(pc); 252 return (unsigned long)__va(pc);
253 253
254 /* Not sure where we were */ 254 /* Not sure where we were */
255 if (pc < KERNELBASE) 255 if (!is_kernel_addr(pc))
256 /* function descriptor madness */ 256 /* function descriptor madness */
257 return *((unsigned long *)kernel_unknown_bucket); 257 return *((unsigned long *)kernel_unknown_bucket);
258 258
@@ -264,7 +264,7 @@ static int get_kernel(unsigned long pc)
264 int is_kernel; 264 int is_kernel;
265 265
266 if (!mmcra_has_sihv) { 266 if (!mmcra_has_sihv) {
267 is_kernel = (pc >= KERNELBASE); 267 is_kernel = is_kernel_addr(pc);
268 } else { 268 } else {
269 unsigned long mmcra = mfspr(SPRN_MMCRA); 269 unsigned long mmcra = mfspr(SPRN_MMCRA);
270 is_kernel = ((mmcra & MMCRA_SIPR) == 0); 270 is_kernel = ((mmcra & MMCRA_SIPR) == 0);
diff --git a/arch/powerpc/oprofile/op_model_rs64.c b/arch/powerpc/oprofile/op_model_rs64.c
index e010b85996e8..5c909ee609fe 100644
--- a/arch/powerpc/oprofile/op_model_rs64.c
+++ b/arch/powerpc/oprofile/op_model_rs64.c
@@ -178,7 +178,6 @@ static void rs64_handle_interrupt(struct pt_regs *regs,
178 int val; 178 int val;
179 int i; 179 int i;
180 unsigned long pc = mfspr(SPRN_SIAR); 180 unsigned long pc = mfspr(SPRN_SIAR);
181 int is_kernel = (pc >= KERNELBASE);
182 181
183 /* set the PMM bit (see comment below) */ 182 /* set the PMM bit (see comment below) */
184 mtmsrd(mfmsr() | MSR_PMM); 183 mtmsrd(mfmsr() | MSR_PMM);
@@ -187,7 +186,7 @@ static void rs64_handle_interrupt(struct pt_regs *regs,
187 val = ctr_read(i); 186 val = ctr_read(i);
188 if (val < 0) { 187 if (val < 0) {
189 if (ctr[i].enabled) { 188 if (ctr[i].enabled) {
190 oprofile_add_pc(pc, is_kernel, i); 189 oprofile_add_pc(pc, is_kernel_addr(pc), i);
191 ctr_write(i, reset_value[i]); 190 ctr_write(i, reset_value[i]);
192 } else { 191 } else {
193 ctr_write(i, 0); 192 ctr_write(i, 0);
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
new file mode 100644
index 000000000000..7675e675dce1
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -0,0 +1,27 @@
1menu "Platform support"
2 depends on PPC_83xx
3
4choice
5 prompt "Machine Type"
6 default MPC834x_SYS
7
8config MPC834x_SYS
9 bool "Freescale MPC834x SYS"
10 select DEFAULT_UIMAGE
11 help
12 This option enables support for the MPC 834x SYS evaluation board.
13
14 Be aware that PCI buses can only function when SYS board is plugged
15 into the PIB (Platform IO Board) board from Freescale which provide
16 3 PCI slots. The PIBs PCI initialization is the bootloader's
17 responsiblilty.
18
19endchoice
20
21config MPC834x
22 bool
23 select PPC_UDBG_16550
24 select PPC_INDIRECT_PCI
25 default y if MPC834x_SYS
26
27endmenu
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
new file mode 100644
index 000000000000..9d8b28ef3343
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -0,0 +1,4 @@
1#
2# Makefile for the PowerPC 83xx linux kernel.
3#
4obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o pci.o
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c
new file mode 100644
index 000000000000..2098dd05a773
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.c
@@ -0,0 +1,243 @@
1/*
2 * arch/powerpc/platforms/83xx/mpc834x_sys.c
3 *
4 * MPC834x SYS board specific routines
5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14#include <linux/config.h>
15#include <linux/stddef.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/errno.h>
19#include <linux/reboot.h>
20#include <linux/pci.h>
21#include <linux/kdev_t.h>
22#include <linux/major.h>
23#include <linux/console.h>
24#include <linux/delay.h>
25#include <linux/seq_file.h>
26#include <linux/root_dev.h>
27#include <linux/module.h>
28#include <linux/fsl_devices.h>
29
30#include <asm/system.h>
31#include <asm/pgtable.h>
32#include <asm/page.h>
33#include <asm/atomic.h>
34#include <asm/time.h>
35#include <asm/io.h>
36#include <asm/machdep.h>
37#include <asm/ipic.h>
38#include <asm/bootinfo.h>
39#include <asm/pci-bridge.h>
40#include <asm/mpc83xx.h>
41#include <asm/irq.h>
42#include <mm/mmu_decl.h>
43#include <asm/prom.h>
44#include <asm/udbg.h>
45#include <sysdev/fsl_soc.h>
46
47#include "mpc83xx.h"
48
49#ifndef CONFIG_PCI
50unsigned long isa_io_base = 0;
51unsigned long isa_mem_base = 0;
52#endif
53
54#ifdef CONFIG_PCI
55extern int mpc83xx_pci2_busno;
56
57static int
58mpc83xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
59{
60 static char pci_irq_table[][4] =
61 /*
62 * PCI IDSEL/INTPIN->INTLINE
63 * A B C D
64 */
65 {
66 {PIRQA, PIRQB, PIRQC, PIRQD}, /* idsel 0x11 */
67 {PIRQC, PIRQD, PIRQA, PIRQB}, /* idsel 0x12 */
68 {PIRQD, PIRQA, PIRQB, PIRQC}, /* idsel 0x13 */
69 {0, 0, 0, 0},
70 {PIRQA, PIRQB, PIRQC, PIRQD}, /* idsel 0x15 */
71 {PIRQD, PIRQA, PIRQB, PIRQC}, /* idsel 0x16 */
72 {PIRQC, PIRQD, PIRQA, PIRQB}, /* idsel 0x17 */
73 {PIRQB, PIRQC, PIRQD, PIRQA}, /* idsel 0x18 */
74 {0, 0, 0, 0}, /* idsel 0x19 */
75 {0, 0, 0, 0}, /* idsel 0x20 */
76 };
77
78 const long min_idsel = 0x11, max_idsel = 0x20, irqs_per_slot = 4;
79 return PCI_IRQ_TABLE_LOOKUP;
80}
81
82static int
83mpc83xx_exclude_device(u_char bus, u_char devfn)
84{
85 if (bus == 0 && PCI_SLOT(devfn) == 0)
86 return PCIBIOS_DEVICE_NOT_FOUND;
87 if (mpc83xx_pci2_busno)
88 if (bus == (mpc83xx_pci2_busno) && PCI_SLOT(devfn) == 0)
89 return PCIBIOS_DEVICE_NOT_FOUND;
90 return PCIBIOS_SUCCESSFUL;
91}
92#endif /* CONFIG_PCI */
93
94/* ************************************************************************
95 *
96 * Setup the architecture
97 *
98 */
99static void __init
100mpc834x_sys_setup_arch(void)
101{
102 struct device_node *np;
103
104 if (ppc_md.progress)
105 ppc_md.progress("mpc834x_sys_setup_arch()", 0);
106
107 np = of_find_node_by_type(NULL, "cpu");
108 if (np != 0) {
109 unsigned int *fp = (int *) get_property(np, "clock-frequency", NULL);
110 if (fp != 0)
111 loops_per_jiffy = *fp / HZ;
112 else
113 loops_per_jiffy = 50000000 / HZ;
114 of_node_put(np);
115 }
116
117#ifdef CONFIG_PCI
118 for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
119 add_bridge(np);
120
121 ppc_md.pci_swizzle = common_swizzle;
122 ppc_md.pci_map_irq = mpc83xx_map_irq;
123 ppc_md.pci_exclude_device = mpc83xx_exclude_device;
124#endif
125
126#ifdef CONFIG_ROOT_NFS
127 ROOT_DEV = Root_NFS;
128#else
129 ROOT_DEV = Root_HDA1;
130#endif
131}
132
133void __init
134mpc834x_sys_init_IRQ(void)
135{
136 u8 senses[8] = {
137 0, /* EXT 0 */
138 IRQ_SENSE_LEVEL, /* EXT 1 */
139 IRQ_SENSE_LEVEL, /* EXT 2 */
140 0, /* EXT 3 */
141#ifdef CONFIG_PCI
142 IRQ_SENSE_LEVEL, /* EXT 4 */
143 IRQ_SENSE_LEVEL, /* EXT 5 */
144 IRQ_SENSE_LEVEL, /* EXT 6 */
145 IRQ_SENSE_LEVEL, /* EXT 7 */
146#else
147 0, /* EXT 4 */
148 0, /* EXT 5 */
149 0, /* EXT 6 */
150 0, /* EXT 7 */
151#endif
152 };
153
154 ipic_init(get_immrbase() + 0x00700, 0, 0, senses, 8);
155
156 /* Initialize the default interrupt mapping priorities,
157 * in case the boot rom changed something on us.
158 */
159 ipic_set_default_priority();
160}
161
162#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
163extern ulong ds1374_get_rtc_time(void);
164extern int ds1374_set_rtc_time(ulong);
165
166static int __init
167mpc834x_rtc_hookup(void)
168{
169 struct timespec tv;
170
171 ppc_md.get_rtc_time = ds1374_get_rtc_time;
172 ppc_md.set_rtc_time = ds1374_set_rtc_time;
173
174 tv.tv_nsec = 0;
175 tv.tv_sec = (ppc_md.get_rtc_time)();
176 do_settimeofday(&tv);
177
178 return 0;
179}
180late_initcall(mpc834x_rtc_hookup);
181#endif
182
183static void
184mpc83xx_restart(char *cmd)
185{
186#define RST_OFFSET 0x00000900
187#define RST_PROT_REG 0x00000018
188#define RST_CTRL_REG 0x0000001c
189 __be32 __iomem *reg;
190
191 // map reset register space
192 reg = ioremap(get_immrbase() + 0x900, 0xff);
193
194 local_irq_disable();
195
196 /* enable software reset "RSTE" */
197 out_be32(reg + (RST_PROT_REG >> 2), 0x52535445);
198
199 /* set software hard reset */
200 out_be32(reg + (RST_CTRL_REG >> 2), 0x52535445);
201 for(;;);
202}
203
204static long __init
205mpc83xx_time_init(void)
206{
207#define SPCR_OFFSET 0x00000110
208#define SPCR_TBEN 0x00400000
209 __be32 __iomem *spcr = ioremap(get_immrbase() + SPCR_OFFSET, 4);
210 __be32 tmp;
211
212 tmp = in_be32(spcr);
213 out_be32(spcr, tmp|SPCR_TBEN);
214
215 iounmap(spcr);
216
217 return 0;
218}
219void __init
220platform_init(void)
221{
222 /* setup the PowerPC module struct */
223 ppc_md.setup_arch = mpc834x_sys_setup_arch;
224
225 ppc_md.init_IRQ = mpc834x_sys_init_IRQ;
226 ppc_md.get_irq = ipic_get_irq;
227
228 ppc_md.restart = mpc83xx_restart;
229
230 ppc_md.time_init = mpc83xx_time_init;
231 ppc_md.set_rtc_time = NULL;
232 ppc_md.get_rtc_time = NULL;
233 ppc_md.calibrate_decr = generic_calibrate_decr;
234
235 ppc_md.progress = udbg_progress;
236
237 if (ppc_md.progress)
238 ppc_md.progress("mpc834x_sys_init(): exit", 0);
239
240 return;
241}
242
243
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.h b/arch/powerpc/platforms/83xx/mpc834x_sys.h
new file mode 100644
index 000000000000..e4ca39f6a862
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.h
@@ -0,0 +1,23 @@
1/*
2 * arch/powerppc/platforms/83xx/mpc834x_sys.h
3 *
4 * MPC834X SYS common board definitions
5 *
6 * Maintainer: Kumar Gala <galak@kernel.crashing.org>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15#ifndef __MACH_MPC83XX_SYS_H__
16#define __MACH_MPC83XX_SYS_H__
17
18#define PIRQA MPC83xx_IRQ_EXT4
19#define PIRQB MPC83xx_IRQ_EXT5
20#define PIRQC MPC83xx_IRQ_EXT6
21#define PIRQD MPC83xx_IRQ_EXT7
22
23#endif /* __MACH_MPC83XX_SYS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
new file mode 100644
index 000000000000..ce9e66abef24
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -0,0 +1,14 @@
1#ifndef __MPC83XX_H__
2#define __MPC83XX_H__
3
4#include <linux/init.h>
5#include <linux/device.h>
6
7/*
8 * Declaration for the various functions exported by the
9 * mpc83xx_* files. Mostly for use by mpc83xx_setup
10 */
11
12extern int add_bridge(struct device_node *dev);
13
14#endif /* __MPC83XX_H__ */
diff --git a/arch/powerpc/platforms/83xx/pci.c b/arch/powerpc/platforms/83xx/pci.c
new file mode 100644
index 000000000000..469cdacc5bd4
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/pci.c
@@ -0,0 +1,99 @@
1/*
2 * FSL SoC setup code
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/config.h>
13#include <linux/stddef.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/errno.h>
17#include <linux/pci.h>
18#include <linux/delay.h>
19#include <linux/irq.h>
20#include <linux/module.h>
21
22#include <asm/system.h>
23#include <asm/atomic.h>
24#include <asm/io.h>
25#include <asm/pci-bridge.h>
26#include <asm/prom.h>
27#include <sysdev/fsl_soc.h>
28
29#undef DEBUG
30
31#ifdef DEBUG
32#define DBG(x...) printk(x)
33#else
34#define DBG(x...)
35#endif
36
37int mpc83xx_pci2_busno;
38
39#ifdef CONFIG_PCI
40int __init add_bridge(struct device_node *dev)
41{
42 int len;
43 struct pci_controller *hose;
44 struct resource rsrc;
45 int *bus_range;
46 int primary = 1, has_address = 0;
47 phys_addr_t immr = get_immrbase();
48
49 DBG("Adding PCI host bridge %s\n", dev->full_name);
50
51 /* Fetch host bridge registers address */
52 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
53
54 /* Get bus range if any */
55 bus_range = (int *) get_property(dev, "bus-range", &len);
56 if (bus_range == NULL || len < 2 * sizeof(int)) {
57 printk(KERN_WARNING "Can't get bus-range for %s, assume"
58 " bus 0\n", dev->full_name);
59 }
60
61 hose = pcibios_alloc_controller();
62 if (!hose)
63 return -ENOMEM;
64 hose->arch_data = dev;
65 hose->set_cfg_type = 1;
66
67 hose->first_busno = bus_range ? bus_range[0] : 0;
68 hose->last_busno = bus_range ? bus_range[1] : 0xff;
69
70 /* MPC83xx supports up to two host controllers one at 0x8500 from immrbar
71 * the other at 0x8600, we consider the 0x8500 the primary controller
72 */
73 /* PCI 1 */
74 if ((rsrc.start & 0xfffff) == 0x8500) {
75 setup_indirect_pci(hose, immr + 0x8300, immr + 0x8304);
76 }
77 /* PCI 2*/
78 if ((rsrc.start & 0xfffff) == 0x8600) {
79 setup_indirect_pci(hose, immr + 0x8380, immr + 0x8384);
80 primary = 0;
81 hose->bus_offset = hose->first_busno;
82 mpc83xx_pci2_busno = hose->first_busno;
83 }
84
85 printk(KERN_INFO "Found MPC83xx PCI host bridge at 0x%08lx. "
86 "Firmware bus number: %d->%d\n",
87 rsrc.start, hose->first_busno, hose->last_busno);
88
89 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
90 hose, hose->cfg_addr, hose->cfg_data);
91
92 /* Interpret the "ranges" property */
93 /* This also maps the I/O region and sets isa_io/mem_base */
94 pci_process_bridge_OF_ranges(hose, dev, primary);
95
96 return 0;
97}
98
99#endif
diff --git a/arch/powerpc/platforms/Makefile b/arch/powerpc/platforms/Makefile
index 8836b3a00668..04073fd987ec 100644
--- a/arch/powerpc/platforms/Makefile
+++ b/arch/powerpc/platforms/Makefile
@@ -7,6 +7,7 @@ endif
7endif 7endif
8obj-$(CONFIG_PPC_CHRP) += chrp/ 8obj-$(CONFIG_PPC_CHRP) += chrp/
9obj-$(CONFIG_4xx) += 4xx/ 9obj-$(CONFIG_4xx) += 4xx/
10obj-$(CONFIG_PPC_83xx) += 83xx/
10obj-$(CONFIG_85xx) += 85xx/ 11obj-$(CONFIG_85xx) += 85xx/
11obj-$(CONFIG_PPC_PSERIES) += pseries/ 12obj-$(CONFIG_PPC_PSERIES) += pseries/
12obj-$(CONFIG_PPC_ISERIES) += iseries/ 13obj-$(CONFIG_PPC_ISERIES) += iseries/
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
new file mode 100644
index 000000000000..3157071e241c
--- /dev/null
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -0,0 +1,13 @@
1menu "Cell Broadband Engine options"
2 depends on PPC_CELL
3
4config SPU_FS
5 tristate "SPU file system"
6 default m
7 depends on PPC_CELL
8 help
9 The SPU file system is used to access Synergistic Processing
10 Units on machines implementing the Broadband Processor
11 Architecture.
12
13endmenu
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index 55e094b96bc0..16031b565be4 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -1,2 +1,10 @@
1obj-y += interrupt.o iommu.o setup.o spider-pic.o 1obj-y += interrupt.o iommu.o setup.o spider-pic.o
2obj-y += pervasive.o
3
2obj-$(CONFIG_SMP) += smp.o 4obj-$(CONFIG_SMP) += smp.o
5obj-$(CONFIG_SPU_FS) += spufs/ spu-base.o
6
7spu-base-y += spu_base.o spu_priv1.o
8
9builtin-spufs-$(CONFIG_SPU_FS) += spu_syscalls.o
10obj-y += $(builtin-spufs-m)
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 7fbe78a9327d..63aa52acf441 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -23,6 +23,7 @@
23#include <linux/config.h> 23#include <linux/config.h>
24#include <linux/interrupt.h> 24#include <linux/interrupt.h>
25#include <linux/irq.h> 25#include <linux/irq.h>
26#include <linux/module.h>
26#include <linux/percpu.h> 27#include <linux/percpu.h>
27#include <linux/types.h> 28#include <linux/types.h>
28 29
@@ -55,6 +56,7 @@ struct iic_regs {
55 56
56struct iic { 57struct iic {
57 struct iic_regs __iomem *regs; 58 struct iic_regs __iomem *regs;
59 u8 target_id;
58}; 60};
59 61
60static DEFINE_PER_CPU(struct iic, iic); 62static DEFINE_PER_CPU(struct iic, iic);
@@ -172,12 +174,11 @@ int iic_get_irq(struct pt_regs *regs)
172 return irq; 174 return irq;
173} 175}
174 176
175static struct iic_regs __iomem *find_iic(int cpu) 177static int setup_iic(int cpu, struct iic *iic)
176{ 178{
177 struct device_node *np; 179 struct device_node *np;
178 int nodeid = cpu / 2; 180 int nodeid = cpu / 2;
179 unsigned long regs; 181 unsigned long regs;
180 struct iic_regs __iomem *iic_regs;
181 182
182 for (np = of_find_node_by_type(NULL, "cpu"); 183 for (np = of_find_node_by_type(NULL, "cpu");
183 np; 184 np;
@@ -188,20 +189,23 @@ static struct iic_regs __iomem *find_iic(int cpu)
188 189
189 if (!np) { 190 if (!np) {
190 printk(KERN_WARNING "IIC: CPU %d not found\n", cpu); 191 printk(KERN_WARNING "IIC: CPU %d not found\n", cpu);
191 iic_regs = NULL; 192 iic->regs = NULL;
192 } else { 193 iic->target_id = 0xff;
193 regs = *(long *)get_property(np, "iic", NULL); 194 return -ENODEV;
194
195 /* hack until we have decided on the devtree info */
196 regs += 0x400;
197 if (cpu & 1)
198 regs += 0x20;
199
200 printk(KERN_DEBUG "IIC for CPU %d at %lx\n", cpu, regs);
201 iic_regs = __ioremap(regs, sizeof(struct iic_regs),
202 _PAGE_NO_CACHE);
203 } 195 }
204 return iic_regs; 196
197 regs = *(long *)get_property(np, "iic", NULL);
198
199 /* hack until we have decided on the devtree info */
200 regs += 0x400;
201 if (cpu & 1)
202 regs += 0x20;
203
204 printk(KERN_DEBUG "IIC for CPU %d at %lx\n", cpu, regs);
205 iic->regs = __ioremap(regs, sizeof(struct iic_regs),
206 _PAGE_NO_CACHE);
207 iic->target_id = (nodeid << 4) + ((cpu & 1) ? 0xf : 0xe);
208 return 0;
205} 209}
206 210
207#ifdef CONFIG_SMP 211#ifdef CONFIG_SMP
@@ -227,6 +231,12 @@ void iic_cause_IPI(int cpu, int mesg)
227 out_be64(&per_cpu(iic, cpu).regs->generate, (IIC_NUM_IPIS - 1 - mesg) << 4); 231 out_be64(&per_cpu(iic, cpu).regs->generate, (IIC_NUM_IPIS - 1 - mesg) << 4);
228} 232}
229 233
234u8 iic_get_target_id(int cpu)
235{
236 return per_cpu(iic, cpu).target_id;
237}
238EXPORT_SYMBOL_GPL(iic_get_target_id);
239
230static irqreturn_t iic_ipi_action(int irq, void *dev_id, struct pt_regs *regs) 240static irqreturn_t iic_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
231{ 241{
232 smp_message_recv(iic_irq_to_ipi(irq), regs); 242 smp_message_recv(iic_irq_to_ipi(irq), regs);
@@ -276,7 +286,7 @@ void iic_init_IRQ(void)
276 irq_offset = 0; 286 irq_offset = 0;
277 for_each_cpu(cpu) { 287 for_each_cpu(cpu) {
278 iic = &per_cpu(iic, cpu); 288 iic = &per_cpu(iic, cpu);
279 iic->regs = find_iic(cpu); 289 setup_iic(cpu, iic);
280 if (iic->regs) 290 if (iic->regs)
281 out_be64(&iic->regs->prio, 0xff); 291 out_be64(&iic->regs->prio, 0xff);
282 } 292 }
diff --git a/arch/powerpc/platforms/cell/interrupt.h b/arch/powerpc/platforms/cell/interrupt.h
index 37d58e6fd0c6..a14bd38791c0 100644
--- a/arch/powerpc/platforms/cell/interrupt.h
+++ b/arch/powerpc/platforms/cell/interrupt.h
@@ -54,6 +54,7 @@ extern void iic_setup_cpu(void);
54extern void iic_local_enable(void); 54extern void iic_local_enable(void);
55extern void iic_local_disable(void); 55extern void iic_local_disable(void);
56 56
57extern u8 iic_get_target_id(int cpu);
57 58
58extern void spider_init_IRQ(void); 59extern void spider_init_IRQ(void);
59extern int spider_get_irq(unsigned long int_pending); 60extern int spider_get_irq(unsigned long int_pending);
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 74f999b4ac9e..46e7cb9c3e64 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -29,6 +29,8 @@
29#include <linux/bootmem.h> 29#include <linux/bootmem.h>
30#include <linux/mm.h> 30#include <linux/mm.h>
31#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
32#include <linux/kernel.h>
33#include <linux/compiler.h>
32 34
33#include <asm/sections.h> 35#include <asm/sections.h>
34#include <asm/iommu.h> 36#include <asm/iommu.h>
@@ -40,6 +42,7 @@
40#include <asm/abs_addr.h> 42#include <asm/abs_addr.h>
41#include <asm/system.h> 43#include <asm/system.h>
42#include <asm/ppc-pci.h> 44#include <asm/ppc-pci.h>
45#include <asm/udbg.h>
43 46
44#include "iommu.h" 47#include "iommu.h"
45 48
@@ -220,8 +223,6 @@ set_iopt_cache(void __iomem *base, unsigned long index,
220{ 223{
221 unsigned long __iomem *tags = base + IOC_PT_CACHE_DIR; 224 unsigned long __iomem *tags = base + IOC_PT_CACHE_DIR;
222 unsigned long __iomem *p = base + IOC_PT_CACHE_REG; 225 unsigned long __iomem *p = base + IOC_PT_CACHE_REG;
223 pr_debug("iopt %02lx was v%016lx/t%016lx, store v%016lx/t%016lx\n",
224 index, get_iopt_cache(base, index, &oldtag), oldtag, val, tag);
225 226
226 out_be64(p, val); 227 out_be64(p, val);
227 out_be64(&tags[index], tag); 228 out_be64(&tags[index], tag);
@@ -248,67 +249,176 @@ set_iocmd_config(void __iomem *base)
248 out_be64(p, conf | IOCMD_CONF_TE); 249 out_be64(p, conf | IOCMD_CONF_TE);
249} 250}
250 251
251/* FIXME: get these from the device tree */ 252static void enable_mapping(void __iomem *base, void __iomem *mmio_base)
252#define ioc_base 0x20000511000ull
253#define ioc_mmio_base 0x20000510000ull
254#define ioid 0x48a
255#define iopt_phys_offset (- 0x20000000) /* We have a 512MB offset from the SB */
256#define io_page_size 0x1000000
257
258static unsigned long map_iopt_entry(unsigned long address)
259{ 253{
260 switch (address >> 20) { 254 set_iocmd_config(base);
261 case 0x600: 255 set_iost_origin(mmio_base);
262 address = 0x24020000000ull; /* spider i/o */
263 break;
264 default:
265 address += iopt_phys_offset;
266 break;
267 }
268
269 return get_iopt_entry(address, ioid, IOPT_PROT_RW);
270} 256}
271 257
272static void iommu_bus_setup_null(struct pci_bus *b) { }
273static void iommu_dev_setup_null(struct pci_dev *d) { } 258static void iommu_dev_setup_null(struct pci_dev *d) { }
259static void iommu_bus_setup_null(struct pci_bus *b) { }
260
261struct cell_iommu {
262 unsigned long base;
263 unsigned long mmio_base;
264 void __iomem *mapped_base;
265 void __iomem *mapped_mmio_base;
266};
267
268static struct cell_iommu cell_iommus[NR_CPUS];
274 269
275/* initialize the iommu to support a simple linear mapping 270/* initialize the iommu to support a simple linear mapping
276 * for each DMA window used by any device. For now, we 271 * for each DMA window used by any device. For now, we
277 * happen to know that there is only one DMA window in use, 272 * happen to know that there is only one DMA window in use,
278 * starting at iopt_phys_offset. */ 273 * starting at iopt_phys_offset. */
279static void cell_map_iommu(void) 274static void cell_do_map_iommu(struct cell_iommu *iommu,
275 unsigned int ioid,
276 unsigned long map_start,
277 unsigned long map_size)
280{ 278{
281 unsigned long address; 279 unsigned long io_address, real_address;
282 void __iomem *base; 280 void __iomem *ioc_base, *ioc_mmio_base;
283 ioste ioste; 281 ioste ioste;
284 unsigned long index; 282 unsigned long index;
285 283
286 base = __ioremap(ioc_base, 0x1000, _PAGE_NO_CACHE); 284 /* we pretend the io page table was at a very high address */
287 pr_debug("%lx mapped to %p\n", ioc_base, base); 285 const unsigned long fake_iopt = 0x10000000000ul;
288 set_iocmd_config(base); 286 const unsigned long io_page_size = 0x1000000; /* use 16M pages */
289 iounmap(base); 287 const unsigned long io_segment_size = 0x10000000; /* 256M */
288
289 ioc_base = iommu->mapped_base;
290 ioc_mmio_base = iommu->mapped_mmio_base;
291
292 for (real_address = 0, io_address = 0;
293 io_address <= map_start + map_size;
294 real_address += io_page_size, io_address += io_page_size) {
295 ioste = get_iost_entry(fake_iopt, io_address, io_page_size);
296 if ((real_address % io_segment_size) == 0) /* segment start */
297 set_iost_cache(ioc_mmio_base,
298 io_address >> 28, ioste);
299 index = get_ioc_hash_1way(ioste, io_address);
300 pr_debug("addr %08lx, index %02lx, ioste %016lx\n",
301 io_address, index, ioste.val);
302 set_iopt_cache(ioc_mmio_base,
303 get_ioc_hash_1way(ioste, io_address),
304 get_ioc_tag(ioste, io_address),
305 get_iopt_entry(real_address-map_start, ioid, IOPT_PROT_RW));
306 }
307}
290 308
291 base = __ioremap(ioc_mmio_base, 0x1000, _PAGE_NO_CACHE); 309static void iommu_devnode_setup(struct device_node *d)
292 pr_debug("%lx mapped to %p\n", ioc_mmio_base, base); 310{
311 unsigned int *ioid;
312 unsigned long *dma_window, map_start, map_size, token;
313 struct cell_iommu *iommu;
293 314
294 set_iost_origin(base); 315 ioid = (unsigned int *)get_property(d, "ioid", NULL);
316 if (!ioid)
317 pr_debug("No ioid entry found !\n");
295 318
296 for (address = 0; address < 0x100000000ul; address += io_page_size) { 319 dma_window = (unsigned long *)get_property(d, "ibm,dma-window", NULL);
297 ioste = get_iost_entry(0x10000000000ul, address, io_page_size); 320 if (!dma_window)
298 if ((address & 0xfffffff) == 0) /* segment start */ 321 pr_debug("No ibm,dma-window entry found !\n");
299 set_iost_cache(base, address >> 28, ioste); 322
300 index = get_ioc_hash_1way(ioste, address); 323 map_start = dma_window[1];
301 pr_debug("addr %08lx, index %02lx, ioste %016lx\n", 324 map_size = dma_window[2];
302 address, index, ioste.val); 325 token = dma_window[0] >> 32;
303 set_iopt_cache(base, 326
304 get_ioc_hash_1way(ioste, address), 327 iommu = &cell_iommus[token];
305 get_ioc_tag(ioste, address), 328
306 map_iopt_entry(address)); 329 cell_do_map_iommu(iommu, *ioid, map_start, map_size);
307 } 330}
308 iounmap(base); 331
332static void iommu_bus_setup(struct pci_bus *b)
333{
334 struct device_node *d = (struct device_node *)b->sysdata;
335 iommu_devnode_setup(d);
336}
337
338
339static int cell_map_iommu_hardcoded(int num_nodes)
340{
341 struct cell_iommu *iommu = NULL;
342
343 pr_debug("%s(%d): Using hardcoded defaults\n", __FUNCTION__, __LINE__);
344
345 /* node 0 */
346 iommu = &cell_iommus[0];
347 iommu->mapped_base = __ioremap(0x20000511000, 0x1000, _PAGE_NO_CACHE);
348 iommu->mapped_mmio_base = __ioremap(0x20000510000, 0x1000, _PAGE_NO_CACHE);
349
350 enable_mapping(iommu->mapped_base, iommu->mapped_mmio_base);
351
352 cell_do_map_iommu(iommu, 0x048a,
353 0x20000000ul,0x20000000ul);
354
355 if (num_nodes < 2)
356 return 0;
357
358 /* node 1 */
359 iommu = &cell_iommus[1];
360 iommu->mapped_base = __ioremap(0x30000511000, 0x1000, _PAGE_NO_CACHE);
361 iommu->mapped_mmio_base = __ioremap(0x30000510000, 0x1000, _PAGE_NO_CACHE);
362
363 enable_mapping(iommu->mapped_base, iommu->mapped_mmio_base);
364
365 cell_do_map_iommu(iommu, 0x048a,
366 0x20000000,0x20000000ul);
367
368 return 0;
309} 369}
310 370
311 371
372static int cell_map_iommu(void)
373{
374 unsigned int num_nodes = 0, *node_id;
375 unsigned long *base, *mmio_base;
376 struct device_node *dn;
377 struct cell_iommu *iommu = NULL;
378
379 /* determine number of nodes (=iommus) */
380 pr_debug("%s(%d): determining number of nodes...", __FUNCTION__, __LINE__);
381 for(dn = of_find_node_by_type(NULL, "cpu");
382 dn;
383 dn = of_find_node_by_type(dn, "cpu")) {
384 node_id = (unsigned int *)get_property(dn, "node-id", NULL);
385
386 if (num_nodes < *node_id)
387 num_nodes = *node_id;
388 }
389
390 num_nodes++;
391 pr_debug("%i found.\n", num_nodes);
392
393 /* map the iommu registers for each node */
394 pr_debug("%s(%d): Looping through nodes\n", __FUNCTION__, __LINE__);
395 for(dn = of_find_node_by_type(NULL, "cpu");
396 dn;
397 dn = of_find_node_by_type(dn, "cpu")) {
398
399 node_id = (unsigned int *)get_property(dn, "node-id", NULL);
400 base = (unsigned long *)get_property(dn, "ioc-cache", NULL);
401 mmio_base = (unsigned long *)get_property(dn, "ioc-translation", NULL);
402
403 if (!base || !mmio_base || !node_id)
404 return cell_map_iommu_hardcoded(num_nodes);
405
406 iommu = &cell_iommus[*node_id];
407 iommu->base = *base;
408 iommu->mmio_base = *mmio_base;
409
410 iommu->mapped_base = __ioremap(*base, 0x1000, _PAGE_NO_CACHE);
411 iommu->mapped_mmio_base = __ioremap(*mmio_base, 0x1000, _PAGE_NO_CACHE);
412
413 enable_mapping(iommu->mapped_base,
414 iommu->mapped_mmio_base);
415
416 /* everything else will be done in iommu_bus_setup */
417 }
418
419 return 1;
420}
421
312static void *cell_alloc_coherent(struct device *hwdev, size_t size, 422static void *cell_alloc_coherent(struct device *hwdev, size_t size,
313 dma_addr_t *dma_handle, gfp_t flag) 423 dma_addr_t *dma_handle, gfp_t flag)
314{ 424{
@@ -365,11 +475,28 @@ static int cell_dma_supported(struct device *dev, u64 mask)
365 475
366void cell_init_iommu(void) 476void cell_init_iommu(void)
367{ 477{
368 cell_map_iommu(); 478 int setup_bus = 0;
369 479
370 /* Direct I/O, IOMMU off */ 480 if (of_find_node_by_path("/mambo")) {
371 ppc_md.iommu_dev_setup = iommu_dev_setup_null; 481 pr_info("Not using iommu on systemsim\n");
372 ppc_md.iommu_bus_setup = iommu_bus_setup_null; 482 } else {
483
484 if (!(of_chosen &&
485 get_property(of_chosen, "linux,iommu-off", NULL)))
486 setup_bus = cell_map_iommu();
487
488 if (setup_bus) {
489 pr_debug("%s: IOMMU mapping activated\n", __FUNCTION__);
490 ppc_md.iommu_dev_setup = iommu_dev_setup_null;
491 ppc_md.iommu_bus_setup = iommu_bus_setup;
492 } else {
493 pr_debug("%s: IOMMU mapping activated, "
494 "no device action necessary\n", __FUNCTION__);
495 /* Direct I/O, IOMMU off */
496 ppc_md.iommu_dev_setup = iommu_dev_setup_null;
497 ppc_md.iommu_bus_setup = iommu_bus_setup_null;
498 }
499 }
373 500
374 pci_dma_ops.alloc_coherent = cell_alloc_coherent; 501 pci_dma_ops.alloc_coherent = cell_alloc_coherent;
375 pci_dma_ops.free_coherent = cell_free_coherent; 502 pci_dma_ops.free_coherent = cell_free_coherent;
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
new file mode 100644
index 000000000000..e0e051c675dd
--- /dev/null
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -0,0 +1,229 @@
1/*
2 * CBE Pervasive Monitor and Debug
3 *
4 * (C) Copyright IBM Corporation 2005
5 *
6 * Authors: Maximino Aguilar (maguilar@us.ibm.com)
7 * Michael N. Day (mnday@us.ibm.com)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#undef DEBUG
25
26#include <linux/config.h>
27#include <linux/interrupt.h>
28#include <linux/irq.h>
29#include <linux/percpu.h>
30#include <linux/types.h>
31#include <linux/kallsyms.h>
32
33#include <asm/io.h>
34#include <asm/machdep.h>
35#include <asm/prom.h>
36#include <asm/pgtable.h>
37#include <asm/reg.h>
38
39#include "pervasive.h"
40
41static DEFINE_SPINLOCK(cbe_pervasive_lock);
42struct cbe_pervasive {
43 struct pmd_regs __iomem *regs;
44 unsigned int thread;
45};
46
47/* can't use per_cpu from setup_arch */
48static struct cbe_pervasive cbe_pervasive[NR_CPUS];
49
50static void __init cbe_enable_pause_zero(void)
51{
52 unsigned long thread_switch_control;
53 unsigned long temp_register;
54 struct cbe_pervasive *p;
55 int thread;
56
57 spin_lock_irq(&cbe_pervasive_lock);
58 p = &cbe_pervasive[smp_processor_id()];
59
60 if (!cbe_pervasive->regs)
61 goto out;
62
63 pr_debug("Power Management: CPU %d\n", smp_processor_id());
64
65 /* Enable Pause(0) control bit */
66 temp_register = in_be64(&p->regs->pm_control);
67
68 out_be64(&p->regs->pm_control,
69 temp_register|PMD_PAUSE_ZERO_CONTROL);
70
71 /* Enable DEC and EE interrupt request */
72 thread_switch_control = mfspr(SPRN_TSC_CELL);
73 thread_switch_control |= TSC_CELL_EE_ENABLE | TSC_CELL_EE_BOOST;
74
75 switch ((mfspr(SPRN_CTRLF) & CTRL_CT)) {
76 case CTRL_CT0:
77 thread_switch_control |= TSC_CELL_DEC_ENABLE_0;
78 thread = 0;
79 break;
80 case CTRL_CT1:
81 thread_switch_control |= TSC_CELL_DEC_ENABLE_1;
82 thread = 1;
83 break;
84 default:
85 printk(KERN_WARNING "%s: unknown configuration\n",
86 __FUNCTION__);
87 thread = -1;
88 break;
89 }
90
91 if (p->thread != thread)
92 printk(KERN_WARNING "%s: device tree inconsistant, "
93 "cpu %i: %d/%d\n", __FUNCTION__,
94 smp_processor_id(),
95 p->thread, thread);
96
97 mtspr(SPRN_TSC_CELL, thread_switch_control);
98
99out:
100 spin_unlock_irq(&cbe_pervasive_lock);
101}
102
103static void cbe_idle(void)
104{
105 unsigned long ctrl;
106
107 cbe_enable_pause_zero();
108
109 while (1) {
110 if (!need_resched()) {
111 local_irq_disable();
112 while (!need_resched()) {
113 /* go into low thread priority */
114 HMT_low();
115
116 /*
117 * atomically disable thread execution
118 * and runlatch.
119 * External and Decrementer exceptions
120 * are still handled when the thread
121 * is disabled but now enter in
122 * cbe_system_reset_exception()
123 */
124 ctrl = mfspr(SPRN_CTRLF);
125 ctrl &= ~(CTRL_RUNLATCH | CTRL_TE);
126 mtspr(SPRN_CTRLT, ctrl);
127 }
128 /* restore thread prio */
129 HMT_medium();
130 local_irq_enable();
131 }
132
133 /*
134 * turn runlatch on again before scheduling the
135 * process we just woke up
136 */
137 ppc64_runlatch_on();
138
139 preempt_enable_no_resched();
140 schedule();
141 preempt_disable();
142 }
143}
144
145static int cbe_system_reset_exception(struct pt_regs *regs)
146{
147 switch (regs->msr & SRR1_WAKEMASK) {
148 case SRR1_WAKEEE:
149 do_IRQ(regs);
150 break;
151 case SRR1_WAKEDEC:
152 timer_interrupt(regs);
153 break;
154 case SRR1_WAKEMT:
155 /* no action required */
156 break;
157 default:
158 /* do system reset */
159 return 0;
160 }
161 /* everything handled */
162 return 1;
163}
164
165static int __init cbe_find_pmd_mmio(int cpu, struct cbe_pervasive *p)
166{
167 struct device_node *node;
168 unsigned int *int_servers;
169 char *addr;
170 unsigned long real_address;
171 unsigned int size;
172
173 struct pmd_regs __iomem *pmd_mmio_area;
174 int hardid, thread;
175 int proplen;
176
177 pmd_mmio_area = NULL;
178 hardid = get_hard_smp_processor_id(cpu);
179 for (node = NULL; (node = of_find_node_by_type(node, "cpu"));) {
180 int_servers = (void *) get_property(node,
181 "ibm,ppc-interrupt-server#s", &proplen);
182 if (!int_servers) {
183 printk(KERN_WARNING "%s misses "
184 "ibm,ppc-interrupt-server#s property",
185 node->full_name);
186 continue;
187 }
188 for (thread = 0; thread < proplen / sizeof (int); thread++) {
189 if (hardid == int_servers[thread]) {
190 addr = get_property(node, "pervasive", NULL);
191 goto found;
192 }
193 }
194 }
195
196 printk(KERN_WARNING "%s: CPU %d not found\n", __FUNCTION__, cpu);
197 return -EINVAL;
198
199found:
200 real_address = *(unsigned long*) addr;
201 addr += sizeof (unsigned long);
202 size = *(unsigned int*) addr;
203
204 pr_debug("pervasive area for CPU %d at %lx, size %x\n",
205 cpu, real_address, size);
206 p->regs = __ioremap(real_address, size, _PAGE_NO_CACHE);
207 p->thread = thread;
208 return 0;
209}
210
211void __init cell_pervasive_init(void)
212{
213 struct cbe_pervasive *p;
214 int cpu;
215 int ret;
216
217 if (!cpu_has_feature(CPU_FTR_PAUSE_ZERO))
218 return;
219
220 for_each_cpu(cpu) {
221 p = &cbe_pervasive[cpu];
222 ret = cbe_find_pmd_mmio(cpu, p);
223 if (ret)
224 return;
225 }
226
227 ppc_md.idle_loop = cbe_idle;
228 ppc_md.system_reset_exception = cbe_system_reset_exception;
229}
diff --git a/arch/powerpc/platforms/cell/pervasive.h b/arch/powerpc/platforms/cell/pervasive.h
new file mode 100644
index 000000000000..da1fb85ca3e8
--- /dev/null
+++ b/arch/powerpc/platforms/cell/pervasive.h
@@ -0,0 +1,62 @@
1/*
2 * Cell Pervasive Monitor and Debug interface and HW structures
3 *
4 * (C) Copyright IBM Corporation 2005
5 *
6 * Authors: Maximino Aguilar (maguilar@us.ibm.com)
7 * David J. Erb (djerb@us.ibm.com)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24
25#ifndef PERVASIVE_H
26#define PERVASIVE_H
27
28struct pmd_regs {
29 u8 pad_0x0000_0x0800[0x0800 - 0x0000]; /* 0x0000 */
30
31 /* Thermal Sensor Registers */
32 u64 ts_ctsr1; /* 0x0800 */
33 u64 ts_ctsr2; /* 0x0808 */
34 u64 ts_mtsr1; /* 0x0810 */
35 u64 ts_mtsr2; /* 0x0818 */
36 u64 ts_itr1; /* 0x0820 */
37 u64 ts_itr2; /* 0x0828 */
38 u64 ts_gitr; /* 0x0830 */
39 u64 ts_isr; /* 0x0838 */
40 u64 ts_imr; /* 0x0840 */
41 u64 tm_cr1; /* 0x0848 */
42 u64 tm_cr2; /* 0x0850 */
43 u64 tm_simr; /* 0x0858 */
44 u64 tm_tpr; /* 0x0860 */
45 u64 tm_str1; /* 0x0868 */
46 u64 tm_str2; /* 0x0870 */
47 u64 tm_tsr; /* 0x0878 */
48
49 /* Power Management */
50 u64 pm_control; /* 0x0880 */
51#define PMD_PAUSE_ZERO_CONTROL 0x10000
52 u64 pm_status; /* 0x0888 */
53
54 /* Time Base Register */
55 u64 tbr; /* 0x0890 */
56
57 u8 pad_0x0898_0x1000 [0x1000 - 0x0898]; /* 0x0898 */
58};
59
60void __init cell_pervasive_init(void);
61
62#endif
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 9a495634d0c2..b33a4443f5a9 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -33,6 +33,7 @@
33#include <asm/mmu.h> 33#include <asm/mmu.h>
34#include <asm/processor.h> 34#include <asm/processor.h>
35#include <asm/io.h> 35#include <asm/io.h>
36#include <asm/kexec.h>
36#include <asm/pgtable.h> 37#include <asm/pgtable.h>
37#include <asm/prom.h> 38#include <asm/prom.h>
38#include <asm/rtas.h> 39#include <asm/rtas.h>
@@ -48,6 +49,7 @@
48 49
49#include "interrupt.h" 50#include "interrupt.h"
50#include "iommu.h" 51#include "iommu.h"
52#include "pervasive.h"
51 53
52#ifdef DEBUG 54#ifdef DEBUG
53#define DBG(fmt...) udbg_printf(fmt) 55#define DBG(fmt...) udbg_printf(fmt)
@@ -55,7 +57,7 @@
55#define DBG(fmt...) 57#define DBG(fmt...)
56#endif 58#endif
57 59
58void cell_show_cpuinfo(struct seq_file *m) 60static void cell_show_cpuinfo(struct seq_file *m)
59{ 61{
60 struct device_node *root; 62 struct device_node *root;
61 const char *model = ""; 63 const char *model = "";
@@ -67,6 +69,77 @@ void cell_show_cpuinfo(struct seq_file *m)
67 of_node_put(root); 69 of_node_put(root);
68} 70}
69 71
72#ifdef CONFIG_SPARSEMEM
73static int __init find_spu_node_id(struct device_node *spe)
74{
75 unsigned int *id;
76#ifdef CONFIG_NUMA
77 struct device_node *cpu;
78 cpu = spe->parent->parent;
79 id = (unsigned int *)get_property(cpu, "node-id", NULL);
80#else
81 id = NULL;
82#endif
83 return id ? *id : 0;
84}
85
86static void __init cell_spuprop_present(struct device_node *spe,
87 const char *prop, int early)
88{
89 struct address_prop {
90 unsigned long address;
91 unsigned int len;
92 } __attribute__((packed)) *p;
93 int proplen;
94
95 unsigned long start_pfn, end_pfn, pfn;
96 int node_id;
97
98 p = (void*)get_property(spe, prop, &proplen);
99 WARN_ON(proplen != sizeof (*p));
100
101 node_id = find_spu_node_id(spe);
102
103 start_pfn = p->address >> PAGE_SHIFT;
104 end_pfn = (p->address + p->len + PAGE_SIZE - 1) >> PAGE_SHIFT;
105
106 /* We need to call memory_present *before* the call to sparse_init,
107 but we can initialize the page structs only *after* that call.
108 Thus, we're being called twice. */
109 if (early)
110 memory_present(node_id, start_pfn, end_pfn);
111 else {
112 /* As the pages backing SPU LS and I/O are outside the range
113 of regular memory, their page structs were not initialized
114 by free_area_init. Do it here instead. */
115 for (pfn = start_pfn; pfn < end_pfn; pfn++) {
116 struct page *page = pfn_to_page(pfn);
117 set_page_links(page, ZONE_DMA, node_id, pfn);
118 set_page_count(page, 1);
119 reset_page_mapcount(page);
120 SetPageReserved(page);
121 INIT_LIST_HEAD(&page->lru);
122 }
123 }
124}
125
126static void __init cell_spumem_init(int early)
127{
128 struct device_node *node;
129 for (node = of_find_node_by_type(NULL, "spe");
130 node; node = of_find_node_by_type(node, "spe")) {
131 cell_spuprop_present(node, "local-store", early);
132 cell_spuprop_present(node, "problem", early);
133 cell_spuprop_present(node, "priv1", early);
134 cell_spuprop_present(node, "priv2", early);
135 }
136}
137#else
138static void __init cell_spumem_init(int early)
139{
140}
141#endif
142
70static void cell_progress(char *s, unsigned short hex) 143static void cell_progress(char *s, unsigned short hex)
71{ 144{
72 printk("*** %04x : %s\n", hex, s ? s : ""); 145 printk("*** %04x : %s\n", hex, s ? s : "");
@@ -93,11 +166,14 @@ static void __init cell_setup_arch(void)
93 init_pci_config_tokens(); 166 init_pci_config_tokens();
94 find_and_init_phbs(); 167 find_and_init_phbs();
95 spider_init_IRQ(); 168 spider_init_IRQ();
169 cell_pervasive_init();
96#ifdef CONFIG_DUMMY_CONSOLE 170#ifdef CONFIG_DUMMY_CONSOLE
97 conswitchp = &dummy_con; 171 conswitchp = &dummy_con;
98#endif 172#endif
99 173
100 mmio_nvram_init(); 174 mmio_nvram_init();
175
176 cell_spumem_init(0);
101} 177}
102 178
103/* 179/*
@@ -113,6 +189,8 @@ static void __init cell_init_early(void)
113 189
114 ppc64_interrupt_controller = IC_CELL_PIC; 190 ppc64_interrupt_controller = IC_CELL_PIC;
115 191
192 cell_spumem_init(1);
193
116 DBG(" <- cell_init_early()\n"); 194 DBG(" <- cell_init_early()\n");
117} 195}
118 196
@@ -125,6 +203,15 @@ static int __init cell_probe(int platform)
125 return 1; 203 return 1;
126} 204}
127 205
206/*
207 * Cell has no legacy IO; anything calling this function has to
208 * fail or bad things will happen
209 */
210static int cell_check_legacy_ioport(unsigned int baseport)
211{
212 return -ENODEV;
213}
214
128struct machdep_calls __initdata cell_md = { 215struct machdep_calls __initdata cell_md = {
129 .probe = cell_probe, 216 .probe = cell_probe,
130 .setup_arch = cell_setup_arch, 217 .setup_arch = cell_setup_arch,
@@ -137,5 +224,11 @@ struct machdep_calls __initdata cell_md = {
137 .get_rtc_time = rtas_get_rtc_time, 224 .get_rtc_time = rtas_get_rtc_time,
138 .set_rtc_time = rtas_set_rtc_time, 225 .set_rtc_time = rtas_set_rtc_time,
139 .calibrate_decr = generic_calibrate_decr, 226 .calibrate_decr = generic_calibrate_decr,
227 .check_legacy_ioport = cell_check_legacy_ioport,
140 .progress = cell_progress, 228 .progress = cell_progress,
229#ifdef CONFIG_KEXEC
230 .machine_kexec = default_machine_kexec,
231 .machine_kexec_prepare = default_machine_kexec_prepare,
232 .machine_crash_shutdown = default_machine_crash_shutdown,
233#endif
141}; 234};
diff --git a/arch/powerpc/platforms/cell/smp.c b/arch/powerpc/platforms/cell/smp.c
index de96eadf419d..bdf6c5fe58c0 100644
--- a/arch/powerpc/platforms/cell/smp.c
+++ b/arch/powerpc/platforms/cell/smp.c
@@ -86,7 +86,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
86 pcpu = get_hard_smp_processor_id(lcpu); 86 pcpu = get_hard_smp_processor_id(lcpu);
87 87
88 /* Fixup atomic count: it exited inside IRQ handler. */ 88 /* Fixup atomic count: it exited inside IRQ handler. */
89 paca[lcpu].__current->thread_info->preempt_count = 0; 89 task_thread_info(paca[lcpu].__current)->preempt_count = 0;
90 90
91 /* 91 /*
92 * If the RTAS start-cpu token does not exist then presume the 92 * If the RTAS start-cpu token does not exist then presume the
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
new file mode 100644
index 000000000000..d75ae03df686
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -0,0 +1,711 @@
1/*
2 * Low-level SPU handling
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#undef DEBUG
24
25#include <linux/interrupt.h>
26#include <linux/list.h>
27#include <linux/module.h>
28#include <linux/poll.h>
29#include <linux/ptrace.h>
30#include <linux/slab.h>
31#include <linux/wait.h>
32
33#include <asm/io.h>
34#include <asm/prom.h>
35#include <asm/semaphore.h>
36#include <asm/spu.h>
37#include <asm/mmu_context.h>
38
39#include "interrupt.h"
40
41static int __spu_trap_invalid_dma(struct spu *spu)
42{
43 pr_debug("%s\n", __FUNCTION__);
44 force_sig(SIGBUS, /* info, */ current);
45 return 0;
46}
47
48static int __spu_trap_dma_align(struct spu *spu)
49{
50 pr_debug("%s\n", __FUNCTION__);
51 force_sig(SIGBUS, /* info, */ current);
52 return 0;
53}
54
55static int __spu_trap_error(struct spu *spu)
56{
57 pr_debug("%s\n", __FUNCTION__);
58 force_sig(SIGILL, /* info, */ current);
59 return 0;
60}
61
62static void spu_restart_dma(struct spu *spu)
63{
64 struct spu_priv2 __iomem *priv2 = spu->priv2;
65
66 if (!test_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags))
67 out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND);
68}
69
70static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
71{
72 struct spu_priv2 __iomem *priv2 = spu->priv2;
73 struct mm_struct *mm = spu->mm;
74 u64 esid, vsid;
75
76 pr_debug("%s\n", __FUNCTION__);
77
78 if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags)) {
79 /* SLBs are pre-loaded for context switch, so
80 * we should never get here!
81 */
82 printk("%s: invalid access during switch!\n", __func__);
83 return 1;
84 }
85 if (!mm || (REGION_ID(ea) != USER_REGION_ID)) {
86 /* Future: support kernel segments so that drivers
87 * can use SPUs.
88 */
89 pr_debug("invalid region access at %016lx\n", ea);
90 return 1;
91 }
92
93 esid = (ea & ESID_MASK) | SLB_ESID_V;
94 vsid = (get_vsid(mm->context.id, ea) << SLB_VSID_SHIFT) | SLB_VSID_USER;
95 if (in_hugepage_area(mm->context, ea))
96 vsid |= SLB_VSID_L;
97
98 out_be64(&priv2->slb_index_W, spu->slb_replace);
99 out_be64(&priv2->slb_vsid_RW, vsid);
100 out_be64(&priv2->slb_esid_RW, esid);
101
102 spu->slb_replace++;
103 if (spu->slb_replace >= 8)
104 spu->slb_replace = 0;
105
106 spu_restart_dma(spu);
107
108 return 0;
109}
110
111extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); //XXX
112static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr)
113{
114 pr_debug("%s\n", __FUNCTION__);
115
116 /* Handle kernel space hash faults immediately.
117 User hash faults need to be deferred to process context. */
118 if ((dsisr & MFC_DSISR_PTE_NOT_FOUND)
119 && REGION_ID(ea) != USER_REGION_ID
120 && hash_page(ea, _PAGE_PRESENT, 0x300) == 0) {
121 spu_restart_dma(spu);
122 return 0;
123 }
124
125 if (test_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags)) {
126 printk("%s: invalid access during switch!\n", __func__);
127 return 1;
128 }
129
130 spu->dar = ea;
131 spu->dsisr = dsisr;
132 mb();
133 if (spu->stop_callback)
134 spu->stop_callback(spu);
135 return 0;
136}
137
138static int __spu_trap_mailbox(struct spu *spu)
139{
140 if (spu->ibox_callback)
141 spu->ibox_callback(spu);
142
143 /* atomically disable SPU mailbox interrupts */
144 spin_lock(&spu->register_lock);
145 spu_int_mask_and(spu, 2, ~0x1);
146 spin_unlock(&spu->register_lock);
147 return 0;
148}
149
150static int __spu_trap_stop(struct spu *spu)
151{
152 pr_debug("%s\n", __FUNCTION__);
153 spu->stop_code = in_be32(&spu->problem->spu_status_R);
154 if (spu->stop_callback)
155 spu->stop_callback(spu);
156 return 0;
157}
158
159static int __spu_trap_halt(struct spu *spu)
160{
161 pr_debug("%s\n", __FUNCTION__);
162 spu->stop_code = in_be32(&spu->problem->spu_status_R);
163 if (spu->stop_callback)
164 spu->stop_callback(spu);
165 return 0;
166}
167
168static int __spu_trap_tag_group(struct spu *spu)
169{
170 pr_debug("%s\n", __FUNCTION__);
171 /* wake_up(&spu->dma_wq); */
172 return 0;
173}
174
175static int __spu_trap_spubox(struct spu *spu)
176{
177 if (spu->wbox_callback)
178 spu->wbox_callback(spu);
179
180 /* atomically disable SPU mailbox interrupts */
181 spin_lock(&spu->register_lock);
182 spu_int_mask_and(spu, 2, ~0x10);
183 spin_unlock(&spu->register_lock);
184 return 0;
185}
186
187static irqreturn_t
188spu_irq_class_0(int irq, void *data, struct pt_regs *regs)
189{
190 struct spu *spu;
191
192 spu = data;
193 spu->class_0_pending = 1;
194 if (spu->stop_callback)
195 spu->stop_callback(spu);
196
197 return IRQ_HANDLED;
198}
199
200int
201spu_irq_class_0_bottom(struct spu *spu)
202{
203 unsigned long stat, mask;
204
205 spu->class_0_pending = 0;
206
207 mask = spu_int_mask_get(spu, 0);
208 stat = spu_int_stat_get(spu, 0);
209
210 stat &= mask;
211
212 if (stat & 1) /* invalid MFC DMA */
213 __spu_trap_invalid_dma(spu);
214
215 if (stat & 2) /* invalid DMA alignment */
216 __spu_trap_dma_align(spu);
217
218 if (stat & 4) /* error on SPU */
219 __spu_trap_error(spu);
220
221 spu_int_stat_clear(spu, 0, stat);
222
223 return (stat & 0x7) ? -EIO : 0;
224}
225EXPORT_SYMBOL_GPL(spu_irq_class_0_bottom);
226
227static irqreturn_t
228spu_irq_class_1(int irq, void *data, struct pt_regs *regs)
229{
230 struct spu *spu;
231 unsigned long stat, mask, dar, dsisr;
232
233 spu = data;
234
235 /* atomically read & clear class1 status. */
236 spin_lock(&spu->register_lock);
237 mask = spu_int_mask_get(spu, 1);
238 stat = spu_int_stat_get(spu, 1) & mask;
239 dar = spu_mfc_dar_get(spu);
240 dsisr = spu_mfc_dsisr_get(spu);
241 if (stat & 2) /* mapping fault */
242 spu_mfc_dsisr_set(spu, 0ul);
243 spu_int_stat_clear(spu, 1, stat);
244 spin_unlock(&spu->register_lock);
245
246 if (stat & 1) /* segment fault */
247 __spu_trap_data_seg(spu, dar);
248
249 if (stat & 2) { /* mapping fault */
250 __spu_trap_data_map(spu, dar, dsisr);
251 }
252
253 if (stat & 4) /* ls compare & suspend on get */
254 ;
255
256 if (stat & 8) /* ls compare & suspend on put */
257 ;
258
259 return stat ? IRQ_HANDLED : IRQ_NONE;
260}
261EXPORT_SYMBOL_GPL(spu_irq_class_1_bottom);
262
263static irqreturn_t
264spu_irq_class_2(int irq, void *data, struct pt_regs *regs)
265{
266 struct spu *spu;
267 unsigned long stat;
268 unsigned long mask;
269
270 spu = data;
271 stat = spu_int_stat_get(spu, 2);
272 mask = spu_int_mask_get(spu, 2);
273
274 pr_debug("class 2 interrupt %d, %lx, %lx\n", irq, stat, mask);
275
276 stat &= mask;
277
278 if (stat & 1) /* PPC core mailbox */
279 __spu_trap_mailbox(spu);
280
281 if (stat & 2) /* SPU stop-and-signal */
282 __spu_trap_stop(spu);
283
284 if (stat & 4) /* SPU halted */
285 __spu_trap_halt(spu);
286
287 if (stat & 8) /* DMA tag group complete */
288 __spu_trap_tag_group(spu);
289
290 if (stat & 0x10) /* SPU mailbox threshold */
291 __spu_trap_spubox(spu);
292
293 spu_int_stat_clear(spu, 2, stat);
294 return stat ? IRQ_HANDLED : IRQ_NONE;
295}
296
297static int
298spu_request_irqs(struct spu *spu)
299{
300 int ret;
301 int irq_base;
302
303 irq_base = IIC_NODE_STRIDE * spu->node + IIC_SPE_OFFSET;
304
305 snprintf(spu->irq_c0, sizeof (spu->irq_c0), "spe%02d.0", spu->number);
306 ret = request_irq(irq_base + spu->isrc,
307 spu_irq_class_0, 0, spu->irq_c0, spu);
308 if (ret)
309 goto out;
310
311 snprintf(spu->irq_c1, sizeof (spu->irq_c1), "spe%02d.1", spu->number);
312 ret = request_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc,
313 spu_irq_class_1, 0, spu->irq_c1, spu);
314 if (ret)
315 goto out1;
316
317 snprintf(spu->irq_c2, sizeof (spu->irq_c2), "spe%02d.2", spu->number);
318 ret = request_irq(irq_base + 2*IIC_CLASS_STRIDE + spu->isrc,
319 spu_irq_class_2, 0, spu->irq_c2, spu);
320 if (ret)
321 goto out2;
322 goto out;
323
324out2:
325 free_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc, spu);
326out1:
327 free_irq(irq_base + spu->isrc, spu);
328out:
329 return ret;
330}
331
332static void
333spu_free_irqs(struct spu *spu)
334{
335 int irq_base;
336
337 irq_base = IIC_NODE_STRIDE * spu->node + IIC_SPE_OFFSET;
338
339 free_irq(irq_base + spu->isrc, spu);
340 free_irq(irq_base + IIC_CLASS_STRIDE + spu->isrc, spu);
341 free_irq(irq_base + 2*IIC_CLASS_STRIDE + spu->isrc, spu);
342}
343
344static LIST_HEAD(spu_list);
345static DECLARE_MUTEX(spu_mutex);
346
347static void spu_init_channels(struct spu *spu)
348{
349 static const struct {
350 unsigned channel;
351 unsigned count;
352 } zero_list[] = {
353 { 0x00, 1, }, { 0x01, 1, }, { 0x03, 1, }, { 0x04, 1, },
354 { 0x18, 1, }, { 0x19, 1, }, { 0x1b, 1, }, { 0x1d, 1, },
355 }, count_list[] = {
356 { 0x00, 0, }, { 0x03, 0, }, { 0x04, 0, }, { 0x15, 16, },
357 { 0x17, 1, }, { 0x18, 0, }, { 0x19, 0, }, { 0x1b, 0, },
358 { 0x1c, 1, }, { 0x1d, 0, }, { 0x1e, 1, },
359 };
360 struct spu_priv2 __iomem *priv2;
361 int i;
362
363 priv2 = spu->priv2;
364
365 /* initialize all channel data to zero */
366 for (i = 0; i < ARRAY_SIZE(zero_list); i++) {
367 int count;
368
369 out_be64(&priv2->spu_chnlcntptr_RW, zero_list[i].channel);
370 for (count = 0; count < zero_list[i].count; count++)
371 out_be64(&priv2->spu_chnldata_RW, 0);
372 }
373
374 /* initialize channel counts to meaningful values */
375 for (i = 0; i < ARRAY_SIZE(count_list); i++) {
376 out_be64(&priv2->spu_chnlcntptr_RW, count_list[i].channel);
377 out_be64(&priv2->spu_chnlcnt_RW, count_list[i].count);
378 }
379}
380
381struct spu *spu_alloc(void)
382{
383 struct spu *spu;
384
385 down(&spu_mutex);
386 if (!list_empty(&spu_list)) {
387 spu = list_entry(spu_list.next, struct spu, list);
388 list_del_init(&spu->list);
389 pr_debug("Got SPU %x %d\n", spu->isrc, spu->number);
390 } else {
391 pr_debug("No SPU left\n");
392 spu = NULL;
393 }
394 up(&spu_mutex);
395
396 if (spu)
397 spu_init_channels(spu);
398
399 return spu;
400}
401EXPORT_SYMBOL_GPL(spu_alloc);
402
403void spu_free(struct spu *spu)
404{
405 down(&spu_mutex);
406 list_add_tail(&spu->list, &spu_list);
407 up(&spu_mutex);
408}
409EXPORT_SYMBOL_GPL(spu_free);
410
411static int spu_handle_mm_fault(struct spu *spu)
412{
413 struct mm_struct *mm = spu->mm;
414 struct vm_area_struct *vma;
415 u64 ea, dsisr, is_write;
416 int ret;
417
418 ea = spu->dar;
419 dsisr = spu->dsisr;
420#if 0
421 if (!IS_VALID_EA(ea)) {
422 return -EFAULT;
423 }
424#endif /* XXX */
425 if (mm == NULL) {
426 return -EFAULT;
427 }
428 if (mm->pgd == NULL) {
429 return -EFAULT;
430 }
431
432 down_read(&mm->mmap_sem);
433 vma = find_vma(mm, ea);
434 if (!vma)
435 goto bad_area;
436 if (vma->vm_start <= ea)
437 goto good_area;
438 if (!(vma->vm_flags & VM_GROWSDOWN))
439 goto bad_area;
440#if 0
441 if (expand_stack(vma, ea))
442 goto bad_area;
443#endif /* XXX */
444good_area:
445 is_write = dsisr & MFC_DSISR_ACCESS_PUT;
446 if (is_write) {
447 if (!(vma->vm_flags & VM_WRITE))
448 goto bad_area;
449 } else {
450 if (dsisr & MFC_DSISR_ACCESS_DENIED)
451 goto bad_area;
452 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
453 goto bad_area;
454 }
455 ret = 0;
456 switch (handle_mm_fault(mm, vma, ea, is_write)) {
457 case VM_FAULT_MINOR:
458 current->min_flt++;
459 break;
460 case VM_FAULT_MAJOR:
461 current->maj_flt++;
462 break;
463 case VM_FAULT_SIGBUS:
464 ret = -EFAULT;
465 goto bad_area;
466 case VM_FAULT_OOM:
467 ret = -ENOMEM;
468 goto bad_area;
469 default:
470 BUG();
471 }
472 up_read(&mm->mmap_sem);
473 return ret;
474
475bad_area:
476 up_read(&mm->mmap_sem);
477 return -EFAULT;
478}
479
480int spu_irq_class_1_bottom(struct spu *spu)
481{
482 u64 ea, dsisr, access, error = 0UL;
483 int ret = 0;
484
485 ea = spu->dar;
486 dsisr = spu->dsisr;
487 if (dsisr & MFC_DSISR_PTE_NOT_FOUND) {
488 access = (_PAGE_PRESENT | _PAGE_USER);
489 access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL;
490 if (hash_page(ea, access, 0x300) != 0)
491 error |= CLASS1_ENABLE_STORAGE_FAULT_INTR;
492 }
493 if ((error & CLASS1_ENABLE_STORAGE_FAULT_INTR) ||
494 (dsisr & MFC_DSISR_ACCESS_DENIED)) {
495 if ((ret = spu_handle_mm_fault(spu)) != 0)
496 error |= CLASS1_ENABLE_STORAGE_FAULT_INTR;
497 else
498 error &= ~CLASS1_ENABLE_STORAGE_FAULT_INTR;
499 }
500 spu->dar = 0UL;
501 spu->dsisr = 0UL;
502 if (!error) {
503 spu_restart_dma(spu);
504 } else {
505 __spu_trap_invalid_dma(spu);
506 }
507 return ret;
508}
509
510void spu_irq_setaffinity(struct spu *spu, int cpu)
511{
512 u64 target = iic_get_target_id(cpu);
513 u64 route = target << 48 | target << 32 | target << 16;
514 spu_int_route_set(spu, route);
515}
516EXPORT_SYMBOL_GPL(spu_irq_setaffinity);
517
518static void __iomem * __init map_spe_prop(struct device_node *n,
519 const char *name)
520{
521 struct address_prop {
522 unsigned long address;
523 unsigned int len;
524 } __attribute__((packed)) *prop;
525
526 void *p;
527 int proplen;
528
529 p = get_property(n, name, &proplen);
530 if (proplen != sizeof (struct address_prop))
531 return NULL;
532
533 prop = p;
534
535 return ioremap(prop->address, prop->len);
536}
537
538static void spu_unmap(struct spu *spu)
539{
540 iounmap(spu->priv2);
541 iounmap(spu->priv1);
542 iounmap(spu->problem);
543 iounmap((u8 __iomem *)spu->local_store);
544}
545
546static int __init spu_map_device(struct spu *spu, struct device_node *spe)
547{
548 char *prop;
549 int ret;
550
551 ret = -ENODEV;
552 prop = get_property(spe, "isrc", NULL);
553 if (!prop)
554 goto out;
555 spu->isrc = *(unsigned int *)prop;
556
557 spu->name = get_property(spe, "name", NULL);
558 if (!spu->name)
559 goto out;
560
561 prop = get_property(spe, "local-store", NULL);
562 if (!prop)
563 goto out;
564 spu->local_store_phys = *(unsigned long *)prop;
565
566 /* we use local store as ram, not io memory */
567 spu->local_store = (void __force *)map_spe_prop(spe, "local-store");
568 if (!spu->local_store)
569 goto out;
570
571 spu->problem= map_spe_prop(spe, "problem");
572 if (!spu->problem)
573 goto out_unmap;
574
575 spu->priv1= map_spe_prop(spe, "priv1");
576 /* priv1 is not available on a hypervisor */
577
578 spu->priv2= map_spe_prop(spe, "priv2");
579 if (!spu->priv2)
580 goto out_unmap;
581 ret = 0;
582 goto out;
583
584out_unmap:
585 spu_unmap(spu);
586out:
587 return ret;
588}
589
590static int __init find_spu_node_id(struct device_node *spe)
591{
592 unsigned int *id;
593 struct device_node *cpu;
594
595 cpu = spe->parent->parent;
596 id = (unsigned int *)get_property(cpu, "node-id", NULL);
597
598 return id ? *id : 0;
599}
600
601static int __init create_spu(struct device_node *spe)
602{
603 struct spu *spu;
604 int ret;
605 static int number;
606
607 ret = -ENOMEM;
608 spu = kmalloc(sizeof (*spu), GFP_KERNEL);
609 if (!spu)
610 goto out;
611
612 ret = spu_map_device(spu, spe);
613 if (ret)
614 goto out_free;
615
616 spu->node = find_spu_node_id(spe);
617 spu->stop_code = 0;
618 spu->slb_replace = 0;
619 spu->mm = NULL;
620 spu->ctx = NULL;
621 spu->rq = NULL;
622 spu->pid = 0;
623 spu->class_0_pending = 0;
624 spu->flags = 0UL;
625 spu->dar = 0UL;
626 spu->dsisr = 0UL;
627 spin_lock_init(&spu->register_lock);
628
629 spu_mfc_sdr_set(spu, mfspr(SPRN_SDR1));
630 spu_mfc_sr1_set(spu, 0x33);
631
632 spu->ibox_callback = NULL;
633 spu->wbox_callback = NULL;
634 spu->stop_callback = NULL;
635
636 down(&spu_mutex);
637 spu->number = number++;
638 ret = spu_request_irqs(spu);
639 if (ret)
640 goto out_unmap;
641
642 list_add(&spu->list, &spu_list);
643 up(&spu_mutex);
644
645 pr_debug(KERN_DEBUG "Using SPE %s %02x %p %p %p %p %d\n",
646 spu->name, spu->isrc, spu->local_store,
647 spu->problem, spu->priv1, spu->priv2, spu->number);
648 goto out;
649
650out_unmap:
651 up(&spu_mutex);
652 spu_unmap(spu);
653out_free:
654 kfree(spu);
655out:
656 return ret;
657}
658
659static void destroy_spu(struct spu *spu)
660{
661 list_del_init(&spu->list);
662
663 spu_free_irqs(spu);
664 spu_unmap(spu);
665 kfree(spu);
666}
667
668static void cleanup_spu_base(void)
669{
670 struct spu *spu, *tmp;
671 down(&spu_mutex);
672 list_for_each_entry_safe(spu, tmp, &spu_list, list)
673 destroy_spu(spu);
674 up(&spu_mutex);
675}
676module_exit(cleanup_spu_base);
677
678static int __init init_spu_base(void)
679{
680 struct device_node *node;
681 int ret;
682
683 ret = -ENODEV;
684 for (node = of_find_node_by_type(NULL, "spe");
685 node; node = of_find_node_by_type(node, "spe")) {
686 ret = create_spu(node);
687 if (ret) {
688 printk(KERN_WARNING "%s: Error initializing %s\n",
689 __FUNCTION__, node->name);
690 cleanup_spu_base();
691 break;
692 }
693 }
694 /* in some old firmware versions, the spe is called 'spc', so we
695 look for that as well */
696 for (node = of_find_node_by_type(NULL, "spc");
697 node; node = of_find_node_by_type(node, "spc")) {
698 ret = create_spu(node);
699 if (ret) {
700 printk(KERN_WARNING "%s: Error initializing %s\n",
701 __FUNCTION__, node->name);
702 cleanup_spu_base();
703 break;
704 }
705 }
706 return ret;
707}
708module_init(init_spu_base);
709
710MODULE_LICENSE("GPL");
711MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>");
diff --git a/arch/powerpc/platforms/cell/spu_priv1.c b/arch/powerpc/platforms/cell/spu_priv1.c
new file mode 100644
index 000000000000..b2656421c7b5
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spu_priv1.c
@@ -0,0 +1,133 @@
1/*
2 * access to SPU privileged registers
3 */
4#include <linux/module.h>
5
6#include <asm/io.h>
7#include <asm/spu.h>
8
9void spu_int_mask_and(struct spu *spu, int class, u64 mask)
10{
11 u64 old_mask;
12
13 old_mask = in_be64(&spu->priv1->int_mask_RW[class]);
14 out_be64(&spu->priv1->int_mask_RW[class], old_mask & mask);
15}
16EXPORT_SYMBOL_GPL(spu_int_mask_and);
17
18void spu_int_mask_or(struct spu *spu, int class, u64 mask)
19{
20 u64 old_mask;
21
22 old_mask = in_be64(&spu->priv1->int_mask_RW[class]);
23 out_be64(&spu->priv1->int_mask_RW[class], old_mask | mask);
24}
25EXPORT_SYMBOL_GPL(spu_int_mask_or);
26
27void spu_int_mask_set(struct spu *spu, int class, u64 mask)
28{
29 out_be64(&spu->priv1->int_mask_RW[class], mask);
30}
31EXPORT_SYMBOL_GPL(spu_int_mask_set);
32
33u64 spu_int_mask_get(struct spu *spu, int class)
34{
35 return in_be64(&spu->priv1->int_mask_RW[class]);
36}
37EXPORT_SYMBOL_GPL(spu_int_mask_get);
38
39void spu_int_stat_clear(struct spu *spu, int class, u64 stat)
40{
41 out_be64(&spu->priv1->int_stat_RW[class], stat);
42}
43EXPORT_SYMBOL_GPL(spu_int_stat_clear);
44
45u64 spu_int_stat_get(struct spu *spu, int class)
46{
47 return in_be64(&spu->priv1->int_stat_RW[class]);
48}
49EXPORT_SYMBOL_GPL(spu_int_stat_get);
50
51void spu_int_route_set(struct spu *spu, u64 route)
52{
53 out_be64(&spu->priv1->int_route_RW, route);
54}
55EXPORT_SYMBOL_GPL(spu_int_route_set);
56
57u64 spu_mfc_dar_get(struct spu *spu)
58{
59 return in_be64(&spu->priv1->mfc_dar_RW);
60}
61EXPORT_SYMBOL_GPL(spu_mfc_dar_get);
62
63u64 spu_mfc_dsisr_get(struct spu *spu)
64{
65 return in_be64(&spu->priv1->mfc_dsisr_RW);
66}
67EXPORT_SYMBOL_GPL(spu_mfc_dsisr_get);
68
69void spu_mfc_dsisr_set(struct spu *spu, u64 dsisr)
70{
71 out_be64(&spu->priv1->mfc_dsisr_RW, dsisr);
72}
73EXPORT_SYMBOL_GPL(spu_mfc_dsisr_set);
74
75void spu_mfc_sdr_set(struct spu *spu, u64 sdr)
76{
77 out_be64(&spu->priv1->mfc_sdr_RW, sdr);
78}
79EXPORT_SYMBOL_GPL(spu_mfc_sdr_set);
80
81void spu_mfc_sr1_set(struct spu *spu, u64 sr1)
82{
83 out_be64(&spu->priv1->mfc_sr1_RW, sr1);
84}
85EXPORT_SYMBOL_GPL(spu_mfc_sr1_set);
86
87u64 spu_mfc_sr1_get(struct spu *spu)
88{
89 return in_be64(&spu->priv1->mfc_sr1_RW);
90}
91EXPORT_SYMBOL_GPL(spu_mfc_sr1_get);
92
93void spu_mfc_tclass_id_set(struct spu *spu, u64 tclass_id)
94{
95 out_be64(&spu->priv1->mfc_tclass_id_RW, tclass_id);
96}
97EXPORT_SYMBOL_GPL(spu_mfc_tclass_id_set);
98
99u64 spu_mfc_tclass_id_get(struct spu *spu)
100{
101 return in_be64(&spu->priv1->mfc_tclass_id_RW);
102}
103EXPORT_SYMBOL_GPL(spu_mfc_tclass_id_get);
104
105void spu_tlb_invalidate(struct spu *spu)
106{
107 out_be64(&spu->priv1->tlb_invalidate_entry_W, 0ul);
108}
109EXPORT_SYMBOL_GPL(spu_tlb_invalidate);
110
111void spu_resource_allocation_groupID_set(struct spu *spu, u64 id)
112{
113 out_be64(&spu->priv1->resource_allocation_groupID_RW, id);
114}
115EXPORT_SYMBOL_GPL(spu_resource_allocation_groupID_set);
116
117u64 spu_resource_allocation_groupID_get(struct spu *spu)
118{
119 return in_be64(&spu->priv1->resource_allocation_groupID_RW);
120}
121EXPORT_SYMBOL_GPL(spu_resource_allocation_groupID_get);
122
123void spu_resource_allocation_enable_set(struct spu *spu, u64 enable)
124{
125 out_be64(&spu->priv1->resource_allocation_enable_RW, enable);
126}
127EXPORT_SYMBOL_GPL(spu_resource_allocation_enable_set);
128
129u64 spu_resource_allocation_enable_get(struct spu *spu)
130{
131 return in_be64(&spu->priv1->resource_allocation_enable_RW);
132}
133EXPORT_SYMBOL_GPL(spu_resource_allocation_enable_get);
diff --git a/arch/powerpc/platforms/cell/spu_syscalls.c b/arch/powerpc/platforms/cell/spu_syscalls.c
new file mode 100644
index 000000000000..261b507a901a
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spu_syscalls.c
@@ -0,0 +1,88 @@
1/*
2 * SPU file system -- system call stubs
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22#include <linux/file.h>
23#include <linux/module.h>
24#include <linux/syscalls.h>
25
26#include <asm/spu.h>
27
28struct spufs_calls spufs_calls = {
29 .owner = NULL,
30};
31
32/* These stub syscalls are needed to have the actual implementation
33 * within a loadable module. When spufs is built into the kernel,
34 * this file is not used and the syscalls directly enter the fs code */
35
36asmlinkage long sys_spu_create(const char __user *name,
37 unsigned int flags, mode_t mode)
38{
39 long ret;
40 struct module *owner = spufs_calls.owner;
41
42 ret = -ENOSYS;
43 if (owner && try_module_get(owner)) {
44 ret = spufs_calls.create_thread(name, flags, mode);
45 module_put(owner);
46 }
47 return ret;
48}
49
50asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus)
51{
52 long ret;
53 struct file *filp;
54 int fput_needed;
55 struct module *owner = spufs_calls.owner;
56
57 ret = -ENOSYS;
58 if (owner && try_module_get(owner)) {
59 ret = -EBADF;
60 filp = fget_light(fd, &fput_needed);
61 if (filp) {
62 ret = spufs_calls.spu_run(filp, unpc, ustatus);
63 fput_light(filp, fput_needed);
64 }
65 module_put(owner);
66 }
67 return ret;
68}
69
70int register_spu_syscalls(struct spufs_calls *calls)
71{
72 if (spufs_calls.owner)
73 return -EBUSY;
74
75 spufs_calls.create_thread = calls->create_thread;
76 spufs_calls.spu_run = calls->spu_run;
77 smp_mb();
78 spufs_calls.owner = calls->owner;
79 return 0;
80}
81EXPORT_SYMBOL_GPL(register_spu_syscalls);
82
83void unregister_spu_syscalls(struct spufs_calls *calls)
84{
85 BUG_ON(spufs_calls.owner != calls->owner);
86 spufs_calls.owner = NULL;
87}
88EXPORT_SYMBOL_GPL(unregister_spu_syscalls);
diff --git a/arch/powerpc/platforms/cell/spufs/Makefile b/arch/powerpc/platforms/cell/spufs/Makefile
new file mode 100644
index 000000000000..a7cddf40e3d9
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/Makefile
@@ -0,0 +1,54 @@
1obj-$(CONFIG_SPU_FS) += spufs.o
2spufs-y += inode.o file.o context.o switch.o syscalls.o
3spufs-y += sched.o backing_ops.o hw_ops.o run.o
4
5# Rules to build switch.o with the help of SPU tool chain
6SPU_CROSS := spu-
7SPU_CC := $(SPU_CROSS)gcc
8SPU_AS := $(SPU_CROSS)gcc
9SPU_LD := $(SPU_CROSS)ld
10SPU_OBJCOPY := $(SPU_CROSS)objcopy
11SPU_CFLAGS := -O2 -Wall -I$(srctree)/include -I$(objtree)/include2
12SPU_AFLAGS := -c -D__ASSEMBLY__ -I$(srctree)/include -I$(objtree)/include2
13SPU_LDFLAGS := -N -Ttext=0x0
14
15$(obj)/switch.o: $(obj)/spu_save_dump.h $(obj)/spu_restore_dump.h
16
17# Compile SPU files
18 cmd_spu_cc = $(SPU_CC) $(SPU_CFLAGS) -c -o $@ $<
19quiet_cmd_spu_cc = SPU_CC $@
20$(obj)/spu_%.o: $(src)/spu_%.c
21 $(call if_changed,spu_cc)
22
23# Assemble SPU files
24 cmd_spu_as = $(SPU_AS) $(SPU_AFLAGS) -o $@ $<
25quiet_cmd_spu_as = SPU_AS $@
26$(obj)/spu_%.o: $(src)/spu_%.S
27 $(call if_changed,spu_as)
28
29# Link SPU Executables
30 cmd_spu_ld = $(SPU_LD) $(SPU_LDFLAGS) -o $@ $^
31quiet_cmd_spu_ld = SPU_LD $@
32$(obj)/spu_%: $(obj)/spu_%_crt0.o $(obj)/spu_%.o
33 $(call if_changed,spu_ld)
34
35# Copy into binary format
36 cmd_spu_objcopy = $(SPU_OBJCOPY) -O binary $< $@
37quiet_cmd_spu_objcopy = OBJCOPY $@
38$(obj)/spu_%.bin: $(src)/spu_%
39 $(call if_changed,spu_objcopy)
40
41# create C code from ELF executable
42cmd_hexdump = ( \
43 echo "/*" ; \
44 echo " * $*_dump.h: Copyright (C) 2005 IBM." ; \
45 echo " * Hex-dump auto generated from $*.c." ; \
46 echo " * Do not edit!" ; \
47 echo " */" ; \
48 echo "static unsigned int $*_code[] __page_aligned = {" ; \
49 hexdump -v -e '"0x" 4/1 "%02x" "," "\n"' $< ; \
50 echo "};" ; \
51 ) > $@
52quiet_cmd_hexdump = HEXDUMP $@
53$(obj)/%_dump.h: $(obj)/%.bin
54 $(call if_changed,hexdump)
diff --git a/arch/powerpc/platforms/cell/spufs/backing_ops.c b/arch/powerpc/platforms/cell/spufs/backing_ops.c
new file mode 100644
index 000000000000..a5c489a53c61
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/backing_ops.c
@@ -0,0 +1,308 @@
1/* backing_ops.c - query/set operations on saved SPU context.
2 *
3 * Copyright (C) IBM 2005
4 * Author: Mark Nutter <mnutter@us.ibm.com>
5 *
6 * These register operations allow SPUFS to operate on saved
7 * SPU contexts rather than hardware.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2, or (at your option)
12 * any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */
23
24#include <linux/config.h>
25#include <linux/module.h>
26#include <linux/errno.h>
27#include <linux/sched.h>
28#include <linux/kernel.h>
29#include <linux/mm.h>
30#include <linux/vmalloc.h>
31#include <linux/smp.h>
32#include <linux/smp_lock.h>
33#include <linux/stddef.h>
34#include <linux/unistd.h>
35#include <linux/poll.h>
36
37#include <asm/io.h>
38#include <asm/spu.h>
39#include <asm/spu_csa.h>
40#include <asm/mmu_context.h>
41#include "spufs.h"
42
43/*
44 * Reads/writes to various problem and priv2 registers require
45 * state changes, i.e. generate SPU events, modify channel
46 * counts, etc.
47 */
48
49static void gen_spu_event(struct spu_context *ctx, u32 event)
50{
51 u64 ch0_cnt;
52 u64 ch0_data;
53 u64 ch1_data;
54
55 ch0_cnt = ctx->csa.spu_chnlcnt_RW[0];
56 ch0_data = ctx->csa.spu_chnldata_RW[0];
57 ch1_data = ctx->csa.spu_chnldata_RW[1];
58 ctx->csa.spu_chnldata_RW[0] |= event;
59 if ((ch0_cnt == 0) && !(ch0_data & event) && (ch1_data & event)) {
60 ctx->csa.spu_chnlcnt_RW[0] = 1;
61 }
62}
63
64static int spu_backing_mbox_read(struct spu_context *ctx, u32 * data)
65{
66 u32 mbox_stat;
67 int ret = 0;
68
69 spin_lock(&ctx->csa.register_lock);
70 mbox_stat = ctx->csa.prob.mb_stat_R;
71 if (mbox_stat & 0x0000ff) {
72 /* Read the first available word.
73 * Implementation note: the depth
74 * of pu_mb_R is currently 1.
75 */
76 *data = ctx->csa.prob.pu_mb_R;
77 ctx->csa.prob.mb_stat_R &= ~(0x0000ff);
78 ctx->csa.spu_chnlcnt_RW[28] = 1;
79 gen_spu_event(ctx, MFC_PU_MAILBOX_AVAILABLE_EVENT);
80 ret = 4;
81 }
82 spin_unlock(&ctx->csa.register_lock);
83 return ret;
84}
85
86static u32 spu_backing_mbox_stat_read(struct spu_context *ctx)
87{
88 return ctx->csa.prob.mb_stat_R;
89}
90
91static unsigned int spu_backing_mbox_stat_poll(struct spu_context *ctx,
92 unsigned int events)
93{
94 int ret;
95 u32 stat;
96
97 ret = 0;
98 spin_lock_irq(&ctx->csa.register_lock);
99 stat = ctx->csa.prob.mb_stat_R;
100
101 /* if the requested event is there, return the poll
102 mask, otherwise enable the interrupt to get notified,
103 but first mark any pending interrupts as done so
104 we don't get woken up unnecessarily */
105
106 if (events & (POLLIN | POLLRDNORM)) {
107 if (stat & 0xff0000)
108 ret |= POLLIN | POLLRDNORM;
109 else {
110 ctx->csa.priv1.int_stat_class0_RW &= ~0x1;
111 ctx->csa.priv1.int_mask_class2_RW |= 0x1;
112 }
113 }
114 if (events & (POLLOUT | POLLWRNORM)) {
115 if (stat & 0x00ff00)
116 ret = POLLOUT | POLLWRNORM;
117 else {
118 ctx->csa.priv1.int_stat_class0_RW &= ~0x10;
119 ctx->csa.priv1.int_mask_class2_RW |= 0x10;
120 }
121 }
122 spin_unlock_irq(&ctx->csa.register_lock);
123 return ret;
124}
125
126static int spu_backing_ibox_read(struct spu_context *ctx, u32 * data)
127{
128 int ret;
129
130 spin_lock(&ctx->csa.register_lock);
131 if (ctx->csa.prob.mb_stat_R & 0xff0000) {
132 /* Read the first available word.
133 * Implementation note: the depth
134 * of puint_mb_R is currently 1.
135 */
136 *data = ctx->csa.priv2.puint_mb_R;
137 ctx->csa.prob.mb_stat_R &= ~(0xff0000);
138 ctx->csa.spu_chnlcnt_RW[30] = 1;
139 gen_spu_event(ctx, MFC_PU_INT_MAILBOX_AVAILABLE_EVENT);
140 ret = 4;
141 } else {
142 /* make sure we get woken up by the interrupt */
143 ctx->csa.priv1.int_mask_class2_RW |= 0x1UL;
144 ret = 0;
145 }
146 spin_unlock(&ctx->csa.register_lock);
147 return ret;
148}
149
150static int spu_backing_wbox_write(struct spu_context *ctx, u32 data)
151{
152 int ret;
153
154 spin_lock(&ctx->csa.register_lock);
155 if ((ctx->csa.prob.mb_stat_R) & 0x00ff00) {
156 int slot = ctx->csa.spu_chnlcnt_RW[29];
157 int avail = (ctx->csa.prob.mb_stat_R & 0x00ff00) >> 8;
158
159 /* We have space to write wbox_data.
160 * Implementation note: the depth
161 * of spu_mb_W is currently 4.
162 */
163 BUG_ON(avail != (4 - slot));
164 ctx->csa.spu_mailbox_data[slot] = data;
165 ctx->csa.spu_chnlcnt_RW[29] = ++slot;
166 ctx->csa.prob.mb_stat_R = (((4 - slot) & 0xff) << 8);
167 gen_spu_event(ctx, MFC_SPU_MAILBOX_WRITTEN_EVENT);
168 ret = 4;
169 } else {
170 /* make sure we get woken up by the interrupt when space
171 becomes available */
172 ctx->csa.priv1.int_mask_class2_RW |= 0x10;
173 ret = 0;
174 }
175 spin_unlock(&ctx->csa.register_lock);
176 return ret;
177}
178
179static u32 spu_backing_signal1_read(struct spu_context *ctx)
180{
181 return ctx->csa.spu_chnldata_RW[3];
182}
183
184static void spu_backing_signal1_write(struct spu_context *ctx, u32 data)
185{
186 spin_lock(&ctx->csa.register_lock);
187 if (ctx->csa.priv2.spu_cfg_RW & 0x1)
188 ctx->csa.spu_chnldata_RW[3] |= data;
189 else
190 ctx->csa.spu_chnldata_RW[3] = data;
191 ctx->csa.spu_chnlcnt_RW[3] = 1;
192 gen_spu_event(ctx, MFC_SIGNAL_1_EVENT);
193 spin_unlock(&ctx->csa.register_lock);
194}
195
196static u32 spu_backing_signal2_read(struct spu_context *ctx)
197{
198 return ctx->csa.spu_chnldata_RW[4];
199}
200
201static void spu_backing_signal2_write(struct spu_context *ctx, u32 data)
202{
203 spin_lock(&ctx->csa.register_lock);
204 if (ctx->csa.priv2.spu_cfg_RW & 0x2)
205 ctx->csa.spu_chnldata_RW[4] |= data;
206 else
207 ctx->csa.spu_chnldata_RW[4] = data;
208 ctx->csa.spu_chnlcnt_RW[4] = 1;
209 gen_spu_event(ctx, MFC_SIGNAL_2_EVENT);
210 spin_unlock(&ctx->csa.register_lock);
211}
212
213static void spu_backing_signal1_type_set(struct spu_context *ctx, u64 val)
214{
215 u64 tmp;
216
217 spin_lock(&ctx->csa.register_lock);
218 tmp = ctx->csa.priv2.spu_cfg_RW;
219 if (val)
220 tmp |= 1;
221 else
222 tmp &= ~1;
223 ctx->csa.priv2.spu_cfg_RW = tmp;
224 spin_unlock(&ctx->csa.register_lock);
225}
226
227static u64 spu_backing_signal1_type_get(struct spu_context *ctx)
228{
229 return ((ctx->csa.priv2.spu_cfg_RW & 1) != 0);
230}
231
232static void spu_backing_signal2_type_set(struct spu_context *ctx, u64 val)
233{
234 u64 tmp;
235
236 spin_lock(&ctx->csa.register_lock);
237 tmp = ctx->csa.priv2.spu_cfg_RW;
238 if (val)
239 tmp |= 2;
240 else
241 tmp &= ~2;
242 ctx->csa.priv2.spu_cfg_RW = tmp;
243 spin_unlock(&ctx->csa.register_lock);
244}
245
246static u64 spu_backing_signal2_type_get(struct spu_context *ctx)
247{
248 return ((ctx->csa.priv2.spu_cfg_RW & 2) != 0);
249}
250
251static u32 spu_backing_npc_read(struct spu_context *ctx)
252{
253 return ctx->csa.prob.spu_npc_RW;
254}
255
256static void spu_backing_npc_write(struct spu_context *ctx, u32 val)
257{
258 ctx->csa.prob.spu_npc_RW = val;
259}
260
261static u32 spu_backing_status_read(struct spu_context *ctx)
262{
263 return ctx->csa.prob.spu_status_R;
264}
265
266static char *spu_backing_get_ls(struct spu_context *ctx)
267{
268 return ctx->csa.lscsa->ls;
269}
270
271static void spu_backing_runcntl_write(struct spu_context *ctx, u32 val)
272{
273 spin_lock(&ctx->csa.register_lock);
274 ctx->csa.prob.spu_runcntl_RW = val;
275 if (val & SPU_RUNCNTL_RUNNABLE) {
276 ctx->csa.prob.spu_status_R |= SPU_STATUS_RUNNING;
277 } else {
278 ctx->csa.prob.spu_status_R &= ~SPU_STATUS_RUNNING;
279 }
280 spin_unlock(&ctx->csa.register_lock);
281}
282
283static void spu_backing_runcntl_stop(struct spu_context *ctx)
284{
285 spu_backing_runcntl_write(ctx, SPU_RUNCNTL_STOP);
286}
287
288struct spu_context_ops spu_backing_ops = {
289 .mbox_read = spu_backing_mbox_read,
290 .mbox_stat_read = spu_backing_mbox_stat_read,
291 .mbox_stat_poll = spu_backing_mbox_stat_poll,
292 .ibox_read = spu_backing_ibox_read,
293 .wbox_write = spu_backing_wbox_write,
294 .signal1_read = spu_backing_signal1_read,
295 .signal1_write = spu_backing_signal1_write,
296 .signal2_read = spu_backing_signal2_read,
297 .signal2_write = spu_backing_signal2_write,
298 .signal1_type_set = spu_backing_signal1_type_set,
299 .signal1_type_get = spu_backing_signal1_type_get,
300 .signal2_type_set = spu_backing_signal2_type_set,
301 .signal2_type_get = spu_backing_signal2_type_get,
302 .npc_read = spu_backing_npc_read,
303 .npc_write = spu_backing_npc_write,
304 .status_read = spu_backing_status_read,
305 .get_ls = spu_backing_get_ls,
306 .runcntl_write = spu_backing_runcntl_write,
307 .runcntl_stop = spu_backing_runcntl_stop,
308};
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
new file mode 100644
index 000000000000..336f238102fd
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -0,0 +1,167 @@
1/*
2 * SPU file system -- SPU context management
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include <linux/fs.h>
24#include <linux/mm.h>
25#include <linux/slab.h>
26#include <asm/spu.h>
27#include <asm/spu_csa.h>
28#include "spufs.h"
29
30struct spu_context *alloc_spu_context(struct address_space *local_store)
31{
32 struct spu_context *ctx;
33 ctx = kmalloc(sizeof *ctx, GFP_KERNEL);
34 if (!ctx)
35 goto out;
36 /* Binding to physical processor deferred
37 * until spu_activate().
38 */
39 spu_init_csa(&ctx->csa);
40 if (!ctx->csa.lscsa) {
41 goto out_free;
42 }
43 spin_lock_init(&ctx->mmio_lock);
44 kref_init(&ctx->kref);
45 init_rwsem(&ctx->state_sema);
46 init_MUTEX(&ctx->run_sema);
47 init_waitqueue_head(&ctx->ibox_wq);
48 init_waitqueue_head(&ctx->wbox_wq);
49 init_waitqueue_head(&ctx->stop_wq);
50 ctx->ibox_fasync = NULL;
51 ctx->wbox_fasync = NULL;
52 ctx->state = SPU_STATE_SAVED;
53 ctx->local_store = local_store;
54 ctx->spu = NULL;
55 ctx->ops = &spu_backing_ops;
56 ctx->owner = get_task_mm(current);
57 goto out;
58out_free:
59 kfree(ctx);
60 ctx = NULL;
61out:
62 return ctx;
63}
64
65void destroy_spu_context(struct kref *kref)
66{
67 struct spu_context *ctx;
68 ctx = container_of(kref, struct spu_context, kref);
69 down_write(&ctx->state_sema);
70 spu_deactivate(ctx);
71 ctx->ibox_fasync = NULL;
72 ctx->wbox_fasync = NULL;
73 up_write(&ctx->state_sema);
74 spu_fini_csa(&ctx->csa);
75 kfree(ctx);
76}
77
78struct spu_context * get_spu_context(struct spu_context *ctx)
79{
80 kref_get(&ctx->kref);
81 return ctx;
82}
83
84int put_spu_context(struct spu_context *ctx)
85{
86 return kref_put(&ctx->kref, &destroy_spu_context);
87}
88
89/* give up the mm reference when the context is about to be destroyed */
90void spu_forget(struct spu_context *ctx)
91{
92 struct mm_struct *mm;
93 spu_acquire_saved(ctx);
94 mm = ctx->owner;
95 ctx->owner = NULL;
96 mmput(mm);
97 spu_release(ctx);
98}
99
100void spu_acquire(struct spu_context *ctx)
101{
102 down_read(&ctx->state_sema);
103}
104
105void spu_release(struct spu_context *ctx)
106{
107 up_read(&ctx->state_sema);
108}
109
110void spu_unmap_mappings(struct spu_context *ctx)
111{
112 unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1);
113}
114
115int spu_acquire_runnable(struct spu_context *ctx)
116{
117 int ret = 0;
118
119 down_read(&ctx->state_sema);
120 if (ctx->state == SPU_STATE_RUNNABLE) {
121 ctx->spu->prio = current->prio;
122 return 0;
123 }
124 up_read(&ctx->state_sema);
125
126 down_write(&ctx->state_sema);
127 /* ctx is about to be freed, can't acquire any more */
128 if (!ctx->owner) {
129 ret = -EINVAL;
130 goto out;
131 }
132
133 if (ctx->state == SPU_STATE_SAVED) {
134 ret = spu_activate(ctx, 0);
135 if (ret)
136 goto out;
137 ctx->state = SPU_STATE_RUNNABLE;
138 }
139
140 downgrade_write(&ctx->state_sema);
141 /* On success, we return holding the lock */
142
143 return ret;
144out:
145 /* Release here, to simplify calling code. */
146 up_write(&ctx->state_sema);
147
148 return ret;
149}
150
151void spu_acquire_saved(struct spu_context *ctx)
152{
153 down_read(&ctx->state_sema);
154
155 if (ctx->state == SPU_STATE_SAVED)
156 return;
157
158 up_read(&ctx->state_sema);
159 down_write(&ctx->state_sema);
160
161 if (ctx->state == SPU_STATE_RUNNABLE) {
162 spu_deactivate(ctx);
163 ctx->state = SPU_STATE_SAVED;
164 }
165
166 downgrade_write(&ctx->state_sema);
167}
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
new file mode 100644
index 000000000000..dfa649c9b956
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -0,0 +1,794 @@
1/*
2 * SPU file system -- file contents
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include <linux/fs.h>
24#include <linux/ioctl.h>
25#include <linux/module.h>
26#include <linux/pagemap.h>
27#include <linux/poll.h>
28#include <linux/ptrace.h>
29
30#include <asm/io.h>
31#include <asm/semaphore.h>
32#include <asm/spu.h>
33#include <asm/uaccess.h>
34
35#include "spufs.h"
36
37
38static int
39spufs_mem_open(struct inode *inode, struct file *file)
40{
41 struct spufs_inode_info *i = SPUFS_I(inode);
42 file->private_data = i->i_ctx;
43 file->f_mapping = i->i_ctx->local_store;
44 return 0;
45}
46
47static ssize_t
48spufs_mem_read(struct file *file, char __user *buffer,
49 size_t size, loff_t *pos)
50{
51 struct spu_context *ctx = file->private_data;
52 char *local_store;
53 int ret;
54
55 spu_acquire(ctx);
56
57 local_store = ctx->ops->get_ls(ctx);
58 ret = simple_read_from_buffer(buffer, size, pos, local_store, LS_SIZE);
59
60 spu_release(ctx);
61 return ret;
62}
63
64static ssize_t
65spufs_mem_write(struct file *file, const char __user *buffer,
66 size_t size, loff_t *pos)
67{
68 struct spu_context *ctx = file->private_data;
69 char *local_store;
70 int ret;
71
72 size = min_t(ssize_t, LS_SIZE - *pos, size);
73 if (size <= 0)
74 return -EFBIG;
75 *pos += size;
76
77 spu_acquire(ctx);
78
79 local_store = ctx->ops->get_ls(ctx);
80 ret = copy_from_user(local_store + *pos - size,
81 buffer, size) ? -EFAULT : size;
82
83 spu_release(ctx);
84 return ret;
85}
86
87#ifdef CONFIG_SPARSEMEM
88static struct page *
89spufs_mem_mmap_nopage(struct vm_area_struct *vma,
90 unsigned long address, int *type)
91{
92 struct page *page = NOPAGE_SIGBUS;
93
94 struct spu_context *ctx = vma->vm_file->private_data;
95 unsigned long offset = address - vma->vm_start;
96 offset += vma->vm_pgoff << PAGE_SHIFT;
97
98 spu_acquire(ctx);
99
100 if (ctx->state == SPU_STATE_SAVED)
101 page = vmalloc_to_page(ctx->csa.lscsa->ls + offset);
102 else
103 page = pfn_to_page((ctx->spu->local_store_phys + offset)
104 >> PAGE_SHIFT);
105
106 spu_release(ctx);
107
108 if (type)
109 *type = VM_FAULT_MINOR;
110
111 page_cache_get(page);
112 return page;
113}
114
115static struct vm_operations_struct spufs_mem_mmap_vmops = {
116 .nopage = spufs_mem_mmap_nopage,
117};
118
119static int
120spufs_mem_mmap(struct file *file, struct vm_area_struct *vma)
121{
122 if (!(vma->vm_flags & VM_SHARED))
123 return -EINVAL;
124
125 /* FIXME: */
126 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
127 | _PAGE_NO_CACHE);
128
129 vma->vm_ops = &spufs_mem_mmap_vmops;
130 return 0;
131}
132#endif
133
134static struct file_operations spufs_mem_fops = {
135 .open = spufs_mem_open,
136 .read = spufs_mem_read,
137 .write = spufs_mem_write,
138 .llseek = generic_file_llseek,
139#ifdef CONFIG_SPARSEMEM
140 .mmap = spufs_mem_mmap,
141#endif
142};
143
144static int
145spufs_regs_open(struct inode *inode, struct file *file)
146{
147 struct spufs_inode_info *i = SPUFS_I(inode);
148 file->private_data = i->i_ctx;
149 return 0;
150}
151
152static ssize_t
153spufs_regs_read(struct file *file, char __user *buffer,
154 size_t size, loff_t *pos)
155{
156 struct spu_context *ctx = file->private_data;
157 struct spu_lscsa *lscsa = ctx->csa.lscsa;
158 int ret;
159
160 spu_acquire_saved(ctx);
161
162 ret = simple_read_from_buffer(buffer, size, pos,
163 lscsa->gprs, sizeof lscsa->gprs);
164
165 spu_release(ctx);
166 return ret;
167}
168
169static ssize_t
170spufs_regs_write(struct file *file, const char __user *buffer,
171 size_t size, loff_t *pos)
172{
173 struct spu_context *ctx = file->private_data;
174 struct spu_lscsa *lscsa = ctx->csa.lscsa;
175 int ret;
176
177 size = min_t(ssize_t, sizeof lscsa->gprs - *pos, size);
178 if (size <= 0)
179 return -EFBIG;
180 *pos += size;
181
182 spu_acquire_saved(ctx);
183
184 ret = copy_from_user(lscsa->gprs + *pos - size,
185 buffer, size) ? -EFAULT : size;
186
187 spu_release(ctx);
188 return ret;
189}
190
191static struct file_operations spufs_regs_fops = {
192 .open = spufs_regs_open,
193 .read = spufs_regs_read,
194 .write = spufs_regs_write,
195 .llseek = generic_file_llseek,
196};
197
198static ssize_t
199spufs_fpcr_read(struct file *file, char __user * buffer,
200 size_t size, loff_t * pos)
201{
202 struct spu_context *ctx = file->private_data;
203 struct spu_lscsa *lscsa = ctx->csa.lscsa;
204 int ret;
205
206 spu_acquire_saved(ctx);
207
208 ret = simple_read_from_buffer(buffer, size, pos,
209 &lscsa->fpcr, sizeof(lscsa->fpcr));
210
211 spu_release(ctx);
212 return ret;
213}
214
215static ssize_t
216spufs_fpcr_write(struct file *file, const char __user * buffer,
217 size_t size, loff_t * pos)
218{
219 struct spu_context *ctx = file->private_data;
220 struct spu_lscsa *lscsa = ctx->csa.lscsa;
221 int ret;
222
223 size = min_t(ssize_t, sizeof(lscsa->fpcr) - *pos, size);
224 if (size <= 0)
225 return -EFBIG;
226 *pos += size;
227
228 spu_acquire_saved(ctx);
229
230 ret = copy_from_user((char *)&lscsa->fpcr + *pos - size,
231 buffer, size) ? -EFAULT : size;
232
233 spu_release(ctx);
234 return ret;
235}
236
237static struct file_operations spufs_fpcr_fops = {
238 .open = spufs_regs_open,
239 .read = spufs_fpcr_read,
240 .write = spufs_fpcr_write,
241 .llseek = generic_file_llseek,
242};
243
244/* generic open function for all pipe-like files */
245static int spufs_pipe_open(struct inode *inode, struct file *file)
246{
247 struct spufs_inode_info *i = SPUFS_I(inode);
248 file->private_data = i->i_ctx;
249
250 return nonseekable_open(inode, file);
251}
252
253static ssize_t spufs_mbox_read(struct file *file, char __user *buf,
254 size_t len, loff_t *pos)
255{
256 struct spu_context *ctx = file->private_data;
257 u32 mbox_data;
258 int ret;
259
260 if (len < 4)
261 return -EINVAL;
262
263 spu_acquire(ctx);
264 ret = ctx->ops->mbox_read(ctx, &mbox_data);
265 spu_release(ctx);
266
267 if (!ret)
268 return -EAGAIN;
269
270 if (copy_to_user(buf, &mbox_data, sizeof mbox_data))
271 return -EFAULT;
272
273 return 4;
274}
275
276static struct file_operations spufs_mbox_fops = {
277 .open = spufs_pipe_open,
278 .read = spufs_mbox_read,
279};
280
281static ssize_t spufs_mbox_stat_read(struct file *file, char __user *buf,
282 size_t len, loff_t *pos)
283{
284 struct spu_context *ctx = file->private_data;
285 u32 mbox_stat;
286
287 if (len < 4)
288 return -EINVAL;
289
290 spu_acquire(ctx);
291
292 mbox_stat = ctx->ops->mbox_stat_read(ctx) & 0xff;
293
294 spu_release(ctx);
295
296 if (copy_to_user(buf, &mbox_stat, sizeof mbox_stat))
297 return -EFAULT;
298
299 return 4;
300}
301
302static struct file_operations spufs_mbox_stat_fops = {
303 .open = spufs_pipe_open,
304 .read = spufs_mbox_stat_read,
305};
306
307/* low-level ibox access function */
308size_t spu_ibox_read(struct spu_context *ctx, u32 *data)
309{
310 return ctx->ops->ibox_read(ctx, data);
311}
312
313static int spufs_ibox_fasync(int fd, struct file *file, int on)
314{
315 struct spu_context *ctx = file->private_data;
316
317 return fasync_helper(fd, file, on, &ctx->ibox_fasync);
318}
319
320/* interrupt-level ibox callback function. */
321void spufs_ibox_callback(struct spu *spu)
322{
323 struct spu_context *ctx = spu->ctx;
324
325 wake_up_all(&ctx->ibox_wq);
326 kill_fasync(&ctx->ibox_fasync, SIGIO, POLLIN);
327}
328
329static ssize_t spufs_ibox_read(struct file *file, char __user *buf,
330 size_t len, loff_t *pos)
331{
332 struct spu_context *ctx = file->private_data;
333 u32 ibox_data;
334 ssize_t ret;
335
336 if (len < 4)
337 return -EINVAL;
338
339 spu_acquire(ctx);
340
341 ret = 0;
342 if (file->f_flags & O_NONBLOCK) {
343 if (!spu_ibox_read(ctx, &ibox_data))
344 ret = -EAGAIN;
345 } else {
346 ret = spufs_wait(ctx->ibox_wq, spu_ibox_read(ctx, &ibox_data));
347 }
348
349 spu_release(ctx);
350
351 if (ret)
352 return ret;
353
354 ret = 4;
355 if (copy_to_user(buf, &ibox_data, sizeof ibox_data))
356 ret = -EFAULT;
357
358 return ret;
359}
360
361static unsigned int spufs_ibox_poll(struct file *file, poll_table *wait)
362{
363 struct spu_context *ctx = file->private_data;
364 unsigned int mask;
365
366 poll_wait(file, &ctx->ibox_wq, wait);
367
368 spu_acquire(ctx);
369 mask = ctx->ops->mbox_stat_poll(ctx, POLLIN | POLLRDNORM);
370 spu_release(ctx);
371
372 return mask;
373}
374
375static struct file_operations spufs_ibox_fops = {
376 .open = spufs_pipe_open,
377 .read = spufs_ibox_read,
378 .poll = spufs_ibox_poll,
379 .fasync = spufs_ibox_fasync,
380};
381
382static ssize_t spufs_ibox_stat_read(struct file *file, char __user *buf,
383 size_t len, loff_t *pos)
384{
385 struct spu_context *ctx = file->private_data;
386 u32 ibox_stat;
387
388 if (len < 4)
389 return -EINVAL;
390
391 spu_acquire(ctx);
392 ibox_stat = (ctx->ops->mbox_stat_read(ctx) >> 16) & 0xff;
393 spu_release(ctx);
394
395 if (copy_to_user(buf, &ibox_stat, sizeof ibox_stat))
396 return -EFAULT;
397
398 return 4;
399}
400
401static struct file_operations spufs_ibox_stat_fops = {
402 .open = spufs_pipe_open,
403 .read = spufs_ibox_stat_read,
404};
405
406/* low-level mailbox write */
407size_t spu_wbox_write(struct spu_context *ctx, u32 data)
408{
409 return ctx->ops->wbox_write(ctx, data);
410}
411
412static int spufs_wbox_fasync(int fd, struct file *file, int on)
413{
414 struct spu_context *ctx = file->private_data;
415 int ret;
416
417 ret = fasync_helper(fd, file, on, &ctx->wbox_fasync);
418
419 return ret;
420}
421
422/* interrupt-level wbox callback function. */
423void spufs_wbox_callback(struct spu *spu)
424{
425 struct spu_context *ctx = spu->ctx;
426
427 wake_up_all(&ctx->wbox_wq);
428 kill_fasync(&ctx->wbox_fasync, SIGIO, POLLOUT);
429}
430
431static ssize_t spufs_wbox_write(struct file *file, const char __user *buf,
432 size_t len, loff_t *pos)
433{
434 struct spu_context *ctx = file->private_data;
435 u32 wbox_data;
436 int ret;
437
438 if (len < 4)
439 return -EINVAL;
440
441 if (copy_from_user(&wbox_data, buf, sizeof wbox_data))
442 return -EFAULT;
443
444 spu_acquire(ctx);
445
446 ret = 0;
447 if (file->f_flags & O_NONBLOCK) {
448 if (!spu_wbox_write(ctx, wbox_data))
449 ret = -EAGAIN;
450 } else {
451 ret = spufs_wait(ctx->wbox_wq, spu_wbox_write(ctx, wbox_data));
452 }
453
454 spu_release(ctx);
455
456 return ret ? ret : sizeof wbox_data;
457}
458
459static unsigned int spufs_wbox_poll(struct file *file, poll_table *wait)
460{
461 struct spu_context *ctx = file->private_data;
462 unsigned int mask;
463
464 poll_wait(file, &ctx->wbox_wq, wait);
465
466 spu_acquire(ctx);
467 mask = ctx->ops->mbox_stat_poll(ctx, POLLOUT | POLLWRNORM);
468 spu_release(ctx);
469
470 return mask;
471}
472
473static struct file_operations spufs_wbox_fops = {
474 .open = spufs_pipe_open,
475 .write = spufs_wbox_write,
476 .poll = spufs_wbox_poll,
477 .fasync = spufs_wbox_fasync,
478};
479
480static ssize_t spufs_wbox_stat_read(struct file *file, char __user *buf,
481 size_t len, loff_t *pos)
482{
483 struct spu_context *ctx = file->private_data;
484 u32 wbox_stat;
485
486 if (len < 4)
487 return -EINVAL;
488
489 spu_acquire(ctx);
490 wbox_stat = (ctx->ops->mbox_stat_read(ctx) >> 8) & 0xff;
491 spu_release(ctx);
492
493 if (copy_to_user(buf, &wbox_stat, sizeof wbox_stat))
494 return -EFAULT;
495
496 return 4;
497}
498
499static struct file_operations spufs_wbox_stat_fops = {
500 .open = spufs_pipe_open,
501 .read = spufs_wbox_stat_read,
502};
503
504static ssize_t spufs_signal1_read(struct file *file, char __user *buf,
505 size_t len, loff_t *pos)
506{
507 struct spu_context *ctx = file->private_data;
508 u32 data;
509
510 if (len < 4)
511 return -EINVAL;
512
513 spu_acquire(ctx);
514 data = ctx->ops->signal1_read(ctx);
515 spu_release(ctx);
516
517 if (copy_to_user(buf, &data, 4))
518 return -EFAULT;
519
520 return 4;
521}
522
523static ssize_t spufs_signal1_write(struct file *file, const char __user *buf,
524 size_t len, loff_t *pos)
525{
526 struct spu_context *ctx;
527 u32 data;
528
529 ctx = file->private_data;
530
531 if (len < 4)
532 return -EINVAL;
533
534 if (copy_from_user(&data, buf, 4))
535 return -EFAULT;
536
537 spu_acquire(ctx);
538 ctx->ops->signal1_write(ctx, data);
539 spu_release(ctx);
540
541 return 4;
542}
543
544static struct file_operations spufs_signal1_fops = {
545 .open = spufs_pipe_open,
546 .read = spufs_signal1_read,
547 .write = spufs_signal1_write,
548};
549
550static ssize_t spufs_signal2_read(struct file *file, char __user *buf,
551 size_t len, loff_t *pos)
552{
553 struct spu_context *ctx;
554 u32 data;
555
556 ctx = file->private_data;
557
558 if (len < 4)
559 return -EINVAL;
560
561 spu_acquire(ctx);
562 data = ctx->ops->signal2_read(ctx);
563 spu_release(ctx);
564
565 if (copy_to_user(buf, &data, 4))
566 return -EFAULT;
567
568 return 4;
569}
570
571static ssize_t spufs_signal2_write(struct file *file, const char __user *buf,
572 size_t len, loff_t *pos)
573{
574 struct spu_context *ctx;
575 u32 data;
576
577 ctx = file->private_data;
578
579 if (len < 4)
580 return -EINVAL;
581
582 if (copy_from_user(&data, buf, 4))
583 return -EFAULT;
584
585 spu_acquire(ctx);
586 ctx->ops->signal2_write(ctx, data);
587 spu_release(ctx);
588
589 return 4;
590}
591
592static struct file_operations spufs_signal2_fops = {
593 .open = spufs_pipe_open,
594 .read = spufs_signal2_read,
595 .write = spufs_signal2_write,
596};
597
598static void spufs_signal1_type_set(void *data, u64 val)
599{
600 struct spu_context *ctx = data;
601
602 spu_acquire(ctx);
603 ctx->ops->signal1_type_set(ctx, val);
604 spu_release(ctx);
605}
606
607static u64 spufs_signal1_type_get(void *data)
608{
609 struct spu_context *ctx = data;
610 u64 ret;
611
612 spu_acquire(ctx);
613 ret = ctx->ops->signal1_type_get(ctx);
614 spu_release(ctx);
615
616 return ret;
617}
618DEFINE_SIMPLE_ATTRIBUTE(spufs_signal1_type, spufs_signal1_type_get,
619 spufs_signal1_type_set, "%llu");
620
621static void spufs_signal2_type_set(void *data, u64 val)
622{
623 struct spu_context *ctx = data;
624
625 spu_acquire(ctx);
626 ctx->ops->signal2_type_set(ctx, val);
627 spu_release(ctx);
628}
629
630static u64 spufs_signal2_type_get(void *data)
631{
632 struct spu_context *ctx = data;
633 u64 ret;
634
635 spu_acquire(ctx);
636 ret = ctx->ops->signal2_type_get(ctx);
637 spu_release(ctx);
638
639 return ret;
640}
641DEFINE_SIMPLE_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get,
642 spufs_signal2_type_set, "%llu");
643
644static void spufs_npc_set(void *data, u64 val)
645{
646 struct spu_context *ctx = data;
647 spu_acquire(ctx);
648 ctx->ops->npc_write(ctx, val);
649 spu_release(ctx);
650}
651
652static u64 spufs_npc_get(void *data)
653{
654 struct spu_context *ctx = data;
655 u64 ret;
656 spu_acquire(ctx);
657 ret = ctx->ops->npc_read(ctx);
658 spu_release(ctx);
659 return ret;
660}
661DEFINE_SIMPLE_ATTRIBUTE(spufs_npc_ops, spufs_npc_get, spufs_npc_set, "%llx\n")
662
663static void spufs_decr_set(void *data, u64 val)
664{
665 struct spu_context *ctx = data;
666 struct spu_lscsa *lscsa = ctx->csa.lscsa;
667 spu_acquire_saved(ctx);
668 lscsa->decr.slot[0] = (u32) val;
669 spu_release(ctx);
670}
671
672static u64 spufs_decr_get(void *data)
673{
674 struct spu_context *ctx = data;
675 struct spu_lscsa *lscsa = ctx->csa.lscsa;
676 u64 ret;
677 spu_acquire_saved(ctx);
678 ret = lscsa->decr.slot[0];
679 spu_release(ctx);
680 return ret;
681}
682DEFINE_SIMPLE_ATTRIBUTE(spufs_decr_ops, spufs_decr_get, spufs_decr_set,
683 "%llx\n")
684
685static void spufs_decr_status_set(void *data, u64 val)
686{
687 struct spu_context *ctx = data;
688 struct spu_lscsa *lscsa = ctx->csa.lscsa;
689 spu_acquire_saved(ctx);
690 lscsa->decr_status.slot[0] = (u32) val;
691 spu_release(ctx);
692}
693
694static u64 spufs_decr_status_get(void *data)
695{
696 struct spu_context *ctx = data;
697 struct spu_lscsa *lscsa = ctx->csa.lscsa;
698 u64 ret;
699 spu_acquire_saved(ctx);
700 ret = lscsa->decr_status.slot[0];
701 spu_release(ctx);
702 return ret;
703}
704DEFINE_SIMPLE_ATTRIBUTE(spufs_decr_status_ops, spufs_decr_status_get,
705 spufs_decr_status_set, "%llx\n")
706
707static void spufs_spu_tag_mask_set(void *data, u64 val)
708{
709 struct spu_context *ctx = data;
710 struct spu_lscsa *lscsa = ctx->csa.lscsa;
711 spu_acquire_saved(ctx);
712 lscsa->tag_mask.slot[0] = (u32) val;
713 spu_release(ctx);
714}
715
716static u64 spufs_spu_tag_mask_get(void *data)
717{
718 struct spu_context *ctx = data;
719 struct spu_lscsa *lscsa = ctx->csa.lscsa;
720 u64 ret;
721 spu_acquire_saved(ctx);
722 ret = lscsa->tag_mask.slot[0];
723 spu_release(ctx);
724 return ret;
725}
726DEFINE_SIMPLE_ATTRIBUTE(spufs_spu_tag_mask_ops, spufs_spu_tag_mask_get,
727 spufs_spu_tag_mask_set, "%llx\n")
728
729static void spufs_event_mask_set(void *data, u64 val)
730{
731 struct spu_context *ctx = data;
732 struct spu_lscsa *lscsa = ctx->csa.lscsa;
733 spu_acquire_saved(ctx);
734 lscsa->event_mask.slot[0] = (u32) val;
735 spu_release(ctx);
736}
737
738static u64 spufs_event_mask_get(void *data)
739{
740 struct spu_context *ctx = data;
741 struct spu_lscsa *lscsa = ctx->csa.lscsa;
742 u64 ret;
743 spu_acquire_saved(ctx);
744 ret = lscsa->event_mask.slot[0];
745 spu_release(ctx);
746 return ret;
747}
748DEFINE_SIMPLE_ATTRIBUTE(spufs_event_mask_ops, spufs_event_mask_get,
749 spufs_event_mask_set, "%llx\n")
750
751static void spufs_srr0_set(void *data, u64 val)
752{
753 struct spu_context *ctx = data;
754 struct spu_lscsa *lscsa = ctx->csa.lscsa;
755 spu_acquire_saved(ctx);
756 lscsa->srr0.slot[0] = (u32) val;
757 spu_release(ctx);
758}
759
760static u64 spufs_srr0_get(void *data)
761{
762 struct spu_context *ctx = data;
763 struct spu_lscsa *lscsa = ctx->csa.lscsa;
764 u64 ret;
765 spu_acquire_saved(ctx);
766 ret = lscsa->srr0.slot[0];
767 spu_release(ctx);
768 return ret;
769}
770DEFINE_SIMPLE_ATTRIBUTE(spufs_srr0_ops, spufs_srr0_get, spufs_srr0_set,
771 "%llx\n")
772
773struct tree_descr spufs_dir_contents[] = {
774 { "mem", &spufs_mem_fops, 0666, },
775 { "regs", &spufs_regs_fops, 0666, },
776 { "mbox", &spufs_mbox_fops, 0444, },
777 { "ibox", &spufs_ibox_fops, 0444, },
778 { "wbox", &spufs_wbox_fops, 0222, },
779 { "mbox_stat", &spufs_mbox_stat_fops, 0444, },
780 { "ibox_stat", &spufs_ibox_stat_fops, 0444, },
781 { "wbox_stat", &spufs_wbox_stat_fops, 0444, },
782 { "signal1", &spufs_signal1_fops, 0666, },
783 { "signal2", &spufs_signal2_fops, 0666, },
784 { "signal1_type", &spufs_signal1_type, 0666, },
785 { "signal2_type", &spufs_signal2_type, 0666, },
786 { "npc", &spufs_npc_ops, 0666, },
787 { "fpcr", &spufs_fpcr_fops, 0666, },
788 { "decr", &spufs_decr_ops, 0666, },
789 { "decr_status", &spufs_decr_status_ops, 0666, },
790 { "spu_tag_mask", &spufs_spu_tag_mask_ops, 0666, },
791 { "event_mask", &spufs_event_mask_ops, 0666, },
792 { "srr0", &spufs_srr0_ops, 0666, },
793 {},
794};
diff --git a/arch/powerpc/platforms/cell/spufs/hw_ops.c b/arch/powerpc/platforms/cell/spufs/hw_ops.c
new file mode 100644
index 000000000000..5445719bff79
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/hw_ops.c
@@ -0,0 +1,255 @@
1/* hw_ops.c - query/set operations on active SPU context.
2 *
3 * Copyright (C) IBM 2005
4 * Author: Mark Nutter <mnutter@us.ibm.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, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#include <linux/config.h>
22#include <linux/module.h>
23#include <linux/errno.h>
24#include <linux/sched.h>
25#include <linux/kernel.h>
26#include <linux/mm.h>
27#include <linux/poll.h>
28#include <linux/smp.h>
29#include <linux/smp_lock.h>
30#include <linux/stddef.h>
31#include <linux/unistd.h>
32
33#include <asm/io.h>
34#include <asm/spu.h>
35#include <asm/spu_csa.h>
36#include <asm/mmu_context.h>
37#include "spufs.h"
38
39static int spu_hw_mbox_read(struct spu_context *ctx, u32 * data)
40{
41 struct spu *spu = ctx->spu;
42 struct spu_problem __iomem *prob = spu->problem;
43 u32 mbox_stat;
44 int ret = 0;
45
46 spin_lock_irq(&spu->register_lock);
47 mbox_stat = in_be32(&prob->mb_stat_R);
48 if (mbox_stat & 0x0000ff) {
49 *data = in_be32(&prob->pu_mb_R);
50 ret = 4;
51 }
52 spin_unlock_irq(&spu->register_lock);
53 return ret;
54}
55
56static u32 spu_hw_mbox_stat_read(struct spu_context *ctx)
57{
58 return in_be32(&ctx->spu->problem->mb_stat_R);
59}
60
61static unsigned int spu_hw_mbox_stat_poll(struct spu_context *ctx,
62 unsigned int events)
63{
64 struct spu *spu = ctx->spu;
65 int ret = 0;
66 u32 stat;
67
68 spin_lock_irq(&spu->register_lock);
69 stat = in_be32(&spu->problem->mb_stat_R);
70
71 /* if the requested event is there, return the poll
72 mask, otherwise enable the interrupt to get notified,
73 but first mark any pending interrupts as done so
74 we don't get woken up unnecessarily */
75
76 if (events & (POLLIN | POLLRDNORM)) {
77 if (stat & 0xff0000)
78 ret |= POLLIN | POLLRDNORM;
79 else {
80 spu_int_stat_clear(spu, 2, 0x1);
81 spu_int_mask_or(spu, 2, 0x1);
82 }
83 }
84 if (events & (POLLOUT | POLLWRNORM)) {
85 if (stat & 0x00ff00)
86 ret = POLLOUT | POLLWRNORM;
87 else {
88 spu_int_stat_clear(spu, 2, 0x10);
89 spu_int_mask_or(spu, 2, 0x10);
90 }
91 }
92 spin_unlock_irq(&spu->register_lock);
93 return ret;
94}
95
96static int spu_hw_ibox_read(struct spu_context *ctx, u32 * data)
97{
98 struct spu *spu = ctx->spu;
99 struct spu_problem __iomem *prob = spu->problem;
100 struct spu_priv2 __iomem *priv2 = spu->priv2;
101 int ret;
102
103 spin_lock_irq(&spu->register_lock);
104 if (in_be32(&prob->mb_stat_R) & 0xff0000) {
105 /* read the first available word */
106 *data = in_be64(&priv2->puint_mb_R);
107 ret = 4;
108 } else {
109 /* make sure we get woken up by the interrupt */
110 spu_int_mask_or(spu, 2, 0x1);
111 ret = 0;
112 }
113 spin_unlock_irq(&spu->register_lock);
114 return ret;
115}
116
117static int spu_hw_wbox_write(struct spu_context *ctx, u32 data)
118{
119 struct spu *spu = ctx->spu;
120 struct spu_problem __iomem *prob = spu->problem;
121 int ret;
122
123 spin_lock_irq(&spu->register_lock);
124 if (in_be32(&prob->mb_stat_R) & 0x00ff00) {
125 /* we have space to write wbox_data to */
126 out_be32(&prob->spu_mb_W, data);
127 ret = 4;
128 } else {
129 /* make sure we get woken up by the interrupt when space
130 becomes available */
131 spu_int_mask_or(spu, 2, 0x10);
132 ret = 0;
133 }
134 spin_unlock_irq(&spu->register_lock);
135 return ret;
136}
137
138static u32 spu_hw_signal1_read(struct spu_context *ctx)
139{
140 return in_be32(&ctx->spu->problem->signal_notify1);
141}
142
143static void spu_hw_signal1_write(struct spu_context *ctx, u32 data)
144{
145 out_be32(&ctx->spu->problem->signal_notify1, data);
146}
147
148static u32 spu_hw_signal2_read(struct spu_context *ctx)
149{
150 return in_be32(&ctx->spu->problem->signal_notify1);
151}
152
153static void spu_hw_signal2_write(struct spu_context *ctx, u32 data)
154{
155 out_be32(&ctx->spu->problem->signal_notify2, data);
156}
157
158static void spu_hw_signal1_type_set(struct spu_context *ctx, u64 val)
159{
160 struct spu *spu = ctx->spu;
161 struct spu_priv2 __iomem *priv2 = spu->priv2;
162 u64 tmp;
163
164 spin_lock_irq(&spu->register_lock);
165 tmp = in_be64(&priv2->spu_cfg_RW);
166 if (val)
167 tmp |= 1;
168 else
169 tmp &= ~1;
170 out_be64(&priv2->spu_cfg_RW, tmp);
171 spin_unlock_irq(&spu->register_lock);
172}
173
174static u64 spu_hw_signal1_type_get(struct spu_context *ctx)
175{
176 return ((in_be64(&ctx->spu->priv2->spu_cfg_RW) & 1) != 0);
177}
178
179static void spu_hw_signal2_type_set(struct spu_context *ctx, u64 val)
180{
181 struct spu *spu = ctx->spu;
182 struct spu_priv2 __iomem *priv2 = spu->priv2;
183 u64 tmp;
184
185 spin_lock_irq(&spu->register_lock);
186 tmp = in_be64(&priv2->spu_cfg_RW);
187 if (val)
188 tmp |= 2;
189 else
190 tmp &= ~2;
191 out_be64(&priv2->spu_cfg_RW, tmp);
192 spin_unlock_irq(&spu->register_lock);
193}
194
195static u64 spu_hw_signal2_type_get(struct spu_context *ctx)
196{
197 return ((in_be64(&ctx->spu->priv2->spu_cfg_RW) & 2) != 0);
198}
199
200static u32 spu_hw_npc_read(struct spu_context *ctx)
201{
202 return in_be32(&ctx->spu->problem->spu_npc_RW);
203}
204
205static void spu_hw_npc_write(struct spu_context *ctx, u32 val)
206{
207 out_be32(&ctx->spu->problem->spu_npc_RW, val);
208}
209
210static u32 spu_hw_status_read(struct spu_context *ctx)
211{
212 return in_be32(&ctx->spu->problem->spu_status_R);
213}
214
215static char *spu_hw_get_ls(struct spu_context *ctx)
216{
217 return ctx->spu->local_store;
218}
219
220static void spu_hw_runcntl_write(struct spu_context *ctx, u32 val)
221{
222 eieio();
223 out_be32(&ctx->spu->problem->spu_runcntl_RW, val);
224}
225
226static void spu_hw_runcntl_stop(struct spu_context *ctx)
227{
228 spin_lock_irq(&ctx->spu->register_lock);
229 out_be32(&ctx->spu->problem->spu_runcntl_RW, SPU_RUNCNTL_STOP);
230 while (in_be32(&ctx->spu->problem->spu_status_R) & SPU_STATUS_RUNNING)
231 cpu_relax();
232 spin_unlock_irq(&ctx->spu->register_lock);
233}
234
235struct spu_context_ops spu_hw_ops = {
236 .mbox_read = spu_hw_mbox_read,
237 .mbox_stat_read = spu_hw_mbox_stat_read,
238 .mbox_stat_poll = spu_hw_mbox_stat_poll,
239 .ibox_read = spu_hw_ibox_read,
240 .wbox_write = spu_hw_wbox_write,
241 .signal1_read = spu_hw_signal1_read,
242 .signal1_write = spu_hw_signal1_write,
243 .signal2_read = spu_hw_signal2_read,
244 .signal2_write = spu_hw_signal2_write,
245 .signal1_type_set = spu_hw_signal1_type_set,
246 .signal1_type_get = spu_hw_signal1_type_get,
247 .signal2_type_set = spu_hw_signal2_type_set,
248 .signal2_type_get = spu_hw_signal2_type_get,
249 .npc_read = spu_hw_npc_read,
250 .npc_write = spu_hw_npc_write,
251 .status_read = spu_hw_status_read,
252 .get_ls = spu_hw_get_ls,
253 .runcntl_write = spu_hw_runcntl_write,
254 .runcntl_stop = spu_hw_runcntl_stop,
255};
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
new file mode 100644
index 000000000000..b3962c3a0348
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -0,0 +1,486 @@
1/*
2 * SPU file system
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#include <linux/file.h>
24#include <linux/fs.h>
25#include <linux/backing-dev.h>
26#include <linux/init.h>
27#include <linux/ioctl.h>
28#include <linux/module.h>
29#include <linux/mount.h>
30#include <linux/namei.h>
31#include <linux/pagemap.h>
32#include <linux/poll.h>
33#include <linux/slab.h>
34#include <linux/parser.h>
35
36#include <asm/io.h>
37#include <asm/semaphore.h>
38#include <asm/spu.h>
39#include <asm/uaccess.h>
40
41#include "spufs.h"
42
43static kmem_cache_t *spufs_inode_cache;
44
45static struct inode *
46spufs_alloc_inode(struct super_block *sb)
47{
48 struct spufs_inode_info *ei;
49
50 ei = kmem_cache_alloc(spufs_inode_cache, SLAB_KERNEL);
51 if (!ei)
52 return NULL;
53 return &ei->vfs_inode;
54}
55
56static void
57spufs_destroy_inode(struct inode *inode)
58{
59 kmem_cache_free(spufs_inode_cache, SPUFS_I(inode));
60}
61
62static void
63spufs_init_once(void *p, kmem_cache_t * cachep, unsigned long flags)
64{
65 struct spufs_inode_info *ei = p;
66
67 if ((flags & (SLAB_CTOR_VERIFY|SLAB_CTOR_CONSTRUCTOR)) ==
68 SLAB_CTOR_CONSTRUCTOR) {
69 inode_init_once(&ei->vfs_inode);
70 }
71}
72
73static struct inode *
74spufs_new_inode(struct super_block *sb, int mode)
75{
76 struct inode *inode;
77
78 inode = new_inode(sb);
79 if (!inode)
80 goto out;
81
82 inode->i_mode = mode;
83 inode->i_uid = current->fsuid;
84 inode->i_gid = current->fsgid;
85 inode->i_blksize = PAGE_CACHE_SIZE;
86 inode->i_blocks = 0;
87 inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME;
88out:
89 return inode;
90}
91
92static int
93spufs_setattr(struct dentry *dentry, struct iattr *attr)
94{
95 struct inode *inode = dentry->d_inode;
96
97 if ((attr->ia_valid & ATTR_SIZE) &&
98 (attr->ia_size != inode->i_size))
99 return -EINVAL;
100 return inode_setattr(inode, attr);
101}
102
103
104static int
105spufs_new_file(struct super_block *sb, struct dentry *dentry,
106 struct file_operations *fops, int mode,
107 struct spu_context *ctx)
108{
109 static struct inode_operations spufs_file_iops = {
110 .setattr = spufs_setattr,
111 };
112 struct inode *inode;
113 int ret;
114
115 ret = -ENOSPC;
116 inode = spufs_new_inode(sb, S_IFREG | mode);
117 if (!inode)
118 goto out;
119
120 ret = 0;
121 inode->i_op = &spufs_file_iops;
122 inode->i_fop = fops;
123 inode->u.generic_ip = SPUFS_I(inode)->i_ctx = get_spu_context(ctx);
124 d_add(dentry, inode);
125out:
126 return ret;
127}
128
129static void
130spufs_delete_inode(struct inode *inode)
131{
132 if (SPUFS_I(inode)->i_ctx)
133 put_spu_context(SPUFS_I(inode)->i_ctx);
134 clear_inode(inode);
135}
136
137static void spufs_prune_dir(struct dentry *dir)
138{
139 struct dentry *dentry, *tmp;
140 mutex_lock(&dir->d_inode->i_mutex);
141 list_for_each_entry_safe(dentry, tmp, &dir->d_subdirs, d_u.d_child) {
142 spin_lock(&dcache_lock);
143 spin_lock(&dentry->d_lock);
144 if (!(d_unhashed(dentry)) && dentry->d_inode) {
145 dget_locked(dentry);
146 __d_drop(dentry);
147 spin_unlock(&dentry->d_lock);
148 simple_unlink(dir->d_inode, dentry);
149 spin_unlock(&dcache_lock);
150 dput(dentry);
151 } else {
152 spin_unlock(&dentry->d_lock);
153 spin_unlock(&dcache_lock);
154 }
155 }
156 shrink_dcache_parent(dir);
157 mutex_unlock(&dir->d_inode->i_mutex);
158}
159
160static int spufs_rmdir(struct inode *root, struct dentry *dir_dentry)
161{
162 struct spu_context *ctx;
163
164 /* remove all entries */
165 mutex_lock(&root->i_mutex);
166 spufs_prune_dir(dir_dentry);
167 mutex_unlock(&root->i_mutex);
168
169 /* We have to give up the mm_struct */
170 ctx = SPUFS_I(dir_dentry->d_inode)->i_ctx;
171 spu_forget(ctx);
172
173 /* XXX Do we need to hold i_mutex here ? */
174 return simple_rmdir(root, dir_dentry);
175}
176
177static int spufs_fill_dir(struct dentry *dir, struct tree_descr *files,
178 int mode, struct spu_context *ctx)
179{
180 struct dentry *dentry;
181 int ret;
182
183 while (files->name && files->name[0]) {
184 ret = -ENOMEM;
185 dentry = d_alloc_name(dir, files->name);
186 if (!dentry)
187 goto out;
188 ret = spufs_new_file(dir->d_sb, dentry, files->ops,
189 files->mode & mode, ctx);
190 if (ret)
191 goto out;
192 files++;
193 }
194 return 0;
195out:
196 spufs_prune_dir(dir);
197 return ret;
198}
199
200static int spufs_dir_close(struct inode *inode, struct file *file)
201{
202 struct inode *dir;
203 struct dentry *dentry;
204 int ret;
205
206 dentry = file->f_dentry;
207 dir = dentry->d_parent->d_inode;
208
209 ret = spufs_rmdir(dir, dentry);
210 WARN_ON(ret);
211
212 return dcache_dir_close(inode, file);
213}
214
215struct inode_operations spufs_dir_inode_operations = {
216 .lookup = simple_lookup,
217};
218
219struct file_operations spufs_context_fops = {
220 .open = dcache_dir_open,
221 .release = spufs_dir_close,
222 .llseek = dcache_dir_lseek,
223 .read = generic_read_dir,
224 .readdir = dcache_readdir,
225 .fsync = simple_sync_file,
226};
227
228static int
229spufs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
230{
231 int ret;
232 struct inode *inode;
233 struct spu_context *ctx;
234
235 ret = -ENOSPC;
236 inode = spufs_new_inode(dir->i_sb, mode | S_IFDIR);
237 if (!inode)
238 goto out;
239
240 if (dir->i_mode & S_ISGID) {
241 inode->i_gid = dir->i_gid;
242 inode->i_mode &= S_ISGID;
243 }
244 ctx = alloc_spu_context(inode->i_mapping);
245 SPUFS_I(inode)->i_ctx = ctx;
246 if (!ctx)
247 goto out_iput;
248
249 inode->i_op = &spufs_dir_inode_operations;
250 inode->i_fop = &simple_dir_operations;
251 ret = spufs_fill_dir(dentry, spufs_dir_contents, mode, ctx);
252 if (ret)
253 goto out_free_ctx;
254
255 d_instantiate(dentry, inode);
256 dget(dentry);
257 dir->i_nlink++;
258 dentry->d_inode->i_nlink++;
259 goto out;
260
261out_free_ctx:
262 put_spu_context(ctx);
263out_iput:
264 iput(inode);
265out:
266 return ret;
267}
268
269static int spufs_context_open(struct dentry *dentry, struct vfsmount *mnt)
270{
271 int ret;
272 struct file *filp;
273
274 ret = get_unused_fd();
275 if (ret < 0) {
276 dput(dentry);
277 mntput(mnt);
278 goto out;
279 }
280
281 filp = dentry_open(dentry, mnt, O_RDONLY);
282 if (IS_ERR(filp)) {
283 put_unused_fd(ret);
284 ret = PTR_ERR(filp);
285 goto out;
286 }
287
288 filp->f_op = &spufs_context_fops;
289 fd_install(ret, filp);
290out:
291 return ret;
292}
293
294static struct file_system_type spufs_type;
295
296long spufs_create_thread(struct nameidata *nd,
297 unsigned int flags, mode_t mode)
298{
299 struct dentry *dentry;
300 int ret;
301
302 /* need to be at the root of spufs */
303 ret = -EINVAL;
304 if (nd->dentry->d_sb->s_type != &spufs_type ||
305 nd->dentry != nd->dentry->d_sb->s_root)
306 goto out;
307
308 dentry = lookup_create(nd, 1);
309 ret = PTR_ERR(dentry);
310 if (IS_ERR(dentry))
311 goto out_dir;
312
313 ret = -EEXIST;
314 if (dentry->d_inode)
315 goto out_dput;
316
317 mode &= ~current->fs->umask;
318 ret = spufs_mkdir(nd->dentry->d_inode, dentry, mode & S_IRWXUGO);
319 if (ret)
320 goto out_dput;
321
322 /*
323 * get references for dget and mntget, will be released
324 * in error path of *_open().
325 */
326 ret = spufs_context_open(dget(dentry), mntget(nd->mnt));
327 if (ret < 0)
328 spufs_rmdir(nd->dentry->d_inode, dentry);
329
330out_dput:
331 dput(dentry);
332out_dir:
333 mutex_unlock(&nd->dentry->d_inode->i_mutex);
334out:
335 return ret;
336}
337
338/* File system initialization */
339enum {
340 Opt_uid, Opt_gid, Opt_err,
341};
342
343static match_table_t spufs_tokens = {
344 { Opt_uid, "uid=%d" },
345 { Opt_gid, "gid=%d" },
346 { Opt_err, NULL },
347};
348
349static int
350spufs_parse_options(char *options, struct inode *root)
351{
352 char *p;
353 substring_t args[MAX_OPT_ARGS];
354
355 while ((p = strsep(&options, ",")) != NULL) {
356 int token, option;
357
358 if (!*p)
359 continue;
360
361 token = match_token(p, spufs_tokens, args);
362 switch (token) {
363 case Opt_uid:
364 if (match_int(&args[0], &option))
365 return 0;
366 root->i_uid = option;
367 break;
368 case Opt_gid:
369 if (match_int(&args[0], &option))
370 return 0;
371 root->i_gid = option;
372 break;
373 default:
374 return 0;
375 }
376 }
377 return 1;
378}
379
380static int
381spufs_create_root(struct super_block *sb, void *data)
382{
383 struct inode *inode;
384 int ret;
385
386 ret = -ENOMEM;
387 inode = spufs_new_inode(sb, S_IFDIR | 0775);
388 if (!inode)
389 goto out;
390
391 inode->i_op = &spufs_dir_inode_operations;
392 inode->i_fop = &simple_dir_operations;
393 SPUFS_I(inode)->i_ctx = NULL;
394
395 ret = -EINVAL;
396 if (!spufs_parse_options(data, inode))
397 goto out_iput;
398
399 ret = -ENOMEM;
400 sb->s_root = d_alloc_root(inode);
401 if (!sb->s_root)
402 goto out_iput;
403
404 return 0;
405out_iput:
406 iput(inode);
407out:
408 return ret;
409}
410
411static int
412spufs_fill_super(struct super_block *sb, void *data, int silent)
413{
414 static struct super_operations s_ops = {
415 .alloc_inode = spufs_alloc_inode,
416 .destroy_inode = spufs_destroy_inode,
417 .statfs = simple_statfs,
418 .delete_inode = spufs_delete_inode,
419 .drop_inode = generic_delete_inode,
420 };
421
422 sb->s_maxbytes = MAX_LFS_FILESIZE;
423 sb->s_blocksize = PAGE_CACHE_SIZE;
424 sb->s_blocksize_bits = PAGE_CACHE_SHIFT;
425 sb->s_magic = SPUFS_MAGIC;
426 sb->s_op = &s_ops;
427
428 return spufs_create_root(sb, data);
429}
430
431static struct super_block *
432spufs_get_sb(struct file_system_type *fstype, int flags,
433 const char *name, void *data)
434{
435 return get_sb_single(fstype, flags, data, spufs_fill_super);
436}
437
438static struct file_system_type spufs_type = {
439 .owner = THIS_MODULE,
440 .name = "spufs",
441 .get_sb = spufs_get_sb,
442 .kill_sb = kill_litter_super,
443};
444
445static int spufs_init(void)
446{
447 int ret;
448 ret = -ENOMEM;
449 spufs_inode_cache = kmem_cache_create("spufs_inode_cache",
450 sizeof(struct spufs_inode_info), 0,
451 SLAB_HWCACHE_ALIGN, spufs_init_once, NULL);
452
453 if (!spufs_inode_cache)
454 goto out;
455 if (spu_sched_init() != 0) {
456 kmem_cache_destroy(spufs_inode_cache);
457 goto out;
458 }
459 ret = register_filesystem(&spufs_type);
460 if (ret)
461 goto out_cache;
462 ret = register_spu_syscalls(&spufs_calls);
463 if (ret)
464 goto out_fs;
465 return 0;
466out_fs:
467 unregister_filesystem(&spufs_type);
468out_cache:
469 kmem_cache_destroy(spufs_inode_cache);
470out:
471 return ret;
472}
473module_init(spufs_init);
474
475static void spufs_exit(void)
476{
477 spu_sched_exit();
478 unregister_spu_syscalls(&spufs_calls);
479 unregister_filesystem(&spufs_type);
480 kmem_cache_destroy(spufs_inode_cache);
481}
482module_exit(spufs_exit);
483
484MODULE_LICENSE("GPL");
485MODULE_AUTHOR("Arnd Bergmann <arndb@de.ibm.com>");
486
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
new file mode 100644
index 000000000000..18ea8866c61a
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -0,0 +1,131 @@
1#include <linux/wait.h>
2#include <linux/ptrace.h>
3
4#include <asm/spu.h>
5
6#include "spufs.h"
7
8/* interrupt-level stop callback function. */
9void spufs_stop_callback(struct spu *spu)
10{
11 struct spu_context *ctx = spu->ctx;
12
13 wake_up_all(&ctx->stop_wq);
14}
15
16static inline int spu_stopped(struct spu_context *ctx, u32 * stat)
17{
18 struct spu *spu;
19 u64 pte_fault;
20
21 *stat = ctx->ops->status_read(ctx);
22 if (ctx->state != SPU_STATE_RUNNABLE)
23 return 1;
24 spu = ctx->spu;
25 pte_fault = spu->dsisr &
26 (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED);
27 return (!(*stat & 0x1) || pte_fault || spu->class_0_pending) ? 1 : 0;
28}
29
30static inline int spu_run_init(struct spu_context *ctx, u32 * npc,
31 u32 * status)
32{
33 int ret;
34
35 if ((ret = spu_acquire_runnable(ctx)) != 0)
36 return ret;
37 ctx->ops->npc_write(ctx, *npc);
38 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE);
39 return 0;
40}
41
42static inline int spu_run_fini(struct spu_context *ctx, u32 * npc,
43 u32 * status)
44{
45 int ret = 0;
46
47 *status = ctx->ops->status_read(ctx);
48 *npc = ctx->ops->npc_read(ctx);
49 spu_release(ctx);
50
51 if (signal_pending(current))
52 ret = -ERESTARTSYS;
53 if (unlikely(current->ptrace & PT_PTRACED)) {
54 if ((*status & SPU_STATUS_STOPPED_BY_STOP)
55 && (*status >> SPU_STOP_STATUS_SHIFT) == 0x3fff) {
56 force_sig(SIGTRAP, current);
57 ret = -ERESTARTSYS;
58 }
59 }
60 return ret;
61}
62
63static inline int spu_reacquire_runnable(struct spu_context *ctx, u32 *npc,
64 u32 *status)
65{
66 int ret;
67
68 if ((ret = spu_run_fini(ctx, npc, status)) != 0)
69 return ret;
70 if (*status & (SPU_STATUS_STOPPED_BY_STOP |
71 SPU_STATUS_STOPPED_BY_HALT)) {
72 return *status;
73 }
74 if ((ret = spu_run_init(ctx, npc, status)) != 0)
75 return ret;
76 return 0;
77}
78
79static inline int spu_process_events(struct spu_context *ctx)
80{
81 struct spu *spu = ctx->spu;
82 u64 pte_fault = MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED;
83 int ret = 0;
84
85 if (spu->dsisr & pte_fault)
86 ret = spu_irq_class_1_bottom(spu);
87 if (spu->class_0_pending)
88 ret = spu_irq_class_0_bottom(spu);
89 if (!ret && signal_pending(current))
90 ret = -ERESTARTSYS;
91 return ret;
92}
93
94long spufs_run_spu(struct file *file, struct spu_context *ctx,
95 u32 * npc, u32 * status)
96{
97 int ret;
98
99 if (down_interruptible(&ctx->run_sema))
100 return -ERESTARTSYS;
101
102 ret = spu_run_init(ctx, npc, status);
103 if (ret)
104 goto out;
105
106 do {
107 ret = spufs_wait(ctx->stop_wq, spu_stopped(ctx, status));
108 if (unlikely(ret))
109 break;
110 if (unlikely(ctx->state != SPU_STATE_RUNNABLE)) {
111 ret = spu_reacquire_runnable(ctx, npc, status);
112 if (ret)
113 goto out;
114 continue;
115 }
116 ret = spu_process_events(ctx);
117
118 } while (!ret && !(*status & (SPU_STATUS_STOPPED_BY_STOP |
119 SPU_STATUS_STOPPED_BY_HALT)));
120
121 ctx->ops->runcntl_stop(ctx);
122 ret = spu_run_fini(ctx, npc, status);
123 if (!ret)
124 ret = *status;
125 spu_yield(ctx);
126
127out:
128 up(&ctx->run_sema);
129 return ret;
130}
131
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
new file mode 100644
index 000000000000..963182fbd1aa
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -0,0 +1,461 @@
1/* sched.c - SPU scheduler.
2 *
3 * Copyright (C) IBM 2005
4 * Author: Mark Nutter <mnutter@us.ibm.com>
5 *
6 * SPU scheduler, based on Linux thread priority. For now use
7 * a simple "cooperative" yield model with no preemption. SPU
8 * scheduling will eventually be preemptive: When a thread with
9 * a higher static priority gets ready to run, then an active SPU
10 * context will be preempted and returned to the waitq.
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 as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#undef DEBUG
28
29#include <linux/config.h>
30#include <linux/module.h>
31#include <linux/errno.h>
32#include <linux/sched.h>
33#include <linux/kernel.h>
34#include <linux/mm.h>
35#include <linux/completion.h>
36#include <linux/vmalloc.h>
37#include <linux/smp.h>
38#include <linux/smp_lock.h>
39#include <linux/stddef.h>
40#include <linux/unistd.h>
41
42#include <asm/io.h>
43#include <asm/mmu_context.h>
44#include <asm/spu.h>
45#include <asm/spu_csa.h>
46#include "spufs.h"
47
48#define SPU_MIN_TIMESLICE (100 * HZ / 1000)
49
50#define SPU_BITMAP_SIZE (((MAX_PRIO+BITS_PER_LONG)/BITS_PER_LONG)+1)
51struct spu_prio_array {
52 atomic_t nr_blocked;
53 unsigned long bitmap[SPU_BITMAP_SIZE];
54 wait_queue_head_t waitq[MAX_PRIO];
55};
56
57/* spu_runqueue - This is the main runqueue data structure for SPUs. */
58struct spu_runqueue {
59 struct semaphore sem;
60 unsigned long nr_active;
61 unsigned long nr_idle;
62 unsigned long nr_switches;
63 struct list_head active_list;
64 struct list_head idle_list;
65 struct spu_prio_array prio;
66};
67
68static struct spu_runqueue *spu_runqueues = NULL;
69
70static inline struct spu_runqueue *spu_rq(void)
71{
72 /* Future: make this a per-NODE array,
73 * and use cpu_to_node(smp_processor_id())
74 */
75 return spu_runqueues;
76}
77
78static inline struct spu *del_idle(struct spu_runqueue *rq)
79{
80 struct spu *spu;
81
82 BUG_ON(rq->nr_idle <= 0);
83 BUG_ON(list_empty(&rq->idle_list));
84 /* Future: Move SPU out of low-power SRI state. */
85 spu = list_entry(rq->idle_list.next, struct spu, sched_list);
86 list_del_init(&spu->sched_list);
87 rq->nr_idle--;
88 return spu;
89}
90
91static inline void del_active(struct spu_runqueue *rq, struct spu *spu)
92{
93 BUG_ON(rq->nr_active <= 0);
94 BUG_ON(list_empty(&rq->active_list));
95 list_del_init(&spu->sched_list);
96 rq->nr_active--;
97}
98
99static inline void add_idle(struct spu_runqueue *rq, struct spu *spu)
100{
101 /* Future: Put SPU into low-power SRI state. */
102 list_add_tail(&spu->sched_list, &rq->idle_list);
103 rq->nr_idle++;
104}
105
106static inline void add_active(struct spu_runqueue *rq, struct spu *spu)
107{
108 rq->nr_active++;
109 rq->nr_switches++;
110 list_add_tail(&spu->sched_list, &rq->active_list);
111}
112
113static void prio_wakeup(struct spu_runqueue *rq)
114{
115 if (atomic_read(&rq->prio.nr_blocked) && rq->nr_idle) {
116 int best = sched_find_first_bit(rq->prio.bitmap);
117 if (best < MAX_PRIO) {
118 wait_queue_head_t *wq = &rq->prio.waitq[best];
119 wake_up_interruptible_nr(wq, 1);
120 }
121 }
122}
123
124static void prio_wait(struct spu_runqueue *rq, struct spu_context *ctx,
125 u64 flags)
126{
127 int prio = current->prio;
128 wait_queue_head_t *wq = &rq->prio.waitq[prio];
129 DEFINE_WAIT(wait);
130
131 __set_bit(prio, rq->prio.bitmap);
132 atomic_inc(&rq->prio.nr_blocked);
133 prepare_to_wait_exclusive(wq, &wait, TASK_INTERRUPTIBLE);
134 if (!signal_pending(current)) {
135 up(&rq->sem);
136 up_write(&ctx->state_sema);
137 pr_debug("%s: pid=%d prio=%d\n", __FUNCTION__,
138 current->pid, current->prio);
139 schedule();
140 down_write(&ctx->state_sema);
141 down(&rq->sem);
142 }
143 finish_wait(wq, &wait);
144 atomic_dec(&rq->prio.nr_blocked);
145 if (!waitqueue_active(wq))
146 __clear_bit(prio, rq->prio.bitmap);
147}
148
149static inline int is_best_prio(struct spu_runqueue *rq)
150{
151 int best_prio;
152
153 best_prio = sched_find_first_bit(rq->prio.bitmap);
154 return (current->prio < best_prio) ? 1 : 0;
155}
156
157static inline void mm_needs_global_tlbie(struct mm_struct *mm)
158{
159 /* Global TLBIE broadcast required with SPEs. */
160#if (NR_CPUS > 1)
161 __cpus_setall(&mm->cpu_vm_mask, NR_CPUS);
162#else
163 __cpus_setall(&mm->cpu_vm_mask, NR_CPUS+1); /* is this ok? */
164#endif
165}
166
167static inline void bind_context(struct spu *spu, struct spu_context *ctx)
168{
169 pr_debug("%s: pid=%d SPU=%d\n", __FUNCTION__, current->pid,
170 spu->number);
171 spu->ctx = ctx;
172 spu->flags = 0;
173 ctx->flags = 0;
174 ctx->spu = spu;
175 ctx->ops = &spu_hw_ops;
176 spu->pid = current->pid;
177 spu->prio = current->prio;
178 spu->mm = ctx->owner;
179 mm_needs_global_tlbie(spu->mm);
180 spu->ibox_callback = spufs_ibox_callback;
181 spu->wbox_callback = spufs_wbox_callback;
182 spu->stop_callback = spufs_stop_callback;
183 mb();
184 spu_unmap_mappings(ctx);
185 spu_restore(&ctx->csa, spu);
186 spu->timestamp = jiffies;
187}
188
189static inline void unbind_context(struct spu *spu, struct spu_context *ctx)
190{
191 pr_debug("%s: unbind pid=%d SPU=%d\n", __FUNCTION__,
192 spu->pid, spu->number);
193 spu_unmap_mappings(ctx);
194 spu_save(&ctx->csa, spu);
195 spu->timestamp = jiffies;
196 ctx->state = SPU_STATE_SAVED;
197 spu->ibox_callback = NULL;
198 spu->wbox_callback = NULL;
199 spu->stop_callback = NULL;
200 spu->mm = NULL;
201 spu->pid = 0;
202 spu->prio = MAX_PRIO;
203 ctx->ops = &spu_backing_ops;
204 ctx->spu = NULL;
205 ctx->flags = 0;
206 spu->flags = 0;
207 spu->ctx = NULL;
208}
209
210static void spu_reaper(void *data)
211{
212 struct spu_context *ctx = data;
213 struct spu *spu;
214
215 down_write(&ctx->state_sema);
216 spu = ctx->spu;
217 if (spu && test_bit(SPU_CONTEXT_PREEMPT, &ctx->flags)) {
218 if (atomic_read(&spu->rq->prio.nr_blocked)) {
219 pr_debug("%s: spu=%d\n", __func__, spu->number);
220 ctx->ops->runcntl_stop(ctx);
221 spu_deactivate(ctx);
222 wake_up_all(&ctx->stop_wq);
223 } else {
224 clear_bit(SPU_CONTEXT_PREEMPT, &ctx->flags);
225 }
226 }
227 up_write(&ctx->state_sema);
228 put_spu_context(ctx);
229}
230
231static void schedule_spu_reaper(struct spu_runqueue *rq, struct spu *spu)
232{
233 struct spu_context *ctx = get_spu_context(spu->ctx);
234 unsigned long now = jiffies;
235 unsigned long expire = spu->timestamp + SPU_MIN_TIMESLICE;
236
237 set_bit(SPU_CONTEXT_PREEMPT, &ctx->flags);
238 INIT_WORK(&ctx->reap_work, spu_reaper, ctx);
239 if (time_after(now, expire))
240 schedule_work(&ctx->reap_work);
241 else
242 schedule_delayed_work(&ctx->reap_work, expire - now);
243}
244
245static void check_preempt_active(struct spu_runqueue *rq)
246{
247 struct list_head *p;
248 struct spu *worst = NULL;
249
250 list_for_each(p, &rq->active_list) {
251 struct spu *spu = list_entry(p, struct spu, sched_list);
252 struct spu_context *ctx = spu->ctx;
253 if (!test_bit(SPU_CONTEXT_PREEMPT, &ctx->flags)) {
254 if (!worst || (spu->prio > worst->prio)) {
255 worst = spu;
256 }
257 }
258 }
259 if (worst && (current->prio < worst->prio))
260 schedule_spu_reaper(rq, worst);
261}
262
263static struct spu *get_idle_spu(struct spu_context *ctx, u64 flags)
264{
265 struct spu_runqueue *rq;
266 struct spu *spu = NULL;
267
268 rq = spu_rq();
269 down(&rq->sem);
270 for (;;) {
271 if (rq->nr_idle > 0) {
272 if (is_best_prio(rq)) {
273 /* Fall through. */
274 spu = del_idle(rq);
275 break;
276 } else {
277 prio_wakeup(rq);
278 up(&rq->sem);
279 yield();
280 if (signal_pending(current)) {
281 return NULL;
282 }
283 rq = spu_rq();
284 down(&rq->sem);
285 continue;
286 }
287 } else {
288 check_preempt_active(rq);
289 prio_wait(rq, ctx, flags);
290 if (signal_pending(current)) {
291 prio_wakeup(rq);
292 spu = NULL;
293 break;
294 }
295 continue;
296 }
297 }
298 up(&rq->sem);
299 return spu;
300}
301
302static void put_idle_spu(struct spu *spu)
303{
304 struct spu_runqueue *rq = spu->rq;
305
306 down(&rq->sem);
307 add_idle(rq, spu);
308 prio_wakeup(rq);
309 up(&rq->sem);
310}
311
312static int get_active_spu(struct spu *spu)
313{
314 struct spu_runqueue *rq = spu->rq;
315 struct list_head *p;
316 struct spu *tmp;
317 int rc = 0;
318
319 down(&rq->sem);
320 list_for_each(p, &rq->active_list) {
321 tmp = list_entry(p, struct spu, sched_list);
322 if (tmp == spu) {
323 del_active(rq, spu);
324 rc = 1;
325 break;
326 }
327 }
328 up(&rq->sem);
329 return rc;
330}
331
332static void put_active_spu(struct spu *spu)
333{
334 struct spu_runqueue *rq = spu->rq;
335
336 down(&rq->sem);
337 add_active(rq, spu);
338 up(&rq->sem);
339}
340
341/* Lock order:
342 * spu_activate() & spu_deactivate() require the
343 * caller to have down_write(&ctx->state_sema).
344 *
345 * The rq->sem is breifly held (inside or outside a
346 * given ctx lock) for list management, but is never
347 * held during save/restore.
348 */
349
350int spu_activate(struct spu_context *ctx, u64 flags)
351{
352 struct spu *spu;
353
354 if (ctx->spu)
355 return 0;
356 spu = get_idle_spu(ctx, flags);
357 if (!spu)
358 return (signal_pending(current)) ? -ERESTARTSYS : -EAGAIN;
359 bind_context(spu, ctx);
360 /*
361 * We're likely to wait for interrupts on the same
362 * CPU that we are now on, so send them here.
363 */
364 spu_irq_setaffinity(spu, raw_smp_processor_id());
365 put_active_spu(spu);
366 return 0;
367}
368
369void spu_deactivate(struct spu_context *ctx)
370{
371 struct spu *spu;
372 int needs_idle;
373
374 spu = ctx->spu;
375 if (!spu)
376 return;
377 needs_idle = get_active_spu(spu);
378 unbind_context(spu, ctx);
379 if (needs_idle)
380 put_idle_spu(spu);
381}
382
383void spu_yield(struct spu_context *ctx)
384{
385 struct spu *spu;
386 int need_yield = 0;
387
388 down_write(&ctx->state_sema);
389 spu = ctx->spu;
390 if (spu && (sched_find_first_bit(spu->rq->prio.bitmap) < MAX_PRIO)) {
391 pr_debug("%s: yielding SPU %d\n", __FUNCTION__, spu->number);
392 spu_deactivate(ctx);
393 ctx->state = SPU_STATE_SAVED;
394 need_yield = 1;
395 } else if (spu) {
396 spu->prio = MAX_PRIO;
397 }
398 up_write(&ctx->state_sema);
399 if (unlikely(need_yield))
400 yield();
401}
402
403int __init spu_sched_init(void)
404{
405 struct spu_runqueue *rq;
406 struct spu *spu;
407 int i;
408
409 rq = spu_runqueues = kmalloc(sizeof(struct spu_runqueue), GFP_KERNEL);
410 if (!rq) {
411 printk(KERN_WARNING "%s: Unable to allocate runqueues.\n",
412 __FUNCTION__);
413 return 1;
414 }
415 memset(rq, 0, sizeof(struct spu_runqueue));
416 init_MUTEX(&rq->sem);
417 INIT_LIST_HEAD(&rq->active_list);
418 INIT_LIST_HEAD(&rq->idle_list);
419 rq->nr_active = 0;
420 rq->nr_idle = 0;
421 rq->nr_switches = 0;
422 atomic_set(&rq->prio.nr_blocked, 0);
423 for (i = 0; i < MAX_PRIO; i++) {
424 init_waitqueue_head(&rq->prio.waitq[i]);
425 __clear_bit(i, rq->prio.bitmap);
426 }
427 __set_bit(MAX_PRIO, rq->prio.bitmap);
428 for (;;) {
429 spu = spu_alloc();
430 if (!spu)
431 break;
432 pr_debug("%s: adding SPU[%d]\n", __FUNCTION__, spu->number);
433 add_idle(rq, spu);
434 spu->rq = rq;
435 spu->timestamp = jiffies;
436 }
437 if (!rq->nr_idle) {
438 printk(KERN_WARNING "%s: No available SPUs.\n", __FUNCTION__);
439 kfree(rq);
440 return 1;
441 }
442 return 0;
443}
444
445void __exit spu_sched_exit(void)
446{
447 struct spu_runqueue *rq = spu_rq();
448 struct spu *spu;
449
450 if (!rq) {
451 printk(KERN_WARNING "%s: no runqueues!\n", __FUNCTION__);
452 return;
453 }
454 while (rq->nr_idle > 0) {
455 spu = del_idle(rq);
456 if (!spu)
457 break;
458 spu_free(spu);
459 }
460 kfree(rq);
461}
diff --git a/arch/powerpc/platforms/cell/spufs/spu_restore.c b/arch/powerpc/platforms/cell/spufs/spu_restore.c
new file mode 100644
index 000000000000..0bf723dcd677
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/spu_restore.c
@@ -0,0 +1,336 @@
1/*
2 * spu_restore.c
3 *
4 * (C) Copyright IBM Corp. 2005
5 *
6 * SPU-side context restore sequence outlined in
7 * Synergistic Processor Element Book IV
8 *
9 * Author: Mark Nutter <mnutter@us.ibm.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 */
26
27
28#ifndef LS_SIZE
29#define LS_SIZE 0x40000 /* 256K (in bytes) */
30#endif
31
32typedef unsigned int u32;
33typedef unsigned long long u64;
34
35#include <spu_intrinsics.h>
36#include <asm/spu_csa.h>
37#include "spu_utils.h"
38
39#define BR_INSTR 0x327fff80 /* br -4 */
40#define NOP_INSTR 0x40200000 /* nop */
41#define HEQ_INSTR 0x7b000000 /* heq $0, $0 */
42#define STOP_INSTR 0x00000000 /* stop 0x0 */
43#define ILLEGAL_INSTR 0x00800000 /* illegal instr */
44#define RESTORE_COMPLETE 0x00003ffc /* stop 0x3ffc */
45
46static inline void fetch_regs_from_mem(addr64 lscsa_ea)
47{
48 unsigned int ls = (unsigned int)&regs_spill[0];
49 unsigned int size = sizeof(regs_spill);
50 unsigned int tag_id = 0;
51 unsigned int cmd = 0x40; /* GET */
52
53 spu_writech(MFC_LSA, ls);
54 spu_writech(MFC_EAH, lscsa_ea.ui[0]);
55 spu_writech(MFC_EAL, lscsa_ea.ui[1]);
56 spu_writech(MFC_Size, size);
57 spu_writech(MFC_TagID, tag_id);
58 spu_writech(MFC_Cmd, cmd);
59}
60
61static inline void restore_upper_240kb(addr64 lscsa_ea)
62{
63 unsigned int ls = 16384;
64 unsigned int list = (unsigned int)&dma_list[0];
65 unsigned int size = sizeof(dma_list);
66 unsigned int tag_id = 0;
67 unsigned int cmd = 0x44; /* GETL */
68
69 /* Restore, Step 4:
70 * Enqueue the GETL command (tag 0) to the MFC SPU command
71 * queue to transfer the upper 240 kb of LS from CSA.
72 */
73 spu_writech(MFC_LSA, ls);
74 spu_writech(MFC_EAH, lscsa_ea.ui[0]);
75 spu_writech(MFC_EAL, list);
76 spu_writech(MFC_Size, size);
77 spu_writech(MFC_TagID, tag_id);
78 spu_writech(MFC_Cmd, cmd);
79}
80
81static inline void restore_decr(void)
82{
83 unsigned int offset;
84 unsigned int decr_running;
85 unsigned int decr;
86
87 /* Restore, Step 6:
88 * If the LSCSA "decrementer running" flag is set
89 * then write the SPU_WrDec channel with the
90 * decrementer value from LSCSA.
91 */
92 offset = LSCSA_QW_OFFSET(decr_status);
93 decr_running = regs_spill[offset].slot[0];
94 if (decr_running) {
95 offset = LSCSA_QW_OFFSET(decr);
96 decr = regs_spill[offset].slot[0];
97 spu_writech(SPU_WrDec, decr);
98 }
99}
100
101static inline void write_ppu_mb(void)
102{
103 unsigned int offset;
104 unsigned int data;
105
106 /* Restore, Step 11:
107 * Write the MFC_WrOut_MB channel with the PPU_MB
108 * data from LSCSA.
109 */
110 offset = LSCSA_QW_OFFSET(ppu_mb);
111 data = regs_spill[offset].slot[0];
112 spu_writech(SPU_WrOutMbox, data);
113}
114
115static inline void write_ppuint_mb(void)
116{
117 unsigned int offset;
118 unsigned int data;
119
120 /* Restore, Step 12:
121 * Write the MFC_WrInt_MB channel with the PPUINT_MB
122 * data from LSCSA.
123 */
124 offset = LSCSA_QW_OFFSET(ppuint_mb);
125 data = regs_spill[offset].slot[0];
126 spu_writech(SPU_WrOutIntrMbox, data);
127}
128
129static inline void restore_fpcr(void)
130{
131 unsigned int offset;
132 vector unsigned int fpcr;
133
134 /* Restore, Step 13:
135 * Restore the floating-point status and control
136 * register from the LSCSA.
137 */
138 offset = LSCSA_QW_OFFSET(fpcr);
139 fpcr = regs_spill[offset].v;
140 spu_mtfpscr(fpcr);
141}
142
143static inline void restore_srr0(void)
144{
145 unsigned int offset;
146 unsigned int srr0;
147
148 /* Restore, Step 14:
149 * Restore the SPU SRR0 data from the LSCSA.
150 */
151 offset = LSCSA_QW_OFFSET(srr0);
152 srr0 = regs_spill[offset].slot[0];
153 spu_writech(SPU_WrSRR0, srr0);
154}
155
156static inline void restore_event_mask(void)
157{
158 unsigned int offset;
159 unsigned int event_mask;
160
161 /* Restore, Step 15:
162 * Restore the SPU_RdEventMsk data from the LSCSA.
163 */
164 offset = LSCSA_QW_OFFSET(event_mask);
165 event_mask = regs_spill[offset].slot[0];
166 spu_writech(SPU_WrEventMask, event_mask);
167}
168
169static inline void restore_tag_mask(void)
170{
171 unsigned int offset;
172 unsigned int tag_mask;
173
174 /* Restore, Step 16:
175 * Restore the SPU_RdTagMsk data from the LSCSA.
176 */
177 offset = LSCSA_QW_OFFSET(tag_mask);
178 tag_mask = regs_spill[offset].slot[0];
179 spu_writech(MFC_WrTagMask, tag_mask);
180}
181
182static inline void restore_complete(void)
183{
184 extern void exit_fini(void);
185 unsigned int *exit_instrs = (unsigned int *)exit_fini;
186 unsigned int offset;
187 unsigned int stopped_status;
188 unsigned int stopped_code;
189
190 /* Restore, Step 18:
191 * Issue a stop-and-signal instruction with
192 * "good context restore" signal value.
193 *
194 * Restore, Step 19:
195 * There may be additional instructions placed
196 * here by the PPE Sequence for SPU Context
197 * Restore in order to restore the correct
198 * "stopped state".
199 *
200 * This step is handled here by analyzing the
201 * LSCSA.stopped_status and then modifying the
202 * exit() function to behave appropriately.
203 */
204
205 offset = LSCSA_QW_OFFSET(stopped_status);
206 stopped_status = regs_spill[offset].slot[0];
207 stopped_code = regs_spill[offset].slot[1];
208
209 switch (stopped_status) {
210 case SPU_STOPPED_STATUS_P_I:
211 /* SPU_Status[P,I]=1. Add illegal instruction
212 * followed by stop-and-signal instruction after
213 * end of restore code.
214 */
215 exit_instrs[0] = RESTORE_COMPLETE;
216 exit_instrs[1] = ILLEGAL_INSTR;
217 exit_instrs[2] = STOP_INSTR | stopped_code;
218 break;
219 case SPU_STOPPED_STATUS_P_H:
220 /* SPU_Status[P,H]=1. Add 'heq $0, $0' followed
221 * by stop-and-signal instruction after end of
222 * restore code.
223 */
224 exit_instrs[0] = RESTORE_COMPLETE;
225 exit_instrs[1] = HEQ_INSTR;
226 exit_instrs[2] = STOP_INSTR | stopped_code;
227 break;
228 case SPU_STOPPED_STATUS_S_P:
229 /* SPU_Status[S,P]=1. Add nop instruction
230 * followed by 'br -4' after end of restore
231 * code.
232 */
233 exit_instrs[0] = RESTORE_COMPLETE;
234 exit_instrs[1] = STOP_INSTR | stopped_code;
235 exit_instrs[2] = NOP_INSTR;
236 exit_instrs[3] = BR_INSTR;
237 break;
238 case SPU_STOPPED_STATUS_S_I:
239 /* SPU_Status[S,I]=1. Add illegal instruction
240 * followed by 'br -4' after end of restore code.
241 */
242 exit_instrs[0] = RESTORE_COMPLETE;
243 exit_instrs[1] = ILLEGAL_INSTR;
244 exit_instrs[2] = NOP_INSTR;
245 exit_instrs[3] = BR_INSTR;
246 break;
247 case SPU_STOPPED_STATUS_I:
248 /* SPU_Status[I]=1. Add illegal instruction followed
249 * by infinite loop after end of restore sequence.
250 */
251 exit_instrs[0] = RESTORE_COMPLETE;
252 exit_instrs[1] = ILLEGAL_INSTR;
253 exit_instrs[2] = NOP_INSTR;
254 exit_instrs[3] = BR_INSTR;
255 break;
256 case SPU_STOPPED_STATUS_S:
257 /* SPU_Status[S]=1. Add two 'nop' instructions. */
258 exit_instrs[0] = RESTORE_COMPLETE;
259 exit_instrs[1] = NOP_INSTR;
260 exit_instrs[2] = NOP_INSTR;
261 exit_instrs[3] = BR_INSTR;
262 break;
263 case SPU_STOPPED_STATUS_H:
264 /* SPU_Status[H]=1. Add 'heq $0, $0' instruction
265 * after end of restore code.
266 */
267 exit_instrs[0] = RESTORE_COMPLETE;
268 exit_instrs[1] = HEQ_INSTR;
269 exit_instrs[2] = NOP_INSTR;
270 exit_instrs[3] = BR_INSTR;
271 break;
272 case SPU_STOPPED_STATUS_P:
273 /* SPU_Status[P]=1. Add stop-and-signal instruction
274 * after end of restore code.
275 */
276 exit_instrs[0] = RESTORE_COMPLETE;
277 exit_instrs[1] = STOP_INSTR | stopped_code;
278 break;
279 case SPU_STOPPED_STATUS_R:
280 /* SPU_Status[I,S,H,P,R]=0. Add infinite loop. */
281 exit_instrs[0] = RESTORE_COMPLETE;
282 exit_instrs[1] = NOP_INSTR;
283 exit_instrs[2] = NOP_INSTR;
284 exit_instrs[3] = BR_INSTR;
285 break;
286 default:
287 /* SPU_Status[R]=1. No additonal instructions. */
288 break;
289 }
290 spu_sync();
291}
292
293/**
294 * main - entry point for SPU-side context restore.
295 *
296 * This code deviates from the documented sequence in the
297 * following aspects:
298 *
299 * 1. The EA for LSCSA is passed from PPE in the
300 * signal notification channels.
301 * 2. The register spill area is pulled by SPU
302 * into LS, rather than pushed by PPE.
303 * 3. All 128 registers are restored by exit().
304 * 4. The exit() function is modified at run
305 * time in order to properly restore the
306 * SPU_Status register.
307 */
308int main()
309{
310 addr64 lscsa_ea;
311
312 lscsa_ea.ui[0] = spu_readch(SPU_RdSigNotify1);
313 lscsa_ea.ui[1] = spu_readch(SPU_RdSigNotify2);
314 fetch_regs_from_mem(lscsa_ea);
315
316 set_event_mask(); /* Step 1. */
317 set_tag_mask(); /* Step 2. */
318 build_dma_list(lscsa_ea); /* Step 3. */
319 restore_upper_240kb(lscsa_ea); /* Step 4. */
320 /* Step 5: done by 'exit'. */
321 restore_decr(); /* Step 6. */
322 enqueue_putllc(lscsa_ea); /* Step 7. */
323 set_tag_update(); /* Step 8. */
324 read_tag_status(); /* Step 9. */
325 read_llar_status(); /* Step 10. */
326 write_ppu_mb(); /* Step 11. */
327 write_ppuint_mb(); /* Step 12. */
328 restore_fpcr(); /* Step 13. */
329 restore_srr0(); /* Step 14. */
330 restore_event_mask(); /* Step 15. */
331 restore_tag_mask(); /* Step 16. */
332 /* Step 17. done by 'exit'. */
333 restore_complete(); /* Step 18. */
334
335 return 0;
336}
diff --git a/arch/powerpc/platforms/cell/spufs/spu_restore_crt0.S b/arch/powerpc/platforms/cell/spufs/spu_restore_crt0.S
new file mode 100644
index 000000000000..2905949debe1
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/spu_restore_crt0.S
@@ -0,0 +1,116 @@
1/*
2 * crt0_r.S: Entry function for SPU-side context restore.
3 *
4 * Copyright (C) 2005 IBM
5 *
6 * Entry and exit function for SPU-side of the context restore
7 * sequence. Sets up an initial stack frame, then branches to
8 * 'main'. On return, restores all 128 registers from the LSCSA
9 * and exits.
10 *
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 as published by
14 * the Free Software Foundation; either version 2, or (at your option)
15 * any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#include <asm/spu_csa.h>
28
29.data
30.align 7
31.globl regs_spill
32regs_spill:
33.space SIZEOF_SPU_SPILL_REGS, 0x0
34
35.text
36.global _start
37_start:
38 /* Initialize the stack pointer to point to 16368
39 * (16kb-16). The back chain pointer is initialized
40 * to NULL.
41 */
42 il $0, 0
43 il $SP, 16368
44 stqd $0, 0($SP)
45
46 /* Allocate a minimum stack frame for the called main.
47 * This is needed so that main has a place to save the
48 * link register when it calls another function.
49 */
50 stqd $SP, -160($SP)
51 ai $SP, $SP, -160
52
53 /* Call the program's main function. */
54 brsl $0, main
55
56.global exit
57.global _exit
58exit:
59_exit:
60 /* SPU Context Restore, Step 5: Restore the remaining 112 GPRs. */
61 ila $3, regs_spill + 256
62restore_regs:
63 lqr $4, restore_reg_insts
64restore_reg_loop:
65 ai $4, $4, 4
66 .balignl 16, 0x40200000
67restore_reg_insts: /* must be quad-word aligned. */
68 lqd $16, 0($3)
69 lqd $17, 16($3)
70 lqd $18, 32($3)
71 lqd $19, 48($3)
72 andi $5, $4, 0x7F
73 stqr $4, restore_reg_insts
74 ai $3, $3, 64
75 brnz $5, restore_reg_loop
76
77 /* SPU Context Restore Step 17: Restore the first 16 GPRs. */
78 lqa $0, regs_spill + 0
79 lqa $1, regs_spill + 16
80 lqa $2, regs_spill + 32
81 lqa $3, regs_spill + 48
82 lqa $4, regs_spill + 64
83 lqa $5, regs_spill + 80
84 lqa $6, regs_spill + 96
85 lqa $7, regs_spill + 112
86 lqa $8, regs_spill + 128
87 lqa $9, regs_spill + 144
88 lqa $10, regs_spill + 160
89 lqa $11, regs_spill + 176
90 lqa $12, regs_spill + 192
91 lqa $13, regs_spill + 208
92 lqa $14, regs_spill + 224
93 lqa $15, regs_spill + 240
94
95 /* Under normal circumstances, the 'exit' function
96 * terminates with 'stop SPU_RESTORE_COMPLETE',
97 * indicating that the SPU-side restore code has
98 * completed.
99 *
100 * However it is possible that instructions immediately
101 * following the 'stop 0x3ffc' have been modified at run
102 * time so as to recreate the exact SPU_Status settings
103 * from the application, e.g. illegal instruciton, halt,
104 * etc.
105 */
106.global exit_fini
107.global _exit_fini
108exit_fini:
109_exit_fini:
110 stop SPU_RESTORE_COMPLETE
111 stop 0
112 stop 0
113 stop 0
114
115 /* Pad the size of this crt0.o to be multiple of 16 bytes. */
116.balignl 16, 0x0
diff --git a/arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped b/arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped
new file mode 100644
index 000000000000..1b2355ff7036
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/spu_restore_dump.h_shipped
@@ -0,0 +1,231 @@
1/*
2 * spu_restore_dump.h: Copyright (C) 2005 IBM.
3 * Hex-dump auto generated from spu_restore.c.
4 * Do not edit!
5 */
6static unsigned int spu_restore_code[] __page_aligned = {
70x40800000, 0x409ff801, 0x24000080, 0x24fd8081,
80x1cd80081, 0x33001180, 0x42030003, 0x33800284,
90x1c010204, 0x40200000, 0x40200000, 0x40200000,
100x34000190, 0x34004191, 0x34008192, 0x3400c193,
110x141fc205, 0x23fffd84, 0x1c100183, 0x217ffa85,
120x3080a000, 0x3080a201, 0x3080a402, 0x3080a603,
130x3080a804, 0x3080aa05, 0x3080ac06, 0x3080ae07,
140x3080b008, 0x3080b209, 0x3080b40a, 0x3080b60b,
150x3080b80c, 0x3080ba0d, 0x3080bc0e, 0x3080be0f,
160x00003ffc, 0x00000000, 0x00000000, 0x00000000,
170x01a00182, 0x3ec00083, 0xb0a14103, 0x01a00204,
180x3ec10082, 0x4202800e, 0x04000703, 0xb0a14202,
190x21a00803, 0x3fbf028d, 0x3f20068d, 0x3fbe0682,
200x3fe30102, 0x21a00882, 0x3f82028f, 0x3fe3078f,
210x3fbf0784, 0x3f200204, 0x3fbe0204, 0x3fe30204,
220x04000203, 0x21a00903, 0x40848002, 0x21a00982,
230x40800003, 0x21a00a03, 0x40802002, 0x21a00a82,
240x21a00083, 0x40800082, 0x21a00b02, 0x10002818,
250x40a80002, 0x32800007, 0x4207000c, 0x18008208,
260x40a0000b, 0x4080020a, 0x40800709, 0x00200000,
270x42070002, 0x3ac30384, 0x1cffc489, 0x00200000,
280x18008383, 0x38830382, 0x4cffc486, 0x3ac28185,
290xb0408584, 0x28830382, 0x1c020387, 0x38828182,
300xb0408405, 0x1802c408, 0x28828182, 0x217ff886,
310x04000583, 0x21a00803, 0x3fbe0682, 0x3fe30102,
320x04000106, 0x21a00886, 0x04000603, 0x21a00903,
330x40803c02, 0x21a00982, 0x40800003, 0x04000184,
340x21a00a04, 0x40802202, 0x21a00a82, 0x42028005,
350x34208702, 0x21002282, 0x21a00804, 0x21a00886,
360x3fbf0782, 0x3f200102, 0x3fbe0102, 0x3fe30102,
370x21a00902, 0x40804003, 0x21a00983, 0x21a00a04,
380x40805a02, 0x21a00a82, 0x40800083, 0x21a00b83,
390x01a00c02, 0x01a00d83, 0x3420c282, 0x21a00e02,
400x34210283, 0x21a00f03, 0x34200284, 0x77400200,
410x3421c282, 0x21a00702, 0x34218283, 0x21a00083,
420x34214282, 0x21a00b02, 0x4200480c, 0x00200000,
430x1c010286, 0x34220284, 0x34220302, 0x0f608203,
440x5c024204, 0x3b81810b, 0x42013c02, 0x00200000,
450x18008185, 0x38808183, 0x3b814182, 0x21004e84,
460x4020007f, 0x35000100, 0x000004e0, 0x000002a0,
470x000002e8, 0x00000428, 0x00000360, 0x000002e8,
480x000004a0, 0x00000468, 0x000003c8, 0x00000360,
490x409ffe02, 0x30801203, 0x40800204, 0x3ec40085,
500x10009c09, 0x3ac10606, 0xb060c105, 0x4020007f,
510x4020007f, 0x20801203, 0x38810602, 0xb0408586,
520x28810602, 0x32004180, 0x34204702, 0x21a00382,
530x4020007f, 0x327fdc80, 0x409ffe02, 0x30801203,
540x40800204, 0x3ec40087, 0x40800405, 0x00200000,
550x40800606, 0x3ac10608, 0x3ac14609, 0x3ac1860a,
560xb060c107, 0x20801203, 0x41004003, 0x38810602,
570x4020007f, 0xb0408188, 0x4020007f, 0x28810602,
580x41201002, 0x38814603, 0x10009c09, 0xb060c109,
590x4020007f, 0x28814603, 0x41193f83, 0x38818602,
600x60ffc003, 0xb040818a, 0x28818602, 0x32003080,
610x409ffe02, 0x30801203, 0x40800204, 0x3ec40087,
620x41201008, 0x10009c14, 0x40800405, 0x3ac10609,
630x40800606, 0x3ac1460a, 0xb060c107, 0x3ac1860b,
640x20801203, 0x38810602, 0xb0408409, 0x28810602,
650x38814603, 0xb060c40a, 0x4020007f, 0x28814603,
660x41193f83, 0x38818602, 0x60ffc003, 0xb040818b,
670x28818602, 0x32002380, 0x409ffe02, 0x30801204,
680x40800205, 0x3ec40083, 0x40800406, 0x3ac14607,
690x3ac18608, 0xb0810103, 0x41004002, 0x20801204,
700x4020007f, 0x38814603, 0x10009c0b, 0xb060c107,
710x4020007f, 0x4020007f, 0x28814603, 0x38818602,
720x4020007f, 0x4020007f, 0xb0408588, 0x28818602,
730x4020007f, 0x32001780, 0x409ffe02, 0x1000640e,
740x40800204, 0x30801203, 0x40800405, 0x3ec40087,
750x40800606, 0x3ac10608, 0x3ac14609, 0x3ac1860a,
760xb060c107, 0x20801203, 0x413d8003, 0x38810602,
770x4020007f, 0x327fd780, 0x409ffe02, 0x10007f0c,
780x40800205, 0x30801204, 0x40800406, 0x3ec40083,
790x3ac14607, 0x3ac18608, 0xb0810103, 0x413d8002,
800x20801204, 0x38814603, 0x4020007f, 0x327feb80,
810x409ffe02, 0x30801203, 0x40800204, 0x3ec40087,
820x40800405, 0x1000650a, 0x40800606, 0x3ac10608,
830x3ac14609, 0x3ac1860a, 0xb060c107, 0x20801203,
840x38810602, 0xb0408588, 0x4020007f, 0x327fc980,
850x00400000, 0x40800003, 0x4020007f, 0x35000000,
860x00000000, 0x00000000, 0x00000000, 0x00000000,
870x00000000, 0x00000000, 0x00000000, 0x00000000,
880x00000000, 0x00000000, 0x00000000, 0x00000000,
890x00000000, 0x00000000, 0x00000000, 0x00000000,
900x00000000, 0x00000000, 0x00000000, 0x00000000,
910x00000000, 0x00000000, 0x00000000, 0x00000000,
920x00000000, 0x00000000, 0x00000000, 0x00000000,
930x00000000, 0x00000000, 0x00000000, 0x00000000,
940x00000000, 0x00000000, 0x00000000, 0x00000000,
950x00000000, 0x00000000, 0x00000000, 0x00000000,
960x00000000, 0x00000000, 0x00000000, 0x00000000,
970x00000000, 0x00000000, 0x00000000, 0x00000000,
980x00000000, 0x00000000, 0x00000000, 0x00000000,
990x00000000, 0x00000000, 0x00000000, 0x00000000,
1000x00000000, 0x00000000, 0x00000000, 0x00000000,
1010x00000000, 0x00000000, 0x00000000, 0x00000000,
1020x00000000, 0x00000000, 0x00000000, 0x00000000,
1030x00000000, 0x00000000, 0x00000000, 0x00000000,
1040x00000000, 0x00000000, 0x00000000, 0x00000000,
1050x00000000, 0x00000000, 0x00000000, 0x00000000,
1060x00000000, 0x00000000, 0x00000000, 0x00000000,
1070x00000000, 0x00000000, 0x00000000, 0x00000000,
1080x00000000, 0x00000000, 0x00000000, 0x00000000,
1090x00000000, 0x00000000, 0x00000000, 0x00000000,
1100x00000000, 0x00000000, 0x00000000, 0x00000000,
1110x00000000, 0x00000000, 0x00000000, 0x00000000,
1120x00000000, 0x00000000, 0x00000000, 0x00000000,
1130x00000000, 0x00000000, 0x00000000, 0x00000000,
1140x00000000, 0x00000000, 0x00000000, 0x00000000,
1150x00000000, 0x00000000, 0x00000000, 0x00000000,
1160x00000000, 0x00000000, 0x00000000, 0x00000000,
1170x00000000, 0x00000000, 0x00000000, 0x00000000,
1180x00000000, 0x00000000, 0x00000000, 0x00000000,
1190x00000000, 0x00000000, 0x00000000, 0x00000000,
1200x00000000, 0x00000000, 0x00000000, 0x00000000,
1210x00000000, 0x00000000, 0x00000000, 0x00000000,
1220x00000000, 0x00000000, 0x00000000, 0x00000000,
1230x00000000, 0x00000000, 0x00000000, 0x00000000,
1240x00000000, 0x00000000, 0x00000000, 0x00000000,
1250x00000000, 0x00000000, 0x00000000, 0x00000000,
1260x00000000, 0x00000000, 0x00000000, 0x00000000,
1270x00000000, 0x00000000, 0x00000000, 0x00000000,
1280x00000000, 0x00000000, 0x00000000, 0x00000000,
1290x00000000, 0x00000000, 0x00000000, 0x00000000,
1300x00000000, 0x00000000, 0x00000000, 0x00000000,
1310x00000000, 0x00000000, 0x00000000, 0x00000000,
1320x00000000, 0x00000000, 0x00000000, 0x00000000,
1330x00000000, 0x00000000, 0x00000000, 0x00000000,
1340x00000000, 0x00000000, 0x00000000, 0x00000000,
1350x00000000, 0x00000000, 0x00000000, 0x00000000,
1360x00000000, 0x00000000, 0x00000000, 0x00000000,
1370x00000000, 0x00000000, 0x00000000, 0x00000000,
1380x00000000, 0x00000000, 0x00000000, 0x00000000,
1390x00000000, 0x00000000, 0x00000000, 0x00000000,
1400x00000000, 0x00000000, 0x00000000, 0x00000000,
1410x00000000, 0x00000000, 0x00000000, 0x00000000,
1420x00000000, 0x00000000, 0x00000000, 0x00000000,
1430x00000000, 0x00000000, 0x00000000, 0x00000000,
1440x00000000, 0x00000000, 0x00000000, 0x00000000,
1450x00000000, 0x00000000, 0x00000000, 0x00000000,
1460x00000000, 0x00000000, 0x00000000, 0x00000000,
1470x00000000, 0x00000000, 0x00000000, 0x00000000,
1480x00000000, 0x00000000, 0x00000000, 0x00000000,
1490x00000000, 0x00000000, 0x00000000, 0x00000000,
1500x00000000, 0x00000000, 0x00000000, 0x00000000,
1510x00000000, 0x00000000, 0x00000000, 0x00000000,
1520x00000000, 0x00000000, 0x00000000, 0x00000000,
1530x00000000, 0x00000000, 0x00000000, 0x00000000,
1540x00000000, 0x00000000, 0x00000000, 0x00000000,
1550x00000000, 0x00000000, 0x00000000, 0x00000000,
1560x00000000, 0x00000000, 0x00000000, 0x00000000,
1570x00000000, 0x00000000, 0x00000000, 0x00000000,
1580x00000000, 0x00000000, 0x00000000, 0x00000000,
1590x00000000, 0x00000000, 0x00000000, 0x00000000,
1600x00000000, 0x00000000, 0x00000000, 0x00000000,
1610x00000000, 0x00000000, 0x00000000, 0x00000000,
1620x00000000, 0x00000000, 0x00000000, 0x00000000,
1630x00000000, 0x00000000, 0x00000000, 0x00000000,
1640x00000000, 0x00000000, 0x00000000, 0x00000000,
1650x00000000, 0x00000000, 0x00000000, 0x00000000,
1660x00000000, 0x00000000, 0x00000000, 0x00000000,
1670x00000000, 0x00000000, 0x00000000, 0x00000000,
1680x00000000, 0x00000000, 0x00000000, 0x00000000,
1690x00000000, 0x00000000, 0x00000000, 0x00000000,
1700x00000000, 0x00000000, 0x00000000, 0x00000000,
1710x00000000, 0x00000000, 0x00000000, 0x00000000,
1720x00000000, 0x00000000, 0x00000000, 0x00000000,
1730x00000000, 0x00000000, 0x00000000, 0x00000000,
1740x00000000, 0x00000000, 0x00000000, 0x00000000,
1750x00000000, 0x00000000, 0x00000000, 0x00000000,
1760x00000000, 0x00000000, 0x00000000, 0x00000000,
1770x00000000, 0x00000000, 0x00000000, 0x00000000,
1780x00000000, 0x00000000, 0x00000000, 0x00000000,
1790x00000000, 0x00000000, 0x00000000, 0x00000000,
1800x00000000, 0x00000000, 0x00000000, 0x00000000,
1810x00000000, 0x00000000, 0x00000000, 0x00000000,
1820x00000000, 0x00000000, 0x00000000, 0x00000000,
1830x00000000, 0x00000000, 0x00000000, 0x00000000,
1840x00000000, 0x00000000, 0x00000000, 0x00000000,
1850x00000000, 0x00000000, 0x00000000, 0x00000000,
1860x00000000, 0x00000000, 0x00000000, 0x00000000,
1870x00000000, 0x00000000, 0x00000000, 0x00000000,
1880x00000000, 0x00000000, 0x00000000, 0x00000000,
1890x00000000, 0x00000000, 0x00000000, 0x00000000,
1900x00000000, 0x00000000, 0x00000000, 0x00000000,
1910x00000000, 0x00000000, 0x00000000, 0x00000000,
1920x00000000, 0x00000000, 0x00000000, 0x00000000,
1930x00000000, 0x00000000, 0x00000000, 0x00000000,
1940x00000000, 0x00000000, 0x00000000, 0x00000000,
1950x00000000, 0x00000000, 0x00000000, 0x00000000,
1960x00000000, 0x00000000, 0x00000000, 0x00000000,
1970x00000000, 0x00000000, 0x00000000, 0x00000000,
1980x00000000, 0x00000000, 0x00000000, 0x00000000,
1990x00000000, 0x00000000, 0x00000000, 0x00000000,
2000x00000000, 0x00000000, 0x00000000, 0x00000000,
2010x00000000, 0x00000000, 0x00000000, 0x00000000,
2020x00000000, 0x00000000, 0x00000000, 0x00000000,
2030x00000000, 0x00000000, 0x00000000, 0x00000000,
2040x00000000, 0x00000000, 0x00000000, 0x00000000,
2050x00000000, 0x00000000, 0x00000000, 0x00000000,
2060x00000000, 0x00000000, 0x00000000, 0x00000000,
2070x00000000, 0x00000000, 0x00000000, 0x00000000,
2080x00000000, 0x00000000, 0x00000000, 0x00000000,
2090x00000000, 0x00000000, 0x00000000, 0x00000000,
2100x00000000, 0x00000000, 0x00000000, 0x00000000,
2110x00000000, 0x00000000, 0x00000000, 0x00000000,
2120x00000000, 0x00000000, 0x00000000, 0x00000000,
2130x00000000, 0x00000000, 0x00000000, 0x00000000,
2140x00000000, 0x00000000, 0x00000000, 0x00000000,
2150x00000000, 0x00000000, 0x00000000, 0x00000000,
2160x00000000, 0x00000000, 0x00000000, 0x00000000,
2170x00000000, 0x00000000, 0x00000000, 0x00000000,
2180x00000000, 0x00000000, 0x00000000, 0x00000000,
2190x00000000, 0x00000000, 0x00000000, 0x00000000,
2200x00000000, 0x00000000, 0x00000000, 0x00000000,
2210x00000000, 0x00000000, 0x00000000, 0x00000000,
2220x00000000, 0x00000000, 0x00000000, 0x00000000,
2230x00000000, 0x00000000, 0x00000000, 0x00000000,
2240x00000000, 0x00000000, 0x00000000, 0x00000000,
2250x00000000, 0x00000000, 0x00000000, 0x00000000,
2260x00000000, 0x00000000, 0x00000000, 0x00000000,
2270x00000000, 0x00000000, 0x00000000, 0x00000000,
2280x00000000, 0x00000000, 0x00000000, 0x00000000,
2290x00000000, 0x00000000, 0x00000000, 0x00000000,
2300x00000000, 0x00000000, 0x00000000, 0x00000000,
231};
diff --git a/arch/powerpc/platforms/cell/spufs/spu_save.c b/arch/powerpc/platforms/cell/spufs/spu_save.c
new file mode 100644
index 000000000000..196033b8a579
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/spu_save.c
@@ -0,0 +1,195 @@
1/*
2 * spu_save.c
3 *
4 * (C) Copyright IBM Corp. 2005
5 *
6 * SPU-side context save sequence outlined in
7 * Synergistic Processor Element Book IV
8 *
9 * Author: Mark Nutter <mnutter@us.ibm.com>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 */
26
27
28#ifndef LS_SIZE
29#define LS_SIZE 0x40000 /* 256K (in bytes) */
30#endif
31
32typedef unsigned int u32;
33typedef unsigned long long u64;
34
35#include <spu_intrinsics.h>
36#include <asm/spu_csa.h>
37#include "spu_utils.h"
38
39static inline void save_event_mask(void)
40{
41 unsigned int offset;
42
43 /* Save, Step 2:
44 * Read the SPU_RdEventMsk channel and save to the LSCSA.
45 */
46 offset = LSCSA_QW_OFFSET(event_mask);
47 regs_spill[offset].slot[0] = spu_readch(SPU_RdEventStatMask);
48}
49
50static inline void save_tag_mask(void)
51{
52 unsigned int offset;
53
54 /* Save, Step 3:
55 * Read the SPU_RdTagMsk channel and save to the LSCSA.
56 */
57 offset = LSCSA_QW_OFFSET(tag_mask);
58 regs_spill[offset].slot[0] = spu_readch(MFC_RdTagMask);
59}
60
61static inline void save_upper_240kb(addr64 lscsa_ea)
62{
63 unsigned int ls = 16384;
64 unsigned int list = (unsigned int)&dma_list[0];
65 unsigned int size = sizeof(dma_list);
66 unsigned int tag_id = 0;
67 unsigned int cmd = 0x24; /* PUTL */
68
69 /* Save, Step 7:
70 * Enqueue the PUTL command (tag 0) to the MFC SPU command
71 * queue to transfer the remaining 240 kb of LS to CSA.
72 */
73 spu_writech(MFC_LSA, ls);
74 spu_writech(MFC_EAH, lscsa_ea.ui[0]);
75 spu_writech(MFC_EAL, list);
76 spu_writech(MFC_Size, size);
77 spu_writech(MFC_TagID, tag_id);
78 spu_writech(MFC_Cmd, cmd);
79}
80
81static inline void save_fpcr(void)
82{
83 // vector unsigned int fpcr;
84 unsigned int offset;
85
86 /* Save, Step 9:
87 * Issue the floating-point status and control register
88 * read instruction, and save to the LSCSA.
89 */
90 offset = LSCSA_QW_OFFSET(fpcr);
91 regs_spill[offset].v = spu_mffpscr();
92}
93
94static inline void save_decr(void)
95{
96 unsigned int offset;
97
98 /* Save, Step 10:
99 * Read and save the SPU_RdDec channel data to
100 * the LSCSA.
101 */
102 offset = LSCSA_QW_OFFSET(decr);
103 regs_spill[offset].slot[0] = spu_readch(SPU_RdDec);
104}
105
106static inline void save_srr0(void)
107{
108 unsigned int offset;
109
110 /* Save, Step 11:
111 * Read and save the SPU_WSRR0 channel data to
112 * the LSCSA.
113 */
114 offset = LSCSA_QW_OFFSET(srr0);
115 regs_spill[offset].slot[0] = spu_readch(SPU_RdSRR0);
116}
117
118static inline void spill_regs_to_mem(addr64 lscsa_ea)
119{
120 unsigned int ls = (unsigned int)&regs_spill[0];
121 unsigned int size = sizeof(regs_spill);
122 unsigned int tag_id = 0;
123 unsigned int cmd = 0x20; /* PUT */
124
125 /* Save, Step 13:
126 * Enqueue a PUT command (tag 0) to send the LSCSA
127 * to the CSA.
128 */
129 spu_writech(MFC_LSA, ls);
130 spu_writech(MFC_EAH, lscsa_ea.ui[0]);
131 spu_writech(MFC_EAL, lscsa_ea.ui[1]);
132 spu_writech(MFC_Size, size);
133 spu_writech(MFC_TagID, tag_id);
134 spu_writech(MFC_Cmd, cmd);
135}
136
137static inline void enqueue_sync(addr64 lscsa_ea)
138{
139 unsigned int tag_id = 0;
140 unsigned int cmd = 0xCC;
141
142 /* Save, Step 14:
143 * Enqueue an MFC_SYNC command (tag 0).
144 */
145 spu_writech(MFC_TagID, tag_id);
146 spu_writech(MFC_Cmd, cmd);
147}
148
149static inline void save_complete(void)
150{
151 /* Save, Step 18:
152 * Issue a stop-and-signal instruction indicating
153 * "save complete". Note: This function will not
154 * return!!
155 */
156 spu_stop(SPU_SAVE_COMPLETE);
157}
158
159/**
160 * main - entry point for SPU-side context save.
161 *
162 * This code deviates from the documented sequence as follows:
163 *
164 * 1. The EA for LSCSA is passed from PPE in the
165 * signal notification channels.
166 * 2. All 128 registers are saved by crt0.o.
167 */
168int main()
169{
170 addr64 lscsa_ea;
171
172 lscsa_ea.ui[0] = spu_readch(SPU_RdSigNotify1);
173 lscsa_ea.ui[1] = spu_readch(SPU_RdSigNotify2);
174
175 /* Step 1: done by exit(). */
176 save_event_mask(); /* Step 2. */
177 save_tag_mask(); /* Step 3. */
178 set_event_mask(); /* Step 4. */
179 set_tag_mask(); /* Step 5. */
180 build_dma_list(lscsa_ea); /* Step 6. */
181 save_upper_240kb(lscsa_ea); /* Step 7. */
182 /* Step 8: done by exit(). */
183 save_fpcr(); /* Step 9. */
184 save_decr(); /* Step 10. */
185 save_srr0(); /* Step 11. */
186 enqueue_putllc(lscsa_ea); /* Step 12. */
187 spill_regs_to_mem(lscsa_ea); /* Step 13. */
188 enqueue_sync(lscsa_ea); /* Step 14. */
189 set_tag_update(); /* Step 15. */
190 read_tag_status(); /* Step 16. */
191 read_llar_status(); /* Step 17. */
192 save_complete(); /* Step 18. */
193
194 return 0;
195}
diff --git a/arch/powerpc/platforms/cell/spufs/spu_save_crt0.S b/arch/powerpc/platforms/cell/spufs/spu_save_crt0.S
new file mode 100644
index 000000000000..6659d6a66faa
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/spu_save_crt0.S
@@ -0,0 +1,102 @@
1/*
2 * crt0_s.S: Entry function for SPU-side context save.
3 *
4 * Copyright (C) 2005 IBM
5 *
6 * Entry function for SPU-side of the context save sequence.
7 * Saves all 128 GPRs, sets up an initial stack frame, then
8 * branches to 'main'.
9 *
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26#include <asm/spu_csa.h>
27
28.data
29.align 7
30.globl regs_spill
31regs_spill:
32.space SIZEOF_SPU_SPILL_REGS, 0x0
33
34.text
35.global _start
36_start:
37 /* SPU Context Save Step 1: Save the first 16 GPRs. */
38 stqa $0, regs_spill + 0
39 stqa $1, regs_spill + 16
40 stqa $2, regs_spill + 32
41 stqa $3, regs_spill + 48
42 stqa $4, regs_spill + 64
43 stqa $5, regs_spill + 80
44 stqa $6, regs_spill + 96
45 stqa $7, regs_spill + 112
46 stqa $8, regs_spill + 128
47 stqa $9, regs_spill + 144
48 stqa $10, regs_spill + 160
49 stqa $11, regs_spill + 176
50 stqa $12, regs_spill + 192
51 stqa $13, regs_spill + 208
52 stqa $14, regs_spill + 224
53 stqa $15, regs_spill + 240
54
55 /* SPU Context Save, Step 8: Save the remaining 112 GPRs. */
56 ila $3, regs_spill + 256
57save_regs:
58 lqr $4, save_reg_insts
59save_reg_loop:
60 ai $4, $4, 4
61 .balignl 16, 0x40200000
62save_reg_insts: /* must be quad-word aligned. */
63 stqd $16, 0($3)
64 stqd $17, 16($3)
65 stqd $18, 32($3)
66 stqd $19, 48($3)
67 andi $5, $4, 0x7F
68 stqr $4, save_reg_insts
69 ai $3, $3, 64
70 brnz $5, save_reg_loop
71
72 /* Initialize the stack pointer to point to 16368
73 * (16kb-16). The back chain pointer is initialized
74 * to NULL.
75 */
76 il $0, 0
77 il $SP, 16368
78 stqd $0, 0($SP)
79
80 /* Allocate a minimum stack frame for the called main.
81 * This is needed so that main has a place to save the
82 * link register when it calls another function.
83 */
84 stqd $SP, -160($SP)
85 ai $SP, $SP, -160
86
87 /* Call the program's main function. */
88 brsl $0, main
89
90 /* In this case main should not return; if it does
91 * there has been an error in the sequence. Execute
92 * stop-and-signal with code=0.
93 */
94.global exit
95.global _exit
96exit:
97_exit:
98 stop 0x0
99
100 /* Pad the size of this crt0.o to be multiple of 16 bytes. */
101.balignl 16, 0x0
102
diff --git a/arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped b/arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped
new file mode 100644
index 000000000000..39e54003f1df
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/spu_save_dump.h_shipped
@@ -0,0 +1,191 @@
1/*
2 * spu_save_dump.h: Copyright (C) 2005 IBM.
3 * Hex-dump auto generated from spu_save.c.
4 * Do not edit!
5 */
6static unsigned int spu_save_code[] __page_aligned = {
70x20805000, 0x20805201, 0x20805402, 0x20805603,
80x20805804, 0x20805a05, 0x20805c06, 0x20805e07,
90x20806008, 0x20806209, 0x2080640a, 0x2080660b,
100x2080680c, 0x20806a0d, 0x20806c0e, 0x20806e0f,
110x4201c003, 0x33800184, 0x1c010204, 0x40200000,
120x24000190, 0x24004191, 0x24008192, 0x2400c193,
130x141fc205, 0x23fffd84, 0x1c100183, 0x217ffb85,
140x40800000, 0x409ff801, 0x24000080, 0x24fd8081,
150x1cd80081, 0x33000180, 0x00000000, 0x00000000,
160x01a00182, 0x3ec00083, 0xb1c38103, 0x01a00204,
170x3ec10082, 0x4201400d, 0xb1c38202, 0x01a00583,
180x34218682, 0x3ed80684, 0xb0408184, 0x24218682,
190x01a00603, 0x00200000, 0x34214682, 0x3ed40684,
200xb0408184, 0x40800003, 0x24214682, 0x21a00083,
210x40800082, 0x21a00b02, 0x4020007f, 0x1000251e,
220x40a80002, 0x32800008, 0x4205c00c, 0x00200000,
230x40a0000b, 0x3f82070f, 0x4080020a, 0x40800709,
240x3fe3078f, 0x3fbf0783, 0x3f200183, 0x3fbe0183,
250x3fe30187, 0x18008387, 0x4205c002, 0x3ac30404,
260x1cffc489, 0x00200000, 0x18008403, 0x38830402,
270x4cffc486, 0x3ac28185, 0xb0408584, 0x28830402,
280x1c020408, 0x38828182, 0xb0408385, 0x1802c387,
290x28828182, 0x217ff886, 0x04000582, 0x32800007,
300x21a00802, 0x3fbf0705, 0x3f200285, 0x3fbe0285,
310x3fe30285, 0x21a00885, 0x04000603, 0x21a00903,
320x40803c02, 0x21a00982, 0x04000386, 0x21a00a06,
330x40801202, 0x21a00a82, 0x73000003, 0x24200683,
340x01a00404, 0x00200000, 0x34204682, 0x3ec40683,
350xb0408203, 0x24204682, 0x01a00783, 0x00200000,
360x3421c682, 0x3edc0684, 0xb0408184, 0x2421c682,
370x21a00806, 0x21a00885, 0x3fbf0784, 0x3f200204,
380x3fbe0204, 0x3fe30204, 0x21a00904, 0x40804002,
390x21a00982, 0x21a00a06, 0x40805a02, 0x21a00a82,
400x04000683, 0x21a00803, 0x21a00885, 0x21a00904,
410x40848002, 0x21a00982, 0x21a00a06, 0x40801002,
420x21a00a82, 0x21a00a06, 0x40806602, 0x00200000,
430x35800009, 0x21a00a82, 0x40800083, 0x21a00b83,
440x01a00c02, 0x01a00d83, 0x00003ffb, 0x40800003,
450x4020007f, 0x35000000, 0x00000000, 0x00000000,
460x00000000, 0x00000000, 0x00000000, 0x00000000,
470x00000000, 0x00000000, 0x00000000, 0x00000000,
480x00000000, 0x00000000, 0x00000000, 0x00000000,
490x00000000, 0x00000000, 0x00000000, 0x00000000,
500x00000000, 0x00000000, 0x00000000, 0x00000000,
510x00000000, 0x00000000, 0x00000000, 0x00000000,
520x00000000, 0x00000000, 0x00000000, 0x00000000,
530x00000000, 0x00000000, 0x00000000, 0x00000000,
540x00000000, 0x00000000, 0x00000000, 0x00000000,
550x00000000, 0x00000000, 0x00000000, 0x00000000,
560x00000000, 0x00000000, 0x00000000, 0x00000000,
570x00000000, 0x00000000, 0x00000000, 0x00000000,
580x00000000, 0x00000000, 0x00000000, 0x00000000,
590x00000000, 0x00000000, 0x00000000, 0x00000000,
600x00000000, 0x00000000, 0x00000000, 0x00000000,
610x00000000, 0x00000000, 0x00000000, 0x00000000,
620x00000000, 0x00000000, 0x00000000, 0x00000000,
630x00000000, 0x00000000, 0x00000000, 0x00000000,
640x00000000, 0x00000000, 0x00000000, 0x00000000,
650x00000000, 0x00000000, 0x00000000, 0x00000000,
660x00000000, 0x00000000, 0x00000000, 0x00000000,
670x00000000, 0x00000000, 0x00000000, 0x00000000,
680x00000000, 0x00000000, 0x00000000, 0x00000000,
690x00000000, 0x00000000, 0x00000000, 0x00000000,
700x00000000, 0x00000000, 0x00000000, 0x00000000,
710x00000000, 0x00000000, 0x00000000, 0x00000000,
720x00000000, 0x00000000, 0x00000000, 0x00000000,
730x00000000, 0x00000000, 0x00000000, 0x00000000,
740x00000000, 0x00000000, 0x00000000, 0x00000000,
750x00000000, 0x00000000, 0x00000000, 0x00000000,
760x00000000, 0x00000000, 0x00000000, 0x00000000,
770x00000000, 0x00000000, 0x00000000, 0x00000000,
780x00000000, 0x00000000, 0x00000000, 0x00000000,
790x00000000, 0x00000000, 0x00000000, 0x00000000,
800x00000000, 0x00000000, 0x00000000, 0x00000000,
810x00000000, 0x00000000, 0x00000000, 0x00000000,
820x00000000, 0x00000000, 0x00000000, 0x00000000,
830x00000000, 0x00000000, 0x00000000, 0x00000000,
840x00000000, 0x00000000, 0x00000000, 0x00000000,
850x00000000, 0x00000000, 0x00000000, 0x00000000,
860x00000000, 0x00000000, 0x00000000, 0x00000000,
870x00000000, 0x00000000, 0x00000000, 0x00000000,
880x00000000, 0x00000000, 0x00000000, 0x00000000,
890x00000000, 0x00000000, 0x00000000, 0x00000000,
900x00000000, 0x00000000, 0x00000000, 0x00000000,
910x00000000, 0x00000000, 0x00000000, 0x00000000,
920x00000000, 0x00000000, 0x00000000, 0x00000000,
930x00000000, 0x00000000, 0x00000000, 0x00000000,
940x00000000, 0x00000000, 0x00000000, 0x00000000,
950x00000000, 0x00000000, 0x00000000, 0x00000000,
960x00000000, 0x00000000, 0x00000000, 0x00000000,
970x00000000, 0x00000000, 0x00000000, 0x00000000,
980x00000000, 0x00000000, 0x00000000, 0x00000000,
990x00000000, 0x00000000, 0x00000000, 0x00000000,
1000x00000000, 0x00000000, 0x00000000, 0x00000000,
1010x00000000, 0x00000000, 0x00000000, 0x00000000,
1020x00000000, 0x00000000, 0x00000000, 0x00000000,
1030x00000000, 0x00000000, 0x00000000, 0x00000000,
1040x00000000, 0x00000000, 0x00000000, 0x00000000,
1050x00000000, 0x00000000, 0x00000000, 0x00000000,
1060x00000000, 0x00000000, 0x00000000, 0x00000000,
1070x00000000, 0x00000000, 0x00000000, 0x00000000,
1080x00000000, 0x00000000, 0x00000000, 0x00000000,
1090x00000000, 0x00000000, 0x00000000, 0x00000000,
1100x00000000, 0x00000000, 0x00000000, 0x00000000,
1110x00000000, 0x00000000, 0x00000000, 0x00000000,
1120x00000000, 0x00000000, 0x00000000, 0x00000000,
1130x00000000, 0x00000000, 0x00000000, 0x00000000,
1140x00000000, 0x00000000, 0x00000000, 0x00000000,
1150x00000000, 0x00000000, 0x00000000, 0x00000000,
1160x00000000, 0x00000000, 0x00000000, 0x00000000,
1170x00000000, 0x00000000, 0x00000000, 0x00000000,
1180x00000000, 0x00000000, 0x00000000, 0x00000000,
1190x00000000, 0x00000000, 0x00000000, 0x00000000,
1200x00000000, 0x00000000, 0x00000000, 0x00000000,
1210x00000000, 0x00000000, 0x00000000, 0x00000000,
1220x00000000, 0x00000000, 0x00000000, 0x00000000,
1230x00000000, 0x00000000, 0x00000000, 0x00000000,
1240x00000000, 0x00000000, 0x00000000, 0x00000000,
1250x00000000, 0x00000000, 0x00000000, 0x00000000,
1260x00000000, 0x00000000, 0x00000000, 0x00000000,
1270x00000000, 0x00000000, 0x00000000, 0x00000000,
1280x00000000, 0x00000000, 0x00000000, 0x00000000,
1290x00000000, 0x00000000, 0x00000000, 0x00000000,
1300x00000000, 0x00000000, 0x00000000, 0x00000000,
1310x00000000, 0x00000000, 0x00000000, 0x00000000,
1320x00000000, 0x00000000, 0x00000000, 0x00000000,
1330x00000000, 0x00000000, 0x00000000, 0x00000000,
1340x00000000, 0x00000000, 0x00000000, 0x00000000,
1350x00000000, 0x00000000, 0x00000000, 0x00000000,
1360x00000000, 0x00000000, 0x00000000, 0x00000000,
1370x00000000, 0x00000000, 0x00000000, 0x00000000,
1380x00000000, 0x00000000, 0x00000000, 0x00000000,
1390x00000000, 0x00000000, 0x00000000, 0x00000000,
1400x00000000, 0x00000000, 0x00000000, 0x00000000,
1410x00000000, 0x00000000, 0x00000000, 0x00000000,
1420x00000000, 0x00000000, 0x00000000, 0x00000000,
1430x00000000, 0x00000000, 0x00000000, 0x00000000,
1440x00000000, 0x00000000, 0x00000000, 0x00000000,
1450x00000000, 0x00000000, 0x00000000, 0x00000000,
1460x00000000, 0x00000000, 0x00000000, 0x00000000,
1470x00000000, 0x00000000, 0x00000000, 0x00000000,
1480x00000000, 0x00000000, 0x00000000, 0x00000000,
1490x00000000, 0x00000000, 0x00000000, 0x00000000,
1500x00000000, 0x00000000, 0x00000000, 0x00000000,
1510x00000000, 0x00000000, 0x00000000, 0x00000000,
1520x00000000, 0x00000000, 0x00000000, 0x00000000,
1530x00000000, 0x00000000, 0x00000000, 0x00000000,
1540x00000000, 0x00000000, 0x00000000, 0x00000000,
1550x00000000, 0x00000000, 0x00000000, 0x00000000,
1560x00000000, 0x00000000, 0x00000000, 0x00000000,
1570x00000000, 0x00000000, 0x00000000, 0x00000000,
1580x00000000, 0x00000000, 0x00000000, 0x00000000,
1590x00000000, 0x00000000, 0x00000000, 0x00000000,
1600x00000000, 0x00000000, 0x00000000, 0x00000000,
1610x00000000, 0x00000000, 0x00000000, 0x00000000,
1620x00000000, 0x00000000, 0x00000000, 0x00000000,
1630x00000000, 0x00000000, 0x00000000, 0x00000000,
1640x00000000, 0x00000000, 0x00000000, 0x00000000,
1650x00000000, 0x00000000, 0x00000000, 0x00000000,
1660x00000000, 0x00000000, 0x00000000, 0x00000000,
1670x00000000, 0x00000000, 0x00000000, 0x00000000,
1680x00000000, 0x00000000, 0x00000000, 0x00000000,
1690x00000000, 0x00000000, 0x00000000, 0x00000000,
1700x00000000, 0x00000000, 0x00000000, 0x00000000,
1710x00000000, 0x00000000, 0x00000000, 0x00000000,
1720x00000000, 0x00000000, 0x00000000, 0x00000000,
1730x00000000, 0x00000000, 0x00000000, 0x00000000,
1740x00000000, 0x00000000, 0x00000000, 0x00000000,
1750x00000000, 0x00000000, 0x00000000, 0x00000000,
1760x00000000, 0x00000000, 0x00000000, 0x00000000,
1770x00000000, 0x00000000, 0x00000000, 0x00000000,
1780x00000000, 0x00000000, 0x00000000, 0x00000000,
1790x00000000, 0x00000000, 0x00000000, 0x00000000,
1800x00000000, 0x00000000, 0x00000000, 0x00000000,
1810x00000000, 0x00000000, 0x00000000, 0x00000000,
1820x00000000, 0x00000000, 0x00000000, 0x00000000,
1830x00000000, 0x00000000, 0x00000000, 0x00000000,
1840x00000000, 0x00000000, 0x00000000, 0x00000000,
1850x00000000, 0x00000000, 0x00000000, 0x00000000,
1860x00000000, 0x00000000, 0x00000000, 0x00000000,
1870x00000000, 0x00000000, 0x00000000, 0x00000000,
1880x00000000, 0x00000000, 0x00000000, 0x00000000,
1890x00000000, 0x00000000, 0x00000000, 0x00000000,
1900x00000000, 0x00000000, 0x00000000, 0x00000000,
191};
diff --git a/arch/powerpc/platforms/cell/spufs/spu_utils.h b/arch/powerpc/platforms/cell/spufs/spu_utils.h
new file mode 100644
index 000000000000..58359feb6c95
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/spu_utils.h
@@ -0,0 +1,160 @@
1/*
2 * utils.h: Utilities for SPU-side of the context switch operation.
3 *
4 * (C) Copyright IBM 2005
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, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20
21#ifndef _SPU_CONTEXT_UTILS_H_
22#define _SPU_CONTEXT_UTILS_H_
23
24/*
25 * 64-bit safe EA.
26 */
27typedef union {
28 unsigned long long ull;
29 unsigned int ui[2];
30} addr64;
31
32/*
33 * 128-bit register template.
34 */
35typedef union {
36 unsigned int slot[4];
37 vector unsigned int v;
38} spu_reg128v;
39
40/*
41 * DMA list structure.
42 */
43struct dma_list_elem {
44 unsigned int size;
45 unsigned int ea_low;
46};
47
48/*
49 * Declare storage for 8-byte aligned DMA list.
50 */
51struct dma_list_elem dma_list[15] __attribute__ ((aligned(8)));
52
53/*
54 * External definition for storage
55 * declared in crt0.
56 */
57extern spu_reg128v regs_spill[NR_SPU_SPILL_REGS];
58
59/*
60 * Compute LSCSA byte offset for a given field.
61 */
62static struct spu_lscsa *dummy = (struct spu_lscsa *)0;
63#define LSCSA_BYTE_OFFSET(_field) \
64 ((char *)(&(dummy->_field)) - (char *)(&(dummy->gprs[0].slot[0])))
65#define LSCSA_QW_OFFSET(_field) (LSCSA_BYTE_OFFSET(_field) >> 4)
66
67static inline void set_event_mask(void)
68{
69 unsigned int event_mask = 0;
70
71 /* Save, Step 4:
72 * Restore, Step 1:
73 * Set the SPU_RdEventMsk channel to zero to mask
74 * all events.
75 */
76 spu_writech(SPU_WrEventMask, event_mask);
77}
78
79static inline void set_tag_mask(void)
80{
81 unsigned int tag_mask = 1;
82
83 /* Save, Step 5:
84 * Restore, Step 2:
85 * Set the SPU_WrTagMsk channel to '01' to unmask
86 * only tag group 0.
87 */
88 spu_writech(MFC_WrTagMask, tag_mask);
89}
90
91static inline void build_dma_list(addr64 lscsa_ea)
92{
93 unsigned int ea_low;
94 int i;
95
96 /* Save, Step 6:
97 * Restore, Step 3:
98 * Update the effective address for the CSA in the
99 * pre-canned DMA-list in local storage.
100 */
101 ea_low = lscsa_ea.ui[1];
102 ea_low += LSCSA_BYTE_OFFSET(ls[16384]);
103
104 for (i = 0; i < 15; i++, ea_low += 16384) {
105 dma_list[i].size = 16384;
106 dma_list[i].ea_low = ea_low;
107 }
108}
109
110static inline void enqueue_putllc(addr64 lscsa_ea)
111{
112 unsigned int ls = 0;
113 unsigned int size = 128;
114 unsigned int tag_id = 0;
115 unsigned int cmd = 0xB4; /* PUTLLC */
116
117 /* Save, Step 12:
118 * Restore, Step 7:
119 * Send a PUTLLC (tag 0) command to the MFC using
120 * an effective address in the CSA in order to
121 * remove any possible lock-line reservation.
122 */
123 spu_writech(MFC_LSA, ls);
124 spu_writech(MFC_EAH, lscsa_ea.ui[0]);
125 spu_writech(MFC_EAL, lscsa_ea.ui[1]);
126 spu_writech(MFC_Size, size);
127 spu_writech(MFC_TagID, tag_id);
128 spu_writech(MFC_Cmd, cmd);
129}
130
131static inline void set_tag_update(void)
132{
133 unsigned int update_any = 1;
134
135 /* Save, Step 15:
136 * Restore, Step 8:
137 * Write the MFC_TagUpdate channel with '01'.
138 */
139 spu_writech(MFC_WrTagUpdate, update_any);
140}
141
142static inline void read_tag_status(void)
143{
144 /* Save, Step 16:
145 * Restore, Step 9:
146 * Read the MFC_TagStat channel data.
147 */
148 spu_readch(MFC_RdTagStat);
149}
150
151static inline void read_llar_status(void)
152{
153 /* Save, Step 17:
154 * Restore, Step 10:
155 * Read the MFC_AtomicStat channel data.
156 */
157 spu_readch(MFC_RdAtomicStat);
158}
159
160#endif /* _SPU_CONTEXT_UTILS_H_ */
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
new file mode 100644
index 000000000000..db2601f0abd5
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -0,0 +1,163 @@
1/*
2 * SPU file system
3 *
4 * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
5 *
6 * Author: Arnd Bergmann <arndb@de.ibm.com>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22#ifndef SPUFS_H
23#define SPUFS_H
24
25#include <linux/kref.h>
26#include <linux/rwsem.h>
27#include <linux/spinlock.h>
28#include <linux/fs.h>
29
30#include <asm/spu.h>
31#include <asm/spu_csa.h>
32
33/* The magic number for our file system */
34enum {
35 SPUFS_MAGIC = 0x23c9b64e,
36};
37
38struct spu_context_ops;
39
40#define SPU_CONTEXT_PREEMPT 0UL
41
42struct spu_context {
43 struct spu *spu; /* pointer to a physical SPU */
44 struct spu_state csa; /* SPU context save area. */
45 spinlock_t mmio_lock; /* protects mmio access */
46 struct address_space *local_store;/* local store backing store */
47
48 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
49 struct rw_semaphore state_sema;
50 struct semaphore run_sema;
51
52 struct mm_struct *owner;
53
54 struct kref kref;
55 wait_queue_head_t ibox_wq;
56 wait_queue_head_t wbox_wq;
57 wait_queue_head_t stop_wq;
58 struct fasync_struct *ibox_fasync;
59 struct fasync_struct *wbox_fasync;
60 struct spu_context_ops *ops;
61 struct work_struct reap_work;
62 u64 flags;
63};
64
65/* SPU context query/set operations. */
66struct spu_context_ops {
67 int (*mbox_read) (struct spu_context * ctx, u32 * data);
68 u32(*mbox_stat_read) (struct spu_context * ctx);
69 unsigned int (*mbox_stat_poll)(struct spu_context *ctx,
70 unsigned int events);
71 int (*ibox_read) (struct spu_context * ctx, u32 * data);
72 int (*wbox_write) (struct spu_context * ctx, u32 data);
73 u32(*signal1_read) (struct spu_context * ctx);
74 void (*signal1_write) (struct spu_context * ctx, u32 data);
75 u32(*signal2_read) (struct spu_context * ctx);
76 void (*signal2_write) (struct spu_context * ctx, u32 data);
77 void (*signal1_type_set) (struct spu_context * ctx, u64 val);
78 u64(*signal1_type_get) (struct spu_context * ctx);
79 void (*signal2_type_set) (struct spu_context * ctx, u64 val);
80 u64(*signal2_type_get) (struct spu_context * ctx);
81 u32(*npc_read) (struct spu_context * ctx);
82 void (*npc_write) (struct spu_context * ctx, u32 data);
83 u32(*status_read) (struct spu_context * ctx);
84 char*(*get_ls) (struct spu_context * ctx);
85 void (*runcntl_write) (struct spu_context * ctx, u32 data);
86 void (*runcntl_stop) (struct spu_context * ctx);
87};
88
89extern struct spu_context_ops spu_hw_ops;
90extern struct spu_context_ops spu_backing_ops;
91
92struct spufs_inode_info {
93 struct spu_context *i_ctx;
94 struct inode vfs_inode;
95};
96#define SPUFS_I(inode) \
97 container_of(inode, struct spufs_inode_info, vfs_inode)
98
99extern struct tree_descr spufs_dir_contents[];
100
101/* system call implementation */
102long spufs_run_spu(struct file *file,
103 struct spu_context *ctx, u32 *npc, u32 *status);
104long spufs_create_thread(struct nameidata *nd,
105 unsigned int flags, mode_t mode);
106extern struct file_operations spufs_context_fops;
107
108/* context management */
109struct spu_context * alloc_spu_context(struct address_space *local_store);
110void destroy_spu_context(struct kref *kref);
111struct spu_context * get_spu_context(struct spu_context *ctx);
112int put_spu_context(struct spu_context *ctx);
113void spu_unmap_mappings(struct spu_context *ctx);
114
115void spu_forget(struct spu_context *ctx);
116void spu_acquire(struct spu_context *ctx);
117void spu_release(struct spu_context *ctx);
118int spu_acquire_runnable(struct spu_context *ctx);
119void spu_acquire_saved(struct spu_context *ctx);
120
121int spu_activate(struct spu_context *ctx, u64 flags);
122void spu_deactivate(struct spu_context *ctx);
123void spu_yield(struct spu_context *ctx);
124int __init spu_sched_init(void);
125void __exit spu_sched_exit(void);
126
127/*
128 * spufs_wait
129 * Same as wait_event_interruptible(), except that here
130 * we need to call spu_release(ctx) before sleeping, and
131 * then spu_acquire(ctx) when awoken.
132 */
133
134#define spufs_wait(wq, condition) \
135({ \
136 int __ret = 0; \
137 DEFINE_WAIT(__wait); \
138 for (;;) { \
139 prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE); \
140 if (condition) \
141 break; \
142 if (!signal_pending(current)) { \
143 spu_release(ctx); \
144 schedule(); \
145 spu_acquire(ctx); \
146 continue; \
147 } \
148 __ret = -ERESTARTSYS; \
149 break; \
150 } \
151 finish_wait(&(wq), &__wait); \
152 __ret; \
153})
154
155size_t spu_wbox_write(struct spu_context *ctx, u32 data);
156size_t spu_ibox_read(struct spu_context *ctx, u32 *data);
157
158/* irq callback funcs. */
159void spufs_ibox_callback(struct spu *spu);
160void spufs_wbox_callback(struct spu *spu);
161void spufs_stop_callback(struct spu *spu);
162
163#endif
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
new file mode 100644
index 000000000000..212db28531fa
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -0,0 +1,2204 @@
1/*
2 * spu_switch.c
3 *
4 * (C) Copyright IBM Corp. 2005
5 *
6 * Author: Mark Nutter <mnutter@us.ibm.com>
7 *
8 * Host-side part of SPU context switch sequence outlined in
9 * Synergistic Processor Element, Book IV.
10 *
11 * A fully premptive switch of an SPE is very expensive in terms
12 * of time and system resources. SPE Book IV indicates that SPE
13 * allocation should follow a "serially reusable device" model,
14 * in which the SPE is assigned a task until it completes. When
15 * this is not possible, this sequence may be used to premptively
16 * save, and then later (optionally) restore the context of a
17 * program executing on an SPE.
18 *
19 *
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2, or (at your option)
23 * any later version.
24 *
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
29 *
30 * You should have received a copy of the GNU General Public License
31 * along with this program; if not, write to the Free Software
32 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
33 */
34
35#include <linux/config.h>
36#include <linux/module.h>
37#include <linux/errno.h>
38#include <linux/sched.h>
39#include <linux/kernel.h>
40#include <linux/mm.h>
41#include <linux/vmalloc.h>
42#include <linux/smp.h>
43#include <linux/smp_lock.h>
44#include <linux/stddef.h>
45#include <linux/unistd.h>
46
47#include <asm/io.h>
48#include <asm/spu.h>
49#include <asm/spu_csa.h>
50#include <asm/mmu_context.h>
51
52#include "spu_save_dump.h"
53#include "spu_restore_dump.h"
54
55#if 0
56#define POLL_WHILE_TRUE(_c) { \
57 do { \
58 } while (_c); \
59 }
60#else
61#define RELAX_SPIN_COUNT 1000
62#define POLL_WHILE_TRUE(_c) { \
63 do { \
64 int _i; \
65 for (_i=0; _i<RELAX_SPIN_COUNT && (_c); _i++) { \
66 cpu_relax(); \
67 } \
68 if (unlikely(_c)) yield(); \
69 else break; \
70 } while (_c); \
71 }
72#endif /* debug */
73
74#define POLL_WHILE_FALSE(_c) POLL_WHILE_TRUE(!(_c))
75
76static inline void acquire_spu_lock(struct spu *spu)
77{
78 /* Save, Step 1:
79 * Restore, Step 1:
80 * Acquire SPU-specific mutual exclusion lock.
81 * TBD.
82 */
83}
84
85static inline void release_spu_lock(struct spu *spu)
86{
87 /* Restore, Step 76:
88 * Release SPU-specific mutual exclusion lock.
89 * TBD.
90 */
91}
92
93static inline int check_spu_isolate(struct spu_state *csa, struct spu *spu)
94{
95 struct spu_problem __iomem *prob = spu->problem;
96 u32 isolate_state;
97
98 /* Save, Step 2:
99 * Save, Step 6:
100 * If SPU_Status[E,L,IS] any field is '1', this
101 * SPU is in isolate state and cannot be context
102 * saved at this time.
103 */
104 isolate_state = SPU_STATUS_ISOLATED_STATE |
105 SPU_STATUS_ISOLATED_LOAD_STAUTUS | SPU_STATUS_ISOLATED_EXIT_STAUTUS;
106 return (in_be32(&prob->spu_status_R) & isolate_state) ? 1 : 0;
107}
108
109static inline void disable_interrupts(struct spu_state *csa, struct spu *spu)
110{
111 /* Save, Step 3:
112 * Restore, Step 2:
113 * Save INT_Mask_class0 in CSA.
114 * Write INT_MASK_class0 with value of 0.
115 * Save INT_Mask_class1 in CSA.
116 * Write INT_MASK_class1 with value of 0.
117 * Save INT_Mask_class2 in CSA.
118 * Write INT_MASK_class2 with value of 0.
119 */
120 spin_lock_irq(&spu->register_lock);
121 if (csa) {
122 csa->priv1.int_mask_class0_RW = spu_int_mask_get(spu, 0);
123 csa->priv1.int_mask_class1_RW = spu_int_mask_get(spu, 1);
124 csa->priv1.int_mask_class2_RW = spu_int_mask_get(spu, 2);
125 }
126 spu_int_mask_set(spu, 0, 0ul);
127 spu_int_mask_set(spu, 1, 0ul);
128 spu_int_mask_set(spu, 2, 0ul);
129 eieio();
130 spin_unlock_irq(&spu->register_lock);
131}
132
133static inline void set_watchdog_timer(struct spu_state *csa, struct spu *spu)
134{
135 /* Save, Step 4:
136 * Restore, Step 25.
137 * Set a software watchdog timer, which specifies the
138 * maximum allowable time for a context save sequence.
139 *
140 * For present, this implementation will not set a global
141 * watchdog timer, as virtualization & variable system load
142 * may cause unpredictable execution times.
143 */
144}
145
146static inline void inhibit_user_access(struct spu_state *csa, struct spu *spu)
147{
148 /* Save, Step 5:
149 * Restore, Step 3:
150 * Inhibit user-space access (if provided) to this
151 * SPU by unmapping the virtual pages assigned to
152 * the SPU memory-mapped I/O (MMIO) for problem
153 * state. TBD.
154 */
155}
156
157static inline void set_switch_pending(struct spu_state *csa, struct spu *spu)
158{
159 /* Save, Step 7:
160 * Restore, Step 5:
161 * Set a software context switch pending flag.
162 */
163 set_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags);
164 mb();
165}
166
167static inline void save_mfc_cntl(struct spu_state *csa, struct spu *spu)
168{
169 struct spu_priv2 __iomem *priv2 = spu->priv2;
170
171 /* Save, Step 8:
172 * Suspend DMA and save MFC_CNTL.
173 */
174 switch (in_be64(&priv2->mfc_control_RW) &
175 MFC_CNTL_SUSPEND_DMA_STATUS_MASK) {
176 case MFC_CNTL_SUSPEND_IN_PROGRESS:
177 POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) &
178 MFC_CNTL_SUSPEND_DMA_STATUS_MASK) ==
179 MFC_CNTL_SUSPEND_COMPLETE);
180 /* fall through */
181 case MFC_CNTL_SUSPEND_COMPLETE:
182 if (csa) {
183 csa->priv2.mfc_control_RW =
184 in_be64(&priv2->mfc_control_RW) |
185 MFC_CNTL_SUSPEND_DMA_QUEUE;
186 }
187 break;
188 case MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION:
189 out_be64(&priv2->mfc_control_RW, MFC_CNTL_SUSPEND_DMA_QUEUE);
190 POLL_WHILE_FALSE((in_be64(&priv2->mfc_control_RW) &
191 MFC_CNTL_SUSPEND_DMA_STATUS_MASK) ==
192 MFC_CNTL_SUSPEND_COMPLETE);
193 if (csa) {
194 csa->priv2.mfc_control_RW =
195 in_be64(&priv2->mfc_control_RW) &
196 ~MFC_CNTL_SUSPEND_DMA_QUEUE;
197 }
198 break;
199 }
200}
201
202static inline void save_spu_runcntl(struct spu_state *csa, struct spu *spu)
203{
204 struct spu_problem __iomem *prob = spu->problem;
205
206 /* Save, Step 9:
207 * Save SPU_Runcntl in the CSA. This value contains
208 * the "Application Desired State".
209 */
210 csa->prob.spu_runcntl_RW = in_be32(&prob->spu_runcntl_RW);
211}
212
213static inline void save_mfc_sr1(struct spu_state *csa, struct spu *spu)
214{
215 /* Save, Step 10:
216 * Save MFC_SR1 in the CSA.
217 */
218 csa->priv1.mfc_sr1_RW = spu_mfc_sr1_get(spu);
219}
220
221static inline void save_spu_status(struct spu_state *csa, struct spu *spu)
222{
223 struct spu_problem __iomem *prob = spu->problem;
224
225 /* Save, Step 11:
226 * Read SPU_Status[R], and save to CSA.
227 */
228 if ((in_be32(&prob->spu_status_R) & SPU_STATUS_RUNNING) == 0) {
229 csa->prob.spu_status_R = in_be32(&prob->spu_status_R);
230 } else {
231 u32 stopped;
232
233 out_be32(&prob->spu_runcntl_RW, SPU_RUNCNTL_STOP);
234 eieio();
235 POLL_WHILE_TRUE(in_be32(&prob->spu_status_R) &
236 SPU_STATUS_RUNNING);
237 stopped =
238 SPU_STATUS_INVALID_INSTR | SPU_STATUS_SINGLE_STEP |
239 SPU_STATUS_STOPPED_BY_HALT | SPU_STATUS_STOPPED_BY_STOP;
240 if ((in_be32(&prob->spu_status_R) & stopped) == 0)
241 csa->prob.spu_status_R = SPU_STATUS_RUNNING;
242 else
243 csa->prob.spu_status_R = in_be32(&prob->spu_status_R);
244 }
245}
246
247static inline void save_mfc_decr(struct spu_state *csa, struct spu *spu)
248{
249 struct spu_priv2 __iomem *priv2 = spu->priv2;
250
251 /* Save, Step 12:
252 * Read MFC_CNTL[Ds]. Update saved copy of
253 * CSA.MFC_CNTL[Ds].
254 */
255 if (in_be64(&priv2->mfc_control_RW) & MFC_CNTL_DECREMENTER_RUNNING) {
256 csa->priv2.mfc_control_RW |= MFC_CNTL_DECREMENTER_RUNNING;
257 csa->suspend_time = get_cycles();
258 out_be64(&priv2->spu_chnlcntptr_RW, 7ULL);
259 eieio();
260 csa->spu_chnldata_RW[7] = in_be64(&priv2->spu_chnldata_RW);
261 eieio();
262 } else {
263 csa->priv2.mfc_control_RW &= ~MFC_CNTL_DECREMENTER_RUNNING;
264 }
265}
266
267static inline void halt_mfc_decr(struct spu_state *csa, struct spu *spu)
268{
269 struct spu_priv2 __iomem *priv2 = spu->priv2;
270
271 /* Save, Step 13:
272 * Write MFC_CNTL[Dh] set to a '1' to halt
273 * the decrementer.
274 */
275 out_be64(&priv2->mfc_control_RW, MFC_CNTL_DECREMENTER_HALTED);
276 eieio();
277}
278
279static inline void save_timebase(struct spu_state *csa, struct spu *spu)
280{
281 /* Save, Step 14:
282 * Read PPE Timebase High and Timebase low registers
283 * and save in CSA. TBD.
284 */
285 csa->suspend_time = get_cycles();
286}
287
288static inline void remove_other_spu_access(struct spu_state *csa,
289 struct spu *spu)
290{
291 /* Save, Step 15:
292 * Remove other SPU access to this SPU by unmapping
293 * this SPU's pages from their address space. TBD.
294 */
295}
296
297static inline void do_mfc_mssync(struct spu_state *csa, struct spu *spu)
298{
299 struct spu_problem __iomem *prob = spu->problem;
300
301 /* Save, Step 16:
302 * Restore, Step 11.
303 * Write SPU_MSSync register. Poll SPU_MSSync[P]
304 * for a value of 0.
305 */
306 out_be64(&prob->spc_mssync_RW, 1UL);
307 POLL_WHILE_TRUE(in_be64(&prob->spc_mssync_RW) & MS_SYNC_PENDING);
308}
309
310static inline void issue_mfc_tlbie(struct spu_state *csa, struct spu *spu)
311{
312 /* Save, Step 17:
313 * Restore, Step 12.
314 * Restore, Step 48.
315 * Write TLB_Invalidate_Entry[IS,VPN,L,Lp]=0 register.
316 * Then issue a PPE sync instruction.
317 */
318 spu_tlb_invalidate(spu);
319 mb();
320}
321
322static inline void handle_pending_interrupts(struct spu_state *csa,
323 struct spu *spu)
324{
325 /* Save, Step 18:
326 * Handle any pending interrupts from this SPU
327 * here. This is OS or hypervisor specific. One
328 * option is to re-enable interrupts to handle any
329 * pending interrupts, with the interrupt handlers
330 * recognizing the software Context Switch Pending
331 * flag, to ensure the SPU execution or MFC command
332 * queue is not restarted. TBD.
333 */
334}
335
336static inline void save_mfc_queues(struct spu_state *csa, struct spu *spu)
337{
338 struct spu_priv2 __iomem *priv2 = spu->priv2;
339 int i;
340
341 /* Save, Step 19:
342 * If MFC_Cntl[Se]=0 then save
343 * MFC command queues.
344 */
345 if ((in_be64(&priv2->mfc_control_RW) & MFC_CNTL_DMA_QUEUES_EMPTY) == 0) {
346 for (i = 0; i < 8; i++) {
347 csa->priv2.puq[i].mfc_cq_data0_RW =
348 in_be64(&priv2->puq[i].mfc_cq_data0_RW);
349 csa->priv2.puq[i].mfc_cq_data1_RW =
350 in_be64(&priv2->puq[i].mfc_cq_data1_RW);
351 csa->priv2.puq[i].mfc_cq_data2_RW =
352 in_be64(&priv2->puq[i].mfc_cq_data2_RW);
353 csa->priv2.puq[i].mfc_cq_data3_RW =
354 in_be64(&priv2->puq[i].mfc_cq_data3_RW);
355 }
356 for (i = 0; i < 16; i++) {
357 csa->priv2.spuq[i].mfc_cq_data0_RW =
358 in_be64(&priv2->spuq[i].mfc_cq_data0_RW);
359 csa->priv2.spuq[i].mfc_cq_data1_RW =
360 in_be64(&priv2->spuq[i].mfc_cq_data1_RW);
361 csa->priv2.spuq[i].mfc_cq_data2_RW =
362 in_be64(&priv2->spuq[i].mfc_cq_data2_RW);
363 csa->priv2.spuq[i].mfc_cq_data3_RW =
364 in_be64(&priv2->spuq[i].mfc_cq_data3_RW);
365 }
366 }
367}
368
369static inline void save_ppu_querymask(struct spu_state *csa, struct spu *spu)
370{
371 struct spu_problem __iomem *prob = spu->problem;
372
373 /* Save, Step 20:
374 * Save the PPU_QueryMask register
375 * in the CSA.
376 */
377 csa->prob.dma_querymask_RW = in_be32(&prob->dma_querymask_RW);
378}
379
380static inline void save_ppu_querytype(struct spu_state *csa, struct spu *spu)
381{
382 struct spu_problem __iomem *prob = spu->problem;
383
384 /* Save, Step 21:
385 * Save the PPU_QueryType register
386 * in the CSA.
387 */
388 csa->prob.dma_querytype_RW = in_be32(&prob->dma_querytype_RW);
389}
390
391static inline void save_mfc_csr_tsq(struct spu_state *csa, struct spu *spu)
392{
393 struct spu_priv2 __iomem *priv2 = spu->priv2;
394
395 /* Save, Step 22:
396 * Save the MFC_CSR_TSQ register
397 * in the LSCSA.
398 */
399 csa->priv2.spu_tag_status_query_RW =
400 in_be64(&priv2->spu_tag_status_query_RW);
401}
402
403static inline void save_mfc_csr_cmd(struct spu_state *csa, struct spu *spu)
404{
405 struct spu_priv2 __iomem *priv2 = spu->priv2;
406
407 /* Save, Step 23:
408 * Save the MFC_CSR_CMD1 and MFC_CSR_CMD2
409 * registers in the CSA.
410 */
411 csa->priv2.spu_cmd_buf1_RW = in_be64(&priv2->spu_cmd_buf1_RW);
412 csa->priv2.spu_cmd_buf2_RW = in_be64(&priv2->spu_cmd_buf2_RW);
413}
414
415static inline void save_mfc_csr_ato(struct spu_state *csa, struct spu *spu)
416{
417 struct spu_priv2 __iomem *priv2 = spu->priv2;
418
419 /* Save, Step 24:
420 * Save the MFC_CSR_ATO register in
421 * the CSA.
422 */
423 csa->priv2.spu_atomic_status_RW = in_be64(&priv2->spu_atomic_status_RW);
424}
425
426static inline void save_mfc_tclass_id(struct spu_state *csa, struct spu *spu)
427{
428 /* Save, Step 25:
429 * Save the MFC_TCLASS_ID register in
430 * the CSA.
431 */
432 csa->priv1.mfc_tclass_id_RW = spu_mfc_tclass_id_get(spu);
433}
434
435static inline void set_mfc_tclass_id(struct spu_state *csa, struct spu *spu)
436{
437 /* Save, Step 26:
438 * Restore, Step 23.
439 * Write the MFC_TCLASS_ID register with
440 * the value 0x10000000.
441 */
442 spu_mfc_tclass_id_set(spu, 0x10000000);
443 eieio();
444}
445
446static inline void purge_mfc_queue(struct spu_state *csa, struct spu *spu)
447{
448 struct spu_priv2 __iomem *priv2 = spu->priv2;
449
450 /* Save, Step 27:
451 * Restore, Step 14.
452 * Write MFC_CNTL[Pc]=1 (purge queue).
453 */
454 out_be64(&priv2->mfc_control_RW, MFC_CNTL_PURGE_DMA_REQUEST);
455 eieio();
456}
457
458static inline void wait_purge_complete(struct spu_state *csa, struct spu *spu)
459{
460 struct spu_priv2 __iomem *priv2 = spu->priv2;
461
462 /* Save, Step 28:
463 * Poll MFC_CNTL[Ps] until value '11' is read
464 * (purge complete).
465 */
466 POLL_WHILE_FALSE(in_be64(&priv2->mfc_control_RW) &
467 MFC_CNTL_PURGE_DMA_COMPLETE);
468}
469
470static inline void save_mfc_slbs(struct spu_state *csa, struct spu *spu)
471{
472 struct spu_priv2 __iomem *priv2 = spu->priv2;
473 int i;
474
475 /* Save, Step 29:
476 * If MFC_SR1[R]='1', save SLBs in CSA.
477 */
478 if (spu_mfc_sr1_get(spu) & MFC_STATE1_RELOCATE_MASK) {
479 csa->priv2.slb_index_W = in_be64(&priv2->slb_index_W);
480 for (i = 0; i < 8; i++) {
481 out_be64(&priv2->slb_index_W, i);
482 eieio();
483 csa->slb_esid_RW[i] = in_be64(&priv2->slb_esid_RW);
484 csa->slb_vsid_RW[i] = in_be64(&priv2->slb_vsid_RW);
485 eieio();
486 }
487 }
488}
489
490static inline void setup_mfc_sr1(struct spu_state *csa, struct spu *spu)
491{
492 /* Save, Step 30:
493 * Restore, Step 18:
494 * Write MFC_SR1 with MFC_SR1[D=0,S=1] and
495 * MFC_SR1[TL,R,Pr,T] set correctly for the
496 * OS specific environment.
497 *
498 * Implementation note: The SPU-side code
499 * for save/restore is privileged, so the
500 * MFC_SR1[Pr] bit is not set.
501 *
502 */
503 spu_mfc_sr1_set(spu, (MFC_STATE1_MASTER_RUN_CONTROL_MASK |
504 MFC_STATE1_RELOCATE_MASK |
505 MFC_STATE1_BUS_TLBIE_MASK));
506}
507
508static inline void save_spu_npc(struct spu_state *csa, struct spu *spu)
509{
510 struct spu_problem __iomem *prob = spu->problem;
511
512 /* Save, Step 31:
513 * Save SPU_NPC in the CSA.
514 */
515 csa->prob.spu_npc_RW = in_be32(&prob->spu_npc_RW);
516}
517
518static inline void save_spu_privcntl(struct spu_state *csa, struct spu *spu)
519{
520 struct spu_priv2 __iomem *priv2 = spu->priv2;
521
522 /* Save, Step 32:
523 * Save SPU_PrivCntl in the CSA.
524 */
525 csa->priv2.spu_privcntl_RW = in_be64(&priv2->spu_privcntl_RW);
526}
527
528static inline void reset_spu_privcntl(struct spu_state *csa, struct spu *spu)
529{
530 struct spu_priv2 __iomem *priv2 = spu->priv2;
531
532 /* Save, Step 33:
533 * Restore, Step 16:
534 * Write SPU_PrivCntl[S,Le,A] fields reset to 0.
535 */
536 out_be64(&priv2->spu_privcntl_RW, 0UL);
537 eieio();
538}
539
540static inline void save_spu_lslr(struct spu_state *csa, struct spu *spu)
541{
542 struct spu_priv2 __iomem *priv2 = spu->priv2;
543
544 /* Save, Step 34:
545 * Save SPU_LSLR in the CSA.
546 */
547 csa->priv2.spu_lslr_RW = in_be64(&priv2->spu_lslr_RW);
548}
549
550static inline void reset_spu_lslr(struct spu_state *csa, struct spu *spu)
551{
552 struct spu_priv2 __iomem *priv2 = spu->priv2;
553
554 /* Save, Step 35:
555 * Restore, Step 17.
556 * Reset SPU_LSLR.
557 */
558 out_be64(&priv2->spu_lslr_RW, LS_ADDR_MASK);
559 eieio();
560}
561
562static inline void save_spu_cfg(struct spu_state *csa, struct spu *spu)
563{
564 struct spu_priv2 __iomem *priv2 = spu->priv2;
565
566 /* Save, Step 36:
567 * Save SPU_Cfg in the CSA.
568 */
569 csa->priv2.spu_cfg_RW = in_be64(&priv2->spu_cfg_RW);
570}
571
572static inline void save_pm_trace(struct spu_state *csa, struct spu *spu)
573{
574 /* Save, Step 37:
575 * Save PM_Trace_Tag_Wait_Mask in the CSA.
576 * Not performed by this implementation.
577 */
578}
579
580static inline void save_mfc_rag(struct spu_state *csa, struct spu *spu)
581{
582 /* Save, Step 38:
583 * Save RA_GROUP_ID register and the
584 * RA_ENABLE reigster in the CSA.
585 */
586 csa->priv1.resource_allocation_groupID_RW =
587 spu_resource_allocation_groupID_get(spu);
588 csa->priv1.resource_allocation_enable_RW =
589 spu_resource_allocation_enable_get(spu);
590}
591
592static inline void save_ppu_mb_stat(struct spu_state *csa, struct spu *spu)
593{
594 struct spu_problem __iomem *prob = spu->problem;
595
596 /* Save, Step 39:
597 * Save MB_Stat register in the CSA.
598 */
599 csa->prob.mb_stat_R = in_be32(&prob->mb_stat_R);
600}
601
602static inline void save_ppu_mb(struct spu_state *csa, struct spu *spu)
603{
604 struct spu_problem __iomem *prob = spu->problem;
605
606 /* Save, Step 40:
607 * Save the PPU_MB register in the CSA.
608 */
609 csa->prob.pu_mb_R = in_be32(&prob->pu_mb_R);
610}
611
612static inline void save_ppuint_mb(struct spu_state *csa, struct spu *spu)
613{
614 struct spu_priv2 __iomem *priv2 = spu->priv2;
615
616 /* Save, Step 41:
617 * Save the PPUINT_MB register in the CSA.
618 */
619 csa->priv2.puint_mb_R = in_be64(&priv2->puint_mb_R);
620}
621
622static inline void save_ch_part1(struct spu_state *csa, struct spu *spu)
623{
624 struct spu_priv2 __iomem *priv2 = spu->priv2;
625 u64 idx, ch_indices[7] = { 0UL, 1UL, 3UL, 4UL, 24UL, 25UL, 27UL };
626 int i;
627
628 /* Save, Step 42:
629 * Save the following CH: [0,1,3,4,24,25,27]
630 */
631 for (i = 0; i < 7; i++) {
632 idx = ch_indices[i];
633 out_be64(&priv2->spu_chnlcntptr_RW, idx);
634 eieio();
635 csa->spu_chnldata_RW[idx] = in_be64(&priv2->spu_chnldata_RW);
636 csa->spu_chnlcnt_RW[idx] = in_be64(&priv2->spu_chnlcnt_RW);
637 out_be64(&priv2->spu_chnldata_RW, 0UL);
638 out_be64(&priv2->spu_chnlcnt_RW, 0UL);
639 eieio();
640 }
641}
642
643static inline void save_spu_mb(struct spu_state *csa, struct spu *spu)
644{
645 struct spu_priv2 __iomem *priv2 = spu->priv2;
646 int i;
647
648 /* Save, Step 43:
649 * Save SPU Read Mailbox Channel.
650 */
651 out_be64(&priv2->spu_chnlcntptr_RW, 29UL);
652 eieio();
653 csa->spu_chnlcnt_RW[29] = in_be64(&priv2->spu_chnlcnt_RW);
654 for (i = 0; i < 4; i++) {
655 csa->spu_mailbox_data[i] = in_be64(&priv2->spu_chnldata_RW);
656 }
657 out_be64(&priv2->spu_chnlcnt_RW, 0UL);
658 eieio();
659}
660
661static inline void save_mfc_cmd(struct spu_state *csa, struct spu *spu)
662{
663 struct spu_priv2 __iomem *priv2 = spu->priv2;
664
665 /* Save, Step 44:
666 * Save MFC_CMD Channel.
667 */
668 out_be64(&priv2->spu_chnlcntptr_RW, 21UL);
669 eieio();
670 csa->spu_chnlcnt_RW[21] = in_be64(&priv2->spu_chnlcnt_RW);
671 eieio();
672}
673
674static inline void reset_ch(struct spu_state *csa, struct spu *spu)
675{
676 struct spu_priv2 __iomem *priv2 = spu->priv2;
677 u64 ch_indices[4] = { 21UL, 23UL, 28UL, 30UL };
678 u64 ch_counts[4] = { 16UL, 1UL, 1UL, 1UL };
679 u64 idx;
680 int i;
681
682 /* Save, Step 45:
683 * Reset the following CH: [21, 23, 28, 30]
684 */
685 for (i = 0; i < 4; i++) {
686 idx = ch_indices[i];
687 out_be64(&priv2->spu_chnlcntptr_RW, idx);
688 eieio();
689 out_be64(&priv2->spu_chnlcnt_RW, ch_counts[i]);
690 eieio();
691 }
692}
693
694static inline void resume_mfc_queue(struct spu_state *csa, struct spu *spu)
695{
696 struct spu_priv2 __iomem *priv2 = spu->priv2;
697
698 /* Save, Step 46:
699 * Restore, Step 25.
700 * Write MFC_CNTL[Sc]=0 (resume queue processing).
701 */
702 out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESUME_DMA_QUEUE);
703}
704
705static inline void invalidate_slbs(struct spu_state *csa, struct spu *spu)
706{
707 struct spu_priv2 __iomem *priv2 = spu->priv2;
708
709 /* Save, Step 45:
710 * Restore, Step 19:
711 * If MFC_SR1[R]=1, write 0 to SLB_Invalidate_All.
712 */
713 if (spu_mfc_sr1_get(spu) & MFC_STATE1_RELOCATE_MASK) {
714 out_be64(&priv2->slb_invalidate_all_W, 0UL);
715 eieio();
716 }
717}
718
719static inline void get_kernel_slb(u64 ea, u64 slb[2])
720{
721 slb[0] = (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
722 slb[1] = (ea & ESID_MASK) | SLB_ESID_V;
723
724 /* Large pages are used for kernel text/data, but not vmalloc. */
725 if (cpu_has_feature(CPU_FTR_16M_PAGE)
726 && REGION_ID(ea) == KERNEL_REGION_ID)
727 slb[0] |= SLB_VSID_L;
728}
729
730static inline void load_mfc_slb(struct spu *spu, u64 slb[2], int slbe)
731{
732 struct spu_priv2 __iomem *priv2 = spu->priv2;
733
734 out_be64(&priv2->slb_index_W, slbe);
735 eieio();
736 out_be64(&priv2->slb_vsid_RW, slb[0]);
737 out_be64(&priv2->slb_esid_RW, slb[1]);
738 eieio();
739}
740
741static inline void setup_mfc_slbs(struct spu_state *csa, struct spu *spu)
742{
743 u64 code_slb[2];
744 u64 lscsa_slb[2];
745
746 /* Save, Step 47:
747 * Restore, Step 30.
748 * If MFC_SR1[R]=1, write 0 to SLB_Invalidate_All
749 * register, then initialize SLB_VSID and SLB_ESID
750 * to provide access to SPU context save code and
751 * LSCSA.
752 *
753 * This implementation places both the context
754 * switch code and LSCSA in kernel address space.
755 *
756 * Further this implementation assumes that the
757 * MFC_SR1[R]=1 (in other words, assume that
758 * translation is desired by OS environment).
759 */
760 invalidate_slbs(csa, spu);
761 get_kernel_slb((unsigned long)&spu_save_code[0], code_slb);
762 get_kernel_slb((unsigned long)csa->lscsa, lscsa_slb);
763 load_mfc_slb(spu, code_slb, 0);
764 if ((lscsa_slb[0] != code_slb[0]) || (lscsa_slb[1] != code_slb[1]))
765 load_mfc_slb(spu, lscsa_slb, 1);
766}
767
768static inline void set_switch_active(struct spu_state *csa, struct spu *spu)
769{
770 /* Save, Step 48:
771 * Restore, Step 23.
772 * Change the software context switch pending flag
773 * to context switch active.
774 */
775 set_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags);
776 clear_bit(SPU_CONTEXT_SWITCH_PENDING, &spu->flags);
777 mb();
778}
779
780static inline void enable_interrupts(struct spu_state *csa, struct spu *spu)
781{
782 unsigned long class1_mask = CLASS1_ENABLE_SEGMENT_FAULT_INTR |
783 CLASS1_ENABLE_STORAGE_FAULT_INTR;
784
785 /* Save, Step 49:
786 * Restore, Step 22:
787 * Reset and then enable interrupts, as
788 * needed by OS.
789 *
790 * This implementation enables only class1
791 * (translation) interrupts.
792 */
793 spin_lock_irq(&spu->register_lock);
794 spu_int_stat_clear(spu, 0, ~0ul);
795 spu_int_stat_clear(spu, 1, ~0ul);
796 spu_int_stat_clear(spu, 2, ~0ul);
797 spu_int_mask_set(spu, 0, 0ul);
798 spu_int_mask_set(spu, 1, class1_mask);
799 spu_int_mask_set(spu, 2, 0ul);
800 spin_unlock_irq(&spu->register_lock);
801}
802
803static inline int send_mfc_dma(struct spu *spu, unsigned long ea,
804 unsigned int ls_offset, unsigned int size,
805 unsigned int tag, unsigned int rclass,
806 unsigned int cmd)
807{
808 struct spu_problem __iomem *prob = spu->problem;
809 union mfc_tag_size_class_cmd command;
810 unsigned int transfer_size;
811 volatile unsigned int status = 0x0;
812
813 while (size > 0) {
814 transfer_size =
815 (size > MFC_MAX_DMA_SIZE) ? MFC_MAX_DMA_SIZE : size;
816 command.u.mfc_size = transfer_size;
817 command.u.mfc_tag = tag;
818 command.u.mfc_rclassid = rclass;
819 command.u.mfc_cmd = cmd;
820 do {
821 out_be32(&prob->mfc_lsa_W, ls_offset);
822 out_be64(&prob->mfc_ea_W, ea);
823 out_be64(&prob->mfc_union_W.all64, command.all64);
824 status =
825 in_be32(&prob->mfc_union_W.by32.mfc_class_cmd32);
826 if (unlikely(status & 0x2)) {
827 cpu_relax();
828 }
829 } while (status & 0x3);
830 size -= transfer_size;
831 ea += transfer_size;
832 ls_offset += transfer_size;
833 }
834 return 0;
835}
836
837static inline void save_ls_16kb(struct spu_state *csa, struct spu *spu)
838{
839 unsigned long addr = (unsigned long)&csa->lscsa->ls[0];
840 unsigned int ls_offset = 0x0;
841 unsigned int size = 16384;
842 unsigned int tag = 0;
843 unsigned int rclass = 0;
844 unsigned int cmd = MFC_PUT_CMD;
845
846 /* Save, Step 50:
847 * Issue a DMA command to copy the first 16K bytes
848 * of local storage to the CSA.
849 */
850 send_mfc_dma(spu, addr, ls_offset, size, tag, rclass, cmd);
851}
852
853static inline void set_spu_npc(struct spu_state *csa, struct spu *spu)
854{
855 struct spu_problem __iomem *prob = spu->problem;
856
857 /* Save, Step 51:
858 * Restore, Step 31.
859 * Write SPU_NPC[IE]=0 and SPU_NPC[LSA] to entry
860 * point address of context save code in local
861 * storage.
862 *
863 * This implementation uses SPU-side save/restore
864 * programs with entry points at LSA of 0.
865 */
866 out_be32(&prob->spu_npc_RW, 0);
867 eieio();
868}
869
870static inline void set_signot1(struct spu_state *csa, struct spu *spu)
871{
872 struct spu_problem __iomem *prob = spu->problem;
873 union {
874 u64 ull;
875 u32 ui[2];
876 } addr64;
877
878 /* Save, Step 52:
879 * Restore, Step 32:
880 * Write SPU_Sig_Notify_1 register with upper 32-bits
881 * of the CSA.LSCSA effective address.
882 */
883 addr64.ull = (u64) csa->lscsa;
884 out_be32(&prob->signal_notify1, addr64.ui[0]);
885 eieio();
886}
887
888static inline void set_signot2(struct spu_state *csa, struct spu *spu)
889{
890 struct spu_problem __iomem *prob = spu->problem;
891 union {
892 u64 ull;
893 u32 ui[2];
894 } addr64;
895
896 /* Save, Step 53:
897 * Restore, Step 33:
898 * Write SPU_Sig_Notify_2 register with lower 32-bits
899 * of the CSA.LSCSA effective address.
900 */
901 addr64.ull = (u64) csa->lscsa;
902 out_be32(&prob->signal_notify2, addr64.ui[1]);
903 eieio();
904}
905
906static inline void send_save_code(struct spu_state *csa, struct spu *spu)
907{
908 unsigned long addr = (unsigned long)&spu_save_code[0];
909 unsigned int ls_offset = 0x0;
910 unsigned int size = sizeof(spu_save_code);
911 unsigned int tag = 0;
912 unsigned int rclass = 0;
913 unsigned int cmd = MFC_GETFS_CMD;
914
915 /* Save, Step 54:
916 * Issue a DMA command to copy context save code
917 * to local storage and start SPU.
918 */
919 send_mfc_dma(spu, addr, ls_offset, size, tag, rclass, cmd);
920}
921
922static inline void set_ppu_querymask(struct spu_state *csa, struct spu *spu)
923{
924 struct spu_problem __iomem *prob = spu->problem;
925
926 /* Save, Step 55:
927 * Restore, Step 38.
928 * Write PPU_QueryMask=1 (enable Tag Group 0)
929 * and issue eieio instruction.
930 */
931 out_be32(&prob->dma_querymask_RW, MFC_TAGID_TO_TAGMASK(0));
932 eieio();
933}
934
935static inline void wait_tag_complete(struct spu_state *csa, struct spu *spu)
936{
937 struct spu_problem __iomem *prob = spu->problem;
938 u32 mask = MFC_TAGID_TO_TAGMASK(0);
939 unsigned long flags;
940
941 /* Save, Step 56:
942 * Restore, Step 39.
943 * Restore, Step 39.
944 * Restore, Step 46.
945 * Poll PPU_TagStatus[gn] until 01 (Tag group 0 complete)
946 * or write PPU_QueryType[TS]=01 and wait for Tag Group
947 * Complete Interrupt. Write INT_Stat_Class0 or
948 * INT_Stat_Class2 with value of 'handled'.
949 */
950 POLL_WHILE_FALSE(in_be32(&prob->dma_tagstatus_R) & mask);
951
952 local_irq_save(flags);
953 spu_int_stat_clear(spu, 0, ~(0ul));
954 spu_int_stat_clear(spu, 2, ~(0ul));
955 local_irq_restore(flags);
956}
957
958static inline void wait_spu_stopped(struct spu_state *csa, struct spu *spu)
959{
960 struct spu_problem __iomem *prob = spu->problem;
961 unsigned long flags;
962
963 /* Save, Step 57:
964 * Restore, Step 40.
965 * Poll until SPU_Status[R]=0 or wait for SPU Class 0
966 * or SPU Class 2 interrupt. Write INT_Stat_class0
967 * or INT_Stat_class2 with value of handled.
968 */
969 POLL_WHILE_TRUE(in_be32(&prob->spu_status_R) & SPU_STATUS_RUNNING);
970
971 local_irq_save(flags);
972 spu_int_stat_clear(spu, 0, ~(0ul));
973 spu_int_stat_clear(spu, 2, ~(0ul));
974 local_irq_restore(flags);
975}
976
977static inline int check_save_status(struct spu_state *csa, struct spu *spu)
978{
979 struct spu_problem __iomem *prob = spu->problem;
980 u32 complete;
981
982 /* Save, Step 54:
983 * If SPU_Status[P]=1 and SPU_Status[SC] = "success",
984 * context save succeeded, otherwise context save
985 * failed.
986 */
987 complete = ((SPU_SAVE_COMPLETE << SPU_STOP_STATUS_SHIFT) |
988 SPU_STATUS_STOPPED_BY_STOP);
989 return (in_be32(&prob->spu_status_R) != complete) ? 1 : 0;
990}
991
992static inline void terminate_spu_app(struct spu_state *csa, struct spu *spu)
993{
994 /* Restore, Step 4:
995 * If required, notify the "using application" that
996 * the SPU task has been terminated. TBD.
997 */
998}
999
1000static inline void suspend_mfc(struct spu_state *csa, struct spu *spu)
1001{
1002 struct spu_priv2 __iomem *priv2 = spu->priv2;
1003
1004 /* Restore, Step 7:
1005 * Restore, Step 47.
1006 * Write MFC_Cntl[Dh,Sc]='1','1' to suspend
1007 * the queue and halt the decrementer.
1008 */
1009 out_be64(&priv2->mfc_control_RW, MFC_CNTL_SUSPEND_DMA_QUEUE |
1010 MFC_CNTL_DECREMENTER_HALTED);
1011 eieio();
1012}
1013
1014static inline void wait_suspend_mfc_complete(struct spu_state *csa,
1015 struct spu *spu)
1016{
1017 struct spu_priv2 __iomem *priv2 = spu->priv2;
1018
1019 /* Restore, Step 8:
1020 * Restore, Step 47.
1021 * Poll MFC_CNTL[Ss] until 11 is returned.
1022 */
1023 POLL_WHILE_FALSE(in_be64(&priv2->mfc_control_RW) &
1024 MFC_CNTL_SUSPEND_COMPLETE);
1025}
1026
1027static inline int suspend_spe(struct spu_state *csa, struct spu *spu)
1028{
1029 struct spu_problem __iomem *prob = spu->problem;
1030
1031 /* Restore, Step 9:
1032 * If SPU_Status[R]=1, stop SPU execution
1033 * and wait for stop to complete.
1034 *
1035 * Returns 1 if SPU_Status[R]=1 on entry.
1036 * 0 otherwise
1037 */
1038 if (in_be32(&prob->spu_status_R) & SPU_STATUS_RUNNING) {
1039 if (in_be32(&prob->spu_status_R) &
1040 SPU_STATUS_ISOLATED_EXIT_STAUTUS) {
1041 POLL_WHILE_TRUE(in_be32(&prob->spu_status_R) &
1042 SPU_STATUS_RUNNING);
1043 }
1044 if ((in_be32(&prob->spu_status_R) &
1045 SPU_STATUS_ISOLATED_LOAD_STAUTUS)
1046 || (in_be32(&prob->spu_status_R) &
1047 SPU_STATUS_ISOLATED_STATE)) {
1048 out_be32(&prob->spu_runcntl_RW, SPU_RUNCNTL_STOP);
1049 eieio();
1050 POLL_WHILE_TRUE(in_be32(&prob->spu_status_R) &
1051 SPU_STATUS_RUNNING);
1052 out_be32(&prob->spu_runcntl_RW, 0x2);
1053 eieio();
1054 POLL_WHILE_TRUE(in_be32(&prob->spu_status_R) &
1055 SPU_STATUS_RUNNING);
1056 }
1057 if (in_be32(&prob->spu_status_R) &
1058 SPU_STATUS_WAITING_FOR_CHANNEL) {
1059 out_be32(&prob->spu_runcntl_RW, SPU_RUNCNTL_STOP);
1060 eieio();
1061 POLL_WHILE_TRUE(in_be32(&prob->spu_status_R) &
1062 SPU_STATUS_RUNNING);
1063 }
1064 return 1;
1065 }
1066 return 0;
1067}
1068
1069static inline void clear_spu_status(struct spu_state *csa, struct spu *spu)
1070{
1071 struct spu_problem __iomem *prob = spu->problem;
1072
1073 /* Restore, Step 10:
1074 * If SPU_Status[R]=0 and SPU_Status[E,L,IS]=1,
1075 * release SPU from isolate state.
1076 */
1077 if (!(in_be32(&prob->spu_status_R) & SPU_STATUS_RUNNING)) {
1078 if (in_be32(&prob->spu_status_R) &
1079 SPU_STATUS_ISOLATED_EXIT_STAUTUS) {
1080 spu_mfc_sr1_set(spu,
1081 MFC_STATE1_MASTER_RUN_CONTROL_MASK);
1082 eieio();
1083 out_be32(&prob->spu_runcntl_RW, SPU_RUNCNTL_RUNNABLE);
1084 eieio();
1085 POLL_WHILE_TRUE(in_be32(&prob->spu_status_R) &
1086 SPU_STATUS_RUNNING);
1087 }
1088 if ((in_be32(&prob->spu_status_R) &
1089 SPU_STATUS_ISOLATED_LOAD_STAUTUS)
1090 || (in_be32(&prob->spu_status_R) &
1091 SPU_STATUS_ISOLATED_STATE)) {
1092 spu_mfc_sr1_set(spu,
1093 MFC_STATE1_MASTER_RUN_CONTROL_MASK);
1094 eieio();
1095 out_be32(&prob->spu_runcntl_RW, 0x2);
1096 eieio();
1097 POLL_WHILE_TRUE(in_be32(&prob->spu_status_R) &
1098 SPU_STATUS_RUNNING);
1099 }
1100 }
1101}
1102
1103static inline void reset_ch_part1(struct spu_state *csa, struct spu *spu)
1104{
1105 struct spu_priv2 __iomem *priv2 = spu->priv2;
1106 u64 ch_indices[7] = { 0UL, 1UL, 3UL, 4UL, 24UL, 25UL, 27UL };
1107 u64 idx;
1108 int i;
1109
1110 /* Restore, Step 20:
1111 * Reset the following CH: [0,1,3,4,24,25,27]
1112 */
1113 for (i = 0; i < 7; i++) {
1114 idx = ch_indices[i];
1115 out_be64(&priv2->spu_chnlcntptr_RW, idx);
1116 eieio();
1117 out_be64(&priv2->spu_chnldata_RW, 0UL);
1118 out_be64(&priv2->spu_chnlcnt_RW, 0UL);
1119 eieio();
1120 }
1121}
1122
1123static inline void reset_ch_part2(struct spu_state *csa, struct spu *spu)
1124{
1125 struct spu_priv2 __iomem *priv2 = spu->priv2;
1126 u64 ch_indices[5] = { 21UL, 23UL, 28UL, 29UL, 30UL };
1127 u64 ch_counts[5] = { 16UL, 1UL, 1UL, 0UL, 1UL };
1128 u64 idx;
1129 int i;
1130
1131 /* Restore, Step 21:
1132 * Reset the following CH: [21, 23, 28, 29, 30]
1133 */
1134 for (i = 0; i < 5; i++) {
1135 idx = ch_indices[i];
1136 out_be64(&priv2->spu_chnlcntptr_RW, idx);
1137 eieio();
1138 out_be64(&priv2->spu_chnlcnt_RW, ch_counts[i]);
1139 eieio();
1140 }
1141}
1142
1143static inline void setup_spu_status_part1(struct spu_state *csa,
1144 struct spu *spu)
1145{
1146 u32 status_P = SPU_STATUS_STOPPED_BY_STOP;
1147 u32 status_I = SPU_STATUS_INVALID_INSTR;
1148 u32 status_H = SPU_STATUS_STOPPED_BY_HALT;
1149 u32 status_S = SPU_STATUS_SINGLE_STEP;
1150 u32 status_S_I = SPU_STATUS_SINGLE_STEP | SPU_STATUS_INVALID_INSTR;
1151 u32 status_S_P = SPU_STATUS_SINGLE_STEP | SPU_STATUS_STOPPED_BY_STOP;
1152 u32 status_P_H = SPU_STATUS_STOPPED_BY_HALT |SPU_STATUS_STOPPED_BY_STOP;
1153 u32 status_P_I = SPU_STATUS_STOPPED_BY_STOP |SPU_STATUS_INVALID_INSTR;
1154 u32 status_code;
1155
1156 /* Restore, Step 27:
1157 * If the CSA.SPU_Status[I,S,H,P]=1 then add the correct
1158 * instruction sequence to the end of the SPU based restore
1159 * code (after the "context restored" stop and signal) to
1160 * restore the correct SPU status.
1161 *
1162 * NOTE: Rather than modifying the SPU executable, we
1163 * instead add a new 'stopped_status' field to the
1164 * LSCSA. The SPU-side restore reads this field and
1165 * takes the appropriate action when exiting.
1166 */
1167
1168 status_code =
1169 (csa->prob.spu_status_R >> SPU_STOP_STATUS_SHIFT) & 0xFFFF;
1170 if ((csa->prob.spu_status_R & status_P_I) == status_P_I) {
1171
1172 /* SPU_Status[P,I]=1 - Illegal Instruction followed
1173 * by Stop and Signal instruction, followed by 'br -4'.
1174 *
1175 */
1176 csa->lscsa->stopped_status.slot[0] = SPU_STOPPED_STATUS_P_I;
1177 csa->lscsa->stopped_status.slot[1] = status_code;
1178
1179 } else if ((csa->prob.spu_status_R & status_P_H) == status_P_H) {
1180
1181 /* SPU_Status[P,H]=1 - Halt Conditional, followed
1182 * by Stop and Signal instruction, followed by
1183 * 'br -4'.
1184 */
1185 csa->lscsa->stopped_status.slot[0] = SPU_STOPPED_STATUS_P_H;
1186 csa->lscsa->stopped_status.slot[1] = status_code;
1187
1188 } else if ((csa->prob.spu_status_R & status_S_P) == status_S_P) {
1189
1190 /* SPU_Status[S,P]=1 - Stop and Signal instruction
1191 * followed by 'br -4'.
1192 */
1193 csa->lscsa->stopped_status.slot[0] = SPU_STOPPED_STATUS_S_P;
1194 csa->lscsa->stopped_status.slot[1] = status_code;
1195
1196 } else if ((csa->prob.spu_status_R & status_S_I) == status_S_I) {
1197
1198 /* SPU_Status[S,I]=1 - Illegal instruction followed
1199 * by 'br -4'.
1200 */
1201 csa->lscsa->stopped_status.slot[0] = SPU_STOPPED_STATUS_S_I;
1202 csa->lscsa->stopped_status.slot[1] = status_code;
1203
1204 } else if ((csa->prob.spu_status_R & status_P) == status_P) {
1205
1206 /* SPU_Status[P]=1 - Stop and Signal instruction
1207 * followed by 'br -4'.
1208 */
1209 csa->lscsa->stopped_status.slot[0] = SPU_STOPPED_STATUS_P;
1210 csa->lscsa->stopped_status.slot[1] = status_code;
1211
1212 } else if ((csa->prob.spu_status_R & status_H) == status_H) {
1213
1214 /* SPU_Status[H]=1 - Halt Conditional, followed
1215 * by 'br -4'.
1216 */
1217 csa->lscsa->stopped_status.slot[0] = SPU_STOPPED_STATUS_H;
1218
1219 } else if ((csa->prob.spu_status_R & status_S) == status_S) {
1220
1221 /* SPU_Status[S]=1 - Two nop instructions.
1222 */
1223 csa->lscsa->stopped_status.slot[0] = SPU_STOPPED_STATUS_S;
1224
1225 } else if ((csa->prob.spu_status_R & status_I) == status_I) {
1226
1227 /* SPU_Status[I]=1 - Illegal instruction followed
1228 * by 'br -4'.
1229 */
1230 csa->lscsa->stopped_status.slot[0] = SPU_STOPPED_STATUS_I;
1231
1232 }
1233}
1234
1235static inline void setup_spu_status_part2(struct spu_state *csa,
1236 struct spu *spu)
1237{
1238 u32 mask;
1239
1240 /* Restore, Step 28:
1241 * If the CSA.SPU_Status[I,S,H,P,R]=0 then
1242 * add a 'br *' instruction to the end of
1243 * the SPU based restore code.
1244 *
1245 * NOTE: Rather than modifying the SPU executable, we
1246 * instead add a new 'stopped_status' field to the
1247 * LSCSA. The SPU-side restore reads this field and
1248 * takes the appropriate action when exiting.
1249 */
1250 mask = SPU_STATUS_INVALID_INSTR |
1251 SPU_STATUS_SINGLE_STEP |
1252 SPU_STATUS_STOPPED_BY_HALT |
1253 SPU_STATUS_STOPPED_BY_STOP | SPU_STATUS_RUNNING;
1254 if (!(csa->prob.spu_status_R & mask)) {
1255 csa->lscsa->stopped_status.slot[0] = SPU_STOPPED_STATUS_R;
1256 }
1257}
1258
1259static inline void restore_mfc_rag(struct spu_state *csa, struct spu *spu)
1260{
1261 /* Restore, Step 29:
1262 * Restore RA_GROUP_ID register and the
1263 * RA_ENABLE reigster from the CSA.
1264 */
1265 spu_resource_allocation_groupID_set(spu,
1266 csa->priv1.resource_allocation_groupID_RW);
1267 spu_resource_allocation_enable_set(spu,
1268 csa->priv1.resource_allocation_enable_RW);
1269}
1270
1271static inline void send_restore_code(struct spu_state *csa, struct spu *spu)
1272{
1273 unsigned long addr = (unsigned long)&spu_restore_code[0];
1274 unsigned int ls_offset = 0x0;
1275 unsigned int size = sizeof(spu_restore_code);
1276 unsigned int tag = 0;
1277 unsigned int rclass = 0;
1278 unsigned int cmd = MFC_GETFS_CMD;
1279
1280 /* Restore, Step 37:
1281 * Issue MFC DMA command to copy context
1282 * restore code to local storage.
1283 */
1284 send_mfc_dma(spu, addr, ls_offset, size, tag, rclass, cmd);
1285}
1286
1287static inline void setup_decr(struct spu_state *csa, struct spu *spu)
1288{
1289 /* Restore, Step 34:
1290 * If CSA.MFC_CNTL[Ds]=1 (decrementer was
1291 * running) then adjust decrementer, set
1292 * decrementer running status in LSCSA,
1293 * and set decrementer "wrapped" status
1294 * in LSCSA.
1295 */
1296 if (csa->priv2.mfc_control_RW & MFC_CNTL_DECREMENTER_RUNNING) {
1297 cycles_t resume_time = get_cycles();
1298 cycles_t delta_time = resume_time - csa->suspend_time;
1299
1300 csa->lscsa->decr.slot[0] = delta_time;
1301 }
1302}
1303
1304static inline void setup_ppu_mb(struct spu_state *csa, struct spu *spu)
1305{
1306 /* Restore, Step 35:
1307 * Copy the CSA.PU_MB data into the LSCSA.
1308 */
1309 csa->lscsa->ppu_mb.slot[0] = csa->prob.pu_mb_R;
1310}
1311
1312static inline void setup_ppuint_mb(struct spu_state *csa, struct spu *spu)
1313{
1314 /* Restore, Step 36:
1315 * Copy the CSA.PUINT_MB data into the LSCSA.
1316 */
1317 csa->lscsa->ppuint_mb.slot[0] = csa->priv2.puint_mb_R;
1318}
1319
1320static inline int check_restore_status(struct spu_state *csa, struct spu *spu)
1321{
1322 struct spu_problem __iomem *prob = spu->problem;
1323 u32 complete;
1324
1325 /* Restore, Step 40:
1326 * If SPU_Status[P]=1 and SPU_Status[SC] = "success",
1327 * context restore succeeded, otherwise context restore
1328 * failed.
1329 */
1330 complete = ((SPU_RESTORE_COMPLETE << SPU_STOP_STATUS_SHIFT) |
1331 SPU_STATUS_STOPPED_BY_STOP);
1332 return (in_be32(&prob->spu_status_R) != complete) ? 1 : 0;
1333}
1334
1335static inline void restore_spu_privcntl(struct spu_state *csa, struct spu *spu)
1336{
1337 struct spu_priv2 __iomem *priv2 = spu->priv2;
1338
1339 /* Restore, Step 41:
1340 * Restore SPU_PrivCntl from the CSA.
1341 */
1342 out_be64(&priv2->spu_privcntl_RW, csa->priv2.spu_privcntl_RW);
1343 eieio();
1344}
1345
1346static inline void restore_status_part1(struct spu_state *csa, struct spu *spu)
1347{
1348 struct spu_problem __iomem *prob = spu->problem;
1349 u32 mask;
1350
1351 /* Restore, Step 42:
1352 * If any CSA.SPU_Status[I,S,H,P]=1, then
1353 * restore the error or single step state.
1354 */
1355 mask = SPU_STATUS_INVALID_INSTR |
1356 SPU_STATUS_SINGLE_STEP |
1357 SPU_STATUS_STOPPED_BY_HALT | SPU_STATUS_STOPPED_BY_STOP;
1358 if (csa->prob.spu_status_R & mask) {
1359 out_be32(&prob->spu_runcntl_RW, SPU_RUNCNTL_RUNNABLE);
1360 eieio();
1361 POLL_WHILE_TRUE(in_be32(&prob->spu_status_R) &
1362 SPU_STATUS_RUNNING);
1363 }
1364}
1365
1366static inline void restore_status_part2(struct spu_state *csa, struct spu *spu)
1367{
1368 struct spu_problem __iomem *prob = spu->problem;
1369 u32 mask;
1370
1371 /* Restore, Step 43:
1372 * If all CSA.SPU_Status[I,S,H,P,R]=0 then write
1373 * SPU_RunCntl[R0R1]='01', wait for SPU_Status[R]=1,
1374 * then write '00' to SPU_RunCntl[R0R1] and wait
1375 * for SPU_Status[R]=0.
1376 */
1377 mask = SPU_STATUS_INVALID_INSTR |
1378 SPU_STATUS_SINGLE_STEP |
1379 SPU_STATUS_STOPPED_BY_HALT |
1380 SPU_STATUS_STOPPED_BY_STOP | SPU_STATUS_RUNNING;
1381 if (!(csa->prob.spu_status_R & mask)) {
1382 out_be32(&prob->spu_runcntl_RW, SPU_RUNCNTL_RUNNABLE);
1383 eieio();
1384 POLL_WHILE_FALSE(in_be32(&prob->spu_status_R) &
1385 SPU_STATUS_RUNNING);
1386 out_be32(&prob->spu_runcntl_RW, SPU_RUNCNTL_STOP);
1387 eieio();
1388 POLL_WHILE_TRUE(in_be32(&prob->spu_status_R) &
1389 SPU_STATUS_RUNNING);
1390 }
1391}
1392
1393static inline void restore_ls_16kb(struct spu_state *csa, struct spu *spu)
1394{
1395 unsigned long addr = (unsigned long)&csa->lscsa->ls[0];
1396 unsigned int ls_offset = 0x0;
1397 unsigned int size = 16384;
1398 unsigned int tag = 0;
1399 unsigned int rclass = 0;
1400 unsigned int cmd = MFC_GET_CMD;
1401
1402 /* Restore, Step 44:
1403 * Issue a DMA command to restore the first
1404 * 16kb of local storage from CSA.
1405 */
1406 send_mfc_dma(spu, addr, ls_offset, size, tag, rclass, cmd);
1407}
1408
1409static inline void clear_interrupts(struct spu_state *csa, struct spu *spu)
1410{
1411 /* Restore, Step 49:
1412 * Write INT_MASK_class0 with value of 0.
1413 * Write INT_MASK_class1 with value of 0.
1414 * Write INT_MASK_class2 with value of 0.
1415 * Write INT_STAT_class0 with value of -1.
1416 * Write INT_STAT_class1 with value of -1.
1417 * Write INT_STAT_class2 with value of -1.
1418 */
1419 spin_lock_irq(&spu->register_lock);
1420 spu_int_mask_set(spu, 0, 0ul);
1421 spu_int_mask_set(spu, 1, 0ul);
1422 spu_int_mask_set(spu, 2, 0ul);
1423 spu_int_stat_clear(spu, 0, ~0ul);
1424 spu_int_stat_clear(spu, 1, ~0ul);
1425 spu_int_stat_clear(spu, 2, ~0ul);
1426 spin_unlock_irq(&spu->register_lock);
1427}
1428
1429static inline void restore_mfc_queues(struct spu_state *csa, struct spu *spu)
1430{
1431 struct spu_priv2 __iomem *priv2 = spu->priv2;
1432 int i;
1433
1434 /* Restore, Step 50:
1435 * If MFC_Cntl[Se]!=0 then restore
1436 * MFC command queues.
1437 */
1438 if ((csa->priv2.mfc_control_RW & MFC_CNTL_DMA_QUEUES_EMPTY_MASK) == 0) {
1439 for (i = 0; i < 8; i++) {
1440 out_be64(&priv2->puq[i].mfc_cq_data0_RW,
1441 csa->priv2.puq[i].mfc_cq_data0_RW);
1442 out_be64(&priv2->puq[i].mfc_cq_data1_RW,
1443 csa->priv2.puq[i].mfc_cq_data1_RW);
1444 out_be64(&priv2->puq[i].mfc_cq_data2_RW,
1445 csa->priv2.puq[i].mfc_cq_data2_RW);
1446 out_be64(&priv2->puq[i].mfc_cq_data3_RW,
1447 csa->priv2.puq[i].mfc_cq_data3_RW);
1448 }
1449 for (i = 0; i < 16; i++) {
1450 out_be64(&priv2->spuq[i].mfc_cq_data0_RW,
1451 csa->priv2.spuq[i].mfc_cq_data0_RW);
1452 out_be64(&priv2->spuq[i].mfc_cq_data1_RW,
1453 csa->priv2.spuq[i].mfc_cq_data1_RW);
1454 out_be64(&priv2->spuq[i].mfc_cq_data2_RW,
1455 csa->priv2.spuq[i].mfc_cq_data2_RW);
1456 out_be64(&priv2->spuq[i].mfc_cq_data3_RW,
1457 csa->priv2.spuq[i].mfc_cq_data3_RW);
1458 }
1459 }
1460 eieio();
1461}
1462
1463static inline void restore_ppu_querymask(struct spu_state *csa, struct spu *spu)
1464{
1465 struct spu_problem __iomem *prob = spu->problem;
1466
1467 /* Restore, Step 51:
1468 * Restore the PPU_QueryMask register from CSA.
1469 */
1470 out_be32(&prob->dma_querymask_RW, csa->prob.dma_querymask_RW);
1471 eieio();
1472}
1473
1474static inline void restore_ppu_querytype(struct spu_state *csa, struct spu *spu)
1475{
1476 struct spu_problem __iomem *prob = spu->problem;
1477
1478 /* Restore, Step 52:
1479 * Restore the PPU_QueryType register from CSA.
1480 */
1481 out_be32(&prob->dma_querytype_RW, csa->prob.dma_querytype_RW);
1482 eieio();
1483}
1484
1485static inline void restore_mfc_csr_tsq(struct spu_state *csa, struct spu *spu)
1486{
1487 struct spu_priv2 __iomem *priv2 = spu->priv2;
1488
1489 /* Restore, Step 53:
1490 * Restore the MFC_CSR_TSQ register from CSA.
1491 */
1492 out_be64(&priv2->spu_tag_status_query_RW,
1493 csa->priv2.spu_tag_status_query_RW);
1494 eieio();
1495}
1496
1497static inline void restore_mfc_csr_cmd(struct spu_state *csa, struct spu *spu)
1498{
1499 struct spu_priv2 __iomem *priv2 = spu->priv2;
1500
1501 /* Restore, Step 54:
1502 * Restore the MFC_CSR_CMD1 and MFC_CSR_CMD2
1503 * registers from CSA.
1504 */
1505 out_be64(&priv2->spu_cmd_buf1_RW, csa->priv2.spu_cmd_buf1_RW);
1506 out_be64(&priv2->spu_cmd_buf2_RW, csa->priv2.spu_cmd_buf2_RW);
1507 eieio();
1508}
1509
1510static inline void restore_mfc_csr_ato(struct spu_state *csa, struct spu *spu)
1511{
1512 struct spu_priv2 __iomem *priv2 = spu->priv2;
1513
1514 /* Restore, Step 55:
1515 * Restore the MFC_CSR_ATO register from CSA.
1516 */
1517 out_be64(&priv2->spu_atomic_status_RW, csa->priv2.spu_atomic_status_RW);
1518}
1519
1520static inline void restore_mfc_tclass_id(struct spu_state *csa, struct spu *spu)
1521{
1522 /* Restore, Step 56:
1523 * Restore the MFC_TCLASS_ID register from CSA.
1524 */
1525 spu_mfc_tclass_id_set(spu, csa->priv1.mfc_tclass_id_RW);
1526 eieio();
1527}
1528
1529static inline void set_llr_event(struct spu_state *csa, struct spu *spu)
1530{
1531 u64 ch0_cnt, ch0_data;
1532 u64 ch1_data;
1533
1534 /* Restore, Step 57:
1535 * Set the Lock Line Reservation Lost Event by:
1536 * 1. OR CSA.SPU_Event_Status with bit 21 (Lr) set to 1.
1537 * 2. If CSA.SPU_Channel_0_Count=0 and
1538 * CSA.SPU_Wr_Event_Mask[Lr]=1 and
1539 * CSA.SPU_Event_Status[Lr]=0 then set
1540 * CSA.SPU_Event_Status_Count=1.
1541 */
1542 ch0_cnt = csa->spu_chnlcnt_RW[0];
1543 ch0_data = csa->spu_chnldata_RW[0];
1544 ch1_data = csa->spu_chnldata_RW[1];
1545 csa->spu_chnldata_RW[0] |= MFC_LLR_LOST_EVENT;
1546 if ((ch0_cnt == 0) && !(ch0_data & MFC_LLR_LOST_EVENT) &&
1547 (ch1_data & MFC_LLR_LOST_EVENT)) {
1548 csa->spu_chnlcnt_RW[0] = 1;
1549 }
1550}
1551
1552static inline void restore_decr_wrapped(struct spu_state *csa, struct spu *spu)
1553{
1554 /* Restore, Step 58:
1555 * If the status of the CSA software decrementer
1556 * "wrapped" flag is set, OR in a '1' to
1557 * CSA.SPU_Event_Status[Tm].
1558 */
1559 if (csa->lscsa->decr_status.slot[0] == 1) {
1560 csa->spu_chnldata_RW[0] |= 0x20;
1561 }
1562 if ((csa->lscsa->decr_status.slot[0] == 1) &&
1563 (csa->spu_chnlcnt_RW[0] == 0 &&
1564 ((csa->spu_chnldata_RW[2] & 0x20) == 0x0) &&
1565 ((csa->spu_chnldata_RW[0] & 0x20) != 0x1))) {
1566 csa->spu_chnlcnt_RW[0] = 1;
1567 }
1568}
1569
1570static inline void restore_ch_part1(struct spu_state *csa, struct spu *spu)
1571{
1572 struct spu_priv2 __iomem *priv2 = spu->priv2;
1573 u64 idx, ch_indices[7] = { 0UL, 1UL, 3UL, 4UL, 24UL, 25UL, 27UL };
1574 int i;
1575
1576 /* Restore, Step 59:
1577 * Restore the following CH: [0,1,3,4,24,25,27]
1578 */
1579 for (i = 0; i < 7; i++) {
1580 idx = ch_indices[i];
1581 out_be64(&priv2->spu_chnlcntptr_RW, idx);
1582 eieio();
1583 out_be64(&priv2->spu_chnldata_RW, csa->spu_chnldata_RW[idx]);
1584 out_be64(&priv2->spu_chnlcnt_RW, csa->spu_chnlcnt_RW[idx]);
1585 eieio();
1586 }
1587}
1588
1589static inline void restore_ch_part2(struct spu_state *csa, struct spu *spu)
1590{
1591 struct spu_priv2 __iomem *priv2 = spu->priv2;
1592 u64 ch_indices[3] = { 9UL, 21UL, 23UL };
1593 u64 ch_counts[3] = { 1UL, 16UL, 1UL };
1594 u64 idx;
1595 int i;
1596
1597 /* Restore, Step 60:
1598 * Restore the following CH: [9,21,23].
1599 */
1600 ch_counts[0] = 1UL;
1601 ch_counts[1] = csa->spu_chnlcnt_RW[21];
1602 ch_counts[2] = 1UL;
1603 for (i = 0; i < 3; i++) {
1604 idx = ch_indices[i];
1605 out_be64(&priv2->spu_chnlcntptr_RW, idx);
1606 eieio();
1607 out_be64(&priv2->spu_chnlcnt_RW, ch_counts[i]);
1608 eieio();
1609 }
1610}
1611
1612static inline void restore_spu_lslr(struct spu_state *csa, struct spu *spu)
1613{
1614 struct spu_priv2 __iomem *priv2 = spu->priv2;
1615
1616 /* Restore, Step 61:
1617 * Restore the SPU_LSLR register from CSA.
1618 */
1619 out_be64(&priv2->spu_lslr_RW, csa->priv2.spu_lslr_RW);
1620 eieio();
1621}
1622
1623static inline void restore_spu_cfg(struct spu_state *csa, struct spu *spu)
1624{
1625 struct spu_priv2 __iomem *priv2 = spu->priv2;
1626
1627 /* Restore, Step 62:
1628 * Restore the SPU_Cfg register from CSA.
1629 */
1630 out_be64(&priv2->spu_cfg_RW, csa->priv2.spu_cfg_RW);
1631 eieio();
1632}
1633
1634static inline void restore_pm_trace(struct spu_state *csa, struct spu *spu)
1635{
1636 /* Restore, Step 63:
1637 * Restore PM_Trace_Tag_Wait_Mask from CSA.
1638 * Not performed by this implementation.
1639 */
1640}
1641
1642static inline void restore_spu_npc(struct spu_state *csa, struct spu *spu)
1643{
1644 struct spu_problem __iomem *prob = spu->problem;
1645
1646 /* Restore, Step 64:
1647 * Restore SPU_NPC from CSA.
1648 */
1649 out_be32(&prob->spu_npc_RW, csa->prob.spu_npc_RW);
1650 eieio();
1651}
1652
1653static inline void restore_spu_mb(struct spu_state *csa, struct spu *spu)
1654{
1655 struct spu_priv2 __iomem *priv2 = spu->priv2;
1656 int i;
1657
1658 /* Restore, Step 65:
1659 * Restore MFC_RdSPU_MB from CSA.
1660 */
1661 out_be64(&priv2->spu_chnlcntptr_RW, 29UL);
1662 eieio();
1663 out_be64(&priv2->spu_chnlcnt_RW, csa->spu_chnlcnt_RW[29]);
1664 for (i = 0; i < 4; i++) {
1665 out_be64(&priv2->spu_chnldata_RW, csa->spu_mailbox_data[i]);
1666 }
1667 eieio();
1668}
1669
1670static inline void check_ppu_mb_stat(struct spu_state *csa, struct spu *spu)
1671{
1672 struct spu_problem __iomem *prob = spu->problem;
1673 u32 dummy = 0;
1674
1675 /* Restore, Step 66:
1676 * If CSA.MB_Stat[P]=0 (mailbox empty) then
1677 * read from the PPU_MB register.
1678 */
1679 if ((csa->prob.mb_stat_R & 0xFF) == 0) {
1680 dummy = in_be32(&prob->pu_mb_R);
1681 eieio();
1682 }
1683}
1684
1685static inline void check_ppuint_mb_stat(struct spu_state *csa, struct spu *spu)
1686{
1687 struct spu_priv2 __iomem *priv2 = spu->priv2;
1688 u64 dummy = 0UL;
1689
1690 /* Restore, Step 66:
1691 * If CSA.MB_Stat[I]=0 (mailbox empty) then
1692 * read from the PPUINT_MB register.
1693 */
1694 if ((csa->prob.mb_stat_R & 0xFF0000) == 0) {
1695 dummy = in_be64(&priv2->puint_mb_R);
1696 eieio();
1697 spu_int_stat_clear(spu, 2, CLASS2_ENABLE_MAILBOX_INTR);
1698 eieio();
1699 }
1700}
1701
1702static inline void restore_mfc_slbs(struct spu_state *csa, struct spu *spu)
1703{
1704 struct spu_priv2 __iomem *priv2 = spu->priv2;
1705 int i;
1706
1707 /* Restore, Step 68:
1708 * If MFC_SR1[R]='1', restore SLBs from CSA.
1709 */
1710 if (csa->priv1.mfc_sr1_RW & MFC_STATE1_RELOCATE_MASK) {
1711 for (i = 0; i < 8; i++) {
1712 out_be64(&priv2->slb_index_W, i);
1713 eieio();
1714 out_be64(&priv2->slb_esid_RW, csa->slb_esid_RW[i]);
1715 out_be64(&priv2->slb_vsid_RW, csa->slb_vsid_RW[i]);
1716 eieio();
1717 }
1718 out_be64(&priv2->slb_index_W, csa->priv2.slb_index_W);
1719 eieio();
1720 }
1721}
1722
1723static inline void restore_mfc_sr1(struct spu_state *csa, struct spu *spu)
1724{
1725 /* Restore, Step 69:
1726 * Restore the MFC_SR1 register from CSA.
1727 */
1728 spu_mfc_sr1_set(spu, csa->priv1.mfc_sr1_RW);
1729 eieio();
1730}
1731
1732static inline void restore_other_spu_access(struct spu_state *csa,
1733 struct spu *spu)
1734{
1735 /* Restore, Step 70:
1736 * Restore other SPU mappings to this SPU. TBD.
1737 */
1738}
1739
1740static inline void restore_spu_runcntl(struct spu_state *csa, struct spu *spu)
1741{
1742 struct spu_problem __iomem *prob = spu->problem;
1743
1744 /* Restore, Step 71:
1745 * If CSA.SPU_Status[R]=1 then write
1746 * SPU_RunCntl[R0R1]='01'.
1747 */
1748 if (csa->prob.spu_status_R & SPU_STATUS_RUNNING) {
1749 out_be32(&prob->spu_runcntl_RW, SPU_RUNCNTL_RUNNABLE);
1750 eieio();
1751 }
1752}
1753
1754static inline void restore_mfc_cntl(struct spu_state *csa, struct spu *spu)
1755{
1756 struct spu_priv2 __iomem *priv2 = spu->priv2;
1757
1758 /* Restore, Step 72:
1759 * Restore the MFC_CNTL register for the CSA.
1760 */
1761 out_be64(&priv2->mfc_control_RW, csa->priv2.mfc_control_RW);
1762 eieio();
1763}
1764
1765static inline void enable_user_access(struct spu_state *csa, struct spu *spu)
1766{
1767 /* Restore, Step 73:
1768 * Enable user-space access (if provided) to this
1769 * SPU by mapping the virtual pages assigned to
1770 * the SPU memory-mapped I/O (MMIO) for problem
1771 * state. TBD.
1772 */
1773}
1774
1775static inline void reset_switch_active(struct spu_state *csa, struct spu *spu)
1776{
1777 /* Restore, Step 74:
1778 * Reset the "context switch active" flag.
1779 */
1780 clear_bit(SPU_CONTEXT_SWITCH_ACTIVE, &spu->flags);
1781 mb();
1782}
1783
1784static inline void reenable_interrupts(struct spu_state *csa, struct spu *spu)
1785{
1786 /* Restore, Step 75:
1787 * Re-enable SPU interrupts.
1788 */
1789 spin_lock_irq(&spu->register_lock);
1790 spu_int_mask_set(spu, 0, csa->priv1.int_mask_class0_RW);
1791 spu_int_mask_set(spu, 1, csa->priv1.int_mask_class1_RW);
1792 spu_int_mask_set(spu, 2, csa->priv1.int_mask_class2_RW);
1793 spin_unlock_irq(&spu->register_lock);
1794}
1795
1796static int quiece_spu(struct spu_state *prev, struct spu *spu)
1797{
1798 /*
1799 * Combined steps 2-18 of SPU context save sequence, which
1800 * quiesce the SPU state (disable SPU execution, MFC command
1801 * queues, decrementer, SPU interrupts, etc.).
1802 *
1803 * Returns 0 on success.
1804 * 2 if failed step 2.
1805 * 6 if failed step 6.
1806 */
1807
1808 if (check_spu_isolate(prev, spu)) { /* Step 2. */
1809 return 2;
1810 }
1811 disable_interrupts(prev, spu); /* Step 3. */
1812 set_watchdog_timer(prev, spu); /* Step 4. */
1813 inhibit_user_access(prev, spu); /* Step 5. */
1814 if (check_spu_isolate(prev, spu)) { /* Step 6. */
1815 return 6;
1816 }
1817 set_switch_pending(prev, spu); /* Step 7. */
1818 save_mfc_cntl(prev, spu); /* Step 8. */
1819 save_spu_runcntl(prev, spu); /* Step 9. */
1820 save_mfc_sr1(prev, spu); /* Step 10. */
1821 save_spu_status(prev, spu); /* Step 11. */
1822 save_mfc_decr(prev, spu); /* Step 12. */
1823 halt_mfc_decr(prev, spu); /* Step 13. */
1824 save_timebase(prev, spu); /* Step 14. */
1825 remove_other_spu_access(prev, spu); /* Step 15. */
1826 do_mfc_mssync(prev, spu); /* Step 16. */
1827 issue_mfc_tlbie(prev, spu); /* Step 17. */
1828 handle_pending_interrupts(prev, spu); /* Step 18. */
1829
1830 return 0;
1831}
1832
1833static void save_csa(struct spu_state *prev, struct spu *spu)
1834{
1835 /*
1836 * Combine steps 19-44 of SPU context save sequence, which
1837 * save regions of the privileged & problem state areas.
1838 */
1839
1840 save_mfc_queues(prev, spu); /* Step 19. */
1841 save_ppu_querymask(prev, spu); /* Step 20. */
1842 save_ppu_querytype(prev, spu); /* Step 21. */
1843 save_mfc_csr_tsq(prev, spu); /* Step 22. */
1844 save_mfc_csr_cmd(prev, spu); /* Step 23. */
1845 save_mfc_csr_ato(prev, spu); /* Step 24. */
1846 save_mfc_tclass_id(prev, spu); /* Step 25. */
1847 set_mfc_tclass_id(prev, spu); /* Step 26. */
1848 purge_mfc_queue(prev, spu); /* Step 27. */
1849 wait_purge_complete(prev, spu); /* Step 28. */
1850 save_mfc_slbs(prev, spu); /* Step 29. */
1851 setup_mfc_sr1(prev, spu); /* Step 30. */
1852 save_spu_npc(prev, spu); /* Step 31. */
1853 save_spu_privcntl(prev, spu); /* Step 32. */
1854 reset_spu_privcntl(prev, spu); /* Step 33. */
1855 save_spu_lslr(prev, spu); /* Step 34. */
1856 reset_spu_lslr(prev, spu); /* Step 35. */
1857 save_spu_cfg(prev, spu); /* Step 36. */
1858 save_pm_trace(prev, spu); /* Step 37. */
1859 save_mfc_rag(prev, spu); /* Step 38. */
1860 save_ppu_mb_stat(prev, spu); /* Step 39. */
1861 save_ppu_mb(prev, spu); /* Step 40. */
1862 save_ppuint_mb(prev, spu); /* Step 41. */
1863 save_ch_part1(prev, spu); /* Step 42. */
1864 save_spu_mb(prev, spu); /* Step 43. */
1865 save_mfc_cmd(prev, spu); /* Step 44. */
1866 reset_ch(prev, spu); /* Step 45. */
1867}
1868
1869static void save_lscsa(struct spu_state *prev, struct spu *spu)
1870{
1871 /*
1872 * Perform steps 46-57 of SPU context save sequence,
1873 * which save regions of the local store and register
1874 * file.
1875 */
1876
1877 resume_mfc_queue(prev, spu); /* Step 46. */
1878 setup_mfc_slbs(prev, spu); /* Step 47. */
1879 set_switch_active(prev, spu); /* Step 48. */
1880 enable_interrupts(prev, spu); /* Step 49. */
1881 save_ls_16kb(prev, spu); /* Step 50. */
1882 set_spu_npc(prev, spu); /* Step 51. */
1883 set_signot1(prev, spu); /* Step 52. */
1884 set_signot2(prev, spu); /* Step 53. */
1885 send_save_code(prev, spu); /* Step 54. */
1886 set_ppu_querymask(prev, spu); /* Step 55. */
1887 wait_tag_complete(prev, spu); /* Step 56. */
1888 wait_spu_stopped(prev, spu); /* Step 57. */
1889}
1890
1891static void harvest(struct spu_state *prev, struct spu *spu)
1892{
1893 /*
1894 * Perform steps 2-25 of SPU context restore sequence,
1895 * which resets an SPU either after a failed save, or
1896 * when using SPU for first time.
1897 */
1898
1899 disable_interrupts(prev, spu); /* Step 2. */
1900 inhibit_user_access(prev, spu); /* Step 3. */
1901 terminate_spu_app(prev, spu); /* Step 4. */
1902 set_switch_pending(prev, spu); /* Step 5. */
1903 remove_other_spu_access(prev, spu); /* Step 6. */
1904 suspend_mfc(prev, spu); /* Step 7. */
1905 wait_suspend_mfc_complete(prev, spu); /* Step 8. */
1906 if (!suspend_spe(prev, spu)) /* Step 9. */
1907 clear_spu_status(prev, spu); /* Step 10. */
1908 do_mfc_mssync(prev, spu); /* Step 11. */
1909 issue_mfc_tlbie(prev, spu); /* Step 12. */
1910 handle_pending_interrupts(prev, spu); /* Step 13. */
1911 purge_mfc_queue(prev, spu); /* Step 14. */
1912 wait_purge_complete(prev, spu); /* Step 15. */
1913 reset_spu_privcntl(prev, spu); /* Step 16. */
1914 reset_spu_lslr(prev, spu); /* Step 17. */
1915 setup_mfc_sr1(prev, spu); /* Step 18. */
1916 invalidate_slbs(prev, spu); /* Step 19. */
1917 reset_ch_part1(prev, spu); /* Step 20. */
1918 reset_ch_part2(prev, spu); /* Step 21. */
1919 enable_interrupts(prev, spu); /* Step 22. */
1920 set_switch_active(prev, spu); /* Step 23. */
1921 set_mfc_tclass_id(prev, spu); /* Step 24. */
1922 resume_mfc_queue(prev, spu); /* Step 25. */
1923}
1924
1925static void restore_lscsa(struct spu_state *next, struct spu *spu)
1926{
1927 /*
1928 * Perform steps 26-40 of SPU context restore sequence,
1929 * which restores regions of the local store and register
1930 * file.
1931 */
1932
1933 set_watchdog_timer(next, spu); /* Step 26. */
1934 setup_spu_status_part1(next, spu); /* Step 27. */
1935 setup_spu_status_part2(next, spu); /* Step 28. */
1936 restore_mfc_rag(next, spu); /* Step 29. */
1937 setup_mfc_slbs(next, spu); /* Step 30. */
1938 set_spu_npc(next, spu); /* Step 31. */
1939 set_signot1(next, spu); /* Step 32. */
1940 set_signot2(next, spu); /* Step 33. */
1941 setup_decr(next, spu); /* Step 34. */
1942 setup_ppu_mb(next, spu); /* Step 35. */
1943 setup_ppuint_mb(next, spu); /* Step 36. */
1944 send_restore_code(next, spu); /* Step 37. */
1945 set_ppu_querymask(next, spu); /* Step 38. */
1946 wait_tag_complete(next, spu); /* Step 39. */
1947 wait_spu_stopped(next, spu); /* Step 40. */
1948}
1949
1950static void restore_csa(struct spu_state *next, struct spu *spu)
1951{
1952 /*
1953 * Combine steps 41-76 of SPU context restore sequence, which
1954 * restore regions of the privileged & problem state areas.
1955 */
1956
1957 restore_spu_privcntl(next, spu); /* Step 41. */
1958 restore_status_part1(next, spu); /* Step 42. */
1959 restore_status_part2(next, spu); /* Step 43. */
1960 restore_ls_16kb(next, spu); /* Step 44. */
1961 wait_tag_complete(next, spu); /* Step 45. */
1962 suspend_mfc(next, spu); /* Step 46. */
1963 wait_suspend_mfc_complete(next, spu); /* Step 47. */
1964 issue_mfc_tlbie(next, spu); /* Step 48. */
1965 clear_interrupts(next, spu); /* Step 49. */
1966 restore_mfc_queues(next, spu); /* Step 50. */
1967 restore_ppu_querymask(next, spu); /* Step 51. */
1968 restore_ppu_querytype(next, spu); /* Step 52. */
1969 restore_mfc_csr_tsq(next, spu); /* Step 53. */
1970 restore_mfc_csr_cmd(next, spu); /* Step 54. */
1971 restore_mfc_csr_ato(next, spu); /* Step 55. */
1972 restore_mfc_tclass_id(next, spu); /* Step 56. */
1973 set_llr_event(next, spu); /* Step 57. */
1974 restore_decr_wrapped(next, spu); /* Step 58. */
1975 restore_ch_part1(next, spu); /* Step 59. */
1976 restore_ch_part2(next, spu); /* Step 60. */
1977 restore_spu_lslr(next, spu); /* Step 61. */
1978 restore_spu_cfg(next, spu); /* Step 62. */
1979 restore_pm_trace(next, spu); /* Step 63. */
1980 restore_spu_npc(next, spu); /* Step 64. */
1981 restore_spu_mb(next, spu); /* Step 65. */
1982 check_ppu_mb_stat(next, spu); /* Step 66. */
1983 check_ppuint_mb_stat(next, spu); /* Step 67. */
1984 restore_mfc_slbs(next, spu); /* Step 68. */
1985 restore_mfc_sr1(next, spu); /* Step 69. */
1986 restore_other_spu_access(next, spu); /* Step 70. */
1987 restore_spu_runcntl(next, spu); /* Step 71. */
1988 restore_mfc_cntl(next, spu); /* Step 72. */
1989 enable_user_access(next, spu); /* Step 73. */
1990 reset_switch_active(next, spu); /* Step 74. */
1991 reenable_interrupts(next, spu); /* Step 75. */
1992}
1993
1994static int __do_spu_save(struct spu_state *prev, struct spu *spu)
1995{
1996 int rc;
1997
1998 /*
1999 * SPU context save can be broken into three phases:
2000 *
2001 * (a) quiesce [steps 2-16].
2002 * (b) save of CSA, performed by PPE [steps 17-42]
2003 * (c) save of LSCSA, mostly performed by SPU [steps 43-52].
2004 *
2005 * Returns 0 on success.
2006 * 2,6 if failed to quiece SPU
2007 * 53 if SPU-side of save failed.
2008 */
2009
2010 rc = quiece_spu(prev, spu); /* Steps 2-16. */
2011 switch (rc) {
2012 default:
2013 case 2:
2014 case 6:
2015 harvest(prev, spu);
2016 return rc;
2017 break;
2018 case 0:
2019 break;
2020 }
2021 save_csa(prev, spu); /* Steps 17-43. */
2022 save_lscsa(prev, spu); /* Steps 44-53. */
2023 return check_save_status(prev, spu); /* Step 54. */
2024}
2025
2026static int __do_spu_restore(struct spu_state *next, struct spu *spu)
2027{
2028 int rc;
2029
2030 /*
2031 * SPU context restore can be broken into three phases:
2032 *
2033 * (a) harvest (or reset) SPU [steps 2-24].
2034 * (b) restore LSCSA [steps 25-40], mostly performed by SPU.
2035 * (c) restore CSA [steps 41-76], performed by PPE.
2036 *
2037 * The 'harvest' step is not performed here, but rather
2038 * as needed below.
2039 */
2040
2041 restore_lscsa(next, spu); /* Steps 24-39. */
2042 rc = check_restore_status(next, spu); /* Step 40. */
2043 switch (rc) {
2044 default:
2045 /* Failed. Return now. */
2046 return rc;
2047 break;
2048 case 0:
2049 /* Fall through to next step. */
2050 break;
2051 }
2052 restore_csa(next, spu);
2053
2054 return 0;
2055}
2056
2057/**
2058 * spu_save - SPU context save, with locking.
2059 * @prev: pointer to SPU context save area, to be saved.
2060 * @spu: pointer to SPU iomem structure.
2061 *
2062 * Acquire locks, perform the save operation then return.
2063 */
2064int spu_save(struct spu_state *prev, struct spu *spu)
2065{
2066 int rc;
2067
2068 acquire_spu_lock(spu); /* Step 1. */
2069 rc = __do_spu_save(prev, spu); /* Steps 2-53. */
2070 release_spu_lock(spu);
2071 if (rc) {
2072 panic("%s failed on SPU[%d], rc=%d.\n",
2073 __func__, spu->number, rc);
2074 }
2075 return rc;
2076}
2077
2078/**
2079 * spu_restore - SPU context restore, with harvest and locking.
2080 * @new: pointer to SPU context save area, to be restored.
2081 * @spu: pointer to SPU iomem structure.
2082 *
2083 * Perform harvest + restore, as we may not be coming
2084 * from a previous succesful save operation, and the
2085 * hardware state is unknown.
2086 */
2087int spu_restore(struct spu_state *new, struct spu *spu)
2088{
2089 int rc;
2090
2091 acquire_spu_lock(spu);
2092 harvest(NULL, spu);
2093 spu->stop_code = 0;
2094 spu->dar = 0;
2095 spu->dsisr = 0;
2096 spu->slb_replace = 0;
2097 spu->class_0_pending = 0;
2098 rc = __do_spu_restore(new, spu);
2099 release_spu_lock(spu);
2100 if (rc) {
2101 panic("%s failed on SPU[%d] rc=%d.\n",
2102 __func__, spu->number, rc);
2103 }
2104 return rc;
2105}
2106
2107/**
2108 * spu_harvest - SPU harvest (reset) operation
2109 * @spu: pointer to SPU iomem structure.
2110 *
2111 * Perform SPU harvest (reset) operation.
2112 */
2113void spu_harvest(struct spu *spu)
2114{
2115 acquire_spu_lock(spu);
2116 harvest(NULL, spu);
2117 release_spu_lock(spu);
2118}
2119
2120static void init_prob(struct spu_state *csa)
2121{
2122 csa->spu_chnlcnt_RW[9] = 1;
2123 csa->spu_chnlcnt_RW[21] = 16;
2124 csa->spu_chnlcnt_RW[23] = 1;
2125 csa->spu_chnlcnt_RW[28] = 1;
2126 csa->spu_chnlcnt_RW[30] = 1;
2127 csa->prob.spu_runcntl_RW = SPU_RUNCNTL_STOP;
2128}
2129
2130static void init_priv1(struct spu_state *csa)
2131{
2132 /* Enable decode, relocate, tlbie response, master runcntl. */
2133 csa->priv1.mfc_sr1_RW = MFC_STATE1_LOCAL_STORAGE_DECODE_MASK |
2134 MFC_STATE1_MASTER_RUN_CONTROL_MASK |
2135 MFC_STATE1_PROBLEM_STATE_MASK |
2136 MFC_STATE1_RELOCATE_MASK | MFC_STATE1_BUS_TLBIE_MASK;
2137
2138 /* Set storage description. */
2139 csa->priv1.mfc_sdr_RW = mfspr(SPRN_SDR1);
2140
2141 /* Enable OS-specific set of interrupts. */
2142 csa->priv1.int_mask_class0_RW = CLASS0_ENABLE_DMA_ALIGNMENT_INTR |
2143 CLASS0_ENABLE_INVALID_DMA_COMMAND_INTR |
2144 CLASS0_ENABLE_SPU_ERROR_INTR;
2145 csa->priv1.int_mask_class1_RW = CLASS1_ENABLE_SEGMENT_FAULT_INTR |
2146 CLASS1_ENABLE_STORAGE_FAULT_INTR;
2147 csa->priv1.int_mask_class2_RW = CLASS2_ENABLE_SPU_STOP_INTR |
2148 CLASS2_ENABLE_SPU_HALT_INTR;
2149}
2150
2151static void init_priv2(struct spu_state *csa)
2152{
2153 csa->priv2.spu_lslr_RW = LS_ADDR_MASK;
2154 csa->priv2.mfc_control_RW = MFC_CNTL_RESUME_DMA_QUEUE |
2155 MFC_CNTL_NORMAL_DMA_QUEUE_OPERATION |
2156 MFC_CNTL_DMA_QUEUES_EMPTY_MASK;
2157}
2158
2159/**
2160 * spu_alloc_csa - allocate and initialize an SPU context save area.
2161 *
2162 * Allocate and initialize the contents of an SPU context save area.
2163 * This includes enabling address translation, interrupt masks, etc.,
2164 * as appropriate for the given OS environment.
2165 *
2166 * Note that storage for the 'lscsa' is allocated separately,
2167 * as it is by far the largest of the context save regions,
2168 * and may need to be pinned or otherwise specially aligned.
2169 */
2170void spu_init_csa(struct spu_state *csa)
2171{
2172 struct spu_lscsa *lscsa;
2173 unsigned char *p;
2174
2175 if (!csa)
2176 return;
2177 memset(csa, 0, sizeof(struct spu_state));
2178
2179 lscsa = vmalloc(sizeof(struct spu_lscsa));
2180 if (!lscsa)
2181 return;
2182
2183 memset(lscsa, 0, sizeof(struct spu_lscsa));
2184 csa->lscsa = lscsa;
2185 csa->register_lock = SPIN_LOCK_UNLOCKED;
2186
2187 /* Set LS pages reserved to allow for user-space mapping. */
2188 for (p = lscsa->ls; p < lscsa->ls + LS_SIZE; p += PAGE_SIZE)
2189 SetPageReserved(vmalloc_to_page(p));
2190
2191 init_prob(csa);
2192 init_priv1(csa);
2193 init_priv2(csa);
2194}
2195
2196void spu_fini_csa(struct spu_state *csa)
2197{
2198 /* Clear reserved bit before vfree. */
2199 unsigned char *p;
2200 for (p = csa->lscsa->ls; p < csa->lscsa->ls + LS_SIZE; p += PAGE_SIZE)
2201 ClearPageReserved(vmalloc_to_page(p));
2202
2203 vfree(csa->lscsa);
2204}
diff --git a/arch/powerpc/platforms/cell/spufs/syscalls.c b/arch/powerpc/platforms/cell/spufs/syscalls.c
new file mode 100644
index 000000000000..e6565a949ddc
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spufs/syscalls.c
@@ -0,0 +1,103 @@
1#include <linux/file.h>
2#include <linux/fs.h>
3#include <linux/module.h>
4#include <linux/mount.h>
5#include <linux/namei.h>
6
7#include <asm/uaccess.h>
8
9#include "spufs.h"
10
11/**
12 * sys_spu_run - run code loaded into an SPU
13 *
14 * @unpc: next program counter for the SPU
15 * @ustatus: status of the SPU
16 *
17 * This system call transfers the control of execution of a
18 * user space thread to an SPU. It will return when the
19 * SPU has finished executing or when it hits an error
20 * condition and it will be interrupted if a signal needs
21 * to be delivered to a handler in user space.
22 *
23 * The next program counter is set to the passed value
24 * before the SPU starts fetching code and the user space
25 * pointer gets updated with the new value when returning
26 * from kernel space.
27 *
28 * The status value returned from spu_run reflects the
29 * value of the spu_status register after the SPU has stopped.
30 *
31 */
32static long do_spu_run(struct file *filp,
33 __u32 __user *unpc,
34 __u32 __user *ustatus)
35{
36 long ret;
37 struct spufs_inode_info *i;
38 u32 npc, status;
39
40 ret = -EFAULT;
41 if (get_user(npc, unpc) || get_user(status, ustatus))
42 goto out;
43
44 /* check if this file was created by spu_create */
45 ret = -EINVAL;
46 if (filp->f_op != &spufs_context_fops)
47 goto out;
48
49 i = SPUFS_I(filp->f_dentry->d_inode);
50 ret = spufs_run_spu(filp, i->i_ctx, &npc, &status);
51
52 if (put_user(npc, unpc) || put_user(status, ustatus))
53 ret = -EFAULT;
54out:
55 return ret;
56}
57
58#ifndef MODULE
59asmlinkage long sys_spu_run(int fd, __u32 __user *unpc, __u32 __user *ustatus)
60{
61 int fput_needed;
62 struct file *filp;
63 long ret;
64
65 ret = -EBADF;
66 filp = fget_light(fd, &fput_needed);
67 if (filp) {
68 ret = do_spu_run(filp, unpc, ustatus);
69 fput_light(filp, fput_needed);
70 }
71
72 return ret;
73}
74#endif
75
76asmlinkage long sys_spu_create(const char __user *pathname,
77 unsigned int flags, mode_t mode)
78{
79 char *tmp;
80 int ret;
81
82 tmp = getname(pathname);
83 ret = PTR_ERR(tmp);
84 if (!IS_ERR(tmp)) {
85 struct nameidata nd;
86
87 ret = path_lookup(tmp, LOOKUP_PARENT|
88 LOOKUP_OPEN|LOOKUP_CREATE, &nd);
89 if (!ret) {
90 ret = spufs_create_thread(&nd, flags, mode);
91 path_release(&nd);
92 }
93 putname(tmp);
94 }
95
96 return ret;
97}
98
99struct spufs_calls spufs_calls = {
100 .create_thread = sys_spu_create,
101 .spu_run = do_spu_run,
102 .owner = THIS_MODULE,
103};
diff --git a/arch/powerpc/platforms/chrp/pci.c b/arch/powerpc/platforms/chrp/pci.c
index 82c429d487f3..00c52f27ef4f 100644
--- a/arch/powerpc/platforms/chrp/pci.c
+++ b/arch/powerpc/platforms/chrp/pci.c
@@ -135,12 +135,13 @@ int __init
135hydra_init(void) 135hydra_init(void)
136{ 136{
137 struct device_node *np; 137 struct device_node *np;
138 struct resource r;
138 139
139 np = find_devices("mac-io"); 140 np = find_devices("mac-io");
140 if (np == NULL || np->n_addrs == 0) 141 if (np == NULL || of_address_to_resource(np, 0, &r))
141 return 0; 142 return 0;
142 Hydra = ioremap(np->addrs[0].address, np->addrs[0].size); 143 Hydra = ioremap(r.start, r.end-r.start);
143 printk("Hydra Mac I/O at %lx\n", np->addrs[0].address); 144 printk("Hydra Mac I/O at %lx\n", r.start);
144 printk("Hydra Feature_Control was %x", 145 printk("Hydra Feature_Control was %x",
145 in_le32(&Hydra->Feature_Control)); 146 in_le32(&Hydra->Feature_Control));
146 out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN | 147 out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN |
@@ -177,18 +178,24 @@ setup_python(struct pci_controller *hose, struct device_node *dev)
177{ 178{
178 u32 __iomem *reg; 179 u32 __iomem *reg;
179 u32 val; 180 u32 val;
180 unsigned long addr = dev->addrs[0].address; 181 struct resource r;
181 182
182 setup_indirect_pci(hose, addr + 0xf8000, addr + 0xf8010); 183 if (of_address_to_resource(dev, 0, &r)) {
184 printk(KERN_ERR "No address for Python PCI controller\n");
185 return;
186 }
183 187
184 /* Clear the magic go-slow bit */ 188 /* Clear the magic go-slow bit */
185 reg = ioremap(dev->addrs[0].address + 0xf6000, 0x40); 189 reg = ioremap(r.start + 0xf6000, 0x40);
190 BUG_ON(!reg);
186 val = in_be32(&reg[12]); 191 val = in_be32(&reg[12]);
187 if (val & PRG_CL_RESET_VALID) { 192 if (val & PRG_CL_RESET_VALID) {
188 out_be32(&reg[12], val & ~PRG_CL_RESET_VALID); 193 out_be32(&reg[12], val & ~PRG_CL_RESET_VALID);
189 in_be32(&reg[12]); 194 in_be32(&reg[12]);
190 } 195 }
191 iounmap(reg); 196 iounmap(reg);
197
198 setup_indirect_pci(hose, r.start + 0xf8000, r.start + 0xf8010);
192} 199}
193 200
194/* Marvell Discovery II based Pegasos 2 */ 201/* Marvell Discovery II based Pegasos 2 */
@@ -218,7 +225,7 @@ chrp_find_bridges(void)
218 char *model, *machine; 225 char *model, *machine;
219 int is_longtrail = 0, is_mot = 0, is_pegasos = 0; 226 int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
220 struct device_node *root = find_path_device("/"); 227 struct device_node *root = find_path_device("/");
221 228 struct resource r;
222 /* 229 /*
223 * The PCI host bridge nodes on some machines don't have 230 * The PCI host bridge nodes on some machines don't have
224 * properties to adequately identify them, so we have to 231 * properties to adequately identify them, so we have to
@@ -238,7 +245,7 @@ chrp_find_bridges(void)
238 continue; 245 continue;
239 ++index; 246 ++index;
240 /* The GG2 bridge on the LongTrail doesn't have an address */ 247 /* The GG2 bridge on the LongTrail doesn't have an address */
241 if (dev->n_addrs < 1 && !is_longtrail) { 248 if (of_address_to_resource(dev, 0, &r) && !is_longtrail) {
242 printk(KERN_WARNING "Can't use %s: no address\n", 249 printk(KERN_WARNING "Can't use %s: no address\n",
243 dev->full_name); 250 dev->full_name);
244 continue; 251 continue;
@@ -255,8 +262,8 @@ chrp_find_bridges(void)
255 printk(KERN_INFO "PCI buses %d..%d", 262 printk(KERN_INFO "PCI buses %d..%d",
256 bus_range[0], bus_range[1]); 263 bus_range[0], bus_range[1]);
257 printk(" controlled by %s", dev->type); 264 printk(" controlled by %s", dev->type);
258 if (dev->n_addrs > 0) 265 if (!is_longtrail)
259 printk(" at %lx", dev->addrs[0].address); 266 printk(" at %lx", r.start);
260 printk("\n"); 267 printk("\n");
261 268
262 hose = pcibios_alloc_controller(); 269 hose = pcibios_alloc_controller();
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index dda5f2c72c25..2dc87aa5962f 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -49,7 +49,6 @@
49#include <asm/hydra.h> 49#include <asm/hydra.h>
50#include <asm/sections.h> 50#include <asm/sections.h>
51#include <asm/time.h> 51#include <asm/time.h>
52#include <asm/btext.h>
53#include <asm/i8259.h> 52#include <asm/i8259.h>
54#include <asm/mpic.h> 53#include <asm/mpic.h>
55#include <asm/rtas.h> 54#include <asm/rtas.h>
@@ -58,7 +57,6 @@
58#include "chrp.h" 57#include "chrp.h"
59 58
60void rtas_indicator_progress(char *, unsigned short); 59void rtas_indicator_progress(char *, unsigned short);
61void btext_progress(char *, unsigned short);
62 60
63int _chrp_type; 61int _chrp_type;
64EXPORT_SYMBOL(_chrp_type); 62EXPORT_SYMBOL(_chrp_type);
@@ -264,11 +262,6 @@ void __init chrp_setup_arch(void)
264 ppc_md.set_rtc_time = rtas_set_rtc_time; 262 ppc_md.set_rtc_time = rtas_set_rtc_time;
265 } 263 }
266 264
267#ifdef CONFIG_BOOTX_TEXT
268 if (ppc_md.progress == NULL && boot_text_mapped)
269 ppc_md.progress = btext_progress;
270#endif
271
272#ifdef CONFIG_BLK_DEV_INITRD 265#ifdef CONFIG_BLK_DEV_INITRD
273 /* this is fine for chrp */ 266 /* this is fine for chrp */
274 initrd_below_start_ok = 1; 267 initrd_below_start_ok = 1;
@@ -359,9 +352,10 @@ static void __init chrp_find_openpic(void)
359 opaddr = opprop[na-1]; /* assume 32-bit */ 352 opaddr = opprop[na-1]; /* assume 32-bit */
360 oplen /= na * sizeof(unsigned int); 353 oplen /= na * sizeof(unsigned int);
361 } else { 354 } else {
362 if (np->n_addrs == 0) 355 struct resource r;
356 if (of_address_to_resource(np, 0, &r))
363 return; 357 return;
364 opaddr = np->addrs[0].address; 358 opaddr = r.start;
365 oplen = 0; 359 oplen = 0;
366 } 360 }
367 361
@@ -384,7 +378,7 @@ static void __init chrp_find_openpic(void)
384 */ 378 */
385 if (oplen < len) { 379 if (oplen < len) {
386 printk(KERN_ERR "Insufficient addresses for distributed" 380 printk(KERN_ERR "Insufficient addresses for distributed"
387 " OpenPIC (%d < %d)\n", np->n_addrs, len); 381 " OpenPIC (%d < %d)\n", oplen, len);
388 len = oplen; 382 len = oplen;
389 } 383 }
390 384
@@ -522,12 +516,3 @@ void __init chrp_init(void)
522 smp_ops = &chrp_smp_ops; 516 smp_ops = &chrp_smp_ops;
523#endif /* CONFIG_SMP */ 517#endif /* CONFIG_SMP */
524} 518}
525
526#ifdef CONFIG_BOOTX_TEXT
527void
528btext_progress(char *s, unsigned short hex)
529{
530 btext_drawstring(s);
531 btext_drawstring("\n");
532}
533#endif /* CONFIG_BOOTX_TEXT */
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
index 737ee5d9f0aa..36a0f97bb7b1 100644
--- a/arch/powerpc/platforms/chrp/time.c
+++ b/arch/powerpc/platforms/chrp/time.c
@@ -21,6 +21,7 @@
21#include <linux/mc146818rtc.h> 21#include <linux/mc146818rtc.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/bcd.h> 23#include <linux/bcd.h>
24#include <linux/ioport.h>
24 25
25#include <asm/io.h> 26#include <asm/io.h>
26#include <asm/nvram.h> 27#include <asm/nvram.h>
@@ -37,14 +38,16 @@ static int nvram_data = NVRAM_DATA;
37long __init chrp_time_init(void) 38long __init chrp_time_init(void)
38{ 39{
39 struct device_node *rtcs; 40 struct device_node *rtcs;
41 struct resource r;
40 int base; 42 int base;
41 43
42 rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); 44 rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
43 if (rtcs == NULL) 45 if (rtcs == NULL)
44 rtcs = find_compatible_devices("rtc", "ds1385-rtc"); 46 rtcs = find_compatible_devices("rtc", "ds1385-rtc");
45 if (rtcs == NULL || rtcs->addrs == NULL) 47 if (rtcs == NULL || of_address_to_resource(rtcs, 0, &r))
46 return 0; 48 return 0;
47 base = rtcs->addrs[0].address; 49
50 base = r.start;
48 nvram_as1 = 0; 51 nvram_as1 = 0;
49 nvram_as0 = base; 52 nvram_as0 = base;
50 nvram_data = base + 1; 53 nvram_data = base + 1;
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 81250090f98d..4fdbc9ae876b 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -144,16 +144,6 @@ config LITE5200
144 much but it's only been tested on this board version. I think this 144 much but it's only been tested on this board version. I think this
145 board is also known as IceCube. 145 board is also known as IceCube.
146 146
147config MPC834x_SYS
148 bool "Freescale MPC834x SYS"
149 help
150 This option enables support for the MPC 834x SYS evaluation board.
151
152 Be aware that PCI buses can only function when SYS board is plugged
153 into the PIB (Platform IO Board) board from Freescale which provide
154 3 PCI slots. The PIBs PCI initialization is the bootloader's
155 responsiblilty.
156
157config EV64360 147config EV64360
158 bool "Marvell-EV64360BP" 148 bool "Marvell-EV64360BP"
159 help 149 help
@@ -192,14 +182,6 @@ config 8272
192 The MPC8272 CPM has a different internal dpram setup than other CPM2 182 The MPC8272 CPM has a different internal dpram setup than other CPM2
193 devices 183 devices
194 184
195config 83xx
196 bool
197 default y if MPC834x_SYS
198
199config MPC834x
200 bool
201 default y if MPC834x_SYS
202
203config CPM2 185config CPM2
204 bool 186 bool
205 depends on 8260 || MPC8560 || MPC8555 187 depends on 8260 || MPC8560 || MPC8555
diff --git a/arch/powerpc/platforms/iseries/Makefile b/arch/powerpc/platforms/iseries/Makefile
index 127b465308be..ce8c0b943fa0 100644
--- a/arch/powerpc/platforms/iseries/Makefile
+++ b/arch/powerpc/platforms/iseries/Makefile
@@ -1,8 +1,8 @@
1EXTRA_CFLAGS += -mno-minimal-toc 1EXTRA_CFLAGS += -mno-minimal-toc
2 2
3obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o mf.o lpevents.o \ 3obj-y += hvlog.o hvlpconfig.o lpardata.o setup.o mf.o lpevents.o \
4 hvcall.o proc.o htab.o iommu.o misc.o 4 hvcall.o proc.o htab.o iommu.o misc.o irq.o
5obj-$(CONFIG_PCI) += pci.o irq.o vpdinfo.o 5obj-$(CONFIG_PCI) += pci.o vpdinfo.o
6obj-$(CONFIG_IBMVIO) += vio.o 6obj-$(CONFIG_IBMVIO) += vio.o
7obj-$(CONFIG_SMP) += smp.o 7obj-$(CONFIG_SMP) += smp.o
8obj-$(CONFIG_VIOPATH) += viopath.o 8obj-$(CONFIG_VIOPATH) += viopath.o
diff --git a/arch/powerpc/platforms/iseries/iommu.c b/arch/powerpc/platforms/iseries/iommu.c
index 2b54eeb2c899..bea0b703f409 100644
--- a/arch/powerpc/platforms/iseries/iommu.c
+++ b/arch/powerpc/platforms/iseries/iommu.c
@@ -34,6 +34,8 @@
34#include <asm/pci-bridge.h> 34#include <asm/pci-bridge.h>
35#include <asm/iseries/hv_call_xm.h> 35#include <asm/iseries/hv_call_xm.h>
36 36
37#include "iommu.h"
38
37extern struct list_head iSeries_Global_Device_List; 39extern struct list_head iSeries_Global_Device_List;
38 40
39 41
diff --git a/arch/powerpc/platforms/iseries/iommu.h b/arch/powerpc/platforms/iseries/iommu.h
new file mode 100644
index 000000000000..cb5658fbe657
--- /dev/null
+++ b/arch/powerpc/platforms/iseries/iommu.h
@@ -0,0 +1,35 @@
1#ifndef _PLATFORMS_ISERIES_IOMMU_H
2#define _PLATFORMS_ISERIES_IOMMU_H
3
4/*
5 * Copyright (C) 2005 Stephen Rothwell, IBM Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the:
19 * Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330,
21 * Boston, MA 02111-1307 USA
22 */
23
24struct device_node;
25struct iommu_table;
26
27/* Creates table for an individual device node */
28extern void iommu_devnode_init_iSeries(struct device_node *dn);
29
30/* Get table parameters from HV */
31extern void iommu_table_getparms_iSeries(unsigned long busno,
32 unsigned char slotno, unsigned char virtbus,
33 struct iommu_table *tbl);
34
35#endif /* _PLATFORMS_ISERIES_IOMMU_H */
diff --git a/arch/powerpc/platforms/iseries/irq.c b/arch/powerpc/platforms/iseries/irq.c
index a58daa153686..be3fbfc24e6c 100644
--- a/arch/powerpc/platforms/iseries/irq.c
+++ b/arch/powerpc/platforms/iseries/irq.c
@@ -35,161 +35,131 @@
35#include <linux/irq.h> 35#include <linux/irq.h>
36#include <linux/spinlock.h> 36#include <linux/spinlock.h>
37 37
38#include <asm/paca.h>
38#include <asm/iseries/hv_types.h> 39#include <asm/iseries/hv_types.h>
39#include <asm/iseries/hv_lp_event.h> 40#include <asm/iseries/hv_lp_event.h>
40#include <asm/iseries/hv_call_xm.h> 41#include <asm/iseries/hv_call_xm.h>
42#include <asm/iseries/it_lp_queue.h>
41 43
42#include "irq.h" 44#include "irq.h"
43#include "call_pci.h" 45#include "call_pci.h"
44 46
45static long Pci_Interrupt_Count; 47#if defined(CONFIG_SMP)
46static long Pci_Event_Count; 48extern void iSeries_smp_message_recv(struct pt_regs *);
47 49#endif
48enum XmPciLpEvent_Subtype {
49 XmPciLpEvent_BusCreated = 0, // PHB has been created
50 XmPciLpEvent_BusError = 1, // PHB has failed
51 XmPciLpEvent_BusFailed = 2, // Msg to Secondary, Primary failed bus
52 XmPciLpEvent_NodeFailed = 4, // Multi-adapter bridge has failed
53 XmPciLpEvent_NodeRecovered = 5, // Multi-adapter bridge has recovered
54 XmPciLpEvent_BusRecovered = 12, // PHB has been recovered
55 XmPciLpEvent_UnQuiesceBus = 18, // Secondary bus unqiescing
56 XmPciLpEvent_BridgeError = 21, // Bridge Error
57 XmPciLpEvent_SlotInterrupt = 22 // Slot interrupt
58};
59 50
60struct XmPciLpEvent_BusInterrupt { 51#ifdef CONFIG_PCI
61 HvBusNumber busNumber;
62 HvSubBusNumber subBusNumber;
63};
64 52
65struct XmPciLpEvent_NodeInterrupt { 53enum pci_event_type {
66 HvBusNumber busNumber; 54 pe_bus_created = 0, /* PHB has been created */
67 HvSubBusNumber subBusNumber; 55 pe_bus_error = 1, /* PHB has failed */
68 HvAgentId deviceId; 56 pe_bus_failed = 2, /* Msg to Secondary, Primary failed bus */
57 pe_node_failed = 4, /* Multi-adapter bridge has failed */
58 pe_node_recovered = 5, /* Multi-adapter bridge has recovered */
59 pe_bus_recovered = 12, /* PHB has been recovered */
60 pe_unquiese_bus = 18, /* Secondary bus unqiescing */
61 pe_bridge_error = 21, /* Bridge Error */
62 pe_slot_interrupt = 22 /* Slot interrupt */
69}; 63};
70 64
71struct XmPciLpEvent { 65struct pci_event {
72 struct HvLpEvent hvLpEvent; 66 struct HvLpEvent event;
73
74 union { 67 union {
75 u64 alignData; // Align on an 8-byte boundary 68 u64 __align; /* Align on an 8-byte boundary */
76
77 struct { 69 struct {
78 u32 fisr; 70 u32 fisr;
79 HvBusNumber busNumber; 71 HvBusNumber bus_number;
80 HvSubBusNumber subBusNumber; 72 HvSubBusNumber sub_bus_number;
81 HvAgentId deviceId; 73 HvAgentId dev_id;
82 } slotInterrupt; 74 } slot;
83 75 struct {
84 struct XmPciLpEvent_BusInterrupt busFailed; 76 HvBusNumber bus_number;
85 struct XmPciLpEvent_BusInterrupt busRecovered; 77 HvSubBusNumber sub_bus_number;
86 struct XmPciLpEvent_BusInterrupt busCreated; 78 } bus;
87 79 struct {
88 struct XmPciLpEvent_NodeInterrupt nodeFailed; 80 HvBusNumber bus_number;
89 struct XmPciLpEvent_NodeInterrupt nodeRecovered; 81 HvSubBusNumber sub_bus_number;
90 82 HvAgentId dev_id;
91 } eventData; 83 } node;
92 84 } data;
93}; 85};
94 86
95static void intReceived(struct XmPciLpEvent *eventParm, 87static DEFINE_SPINLOCK(pending_irqs_lock);
96 struct pt_regs *regsParm) 88static int num_pending_irqs;
89static int pending_irqs[NR_IRQS];
90
91static void int_received(struct pci_event *event, struct pt_regs *regs)
97{ 92{
98 int irq; 93 int irq;
99#ifdef CONFIG_IRQSTACKS
100 struct thread_info *curtp, *irqtp;
101#endif
102 94
103 ++Pci_Interrupt_Count; 95 switch (event->event.xSubtype) {
104 96 case pe_slot_interrupt:
105 switch (eventParm->hvLpEvent.xSubtype) { 97 irq = event->event.xCorrelationToken;
106 case XmPciLpEvent_SlotInterrupt: 98 if (irq < NR_IRQS) {
107 irq = eventParm->hvLpEvent.xCorrelationToken; 99 spin_lock(&pending_irqs_lock);
108 /* Dispatch the interrupt handlers for this irq */ 100 pending_irqs[irq]++;
109#ifdef CONFIG_IRQSTACKS 101 num_pending_irqs++;
110 /* Switch to the irq stack to handle this */ 102 spin_unlock(&pending_irqs_lock);
111 curtp = current_thread_info(); 103 } else {
112 irqtp = hardirq_ctx[smp_processor_id()]; 104 printk(KERN_WARNING "int_received: bad irq number %d\n",
113 if (curtp != irqtp) { 105 irq);
114 irqtp->task = curtp->task; 106 HvCallPci_eoi(event->data.slot.bus_number,
115 irqtp->flags = 0; 107 event->data.slot.sub_bus_number,
116 call___do_IRQ(irq, regsParm, irqtp); 108 event->data.slot.dev_id);
117 irqtp->task = NULL; 109 }
118 if (irqtp->flags)
119 set_bits(irqtp->flags, &curtp->flags);
120 } else
121#endif
122 __do_IRQ(irq, regsParm);
123 HvCallPci_eoi(eventParm->eventData.slotInterrupt.busNumber,
124 eventParm->eventData.slotInterrupt.subBusNumber,
125 eventParm->eventData.slotInterrupt.deviceId);
126 break; 110 break;
127 /* Ignore error recovery events for now */ 111 /* Ignore error recovery events for now */
128 case XmPciLpEvent_BusCreated: 112 case pe_bus_created:
129 printk(KERN_INFO "intReceived: system bus %d created\n", 113 printk(KERN_INFO "int_received: system bus %d created\n",
130 eventParm->eventData.busCreated.busNumber); 114 event->data.bus.bus_number);
131 break; 115 break;
132 case XmPciLpEvent_BusError: 116 case pe_bus_error:
133 case XmPciLpEvent_BusFailed: 117 case pe_bus_failed:
134 printk(KERN_INFO "intReceived: system bus %d failed\n", 118 printk(KERN_INFO "int_received: system bus %d failed\n",
135 eventParm->eventData.busFailed.busNumber); 119 event->data.bus.bus_number);
136 break; 120 break;
137 case XmPciLpEvent_BusRecovered: 121 case pe_bus_recovered:
138 case XmPciLpEvent_UnQuiesceBus: 122 case pe_unquiese_bus:
139 printk(KERN_INFO "intReceived: system bus %d recovered\n", 123 printk(KERN_INFO "int_received: system bus %d recovered\n",
140 eventParm->eventData.busRecovered.busNumber); 124 event->data.bus.bus_number);
141 break; 125 break;
142 case XmPciLpEvent_NodeFailed: 126 case pe_node_failed:
143 case XmPciLpEvent_BridgeError: 127 case pe_bridge_error:
144 printk(KERN_INFO 128 printk(KERN_INFO
145 "intReceived: multi-adapter bridge %d/%d/%d failed\n", 129 "int_received: multi-adapter bridge %d/%d/%d failed\n",
146 eventParm->eventData.nodeFailed.busNumber, 130 event->data.node.bus_number,
147 eventParm->eventData.nodeFailed.subBusNumber, 131 event->data.node.sub_bus_number,
148 eventParm->eventData.nodeFailed.deviceId); 132 event->data.node.dev_id);
149 break; 133 break;
150 case XmPciLpEvent_NodeRecovered: 134 case pe_node_recovered:
151 printk(KERN_INFO 135 printk(KERN_INFO
152 "intReceived: multi-adapter bridge %d/%d/%d recovered\n", 136 "int_received: multi-adapter bridge %d/%d/%d recovered\n",
153 eventParm->eventData.nodeRecovered.busNumber, 137 event->data.node.bus_number,
154 eventParm->eventData.nodeRecovered.subBusNumber, 138 event->data.node.sub_bus_number,
155 eventParm->eventData.nodeRecovered.deviceId); 139 event->data.node.dev_id);
156 break; 140 break;
157 default: 141 default:
158 printk(KERN_ERR 142 printk(KERN_ERR
159 "intReceived: unrecognized event subtype 0x%x\n", 143 "int_received: unrecognized event subtype 0x%x\n",
160 eventParm->hvLpEvent.xSubtype); 144 event->event.xSubtype);
161 break; 145 break;
162 } 146 }
163} 147}
164 148
165static void XmPciLpEvent_handler(struct HvLpEvent *eventParm, 149static void pci_event_handler(struct HvLpEvent *event, struct pt_regs *regs)
166 struct pt_regs *regsParm)
167{ 150{
168#ifdef CONFIG_PCI 151 if (event && (event->xType == HvLpEvent_Type_PciIo)) {
169 ++Pci_Event_Count; 152 if (hvlpevent_is_int(event))
170 153 int_received((struct pci_event *)event, regs);
171 if (eventParm && (eventParm->xType == HvLpEvent_Type_PciIo)) { 154 else
172 switch (eventParm->xFlags.xFunction) {
173 case HvLpEvent_Function_Int:
174 intReceived((struct XmPciLpEvent *)eventParm, regsParm);
175 break;
176 case HvLpEvent_Function_Ack:
177 printk(KERN_ERR 155 printk(KERN_ERR
178 "XmPciLpEvent_handler: unexpected ack received\n"); 156 "pci_event_handler: unexpected ack received\n");
179 break; 157 } else if (event)
180 default:
181 printk(KERN_ERR
182 "XmPciLpEvent_handler: unexpected event function %d\n",
183 (int)eventParm->xFlags.xFunction);
184 break;
185 }
186 } else if (eventParm)
187 printk(KERN_ERR 158 printk(KERN_ERR
188 "XmPciLpEvent_handler: Unrecognized PCI event type 0x%x\n", 159 "pci_event_handler: Unrecognized PCI event type 0x%x\n",
189 (int)eventParm->xType); 160 (int)event->xType);
190 else 161 else
191 printk(KERN_ERR "XmPciLpEvent_handler: NULL event received\n"); 162 printk(KERN_ERR "pci_event_handler: NULL event received\n");
192#endif
193} 163}
194 164
195/* 165/*
@@ -199,20 +169,21 @@ static void XmPciLpEvent_handler(struct HvLpEvent *eventParm,
199void __init iSeries_init_IRQ(void) 169void __init iSeries_init_IRQ(void)
200{ 170{
201 /* Register PCI event handler and open an event path */ 171 /* Register PCI event handler and open an event path */
202 int xRc; 172 int ret;
203 173
204 xRc = HvLpEvent_registerHandler(HvLpEvent_Type_PciIo, 174 ret = HvLpEvent_registerHandler(HvLpEvent_Type_PciIo,
205 &XmPciLpEvent_handler); 175 &pci_event_handler);
206 if (xRc == 0) { 176 if (ret == 0) {
207 xRc = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0); 177 ret = HvLpEvent_openPath(HvLpEvent_Type_PciIo, 0);
208 if (xRc != 0) 178 if (ret != 0)
209 printk(KERN_ERR "iSeries_init_IRQ: open event path " 179 printk(KERN_ERR "iseries_init_IRQ: open event path "
210 "failed with rc 0x%x\n", xRc); 180 "failed with rc 0x%x\n", ret);
211 } else 181 } else
212 printk(KERN_ERR "iSeries_init_IRQ: register handler " 182 printk(KERN_ERR "iseries_init_IRQ: register handler "
213 "failed with rc 0x%x\n", xRc); 183 "failed with rc 0x%x\n", ret);
214} 184}
215 185
186#define REAL_IRQ_TO_SUBBUS(irq) (((irq) >> 14) & 0xff)
216#define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1) 187#define REAL_IRQ_TO_BUS(irq) ((((irq) >> 6) & 0xff) + 1)
217#define REAL_IRQ_TO_IDSEL(irq) ((((irq) >> 3) & 7) + 1) 188#define REAL_IRQ_TO_IDSEL(irq) ((((irq) >> 3) & 7) + 1)
218#define REAL_IRQ_TO_FUNC(irq) ((irq) & 7) 189#define REAL_IRQ_TO_FUNC(irq) ((irq) & 7)
@@ -221,40 +192,40 @@ void __init iSeries_init_IRQ(void)
221 * This will be called by device drivers (via enable_IRQ) 192 * This will be called by device drivers (via enable_IRQ)
222 * to enable INTA in the bridge interrupt status register. 193 * to enable INTA in the bridge interrupt status register.
223 */ 194 */
224static void iSeries_enable_IRQ(unsigned int irq) 195static void iseries_enable_IRQ(unsigned int irq)
225{ 196{
226 u32 bus, deviceId, function, mask; 197 u32 bus, dev_id, function, mask;
227 const u32 subBus = 0; 198 const u32 sub_bus = 0;
228 unsigned int rirq = virt_irq_to_real_map[irq]; 199 unsigned int rirq = virt_irq_to_real_map[irq];
229 200
230 /* The IRQ has already been locked by the caller */ 201 /* The IRQ has already been locked by the caller */
231 bus = REAL_IRQ_TO_BUS(rirq); 202 bus = REAL_IRQ_TO_BUS(rirq);
232 function = REAL_IRQ_TO_FUNC(rirq); 203 function = REAL_IRQ_TO_FUNC(rirq);
233 deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; 204 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
234 205
235 /* Unmask secondary INTA */ 206 /* Unmask secondary INTA */
236 mask = 0x80000000; 207 mask = 0x80000000;
237 HvCallPci_unmaskInterrupts(bus, subBus, deviceId, mask); 208 HvCallPci_unmaskInterrupts(bus, sub_bus, dev_id, mask);
238} 209}
239 210
240/* This is called by iSeries_activate_IRQs */ 211/* This is called by iseries_activate_IRQs */
241static unsigned int iSeries_startup_IRQ(unsigned int irq) 212static unsigned int iseries_startup_IRQ(unsigned int irq)
242{ 213{
243 u32 bus, deviceId, function, mask; 214 u32 bus, dev_id, function, mask;
244 const u32 subBus = 0; 215 const u32 sub_bus = 0;
245 unsigned int rirq = virt_irq_to_real_map[irq]; 216 unsigned int rirq = virt_irq_to_real_map[irq];
246 217
247 bus = REAL_IRQ_TO_BUS(rirq); 218 bus = REAL_IRQ_TO_BUS(rirq);
248 function = REAL_IRQ_TO_FUNC(rirq); 219 function = REAL_IRQ_TO_FUNC(rirq);
249 deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; 220 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
250 221
251 /* Link the IRQ number to the bridge */ 222 /* Link the IRQ number to the bridge */
252 HvCallXm_connectBusUnit(bus, subBus, deviceId, irq); 223 HvCallXm_connectBusUnit(bus, sub_bus, dev_id, irq);
253 224
254 /* Unmask bridge interrupts in the FISR */ 225 /* Unmask bridge interrupts in the FISR */
255 mask = 0x01010000 << function; 226 mask = 0x01010000 << function;
256 HvCallPci_unmaskFisr(bus, subBus, deviceId, mask); 227 HvCallPci_unmaskFisr(bus, sub_bus, dev_id, mask);
257 iSeries_enable_IRQ(irq); 228 iseries_enable_IRQ(irq);
258 return 0; 229 return 0;
259} 230}
260 231
@@ -279,78 +250,117 @@ void __init iSeries_activate_IRQs()
279} 250}
280 251
281/* this is not called anywhere currently */ 252/* this is not called anywhere currently */
282static void iSeries_shutdown_IRQ(unsigned int irq) 253static void iseries_shutdown_IRQ(unsigned int irq)
283{ 254{
284 u32 bus, deviceId, function, mask; 255 u32 bus, dev_id, function, mask;
285 const u32 subBus = 0; 256 const u32 sub_bus = 0;
286 unsigned int rirq = virt_irq_to_real_map[irq]; 257 unsigned int rirq = virt_irq_to_real_map[irq];
287 258
288 /* irq should be locked by the caller */ 259 /* irq should be locked by the caller */
289 bus = REAL_IRQ_TO_BUS(rirq); 260 bus = REAL_IRQ_TO_BUS(rirq);
290 function = REAL_IRQ_TO_FUNC(rirq); 261 function = REAL_IRQ_TO_FUNC(rirq);
291 deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; 262 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
292 263
293 /* Invalidate the IRQ number in the bridge */ 264 /* Invalidate the IRQ number in the bridge */
294 HvCallXm_connectBusUnit(bus, subBus, deviceId, 0); 265 HvCallXm_connectBusUnit(bus, sub_bus, dev_id, 0);
295 266
296 /* Mask bridge interrupts in the FISR */ 267 /* Mask bridge interrupts in the FISR */
297 mask = 0x01010000 << function; 268 mask = 0x01010000 << function;
298 HvCallPci_maskFisr(bus, subBus, deviceId, mask); 269 HvCallPci_maskFisr(bus, sub_bus, dev_id, mask);
299} 270}
300 271
301/* 272/*
302 * This will be called by device drivers (via disable_IRQ) 273 * This will be called by device drivers (via disable_IRQ)
303 * to disable INTA in the bridge interrupt status register. 274 * to disable INTA in the bridge interrupt status register.
304 */ 275 */
305static void iSeries_disable_IRQ(unsigned int irq) 276static void iseries_disable_IRQ(unsigned int irq)
306{ 277{
307 u32 bus, deviceId, function, mask; 278 u32 bus, dev_id, function, mask;
308 const u32 subBus = 0; 279 const u32 sub_bus = 0;
309 unsigned int rirq = virt_irq_to_real_map[irq]; 280 unsigned int rirq = virt_irq_to_real_map[irq];
310 281
311 /* The IRQ has already been locked by the caller */ 282 /* The IRQ has already been locked by the caller */
312 bus = REAL_IRQ_TO_BUS(rirq); 283 bus = REAL_IRQ_TO_BUS(rirq);
313 function = REAL_IRQ_TO_FUNC(rirq); 284 function = REAL_IRQ_TO_FUNC(rirq);
314 deviceId = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function; 285 dev_id = (REAL_IRQ_TO_IDSEL(rirq) << 4) + function;
315 286
316 /* Mask secondary INTA */ 287 /* Mask secondary INTA */
317 mask = 0x80000000; 288 mask = 0x80000000;
318 HvCallPci_maskInterrupts(bus, subBus, deviceId, mask); 289 HvCallPci_maskInterrupts(bus, sub_bus, dev_id, mask);
319} 290}
320 291
321/* 292static void iseries_end_IRQ(unsigned int irq)
322 * This does nothing because there is not enough information
323 * provided to do the EOI HvCall. This is done by XmPciLpEvent.c
324 */
325static void iSeries_end_IRQ(unsigned int irq)
326{ 293{
294 unsigned int rirq = virt_irq_to_real_map[irq];
295
296 HvCallPci_eoi(REAL_IRQ_TO_BUS(rirq), REAL_IRQ_TO_SUBBUS(rirq),
297 (REAL_IRQ_TO_IDSEL(rirq) << 4) + REAL_IRQ_TO_FUNC(rirq));
327} 298}
328 299
329static hw_irq_controller iSeries_IRQ_handler = { 300static hw_irq_controller iSeries_IRQ_handler = {
330 .typename = "iSeries irq controller", 301 .typename = "iSeries irq controller",
331 .startup = iSeries_startup_IRQ, 302 .startup = iseries_startup_IRQ,
332 .shutdown = iSeries_shutdown_IRQ, 303 .shutdown = iseries_shutdown_IRQ,
333 .enable = iSeries_enable_IRQ, 304 .enable = iseries_enable_IRQ,
334 .disable = iSeries_disable_IRQ, 305 .disable = iseries_disable_IRQ,
335 .end = iSeries_end_IRQ 306 .end = iseries_end_IRQ
336}; 307};
337 308
338/* 309/*
339 * This is called out of iSeries_scan_slot to allocate an IRQ for an EADS slot 310 * This is called out of iSeries_scan_slot to allocate an IRQ for an EADS slot
340 * It calculates the irq value for the slot. 311 * It calculates the irq value for the slot.
341 * Note that subBusNumber is always 0 (at the moment at least). 312 * Note that sub_bus is always 0 (at the moment at least).
342 */ 313 */
343int __init iSeries_allocate_IRQ(HvBusNumber busNumber, 314int __init iSeries_allocate_IRQ(HvBusNumber bus,
344 HvSubBusNumber subBusNumber, HvAgentId deviceId) 315 HvSubBusNumber sub_bus, HvAgentId dev_id)
345{ 316{
346 int virtirq; 317 int virtirq;
347 unsigned int realirq; 318 unsigned int realirq;
348 u8 idsel = (deviceId >> 4); 319 u8 idsel = (dev_id >> 4);
349 u8 function = deviceId & 7; 320 u8 function = dev_id & 7;
350 321
351 realirq = ((busNumber - 1) << 6) + ((idsel - 1) << 3) + function; 322 realirq = (((((sub_bus << 8) + (bus - 1)) << 3) + (idsel - 1)) << 3)
323 + function;
352 virtirq = virt_irq_create_mapping(realirq); 324 virtirq = virt_irq_create_mapping(realirq);
353 325
354 irq_desc[virtirq].handler = &iSeries_IRQ_handler; 326 irq_desc[virtirq].handler = &iSeries_IRQ_handler;
355 return virtirq; 327 return virtirq;
356} 328}
329
330#endif /* CONFIG_PCI */
331
332/*
333 * Get the next pending IRQ.
334 */
335int iSeries_get_irq(struct pt_regs *regs)
336{
337 /* -2 means ignore this interrupt */
338 int irq = -2;
339
340#ifdef CONFIG_SMP
341 if (get_lppaca()->int_dword.fields.ipi_cnt) {
342 get_lppaca()->int_dword.fields.ipi_cnt = 0;
343 iSeries_smp_message_recv(regs);
344 }
345#endif /* CONFIG_SMP */
346 if (hvlpevent_is_pending())
347 process_hvlpevents(regs);
348
349#ifdef CONFIG_PCI
350 if (num_pending_irqs) {
351 spin_lock(&pending_irqs_lock);
352 for (irq = 0; irq < NR_IRQS; irq++) {
353 if (pending_irqs[irq]) {
354 pending_irqs[irq]--;
355 num_pending_irqs--;
356 break;
357 }
358 }
359 spin_unlock(&pending_irqs_lock);
360 if (irq >= NR_IRQS)
361 irq = -2;
362 }
363#endif
364
365 return irq;
366}
diff --git a/arch/powerpc/platforms/iseries/irq.h b/arch/powerpc/platforms/iseries/irq.h
index 5f643f16ecc0..b9c801ba5a47 100644
--- a/arch/powerpc/platforms/iseries/irq.h
+++ b/arch/powerpc/platforms/iseries/irq.h
@@ -4,5 +4,6 @@
4extern void iSeries_init_IRQ(void); 4extern void iSeries_init_IRQ(void);
5extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, HvAgentId); 5extern int iSeries_allocate_IRQ(HvBusNumber, HvSubBusNumber, HvAgentId);
6extern void iSeries_activate_IRQs(void); 6extern void iSeries_activate_IRQs(void);
7extern int iSeries_get_irq(struct pt_regs *);
7 8
8#endif /* _ISERIES_IRQ_H */ 9#endif /* _ISERIES_IRQ_H */
diff --git a/arch/powerpc/platforms/iseries/lpardata.c b/arch/powerpc/platforms/iseries/lpardata.c
index bb8c91537f35..438e2dba63b5 100644
--- a/arch/powerpc/platforms/iseries/lpardata.c
+++ b/arch/powerpc/platforms/iseries/lpardata.c
@@ -93,10 +93,7 @@ struct ItLpNaca itLpNaca = {
93 .xPirEnvironMode = 0, /* Piranha stuff */ 93 .xPirEnvironMode = 0, /* Piranha stuff */
94 .xPirConsoleMode = 0, 94 .xPirConsoleMode = 0,
95 .xPirDasdMode = 0, 95 .xPirDasdMode = 0,
96 .xLparInstalled = 0, 96 .flags = 0,
97 .xSysPartitioned = 0,
98 .xHwSyncedTBs = 0,
99 .xIntProcUtilHmt = 0,
100 .xSpVpdFormat = 0, 97 .xSpVpdFormat = 0,
101 .xIntProcRatio = 0, 98 .xIntProcRatio = 0,
102 .xPlicVrmIndex = 0, /* VRM index of PLIC */ 99 .xPlicVrmIndex = 0, /* VRM index of PLIC */
@@ -225,3 +222,10 @@ struct ItVpdAreas itVpdAreas = {
225 0,0 222 0,0
226 } 223 }
227}; 224};
225
226struct ItLpRegSave iseries_reg_save[] = {
227 [0 ... (NR_CPUS-1)] = {
228 .xDesc = 0xd397d9e2, /* "LpRS" */
229 .xSize = sizeof(struct ItLpRegSave),
230 },
231};
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c
index e9fb98bf895f..0b885300d1d1 100644
--- a/arch/powerpc/platforms/iseries/lpevents.c
+++ b/arch/powerpc/platforms/iseries/lpevents.c
@@ -53,7 +53,7 @@ static struct HvLpEvent * get_next_hvlpevent(void)
53 struct HvLpEvent * event; 53 struct HvLpEvent * event;
54 event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; 54 event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr;
55 55
56 if (event->xFlags.xValid) { 56 if (hvlpevent_is_valid(event)) {
57 /* rmb() needed only for weakly consistent machines (regatta) */ 57 /* rmb() needed only for weakly consistent machines (regatta) */
58 rmb(); 58 rmb();
59 /* Set pointer to next potential event */ 59 /* Set pointer to next potential event */
@@ -84,7 +84,7 @@ int hvlpevent_is_pending(void)
84 84
85 next_event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr; 85 next_event = (struct HvLpEvent *)hvlpevent_queue.xSlicCurEventPtr;
86 86
87 return next_event->xFlags.xValid | 87 return hvlpevent_is_valid(next_event) ||
88 hvlpevent_queue.xPlicOverflowIntPending; 88 hvlpevent_queue.xPlicOverflowIntPending;
89} 89}
90 90
@@ -101,18 +101,18 @@ static void hvlpevent_clear_valid(struct HvLpEvent * event)
101 switch (extra) { 101 switch (extra) {
102 case 3: 102 case 3:
103 tmp = (struct HvLpEvent*)((char*)event + 3 * LpEventAlign); 103 tmp = (struct HvLpEvent*)((char*)event + 3 * LpEventAlign);
104 tmp->xFlags.xValid = 0; 104 hvlpevent_invalidate(tmp);
105 case 2: 105 case 2:
106 tmp = (struct HvLpEvent*)((char*)event + 2 * LpEventAlign); 106 tmp = (struct HvLpEvent*)((char*)event + 2 * LpEventAlign);
107 tmp->xFlags.xValid = 0; 107 hvlpevent_invalidate(tmp);
108 case 1: 108 case 1:
109 tmp = (struct HvLpEvent*)((char*)event + 1 * LpEventAlign); 109 tmp = (struct HvLpEvent*)((char*)event + 1 * LpEventAlign);
110 tmp->xFlags.xValid = 0; 110 hvlpevent_invalidate(tmp);
111 } 111 }
112 112
113 mb(); 113 mb();
114 114
115 event->xFlags.xValid = 0; 115 hvlpevent_invalidate(event);
116} 116}
117 117
118void process_hvlpevents(struct pt_regs *regs) 118void process_hvlpevents(struct pt_regs *regs)
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index 49e7e4b85847..a41d8b78c0cd 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -251,10 +251,7 @@ static struct pending_event *new_pending_event(void)
251 } 251 }
252 memset(ev, 0, sizeof(struct pending_event)); 252 memset(ev, 0, sizeof(struct pending_event));
253 hev = &ev->event.hp_lp_event; 253 hev = &ev->event.hp_lp_event;
254 hev->xFlags.xValid = 1; 254 hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DO_ACK | HV_LP_EVENT_INT;
255 hev->xFlags.xAckType = HvLpEvent_AckType_ImmediateAck;
256 hev->xFlags.xAckInd = HvLpEvent_AckInd_DoAck;
257 hev->xFlags.xFunction = HvLpEvent_Function_Int;
258 hev->xType = HvLpEvent_Type_MachineFac; 255 hev->xType = HvLpEvent_Type_MachineFac;
259 hev->xSourceLp = HvLpConfig_getLpIndex(); 256 hev->xSourceLp = HvLpConfig_getLpIndex();
260 hev->xTargetLp = primary_lp; 257 hev->xTargetLp = primary_lp;
@@ -518,17 +515,10 @@ static void handle_ack(struct io_mf_lp_event *event)
518static void hv_handler(struct HvLpEvent *event, struct pt_regs *regs) 515static void hv_handler(struct HvLpEvent *event, struct pt_regs *regs)
519{ 516{
520 if ((event != NULL) && (event->xType == HvLpEvent_Type_MachineFac)) { 517 if ((event != NULL) && (event->xType == HvLpEvent_Type_MachineFac)) {
521 switch(event->xFlags.xFunction) { 518 if (hvlpevent_is_ack(event))
522 case HvLpEvent_Function_Ack:
523 handle_ack((struct io_mf_lp_event *)event); 519 handle_ack((struct io_mf_lp_event *)event);
524 break; 520 else
525 case HvLpEvent_Function_Int:
526 handle_int((struct io_mf_lp_event *)event); 521 handle_int((struct io_mf_lp_event *)event);
527 break;
528 default:
529 printk(KERN_ERR "mf.c: non ack/int event received\n");
530 break;
531 }
532 } else 522 } else
533 printk(KERN_ERR "mf.c: alien event received\n"); 523 printk(KERN_ERR "mf.c: alien event received\n");
534} 524}
diff --git a/arch/powerpc/platforms/iseries/misc.S b/arch/powerpc/platforms/iseries/misc.S
index dfe7aa1ba098..7641fc7e550a 100644
--- a/arch/powerpc/platforms/iseries/misc.S
+++ b/arch/powerpc/platforms/iseries/misc.S
@@ -44,7 +44,8 @@ _GLOBAL(local_irq_restore)
44 /* Check pending interrupts */ 44 /* Check pending interrupts */
45 /* A decrementer, IPI or PMC interrupt may have occurred 45 /* A decrementer, IPI or PMC interrupt may have occurred
46 * while we were in the hypervisor (which enables) */ 46 * while we were in the hypervisor (which enables) */
47 ld r4,PACALPPACA+LPPACAANYINT(r13) 47 ld r4,PACALPPACAPTR(r13)
48 ld r4,LPPACAANYINT(r4)
48 cmpdi r4,0 49 cmpdi r4,0
49 beqlr 50 beqlr
50 51
diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index dafc518fbb83..a19833b880e4 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -43,6 +43,7 @@
43#include "irq.h" 43#include "irq.h"
44#include "pci.h" 44#include "pci.h"
45#include "call_pci.h" 45#include "call_pci.h"
46#include "iommu.h"
46 47
47extern unsigned long io_page_mask; 48extern unsigned long io_page_mask;
48 49
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index da26639190db..3f8790146b00 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -52,6 +52,7 @@
52#include <asm/iseries/mf.h> 52#include <asm/iseries/mf.h>
53#include <asm/iseries/hv_lp_event.h> 53#include <asm/iseries/hv_lp_event.h>
54#include <asm/iseries/lpar_map.h> 54#include <asm/iseries/lpar_map.h>
55#include <asm/udbg.h>
55 56
56#include "naca.h" 57#include "naca.h"
57#include "setup.h" 58#include "setup.h"
@@ -62,10 +63,8 @@
62#include "call_sm.h" 63#include "call_sm.h"
63#include "call_hpt.h" 64#include "call_hpt.h"
64 65
65extern void hvlog(char *fmt, ...);
66
67#ifdef DEBUG 66#ifdef DEBUG
68#define DBG(fmt...) hvlog(fmt) 67#define DBG(fmt...) udbg_printf(fmt)
69#else 68#else
70#define DBG(fmt...) 69#define DBG(fmt...)
71#endif 70#endif
@@ -474,14 +473,6 @@ static unsigned long __init build_iSeries_Memory_Map(void)
474 printk("HPT absolute addr = %016lx, size = %dK\n", 473 printk("HPT absolute addr = %016lx, size = %dK\n",
475 chunk_to_addr(hptFirstChunk), hptSizeChunks * 256); 474 chunk_to_addr(hptFirstChunk), hptSizeChunks * 256);
476 475
477 ppc64_pft_size = __ilog2(hptSizePages * HW_PAGE_SIZE);
478
479 /*
480 * The actual hashed page table is in the hypervisor,
481 * we have no direct access
482 */
483 htab_address = NULL;
484
485 /* 476 /*
486 * Determine if absolute memory has any 477 * Determine if absolute memory has any
487 * holes so that we can interpret the 478 * holes so that we can interpret the
@@ -547,7 +538,7 @@ static unsigned long __init build_iSeries_Memory_Map(void)
547 */ 538 */
548static void __init iSeries_setup_arch(void) 539static void __init iSeries_setup_arch(void)
549{ 540{
550 if (get_paca()->lppaca.shared_proc) { 541 if (get_lppaca()->shared_proc) {
551 ppc_md.idle_loop = iseries_shared_idle; 542 ppc_md.idle_loop = iseries_shared_idle;
552 printk(KERN_INFO "Using shared processor idle loop\n"); 543 printk(KERN_INFO "Using shared processor idle loop\n");
553 } else { 544 } else {
@@ -571,16 +562,6 @@ static void iSeries_show_cpuinfo(struct seq_file *m)
571 562
572/* 563/*
573 * Document me. 564 * Document me.
574 * and Implement me.
575 */
576static int iSeries_get_irq(struct pt_regs *regs)
577{
578 /* -2 means ignore this interrupt */
579 return -2;
580}
581
582/*
583 * Document me.
584 */ 565 */
585static void iSeries_restart(char *cmd) 566static void iSeries_restart(char *cmd)
586{ 567{
@@ -666,7 +647,7 @@ static void yield_shared_processor(void)
666 * The decrementer stops during the yield. Force a fake decrementer 647 * The decrementer stops during the yield. Force a fake decrementer
667 * here and let the timer_interrupt code sort out the actual time. 648 * here and let the timer_interrupt code sort out the actual time.
668 */ 649 */
669 get_paca()->lppaca.int_dword.fields.decr_int = 1; 650 get_lppaca()->int_dword.fields.decr_int = 1;
670 process_iSeries_events(); 651 process_iSeries_events();
671} 652}
672 653
@@ -871,6 +852,11 @@ void dt_prop_u64_list(struct iseries_flat_dt *dt, char *name, u64 *data, int n)
871 dt_prop(dt, name, (char *)data, sizeof(u64) * n); 852 dt_prop(dt, name, (char *)data, sizeof(u64) * n);
872} 853}
873 854
855void dt_prop_u32_list(struct iseries_flat_dt *dt, char *name, u32 *data, int n)
856{
857 dt_prop(dt, name, (char *)data, sizeof(u32) * n);
858}
859
874void dt_prop_empty(struct iseries_flat_dt *dt, char *name) 860void dt_prop_empty(struct iseries_flat_dt *dt, char *name)
875{ 861{
876 dt_prop(dt, name, NULL, 0); 862 dt_prop(dt, name, NULL, 0);
@@ -882,6 +868,7 @@ void dt_cpus(struct iseries_flat_dt *dt)
882 unsigned char *p; 868 unsigned char *p;
883 unsigned int i, index; 869 unsigned int i, index;
884 struct IoHriProcessorVpd *d; 870 struct IoHriProcessorVpd *d;
871 u32 pft_size[2];
885 872
886 /* yuck */ 873 /* yuck */
887 snprintf(buf, 32, "PowerPC,%s", cur_cpu_spec->cpu_name); 874 snprintf(buf, 32, "PowerPC,%s", cur_cpu_spec->cpu_name);
@@ -892,8 +879,11 @@ void dt_cpus(struct iseries_flat_dt *dt)
892 dt_prop_u32(dt, "#address-cells", 1); 879 dt_prop_u32(dt, "#address-cells", 1);
893 dt_prop_u32(dt, "#size-cells", 0); 880 dt_prop_u32(dt, "#size-cells", 0);
894 881
882 pft_size[0] = 0; /* NUMA CEC cookie, 0 for non NUMA */
883 pft_size[1] = __ilog2(HvCallHpt_getHptPages() * HW_PAGE_SIZE);
884
895 for (i = 0; i < NR_CPUS; i++) { 885 for (i = 0; i < NR_CPUS; i++) {
896 if (paca[i].lppaca.dyn_proc_status >= 2) 886 if (lppaca[i].dyn_proc_status >= 2)
897 continue; 887 continue;
898 888
899 snprintf(p, 32 - (p - buf), "@%d", i); 889 snprintf(p, 32 - (p - buf), "@%d", i);
@@ -901,7 +891,7 @@ void dt_cpus(struct iseries_flat_dt *dt)
901 891
902 dt_prop_str(dt, "device_type", "cpu"); 892 dt_prop_str(dt, "device_type", "cpu");
903 893
904 index = paca[i].lppaca.dyn_hv_phys_proc_index; 894 index = lppaca[i].dyn_hv_phys_proc_index;
905 d = &xIoHriProcessorVpd[index]; 895 d = &xIoHriProcessorVpd[index];
906 896
907 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024); 897 dt_prop_u32(dt, "i-cache-size", d->xInstCacheSize * 1024);
@@ -918,6 +908,8 @@ void dt_cpus(struct iseries_flat_dt *dt)
918 908
919 dt_prop_u32(dt, "reg", i); 909 dt_prop_u32(dt, "reg", i);
920 910
911 dt_prop_u32_list(dt, "ibm,pft-size", pft_size, 2);
912
921 dt_end_node(dt); 913 dt_end_node(dt);
922 } 914 }
923 915
@@ -994,3 +986,16 @@ static int __init early_parsemem(char *p)
994 return 0; 986 return 0;
995} 987}
996early_param("mem", early_parsemem); 988early_param("mem", early_parsemem);
989
990static void hvputc(char c)
991{
992 if (c == '\n')
993 hvputc('\r');
994
995 HvCall_writeLogBuffer(&c, 1);
996}
997
998void __init udbg_init_iseries(void)
999{
1000 udbg_putc = hvputc;
1001}
diff --git a/arch/powerpc/platforms/iseries/smp.c b/arch/powerpc/platforms/iseries/smp.c
index fcb094ec6aec..6f9d407a709f 100644
--- a/arch/powerpc/platforms/iseries/smp.c
+++ b/arch/powerpc/platforms/iseries/smp.c
@@ -91,7 +91,7 @@ static void smp_iSeries_kick_cpu(int nr)
91 BUG_ON((nr < 0) || (nr >= NR_CPUS)); 91 BUG_ON((nr < 0) || (nr >= NR_CPUS));
92 92
93 /* Verify that our partition has a processor nr */ 93 /* Verify that our partition has a processor nr */
94 if (paca[nr].lppaca.dyn_proc_status >= 2) 94 if (lppaca[nr].dyn_proc_status >= 2)
95 return; 95 return;
96 96
97 /* The processor is currently spinning, waiting 97 /* The processor is currently spinning, waiting
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c
index 384360ee06ec..ad36ab0639f0 100644
--- a/arch/powerpc/platforms/iseries/vio.c
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -22,6 +22,8 @@
22#include <asm/iseries/hv_lp_config.h> 22#include <asm/iseries/hv_lp_config.h>
23#include <asm/iseries/hv_call_xm.h> 23#include <asm/iseries/hv_call_xm.h>
24 24
25#include "iommu.h"
26
25struct device *iSeries_vio_dev = &vio_bus_device.dev; 27struct device *iSeries_vio_dev = &vio_bus_device.dev;
26EXPORT_SYMBOL(iSeries_vio_dev); 28EXPORT_SYMBOL(iSeries_vio_dev);
27 29
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c
index 842672695598..622a30149b48 100644
--- a/arch/powerpc/platforms/iseries/viopath.c
+++ b/arch/powerpc/platforms/iseries/viopath.c
@@ -270,7 +270,7 @@ static void handleMonitorEvent(struct HvLpEvent *event)
270 * First see if this is just a normal monitor message from the 270 * First see if this is just a normal monitor message from the
271 * other partition 271 * other partition
272 */ 272 */
273 if (event->xFlags.xFunction == HvLpEvent_Function_Int) { 273 if (hvlpevent_is_int(event)) {
274 remoteLp = event->xSourceLp; 274 remoteLp = event->xSourceLp;
275 if (!viopathStatus[remoteLp].isActive) 275 if (!viopathStatus[remoteLp].isActive)
276 sendMonMsg(remoteLp); 276 sendMonMsg(remoteLp);
@@ -331,13 +331,12 @@ static void handleConfig(struct HvLpEvent *event)
331{ 331{
332 if (!event) 332 if (!event)
333 return; 333 return;
334 if (event->xFlags.xFunction == HvLpEvent_Function_Int) { 334 if (hvlpevent_is_int(event)) {
335 printk(VIOPATH_KERN_WARN 335 printk(VIOPATH_KERN_WARN
336 "unexpected config request from partition %d", 336 "unexpected config request from partition %d",
337 event->xSourceLp); 337 event->xSourceLp);
338 338
339 if ((event->xFlags.xFunction == HvLpEvent_Function_Int) && 339 if (hvlpevent_need_ack(event)) {
340 (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck)) {
341 event->xRc = HvLpEvent_Rc_InvalidSubtype; 340 event->xRc = HvLpEvent_Rc_InvalidSubtype;
342 HvCallEvent_ackLpEvent(event); 341 HvCallEvent_ackLpEvent(event);
343 } 342 }
@@ -377,7 +376,7 @@ static void vio_handleEvent(struct HvLpEvent *event, struct pt_regs *regs)
377 int subtype = (event->xSubtype & VIOMAJOR_SUBTYPE_MASK) 376 int subtype = (event->xSubtype & VIOMAJOR_SUBTYPE_MASK)
378 >> VIOMAJOR_SUBTYPE_SHIFT; 377 >> VIOMAJOR_SUBTYPE_SHIFT;
379 378
380 if (event->xFlags.xFunction == HvLpEvent_Function_Int) { 379 if (hvlpevent_is_int(event)) {
381 remoteLp = event->xSourceLp; 380 remoteLp = event->xSourceLp;
382 /* 381 /*
383 * The isActive is checked because if the hosting partition 382 * The isActive is checked because if the hosting partition
@@ -436,8 +435,7 @@ static void vio_handleEvent(struct HvLpEvent *event, struct pt_regs *regs)
436 "unexpected virtual io event subtype %d from partition %d\n", 435 "unexpected virtual io event subtype %d from partition %d\n",
437 event->xSubtype, remoteLp); 436 event->xSubtype, remoteLp);
438 /* No handler. Ack if necessary */ 437 /* No handler. Ack if necessary */
439 if ((event->xFlags.xFunction == HvLpEvent_Function_Int) && 438 if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) {
440 (event->xFlags.xAckInd == HvLpEvent_AckInd_DoAck)) {
441 event->xRc = HvLpEvent_Rc_InvalidSubtype; 439 event->xRc = HvLpEvent_Rc_InvalidSubtype;
442 HvCallEvent_ackLpEvent(event); 440 HvCallEvent_ackLpEvent(event);
443 } 441 }
diff --git a/arch/powerpc/platforms/maple/pci.c b/arch/powerpc/platforms/maple/pci.c
index f40451da037c..7d4099a34f92 100644
--- a/arch/powerpc/platforms/maple/pci.c
+++ b/arch/powerpc/platforms/maple/pci.c
@@ -316,7 +316,6 @@ static int __init add_bridge(struct device_node *dev)
316 char* disp_name; 316 char* disp_name;
317 int *bus_range; 317 int *bus_range;
318 int primary = 1; 318 int primary = 1;
319 struct property *of_prop;
320 319
321 DBG("Adding PCI host bridge %s\n", dev->full_name); 320 DBG("Adding PCI host bridge %s\n", dev->full_name);
322 321
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index 7ece8983a105..ec5c1e10c407 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -51,6 +51,7 @@
51#include <asm/pgtable.h> 51#include <asm/pgtable.h>
52#include <asm/bitops.h> 52#include <asm/bitops.h>
53#include <asm/io.h> 53#include <asm/io.h>
54#include <asm/kexec.h>
54#include <asm/pci-bridge.h> 55#include <asm/pci-bridge.h>
55#include <asm/iommu.h> 56#include <asm/iommu.h>
56#include <asm/machdep.h> 57#include <asm/machdep.h>
@@ -70,41 +71,60 @@
70#define DBG(fmt...) 71#define DBG(fmt...)
71#endif 72#endif
72 73
73extern void generic_find_legacy_serial_ports(u64 *physport, 74static unsigned long maple_find_nvram_base(void)
74 unsigned int *default_speed); 75{
76 struct device_node *rtcs;
77 unsigned long result = 0;
78
79 /* find NVRAM device */
80 rtcs = of_find_compatible_node(NULL, "nvram", "AMD8111");
81 if (rtcs) {
82 struct resource r;
83 if (of_address_to_resource(rtcs, 0, &r)) {
84 printk(KERN_EMERG "Maple: Unable to translate NVRAM"
85 " address\n");
86 goto bail;
87 }
88 if (!(r.flags & IORESOURCE_IO)) {
89 printk(KERN_EMERG "Maple: NVRAM address isn't PIO!\n");
90 goto bail;
91 }
92 result = r.start;
93 } else
94 printk(KERN_EMERG "Maple: Unable to find NVRAM\n");
95 bail:
96 of_node_put(rtcs);
97 return result;
98}
75 99
76static void maple_restart(char *cmd) 100static void maple_restart(char *cmd)
77{ 101{
78 unsigned int maple_nvram_base; 102 unsigned int maple_nvram_base;
79 unsigned int maple_nvram_offset; 103 unsigned int maple_nvram_offset;
80 unsigned int maple_nvram_command; 104 unsigned int maple_nvram_command;
81 struct device_node *rtcs; 105 struct device_node *sp;
82 106
83 /* find NVRAM device */ 107 maple_nvram_base = maple_find_nvram_base();
84 rtcs = find_compatible_devices("nvram", "AMD8111"); 108 if (maple_nvram_base == 0)
85 if (rtcs && rtcs->addrs) { 109 goto fail;
86 maple_nvram_base = rtcs->addrs[0].address;
87 } else {
88 printk(KERN_EMERG "Maple: Unable to find NVRAM\n");
89 printk(KERN_EMERG "Maple: Manual Restart Required\n");
90 return;
91 }
92 110
93 /* find service processor device */ 111 /* find service processor device */
94 rtcs = find_devices("service-processor"); 112 sp = of_find_node_by_name(NULL, "service-processor");
95 if (!rtcs) { 113 if (!sp) {
96 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 114 printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
97 printk(KERN_EMERG "Maple: Manual Restart Required\n"); 115 goto fail;
98 return;
99 } 116 }
100 maple_nvram_offset = *(unsigned int*) get_property(rtcs, 117 maple_nvram_offset = *(unsigned int*) get_property(sp,
101 "restart-addr", NULL); 118 "restart-addr", NULL);
102 maple_nvram_command = *(unsigned int*) get_property(rtcs, 119 maple_nvram_command = *(unsigned int*) get_property(sp,
103 "restart-value", NULL); 120 "restart-value", NULL);
121 of_node_put(sp);
104 122
105 /* send command */ 123 /* send command */
106 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 124 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
107 for (;;) ; 125 for (;;) ;
126 fail:
127 printk(KERN_EMERG "Maple: Manual Restart Required\n");
108} 128}
109 129
110static void maple_power_off(void) 130static void maple_power_off(void)
@@ -112,33 +132,29 @@ static void maple_power_off(void)
112 unsigned int maple_nvram_base; 132 unsigned int maple_nvram_base;
113 unsigned int maple_nvram_offset; 133 unsigned int maple_nvram_offset;
114 unsigned int maple_nvram_command; 134 unsigned int maple_nvram_command;
115 struct device_node *rtcs; 135 struct device_node *sp;
116 136
117 /* find NVRAM device */ 137 maple_nvram_base = maple_find_nvram_base();
118 rtcs = find_compatible_devices("nvram", "AMD8111"); 138 if (maple_nvram_base == 0)
119 if (rtcs && rtcs->addrs) { 139 goto fail;
120 maple_nvram_base = rtcs->addrs[0].address;
121 } else {
122 printk(KERN_EMERG "Maple: Unable to find NVRAM\n");
123 printk(KERN_EMERG "Maple: Manual Power-Down Required\n");
124 return;
125 }
126 140
127 /* find service processor device */ 141 /* find service processor device */
128 rtcs = find_devices("service-processor"); 142 sp = of_find_node_by_name(NULL, "service-processor");
129 if (!rtcs) { 143 if (!sp) {
130 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 144 printk(KERN_EMERG "Maple: Unable to find Service Processor\n");
131 printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); 145 goto fail;
132 return;
133 } 146 }
134 maple_nvram_offset = *(unsigned int*) get_property(rtcs, 147 maple_nvram_offset = *(unsigned int*) get_property(sp,
135 "power-off-addr", NULL); 148 "power-off-addr", NULL);
136 maple_nvram_command = *(unsigned int*) get_property(rtcs, 149 maple_nvram_command = *(unsigned int*) get_property(sp,
137 "power-off-value", NULL); 150 "power-off-value", NULL);
151 of_node_put(sp);
138 152
139 /* send command */ 153 /* send command */
140 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 154 outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset);
141 for (;;) ; 155 for (;;) ;
156 fail:
157 printk(KERN_EMERG "Maple: Manual Power-Down Required\n");
142} 158}
143 159
144static void maple_halt(void) 160static void maple_halt(void)
@@ -181,9 +197,6 @@ void __init maple_setup_arch(void)
181 */ 197 */
182static void __init maple_init_early(void) 198static void __init maple_init_early(void)
183{ 199{
184 unsigned int default_speed;
185 u64 physport;
186
187 DBG(" -> maple_init_early\n"); 200 DBG(" -> maple_init_early\n");
188 201
189 /* Initialize hash table, from now on, we can take hash faults 202 /* Initialize hash table, from now on, we can take hash faults
@@ -191,24 +204,10 @@ static void __init maple_init_early(void)
191 */ 204 */
192 hpte_init_native(); 205 hpte_init_native();
193 206
194 /* Find the serial port */
195 generic_find_legacy_serial_ports(&physport, &default_speed);
196
197 DBG("phys port addr: %lx\n", (long)physport);
198
199 if (physport) {
200 void *comport;
201 /* Map the uart for udbg. */
202 comport = (void *)ioremap(physport, 16);
203 udbg_init_uart(comport, default_speed);
204
205 DBG("Hello World !\n");
206 }
207
208 /* Setup interrupt mapping options */ 207 /* Setup interrupt mapping options */
209 ppc64_interrupt_controller = IC_OPEN_PIC; 208 ppc64_interrupt_controller = IC_OPEN_PIC;
210 209
211 iommu_init_early_u3(); 210 iommu_init_early_dart();
212 211
213 DBG(" <- maple_init_early\n"); 212 DBG(" <- maple_init_early\n");
214} 213}
@@ -270,7 +269,7 @@ static int __init maple_probe(int platform)
270 * occupies having to be broken up so the DART itself is not 269 * occupies having to be broken up so the DART itself is not
271 * part of the cacheable linar mapping 270 * part of the cacheable linar mapping
272 */ 271 */
273 alloc_u3_dart_table(); 272 alloc_dart_table();
274 273
275 return 1; 274 return 1;
276} 275}
@@ -292,4 +291,9 @@ struct machdep_calls __initdata maple_md = {
292 .calibrate_decr = generic_calibrate_decr, 291 .calibrate_decr = generic_calibrate_decr,
293 .progress = maple_progress, 292 .progress = maple_progress,
294 .idle_loop = native_idle, 293 .idle_loop = native_idle,
294#ifdef CONFIG_KEXEC
295 .machine_kexec = default_machine_kexec,
296 .machine_kexec_prepare = default_machine_kexec_prepare,
297 .machine_crash_shutdown = default_machine_crash_shutdown,
298#endif
295}; 299};
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c
index 15846cc938ac..50bc4eb85353 100644
--- a/arch/powerpc/platforms/maple/time.c
+++ b/arch/powerpc/platforms/maple/time.c
@@ -168,11 +168,24 @@ unsigned long __init maple_get_boot_time(void)
168 struct rtc_time tm; 168 struct rtc_time tm;
169 struct device_node *rtcs; 169 struct device_node *rtcs;
170 170
171 rtcs = find_compatible_devices("rtc", "pnpPNP,b00"); 171 rtcs = of_find_compatible_node(NULL, "rtc", "pnpPNP,b00");
172 if (rtcs && rtcs->addrs) { 172 if (rtcs) {
173 maple_rtc_addr = rtcs->addrs[0].address; 173 struct resource r;
174 printk(KERN_INFO "Maple: Found RTC at 0x%x\n", maple_rtc_addr); 174 if (of_address_to_resource(rtcs, 0, &r)) {
175 } else { 175 printk(KERN_EMERG "Maple: Unable to translate RTC"
176 " address\n");
177 goto bail;
178 }
179 if (!(r.flags & IORESOURCE_IO)) {
180 printk(KERN_EMERG "Maple: RTC address isn't PIO!\n");
181 goto bail;
182 }
183 maple_rtc_addr = r.start;
184 printk(KERN_INFO "Maple: Found RTC at IO 0x%x\n",
185 maple_rtc_addr);
186 }
187 bail:
188 if (maple_rtc_addr == 0) {
176 maple_rtc_addr = RTC_PORT(0); /* legacy address */ 189 maple_rtc_addr = RTC_PORT(0); /* legacy address */
177 printk(KERN_INFO "Maple: No device node for RTC, assuming " 190 printk(KERN_INFO "Maple: No device node for RTC, assuming "
178 "legacy address (0x%x)\n", maple_rtc_addr); 191 "legacy address (0x%x)\n", maple_rtc_addr);
diff --git a/arch/powerpc/platforms/powermac/Makefile b/arch/powerpc/platforms/powermac/Makefile
index c9df44fcf571..78093d7f97af 100644
--- a/arch/powerpc/platforms/powermac/Makefile
+++ b/arch/powerpc/platforms/powermac/Makefile
@@ -1,9 +1,14 @@
1CFLAGS_bootx_init.o += -fPIC
2
1obj-y += pic.o setup.o time.o feature.o pci.o \ 3obj-y += pic.o setup.o time.o feature.o pci.o \
2 sleep.o low_i2c.o cache.o 4 sleep.o low_i2c.o cache.o pfunc_core.o \
5 pfunc_base.o
3obj-$(CONFIG_PMAC_BACKLIGHT) += backlight.o 6obj-$(CONFIG_PMAC_BACKLIGHT) += backlight.o
4obj-$(CONFIG_CPU_FREQ_PMAC) += cpufreq_32.o 7obj-$(CONFIG_CPU_FREQ_PMAC) += cpufreq_32.o
5obj-$(CONFIG_CPU_FREQ_PMAC64) += cpufreq_64.o 8obj-$(CONFIG_CPU_FREQ_PMAC64) += cpufreq_64.o
6obj-$(CONFIG_NVRAM) += nvram.o 9obj-$(CONFIG_NVRAM) += nvram.o
7# ppc64 pmac doesn't define CONFIG_NVRAM but needs nvram stuff 10# ppc64 pmac doesn't define CONFIG_NVRAM but needs nvram stuff
8obj-$(CONFIG_PPC64) += nvram.o 11obj-$(CONFIG_PPC64) += nvram.o
12obj-$(CONFIG_PPC32) += bootx_init.o
9obj-$(CONFIG_SMP) += smp.o 13obj-$(CONFIG_SMP) += smp.o
14obj-$(CONFIG_PPC_MERGE) += udbg_scc.o udbg_adb.o
diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
new file mode 100644
index 000000000000..fa8b4d7b5ded
--- /dev/null
+++ b/arch/powerpc/platforms/powermac/bootx_init.c
@@ -0,0 +1,547 @@
1/*
2 * Early boot support code for BootX bootloader
3 *
4 * Copyright (C) 2005 Ben. Herrenschmidt (benh@kernel.crashing.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/config.h>
13#include <linux/kernel.h>
14#include <linux/string.h>
15#include <linux/init.h>
16#include <linux/version.h>
17#include <asm/sections.h>
18#include <asm/prom.h>
19#include <asm/page.h>
20#include <asm/bootx.h>
21#include <asm/bootinfo.h>
22#include <asm/btext.h>
23#include <asm/io.h>
24
25#undef DEBUG
26#define SET_BOOT_BAT
27
28#ifdef DEBUG
29#define DBG(fmt...) do { bootx_printf(fmt); } while(0)
30#else
31#define DBG(fmt...) do { } while(0)
32#endif
33
34extern void __start(unsigned long r3, unsigned long r4, unsigned long r5);
35
36static unsigned long __initdata bootx_dt_strbase;
37static unsigned long __initdata bootx_dt_strend;
38static unsigned long __initdata bootx_node_chosen;
39static boot_infos_t * __initdata bootx_info;
40static char __initdata bootx_disp_path[256];
41
42/* Is boot-info compatible ? */
43#define BOOT_INFO_IS_COMPATIBLE(bi) \
44 ((bi)->compatible_version <= BOOT_INFO_VERSION)
45#define BOOT_INFO_IS_V2_COMPATIBLE(bi) ((bi)->version >= 2)
46#define BOOT_INFO_IS_V4_COMPATIBLE(bi) ((bi)->version >= 4)
47
48#ifdef CONFIG_BOOTX_TEXT
49static void __init bootx_printf(const char *format, ...)
50{
51 const char *p, *q, *s;
52 va_list args;
53 unsigned long v;
54
55 va_start(args, format);
56 for (p = format; *p != 0; p = q) {
57 for (q = p; *q != 0 && *q != '\n' && *q != '%'; ++q)
58 ;
59 if (q > p)
60 btext_drawtext(p, q - p);
61 if (*q == 0)
62 break;
63 if (*q == '\n') {
64 ++q;
65 btext_flushline();
66 btext_drawstring("\r\n");
67 btext_flushline();
68 continue;
69 }
70 ++q;
71 if (*q == 0)
72 break;
73 switch (*q) {
74 case 's':
75 ++q;
76 s = va_arg(args, const char *);
77 if (s == NULL)
78 s = "<NULL>";
79 btext_drawstring(s);
80 break;
81 case 'x':
82 ++q;
83 v = va_arg(args, unsigned long);
84 btext_drawhex(v);
85 break;
86 }
87 }
88}
89#else /* CONFIG_BOOTX_TEXT */
90static void __init bootx_printf(const char *format, ...) {}
91#endif /* CONFIG_BOOTX_TEXT */
92
93static void * __init bootx_early_getprop(unsigned long base,
94 unsigned long node,
95 char *prop)
96{
97 struct bootx_dt_node *np = (struct bootx_dt_node *)(base + node);
98 u32 *ppp = &np->properties;
99
100 while(*ppp) {
101 struct bootx_dt_prop *pp =
102 (struct bootx_dt_prop *)(base + *ppp);
103
104 if (strcmp((char *)((unsigned long)pp->name + base),
105 prop) == 0) {
106 return (void *)((unsigned long)pp->value + base);
107 }
108 ppp = &pp->next;
109 }
110 return NULL;
111}
112
113#define dt_push_token(token, mem) \
114 do { \
115 *(mem) = _ALIGN_UP(*(mem),4); \
116 *((u32 *)*(mem)) = token; \
117 *(mem) += 4; \
118 } while(0)
119
120static unsigned long __init bootx_dt_find_string(char *str)
121{
122 char *s, *os;
123
124 s = os = (char *)bootx_dt_strbase;
125 s += 4;
126 while (s < (char *)bootx_dt_strend) {
127 if (strcmp(s, str) == 0)
128 return s - os;
129 s += strlen(s) + 1;
130 }
131 return 0;
132}
133
134static void __init bootx_dt_add_prop(char *name, void *data, int size,
135 unsigned long *mem_end)
136{
137 unsigned long soff = bootx_dt_find_string(name);
138 if (data == NULL)
139 size = 0;
140 if (soff == 0) {
141 bootx_printf("WARNING: Can't find string index for <%s>\n",
142 name);
143 return;
144 }
145 if (size > 0x20000) {
146 bootx_printf("WARNING: ignoring large property ");
147 bootx_printf("%s length 0x%x\n", name, size);
148 return;
149 }
150 dt_push_token(OF_DT_PROP, mem_end);
151 dt_push_token(size, mem_end);
152 dt_push_token(soff, mem_end);
153
154 /* push property content */
155 if (size && data) {
156 memcpy((void *)*mem_end, data, size);
157 *mem_end = _ALIGN_UP(*mem_end + size, 4);
158 }
159}
160
161static void __init bootx_add_chosen_props(unsigned long base,
162 unsigned long *mem_end)
163{
164 u32 val = _MACH_Pmac;
165
166 bootx_dt_add_prop("linux,platform", &val, 4, mem_end);
167
168 if (bootx_info->kernelParamsOffset) {
169 char *args = (char *)((unsigned long)bootx_info) +
170 bootx_info->kernelParamsOffset;
171 bootx_dt_add_prop("bootargs", args, strlen(args) + 1, mem_end);
172 }
173 if (bootx_info->ramDisk) {
174 val = ((unsigned long)bootx_info) + bootx_info->ramDisk;
175 bootx_dt_add_prop("linux,initrd-start", &val, 4, mem_end);
176 val += bootx_info->ramDiskSize;
177 bootx_dt_add_prop("linux,initrd-end", &val, 4, mem_end);
178 }
179 if (strlen(bootx_disp_path))
180 bootx_dt_add_prop("linux,stdout-path", bootx_disp_path,
181 strlen(bootx_disp_path) + 1, mem_end);
182}
183
184static void __init bootx_add_display_props(unsigned long base,
185 unsigned long *mem_end)
186{
187 bootx_dt_add_prop("linux,boot-display", NULL, 0, mem_end);
188 bootx_dt_add_prop("linux,opened", NULL, 0, mem_end);
189}
190
191static void __init bootx_dt_add_string(char *s, unsigned long *mem_end)
192{
193 unsigned int l = strlen(s) + 1;
194 memcpy((void *)*mem_end, s, l);
195 bootx_dt_strend = *mem_end = *mem_end + l;
196}
197
198static void __init bootx_scan_dt_build_strings(unsigned long base,
199 unsigned long node,
200 unsigned long *mem_end)
201{
202 struct bootx_dt_node *np = (struct bootx_dt_node *)(base + node);
203 u32 *cpp, *ppp = &np->properties;
204 unsigned long soff;
205 char *namep;
206
207 /* Keep refs to known nodes */
208 namep = np->full_name ? (char *)(base + np->full_name) : NULL;
209 if (namep == NULL) {
210 bootx_printf("Node without a full name !\n");
211 namep = "";
212 }
213 DBG("* strings: %s\n", namep);
214
215 if (!strcmp(namep, "/chosen")) {
216 DBG(" detected /chosen ! adding properties names !\n");
217 bootx_dt_add_string("linux,platform", mem_end);
218 bootx_dt_add_string("linux,stdout-path", mem_end);
219 bootx_dt_add_string("linux,initrd-start", mem_end);
220 bootx_dt_add_string("linux,initrd-end", mem_end);
221 bootx_dt_add_string("bootargs", mem_end);
222 bootx_node_chosen = node;
223 }
224 if (node == bootx_info->dispDeviceRegEntryOffset) {
225 DBG(" detected display ! adding properties names !\n");
226 bootx_dt_add_string("linux,boot-display", mem_end);
227 bootx_dt_add_string("linux,opened", mem_end);
228 strncpy(bootx_disp_path, namep, 255);
229 }
230
231 /* get and store all property names */
232 while (*ppp) {
233 struct bootx_dt_prop *pp =
234 (struct bootx_dt_prop *)(base + *ppp);
235
236 namep = pp->name ? (char *)(base + pp->name) : NULL;
237 if (namep == NULL || strcmp(namep, "name") == 0)
238 goto next;
239 /* get/create string entry */
240 soff = bootx_dt_find_string(namep);
241 if (soff == 0)
242 bootx_dt_add_string(namep, mem_end);
243 next:
244 ppp = &pp->next;
245 }
246
247 /* do all our children */
248 cpp = &np->child;
249 while(*cpp) {
250 np = (struct bootx_dt_node *)(base + *cpp);
251 bootx_scan_dt_build_strings(base, *cpp, mem_end);
252 cpp = &np->sibling;
253 }
254}
255
256static void __init bootx_scan_dt_build_struct(unsigned long base,
257 unsigned long node,
258 unsigned long *mem_end)
259{
260 struct bootx_dt_node *np = (struct bootx_dt_node *)(base + node);
261 u32 *cpp, *ppp = &np->properties;
262 char *namep, *p, *ep, *lp;
263 int l;
264
265 dt_push_token(OF_DT_BEGIN_NODE, mem_end);
266
267 /* get the node's full name */
268 namep = np->full_name ? (char *)(base + np->full_name) : NULL;
269 if (namep == NULL)
270 namep = "";
271 l = strlen(namep);
272
273 DBG("* struct: %s\n", namep);
274
275 /* Fixup an Apple bug where they have bogus \0 chars in the
276 * middle of the path in some properties, and extract
277 * the unit name (everything after the last '/').
278 */
279 memcpy((void *)*mem_end, namep, l + 1);
280 namep = (char *)*mem_end;
281 for (lp = p = namep, ep = namep + l; p < ep; p++) {
282 if (*p == '/')
283 lp = namep;
284 else if (*p != 0)
285 *lp++ = *p;
286 }
287 *lp = 0;
288 *mem_end = _ALIGN_UP((unsigned long)lp + 1, 4);
289
290 /* get and store all properties */
291 while (*ppp) {
292 struct bootx_dt_prop *pp =
293 (struct bootx_dt_prop *)(base + *ppp);
294
295 namep = pp->name ? (char *)(base + pp->name) : NULL;
296 /* Skip "name" */
297 if (namep == NULL || !strcmp(namep, "name"))
298 goto next;
299 /* Skip "bootargs" in /chosen too as we replace it */
300 if (node == bootx_node_chosen && !strcmp(namep, "bootargs"))
301 goto next;
302
303 /* push property head */
304 bootx_dt_add_prop(namep,
305 pp->value ? (void *)(base + pp->value): NULL,
306 pp->length, mem_end);
307 next:
308 ppp = &pp->next;
309 }
310
311 if (node == bootx_node_chosen)
312 bootx_add_chosen_props(base, mem_end);
313 if (node == bootx_info->dispDeviceRegEntryOffset)
314 bootx_add_display_props(base, mem_end);
315
316 /* do all our children */
317 cpp = &np->child;
318 while(*cpp) {
319 np = (struct bootx_dt_node *)(base + *cpp);
320 bootx_scan_dt_build_struct(base, *cpp, mem_end);
321 cpp = &np->sibling;
322 }
323
324 dt_push_token(OF_DT_END_NODE, mem_end);
325}
326
327static unsigned long __init bootx_flatten_dt(unsigned long start)
328{
329 boot_infos_t *bi = bootx_info;
330 unsigned long mem_start, mem_end;
331 struct boot_param_header *hdr;
332 unsigned long base;
333 u64 *rsvmap;
334
335 /* Start using memory after the big blob passed by BootX, get
336 * some space for the header
337 */
338 mem_start = mem_end = _ALIGN_UP(((unsigned long)bi) + start, 4);
339 DBG("Boot params header at: %x\n", mem_start);
340 hdr = (struct boot_param_header *)mem_start;
341 mem_end += sizeof(struct boot_param_header);
342 rsvmap = (u64 *)(_ALIGN_UP(mem_end, 8));
343 hdr->off_mem_rsvmap = ((unsigned long)rsvmap) - mem_start;
344 mem_end = ((unsigned long)rsvmap) + 8 * sizeof(u64);
345
346 /* Get base of tree */
347 base = ((unsigned long)bi) + bi->deviceTreeOffset;
348
349 /* Build string array */
350 DBG("Building string array at: %x\n", mem_end);
351 DBG("Device Tree Base=%x\n", base);
352 bootx_dt_strbase = mem_end;
353 mem_end += 4;
354 bootx_dt_strend = mem_end;
355 bootx_scan_dt_build_strings(base, 4, &mem_end);
356 hdr->off_dt_strings = bootx_dt_strbase - mem_start;
357 hdr->dt_strings_size = bootx_dt_strend - bootx_dt_strbase;
358
359 /* Build structure */
360 mem_end = _ALIGN(mem_end, 16);
361 DBG("Building device tree structure at: %x\n", mem_end);
362 hdr->off_dt_struct = mem_end - mem_start;
363 bootx_scan_dt_build_struct(base, 4, &mem_end);
364 dt_push_token(OF_DT_END, &mem_end);
365
366 /* Finish header */
367 hdr->boot_cpuid_phys = 0;
368 hdr->magic = OF_DT_HEADER;
369 hdr->totalsize = mem_end - mem_start;
370 hdr->version = OF_DT_VERSION;
371 /* Version 16 is not backward compatible */
372 hdr->last_comp_version = 0x10;
373
374 /* Reserve the whole thing and copy the reserve map in, we
375 * also bump mem_reserve_cnt to cause further reservations to
376 * fail since it's too late.
377 */
378 mem_end = _ALIGN(mem_end, PAGE_SIZE);
379 DBG("End of boot params: %x\n", mem_end);
380 rsvmap[0] = mem_start;
381 rsvmap[1] = mem_end;
382 rsvmap[2] = 0;
383 rsvmap[3] = 0;
384
385 return (unsigned long)hdr;
386}
387
388
389#ifdef CONFIG_BOOTX_TEXT
390static void __init btext_welcome(boot_infos_t *bi)
391{
392 unsigned long flags;
393 unsigned long pvr;
394
395 bootx_printf("Welcome to Linux, kernel " UTS_RELEASE "\n");
396 bootx_printf("\nlinked at : 0x%x", KERNELBASE);
397 bootx_printf("\nframe buffer at : 0x%x", bi->dispDeviceBase);
398 bootx_printf(" (phys), 0x%x", bi->logicalDisplayBase);
399 bootx_printf(" (log)");
400 bootx_printf("\nklimit : 0x%x",(unsigned long)klimit);
401 bootx_printf("\nboot_info at : 0x%x", bi);
402 __asm__ __volatile__ ("mfmsr %0" : "=r" (flags));
403 bootx_printf("\nMSR : 0x%x", flags);
404 __asm__ __volatile__ ("mfspr %0, 287" : "=r" (pvr));
405 bootx_printf("\nPVR : 0x%x", pvr);
406 pvr >>= 16;
407 if (pvr > 1) {
408 __asm__ __volatile__ ("mfspr %0, 1008" : "=r" (flags));
409 bootx_printf("\nHID0 : 0x%x", flags);
410 }
411 if (pvr == 8 || pvr == 12 || pvr == 0x800c) {
412 __asm__ __volatile__ ("mfspr %0, 1019" : "=r" (flags));
413 bootx_printf("\nICTC : 0x%x", flags);
414 }
415#ifdef DEBUG
416 bootx_printf("\n\n");
417 bootx_printf("bi->deviceTreeOffset : 0x%x\n",
418 bi->deviceTreeOffset);
419 bootx_printf("bi->deviceTreeSize : 0x%x\n",
420 bi->deviceTreeSize);
421#endif
422 bootx_printf("\n\n");
423}
424#endif /* CONFIG_BOOTX_TEXT */
425
426void __init bootx_init(unsigned long r3, unsigned long r4)
427{
428 boot_infos_t *bi = (boot_infos_t *) r4;
429 unsigned long hdr;
430 unsigned long space;
431 unsigned long ptr, x;
432 char *model;
433 unsigned long offset = reloc_offset();
434
435 reloc_got2(offset);
436
437 bootx_info = bi;
438
439 /* We haven't cleared any bss at this point, make sure
440 * what we need is initialized
441 */
442 bootx_dt_strbase = bootx_dt_strend = 0;
443 bootx_node_chosen = 0;
444 bootx_disp_path[0] = 0;
445
446 if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
447 bi->logicalDisplayBase = bi->dispDeviceBase;
448
449#ifdef CONFIG_BOOTX_TEXT
450 btext_setup_display(bi->dispDeviceRect[2] - bi->dispDeviceRect[0],
451 bi->dispDeviceRect[3] - bi->dispDeviceRect[1],
452 bi->dispDeviceDepth, bi->dispDeviceRowBytes,
453 (unsigned long)bi->logicalDisplayBase);
454 btext_clearscreen();
455 btext_flushscreen();
456#endif /* CONFIG_BOOTX_TEXT */
457
458 /*
459 * Test if boot-info is compatible. Done only in config
460 * CONFIG_BOOTX_TEXT since there is nothing much we can do
461 * with an incompatible version, except display a message
462 * and eventually hang the processor...
463 *
464 * I'll try to keep enough of boot-info compatible in the
465 * future to always allow display of this message;
466 */
467 if (!BOOT_INFO_IS_COMPATIBLE(bi)) {
468 bootx_printf(" !!! WARNING - Incompatible version"
469 " of BootX !!!\n\n\n");
470 for (;;)
471 ;
472 }
473 if (bi->architecture != BOOT_ARCH_PCI) {
474 bootx_printf(" !!! WARNING - Usupported machine"
475 " architecture !\n");
476 for (;;)
477 ;
478 }
479
480#ifdef CONFIG_BOOTX_TEXT
481 btext_welcome(bi);
482#endif
483 /* New BootX enters kernel with MMU off, i/os are not allowed
484 * here. This hack will have been done by the boostrap anyway.
485 */
486 if (bi->version < 4) {
487 /*
488 * XXX If this is an iMac, turn off the USB controller.
489 */
490 model = (char *) bootx_early_getprop(r4 + bi->deviceTreeOffset,
491 4, "model");
492 if (model
493 && (strcmp(model, "iMac,1") == 0
494 || strcmp(model, "PowerMac1,1") == 0)) {
495 bootx_printf("iMac,1 detected, shutting down USB \n");
496 out_le32((unsigned *)0x80880008, 1); /* XXX */
497 }
498 }
499
500 /* Get a pointer that points above the device tree, args, ramdisk,
501 * etc... to use for generating the flattened tree
502 */
503 if (bi->version < 5) {
504 space = bi->deviceTreeOffset + bi->deviceTreeSize;
505 if (bi->ramDisk)
506 space = bi->ramDisk + bi->ramDiskSize;
507 } else
508 space = bi->totalParamsSize;
509
510 bootx_printf("Total space used by parameters & ramdisk: %x \n", space);
511
512 /* New BootX will have flushed all TLBs and enters kernel with
513 * MMU switched OFF, so this should not be useful anymore.
514 */
515 if (bi->version < 4) {
516 bootx_printf("Touching pages...\n");
517
518 /*
519 * Touch each page to make sure the PTEs for them
520 * are in the hash table - the aim is to try to avoid
521 * getting DSI exceptions while copying the kernel image.
522 */
523 for (ptr = ((unsigned long) &_stext) & PAGE_MASK;
524 ptr < (unsigned long)bi + space; ptr += PAGE_SIZE)
525 x = *(volatile unsigned long *)ptr;
526 }
527
528 /* Ok, now we need to generate a flattened device-tree to pass
529 * to the kernel
530 */
531 bootx_printf("Preparing boot params...\n");
532
533 hdr = bootx_flatten_dt(space);
534
535#ifdef CONFIG_BOOTX_TEXT
536#ifdef SET_BOOT_BAT
537 bootx_printf("Preparing BAT...\n");
538 btext_prepare_BAT();
539#else
540 btext_unmap();
541#endif
542#endif
543
544 reloc_got2(-offset);
545
546 __start(hdr, KERNELBASE + offset, 0);
547}
diff --git a/arch/powerpc/platforms/powermac/cpufreq_64.c b/arch/powerpc/platforms/powermac/cpufreq_64.c
index 39150342c6f1..a415e8d2f7af 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_64.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_64.c
@@ -28,6 +28,7 @@
28#include <asm/cputable.h> 28#include <asm/cputable.h>
29#include <asm/time.h> 29#include <asm/time.h>
30#include <asm/smu.h> 30#include <asm/smu.h>
31#include <asm/pmac_pfunc.h>
31 32
32#undef DEBUG 33#undef DEBUG
33 34
@@ -79,12 +80,16 @@ static struct freq_attr* g5_cpu_freqs_attr[] = {
79}; 80};
80 81
81/* Power mode data is an array of the 32 bits PCR values to use for 82/* Power mode data is an array of the 32 bits PCR values to use for
82 * the various frequencies, retreived from the device-tree 83 * the various frequencies, retrieved from the device-tree
83 */ 84 */
84static u32 *g5_pmode_data; 85static u32 *g5_pmode_data;
85static int g5_pmode_max; 86static int g5_pmode_max;
86static int g5_pmode_cur; 87static int g5_pmode_cur;
87 88
89static void (*g5_switch_volt)(int speed_mode);
90static int (*g5_switch_freq)(int speed_mode);
91static int (*g5_query_freq)(void);
92
88static DECLARE_MUTEX(g5_switch_mutex); 93static DECLARE_MUTEX(g5_switch_mutex);
89 94
90 95
@@ -92,9 +97,11 @@ static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */
92static int g5_fvt_count; /* number of op. points */ 97static int g5_fvt_count; /* number of op. points */
93static int g5_fvt_cur; /* current op. point */ 98static int g5_fvt_cur; /* current op. point */
94 99
95/* ----------------- real hardware interface */ 100/*
101 * SMU based voltage switching for Neo2 platforms
102 */
96 103
97static void g5_switch_volt(int speed_mode) 104static void g5_smu_switch_volt(int speed_mode)
98{ 105{
99 struct smu_simple_cmd cmd; 106 struct smu_simple_cmd cmd;
100 107
@@ -105,26 +112,57 @@ static void g5_switch_volt(int speed_mode)
105 wait_for_completion(&comp); 112 wait_for_completion(&comp);
106} 113}
107 114
108static int g5_switch_freq(int speed_mode) 115/*
116 * Platform function based voltage/vdnap switching for Neo2
117 */
118
119static struct pmf_function *pfunc_set_vdnap0;
120static struct pmf_function *pfunc_vdnap0_complete;
121
122static void g5_vdnap_switch_volt(int speed_mode)
109{ 123{
110 struct cpufreq_freqs freqs; 124 struct pmf_args args;
111 int to; 125 u32 slew, done = 0;
126 unsigned long timeout;
112 127
113 if (g5_pmode_cur == speed_mode) 128 slew = (speed_mode == CPUFREQ_LOW) ? 1 : 0;
114 return 0; 129 args.count = 1;
130 args.u[0].p = &slew;
115 131
116 down(&g5_switch_mutex); 132 pmf_call_one(pfunc_set_vdnap0, &args);
117 133
118 freqs.old = g5_cpu_freqs[g5_pmode_cur].frequency; 134 /* It's an irq GPIO so we should be able to just block here,
119 freqs.new = g5_cpu_freqs[speed_mode].frequency; 135 * I'll do that later after I've properly tested the IRQ code for
120 freqs.cpu = 0; 136 * platform functions
137 */
138 timeout = jiffies + HZ/10;
139 while(!time_after(jiffies, timeout)) {
140 args.count = 1;
141 args.u[0].p = &done;
142 pmf_call_one(pfunc_vdnap0_complete, &args);
143 if (done)
144 break;
145 msleep(1);
146 }
147 if (done == 0)
148 printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");
149}
121 150
122 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 151
152/*
153 * SCOM based frequency switching for 970FX rev3
154 */
155static int g5_scom_switch_freq(int speed_mode)
156{
157 unsigned long flags;
158 int to;
123 159
124 /* If frequency is going up, first ramp up the voltage */ 160 /* If frequency is going up, first ramp up the voltage */
125 if (speed_mode < g5_pmode_cur) 161 if (speed_mode < g5_pmode_cur)
126 g5_switch_volt(speed_mode); 162 g5_switch_volt(speed_mode);
127 163
164 local_irq_save(flags);
165
128 /* Clear PCR high */ 166 /* Clear PCR high */
129 scom970_write(SCOM_PCR, 0); 167 scom970_write(SCOM_PCR, 0);
130 /* Clear PCR low */ 168 /* Clear PCR low */
@@ -147,6 +185,8 @@ static int g5_switch_freq(int speed_mode)
147 udelay(100); 185 udelay(100);
148 } 186 }
149 187
188 local_irq_restore(flags);
189
150 /* If frequency is going down, last ramp the voltage */ 190 /* If frequency is going down, last ramp the voltage */
151 if (speed_mode > g5_pmode_cur) 191 if (speed_mode > g5_pmode_cur)
152 g5_switch_volt(speed_mode); 192 g5_switch_volt(speed_mode);
@@ -154,14 +194,10 @@ static int g5_switch_freq(int speed_mode)
154 g5_pmode_cur = speed_mode; 194 g5_pmode_cur = speed_mode;
155 ppc_proc_freq = g5_cpu_freqs[speed_mode].frequency * 1000ul; 195 ppc_proc_freq = g5_cpu_freqs[speed_mode].frequency * 1000ul;
156 196
157 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
158
159 up(&g5_switch_mutex);
160
161 return 0; 197 return 0;
162} 198}
163 199
164static int g5_query_freq(void) 200static int g5_scom_query_freq(void)
165{ 201{
166 unsigned long psr = scom970_read(SCOM_PSR); 202 unsigned long psr = scom970_read(SCOM_PSR);
167 int i; 203 int i;
@@ -173,7 +209,104 @@ static int g5_query_freq(void)
173 return i; 209 return i;
174} 210}
175 211
176/* ----------------- cpufreq bookkeeping */ 212/*
213 * Platform function based voltage switching for PowerMac7,2 & 7,3
214 */
215
216static struct pmf_function *pfunc_cpu0_volt_high;
217static struct pmf_function *pfunc_cpu0_volt_low;
218static struct pmf_function *pfunc_cpu1_volt_high;
219static struct pmf_function *pfunc_cpu1_volt_low;
220
221static void g5_pfunc_switch_volt(int speed_mode)
222{
223 if (speed_mode == CPUFREQ_HIGH) {
224 if (pfunc_cpu0_volt_high)
225 pmf_call_one(pfunc_cpu0_volt_high, NULL);
226 if (pfunc_cpu1_volt_high)
227 pmf_call_one(pfunc_cpu1_volt_high, NULL);
228 } else {
229 if (pfunc_cpu0_volt_low)
230 pmf_call_one(pfunc_cpu0_volt_low, NULL);
231 if (pfunc_cpu1_volt_low)
232 pmf_call_one(pfunc_cpu1_volt_low, NULL);
233 }
234 msleep(10); /* should be faster , to fix */
235}
236
237/*
238 * Platform function based frequency switching for PowerMac7,2 & 7,3
239 */
240
241static struct pmf_function *pfunc_cpu_setfreq_high;
242static struct pmf_function *pfunc_cpu_setfreq_low;
243static struct pmf_function *pfunc_cpu_getfreq;
244static struct pmf_function *pfunc_slewing_done;;
245
246static int g5_pfunc_switch_freq(int speed_mode)
247{
248 struct pmf_args args;
249 u32 done = 0;
250 unsigned long timeout;
251
252 /* If frequency is going up, first ramp up the voltage */
253 if (speed_mode < g5_pmode_cur)
254 g5_switch_volt(speed_mode);
255
256 /* Do it */
257 if (speed_mode == CPUFREQ_HIGH)
258 pmf_call_one(pfunc_cpu_setfreq_high, NULL);
259 else
260 pmf_call_one(pfunc_cpu_setfreq_low, NULL);
261
262 /* It's an irq GPIO so we should be able to just block here,
263 * I'll do that later after I've properly tested the IRQ code for
264 * platform functions
265 */
266 timeout = jiffies + HZ/10;
267 while(!time_after(jiffies, timeout)) {
268 args.count = 1;
269 args.u[0].p = &done;
270 pmf_call_one(pfunc_slewing_done, &args);
271 if (done)
272 break;
273 msleep(1);
274 }
275 if (done == 0)
276 printk(KERN_WARNING "cpufreq: Timeout in clock slewing !\n");
277
278 /* If frequency is going down, last ramp the voltage */
279 if (speed_mode > g5_pmode_cur)
280 g5_switch_volt(speed_mode);
281
282 g5_pmode_cur = speed_mode;
283 ppc_proc_freq = g5_cpu_freqs[speed_mode].frequency * 1000ul;
284
285 return 0;
286}
287
288static int g5_pfunc_query_freq(void)
289{
290 struct pmf_args args;
291 u32 val = 0;
292
293 args.count = 1;
294 args.u[0].p = &val;
295 pmf_call_one(pfunc_cpu_getfreq, &args);
296 return val ? CPUFREQ_HIGH : CPUFREQ_LOW;
297}
298
299/*
300 * Fake voltage switching for platforms with missing support
301 */
302
303static void g5_dummy_switch_volt(int speed_mode)
304{
305}
306
307/*
308 * Common interface to the cpufreq core
309 */
177 310
178static int g5_cpufreq_verify(struct cpufreq_policy *policy) 311static int g5_cpufreq_verify(struct cpufreq_policy *policy)
179{ 312{
@@ -183,13 +316,30 @@ static int g5_cpufreq_verify(struct cpufreq_policy *policy)
183static int g5_cpufreq_target(struct cpufreq_policy *policy, 316static int g5_cpufreq_target(struct cpufreq_policy *policy,
184 unsigned int target_freq, unsigned int relation) 317 unsigned int target_freq, unsigned int relation)
185{ 318{
186 unsigned int newstate = 0; 319 unsigned int newstate = 0;
320 struct cpufreq_freqs freqs;
321 int rc;
187 322
188 if (cpufreq_frequency_table_target(policy, g5_cpu_freqs, 323 if (cpufreq_frequency_table_target(policy, g5_cpu_freqs,
189 target_freq, relation, &newstate)) 324 target_freq, relation, &newstate))
190 return -EINVAL; 325 return -EINVAL;
191 326
192 return g5_switch_freq(newstate); 327 if (g5_pmode_cur == newstate)
328 return 0;
329
330 down(&g5_switch_mutex);
331
332 freqs.old = g5_cpu_freqs[g5_pmode_cur].frequency;
333 freqs.new = g5_cpu_freqs[newstate].frequency;
334 freqs.cpu = 0;
335
336 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
337 rc = g5_switch_freq(newstate);
338 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
339
340 up(&g5_switch_mutex);
341
342 return rc;
193} 343}
194 344
195static unsigned int g5_cpufreq_get_speed(unsigned int cpu) 345static unsigned int g5_cpufreq_get_speed(unsigned int cpu)
@@ -205,6 +355,7 @@ static int g5_cpufreq_cpu_init(struct cpufreq_policy *policy)
205 policy->governor = CPUFREQ_DEFAULT_GOVERNOR; 355 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
206 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL; 356 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
207 policy->cur = g5_cpu_freqs[g5_query_freq()].frequency; 357 policy->cur = g5_cpu_freqs[g5_query_freq()].frequency;
358 policy->cpus = cpu_possible_map;
208 cpufreq_frequency_table_get_attr(g5_cpu_freqs, policy->cpu); 359 cpufreq_frequency_table_get_attr(g5_cpu_freqs, policy->cpu);
209 360
210 return cpufreq_frequency_table_cpuinfo(policy, 361 return cpufreq_frequency_table_cpuinfo(policy,
@@ -224,19 +375,39 @@ static struct cpufreq_driver g5_cpufreq_driver = {
224}; 375};
225 376
226 377
227static int __init g5_cpufreq_init(void) 378static int __init g5_neo2_cpufreq_init(struct device_node *cpus)
228{ 379{
229 struct device_node *cpunode; 380 struct device_node *cpunode;
230 unsigned int psize, ssize; 381 unsigned int psize, ssize;
231 struct smu_sdbp_header *shdr;
232 unsigned long max_freq; 382 unsigned long max_freq;
233 u32 *valp; 383 char *freq_method, *volt_method;
384 u32 *valp, pvr_hi;
385 int use_volts_vdnap = 0;
386 int use_volts_smu = 0;
234 int rc = -ENODEV; 387 int rc = -ENODEV;
235 388
236 /* Look for CPU and SMU nodes */ 389 /* Check supported platforms */
237 cpunode = of_find_node_by_type(NULL, "cpu"); 390 if (machine_is_compatible("PowerMac8,1") ||
238 if (!cpunode) { 391 machine_is_compatible("PowerMac8,2") ||
239 DBG("No CPU node !\n"); 392 machine_is_compatible("PowerMac9,1"))
393 use_volts_smu = 1;
394 else if (machine_is_compatible("PowerMac11,2"))
395 use_volts_vdnap = 1;
396 else
397 return -ENODEV;
398
399 /* Get first CPU node */
400 for (cpunode = NULL;
401 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
402 u32 *reg =
403 (u32 *)get_property(cpunode, "reg", NULL);
404 if (reg == NULL || (*reg) != 0)
405 continue;
406 if (!strcmp(cpunode->type, "cpu"))
407 break;
408 }
409 if (cpunode == NULL) {
410 printk(KERN_ERR "cpufreq: Can't find any CPU 0 node\n");
240 return -ENODEV; 411 return -ENODEV;
241 } 412 }
242 413
@@ -246,8 +417,9 @@ static int __init g5_cpufreq_init(void)
246 DBG("No cpu-version property !\n"); 417 DBG("No cpu-version property !\n");
247 goto bail_noprops; 418 goto bail_noprops;
248 } 419 }
249 if (((*valp) >> 16) != 0x3c) { 420 pvr_hi = (*valp) >> 16;
250 DBG("Wrong CPU version: %08x\n", *valp); 421 if (pvr_hi != 0x3c && pvr_hi != 0x44) {
422 printk(KERN_ERR "cpufreq: Unsupported CPU version\n");
251 goto bail_noprops; 423 goto bail_noprops;
252 } 424 }
253 425
@@ -259,18 +431,50 @@ static int __init g5_cpufreq_init(void)
259 } 431 }
260 g5_pmode_max = psize / sizeof(u32) - 1; 432 g5_pmode_max = psize / sizeof(u32) - 1;
261 433
262 /* Look for the FVT table */ 434 if (use_volts_smu) {
263 shdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL); 435 struct smu_sdbp_header *shdr;
264 if (!shdr) 436
265 goto bail_noprops; 437 /* Look for the FVT table */
266 g5_fvt_table = (struct smu_sdbp_fvt *)&shdr[1]; 438 shdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL);
267 ssize = (shdr->len * sizeof(u32)) - sizeof(struct smu_sdbp_header); 439 if (!shdr)
268 g5_fvt_count = ssize / sizeof(struct smu_sdbp_fvt); 440 goto bail_noprops;
269 g5_fvt_cur = 0; 441 g5_fvt_table = (struct smu_sdbp_fvt *)&shdr[1];
270 442 ssize = (shdr->len * sizeof(u32)) -
271 /* Sanity checking */ 443 sizeof(struct smu_sdbp_header);
272 if (g5_fvt_count < 1 || g5_pmode_max < 1) 444 g5_fvt_count = ssize / sizeof(struct smu_sdbp_fvt);
273 goto bail_noprops; 445 g5_fvt_cur = 0;
446
447 /* Sanity checking */
448 if (g5_fvt_count < 1 || g5_pmode_max < 1)
449 goto bail_noprops;
450
451 g5_switch_volt = g5_smu_switch_volt;
452 volt_method = "SMU";
453 } else if (use_volts_vdnap) {
454 struct device_node *root;
455
456 root = of_find_node_by_path("/");
457 if (root == NULL) {
458 printk(KERN_ERR "cpufreq: Can't find root of "
459 "device tree\n");
460 goto bail_noprops;
461 }
462 pfunc_set_vdnap0 = pmf_find_function(root, "set-vdnap0");
463 pfunc_vdnap0_complete =
464 pmf_find_function(root, "slewing-done");
465 if (pfunc_set_vdnap0 == NULL ||
466 pfunc_vdnap0_complete == NULL) {
467 printk(KERN_ERR "cpufreq: Can't find required "
468 "platform function\n");
469 goto bail_noprops;
470 }
471
472 g5_switch_volt = g5_vdnap_switch_volt;
473 volt_method = "GPIO";
474 } else {
475 g5_switch_volt = g5_dummy_switch_volt;
476 volt_method = "none";
477 }
274 478
275 /* 479 /*
276 * From what I see, clock-frequency is always the maximal frequency. 480 * From what I see, clock-frequency is always the maximal frequency.
@@ -286,19 +490,23 @@ static int __init g5_cpufreq_init(void)
286 g5_cpu_freqs[0].frequency = max_freq; 490 g5_cpu_freqs[0].frequency = max_freq;
287 g5_cpu_freqs[1].frequency = max_freq/2; 491 g5_cpu_freqs[1].frequency = max_freq/2;
288 492
289 /* Check current frequency */ 493 /* Set callbacks */
290 g5_pmode_cur = g5_query_freq(); 494 g5_switch_freq = g5_scom_switch_freq;
291 if (g5_pmode_cur > 1) 495 g5_query_freq = g5_scom_query_freq;
292 /* We don't support anything but 1:1 and 1:2, fixup ... */ 496 freq_method = "SCOM";
293 g5_pmode_cur = 1;
294 497
295 /* Force apply current frequency to make sure everything is in 498 /* Force apply current frequency to make sure everything is in
296 * sync (voltage is right for example). Firmware may leave us with 499 * sync (voltage is right for example). Firmware may leave us with
297 * a strange setting ... 500 * a strange setting ...
298 */ 501 */
299 g5_switch_freq(g5_pmode_cur); 502 g5_switch_volt(CPUFREQ_HIGH);
503 msleep(10);
504 g5_pmode_cur = -1;
505 g5_switch_freq(g5_query_freq());
300 506
301 printk(KERN_INFO "Registering G5 CPU frequency driver\n"); 507 printk(KERN_INFO "Registering G5 CPU frequency driver\n");
508 printk(KERN_INFO "Frequency method: %s, Voltage method: %s\n",
509 freq_method, volt_method);
302 printk(KERN_INFO "Low: %d Mhz, High: %d Mhz, Cur: %d MHz\n", 510 printk(KERN_INFO "Low: %d Mhz, High: %d Mhz, Cur: %d MHz\n",
303 g5_cpu_freqs[1].frequency/1000, 511 g5_cpu_freqs[1].frequency/1000,
304 g5_cpu_freqs[0].frequency/1000, 512 g5_cpu_freqs[0].frequency/1000,
@@ -317,6 +525,200 @@ static int __init g5_cpufreq_init(void)
317 return rc; 525 return rc;
318} 526}
319 527
528static int __init g5_pm72_cpufreq_init(struct device_node *cpus)
529{
530 struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL;
531 u8 *eeprom = NULL;
532 u32 *valp;
533 u64 max_freq, min_freq, ih, il;
534 int has_volt = 1, rc = 0;
535
536 /* Get first CPU node */
537 for (cpunode = NULL;
538 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) {
539 if (!strcmp(cpunode->type, "cpu"))
540 break;
541 }
542 if (cpunode == NULL) {
543 printk(KERN_ERR "cpufreq: Can't find any CPU node\n");
544 return -ENODEV;
545 }
546
547 /* Lookup the cpuid eeprom node */
548 cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0");
549 if (cpuid != NULL)
550 eeprom = (u8 *)get_property(cpuid, "cpuid", NULL);
551 if (eeprom == NULL) {
552 printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n");
553 rc = -ENODEV;
554 goto bail;
555 }
556
557 /* Lookup the i2c hwclock */
558 for (hwclock = NULL;
559 (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){
560 char *loc = get_property(hwclock, "hwctrl-location", NULL);
561 if (loc == NULL)
562 continue;
563 if (strcmp(loc, "CPU CLOCK"))
564 continue;
565 if (!get_property(hwclock, "platform-get-frequency", NULL))
566 continue;
567 break;
568 }
569 if (hwclock == NULL) {
570 printk(KERN_ERR "cpufreq: Can't find i2c clock chip !\n");
571 rc = -ENODEV;
572 goto bail;
573 }
574
575 DBG("cpufreq: i2c clock chip found: %s\n", hwclock->full_name);
576
577 /* Now get all the platform functions */
578 pfunc_cpu_getfreq =
579 pmf_find_function(hwclock, "get-frequency");
580 pfunc_cpu_setfreq_high =
581 pmf_find_function(hwclock, "set-frequency-high");
582 pfunc_cpu_setfreq_low =
583 pmf_find_function(hwclock, "set-frequency-low");
584 pfunc_slewing_done =
585 pmf_find_function(hwclock, "slewing-done");
586 pfunc_cpu0_volt_high =
587 pmf_find_function(hwclock, "set-voltage-high-0");
588 pfunc_cpu0_volt_low =
589 pmf_find_function(hwclock, "set-voltage-low-0");
590 pfunc_cpu1_volt_high =
591 pmf_find_function(hwclock, "set-voltage-high-1");
592 pfunc_cpu1_volt_low =
593 pmf_find_function(hwclock, "set-voltage-low-1");
594
595 /* Check we have minimum requirements */
596 if (pfunc_cpu_getfreq == NULL || pfunc_cpu_setfreq_high == NULL ||
597 pfunc_cpu_setfreq_low == NULL || pfunc_slewing_done == NULL) {
598 printk(KERN_ERR "cpufreq: Can't find platform functions !\n");
599 rc = -ENODEV;
600 goto bail;
601 }
602
603 /* Check that we have complete sets */
604 if (pfunc_cpu0_volt_high == NULL || pfunc_cpu0_volt_low == NULL) {
605 pmf_put_function(pfunc_cpu0_volt_high);
606 pmf_put_function(pfunc_cpu0_volt_low);
607 pfunc_cpu0_volt_high = pfunc_cpu0_volt_low = NULL;
608 has_volt = 0;
609 }
610 if (!has_volt ||
611 pfunc_cpu1_volt_high == NULL || pfunc_cpu1_volt_low == NULL) {
612 pmf_put_function(pfunc_cpu1_volt_high);
613 pmf_put_function(pfunc_cpu1_volt_low);
614 pfunc_cpu1_volt_high = pfunc_cpu1_volt_low = NULL;
615 }
616
617 /* Note: The device tree also contains a "platform-set-values"
618 * function for which I haven't quite figured out the usage. It
619 * might have to be called on init and/or wakeup, I'm not too sure
620 * but things seem to work fine without it so far ...
621 */
622
623 /* Get max frequency from device-tree */
624 valp = (u32 *)get_property(cpunode, "clock-frequency", NULL);
625 if (!valp) {
626 printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n");
627 rc = -ENODEV;
628 goto bail;
629 }
630
631 max_freq = (*valp)/1000;
632
633 /* Now calculate reduced frequency by using the cpuid input freq
634 * ratio. This requires 64 bits math unless we are willing to lose
635 * some precision
636 */
637 ih = *((u32 *)(eeprom + 0x10));
638 il = *((u32 *)(eeprom + 0x20));
639 min_freq = 0;
640 if (ih != 0 && il != 0)
641 min_freq = (max_freq * il) / ih;
642
643 /* Sanity check */
644 if (min_freq >= max_freq || min_freq < 1000) {
645 printk(KERN_ERR "cpufreq: Can't calculate low frequency !\n");
646 rc = -ENODEV;
647 goto bail;
648 }
649 g5_cpu_freqs[0].frequency = max_freq;
650 g5_cpu_freqs[1].frequency = min_freq;
651
652 /* Set callbacks */
653 g5_switch_volt = g5_pfunc_switch_volt;
654 g5_switch_freq = g5_pfunc_switch_freq;
655 g5_query_freq = g5_pfunc_query_freq;
656
657 /* Force apply current frequency to make sure everything is in
658 * sync (voltage is right for example). Firmware may leave us with
659 * a strange setting ...
660 */
661 g5_switch_volt(CPUFREQ_HIGH);
662 msleep(10);
663 g5_pmode_cur = -1;
664 g5_switch_freq(g5_query_freq());
665
666 printk(KERN_INFO "Registering G5 CPU frequency driver\n");
667 printk(KERN_INFO "Frequency method: i2c/pfunc, "
668 "Voltage method: %s\n", has_volt ? "i2c/pfunc" : "none");
669 printk(KERN_INFO "Low: %d Mhz, High: %d Mhz, Cur: %d MHz\n",
670 g5_cpu_freqs[1].frequency/1000,
671 g5_cpu_freqs[0].frequency/1000,
672 g5_cpu_freqs[g5_pmode_cur].frequency/1000);
673
674 rc = cpufreq_register_driver(&g5_cpufreq_driver);
675 bail:
676 if (rc != 0) {
677 pmf_put_function(pfunc_cpu_getfreq);
678 pmf_put_function(pfunc_cpu_setfreq_high);
679 pmf_put_function(pfunc_cpu_setfreq_low);
680 pmf_put_function(pfunc_slewing_done);
681 pmf_put_function(pfunc_cpu0_volt_high);
682 pmf_put_function(pfunc_cpu0_volt_low);
683 pmf_put_function(pfunc_cpu1_volt_high);
684 pmf_put_function(pfunc_cpu1_volt_low);
685 }
686 of_node_put(hwclock);
687 of_node_put(cpuid);
688 of_node_put(cpunode);
689
690 return rc;
691}
692
693static int __init g5_rm31_cpufreq_init(struct device_node *cpus)
694{
695 /* NYI */
696 return 0;
697}
698
699static int __init g5_cpufreq_init(void)
700{
701 struct device_node *cpus;
702 int rc;
703
704 cpus = of_find_node_by_path("/cpus");
705 if (cpus == NULL) {
706 DBG("No /cpus node !\n");
707 return -ENODEV;
708 }
709
710 if (machine_is_compatible("PowerMac7,2") ||
711 machine_is_compatible("PowerMac7,3"))
712 rc = g5_pm72_cpufreq_init(cpus);
713 else if (machine_is_compatible("RackMac3,1"))
714 rc = g5_rm31_cpufreq_init(cpus);
715 else
716 rc = g5_neo2_cpufreq_init(cpus);
717
718 of_node_put(cpus);
719 return rc;
720}
721
320module_init(g5_cpufreq_init); 722module_init(g5_cpufreq_init);
321 723
322 724
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 0d7fa00fcb00..558dd0692092 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -58,12 +58,11 @@ extern int powersave_lowspeed;
58extern int powersave_nap; 58extern int powersave_nap;
59extern struct device_node *k2_skiplist[2]; 59extern struct device_node *k2_skiplist[2];
60 60
61
62/* 61/*
63 * We use a single global lock to protect accesses. Each driver has 62 * We use a single global lock to protect accesses. Each driver has
64 * to take care of its own locking 63 * to take care of its own locking
65 */ 64 */
66static DEFINE_SPINLOCK(feature_lock); 65DEFINE_SPINLOCK(feature_lock);
67 66
68#define LOCK(flags) spin_lock_irqsave(&feature_lock, flags); 67#define LOCK(flags) spin_lock_irqsave(&feature_lock, flags);
69#define UNLOCK(flags) spin_unlock_irqrestore(&feature_lock, flags); 68#define UNLOCK(flags) spin_unlock_irqrestore(&feature_lock, flags);
@@ -101,26 +100,17 @@ static const char *macio_names[] =
101 "Keylargo", 100 "Keylargo",
102 "Pangea", 101 "Pangea",
103 "Intrepid", 102 "Intrepid",
104 "K2" 103 "K2",
104 "Shasta",
105}; 105};
106 106
107 107
108struct device_node *uninorth_node;
109u32 __iomem *uninorth_base;
108 110
109/*
110 * Uninorth reg. access. Note that Uni-N regs are big endian
111 */
112
113#define UN_REG(r) (uninorth_base + ((r) >> 2))
114#define UN_IN(r) (in_be32(UN_REG(r)))
115#define UN_OUT(r,v) (out_be32(UN_REG(r), (v)))
116#define UN_BIS(r,v) (UN_OUT((r), UN_IN(r) | (v)))
117#define UN_BIC(r,v) (UN_OUT((r), UN_IN(r) & ~(v)))
118
119static struct device_node *uninorth_node;
120static u32 __iomem *uninorth_base;
121static u32 uninorth_rev; 111static u32 uninorth_rev;
122static int uninorth_u3; 112static int uninorth_maj;
123static void __iomem *u3_ht; 113static void __iomem *u3_ht_base;
124 114
125/* 115/*
126 * For each motherboard family, we have a table of functions pointers 116 * For each motherboard family, we have a table of functions pointers
@@ -1399,8 +1389,15 @@ static long g5_fw_enable(struct device_node *node, long param, long value)
1399static long g5_mpic_enable(struct device_node *node, long param, long value) 1389static long g5_mpic_enable(struct device_node *node, long param, long value)
1400{ 1390{
1401 unsigned long flags; 1391 unsigned long flags;
1392 struct device_node *parent = of_get_parent(node);
1393 int is_u3;
1402 1394
1403 if (node->parent == NULL || strcmp(node->parent->name, "u3")) 1395 if (parent == NULL)
1396 return 0;
1397 is_u3 = strcmp(parent->name, "u3") == 0 ||
1398 strcmp(parent->name, "u4") == 0;
1399 of_node_put(parent);
1400 if (!is_u3)
1404 return 0; 1401 return 0;
1405 1402
1406 LOCK(flags); 1403 LOCK(flags);
@@ -1445,20 +1442,53 @@ static long g5_i2s_enable(struct device_node *node, long param, long value)
1445 /* Very crude implementation for now */ 1442 /* Very crude implementation for now */
1446 struct macio_chip *macio = &macio_chips[0]; 1443 struct macio_chip *macio = &macio_chips[0];
1447 unsigned long flags; 1444 unsigned long flags;
1448 1445 int cell;
1449 if (value == 0) 1446 u32 fcrs[3][3] = {
1450 return 0; /* don't disable yet */ 1447 { 0,
1448 K2_FCR1_I2S0_CELL_ENABLE |
1449 K2_FCR1_I2S0_CLK_ENABLE_BIT | K2_FCR1_I2S0_ENABLE,
1450 KL3_I2S0_CLK18_ENABLE
1451 },
1452 { KL0_SCC_A_INTF_ENABLE,
1453 K2_FCR1_I2S1_CELL_ENABLE |
1454 K2_FCR1_I2S1_CLK_ENABLE_BIT | K2_FCR1_I2S1_ENABLE,
1455 KL3_I2S1_CLK18_ENABLE
1456 },
1457 { KL0_SCC_B_INTF_ENABLE,
1458 SH_FCR1_I2S2_CELL_ENABLE |
1459 SH_FCR1_I2S2_CLK_ENABLE_BIT | SH_FCR1_I2S2_ENABLE,
1460 SH_FCR3_I2S2_CLK18_ENABLE
1461 },
1462 };
1463
1464 if (macio->type != macio_keylargo2 && macio->type != macio_shasta)
1465 return -ENODEV;
1466 if (strncmp(node->name, "i2s-", 4))
1467 return -ENODEV;
1468 cell = node->name[4] - 'a';
1469 switch(cell) {
1470 case 0:
1471 case 1:
1472 break;
1473 case 2:
1474 if (macio->type == macio_shasta)
1475 break;
1476 default:
1477 return -ENODEV;
1478 }
1451 1479
1452 LOCK(flags); 1480 LOCK(flags);
1453 MACIO_BIS(KEYLARGO_FCR3, KL3_CLK45_ENABLE | KL3_CLK49_ENABLE | 1481 if (value) {
1454 KL3_I2S0_CLK18_ENABLE); 1482 MACIO_BIC(KEYLARGO_FCR0, fcrs[cell][0]);
1455 udelay(10); 1483 MACIO_BIS(KEYLARGO_FCR1, fcrs[cell][1]);
1456 MACIO_BIS(KEYLARGO_FCR1, K2_FCR1_I2S0_CELL_ENABLE | 1484 MACIO_BIS(KEYLARGO_FCR3, fcrs[cell][2]);
1457 K2_FCR1_I2S0_CLK_ENABLE_BIT | K2_FCR1_I2S0_ENABLE); 1485 } else {
1486 MACIO_BIC(KEYLARGO_FCR3, fcrs[cell][2]);
1487 MACIO_BIC(KEYLARGO_FCR1, fcrs[cell][1]);
1488 MACIO_BIS(KEYLARGO_FCR0, fcrs[cell][0]);
1489 }
1458 udelay(10); 1490 udelay(10);
1459 MACIO_BIC(KEYLARGO_FCR1, K2_FCR1_I2S0_RESET);
1460 UNLOCK(flags); 1491 UNLOCK(flags);
1461 udelay(10);
1462 1492
1463 return 0; 1493 return 0;
1464} 1494}
@@ -1473,7 +1503,7 @@ static long g5_reset_cpu(struct device_node *node, long param, long value)
1473 struct device_node *np; 1503 struct device_node *np;
1474 1504
1475 macio = &macio_chips[0]; 1505 macio = &macio_chips[0];
1476 if (macio->type != macio_keylargo2) 1506 if (macio->type != macio_keylargo2 && macio->type != macio_shasta)
1477 return -ENODEV; 1507 return -ENODEV;
1478 1508
1479 np = find_path_device("/cpus"); 1509 np = find_path_device("/cpus");
@@ -1512,14 +1542,17 @@ static long g5_reset_cpu(struct device_node *node, long param, long value)
1512 */ 1542 */
1513void g5_phy_disable_cpu1(void) 1543void g5_phy_disable_cpu1(void)
1514{ 1544{
1515 UN_OUT(U3_API_PHY_CONFIG_1, 0); 1545 if (uninorth_maj == 3)
1546 UN_OUT(U3_API_PHY_CONFIG_1, 0);
1516} 1547}
1517#endif /* CONFIG_POWER4 */ 1548#endif /* CONFIG_POWER4 */
1518 1549
1519#ifndef CONFIG_POWER4 1550#ifndef CONFIG_POWER4
1520 1551
1521static void 1552
1522keylargo_shutdown(struct macio_chip *macio, int sleep_mode) 1553#ifdef CONFIG_PM
1554
1555static void keylargo_shutdown(struct macio_chip *macio, int sleep_mode)
1523{ 1556{
1524 u32 temp; 1557 u32 temp;
1525 1558
@@ -1572,8 +1605,7 @@ keylargo_shutdown(struct macio_chip *macio, int sleep_mode)
1572 (void)MACIO_IN32(KEYLARGO_FCR0); mdelay(1); 1605 (void)MACIO_IN32(KEYLARGO_FCR0); mdelay(1);
1573} 1606}
1574 1607
1575static void 1608static void pangea_shutdown(struct macio_chip *macio, int sleep_mode)
1576pangea_shutdown(struct macio_chip *macio, int sleep_mode)
1577{ 1609{
1578 u32 temp; 1610 u32 temp;
1579 1611
@@ -1606,8 +1638,7 @@ pangea_shutdown(struct macio_chip *macio, int sleep_mode)
1606 (void)MACIO_IN32(KEYLARGO_FCR0); mdelay(1); 1638 (void)MACIO_IN32(KEYLARGO_FCR0); mdelay(1);
1607} 1639}
1608 1640
1609static void 1641static void intrepid_shutdown(struct macio_chip *macio, int sleep_mode)
1610intrepid_shutdown(struct macio_chip *macio, int sleep_mode)
1611{ 1642{
1612 u32 temp; 1643 u32 temp;
1613 1644
@@ -1635,113 +1666,6 @@ intrepid_shutdown(struct macio_chip *macio, int sleep_mode)
1635} 1666}
1636 1667
1637 1668
1638void pmac_tweak_clock_spreading(int enable)
1639{
1640 struct macio_chip *macio = &macio_chips[0];
1641
1642 /* Hack for doing clock spreading on some machines PowerBooks and
1643 * iBooks. This implements the "platform-do-clockspreading" OF
1644 * property as decoded manually on various models. For safety, we also
1645 * check the product ID in the device-tree in cases we'll whack the i2c
1646 * chip to make reasonably sure we won't set wrong values in there
1647 *
1648 * Of course, ultimately, we have to implement a real parser for
1649 * the platform-do-* stuff...
1650 */
1651
1652 if (macio->type == macio_intrepid) {
1653 if (enable)
1654 UN_OUT(UNI_N_CLOCK_SPREADING, 2);
1655 else
1656 UN_OUT(UNI_N_CLOCK_SPREADING, 0);
1657 mdelay(40);
1658 }
1659
1660 while (machine_is_compatible("PowerBook5,2") ||
1661 machine_is_compatible("PowerBook5,3") ||
1662 machine_is_compatible("PowerBook6,2") ||
1663 machine_is_compatible("PowerBook6,3")) {
1664 struct device_node *ui2c = of_find_node_by_type(NULL, "i2c");
1665 struct device_node *dt = of_find_node_by_name(NULL, "device-tree");
1666 u8 buffer[9];
1667 u32 *productID;
1668 int i, rc, changed = 0;
1669
1670 if (dt == NULL)
1671 break;
1672 productID = (u32 *)get_property(dt, "pid#", NULL);
1673 if (productID == NULL)
1674 break;
1675 while(ui2c) {
1676 struct device_node *p = of_get_parent(ui2c);
1677 if (p && !strcmp(p->name, "uni-n"))
1678 break;
1679 ui2c = of_find_node_by_type(ui2c, "i2c");
1680 }
1681 if (ui2c == NULL)
1682 break;
1683 DBG("Trying to bump clock speed for PID: %08x...\n", *productID);
1684 rc = pmac_low_i2c_open(ui2c, 1);
1685 if (rc != 0)
1686 break;
1687 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_combined);
1688 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_read, 0x80, buffer, 9);
1689 DBG("read result: %d,", rc);
1690 if (rc != 0) {
1691 pmac_low_i2c_close(ui2c);
1692 break;
1693 }
1694 for (i=0; i<9; i++)
1695 DBG(" %02x", buffer[i]);
1696 DBG("\n");
1697
1698 switch(*productID) {
1699 case 0x1182: /* AlBook 12" rev 2 */
1700 case 0x1183: /* iBook G4 12" */
1701 buffer[0] = (buffer[0] & 0x8f) | 0x70;
1702 buffer[2] = (buffer[2] & 0x7f) | 0x00;
1703 buffer[5] = (buffer[5] & 0x80) | 0x31;
1704 buffer[6] = (buffer[6] & 0x40) | 0xb0;
1705 buffer[7] = (buffer[7] & 0x00) | (enable ? 0xc0 : 0xba);
1706 buffer[8] = (buffer[8] & 0x00) | 0x30;
1707 changed = 1;
1708 break;
1709 case 0x3142: /* AlBook 15" (ATI M10) */
1710 case 0x3143: /* AlBook 17" (ATI M10) */
1711 buffer[0] = (buffer[0] & 0xaf) | 0x50;
1712 buffer[2] = (buffer[2] & 0x7f) | 0x00;
1713 buffer[5] = (buffer[5] & 0x80) | 0x31;
1714 buffer[6] = (buffer[6] & 0x40) | 0xb0;
1715 buffer[7] = (buffer[7] & 0x00) | (enable ? 0xd0 : 0xc0);
1716 buffer[8] = (buffer[8] & 0x00) | 0x30;
1717 changed = 1;
1718 break;
1719 default:
1720 DBG("i2c-hwclock: Machine model not handled\n");
1721 break;
1722 }
1723 if (!changed) {
1724 pmac_low_i2c_close(ui2c);
1725 break;
1726 }
1727 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_stdsub);
1728 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_write, 0x80, buffer, 9);
1729 DBG("write result: %d,", rc);
1730 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_combined);
1731 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_read, 0x80, buffer, 9);
1732 DBG("read result: %d,", rc);
1733 if (rc != 0) {
1734 pmac_low_i2c_close(ui2c);
1735 break;
1736 }
1737 for (i=0; i<9; i++)
1738 DBG(" %02x", buffer[i]);
1739 pmac_low_i2c_close(ui2c);
1740 break;
1741 }
1742}
1743
1744
1745static int 1669static int
1746core99_sleep(void) 1670core99_sleep(void)
1747{ 1671{
@@ -1898,6 +1822,8 @@ core99_wake_up(void)
1898 return 0; 1822 return 0;
1899} 1823}
1900 1824
1825#endif /* CONFIG_PM */
1826
1901static long 1827static long
1902core99_sleep_state(struct device_node *node, long param, long value) 1828core99_sleep_state(struct device_node *node, long param, long value)
1903{ 1829{
@@ -1919,10 +1845,13 @@ core99_sleep_state(struct device_node *node, long param, long value)
1919 if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0) 1845 if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0)
1920 return -EPERM; 1846 return -EPERM;
1921 1847
1848#ifdef CONFIG_PM
1922 if (value == 1) 1849 if (value == 1)
1923 return core99_sleep(); 1850 return core99_sleep();
1924 else if (value == 0) 1851 else if (value == 0)
1925 return core99_wake_up(); 1852 return core99_wake_up();
1853
1854#endif /* CONFIG_PM */
1926 return 0; 1855 return 0;
1927} 1856}
1928 1857
@@ -2046,7 +1975,9 @@ static struct feature_table_entry core99_features[] = {
2046 { PMAC_FTR_USB_ENABLE, core99_usb_enable }, 1975 { PMAC_FTR_USB_ENABLE, core99_usb_enable },
2047 { PMAC_FTR_1394_ENABLE, core99_firewire_enable }, 1976 { PMAC_FTR_1394_ENABLE, core99_firewire_enable },
2048 { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power }, 1977 { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power },
1978#ifdef CONFIG_PM
2049 { PMAC_FTR_SLEEP_STATE, core99_sleep_state }, 1979 { PMAC_FTR_SLEEP_STATE, core99_sleep_state },
1980#endif
2050#ifdef CONFIG_SMP 1981#ifdef CONFIG_SMP
2051 { PMAC_FTR_RESET_CPU, core99_reset_cpu }, 1982 { PMAC_FTR_RESET_CPU, core99_reset_cpu },
2052#endif /* CONFIG_SMP */ 1983#endif /* CONFIG_SMP */
@@ -2416,6 +2347,14 @@ static struct pmac_mb_def pmac_mb_defs[] = {
2416 PMAC_TYPE_POWERMAC_G5_U3L, g5_features, 2347 PMAC_TYPE_POWERMAC_G5_U3L, g5_features,
2417 0, 2348 0,
2418 }, 2349 },
2350 { "PowerMac11,2", "PowerMac G5 Dual Core",
2351 PMAC_TYPE_POWERMAC_G5_U3L, g5_features,
2352 0,
2353 },
2354 { "PowerMac12,1", "iMac G5 (iSight)",
2355 PMAC_TYPE_POWERMAC_G5_U3L, g5_features,
2356 0,
2357 },
2419 { "RackMac3,1", "XServe G5", 2358 { "RackMac3,1", "XServe G5",
2420 PMAC_TYPE_XSERVE_G5, g5_features, 2359 PMAC_TYPE_XSERVE_G5, g5_features,
2421 0, 2360 0,
@@ -2528,6 +2467,11 @@ static int __init probe_motherboard(void)
2528 pmac_mb.model_name = "Unknown K2-based"; 2467 pmac_mb.model_name = "Unknown K2-based";
2529 pmac_mb.features = g5_features; 2468 pmac_mb.features = g5_features;
2530 break; 2469 break;
2470 case macio_shasta:
2471 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_SHASTA;
2472 pmac_mb.model_name = "Unknown Shasta-based";
2473 pmac_mb.features = g5_features;
2474 break;
2531#endif /* CONFIG_POWER4 */ 2475#endif /* CONFIG_POWER4 */
2532 default: 2476 default:
2533 return -ENODEV; 2477 return -ENODEV;
@@ -2596,6 +2540,8 @@ found:
2596 */ 2540 */
2597static void __init probe_uninorth(void) 2541static void __init probe_uninorth(void)
2598{ 2542{
2543 u32 *addrp;
2544 phys_addr_t address;
2599 unsigned long actrl; 2545 unsigned long actrl;
2600 2546
2601 /* Locate core99 Uni-N */ 2547 /* Locate core99 Uni-N */
@@ -2603,22 +2549,31 @@ static void __init probe_uninorth(void)
2603 /* Locate G5 u3 */ 2549 /* Locate G5 u3 */
2604 if (uninorth_node == NULL) { 2550 if (uninorth_node == NULL) {
2605 uninorth_node = of_find_node_by_name(NULL, "u3"); 2551 uninorth_node = of_find_node_by_name(NULL, "u3");
2606 uninorth_u3 = 1; 2552 uninorth_maj = 3;
2607 } 2553 }
2608 if (uninorth_node && uninorth_node->n_addrs > 0) { 2554 /* Locate G5 u4 */
2609 unsigned long address = uninorth_node->addrs[0].address; 2555 if (uninorth_node == NULL) {
2610 uninorth_base = ioremap(address, 0x40000); 2556 uninorth_node = of_find_node_by_name(NULL, "u4");
2611 uninorth_rev = in_be32(UN_REG(UNI_N_VERSION)); 2557 uninorth_maj = 4;
2612 if (uninorth_u3) 2558 }
2613 u3_ht = ioremap(address + U3_HT_CONFIG_BASE, 0x1000); 2559 if (uninorth_node == NULL)
2614 } else
2615 uninorth_node = NULL;
2616
2617 if (!uninorth_node)
2618 return; 2560 return;
2619 2561
2620 printk(KERN_INFO "Found %s memory controller & host bridge, revision: %d\n", 2562 addrp = (u32 *)get_property(uninorth_node, "reg", NULL);
2621 uninorth_u3 ? "U3" : "UniNorth", uninorth_rev); 2563 if (addrp == NULL)
2564 return;
2565 address = of_translate_address(uninorth_node, addrp);
2566 if (address == 0)
2567 return;
2568 uninorth_base = ioremap(address, 0x40000);
2569 uninorth_rev = in_be32(UN_REG(UNI_N_VERSION));
2570 if (uninorth_maj == 3 || uninorth_maj == 4)
2571 u3_ht_base = ioremap(address + U3_HT_CONFIG_BASE, 0x1000);
2572
2573 printk(KERN_INFO "Found %s memory controller & host bridge"
2574 " @ 0x%08x revision: 0x%02x\n", uninorth_maj == 3 ? "U3" :
2575 uninorth_maj == 4 ? "U4" : "UniNorth",
2576 (unsigned int)address, uninorth_rev);
2622 printk(KERN_INFO "Mapped at 0x%08lx\n", (unsigned long)uninorth_base); 2577 printk(KERN_INFO "Mapped at 0x%08lx\n", (unsigned long)uninorth_base);
2623 2578
2624 /* Set the arbitrer QAck delay according to what Apple does 2579 /* Set the arbitrer QAck delay according to what Apple does
@@ -2626,7 +2581,8 @@ static void __init probe_uninorth(void)
2626 if (uninorth_rev < 0x11) { 2581 if (uninorth_rev < 0x11) {
2627 actrl = UN_IN(UNI_N_ARB_CTRL) & ~UNI_N_ARB_CTRL_QACK_DELAY_MASK; 2582 actrl = UN_IN(UNI_N_ARB_CTRL) & ~UNI_N_ARB_CTRL_QACK_DELAY_MASK;
2628 actrl |= ((uninorth_rev < 3) ? UNI_N_ARB_CTRL_QACK_DELAY105 : 2583 actrl |= ((uninorth_rev < 3) ? UNI_N_ARB_CTRL_QACK_DELAY105 :
2629 UNI_N_ARB_CTRL_QACK_DELAY) << UNI_N_ARB_CTRL_QACK_DELAY_SHIFT; 2584 UNI_N_ARB_CTRL_QACK_DELAY) <<
2585 UNI_N_ARB_CTRL_QACK_DELAY_SHIFT;
2630 UN_OUT(UNI_N_ARB_CTRL, actrl); 2586 UN_OUT(UNI_N_ARB_CTRL, actrl);
2631 } 2587 }
2632 2588
@@ -2634,7 +2590,8 @@ static void __init probe_uninorth(void)
2634 * revs 1.5 to 2.O and Pangea. Seem to toggle the UniN Maxbus/PCI 2590 * revs 1.5 to 2.O and Pangea. Seem to toggle the UniN Maxbus/PCI
2635 * memory timeout 2591 * memory timeout
2636 */ 2592 */
2637 if ((uninorth_rev >= 0x11 && uninorth_rev <= 0x24) || uninorth_rev == 0xc0) 2593 if ((uninorth_rev >= 0x11 && uninorth_rev <= 0x24) ||
2594 uninorth_rev == 0xc0)
2638 UN_OUT(0x2160, UN_IN(0x2160) & 0x00ffffff); 2595 UN_OUT(0x2160, UN_IN(0x2160) & 0x00ffffff);
2639} 2596}
2640 2597
@@ -2642,18 +2599,17 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ
2642{ 2599{
2643 struct device_node* node; 2600 struct device_node* node;
2644 int i; 2601 int i;
2645 volatile u32 __iomem * base; 2602 volatile u32 __iomem *base;
2646 u32* revp; 2603 u32 *addrp, *revp;
2604 phys_addr_t addr;
2605 u64 size;
2647 2606
2648 node = find_devices(name); 2607 for (node = NULL; (node = of_find_node_by_name(node, name)) != NULL;) {
2649 if (!node || !node->n_addrs) 2608 if (!compat)
2650 return; 2609 break;
2651 if (compat) 2610 if (device_is_compatible(node, compat))
2652 do { 2611 break;
2653 if (device_is_compatible(node, compat)) 2612 }
2654 break;
2655 node = node->next;
2656 } while (node);
2657 if (!node) 2613 if (!node)
2658 return; 2614 return;
2659 for(i=0; i<MAX_MACIO_CHIPS; i++) { 2615 for(i=0; i<MAX_MACIO_CHIPS; i++) {
@@ -2662,22 +2618,38 @@ static void __init probe_one_macio(const char *name, const char *compat, int typ
2662 if (macio_chips[i].of_node == node) 2618 if (macio_chips[i].of_node == node)
2663 return; 2619 return;
2664 } 2620 }
2621
2665 if (i >= MAX_MACIO_CHIPS) { 2622 if (i >= MAX_MACIO_CHIPS) {
2666 printk(KERN_ERR "pmac_feature: Please increase MAX_MACIO_CHIPS !\n"); 2623 printk(KERN_ERR "pmac_feature: Please increase MAX_MACIO_CHIPS !\n");
2667 printk(KERN_ERR "pmac_feature: %s skipped\n", node->full_name); 2624 printk(KERN_ERR "pmac_feature: %s skipped\n", node->full_name);
2668 return; 2625 return;
2669 } 2626 }
2670 base = ioremap(node->addrs[0].address, node->addrs[0].size); 2627 addrp = of_get_pci_address(node, 0, &size, NULL);
2628 if (addrp == NULL) {
2629 printk(KERN_ERR "pmac_feature: %s: can't find base !\n",
2630 node->full_name);
2631 return;
2632 }
2633 addr = of_translate_address(node, addrp);
2634 if (addr == 0) {
2635 printk(KERN_ERR "pmac_feature: %s, can't translate base !\n",
2636 node->full_name);
2637 return;
2638 }
2639 base = ioremap(addr, (unsigned long)size);
2671 if (!base) { 2640 if (!base) {
2672 printk(KERN_ERR "pmac_feature: Can't map mac-io chip !\n"); 2641 printk(KERN_ERR "pmac_feature: %s, can't map mac-io chip !\n",
2642 node->full_name);
2673 return; 2643 return;
2674 } 2644 }
2675 if (type == macio_keylargo) { 2645 if (type == macio_keylargo || type == macio_keylargo2) {
2676 u32 *did = (u32 *)get_property(node, "device-id", NULL); 2646 u32 *did = (u32 *)get_property(node, "device-id", NULL);
2677 if (*did == 0x00000025) 2647 if (*did == 0x00000025)
2678 type = macio_pangea; 2648 type = macio_pangea;
2679 if (*did == 0x0000003e) 2649 if (*did == 0x0000003e)
2680 type = macio_intrepid; 2650 type = macio_intrepid;
2651 if (*did == 0x0000004f)
2652 type = macio_shasta;
2681 } 2653 }
2682 macio_chips[i].of_node = node; 2654 macio_chips[i].of_node = node;
2683 macio_chips[i].type = type; 2655 macio_chips[i].type = type;
@@ -2776,7 +2748,8 @@ set_initial_features(void)
2776 } 2748 }
2777 2749
2778#ifdef CONFIG_POWER4 2750#ifdef CONFIG_POWER4
2779 if (macio_chips[0].type == macio_keylargo2) { 2751 if (macio_chips[0].type == macio_keylargo2 ||
2752 macio_chips[0].type == macio_shasta) {
2780#ifndef CONFIG_SMP 2753#ifndef CONFIG_SMP
2781 /* On SMP machines running UP, we have the second CPU eating 2754 /* On SMP machines running UP, we have the second CPU eating
2782 * bus cycles. We need to take it off the bus. This is done 2755 * bus cycles. We need to take it off the bus. This is done
@@ -2885,12 +2858,6 @@ set_initial_features(void)
2885 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_POWER_N); 2858 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_POWER_N);
2886 } 2859 }
2887 2860
2888 /* Some machine models need the clock chip to be properly setup for
2889 * clock spreading now. This should be a platform function but we
2890 * don't do these at the moment
2891 */
2892 pmac_tweak_clock_spreading(1);
2893
2894#endif /* CONFIG_POWER4 */ 2861#endif /* CONFIG_POWER4 */
2895 2862
2896 /* On all machines, switch modem & serial ports off */ 2863 /* On all machines, switch modem & serial ports off */
@@ -2918,9 +2885,6 @@ pmac_feature_init(void)
2918 return; 2885 return;
2919 } 2886 }
2920 2887
2921 /* Setup low-level i2c stuffs */
2922 pmac_init_low_i2c();
2923
2924 /* Probe machine type */ 2888 /* Probe machine type */
2925 if (probe_motherboard()) 2889 if (probe_motherboard())
2926 printk(KERN_WARNING "Unknown PowerMac !\n"); 2890 printk(KERN_WARNING "Unknown PowerMac !\n");
@@ -2931,26 +2895,6 @@ pmac_feature_init(void)
2931 set_initial_features(); 2895 set_initial_features();
2932} 2896}
2933 2897
2934int __init pmac_feature_late_init(void)
2935{
2936#if 0
2937 struct device_node *np;
2938
2939 /* Request some resources late */
2940 if (uninorth_node)
2941 request_OF_resource(uninorth_node, 0, NULL);
2942 np = find_devices("hammerhead");
2943 if (np)
2944 request_OF_resource(np, 0, NULL);
2945 np = find_devices("interrupt-controller");
2946 if (np)
2947 request_OF_resource(np, 0, NULL);
2948#endif
2949 return 0;
2950}
2951
2952device_initcall(pmac_feature_late_init);
2953
2954#if 0 2898#if 0
2955static void dump_HT_speeds(char *name, u32 cfg, u32 frq) 2899static void dump_HT_speeds(char *name, u32 cfg, u32 frq)
2956{ 2900{
@@ -2973,9 +2917,9 @@ void __init pmac_check_ht_link(void)
2973 u8 px_bus, px_devfn; 2917 u8 px_bus, px_devfn;
2974 struct pci_controller *px_hose; 2918 struct pci_controller *px_hose;
2975 2919
2976 (void)in_be32(u3_ht + U3_HT_LINK_COMMAND); 2920 (void)in_be32(u3_ht_base + U3_HT_LINK_COMMAND);
2977 ucfg = cfg = in_be32(u3_ht + U3_HT_LINK_CONFIG); 2921 ucfg = cfg = in_be32(u3_ht_base + U3_HT_LINK_CONFIG);
2978 ufreq = freq = in_be32(u3_ht + U3_HT_LINK_FREQ); 2922 ufreq = freq = in_be32(u3_ht_base + U3_HT_LINK_FREQ);
2979 dump_HT_speeds("U3 HyperTransport", cfg, freq); 2923 dump_HT_speeds("U3 HyperTransport", cfg, freq);
2980 2924
2981 pcix_node = of_find_compatible_node(NULL, "pci", "pci-x"); 2925 pcix_node = of_find_compatible_node(NULL, "pci", "pci-x");
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index f3f39e8e337a..535c802b369f 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -1,22 +1,34 @@
1/* 1/*
2 * arch/ppc/platforms/pmac_low_i2c.c 2 * arch/powerpc/platforms/powermac/low_i2c.c
3 * 3 *
4 * Copyright (C) 2003 Ben. Herrenschmidt (benh@kernel.crashing.org) 4 * Copyright (C) 2003-2005 Ben. Herrenschmidt (benh@kernel.crashing.org)
5 * 5 *
6 * This program is free software; you can redistribute it and/or 6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License 7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 * 10 *
11 * This file contains some low-level i2c access routines that 11 * The linux i2c layer isn't completely suitable for our needs for various
12 * need to be used by various bits of the PowerMac platform code 12 * reasons ranging from too late initialisation to semantics not perfectly
13 * at times where the real asynchronous & interrupt driven driver 13 * matching some requirements of the apple platform functions etc...
14 * cannot be used. The API borrows some semantics from the darwin 14 *
15 * driver in order to ease the implementation of the platform 15 * This file thus provides a simple low level unified i2c interface for
16 * properties parser 16 * powermac that covers the various types of i2c busses used in Apple machines.
17 * For now, keywest, PMU and SMU, though we could add Cuda, or other bit
18 * banging busses found on older chipstes in earlier machines if we ever need
19 * one of them.
20 *
21 * The drivers in this file are synchronous/blocking. In addition, the
22 * keywest one is fairly slow due to the use of msleep instead of interrupts
23 * as the interrupt is currently used by i2c-keywest. In the long run, we
24 * might want to get rid of those high-level interfaces to linux i2c layer
25 * either completely (converting all drivers) or replacing them all with a
26 * single stub driver on top of this one. Once done, the interrupt will be
27 * available for our use.
17 */ 28 */
18 29
19#undef DEBUG 30#undef DEBUG
31#undef DEBUG_LOW
20 32
21#include <linux/config.h> 33#include <linux/config.h>
22#include <linux/types.h> 34#include <linux/types.h>
@@ -25,66 +37,91 @@
25#include <linux/module.h> 37#include <linux/module.h>
26#include <linux/adb.h> 38#include <linux/adb.h>
27#include <linux/pmu.h> 39#include <linux/pmu.h>
40#include <linux/delay.h>
41#include <linux/completion.h>
42#include <linux/platform_device.h>
43#include <linux/interrupt.h>
44#include <linux/completion.h>
45#include <linux/timer.h>
28#include <asm/keylargo.h> 46#include <asm/keylargo.h>
29#include <asm/uninorth.h> 47#include <asm/uninorth.h>
30#include <asm/io.h> 48#include <asm/io.h>
31#include <asm/prom.h> 49#include <asm/prom.h>
32#include <asm/machdep.h> 50#include <asm/machdep.h>
51#include <asm/smu.h>
52#include <asm/pmac_pfunc.h>
33#include <asm/pmac_low_i2c.h> 53#include <asm/pmac_low_i2c.h>
34 54
35#define MAX_LOW_I2C_HOST 4
36
37#ifdef DEBUG 55#ifdef DEBUG
38#define DBG(x...) do {\ 56#define DBG(x...) do {\
39 printk(KERN_DEBUG "KW:" x); \ 57 printk(KERN_DEBUG "low_i2c:" x); \
40 } while(0) 58 } while(0)
41#else 59#else
42#define DBG(x...) 60#define DBG(x...)
43#endif 61#endif
44 62
45struct low_i2c_host; 63#ifdef DEBUG_LOW
46 64#define DBG_LOW(x...) do {\
47typedef int (*low_i2c_func_t)(struct low_i2c_host *host, u8 addr, u8 sub, u8 *data, int len); 65 printk(KERN_DEBUG "low_i2c:" x); \
66 } while(0)
67#else
68#define DBG_LOW(x...)
69#endif
48 70
49struct low_i2c_host
50{
51 struct device_node *np; /* OF device node */
52 struct semaphore mutex; /* Access mutex for use by i2c-keywest */
53 low_i2c_func_t func; /* Access function */
54 unsigned int is_open : 1; /* Poor man's access control */
55 int mode; /* Current mode */
56 int channel; /* Current channel */
57 int num_channels; /* Number of channels */
58 void __iomem *base; /* For keywest-i2c, base address */
59 int bsteps; /* And register stepping */
60 int speed; /* And speed */
61};
62 71
63static struct low_i2c_host low_i2c_hosts[MAX_LOW_I2C_HOST]; 72static int pmac_i2c_force_poll = 1;
64 73
65/* No locking is necessary on allocation, we are running way before 74/*
66 * anything can race with us 75 * A bus structure. Each bus in the system has such a structure associated.
67 */ 76 */
68static struct low_i2c_host *find_low_i2c_host(struct device_node *np) 77struct pmac_i2c_bus
69{ 78{
70 int i; 79 struct list_head link;
80 struct device_node *controller;
81 struct device_node *busnode;
82 int type;
83 int flags;
84 struct i2c_adapter *adapter;
85 void *hostdata;
86 int channel; /* some hosts have multiple */
87 int mode; /* current mode */
88 struct semaphore sem;
89 int opened;
90 int polled; /* open mode */
91 struct platform_device *platform_dev;
92
93 /* ops */
94 int (*open)(struct pmac_i2c_bus *bus);
95 void (*close)(struct pmac_i2c_bus *bus);
96 int (*xfer)(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
97 u32 subaddr, u8 *data, int len);
98};
71 99
72 for (i = 0; i < MAX_LOW_I2C_HOST; i++) 100static LIST_HEAD(pmac_i2c_busses);
73 if (low_i2c_hosts[i].np == np)
74 return &low_i2c_hosts[i];
75 return NULL;
76}
77 101
78/* 102/*
79 * 103 * Keywest implementation
80 * i2c-keywest implementation (UniNorth, U2, U3, Keylargo's)
81 *
82 */ 104 */
83 105
84/* 106struct pmac_i2c_host_kw
85 * Keywest i2c definitions borrowed from drivers/i2c/i2c-keywest.h, 107{
86 * should be moved somewhere in include/asm-ppc/ 108 struct semaphore mutex; /* Access mutex for use by
87 */ 109 * i2c-keywest */
110 void __iomem *base; /* register base address */
111 int bsteps; /* register stepping */
112 int speed; /* speed */
113 int irq;
114 u8 *data;
115 unsigned len;
116 int state;
117 int rw;
118 int polled;
119 int result;
120 struct completion complete;
121 spinlock_t lock;
122 struct timer_list timeout_timer;
123};
124
88/* Register indices */ 125/* Register indices */
89typedef enum { 126typedef enum {
90 reg_mode = 0, 127 reg_mode = 0,
@@ -97,6 +134,8 @@ typedef enum {
97 reg_data 134 reg_data
98} reg_t; 135} reg_t;
99 136
137/* The Tumbler audio equalizer can be really slow sometimes */
138#define KW_POLL_TIMEOUT (2*HZ)
100 139
101/* Mode register */ 140/* Mode register */
102#define KW_I2C_MODE_100KHZ 0x00 141#define KW_I2C_MODE_100KHZ 0x00
@@ -140,8 +179,9 @@ enum {
140}; 179};
141 180
142#define WRONG_STATE(name) do {\ 181#define WRONG_STATE(name) do {\
143 printk(KERN_DEBUG "KW: wrong state. Got %s, state: %s (isr: %02x)\n", \ 182 printk(KERN_DEBUG "KW: wrong state. Got %s, state: %s " \
144 name, __kw_state_names[state], isr); \ 183 "(isr: %02x)\n", \
184 name, __kw_state_names[host->state], isr); \
145 } while(0) 185 } while(0)
146 186
147static const char *__kw_state_names[] = { 187static const char *__kw_state_names[] = {
@@ -153,120 +193,137 @@ static const char *__kw_state_names[] = {
153 "state_dead" 193 "state_dead"
154}; 194};
155 195
156static inline u8 __kw_read_reg(struct low_i2c_host *host, reg_t reg) 196static inline u8 __kw_read_reg(struct pmac_i2c_host_kw *host, reg_t reg)
157{ 197{
158 return readb(host->base + (((unsigned int)reg) << host->bsteps)); 198 return readb(host->base + (((unsigned int)reg) << host->bsteps));
159} 199}
160 200
161static inline void __kw_write_reg(struct low_i2c_host *host, reg_t reg, u8 val) 201static inline void __kw_write_reg(struct pmac_i2c_host_kw *host,
202 reg_t reg, u8 val)
162{ 203{
163 writeb(val, host->base + (((unsigned)reg) << host->bsteps)); 204 writeb(val, host->base + (((unsigned)reg) << host->bsteps));
164 (void)__kw_read_reg(host, reg_subaddr); 205 (void)__kw_read_reg(host, reg_subaddr);
165} 206}
166 207
167#define kw_write_reg(reg, val) __kw_write_reg(host, reg, val) 208#define kw_write_reg(reg, val) __kw_write_reg(host, reg, val)
168#define kw_read_reg(reg) __kw_read_reg(host, reg) 209#define kw_read_reg(reg) __kw_read_reg(host, reg)
169
170 210
171/* Don't schedule, the g5 fan controller is too 211static u8 kw_i2c_wait_interrupt(struct pmac_i2c_host_kw *host)
172 * timing sensitive
173 */
174static u8 kw_wait_interrupt(struct low_i2c_host* host)
175{ 212{
176 int i, j; 213 int i, j;
177 u8 isr; 214 u8 isr;
178 215
179 for (i = 0; i < 100000; i++) { 216 for (i = 0; i < 1000; i++) {
180 isr = kw_read_reg(reg_isr) & KW_I2C_IRQ_MASK; 217 isr = kw_read_reg(reg_isr) & KW_I2C_IRQ_MASK;
181 if (isr != 0) 218 if (isr != 0)
182 return isr; 219 return isr;
183 220
184 /* This code is used with the timebase frozen, we cannot rely 221 /* This code is used with the timebase frozen, we cannot rely
185 * on udelay ! For now, just use a bogus loop 222 * on udelay nor schedule when in polled mode !
223 * For now, just use a bogus loop....
186 */ 224 */
187 for (j = 1; j < 10000; j++) 225 if (host->polled) {
188 mb(); 226 for (j = 1; j < 100000; j++)
227 mb();
228 } else
229 msleep(1);
189 } 230 }
190 return isr; 231 return isr;
191} 232}
192 233
193static int kw_handle_interrupt(struct low_i2c_host *host, int state, int rw, int *rc, u8 **data, int *len, u8 isr) 234static void kw_i2c_handle_interrupt(struct pmac_i2c_host_kw *host, u8 isr)
194{ 235{
195 u8 ack; 236 u8 ack;
196 237
197 DBG("kw_handle_interrupt(%s, isr: %x)\n", __kw_state_names[state], isr); 238 DBG_LOW("kw_handle_interrupt(%s, isr: %x)\n",
239 __kw_state_names[host->state], isr);
240
241 if (host->state == state_idle) {
242 printk(KERN_WARNING "low_i2c: Keywest got an out of state"
243 " interrupt, ignoring\n");
244 kw_write_reg(reg_isr, isr);
245 return;
246 }
198 247
199 if (isr == 0) { 248 if (isr == 0) {
200 if (state != state_stop) { 249 if (host->state != state_stop) {
201 DBG("KW: Timeout !\n"); 250 DBG_LOW("KW: Timeout !\n");
202 *rc = -EIO; 251 host->result = -EIO;
203 goto stop; 252 goto stop;
204 } 253 }
205 if (state == state_stop) { 254 if (host->state == state_stop) {
206 ack = kw_read_reg(reg_status); 255 ack = kw_read_reg(reg_status);
207 if (!(ack & KW_I2C_STAT_BUSY)) { 256 if (ack & KW_I2C_STAT_BUSY)
208 state = state_idle; 257 kw_write_reg(reg_status, 0);
209 kw_write_reg(reg_ier, 0x00); 258 host->state = state_idle;
210 } 259 kw_write_reg(reg_ier, 0x00);
260 if (!host->polled)
261 complete(&host->complete);
211 } 262 }
212 return state; 263 return;
213 } 264 }
214 265
215 if (isr & KW_I2C_IRQ_ADDR) { 266 if (isr & KW_I2C_IRQ_ADDR) {
216 ack = kw_read_reg(reg_status); 267 ack = kw_read_reg(reg_status);
217 if (state != state_addr) { 268 if (host->state != state_addr) {
218 kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR); 269 kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR);
219 WRONG_STATE("KW_I2C_IRQ_ADDR"); 270 WRONG_STATE("KW_I2C_IRQ_ADDR");
220 *rc = -EIO; 271 host->result = -EIO;
221 goto stop; 272 goto stop;
222 } 273 }
223 if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { 274 if ((ack & KW_I2C_STAT_LAST_AAK) == 0) {
224 *rc = -ENODEV; 275 host->result = -ENODEV;
225 DBG("KW: NAK on address\n"); 276 DBG_LOW("KW: NAK on address\n");
226 return state_stop; 277 host->state = state_stop;
278 return;
227 } else { 279 } else {
228 if (rw) { 280 if (host->len == 0) {
229 state = state_read; 281 kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR);
230 if (*len > 1) 282 goto stop;
231 kw_write_reg(reg_control, KW_I2C_CTL_AAK); 283 }
284 if (host->rw) {
285 host->state = state_read;
286 if (host->len > 1)
287 kw_write_reg(reg_control,
288 KW_I2C_CTL_AAK);
232 } else { 289 } else {
233 state = state_write; 290 host->state = state_write;
234 kw_write_reg(reg_data, **data); 291 kw_write_reg(reg_data, *(host->data++));
235 (*data)++; (*len)--; 292 host->len--;
236 } 293 }
237 } 294 }
238 kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR); 295 kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR);
239 } 296 }
240 297
241 if (isr & KW_I2C_IRQ_DATA) { 298 if (isr & KW_I2C_IRQ_DATA) {
242 if (state == state_read) { 299 if (host->state == state_read) {
243 **data = kw_read_reg(reg_data); 300 *(host->data++) = kw_read_reg(reg_data);
244 (*data)++; (*len)--; 301 host->len--;
245 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); 302 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA);
246 if ((*len) == 0) 303 if (host->len == 0)
247 state = state_stop; 304 host->state = state_stop;
248 else if ((*len) == 1) 305 else if (host->len == 1)
249 kw_write_reg(reg_control, 0); 306 kw_write_reg(reg_control, 0);
250 } else if (state == state_write) { 307 } else if (host->state == state_write) {
251 ack = kw_read_reg(reg_status); 308 ack = kw_read_reg(reg_status);
252 if ((ack & KW_I2C_STAT_LAST_AAK) == 0) { 309 if ((ack & KW_I2C_STAT_LAST_AAK) == 0) {
253 DBG("KW: nack on data write\n"); 310 DBG_LOW("KW: nack on data write\n");
254 *rc = -EIO; 311 host->result = -EIO;
255 goto stop; 312 goto stop;
256 } else if (*len) { 313 } else if (host->len) {
257 kw_write_reg(reg_data, **data); 314 kw_write_reg(reg_data, *(host->data++));
258 (*data)++; (*len)--; 315 host->len--;
259 } else { 316 } else {
260 kw_write_reg(reg_control, KW_I2C_CTL_STOP); 317 kw_write_reg(reg_control, KW_I2C_CTL_STOP);
261 state = state_stop; 318 host->state = state_stop;
262 *rc = 0; 319 host->result = 0;
263 } 320 }
264 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); 321 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA);
265 } else { 322 } else {
266 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA); 323 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA);
267 WRONG_STATE("KW_I2C_IRQ_DATA"); 324 WRONG_STATE("KW_I2C_IRQ_DATA");
268 if (state != state_stop) { 325 if (host->state != state_stop) {
269 *rc = -EIO; 326 host->result = -EIO;
270 goto stop; 327 goto stop;
271 } 328 }
272 } 329 }
@@ -274,98 +331,194 @@ static int kw_handle_interrupt(struct low_i2c_host *host, int state, int rw, int
274 331
275 if (isr & KW_I2C_IRQ_STOP) { 332 if (isr & KW_I2C_IRQ_STOP) {
276 kw_write_reg(reg_isr, KW_I2C_IRQ_STOP); 333 kw_write_reg(reg_isr, KW_I2C_IRQ_STOP);
277 if (state != state_stop) { 334 if (host->state != state_stop) {
278 WRONG_STATE("KW_I2C_IRQ_STOP"); 335 WRONG_STATE("KW_I2C_IRQ_STOP");
279 *rc = -EIO; 336 host->result = -EIO;
280 } 337 }
281 return state_idle; 338 host->state = state_idle;
339 if (!host->polled)
340 complete(&host->complete);
282 } 341 }
283 342
284 if (isr & KW_I2C_IRQ_START) 343 if (isr & KW_I2C_IRQ_START)
285 kw_write_reg(reg_isr, KW_I2C_IRQ_START); 344 kw_write_reg(reg_isr, KW_I2C_IRQ_START);
286 345
287 return state; 346 return;
288
289 stop: 347 stop:
290 kw_write_reg(reg_control, KW_I2C_CTL_STOP); 348 kw_write_reg(reg_control, KW_I2C_CTL_STOP);
291 return state_stop; 349 host->state = state_stop;
350 return;
292} 351}
293 352
294static int keywest_low_i2c_func(struct low_i2c_host *host, u8 addr, u8 subaddr, u8 *data, int len) 353/* Interrupt handler */
354static irqreturn_t kw_i2c_irq(int irq, void *dev_id, struct pt_regs *regs)
295{ 355{
356 struct pmac_i2c_host_kw *host = dev_id;
357 unsigned long flags;
358
359 spin_lock_irqsave(&host->lock, flags);
360 del_timer(&host->timeout_timer);
361 kw_i2c_handle_interrupt(host, kw_read_reg(reg_isr));
362 if (host->state != state_idle) {
363 host->timeout_timer.expires = jiffies + KW_POLL_TIMEOUT;
364 add_timer(&host->timeout_timer);
365 }
366 spin_unlock_irqrestore(&host->lock, flags);
367 return IRQ_HANDLED;
368}
369
370static void kw_i2c_timeout(unsigned long data)
371{
372 struct pmac_i2c_host_kw *host = (struct pmac_i2c_host_kw *)data;
373 unsigned long flags;
374
375 spin_lock_irqsave(&host->lock, flags);
376 kw_i2c_handle_interrupt(host, kw_read_reg(reg_isr));
377 if (host->state != state_idle) {
378 host->timeout_timer.expires = jiffies + KW_POLL_TIMEOUT;
379 add_timer(&host->timeout_timer);
380 }
381 spin_unlock_irqrestore(&host->lock, flags);
382}
383
384static int kw_i2c_open(struct pmac_i2c_bus *bus)
385{
386 struct pmac_i2c_host_kw *host = bus->hostdata;
387 down(&host->mutex);
388 return 0;
389}
390
391static void kw_i2c_close(struct pmac_i2c_bus *bus)
392{
393 struct pmac_i2c_host_kw *host = bus->hostdata;
394 up(&host->mutex);
395}
396
397static int kw_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
398 u32 subaddr, u8 *data, int len)
399{
400 struct pmac_i2c_host_kw *host = bus->hostdata;
296 u8 mode_reg = host->speed; 401 u8 mode_reg = host->speed;
297 int state = state_addr; 402 int use_irq = host->irq != NO_IRQ && !bus->polled;
298 int rc = 0;
299 403
300 /* Setup mode & subaddress if any */ 404 /* Setup mode & subaddress if any */
301 switch(host->mode) { 405 switch(bus->mode) {
302 case pmac_low_i2c_mode_dumb: 406 case pmac_i2c_mode_dumb:
303 printk(KERN_ERR "low_i2c: Dumb mode not supported !\n");
304 return -EINVAL; 407 return -EINVAL;
305 case pmac_low_i2c_mode_std: 408 case pmac_i2c_mode_std:
306 mode_reg |= KW_I2C_MODE_STANDARD; 409 mode_reg |= KW_I2C_MODE_STANDARD;
410 if (subsize != 0)
411 return -EINVAL;
307 break; 412 break;
308 case pmac_low_i2c_mode_stdsub: 413 case pmac_i2c_mode_stdsub:
309 mode_reg |= KW_I2C_MODE_STANDARDSUB; 414 mode_reg |= KW_I2C_MODE_STANDARDSUB;
415 if (subsize != 1)
416 return -EINVAL;
310 break; 417 break;
311 case pmac_low_i2c_mode_combined: 418 case pmac_i2c_mode_combined:
312 mode_reg |= KW_I2C_MODE_COMBINED; 419 mode_reg |= KW_I2C_MODE_COMBINED;
420 if (subsize != 1)
421 return -EINVAL;
313 break; 422 break;
314 } 423 }
315 424
316 /* Setup channel & clear pending irqs */ 425 /* Setup channel & clear pending irqs */
317 kw_write_reg(reg_isr, kw_read_reg(reg_isr)); 426 kw_write_reg(reg_isr, kw_read_reg(reg_isr));
318 kw_write_reg(reg_mode, mode_reg | (host->channel << 4)); 427 kw_write_reg(reg_mode, mode_reg | (bus->channel << 4));
319 kw_write_reg(reg_status, 0); 428 kw_write_reg(reg_status, 0);
320 429
321 /* Set up address and r/w bit */ 430 /* Set up address and r/w bit, strip possible stale bus number from
322 kw_write_reg(reg_addr, addr); 431 * address top bits
432 */
433 kw_write_reg(reg_addr, addrdir & 0xff);
323 434
324 /* Set up the sub address */ 435 /* Set up the sub address */
325 if ((mode_reg & KW_I2C_MODE_MODE_MASK) == KW_I2C_MODE_STANDARDSUB 436 if ((mode_reg & KW_I2C_MODE_MODE_MASK) == KW_I2C_MODE_STANDARDSUB
326 || (mode_reg & KW_I2C_MODE_MODE_MASK) == KW_I2C_MODE_COMBINED) 437 || (mode_reg & KW_I2C_MODE_MODE_MASK) == KW_I2C_MODE_COMBINED)
327 kw_write_reg(reg_subaddr, subaddr); 438 kw_write_reg(reg_subaddr, subaddr);
328 439
329 /* Start sending address & disable interrupt*/ 440 /* Prepare for async operations */
330 kw_write_reg(reg_ier, 0 /*KW_I2C_IRQ_MASK*/); 441 host->data = data;
442 host->len = len;
443 host->state = state_addr;
444 host->result = 0;
445 host->rw = (addrdir & 1);
446 host->polled = bus->polled;
447
448 /* Enable interrupt if not using polled mode and interrupt is
449 * available
450 */
451 if (use_irq) {
452 /* Clear completion */
453 INIT_COMPLETION(host->complete);
454 /* Ack stale interrupts */
455 kw_write_reg(reg_isr, kw_read_reg(reg_isr));
456 /* Arm timeout */
457 host->timeout_timer.expires = jiffies + KW_POLL_TIMEOUT;
458 add_timer(&host->timeout_timer);
459 /* Enable emission */
460 kw_write_reg(reg_ier, KW_I2C_IRQ_MASK);
461 }
462
463 /* Start sending address */
331 kw_write_reg(reg_control, KW_I2C_CTL_XADDR); 464 kw_write_reg(reg_control, KW_I2C_CTL_XADDR);
332 465
333 /* State machine, to turn into an interrupt handler */ 466 /* Wait for completion */
334 while(state != state_idle) { 467 if (use_irq)
335 u8 isr = kw_wait_interrupt(host); 468 wait_for_completion(&host->complete);
336 state = kw_handle_interrupt(host, state, addr & 1, &rc, &data, &len, isr); 469 else {
470 while(host->state != state_idle) {
471 unsigned long flags;
472
473 u8 isr = kw_i2c_wait_interrupt(host);
474 spin_lock_irqsave(&host->lock, flags);
475 kw_i2c_handle_interrupt(host, isr);
476 spin_unlock_irqrestore(&host->lock, flags);
477 }
337 } 478 }
338 479
339 return rc; 480 /* Disable emission */
481 kw_write_reg(reg_ier, 0);
482
483 return host->result;
340} 484}
341 485
342static void keywest_low_i2c_add(struct device_node *np) 486static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np)
343{ 487{
344 struct low_i2c_host *host = find_low_i2c_host(NULL); 488 struct pmac_i2c_host_kw *host;
345 u32 *psteps, *prate, steps, aoffset = 0; 489 u32 *psteps, *prate, *addrp, steps;
346 struct device_node *parent;
347 490
491 host = kzalloc(sizeof(struct pmac_i2c_host_kw), GFP_KERNEL);
348 if (host == NULL) { 492 if (host == NULL) {
349 printk(KERN_ERR "low_i2c: Can't allocate host for %s\n", 493 printk(KERN_ERR "low_i2c: Can't allocate host for %s\n",
350 np->full_name); 494 np->full_name);
351 return; 495 return NULL;
352 } 496 }
353 memset(host, 0, sizeof(*host));
354 497
498 /* Apple is kind enough to provide a valid AAPL,address property
499 * on all i2c keywest nodes so far ... we would have to fallback
500 * to macio parsing if that wasn't the case
501 */
502 addrp = (u32 *)get_property(np, "AAPL,address", NULL);
503 if (addrp == NULL) {
504 printk(KERN_ERR "low_i2c: Can't find address for %s\n",
505 np->full_name);
506 kfree(host);
507 return NULL;
508 }
355 init_MUTEX(&host->mutex); 509 init_MUTEX(&host->mutex);
356 host->np = of_node_get(np); 510 init_completion(&host->complete);
511 spin_lock_init(&host->lock);
512 init_timer(&host->timeout_timer);
513 host->timeout_timer.function = kw_i2c_timeout;
514 host->timeout_timer.data = (unsigned long)host;
515
357 psteps = (u32 *)get_property(np, "AAPL,address-step", NULL); 516 psteps = (u32 *)get_property(np, "AAPL,address-step", NULL);
358 steps = psteps ? (*psteps) : 0x10; 517 steps = psteps ? (*psteps) : 0x10;
359 for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++) 518 for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++)
360 steps >>= 1; 519 steps >>= 1;
361 parent = of_get_parent(np);
362 host->num_channels = 1;
363 if (parent && parent->name[0] == 'u') {
364 host->num_channels = 2;
365 aoffset = 3;
366 }
367 /* Select interface rate */ 520 /* Select interface rate */
368 host->speed = KW_I2C_MODE_100KHZ; 521 host->speed = KW_I2C_MODE_25KHZ;
369 prate = (u32 *)get_property(np, "AAPL,i2c-rate", NULL); 522 prate = (u32 *)get_property(np, "AAPL,i2c-rate", NULL);
370 if (prate) switch(*prate) { 523 if (prate) switch(*prate) {
371 case 100: 524 case 100:
@@ -378,146 +531,981 @@ static void keywest_low_i2c_add(struct device_node *np)
378 host->speed = KW_I2C_MODE_25KHZ; 531 host->speed = KW_I2C_MODE_25KHZ;
379 break; 532 break;
380 } 533 }
534 if (np->n_intrs > 0)
535 host->irq = np->intrs[0].line;
536 else
537 host->irq = NO_IRQ;
538
539 host->base = ioremap((*addrp), 0x1000);
540 if (host->base == NULL) {
541 printk(KERN_ERR "low_i2c: Can't map registers for %s\n",
542 np->full_name);
543 kfree(host);
544 return NULL;
545 }
546
547 /* Make sure IRA is disabled */
548 kw_write_reg(reg_ier, 0);
549
550 /* Request chip interrupt */
551 if (request_irq(host->irq, kw_i2c_irq, SA_SHIRQ, "keywest i2c", host))
552 host->irq = NO_IRQ;
553
554 printk(KERN_INFO "KeyWest i2c @0x%08x irq %d %s\n",
555 *addrp, host->irq, np->full_name);
381 556
382 host->mode = pmac_low_i2c_mode_std; 557 return host;
383 host->base = ioremap(np->addrs[0].address + aoffset,
384 np->addrs[0].size);
385 host->func = keywest_low_i2c_func;
386} 558}
387 559
560
561static void __init kw_i2c_add(struct pmac_i2c_host_kw *host,
562 struct device_node *controller,
563 struct device_node *busnode,
564 int channel)
565{
566 struct pmac_i2c_bus *bus;
567
568 bus = kzalloc(sizeof(struct pmac_i2c_bus), GFP_KERNEL);
569 if (bus == NULL)
570 return;
571
572 bus->controller = of_node_get(controller);
573 bus->busnode = of_node_get(busnode);
574 bus->type = pmac_i2c_bus_keywest;
575 bus->hostdata = host;
576 bus->channel = channel;
577 bus->mode = pmac_i2c_mode_std;
578 bus->open = kw_i2c_open;
579 bus->close = kw_i2c_close;
580 bus->xfer = kw_i2c_xfer;
581 init_MUTEX(&bus->sem);
582 if (controller == busnode)
583 bus->flags = pmac_i2c_multibus;
584 list_add(&bus->link, &pmac_i2c_busses);
585
586 printk(KERN_INFO " channel %d bus %s\n", channel,
587 (controller == busnode) ? "<multibus>" : busnode->full_name);
588}
589
590static void __init kw_i2c_probe(void)
591{
592 struct device_node *np, *child, *parent;
593
594 /* Probe keywest-i2c busses */
595 for (np = NULL;
596 (np = of_find_compatible_node(np, "i2c","keywest-i2c")) != NULL;){
597 struct pmac_i2c_host_kw *host;
598 int multibus, chans, i;
599
600 /* Found one, init a host structure */
601 host = kw_i2c_host_init(np);
602 if (host == NULL)
603 continue;
604
605 /* Now check if we have a multibus setup (old style) or if we
606 * have proper bus nodes. Note that the "new" way (proper bus
607 * nodes) might cause us to not create some busses that are
608 * kept hidden in the device-tree. In the future, we might
609 * want to work around that by creating busses without a node
610 * but not for now
611 */
612 child = of_get_next_child(np, NULL);
613 multibus = !child || strcmp(child->name, "i2c-bus");
614 of_node_put(child);
615
616 /* For a multibus setup, we get the bus count based on the
617 * parent type
618 */
619 if (multibus) {
620 parent = of_get_parent(np);
621 if (parent == NULL)
622 continue;
623 chans = parent->name[0] == 'u' ? 2 : 1;
624 for (i = 0; i < chans; i++)
625 kw_i2c_add(host, np, np, i);
626 } else {
627 for (child = NULL;
628 (child = of_get_next_child(np, child)) != NULL;) {
629 u32 *reg =
630 (u32 *)get_property(child, "reg", NULL);
631 if (reg == NULL)
632 continue;
633 kw_i2c_add(host, np, child, *reg);
634 }
635 }
636 }
637}
638
639
388/* 640/*
389 * 641 *
390 * PMU implementation 642 * PMU implementation
391 * 643 *
392 */ 644 */
393 645
394
395#ifdef CONFIG_ADB_PMU 646#ifdef CONFIG_ADB_PMU
396 647
397static int pmu_low_i2c_func(struct low_i2c_host *host, u8 addr, u8 sub, u8 *data, int len) 648/*
649 * i2c command block to the PMU
650 */
651struct pmu_i2c_hdr {
652 u8 bus;
653 u8 mode;
654 u8 bus2;
655 u8 address;
656 u8 sub_addr;
657 u8 comb_addr;
658 u8 count;
659 u8 data[];
660};
661
662static void pmu_i2c_complete(struct adb_request *req)
398{ 663{
399 // TODO 664 complete(req->arg);
400 return -ENODEV;
401} 665}
402 666
403static void pmu_low_i2c_add(struct device_node *np) 667static int pmu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
668 u32 subaddr, u8 *data, int len)
404{ 669{
405 struct low_i2c_host *host = find_low_i2c_host(NULL); 670 struct adb_request *req = bus->hostdata;
671 struct pmu_i2c_hdr *hdr = (struct pmu_i2c_hdr *)&req->data[1];
672 struct completion comp;
673 int read = addrdir & 1;
674 int retry;
675 int rc = 0;
406 676
407 if (host == NULL) { 677 /* For now, limit ourselves to 16 bytes transfers */
408 printk(KERN_ERR "low_i2c: Can't allocate host for %s\n", 678 if (len > 16)
409 np->full_name); 679 return -EINVAL;
410 return; 680
681 init_completion(&comp);
682
683 for (retry = 0; retry < 16; retry++) {
684 memset(req, 0, sizeof(struct adb_request));
685 hdr->bus = bus->channel;
686 hdr->count = len;
687
688 switch(bus->mode) {
689 case pmac_i2c_mode_std:
690 if (subsize != 0)
691 return -EINVAL;
692 hdr->address = addrdir;
693 hdr->mode = PMU_I2C_MODE_SIMPLE;
694 break;
695 case pmac_i2c_mode_stdsub:
696 case pmac_i2c_mode_combined:
697 if (subsize != 1)
698 return -EINVAL;
699 hdr->address = addrdir & 0xfe;
700 hdr->comb_addr = addrdir;
701 hdr->sub_addr = subaddr;
702 if (bus->mode == pmac_i2c_mode_stdsub)
703 hdr->mode = PMU_I2C_MODE_STDSUB;
704 else
705 hdr->mode = PMU_I2C_MODE_COMBINED;
706 break;
707 default:
708 return -EINVAL;
709 }
710
711 INIT_COMPLETION(comp);
712 req->data[0] = PMU_I2C_CMD;
713 req->reply[0] = 0xff;
714 req->nbytes = sizeof(struct pmu_i2c_hdr) + 1;
715 req->done = pmu_i2c_complete;
716 req->arg = &comp;
717 if (!read && len) {
718 memcpy(hdr->data, data, len);
719 req->nbytes += len;
720 }
721 rc = pmu_queue_request(req);
722 if (rc)
723 return rc;
724 wait_for_completion(&comp);
725 if (req->reply[0] == PMU_I2C_STATUS_OK)
726 break;
727 msleep(15);
411 } 728 }
412 memset(host, 0, sizeof(*host)); 729 if (req->reply[0] != PMU_I2C_STATUS_OK)
730 return -EIO;
413 731
414 init_MUTEX(&host->mutex); 732 for (retry = 0; retry < 16; retry++) {
415 host->np = of_node_get(np); 733 memset(req, 0, sizeof(struct adb_request));
416 host->num_channels = 3; 734
417 host->mode = pmac_low_i2c_mode_std; 735 /* I know that looks like a lot, slow as hell, but darwin
418 host->func = pmu_low_i2c_func; 736 * does it so let's be on the safe side for now
737 */
738 msleep(15);
739
740 hdr->bus = PMU_I2C_BUS_STATUS;
741
742 INIT_COMPLETION(comp);
743 req->data[0] = PMU_I2C_CMD;
744 req->reply[0] = 0xff;
745 req->nbytes = 2;
746 req->done = pmu_i2c_complete;
747 req->arg = &comp;
748 rc = pmu_queue_request(req);
749 if (rc)
750 return rc;
751 wait_for_completion(&comp);
752
753 if (req->reply[0] == PMU_I2C_STATUS_OK && !read)
754 return 0;
755 if (req->reply[0] == PMU_I2C_STATUS_DATAREAD && read) {
756 int rlen = req->reply_len - 1;
757
758 if (rlen != len) {
759 printk(KERN_WARNING "low_i2c: PMU returned %d"
760 " bytes, expected %d !\n", rlen, len);
761 return -EIO;
762 }
763 if (len)
764 memcpy(data, &req->reply[1], len);
765 return 0;
766 }
767 }
768 return -EIO;
769}
770
771static void __init pmu_i2c_probe(void)
772{
773 struct pmac_i2c_bus *bus;
774 struct device_node *busnode;
775 int channel, sz;
776
777 if (!pmu_present())
778 return;
779
780 /* There might or might not be a "pmu-i2c" node, we use that
781 * or via-pmu itself, whatever we find. I haven't seen a machine
782 * with separate bus nodes, so we assume a multibus setup
783 */
784 busnode = of_find_node_by_name(NULL, "pmu-i2c");
785 if (busnode == NULL)
786 busnode = of_find_node_by_name(NULL, "via-pmu");
787 if (busnode == NULL)
788 return;
789
790 printk(KERN_INFO "PMU i2c %s\n", busnode->full_name);
791
792 /*
793 * We add bus 1 and 2 only for now, bus 0 is "special"
794 */
795 for (channel = 1; channel <= 2; channel++) {
796 sz = sizeof(struct pmac_i2c_bus) + sizeof(struct adb_request);
797 bus = kzalloc(sz, GFP_KERNEL);
798 if (bus == NULL)
799 return;
800
801 bus->controller = busnode;
802 bus->busnode = busnode;
803 bus->type = pmac_i2c_bus_pmu;
804 bus->channel = channel;
805 bus->mode = pmac_i2c_mode_std;
806 bus->hostdata = bus + 1;
807 bus->xfer = pmu_i2c_xfer;
808 init_MUTEX(&bus->sem);
809 bus->flags = pmac_i2c_multibus;
810 list_add(&bus->link, &pmac_i2c_busses);
811
812 printk(KERN_INFO " channel %d bus <multibus>\n", channel);
813 }
419} 814}
420 815
421#endif /* CONFIG_ADB_PMU */ 816#endif /* CONFIG_ADB_PMU */
422 817
423void __init pmac_init_low_i2c(void) 818
819/*
820 *
821 * SMU implementation
822 *
823 */
824
825#ifdef CONFIG_PMAC_SMU
826
827static void smu_i2c_complete(struct smu_i2c_cmd *cmd, void *misc)
424{ 828{
425 struct device_node *np; 829 complete(misc);
830}
426 831
427 /* Probe keywest-i2c busses */ 832static int smu_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
428 np = of_find_compatible_node(NULL, "i2c", "keywest-i2c"); 833 u32 subaddr, u8 *data, int len)
429 while(np) { 834{
430 keywest_low_i2c_add(np); 835 struct smu_i2c_cmd *cmd = bus->hostdata;
431 np = of_find_compatible_node(np, "i2c", "keywest-i2c"); 836 struct completion comp;
837 int read = addrdir & 1;
838 int rc = 0;
839
840 if ((read && len > SMU_I2C_READ_MAX) ||
841 ((!read) && len > SMU_I2C_WRITE_MAX))
842 return -EINVAL;
843
844 memset(cmd, 0, sizeof(struct smu_i2c_cmd));
845 cmd->info.bus = bus->channel;
846 cmd->info.devaddr = addrdir;
847 cmd->info.datalen = len;
848
849 switch(bus->mode) {
850 case pmac_i2c_mode_std:
851 if (subsize != 0)
852 return -EINVAL;
853 cmd->info.type = SMU_I2C_TRANSFER_SIMPLE;
854 break;
855 case pmac_i2c_mode_stdsub:
856 case pmac_i2c_mode_combined:
857 if (subsize > 3 || subsize < 1)
858 return -EINVAL;
859 cmd->info.sublen = subsize;
860 /* that's big-endian only but heh ! */
861 memcpy(&cmd->info.subaddr, ((char *)&subaddr) + (4 - subsize),
862 subsize);
863 if (bus->mode == pmac_i2c_mode_stdsub)
864 cmd->info.type = SMU_I2C_TRANSFER_STDSUB;
865 else
866 cmd->info.type = SMU_I2C_TRANSFER_COMBINED;
867 break;
868 default:
869 return -EINVAL;
432 } 870 }
871 if (!read && len)
872 memcpy(cmd->info.data, data, len);
873
874 init_completion(&comp);
875 cmd->done = smu_i2c_complete;
876 cmd->misc = &comp;
877 rc = smu_queue_i2c(cmd);
878 if (rc < 0)
879 return rc;
880 wait_for_completion(&comp);
881 rc = cmd->status;
882
883 if (read && len)
884 memcpy(data, cmd->info.data, len);
885 return rc < 0 ? rc : 0;
886}
887
888static void __init smu_i2c_probe(void)
889{
890 struct device_node *controller, *busnode;
891 struct pmac_i2c_bus *bus;
892 u32 *reg;
893 int sz;
894
895 if (!smu_present())
896 return;
897
898 controller = of_find_node_by_name(NULL, "smu-i2c-control");
899 if (controller == NULL)
900 controller = of_find_node_by_name(NULL, "smu");
901 if (controller == NULL)
902 return;
903
904 printk(KERN_INFO "SMU i2c %s\n", controller->full_name);
905
906 /* Look for childs, note that they might not be of the right
907 * type as older device trees mix i2c busses and other thigns
908 * at the same level
909 */
910 for (busnode = NULL;
911 (busnode = of_get_next_child(controller, busnode)) != NULL;) {
912 if (strcmp(busnode->type, "i2c") &&
913 strcmp(busnode->type, "i2c-bus"))
914 continue;
915 reg = (u32 *)get_property(busnode, "reg", NULL);
916 if (reg == NULL)
917 continue;
918
919 sz = sizeof(struct pmac_i2c_bus) + sizeof(struct smu_i2c_cmd);
920 bus = kzalloc(sz, GFP_KERNEL);
921 if (bus == NULL)
922 return;
923
924 bus->controller = controller;
925 bus->busnode = of_node_get(busnode);
926 bus->type = pmac_i2c_bus_smu;
927 bus->channel = *reg;
928 bus->mode = pmac_i2c_mode_std;
929 bus->hostdata = bus + 1;
930 bus->xfer = smu_i2c_xfer;
931 init_MUTEX(&bus->sem);
932 bus->flags = 0;
933 list_add(&bus->link, &pmac_i2c_busses);
934
935 printk(KERN_INFO " channel %x bus %s\n",
936 bus->channel, busnode->full_name);
937 }
938}
939
940#endif /* CONFIG_PMAC_SMU */
941
942/*
943 *
944 * Core code
945 *
946 */
433 947
434#ifdef CONFIG_ADB_PMU
435 /* Probe PMU busses */
436 np = of_find_node_by_name(NULL, "via-pmu");
437 if (np)
438 pmu_low_i2c_add(np);
439#endif /* CONFIG_ADB_PMU */
440 948
441 /* TODO: Add CUDA support as well */ 949struct pmac_i2c_bus *pmac_i2c_find_bus(struct device_node *node)
950{
951 struct device_node *p = of_node_get(node);
952 struct device_node *prev = NULL;
953 struct pmac_i2c_bus *bus;
954
955 while(p) {
956 list_for_each_entry(bus, &pmac_i2c_busses, link) {
957 if (p == bus->busnode) {
958 if (prev && bus->flags & pmac_i2c_multibus) {
959 u32 *reg;
960 reg = (u32 *)get_property(prev, "reg",
961 NULL);
962 if (!reg)
963 continue;
964 if (((*reg) >> 8) != bus->channel)
965 continue;
966 }
967 of_node_put(p);
968 of_node_put(prev);
969 return bus;
970 }
971 }
972 of_node_put(prev);
973 prev = p;
974 p = of_get_parent(p);
975 }
976 return NULL;
442} 977}
978EXPORT_SYMBOL_GPL(pmac_i2c_find_bus);
979
980u8 pmac_i2c_get_dev_addr(struct device_node *device)
981{
982 u32 *reg = (u32 *)get_property(device, "reg", NULL);
983
984 if (reg == NULL)
985 return 0;
986
987 return (*reg) & 0xff;
988}
989EXPORT_SYMBOL_GPL(pmac_i2c_get_dev_addr);
990
991struct device_node *pmac_i2c_get_controller(struct pmac_i2c_bus *bus)
992{
993 return bus->controller;
994}
995EXPORT_SYMBOL_GPL(pmac_i2c_get_controller);
996
997struct device_node *pmac_i2c_get_bus_node(struct pmac_i2c_bus *bus)
998{
999 return bus->busnode;
1000}
1001EXPORT_SYMBOL_GPL(pmac_i2c_get_bus_node);
1002
1003int pmac_i2c_get_type(struct pmac_i2c_bus *bus)
1004{
1005 return bus->type;
1006}
1007EXPORT_SYMBOL_GPL(pmac_i2c_get_type);
1008
1009int pmac_i2c_get_flags(struct pmac_i2c_bus *bus)
1010{
1011 return bus->flags;
1012}
1013EXPORT_SYMBOL_GPL(pmac_i2c_get_flags);
1014
1015int pmac_i2c_get_channel(struct pmac_i2c_bus *bus)
1016{
1017 return bus->channel;
1018}
1019EXPORT_SYMBOL_GPL(pmac_i2c_get_channel);
1020
1021
1022void pmac_i2c_attach_adapter(struct pmac_i2c_bus *bus,
1023 struct i2c_adapter *adapter)
1024{
1025 WARN_ON(bus->adapter != NULL);
1026 bus->adapter = adapter;
1027}
1028EXPORT_SYMBOL_GPL(pmac_i2c_attach_adapter);
1029
1030void pmac_i2c_detach_adapter(struct pmac_i2c_bus *bus,
1031 struct i2c_adapter *adapter)
1032{
1033 WARN_ON(bus->adapter != adapter);
1034 bus->adapter = NULL;
1035}
1036EXPORT_SYMBOL_GPL(pmac_i2c_detach_adapter);
1037
1038struct i2c_adapter *pmac_i2c_get_adapter(struct pmac_i2c_bus *bus)
1039{
1040 return bus->adapter;
1041}
1042EXPORT_SYMBOL_GPL(pmac_i2c_get_adapter);
1043
1044struct pmac_i2c_bus *pmac_i2c_adapter_to_bus(struct i2c_adapter *adapter)
1045{
1046 struct pmac_i2c_bus *bus;
1047
1048 list_for_each_entry(bus, &pmac_i2c_busses, link)
1049 if (bus->adapter == adapter)
1050 return bus;
1051 return NULL;
1052}
1053EXPORT_SYMBOL_GPL(pmac_i2c_adapter_to_bus);
1054
1055extern int pmac_i2c_match_adapter(struct device_node *dev,
1056 struct i2c_adapter *adapter)
1057{
1058 struct pmac_i2c_bus *bus = pmac_i2c_find_bus(dev);
1059
1060 if (bus == NULL)
1061 return 0;
1062 return (bus->adapter == adapter);
1063}
1064EXPORT_SYMBOL_GPL(pmac_i2c_match_adapter);
443 1065
444int pmac_low_i2c_lock(struct device_node *np) 1066int pmac_low_i2c_lock(struct device_node *np)
445{ 1067{
446 struct low_i2c_host *host = find_low_i2c_host(np); 1068 struct pmac_i2c_bus *bus, *found = NULL;
447 1069
448 if (!host) 1070 list_for_each_entry(bus, &pmac_i2c_busses, link) {
1071 if (np == bus->controller) {
1072 found = bus;
1073 break;
1074 }
1075 }
1076 if (!found)
449 return -ENODEV; 1077 return -ENODEV;
450 down(&host->mutex); 1078 return pmac_i2c_open(bus, 0);
451 return 0;
452} 1079}
453EXPORT_SYMBOL(pmac_low_i2c_lock); 1080EXPORT_SYMBOL_GPL(pmac_low_i2c_lock);
454 1081
455int pmac_low_i2c_unlock(struct device_node *np) 1082int pmac_low_i2c_unlock(struct device_node *np)
456{ 1083{
457 struct low_i2c_host *host = find_low_i2c_host(np); 1084 struct pmac_i2c_bus *bus, *found = NULL;
458 1085
459 if (!host) 1086 list_for_each_entry(bus, &pmac_i2c_busses, link) {
1087 if (np == bus->controller) {
1088 found = bus;
1089 break;
1090 }
1091 }
1092 if (!found)
460 return -ENODEV; 1093 return -ENODEV;
461 up(&host->mutex); 1094 pmac_i2c_close(bus);
462 return 0; 1095 return 0;
463} 1096}
464EXPORT_SYMBOL(pmac_low_i2c_unlock); 1097EXPORT_SYMBOL_GPL(pmac_low_i2c_unlock);
465 1098
466 1099
467int pmac_low_i2c_open(struct device_node *np, int channel) 1100int pmac_i2c_open(struct pmac_i2c_bus *bus, int polled)
468{ 1101{
469 struct low_i2c_host *host = find_low_i2c_host(np); 1102 int rc;
1103
1104 down(&bus->sem);
1105 bus->polled = polled || pmac_i2c_force_poll;
1106 bus->opened = 1;
1107 bus->mode = pmac_i2c_mode_std;
1108 if (bus->open && (rc = bus->open(bus)) != 0) {
1109 bus->opened = 0;
1110 up(&bus->sem);
1111 return rc;
1112 }
1113 return 0;
1114}
1115EXPORT_SYMBOL_GPL(pmac_i2c_open);
470 1116
471 if (!host) 1117void pmac_i2c_close(struct pmac_i2c_bus *bus)
472 return -ENODEV; 1118{
1119 WARN_ON(!bus->opened);
1120 if (bus->close)
1121 bus->close(bus);
1122 bus->opened = 0;
1123 up(&bus->sem);
1124}
1125EXPORT_SYMBOL_GPL(pmac_i2c_close);
473 1126
474 if (channel >= host->num_channels) 1127int pmac_i2c_setmode(struct pmac_i2c_bus *bus, int mode)
1128{
1129 WARN_ON(!bus->opened);
1130
1131 /* Report me if you see the error below as there might be a new
1132 * "combined4" mode that I need to implement for the SMU bus
1133 */
1134 if (mode < pmac_i2c_mode_dumb || mode > pmac_i2c_mode_combined) {
1135 printk(KERN_ERR "low_i2c: Invalid mode %d requested on"
1136 " bus %s !\n", mode, bus->busnode->full_name);
475 return -EINVAL; 1137 return -EINVAL;
476 1138 }
477 down(&host->mutex); 1139 bus->mode = mode;
478 host->is_open = 1;
479 host->channel = channel;
480 1140
481 return 0; 1141 return 0;
482} 1142}
483EXPORT_SYMBOL(pmac_low_i2c_open); 1143EXPORT_SYMBOL_GPL(pmac_i2c_setmode);
484 1144
485int pmac_low_i2c_close(struct device_node *np) 1145int pmac_i2c_xfer(struct pmac_i2c_bus *bus, u8 addrdir, int subsize,
1146 u32 subaddr, u8 *data, int len)
486{ 1147{
487 struct low_i2c_host *host = find_low_i2c_host(np); 1148 int rc;
488 1149
489 if (!host) 1150 WARN_ON(!bus->opened);
490 return -ENODEV;
491 1151
492 host->is_open = 0; 1152 DBG("xfer() chan=%d, addrdir=0x%x, mode=%d, subsize=%d, subaddr=0x%x,"
493 up(&host->mutex); 1153 " %d bytes, bus %s\n", bus->channel, addrdir, bus->mode, subsize,
1154 subaddr, len, bus->busnode->full_name);
494 1155
495 return 0; 1156 rc = bus->xfer(bus, addrdir, subsize, subaddr, data, len);
1157
1158#ifdef DEBUG
1159 if (rc)
1160 DBG("xfer error %d\n", rc);
1161#endif
1162 return rc;
496} 1163}
497EXPORT_SYMBOL(pmac_low_i2c_close); 1164EXPORT_SYMBOL_GPL(pmac_i2c_xfer);
1165
1166/* some quirks for platform function decoding */
1167enum {
1168 pmac_i2c_quirk_invmask = 0x00000001u,
1169};
498 1170
499int pmac_low_i2c_setmode(struct device_node *np, int mode) 1171static void pmac_i2c_devscan(void (*callback)(struct device_node *dev,
1172 int quirks))
500{ 1173{
501 struct low_i2c_host *host = find_low_i2c_host(np); 1174 struct pmac_i2c_bus *bus;
1175 struct device_node *np;
1176 static struct whitelist_ent {
1177 char *name;
1178 char *compatible;
1179 int quirks;
1180 } whitelist[] = {
1181 /* XXX Study device-tree's & apple drivers are get the quirks
1182 * right !
1183 */
1184 { "i2c-hwclock", NULL, pmac_i2c_quirk_invmask },
1185 { "i2c-cpu-voltage", NULL, 0},
1186 { "temp-monitor", NULL, 0 },
1187 { "supply-monitor", NULL, 0 },
1188 { NULL, NULL, 0 },
1189 };
1190
1191 /* Only some devices need to have platform functions instanciated
1192 * here. For now, we have a table. Others, like 9554 i2c GPIOs used
1193 * on Xserve, if we ever do a driver for them, will use their own
1194 * platform function instance
1195 */
1196 list_for_each_entry(bus, &pmac_i2c_busses, link) {
1197 for (np = NULL;
1198 (np = of_get_next_child(bus->busnode, np)) != NULL;) {
1199 struct whitelist_ent *p;
1200 /* If multibus, check if device is on that bus */
1201 if (bus->flags & pmac_i2c_multibus)
1202 if (bus != pmac_i2c_find_bus(np))
1203 continue;
1204 for (p = whitelist; p->name != NULL; p++) {
1205 if (strcmp(np->name, p->name))
1206 continue;
1207 if (p->compatible &&
1208 !device_is_compatible(np, p->compatible))
1209 continue;
1210 callback(np, p->quirks);
1211 break;
1212 }
1213 }
1214 }
1215}
502 1216
503 if (!host) 1217#define MAX_I2C_DATA 64
504 return -ENODEV; 1218
505 WARN_ON(!host->is_open); 1219struct pmac_i2c_pf_inst
506 host->mode = mode; 1220{
1221 struct pmac_i2c_bus *bus;
1222 u8 addr;
1223 u8 buffer[MAX_I2C_DATA];
1224 u8 scratch[MAX_I2C_DATA];
1225 int bytes;
1226 int quirks;
1227};
1228
1229static void* pmac_i2c_do_begin(struct pmf_function *func, struct pmf_args *args)
1230{
1231 struct pmac_i2c_pf_inst *inst;
1232 struct pmac_i2c_bus *bus;
1233
1234 bus = pmac_i2c_find_bus(func->node);
1235 if (bus == NULL) {
1236 printk(KERN_ERR "low_i2c: Can't find bus for %s (pfunc)\n",
1237 func->node->full_name);
1238 return NULL;
1239 }
1240 if (pmac_i2c_open(bus, 0)) {
1241 printk(KERN_ERR "low_i2c: Can't open i2c bus for %s (pfunc)\n",
1242 func->node->full_name);
1243 return NULL;
1244 }
1245
1246 /* XXX might need GFP_ATOMIC when called during the suspend process,
1247 * but then, there are already lots of issues with suspending when
1248 * near OOM that need to be resolved, the allocator itself should
1249 * probably make GFP_NOIO implicit during suspend
1250 */
1251 inst = kzalloc(sizeof(struct pmac_i2c_pf_inst), GFP_KERNEL);
1252 if (inst == NULL) {
1253 pmac_i2c_close(bus);
1254 return NULL;
1255 }
1256 inst->bus = bus;
1257 inst->addr = pmac_i2c_get_dev_addr(func->node);
1258 inst->quirks = (int)(long)func->driver_data;
1259 return inst;
1260}
1261
1262static void pmac_i2c_do_end(struct pmf_function *func, void *instdata)
1263{
1264 struct pmac_i2c_pf_inst *inst = instdata;
1265
1266 if (inst == NULL)
1267 return;
1268 pmac_i2c_close(inst->bus);
1269 if (inst)
1270 kfree(inst);
1271}
1272
1273static int pmac_i2c_do_read(PMF_STD_ARGS, u32 len)
1274{
1275 struct pmac_i2c_pf_inst *inst = instdata;
1276
1277 inst->bytes = len;
1278 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_read, 0, 0,
1279 inst->buffer, len);
1280}
1281
1282static int pmac_i2c_do_write(PMF_STD_ARGS, u32 len, const u8 *data)
1283{
1284 struct pmac_i2c_pf_inst *inst = instdata;
1285
1286 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 0, 0,
1287 (u8 *)data, len);
1288}
1289
1290/* This function is used to do the masking & OR'ing for the "rmw" type
1291 * callbacks. Ze should apply the mask and OR in the values in the
1292 * buffer before writing back. The problem is that it seems that
1293 * various darwin drivers implement the mask/or differently, thus
1294 * we need to check the quirks first
1295 */
1296static void pmac_i2c_do_apply_rmw(struct pmac_i2c_pf_inst *inst,
1297 u32 len, const u8 *mask, const u8 *val)
1298{
1299 int i;
1300
1301 if (inst->quirks & pmac_i2c_quirk_invmask) {
1302 for (i = 0; i < len; i ++)
1303 inst->scratch[i] = (inst->buffer[i] & mask[i]) | val[i];
1304 } else {
1305 for (i = 0; i < len; i ++)
1306 inst->scratch[i] = (inst->buffer[i] & ~mask[i])
1307 | (val[i] & mask[i]);
1308 }
1309}
1310
1311static int pmac_i2c_do_rmw(PMF_STD_ARGS, u32 masklen, u32 valuelen,
1312 u32 totallen, const u8 *maskdata,
1313 const u8 *valuedata)
1314{
1315 struct pmac_i2c_pf_inst *inst = instdata;
1316
1317 if (masklen > inst->bytes || valuelen > inst->bytes ||
1318 totallen > inst->bytes || valuelen > masklen)
1319 return -EINVAL;
1320
1321 pmac_i2c_do_apply_rmw(inst, masklen, maskdata, valuedata);
1322
1323 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 0, 0,
1324 inst->scratch, totallen);
1325}
1326
1327static int pmac_i2c_do_read_sub(PMF_STD_ARGS, u8 subaddr, u32 len)
1328{
1329 struct pmac_i2c_pf_inst *inst = instdata;
1330
1331 inst->bytes = len;
1332 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_read, 1, subaddr,
1333 inst->buffer, len);
1334}
1335
1336static int pmac_i2c_do_write_sub(PMF_STD_ARGS, u8 subaddr, u32 len,
1337 const u8 *data)
1338{
1339 struct pmac_i2c_pf_inst *inst = instdata;
1340
1341 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 1,
1342 subaddr, (u8 *)data, len);
1343}
507 1344
1345static int pmac_i2c_do_set_mode(PMF_STD_ARGS, int mode)
1346{
1347 struct pmac_i2c_pf_inst *inst = instdata;
1348
1349 return pmac_i2c_setmode(inst->bus, mode);
1350}
1351
1352static int pmac_i2c_do_rmw_sub(PMF_STD_ARGS, u8 subaddr, u32 masklen,
1353 u32 valuelen, u32 totallen, const u8 *maskdata,
1354 const u8 *valuedata)
1355{
1356 struct pmac_i2c_pf_inst *inst = instdata;
1357
1358 if (masklen > inst->bytes || valuelen > inst->bytes ||
1359 totallen > inst->bytes || valuelen > masklen)
1360 return -EINVAL;
1361
1362 pmac_i2c_do_apply_rmw(inst, masklen, maskdata, valuedata);
1363
1364 return pmac_i2c_xfer(inst->bus, inst->addr | pmac_i2c_write, 1,
1365 subaddr, inst->scratch, totallen);
1366}
1367
1368static int pmac_i2c_do_mask_and_comp(PMF_STD_ARGS, u32 len,
1369 const u8 *maskdata,
1370 const u8 *valuedata)
1371{
1372 struct pmac_i2c_pf_inst *inst = instdata;
1373 int i, match;
1374
1375 /* Get return value pointer, it's assumed to be a u32 */
1376 if (!args || !args->count || !args->u[0].p)
1377 return -EINVAL;
1378
1379 /* Check buffer */
1380 if (len > inst->bytes)
1381 return -EINVAL;
1382
1383 for (i = 0, match = 1; match && i < len; i ++)
1384 if ((inst->buffer[i] & maskdata[i]) != valuedata[i])
1385 match = 0;
1386 *args->u[0].p = match;
508 return 0; 1387 return 0;
509} 1388}
510EXPORT_SYMBOL(pmac_low_i2c_setmode);
511 1389
512int pmac_low_i2c_xfer(struct device_node *np, u8 addrdir, u8 subaddr, u8 *data, int len) 1390static int pmac_i2c_do_delay(PMF_STD_ARGS, u32 duration)
513{ 1391{
514 struct low_i2c_host *host = find_low_i2c_host(np); 1392 msleep((duration + 999) / 1000);
1393 return 0;
1394}
515 1395
516 if (!host)
517 return -ENODEV;
518 WARN_ON(!host->is_open);
519 1396
520 return host->func(host, addrdir, subaddr, data, len); 1397static struct pmf_handlers pmac_i2c_pfunc_handlers = {
1398 .begin = pmac_i2c_do_begin,
1399 .end = pmac_i2c_do_end,
1400 .read_i2c = pmac_i2c_do_read,
1401 .write_i2c = pmac_i2c_do_write,
1402 .rmw_i2c = pmac_i2c_do_rmw,
1403 .read_i2c_sub = pmac_i2c_do_read_sub,
1404 .write_i2c_sub = pmac_i2c_do_write_sub,
1405 .rmw_i2c_sub = pmac_i2c_do_rmw_sub,
1406 .set_i2c_mode = pmac_i2c_do_set_mode,
1407 .mask_and_compare = pmac_i2c_do_mask_and_comp,
1408 .delay = pmac_i2c_do_delay,
1409};
1410
1411static void __init pmac_i2c_dev_create(struct device_node *np, int quirks)
1412{
1413 DBG("dev_create(%s)\n", np->full_name);
1414
1415 pmf_register_driver(np, &pmac_i2c_pfunc_handlers,
1416 (void *)(long)quirks);
1417}
1418
1419static void __init pmac_i2c_dev_init(struct device_node *np, int quirks)
1420{
1421 DBG("dev_create(%s)\n", np->full_name);
1422
1423 pmf_do_functions(np, NULL, 0, PMF_FLAGS_ON_INIT, NULL);
1424}
1425
1426static void pmac_i2c_dev_suspend(struct device_node *np, int quirks)
1427{
1428 DBG("dev_suspend(%s)\n", np->full_name);
1429 pmf_do_functions(np, NULL, 0, PMF_FLAGS_ON_SLEEP, NULL);
1430}
1431
1432static void pmac_i2c_dev_resume(struct device_node *np, int quirks)
1433{
1434 DBG("dev_resume(%s)\n", np->full_name);
1435 pmf_do_functions(np, NULL, 0, PMF_FLAGS_ON_WAKE, NULL);
1436}
1437
1438void pmac_pfunc_i2c_suspend(void)
1439{
1440 pmac_i2c_devscan(pmac_i2c_dev_suspend);
1441}
1442
1443void pmac_pfunc_i2c_resume(void)
1444{
1445 pmac_i2c_devscan(pmac_i2c_dev_resume);
1446}
1447
1448/*
1449 * Initialize us: probe all i2c busses on the machine, instantiate
1450 * busses and platform functions as needed.
1451 */
1452/* This is non-static as it might be called early by smp code */
1453int __init pmac_i2c_init(void)
1454{
1455 static int i2c_inited;
1456
1457 if (i2c_inited)
1458 return 0;
1459 i2c_inited = 1;
1460
1461 /* Probe keywest-i2c busses */
1462 kw_i2c_probe();
1463
1464#ifdef CONFIG_ADB_PMU
1465 /* Probe PMU i2c busses */
1466 pmu_i2c_probe();
1467#endif
1468
1469#ifdef CONFIG_PMAC_SMU
1470 /* Probe SMU i2c busses */
1471 smu_i2c_probe();
1472#endif
1473
1474 /* Now add plaform functions for some known devices */
1475 pmac_i2c_devscan(pmac_i2c_dev_create);
1476
1477 return 0;
521} 1478}
522EXPORT_SYMBOL(pmac_low_i2c_xfer); 1479arch_initcall(pmac_i2c_init);
1480
1481/* Since pmac_i2c_init can be called too early for the platform device
1482 * registration, we need to do it at a later time. In our case, subsys
1483 * happens to fit well, though I agree it's a bit of a hack...
1484 */
1485static int __init pmac_i2c_create_platform_devices(void)
1486{
1487 struct pmac_i2c_bus *bus;
1488 int i = 0;
1489
1490 /* In the case where we are initialized from smp_init(), we must
1491 * not use the timer (and thus the irq). It's safe from now on
1492 * though
1493 */
1494 pmac_i2c_force_poll = 0;
1495
1496 /* Create platform devices */
1497 list_for_each_entry(bus, &pmac_i2c_busses, link) {
1498 bus->platform_dev =
1499 platform_device_alloc("i2c-powermac", i++);
1500 if (bus->platform_dev == NULL)
1501 return -ENOMEM;
1502 bus->platform_dev->dev.platform_data = bus;
1503 platform_device_add(bus->platform_dev);
1504 }
1505
1506 /* Now call platform "init" functions */
1507 pmac_i2c_devscan(pmac_i2c_dev_init);
523 1508
1509 return 0;
1510}
1511subsys_initcall(pmac_i2c_create_platform_devices);
diff --git a/arch/powerpc/platforms/powermac/nvram.c b/arch/powerpc/platforms/powermac/nvram.c
index 4042e2f06ee0..3ebd045a3350 100644
--- a/arch/powerpc/platforms/powermac/nvram.c
+++ b/arch/powerpc/platforms/powermac/nvram.c
@@ -514,7 +514,7 @@ static void core99_nvram_sync(void)
514#endif 514#endif
515} 515}
516 516
517static int __init core99_nvram_setup(struct device_node *dp) 517static int __init core99_nvram_setup(struct device_node *dp, unsigned long addr)
518{ 518{
519 int i; 519 int i;
520 u32 gen_bank0, gen_bank1; 520 u32 gen_bank0, gen_bank1;
@@ -528,7 +528,7 @@ static int __init core99_nvram_setup(struct device_node *dp)
528 printk(KERN_ERR "nvram: can't allocate ram image\n"); 528 printk(KERN_ERR "nvram: can't allocate ram image\n");
529 return -ENOMEM; 529 return -ENOMEM;
530 } 530 }
531 nvram_data = ioremap(dp->addrs[0].address, NVRAM_SIZE*2); 531 nvram_data = ioremap(addr, NVRAM_SIZE*2);
532 nvram_naddrs = 1; /* Make sure we get the correct case */ 532 nvram_naddrs = 1; /* Make sure we get the correct case */
533 533
534 DBG("nvram: Checking bank 0...\n"); 534 DBG("nvram: Checking bank 0...\n");
@@ -549,6 +549,7 @@ static int __init core99_nvram_setup(struct device_node *dp)
549 ppc_md.nvram_write = core99_nvram_write; 549 ppc_md.nvram_write = core99_nvram_write;
550 ppc_md.nvram_size = core99_nvram_size; 550 ppc_md.nvram_size = core99_nvram_size;
551 ppc_md.nvram_sync = core99_nvram_sync; 551 ppc_md.nvram_sync = core99_nvram_sync;
552 ppc_md.machine_shutdown = core99_nvram_sync;
552 /* 553 /*
553 * Maybe we could be smarter here though making an exclusive list 554 * Maybe we could be smarter here though making an exclusive list
554 * of known flash chips is a bit nasty as older OF didn't provide us 555 * of known flash chips is a bit nasty as older OF didn't provide us
@@ -569,34 +570,48 @@ static int __init core99_nvram_setup(struct device_node *dp)
569int __init pmac_nvram_init(void) 570int __init pmac_nvram_init(void)
570{ 571{
571 struct device_node *dp; 572 struct device_node *dp;
573 struct resource r1, r2;
574 unsigned int s1 = 0, s2 = 0;
572 int err = 0; 575 int err = 0;
573 576
574 nvram_naddrs = 0; 577 nvram_naddrs = 0;
575 578
576 dp = find_devices("nvram"); 579 dp = of_find_node_by_name(NULL, "nvram");
577 if (dp == NULL) { 580 if (dp == NULL) {
578 printk(KERN_ERR "Can't find NVRAM device\n"); 581 printk(KERN_ERR "Can't find NVRAM device\n");
579 return -ENODEV; 582 return -ENODEV;
580 } 583 }
581 nvram_naddrs = dp->n_addrs; 584
585 /* Try to obtain an address */
586 if (of_address_to_resource(dp, 0, &r1) == 0) {
587 nvram_naddrs = 1;
588 s1 = (r1.end - r1.start) + 1;
589 if (of_address_to_resource(dp, 1, &r2) == 0) {
590 nvram_naddrs = 2;
591 s2 = (r2.end - r2.start) + 1;
592 }
593 }
594
582 is_core_99 = device_is_compatible(dp, "nvram,flash"); 595 is_core_99 = device_is_compatible(dp, "nvram,flash");
583 if (is_core_99) 596 if (is_core_99) {
584 err = core99_nvram_setup(dp); 597 err = core99_nvram_setup(dp, r1.start);
598 goto bail;
599 }
600
585#ifdef CONFIG_PPC32 601#ifdef CONFIG_PPC32
586 else if (_machine == _MACH_chrp && nvram_naddrs == 1) { 602 if (_machine == _MACH_chrp && nvram_naddrs == 1) {
587 nvram_data = ioremap(dp->addrs[0].address + isa_mem_base, 603 nvram_data = ioremap(r1.start, s1);
588 dp->addrs[0].size);
589 nvram_mult = 1; 604 nvram_mult = 1;
590 ppc_md.nvram_read_val = direct_nvram_read_byte; 605 ppc_md.nvram_read_val = direct_nvram_read_byte;
591 ppc_md.nvram_write_val = direct_nvram_write_byte; 606 ppc_md.nvram_write_val = direct_nvram_write_byte;
592 } else if (nvram_naddrs == 1) { 607 } else if (nvram_naddrs == 1) {
593 nvram_data = ioremap(dp->addrs[0].address, dp->addrs[0].size); 608 nvram_data = ioremap(r1.start, s1);
594 nvram_mult = (dp->addrs[0].size + NVRAM_SIZE - 1) / NVRAM_SIZE; 609 nvram_mult = (s1 + NVRAM_SIZE - 1) / NVRAM_SIZE;
595 ppc_md.nvram_read_val = direct_nvram_read_byte; 610 ppc_md.nvram_read_val = direct_nvram_read_byte;
596 ppc_md.nvram_write_val = direct_nvram_write_byte; 611 ppc_md.nvram_write_val = direct_nvram_write_byte;
597 } else if (nvram_naddrs == 2) { 612 } else if (nvram_naddrs == 2) {
598 nvram_addr = ioremap(dp->addrs[0].address, dp->addrs[0].size); 613 nvram_addr = ioremap(r1.start, s1);
599 nvram_data = ioremap(dp->addrs[1].address, dp->addrs[1].size); 614 nvram_data = ioremap(r2.start, s2);
600 ppc_md.nvram_read_val = indirect_nvram_read_byte; 615 ppc_md.nvram_read_val = indirect_nvram_read_byte;
601 ppc_md.nvram_write_val = indirect_nvram_write_byte; 616 ppc_md.nvram_write_val = indirect_nvram_write_byte;
602 } else if (nvram_naddrs == 0 && sys_ctrler == SYS_CTRLER_PMU) { 617 } else if (nvram_naddrs == 0 && sys_ctrler == SYS_CTRLER_PMU) {
@@ -605,13 +620,15 @@ int __init pmac_nvram_init(void)
605 ppc_md.nvram_read_val = pmu_nvram_read_byte; 620 ppc_md.nvram_read_val = pmu_nvram_read_byte;
606 ppc_md.nvram_write_val = pmu_nvram_write_byte; 621 ppc_md.nvram_write_val = pmu_nvram_write_byte;
607#endif /* CONFIG_ADB_PMU */ 622#endif /* CONFIG_ADB_PMU */
608 } 623 } else {
609#endif
610 else {
611 printk(KERN_ERR "Incompatible type of NVRAM\n"); 624 printk(KERN_ERR "Incompatible type of NVRAM\n");
612 return -ENXIO; 625 err = -ENXIO;
613 } 626 }
614 lookup_partitions(); 627#endif /* CONFIG_PPC32 */
628bail:
629 of_node_put(dp);
630 if (err == 0)
631 lookup_partitions();
615 return err; 632 return err;
616} 633}
617 634
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 443be526cde7..f671ed253901 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Support for PCI bridges found on Power Macintoshes. 2 * Support for PCI bridges found on Power Macintoshes.
3 * 3 *
4 * Copyright (C) 2003 Benjamin Herrenschmuidt (benh@kernel.crashing.org) 4 * Copyright (C) 2003-2005 Benjamin Herrenschmuidt (benh@kernel.crashing.org)
5 * Copyright (C) 1997 Paul Mackerras (paulus@samba.org) 5 * Copyright (C) 1997 Paul Mackerras (paulus@samba.org)
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
@@ -25,7 +25,7 @@
25#include <asm/pmac_feature.h> 25#include <asm/pmac_feature.h>
26#include <asm/grackle.h> 26#include <asm/grackle.h>
27#ifdef CONFIG_PPC64 27#ifdef CONFIG_PPC64
28#include <asm/iommu.h> 28//#include <asm/iommu.h>
29#include <asm/ppc-pci.h> 29#include <asm/ppc-pci.h>
30#endif 30#endif
31 31
@@ -44,6 +44,7 @@ static int add_bridge(struct device_node *dev);
44static int has_uninorth; 44static int has_uninorth;
45#ifdef CONFIG_PPC64 45#ifdef CONFIG_PPC64
46static struct pci_controller *u3_agp; 46static struct pci_controller *u3_agp;
47static struct pci_controller *u4_pcie;
47static struct pci_controller *u3_ht; 48static struct pci_controller *u3_ht;
48#endif /* CONFIG_PPC64 */ 49#endif /* CONFIG_PPC64 */
49 50
@@ -97,11 +98,8 @@ static void __init fixup_bus_range(struct device_node *bridge)
97 98
98 /* Lookup the "bus-range" property for the hose */ 99 /* Lookup the "bus-range" property for the hose */
99 bus_range = (int *) get_property(bridge, "bus-range", &len); 100 bus_range = (int *) get_property(bridge, "bus-range", &len);
100 if (bus_range == NULL || len < 2 * sizeof(int)) { 101 if (bus_range == NULL || len < 2 * sizeof(int))
101 printk(KERN_WARNING "Can't get bus-range for %s\n",
102 bridge->full_name);
103 return; 102 return;
104 }
105 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); 103 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
106} 104}
107 105
@@ -128,14 +126,14 @@ static void __init fixup_bus_range(struct device_node *bridge)
128 */ 126 */
129 127
130#define MACRISC_CFA0(devfn, off) \ 128#define MACRISC_CFA0(devfn, off) \
131 ((1 << (unsigned long)PCI_SLOT(dev_fn)) \ 129 ((1 << (unsigned int)PCI_SLOT(dev_fn)) \
132 | (((unsigned long)PCI_FUNC(dev_fn)) << 8) \ 130 | (((unsigned int)PCI_FUNC(dev_fn)) << 8) \
133 | (((unsigned long)(off)) & 0xFCUL)) 131 | (((unsigned int)(off)) & 0xFCUL))
134 132
135#define MACRISC_CFA1(bus, devfn, off) \ 133#define MACRISC_CFA1(bus, devfn, off) \
136 ((((unsigned long)(bus)) << 16) \ 134 ((((unsigned int)(bus)) << 16) \
137 |(((unsigned long)(devfn)) << 8) \ 135 |(((unsigned int)(devfn)) << 8) \
138 |(((unsigned long)(off)) & 0xFCUL) \ 136 |(((unsigned int)(off)) & 0xFCUL) \
139 |1UL) 137 |1UL)
140 138
141static unsigned long macrisc_cfg_access(struct pci_controller* hose, 139static unsigned long macrisc_cfg_access(struct pci_controller* hose,
@@ -168,7 +166,8 @@ static int macrisc_read_config(struct pci_bus *bus, unsigned int devfn,
168 hose = pci_bus_to_host(bus); 166 hose = pci_bus_to_host(bus);
169 if (hose == NULL) 167 if (hose == NULL)
170 return PCIBIOS_DEVICE_NOT_FOUND; 168 return PCIBIOS_DEVICE_NOT_FOUND;
171 169 if (offset >= 0x100)
170 return PCIBIOS_BAD_REGISTER_NUMBER;
172 addr = macrisc_cfg_access(hose, bus->number, devfn, offset); 171 addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
173 if (!addr) 172 if (!addr)
174 return PCIBIOS_DEVICE_NOT_FOUND; 173 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -199,7 +198,8 @@ static int macrisc_write_config(struct pci_bus *bus, unsigned int devfn,
199 hose = pci_bus_to_host(bus); 198 hose = pci_bus_to_host(bus);
200 if (hose == NULL) 199 if (hose == NULL)
201 return PCIBIOS_DEVICE_NOT_FOUND; 200 return PCIBIOS_DEVICE_NOT_FOUND;
202 201 if (offset >= 0x100)
202 return PCIBIOS_BAD_REGISTER_NUMBER;
203 addr = macrisc_cfg_access(hose, bus->number, devfn, offset); 203 addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
204 if (!addr) 204 if (!addr)
205 return PCIBIOS_DEVICE_NOT_FOUND; 205 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -234,12 +234,13 @@ static struct pci_ops macrisc_pci_ops =
234/* 234/*
235 * Verify that a specific (bus, dev_fn) exists on chaos 235 * Verify that a specific (bus, dev_fn) exists on chaos
236 */ 236 */
237static int 237static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset)
238chaos_validate_dev(struct pci_bus *bus, int devfn, int offset)
239{ 238{
240 struct device_node *np; 239 struct device_node *np;
241 u32 *vendor, *device; 240 u32 *vendor, *device;
242 241
242 if (offset >= 0x100)
243 return PCIBIOS_BAD_REGISTER_NUMBER;
243 np = pci_busdev_to_OF_node(bus, devfn); 244 np = pci_busdev_to_OF_node(bus, devfn);
244 if (np == NULL) 245 if (np == NULL)
245 return PCIBIOS_DEVICE_NOT_FOUND; 246 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -285,15 +286,13 @@ static struct pci_ops chaos_pci_ops =
285}; 286};
286 287
287static void __init setup_chaos(struct pci_controller *hose, 288static void __init setup_chaos(struct pci_controller *hose,
288 struct reg_property *addr) 289 struct resource *addr)
289{ 290{
290 /* assume a `chaos' bridge */ 291 /* assume a `chaos' bridge */
291 hose->ops = &chaos_pci_ops; 292 hose->ops = &chaos_pci_ops;
292 hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000); 293 hose->cfg_addr = ioremap(addr->start + 0x800000, 0x1000);
293 hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000); 294 hose->cfg_data = ioremap(addr->start + 0xc00000, 0x1000);
294} 295}
295#else
296#define setup_chaos(hose, addr)
297#endif /* CONFIG_PPC32 */ 296#endif /* CONFIG_PPC32 */
298 297
299#ifdef CONFIG_PPC64 298#ifdef CONFIG_PPC64
@@ -326,7 +325,7 @@ static int u3_ht_skip_device(struct pci_controller *hose,
326 else 325 else
327 busdn = hose->arch_data; 326 busdn = hose->arch_data;
328 for (dn = busdn->child; dn; dn = dn->sibling) 327 for (dn = busdn->child; dn; dn = dn->sibling)
329 if (dn->data && PCI_DN(dn)->devfn == devfn) 328 if (PCI_DN(dn) && PCI_DN(dn)->devfn == devfn)
330 break; 329 break;
331 if (dn == NULL) 330 if (dn == NULL)
332 return -1; 331 return -1;
@@ -343,10 +342,10 @@ static int u3_ht_skip_device(struct pci_controller *hose,
343} 342}
344 343
345#define U3_HT_CFA0(devfn, off) \ 344#define U3_HT_CFA0(devfn, off) \
346 ((((unsigned long)devfn) << 8) | offset) 345 ((((unsigned int)devfn) << 8) | offset)
347#define U3_HT_CFA1(bus, devfn, off) \ 346#define U3_HT_CFA1(bus, devfn, off) \
348 (U3_HT_CFA0(devfn, off) \ 347 (U3_HT_CFA0(devfn, off) \
349 + (((unsigned long)bus) << 16) \ 348 + (((unsigned int)bus) << 16) \
350 + 0x01000000UL) 349 + 0x01000000UL)
351 350
352static unsigned long u3_ht_cfg_access(struct pci_controller* hose, 351static unsigned long u3_ht_cfg_access(struct pci_controller* hose,
@@ -356,9 +355,11 @@ static unsigned long u3_ht_cfg_access(struct pci_controller* hose,
356 /* For now, we don't self probe U3 HT bridge */ 355 /* For now, we don't self probe U3 HT bridge */
357 if (PCI_SLOT(devfn) == 0) 356 if (PCI_SLOT(devfn) == 0)
358 return 0; 357 return 0;
359 return ((unsigned long)hose->cfg_data) + U3_HT_CFA0(devfn, offset); 358 return ((unsigned long)hose->cfg_data) +
359 U3_HT_CFA0(devfn, offset);
360 } else 360 } else
361 return ((unsigned long)hose->cfg_data) + U3_HT_CFA1(bus, devfn, offset); 361 return ((unsigned long)hose->cfg_data) +
362 U3_HT_CFA1(bus, devfn, offset);
362} 363}
363 364
364static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, 365static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
@@ -370,7 +371,8 @@ static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn,
370 hose = pci_bus_to_host(bus); 371 hose = pci_bus_to_host(bus);
371 if (hose == NULL) 372 if (hose == NULL)
372 return PCIBIOS_DEVICE_NOT_FOUND; 373 return PCIBIOS_DEVICE_NOT_FOUND;
373 374 if (offset >= 0x100)
375 return PCIBIOS_BAD_REGISTER_NUMBER;
374 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); 376 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
375 if (!addr) 377 if (!addr)
376 return PCIBIOS_DEVICE_NOT_FOUND; 378 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -419,7 +421,8 @@ static int u3_ht_write_config(struct pci_bus *bus, unsigned int devfn,
419 hose = pci_bus_to_host(bus); 421 hose = pci_bus_to_host(bus);
420 if (hose == NULL) 422 if (hose == NULL)
421 return PCIBIOS_DEVICE_NOT_FOUND; 423 return PCIBIOS_DEVICE_NOT_FOUND;
422 424 if (offset >= 0x100)
425 return PCIBIOS_BAD_REGISTER_NUMBER;
423 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); 426 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
424 if (!addr) 427 if (!addr)
425 return PCIBIOS_DEVICE_NOT_FOUND; 428 return PCIBIOS_DEVICE_NOT_FOUND;
@@ -459,6 +462,112 @@ static struct pci_ops u3_ht_pci_ops =
459 u3_ht_read_config, 462 u3_ht_read_config,
460 u3_ht_write_config 463 u3_ht_write_config
461}; 464};
465
466#define U4_PCIE_CFA0(devfn, off) \
467 ((1 << ((unsigned int)PCI_SLOT(dev_fn))) \
468 | (((unsigned int)PCI_FUNC(dev_fn)) << 8) \
469 | ((((unsigned int)(off)) >> 8) << 28) \
470 | (((unsigned int)(off)) & 0xfcU))
471
472#define U4_PCIE_CFA1(bus, devfn, off) \
473 ((((unsigned int)(bus)) << 16) \
474 |(((unsigned int)(devfn)) << 8) \
475 | ((((unsigned int)(off)) >> 8) << 28) \
476 |(((unsigned int)(off)) & 0xfcU) \
477 |1UL)
478
479static unsigned long u4_pcie_cfg_access(struct pci_controller* hose,
480 u8 bus, u8 dev_fn, int offset)
481{
482 unsigned int caddr;
483
484 if (bus == hose->first_busno) {
485 caddr = U4_PCIE_CFA0(dev_fn, offset);
486 } else
487 caddr = U4_PCIE_CFA1(bus, dev_fn, offset);
488
489 /* Uninorth will return garbage if we don't read back the value ! */
490 do {
491 out_le32(hose->cfg_addr, caddr);
492 } while (in_le32(hose->cfg_addr) != caddr);
493
494 offset &= 0x03;
495 return ((unsigned long)hose->cfg_data) + offset;
496}
497
498static int u4_pcie_read_config(struct pci_bus *bus, unsigned int devfn,
499 int offset, int len, u32 *val)
500{
501 struct pci_controller *hose;
502 unsigned long addr;
503
504 hose = pci_bus_to_host(bus);
505 if (hose == NULL)
506 return PCIBIOS_DEVICE_NOT_FOUND;
507 if (offset >= 0x1000)
508 return PCIBIOS_BAD_REGISTER_NUMBER;
509 addr = u4_pcie_cfg_access(hose, bus->number, devfn, offset);
510 if (!addr)
511 return PCIBIOS_DEVICE_NOT_FOUND;
512 /*
513 * Note: the caller has already checked that offset is
514 * suitably aligned and that len is 1, 2 or 4.
515 */
516 switch (len) {
517 case 1:
518 *val = in_8((u8 *)addr);
519 break;
520 case 2:
521 *val = in_le16((u16 *)addr);
522 break;
523 default:
524 *val = in_le32((u32 *)addr);
525 break;
526 }
527 return PCIBIOS_SUCCESSFUL;
528}
529
530static int u4_pcie_write_config(struct pci_bus *bus, unsigned int devfn,
531 int offset, int len, u32 val)
532{
533 struct pci_controller *hose;
534 unsigned long addr;
535
536 hose = pci_bus_to_host(bus);
537 if (hose == NULL)
538 return PCIBIOS_DEVICE_NOT_FOUND;
539 if (offset >= 0x1000)
540 return PCIBIOS_BAD_REGISTER_NUMBER;
541 addr = u4_pcie_cfg_access(hose, bus->number, devfn, offset);
542 if (!addr)
543 return PCIBIOS_DEVICE_NOT_FOUND;
544 /*
545 * Note: the caller has already checked that offset is
546 * suitably aligned and that len is 1, 2 or 4.
547 */
548 switch (len) {
549 case 1:
550 out_8((u8 *)addr, val);
551 (void) in_8((u8 *)addr);
552 break;
553 case 2:
554 out_le16((u16 *)addr, val);
555 (void) in_le16((u16 *)addr);
556 break;
557 default:
558 out_le32((u32 *)addr, val);
559 (void) in_le32((u32 *)addr);
560 break;
561 }
562 return PCIBIOS_SUCCESSFUL;
563}
564
565static struct pci_ops u4_pcie_pci_ops =
566{
567 u4_pcie_read_config,
568 u4_pcie_write_config
569};
570
462#endif /* CONFIG_PPC64 */ 571#endif /* CONFIG_PPC64 */
463 572
464#ifdef CONFIG_PPC32 573#ifdef CONFIG_PPC32
@@ -532,7 +641,8 @@ static void __init init_p2pbridge(void)
532 } 641 }
533 if (early_read_config_word(hose, bus, devfn, 642 if (early_read_config_word(hose, bus, devfn,
534 PCI_BRIDGE_CONTROL, &val) < 0) { 643 PCI_BRIDGE_CONTROL, &val) < 0) {
535 printk(KERN_ERR "init_p2pbridge: couldn't read bridge control\n"); 644 printk(KERN_ERR "init_p2pbridge: couldn't read bridge"
645 " control\n");
536 return; 646 return;
537 } 647 }
538 val &= ~PCI_BRIDGE_CTL_MASTER_ABORT; 648 val &= ~PCI_BRIDGE_CTL_MASTER_ABORT;
@@ -576,36 +686,38 @@ static void __init fixup_nec_usb2(void)
576 continue; 686 continue;
577 early_read_config_dword(hose, bus, devfn, 0xe4, &data); 687 early_read_config_dword(hose, bus, devfn, 0xe4, &data);
578 if (data & 1UL) { 688 if (data & 1UL) {
579 printk("Found NEC PD720100A USB2 chip with disabled EHCI, fixing up...\n"); 689 printk("Found NEC PD720100A USB2 chip with disabled"
690 " EHCI, fixing up...\n");
580 data &= ~1UL; 691 data &= ~1UL;
581 early_write_config_dword(hose, bus, devfn, 0xe4, data); 692 early_write_config_dword(hose, bus, devfn, 0xe4, data);
582 early_write_config_byte(hose, bus, devfn | 2, PCI_INTERRUPT_LINE, 693 early_write_config_byte(hose, bus,
694 devfn | 2, PCI_INTERRUPT_LINE,
583 nec->intrs[0].line); 695 nec->intrs[0].line);
584 } 696 }
585 } 697 }
586} 698}
587 699
588static void __init setup_bandit(struct pci_controller *hose, 700static void __init setup_bandit(struct pci_controller *hose,
589 struct reg_property *addr) 701 struct resource *addr)
590{ 702{
591 hose->ops = &macrisc_pci_ops; 703 hose->ops = &macrisc_pci_ops;
592 hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000); 704 hose->cfg_addr = ioremap(addr->start + 0x800000, 0x1000);
593 hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000); 705 hose->cfg_data = ioremap(addr->start + 0xc00000, 0x1000);
594 init_bandit(hose); 706 init_bandit(hose);
595} 707}
596 708
597static int __init setup_uninorth(struct pci_controller *hose, 709static int __init setup_uninorth(struct pci_controller *hose,
598 struct reg_property *addr) 710 struct resource *addr)
599{ 711{
600 pci_assign_all_buses = 1; 712 pci_assign_all_buses = 1;
601 has_uninorth = 1; 713 has_uninorth = 1;
602 hose->ops = &macrisc_pci_ops; 714 hose->ops = &macrisc_pci_ops;
603 hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000); 715 hose->cfg_addr = ioremap(addr->start + 0x800000, 0x1000);
604 hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000); 716 hose->cfg_data = ioremap(addr->start + 0xc00000, 0x1000);
605 /* We "know" that the bridge at f2000000 has the PCI slots. */ 717 /* We "know" that the bridge at f2000000 has the PCI slots. */
606 return addr->address == 0xf2000000; 718 return addr->start == 0xf2000000;
607} 719}
608#endif 720#endif /* CONFIG_PPC32 */
609 721
610#ifdef CONFIG_PPC64 722#ifdef CONFIG_PPC64
611static void __init setup_u3_agp(struct pci_controller* hose) 723static void __init setup_u3_agp(struct pci_controller* hose)
@@ -625,15 +737,36 @@ static void __init setup_u3_agp(struct pci_controller* hose)
625 hose->ops = &macrisc_pci_ops; 737 hose->ops = &macrisc_pci_ops;
626 hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000); 738 hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000);
627 hose->cfg_data = ioremap(0xf0000000 + 0xc00000, 0x1000); 739 hose->cfg_data = ioremap(0xf0000000 + 0xc00000, 0x1000);
628
629 u3_agp = hose; 740 u3_agp = hose;
630} 741}
631 742
743static void __init setup_u4_pcie(struct pci_controller* hose)
744{
745 /* We currently only implement the "non-atomic" config space, to
746 * be optimised later.
747 */
748 hose->ops = &u4_pcie_pci_ops;
749 hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000);
750 hose->cfg_data = ioremap(0xf0000000 + 0xc00000, 0x1000);
751
752 /* The bus contains a bridge from root -> device, we need to
753 * make it visible on bus 0 so that we pick the right type
754 * of config cycles. If we didn't, we would have to force all
755 * config cycles to be type 1. So we override the "bus-range"
756 * property here
757 */
758 hose->first_busno = 0x00;
759 hose->last_busno = 0xff;
760 u4_pcie = hose;
761}
762
632static void __init setup_u3_ht(struct pci_controller* hose) 763static void __init setup_u3_ht(struct pci_controller* hose)
633{ 764{
634 struct device_node *np = (struct device_node *)hose->arch_data; 765 struct device_node *np = (struct device_node *)hose->arch_data;
766 struct pci_controller *other = NULL;
635 int i, cur; 767 int i, cur;
636 768
769
637 hose->ops = &u3_ht_pci_ops; 770 hose->ops = &u3_ht_pci_ops;
638 771
639 /* We hard code the address because of the different size of 772 /* We hard code the address because of the different size of
@@ -667,11 +800,20 @@ static void __init setup_u3_ht(struct pci_controller* hose)
667 800
668 u3_ht = hose; 801 u3_ht = hose;
669 802
670 if (u3_agp == NULL) { 803 if (u3_agp != NULL)
671 DBG("U3 has no AGP, using full resource range\n"); 804 other = u3_agp;
805 else if (u4_pcie != NULL)
806 other = u4_pcie;
807
808 if (other == NULL) {
809 DBG("U3/4 has no AGP/PCIE, using full resource range\n");
672 return; 810 return;
673 } 811 }
674 812
813 /* Fixup bus range vs. PCIE */
814 if (u4_pcie)
815 hose->last_busno = u4_pcie->first_busno - 1;
816
675 /* We "remove" the AGP resources from the resources allocated to HT, 817 /* We "remove" the AGP resources from the resources allocated to HT,
676 * that is we create "holes". However, that code does assumptions 818 * that is we create "holes". However, that code does assumptions
677 * that so far happen to be true (cross fingers...), typically that 819 * that so far happen to be true (cross fingers...), typically that
@@ -679,7 +821,7 @@ static void __init setup_u3_ht(struct pci_controller* hose)
679 */ 821 */
680 cur = 0; 822 cur = 0;
681 for (i=0; i<3; i++) { 823 for (i=0; i<3; i++) {
682 struct resource *res = &u3_agp->mem_resources[i]; 824 struct resource *res = &other->mem_resources[i];
683 if (res->flags != IORESOURCE_MEM) 825 if (res->flags != IORESOURCE_MEM)
684 continue; 826 continue;
685 /* We don't care about "fine" resources */ 827 /* We don't care about "fine" resources */
@@ -722,7 +864,7 @@ static void __init setup_u3_ht(struct pci_controller* hose)
722 hose->mem_resources[cur-1].end = res->start - 1; 864 hose->mem_resources[cur-1].end = res->start - 1;
723 } 865 }
724} 866}
725#endif 867#endif /* CONFIG_PPC64 */
726 868
727/* 869/*
728 * We assume that if we have a G3 powermac, we have one bridge called 870 * We assume that if we have a G3 powermac, we have one bridge called
@@ -733,24 +875,17 @@ static int __init add_bridge(struct device_node *dev)
733{ 875{
734 int len; 876 int len;
735 struct pci_controller *hose; 877 struct pci_controller *hose;
736#ifdef CONFIG_PPC32 878 struct resource rsrc;
737 struct reg_property *addr;
738#endif
739 char *disp_name; 879 char *disp_name;
740 int *bus_range; 880 int *bus_range;
741 int primary = 1; 881 int primary = 1, has_address = 0;
742 882
743 DBG("Adding PCI host bridge %s\n", dev->full_name); 883 DBG("Adding PCI host bridge %s\n", dev->full_name);
744 884
745#ifdef CONFIG_PPC32 885 /* Fetch host bridge registers address */
746 /* XXX fix this */ 886 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0);
747 addr = (struct reg_property *) get_property(dev, "reg", &len); 887
748 if (addr == NULL || len < sizeof(*addr)) { 888 /* Get bus range if any */
749 printk(KERN_WARNING "Can't use %s: no address\n",
750 dev->full_name);
751 return -ENODEV;
752 }
753#endif
754 bus_range = (int *) get_property(dev, "bus-range", &len); 889 bus_range = (int *) get_property(dev, "bus-range", &len);
755 if (bus_range == NULL || len < 2 * sizeof(int)) { 890 if (bus_range == NULL || len < 2 * sizeof(int)) {
756 printk(KERN_WARNING "Can't get bus-range for %s, assume" 891 printk(KERN_WARNING "Can't get bus-range for %s, assume"
@@ -770,6 +905,8 @@ static int __init add_bridge(struct device_node *dev)
770 hose->last_busno = bus_range ? bus_range[1] : 0xff; 905 hose->last_busno = bus_range ? bus_range[1] : 0xff;
771 906
772 disp_name = NULL; 907 disp_name = NULL;
908
909 /* 64 bits only bridges */
773#ifdef CONFIG_PPC64 910#ifdef CONFIG_PPC64
774 if (device_is_compatible(dev, "u3-agp")) { 911 if (device_is_compatible(dev, "u3-agp")) {
775 setup_u3_agp(hose); 912 setup_u3_agp(hose);
@@ -779,28 +916,37 @@ static int __init add_bridge(struct device_node *dev)
779 setup_u3_ht(hose); 916 setup_u3_ht(hose);
780 disp_name = "U3-HT"; 917 disp_name = "U3-HT";
781 primary = 1; 918 primary = 1;
919 } else if (device_is_compatible(dev, "u4-pcie")) {
920 setup_u4_pcie(hose);
921 disp_name = "U4-PCIE";
922 primary = 0;
782 } 923 }
783 printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number: %d->%d\n", 924 printk(KERN_INFO "Found %s PCI host bridge. Firmware bus number:"
784 disp_name, hose->first_busno, hose->last_busno); 925 " %d->%d\n", disp_name, hose->first_busno, hose->last_busno);
785#else 926#endif /* CONFIG_PPC64 */
927
928 /* 32 bits only bridges */
929#ifdef CONFIG_PPC32
786 if (device_is_compatible(dev, "uni-north")) { 930 if (device_is_compatible(dev, "uni-north")) {
787 primary = setup_uninorth(hose, addr); 931 primary = setup_uninorth(hose, &rsrc);
788 disp_name = "UniNorth"; 932 disp_name = "UniNorth";
789 } else if (strcmp(dev->name, "pci") == 0) { 933 } else if (strcmp(dev->name, "pci") == 0) {
790 /* XXX assume this is a mpc106 (grackle) */ 934 /* XXX assume this is a mpc106 (grackle) */
791 setup_grackle(hose); 935 setup_grackle(hose);
792 disp_name = "Grackle (MPC106)"; 936 disp_name = "Grackle (MPC106)";
793 } else if (strcmp(dev->name, "bandit") == 0) { 937 } else if (strcmp(dev->name, "bandit") == 0) {
794 setup_bandit(hose, addr); 938 setup_bandit(hose, &rsrc);
795 disp_name = "Bandit"; 939 disp_name = "Bandit";
796 } else if (strcmp(dev->name, "chaos") == 0) { 940 } else if (strcmp(dev->name, "chaos") == 0) {
797 setup_chaos(hose, addr); 941 setup_chaos(hose, &rsrc);
798 disp_name = "Chaos"; 942 disp_name = "Chaos";
799 primary = 0; 943 primary = 0;
800 } 944 }
801 printk(KERN_INFO "Found %s PCI host bridge at 0x%08lx. Firmware bus number: %d->%d\n", 945 printk(KERN_INFO "Found %s PCI host bridge at 0x%08lx. "
802 disp_name, addr->address, hose->first_busno, hose->last_busno); 946 "Firmware bus number: %d->%d\n",
803#endif 947 disp_name, rsrc.start, hose->first_busno, hose->last_busno);
948#endif /* CONFIG_PPC32 */
949
804 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n", 950 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
805 hose, hose->cfg_addr, hose->cfg_data); 951 hose, hose->cfg_addr, hose->cfg_data);
806 952
@@ -814,8 +960,7 @@ static int __init add_bridge(struct device_node *dev)
814 return 0; 960 return 0;
815} 961}
816 962
817static void __init 963static void __init pcibios_fixup_OF_interrupts(void)
818pcibios_fixup_OF_interrupts(void)
819{ 964{
820 struct pci_dev* dev = NULL; 965 struct pci_dev* dev = NULL;
821 966
@@ -835,8 +980,7 @@ pcibios_fixup_OF_interrupts(void)
835 } 980 }
836} 981}
837 982
838void __init 983void __init pmac_pcibios_fixup(void)
839pmac_pcibios_fixup(void)
840{ 984{
841 /* Fixup interrupts according to OF tree */ 985 /* Fixup interrupts according to OF tree */
842 pcibios_fixup_OF_interrupts(); 986 pcibios_fixup_OF_interrupts();
@@ -899,6 +1043,8 @@ void __init pmac_pci_init(void)
899 pci_setup_phb_io(u3_ht, 1); 1043 pci_setup_phb_io(u3_ht, 1);
900 if (u3_agp) 1044 if (u3_agp)
901 pci_setup_phb_io(u3_agp, 0); 1045 pci_setup_phb_io(u3_agp, 0);
1046 if (u4_pcie)
1047 pci_setup_phb_io(u4_pcie, 0);
902 1048
903 /* 1049 /*
904 * On ppc64, fixup the IO resources on our host bridges as 1050 * On ppc64, fixup the IO resources on our host bridges as
@@ -911,7 +1057,8 @@ void __init pmac_pci_init(void)
911 1057
912 /* Fixup the PCI<->OF mapping for U3 AGP due to bus renumbering. We 1058 /* Fixup the PCI<->OF mapping for U3 AGP due to bus renumbering. We
913 * assume there is no P2P bridge on the AGP bus, which should be a 1059 * assume there is no P2P bridge on the AGP bus, which should be a
914 * safe assumptions hopefully. 1060 * safe assumptions for now. We should do something better in the
1061 * future though
915 */ 1062 */
916 if (u3_agp) { 1063 if (u3_agp) {
917 struct device_node *np = u3_agp->arch_data; 1064 struct device_node *np = u3_agp->arch_data;
@@ -919,7 +1066,6 @@ void __init pmac_pci_init(void)
919 for (np = np->child; np; np = np->sibling) 1066 for (np = np->child; np; np = np->sibling)
920 PCI_DN(np)->busno = 0xf0; 1067 PCI_DN(np)->busno = 0xf0;
921 } 1068 }
922
923 /* pmac_check_ht_link(); */ 1069 /* pmac_check_ht_link(); */
924 1070
925 /* Tell pci.c to not use the common resource allocation mechanism */ 1071 /* Tell pci.c to not use the common resource allocation mechanism */
@@ -1126,7 +1272,8 @@ void pmac_pci_fixup_pciata(struct pci_dev* dev)
1126 good: 1272 good:
1127 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif); 1273 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif);
1128 if ((progif & 5) != 5) { 1274 if ((progif & 5) != 5) {
1129 printk(KERN_INFO "Forcing PCI IDE into native mode: %s\n", pci_name(dev)); 1275 printk(KERN_INFO "Forcing PCI IDE into native mode: %s\n",
1276 pci_name(dev));
1130 (void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5); 1277 (void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5);
1131 if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) || 1278 if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) ||
1132 (progif & 5) != 5) 1279 (progif & 5) != 5)
@@ -1152,7 +1299,8 @@ static void fixup_k2_sata(struct pci_dev* dev)
1152 for (i = 0; i < 6; i++) { 1299 for (i = 0; i < 6; i++) {
1153 dev->resource[i].start = dev->resource[i].end = 0; 1300 dev->resource[i].start = dev->resource[i].end = 0;
1154 dev->resource[i].flags = 0; 1301 dev->resource[i].flags = 0;
1155 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i, 0); 1302 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i,
1303 0);
1156 } 1304 }
1157 } else { 1305 } else {
1158 pci_read_config_word(dev, PCI_COMMAND, &cmd); 1306 pci_read_config_word(dev, PCI_COMMAND, &cmd);
@@ -1161,7 +1309,8 @@ static void fixup_k2_sata(struct pci_dev* dev)
1161 for (i = 0; i < 5; i++) { 1309 for (i = 0; i < 5; i++) {
1162 dev->resource[i].start = dev->resource[i].end = 0; 1310 dev->resource[i].start = dev->resource[i].end = 0;
1163 dev->resource[i].flags = 0; 1311 dev->resource[i].flags = 0;
1164 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i, 0); 1312 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i,
1313 0);
1165 } 1314 }
1166 } 1315 }
1167} 1316}
diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c
new file mode 100644
index 000000000000..4ffd2a9832a0
--- /dev/null
+++ b/arch/powerpc/platforms/powermac/pfunc_base.c
@@ -0,0 +1,405 @@
1#include <linux/config.h>
2#include <linux/types.h>
3#include <linux/init.h>
4#include <linux/delay.h>
5#include <linux/kernel.h>
6#include <linux/interrupt.h>
7#include <linux/spinlock.h>
8
9#include <asm/pmac_feature.h>
10#include <asm/pmac_pfunc.h>
11
12#define DBG(fmt...) printk(fmt)
13
14static irqreturn_t macio_gpio_irq(int irq, void *data, struct pt_regs *regs)
15{
16 pmf_do_irq(data);
17
18 return IRQ_HANDLED;
19}
20
21static int macio_do_gpio_irq_enable(struct pmf_function *func)
22{
23 if (func->node->n_intrs < 1)
24 return -EINVAL;
25
26 return request_irq(func->node->intrs[0].line, macio_gpio_irq, 0,
27 func->node->name, func);
28}
29
30static int macio_do_gpio_irq_disable(struct pmf_function *func)
31{
32 if (func->node->n_intrs < 1)
33 return -EINVAL;
34
35 free_irq(func->node->intrs[0].line, func);
36 return 0;
37}
38
39static int macio_do_gpio_write(PMF_STD_ARGS, u8 value, u8 mask)
40{
41 u8 __iomem *addr = (u8 __iomem *)func->driver_data;
42 unsigned long flags;
43 u8 tmp;
44
45 /* Check polarity */
46 if (args && args->count && !args->u[0].v)
47 value = ~value;
48
49 /* Toggle the GPIO */
50 spin_lock_irqsave(&feature_lock, flags);
51 tmp = readb(addr);
52 tmp = (tmp & ~mask) | (value & mask);
53 DBG("Do write 0x%02x to GPIO %s (%p)\n",
54 tmp, func->node->full_name, addr);
55 writeb(tmp, addr);
56 spin_unlock_irqrestore(&feature_lock, flags);
57
58 return 0;
59}
60
61static int macio_do_gpio_read(PMF_STD_ARGS, u8 mask, int rshift, u8 xor)
62{
63 u8 __iomem *addr = (u8 __iomem *)func->driver_data;
64 u32 value;
65
66 /* Check if we have room for reply */
67 if (args == NULL || args->count == 0 || args->u[0].p == NULL)
68 return -EINVAL;
69
70 value = readb(addr);
71 *args->u[0].p = ((value & mask) >> rshift) ^ xor;
72
73 return 0;
74}
75
76static int macio_do_delay(PMF_STD_ARGS, u32 duration)
77{
78 /* assume we can sleep ! */
79 msleep((duration + 999) / 1000);
80 return 0;
81}
82
83static struct pmf_handlers macio_gpio_handlers = {
84 .irq_enable = macio_do_gpio_irq_enable,
85 .irq_disable = macio_do_gpio_irq_disable,
86 .write_gpio = macio_do_gpio_write,
87 .read_gpio = macio_do_gpio_read,
88 .delay = macio_do_delay,
89};
90
91static void macio_gpio_init_one(struct macio_chip *macio)
92{
93 struct device_node *gparent, *gp;
94
95 /*
96 * Find the "gpio" parent node
97 */
98
99 for (gparent = NULL;
100 (gparent = of_get_next_child(macio->of_node, gparent)) != NULL;)
101 if (strcmp(gparent->name, "gpio") == 0)
102 break;
103 if (gparent == NULL)
104 return;
105
106 DBG("Installing GPIO functions for macio %s\n",
107 macio->of_node->full_name);
108
109 /*
110 * Ok, got one, we dont need anything special to track them down, so
111 * we just create them all
112 */
113 for (gp = NULL; (gp = of_get_next_child(gparent, gp)) != NULL;) {
114 u32 *reg = (u32 *)get_property(gp, "reg", NULL);
115 unsigned long offset;
116 if (reg == NULL)
117 continue;
118 offset = *reg;
119 /* Deal with old style device-tree. We can safely hard code the
120 * offset for now too even if it's a bit gross ...
121 */
122 if (offset < 0x50)
123 offset += 0x50;
124 offset += (unsigned long)macio->base;
125 pmf_register_driver(gp, &macio_gpio_handlers, (void *)offset);
126 }
127
128 DBG("Calling initial GPIO functions for macio %s\n",
129 macio->of_node->full_name);
130
131 /* And now we run all the init ones */
132 for (gp = NULL; (gp = of_get_next_child(gparent, gp)) != NULL;)
133 pmf_do_functions(gp, NULL, 0, PMF_FLAGS_ON_INIT, NULL);
134
135 /* Note: We do not at this point implement the "at sleep" or "at wake"
136 * functions. I yet to find any for GPIOs anyway
137 */
138}
139
140static int macio_do_write_reg32(PMF_STD_ARGS, u32 offset, u32 value, u32 mask)
141{
142 struct macio_chip *macio = func->driver_data;
143 unsigned long flags;
144
145 spin_lock_irqsave(&feature_lock, flags);
146 MACIO_OUT32(offset, (MACIO_IN32(offset) & ~mask) | (value & mask));
147 spin_unlock_irqrestore(&feature_lock, flags);
148 return 0;
149}
150
151static int macio_do_read_reg32(PMF_STD_ARGS, u32 offset)
152{
153 struct macio_chip *macio = func->driver_data;
154
155 /* Check if we have room for reply */
156 if (args == NULL || args->count == 0 || args->u[0].p == NULL)
157 return -EINVAL;
158
159 *args->u[0].p = MACIO_IN32(offset);
160 return 0;
161}
162
163static int macio_do_write_reg8(PMF_STD_ARGS, u32 offset, u8 value, u8 mask)
164{
165 struct macio_chip *macio = func->driver_data;
166 unsigned long flags;
167
168 spin_lock_irqsave(&feature_lock, flags);
169 MACIO_OUT8(offset, (MACIO_IN8(offset) & ~mask) | (value & mask));
170 spin_unlock_irqrestore(&feature_lock, flags);
171 return 0;
172}
173
174static int macio_do_read_reg8(PMF_STD_ARGS, u32 offset)
175{
176 struct macio_chip *macio = func->driver_data;
177
178 /* Check if we have room for reply */
179 if (args == NULL || args->count == 0 || args->u[0].p == NULL)
180 return -EINVAL;
181
182 *((u8 *)(args->u[0].p)) = MACIO_IN8(offset);
183 return 0;
184}
185
186static int macio_do_read_reg32_msrx(PMF_STD_ARGS, u32 offset, u32 mask,
187 u32 shift, u32 xor)
188{
189 struct macio_chip *macio = func->driver_data;
190
191 /* Check if we have room for reply */
192 if (args == NULL || args->count == 0 || args->u[0].p == NULL)
193 return -EINVAL;
194
195 *args->u[0].p = ((MACIO_IN32(offset) & mask) >> shift) ^ xor;
196 return 0;
197}
198
199static int macio_do_read_reg8_msrx(PMF_STD_ARGS, u32 offset, u32 mask,
200 u32 shift, u32 xor)
201{
202 struct macio_chip *macio = func->driver_data;
203
204 /* Check if we have room for reply */
205 if (args == NULL || args->count == 0 || args->u[0].p == NULL)
206 return -EINVAL;
207
208 *((u8 *)(args->u[0].p)) = ((MACIO_IN8(offset) & mask) >> shift) ^ xor;
209 return 0;
210}
211
212static int macio_do_write_reg32_slm(PMF_STD_ARGS, u32 offset, u32 shift,
213 u32 mask)
214{
215 struct macio_chip *macio = func->driver_data;
216 unsigned long flags;
217 u32 tmp, val;
218
219 /* Check args */
220 if (args == NULL || args->count == 0)
221 return -EINVAL;
222
223 spin_lock_irqsave(&feature_lock, flags);
224 tmp = MACIO_IN32(offset);
225 val = args->u[0].v << shift;
226 tmp = (tmp & ~mask) | (val & mask);
227 MACIO_OUT32(offset, tmp);
228 spin_unlock_irqrestore(&feature_lock, flags);
229 return 0;
230}
231
232static int macio_do_write_reg8_slm(PMF_STD_ARGS, u32 offset, u32 shift,
233 u32 mask)
234{
235 struct macio_chip *macio = func->driver_data;
236 unsigned long flags;
237 u32 tmp, val;
238
239 /* Check args */
240 if (args == NULL || args->count == 0)
241 return -EINVAL;
242
243 spin_lock_irqsave(&feature_lock, flags);
244 tmp = MACIO_IN8(offset);
245 val = args->u[0].v << shift;
246 tmp = (tmp & ~mask) | (val & mask);
247 MACIO_OUT8(offset, tmp);
248 spin_unlock_irqrestore(&feature_lock, flags);
249 return 0;
250}
251
252static struct pmf_handlers macio_mmio_handlers = {
253 .write_reg32 = macio_do_write_reg32,
254 .read_reg32 = macio_do_read_reg32,
255 .write_reg8 = macio_do_write_reg8,
256 .read_reg32 = macio_do_read_reg8,
257 .read_reg32_msrx = macio_do_read_reg32_msrx,
258 .read_reg8_msrx = macio_do_read_reg8_msrx,
259 .write_reg32_slm = macio_do_write_reg32_slm,
260 .write_reg8_slm = macio_do_write_reg8_slm,
261 .delay = macio_do_delay,
262};
263
264static void macio_mmio_init_one(struct macio_chip *macio)
265{
266 DBG("Installing MMIO functions for macio %s\n",
267 macio->of_node->full_name);
268
269 pmf_register_driver(macio->of_node, &macio_mmio_handlers, macio);
270}
271
272static struct device_node *unin_hwclock;
273
274static int unin_do_write_reg32(PMF_STD_ARGS, u32 offset, u32 value, u32 mask)
275{
276 unsigned long flags;
277
278 spin_lock_irqsave(&feature_lock, flags);
279 /* This is fairly bogus in darwin, but it should work for our needs
280 * implemeted that way:
281 */
282 UN_OUT(offset, (UN_IN(offset) & ~mask) | (value & mask));
283 spin_unlock_irqrestore(&feature_lock, flags);
284 return 0;
285}
286
287
288static struct pmf_handlers unin_mmio_handlers = {
289 .write_reg32 = unin_do_write_reg32,
290 .delay = macio_do_delay,
291};
292
293static void uninorth_install_pfunc(void)
294{
295 struct device_node *np;
296
297 DBG("Installing functions for UniN %s\n",
298 uninorth_node->full_name);
299
300 /*
301 * Install handlers for the bridge itself
302 */
303 pmf_register_driver(uninorth_node, &unin_mmio_handlers, NULL);
304 pmf_do_functions(uninorth_node, NULL, 0, PMF_FLAGS_ON_INIT, NULL);
305
306
307 /*
308 * Install handlers for the hwclock child if any
309 */
310 for (np = NULL; (np = of_get_next_child(uninorth_node, np)) != NULL;)
311 if (strcmp(np->name, "hw-clock") == 0) {
312 unin_hwclock = np;
313 break;
314 }
315 if (unin_hwclock) {
316 DBG("Installing functions for UniN clock %s\n",
317 unin_hwclock->full_name);
318 pmf_register_driver(unin_hwclock, &unin_mmio_handlers, NULL);
319 pmf_do_functions(unin_hwclock, NULL, 0, PMF_FLAGS_ON_INIT,
320 NULL);
321 }
322}
323
324/* We export this as the SMP code might init us early */
325int __init pmac_pfunc_base_install(void)
326{
327 static int pfbase_inited;
328 int i;
329
330 if (pfbase_inited)
331 return 0;
332 pfbase_inited = 1;
333
334
335 DBG("Installing base platform functions...\n");
336
337 /*
338 * Locate mac-io chips and install handlers
339 */
340 for (i = 0 ; i < MAX_MACIO_CHIPS; i++) {
341 if (macio_chips[i].of_node) {
342 macio_mmio_init_one(&macio_chips[i]);
343 macio_gpio_init_one(&macio_chips[i]);
344 }
345 }
346
347 /*
348 * Install handlers for northbridge and direct mapped hwclock
349 * if any. We do not implement the config space access callback
350 * which is only ever used for functions that we do not call in
351 * the current driver (enabling/disabling cells in U2, mostly used
352 * to restore the PCI settings, we do that differently)
353 */
354 if (uninorth_node && uninorth_base)
355 uninorth_install_pfunc();
356
357 DBG("All base functions installed\n");
358
359 return 0;
360}
361
362arch_initcall(pmac_pfunc_base_install);
363
364#ifdef CONFIG_PM
365
366/* Those can be called by pmac_feature. Ultimately, I should use a sysdev
367 * or a device, but for now, that's good enough until I sort out some
368 * ordering issues. Also, we do not bother with GPIOs, as so far I yet have
369 * to see a case where a GPIO function has the on-suspend or on-resume bit
370 */
371void pmac_pfunc_base_suspend(void)
372{
373 int i;
374
375 for (i = 0 ; i < MAX_MACIO_CHIPS; i++) {
376 if (macio_chips[i].of_node)
377 pmf_do_functions(macio_chips[i].of_node, NULL, 0,
378 PMF_FLAGS_ON_SLEEP, NULL);
379 }
380 if (uninorth_node)
381 pmf_do_functions(uninorth_node, NULL, 0,
382 PMF_FLAGS_ON_SLEEP, NULL);
383 if (unin_hwclock)
384 pmf_do_functions(unin_hwclock, NULL, 0,
385 PMF_FLAGS_ON_SLEEP, NULL);
386}
387
388void pmac_pfunc_base_resume(void)
389{
390 int i;
391
392 if (unin_hwclock)
393 pmf_do_functions(unin_hwclock, NULL, 0,
394 PMF_FLAGS_ON_WAKE, NULL);
395 if (uninorth_node)
396 pmf_do_functions(uninorth_node, NULL, 0,
397 PMF_FLAGS_ON_WAKE, NULL);
398 for (i = 0 ; i < MAX_MACIO_CHIPS; i++) {
399 if (macio_chips[i].of_node)
400 pmf_do_functions(macio_chips[i].of_node, NULL, 0,
401 PMF_FLAGS_ON_WAKE, NULL);
402 }
403}
404
405#endif /* CONFIG_PM */
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c
new file mode 100644
index 000000000000..c32c623001dc
--- /dev/null
+++ b/arch/powerpc/platforms/powermac/pfunc_core.c
@@ -0,0 +1,989 @@
1/*
2 *
3 * FIXME: Properly make this race free with refcounting etc...
4 *
5 * FIXME: LOCKING !!!
6 */
7
8#include <linux/config.h>
9#include <linux/init.h>
10#include <linux/delay.h>
11#include <linux/kernel.h>
12#include <linux/spinlock.h>
13#include <linux/module.h>
14
15#include <asm/semaphore.h>
16#include <asm/prom.h>
17#include <asm/pmac_pfunc.h>
18
19/* Debug */
20#define LOG_PARSE(fmt...)
21#define LOG_ERROR(fmt...) printk(fmt)
22#define LOG_BLOB(t,b,c)
23#define DBG(fmt...) printk(fmt)
24
25/* Command numbers */
26#define PMF_CMD_LIST 0
27#define PMF_CMD_WRITE_GPIO 1
28#define PMF_CMD_READ_GPIO 2
29#define PMF_CMD_WRITE_REG32 3
30#define PMF_CMD_READ_REG32 4
31#define PMF_CMD_WRITE_REG16 5
32#define PMF_CMD_READ_REG16 6
33#define PMF_CMD_WRITE_REG8 7
34#define PMF_CMD_READ_REG8 8
35#define PMF_CMD_DELAY 9
36#define PMF_CMD_WAIT_REG32 10
37#define PMF_CMD_WAIT_REG16 11
38#define PMF_CMD_WAIT_REG8 12
39#define PMF_CMD_READ_I2C 13
40#define PMF_CMD_WRITE_I2C 14
41#define PMF_CMD_RMW_I2C 15
42#define PMF_CMD_GEN_I2C 16
43#define PMF_CMD_SHIFT_BYTES_RIGHT 17
44#define PMF_CMD_SHIFT_BYTES_LEFT 18
45#define PMF_CMD_READ_CFG 19
46#define PMF_CMD_WRITE_CFG 20
47#define PMF_CMD_RMW_CFG 21
48#define PMF_CMD_READ_I2C_SUBADDR 22
49#define PMF_CMD_WRITE_I2C_SUBADDR 23
50#define PMF_CMD_SET_I2C_MODE 24
51#define PMF_CMD_RMW_I2C_SUBADDR 25
52#define PMF_CMD_READ_REG32_MASK_SHR_XOR 26
53#define PMF_CMD_READ_REG16_MASK_SHR_XOR 27
54#define PMF_CMD_READ_REG8_MASK_SHR_XOR 28
55#define PMF_CMD_WRITE_REG32_SHL_MASK 29
56#define PMF_CMD_WRITE_REG16_SHL_MASK 30
57#define PMF_CMD_WRITE_REG8_SHL_MASK 31
58#define PMF_CMD_MASK_AND_COMPARE 32
59#define PMF_CMD_COUNT 33
60
61/* This structure holds the state of the parser while walking through
62 * a function definition
63 */
64struct pmf_cmd {
65 const void *cmdptr;
66 const void *cmdend;
67 struct pmf_function *func;
68 void *instdata;
69 struct pmf_args *args;
70 int error;
71};
72
73#if 0
74/* Debug output */
75static void print_blob(const char *title, const void *blob, int bytes)
76{
77 printk("%s", title);
78 while(bytes--) {
79 printk("%02x ", *((u8 *)blob));
80 blob += 1;
81 }
82 printk("\n");
83}
84#endif
85
86/*
87 * Parser helpers
88 */
89
90static u32 pmf_next32(struct pmf_cmd *cmd)
91{
92 u32 value;
93 if ((cmd->cmdend - cmd->cmdptr) < 4) {
94 cmd->error = 1;
95 return 0;
96 }
97 value = *((u32 *)cmd->cmdptr);
98 cmd->cmdptr += 4;
99 return value;
100}
101
102static const void* pmf_next_blob(struct pmf_cmd *cmd, int count)
103{
104 const void *value;
105 if ((cmd->cmdend - cmd->cmdptr) < count) {
106 cmd->error = 1;
107 return NULL;
108 }
109 value = cmd->cmdptr;
110 cmd->cmdptr += count;
111 return value;
112}
113
114/*
115 * Individual command parsers
116 */
117
118#define PMF_PARSE_CALL(name, cmd, handlers, p...) \
119 do { \
120 if (cmd->error) \
121 return -ENXIO; \
122 if (handlers == NULL) \
123 return 0; \
124 if (handlers->name) \
125 return handlers->name(cmd->func, cmd->instdata, \
126 cmd->args, p); \
127 return -1; \
128 } while(0) \
129
130
131static int pmf_parser_write_gpio(struct pmf_cmd *cmd, struct pmf_handlers *h)
132{
133 u8 value = (u8)pmf_next32(cmd);
134 u8 mask = (u8)pmf_next32(cmd);
135
136 LOG_PARSE("pmf: write_gpio(value: %02x, mask: %02x)\n", value, mask);
137
138 PMF_PARSE_CALL(write_gpio, cmd, h, value, mask);
139}
140
141static int pmf_parser_read_gpio(struct pmf_cmd *cmd, struct pmf_handlers *h)
142{
143 u8 mask = (u8)pmf_next32(cmd);
144 int rshift = (int)pmf_next32(cmd);
145 u8 xor = (u8)pmf_next32(cmd);
146
147 LOG_PARSE("pmf: read_gpio(mask: %02x, rshift: %d, xor: %02x)\n",
148 mask, rshift, xor);
149
150 PMF_PARSE_CALL(read_gpio, cmd, h, mask, rshift, xor);
151}
152
153static int pmf_parser_write_reg32(struct pmf_cmd *cmd, struct pmf_handlers *h)
154{
155 u32 offset = pmf_next32(cmd);
156 u32 value = pmf_next32(cmd);
157 u32 mask = pmf_next32(cmd);
158
159 LOG_PARSE("pmf: write_reg32(offset: %08x, value: %08x, mask: %08x)\n",
160 offset, value, mask);
161
162 PMF_PARSE_CALL(write_reg32, cmd, h, offset, value, mask);
163}
164
165static int pmf_parser_read_reg32(struct pmf_cmd *cmd, struct pmf_handlers *h)
166{
167 u32 offset = pmf_next32(cmd);
168
169 LOG_PARSE("pmf: read_reg32(offset: %08x)\n", offset);
170
171 PMF_PARSE_CALL(read_reg32, cmd, h, offset);
172}
173
174
175static int pmf_parser_write_reg16(struct pmf_cmd *cmd, struct pmf_handlers *h)
176{
177 u32 offset = pmf_next32(cmd);
178 u16 value = (u16)pmf_next32(cmd);
179 u16 mask = (u16)pmf_next32(cmd);
180
181 LOG_PARSE("pmf: write_reg16(offset: %08x, value: %04x, mask: %04x)\n",
182 offset, value, mask);
183
184 PMF_PARSE_CALL(write_reg16, cmd, h, offset, value, mask);
185}
186
187static int pmf_parser_read_reg16(struct pmf_cmd *cmd, struct pmf_handlers *h)
188{
189 u32 offset = pmf_next32(cmd);
190
191 LOG_PARSE("pmf: read_reg16(offset: %08x)\n", offset);
192
193 PMF_PARSE_CALL(read_reg16, cmd, h, offset);
194}
195
196
197static int pmf_parser_write_reg8(struct pmf_cmd *cmd, struct pmf_handlers *h)
198{
199 u32 offset = pmf_next32(cmd);
200 u8 value = (u16)pmf_next32(cmd);
201 u8 mask = (u16)pmf_next32(cmd);
202
203 LOG_PARSE("pmf: write_reg8(offset: %08x, value: %02x, mask: %02x)\n",
204 offset, value, mask);
205
206 PMF_PARSE_CALL(write_reg8, cmd, h, offset, value, mask);
207}
208
209static int pmf_parser_read_reg8(struct pmf_cmd *cmd, struct pmf_handlers *h)
210{
211 u32 offset = pmf_next32(cmd);
212
213 LOG_PARSE("pmf: read_reg8(offset: %08x)\n", offset);
214
215 PMF_PARSE_CALL(read_reg8, cmd, h, offset);
216}
217
218static int pmf_parser_delay(struct pmf_cmd *cmd, struct pmf_handlers *h)
219{
220 u32 duration = pmf_next32(cmd);
221
222 LOG_PARSE("pmf: delay(duration: %d us)\n", duration);
223
224 PMF_PARSE_CALL(delay, cmd, h, duration);
225}
226
227static int pmf_parser_wait_reg32(struct pmf_cmd *cmd, struct pmf_handlers *h)
228{
229 u32 offset = pmf_next32(cmd);
230 u32 value = pmf_next32(cmd);
231 u32 mask = pmf_next32(cmd);
232
233 LOG_PARSE("pmf: wait_reg32(offset: %08x, comp_value: %08x,mask: %08x)\n",
234 offset, value, mask);
235
236 PMF_PARSE_CALL(wait_reg32, cmd, h, offset, value, mask);
237}
238
239static int pmf_parser_wait_reg16(struct pmf_cmd *cmd, struct pmf_handlers *h)
240{
241 u32 offset = pmf_next32(cmd);
242 u16 value = (u16)pmf_next32(cmd);
243 u16 mask = (u16)pmf_next32(cmd);
244
245 LOG_PARSE("pmf: wait_reg16(offset: %08x, comp_value: %04x,mask: %04x)\n",
246 offset, value, mask);
247
248 PMF_PARSE_CALL(wait_reg16, cmd, h, offset, value, mask);
249}
250
251static int pmf_parser_wait_reg8(struct pmf_cmd *cmd, struct pmf_handlers *h)
252{
253 u32 offset = pmf_next32(cmd);
254 u8 value = (u8)pmf_next32(cmd);
255 u8 mask = (u8)pmf_next32(cmd);
256
257 LOG_PARSE("pmf: wait_reg8(offset: %08x, comp_value: %02x,mask: %02x)\n",
258 offset, value, mask);
259
260 PMF_PARSE_CALL(wait_reg8, cmd, h, offset, value, mask);
261}
262
263static int pmf_parser_read_i2c(struct pmf_cmd *cmd, struct pmf_handlers *h)
264{
265 u32 bytes = pmf_next32(cmd);
266
267 LOG_PARSE("pmf: read_i2c(bytes: %ud)\n", bytes);
268
269 PMF_PARSE_CALL(read_i2c, cmd, h, bytes);
270}
271
272static int pmf_parser_write_i2c(struct pmf_cmd *cmd, struct pmf_handlers *h)
273{
274 u32 bytes = pmf_next32(cmd);
275 const void *blob = pmf_next_blob(cmd, bytes);
276
277 LOG_PARSE("pmf: write_i2c(bytes: %ud) ...\n", bytes);
278 LOG_BLOB("pmf: data: \n", blob, bytes);
279
280 PMF_PARSE_CALL(write_i2c, cmd, h, bytes, blob);
281}
282
283
284static int pmf_parser_rmw_i2c(struct pmf_cmd *cmd, struct pmf_handlers *h)
285{
286 u32 maskbytes = pmf_next32(cmd);
287 u32 valuesbytes = pmf_next32(cmd);
288 u32 totalbytes = pmf_next32(cmd);
289 const void *maskblob = pmf_next_blob(cmd, maskbytes);
290 const void *valuesblob = pmf_next_blob(cmd, valuesbytes);
291
292 LOG_PARSE("pmf: rmw_i2c(maskbytes: %ud, valuebytes: %ud, "
293 "totalbytes: %d) ...\n",
294 maskbytes, valuesbytes, totalbytes);
295 LOG_BLOB("pmf: mask data: \n", maskblob, maskbytes);
296 LOG_BLOB("pmf: values data: \n", valuesblob, valuesbytes);
297
298 PMF_PARSE_CALL(rmw_i2c, cmd, h, maskbytes, valuesbytes, totalbytes,
299 maskblob, valuesblob);
300}
301
302static int pmf_parser_read_cfg(struct pmf_cmd *cmd, struct pmf_handlers *h)
303{
304 u32 offset = pmf_next32(cmd);
305 u32 bytes = pmf_next32(cmd);
306
307 LOG_PARSE("pmf: read_cfg(offset: %x, bytes: %ud)\n", offset, bytes);
308
309 PMF_PARSE_CALL(read_cfg, cmd, h, offset, bytes);
310}
311
312
313static int pmf_parser_write_cfg(struct pmf_cmd *cmd, struct pmf_handlers *h)
314{
315 u32 offset = pmf_next32(cmd);
316 u32 bytes = pmf_next32(cmd);
317 const void *blob = pmf_next_blob(cmd, bytes);
318
319 LOG_PARSE("pmf: write_cfg(offset: %x, bytes: %ud)\n", offset, bytes);
320 LOG_BLOB("pmf: data: \n", blob, bytes);
321
322 PMF_PARSE_CALL(write_cfg, cmd, h, offset, bytes, blob);
323}
324
325static int pmf_parser_rmw_cfg(struct pmf_cmd *cmd, struct pmf_handlers *h)
326{
327 u32 offset = pmf_next32(cmd);
328 u32 maskbytes = pmf_next32(cmd);
329 u32 valuesbytes = pmf_next32(cmd);
330 u32 totalbytes = pmf_next32(cmd);
331 const void *maskblob = pmf_next_blob(cmd, maskbytes);
332 const void *valuesblob = pmf_next_blob(cmd, valuesbytes);
333
334 LOG_PARSE("pmf: rmw_cfg(maskbytes: %ud, valuebytes: %ud,"
335 " totalbytes: %d) ...\n",
336 maskbytes, valuesbytes, totalbytes);
337 LOG_BLOB("pmf: mask data: \n", maskblob, maskbytes);
338 LOG_BLOB("pmf: values data: \n", valuesblob, valuesbytes);
339
340 PMF_PARSE_CALL(rmw_cfg, cmd, h, offset, maskbytes, valuesbytes,
341 totalbytes, maskblob, valuesblob);
342}
343
344
345static int pmf_parser_read_i2c_sub(struct pmf_cmd *cmd, struct pmf_handlers *h)
346{
347 u8 subaddr = (u8)pmf_next32(cmd);
348 u32 bytes = pmf_next32(cmd);
349
350 LOG_PARSE("pmf: read_i2c_sub(subaddr: %x, bytes: %ud)\n",
351 subaddr, bytes);
352
353 PMF_PARSE_CALL(read_i2c_sub, cmd, h, subaddr, bytes);
354}
355
356static int pmf_parser_write_i2c_sub(struct pmf_cmd *cmd, struct pmf_handlers *h)
357{
358 u8 subaddr = (u8)pmf_next32(cmd);
359 u32 bytes = pmf_next32(cmd);
360 const void *blob = pmf_next_blob(cmd, bytes);
361
362 LOG_PARSE("pmf: write_i2c_sub(subaddr: %x, bytes: %ud) ...\n",
363 subaddr, bytes);
364 LOG_BLOB("pmf: data: \n", blob, bytes);
365
366 PMF_PARSE_CALL(write_i2c_sub, cmd, h, subaddr, bytes, blob);
367}
368
369static int pmf_parser_set_i2c_mode(struct pmf_cmd *cmd, struct pmf_handlers *h)
370{
371 u32 mode = pmf_next32(cmd);
372
373 LOG_PARSE("pmf: set_i2c_mode(mode: %d)\n", mode);
374
375 PMF_PARSE_CALL(set_i2c_mode, cmd, h, mode);
376}
377
378
379static int pmf_parser_rmw_i2c_sub(struct pmf_cmd *cmd, struct pmf_handlers *h)
380{
381 u8 subaddr = (u8)pmf_next32(cmd);
382 u32 maskbytes = pmf_next32(cmd);
383 u32 valuesbytes = pmf_next32(cmd);
384 u32 totalbytes = pmf_next32(cmd);
385 const void *maskblob = pmf_next_blob(cmd, maskbytes);
386 const void *valuesblob = pmf_next_blob(cmd, valuesbytes);
387
388 LOG_PARSE("pmf: rmw_i2c_sub(subaddr: %x, maskbytes: %ud, valuebytes: %ud"
389 ", totalbytes: %d) ...\n",
390 subaddr, maskbytes, valuesbytes, totalbytes);
391 LOG_BLOB("pmf: mask data: \n", maskblob, maskbytes);
392 LOG_BLOB("pmf: values data: \n", valuesblob, valuesbytes);
393
394 PMF_PARSE_CALL(rmw_i2c_sub, cmd, h, subaddr, maskbytes, valuesbytes,
395 totalbytes, maskblob, valuesblob);
396}
397
398static int pmf_parser_read_reg32_msrx(struct pmf_cmd *cmd,
399 struct pmf_handlers *h)
400{
401 u32 offset = pmf_next32(cmd);
402 u32 mask = pmf_next32(cmd);
403 u32 shift = pmf_next32(cmd);
404 u32 xor = pmf_next32(cmd);
405
406 LOG_PARSE("pmf: read_reg32_msrx(offset: %x, mask: %x, shift: %x,"
407 " xor: %x\n", offset, mask, shift, xor);
408
409 PMF_PARSE_CALL(read_reg32_msrx, cmd, h, offset, mask, shift, xor);
410}
411
412static int pmf_parser_read_reg16_msrx(struct pmf_cmd *cmd,
413 struct pmf_handlers *h)
414{
415 u32 offset = pmf_next32(cmd);
416 u32 mask = pmf_next32(cmd);
417 u32 shift = pmf_next32(cmd);
418 u32 xor = pmf_next32(cmd);
419
420 LOG_PARSE("pmf: read_reg16_msrx(offset: %x, mask: %x, shift: %x,"
421 " xor: %x\n", offset, mask, shift, xor);
422
423 PMF_PARSE_CALL(read_reg16_msrx, cmd, h, offset, mask, shift, xor);
424}
425static int pmf_parser_read_reg8_msrx(struct pmf_cmd *cmd,
426 struct pmf_handlers *h)
427{
428 u32 offset = pmf_next32(cmd);
429 u32 mask = pmf_next32(cmd);
430 u32 shift = pmf_next32(cmd);
431 u32 xor = pmf_next32(cmd);
432
433 LOG_PARSE("pmf: read_reg8_msrx(offset: %x, mask: %x, shift: %x,"
434 " xor: %x\n", offset, mask, shift, xor);
435
436 PMF_PARSE_CALL(read_reg8_msrx, cmd, h, offset, mask, shift, xor);
437}
438
439static int pmf_parser_write_reg32_slm(struct pmf_cmd *cmd,
440 struct pmf_handlers *h)
441{
442 u32 offset = pmf_next32(cmd);
443 u32 shift = pmf_next32(cmd);
444 u32 mask = pmf_next32(cmd);
445
446 LOG_PARSE("pmf: write_reg32_slm(offset: %x, shift: %x, mask: %x\n",
447 offset, shift, mask);
448
449 PMF_PARSE_CALL(write_reg32_slm, cmd, h, offset, shift, mask);
450}
451
452static int pmf_parser_write_reg16_slm(struct pmf_cmd *cmd,
453 struct pmf_handlers *h)
454{
455 u32 offset = pmf_next32(cmd);
456 u32 shift = pmf_next32(cmd);
457 u32 mask = pmf_next32(cmd);
458
459 LOG_PARSE("pmf: write_reg16_slm(offset: %x, shift: %x, mask: %x\n",
460 offset, shift, mask);
461
462 PMF_PARSE_CALL(write_reg16_slm, cmd, h, offset, shift, mask);
463}
464
465static int pmf_parser_write_reg8_slm(struct pmf_cmd *cmd,
466 struct pmf_handlers *h)
467{
468 u32 offset = pmf_next32(cmd);
469 u32 shift = pmf_next32(cmd);
470 u32 mask = pmf_next32(cmd);
471
472 LOG_PARSE("pmf: write_reg8_slm(offset: %x, shift: %x, mask: %x\n",
473 offset, shift, mask);
474
475 PMF_PARSE_CALL(write_reg8_slm, cmd, h, offset, shift, mask);
476}
477
478static int pmf_parser_mask_and_compare(struct pmf_cmd *cmd,
479 struct pmf_handlers *h)
480{
481 u32 bytes = pmf_next32(cmd);
482 const void *maskblob = pmf_next_blob(cmd, bytes);
483 const void *valuesblob = pmf_next_blob(cmd, bytes);
484
485 LOG_PARSE("pmf: mask_and_compare(length: %ud ...\n", bytes);
486 LOG_BLOB("pmf: mask data: \n", maskblob, bytes);
487 LOG_BLOB("pmf: values data: \n", valuesblob, bytes);
488
489 PMF_PARSE_CALL(mask_and_compare, cmd, h,
490 bytes, maskblob, valuesblob);
491}
492
493
494typedef int (*pmf_cmd_parser_t)(struct pmf_cmd *cmd, struct pmf_handlers *h);
495
496static pmf_cmd_parser_t pmf_parsers[PMF_CMD_COUNT] =
497{
498 NULL,
499 pmf_parser_write_gpio,
500 pmf_parser_read_gpio,
501 pmf_parser_write_reg32,
502 pmf_parser_read_reg32,
503 pmf_parser_write_reg16,
504 pmf_parser_read_reg16,
505 pmf_parser_write_reg8,
506 pmf_parser_read_reg8,
507 pmf_parser_delay,
508 pmf_parser_wait_reg32,
509 pmf_parser_wait_reg16,
510 pmf_parser_wait_reg8,
511 pmf_parser_read_i2c,
512 pmf_parser_write_i2c,
513 pmf_parser_rmw_i2c,
514 NULL, /* Bogus command */
515 NULL, /* Shift bytes right: NYI */
516 NULL, /* Shift bytes left: NYI */
517 pmf_parser_read_cfg,
518 pmf_parser_write_cfg,
519 pmf_parser_rmw_cfg,
520 pmf_parser_read_i2c_sub,
521 pmf_parser_write_i2c_sub,
522 pmf_parser_set_i2c_mode,
523 pmf_parser_rmw_i2c_sub,
524 pmf_parser_read_reg32_msrx,
525 pmf_parser_read_reg16_msrx,
526 pmf_parser_read_reg8_msrx,
527 pmf_parser_write_reg32_slm,
528 pmf_parser_write_reg16_slm,
529 pmf_parser_write_reg8_slm,
530 pmf_parser_mask_and_compare,
531};
532
533struct pmf_device {
534 struct list_head link;
535 struct device_node *node;
536 struct pmf_handlers *handlers;
537 struct list_head functions;
538 struct kref ref;
539};
540
541static LIST_HEAD(pmf_devices);
542static spinlock_t pmf_lock = SPIN_LOCK_UNLOCKED;
543
544static void pmf_release_device(struct kref *kref)
545{
546 struct pmf_device *dev = container_of(kref, struct pmf_device, ref);
547 kfree(dev);
548}
549
550static inline void pmf_put_device(struct pmf_device *dev)
551{
552 kref_put(&dev->ref, pmf_release_device);
553}
554
555static inline struct pmf_device *pmf_get_device(struct pmf_device *dev)
556{
557 kref_get(&dev->ref);
558 return dev;
559}
560
561static inline struct pmf_device *pmf_find_device(struct device_node *np)
562{
563 struct pmf_device *dev;
564
565 list_for_each_entry(dev, &pmf_devices, link) {
566 if (dev->node == np)
567 return pmf_get_device(dev);
568 }
569 return NULL;
570}
571
572static int pmf_parse_one(struct pmf_function *func,
573 struct pmf_handlers *handlers,
574 void *instdata, struct pmf_args *args)
575{
576 struct pmf_cmd cmd;
577 u32 ccode;
578 int count, rc;
579
580 cmd.cmdptr = func->data;
581 cmd.cmdend = func->data + func->length;
582 cmd.func = func;
583 cmd.instdata = instdata;
584 cmd.args = args;
585 cmd.error = 0;
586
587 LOG_PARSE("pmf: func %s, %d bytes, %s...\n",
588 func->name, func->length,
589 handlers ? "executing" : "parsing");
590
591 /* One subcommand to parse for now */
592 count = 1;
593
594 while(count-- && cmd.cmdptr < cmd.cmdend) {
595 /* Get opcode */
596 ccode = pmf_next32(&cmd);
597 /* Check if we are hitting a command list, fetch new count */
598 if (ccode == 0) {
599 count = pmf_next32(&cmd) - 1;
600 ccode = pmf_next32(&cmd);
601 }
602 if (cmd.error) {
603 LOG_ERROR("pmf: parse error, not enough data\n");
604 return -ENXIO;
605 }
606 if (ccode >= PMF_CMD_COUNT) {
607 LOG_ERROR("pmf: command code %d unknown !\n", ccode);
608 return -ENXIO;
609 }
610 if (pmf_parsers[ccode] == NULL) {
611 LOG_ERROR("pmf: no parser for command %d !\n", ccode);
612 return -ENXIO;
613 }
614 rc = pmf_parsers[ccode](&cmd, handlers);
615 if (rc != 0) {
616 LOG_ERROR("pmf: parser for command %d returned"
617 " error %d\n", ccode, rc);
618 return rc;
619 }
620 }
621
622 /* We are doing an initial parse pass, we need to adjust the size */
623 if (handlers == NULL)
624 func->length = cmd.cmdptr - func->data;
625
626 return 0;
627}
628
629static int pmf_add_function_prop(struct pmf_device *dev, void *driverdata,
630 const char *name, u32 *data,
631 unsigned int length)
632{
633 int count = 0;
634 struct pmf_function *func = NULL;
635
636 DBG("pmf: Adding functions for platform-do-%s\n", name);
637
638 while (length >= 12) {
639 /* Allocate a structure */
640 func = kzalloc(sizeof(struct pmf_function), GFP_KERNEL);
641 if (func == NULL)
642 goto bail;
643 kref_init(&func->ref);
644 INIT_LIST_HEAD(&func->irq_clients);
645 func->node = dev->node;
646 func->driver_data = driverdata;
647 func->name = name;
648 func->phandle = data[0];
649 func->flags = data[1];
650 data += 2;
651 length -= 8;
652 func->data = data;
653 func->length = length;
654 func->dev = dev;
655 DBG("pmf: idx %d: flags=%08x, phandle=%08x "
656 " %d bytes remaining, parsing...\n",
657 count+1, func->flags, func->phandle, length);
658 if (pmf_parse_one(func, NULL, NULL, NULL)) {
659 kfree(func);
660 goto bail;
661 }
662 length -= func->length;
663 data = (u32 *)(((u8 *)data) + func->length);
664 list_add(&func->link, &dev->functions);
665 pmf_get_device(dev);
666 count++;
667 }
668 bail:
669 DBG("pmf: Added %d functions\n", count);
670
671 return count;
672}
673
674static int pmf_add_functions(struct pmf_device *dev, void *driverdata)
675{
676 struct property *pp;
677#define PP_PREFIX "platform-do-"
678 const int plen = strlen(PP_PREFIX);
679 int count = 0;
680
681 for (pp = dev->node->properties; pp != 0; pp = pp->next) {
682 char *name;
683 if (strncmp(pp->name, PP_PREFIX, plen) != 0)
684 continue;
685 name = pp->name + plen;
686 if (strlen(name) && pp->length >= 12)
687 count += pmf_add_function_prop(dev, driverdata, name,
688 (u32 *)pp->value,
689 pp->length);
690 }
691 return count;
692}
693
694
695int pmf_register_driver(struct device_node *np,
696 struct pmf_handlers *handlers,
697 void *driverdata)
698{
699 struct pmf_device *dev;
700 unsigned long flags;
701 int rc = 0;
702
703 if (handlers == NULL)
704 return -EINVAL;
705
706 DBG("pmf: registering driver for node %s\n", np->full_name);
707
708 spin_lock_irqsave(&pmf_lock, flags);
709 dev = pmf_find_device(np);
710 spin_unlock_irqrestore(&pmf_lock, flags);
711 if (dev != NULL) {
712 DBG("pmf: already there !\n");
713 pmf_put_device(dev);
714 return -EBUSY;
715 }
716
717 dev = kzalloc(sizeof(struct pmf_device), GFP_KERNEL);
718 if (dev == NULL) {
719 DBG("pmf: no memory !\n");
720 return -ENOMEM;
721 }
722 kref_init(&dev->ref);
723 dev->node = of_node_get(np);
724 dev->handlers = handlers;
725 INIT_LIST_HEAD(&dev->functions);
726
727 rc = pmf_add_functions(dev, driverdata);
728 if (rc == 0) {
729 DBG("pmf: no functions, disposing.. \n");
730 of_node_put(np);
731 kfree(dev);
732 return -ENODEV;
733 }
734
735 spin_lock_irqsave(&pmf_lock, flags);
736 list_add(&dev->link, &pmf_devices);
737 spin_unlock_irqrestore(&pmf_lock, flags);
738
739 return 0;
740}
741EXPORT_SYMBOL_GPL(pmf_register_driver);
742
743struct pmf_function *pmf_get_function(struct pmf_function *func)
744{
745 if (!try_module_get(func->dev->handlers->owner))
746 return NULL;
747 kref_get(&func->ref);
748 return func;
749}
750EXPORT_SYMBOL_GPL(pmf_get_function);
751
752static void pmf_release_function(struct kref *kref)
753{
754 struct pmf_function *func =
755 container_of(kref, struct pmf_function, ref);
756 pmf_put_device(func->dev);
757 kfree(func);
758}
759
760static inline void __pmf_put_function(struct pmf_function *func)
761{
762 kref_put(&func->ref, pmf_release_function);
763}
764
765void pmf_put_function(struct pmf_function *func)
766{
767 if (func == NULL)
768 return;
769 module_put(func->dev->handlers->owner);
770 __pmf_put_function(func);
771}
772EXPORT_SYMBOL_GPL(pmf_put_function);
773
774void pmf_unregister_driver(struct device_node *np)
775{
776 struct pmf_device *dev;
777 unsigned long flags;
778
779 DBG("pmf: unregistering driver for node %s\n", np->full_name);
780
781 spin_lock_irqsave(&pmf_lock, flags);
782 dev = pmf_find_device(np);
783 if (dev == NULL) {
784 DBG("pmf: not such driver !\n");
785 spin_unlock_irqrestore(&pmf_lock, flags);
786 return;
787 }
788 list_del(&dev->link);
789
790 while(!list_empty(&dev->functions)) {
791 struct pmf_function *func =
792 list_entry(dev->functions.next, typeof(*func), link);
793 list_del(&func->link);
794 __pmf_put_function(func);
795 }
796
797 pmf_put_device(dev);
798 spin_unlock_irqrestore(&pmf_lock, flags);
799}
800EXPORT_SYMBOL_GPL(pmf_unregister_driver);
801
802struct pmf_function *__pmf_find_function(struct device_node *target,
803 const char *name, u32 flags)
804{
805 struct device_node *actor = of_node_get(target);
806 struct pmf_device *dev;
807 struct pmf_function *func, *result = NULL;
808 char fname[64];
809 u32 *prop, ph;
810
811 /*
812 * Look for a "platform-*" function reference. If we can't find
813 * one, then we fallback to a direct call attempt
814 */
815 snprintf(fname, 63, "platform-%s", name);
816 prop = (u32 *)get_property(target, fname, NULL);
817 if (prop == NULL)
818 goto find_it;
819 ph = *prop;
820 if (ph == 0)
821 goto find_it;
822
823 /*
824 * Ok, now try to find the actor. If we can't find it, we fail,
825 * there is no point in falling back there
826 */
827 of_node_put(actor);
828 actor = of_find_node_by_phandle(ph);
829 if (actor == NULL)
830 return NULL;
831 find_it:
832 dev = pmf_find_device(actor);
833 if (dev == NULL)
834 return NULL;
835
836 list_for_each_entry(func, &dev->functions, link) {
837 if (name && strcmp(name, func->name))
838 continue;
839 if (func->phandle && target->node != func->phandle)
840 continue;
841 if ((func->flags & flags) == 0)
842 continue;
843 result = func;
844 break;
845 }
846 of_node_put(actor);
847 pmf_put_device(dev);
848 return result;
849}
850
851
852int pmf_register_irq_client(struct device_node *target,
853 const char *name,
854 struct pmf_irq_client *client)
855{
856 struct pmf_function *func;
857 unsigned long flags;
858
859 spin_lock_irqsave(&pmf_lock, flags);
860 func = __pmf_find_function(target, name, PMF_FLAGS_INT_GEN);
861 if (func == NULL) {
862 spin_unlock_irqrestore(&pmf_lock, flags);
863 return -ENODEV;
864 }
865 list_add(&client->link, &func->irq_clients);
866 spin_unlock_irqrestore(&pmf_lock, flags);
867
868 return 0;
869}
870EXPORT_SYMBOL_GPL(pmf_register_irq_client);
871
872void pmf_unregister_irq_client(struct device_node *np,
873 const char *name,
874 struct pmf_irq_client *client)
875{
876 unsigned long flags;
877
878 spin_lock_irqsave(&pmf_lock, flags);
879 list_del(&client->link);
880 spin_unlock_irqrestore(&pmf_lock, flags);
881}
882EXPORT_SYMBOL_GPL(pmf_unregister_irq_client);
883
884
885void pmf_do_irq(struct pmf_function *func)
886{
887 unsigned long flags;
888 struct pmf_irq_client *client;
889
890 /* For now, using a spinlock over the whole function. Can be made
891 * to drop the lock using 2 lists if necessary
892 */
893 spin_lock_irqsave(&pmf_lock, flags);
894 list_for_each_entry(client, &func->irq_clients, link) {
895 if (!try_module_get(client->owner))
896 continue;
897 client->handler(client->data);
898 module_put(client->owner);
899 }
900 spin_unlock_irqrestore(&pmf_lock, flags);
901}
902EXPORT_SYMBOL_GPL(pmf_do_irq);
903
904
905int pmf_call_one(struct pmf_function *func, struct pmf_args *args)
906{
907 struct pmf_device *dev = func->dev;
908 void *instdata = NULL;
909 int rc = 0;
910
911 DBG(" ** pmf_call_one(%s/%s) **\n", dev->node->full_name, func->name);
912
913 if (dev->handlers->begin)
914 instdata = dev->handlers->begin(func, args);
915 rc = pmf_parse_one(func, dev->handlers, instdata, args);
916 if (dev->handlers->end)
917 dev->handlers->end(func, instdata);
918
919 return rc;
920}
921EXPORT_SYMBOL_GPL(pmf_call_one);
922
923int pmf_do_functions(struct device_node *np, const char *name,
924 u32 phandle, u32 fflags, struct pmf_args *args)
925{
926 struct pmf_device *dev;
927 struct pmf_function *func, *tmp;
928 unsigned long flags;
929 int rc = -ENODEV;
930
931 spin_lock_irqsave(&pmf_lock, flags);
932
933 dev = pmf_find_device(np);
934 if (dev == NULL) {
935 spin_unlock_irqrestore(&pmf_lock, flags);
936 return -ENODEV;
937 }
938 list_for_each_entry_safe(func, tmp, &dev->functions, link) {
939 if (name && strcmp(name, func->name))
940 continue;
941 if (phandle && func->phandle && phandle != func->phandle)
942 continue;
943 if ((func->flags & fflags) == 0)
944 continue;
945 if (pmf_get_function(func) == NULL)
946 continue;
947 spin_unlock_irqrestore(&pmf_lock, flags);
948 rc = pmf_call_one(func, args);
949 pmf_put_function(func);
950 spin_lock_irqsave(&pmf_lock, flags);
951 }
952 pmf_put_device(dev);
953 spin_unlock_irqrestore(&pmf_lock, flags);
954
955 return rc;
956}
957EXPORT_SYMBOL_GPL(pmf_do_functions);
958
959
960struct pmf_function *pmf_find_function(struct device_node *target,
961 const char *name)
962{
963 struct pmf_function *func;
964 unsigned long flags;
965
966 spin_lock_irqsave(&pmf_lock, flags);
967 func = __pmf_find_function(target, name, PMF_FLAGS_ON_DEMAND);
968 if (func)
969 func = pmf_get_function(func);
970 spin_unlock_irqrestore(&pmf_lock, flags);
971 return func;
972}
973EXPORT_SYMBOL_GPL(pmf_find_function);
974
975int pmf_call_function(struct device_node *target, const char *name,
976 struct pmf_args *args)
977{
978 struct pmf_function *func = pmf_find_function(target, name);
979 int rc;
980
981 if (func == NULL)
982 return -ENODEV;
983
984 rc = pmf_call_one(func, args);
985 pmf_put_function(func);
986 return rc;
987}
988EXPORT_SYMBOL_GPL(pmf_call_function);
989
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 90040c49494d..18bf3011d1e3 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -5,8 +5,8 @@
5 * in a separate file 5 * in a separate file
6 * 6 *
7 * Copyright (C) 1997 Paul Mackerras (paulus@samba.org) 7 * Copyright (C) 1997 Paul Mackerras (paulus@samba.org)
8 * 8 * Copyright (C) 2005 Benjamin Herrenschmidt (benh@kernel.crashing.org)
9 * Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.org) 9 * IBM, Corp.
10 * 10 *
11 * This program is free software; you can redistribute it and/or 11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License 12 * modify it under the terms of the GNU General Public License
@@ -54,12 +54,7 @@ struct pmac_irq_hw {
54}; 54};
55 55
56/* Default addresses */ 56/* Default addresses */
57static volatile struct pmac_irq_hw *pmac_irq_hw[4] = { 57static volatile struct pmac_irq_hw __iomem *pmac_irq_hw[4];
58 (struct pmac_irq_hw *) 0xf3000020,
59 (struct pmac_irq_hw *) 0xf3000010,
60 (struct pmac_irq_hw *) 0xf4000020,
61 (struct pmac_irq_hw *) 0xf4000010,
62};
63 58
64#define GC_LEVEL_MASK 0x3ff00000 59#define GC_LEVEL_MASK 0x3ff00000
65#define OHARE_LEVEL_MASK 0x1ff00000 60#define OHARE_LEVEL_MASK 0x1ff00000
@@ -82,8 +77,7 @@ static unsigned long ppc_lost_interrupts[NR_MASK_WORDS];
82 * since it can lose interrupts (see pmac_set_irq_mask). 77 * since it can lose interrupts (see pmac_set_irq_mask).
83 * -- Cort 78 * -- Cort
84 */ 79 */
85void 80void __set_lost(unsigned long irq_nr, int nokick)
86__set_lost(unsigned long irq_nr, int nokick)
87{ 81{
88 if (!test_and_set_bit(irq_nr, ppc_lost_interrupts)) { 82 if (!test_and_set_bit(irq_nr, ppc_lost_interrupts)) {
89 atomic_inc(&ppc_n_lost_interrupts); 83 atomic_inc(&ppc_n_lost_interrupts);
@@ -92,8 +86,7 @@ __set_lost(unsigned long irq_nr, int nokick)
92 } 86 }
93} 87}
94 88
95static void 89static void pmac_mask_and_ack_irq(unsigned int irq_nr)
96pmac_mask_and_ack_irq(unsigned int irq_nr)
97{ 90{
98 unsigned long bit = 1UL << (irq_nr & 0x1f); 91 unsigned long bit = 1UL << (irq_nr & 0x1f);
99 int i = irq_nr >> 5; 92 int i = irq_nr >> 5;
@@ -224,8 +217,7 @@ static irqreturn_t gatwick_action(int cpl, void *dev_id, struct pt_regs *regs)
224 return IRQ_NONE; 217 return IRQ_NONE;
225} 218}
226 219
227int 220static int pmac_get_irq(struct pt_regs *regs)
228pmac_get_irq(struct pt_regs *regs)
229{ 221{
230 int irq; 222 int irq;
231 unsigned long bits = 0; 223 unsigned long bits = 0;
@@ -256,34 +248,40 @@ pmac_get_irq(struct pt_regs *regs)
256 248
257/* This routine will fix some missing interrupt values in the device tree 249/* This routine will fix some missing interrupt values in the device tree
258 * on the gatwick mac-io controller used by some PowerBooks 250 * on the gatwick mac-io controller used by some PowerBooks
251 *
252 * Walking of OF nodes could use a bit more fixing up here, but it's not
253 * very important as this is all boot time code on static portions of the
254 * device-tree.
255 *
256 * However, the modifications done to "intrs" will have to be removed and
257 * replaced with proper updates of the "interrupts" properties or
258 * AAPL,interrupts, yet to be decided, once the dynamic parsing is there.
259 */ 259 */
260static void __init 260static void __init pmac_fix_gatwick_interrupts(struct device_node *gw,
261pmac_fix_gatwick_interrupts(struct device_node *gw, int irq_base) 261 int irq_base)
262{ 262{
263 struct device_node *node; 263 struct device_node *node;
264 int count; 264 int count;
265 265
266 memset(gatwick_int_pool, 0, sizeof(gatwick_int_pool)); 266 memset(gatwick_int_pool, 0, sizeof(gatwick_int_pool));
267 node = gw->child;
268 count = 0; 267 count = 0;
269 while(node) 268 for (node = NULL; (node = of_get_next_child(gw, node)) != NULL;) {
270 {
271 /* Fix SCC */ 269 /* Fix SCC */
272 if (strcasecmp(node->name, "escc") == 0) 270 if ((strcasecmp(node->name, "escc") == 0) && node->child) {
273 if (node->child) { 271 if (node->child->n_intrs < 3) {
274 if (node->child->n_intrs < 3) { 272 node->child->intrs = &gatwick_int_pool[count];
275 node->child->intrs = &gatwick_int_pool[count]; 273 count += 3;
276 count += 3;
277 }
278 node->child->n_intrs = 3;
279 node->child->intrs[0].line = 15+irq_base;
280 node->child->intrs[1].line = 4+irq_base;
281 node->child->intrs[2].line = 5+irq_base;
282 printk(KERN_INFO "irq: fixed SCC on second controller (%d,%d,%d)\n",
283 node->child->intrs[0].line,
284 node->child->intrs[1].line,
285 node->child->intrs[2].line);
286 } 274 }
275 node->child->n_intrs = 3;
276 node->child->intrs[0].line = 15+irq_base;
277 node->child->intrs[1].line = 4+irq_base;
278 node->child->intrs[2].line = 5+irq_base;
279 printk(KERN_INFO "irq: fixed SCC on gatwick"
280 " (%d,%d,%d)\n",
281 node->child->intrs[0].line,
282 node->child->intrs[1].line,
283 node->child->intrs[2].line);
284 }
287 /* Fix media-bay & left SWIM */ 285 /* Fix media-bay & left SWIM */
288 if (strcasecmp(node->name, "media-bay") == 0) { 286 if (strcasecmp(node->name, "media-bay") == 0) {
289 struct device_node* ya_node; 287 struct device_node* ya_node;
@@ -292,12 +290,11 @@ pmac_fix_gatwick_interrupts(struct device_node *gw, int irq_base)
292 node->intrs = &gatwick_int_pool[count++]; 290 node->intrs = &gatwick_int_pool[count++];
293 node->n_intrs = 1; 291 node->n_intrs = 1;
294 node->intrs[0].line = 29+irq_base; 292 node->intrs[0].line = 29+irq_base;
295 printk(KERN_INFO "irq: fixed media-bay on second controller (%d)\n", 293 printk(KERN_INFO "irq: fixed media-bay on gatwick"
296 node->intrs[0].line); 294 " (%d)\n", node->intrs[0].line);
297 295
298 ya_node = node->child; 296 ya_node = node->child;
299 while(ya_node) 297 while(ya_node) {
300 {
301 if (strcasecmp(ya_node->name, "floppy") == 0) { 298 if (strcasecmp(ya_node->name, "floppy") == 0) {
302 if (ya_node->n_intrs < 2) { 299 if (ya_node->n_intrs < 2) {
303 ya_node->intrs = &gatwick_int_pool[count]; 300 ya_node->intrs = &gatwick_int_pool[count];
@@ -323,7 +320,6 @@ pmac_fix_gatwick_interrupts(struct device_node *gw, int irq_base)
323 ya_node = ya_node->sibling; 320 ya_node = ya_node->sibling;
324 } 321 }
325 } 322 }
326 node = node->sibling;
327 } 323 }
328 if (count > 10) { 324 if (count > 10) {
329 printk("WARNING !! Gatwick interrupt pool overflow\n"); 325 printk("WARNING !! Gatwick interrupt pool overflow\n");
@@ -338,45 +334,41 @@ pmac_fix_gatwick_interrupts(struct device_node *gw, int irq_base)
338 * controller. If we find this second ohare, set it up and fix the 334 * controller. If we find this second ohare, set it up and fix the
339 * interrupt value in the device tree for the ethernet chip. 335 * interrupt value in the device tree for the ethernet chip.
340 */ 336 */
341static int __init enable_second_ohare(void) 337static void __init enable_second_ohare(struct device_node *np)
342{ 338{
343 unsigned char bus, devfn; 339 unsigned char bus, devfn;
344 unsigned short cmd; 340 unsigned short cmd;
345 unsigned long addr;
346 struct device_node *irqctrler = find_devices("pci106b,7");
347 struct device_node *ether; 341 struct device_node *ether;
348 342
349 if (irqctrler == NULL || irqctrler->n_addrs <= 0) 343 /* This code doesn't strictly belong here, it could be part of
350 return -1; 344 * either the PCI initialisation or the feature code. It's kept
351 addr = (unsigned long) ioremap(irqctrler->addrs[0].address, 0x40); 345 * here for historical reasons.
352 pmac_irq_hw[1] = (volatile struct pmac_irq_hw *)(addr + 0x20); 346 */
353 max_irqs = 64; 347 if (pci_device_from_OF_node(np, &bus, &devfn) == 0) {
354 if (pci_device_from_OF_node(irqctrler, &bus, &devfn) == 0) { 348 struct pci_controller* hose =
355 struct pci_controller* hose = pci_find_hose_for_OF_device(irqctrler); 349 pci_find_hose_for_OF_device(np);
356 if (!hose) 350 if (!hose) {
357 printk(KERN_ERR "Can't find PCI hose for OHare2 !\n"); 351 printk(KERN_ERR "Can't find PCI hose for OHare2 !\n");
358 else { 352 return;
359 early_read_config_word(hose, bus, devfn, PCI_COMMAND, &cmd);
360 cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
361 cmd &= ~PCI_COMMAND_IO;
362 early_write_config_word(hose, bus, devfn, PCI_COMMAND, cmd);
363 } 353 }
354 early_read_config_word(hose, bus, devfn, PCI_COMMAND, &cmd);
355 cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
356 cmd &= ~PCI_COMMAND_IO;
357 early_write_config_word(hose, bus, devfn, PCI_COMMAND, cmd);
364 } 358 }
365 359
366 /* Fix interrupt for the modem/ethernet combo controller. The number 360 /* Fix interrupt for the modem/ethernet combo controller. The number
367 in the device tree (27) is bogus (correct for the ethernet-only 361 * in the device tree (27) is bogus (correct for the ethernet-only
368 board but not the combo ethernet/modem board). 362 * board but not the combo ethernet/modem board).
369 The real interrupt is 28 on the second controller -> 28+32 = 60. 363 * The real interrupt is 28 on the second controller -> 28+32 = 60.
370 */ 364 */
371 ether = find_devices("pci1011,14"); 365 ether = of_find_node_by_name(NULL, "pci1011,14");
372 if (ether && ether->n_intrs > 0) { 366 if (ether && ether->n_intrs > 0) {
373 ether->intrs[0].line = 60; 367 ether->intrs[0].line = 60;
374 printk(KERN_INFO "irq: Fixed ethernet IRQ to %d\n", 368 printk(KERN_INFO "irq: Fixed ethernet IRQ to %d\n",
375 ether->intrs[0].line); 369 ether->intrs[0].line);
376 } 370 }
377 371 of_node_put(ether);
378 /* Return the interrupt number of the cascade */
379 return irqctrler->intrs[0].line;
380} 372}
381 373
382#ifdef CONFIG_XMON 374#ifdef CONFIG_XMON
@@ -394,189 +386,251 @@ static struct irqaction gatwick_cascade_action = {
394 .mask = CPU_MASK_NONE, 386 .mask = CPU_MASK_NONE,
395 .name = "cascade", 387 .name = "cascade",
396}; 388};
397#endif /* CONFIG_PPC32 */
398 389
399static int pmac_u3_cascade(struct pt_regs *regs, void *data) 390static void __init pmac_pic_probe_oldstyle(void)
400{ 391{
401 return mpic_get_one_irq((struct mpic *)data, regs);
402}
403
404void __init pmac_pic_init(void)
405{
406 struct device_node *irqctrler = NULL;
407 struct device_node *irqctrler2 = NULL;
408 struct device_node *np;
409#ifdef CONFIG_PPC32
410 int i; 392 int i;
411 unsigned long addr;
412 int irq_cascade = -1; 393 int irq_cascade = -1;
413#endif 394 struct device_node *master = NULL;
414 struct mpic *mpic1, *mpic2; 395 struct device_node *slave = NULL;
396 u8 __iomem *addr;
397 struct resource r;
415 398
416 /* We first try to detect Apple's new Core99 chipset, since mac-io 399 /* Set our get_irq function */
417 * is quite different on those machines and contains an IBM MPIC2. 400 ppc_md.get_irq = pmac_get_irq;
418 */
419 np = find_type_devices("open-pic");
420 while (np) {
421 if (np->parent && !strcmp(np->parent->name, "u3"))
422 irqctrler2 = np;
423 else
424 irqctrler = np;
425 np = np->next;
426 }
427 if (irqctrler != NULL && irqctrler->n_addrs > 0) {
428 unsigned char senses[128];
429
430 printk(KERN_INFO "PowerMac using OpenPIC irq controller at 0x%08x\n",
431 (unsigned int)irqctrler->addrs[0].address);
432 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, irqctrler, 0, 0);
433
434 prom_get_irq_senses(senses, 0, 128);
435 mpic1 = mpic_alloc(irqctrler->addrs[0].address,
436 MPIC_PRIMARY | MPIC_WANTS_RESET,
437 0, 0, 128, 252, senses, 128, " OpenPIC ");
438 BUG_ON(mpic1 == NULL);
439 mpic_init(mpic1);
440
441 if (irqctrler2 != NULL && irqctrler2->n_intrs > 0 &&
442 irqctrler2->n_addrs > 0) {
443 printk(KERN_INFO "Slave OpenPIC at 0x%08x hooked on IRQ %d\n",
444 (u32)irqctrler2->addrs[0].address,
445 irqctrler2->intrs[0].line);
446
447 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, irqctrler2, 0, 0);
448 prom_get_irq_senses(senses, 128, 128 + 124);
449
450 /* We don't need to set MPIC_BROKEN_U3 here since we don't have
451 * hypertransport interrupts routed to it
452 */
453 mpic2 = mpic_alloc(irqctrler2->addrs[0].address,
454 MPIC_BIG_ENDIAN | MPIC_WANTS_RESET,
455 0, 128, 124, 0, senses, 124,
456 " U3-MPIC ");
457 BUG_ON(mpic2 == NULL);
458 mpic_init(mpic2);
459 mpic_setup_cascade(irqctrler2->intrs[0].line,
460 pmac_u3_cascade, mpic2);
461 }
462#if defined(CONFIG_XMON) && defined(CONFIG_PPC32)
463 {
464 struct device_node* pswitch;
465 int nmi_irq;
466
467 pswitch = find_devices("programmer-switch");
468 if (pswitch && pswitch->n_intrs) {
469 nmi_irq = pswitch->intrs[0].line;
470 mpic_irq_set_priority(nmi_irq, 9);
471 setup_irq(nmi_irq, &xmon_action);
472 }
473 }
474#endif /* CONFIG_XMON */
475 return;
476 }
477 irqctrler = NULL;
478 401
479#ifdef CONFIG_PPC32 402 /*
480 /* Get the level/edge settings, assume if it's not 403 * Find the interrupt controller type & node
481 * a Grand Central nor an OHare, then it's an Heathrow
482 * (or Paddington).
483 */ 404 */
484 ppc_md.get_irq = pmac_get_irq; 405
485 if (find_devices("gc")) 406 if ((master = of_find_node_by_name(NULL, "gc")) != NULL) {
407 max_irqs = max_real_irqs = 32;
486 level_mask[0] = GC_LEVEL_MASK; 408 level_mask[0] = GC_LEVEL_MASK;
487 else if (find_devices("ohare")) { 409 } else if ((master = of_find_node_by_name(NULL, "ohare")) != NULL) {
410 max_irqs = max_real_irqs = 32;
488 level_mask[0] = OHARE_LEVEL_MASK; 411 level_mask[0] = OHARE_LEVEL_MASK;
412
489 /* We might have a second cascaded ohare */ 413 /* We might have a second cascaded ohare */
490 level_mask[1] = OHARE_LEVEL_MASK; 414 slave = of_find_node_by_name(NULL, "pci106b,7");
491 } else { 415 if (slave) {
416 max_irqs = 64;
417 level_mask[1] = OHARE_LEVEL_MASK;
418 enable_second_ohare(slave);
419 }
420 } else if ((master = of_find_node_by_name(NULL, "mac-io")) != NULL) {
421 max_irqs = max_real_irqs = 64;
492 level_mask[0] = HEATHROW_LEVEL_MASK; 422 level_mask[0] = HEATHROW_LEVEL_MASK;
493 level_mask[1] = 0; 423 level_mask[1] = 0;
424
494 /* We might have a second cascaded heathrow */ 425 /* We might have a second cascaded heathrow */
495 level_mask[2] = HEATHROW_LEVEL_MASK; 426 slave = of_find_node_by_name(master, "mac-io");
496 level_mask[3] = 0; 427
497 } 428 /* Check ordering of master & slave */
429 if (device_is_compatible(master, "gatwick")) {
430 struct device_node *tmp;
431 BUG_ON(slave == NULL);
432 tmp = master;
433 master = slave;
434 slave = tmp;
435 }
498 436
499 /* 437 /* We found a slave */
500 * G3 powermacs and 1999 G3 PowerBooks have 64 interrupts, 438 if (slave) {
501 * 1998 G3 Series PowerBooks have 128,
502 * other powermacs have 32.
503 * The combo ethernet/modem card for the Powerstar powerbooks
504 * (2400/3400/3500, ohare based) has a second ohare chip
505 * effectively making a total of 64.
506 */
507 max_irqs = max_real_irqs = 32;
508 irqctrler = find_devices("mac-io");
509 if (irqctrler)
510 {
511 max_real_irqs = 64;
512 if (irqctrler->next)
513 max_irqs = 128; 439 max_irqs = 128;
514 else 440 level_mask[2] = HEATHROW_LEVEL_MASK;
515 max_irqs = 64; 441 level_mask[3] = 0;
442 pmac_fix_gatwick_interrupts(slave, max_real_irqs);
443 }
516 } 444 }
445 BUG_ON(master == NULL);
446
447 /* Set the handler for the main PIC */
517 for ( i = 0; i < max_real_irqs ; i++ ) 448 for ( i = 0; i < max_real_irqs ; i++ )
518 irq_desc[i].handler = &pmac_pic; 449 irq_desc[i].handler = &pmac_pic;
519 450
520 /* get addresses of first controller */ 451 /* Get addresses of first controller if we have a node for it */
521 if (irqctrler) { 452 BUG_ON(of_address_to_resource(master, 0, &r));
522 if (irqctrler->n_addrs > 0) {
523 addr = (unsigned long)
524 ioremap(irqctrler->addrs[0].address, 0x40);
525 for (i = 0; i < 2; ++i)
526 pmac_irq_hw[i] = (volatile struct pmac_irq_hw*)
527 (addr + (2 - i) * 0x10);
528 }
529 453
530 /* get addresses of second controller */ 454 /* Map interrupts of primary controller */
531 irqctrler = irqctrler->next; 455 addr = (u8 __iomem *) ioremap(r.start, 0x40);
532 if (irqctrler && irqctrler->n_addrs > 0) { 456 i = 0;
533 addr = (unsigned long) 457 pmac_irq_hw[i++] = (volatile struct pmac_irq_hw __iomem *)
534 ioremap(irqctrler->addrs[0].address, 0x40); 458 (addr + 0x20);
535 for (i = 2; i < 4; ++i) 459 if (max_real_irqs > 32)
536 pmac_irq_hw[i] = (volatile struct pmac_irq_hw*) 460 pmac_irq_hw[i++] = (volatile struct pmac_irq_hw __iomem *)
537 (addr + (4 - i) * 0x10); 461 (addr + 0x10);
538 irq_cascade = irqctrler->intrs[0].line; 462 of_node_put(master);
539 if (device_is_compatible(irqctrler, "gatwick")) 463
540 pmac_fix_gatwick_interrupts(irqctrler, max_real_irqs); 464 printk(KERN_INFO "irq: Found primary Apple PIC %s for %d irqs\n",
541 } 465 master->full_name, max_real_irqs);
542 } else { 466
543 /* older powermacs have a GC (grand central) or ohare at 467 /* Map interrupts of cascaded controller */
544 f3000000, with interrupt control registers at f3000020. */ 468 if (slave && !of_address_to_resource(slave, 0, &r)) {
545 addr = (unsigned long) ioremap(0xf3000000, 0x40); 469 addr = (u8 __iomem *)ioremap(r.start, 0x40);
546 pmac_irq_hw[0] = (volatile struct pmac_irq_hw *) (addr + 0x20); 470 pmac_irq_hw[i++] = (volatile struct pmac_irq_hw __iomem *)
471 (addr + 0x20);
472 if (max_irqs > 64)
473 pmac_irq_hw[i++] =
474 (volatile struct pmac_irq_hw __iomem *)
475 (addr + 0x10);
476 irq_cascade = slave->intrs[0].line;
477
478 printk(KERN_INFO "irq: Found slave Apple PIC %s for %d irqs"
479 " cascade: %d\n", slave->full_name,
480 max_irqs - max_real_irqs, irq_cascade);
547 } 481 }
548 482 of_node_put(slave);
549 /* PowerBooks 3400 and 3500 can have a second controller in a second
550 ohare chip, on the combo ethernet/modem card */
551 if (machine_is_compatible("AAPL,3400/2400")
552 || machine_is_compatible("AAPL,3500"))
553 irq_cascade = enable_second_ohare();
554 483
555 /* disable all interrupts in all controllers */ 484 /* disable all interrupts in all controllers */
556 for (i = 0; i * 32 < max_irqs; ++i) 485 for (i = 0; i * 32 < max_irqs; ++i)
557 out_le32(&pmac_irq_hw[i]->enable, 0); 486 out_le32(&pmac_irq_hw[i]->enable, 0);
487
558 /* mark level interrupts */ 488 /* mark level interrupts */
559 for (i = 0; i < max_irqs; i++) 489 for (i = 0; i < max_irqs; i++)
560 if (level_mask[i >> 5] & (1UL << (i & 0x1f))) 490 if (level_mask[i >> 5] & (1UL << (i & 0x1f)))
561 irq_desc[i].status = IRQ_LEVEL; 491 irq_desc[i].status = IRQ_LEVEL;
562 492
563 /* get interrupt line of secondary interrupt controller */ 493 /* Setup handlers for secondary controller and hook cascade irq*/
564 if (irq_cascade >= 0) { 494 if (slave) {
565 printk(KERN_INFO "irq: secondary controller on irq %d\n",
566 (int)irq_cascade);
567 for ( i = max_real_irqs ; i < max_irqs ; i++ ) 495 for ( i = max_real_irqs ; i < max_irqs ; i++ )
568 irq_desc[i].handler = &gatwick_pic; 496 irq_desc[i].handler = &gatwick_pic;
569 setup_irq(irq_cascade, &gatwick_cascade_action); 497 setup_irq(irq_cascade, &gatwick_cascade_action);
570 } 498 }
571 printk("System has %d possible interrupts\n", max_irqs); 499 printk(KERN_INFO "irq: System has %d possible interrupts\n", max_irqs);
572 if (max_irqs != max_real_irqs)
573 printk(KERN_DEBUG "%d interrupts on main controller\n",
574 max_real_irqs);
575
576#ifdef CONFIG_XMON 500#ifdef CONFIG_XMON
577 setup_irq(20, &xmon_action); 501 setup_irq(20, &xmon_action);
578#endif /* CONFIG_XMON */ 502#endif
579#endif /* CONFIG_PPC32 */ 503}
504#endif /* CONFIG_PPC32 */
505
506static int pmac_u3_cascade(struct pt_regs *regs, void *data)
507{
508 return mpic_get_one_irq((struct mpic *)data, regs);
509}
510
511static void __init pmac_pic_setup_mpic_nmi(struct mpic *mpic)
512{
513#if defined(CONFIG_XMON) && defined(CONFIG_PPC32)
514 struct device_node* pswitch;
515 int nmi_irq;
516
517 pswitch = of_find_node_by_name(NULL, "programmer-switch");
518 if (pswitch && pswitch->n_intrs) {
519 nmi_irq = pswitch->intrs[0].line;
520 mpic_irq_set_priority(nmi_irq, 9);
521 setup_irq(nmi_irq, &xmon_action);
522 }
523 of_node_put(pswitch);
524#endif /* defined(CONFIG_XMON) && defined(CONFIG_PPC32) */
525}
526
527static struct mpic * __init pmac_setup_one_mpic(struct device_node *np,
528 int master)
529{
530 unsigned char senses[128];
531 int offset = master ? 0 : 128;
532 int count = master ? 128 : 124;
533 const char *name = master ? " MPIC 1 " : " MPIC 2 ";
534 struct resource r;
535 struct mpic *mpic;
536 unsigned int flags = master ? MPIC_PRIMARY : 0;
537 int rc;
538
539 rc = of_address_to_resource(np, 0, &r);
540 if (rc)
541 return NULL;
542
543 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, np, 0, 0);
544
545 prom_get_irq_senses(senses, offset, offset + count);
546
547 flags |= MPIC_WANTS_RESET;
548 if (get_property(np, "big-endian", NULL))
549 flags |= MPIC_BIG_ENDIAN;
550
551 /* Primary Big Endian means HT interrupts. This is quite dodgy
552 * but works until I find a better way
553 */
554 if (master && (flags & MPIC_BIG_ENDIAN))
555 flags |= MPIC_BROKEN_U3;
556
557 mpic = mpic_alloc(r.start, flags, 0, offset, count, master ? 252 : 0,
558 senses, count, name);
559 if (mpic == NULL)
560 return NULL;
561
562 mpic_init(mpic);
563
564 return mpic;
565 }
566
567static int __init pmac_pic_probe_mpic(void)
568{
569 struct mpic *mpic1, *mpic2;
570 struct device_node *np, *master = NULL, *slave = NULL;
571
572 /* We can have up to 2 MPICs cascaded */
573 for (np = NULL; (np = of_find_node_by_type(np, "open-pic"))
574 != NULL;) {
575 if (master == NULL &&
576 get_property(np, "interrupts", NULL) == NULL)
577 master = of_node_get(np);
578 else if (slave == NULL)
579 slave = of_node_get(np);
580 if (master && slave)
581 break;
582 }
583
584 /* Check for bogus setups */
585 if (master == NULL && slave != NULL) {
586 master = slave;
587 slave = NULL;
588 }
589
590 /* Not found, default to good old pmac pic */
591 if (master == NULL)
592 return -ENODEV;
593
594 /* Set master handler */
595 ppc_md.get_irq = mpic_get_irq;
596
597 /* Setup master */
598 mpic1 = pmac_setup_one_mpic(master, 1);
599 BUG_ON(mpic1 == NULL);
600
601 /* Install NMI if any */
602 pmac_pic_setup_mpic_nmi(mpic1);
603
604 of_node_put(master);
605
606 /* No slave, let's go out */
607 if (slave == NULL || slave->n_intrs < 1)
608 return 0;
609
610 mpic2 = pmac_setup_one_mpic(slave, 0);
611 if (mpic2 == NULL) {
612 printk(KERN_ERR "Failed to setup slave MPIC\n");
613 of_node_put(slave);
614 return 0;
615 }
616 mpic_setup_cascade(slave->intrs[0].line, pmac_u3_cascade, mpic2);
617
618 of_node_put(slave);
619 return 0;
620}
621
622
623void __init pmac_pic_init(void)
624{
625 /* We first try to detect Apple's new Core99 chipset, since mac-io
626 * is quite different on those machines and contains an IBM MPIC2.
627 */
628 if (pmac_pic_probe_mpic() == 0)
629 return;
630
631#ifdef CONFIG_PPC32
632 pmac_pic_probe_oldstyle();
633#endif
580} 634}
581 635
582#if defined(CONFIG_PM) && defined(CONFIG_PPC32) 636#if defined(CONFIG_PM) && defined(CONFIG_PPC32)
diff --git a/arch/powerpc/platforms/powermac/pmac.h b/arch/powerpc/platforms/powermac/pmac.h
index 2ad25e13423e..21c7b0f8f329 100644
--- a/arch/powerpc/platforms/powermac/pmac.h
+++ b/arch/powerpc/platforms/powermac/pmac.h
@@ -42,10 +42,6 @@ extern void pmac_ide_init_hwif_ports(hw_regs_t *hw,
42 unsigned long data_port, unsigned long ctrl_port, int *irq); 42 unsigned long data_port, unsigned long ctrl_port, int *irq);
43 43
44extern int pmac_nvram_init(void); 44extern int pmac_nvram_init(void);
45 45extern void pmac_pic_init(void);
46extern struct hw_interrupt_type pmac_pic;
47
48void pmac_pic_init(void);
49int pmac_get_irq(struct pt_regs *regs);
50 46
51#endif /* __PMAC_H__ */ 47#endif /* __PMAC_H__ */
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 7acb0546671f..89c4c3636161 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -60,6 +60,7 @@
60#include <asm/system.h> 60#include <asm/system.h>
61#include <asm/pgtable.h> 61#include <asm/pgtable.h>
62#include <asm/io.h> 62#include <asm/io.h>
63#include <asm/kexec.h>
63#include <asm/pci-bridge.h> 64#include <asm/pci-bridge.h>
64#include <asm/ohare.h> 65#include <asm/ohare.h>
65#include <asm/mediabay.h> 66#include <asm/mediabay.h>
@@ -74,8 +75,8 @@
74#include <asm/iommu.h> 75#include <asm/iommu.h>
75#include <asm/smu.h> 76#include <asm/smu.h>
76#include <asm/pmc.h> 77#include <asm/pmc.h>
77#include <asm/mpic.h>
78#include <asm/lmb.h> 78#include <asm/lmb.h>
79#include <asm/udbg.h>
79 80
80#include "pmac.h" 81#include "pmac.h"
81 82
@@ -277,7 +278,7 @@ static void __init l2cr_init(void)
277} 278}
278#endif 279#endif
279 280
280void __init pmac_setup_arch(void) 281static void __init pmac_setup_arch(void)
281{ 282{
282 struct device_node *cpu, *ic; 283 struct device_node *cpu, *ic;
283 int *fp; 284 int *fp;
@@ -321,16 +322,6 @@ void __init pmac_setup_arch(void)
321 l2cr_init(); 322 l2cr_init();
322#endif /* CONFIG_PPC32 */ 323#endif /* CONFIG_PPC32 */
323 324
324#ifdef CONFIG_PPC64
325 /* Probe motherboard chipset */
326 /* this is done earlier in setup_arch for 32-bit */
327 pmac_feature_init();
328
329 /* We can NAP */
330 powersave_nap = 1;
331 printk(KERN_INFO "Using native/NAP idle loop\n");
332#endif
333
334#ifdef CONFIG_KGDB 325#ifdef CONFIG_KGDB
335 zs_kgdb_hook(0); 326 zs_kgdb_hook(0);
336#endif 327#endif
@@ -354,7 +345,7 @@ void __init pmac_setup_arch(void)
354 345
355#ifdef CONFIG_SMP 346#ifdef CONFIG_SMP
356 /* Check for Core99 */ 347 /* Check for Core99 */
357 if (find_devices("uni-n") || find_devices("u3")) 348 if (find_devices("uni-n") || find_devices("u3") || find_devices("u4"))
358 smp_ops = &core99_smp_ops; 349 smp_ops = &core99_smp_ops;
359#ifdef CONFIG_PPC32 350#ifdef CONFIG_PPC32
360 else 351 else
@@ -621,35 +612,31 @@ static void __init pmac_init_early(void)
621 * and call ioremap 612 * and call ioremap
622 */ 613 */
623 hpte_init_native(); 614 hpte_init_native();
615#endif
624 616
625 /* Init SCC */ 617 /* Enable early btext debug if requested */
626 if (strstr(cmd_line, "sccdbg")) { 618 if (strstr(cmd_line, "btextdbg")) {
627 sccdbg = 1; 619 udbg_adb_init_early();
628 udbg_init_scc(NULL); 620 register_early_udbg_console();
629 } 621 }
630 622
631 /* Setup interrupt mapping options */ 623 /* Probe motherboard chipset */
632 ppc64_interrupt_controller = IC_OPEN_PIC; 624 pmac_feature_init();
633 625
634 iommu_init_early_u3(); 626 /* We can NAP */
635#endif 627 powersave_nap = 1;
636} 628 printk(KERN_INFO "Using native/NAP idle loop\n");
629
630 /* Initialize debug stuff */
631 udbg_scc_init(!!strstr(cmd_line, "sccdbg"));
632 udbg_adb_init(!!strstr(cmd_line, "btextdbg"));
637 633
638static void __init pmac_progress(char *s, unsigned short hex)
639{
640#ifdef CONFIG_PPC64 634#ifdef CONFIG_PPC64
641 if (sccdbg) { 635 /* Setup interrupt mapping options */
642 udbg_puts(s); 636 ppc64_interrupt_controller = IC_OPEN_PIC;
643 udbg_puts("\n"); 637
644 return; 638 iommu_init_early_dart();
645 }
646#endif 639#endif
647#ifdef CONFIG_BOOTX_TEXT
648 if (boot_text_mapped) {
649 btext_drawstring(s);
650 btext_drawchar('\n');
651 }
652#endif /* CONFIG_BOOTX_TEXT */
653} 640}
654 641
655/* 642/*
@@ -663,35 +650,14 @@ static int pmac_check_legacy_ioport(unsigned int baseport)
663 650
664static int __init pmac_declare_of_platform_devices(void) 651static int __init pmac_declare_of_platform_devices(void)
665{ 652{
666 struct device_node *np, *npp; 653 struct device_node *np;
667 654
668 np = find_devices("uni-n"); 655 np = of_find_node_by_name(NULL, "valkyrie");
669 if (np) {
670 for (np = np->child; np != NULL; np = np->sibling)
671 if (strncmp(np->name, "i2c", 3) == 0) {
672 of_platform_device_create(np, "uni-n-i2c",
673 NULL);
674 break;
675 }
676 }
677 np = find_devices("valkyrie");
678 if (np) 656 if (np)
679 of_platform_device_create(np, "valkyrie", NULL); 657 of_platform_device_create(np, "valkyrie", NULL);
680 np = find_devices("platinum"); 658 np = of_find_node_by_name(NULL, "platinum");
681 if (np) 659 if (np)
682 of_platform_device_create(np, "platinum", NULL); 660 of_platform_device_create(np, "platinum", NULL);
683
684 npp = of_find_node_by_name(NULL, "u3");
685 if (npp) {
686 for (np = NULL; (np = of_get_next_child(npp, np)) != NULL;) {
687 if (strncmp(np->name, "i2c", 3) == 0) {
688 of_platform_device_create(np, "u3-i2c", NULL);
689 of_node_put(np);
690 break;
691 }
692 }
693 of_node_put(npp);
694 }
695 np = of_find_node_by_type(NULL, "smu"); 661 np = of_find_node_by_type(NULL, "smu");
696 if (np) { 662 if (np) {
697 of_platform_device_create(np, "smu", NULL); 663 of_platform_device_create(np, "smu", NULL);
@@ -718,7 +684,7 @@ static int __init pmac_probe(int platform)
718 * occupies having to be broken up so the DART itself is not 684 * occupies having to be broken up so the DART itself is not
719 * part of the cacheable linar mapping 685 * part of the cacheable linar mapping
720 */ 686 */
721 alloc_u3_dart_table(); 687 alloc_dart_table();
722#endif 688#endif
723 689
724#ifdef CONFIG_PMAC_SMU 690#ifdef CONFIG_PMAC_SMU
@@ -734,15 +700,17 @@ static int __init pmac_probe(int platform)
734} 700}
735 701
736#ifdef CONFIG_PPC64 702#ifdef CONFIG_PPC64
737static int pmac_probe_mode(struct pci_bus *bus) 703/* Move that to pci.c */
704static int pmac_pci_probe_mode(struct pci_bus *bus)
738{ 705{
739 struct device_node *node = bus->sysdata; 706 struct device_node *node = bus->sysdata;
740 707
741 /* We need to use normal PCI probing for the AGP bus, 708 /* We need to use normal PCI probing for the AGP bus,
742 since the device for the AGP bridge isn't in the tree. */ 709 * since the device for the AGP bridge isn't in the tree.
743 if (bus->self == NULL && device_is_compatible(node, "u3-agp")) 710 */
711 if (bus->self == NULL && (device_is_compatible(node, "u3-agp") ||
712 device_is_compatible(node, "u4-pcie")))
744 return PCI_PROBE_NORMAL; 713 return PCI_PROBE_NORMAL;
745
746 return PCI_PROBE_DEVTREE; 714 return PCI_PROBE_DEVTREE;
747} 715}
748#endif 716#endif
@@ -756,7 +724,7 @@ struct machdep_calls __initdata pmac_md = {
756 .init_early = pmac_init_early, 724 .init_early = pmac_init_early,
757 .show_cpuinfo = pmac_show_cpuinfo, 725 .show_cpuinfo = pmac_show_cpuinfo,
758 .init_IRQ = pmac_pic_init, 726 .init_IRQ = pmac_pic_init,
759 .get_irq = mpic_get_irq, /* changed later */ 727 .get_irq = NULL, /* changed later */
760 .pcibios_fixup = pmac_pcibios_fixup, 728 .pcibios_fixup = pmac_pcibios_fixup,
761 .restart = pmac_restart, 729 .restart = pmac_restart,
762 .power_off = pmac_power_off, 730 .power_off = pmac_power_off,
@@ -768,12 +736,17 @@ struct machdep_calls __initdata pmac_md = {
768 .calibrate_decr = pmac_calibrate_decr, 736 .calibrate_decr = pmac_calibrate_decr,
769 .feature_call = pmac_do_feature_call, 737 .feature_call = pmac_do_feature_call,
770 .check_legacy_ioport = pmac_check_legacy_ioport, 738 .check_legacy_ioport = pmac_check_legacy_ioport,
771 .progress = pmac_progress, 739 .progress = udbg_progress,
772#ifdef CONFIG_PPC64 740#ifdef CONFIG_PPC64
773 .pci_probe_mode = pmac_probe_mode, 741 .pci_probe_mode = pmac_pci_probe_mode,
774 .idle_loop = native_idle, 742 .idle_loop = native_idle,
775 .enable_pmcs = power4_enable_pmcs, 743 .enable_pmcs = power4_enable_pmcs,
744#ifdef CONFIG_KEXEC
745 .machine_kexec = default_machine_kexec,
746 .machine_kexec_prepare = default_machine_kexec_prepare,
747 .machine_crash_shutdown = default_machine_crash_shutdown,
776#endif 748#endif
749#endif /* CONFIG_PPC64 */
777#ifdef CONFIG_PPC32 750#ifdef CONFIG_PPC32
778 .pcibios_enable_device_hook = pmac_pci_enable_device_hook, 751 .pcibios_enable_device_hook = pmac_pci_enable_device_hook,
779 .pcibios_after_init = pmac_pcibios_after_init, 752 .pcibios_after_init = pmac_pcibios_after_init,
diff --git a/arch/powerpc/platforms/powermac/smp.c b/arch/powerpc/platforms/powermac/smp.c
index fb2a7c798e82..0df2cdcd805c 100644
--- a/arch/powerpc/platforms/powermac/smp.c
+++ b/arch/powerpc/platforms/powermac/smp.c
@@ -52,8 +52,9 @@
52#include <asm/cacheflush.h> 52#include <asm/cacheflush.h>
53#include <asm/keylargo.h> 53#include <asm/keylargo.h>
54#include <asm/pmac_low_i2c.h> 54#include <asm/pmac_low_i2c.h>
55#include <asm/pmac_pfunc.h>
55 56
56#undef DEBUG 57#define DEBUG
57 58
58#ifdef DEBUG 59#ifdef DEBUG
59#define DBG(fmt...) udbg_printf(fmt) 60#define DBG(fmt...) udbg_printf(fmt)
@@ -62,6 +63,7 @@
62#endif 63#endif
63 64
64extern void __secondary_start_pmac_0(void); 65extern void __secondary_start_pmac_0(void);
66extern int pmac_pfunc_base_install(void);
65 67
66#ifdef CONFIG_PPC32 68#ifdef CONFIG_PPC32
67 69
@@ -361,7 +363,6 @@ static void __init psurge_dual_sync_tb(int cpu_nr)
361 set_dec(tb_ticks_per_jiffy); 363 set_dec(tb_ticks_per_jiffy);
362 /* XXX fixme */ 364 /* XXX fixme */
363 set_tb(0, 0); 365 set_tb(0, 0);
364 last_jiffy_stamp(cpu_nr) = 0;
365 366
366 if (cpu_nr > 0) { 367 if (cpu_nr > 0) {
367 mb(); 368 mb();
@@ -429,15 +430,62 @@ struct smp_ops_t psurge_smp_ops = {
429}; 430};
430#endif /* CONFIG_PPC32 - actually powersurge support */ 431#endif /* CONFIG_PPC32 - actually powersurge support */
431 432
433/*
434 * Core 99 and later support
435 */
436
437static void (*pmac_tb_freeze)(int freeze);
438static unsigned long timebase;
439static int tb_req;
440
441static void smp_core99_give_timebase(void)
442{
443 unsigned long flags;
444
445 local_irq_save(flags);
446
447 while(!tb_req)
448 barrier();
449 tb_req = 0;
450 (*pmac_tb_freeze)(1);
451 mb();
452 timebase = get_tb();
453 mb();
454 while (timebase)
455 barrier();
456 mb();
457 (*pmac_tb_freeze)(0);
458 mb();
459
460 local_irq_restore(flags);
461}
462
463
464static void __devinit smp_core99_take_timebase(void)
465{
466 unsigned long flags;
467
468 local_irq_save(flags);
469
470 tb_req = 1;
471 mb();
472 while (!timebase)
473 barrier();
474 mb();
475 set_tb(timebase >> 32, timebase & 0xffffffff);
476 timebase = 0;
477 mb();
478 set_dec(tb_ticks_per_jiffy/2);
479
480 local_irq_restore(flags);
481}
482
432#ifdef CONFIG_PPC64 483#ifdef CONFIG_PPC64
433/* 484/*
434 * G5s enable/disable the timebase via an i2c-connected clock chip. 485 * G5s enable/disable the timebase via an i2c-connected clock chip.
435 */ 486 */
436static struct device_node *pmac_tb_clock_chip_host; 487static struct pmac_i2c_bus *pmac_tb_clock_chip_host;
437static u8 pmac_tb_pulsar_addr; 488static u8 pmac_tb_pulsar_addr;
438static void (*pmac_tb_freeze)(int freeze);
439static DEFINE_SPINLOCK(timebase_lock);
440static unsigned long timebase;
441 489
442static void smp_core99_cypress_tb_freeze(int freeze) 490static void smp_core99_cypress_tb_freeze(int freeze)
443{ 491{
@@ -447,19 +495,20 @@ static void smp_core99_cypress_tb_freeze(int freeze)
447 /* Strangely, the device-tree says address is 0xd2, but darwin 495 /* Strangely, the device-tree says address is 0xd2, but darwin
448 * accesses 0xd0 ... 496 * accesses 0xd0 ...
449 */ 497 */
450 pmac_low_i2c_setmode(pmac_tb_clock_chip_host, pmac_low_i2c_mode_combined); 498 pmac_i2c_setmode(pmac_tb_clock_chip_host,
451 rc = pmac_low_i2c_xfer(pmac_tb_clock_chip_host, 499 pmac_i2c_mode_combined);
452 0xd0 | pmac_low_i2c_read, 500 rc = pmac_i2c_xfer(pmac_tb_clock_chip_host,
453 0x81, &data, 1); 501 0xd0 | pmac_i2c_read,
502 1, 0x81, &data, 1);
454 if (rc != 0) 503 if (rc != 0)
455 goto bail; 504 goto bail;
456 505
457 data = (data & 0xf3) | (freeze ? 0x00 : 0x0c); 506 data = (data & 0xf3) | (freeze ? 0x00 : 0x0c);
458 507
459 pmac_low_i2c_setmode(pmac_tb_clock_chip_host, pmac_low_i2c_mode_stdsub); 508 pmac_i2c_setmode(pmac_tb_clock_chip_host, pmac_i2c_mode_stdsub);
460 rc = pmac_low_i2c_xfer(pmac_tb_clock_chip_host, 509 rc = pmac_i2c_xfer(pmac_tb_clock_chip_host,
461 0xd0 | pmac_low_i2c_write, 510 0xd0 | pmac_i2c_write,
462 0x81, &data, 1); 511 1, 0x81, &data, 1);
463 512
464 bail: 513 bail:
465 if (rc != 0) { 514 if (rc != 0) {
@@ -475,19 +524,20 @@ static void smp_core99_pulsar_tb_freeze(int freeze)
475 u8 data; 524 u8 data;
476 int rc; 525 int rc;
477 526
478 pmac_low_i2c_setmode(pmac_tb_clock_chip_host, pmac_low_i2c_mode_combined); 527 pmac_i2c_setmode(pmac_tb_clock_chip_host,
479 rc = pmac_low_i2c_xfer(pmac_tb_clock_chip_host, 528 pmac_i2c_mode_combined);
480 pmac_tb_pulsar_addr | pmac_low_i2c_read, 529 rc = pmac_i2c_xfer(pmac_tb_clock_chip_host,
481 0x2e, &data, 1); 530 pmac_tb_pulsar_addr | pmac_i2c_read,
531 1, 0x2e, &data, 1);
482 if (rc != 0) 532 if (rc != 0)
483 goto bail; 533 goto bail;
484 534
485 data = (data & 0x88) | (freeze ? 0x11 : 0x22); 535 data = (data & 0x88) | (freeze ? 0x11 : 0x22);
486 536
487 pmac_low_i2c_setmode(pmac_tb_clock_chip_host, pmac_low_i2c_mode_stdsub); 537 pmac_i2c_setmode(pmac_tb_clock_chip_host, pmac_i2c_mode_stdsub);
488 rc = pmac_low_i2c_xfer(pmac_tb_clock_chip_host, 538 rc = pmac_i2c_xfer(pmac_tb_clock_chip_host,
489 pmac_tb_pulsar_addr | pmac_low_i2c_write, 539 pmac_tb_pulsar_addr | pmac_i2c_write,
490 0x2e, &data, 1); 540 1, 0x2e, &data, 1);
491 bail: 541 bail:
492 if (rc != 0) { 542 if (rc != 0) {
493 printk(KERN_ERR "Pulsar Timebase %s rc: %d\n", 543 printk(KERN_ERR "Pulsar Timebase %s rc: %d\n",
@@ -496,54 +546,14 @@ static void smp_core99_pulsar_tb_freeze(int freeze)
496 } 546 }
497} 547}
498 548
499 549static void __init smp_core99_setup_i2c_hwsync(int ncpus)
500static void smp_core99_give_timebase(void)
501{
502 /* Open i2c bus for synchronous access */
503 if (pmac_low_i2c_open(pmac_tb_clock_chip_host, 0))
504 panic("Can't open i2c for TB sync !\n");
505
506 spin_lock(&timebase_lock);
507 (*pmac_tb_freeze)(1);
508 mb();
509 timebase = get_tb();
510 spin_unlock(&timebase_lock);
511
512 while (timebase)
513 barrier();
514
515 spin_lock(&timebase_lock);
516 (*pmac_tb_freeze)(0);
517 spin_unlock(&timebase_lock);
518
519 /* Close i2c bus */
520 pmac_low_i2c_close(pmac_tb_clock_chip_host);
521}
522
523
524static void __devinit smp_core99_take_timebase(void)
525{
526 while (!timebase)
527 barrier();
528 spin_lock(&timebase_lock);
529 set_tb(timebase >> 32, timebase & 0xffffffff);
530 timebase = 0;
531 spin_unlock(&timebase_lock);
532}
533
534static void __init smp_core99_setup(int ncpus)
535{ 550{
536 struct device_node *cc = NULL; 551 struct device_node *cc = NULL;
537 struct device_node *p; 552 struct device_node *p;
553 const char *name = NULL;
538 u32 *reg; 554 u32 *reg;
539 int ok; 555 int ok;
540 556
541 /* HW sync only on these platforms */
542 if (!machine_is_compatible("PowerMac7,2") &&
543 !machine_is_compatible("PowerMac7,3") &&
544 !machine_is_compatible("RackMac3,1"))
545 return;
546
547 /* Look for the clock chip */ 557 /* Look for the clock chip */
548 while ((cc = of_find_node_by_name(cc, "i2c-hwclock")) != NULL) { 558 while ((cc = of_find_node_by_name(cc, "i2c-hwclock")) != NULL) {
549 p = of_get_parent(cc); 559 p = of_get_parent(cc);
@@ -552,124 +562,86 @@ static void __init smp_core99_setup(int ncpus)
552 if (!ok) 562 if (!ok)
553 continue; 563 continue;
554 564
565 pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc);
566 if (pmac_tb_clock_chip_host == NULL)
567 continue;
555 reg = (u32 *)get_property(cc, "reg", NULL); 568 reg = (u32 *)get_property(cc, "reg", NULL);
556 if (reg == NULL) 569 if (reg == NULL)
557 continue; 570 continue;
558
559 switch (*reg) { 571 switch (*reg) {
560 case 0xd2: 572 case 0xd2:
561 if (device_is_compatible(cc, "pulsar-legacy-slewing")) { 573 if (device_is_compatible(cc,"pulsar-legacy-slewing")) {
562 pmac_tb_freeze = smp_core99_pulsar_tb_freeze; 574 pmac_tb_freeze = smp_core99_pulsar_tb_freeze;
563 pmac_tb_pulsar_addr = 0xd2; 575 pmac_tb_pulsar_addr = 0xd2;
564 printk(KERN_INFO "Timebase clock is Pulsar chip\n"); 576 name = "Pulsar";
565 } else if (device_is_compatible(cc, "cy28508")) { 577 } else if (device_is_compatible(cc, "cy28508")) {
566 pmac_tb_freeze = smp_core99_cypress_tb_freeze; 578 pmac_tb_freeze = smp_core99_cypress_tb_freeze;
567 printk(KERN_INFO "Timebase clock is Cypress chip\n"); 579 name = "Cypress";
568 } 580 }
569 break; 581 break;
570 case 0xd4: 582 case 0xd4:
571 pmac_tb_freeze = smp_core99_pulsar_tb_freeze; 583 pmac_tb_freeze = smp_core99_pulsar_tb_freeze;
572 pmac_tb_pulsar_addr = 0xd4; 584 pmac_tb_pulsar_addr = 0xd4;
573 printk(KERN_INFO "Timebase clock is Pulsar chip\n"); 585 name = "Pulsar";
574 break; 586 break;
575 } 587 }
576 if (pmac_tb_freeze != NULL) { 588 if (pmac_tb_freeze != NULL)
577 pmac_tb_clock_chip_host = of_get_parent(cc);
578 of_node_put(cc);
579 break; 589 break;
580 }
581 } 590 }
582 if (pmac_tb_freeze == NULL) { 591 if (pmac_tb_freeze != NULL) {
583 smp_ops->give_timebase = smp_generic_give_timebase; 592 /* Open i2c bus for synchronous access */
584 smp_ops->take_timebase = smp_generic_take_timebase; 593 if (pmac_i2c_open(pmac_tb_clock_chip_host, 1)) {
594 printk(KERN_ERR "Failed top open i2c bus for clock"
595 " sync, fallback to software sync !\n");
596 goto no_i2c_sync;
597 }
598 printk(KERN_INFO "Processor timebase sync using %s i2c clock\n",
599 name);
600 return;
585 } 601 }
602 no_i2c_sync:
603 pmac_tb_freeze = NULL;
604 pmac_tb_clock_chip_host = NULL;
586} 605}
587 606
588/* nothing to do here, caches are already set up by service processor */ 607
589static inline void __devinit core99_init_caches(int cpu) 608
609/*
610 * Newer G5s uses a platform function
611 */
612
613static void smp_core99_pfunc_tb_freeze(int freeze)
590{ 614{
615 struct device_node *cpus;
616 struct pmf_args args;
617
618 cpus = of_find_node_by_path("/cpus");
619 BUG_ON(cpus == NULL);
620 args.count = 1;
621 args.u[0].v = !freeze;
622 pmf_call_function(cpus, "cpu-timebase", &args);
623 of_node_put(cpus);
591} 624}
592 625
593#else /* CONFIG_PPC64 */ 626#else /* CONFIG_PPC64 */
594 627
595/* 628/*
596 * SMP G4 powermacs use a GPIO to enable/disable the timebase. 629 * SMP G4 use a GPIO to enable/disable the timebase.
597 */ 630 */
598 631
599static unsigned int core99_tb_gpio; /* Timebase freeze GPIO */ 632static unsigned int core99_tb_gpio; /* Timebase freeze GPIO */
600 633
601static unsigned int pri_tb_hi, pri_tb_lo; 634static void smp_core99_gpio_tb_freeze(int freeze)
602static unsigned int pri_tb_stamp;
603
604/* not __init, called in sleep/wakeup code */
605void smp_core99_give_timebase(void)
606{ 635{
607 unsigned long flags; 636 if (freeze)
608 unsigned int t; 637 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, core99_tb_gpio, 4);
609 638 else
610 /* wait for the secondary to be in take_timebase */ 639 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, core99_tb_gpio, 0);
611 for (t = 100000; t > 0 && !sec_tb_reset; --t)
612 udelay(10);
613 if (!sec_tb_reset) {
614 printk(KERN_WARNING "Timeout waiting sync on second CPU\n");
615 return;
616 }
617
618 /* freeze the timebase and read it */
619 /* disable interrupts so the timebase is disabled for the
620 shortest possible time */
621 local_irq_save(flags);
622 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, core99_tb_gpio, 4);
623 pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, core99_tb_gpio, 0); 640 pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, core99_tb_gpio, 0);
624 mb();
625 pri_tb_hi = get_tbu();
626 pri_tb_lo = get_tbl();
627 pri_tb_stamp = last_jiffy_stamp(smp_processor_id());
628 mb();
629
630 /* tell the secondary we're ready */
631 sec_tb_reset = 2;
632 mb();
633
634 /* wait for the secondary to have taken it */
635 /* note: can't use udelay here, since it needs the timebase running */
636 for (t = 10000000; t > 0 && sec_tb_reset; --t)
637 barrier();
638 if (sec_tb_reset)
639 /* XXX BUG_ON here? */
640 printk(KERN_WARNING "Timeout waiting sync(2) on second CPU\n");
641
642 /* Now, restart the timebase by leaving the GPIO to an open collector */
643 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, core99_tb_gpio, 0);
644 pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, core99_tb_gpio, 0);
645 local_irq_restore(flags);
646} 641}
647 642
648/* not __init, called in sleep/wakeup code */
649void smp_core99_take_timebase(void)
650{
651 unsigned long flags;
652
653 /* tell the primary we're here */
654 sec_tb_reset = 1;
655 mb();
656
657 /* wait for the primary to set pri_tb_hi/lo */
658 while (sec_tb_reset < 2)
659 mb();
660
661 /* set our stuff the same as the primary */
662 local_irq_save(flags);
663 set_dec(1);
664 set_tb(pri_tb_hi, pri_tb_lo);
665 last_jiffy_stamp(smp_processor_id()) = pri_tb_stamp;
666 mb();
667 643
668 /* tell the primary we're done */ 644#endif /* !CONFIG_PPC64 */
669 sec_tb_reset = 0;
670 mb();
671 local_irq_restore(flags);
672}
673 645
674/* L2 and L3 cache settings to pass from CPU0 to CPU1 on G4 cpus */ 646/* L2 and L3 cache settings to pass from CPU0 to CPU1 on G4 cpus */
675volatile static long int core99_l2_cache; 647volatile static long int core99_l2_cache;
@@ -677,6 +649,7 @@ volatile static long int core99_l3_cache;
677 649
678static void __devinit core99_init_caches(int cpu) 650static void __devinit core99_init_caches(int cpu)
679{ 651{
652#ifndef CONFIG_PPC64
680 if (!cpu_has_feature(CPU_FTR_L2CR)) 653 if (!cpu_has_feature(CPU_FTR_L2CR))
681 return; 654 return;
682 655
@@ -702,30 +675,76 @@ static void __devinit core99_init_caches(int cpu)
702 _set_L3CR(core99_l3_cache); 675 _set_L3CR(core99_l3_cache);
703 printk("CPU%d: L3CR set to %lx\n", cpu, core99_l3_cache); 676 printk("CPU%d: L3CR set to %lx\n", cpu, core99_l3_cache);
704 } 677 }
678#endif /* !CONFIG_PPC64 */
705} 679}
706 680
707static void __init smp_core99_setup(int ncpus) 681static void __init smp_core99_setup(int ncpus)
708{ 682{
709 struct device_node *cpu; 683#ifdef CONFIG_PPC64
710 u32 *tbprop = NULL; 684
711 int i; 685 /* i2c based HW sync on some G5s */
686 if (machine_is_compatible("PowerMac7,2") ||
687 machine_is_compatible("PowerMac7,3") ||
688 machine_is_compatible("RackMac3,1"))
689 smp_core99_setup_i2c_hwsync(ncpus);
712 690
713 core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */ 691 /* pfunc based HW sync on recent G5s */
714 cpu = of_find_node_by_type(NULL, "cpu"); 692 if (pmac_tb_freeze == NULL) {
715 if (cpu != NULL) { 693 struct device_node *cpus =
716 tbprop = (u32 *)get_property(cpu, "timebase-enable", NULL); 694 of_find_node_by_path("/cpus");
717 if (tbprop) 695 if (cpus &&
718 core99_tb_gpio = *tbprop; 696 get_property(cpus, "platform-cpu-timebase", NULL)) {
719 of_node_put(cpu); 697 pmac_tb_freeze = smp_core99_pfunc_tb_freeze;
698 printk(KERN_INFO "Processor timebase sync using"
699 " platform function\n");
700 }
720 } 701 }
721 702
722 /* XXX should get this from reg properties */ 703#else /* CONFIG_PPC64 */
723 for (i = 1; i < ncpus; ++i) 704
724 smp_hw_index[i] = i; 705 /* GPIO based HW sync on ppc32 Core99 */
725 powersave_nap = 0; 706 if (pmac_tb_freeze == NULL && !machine_is_compatible("MacRISC4")) {
726} 707 struct device_node *cpu;
708 u32 *tbprop = NULL;
709
710 core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */
711 cpu = of_find_node_by_type(NULL, "cpu");
712 if (cpu != NULL) {
713 tbprop = (u32 *)get_property(cpu, "timebase-enable",
714 NULL);
715 if (tbprop)
716 core99_tb_gpio = *tbprop;
717 of_node_put(cpu);
718 }
719 pmac_tb_freeze = smp_core99_gpio_tb_freeze;
720 printk(KERN_INFO "Processor timebase sync using"
721 " GPIO 0x%02x\n", core99_tb_gpio);
722 }
723
724#endif /* CONFIG_PPC64 */
725
726 /* No timebase sync, fallback to software */
727 if (pmac_tb_freeze == NULL) {
728 smp_ops->give_timebase = smp_generic_give_timebase;
729 smp_ops->take_timebase = smp_generic_take_timebase;
730 printk(KERN_INFO "Processor timebase sync using software\n");
731 }
732
733#ifndef CONFIG_PPC64
734 {
735 int i;
736
737 /* XXX should get this from reg properties */
738 for (i = 1; i < ncpus; ++i)
739 smp_hw_index[i] = i;
740 }
727#endif 741#endif
728 742
743 /* 32 bits SMP can't NAP */
744 if (!machine_is_compatible("MacRISC4"))
745 powersave_nap = 0;
746}
747
729static int __init smp_core99_probe(void) 748static int __init smp_core99_probe(void)
730{ 749{
731 struct device_node *cpus; 750 struct device_node *cpus;
@@ -743,8 +762,19 @@ static int __init smp_core99_probe(void)
743 if (ncpus <= 1) 762 if (ncpus <= 1)
744 return 1; 763 return 1;
745 764
765 /* We need to perform some early initialisations before we can start
766 * setting up SMP as we are running before initcalls
767 */
768 pmac_pfunc_base_install();
769 pmac_i2c_init();
770
771 /* Setup various bits like timebase sync method, ability to nap, ... */
746 smp_core99_setup(ncpus); 772 smp_core99_setup(ncpus);
773
774 /* Install IPIs */
747 mpic_request_ipis(); 775 mpic_request_ipis();
776
777 /* Collect l2cr and l3cr values from CPU 0 */
748 core99_init_caches(0); 778 core99_init_caches(0);
749 779
750 return ncpus; 780 return ncpus;
@@ -753,14 +783,15 @@ static int __init smp_core99_probe(void)
753static void __devinit smp_core99_kick_cpu(int nr) 783static void __devinit smp_core99_kick_cpu(int nr)
754{ 784{
755 unsigned int save_vector; 785 unsigned int save_vector;
756 unsigned long new_vector; 786 unsigned long target, flags;
757 unsigned long flags;
758 volatile unsigned int *vector 787 volatile unsigned int *vector
759 = ((volatile unsigned int *)(KERNELBASE+0x100)); 788 = ((volatile unsigned int *)(KERNELBASE+0x100));
760 789
761 if (nr < 0 || nr > 3) 790 if (nr < 0 || nr > 3)
762 return; 791 return;
763 if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu", 0x346); 792
793 if (ppc_md.progress)
794 ppc_md.progress("smp_core99_kick_cpu", 0x346);
764 795
765 local_irq_save(flags); 796 local_irq_save(flags);
766 local_irq_disable(); 797 local_irq_disable();
@@ -768,14 +799,11 @@ static void __devinit smp_core99_kick_cpu(int nr)
768 /* Save reset vector */ 799 /* Save reset vector */
769 save_vector = *vector; 800 save_vector = *vector;
770 801
771 /* Setup fake reset vector that does 802 /* Setup fake reset vector that does
772 * b __secondary_start_pmac_0 + nr*8 - KERNELBASE 803 * b __secondary_start_pmac_0 + nr*8 - KERNELBASE
773 */ 804 */
774 new_vector = (unsigned long) __secondary_start_pmac_0 + nr * 8; 805 target = (unsigned long) __secondary_start_pmac_0 + nr * 8;
775 *vector = 0x48000002 + new_vector - KERNELBASE; 806 create_branch((unsigned long)vector, target, BRANCH_SET_LINK);
776
777 /* flush data cache and inval instruction cache */
778 flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
779 807
780 /* Put some life in our friend */ 808 /* Put some life in our friend */
781 pmac_call_feature(PMAC_FTR_RESET_CPU, NULL, nr, 0); 809 pmac_call_feature(PMAC_FTR_RESET_CPU, NULL, nr, 0);
@@ -805,17 +833,25 @@ static void __devinit smp_core99_setup_cpu(int cpu_nr)
805 mpic_setup_this_cpu(); 833 mpic_setup_this_cpu();
806 834
807 if (cpu_nr == 0) { 835 if (cpu_nr == 0) {
808#ifdef CONFIG_POWER4 836#ifdef CONFIG_PPC64
809 extern void g5_phy_disable_cpu1(void); 837 extern void g5_phy_disable_cpu1(void);
810 838
839 /* Close i2c bus if it was used for tb sync */
840 if (pmac_tb_clock_chip_host) {
841 pmac_i2c_close(pmac_tb_clock_chip_host);
842 pmac_tb_clock_chip_host = NULL;
843 }
844
811 /* If we didn't start the second CPU, we must take 845 /* If we didn't start the second CPU, we must take
812 * it off the bus 846 * it off the bus
813 */ 847 */
814 if (machine_is_compatible("MacRISC4") && 848 if (machine_is_compatible("MacRISC4") &&
815 num_online_cpus() < 2) 849 num_online_cpus() < 2)
816 g5_phy_disable_cpu1(); 850 g5_phy_disable_cpu1();
817#endif /* CONFIG_POWER4 */ 851#endif /* CONFIG_PPC64 */
818 if (ppc_md.progress) ppc_md.progress("core99_setup_cpu 0 done", 0x349); 852
853 if (ppc_md.progress)
854 ppc_md.progress("core99_setup_cpu 0 done", 0x349);
819 } 855 }
820} 856}
821 857
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
index feb0a94e7819..5d9afa1fa02d 100644
--- a/arch/powerpc/platforms/powermac/time.c
+++ b/arch/powerpc/platforms/powermac/time.c
@@ -258,15 +258,20 @@ int __init via_calibrate_decr(void)
258 volatile unsigned char __iomem *via; 258 volatile unsigned char __iomem *via;
259 int count = VIA_TIMER_FREQ_6 / 100; 259 int count = VIA_TIMER_FREQ_6 / 100;
260 unsigned int dstart, dend; 260 unsigned int dstart, dend;
261 struct resource rsrc;
261 262
262 vias = find_devices("via-cuda"); 263 vias = of_find_node_by_name(NULL, "via-cuda");
263 if (vias == 0) 264 if (vias == 0)
264 vias = find_devices("via-pmu"); 265 vias = of_find_node_by_name(NULL, "via-pmu");
265 if (vias == 0) 266 if (vias == 0)
266 vias = find_devices("via"); 267 vias = of_find_node_by_name(NULL, "via");
267 if (vias == 0 || vias->n_addrs == 0) 268 if (vias == 0 || of_address_to_resource(vias, 0, &rsrc))
268 return 0; 269 return 0;
269 via = ioremap(vias->addrs[0].address, vias->addrs[0].size); 270 via = ioremap(rsrc.start, rsrc.end - rsrc.start + 1);
271 if (via == NULL) {
272 printk(KERN_ERR "Failed to map VIA for timer calibration !\n");
273 return 0;
274 }
270 275
271 /* set timer 1 for continuous interrupts */ 276 /* set timer 1 for continuous interrupts */
272 out_8(&via[ACR], (via[ACR] & ~T1MODE) | T1MODE_CONT); 277 out_8(&via[ACR], (via[ACR] & ~T1MODE) | T1MODE_CONT);
diff --git a/arch/powerpc/platforms/powermac/udbg_adb.c b/arch/powerpc/platforms/powermac/udbg_adb.c
new file mode 100644
index 000000000000..06c8265c2baf
--- /dev/null
+++ b/arch/powerpc/platforms/powermac/udbg_adb.c
@@ -0,0 +1,221 @@
1#include <linux/config.h>
2#include <linux/string.h>
3#include <linux/kernel.h>
4#include <linux/errno.h>
5#include <linux/bitops.h>
6#include <linux/ptrace.h>
7#include <linux/adb.h>
8#include <linux/pmu.h>
9#include <linux/cuda.h>
10#include <asm/machdep.h>
11#include <asm/io.h>
12#include <asm/page.h>
13#include <asm/xmon.h>
14#include <asm/prom.h>
15#include <asm/bootx.h>
16#include <asm/machdep.h>
17#include <asm/errno.h>
18#include <asm/pmac_feature.h>
19#include <asm/processor.h>
20#include <asm/delay.h>
21#include <asm/btext.h>
22#include <asm/time.h>
23#include <asm/udbg.h>
24
25/*
26 * This implementation is "special", it can "patch" the current
27 * udbg implementation and work on top of it. It must thus be
28 * initialized last
29 */
30
31static void (*udbg_adb_old_putc)(char c);
32static int (*udbg_adb_old_getc)(void);
33static int (*udbg_adb_old_getc_poll)(void);
34
35static enum {
36 input_adb_none,
37 input_adb_pmu,
38 input_adb_cuda,
39} input_type = input_adb_none;
40
41int xmon_wants_key, xmon_adb_keycode;
42
43static inline void udbg_adb_poll(void)
44{
45#ifdef CONFIG_ADB_PMU
46 if (input_type == input_adb_pmu)
47 pmu_poll_adb();
48#endif /* CONFIG_ADB_PMU */
49#ifdef CONFIG_ADB_CUDA
50 if (input_type == input_adb_cuda)
51 cuda_poll();
52#endif /* CONFIG_ADB_CUDA */
53}
54
55#ifdef CONFIG_BOOTX_TEXT
56
57static int udbg_adb_use_btext;
58static int xmon_adb_shiftstate;
59
60static unsigned char xmon_keytab[128] =
61 "asdfhgzxcv\000bqwer" /* 0x00 - 0x0f */
62 "yt123465=97-80]o" /* 0x10 - 0x1f */
63 "u[ip\rlj'k;\\,/nm." /* 0x20 - 0x2f */
64 "\t `\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */
65 "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */
66 "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */
67
68static unsigned char xmon_shift_keytab[128] =
69 "ASDFHGZXCV\000BQWER" /* 0x00 - 0x0f */
70 "YT!@#$^%+(&_*)}O" /* 0x10 - 0x1f */
71 "U{IP\rLJ\"K:|<?NM>" /* 0x20 - 0x2f */
72 "\t ~\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */
73 "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */
74 "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */
75
76static int udbg_adb_local_getc(void)
77{
78 int k, t, on;
79
80 xmon_wants_key = 1;
81 for (;;) {
82 xmon_adb_keycode = -1;
83 t = 0;
84 on = 0;
85 k = -1;
86 do {
87 if (--t < 0) {
88 on = 1 - on;
89 btext_drawchar(on? 0xdb: 0x20);
90 btext_drawchar('\b');
91 t = 200000;
92 }
93 udbg_adb_poll();
94 if (udbg_adb_old_getc_poll)
95 k = udbg_adb_old_getc_poll();
96 } while (k == -1 && xmon_adb_keycode == -1);
97 if (on)
98 btext_drawstring(" \b");
99 if (k != -1)
100 return k;
101 k = xmon_adb_keycode;
102
103 /* test for shift keys */
104 if ((k & 0x7f) == 0x38 || (k & 0x7f) == 0x7b) {
105 xmon_adb_shiftstate = (k & 0x80) == 0;
106 continue;
107 }
108 if (k >= 0x80)
109 continue; /* ignore up transitions */
110 k = (xmon_adb_shiftstate? xmon_shift_keytab: xmon_keytab)[k];
111 if (k != 0)
112 break;
113 }
114 xmon_wants_key = 0;
115 return k;
116}
117#endif /* CONFIG_BOOTX_TEXT */
118
119static int udbg_adb_getc(void)
120{
121#ifdef CONFIG_BOOTX_TEXT
122 if (udbg_adb_use_btext && input_type != input_adb_none)
123 return udbg_adb_local_getc();
124#endif
125 if (udbg_adb_old_getc)
126 return udbg_adb_old_getc();
127 return -1;
128}
129
130/* getc_poll() is not really used, unless you have the xmon-over modem
131 * hack that doesn't quite concern us here, thus we just poll the low level
132 * ADB driver to prevent it from timing out and call back the original poll
133 * routine.
134 */
135static int udbg_adb_getc_poll(void)
136{
137 udbg_adb_poll();
138
139 if (udbg_adb_old_getc_poll)
140 return udbg_adb_old_getc_poll();
141 return -1;
142}
143
144static void udbg_adb_putc(char c)
145{
146#ifdef CONFIG_BOOTX_TEXT
147 if (udbg_adb_use_btext)
148 btext_drawchar(c);
149#endif
150 if (udbg_adb_old_putc)
151 return udbg_adb_old_putc(c);
152}
153
154void udbg_adb_init_early(void)
155{
156#ifdef CONFIG_BOOTX_TEXT
157 if (btext_find_display(1) == 0) {
158 udbg_adb_use_btext = 1;
159 udbg_putc = udbg_adb_putc;
160 }
161#endif
162}
163
164int udbg_adb_init(int force_btext)
165{
166 struct device_node *np;
167
168 /* Capture existing callbacks */
169 udbg_adb_old_putc = udbg_putc;
170 udbg_adb_old_getc = udbg_getc;
171 udbg_adb_old_getc_poll = udbg_getc_poll;
172
173 /* Check if our early init was already called */
174 if (udbg_adb_old_putc == udbg_adb_putc)
175 udbg_adb_old_putc = NULL;
176#ifdef CONFIG_BOOTX_TEXT
177 if (udbg_adb_old_putc == btext_drawchar)
178 udbg_adb_old_putc = NULL;
179#endif
180
181 /* Set ours as output */
182 udbg_putc = udbg_adb_putc;
183 udbg_getc = udbg_adb_getc;
184 udbg_getc_poll = udbg_adb_getc_poll;
185
186#ifdef CONFIG_BOOTX_TEXT
187 /* Check if we should use btext output */
188 if (btext_find_display(force_btext) == 0)
189 udbg_adb_use_btext = 1;
190#endif
191
192 /* See if there is a keyboard in the device tree with a parent
193 * of type "adb". If not, we return a failure, but we keep the
194 * bext output set for now
195 */
196 for (np = NULL; (np = of_find_node_by_name(np, "keyboard")) != NULL;) {
197 struct device_node *parent = of_get_parent(np);
198 int found = (parent && strcmp(parent->type, "adb") == 0);
199 of_node_put(parent);
200 if (found)
201 break;
202 }
203 if (np == NULL)
204 return -ENODEV;
205 of_node_put(np);
206
207#ifdef CONFIG_ADB_PMU
208 if (find_via_pmu())
209 input_type = input_adb_pmu;
210#endif
211#ifdef CONFIG_ADB_CUDA
212 if (find_via_cuda())
213 input_type = input_adb_cuda;
214#endif
215
216 /* Same as above: nothing found, keep btext set for output */
217 if (input_type == input_adb_none)
218 return -ENODEV;
219
220 return 0;
221}
diff --git a/arch/powerpc/kernel/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c
index 820c53551507..c4352a8db644 100644
--- a/arch/powerpc/kernel/udbg_scc.c
+++ b/arch/powerpc/platforms/powermac/udbg_scc.c
@@ -25,7 +25,7 @@ extern void real_writeb(u8 data, volatile u8 __iomem *addr);
25static volatile u8 __iomem *sccc; 25static volatile u8 __iomem *sccc;
26static volatile u8 __iomem *sccd; 26static volatile u8 __iomem *sccd;
27 27
28static void udbg_scc_putc(unsigned char c) 28static void udbg_scc_putc(char c)
29{ 29{
30 if (sccc) { 30 if (sccc) {
31 while ((in_8(sccc) & SCC_TXRDY) == 0) 31 while ((in_8(sccc) & SCC_TXRDY) == 0)
@@ -47,14 +47,14 @@ static int udbg_scc_getc_poll(void)
47 return -1; 47 return -1;
48} 48}
49 49
50static unsigned char udbg_scc_getc(void) 50static int udbg_scc_getc(void)
51{ 51{
52 if (sccc) { 52 if (sccc) {
53 while ((in_8(sccc) & SCC_RXRDY) == 0) 53 while ((in_8(sccc) & SCC_RXRDY) == 0)
54 ; 54 ;
55 return in_8(sccd); 55 return in_8(sccd);
56 } 56 }
57 return 0; 57 return -1;
58} 58}
59 59
60static unsigned char scc_inittab[] = { 60static unsigned char scc_inittab[] = {
@@ -67,38 +67,59 @@ static unsigned char scc_inittab[] = {
67 3, 0xc1, /* rx enable, 8 bits */ 67 3, 0xc1, /* rx enable, 8 bits */
68}; 68};
69 69
70void udbg_init_scc(struct device_node *np) 70void udbg_scc_init(int force_scc)
71{ 71{
72 u32 *reg; 72 u32 *reg;
73 unsigned long addr; 73 unsigned long addr;
74 struct device_node *stdout = NULL, *escc = NULL, *macio = NULL;
75 struct device_node *ch, *ch_def = NULL, *ch_a = NULL;
76 char *path;
74 int i, x; 77 int i, x;
75 78
76 if (np == NULL) 79 escc = of_find_node_by_name(NULL, "escc");
77 np = of_find_node_by_name(NULL, "escc"); 80 if (escc == NULL)
78 if (np == NULL || np->parent == NULL) 81 goto bail;
79 return; 82 macio = of_get_parent(escc);
83 if (macio == NULL)
84 goto bail;
85 path = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
86 if (path != NULL)
87 stdout = of_find_node_by_path(path);
88 for (ch = NULL; (ch = of_get_next_child(escc, ch)) != NULL;) {
89 if (ch == stdout)
90 ch_def = of_node_get(ch);
91 if (strcmp(ch->name, "ch-a") == 0)
92 ch_a = of_node_get(ch);
93 }
94 if (ch_def == NULL && !force_scc)
95 goto bail;
96
97 ch = ch_def ? ch_def : ch_a;
80 98
81 udbg_printf("found SCC...\n");
82 /* Get address within mac-io ASIC */ 99 /* Get address within mac-io ASIC */
83 reg = (u32 *)get_property(np, "reg", NULL); 100 reg = (u32 *)get_property(escc, "reg", NULL);
84 if (reg == NULL) 101 if (reg == NULL)
85 return; 102 goto bail;
86 addr = reg[0]; 103 addr = reg[0];
87 udbg_printf("local addr: %lx\n", addr); 104
88 /* Get address of mac-io PCI itself */ 105 /* Get address of mac-io PCI itself */
89 reg = (u32 *)get_property(np->parent, "assigned-addresses", NULL); 106 reg = (u32 *)get_property(macio, "assigned-addresses", NULL);
90 if (reg == NULL) 107 if (reg == NULL)
91 return; 108 goto bail;
92 addr += reg[2]; 109 addr += reg[2];
93 udbg_printf("final addr: %lx\n", addr); 110
111 /* Lock the serial port */
112 pmac_call_feature(PMAC_FTR_SCC_ENABLE, ch,
113 PMAC_SCC_ASYNC | PMAC_SCC_FLAG_XMON, 1);
114
94 115
95 /* Setup for 57600 8N1 */ 116 /* Setup for 57600 8N1 */
96 addr += 0x20; 117 if (ch == ch_a)
118 addr += 0x20;
97 sccc = (volatile u8 * __iomem) ioremap(addr & PAGE_MASK, PAGE_SIZE) ; 119 sccc = (volatile u8 * __iomem) ioremap(addr & PAGE_MASK, PAGE_SIZE) ;
98 sccc += addr & ~PAGE_MASK; 120 sccc += addr & ~PAGE_MASK;
99 sccd = sccc + 0x10; 121 sccd = sccc + 0x10;
100 122
101 udbg_printf("ioremap result sccc: %p\n", sccc);
102 mb(); 123 mb();
103 124
104 for (i = 20000; i != 0; --i) 125 for (i = 20000; i != 0; --i)
@@ -113,9 +134,17 @@ void udbg_init_scc(struct device_node *np)
113 udbg_getc_poll = udbg_scc_getc_poll; 134 udbg_getc_poll = udbg_scc_getc_poll;
114 135
115 udbg_puts("Hello World !\n"); 136 udbg_puts("Hello World !\n");
137
138 bail:
139 of_node_put(macio);
140 of_node_put(escc);
141 of_node_put(stdout);
142 of_node_put(ch_def);
143 of_node_put(ch_a);
116} 144}
117 145
118static void udbg_real_scc_putc(unsigned char c) 146#ifdef CONFIG_PPC64
147static void udbg_real_scc_putc(char c)
119{ 148{
120 while ((real_readb(sccc) & SCC_TXRDY) == 0) 149 while ((real_readb(sccc) & SCC_TXRDY) == 0)
121 ; 150 ;
@@ -124,7 +153,7 @@ static void udbg_real_scc_putc(unsigned char c)
124 udbg_real_scc_putc('\r'); 153 udbg_real_scc_putc('\r');
125} 154}
126 155
127void udbg_init_pmac_realmode(void) 156void __init udbg_init_pmac_realmode(void)
128{ 157{
129 sccc = (volatile u8 __iomem *)0x80013020ul; 158 sccc = (volatile u8 __iomem *)0x80013020ul;
130 sccd = (volatile u8 __iomem *)0x80013030ul; 159 sccd = (volatile u8 __iomem *)0x80013030ul;
@@ -133,3 +162,4 @@ void udbg_init_pmac_realmode(void)
133 udbg_getc = NULL; 162 udbg_getc = NULL;
134 udbg_getc_poll = NULL; 163 udbg_getc_poll = NULL;
135} 164}
165#endif /* CONFIG_PPC64 */
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 06d5ef501218..61616d144072 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -1,10 +1,10 @@
1obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \ 1obj-y := pci.o lpar.o hvCall.o nvram.o reconfig.o \
2 setup.o iommu.o ras.o rtasd.o 2 setup.o iommu.o ras.o rtasd.o pci_dlpar.o
3obj-$(CONFIG_SMP) += smp.o 3obj-$(CONFIG_SMP) += smp.o
4obj-$(CONFIG_IBMVIO) += vio.o 4obj-$(CONFIG_IBMVIO) += vio.o
5obj-$(CONFIG_XICS) += xics.o 5obj-$(CONFIG_XICS) += xics.o
6obj-$(CONFIG_SCANLOG) += scanlog.o 6obj-$(CONFIG_SCANLOG) += scanlog.o
7obj-$(CONFIG_EEH) += eeh.o eeh_event.o 7obj-$(CONFIG_EEH) += eeh.o eeh_cache.o eeh_driver.o eeh_event.o
8 8
9obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o 9obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o
10obj-$(CONFIG_HVCS) += hvcserver.o 10obj-$(CONFIG_HVCS) += hvcserver.o
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index c8d2a40dc5b4..83578313ee7e 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -76,15 +76,14 @@
76 */ 76 */
77#define EEH_MAX_FAILS 100000 77#define EEH_MAX_FAILS 100000
78 78
79/* Misc forward declaraions */
80static void eeh_save_bars(struct pci_dev * pdev, struct pci_dn *pdn);
81
82/* RTAS tokens */ 79/* RTAS tokens */
83static int ibm_set_eeh_option; 80static int ibm_set_eeh_option;
84static int ibm_set_slot_reset; 81static int ibm_set_slot_reset;
85static int ibm_read_slot_reset_state; 82static int ibm_read_slot_reset_state;
86static int ibm_read_slot_reset_state2; 83static int ibm_read_slot_reset_state2;
87static int ibm_slot_error_detail; 84static int ibm_slot_error_detail;
85static int ibm_get_config_addr_info;
86static int ibm_configure_bridge;
88 87
89int eeh_subsystem_enabled; 88int eeh_subsystem_enabled;
90EXPORT_SYMBOL(eeh_subsystem_enabled); 89EXPORT_SYMBOL(eeh_subsystem_enabled);
@@ -98,308 +97,23 @@ static DEFINE_SPINLOCK(slot_errbuf_lock);
98static int eeh_error_buf_size; 97static int eeh_error_buf_size;
99 98
100/* System monitoring statistics */ 99/* System monitoring statistics */
101static DEFINE_PER_CPU(unsigned long, no_device); 100static unsigned long no_device;
102static DEFINE_PER_CPU(unsigned long, no_dn); 101static unsigned long no_dn;
103static DEFINE_PER_CPU(unsigned long, no_cfg_addr); 102static unsigned long no_cfg_addr;
104static DEFINE_PER_CPU(unsigned long, ignored_check); 103static unsigned long ignored_check;
105static DEFINE_PER_CPU(unsigned long, total_mmio_ffs); 104static unsigned long total_mmio_ffs;
106static DEFINE_PER_CPU(unsigned long, false_positives); 105static unsigned long false_positives;
107static DEFINE_PER_CPU(unsigned long, ignored_failures); 106static unsigned long ignored_failures;
108static DEFINE_PER_CPU(unsigned long, slot_resets); 107static unsigned long slot_resets;
109
110/**
111 * The pci address cache subsystem. This subsystem places
112 * PCI device address resources into a red-black tree, sorted
113 * according to the address range, so that given only an i/o
114 * address, the corresponding PCI device can be **quickly**
115 * found. It is safe to perform an address lookup in an interrupt
116 * context; this ability is an important feature.
117 *
118 * Currently, the only customer of this code is the EEH subsystem;
119 * thus, this code has been somewhat tailored to suit EEH better.
120 * In particular, the cache does *not* hold the addresses of devices
121 * for which EEH is not enabled.
122 *
123 * (Implementation Note: The RB tree seems to be better/faster
124 * than any hash algo I could think of for this problem, even
125 * with the penalty of slow pointer chases for d-cache misses).
126 */
127struct pci_io_addr_range
128{
129 struct rb_node rb_node;
130 unsigned long addr_lo;
131 unsigned long addr_hi;
132 struct pci_dev *pcidev;
133 unsigned int flags;
134};
135
136static struct pci_io_addr_cache
137{
138 struct rb_root rb_root;
139 spinlock_t piar_lock;
140} pci_io_addr_cache_root;
141
142static inline struct pci_dev *__pci_get_device_by_addr(unsigned long addr)
143{
144 struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node;
145
146 while (n) {
147 struct pci_io_addr_range *piar;
148 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
149
150 if (addr < piar->addr_lo) {
151 n = n->rb_left;
152 } else {
153 if (addr > piar->addr_hi) {
154 n = n->rb_right;
155 } else {
156 pci_dev_get(piar->pcidev);
157 return piar->pcidev;
158 }
159 }
160 }
161
162 return NULL;
163}
164
165/**
166 * pci_get_device_by_addr - Get device, given only address
167 * @addr: mmio (PIO) phys address or i/o port number
168 *
169 * Given an mmio phys address, or a port number, find a pci device
170 * that implements this address. Be sure to pci_dev_put the device
171 * when finished. I/O port numbers are assumed to be offset
172 * from zero (that is, they do *not* have pci_io_addr added in).
173 * It is safe to call this function within an interrupt.
174 */
175static struct pci_dev *pci_get_device_by_addr(unsigned long addr)
176{
177 struct pci_dev *dev;
178 unsigned long flags;
179
180 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
181 dev = __pci_get_device_by_addr(addr);
182 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
183 return dev;
184}
185
186#ifdef DEBUG
187/*
188 * Handy-dandy debug print routine, does nothing more
189 * than print out the contents of our addr cache.
190 */
191static void pci_addr_cache_print(struct pci_io_addr_cache *cache)
192{
193 struct rb_node *n;
194 int cnt = 0;
195
196 n = rb_first(&cache->rb_root);
197 while (n) {
198 struct pci_io_addr_range *piar;
199 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
200 printk(KERN_DEBUG "PCI: %s addr range %d [%lx-%lx]: %s\n",
201 (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt,
202 piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev));
203 cnt++;
204 n = rb_next(n);
205 }
206}
207#endif
208
209/* Insert address range into the rb tree. */
210static struct pci_io_addr_range *
211pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
212 unsigned long ahi, unsigned int flags)
213{
214 struct rb_node **p = &pci_io_addr_cache_root.rb_root.rb_node;
215 struct rb_node *parent = NULL;
216 struct pci_io_addr_range *piar;
217
218 /* Walk tree, find a place to insert into tree */
219 while (*p) {
220 parent = *p;
221 piar = rb_entry(parent, struct pci_io_addr_range, rb_node);
222 if (ahi < piar->addr_lo) {
223 p = &parent->rb_left;
224 } else if (alo > piar->addr_hi) {
225 p = &parent->rb_right;
226 } else {
227 if (dev != piar->pcidev ||
228 alo != piar->addr_lo || ahi != piar->addr_hi) {
229 printk(KERN_WARNING "PIAR: overlapping address range\n");
230 }
231 return piar;
232 }
233 }
234 piar = (struct pci_io_addr_range *)kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC);
235 if (!piar)
236 return NULL;
237
238 piar->addr_lo = alo;
239 piar->addr_hi = ahi;
240 piar->pcidev = dev;
241 piar->flags = flags;
242
243#ifdef DEBUG
244 printk(KERN_DEBUG "PIAR: insert range=[%lx:%lx] dev=%s\n",
245 alo, ahi, pci_name (dev));
246#endif
247 108
248 rb_link_node(&piar->rb_node, parent, p); 109#define IS_BRIDGE(class_code) (((class_code)<<16) == PCI_BASE_CLASS_BRIDGE)
249 rb_insert_color(&piar->rb_node, &pci_io_addr_cache_root.rb_root);
250
251 return piar;
252}
253
254static void __pci_addr_cache_insert_device(struct pci_dev *dev)
255{
256 struct device_node *dn;
257 struct pci_dn *pdn;
258 int i;
259 int inserted = 0;
260
261 dn = pci_device_to_OF_node(dev);
262 if (!dn) {
263 printk(KERN_WARNING "PCI: no pci dn found for dev=%s\n", pci_name(dev));
264 return;
265 }
266
267 /* Skip any devices for which EEH is not enabled. */
268 pdn = PCI_DN(dn);
269 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) ||
270 pdn->eeh_mode & EEH_MODE_NOCHECK) {
271#ifdef DEBUG
272 printk(KERN_INFO "PCI: skip building address cache for=%s - %s\n",
273 pci_name(dev), pdn->node->full_name);
274#endif
275 return;
276 }
277
278 /* The cache holds a reference to the device... */
279 pci_dev_get(dev);
280
281 /* Walk resources on this device, poke them into the tree */
282 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
283 unsigned long start = pci_resource_start(dev,i);
284 unsigned long end = pci_resource_end(dev,i);
285 unsigned int flags = pci_resource_flags(dev,i);
286
287 /* We are interested only bus addresses, not dma or other stuff */
288 if (0 == (flags & (IORESOURCE_IO | IORESOURCE_MEM)))
289 continue;
290 if (start == 0 || ~start == 0 || end == 0 || ~end == 0)
291 continue;
292 pci_addr_cache_insert(dev, start, end, flags);
293 inserted = 1;
294 }
295
296 /* If there was nothing to add, the cache has no reference... */
297 if (!inserted)
298 pci_dev_put(dev);
299}
300
301/**
302 * pci_addr_cache_insert_device - Add a device to the address cache
303 * @dev: PCI device whose I/O addresses we are interested in.
304 *
305 * In order to support the fast lookup of devices based on addresses,
306 * we maintain a cache of devices that can be quickly searched.
307 * This routine adds a device to that cache.
308 */
309static void pci_addr_cache_insert_device(struct pci_dev *dev)
310{
311 unsigned long flags;
312
313 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
314 __pci_addr_cache_insert_device(dev);
315 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
316}
317
318static inline void __pci_addr_cache_remove_device(struct pci_dev *dev)
319{
320 struct rb_node *n;
321 int removed = 0;
322
323restart:
324 n = rb_first(&pci_io_addr_cache_root.rb_root);
325 while (n) {
326 struct pci_io_addr_range *piar;
327 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
328
329 if (piar->pcidev == dev) {
330 rb_erase(n, &pci_io_addr_cache_root.rb_root);
331 removed = 1;
332 kfree(piar);
333 goto restart;
334 }
335 n = rb_next(n);
336 }
337
338 /* The cache no longer holds its reference to this device... */
339 if (removed)
340 pci_dev_put(dev);
341}
342
343/**
344 * pci_addr_cache_remove_device - remove pci device from addr cache
345 * @dev: device to remove
346 *
347 * Remove a device from the addr-cache tree.
348 * This is potentially expensive, since it will walk
349 * the tree multiple times (once per resource).
350 * But so what; device removal doesn't need to be that fast.
351 */
352static void pci_addr_cache_remove_device(struct pci_dev *dev)
353{
354 unsigned long flags;
355
356 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
357 __pci_addr_cache_remove_device(dev);
358 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
359}
360
361/**
362 * pci_addr_cache_build - Build a cache of I/O addresses
363 *
364 * Build a cache of pci i/o addresses. This cache will be used to
365 * find the pci device that corresponds to a given address.
366 * This routine scans all pci busses to build the cache.
367 * Must be run late in boot process, after the pci controllers
368 * have been scaned for devices (after all device resources are known).
369 */
370void __init pci_addr_cache_build(void)
371{
372 struct device_node *dn;
373 struct pci_dev *dev = NULL;
374
375 if (!eeh_subsystem_enabled)
376 return;
377
378 spin_lock_init(&pci_io_addr_cache_root.piar_lock);
379
380 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
381 /* Ignore PCI bridges ( XXX why ??) */
382 if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE) {
383 continue;
384 }
385 pci_addr_cache_insert_device(dev);
386
387 /* Save the BAR's; firmware doesn't restore these after EEH reset */
388 dn = pci_device_to_OF_node(dev);
389 eeh_save_bars(dev, PCI_DN(dn));
390 }
391
392#ifdef DEBUG
393 /* Verify tree built up above, echo back the list of addrs. */
394 pci_addr_cache_print(&pci_io_addr_cache_root);
395#endif
396}
397 110
398/* --------------------------------------------------------------- */ 111/* --------------------------------------------------------------- */
399/* Above lies the PCI Address Cache. Below lies the EEH event infrastructure */ 112/* Below lies the EEH event infrastructure */
400 113
401void eeh_slot_error_detail (struct pci_dn *pdn, int severity) 114void eeh_slot_error_detail (struct pci_dn *pdn, int severity)
402{ 115{
116 int config_addr;
403 unsigned long flags; 117 unsigned long flags;
404 int rc; 118 int rc;
405 119
@@ -407,8 +121,13 @@ void eeh_slot_error_detail (struct pci_dn *pdn, int severity)
407 spin_lock_irqsave(&slot_errbuf_lock, flags); 121 spin_lock_irqsave(&slot_errbuf_lock, flags);
408 memset(slot_errbuf, 0, eeh_error_buf_size); 122 memset(slot_errbuf, 0, eeh_error_buf_size);
409 123
124 /* Use PE configuration address, if present */
125 config_addr = pdn->eeh_config_addr;
126 if (pdn->eeh_pe_config_addr)
127 config_addr = pdn->eeh_pe_config_addr;
128
410 rc = rtas_call(ibm_slot_error_detail, 129 rc = rtas_call(ibm_slot_error_detail,
411 8, 1, NULL, pdn->eeh_config_addr, 130 8, 1, NULL, config_addr,
412 BUID_HI(pdn->phb->buid), 131 BUID_HI(pdn->phb->buid),
413 BUID_LO(pdn->phb->buid), NULL, 0, 132 BUID_LO(pdn->phb->buid), NULL, 0,
414 virt_to_phys(slot_errbuf), 133 virt_to_phys(slot_errbuf),
@@ -428,6 +147,7 @@ void eeh_slot_error_detail (struct pci_dn *pdn, int severity)
428static int read_slot_reset_state(struct pci_dn *pdn, int rets[]) 147static int read_slot_reset_state(struct pci_dn *pdn, int rets[])
429{ 148{
430 int token, outputs; 149 int token, outputs;
150 int config_addr;
431 151
432 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) { 152 if (ibm_read_slot_reset_state2 != RTAS_UNKNOWN_SERVICE) {
433 token = ibm_read_slot_reset_state2; 153 token = ibm_read_slot_reset_state2;
@@ -438,7 +158,12 @@ static int read_slot_reset_state(struct pci_dn *pdn, int rets[])
438 outputs = 3; 158 outputs = 3;
439 } 159 }
440 160
441 return rtas_call(token, 3, outputs, rets, pdn->eeh_config_addr, 161 /* Use PE configuration address, if present */
162 config_addr = pdn->eeh_config_addr;
163 if (pdn->eeh_pe_config_addr)
164 config_addr = pdn->eeh_pe_config_addr;
165
166 return rtas_call(token, 3, outputs, rets, config_addr,
442 BUID_HI(pdn->phb->buid), BUID_LO(pdn->phb->buid)); 167 BUID_HI(pdn->phb->buid), BUID_LO(pdn->phb->buid));
443} 168}
444 169
@@ -462,7 +187,7 @@ static inline unsigned long eeh_token_to_phys(unsigned long token)
462/** 187/**
463 * Return the "partitionable endpoint" (pe) under which this device lies 188 * Return the "partitionable endpoint" (pe) under which this device lies
464 */ 189 */
465static struct device_node * find_device_pe(struct device_node *dn) 190struct device_node * find_device_pe(struct device_node *dn)
466{ 191{
467 while ((dn->parent) && PCI_DN(dn->parent) && 192 while ((dn->parent) && PCI_DN(dn->parent) &&
468 (PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) { 193 (PCI_DN(dn->parent)->eeh_mode & EEH_MODE_SUPPORTED)) {
@@ -483,8 +208,14 @@ static void __eeh_mark_slot (struct device_node *dn, int mode_flag)
483{ 208{
484 while (dn) { 209 while (dn) {
485 if (PCI_DN(dn)) { 210 if (PCI_DN(dn)) {
211 /* Mark the pci device driver too */
212 struct pci_dev *dev = PCI_DN(dn)->pcidev;
213
486 PCI_DN(dn)->eeh_mode |= mode_flag; 214 PCI_DN(dn)->eeh_mode |= mode_flag;
487 215
216 if (dev && dev->driver)
217 dev->error_state = pci_channel_io_frozen;
218
488 if (dn->child) 219 if (dn->child)
489 __eeh_mark_slot (dn->child, mode_flag); 220 __eeh_mark_slot (dn->child, mode_flag);
490 } 221 }
@@ -495,6 +226,11 @@ static void __eeh_mark_slot (struct device_node *dn, int mode_flag)
495void eeh_mark_slot (struct device_node *dn, int mode_flag) 226void eeh_mark_slot (struct device_node *dn, int mode_flag)
496{ 227{
497 dn = find_device_pe (dn); 228 dn = find_device_pe (dn);
229
230 /* Back up one, since config addrs might be shared */
231 if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr)
232 dn = dn->parent;
233
498 PCI_DN(dn)->eeh_mode |= mode_flag; 234 PCI_DN(dn)->eeh_mode |= mode_flag;
499 __eeh_mark_slot (dn->child, mode_flag); 235 __eeh_mark_slot (dn->child, mode_flag);
500} 236}
@@ -516,7 +252,13 @@ void eeh_clear_slot (struct device_node *dn, int mode_flag)
516{ 252{
517 unsigned long flags; 253 unsigned long flags;
518 spin_lock_irqsave(&confirm_error_lock, flags); 254 spin_lock_irqsave(&confirm_error_lock, flags);
255
519 dn = find_device_pe (dn); 256 dn = find_device_pe (dn);
257
258 /* Back up one, since config addrs might be shared */
259 if (PCI_DN(dn) && PCI_DN(dn)->eeh_pe_config_addr)
260 dn = dn->parent;
261
520 PCI_DN(dn)->eeh_mode &= ~mode_flag; 262 PCI_DN(dn)->eeh_mode &= ~mode_flag;
521 PCI_DN(dn)->eeh_check_count = 0; 263 PCI_DN(dn)->eeh_check_count = 0;
522 __eeh_clear_slot (dn->child, mode_flag); 264 __eeh_clear_slot (dn->child, mode_flag);
@@ -544,15 +286,16 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
544 int rets[3]; 286 int rets[3];
545 unsigned long flags; 287 unsigned long flags;
546 struct pci_dn *pdn; 288 struct pci_dn *pdn;
289 enum pci_channel_state state;
547 int rc = 0; 290 int rc = 0;
548 291
549 __get_cpu_var(total_mmio_ffs)++; 292 total_mmio_ffs++;
550 293
551 if (!eeh_subsystem_enabled) 294 if (!eeh_subsystem_enabled)
552 return 0; 295 return 0;
553 296
554 if (!dn) { 297 if (!dn) {
555 __get_cpu_var(no_dn)++; 298 no_dn++;
556 return 0; 299 return 0;
557 } 300 }
558 pdn = PCI_DN(dn); 301 pdn = PCI_DN(dn);
@@ -560,7 +303,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
560 /* Access to IO BARs might get this far and still not want checking. */ 303 /* Access to IO BARs might get this far and still not want checking. */
561 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) || 304 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) ||
562 pdn->eeh_mode & EEH_MODE_NOCHECK) { 305 pdn->eeh_mode & EEH_MODE_NOCHECK) {
563 __get_cpu_var(ignored_check)++; 306 ignored_check++;
564#ifdef DEBUG 307#ifdef DEBUG
565 printk ("EEH:ignored check (%x) for %s %s\n", 308 printk ("EEH:ignored check (%x) for %s %s\n",
566 pdn->eeh_mode, pci_name (dev), dn->full_name); 309 pdn->eeh_mode, pci_name (dev), dn->full_name);
@@ -568,8 +311,8 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
568 return 0; 311 return 0;
569 } 312 }
570 313
571 if (!pdn->eeh_config_addr) { 314 if (!pdn->eeh_config_addr && !pdn->eeh_pe_config_addr) {
572 __get_cpu_var(no_cfg_addr)++; 315 no_cfg_addr++;
573 return 0; 316 return 0;
574 } 317 }
575 318
@@ -611,7 +354,7 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
611 if (ret != 0) { 354 if (ret != 0) {
612 printk(KERN_WARNING "EEH: read_slot_reset_state() failed; rc=%d dn=%s\n", 355 printk(KERN_WARNING "EEH: read_slot_reset_state() failed; rc=%d dn=%s\n",
613 ret, dn->full_name); 356 ret, dn->full_name);
614 __get_cpu_var(false_positives)++; 357 false_positives++;
615 rc = 0; 358 rc = 0;
616 goto dn_unlock; 359 goto dn_unlock;
617 } 360 }
@@ -620,14 +363,14 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
620 if (rets[1] != 1) { 363 if (rets[1] != 1) {
621 printk(KERN_WARNING "EEH: event on unsupported device, rc=%d dn=%s\n", 364 printk(KERN_WARNING "EEH: event on unsupported device, rc=%d dn=%s\n",
622 ret, dn->full_name); 365 ret, dn->full_name);
623 __get_cpu_var(false_positives)++; 366 false_positives++;
624 rc = 0; 367 rc = 0;
625 goto dn_unlock; 368 goto dn_unlock;
626 } 369 }
627 370
628 /* If not the kind of error we know about, punt. */ 371 /* If not the kind of error we know about, punt. */
629 if (rets[0] != 2 && rets[0] != 4 && rets[0] != 5) { 372 if (rets[0] != 2 && rets[0] != 4 && rets[0] != 5) {
630 __get_cpu_var(false_positives)++; 373 false_positives++;
631 rc = 0; 374 rc = 0;
632 goto dn_unlock; 375 goto dn_unlock;
633 } 376 }
@@ -635,12 +378,12 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
635 /* Note that config-io to empty slots may fail; 378 /* Note that config-io to empty slots may fail;
636 * we recognize empty because they don't have children. */ 379 * we recognize empty because they don't have children. */
637 if ((rets[0] == 5) && (dn->child == NULL)) { 380 if ((rets[0] == 5) && (dn->child == NULL)) {
638 __get_cpu_var(false_positives)++; 381 false_positives++;
639 rc = 0; 382 rc = 0;
640 goto dn_unlock; 383 goto dn_unlock;
641 } 384 }
642 385
643 __get_cpu_var(slot_resets)++; 386 slot_resets++;
644 387
645 /* Avoid repeated reports of this failure, including problems 388 /* Avoid repeated reports of this failure, including problems
646 * with other functions on this device, and functions under 389 * with other functions on this device, and functions under
@@ -648,8 +391,13 @@ int eeh_dn_check_failure(struct device_node *dn, struct pci_dev *dev)
648 eeh_mark_slot (dn, EEH_MODE_ISOLATED); 391 eeh_mark_slot (dn, EEH_MODE_ISOLATED);
649 spin_unlock_irqrestore(&confirm_error_lock, flags); 392 spin_unlock_irqrestore(&confirm_error_lock, flags);
650 393
651 eeh_send_failure_event (dn, dev, rets[0], rets[2]); 394 state = pci_channel_io_normal;
652 395 if ((rets[0] == 2) || (rets[0] == 4))
396 state = pci_channel_io_frozen;
397 if (rets[0] == 5)
398 state = pci_channel_io_perm_failure;
399 eeh_send_failure_event (dn, dev, state, rets[2]);
400
653 /* Most EEH events are due to device driver bugs. Having 401 /* Most EEH events are due to device driver bugs. Having
654 * a stack trace will help the device-driver authors figure 402 * a stack trace will help the device-driver authors figure
655 * out what happened. So print that out. */ 403 * out what happened. So print that out. */
@@ -685,7 +433,7 @@ unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned lon
685 addr = eeh_token_to_phys((unsigned long __force) token); 433 addr = eeh_token_to_phys((unsigned long __force) token);
686 dev = pci_get_device_by_addr(addr); 434 dev = pci_get_device_by_addr(addr);
687 if (!dev) { 435 if (!dev) {
688 __get_cpu_var(no_device)++; 436 no_device++;
689 return val; 437 return val;
690 } 438 }
691 439
@@ -716,11 +464,16 @@ eeh_slot_availability(struct pci_dn *pdn)
716 if (rc) return rc; 464 if (rc) return rc;
717 465
718 if (rets[1] == 0) return -1; /* EEH is not supported */ 466 if (rets[1] == 0) return -1; /* EEH is not supported */
719 if (rets[0] == 0) return 0; /* Oll Korrect */ 467 if (rets[0] == 0) return 0; /* Oll Korrect */
720 if (rets[0] == 5) { 468 if (rets[0] == 5) {
721 if (rets[2] == 0) return -1; /* permanently unavailable */ 469 if (rets[2] == 0) return -1; /* permanently unavailable */
722 return rets[2]; /* number of millisecs to wait */ 470 return rets[2]; /* number of millisecs to wait */
723 } 471 }
472 if (rets[0] == 1)
473 return 250;
474
475 printk (KERN_ERR "EEH: Slot unavailable: rc=%d, rets=%d %d %d\n",
476 rc, rets[0], rets[1], rets[2]);
724 return -1; 477 return -1;
725} 478}
726 479
@@ -737,6 +490,7 @@ eeh_slot_availability(struct pci_dn *pdn)
737static void 490static void
738rtas_pci_slot_reset(struct pci_dn *pdn, int state) 491rtas_pci_slot_reset(struct pci_dn *pdn, int state)
739{ 492{
493 int config_addr;
740 int rc; 494 int rc;
741 495
742 BUG_ON (pdn==NULL); 496 BUG_ON (pdn==NULL);
@@ -747,8 +501,13 @@ rtas_pci_slot_reset(struct pci_dn *pdn, int state)
747 return; 501 return;
748 } 502 }
749 503
504 /* Use PE configuration address, if present */
505 config_addr = pdn->eeh_config_addr;
506 if (pdn->eeh_pe_config_addr)
507 config_addr = pdn->eeh_pe_config_addr;
508
750 rc = rtas_call(ibm_set_slot_reset,4,1, NULL, 509 rc = rtas_call(ibm_set_slot_reset,4,1, NULL,
751 pdn->eeh_config_addr, 510 config_addr,
752 BUID_HI(pdn->phb->buid), 511 BUID_HI(pdn->phb->buid),
753 BUID_LO(pdn->phb->buid), 512 BUID_LO(pdn->phb->buid),
754 state); 513 state);
@@ -761,9 +520,11 @@ rtas_pci_slot_reset(struct pci_dn *pdn, int state)
761 520
762/** rtas_set_slot_reset -- assert the pci #RST line for 1/4 second 521/** rtas_set_slot_reset -- assert the pci #RST line for 1/4 second
763 * dn -- device node to be reset. 522 * dn -- device node to be reset.
523 *
524 * Return 0 if success, else a non-zero value.
764 */ 525 */
765 526
766void 527int
767rtas_set_slot_reset(struct pci_dn *pdn) 528rtas_set_slot_reset(struct pci_dn *pdn)
768{ 529{
769 int i, rc; 530 int i, rc;
@@ -793,10 +554,21 @@ rtas_set_slot_reset(struct pci_dn *pdn)
793 * ready to be used; if not, wait for recovery. */ 554 * ready to be used; if not, wait for recovery. */
794 for (i=0; i<10; i++) { 555 for (i=0; i<10; i++) {
795 rc = eeh_slot_availability (pdn); 556 rc = eeh_slot_availability (pdn);
796 if (rc <= 0) break; 557 if (rc < 0)
558 printk (KERN_ERR "EEH: failed (%d) to reset slot %s\n", rc, pdn->node->full_name);
559 if (rc == 0)
560 return 0;
561 if (rc < 0)
562 return -1;
797 563
798 msleep (rc+100); 564 msleep (rc+100);
799 } 565 }
566
567 rc = eeh_slot_availability (pdn);
568 if (rc)
569 printk (KERN_ERR "EEH: timeout resetting slot %s\n", pdn->node->full_name);
570
571 return rc;
800} 572}
801 573
802/* ------------------------------------------------------- */ 574/* ------------------------------------------------------- */
@@ -851,7 +623,7 @@ void eeh_restore_bars(struct pci_dn *pdn)
851 if (!pdn) 623 if (!pdn)
852 return; 624 return;
853 625
854 if (! pdn->eeh_is_bridge) 626 if ((pdn->eeh_mode & EEH_MODE_SUPPORTED) && !IS_BRIDGE(pdn->class_code))
855 __restore_bars (pdn); 627 __restore_bars (pdn);
856 628
857 dn = pdn->node->child; 629 dn = pdn->node->child;
@@ -869,30 +641,30 @@ void eeh_restore_bars(struct pci_dn *pdn)
869 * PCI devices are added individuallly; but, for the restore, 641 * PCI devices are added individuallly; but, for the restore,
870 * an entire slot is reset at a time. 642 * an entire slot is reset at a time.
871 */ 643 */
872static void eeh_save_bars(struct pci_dev * pdev, struct pci_dn *pdn) 644static void eeh_save_bars(struct pci_dn *pdn)
873{ 645{
874 int i; 646 int i;
875 647
876 if (!pdev || !pdn ) 648 if (!pdn )
877 return; 649 return;
878 650
879 for (i = 0; i < 16; i++) 651 for (i = 0; i < 16; i++)
880 pci_read_config_dword(pdev, i * 4, &pdn->config_space[i]); 652 rtas_read_config(pdn, i * 4, 4, &pdn->config_space[i]);
881
882 if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE)
883 pdn->eeh_is_bridge = 1;
884} 653}
885 654
886void 655void
887rtas_configure_bridge(struct pci_dn *pdn) 656rtas_configure_bridge(struct pci_dn *pdn)
888{ 657{
889 int token = rtas_token ("ibm,configure-bridge"); 658 int config_addr;
890 int rc; 659 int rc;
891 660
892 if (token == RTAS_UNKNOWN_SERVICE) 661 /* Use PE configuration address, if present */
893 return; 662 config_addr = pdn->eeh_config_addr;
894 rc = rtas_call(token,3,1, NULL, 663 if (pdn->eeh_pe_config_addr)
895 pdn->eeh_config_addr, 664 config_addr = pdn->eeh_pe_config_addr;
665
666 rc = rtas_call(ibm_configure_bridge,3,1, NULL,
667 config_addr,
896 BUID_HI(pdn->phb->buid), 668 BUID_HI(pdn->phb->buid),
897 BUID_LO(pdn->phb->buid)); 669 BUID_LO(pdn->phb->buid));
898 if (rc) { 670 if (rc) {
@@ -927,6 +699,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
927 int enable; 699 int enable;
928 struct pci_dn *pdn = PCI_DN(dn); 700 struct pci_dn *pdn = PCI_DN(dn);
929 701
702 pdn->class_code = 0;
930 pdn->eeh_mode = 0; 703 pdn->eeh_mode = 0;
931 pdn->eeh_check_count = 0; 704 pdn->eeh_check_count = 0;
932 pdn->eeh_freeze_count = 0; 705 pdn->eeh_freeze_count = 0;
@@ -943,6 +716,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
943 pdn->eeh_mode |= EEH_MODE_NOCHECK; 716 pdn->eeh_mode |= EEH_MODE_NOCHECK;
944 return NULL; 717 return NULL;
945 } 718 }
719 pdn->class_code = *class_code;
946 720
947 /* 721 /*
948 * Now decide if we are going to "Disable" EEH checking 722 * Now decide if we are going to "Disable" EEH checking
@@ -953,8 +727,10 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
953 * But there are a few cases like display devices that make sense. 727 * But there are a few cases like display devices that make sense.
954 */ 728 */
955 enable = 1; /* i.e. we will do checking */ 729 enable = 1; /* i.e. we will do checking */
730#if 0
956 if ((*class_code >> 16) == PCI_BASE_CLASS_DISPLAY) 731 if ((*class_code >> 16) == PCI_BASE_CLASS_DISPLAY)
957 enable = 0; 732 enable = 0;
733#endif
958 734
959 if (!enable) 735 if (!enable)
960 pdn->eeh_mode |= EEH_MODE_NOCHECK; 736 pdn->eeh_mode |= EEH_MODE_NOCHECK;
@@ -973,8 +749,22 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
973 eeh_subsystem_enabled = 1; 749 eeh_subsystem_enabled = 1;
974 pdn->eeh_mode |= EEH_MODE_SUPPORTED; 750 pdn->eeh_mode |= EEH_MODE_SUPPORTED;
975 pdn->eeh_config_addr = regs[0]; 751 pdn->eeh_config_addr = regs[0];
752
753 /* If the newer, better, ibm,get-config-addr-info is supported,
754 * then use that instead. */
755 pdn->eeh_pe_config_addr = 0;
756 if (ibm_get_config_addr_info != RTAS_UNKNOWN_SERVICE) {
757 unsigned int rets[2];
758 ret = rtas_call (ibm_get_config_addr_info, 4, 2, rets,
759 pdn->eeh_config_addr,
760 info->buid_hi, info->buid_lo,
761 0);
762 if (ret == 0)
763 pdn->eeh_pe_config_addr = rets[0];
764 }
976#ifdef DEBUG 765#ifdef DEBUG
977 printk(KERN_DEBUG "EEH: %s: eeh enabled\n", dn->full_name); 766 printk(KERN_DEBUG "EEH: %s: eeh enabled, config=%x pe_config=%x\n",
767 dn->full_name, pdn->eeh_config_addr, pdn->eeh_pe_config_addr);
978#endif 768#endif
979 } else { 769 } else {
980 770
@@ -993,6 +783,7 @@ static void *early_enable_eeh(struct device_node *dn, void *data)
993 dn->full_name); 783 dn->full_name);
994 } 784 }
995 785
786 eeh_save_bars(pdn);
996 return NULL; 787 return NULL;
997} 788}
998 789
@@ -1026,6 +817,8 @@ void __init eeh_init(void)
1026 ibm_read_slot_reset_state2 = rtas_token("ibm,read-slot-reset-state2"); 817 ibm_read_slot_reset_state2 = rtas_token("ibm,read-slot-reset-state2");
1027 ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state"); 818 ibm_read_slot_reset_state = rtas_token("ibm,read-slot-reset-state");
1028 ibm_slot_error_detail = rtas_token("ibm,slot-error-detail"); 819 ibm_slot_error_detail = rtas_token("ibm,slot-error-detail");
820 ibm_get_config_addr_info = rtas_token("ibm,get-config-addr-info");
821 ibm_configure_bridge = rtas_token ("ibm,configure-bridge");
1029 822
1030 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE) 823 if (ibm_set_eeh_option == RTAS_UNKNOWN_SERVICE)
1031 return; 824 return;
@@ -1080,12 +873,10 @@ void eeh_add_device_early(struct device_node *dn)
1080 if (!dn || !PCI_DN(dn)) 873 if (!dn || !PCI_DN(dn))
1081 return; 874 return;
1082 phb = PCI_DN(dn)->phb; 875 phb = PCI_DN(dn)->phb;
1083 if (NULL == phb || 0 == phb->buid) { 876
1084 printk(KERN_WARNING "EEH: Expected buid but found none for %s\n", 877 /* USB Bus children of PCI devices will not have BUID's */
1085 dn->full_name); 878 if (NULL == phb || 0 == phb->buid)
1086 dump_stack();
1087 return; 879 return;
1088 }
1089 880
1090 info.buid_hi = BUID_HI(phb->buid); 881 info.buid_hi = BUID_HI(phb->buid);
1091 info.buid_lo = BUID_LO(phb->buid); 882 info.buid_lo = BUID_LO(phb->buid);
@@ -1093,6 +884,15 @@ void eeh_add_device_early(struct device_node *dn)
1093} 884}
1094EXPORT_SYMBOL_GPL(eeh_add_device_early); 885EXPORT_SYMBOL_GPL(eeh_add_device_early);
1095 886
887void eeh_add_device_tree_early(struct device_node *dn)
888{
889 struct device_node *sib;
890 for (sib = dn->child; sib; sib = sib->sibling)
891 eeh_add_device_tree_early(sib);
892 eeh_add_device_early(dn);
893}
894EXPORT_SYMBOL_GPL(eeh_add_device_tree_early);
895
1096/** 896/**
1097 * eeh_add_device_late - perform EEH initialization for the indicated pci device 897 * eeh_add_device_late - perform EEH initialization for the indicated pci device
1098 * @dev: pci device for which to set up EEH 898 * @dev: pci device for which to set up EEH
@@ -1118,7 +918,6 @@ void eeh_add_device_late(struct pci_dev *dev)
1118 pdn->pcidev = dev; 918 pdn->pcidev = dev;
1119 919
1120 pci_addr_cache_insert_device (dev); 920 pci_addr_cache_insert_device (dev);
1121 eeh_save_bars(dev, pdn);
1122} 921}
1123EXPORT_SYMBOL_GPL(eeh_add_device_late); 922EXPORT_SYMBOL_GPL(eeh_add_device_late);
1124 923
@@ -1147,27 +946,28 @@ void eeh_remove_device(struct pci_dev *dev)
1147} 946}
1148EXPORT_SYMBOL_GPL(eeh_remove_device); 947EXPORT_SYMBOL_GPL(eeh_remove_device);
1149 948
1150static int proc_eeh_show(struct seq_file *m, void *v) 949void eeh_remove_bus_device(struct pci_dev *dev)
1151{ 950{
1152 unsigned int cpu; 951 eeh_remove_device(dev);
1153 unsigned long ffs = 0, positives = 0, failures = 0; 952 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
1154 unsigned long resets = 0; 953 struct pci_bus *bus = dev->subordinate;
1155 unsigned long no_dev = 0, no_dn = 0, no_cfg = 0, no_check = 0; 954 struct list_head *ln;
1156 955 if (!bus)
1157 for_each_cpu(cpu) { 956 return;
1158 ffs += per_cpu(total_mmio_ffs, cpu); 957 for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
1159 positives += per_cpu(false_positives, cpu); 958 struct pci_dev *pdev = pci_dev_b(ln);
1160 failures += per_cpu(ignored_failures, cpu); 959 if (pdev)
1161 resets += per_cpu(slot_resets, cpu); 960 eeh_remove_bus_device(pdev);
1162 no_dev += per_cpu(no_device, cpu); 961 }
1163 no_dn += per_cpu(no_dn, cpu);
1164 no_cfg += per_cpu(no_cfg_addr, cpu);
1165 no_check += per_cpu(ignored_check, cpu);
1166 } 962 }
963}
964EXPORT_SYMBOL_GPL(eeh_remove_bus_device);
1167 965
966static int proc_eeh_show(struct seq_file *m, void *v)
967{
1168 if (0 == eeh_subsystem_enabled) { 968 if (0 == eeh_subsystem_enabled) {
1169 seq_printf(m, "EEH Subsystem is globally disabled\n"); 969 seq_printf(m, "EEH Subsystem is globally disabled\n");
1170 seq_printf(m, "eeh_total_mmio_ffs=%ld\n", ffs); 970 seq_printf(m, "eeh_total_mmio_ffs=%ld\n", total_mmio_ffs);
1171 } else { 971 } else {
1172 seq_printf(m, "EEH Subsystem is enabled\n"); 972 seq_printf(m, "EEH Subsystem is enabled\n");
1173 seq_printf(m, 973 seq_printf(m,
@@ -1179,8 +979,10 @@ static int proc_eeh_show(struct seq_file *m, void *v)
1179 "eeh_false_positives=%ld\n" 979 "eeh_false_positives=%ld\n"
1180 "eeh_ignored_failures=%ld\n" 980 "eeh_ignored_failures=%ld\n"
1181 "eeh_slot_resets=%ld\n", 981 "eeh_slot_resets=%ld\n",
1182 no_dev, no_dn, no_cfg, no_check, 982 no_device, no_dn, no_cfg_addr,
1183 ffs, positives, failures, resets); 983 ignored_check, total_mmio_ffs,
984 false_positives, ignored_failures,
985 slot_resets);
1184 } 986 }
1185 987
1186 return 0; 988 return 0;
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
new file mode 100644
index 000000000000..d4a402c5866c
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -0,0 +1,316 @@
1/*
2 * eeh_cache.c
3 * PCI address cache; allows the lookup of PCI devices based on I/O address
4 *
5 * Copyright (C) 2004 Linas Vepstas <linas@austin.ibm.com> IBM Corporation
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/list.h>
23#include <linux/pci.h>
24#include <linux/rbtree.h>
25#include <linux/spinlock.h>
26#include <asm/atomic.h>
27#include <asm/pci-bridge.h>
28#include <asm/ppc-pci.h>
29
30#undef DEBUG
31
32/**
33 * The pci address cache subsystem. This subsystem places
34 * PCI device address resources into a red-black tree, sorted
35 * according to the address range, so that given only an i/o
36 * address, the corresponding PCI device can be **quickly**
37 * found. It is safe to perform an address lookup in an interrupt
38 * context; this ability is an important feature.
39 *
40 * Currently, the only customer of this code is the EEH subsystem;
41 * thus, this code has been somewhat tailored to suit EEH better.
42 * In particular, the cache does *not* hold the addresses of devices
43 * for which EEH is not enabled.
44 *
45 * (Implementation Note: The RB tree seems to be better/faster
46 * than any hash algo I could think of for this problem, even
47 * with the penalty of slow pointer chases for d-cache misses).
48 */
49struct pci_io_addr_range
50{
51 struct rb_node rb_node;
52 unsigned long addr_lo;
53 unsigned long addr_hi;
54 struct pci_dev *pcidev;
55 unsigned int flags;
56};
57
58static struct pci_io_addr_cache
59{
60 struct rb_root rb_root;
61 spinlock_t piar_lock;
62} pci_io_addr_cache_root;
63
64static inline struct pci_dev *__pci_get_device_by_addr(unsigned long addr)
65{
66 struct rb_node *n = pci_io_addr_cache_root.rb_root.rb_node;
67
68 while (n) {
69 struct pci_io_addr_range *piar;
70 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
71
72 if (addr < piar->addr_lo) {
73 n = n->rb_left;
74 } else {
75 if (addr > piar->addr_hi) {
76 n = n->rb_right;
77 } else {
78 pci_dev_get(piar->pcidev);
79 return piar->pcidev;
80 }
81 }
82 }
83
84 return NULL;
85}
86
87/**
88 * pci_get_device_by_addr - Get device, given only address
89 * @addr: mmio (PIO) phys address or i/o port number
90 *
91 * Given an mmio phys address, or a port number, find a pci device
92 * that implements this address. Be sure to pci_dev_put the device
93 * when finished. I/O port numbers are assumed to be offset
94 * from zero (that is, they do *not* have pci_io_addr added in).
95 * It is safe to call this function within an interrupt.
96 */
97struct pci_dev *pci_get_device_by_addr(unsigned long addr)
98{
99 struct pci_dev *dev;
100 unsigned long flags;
101
102 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
103 dev = __pci_get_device_by_addr(addr);
104 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
105 return dev;
106}
107
108#ifdef DEBUG
109/*
110 * Handy-dandy debug print routine, does nothing more
111 * than print out the contents of our addr cache.
112 */
113static void pci_addr_cache_print(struct pci_io_addr_cache *cache)
114{
115 struct rb_node *n;
116 int cnt = 0;
117
118 n = rb_first(&cache->rb_root);
119 while (n) {
120 struct pci_io_addr_range *piar;
121 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
122 printk(KERN_DEBUG "PCI: %s addr range %d [%lx-%lx]: %s\n",
123 (piar->flags & IORESOURCE_IO) ? "i/o" : "mem", cnt,
124 piar->addr_lo, piar->addr_hi, pci_name(piar->pcidev));
125 cnt++;
126 n = rb_next(n);
127 }
128}
129#endif
130
131/* Insert address range into the rb tree. */
132static struct pci_io_addr_range *
133pci_addr_cache_insert(struct pci_dev *dev, unsigned long alo,
134 unsigned long ahi, unsigned int flags)
135{
136 struct rb_node **p = &pci_io_addr_cache_root.rb_root.rb_node;
137 struct rb_node *parent = NULL;
138 struct pci_io_addr_range *piar;
139
140 /* Walk tree, find a place to insert into tree */
141 while (*p) {
142 parent = *p;
143 piar = rb_entry(parent, struct pci_io_addr_range, rb_node);
144 if (ahi < piar->addr_lo) {
145 p = &parent->rb_left;
146 } else if (alo > piar->addr_hi) {
147 p = &parent->rb_right;
148 } else {
149 if (dev != piar->pcidev ||
150 alo != piar->addr_lo || ahi != piar->addr_hi) {
151 printk(KERN_WARNING "PIAR: overlapping address range\n");
152 }
153 return piar;
154 }
155 }
156 piar = (struct pci_io_addr_range *)kmalloc(sizeof(struct pci_io_addr_range), GFP_ATOMIC);
157 if (!piar)
158 return NULL;
159
160 piar->addr_lo = alo;
161 piar->addr_hi = ahi;
162 piar->pcidev = dev;
163 piar->flags = flags;
164
165#ifdef DEBUG
166 printk(KERN_DEBUG "PIAR: insert range=[%lx:%lx] dev=%s\n",
167 alo, ahi, pci_name (dev));
168#endif
169
170 rb_link_node(&piar->rb_node, parent, p);
171 rb_insert_color(&piar->rb_node, &pci_io_addr_cache_root.rb_root);
172
173 return piar;
174}
175
176static void __pci_addr_cache_insert_device(struct pci_dev *dev)
177{
178 struct device_node *dn;
179 struct pci_dn *pdn;
180 int i;
181 int inserted = 0;
182
183 dn = pci_device_to_OF_node(dev);
184 if (!dn) {
185 printk(KERN_WARNING "PCI: no pci dn found for dev=%s\n", pci_name(dev));
186 return;
187 }
188
189 /* Skip any devices for which EEH is not enabled. */
190 pdn = PCI_DN(dn);
191 if (!(pdn->eeh_mode & EEH_MODE_SUPPORTED) ||
192 pdn->eeh_mode & EEH_MODE_NOCHECK) {
193#ifdef DEBUG
194 printk(KERN_INFO "PCI: skip building address cache for=%s - %s\n",
195 pci_name(dev), pdn->node->full_name);
196#endif
197 return;
198 }
199
200 /* The cache holds a reference to the device... */
201 pci_dev_get(dev);
202
203 /* Walk resources on this device, poke them into the tree */
204 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
205 unsigned long start = pci_resource_start(dev,i);
206 unsigned long end = pci_resource_end(dev,i);
207 unsigned int flags = pci_resource_flags(dev,i);
208
209 /* We are interested only bus addresses, not dma or other stuff */
210 if (0 == (flags & (IORESOURCE_IO | IORESOURCE_MEM)))
211 continue;
212 if (start == 0 || ~start == 0 || end == 0 || ~end == 0)
213 continue;
214 pci_addr_cache_insert(dev, start, end, flags);
215 inserted = 1;
216 }
217
218 /* If there was nothing to add, the cache has no reference... */
219 if (!inserted)
220 pci_dev_put(dev);
221}
222
223/**
224 * pci_addr_cache_insert_device - Add a device to the address cache
225 * @dev: PCI device whose I/O addresses we are interested in.
226 *
227 * In order to support the fast lookup of devices based on addresses,
228 * we maintain a cache of devices that can be quickly searched.
229 * This routine adds a device to that cache.
230 */
231void pci_addr_cache_insert_device(struct pci_dev *dev)
232{
233 unsigned long flags;
234
235 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
236 __pci_addr_cache_insert_device(dev);
237 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
238}
239
240static inline void __pci_addr_cache_remove_device(struct pci_dev *dev)
241{
242 struct rb_node *n;
243 int removed = 0;
244
245restart:
246 n = rb_first(&pci_io_addr_cache_root.rb_root);
247 while (n) {
248 struct pci_io_addr_range *piar;
249 piar = rb_entry(n, struct pci_io_addr_range, rb_node);
250
251 if (piar->pcidev == dev) {
252 rb_erase(n, &pci_io_addr_cache_root.rb_root);
253 removed = 1;
254 kfree(piar);
255 goto restart;
256 }
257 n = rb_next(n);
258 }
259
260 /* The cache no longer holds its reference to this device... */
261 if (removed)
262 pci_dev_put(dev);
263}
264
265/**
266 * pci_addr_cache_remove_device - remove pci device from addr cache
267 * @dev: device to remove
268 *
269 * Remove a device from the addr-cache tree.
270 * This is potentially expensive, since it will walk
271 * the tree multiple times (once per resource).
272 * But so what; device removal doesn't need to be that fast.
273 */
274void pci_addr_cache_remove_device(struct pci_dev *dev)
275{
276 unsigned long flags;
277
278 spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
279 __pci_addr_cache_remove_device(dev);
280 spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
281}
282
283/**
284 * pci_addr_cache_build - Build a cache of I/O addresses
285 *
286 * Build a cache of pci i/o addresses. This cache will be used to
287 * find the pci device that corresponds to a given address.
288 * This routine scans all pci busses to build the cache.
289 * Must be run late in boot process, after the pci controllers
290 * have been scaned for devices (after all device resources are known).
291 */
292void __init pci_addr_cache_build(void)
293{
294 struct device_node *dn;
295 struct pci_dev *dev = NULL;
296
297 spin_lock_init(&pci_io_addr_cache_root.piar_lock);
298
299 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
300 /* Ignore PCI bridges */
301 if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE)
302 continue;
303
304 pci_addr_cache_insert_device(dev);
305
306 dn = pci_device_to_OF_node(dev);
307 pci_dev_get (dev); /* matching put is in eeh_remove_device() */
308 PCI_DN(dn)->pcidev = dev;
309 }
310
311#ifdef DEBUG
312 /* Verify tree built up above, echo back the list of addrs. */
313 pci_addr_cache_print(&pci_io_addr_cache_root);
314#endif
315}
316
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
new file mode 100644
index 000000000000..6373372932ba
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -0,0 +1,376 @@
1/*
2 * PCI Error Recovery Driver for RPA-compliant PPC64 platform.
3 * Copyright (C) 2004, 2005 Linas Vepstas <linas@linas.org>
4 *
5 * All rights reserved.
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 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
15 * NON INFRINGEMENT. See the GNU General Public License for more
16 * details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 * Send feedback to <linas@us.ibm.com>
23 *
24 */
25#include <linux/delay.h>
26#include <linux/irq.h>
27#include <linux/interrupt.h>
28#include <linux/notifier.h>
29#include <linux/pci.h>
30#include <asm/eeh.h>
31#include <asm/eeh_event.h>
32#include <asm/ppc-pci.h>
33#include <asm/pci-bridge.h>
34#include <asm/prom.h>
35#include <asm/rtas.h>
36
37
38static inline const char * pcid_name (struct pci_dev *pdev)
39{
40 if (pdev->dev.driver)
41 return pdev->dev.driver->name;
42 return "";
43}
44
45#ifdef DEBUG
46static void print_device_node_tree (struct pci_dn *pdn, int dent)
47{
48 int i;
49 if (!pdn) return;
50 for (i=0;i<dent; i++)
51 printk(" ");
52 printk("dn=%s mode=%x \tcfg_addr=%x pe_addr=%x \tfull=%s\n",
53 pdn->node->name, pdn->eeh_mode, pdn->eeh_config_addr,
54 pdn->eeh_pe_config_addr, pdn->node->full_name);
55 dent += 3;
56 struct device_node *pc = pdn->node->child;
57 while (pc) {
58 print_device_node_tree(PCI_DN(pc), dent);
59 pc = pc->sibling;
60 }
61}
62#endif
63
64/**
65 * irq_in_use - return true if this irq is being used
66 */
67static int irq_in_use(unsigned int irq)
68{
69 int rc = 0;
70 unsigned long flags;
71 struct irq_desc *desc = irq_desc + irq;
72
73 spin_lock_irqsave(&desc->lock, flags);
74 if (desc->action)
75 rc = 1;
76 spin_unlock_irqrestore(&desc->lock, flags);
77 return rc;
78}
79
80/* ------------------------------------------------------- */
81/** eeh_report_error - report an EEH error to each device,
82 * collect up and merge the device responses.
83 */
84
85static void eeh_report_error(struct pci_dev *dev, void *userdata)
86{
87 enum pci_ers_result rc, *res = userdata;
88 struct pci_driver *driver = dev->driver;
89
90 dev->error_state = pci_channel_io_frozen;
91
92 if (!driver)
93 return;
94
95 if (irq_in_use (dev->irq)) {
96 struct device_node *dn = pci_device_to_OF_node(dev);
97 PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED;
98 disable_irq_nosync(dev->irq);
99 }
100 if (!driver->err_handler)
101 return;
102 if (!driver->err_handler->error_detected)
103 return;
104
105 rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen);
106 if (*res == PCI_ERS_RESULT_NONE) *res = rc;
107 if (*res == PCI_ERS_RESULT_NEED_RESET) return;
108 if (*res == PCI_ERS_RESULT_DISCONNECT &&
109 rc == PCI_ERS_RESULT_NEED_RESET) *res = rc;
110}
111
112/** eeh_report_reset -- tell this device that the pci slot
113 * has been reset.
114 */
115
116static void eeh_report_reset(struct pci_dev *dev, void *userdata)
117{
118 struct pci_driver *driver = dev->driver;
119 struct device_node *dn = pci_device_to_OF_node(dev);
120
121 if (!driver)
122 return;
123
124 if ((PCI_DN(dn)->eeh_mode) & EEH_MODE_IRQ_DISABLED) {
125 PCI_DN(dn)->eeh_mode &= ~EEH_MODE_IRQ_DISABLED;
126 enable_irq(dev->irq);
127 }
128 if (!driver->err_handler)
129 return;
130 if (!driver->err_handler->slot_reset)
131 return;
132
133 driver->err_handler->slot_reset(dev);
134}
135
136static void eeh_report_resume(struct pci_dev *dev, void *userdata)
137{
138 struct pci_driver *driver = dev->driver;
139
140 dev->error_state = pci_channel_io_normal;
141
142 if (!driver)
143 return;
144 if (!driver->err_handler)
145 return;
146 if (!driver->err_handler->resume)
147 return;
148
149 driver->err_handler->resume(dev);
150}
151
152static void eeh_report_failure(struct pci_dev *dev, void *userdata)
153{
154 struct pci_driver *driver = dev->driver;
155
156 dev->error_state = pci_channel_io_perm_failure;
157
158 if (!driver)
159 return;
160
161 if (irq_in_use (dev->irq)) {
162 struct device_node *dn = pci_device_to_OF_node(dev);
163 PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED;
164 disable_irq_nosync(dev->irq);
165 }
166 if (!driver->err_handler)
167 return;
168 if (!driver->err_handler->error_detected)
169 return;
170 driver->err_handler->error_detected(dev, pci_channel_io_perm_failure);
171}
172
173/* ------------------------------------------------------- */
174/**
175 * handle_eeh_events -- reset a PCI device after hard lockup.
176 *
177 * pSeries systems will isolate a PCI slot if the PCI-Host
178 * bridge detects address or data parity errors, DMA's
179 * occuring to wild addresses (which usually happen due to
180 * bugs in device drivers or in PCI adapter firmware).
181 * Slot isolations also occur if #SERR, #PERR or other misc
182 * PCI-related errors are detected.
183 *
184 * Recovery process consists of unplugging the device driver
185 * (which generated hotplug events to userspace), then issuing
186 * a PCI #RST to the device, then reconfiguring the PCI config
187 * space for all bridges & devices under this slot, and then
188 * finally restarting the device drivers (which cause a second
189 * set of hotplug events to go out to userspace).
190 */
191
192/**
193 * eeh_reset_device() -- perform actual reset of a pci slot
194 * Args: bus: pointer to the pci bus structure corresponding
195 * to the isolated slot. A non-null value will
196 * cause all devices under the bus to be removed
197 * and then re-added.
198 * pe_dn: pointer to a "Partionable Endpoint" device node.
199 * This is the top-level structure on which pci
200 * bus resets can be performed.
201 */
202
203static int eeh_reset_device (struct pci_dn *pe_dn, struct pci_bus *bus)
204{
205 int rc;
206 if (bus)
207 pcibios_remove_pci_devices(bus);
208
209 /* Reset the pci controller. (Asserts RST#; resets config space).
210 * Reconfigure bridges and devices. Don't try to bring the system
211 * up if the reset failed for some reason. */
212 rc = rtas_set_slot_reset(pe_dn);
213 if (rc)
214 return rc;
215
216 /* New-style config addrs might be shared across multiple devices,
217 * Walk over all functions on this device */
218 if (pe_dn->eeh_pe_config_addr) {
219 struct device_node *pe = pe_dn->node;
220 pe = pe->parent->child;
221 while (pe) {
222 struct pci_dn *ppe = PCI_DN(pe);
223 if (pe_dn->eeh_pe_config_addr == ppe->eeh_pe_config_addr) {
224 rtas_configure_bridge(ppe);
225 eeh_restore_bars(ppe);
226 }
227 pe = pe->sibling;
228 }
229 } else {
230 rtas_configure_bridge(pe_dn);
231 eeh_restore_bars(pe_dn);
232 }
233
234 /* Give the system 5 seconds to finish running the user-space
235 * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes,
236 * this is a hack, but if we don't do this, and try to bring
237 * the device up before the scripts have taken it down,
238 * potentially weird things happen.
239 */
240 if (bus) {
241 ssleep (5);
242 pcibios_add_pci_devices(bus);
243 }
244
245 return 0;
246}
247
248/* The longest amount of time to wait for a pci device
249 * to come back on line, in seconds.
250 */
251#define MAX_WAIT_FOR_RECOVERY 15
252
253void handle_eeh_events (struct eeh_event *event)
254{
255 struct device_node *frozen_dn;
256 struct pci_dn *frozen_pdn;
257 struct pci_bus *frozen_bus;
258 int rc = 0;
259 enum pci_ers_result result = PCI_ERS_RESULT_NONE;
260
261 frozen_dn = find_device_pe(event->dn);
262 frozen_bus = pcibios_find_pci_bus(frozen_dn);
263
264 if (!frozen_dn) {
265 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint for %s\n",
266 pci_name(event->dev));
267 return;
268 }
269
270 /* There are two different styles for coming up with the PE.
271 * In the old style, it was the highest EEH-capable device
272 * which was always an EADS pci bridge. In the new style,
273 * there might not be any EADS bridges, and even when there are,
274 * the firmware marks them as "EEH incapable". So another
275 * two-step is needed to find the pci bus.. */
276 if (!frozen_bus)
277 frozen_bus = pcibios_find_pci_bus (frozen_dn->parent);
278
279 if (!frozen_bus) {
280 printk(KERN_ERR "EEH: Cannot find PCI bus for %s\n",
281 frozen_dn->full_name);
282 return;
283 }
284
285#if 0
286 /* We may get "permanent failure" messages on empty slots.
287 * These are false alarms. Empty slots have no child dn. */
288 if ((event->state == pci_channel_io_perm_failure) && (frozen_device == NULL))
289 return;
290#endif
291
292 frozen_pdn = PCI_DN(frozen_dn);
293 frozen_pdn->eeh_freeze_count++;
294
295 if (frozen_pdn->eeh_freeze_count > EEH_MAX_ALLOWED_FREEZES)
296 goto hard_fail;
297
298 /* If the reset state is a '5' and the time to reset is 0 (infinity)
299 * or is more then 15 seconds, then mark this as a permanent failure.
300 */
301 if ((event->state == pci_channel_io_perm_failure) &&
302 ((event->time_unavail <= 0) ||
303 (event->time_unavail > MAX_WAIT_FOR_RECOVERY*1000)))
304 goto hard_fail;
305
306 eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */);
307 printk(KERN_WARNING
308 "EEH: This PCI device has failed %d times since last reboot: %s - %s\n",
309 frozen_pdn->eeh_freeze_count,
310 pci_name (frozen_pdn->pcidev),
311 pcid_name(frozen_pdn->pcidev));
312
313 /* Walk the various device drivers attached to this slot through
314 * a reset sequence, giving each an opportunity to do what it needs
315 * to accomplish the reset. Each child gets a report of the
316 * status ... if any child can't handle the reset, then the entire
317 * slot is dlpar removed and added.
318 */
319 pci_walk_bus(frozen_bus, eeh_report_error, &result);
320
321 /* If all device drivers were EEH-unaware, then shut
322 * down all of the device drivers, and hope they
323 * go down willingly, without panicing the system.
324 */
325 if (result == PCI_ERS_RESULT_NONE) {
326 rc = eeh_reset_device(frozen_pdn, frozen_bus);
327 if (rc)
328 goto hard_fail;
329 }
330
331 /* If any device called out for a reset, then reset the slot */
332 if (result == PCI_ERS_RESULT_NEED_RESET) {
333 rc = eeh_reset_device(frozen_pdn, NULL);
334 if (rc)
335 goto hard_fail;
336 pci_walk_bus(frozen_bus, eeh_report_reset, 0);
337 }
338
339 /* If all devices reported they can proceed, the re-enable PIO */
340 if (result == PCI_ERS_RESULT_CAN_RECOVER) {
341 /* XXX Not supported; we brute-force reset the device */
342 rc = eeh_reset_device(frozen_pdn, NULL);
343 if (rc)
344 goto hard_fail;
345 pci_walk_bus(frozen_bus, eeh_report_reset, 0);
346 }
347
348 /* Tell all device drivers that they can resume operations */
349 pci_walk_bus(frozen_bus, eeh_report_resume, 0);
350
351 return;
352
353hard_fail:
354 /*
355 * About 90% of all real-life EEH failures in the field
356 * are due to poorly seated PCI cards. Only 10% or so are
357 * due to actual, failed cards.
358 */
359 printk(KERN_ERR
360 "EEH: PCI device %s - %s has failed %d times \n"
361 "and has been permanently disabled. Please try reseating\n"
362 "this device or replacing it.\n",
363 pci_name (frozen_pdn->pcidev),
364 pcid_name(frozen_pdn->pcidev),
365 frozen_pdn->eeh_freeze_count);
366
367 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */);
368
369 /* Notify all devices that they're about to go down. */
370 pci_walk_bus(frozen_bus, eeh_report_failure, 0);
371
372 /* Shut down the device drivers for good. */
373 pcibios_remove_pci_devices(frozen_bus);
374}
375
376/* ---------- end of file ---------- */
diff --git a/arch/powerpc/platforms/pseries/eeh_event.c b/arch/powerpc/platforms/pseries/eeh_event.c
index 92497333c2b6..9a9961f27480 100644
--- a/arch/powerpc/platforms/pseries/eeh_event.c
+++ b/arch/powerpc/platforms/pseries/eeh_event.c
@@ -21,6 +21,7 @@
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/pci.h> 22#include <linux/pci.h>
23#include <asm/eeh_event.h> 23#include <asm/eeh_event.h>
24#include <asm/ppc-pci.h>
24 25
25/** Overview: 26/** Overview:
26 * EEH error states may be detected within exception handlers; 27 * EEH error states may be detected within exception handlers;
@@ -37,31 +38,6 @@ static void eeh_thread_launcher(void *);
37DECLARE_WORK(eeh_event_wq, eeh_thread_launcher, NULL); 38DECLARE_WORK(eeh_event_wq, eeh_thread_launcher, NULL);
38 39
39/** 40/**
40 * eeh_panic - call panic() for an eeh event that cannot be handled.
41 * The philosophy of this routine is that it is better to panic and
42 * halt the OS than it is to risk possible data corruption by
43 * oblivious device drivers that don't know better.
44 *
45 * @dev pci device that had an eeh event
46 * @reset_state current reset state of the device slot
47 */
48static void eeh_panic(struct pci_dev *dev, int reset_state)
49{
50 /*
51 * Since the panic_on_oops sysctl is used to halt the system
52 * in light of potential corruption, we can use it here.
53 */
54 if (panic_on_oops) {
55 panic("EEH: MMIO failure (%d) on device:%s\n", reset_state,
56 pci_name(dev));
57 }
58 else {
59 printk(KERN_INFO "EEH: Ignored MMIO failure (%d) on device:%s\n",
60 reset_state, pci_name(dev));
61 }
62}
63
64/**
65 * eeh_event_handler - dispatch EEH events. The detection of a frozen 41 * eeh_event_handler - dispatch EEH events. The detection of a frozen
66 * slot can occur inside an interrupt, where it can be hard to do 42 * slot can occur inside an interrupt, where it can be hard to do
67 * anything about it. The goal of this routine is to pull these 43 * anything about it. The goal of this routine is to pull these
@@ -82,10 +58,16 @@ static int eeh_event_handler(void * dummy)
82 58
83 spin_lock_irqsave(&eeh_eventlist_lock, flags); 59 spin_lock_irqsave(&eeh_eventlist_lock, flags);
84 event = NULL; 60 event = NULL;
61
62 /* Unqueue the event, get ready to process. */
85 if (!list_empty(&eeh_eventlist)) { 63 if (!list_empty(&eeh_eventlist)) {
86 event = list_entry(eeh_eventlist.next, struct eeh_event, list); 64 event = list_entry(eeh_eventlist.next, struct eeh_event, list);
87 list_del(&event->list); 65 list_del(&event->list);
88 } 66 }
67
68 if (event)
69 eeh_mark_slot(event->dn, EEH_MODE_RECOVERING);
70
89 spin_unlock_irqrestore(&eeh_eventlist_lock, flags); 71 spin_unlock_irqrestore(&eeh_eventlist_lock, flags);
90 if (event == NULL) 72 if (event == NULL)
91 break; 73 break;
@@ -93,8 +75,11 @@ static int eeh_event_handler(void * dummy)
93 printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n", 75 printk(KERN_INFO "EEH: Detected PCI bus error on device %s\n",
94 pci_name(event->dev)); 76 pci_name(event->dev));
95 77
96 eeh_panic (event->dev, event->state); 78 handle_eeh_events(event);
79
80 eeh_clear_slot(event->dn, EEH_MODE_RECOVERING);
97 81
82 pci_dev_put(event->dev);
98 kfree(event); 83 kfree(event);
99 } 84 }
100 85
@@ -122,7 +107,7 @@ static void eeh_thread_launcher(void *dummy)
122 */ 107 */
123int eeh_send_failure_event (struct device_node *dn, 108int eeh_send_failure_event (struct device_node *dn,
124 struct pci_dev *dev, 109 struct pci_dev *dev,
125 int state, 110 enum pci_channel_state state,
126 int time_unavail) 111 int time_unavail)
127{ 112{
128 unsigned long flags; 113 unsigned long flags;
diff --git a/arch/powerpc/platforms/pseries/hvcserver.c b/arch/powerpc/platforms/pseries/hvcserver.c
index 4d584172055a..22bfb5c89db9 100644
--- a/arch/powerpc/platforms/pseries/hvcserver.c
+++ b/arch/powerpc/platforms/pseries/hvcserver.c
@@ -40,7 +40,7 @@ MODULE_VERSION(HVCS_ARCH_VERSION);
40 * functions aren't performance sensitive, so this conversion isn't an 40 * functions aren't performance sensitive, so this conversion isn't an
41 * issue. 41 * issue.
42 */ 42 */
43int hvcs_convert(long to_convert) 43static int hvcs_convert(long to_convert)
44{ 44{
45 switch (to_convert) { 45 switch (to_convert) {
46 case H_Success: 46 case H_Success:
@@ -91,7 +91,7 @@ int hvcs_free_partner_info(struct list_head *head)
91EXPORT_SYMBOL(hvcs_free_partner_info); 91EXPORT_SYMBOL(hvcs_free_partner_info);
92 92
93/* Helper function for hvcs_get_partner_info */ 93/* Helper function for hvcs_get_partner_info */
94int hvcs_next_partner(uint32_t unit_address, 94static int hvcs_next_partner(uint32_t unit_address,
95 unsigned long last_p_partition_ID, 95 unsigned long last_p_partition_ID,
96 unsigned long last_p_unit_address, unsigned long *pi_buff) 96 unsigned long last_p_unit_address, unsigned long *pi_buff)
97 97
diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c
index c78f2b290a73..48cfbfc43f99 100644
--- a/arch/powerpc/platforms/pseries/iommu.c
+++ b/arch/powerpc/platforms/pseries/iommu.c
@@ -51,8 +51,6 @@
51 51
52#define DBG(fmt...) 52#define DBG(fmt...)
53 53
54extern int is_python(struct device_node *);
55
56static void tce_build_pSeries(struct iommu_table *tbl, long index, 54static void tce_build_pSeries(struct iommu_table *tbl, long index,
57 long npages, unsigned long uaddr, 55 long npages, unsigned long uaddr,
58 enum dma_data_direction direction) 56 enum dma_data_direction direction)
@@ -109,6 +107,9 @@ static void tce_build_pSeriesLP(struct iommu_table *tbl, long tcenum,
109 u64 rc; 107 u64 rc;
110 union tce_entry tce; 108 union tce_entry tce;
111 109
110 tcenum <<= TCE_PAGE_FACTOR;
111 npages <<= TCE_PAGE_FACTOR;
112
112 tce.te_word = 0; 113 tce.te_word = 0;
113 tce.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 114 tce.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
114 tce.te_rdwr = 1; 115 tce.te_rdwr = 1;
@@ -143,10 +144,7 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
143 union tce_entry tce, *tcep; 144 union tce_entry tce, *tcep;
144 long l, limit; 145 long l, limit;
145 146
146 tcenum <<= TCE_PAGE_FACTOR; 147 if (TCE_PAGE_FACTOR == 0 && npages == 1)
147 npages <<= TCE_PAGE_FACTOR;
148
149 if (npages == 1)
150 return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr, 148 return tce_build_pSeriesLP(tbl, tcenum, npages, uaddr,
151 direction); 149 direction);
152 150
@@ -164,6 +162,9 @@ static void tce_buildmulti_pSeriesLP(struct iommu_table *tbl, long tcenum,
164 __get_cpu_var(tce_page) = tcep; 162 __get_cpu_var(tce_page) = tcep;
165 } 163 }
166 164
165 tcenum <<= TCE_PAGE_FACTOR;
166 npages <<= TCE_PAGE_FACTOR;
167
167 tce.te_word = 0; 168 tce.te_word = 0;
168 tce.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT; 169 tce.te_rpn = (virt_to_abs(uaddr)) >> TCE_SHIFT;
169 tce.te_rdwr = 1; 170 tce.te_rdwr = 1;
@@ -433,7 +434,7 @@ static void iommu_bus_setup_pSeriesLP(struct pci_bus *bus)
433 return; 434 return;
434 } 435 }
435 436
436 ppci = pdn->data; 437 ppci = PCI_DN(pdn);
437 if (!ppci->iommu_table) { 438 if (!ppci->iommu_table) {
438 /* Bussubno hasn't been copied yet. 439 /* Bussubno hasn't been copied yet.
439 * Do it now because iommu_table_setparms_lpar needs it. 440 * Do it now because iommu_table_setparms_lpar needs it.
@@ -480,10 +481,10 @@ static void iommu_dev_setup_pSeries(struct pci_dev *dev)
480 * an already allocated iommu table is found and use that. 481 * an already allocated iommu table is found and use that.
481 */ 482 */
482 483
483 while (dn && dn->data && PCI_DN(dn)->iommu_table == NULL) 484 while (dn && PCI_DN(dn) && PCI_DN(dn)->iommu_table == NULL)
484 dn = dn->parent; 485 dn = dn->parent;
485 486
486 if (dn && dn->data) { 487 if (dn && PCI_DN(dn)) {
487 PCI_DN(mydn)->iommu_table = PCI_DN(dn)->iommu_table; 488 PCI_DN(mydn)->iommu_table = PCI_DN(dn)->iommu_table;
488 } else { 489 } else {
489 DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, pci_name(dev)); 490 DBG("iommu_dev_setup_pSeries, dev %p (%s) has no iommu table\n", dev, pci_name(dev));
@@ -494,7 +495,7 @@ static int iommu_reconfig_notifier(struct notifier_block *nb, unsigned long acti
494{ 495{
495 int err = NOTIFY_OK; 496 int err = NOTIFY_OK;
496 struct device_node *np = node; 497 struct device_node *np = node;
497 struct pci_dn *pci = np->data; 498 struct pci_dn *pci = PCI_DN(np);
498 499
499 switch (action) { 500 switch (action) {
500 case PSERIES_RECONFIG_REMOVE: 501 case PSERIES_RECONFIG_REMOVE:
@@ -530,7 +531,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
530 */ 531 */
531 dn = pci_device_to_OF_node(dev); 532 dn = pci_device_to_OF_node(dev);
532 533
533 for (pdn = dn; pdn && pdn->data && !PCI_DN(pdn)->iommu_table; 534 for (pdn = dn; pdn && PCI_DN(pdn) && !PCI_DN(pdn)->iommu_table;
534 pdn = pdn->parent) { 535 pdn = pdn->parent) {
535 dma_window = (unsigned int *) 536 dma_window = (unsigned int *)
536 get_property(pdn, "ibm,dma-window", NULL); 537 get_property(pdn, "ibm,dma-window", NULL);
@@ -549,7 +550,7 @@ static void iommu_dev_setup_pSeriesLP(struct pci_dev *dev)
549 DBG("Found DMA window, allocating table\n"); 550 DBG("Found DMA window, allocating table\n");
550 } 551 }
551 552
552 pci = pdn->data; 553 pci = PCI_DN(pdn);
553 if (!pci->iommu_table) { 554 if (!pci->iommu_table) {
554 /* iommu_table_setparms_lpar needs bussubno. */ 555 /* iommu_table_setparms_lpar needs bussubno. */
555 pci->bussubno = pci->phb->bus->number; 556 pci->bussubno = pci->phb->bus->number;
diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c
index a50e5f3f396d..8952528d31ac 100644
--- a/arch/powerpc/platforms/pseries/lpar.c
+++ b/arch/powerpc/platforms/pseries/lpar.c
@@ -24,6 +24,7 @@
24#include <linux/config.h> 24#include <linux/config.h>
25#include <linux/kernel.h> 25#include <linux/kernel.h>
26#include <linux/dma-mapping.h> 26#include <linux/dma-mapping.h>
27#include <linux/console.h>
27#include <asm/processor.h> 28#include <asm/processor.h>
28#include <asm/mmu.h> 29#include <asm/mmu.h>
29#include <asm/page.h> 30#include <asm/page.h>
@@ -60,7 +61,7 @@ extern void pSeries_find_serial_port(void);
60int vtermno; /* virtual terminal# for udbg */ 61int vtermno; /* virtual terminal# for udbg */
61 62
62#define __ALIGNED__ __attribute__((__aligned__(sizeof(long)))) 63#define __ALIGNED__ __attribute__((__aligned__(sizeof(long))))
63static void udbg_hvsi_putc(unsigned char c) 64static void udbg_hvsi_putc(char c)
64{ 65{
65 /* packet's seqno isn't used anyways */ 66 /* packet's seqno isn't used anyways */
66 uint8_t packet[] __ALIGNED__ = { 0xff, 5, 0, 0, c }; 67 uint8_t packet[] __ALIGNED__ = { 0xff, 5, 0, 0, c };
@@ -111,7 +112,7 @@ static int udbg_hvsi_getc_poll(void)
111 return ch; 112 return ch;
112} 113}
113 114
114static unsigned char udbg_hvsi_getc(void) 115static int udbg_hvsi_getc(void)
115{ 116{
116 int ch; 117 int ch;
117 for (;;) { 118 for (;;) {
@@ -127,7 +128,7 @@ static unsigned char udbg_hvsi_getc(void)
127 } 128 }
128} 129}
129 130
130static void udbg_putcLP(unsigned char c) 131static void udbg_putcLP(char c)
131{ 132{
132 char buf[16]; 133 char buf[16];
133 unsigned long rc; 134 unsigned long rc;
@@ -172,7 +173,7 @@ static int udbg_getc_pollLP(void)
172 return ch; 173 return ch;
173} 174}
174 175
175static unsigned char udbg_getcLP(void) 176static int udbg_getcLP(void)
176{ 177{
177 int ch; 178 int ch;
178 for (;;) { 179 for (;;) {
@@ -191,7 +192,7 @@ static unsigned char udbg_getcLP(void)
191/* call this from early_init() for a working debug console on 192/* call this from early_init() for a working debug console on
192 * vterm capable LPAR machines 193 * vterm capable LPAR machines
193 */ 194 */
194void udbg_init_debug_lpar(void) 195void __init udbg_init_debug_lpar(void)
195{ 196{
196 vtermno = 0; 197 vtermno = 0;
197 udbg_putc = udbg_putcLP; 198 udbg_putc = udbg_putcLP;
@@ -200,73 +201,64 @@ void udbg_init_debug_lpar(void)
200} 201}
201 202
202/* returns 0 if couldn't find or use /chosen/stdout as console */ 203/* returns 0 if couldn't find or use /chosen/stdout as console */
203int find_udbg_vterm(void) 204void __init find_udbg_vterm(void)
204{ 205{
205 struct device_node *stdout_node; 206 struct device_node *stdout_node;
206 u32 *termno; 207 u32 *termno;
207 char *name; 208 char *name;
208 int found = 0; 209 int add_console;
209 210
210 /* find the boot console from /chosen/stdout */ 211 /* find the boot console from /chosen/stdout */
211 if (!of_chosen) 212 if (!of_chosen)
212 return 0; 213 return;
213 name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); 214 name = (char *)get_property(of_chosen, "linux,stdout-path", NULL);
214 if (name == NULL) 215 if (name == NULL)
215 return 0; 216 return;
216 stdout_node = of_find_node_by_path(name); 217 stdout_node = of_find_node_by_path(name);
217 if (!stdout_node) 218 if (!stdout_node)
218 return 0; 219 return;
219
220 /* now we have the stdout node; figure out what type of device it is. */
221 name = (char *)get_property(stdout_node, "name", NULL); 220 name = (char *)get_property(stdout_node, "name", NULL);
222 if (!name) { 221 if (!name) {
223 printk(KERN_WARNING "stdout node missing 'name' property!\n"); 222 printk(KERN_WARNING "stdout node missing 'name' property!\n");
224 goto out; 223 goto out;
225 } 224 }
225 /* The user has requested a console so this is already set up. */
226 add_console = !strstr(cmd_line, "console=");
226 227
227 if (strncmp(name, "vty", 3) == 0) { 228 /* Check if it's a virtual terminal */
228 if (device_is_compatible(stdout_node, "hvterm1")) { 229 if (strncmp(name, "vty", 3) != 0)
229 termno = (u32 *)get_property(stdout_node, "reg", NULL); 230 goto out;
230 if (termno) { 231 termno = (u32 *)get_property(stdout_node, "reg", NULL);
231 vtermno = termno[0]; 232 if (termno == NULL)
232 udbg_putc = udbg_putcLP; 233 goto out;
233 udbg_getc = udbg_getcLP; 234 vtermno = termno[0];
234 udbg_getc_poll = udbg_getc_pollLP; 235
235 found = 1; 236 if (device_is_compatible(stdout_node, "hvterm1")) {
236 } 237 udbg_putc = udbg_putcLP;
237 } else if (device_is_compatible(stdout_node, "hvterm-protocol")) { 238 udbg_getc = udbg_getcLP;
238 termno = (u32 *)get_property(stdout_node, "reg", NULL); 239 udbg_getc_poll = udbg_getc_pollLP;
239 if (termno) { 240 if (add_console)
240 vtermno = termno[0]; 241 add_preferred_console("hvc", termno[0] & 0xff, NULL);
241 udbg_putc = udbg_hvsi_putc; 242 } else if (device_is_compatible(stdout_node, "hvterm-protocol")) {
242 udbg_getc = udbg_hvsi_getc; 243 vtermno = termno[0];
243 udbg_getc_poll = udbg_hvsi_getc_poll; 244 udbg_putc = udbg_hvsi_putc;
244 found = 1; 245 udbg_getc = udbg_hvsi_getc;
245 } 246 udbg_getc_poll = udbg_hvsi_getc_poll;
246 } 247 if (add_console)
247 } else if (strncmp(name, "serial", 6)) { 248 add_preferred_console("hvsi", termno[0] & 0xff, NULL);
248 /* XXX fix ISA serial console */
249 printk(KERN_WARNING "serial stdout on LPAR ('%s')! "
250 "can't print udbg messages\n",
251 stdout_node->full_name);
252 } else {
253 printk(KERN_WARNING "don't know how to print to stdout '%s'\n",
254 stdout_node->full_name);
255 } 249 }
256
257out: 250out:
258 of_node_put(stdout_node); 251 of_node_put(stdout_node);
259 return found;
260} 252}
261 253
262void vpa_init(int cpu) 254void vpa_init(int cpu)
263{ 255{
264 int hwcpu = get_hard_smp_processor_id(cpu); 256 int hwcpu = get_hard_smp_processor_id(cpu);
265 unsigned long vpa = __pa(&paca[cpu].lppaca); 257 unsigned long vpa = __pa(&lppaca[cpu]);
266 long ret; 258 long ret;
267 259
268 if (cpu_has_feature(CPU_FTR_ALTIVEC)) 260 if (cpu_has_feature(CPU_FTR_ALTIVEC))
269 paca[cpu].lppaca.vmxregs_in_use = 1; 261 lppaca[cpu].vmxregs_in_use = 1;
270 262
271 ret = register_vpa(hwcpu, vpa); 263 ret = register_vpa(hwcpu, vpa);
272 264
@@ -298,18 +290,6 @@ long pSeries_lpar_hpte_insert(unsigned long hpte_group,
298 if (!(vflags & HPTE_V_BOLTED)) 290 if (!(vflags & HPTE_V_BOLTED))
299 DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r); 291 DBG_LOW(" hpte_v=%016lx, hpte_r=%016lx\n", hpte_v, hpte_r);
300 292
301#if 1
302 {
303 int i;
304 for (i=0;i<8;i++) {
305 unsigned long w0, w1;
306 plpar_pte_read(0, hpte_group, &w0, &w1);
307 BUG_ON (HPTE_V_COMPARE(hpte_v, w0)
308 && (w0 & HPTE_V_VALID));
309 }
310 }
311#endif
312
313 /* Now fill in the actual HPTE */ 293 /* Now fill in the actual HPTE */
314 /* Set CEC cookie to 0 */ 294 /* Set CEC cookie to 0 */
315 /* Zero page = 0 */ 295 /* Zero page = 0 */
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
new file mode 100644
index 000000000000..21934784f936
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -0,0 +1,174 @@
1/*
2 * PCI Dynamic LPAR, PCI Hot Plug and PCI EEH recovery code
3 * for RPA-compliant PPC64 platform.
4 * Copyright (C) 2003 Linda Xie <lxie@us.ibm.com>
5 * Copyright (C) 2005 International Business Machines
6 *
7 * Updates, 2005, John Rose <johnrose@austin.ibm.com>
8 * Updates, 2005, Linas Vepstas <linas@austin.ibm.com>
9 *
10 * All rights reserved.
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 as published by
14 * the Free Software Foundation; either version 2 of the License, or (at
15 * your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
20 * NON INFRINGEMENT. See the GNU General Public License for more
21 * details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#include <linux/pci.h>
29#include <asm/pci-bridge.h>
30
31static struct pci_bus *
32find_bus_among_children(struct pci_bus *bus,
33 struct device_node *dn)
34{
35 struct pci_bus *child = NULL;
36 struct list_head *tmp;
37 struct device_node *busdn;
38
39 busdn = pci_bus_to_OF_node(bus);
40 if (busdn == dn)
41 return bus;
42
43 list_for_each(tmp, &bus->children) {
44 child = find_bus_among_children(pci_bus_b(tmp), dn);
45 if (child)
46 break;
47 };
48 return child;
49}
50
51struct pci_bus *
52pcibios_find_pci_bus(struct device_node *dn)
53{
54 struct pci_dn *pdn = dn->data;
55
56 if (!pdn || !pdn->phb || !pdn->phb->bus)
57 return NULL;
58
59 return find_bus_among_children(pdn->phb->bus, dn);
60}
61
62/**
63 * pcibios_remove_pci_devices - remove all devices under this bus
64 *
65 * Remove all of the PCI devices under this bus both from the
66 * linux pci device tree, and from the powerpc EEH address cache.
67 */
68void
69pcibios_remove_pci_devices(struct pci_bus *bus)
70{
71 struct pci_dev *dev, *tmp;
72
73 list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
74 eeh_remove_bus_device(dev);
75 pci_remove_bus_device(dev);
76 }
77}
78
79/* Must be called before pci_bus_add_devices */
80void
81pcibios_fixup_new_pci_devices(struct pci_bus *bus, int fix_bus)
82{
83 struct pci_dev *dev;
84
85 list_for_each_entry(dev, &bus->devices, bus_list) {
86 /*
87 * Skip already-present devices (which are on the
88 * global device list.)
89 */
90 if (list_empty(&dev->global_list)) {
91 int i;
92
93 /* Need to setup IOMMU tables */
94 ppc_md.iommu_dev_setup(dev);
95
96 if(fix_bus)
97 pcibios_fixup_device_resources(dev, bus);
98 pci_read_irq_line(dev);
99 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
100 struct resource *r = &dev->resource[i];
101
102 if (r->parent || !r->start || !r->flags)
103 continue;
104 pci_claim_resource(dev, i);
105 }
106 }
107 }
108}
109
110static int
111pcibios_pci_config_bridge(struct pci_dev *dev)
112{
113 u8 sec_busno;
114 struct pci_bus *child_bus;
115 struct pci_dev *child_dev;
116
117 /* Get busno of downstream bus */
118 pci_read_config_byte(dev, PCI_SECONDARY_BUS, &sec_busno);
119
120 /* Add to children of PCI bridge dev->bus */
121 child_bus = pci_add_new_bus(dev->bus, dev, sec_busno);
122 if (!child_bus) {
123 printk (KERN_ERR "%s: could not add second bus\n", __FUNCTION__);
124 return -EIO;
125 }
126 sprintf(child_bus->name, "PCI Bus #%02x", child_bus->number);
127
128 pci_scan_child_bus(child_bus);
129
130 list_for_each_entry(child_dev, &child_bus->devices, bus_list) {
131 eeh_add_device_late(child_dev);
132 }
133
134 /* Fixup new pci devices without touching bus struct */
135 pcibios_fixup_new_pci_devices(child_bus, 0);
136
137 /* Make the discovered devices available */
138 pci_bus_add_devices(child_bus);
139 return 0;
140}
141
142/**
143 * pcibios_add_pci_devices - adds new pci devices to bus
144 *
145 * This routine will find and fixup new pci devices under
146 * the indicated bus. This routine presumes that there
147 * might already be some devices under this bridge, so
148 * it carefully tries to add only new devices. (And that
149 * is how this routine differs from other, similar pcibios
150 * routines.)
151 */
152void
153pcibios_add_pci_devices(struct pci_bus * bus)
154{
155 int slotno, num;
156 struct pci_dev *dev;
157 struct device_node *dn = pci_bus_to_OF_node(bus);
158
159 eeh_add_device_tree_early(dn);
160
161 /* pci_scan_slot should find all children */
162 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
163 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
164 if (num) {
165 pcibios_fixup_new_pci_devices(bus, 1);
166 pci_bus_add_devices(bus);
167 }
168
169 list_for_each_entry(dev, &bus->devices, bus_list) {
170 eeh_add_device_late (dev);
171 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE)
172 pcibios_pci_config_bridge(dev);
173 }
174}
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index fbd214d68b07..b046bcf7443d 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -49,14 +49,14 @@
49#include <asm/machdep.h> 49#include <asm/machdep.h>
50#include <asm/rtas.h> 50#include <asm/rtas.h>
51#include <asm/udbg.h> 51#include <asm/udbg.h>
52#include <asm/firmware.h>
53
54#include "ras.h"
52 55
53static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX]; 56static unsigned char ras_log_buf[RTAS_ERROR_LOG_MAX];
54static DEFINE_SPINLOCK(ras_log_buf_lock); 57static DEFINE_SPINLOCK(ras_log_buf_lock);
55 58
56char mce_data_buf[RTAS_ERROR_LOG_MAX] 59char mce_data_buf[RTAS_ERROR_LOG_MAX];
57;
58/* This is true if we are using the firmware NMI handler (typically LPAR) */
59extern int fwnmi_active;
60 60
61static int ras_get_sensor_state_token; 61static int ras_get_sensor_state_token;
62static int ras_check_exception_token; 62static int ras_check_exception_token;
@@ -280,7 +280,7 @@ static void fwnmi_release_errinfo(void)
280 printk("FWNMI: nmi-interlock failed: %d\n", ret); 280 printk("FWNMI: nmi-interlock failed: %d\n", ret);
281} 281}
282 282
283void pSeries_system_reset_exception(struct pt_regs *regs) 283int pSeries_system_reset_exception(struct pt_regs *regs)
284{ 284{
285 if (fwnmi_active) { 285 if (fwnmi_active) {
286 struct rtas_error_log *errhdr = fwnmi_get_errinfo(regs); 286 struct rtas_error_log *errhdr = fwnmi_get_errinfo(regs);
@@ -289,6 +289,7 @@ void pSeries_system_reset_exception(struct pt_regs *regs)
289 } 289 }
290 fwnmi_release_errinfo(); 290 fwnmi_release_errinfo();
291 } 291 }
292 return 0; /* need to perform reset */
292} 293}
293 294
294/* 295/*
diff --git a/arch/powerpc/platforms/pseries/ras.h b/arch/powerpc/platforms/pseries/ras.h
new file mode 100644
index 000000000000..0e66b0da55e2
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/ras.h
@@ -0,0 +1,9 @@
1#ifndef _PSERIES_RAS_H
2#define _PSERIES_RAS_H
3
4struct pt_regs;
5
6extern int pSeries_system_reset_exception(struct pt_regs *regs);
7extern int pSeries_machine_check_exception(struct pt_regs *regs);
8
9#endif /* _PSERIES_RAS_H */
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index d8864164dbe8..86cfa6ecdcf3 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -350,6 +350,100 @@ static int do_remove_node(char *buf)
350 return rv; 350 return rv;
351} 351}
352 352
353static char *parse_node(char *buf, size_t bufsize, struct device_node **npp)
354{
355 char *handle_str;
356 phandle handle;
357 *npp = NULL;
358
359 handle_str = buf;
360
361 buf = strchr(buf, ' ');
362 if (!buf)
363 return NULL;
364 *buf = '\0';
365 buf++;
366
367 handle = simple_strtoul(handle_str, NULL, 10);
368
369 *npp = of_find_node_by_phandle(handle);
370 return buf;
371}
372
373static int do_add_property(char *buf, size_t bufsize)
374{
375 struct property *prop = NULL;
376 struct device_node *np;
377 unsigned char *value;
378 char *name, *end;
379 int length;
380 end = buf + bufsize;
381 buf = parse_node(buf, bufsize, &np);
382
383 if (!np)
384 return -ENODEV;
385
386 if (parse_next_property(buf, end, &name, &length, &value) == NULL)
387 return -EINVAL;
388
389 prop = new_property(name, length, value, NULL);
390 if (!prop)
391 return -ENOMEM;
392
393 prom_add_property(np, prop);
394
395 return 0;
396}
397
398static int do_remove_property(char *buf, size_t bufsize)
399{
400 struct device_node *np;
401 char *tmp;
402 struct property *prop;
403 buf = parse_node(buf, bufsize, &np);
404
405 if (!np)
406 return -ENODEV;
407
408 tmp = strchr(buf,' ');
409 if (tmp)
410 *tmp = '\0';
411
412 if (strlen(buf) == 0)
413 return -EINVAL;
414
415 prop = of_find_property(np, buf, NULL);
416
417 return prom_remove_property(np, prop);
418}
419
420static int do_update_property(char *buf, size_t bufsize)
421{
422 struct device_node *np;
423 unsigned char *value;
424 char *name, *end;
425 int length;
426 struct property *newprop, *oldprop;
427 buf = parse_node(buf, bufsize, &np);
428 end = buf + bufsize;
429
430 if (!np)
431 return -ENODEV;
432
433 if (parse_next_property(buf, end, &name, &length, &value) == NULL)
434 return -EINVAL;
435
436 newprop = new_property(name, length, value, NULL);
437 if (!newprop)
438 return -ENOMEM;
439
440 oldprop = of_find_property(np, name,NULL);
441 if (!oldprop)
442 return -ENODEV;
443
444 return prom_update_property(np, newprop, oldprop);
445}
446
353/** 447/**
354 * ofdt_write - perform operations on the Open Firmware device tree 448 * ofdt_write - perform operations on the Open Firmware device tree
355 * 449 *
@@ -392,6 +486,12 @@ static ssize_t ofdt_write(struct file *file, const char __user *buf, size_t coun
392 rv = do_add_node(tmp, count - (tmp - kbuf)); 486 rv = do_add_node(tmp, count - (tmp - kbuf));
393 else if (!strcmp(kbuf, "remove_node")) 487 else if (!strcmp(kbuf, "remove_node"))
394 rv = do_remove_node(tmp); 488 rv = do_remove_node(tmp);
489 else if (!strcmp(kbuf, "add_property"))
490 rv = do_add_property(tmp, count - (tmp - kbuf));
491 else if (!strcmp(kbuf, "remove_property"))
492 rv = do_remove_property(tmp, count - (tmp - kbuf));
493 else if (!strcmp(kbuf, "update_property"))
494 rv = do_update_property(tmp, count - (tmp - kbuf));
395 else 495 else
396 rv = -EINVAL; 496 rv = -EINVAL;
397out: 497out:
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c
index 2edc947f7c44..50643496eb63 100644
--- a/arch/powerpc/platforms/pseries/scanlog.c
+++ b/arch/powerpc/platforms/pseries/scanlog.c
@@ -192,7 +192,7 @@ struct file_operations scanlog_fops = {
192 .release = scanlog_release, 192 .release = scanlog_release,
193}; 193};
194 194
195int __init scanlog_init(void) 195static int __init scanlog_init(void)
196{ 196{
197 struct proc_dir_entry *ent; 197 struct proc_dir_entry *ent;
198 198
@@ -222,7 +222,7 @@ int __init scanlog_init(void)
222 return 0; 222 return 0;
223} 223}
224 224
225void __exit scanlog_cleanup(void) 225static void __exit scanlog_cleanup(void)
226{ 226{
227 if (proc_ppc64_scan_log_dump) { 227 if (proc_ppc64_scan_log_dump) {
228 kfree(proc_ppc64_scan_log_dump->data); 228 kfree(proc_ppc64_scan_log_dump->data);
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 4a465f067ede..da6cebaf72cd 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -56,6 +56,7 @@
56#include <asm/dma.h> 56#include <asm/dma.h>
57#include <asm/machdep.h> 57#include <asm/machdep.h>
58#include <asm/irq.h> 58#include <asm/irq.h>
59#include <asm/kexec.h>
59#include <asm/time.h> 60#include <asm/time.h>
60#include <asm/nvram.h> 61#include <asm/nvram.h>
61#include "xics.h" 62#include "xics.h"
@@ -68,6 +69,7 @@
68#include <asm/smp.h> 69#include <asm/smp.h>
69 70
70#include "plpar_wrappers.h" 71#include "plpar_wrappers.h"
72#include "ras.h"
71 73
72#ifdef DEBUG 74#ifdef DEBUG
73#define DBG(fmt...) udbg_printf(fmt) 75#define DBG(fmt...) udbg_printf(fmt)
@@ -76,22 +78,15 @@
76#endif 78#endif
77 79
78extern void find_udbg_vterm(void); 80extern void find_udbg_vterm(void);
79extern void system_reset_fwnmi(void); /* from head.S */
80extern void machine_check_fwnmi(void); /* from head.S */
81extern void generic_find_legacy_serial_ports(u64 *physport,
82 unsigned int *default_speed);
83 81
84int fwnmi_active; /* TRUE if an FWNMI handler is present */ 82int fwnmi_active; /* TRUE if an FWNMI handler is present */
85 83
86extern void pSeries_system_reset_exception(struct pt_regs *regs);
87extern int pSeries_machine_check_exception(struct pt_regs *regs);
88
89static void pseries_shared_idle(void); 84static void pseries_shared_idle(void);
90static void pseries_dedicated_idle(void); 85static void pseries_dedicated_idle(void);
91 86
92struct mpic *pSeries_mpic; 87struct mpic *pSeries_mpic;
93 88
94void pSeries_show_cpuinfo(struct seq_file *m) 89static void pSeries_show_cpuinfo(struct seq_file *m)
95{ 90{
96 struct device_node *root; 91 struct device_node *root;
97 const char *model = ""; 92 const char *model = "";
@@ -105,18 +100,22 @@ void pSeries_show_cpuinfo(struct seq_file *m)
105 100
106/* Initialize firmware assisted non-maskable interrupts if 101/* Initialize firmware assisted non-maskable interrupts if
107 * the firmware supports this feature. 102 * the firmware supports this feature.
108 *
109 */ 103 */
110static void __init fwnmi_init(void) 104static void __init fwnmi_init(void)
111{ 105{
112 int ret; 106 unsigned long system_reset_addr, machine_check_addr;
107
113 int ibm_nmi_register = rtas_token("ibm,nmi-register"); 108 int ibm_nmi_register = rtas_token("ibm,nmi-register");
114 if (ibm_nmi_register == RTAS_UNKNOWN_SERVICE) 109 if (ibm_nmi_register == RTAS_UNKNOWN_SERVICE)
115 return; 110 return;
116 ret = rtas_call(ibm_nmi_register, 2, 1, NULL, 111
117 __pa((unsigned long)system_reset_fwnmi), 112 /* If the kernel's not linked at zero we point the firmware at low
118 __pa((unsigned long)machine_check_fwnmi)); 113 * addresses anyway, and use a trampoline to get to the real code. */
119 if (ret == 0) 114 system_reset_addr = __pa(system_reset_fwnmi) - PHYSICAL_START;
115 machine_check_addr = __pa(machine_check_fwnmi) - PHYSICAL_START;
116
117 if (0 == rtas_call(ibm_nmi_register, 2, 1, NULL, system_reset_addr,
118 machine_check_addr))
120 fwnmi_active = 1; 119 fwnmi_active = 1;
121} 120}
122 121
@@ -191,7 +190,7 @@ static void pseries_lpar_enable_pmcs(void)
191 190
192 /* instruct hypervisor to maintain PMCs */ 191 /* instruct hypervisor to maintain PMCs */
193 if (firmware_has_feature(FW_FEATURE_SPLPAR)) 192 if (firmware_has_feature(FW_FEATURE_SPLPAR))
194 get_paca()->lppaca.pmcregs_in_use = 1; 193 get_lppaca()->pmcregs_in_use = 1;
195} 194}
196 195
197static void __init pSeries_setup_arch(void) 196static void __init pSeries_setup_arch(void)
@@ -235,7 +234,7 @@ static void __init pSeries_setup_arch(void)
235 /* Choose an idle loop */ 234 /* Choose an idle loop */
236 if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 235 if (firmware_has_feature(FW_FEATURE_SPLPAR)) {
237 vpa_init(boot_cpuid); 236 vpa_init(boot_cpuid);
238 if (get_paca()->lppaca.shared_proc) { 237 if (get_lppaca()->shared_proc) {
239 printk(KERN_INFO "Using shared processor idle loop\n"); 238 printk(KERN_INFO "Using shared processor idle loop\n");
240 ppc_md.idle_loop = pseries_shared_idle; 239 ppc_md.idle_loop = pseries_shared_idle;
241 } else { 240 } else {
@@ -323,15 +322,18 @@ static void __init pSeries_discover_pic(void)
323 ppc64_interrupt_controller = IC_INVALID; 322 ppc64_interrupt_controller = IC_INVALID;
324 for (np = NULL; (np = of_find_node_by_name(np, "interrupt-controller"));) { 323 for (np = NULL; (np = of_find_node_by_name(np, "interrupt-controller"));) {
325 typep = (char *)get_property(np, "compatible", NULL); 324 typep = (char *)get_property(np, "compatible", NULL);
326 if (strstr(typep, "open-pic")) 325 if (strstr(typep, "open-pic")) {
327 ppc64_interrupt_controller = IC_OPEN_PIC; 326 ppc64_interrupt_controller = IC_OPEN_PIC;
328 else if (strstr(typep, "ppc-xicp")) 327 break;
328 } else if (strstr(typep, "ppc-xicp")) {
329 ppc64_interrupt_controller = IC_PPC_XIC; 329 ppc64_interrupt_controller = IC_PPC_XIC;
330 else 330 break;
331 printk("pSeries_discover_pic: failed to recognize" 331 }
332 " interrupt-controller\n");
333 break;
334 } 332 }
333 if (ppc64_interrupt_controller == IC_INVALID)
334 printk("pSeries_discover_pic: failed to recognize"
335 " interrupt-controller\n");
336
335} 337}
336 338
337static void pSeries_mach_cpu_die(void) 339static void pSeries_mach_cpu_die(void)
@@ -365,10 +367,7 @@ static int pseries_set_xdabr(unsigned long dabr)
365 */ 367 */
366static void __init pSeries_init_early(void) 368static void __init pSeries_init_early(void)
367{ 369{
368 void *comport;
369 int iommu_off = 0; 370 int iommu_off = 0;
370 unsigned int default_speed;
371 u64 physport;
372 371
373 DBG(" -> pSeries_init_early()\n"); 372 DBG(" -> pSeries_init_early()\n");
374 373
@@ -382,17 +381,8 @@ static void __init pSeries_init_early(void)
382 get_property(of_chosen, "linux,iommu-off", NULL)); 381 get_property(of_chosen, "linux,iommu-off", NULL));
383 } 382 }
384 383
385 generic_find_legacy_serial_ports(&physport, &default_speed);
386
387 if (platform_is_lpar()) 384 if (platform_is_lpar())
388 find_udbg_vterm(); 385 find_udbg_vterm();
389 else if (physport) {
390 /* Map the uart for udbg. */
391 comport = (void *)ioremap(physport, 16);
392 udbg_init_uart(comport, default_speed);
393
394 DBG("Hello World !\n");
395 }
396 386
397 if (firmware_has_feature(FW_FEATURE_DABR)) 387 if (firmware_has_feature(FW_FEATURE_DABR))
398 ppc_md.set_dabr = pseries_set_dabr; 388 ppc_md.set_dabr = pseries_set_dabr;
@@ -454,10 +444,10 @@ DECLARE_PER_CPU(unsigned long, smt_snooze_delay);
454 444
455static inline void dedicated_idle_sleep(unsigned int cpu) 445static inline void dedicated_idle_sleep(unsigned int cpu)
456{ 446{
457 struct paca_struct *ppaca = &paca[cpu ^ 1]; 447 struct lppaca *plppaca = &lppaca[cpu ^ 1];
458 448
459 /* Only sleep if the other thread is not idle */ 449 /* Only sleep if the other thread is not idle */
460 if (!(ppaca->lppaca.idle)) { 450 if (!(plppaca->idle)) {
461 local_irq_disable(); 451 local_irq_disable();
462 452
463 /* 453 /*
@@ -490,7 +480,6 @@ static inline void dedicated_idle_sleep(unsigned int cpu)
490 480
491static void pseries_dedicated_idle(void) 481static void pseries_dedicated_idle(void)
492{ 482{
493 struct paca_struct *lpaca = get_paca();
494 unsigned int cpu = smp_processor_id(); 483 unsigned int cpu = smp_processor_id();
495 unsigned long start_snooze; 484 unsigned long start_snooze;
496 unsigned long *smt_snooze_delay = &__get_cpu_var(smt_snooze_delay); 485 unsigned long *smt_snooze_delay = &__get_cpu_var(smt_snooze_delay);
@@ -501,7 +490,7 @@ static void pseries_dedicated_idle(void)
501 * Indicate to the HV that we are idle. Now would be 490 * Indicate to the HV that we are idle. Now would be
502 * a good time to find other work to dispatch. 491 * a good time to find other work to dispatch.
503 */ 492 */
504 lpaca->lppaca.idle = 1; 493 get_lppaca()->idle = 1;
505 494
506 if (!need_resched()) { 495 if (!need_resched()) {
507 start_snooze = get_tb() + 496 start_snooze = get_tb() +
@@ -528,7 +517,7 @@ static void pseries_dedicated_idle(void)
528 HMT_medium(); 517 HMT_medium();
529 } 518 }
530 519
531 lpaca->lppaca.idle = 0; 520 get_lppaca()->idle = 0;
532 ppc64_runlatch_on(); 521 ppc64_runlatch_on();
533 522
534 preempt_enable_no_resched(); 523 preempt_enable_no_resched();
@@ -542,7 +531,6 @@ static void pseries_dedicated_idle(void)
542 531
543static void pseries_shared_idle(void) 532static void pseries_shared_idle(void)
544{ 533{
545 struct paca_struct *lpaca = get_paca();
546 unsigned int cpu = smp_processor_id(); 534 unsigned int cpu = smp_processor_id();
547 535
548 while (1) { 536 while (1) {
@@ -550,7 +538,7 @@ static void pseries_shared_idle(void)
550 * Indicate to the HV that we are idle. Now would be 538 * Indicate to the HV that we are idle. Now would be
551 * a good time to find other work to dispatch. 539 * a good time to find other work to dispatch.
552 */ 540 */
553 lpaca->lppaca.idle = 1; 541 get_lppaca()->idle = 1;
554 542
555 while (!need_resched() && !cpu_is_offline(cpu)) { 543 while (!need_resched() && !cpu_is_offline(cpu)) {
556 local_irq_disable(); 544 local_irq_disable();
@@ -574,7 +562,7 @@ static void pseries_shared_idle(void)
574 HMT_medium(); 562 HMT_medium();
575 } 563 }
576 564
577 lpaca->lppaca.idle = 0; 565 get_lppaca()->idle = 0;
578 ppc64_runlatch_on(); 566 ppc64_runlatch_on();
579 567
580 preempt_enable_no_resched(); 568 preempt_enable_no_resched();
@@ -598,7 +586,7 @@ static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
598{ 586{
599 /* Don't risk a hypervisor call if we're crashing */ 587 /* Don't risk a hypervisor call if we're crashing */
600 if (!crash_shutdown) { 588 if (!crash_shutdown) {
601 unsigned long vpa = __pa(&get_paca()->lppaca); 589 unsigned long vpa = __pa(get_lppaca());
602 590
603 if (unregister_vpa(hard_smp_processor_id(), vpa)) { 591 if (unregister_vpa(hard_smp_processor_id(), vpa)) {
604 printk("VPA deregistration of cpu %u (hw_cpu_id %d) " 592 printk("VPA deregistration of cpu %u (hw_cpu_id %d) "
@@ -638,5 +626,8 @@ struct machdep_calls __initdata pSeries_md = {
638 .machine_check_exception = pSeries_machine_check_exception, 626 .machine_check_exception = pSeries_machine_check_exception,
639#ifdef CONFIG_KEXEC 627#ifdef CONFIG_KEXEC
640 .kexec_cpu_down = pseries_kexec_cpu_down, 628 .kexec_cpu_down = pseries_kexec_cpu_down,
629 .machine_kexec = default_machine_kexec,
630 .machine_kexec_prepare = default_machine_kexec_prepare,
631 .machine_crash_shutdown = default_machine_crash_shutdown,
641#endif 632#endif
642}; 633};
diff --git a/arch/powerpc/platforms/pseries/smp.c b/arch/powerpc/platforms/pseries/smp.c
index 25181c594d73..8e6b1ed1396e 100644
--- a/arch/powerpc/platforms/pseries/smp.c
+++ b/arch/powerpc/platforms/pseries/smp.c
@@ -93,7 +93,7 @@ static int query_cpu_stopped(unsigned int pcpu)
93 return cpu_status; 93 return cpu_status;
94} 94}
95 95
96int pSeries_cpu_disable(void) 96static int pSeries_cpu_disable(void)
97{ 97{
98 int cpu = smp_processor_id(); 98 int cpu = smp_processor_id();
99 99
@@ -109,7 +109,7 @@ int pSeries_cpu_disable(void)
109 return 0; 109 return 0;
110} 110}
111 111
112void pSeries_cpu_die(unsigned int cpu) 112static void pSeries_cpu_die(unsigned int cpu)
113{ 113{
114 int tries; 114 int tries;
115 int cpu_status; 115 int cpu_status;
@@ -282,7 +282,7 @@ static inline int __devinit smp_startup_cpu(unsigned int lcpu)
282 pcpu = get_hard_smp_processor_id(lcpu); 282 pcpu = get_hard_smp_processor_id(lcpu);
283 283
284 /* Fixup atomic count: it exited inside IRQ handler. */ 284 /* Fixup atomic count: it exited inside IRQ handler. */
285 paca[lcpu].__current->thread_info->preempt_count = 0; 285 task_thread_info(paca[lcpu].__current)->preempt_count = 0;
286 286
287 /* 287 /*
288 * If the RTAS start-cpu token does not exist then presume the 288 * If the RTAS start-cpu token does not exist then presume the
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index 72ac18067ece..fd823c7c9ac8 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -48,11 +48,6 @@ static struct hw_interrupt_type xics_pic = {
48 .set_affinity = xics_set_affinity 48 .set_affinity = xics_set_affinity
49}; 49};
50 50
51static struct hw_interrupt_type xics_8259_pic = {
52 .typename = " XICS/8259",
53 .ack = xics_mask_and_ack_irq,
54};
55
56/* This is used to map real irq numbers to virtual */ 51/* This is used to map real irq numbers to virtual */
57static struct radix_tree_root irq_map = RADIX_TREE_INIT(GFP_ATOMIC); 52static struct radix_tree_root irq_map = RADIX_TREE_INIT(GFP_ATOMIC);
58 53
@@ -367,12 +362,7 @@ int xics_get_irq(struct pt_regs *regs)
367 /* for sanity, this had better be < NR_IRQS - 16 */ 362 /* for sanity, this had better be < NR_IRQS - 16 */
368 if (vec == xics_irq_8259_cascade_real) { 363 if (vec == xics_irq_8259_cascade_real) {
369 irq = i8259_irq(regs); 364 irq = i8259_irq(regs);
370 if (irq == -1) { 365 xics_end_irq(irq_offset_up(xics_irq_8259_cascade));
371 /* Spurious cascaded interrupt. Still must ack xics */
372 xics_end_irq(irq_offset_up(xics_irq_8259_cascade));
373
374 irq = -1;
375 }
376 } else if (vec == XICS_IRQ_SPURIOUS) { 366 } else if (vec == XICS_IRQ_SPURIOUS) {
377 irq = -1; 367 irq = -1;
378 } else { 368 } else {
@@ -391,7 +381,7 @@ int xics_get_irq(struct pt_regs *regs)
391 381
392#ifdef CONFIG_SMP 382#ifdef CONFIG_SMP
393 383
394irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs) 384static irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
395{ 385{
396 int cpu = smp_processor_id(); 386 int cpu = smp_processor_id();
397 387
@@ -417,7 +407,7 @@ irqreturn_t xics_ipi_action(int irq, void *dev_id, struct pt_regs *regs)
417 smp_message_recv(PPC_MSG_MIGRATE_TASK, regs); 407 smp_message_recv(PPC_MSG_MIGRATE_TASK, regs);
418 } 408 }
419#endif 409#endif
420#ifdef CONFIG_DEBUGGER 410#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
421 if (test_and_clear_bit(PPC_MSG_DEBUGGER_BREAK, 411 if (test_and_clear_bit(PPC_MSG_DEBUGGER_BREAK,
422 &xics_ipi_message[cpu].value)) { 412 &xics_ipi_message[cpu].value)) {
423 mb(); 413 mb();
@@ -542,6 +532,7 @@ nextnode:
542 xics_irq_8259_cascade_real = *ireg; 532 xics_irq_8259_cascade_real = *ireg;
543 xics_irq_8259_cascade 533 xics_irq_8259_cascade
544 = virt_irq_create_mapping(xics_irq_8259_cascade_real); 534 = virt_irq_create_mapping(xics_irq_8259_cascade_real);
535 i8259_init(0, 0);
545 of_node_put(np); 536 of_node_put(np);
546 } 537 }
547 538
@@ -565,12 +556,7 @@ nextnode:
565#endif /* CONFIG_SMP */ 556#endif /* CONFIG_SMP */
566 } 557 }
567 558
568 xics_8259_pic.enable = i8259_pic.enable; 559 for (i = irq_offset_value(); i < NR_IRQS; ++i)
569 xics_8259_pic.disable = i8259_pic.disable;
570 xics_8259_pic.end = i8259_pic.end;
571 for (i = 0; i < 16; ++i)
572 get_irq_desc(i)->handler = &xics_8259_pic;
573 for (; i < NR_IRQS; ++i)
574 get_irq_desc(i)->handler = &xics_pic; 560 get_irq_desc(i)->handler = &xics_pic;
575 561
576 xics_setup_cpu(); 562 xics_setup_cpu();
@@ -590,7 +576,6 @@ static int __init xics_setup_i8259(void)
590 no_action, 0, "8259 cascade", NULL)) 576 no_action, 0, "8259 cascade", NULL))
591 printk(KERN_ERR "xics_setup_i8259: couldn't get 8259 " 577 printk(KERN_ERR "xics_setup_i8259: couldn't get 8259 "
592 "cascade\n"); 578 "cascade\n");
593 i8259_init(0, 0);
594 } 579 }
595 return 0; 580 return 0;
596} 581}
diff --git a/arch/powerpc/sysdev/Makefile b/arch/powerpc/sysdev/Makefile
index 6b7efcfc352a..4c2b356774ea 100644
--- a/arch/powerpc/sysdev/Makefile
+++ b/arch/powerpc/sysdev/Makefile
@@ -4,5 +4,7 @@ obj-$(CONFIG_PPC_I8259) += i8259.o
4obj-$(CONFIG_PPC_MPC106) += grackle.o 4obj-$(CONFIG_PPC_MPC106) += grackle.o
5obj-$(CONFIG_BOOKE) += dcr.o 5obj-$(CONFIG_BOOKE) += dcr.o
6obj-$(CONFIG_40x) += dcr.o 6obj-$(CONFIG_40x) += dcr.o
7obj-$(CONFIG_U3_DART) += u3_iommu.o 7obj-$(CONFIG_U3_DART) += dart_iommu.o
8obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o 8obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o
9obj-$(CONFIG_PPC_83xx) += ipic.o
10obj-$(CONFIG_FSL_SOC) += fsl_soc.o
diff --git a/arch/powerpc/sysdev/dart.h b/arch/powerpc/sysdev/dart.h
index 33ed9ed7fc1e..c2d05763ccbe 100644
--- a/arch/powerpc/sysdev/dart.h
+++ b/arch/powerpc/sysdev/dart.h
@@ -20,29 +20,44 @@
20#define _POWERPC_SYSDEV_DART_H 20#define _POWERPC_SYSDEV_DART_H
21 21
22 22
23/* physical base of DART registers */
24#define DART_BASE 0xf8033000UL
25
26/* Offset from base to control register */ 23/* Offset from base to control register */
27#define DARTCNTL 0 24#define DART_CNTL 0
25
28/* Offset from base to exception register */ 26/* Offset from base to exception register */
29#define DARTEXCP 0x10 27#define DART_EXCP_U3 0x10
30/* Offset from base to TLB tag registers */ 28/* Offset from base to TLB tag registers */
31#define DARTTAG 0x1000 29#define DART_TAGS_U3 0x1000
32 30
31/* U4 registers */
32#define DART_BASE_U4 0x10
33#define DART_SIZE_U4 0x20
34#define DART_EXCP_U4 0x30
35#define DART_TAGS_U4 0x1000
33 36
34/* Control Register fields */ 37/* Control Register fields */
35 38
36/* base address of table (pfn) */ 39/* U3 registers */
37#define DARTCNTL_BASE_MASK 0xfffff 40#define DART_CNTL_U3_BASE_MASK 0xfffff
38#define DARTCNTL_BASE_SHIFT 12 41#define DART_CNTL_U3_BASE_SHIFT 12
42#define DART_CNTL_U3_FLUSHTLB 0x400
43#define DART_CNTL_U3_ENABLE 0x200
44#define DART_CNTL_U3_SIZE_MASK 0x1ff
45#define DART_CNTL_U3_SIZE_SHIFT 0
46
47/* U4 registers */
48#define DART_BASE_U4_BASE_MASK 0xffffff
49#define DART_BASE_U4_BASE_SHIFT 0
50#define DART_CNTL_U4_FLUSHTLB 0x20000000
51#define DART_CNTL_U4_ENABLE 0x80000000
52#define DART_SIZE_U4_SIZE_MASK 0x1fff
53#define DART_SIZE_U4_SIZE_SHIFT 0
54
55#define DART_REG(r) (dart + ((r) >> 2))
56#define DART_IN(r) (in_be32(DART_REG(r)))
57#define DART_OUT(r,v) (out_be32(DART_REG(r), (v)))
39 58
40#define DARTCNTL_FLUSHTLB 0x400
41#define DARTCNTL_ENABLE 0x200
42 59
43/* size of table in pages */ 60/* size of table in pages */
44#define DARTCNTL_SIZE_MASK 0x1ff
45#define DARTCNTL_SIZE_SHIFT 0
46 61
47 62
48/* DART table fields */ 63/* DART table fields */
diff --git a/arch/powerpc/sysdev/u3_iommu.c b/arch/powerpc/sysdev/dart_iommu.c
index 5c1a26a6d00c..977de9db8754 100644
--- a/arch/powerpc/sysdev/u3_iommu.c
+++ b/arch/powerpc/sysdev/dart_iommu.c
@@ -1,25 +1,27 @@
1/* 1/*
2 * arch/powerpc/sysdev/u3_iommu.c 2 * arch/powerpc/sysdev/dart_iommu.c
3 * 3 *
4 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation 4 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
5 * Copyright (C) 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>,
6 * IBM Corporation
5 * 7 *
6 * Based on pSeries_iommu.c: 8 * Based on pSeries_iommu.c:
7 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation 9 * Copyright (C) 2001 Mike Corrigan & Dave Engebretsen, IBM Corporation
8 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation 10 * Copyright (C) 2004 Olof Johansson <olof@lixom.net>, IBM Corporation
9 * 11 *
10 * Dynamic DMA mapping support, Apple U3 & IBM CPC925 "DART" iommu. 12 * Dynamic DMA mapping support, Apple U3, U4 & IBM CPC925 "DART" iommu.
13 *
11 * 14 *
12 *
13 * This program is free software; you can redistribute it and/or modify 15 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by 16 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or 17 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version. 18 * (at your option) any later version.
17 * 19 *
18 * This program is distributed in the hope that it will be useful, 20 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details. 23 * GNU General Public License for more details.
22 * 24 *
23 * You should have received a copy of the GNU General Public License 25 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software 26 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
@@ -57,21 +59,22 @@ static unsigned long dart_tablesize;
57static u32 *dart_vbase; 59static u32 *dart_vbase;
58 60
59/* Mapped base address for the dart */ 61/* Mapped base address for the dart */
60static unsigned int *dart; 62static unsigned int *__iomem dart;
61 63
62/* Dummy val that entries are set to when unused */ 64/* Dummy val that entries are set to when unused */
63static unsigned int dart_emptyval; 65static unsigned int dart_emptyval;
64 66
65static struct iommu_table iommu_table_u3; 67static struct iommu_table iommu_table_dart;
66static int iommu_table_u3_inited; 68static int iommu_table_dart_inited;
67static int dart_dirty; 69static int dart_dirty;
70static int dart_is_u4;
68 71
69#define DBG(...) 72#define DBG(...)
70 73
71static inline void dart_tlb_invalidate_all(void) 74static inline void dart_tlb_invalidate_all(void)
72{ 75{
73 unsigned long l = 0; 76 unsigned long l = 0;
74 unsigned int reg; 77 unsigned int reg, inv_bit;
75 unsigned long limit; 78 unsigned long limit;
76 79
77 DBG("dart: flush\n"); 80 DBG("dart: flush\n");
@@ -81,29 +84,28 @@ static inline void dart_tlb_invalidate_all(void)
81 * 84 *
82 * Gotcha: Sometimes, the DART won't detect that the bit gets 85 * Gotcha: Sometimes, the DART won't detect that the bit gets
83 * set. If so, clear it and set it again. 86 * set. If so, clear it and set it again.
84 */ 87 */
85 88
86 limit = 0; 89 limit = 0;
87 90
91 inv_bit = dart_is_u4 ? DART_CNTL_U4_FLUSHTLB : DART_CNTL_U3_FLUSHTLB;
88retry: 92retry:
89 reg = in_be32((unsigned int *)dart+DARTCNTL);
90 reg |= DARTCNTL_FLUSHTLB;
91 out_be32((unsigned int *)dart+DARTCNTL, reg);
92
93 l = 0; 93 l = 0;
94 while ((in_be32((unsigned int *)dart+DARTCNTL) & DARTCNTL_FLUSHTLB) && 94 reg = DART_IN(DART_CNTL);
95 l < (1L<<limit)) { 95 reg |= inv_bit;
96 DART_OUT(DART_CNTL, reg);
97
98 while ((DART_IN(DART_CNTL) & inv_bit) && l < (1L << limit))
96 l++; 99 l++;
97 } 100 if (l == (1L << limit)) {
98 if (l == (1L<<limit)) {
99 if (limit < 4) { 101 if (limit < 4) {
100 limit++; 102 limit++;
101 reg = in_be32((unsigned int *)dart+DARTCNTL); 103 reg = DART_IN(DART_CNTL);
102 reg &= ~DARTCNTL_FLUSHTLB; 104 reg &= ~inv_bit;
103 out_be32((unsigned int *)dart+DARTCNTL, reg); 105 DART_OUT(DART_CNTL, reg);
104 goto retry; 106 goto retry;
105 } else 107 } else
106 panic("U3-DART: TLB did not flush after waiting a long " 108 panic("DART: TLB did not flush after waiting a long "
107 "time. Buggy U3 ?"); 109 "time. Buggy U3 ?");
108 } 110 }
109} 111}
@@ -115,7 +117,7 @@ static void dart_flush(struct iommu_table *tbl)
115 dart_dirty = 0; 117 dart_dirty = 0;
116} 118}
117 119
118static void dart_build(struct iommu_table *tbl, long index, 120static void dart_build(struct iommu_table *tbl, long index,
119 long npages, unsigned long uaddr, 121 long npages, unsigned long uaddr,
120 enum dma_data_direction direction) 122 enum dma_data_direction direction)
121{ 123{
@@ -128,7 +130,7 @@ static void dart_build(struct iommu_table *tbl, long index,
128 npages <<= DART_PAGE_FACTOR; 130 npages <<= DART_PAGE_FACTOR;
129 131
130 dp = ((unsigned int*)tbl->it_base) + index; 132 dp = ((unsigned int*)tbl->it_base) + index;
131 133
132 /* On U3, all memory is contigous, so we can move this 134 /* On U3, all memory is contigous, so we can move this
133 * out of the loop. 135 * out of the loop.
134 */ 136 */
@@ -137,7 +139,6 @@ static void dart_build(struct iommu_table *tbl, long index,
137 139
138 *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK); 140 *(dp++) = DARTMAP_VALID | (rpn & DARTMAP_RPNMASK);
139 141
140 rpn++;
141 uaddr += DART_PAGE_SIZE; 142 uaddr += DART_PAGE_SIZE;
142 } 143 }
143 144
@@ -148,7 +149,7 @@ static void dart_build(struct iommu_table *tbl, long index,
148static void dart_free(struct iommu_table *tbl, long index, long npages) 149static void dart_free(struct iommu_table *tbl, long index, long npages)
149{ 150{
150 unsigned int *dp; 151 unsigned int *dp;
151 152
152 /* We don't worry about flushing the TLB cache. The only drawback of 153 /* We don't worry about flushing the TLB cache. The only drawback of
153 * not doing it is that we won't catch buggy device drivers doing 154 * not doing it is that we won't catch buggy device drivers doing
154 * bad DMAs, but then no 32-bit architecture ever does either. 155 * bad DMAs, but then no 32-bit architecture ever does either.
@@ -160,7 +161,7 @@ static void dart_free(struct iommu_table *tbl, long index, long npages)
160 npages <<= DART_PAGE_FACTOR; 161 npages <<= DART_PAGE_FACTOR;
161 162
162 dp = ((unsigned int *)tbl->it_base) + index; 163 dp = ((unsigned int *)tbl->it_base) + index;
163 164
164 while (npages--) 165 while (npages--)
165 *(dp++) = dart_emptyval; 166 *(dp++) = dart_emptyval;
166} 167}
@@ -168,20 +169,25 @@ static void dart_free(struct iommu_table *tbl, long index, long npages)
168 169
169static int dart_init(struct device_node *dart_node) 170static int dart_init(struct device_node *dart_node)
170{ 171{
171 unsigned int regword;
172 unsigned int i; 172 unsigned int i;
173 unsigned long tmp; 173 unsigned long tmp, base, size;
174 struct resource r;
174 175
175 if (dart_tablebase == 0 || dart_tablesize == 0) { 176 if (dart_tablebase == 0 || dart_tablesize == 0) {
176 printk(KERN_INFO "U3-DART: table not allocated, using direct DMA\n"); 177 printk(KERN_INFO "DART: table not allocated, using "
178 "direct DMA\n");
177 return -ENODEV; 179 return -ENODEV;
178 } 180 }
179 181
182 if (of_address_to_resource(dart_node, 0, &r))
183 panic("DART: can't get register base ! ");
184
180 /* Make sure nothing from the DART range remains in the CPU cache 185 /* Make sure nothing from the DART range remains in the CPU cache
181 * from a previous mapping that existed before the kernel took 186 * from a previous mapping that existed before the kernel took
182 * over 187 * over
183 */ 188 */
184 flush_dcache_phys_range(dart_tablebase, dart_tablebase + dart_tablesize); 189 flush_dcache_phys_range(dart_tablebase,
190 dart_tablebase + dart_tablesize);
185 191
186 /* Allocate a spare page to map all invalid DART pages. We need to do 192 /* Allocate a spare page to map all invalid DART pages. We need to do
187 * that to work around what looks like a problem with the HT bridge 193 * that to work around what looks like a problem with the HT bridge
@@ -189,21 +195,16 @@ static int dart_init(struct device_node *dart_node)
189 */ 195 */
190 tmp = lmb_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE); 196 tmp = lmb_alloc(DART_PAGE_SIZE, DART_PAGE_SIZE);
191 if (!tmp) 197 if (!tmp)
192 panic("U3-DART: Cannot allocate spare page!"); 198 panic("DART: Cannot allocate spare page!");
193 dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) & DARTMAP_RPNMASK); 199 dart_emptyval = DARTMAP_VALID | ((tmp >> DART_PAGE_SHIFT) &
200 DARTMAP_RPNMASK);
194 201
195 /* Map in DART registers. FIXME: Use device node to get base address */ 202 /* Map in DART registers */
196 dart = ioremap(DART_BASE, 0x7000); 203 dart = ioremap(r.start, r.end - r.start + 1);
197 if (dart == NULL) 204 if (dart == NULL)
198 panic("U3-DART: Cannot map registers!"); 205 panic("DART: Cannot map registers!");
199 206
200 /* Set initial control register contents: table base, 207 /* Map in DART table */
201 * table size and enable bit
202 */
203 regword = DARTCNTL_ENABLE |
204 ((dart_tablebase >> DART_PAGE_SHIFT) << DARTCNTL_BASE_SHIFT) |
205 (((dart_tablesize >> DART_PAGE_SHIFT) & DARTCNTL_SIZE_MASK)
206 << DARTCNTL_SIZE_SHIFT);
207 dart_vbase = ioremap(virt_to_abs(dart_tablebase), dart_tablesize); 208 dart_vbase = ioremap(virt_to_abs(dart_tablebase), dart_tablesize);
208 209
209 /* Fill initial table */ 210 /* Fill initial table */
@@ -211,36 +212,50 @@ static int dart_init(struct device_node *dart_node)
211 dart_vbase[i] = dart_emptyval; 212 dart_vbase[i] = dart_emptyval;
212 213
213 /* Initialize DART with table base and enable it. */ 214 /* Initialize DART with table base and enable it. */
214 out_be32((unsigned int *)dart, regword); 215 base = dart_tablebase >> DART_PAGE_SHIFT;
216 size = dart_tablesize >> DART_PAGE_SHIFT;
217 if (dart_is_u4) {
218 size &= DART_SIZE_U4_SIZE_MASK;
219 DART_OUT(DART_BASE_U4, base);
220 DART_OUT(DART_SIZE_U4, size);
221 DART_OUT(DART_CNTL, DART_CNTL_U4_ENABLE);
222 } else {
223 size &= DART_CNTL_U3_SIZE_MASK;
224 DART_OUT(DART_CNTL,
225 DART_CNTL_U3_ENABLE |
226 (base << DART_CNTL_U3_BASE_SHIFT) |
227 (size << DART_CNTL_U3_SIZE_SHIFT));
228 }
215 229
216 /* Invalidate DART to get rid of possible stale TLBs */ 230 /* Invalidate DART to get rid of possible stale TLBs */
217 dart_tlb_invalidate_all(); 231 dart_tlb_invalidate_all();
218 232
219 printk(KERN_INFO "U3/CPC925 DART IOMMU initialized\n"); 233 printk(KERN_INFO "DART IOMMU initialized for %s type chipset\n",
234 dart_is_u4 ? "U4" : "U3");
220 235
221 return 0; 236 return 0;
222} 237}
223 238
224static void iommu_table_u3_setup(void) 239static void iommu_table_dart_setup(void)
225{ 240{
226 iommu_table_u3.it_busno = 0; 241 iommu_table_dart.it_busno = 0;
227 iommu_table_u3.it_offset = 0; 242 iommu_table_dart.it_offset = 0;
228 /* it_size is in number of entries */ 243 /* it_size is in number of entries */
229 iommu_table_u3.it_size = (dart_tablesize / sizeof(u32)) >> DART_PAGE_FACTOR; 244 iommu_table_dart.it_size = (dart_tablesize / sizeof(u32)) >> DART_PAGE_FACTOR;
230 245
231 /* Initialize the common IOMMU code */ 246 /* Initialize the common IOMMU code */
232 iommu_table_u3.it_base = (unsigned long)dart_vbase; 247 iommu_table_dart.it_base = (unsigned long)dart_vbase;
233 iommu_table_u3.it_index = 0; 248 iommu_table_dart.it_index = 0;
234 iommu_table_u3.it_blocksize = 1; 249 iommu_table_dart.it_blocksize = 1;
235 iommu_init_table(&iommu_table_u3); 250 iommu_init_table(&iommu_table_dart);
236 251
237 /* Reserve the last page of the DART to avoid possible prefetch 252 /* Reserve the last page of the DART to avoid possible prefetch
238 * past the DART mapped area 253 * past the DART mapped area
239 */ 254 */
240 set_bit(iommu_table_u3.it_size - 1, iommu_table_u3.it_map); 255 set_bit(iommu_table_dart.it_size - 1, iommu_table_dart.it_map);
241} 256}
242 257
243static void iommu_dev_setup_u3(struct pci_dev *dev) 258static void iommu_dev_setup_dart(struct pci_dev *dev)
244{ 259{
245 struct device_node *dn; 260 struct device_node *dn;
246 261
@@ -254,35 +269,39 @@ static void iommu_dev_setup_u3(struct pci_dev *dev)
254 dn = pci_device_to_OF_node(dev); 269 dn = pci_device_to_OF_node(dev);
255 270
256 if (dn) 271 if (dn)
257 PCI_DN(dn)->iommu_table = &iommu_table_u3; 272 PCI_DN(dn)->iommu_table = &iommu_table_dart;
258} 273}
259 274
260static void iommu_bus_setup_u3(struct pci_bus *bus) 275static void iommu_bus_setup_dart(struct pci_bus *bus)
261{ 276{
262 struct device_node *dn; 277 struct device_node *dn;
263 278
264 if (!iommu_table_u3_inited) { 279 if (!iommu_table_dart_inited) {
265 iommu_table_u3_inited = 1; 280 iommu_table_dart_inited = 1;
266 iommu_table_u3_setup(); 281 iommu_table_dart_setup();
267 } 282 }
268 283
269 dn = pci_bus_to_OF_node(bus); 284 dn = pci_bus_to_OF_node(bus);
270 285
271 if (dn) 286 if (dn)
272 PCI_DN(dn)->iommu_table = &iommu_table_u3; 287 PCI_DN(dn)->iommu_table = &iommu_table_dart;
273} 288}
274 289
275static void iommu_dev_setup_null(struct pci_dev *dev) { } 290static void iommu_dev_setup_null(struct pci_dev *dev) { }
276static void iommu_bus_setup_null(struct pci_bus *bus) { } 291static void iommu_bus_setup_null(struct pci_bus *bus) { }
277 292
278void iommu_init_early_u3(void) 293void iommu_init_early_dart(void)
279{ 294{
280 struct device_node *dn; 295 struct device_node *dn;
281 296
282 /* Find the DART in the device-tree */ 297 /* Find the DART in the device-tree */
283 dn = of_find_compatible_node(NULL, "dart", "u3-dart"); 298 dn = of_find_compatible_node(NULL, "dart", "u3-dart");
284 if (dn == NULL) 299 if (dn == NULL) {
285 return; 300 dn = of_find_compatible_node(NULL, "dart", "u4-dart");
301 if (dn == NULL)
302 goto bail;
303 dart_is_u4 = 1;
304 }
286 305
287 /* Setup low level TCE operations for the core IOMMU code */ 306 /* Setup low level TCE operations for the core IOMMU code */
288 ppc_md.tce_build = dart_build; 307 ppc_md.tce_build = dart_build;
@@ -290,24 +309,27 @@ void iommu_init_early_u3(void)
290 ppc_md.tce_flush = dart_flush; 309 ppc_md.tce_flush = dart_flush;
291 310
292 /* Initialize the DART HW */ 311 /* Initialize the DART HW */
293 if (dart_init(dn)) { 312 if (dart_init(dn) == 0) {
294 /* If init failed, use direct iommu and null setup functions */ 313 ppc_md.iommu_dev_setup = iommu_dev_setup_dart;
295 ppc_md.iommu_dev_setup = iommu_dev_setup_null; 314 ppc_md.iommu_bus_setup = iommu_bus_setup_dart;
296 ppc_md.iommu_bus_setup = iommu_bus_setup_null;
297
298 /* Setup pci_dma ops */
299 pci_direct_iommu_init();
300 } else {
301 ppc_md.iommu_dev_setup = iommu_dev_setup_u3;
302 ppc_md.iommu_bus_setup = iommu_bus_setup_u3;
303 315
304 /* Setup pci_dma ops */ 316 /* Setup pci_dma ops */
305 pci_iommu_init(); 317 pci_iommu_init();
318
319 return;
306 } 320 }
321
322 bail:
323 /* If init failed, use direct iommu and null setup functions */
324 ppc_md.iommu_dev_setup = iommu_dev_setup_null;
325 ppc_md.iommu_bus_setup = iommu_bus_setup_null;
326
327 /* Setup pci_dma ops */
328 pci_direct_iommu_init();
307} 329}
308 330
309 331
310void __init alloc_u3_dart_table(void) 332void __init alloc_dart_table(void)
311{ 333{
312 /* Only reserve DART space if machine has more than 2GB of RAM 334 /* Only reserve DART space if machine has more than 2GB of RAM
313 * or if requested with iommu=on on cmdline. 335 * or if requested with iommu=on on cmdline.
@@ -323,5 +345,5 @@ void __init alloc_u3_dart_table(void)
323 dart_tablebase = (unsigned long) 345 dart_tablebase = (unsigned long)
324 abs_to_virt(lmb_alloc_base(1UL<<24, 1UL<<24, 0x80000000L)); 346 abs_to_virt(lmb_alloc_base(1UL<<24, 1UL<<24, 0x80000000L));
325 347
326 printk(KERN_INFO "U3-DART allocated at: %lx\n", dart_tablebase); 348 printk(KERN_INFO "DART table allocated at: %lx\n", dart_tablebase);
327} 349}
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
new file mode 100644
index 000000000000..064c9de47732
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -0,0 +1,317 @@
1/*
2 * FSL SoC setup code
3 *
4 * Maintained by Kumar Gala (see MAINTAINERS for contact information)
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <linux/config.h>
13#include <linux/stddef.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/errno.h>
17#include <linux/major.h>
18#include <linux/delay.h>
19#include <linux/irq.h>
20#include <linux/module.h>
21#include <linux/device.h>
22#include <linux/platform_device.h>
23#include <linux/fsl_devices.h>
24
25#include <asm/system.h>
26#include <asm/atomic.h>
27#include <asm/io.h>
28#include <asm/irq.h>
29#include <asm/prom.h>
30#include <sysdev/fsl_soc.h>
31#include <mm/mmu_decl.h>
32
33static phys_addr_t immrbase = -1;
34
35phys_addr_t get_immrbase(void)
36{
37 struct device_node *soc;
38
39 if (immrbase != -1)
40 return immrbase;
41
42 soc = of_find_node_by_type(NULL, "soc");
43 if (soc != 0) {
44 unsigned int size;
45 void *prop = get_property(soc, "reg", &size);
46 immrbase = of_translate_address(soc, prop);
47 of_node_put(soc);
48 };
49
50 return immrbase;
51}
52EXPORT_SYMBOL(get_immrbase);
53
54static const char * gfar_tx_intr = "tx";
55static const char * gfar_rx_intr = "rx";
56static const char * gfar_err_intr = "error";
57
58static int __init gfar_of_init(void)
59{
60 struct device_node *np;
61 unsigned int i;
62 struct platform_device *mdio_dev, *gfar_dev;
63 struct resource res;
64 int ret;
65
66 for (np = NULL, i = 0; (np = of_find_compatible_node(np, "mdio", "gianfar")) != NULL; i++) {
67 int k;
68 struct device_node *child = NULL;
69 struct gianfar_mdio_data mdio_data;
70
71 memset(&res, 0, sizeof(res));
72 memset(&mdio_data, 0, sizeof(mdio_data));
73
74 ret = of_address_to_resource(np, 0, &res);
75 if (ret)
76 goto mdio_err;
77
78 mdio_dev = platform_device_register_simple("fsl-gianfar_mdio", res.start, &res, 1);
79 if (IS_ERR(mdio_dev)) {
80 ret = PTR_ERR(mdio_dev);
81 goto mdio_err;
82 }
83
84 for (k = 0; k < 32; k++)
85 mdio_data.irq[k] = -1;
86
87 while ((child = of_get_next_child(np, child)) != NULL) {
88 if (child->n_intrs) {
89 u32 *id = (u32 *) get_property(child, "reg", NULL);
90 mdio_data.irq[*id] = child->intrs[0].line;
91 }
92 }
93
94 ret = platform_device_add_data(mdio_dev, &mdio_data, sizeof(struct gianfar_mdio_data));
95 if (ret)
96 goto mdio_unreg;
97 }
98
99 for (np = NULL, i = 0; (np = of_find_compatible_node(np, "network", "gianfar")) != NULL; i++) {
100 struct resource r[4];
101 struct device_node *phy, *mdio;
102 struct gianfar_platform_data gfar_data;
103 unsigned int *id;
104 char *model;
105 void *mac_addr;
106 phandle *ph;
107
108 memset(r, 0, sizeof(r));
109 memset(&gfar_data, 0, sizeof(gfar_data));
110
111 ret = of_address_to_resource(np, 0, &r[0]);
112 if (ret)
113 goto gfar_err;
114
115 r[1].start = np->intrs[0].line;
116 r[1].end = np->intrs[0].line;
117 r[1].flags = IORESOURCE_IRQ;
118
119 model = get_property(np, "model", NULL);
120
121 /* If we aren't the FEC we have multiple interrupts */
122 if (model && strcasecmp(model, "FEC")) {
123 r[1].name = gfar_tx_intr;
124
125 r[2].name = gfar_rx_intr;
126 r[2].start = np->intrs[1].line;
127 r[2].end = np->intrs[1].line;
128 r[2].flags = IORESOURCE_IRQ;
129
130 r[3].name = gfar_err_intr;
131 r[3].start = np->intrs[2].line;
132 r[3].end = np->intrs[2].line;
133 r[3].flags = IORESOURCE_IRQ;
134 }
135
136 gfar_dev = platform_device_register_simple("fsl-gianfar", i, &r[0], np->n_intrs + 1);
137
138 if (IS_ERR(gfar_dev)) {
139 ret = PTR_ERR(gfar_dev);
140 goto gfar_err;
141 }
142
143 mac_addr = get_property(np, "address", NULL);
144 memcpy(gfar_data.mac_addr, mac_addr, 6);
145
146 if (model && !strcasecmp(model, "TSEC"))
147 gfar_data.device_flags =
148 FSL_GIANFAR_DEV_HAS_GIGABIT |
149 FSL_GIANFAR_DEV_HAS_COALESCE |
150 FSL_GIANFAR_DEV_HAS_RMON |
151 FSL_GIANFAR_DEV_HAS_MULTI_INTR;
152 if (model && !strcasecmp(model, "eTSEC"))
153 gfar_data.device_flags =
154 FSL_GIANFAR_DEV_HAS_GIGABIT |
155 FSL_GIANFAR_DEV_HAS_COALESCE |
156 FSL_GIANFAR_DEV_HAS_RMON |
157 FSL_GIANFAR_DEV_HAS_MULTI_INTR |
158 FSL_GIANFAR_DEV_HAS_CSUM |
159 FSL_GIANFAR_DEV_HAS_VLAN |
160 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH;
161
162 ph = (phandle *) get_property(np, "phy-handle", NULL);
163 phy = of_find_node_by_phandle(*ph);
164
165 if (phy == NULL) {
166 ret = -ENODEV;
167 goto gfar_unreg;
168 }
169
170 mdio = of_get_parent(phy);
171
172 id = (u32 *) get_property(phy, "reg", NULL);
173 ret = of_address_to_resource(mdio, 0, &res);
174 if (ret) {
175 of_node_put(phy);
176 of_node_put(mdio);
177 goto gfar_unreg;
178 }
179
180 gfar_data.phy_id = *id;
181 gfar_data.bus_id = res.start;
182
183 of_node_put(phy);
184 of_node_put(mdio);
185
186 ret = platform_device_add_data(gfar_dev, &gfar_data, sizeof(struct gianfar_platform_data));
187 if (ret)
188 goto gfar_unreg;
189 }
190
191 return 0;
192
193mdio_unreg:
194 platform_device_unregister(mdio_dev);
195mdio_err:
196 return ret;
197
198gfar_unreg:
199 platform_device_unregister(gfar_dev);
200gfar_err:
201 return ret;
202}
203arch_initcall(gfar_of_init);
204
205static int __init fsl_i2c_of_init(void)
206{
207 struct device_node *np;
208 unsigned int i;
209 struct platform_device *i2c_dev;
210 int ret;
211
212 for (np = NULL, i = 0; (np = of_find_compatible_node(np, "i2c", "fsl-i2c")) != NULL; i++) {
213 struct resource r[2];
214 struct fsl_i2c_platform_data i2c_data;
215 unsigned char * flags = NULL;
216
217 memset(&r, 0, sizeof(r));
218 memset(&i2c_data, 0, sizeof(i2c_data));
219
220 ret = of_address_to_resource(np, 0, &r[0]);
221 if (ret)
222 goto i2c_err;
223
224 r[1].start = np->intrs[0].line;
225 r[1].end = np->intrs[0].line;
226 r[1].flags = IORESOURCE_IRQ;
227
228 i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
229 if (IS_ERR(i2c_dev)) {
230 ret = PTR_ERR(i2c_dev);
231 goto i2c_err;
232 }
233
234 i2c_data.device_flags = 0;
235 flags = get_property(np, "dfsrr", NULL);
236 if (flags)
237 i2c_data.device_flags |= FSL_I2C_DEV_SEPARATE_DFSRR;
238
239 flags = get_property(np, "fsl5200-clocking", NULL);
240 if (flags)
241 i2c_data.device_flags |= FSL_I2C_DEV_CLOCK_5200;
242
243 ret = platform_device_add_data(i2c_dev, &i2c_data, sizeof(struct fsl_i2c_platform_data));
244 if (ret)
245 goto i2c_unreg;
246 }
247
248 return 0;
249
250i2c_unreg:
251 platform_device_unregister(i2c_dev);
252i2c_err:
253 return ret;
254}
255arch_initcall(fsl_i2c_of_init);
256
257#ifdef CONFIG_PPC_83xx
258static int __init mpc83xx_wdt_init(void)
259{
260 struct resource r;
261 struct device_node *soc, *np;
262 struct platform_device *dev;
263 unsigned int *freq;
264 int ret;
265
266 np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
267
268 if (!np) {
269 ret = -ENODEV;
270 goto mpc83xx_wdt_nodev;
271 }
272
273 soc = of_find_node_by_type(NULL, "soc");
274
275 if (!soc) {
276 ret = -ENODEV;
277 goto mpc83xx_wdt_nosoc;
278 }
279
280 freq = (unsigned int *)get_property(soc, "bus-frequency", NULL);
281 if (!freq) {
282 ret = -ENODEV;
283 goto mpc83xx_wdt_err;
284 }
285
286 memset(&r, 0, sizeof(r));
287
288 ret = of_address_to_resource(np, 0, &r);
289 if (ret)
290 goto mpc83xx_wdt_err;
291
292 dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1);
293 if (IS_ERR(dev)) {
294 ret = PTR_ERR(dev);
295 goto mpc83xx_wdt_err;
296 }
297
298 ret = platform_device_add_data(dev, freq, sizeof(int));
299 if (ret)
300 goto mpc83xx_wdt_unreg;
301
302 of_node_put(soc);
303 of_node_put(np);
304
305 return 0;
306
307mpc83xx_wdt_unreg:
308 platform_device_unregister(dev);
309mpc83xx_wdt_err:
310 of_node_put(soc);
311mpc83xx_wdt_nosoc:
312 of_node_put(np);
313mpc83xx_wdt_nodev:
314 return ret;
315}
316arch_initcall(mpc83xx_wdt_init);
317#endif
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
new file mode 100644
index 000000000000..c433d3f39edd
--- /dev/null
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -0,0 +1,8 @@
1#ifndef __PPC_FSL_SOC_H
2#define __PPC_FSL_SOC_H
3#ifdef __KERNEL__
4
5extern phys_addr_t get_immrbase(void);
6
7#endif
8#endif
diff --git a/arch/ppc/syslib/ipic.c b/arch/powerpc/sysdev/ipic.c
index 8f01e0f1d847..8f01e0f1d847 100644
--- a/arch/ppc/syslib/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
diff --git a/arch/ppc/syslib/ipic.h b/arch/powerpc/sysdev/ipic.h
index a7ce7da8785c..a7ce7da8785c 100644
--- a/arch/ppc/syslib/ipic.h
+++ b/arch/powerpc/sysdev/ipic.h
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 58d1cc2023c8..4f26304d0263 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -13,6 +13,9 @@
13 */ 13 */
14 14
15#undef DEBUG 15#undef DEBUG
16#undef DEBUG_IPI
17#undef DEBUG_IRQ
18#undef DEBUG_LOW
16 19
17#include <linux/config.h> 20#include <linux/config.h>
18#include <linux/types.h> 21#include <linux/types.h>
@@ -45,7 +48,11 @@ static struct mpic *mpic_primary;
45static DEFINE_SPINLOCK(mpic_lock); 48static DEFINE_SPINLOCK(mpic_lock);
46 49
47#ifdef CONFIG_PPC32 /* XXX for now */ 50#ifdef CONFIG_PPC32 /* XXX for now */
48#define distribute_irqs CONFIG_IRQ_ALL_CPUS 51#ifdef CONFIG_IRQ_ALL_CPUS
52#define distribute_irqs (1)
53#else
54#define distribute_irqs (0)
55#endif
49#endif 56#endif
50 57
51/* 58/*
@@ -164,70 +171,129 @@ static void __init mpic_test_broken_ipi(struct mpic *mpic)
164/* Test if an interrupt is sourced from HyperTransport (used on broken U3s) 171/* Test if an interrupt is sourced from HyperTransport (used on broken U3s)
165 * to force the edge setting on the MPIC and do the ack workaround. 172 * to force the edge setting on the MPIC and do the ack workaround.
166 */ 173 */
167static inline int mpic_is_ht_interrupt(struct mpic *mpic, unsigned int source_no) 174static inline int mpic_is_ht_interrupt(struct mpic *mpic, unsigned int source)
168{ 175{
169 if (source_no >= 128 || !mpic->fixups) 176 if (source >= 128 || !mpic->fixups)
170 return 0; 177 return 0;
171 return mpic->fixups[source_no].base != NULL; 178 return mpic->fixups[source].base != NULL;
172} 179}
173 180
174static inline void mpic_apic_end_irq(struct mpic *mpic, unsigned int source_no) 181
182static inline void mpic_ht_end_irq(struct mpic *mpic, unsigned int source)
175{ 183{
176 struct mpic_irq_fixup *fixup = &mpic->fixups[source_no]; 184 struct mpic_irq_fixup *fixup = &mpic->fixups[source];
177 u32 tmp;
178 185
179 spin_lock(&mpic->fixup_lock); 186 if (fixup->applebase) {
180 writeb(0x11 + 2 * fixup->irq, fixup->base); 187 unsigned int soff = (fixup->index >> 3) & ~3;
181 tmp = readl(fixup->base + 2); 188 unsigned int mask = 1U << (fixup->index & 0x1f);
182 writel(tmp | 0x80000000ul, fixup->base + 2); 189 writel(mask, fixup->applebase + soff);
183 /* config writes shouldn't be posted but let's be safe ... */ 190 } else {
184 (void)readl(fixup->base + 2); 191 spin_lock(&mpic->fixup_lock);
185 spin_unlock(&mpic->fixup_lock); 192 writeb(0x11 + 2 * fixup->index, fixup->base + 2);
193 writel(fixup->data, fixup->base + 4);
194 spin_unlock(&mpic->fixup_lock);
195 }
186} 196}
187 197
198static void mpic_startup_ht_interrupt(struct mpic *mpic, unsigned int source,
199 unsigned int irqflags)
200{
201 struct mpic_irq_fixup *fixup = &mpic->fixups[source];
202 unsigned long flags;
203 u32 tmp;
188 204
189static void __init mpic_amd8111_read_irq(struct mpic *mpic, u8 __iomem *devbase) 205 if (fixup->base == NULL)
206 return;
207
208 DBG("startup_ht_interrupt(%u, %u) index: %d\n",
209 source, irqflags, fixup->index);
210 spin_lock_irqsave(&mpic->fixup_lock, flags);
211 /* Enable and configure */
212 writeb(0x10 + 2 * fixup->index, fixup->base + 2);
213 tmp = readl(fixup->base + 4);
214 tmp &= ~(0x23U);
215 if (irqflags & IRQ_LEVEL)
216 tmp |= 0x22;
217 writel(tmp, fixup->base + 4);
218 spin_unlock_irqrestore(&mpic->fixup_lock, flags);
219}
220
221static void mpic_shutdown_ht_interrupt(struct mpic *mpic, unsigned int source,
222 unsigned int irqflags)
190{ 223{
191 int i, irq; 224 struct mpic_irq_fixup *fixup = &mpic->fixups[source];
225 unsigned long flags;
192 u32 tmp; 226 u32 tmp;
193 227
194 printk(KERN_INFO "mpic: - Workarounds on AMD 8111 @ %p\n", devbase); 228 if (fixup->base == NULL)
229 return;
195 230
196 for (i=0; i < 24; i++) { 231 DBG("shutdown_ht_interrupt(%u, %u)\n", source, irqflags);
197 writeb(0x10 + 2*i, devbase + 0xf2); 232
198 tmp = readl(devbase + 0xf4); 233 /* Disable */
199 if ((tmp & 0x1) || !(tmp & 0x20)) 234 spin_lock_irqsave(&mpic->fixup_lock, flags);
200 continue; 235 writeb(0x10 + 2 * fixup->index, fixup->base + 2);
201 irq = (tmp >> 16) & 0xff; 236 tmp = readl(fixup->base + 4);
202 mpic->fixups[irq].irq = i; 237 tmp &= ~1U;
203 mpic->fixups[irq].base = devbase + 0xf2; 238 writel(tmp, fixup->base + 4);
204 } 239 spin_unlock_irqrestore(&mpic->fixup_lock, flags);
205} 240}
206 241
207static void __init mpic_amd8131_read_irq(struct mpic *mpic, u8 __iomem *devbase) 242static void __init mpic_scan_ht_pic(struct mpic *mpic, u8 __iomem *devbase,
243 unsigned int devfn, u32 vdid)
208{ 244{
209 int i, irq; 245 int i, irq, n;
246 u8 __iomem *base;
210 u32 tmp; 247 u32 tmp;
248 u8 pos;
249
250 for (pos = readb(devbase + PCI_CAPABILITY_LIST); pos != 0;
251 pos = readb(devbase + pos + PCI_CAP_LIST_NEXT)) {
252 u8 id = readb(devbase + pos + PCI_CAP_LIST_ID);
253 if (id == PCI_CAP_ID_HT_IRQCONF) {
254 id = readb(devbase + pos + 3);
255 if (id == 0x80)
256 break;
257 }
258 }
259 if (pos == 0)
260 return;
211 261
212 printk(KERN_INFO "mpic: - Workarounds on AMD 8131 @ %p\n", devbase); 262 base = devbase + pos;
263 writeb(0x01, base + 2);
264 n = (readl(base + 4) >> 16) & 0xff;
213 265
214 for (i=0; i < 4; i++) { 266 printk(KERN_INFO "mpic: - HT:%02x.%x [0x%02x] vendor %04x device %04x"
215 writeb(0x10 + 2*i, devbase + 0xba); 267 " has %d irqs\n",
216 tmp = readl(devbase + 0xbc); 268 devfn >> 3, devfn & 0x7, pos, vdid & 0xffff, vdid >> 16, n + 1);
217 if ((tmp & 0x1) || !(tmp & 0x20)) 269
218 continue; 270 for (i = 0; i <= n; i++) {
271 writeb(0x10 + 2 * i, base + 2);
272 tmp = readl(base + 4);
219 irq = (tmp >> 16) & 0xff; 273 irq = (tmp >> 16) & 0xff;
220 mpic->fixups[irq].irq = i; 274 DBG("HT PIC index 0x%x, irq 0x%x, tmp: %08x\n", i, irq, tmp);
221 mpic->fixups[irq].base = devbase + 0xba; 275 /* mask it , will be unmasked later */
276 tmp |= 0x1;
277 writel(tmp, base + 4);
278 mpic->fixups[irq].index = i;
279 mpic->fixups[irq].base = base;
280 /* Apple HT PIC has a non-standard way of doing EOIs */
281 if ((vdid & 0xffff) == 0x106b)
282 mpic->fixups[irq].applebase = devbase + 0x60;
283 else
284 mpic->fixups[irq].applebase = NULL;
285 writeb(0x11 + 2 * i, base + 2);
286 mpic->fixups[irq].data = readl(base + 4) | 0x80000000;
222 } 287 }
223} 288}
224 289
225static void __init mpic_scan_ioapics(struct mpic *mpic) 290
291static void __init mpic_scan_ht_pics(struct mpic *mpic)
226{ 292{
227 unsigned int devfn; 293 unsigned int devfn;
228 u8 __iomem *cfgspace; 294 u8 __iomem *cfgspace;
229 295
230 printk(KERN_INFO "mpic: Setting up IO-APICs workarounds for U3\n"); 296 printk(KERN_INFO "mpic: Setting up HT PICs workarounds for U3/U4\n");
231 297
232 /* Allocate fixups array */ 298 /* Allocate fixups array */
233 mpic->fixups = alloc_bootmem(128 * sizeof(struct mpic_irq_fixup)); 299 mpic->fixups = alloc_bootmem(128 * sizeof(struct mpic_irq_fixup));
@@ -237,21 +303,20 @@ static void __init mpic_scan_ioapics(struct mpic *mpic)
237 /* Init spinlock */ 303 /* Init spinlock */
238 spin_lock_init(&mpic->fixup_lock); 304 spin_lock_init(&mpic->fixup_lock);
239 305
240 /* Map u3 config space. We assume all IO-APICs are on the primary bus 306 /* Map U3 config space. We assume all IO-APICs are on the primary bus
241 * and slot will never be above "0xf" so we only need to map 32k 307 * so we only need to map 64kB.
242 */ 308 */
243 cfgspace = (unsigned char __iomem *)ioremap(0xf2000000, 0x8000); 309 cfgspace = ioremap(0xf2000000, 0x10000);
244 BUG_ON(cfgspace == NULL); 310 BUG_ON(cfgspace == NULL);
245 311
246 /* Now we scan all slots. We do a very quick scan, we read the header type, 312 /* Now we scan all slots. We do a very quick scan, we read the header
247 * vendor ID and device ID only, that's plenty enough 313 * type, vendor ID and device ID only, that's plenty enough
248 */ 314 */
249 for (devfn = 0; devfn < PCI_DEVFN(0x10,0); devfn ++) { 315 for (devfn = 0; devfn < 0x100; devfn++) {
250 u8 __iomem *devbase = cfgspace + (devfn << 8); 316 u8 __iomem *devbase = cfgspace + (devfn << 8);
251 u8 hdr_type = readb(devbase + PCI_HEADER_TYPE); 317 u8 hdr_type = readb(devbase + PCI_HEADER_TYPE);
252 u32 l = readl(devbase + PCI_VENDOR_ID); 318 u32 l = readl(devbase + PCI_VENDOR_ID);
253 u16 vendor_id, device_id; 319 u16 s;
254 int multifunc = 0;
255 320
256 DBG("devfn %x, l: %x\n", devfn, l); 321 DBG("devfn %x, l: %x\n", devfn, l);
257 322
@@ -259,22 +324,16 @@ static void __init mpic_scan_ioapics(struct mpic *mpic)
259 if (l == 0xffffffff || l == 0x00000000 || 324 if (l == 0xffffffff || l == 0x00000000 ||
260 l == 0x0000ffff || l == 0xffff0000) 325 l == 0x0000ffff || l == 0xffff0000)
261 goto next; 326 goto next;
327 /* Check if is supports capability lists */
328 s = readw(devbase + PCI_STATUS);
329 if (!(s & PCI_STATUS_CAP_LIST))
330 goto next;
331
332 mpic_scan_ht_pic(mpic, devbase, devfn, l);
262 333
263 /* Check if it's a multifunction device (only really used
264 * to function 0 though
265 */
266 multifunc = !!(hdr_type & 0x80);
267 vendor_id = l & 0xffff;
268 device_id = (l >> 16) & 0xffff;
269
270 /* If a known device, go to fixup setup code */
271 if (vendor_id == PCI_VENDOR_ID_AMD && device_id == 0x7460)
272 mpic_amd8111_read_irq(mpic, devbase);
273 if (vendor_id == PCI_VENDOR_ID_AMD && device_id == 0x7450)
274 mpic_amd8131_read_irq(mpic, devbase);
275 next: 334 next:
276 /* next device, if function 0 */ 335 /* next device, if function 0 */
277 if ((PCI_FUNC(devfn) == 0) && !multifunc) 336 if (PCI_FUNC(devfn) == 0 && (hdr_type & 0x80) == 0)
278 devfn += 7; 337 devfn += 7;
279 } 338 }
280} 339}
@@ -371,6 +430,31 @@ static void mpic_enable_irq(unsigned int irq)
371 break; 430 break;
372 } 431 }
373 } while(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK); 432 } while(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK);
433
434#ifdef CONFIG_MPIC_BROKEN_U3
435 if (mpic->flags & MPIC_BROKEN_U3) {
436 unsigned int src = irq - mpic->irq_offset;
437 if (mpic_is_ht_interrupt(mpic, src) &&
438 (irq_desc[irq].status & IRQ_LEVEL))
439 mpic_ht_end_irq(mpic, src);
440 }
441#endif /* CONFIG_MPIC_BROKEN_U3 */
442}
443
444static unsigned int mpic_startup_irq(unsigned int irq)
445{
446#ifdef CONFIG_MPIC_BROKEN_U3
447 struct mpic *mpic = mpic_from_irq(irq);
448 unsigned int src = irq - mpic->irq_offset;
449
450 if (mpic_is_ht_interrupt(mpic, src))
451 mpic_startup_ht_interrupt(mpic, src, irq_desc[irq].status);
452
453#endif /* CONFIG_MPIC_BROKEN_U3 */
454
455 mpic_enable_irq(irq);
456
457 return 0;
374} 458}
375 459
376static void mpic_disable_irq(unsigned int irq) 460static void mpic_disable_irq(unsigned int irq)
@@ -394,12 +478,27 @@ static void mpic_disable_irq(unsigned int irq)
394 } while(!(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK)); 478 } while(!(mpic_irq_read(src, MPIC_IRQ_VECTOR_PRI) & MPIC_VECPRI_MASK));
395} 479}
396 480
481static void mpic_shutdown_irq(unsigned int irq)
482{
483#ifdef CONFIG_MPIC_BROKEN_U3
484 struct mpic *mpic = mpic_from_irq(irq);
485 unsigned int src = irq - mpic->irq_offset;
486
487 if (mpic_is_ht_interrupt(mpic, src))
488 mpic_shutdown_ht_interrupt(mpic, src, irq_desc[irq].status);
489
490#endif /* CONFIG_MPIC_BROKEN_U3 */
491
492 mpic_disable_irq(irq);
493}
494
397static void mpic_end_irq(unsigned int irq) 495static void mpic_end_irq(unsigned int irq)
398{ 496{
399 struct mpic *mpic = mpic_from_irq(irq); 497 struct mpic *mpic = mpic_from_irq(irq);
400 498
499#ifdef DEBUG_IRQ
401 DBG("%s: end_irq: %d\n", mpic->name, irq); 500 DBG("%s: end_irq: %d\n", mpic->name, irq);
402 501#endif
403 /* We always EOI on end_irq() even for edge interrupts since that 502 /* We always EOI on end_irq() even for edge interrupts since that
404 * should only lower the priority, the MPIC should have properly 503 * should only lower the priority, the MPIC should have properly
405 * latched another edge interrupt coming in anyway 504 * latched another edge interrupt coming in anyway
@@ -408,8 +507,9 @@ static void mpic_end_irq(unsigned int irq)
408#ifdef CONFIG_MPIC_BROKEN_U3 507#ifdef CONFIG_MPIC_BROKEN_U3
409 if (mpic->flags & MPIC_BROKEN_U3) { 508 if (mpic->flags & MPIC_BROKEN_U3) {
410 unsigned int src = irq - mpic->irq_offset; 509 unsigned int src = irq - mpic->irq_offset;
411 if (mpic_is_ht_interrupt(mpic, src)) 510 if (mpic_is_ht_interrupt(mpic, src) &&
412 mpic_apic_end_irq(mpic, src); 511 (irq_desc[irq].status & IRQ_LEVEL))
512 mpic_ht_end_irq(mpic, src);
413 } 513 }
414#endif /* CONFIG_MPIC_BROKEN_U3 */ 514#endif /* CONFIG_MPIC_BROKEN_U3 */
415 515
@@ -490,6 +590,8 @@ struct mpic * __init mpic_alloc(unsigned long phys_addr,
490 mpic->name = name; 590 mpic->name = name;
491 591
492 mpic->hc_irq.typename = name; 592 mpic->hc_irq.typename = name;
593 mpic->hc_irq.startup = mpic_startup_irq;
594 mpic->hc_irq.shutdown = mpic_shutdown_irq;
493 mpic->hc_irq.enable = mpic_enable_irq; 595 mpic->hc_irq.enable = mpic_enable_irq;
494 mpic->hc_irq.disable = mpic_disable_irq; 596 mpic->hc_irq.disable = mpic_disable_irq;
495 mpic->hc_irq.end = mpic_end_irq; 597 mpic->hc_irq.end = mpic_end_irq;
@@ -658,10 +760,10 @@ void __init mpic_init(struct mpic *mpic)
658 mpic->irq_count = mpic->num_sources; 760 mpic->irq_count = mpic->num_sources;
659 761
660#ifdef CONFIG_MPIC_BROKEN_U3 762#ifdef CONFIG_MPIC_BROKEN_U3
661 /* Do the ioapic fixups on U3 broken mpic */ 763 /* Do the HT PIC fixups on U3 broken mpic */
662 DBG("MPIC flags: %x\n", mpic->flags); 764 DBG("MPIC flags: %x\n", mpic->flags);
663 if ((mpic->flags & MPIC_BROKEN_U3) && (mpic->flags & MPIC_PRIMARY)) 765 if ((mpic->flags & MPIC_BROKEN_U3) && (mpic->flags & MPIC_PRIMARY))
664 mpic_scan_ioapics(mpic); 766 mpic_scan_ht_pics(mpic);
665#endif /* CONFIG_MPIC_BROKEN_U3 */ 767#endif /* CONFIG_MPIC_BROKEN_U3 */
666 768
667 for (i = 0; i < mpic->num_sources; i++) { 769 for (i = 0; i < mpic->num_sources; i++) {
@@ -848,7 +950,9 @@ void mpic_send_ipi(unsigned int ipi_no, unsigned int cpu_mask)
848 950
849 BUG_ON(mpic == NULL); 951 BUG_ON(mpic == NULL);
850 952
953#ifdef DEBUG_IPI
851 DBG("%s: send_ipi(ipi_no: %d)\n", mpic->name, ipi_no); 954 DBG("%s: send_ipi(ipi_no: %d)\n", mpic->name, ipi_no);
955#endif
852 956
853 mpic_cpu_write(MPIC_CPU_IPI_DISPATCH_0 + ipi_no * 0x10, 957 mpic_cpu_write(MPIC_CPU_IPI_DISPATCH_0 + ipi_no * 0x10,
854 mpic_physmask(cpu_mask & cpus_addr(cpu_online_map)[0])); 958 mpic_physmask(cpu_mask & cpus_addr(cpu_online_map)[0]));
@@ -859,19 +963,28 @@ int mpic_get_one_irq(struct mpic *mpic, struct pt_regs *regs)
859 u32 irq; 963 u32 irq;
860 964
861 irq = mpic_cpu_read(MPIC_CPU_INTACK) & MPIC_VECPRI_VECTOR_MASK; 965 irq = mpic_cpu_read(MPIC_CPU_INTACK) & MPIC_VECPRI_VECTOR_MASK;
966#ifdef DEBUG_LOW
862 DBG("%s: get_one_irq(): %d\n", mpic->name, irq); 967 DBG("%s: get_one_irq(): %d\n", mpic->name, irq);
863 968#endif
864 if (mpic->cascade && irq == mpic->cascade_vec) { 969 if (mpic->cascade && irq == mpic->cascade_vec) {
970#ifdef DEBUG_LOW
865 DBG("%s: cascading ...\n", mpic->name); 971 DBG("%s: cascading ...\n", mpic->name);
972#endif
866 irq = mpic->cascade(regs, mpic->cascade_data); 973 irq = mpic->cascade(regs, mpic->cascade_data);
867 mpic_eoi(mpic); 974 mpic_eoi(mpic);
868 return irq; 975 return irq;
869 } 976 }
870 if (unlikely(irq == MPIC_VEC_SPURRIOUS)) 977 if (unlikely(irq == MPIC_VEC_SPURRIOUS))
871 return -1; 978 return -1;
872 if (irq < MPIC_VEC_IPI_0) 979 if (irq < MPIC_VEC_IPI_0) {
980#ifdef DEBUG_IRQ
981 DBG("%s: irq %d\n", mpic->name, irq + mpic->irq_offset);
982#endif
873 return irq + mpic->irq_offset; 983 return irq + mpic->irq_offset;
984 }
985#ifdef DEBUG_IPI
874 DBG("%s: ipi %d !\n", mpic->name, irq - MPIC_VEC_IPI_0); 986 DBG("%s: ipi %d !\n", mpic->name, irq - MPIC_VEC_IPI_0);
987#endif
875 return irq - MPIC_VEC_IPI_0 + mpic->ipi_offset; 988 return irq - MPIC_VEC_IPI_0 + mpic->ipi_offset;
876} 989}
877 990
diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
index b20312e5ed27..109d874ecfbe 100644
--- a/arch/powerpc/xmon/Makefile
+++ b/arch/powerpc/xmon/Makefile
@@ -3,9 +3,5 @@
3ifdef CONFIG_PPC64 3ifdef CONFIG_PPC64
4EXTRA_CFLAGS += -mno-minimal-toc 4EXTRA_CFLAGS += -mno-minimal-toc
5endif 5endif
6 6obj-y += xmon.o ppc-dis.o ppc-opc.o setjmp.o start.o \
7obj-$(CONFIG_8xx) += start_8xx.o 7 nonstdio.o
8obj-$(CONFIG_6xx) += start_32.o
9obj-$(CONFIG_4xx) += start_32.o
10obj-$(CONFIG_PPC64) += start_64.o
11obj-y += xmon.o ppc-dis.o ppc-opc.o setjmp.o nonstdio.o
diff --git a/arch/powerpc/xmon/start_64.c b/arch/powerpc/xmon/start.c
index 712552c4f242..712552c4f242 100644
--- a/arch/powerpc/xmon/start_64.c
+++ b/arch/powerpc/xmon/start.c
diff --git a/arch/powerpc/xmon/start_32.c b/arch/powerpc/xmon/start_32.c
deleted file mode 100644
index c2464df4217e..000000000000
--- a/arch/powerpc/xmon/start_32.c
+++ /dev/null
@@ -1,441 +0,0 @@
1/*
2 * Copyright (C) 1996 Paul Mackerras.
3 */
4#include <linux/config.h>
5#include <linux/string.h>
6#include <asm/machdep.h>
7#include <asm/io.h>
8#include <asm/page.h>
9#include <linux/adb.h>
10#include <linux/pmu.h>
11#include <linux/cuda.h>
12#include <linux/kernel.h>
13#include <linux/errno.h>
14#include <linux/bitops.h>
15#include <asm/xmon.h>
16#include <asm/prom.h>
17#include <asm/bootx.h>
18#include <asm/machdep.h>
19#include <asm/errno.h>
20#include <asm/pmac_feature.h>
21#include <asm/processor.h>
22#include <asm/delay.h>
23#include <asm/btext.h>
24#include <asm/time.h>
25#include "nonstdio.h"
26
27static volatile unsigned char __iomem *sccc, *sccd;
28unsigned int TXRDY, RXRDY, DLAB;
29
30static int use_serial;
31static int use_screen;
32static int via_modem;
33static int xmon_use_sccb;
34static struct device_node *channel_node;
35
36void buf_access(void)
37{
38 if (DLAB)
39 sccd[3] &= ~DLAB; /* reset DLAB */
40}
41
42extern int adb_init(void);
43
44#ifdef CONFIG_PPC_CHRP
45/*
46 * This looks in the "ranges" property for the primary PCI host bridge
47 * to find the physical address of the start of PCI/ISA I/O space.
48 * It is basically a cut-down version of pci_process_bridge_OF_ranges.
49 */
50static unsigned long chrp_find_phys_io_base(void)
51{
52 struct device_node *node;
53 unsigned int *ranges;
54 unsigned long base = CHRP_ISA_IO_BASE;
55 int rlen = 0;
56 int np;
57
58 node = find_devices("isa");
59 if (node != NULL) {
60 node = node->parent;
61 if (node == NULL || node->type == NULL
62 || strcmp(node->type, "pci") != 0)
63 node = NULL;
64 }
65 if (node == NULL)
66 node = find_devices("pci");
67 if (node == NULL)
68 return base;
69
70 ranges = (unsigned int *) get_property(node, "ranges", &rlen);
71 np = prom_n_addr_cells(node) + 5;
72 while ((rlen -= np * sizeof(unsigned int)) >= 0) {
73 if ((ranges[0] >> 24) == 1 && ranges[2] == 0) {
74 /* I/O space starting at 0, grab the phys base */
75 base = ranges[np - 3];
76 break;
77 }
78 ranges += np;
79 }
80 return base;
81}
82#endif /* CONFIG_PPC_CHRP */
83
84void xmon_map_scc(void)
85{
86#ifdef CONFIG_PPC_MULTIPLATFORM
87 volatile unsigned char __iomem *base;
88
89 if (_machine == _MACH_Pmac) {
90 struct device_node *np;
91 unsigned long addr;
92#ifdef CONFIG_BOOTX_TEXT
93 if (!use_screen && !use_serial
94 && !machine_is_compatible("iMac")) {
95 /* see if there is a keyboard in the device tree
96 with a parent of type "adb" */
97 for (np = find_devices("keyboard"); np; np = np->next)
98 if (np->parent && np->parent->type
99 && strcmp(np->parent->type, "adb") == 0)
100 break;
101
102 /* needs to be hacked if xmon_printk is to be used
103 from within find_via_pmu() */
104#ifdef CONFIG_ADB_PMU
105 if (np != NULL && boot_text_mapped && find_via_pmu())
106 use_screen = 1;
107#endif
108#ifdef CONFIG_ADB_CUDA
109 if (np != NULL && boot_text_mapped && find_via_cuda())
110 use_screen = 1;
111#endif
112 }
113 if (!use_screen && (np = find_devices("escc")) != NULL) {
114 /*
115 * look for the device node for the serial port
116 * we're using and see if it says it has a modem
117 */
118 char *name = xmon_use_sccb? "ch-b": "ch-a";
119 char *slots;
120 int l;
121
122 np = np->child;
123 while (np != NULL && strcmp(np->name, name) != 0)
124 np = np->sibling;
125 if (np != NULL) {
126 /* XXX should parse this properly */
127 channel_node = np;
128 slots = get_property(np, "slot-names", &l);
129 if (slots != NULL && l >= 10
130 && strcmp(slots+4, "Modem") == 0)
131 via_modem = 1;
132 }
133 }
134 btext_drawstring("xmon uses ");
135 if (use_screen)
136 btext_drawstring("screen and keyboard\n");
137 else {
138 if (via_modem)
139 btext_drawstring("modem on ");
140 btext_drawstring(xmon_use_sccb? "printer": "modem");
141 btext_drawstring(" port\n");
142 }
143
144#endif /* CONFIG_BOOTX_TEXT */
145
146#ifdef CHRP_ESCC
147 addr = 0xc1013020;
148#else
149 addr = 0xf3013020;
150#endif
151 TXRDY = 4;
152 RXRDY = 1;
153
154 np = find_devices("mac-io");
155 if (np && np->n_addrs)
156 addr = np->addrs[0].address + 0x13020;
157 base = (volatile unsigned char *) ioremap(addr & PAGE_MASK, PAGE_SIZE);
158 sccc = base + (addr & ~PAGE_MASK);
159 sccd = sccc + 0x10;
160
161 } else {
162 base = (volatile unsigned char *) isa_io_base;
163
164#ifdef CONFIG_PPC_CHRP
165 if (_machine == _MACH_chrp)
166 base = (volatile unsigned char __iomem *)
167 ioremap(chrp_find_phys_io_base(), 0x1000);
168#endif
169
170 sccc = base + 0x3fd;
171 sccd = base + 0x3f8;
172 if (xmon_use_sccb) {
173 sccc -= 0x100;
174 sccd -= 0x100;
175 }
176 TXRDY = 0x20;
177 RXRDY = 1;
178 DLAB = 0x80;
179 }
180#elif defined(CONFIG_GEMINI)
181 /* should already be mapped by the kernel boot */
182 sccc = (volatile unsigned char __iomem *) 0xffeffb0d;
183 sccd = (volatile unsigned char __iomem *) 0xffeffb08;
184 TXRDY = 0x20;
185 RXRDY = 1;
186 DLAB = 0x80;
187#elif defined(CONFIG_405GP)
188 sccc = (volatile unsigned char __iomem *)0xef600305;
189 sccd = (volatile unsigned char __iomem *)0xef600300;
190 TXRDY = 0x20;
191 RXRDY = 1;
192 DLAB = 0x80;
193#endif /* platform */
194}
195
196static int scc_initialized = 0;
197
198void xmon_init_scc(void);
199extern void cuda_poll(void);
200
201static inline void do_poll_adb(void)
202{
203#ifdef CONFIG_ADB_PMU
204 if (sys_ctrler == SYS_CTRLER_PMU)
205 pmu_poll_adb();
206#endif /* CONFIG_ADB_PMU */
207#ifdef CONFIG_ADB_CUDA
208 if (sys_ctrler == SYS_CTRLER_CUDA)
209 cuda_poll();
210#endif /* CONFIG_ADB_CUDA */
211}
212
213int xmon_write(void *ptr, int nb)
214{
215 char *p = ptr;
216 int i, c, ct;
217
218#ifdef CONFIG_SMP
219 static unsigned long xmon_write_lock;
220 int lock_wait = 1000000;
221 int locked;
222
223 while ((locked = test_and_set_bit(0, &xmon_write_lock)) != 0)
224 if (--lock_wait == 0)
225 break;
226#endif
227
228#ifdef CONFIG_BOOTX_TEXT
229 if (use_screen) {
230 /* write it on the screen */
231 for (i = 0; i < nb; ++i)
232 btext_drawchar(*p++);
233 goto out;
234 }
235#endif
236 if (!scc_initialized)
237 xmon_init_scc();
238 ct = 0;
239 for (i = 0; i < nb; ++i) {
240 while ((*sccc & TXRDY) == 0)
241 do_poll_adb();
242 c = p[i];
243 if (c == '\n' && !ct) {
244 c = '\r';
245 ct = 1;
246 --i;
247 } else {
248 ct = 0;
249 }
250 buf_access();
251 *sccd = c;
252 eieio();
253 }
254
255 out:
256#ifdef CONFIG_SMP
257 if (!locked)
258 clear_bit(0, &xmon_write_lock);
259#endif
260 return nb;
261}
262
263int xmon_wants_key;
264int xmon_adb_keycode;
265
266#ifdef CONFIG_BOOTX_TEXT
267static int xmon_adb_shiftstate;
268
269static unsigned char xmon_keytab[128] =
270 "asdfhgzxcv\000bqwer" /* 0x00 - 0x0f */
271 "yt123465=97-80]o" /* 0x10 - 0x1f */
272 "u[ip\rlj'k;\\,/nm." /* 0x20 - 0x2f */
273 "\t `\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */
274 "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */
275 "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */
276
277static unsigned char xmon_shift_keytab[128] =
278 "ASDFHGZXCV\000BQWER" /* 0x00 - 0x0f */
279 "YT!@#$^%+(&_*)}O" /* 0x10 - 0x1f */
280 "U{IP\rLJ\"K:|<?NM>" /* 0x20 - 0x2f */
281 "\t ~\177\0\033\0\0\0\0\0\0\0\0\0\0" /* 0x30 - 0x3f */
282 "\0.\0*\0+\0\0\0\0\0/\r\0-\0" /* 0x40 - 0x4f */
283 "\0\0000123456789\0\0\0"; /* 0x50 - 0x5f */
284
285static int xmon_get_adb_key(void)
286{
287 int k, t, on;
288
289 xmon_wants_key = 1;
290 for (;;) {
291 xmon_adb_keycode = -1;
292 t = 0;
293 on = 0;
294 do {
295 if (--t < 0) {
296 on = 1 - on;
297 btext_drawchar(on? 0xdb: 0x20);
298 btext_drawchar('\b');
299 t = 200000;
300 }
301 do_poll_adb();
302 } while (xmon_adb_keycode == -1);
303 k = xmon_adb_keycode;
304 if (on)
305 btext_drawstring(" \b");
306
307 /* test for shift keys */
308 if ((k & 0x7f) == 0x38 || (k & 0x7f) == 0x7b) {
309 xmon_adb_shiftstate = (k & 0x80) == 0;
310 continue;
311 }
312 if (k >= 0x80)
313 continue; /* ignore up transitions */
314 k = (xmon_adb_shiftstate? xmon_shift_keytab: xmon_keytab)[k];
315 if (k != 0)
316 break;
317 }
318 xmon_wants_key = 0;
319 return k;
320}
321#endif /* CONFIG_BOOTX_TEXT */
322
323int xmon_readchar(void)
324{
325#ifdef CONFIG_BOOTX_TEXT
326 if (use_screen)
327 return xmon_get_adb_key();
328#endif
329 if (!scc_initialized)
330 xmon_init_scc();
331 while ((*sccc & RXRDY) == 0)
332 do_poll_adb();
333 buf_access();
334 return *sccd;
335}
336
337int xmon_read_poll(void)
338{
339 if ((*sccc & RXRDY) == 0) {
340 do_poll_adb();
341 return -1;
342 }
343 buf_access();
344 return *sccd;
345}
346
347static unsigned char scc_inittab[] = {
348 13, 0, /* set baud rate divisor */
349 12, 1,
350 14, 1, /* baud rate gen enable, src=rtxc */
351 11, 0x50, /* clocks = br gen */
352 5, 0xea, /* tx 8 bits, assert DTR & RTS */
353 4, 0x46, /* x16 clock, 1 stop */
354 3, 0xc1, /* rx enable, 8 bits */
355};
356
357void xmon_init_scc(void)
358{
359 if ( _machine == _MACH_chrp )
360 {
361 sccd[3] = 0x83; eieio(); /* LCR = 8N1 + DLAB */
362 sccd[0] = 12; eieio(); /* DLL = 9600 baud */
363 sccd[1] = 0; eieio();
364 sccd[2] = 0; eieio(); /* FCR = 0 */
365 sccd[3] = 3; eieio(); /* LCR = 8N1 */
366 sccd[1] = 0; eieio(); /* IER = 0 */
367 }
368 else if ( _machine == _MACH_Pmac )
369 {
370 int i, x;
371 unsigned long timeout;
372
373 if (channel_node != 0)
374 pmac_call_feature(
375 PMAC_FTR_SCC_ENABLE,
376 channel_node,
377 PMAC_SCC_ASYNC | PMAC_SCC_FLAG_XMON, 1);
378 printk(KERN_INFO "Serial port locked ON by debugger !\n");
379 if (via_modem && channel_node != 0) {
380 unsigned int t0;
381
382 pmac_call_feature(
383 PMAC_FTR_MODEM_ENABLE,
384 channel_node, 0, 1);
385 printk(KERN_INFO "Modem powered up by debugger !\n");
386 t0 = get_tbl();
387 timeout = 3 * tb_ticks_per_sec;
388 if (timeout == 0)
389 /* assume 25MHz if tb_ticks_per_sec not set */
390 timeout = 75000000;
391 while (get_tbl() - t0 < timeout)
392 eieio();
393 }
394 /* use the B channel if requested */
395 if (xmon_use_sccb) {
396 sccc = (volatile unsigned char *)
397 ((unsigned long)sccc & ~0x20);
398 sccd = sccc + 0x10;
399 }
400 for (i = 20000; i != 0; --i) {
401 x = *sccc; eieio();
402 }
403 *sccc = 9; eieio(); /* reset A or B side */
404 *sccc = ((unsigned long)sccc & 0x20)? 0x80: 0x40; eieio();
405 for (i = 0; i < sizeof(scc_inittab); ++i) {
406 *sccc = scc_inittab[i];
407 eieio();
408 }
409 }
410 scc_initialized = 1;
411 if (via_modem) {
412 for (;;) {
413 xmon_write("ATE1V1\r", 7);
414 if (xmon_expect("OK", 5)) {
415 xmon_write("ATA\r", 4);
416 if (xmon_expect("CONNECT", 40))
417 break;
418 }
419 xmon_write("+++", 3);
420 xmon_expect("OK", 3);
421 }
422 }
423}
424
425void xmon_enter(void)
426{
427#ifdef CONFIG_ADB_PMU
428 if (_machine == _MACH_Pmac) {
429 pmu_suspend();
430 }
431#endif
432}
433
434void xmon_leave(void)
435{
436#ifdef CONFIG_ADB_PMU
437 if (_machine == _MACH_Pmac) {
438 pmu_resume();
439 }
440#endif
441}
diff --git a/arch/powerpc/xmon/start_8xx.c b/arch/powerpc/xmon/start_8xx.c
deleted file mode 100644
index 4c17b0486ad5..000000000000
--- a/arch/powerpc/xmon/start_8xx.c
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * Copyright (C) 1996 Paul Mackerras.
3 * Copyright (C) 2000 Dan Malek.
4 * Quick hack of Paul's code to make XMON work on 8xx processors. Lots
5 * of assumptions, like the SMC1 is used, it has been initialized by the
6 * loader at some point, and we can just stuff and suck bytes.
7 * We rely upon the 8xx uart driver to support us, as the interface
8 * changes between boot up and operational phases of the kernel.
9 */
10#include <linux/string.h>
11#include <asm/machdep.h>
12#include <asm/io.h>
13#include <asm/page.h>
14#include <linux/kernel.h>
15#include <asm/8xx_immap.h>
16#include <asm/mpc8xx.h>
17#include <asm/commproc.h>
18#include "nonstdio.h"
19
20extern int xmon_8xx_write(char *str, int nb);
21extern int xmon_8xx_read_poll(void);
22extern int xmon_8xx_read_char(void);
23
24void xmon_map_scc(void)
25{
26 cpmp = (cpm8xx_t *)&(((immap_t *)IMAP_ADDR)->im_cpm);
27}
28
29void xmon_init_scc(void);
30
31int xmon_write(void *ptr, int nb)
32{
33 return(xmon_8xx_write(ptr, nb));
34}
35
36int xmon_readchar(void)
37{
38 return xmon_8xx_read_char();
39}
40
41int xmon_read_poll(void)
42{
43 return(xmon_8xx_read_poll());
44}
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index c45a6ad5f3b7..7d02fa2a8990 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -311,7 +311,7 @@ static void release_output_lock(void)
311} 311}
312#endif 312#endif
313 313
314int xmon_core(struct pt_regs *regs, int fromipi) 314static int xmon_core(struct pt_regs *regs, int fromipi)
315{ 315{
316 int cmd = 0; 316 int cmd = 0;
317 unsigned long msr; 317 unsigned long msr;
@@ -450,7 +450,6 @@ int xmon_core(struct pt_regs *regs, int fromipi)
450 leave: 450 leave:
451 cpu_clear(cpu, cpus_in_xmon); 451 cpu_clear(cpu, cpus_in_xmon);
452 xmon_fault_jmp[cpu] = NULL; 452 xmon_fault_jmp[cpu] = NULL;
453
454#else 453#else
455 /* UP is simple... */ 454 /* UP is simple... */
456 if (in_xmon) { 455 if (in_xmon) {
@@ -529,7 +528,7 @@ xmon_irq(int irq, void *d, struct pt_regs *regs)
529 return IRQ_HANDLED; 528 return IRQ_HANDLED;
530} 529}
531 530
532int xmon_bpt(struct pt_regs *regs) 531static int xmon_bpt(struct pt_regs *regs)
533{ 532{
534 struct bpt *bp; 533 struct bpt *bp;
535 unsigned long offset; 534 unsigned long offset;
@@ -555,7 +554,7 @@ int xmon_bpt(struct pt_regs *regs)
555 return 1; 554 return 1;
556} 555}
557 556
558int xmon_sstep(struct pt_regs *regs) 557static int xmon_sstep(struct pt_regs *regs)
559{ 558{
560 if (user_mode(regs)) 559 if (user_mode(regs))
561 return 0; 560 return 0;
@@ -563,7 +562,7 @@ int xmon_sstep(struct pt_regs *regs)
563 return 1; 562 return 1;
564} 563}
565 564
566int xmon_dabr_match(struct pt_regs *regs) 565static int xmon_dabr_match(struct pt_regs *regs)
567{ 566{
568 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) 567 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))
569 return 0; 568 return 0;
@@ -573,7 +572,7 @@ int xmon_dabr_match(struct pt_regs *regs)
573 return 1; 572 return 1;
574} 573}
575 574
576int xmon_iabr_match(struct pt_regs *regs) 575static int xmon_iabr_match(struct pt_regs *regs)
577{ 576{
578 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF)) 577 if ((regs->msr & (MSR_IR|MSR_PR|MSR_SF)) != (MSR_IR|MSR_SF))
579 return 0; 578 return 0;
@@ -583,7 +582,7 @@ int xmon_iabr_match(struct pt_regs *regs)
583 return 1; 582 return 1;
584} 583}
585 584
586int xmon_ipi(struct pt_regs *regs) 585static int xmon_ipi(struct pt_regs *regs)
587{ 586{
588#ifdef CONFIG_SMP 587#ifdef CONFIG_SMP
589 if (in_xmon && !cpu_isset(smp_processor_id(), cpus_in_xmon)) 588 if (in_xmon && !cpu_isset(smp_processor_id(), cpus_in_xmon))
@@ -592,7 +591,7 @@ int xmon_ipi(struct pt_regs *regs)
592 return 0; 591 return 0;
593} 592}
594 593
595int xmon_fault_handler(struct pt_regs *regs) 594static int xmon_fault_handler(struct pt_regs *regs)
596{ 595{
597 struct bpt *bp; 596 struct bpt *bp;
598 unsigned long offset; 597 unsigned long offset;
@@ -805,7 +804,10 @@ cmds(struct pt_regs *excp)
805 break; 804 break;
806 case 'x': 805 case 'x':
807 case 'X': 806 case 'X':
807 return cmd;
808 case EOF: 808 case EOF:
809 printf(" <no input ...>\n");
810 mdelay(2000);
809 return cmd; 811 return cmd;
810 case '?': 812 case '?':
811 printf(help_string); 813 printf(help_string);
@@ -1011,7 +1013,7 @@ static long check_bp_loc(unsigned long addr)
1011 unsigned int instr; 1013 unsigned int instr;
1012 1014
1013 addr &= ~3; 1015 addr &= ~3;
1014 if (addr < KERNELBASE) { 1016 if (!is_kernel_addr(addr)) {
1015 printf("Breakpoints may only be placed at kernel addresses\n"); 1017 printf("Breakpoints may only be placed at kernel addresses\n");
1016 return 0; 1018 return 0;
1017 } 1019 }
@@ -1062,7 +1064,7 @@ bpt_cmds(void)
1062 dabr.address = 0; 1064 dabr.address = 0;
1063 dabr.enabled = 0; 1065 dabr.enabled = 0;
1064 if (scanhex(&dabr.address)) { 1066 if (scanhex(&dabr.address)) {
1065 if (dabr.address < KERNELBASE) { 1067 if (!is_kernel_addr(dabr.address)) {
1066 printf(badaddr); 1068 printf(badaddr);
1067 break; 1069 break;
1068 } 1070 }
diff --git a/arch/ppc/4xx_io/serial_sicc.c b/arch/ppc/4xx_io/serial_sicc.c
index 84d96b857e4a..8ace2a1f3b48 100644
--- a/arch/ppc/4xx_io/serial_sicc.c
+++ b/arch/ppc/4xx_io/serial_sicc.c
@@ -47,6 +47,7 @@
47#include <linux/mm.h> 47#include <linux/mm.h>
48#include <linux/slab.h> 48#include <linux/slab.h>
49#include <linux/init.h> 49#include <linux/init.h>
50#include <linux/capability.h>
50#include <linux/circ_buf.h> 51#include <linux/circ_buf.h>
51#include <linux/serial.h> 52#include <linux/serial.h>
52#include <linux/console.h> 53#include <linux/console.h>
@@ -214,7 +215,6 @@ static struct tty_driver *siccnormal_driver;
214 * memory if large numbers of serial ports are open. 215 * memory if large numbers of serial ports are open.
215 */ 216 */
216static u_char *tmp_buf; 217static u_char *tmp_buf;
217static DECLARE_MUTEX(tmp_buf_sem);
218 218
219#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8) 219#define HIGH_BITS_OFFSET ((sizeof(long)-sizeof(int))*8)
220 220
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index 8fa51b0a32d2..11899f06bf06 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -8,9 +8,6 @@ config MMU
8 bool 8 bool
9 default y 9 default y
10 10
11config UID16
12 bool
13
14config GENERIC_HARDIRQS 11config GENERIC_HARDIRQS
15 bool 12 bool
16 default y 13 default y
@@ -61,11 +58,11 @@ config 6xx
61 help 58 help
62 There are four types of PowerPC chips supported. The more common 59 There are four types of PowerPC chips supported. The more common
63 types (601, 603, 604, 740, 750, 7400), the Motorola embedded 60 types (601, 603, 604, 740, 750, 7400), the Motorola embedded
64 versions (821, 823, 850, 855, 860, 52xx, 82xx, 83xx), the IBM embedded 61 versions (821, 823, 850, 855, 860, 52xx, 82xx, 83xx), the IBM
65 versions (403 and 405) and the high end 64 bit Power processors 62 embedded versions (403 and 405) and the POWER3 processor.
66 (POWER 3, POWER4, and IBM 970 also known as G5) 63 (For support for more recent 64-bit processors, set ARCH=powerpc.)
67 Unless you are building a kernel for one of the embedded processor 64 Unless you are building a kernel for one of the embedded processor
68 systems, 64 bit IBM RS/6000 or an Apple G5, choose 6xx. 65 systems or a POWER3-based IBM RS/6000, choose 6xx.
69 Note that the kernel runs in 32-bit mode even on 64-bit chips. 66 Note that the kernel runs in 32-bit mode even on 64-bit chips.
70 Also note that because the 52xx, 82xx, & 83xx family has a 603e core, 67 Also note that because the 52xx, 82xx, & 83xx family has a 603e core,
71 specific support for that chipset is asked later on. 68 specific support for that chipset is asked later on.
@@ -80,10 +77,6 @@ config POWER3
80 select PPC_FPU 77 select PPC_FPU
81 bool "POWER3" 78 bool "POWER3"
82 79
83config POWER4
84 select PPC_FPU
85 bool "POWER4 and 970 (G5)"
86
87config 8xx 80config 8xx
88 bool "8xx" 81 bool "8xx"
89 82
@@ -126,7 +119,7 @@ config PHYS_64BIT
126 119
127config ALTIVEC 120config ALTIVEC
128 bool "AltiVec Support" 121 bool "AltiVec Support"
129 depends on 6xx || POWER4 122 depends on 6xx
130 depends on !8260 && !83xx 123 depends on !8260 && !83xx
131 ---help--- 124 ---help---
132 This option enables kernel support for the Altivec extensions to the 125 This option enables kernel support for the Altivec extensions to the
@@ -238,18 +231,9 @@ config KEXEC
238 231
239source "drivers/cpufreq/Kconfig" 232source "drivers/cpufreq/Kconfig"
240 233
241config CPU_FREQ_PMAC
242 bool "Support for Apple PowerBooks"
243 depends on CPU_FREQ && ADB_PMU
244 select CPU_FREQ_TABLE
245 help
246 This adds support for frequency switching on Apple PowerBooks,
247 this currently includes some models of iBook & Titanium
248 PowerBook.
249
250config PPC601_SYNC_FIX 234config PPC601_SYNC_FIX
251 bool "Workarounds for PPC601 bugs" 235 bool "Workarounds for PPC601 bugs"
252 depends on 6xx && (PPC_PREP || PPC_PMAC) 236 depends on 6xx && PPC_PREP
253 help 237 help
254 Some versions of the PPC601 (the first PowerPC chip) have bugs which 238 Some versions of the PPC601 (the first PowerPC chip) have bugs which
255 mean that extra synchronization instructions are required near 239 mean that extra synchronization instructions are required near
@@ -261,26 +245,17 @@ config PPC601_SYNC_FIX
261 245
262 If in doubt, say Y here. 246 If in doubt, say Y here.
263 247
264config HOTPLUG_CPU
265 bool "Support for enabling/disabling CPUs"
266 depends on SMP && HOTPLUG && EXPERIMENTAL && PPC_PMAC
267 ---help---
268 Say Y here to be able to disable and re-enable individual
269 CPUs at runtime on SMP machines.
270
271 Say N if you are unsure.
272
273source arch/ppc/platforms/4xx/Kconfig 248source arch/ppc/platforms/4xx/Kconfig
274source arch/ppc/platforms/85xx/Kconfig 249source arch/ppc/platforms/85xx/Kconfig
275 250
276config PPC64BRIDGE 251config PPC64BRIDGE
277 bool 252 bool
278 depends on POWER3 || POWER4 253 depends on POWER3
279 default y 254 default y
280 255
281config PPC_STD_MMU 256config PPC_STD_MMU
282 bool 257 bool
283 depends on 6xx || POWER3 || POWER4 258 depends on 6xx || POWER3
284 default y 259 default y
285 260
286config NOT_COHERENT_CACHE 261config NOT_COHERENT_CACHE
@@ -508,7 +483,7 @@ endchoice
508 483
509choice 484choice
510 prompt "Machine Type" 485 prompt "Machine Type"
511 depends on 6xx || POWER3 || POWER4 486 depends on 6xx || POWER3
512 default PPC_MULTIPLATFORM 487 default PPC_MULTIPLATFORM
513 ---help--- 488 ---help---
514 Linux currently supports several different kinds of PowerPC-based 489 Linux currently supports several different kinds of PowerPC-based
@@ -519,11 +494,15 @@ choice
519 Platform) machines (including all of the recent IBM RS/6000 and 494 Platform) machines (including all of the recent IBM RS/6000 and
520 pSeries machines), and several embedded PowerPC systems containing 495 pSeries machines), and several embedded PowerPC systems containing
521 4xx, 6xx, 7xx, 8xx, 74xx, and 82xx processors. Currently, the 496 4xx, 6xx, 7xx, 8xx, 74xx, and 82xx processors. Currently, the
522 default option is to build a kernel which works on the first three. 497 default option is to build a kernel which works on PReP and CHRP.
523 498
524 Select CHRP/PowerMac/PReP if configuring for an IBM RS/6000 or 499 Note that support for Apple machines is now only available with
525 pSeries machine, a Power Macintosh (including iMacs, iBooks and 500 ARCH=powerpc, and has been removed from this menu. If you wish
526 Powerbooks), or a PReP machine. 501 to build a kernel for an Apple machine, exit this configuration
502 process and re-run it with ARCH=powerpc.
503
504 Select CHRP/PReP if configuring for an IBM RS/6000 or
505 pSeries machine, or a PReP machine.
527 506
528 Select Gemini if configuring for a Synergy Microsystems' Gemini 507 Select Gemini if configuring for a Synergy Microsystems' Gemini
529 series Single Board Computer. More information is available at: 508 series Single Board Computer. More information is available at:
@@ -533,7 +512,7 @@ choice
533 available at: <http://linux-apus.sourceforge.net/>. 512 available at: <http://linux-apus.sourceforge.net/>.
534 513
535config PPC_MULTIPLATFORM 514config PPC_MULTIPLATFORM
536 bool "CHRP/PowerMac/PReP" 515 bool "CHRP/PReP"
537 516
538config APUS 517config APUS
539 bool "Amiga-APUS" 518 bool "Amiga-APUS"
@@ -746,6 +725,10 @@ config MPC834x
746 bool 725 bool
747 default y if MPC834x_SYS 726 default y if MPC834x_SYS
748 727
728config PPC_83xx
729 bool
730 default y if 83xx
731
749config CPM1 732config CPM1
750 bool 733 bool
751 depends on 8xx 734 depends on 8xx
@@ -767,25 +750,14 @@ config CPM2
767 on it (826x, 827x, 8560). 750 on it (826x, 827x, 8560).
768 751
769config PPC_CHRP 752config PPC_CHRP
770 bool " Common Hardware Reference Platform (CHRP) based machines" 753 bool "Support for CHRP (Common Hardware Reference Platform) machines"
771 depends on PPC_MULTIPLATFORM 754 depends on PPC_MULTIPLATFORM
772 select PPC_I8259 755 select PPC_I8259
773 select PPC_INDIRECT_PCI 756 select PPC_INDIRECT_PCI
774 default y 757 default y
775 758
776config PPC_PMAC
777 bool " Apple PowerMac based machines"
778 depends on PPC_MULTIPLATFORM
779 select PPC_INDIRECT_PCI
780 default y
781
782config PPC_PMAC64
783 bool
784 depends on PPC_PMAC && POWER4
785 default y
786
787config PPC_PREP 759config PPC_PREP
788 bool " PowerPC Reference Platform (PReP) based machines" 760 bool "Support for PReP (PowerPC Reference Platform) machines"
789 depends on PPC_MULTIPLATFORM 761 depends on PPC_MULTIPLATFORM
790 select PPC_I8259 762 select PPC_I8259
791 select PPC_INDIRECT_PCI 763 select PPC_INDIRECT_PCI
@@ -793,7 +765,7 @@ config PPC_PREP
793 765
794config PPC_OF 766config PPC_OF
795 bool 767 bool
796 depends on PPC_PMAC || PPC_CHRP 768 depends on PPC_CHRP
797 default y 769 default y
798 770
799config PPC_GEN550 771config PPC_GEN550
@@ -1165,7 +1137,7 @@ config ISA
1165 1137
1166config GENERIC_ISA_DMA 1138config GENERIC_ISA_DMA
1167 bool 1139 bool
1168 depends on POWER3 || POWER4 || 6xx && !CPM2 1140 depends on POWER3 || 6xx && !CPM2
1169 default y 1141 default y
1170 1142
1171config PPC_I8259 1143config PPC_I8259
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index e719a4933af1..98e940beeb3b 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -128,10 +128,9 @@ TOUT := .tmp_gas_check
128# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec 128# Ensure this is binutils 2.12.1 (or 2.12.90.0.7) or later for altivec
129# instructions. 129# instructions.
130# gcc-3.4 and binutils-2.14 are a fatal combination. 130# gcc-3.4 and binutils-2.14 are a fatal combination.
131GCC_VERSION := $(call cc-version)
132 131
133checkbin: 132checkbin:
134 @if test "$(GCC_VERSION)" = "0304" ; then \ 133 @if test "$(call cc-version)" = "0304" ; then \
135 if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \ 134 if ! /bin/echo mftb 5 | $(AS) -v -mppc -many -o $(TOUT) >/dev/null 2>&1 ; then \
136 echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \ 135 echo -n '*** ${VERSION}.${PATCHLEVEL} kernels no longer build '; \
137 echo 'correctly with gcc-3.4 and your version of binutils.'; \ 136 echo 'correctly with gcc-3.4 and your version of binutils.'; \
diff --git a/arch/ppc/amiga/amiints.c b/arch/ppc/amiga/amiints.c
index 91195e2ce38d..5f35cf3986f7 100644
--- a/arch/ppc/amiga/amiints.c
+++ b/arch/ppc/amiga/amiints.c
@@ -96,8 +96,8 @@ void amiga_init_IRQ(void)
96 gayle.inten = GAYLE_IRQ_IDE; 96 gayle.inten = GAYLE_IRQ_IDE;
97 97
98 /* turn off all interrupts... */ 98 /* turn off all interrupts... */
99 custom.intena = 0x7fff; 99 amiga_custom.intena = 0x7fff;
100 custom.intreq = 0x7fff; 100 amiga_custom.intreq = 0x7fff;
101 101
102#ifdef CONFIG_APUS 102#ifdef CONFIG_APUS
103 /* Clear any inter-CPU interrupt requests. Circumvents bug in 103 /* Clear any inter-CPU interrupt requests. Circumvents bug in
@@ -110,7 +110,7 @@ void amiga_init_IRQ(void)
110 APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET | IPLEMU_IPLMASK); 110 APUS_WRITE(APUS_IPL_EMU, IPLEMU_SETRESET | IPLEMU_IPLMASK);
111#endif 111#endif
112 /* ... and enable the master interrupt bit */ 112 /* ... and enable the master interrupt bit */
113 custom.intena = IF_SETCLR | IF_INTEN; 113 amiga_custom.intena = IF_SETCLR | IF_INTEN;
114 114
115 cia_init_IRQ(&ciaa_base); 115 cia_init_IRQ(&ciaa_base);
116 cia_init_IRQ(&ciab_base); 116 cia_init_IRQ(&ciab_base);
@@ -151,7 +151,7 @@ void amiga_enable_irq(unsigned int irq)
151 } 151 }
152 152
153 /* enable the interrupt */ 153 /* enable the interrupt */
154 custom.intena = IF_SETCLR | ami_intena_vals[irq]; 154 amiga_custom.intena = IF_SETCLR | ami_intena_vals[irq];
155} 155}
156 156
157void amiga_disable_irq(unsigned int irq) 157void amiga_disable_irq(unsigned int irq)
@@ -177,7 +177,7 @@ void amiga_disable_irq(unsigned int irq)
177 } 177 }
178 178
179 /* disable the interrupt */ 179 /* disable the interrupt */
180 custom.intena = ami_intena_vals[irq]; 180 amiga_custom.intena = ami_intena_vals[irq];
181} 181}
182 182
183inline void amiga_do_irq(int irq, struct pt_regs *fp) 183inline void amiga_do_irq(int irq, struct pt_regs *fp)
@@ -196,7 +196,7 @@ void amiga_do_irq_list(int irq, struct pt_regs *fp)
196 196
197 kstat_cpu(0).irqs[irq]++; 197 kstat_cpu(0).irqs[irq]++;
198 198
199 custom.intreq = ami_intena_vals[irq]; 199 amiga_custom.intreq = ami_intena_vals[irq];
200 200
201 for (action = desc->action; action; action = action->next) 201 for (action = desc->action; action; action = action->next)
202 action->handler(irq, action->dev_id, fp); 202 action->handler(irq, action->dev_id, fp);
@@ -208,40 +208,40 @@ void amiga_do_irq_list(int irq, struct pt_regs *fp)
208 208
209static void ami_int1(int irq, void *dev_id, struct pt_regs *fp) 209static void ami_int1(int irq, void *dev_id, struct pt_regs *fp)
210{ 210{
211 unsigned short ints = custom.intreqr & custom.intenar; 211 unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
212 212
213 /* if serial transmit buffer empty, interrupt */ 213 /* if serial transmit buffer empty, interrupt */
214 if (ints & IF_TBE) { 214 if (ints & IF_TBE) {
215 custom.intreq = IF_TBE; 215 amiga_custom.intreq = IF_TBE;
216 amiga_do_irq(IRQ_AMIGA_TBE, fp); 216 amiga_do_irq(IRQ_AMIGA_TBE, fp);
217 } 217 }
218 218
219 /* if floppy disk transfer complete, interrupt */ 219 /* if floppy disk transfer complete, interrupt */
220 if (ints & IF_DSKBLK) { 220 if (ints & IF_DSKBLK) {
221 custom.intreq = IF_DSKBLK; 221 amiga_custom.intreq = IF_DSKBLK;
222 amiga_do_irq(IRQ_AMIGA_DSKBLK, fp); 222 amiga_do_irq(IRQ_AMIGA_DSKBLK, fp);
223 } 223 }
224 224
225 /* if software interrupt set, interrupt */ 225 /* if software interrupt set, interrupt */
226 if (ints & IF_SOFT) { 226 if (ints & IF_SOFT) {
227 custom.intreq = IF_SOFT; 227 amiga_custom.intreq = IF_SOFT;
228 amiga_do_irq(IRQ_AMIGA_SOFT, fp); 228 amiga_do_irq(IRQ_AMIGA_SOFT, fp);
229 } 229 }
230} 230}
231 231
232static void ami_int3(int irq, void *dev_id, struct pt_regs *fp) 232static void ami_int3(int irq, void *dev_id, struct pt_regs *fp)
233{ 233{
234 unsigned short ints = custom.intreqr & custom.intenar; 234 unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
235 235
236 /* if a blitter interrupt */ 236 /* if a blitter interrupt */
237 if (ints & IF_BLIT) { 237 if (ints & IF_BLIT) {
238 custom.intreq = IF_BLIT; 238 amiga_custom.intreq = IF_BLIT;
239 amiga_do_irq(IRQ_AMIGA_BLIT, fp); 239 amiga_do_irq(IRQ_AMIGA_BLIT, fp);
240 } 240 }
241 241
242 /* if a copper interrupt */ 242 /* if a copper interrupt */
243 if (ints & IF_COPER) { 243 if (ints & IF_COPER) {
244 custom.intreq = IF_COPER; 244 amiga_custom.intreq = IF_COPER;
245 amiga_do_irq(IRQ_AMIGA_COPPER, fp); 245 amiga_do_irq(IRQ_AMIGA_COPPER, fp);
246 } 246 }
247 247
@@ -252,36 +252,36 @@ static void ami_int3(int irq, void *dev_id, struct pt_regs *fp)
252 252
253static void ami_int4(int irq, void *dev_id, struct pt_regs *fp) 253static void ami_int4(int irq, void *dev_id, struct pt_regs *fp)
254{ 254{
255 unsigned short ints = custom.intreqr & custom.intenar; 255 unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
256 256
257 /* if audio 0 interrupt */ 257 /* if audio 0 interrupt */
258 if (ints & IF_AUD0) { 258 if (ints & IF_AUD0) {
259 custom.intreq = IF_AUD0; 259 amiga_custom.intreq = IF_AUD0;
260 amiga_do_irq(IRQ_AMIGA_AUD0, fp); 260 amiga_do_irq(IRQ_AMIGA_AUD0, fp);
261 } 261 }
262 262
263 /* if audio 1 interrupt */ 263 /* if audio 1 interrupt */
264 if (ints & IF_AUD1) { 264 if (ints & IF_AUD1) {
265 custom.intreq = IF_AUD1; 265 amiga_custom.intreq = IF_AUD1;
266 amiga_do_irq(IRQ_AMIGA_AUD1, fp); 266 amiga_do_irq(IRQ_AMIGA_AUD1, fp);
267 } 267 }
268 268
269 /* if audio 2 interrupt */ 269 /* if audio 2 interrupt */
270 if (ints & IF_AUD2) { 270 if (ints & IF_AUD2) {
271 custom.intreq = IF_AUD2; 271 amiga_custom.intreq = IF_AUD2;
272 amiga_do_irq(IRQ_AMIGA_AUD2, fp); 272 amiga_do_irq(IRQ_AMIGA_AUD2, fp);
273 } 273 }
274 274
275 /* if audio 3 interrupt */ 275 /* if audio 3 interrupt */
276 if (ints & IF_AUD3) { 276 if (ints & IF_AUD3) {
277 custom.intreq = IF_AUD3; 277 amiga_custom.intreq = IF_AUD3;
278 amiga_do_irq(IRQ_AMIGA_AUD3, fp); 278 amiga_do_irq(IRQ_AMIGA_AUD3, fp);
279 } 279 }
280} 280}
281 281
282static void ami_int5(int irq, void *dev_id, struct pt_regs *fp) 282static void ami_int5(int irq, void *dev_id, struct pt_regs *fp)
283{ 283{
284 unsigned short ints = custom.intreqr & custom.intenar; 284 unsigned short ints = amiga_custom.intreqr & amiga_custom.intenar;
285 285
286 /* if serial receive buffer full interrupt */ 286 /* if serial receive buffer full interrupt */
287 if (ints & IF_RBF) { 287 if (ints & IF_RBF) {
@@ -291,7 +291,7 @@ static void ami_int5(int irq, void *dev_id, struct pt_regs *fp)
291 291
292 /* if a disk sync interrupt */ 292 /* if a disk sync interrupt */
293 if (ints & IF_DSKSYN) { 293 if (ints & IF_DSKSYN) {
294 custom.intreq = IF_DSKSYN; 294 amiga_custom.intreq = IF_DSKSYN;
295 amiga_do_irq(IRQ_AMIGA_DSKSYN, fp); 295 amiga_do_irq(IRQ_AMIGA_DSKSYN, fp);
296 } 296 }
297} 297}
diff --git a/arch/ppc/amiga/cia.c b/arch/ppc/amiga/cia.c
index ad961465b6cb..4431c58f611a 100644
--- a/arch/ppc/amiga/cia.c
+++ b/arch/ppc/amiga/cia.c
@@ -66,7 +66,7 @@ static unsigned char cia_set_irq_private(struct ciabase *base,
66 else 66 else
67 base->icr_data &= ~mask; 67 base->icr_data &= ~mask;
68 if (base->icr_data & base->icr_mask) 68 if (base->icr_data & base->icr_mask)
69 custom.intreq = IF_SETCLR | base->int_mask; 69 amiga_custom.intreq = IF_SETCLR | base->int_mask;
70 return old & base->icr_mask; 70 return old & base->icr_mask;
71} 71}
72 72
@@ -114,7 +114,7 @@ static unsigned char cia_able_irq_private(struct ciabase *base,
114 base->icr_mask &= CIA_ICR_ALL; 114 base->icr_mask &= CIA_ICR_ALL;
115 115
116 if (base->icr_data & base->icr_mask) 116 if (base->icr_data & base->icr_mask)
117 custom.intreq = IF_SETCLR | base->int_mask; 117 amiga_custom.intreq = IF_SETCLR | base->int_mask;
118 return old; 118 return old;
119} 119}
120 120
@@ -145,7 +145,7 @@ static void cia_handler(int irq, void *dev_id, struct pt_regs *fp)
145 irq = base->cia_irq; 145 irq = base->cia_irq;
146 desc = irq_desc + irq; 146 desc = irq_desc + irq;
147 ints = cia_set_irq_private(base, CIA_ICR_ALL); 147 ints = cia_set_irq_private(base, CIA_ICR_ALL);
148 custom.intreq = base->int_mask; 148 amiga_custom.intreq = base->int_mask;
149 for (i = 0; i < CIA_IRQS; i++, irq++) { 149 for (i = 0; i < CIA_IRQS; i++, irq++) {
150 if (ints & 1) { 150 if (ints & 1) {
151 kstat_cpu(0).irqs[irq]++; 151 kstat_cpu(0).irqs[irq]++;
@@ -174,5 +174,5 @@ void __init cia_init_IRQ(struct ciabase *base)
174 action->name = base->name; 174 action->name = base->name;
175 setup_irq(base->handler_irq, &amiga_sys_irqaction[base->handler_irq-IRQ_AMIGA_AUTO]); 175 setup_irq(base->handler_irq, &amiga_sys_irqaction[base->handler_irq-IRQ_AMIGA_AUTO]);
176 176
177 custom.intena = IF_SETCLR | base->int_mask; 177 amiga_custom.intena = IF_SETCLR | base->int_mask;
178} 178}
diff --git a/arch/ppc/amiga/config.c b/arch/ppc/amiga/config.c
index af881d7454dd..60e2da1c92c0 100644
--- a/arch/ppc/amiga/config.c
+++ b/arch/ppc/amiga/config.c
@@ -90,9 +90,6 @@ static void a3000_gettod (int *, int *, int *, int *, int *, int *);
90static void a2000_gettod (int *, int *, int *, int *, int *, int *); 90static void a2000_gettod (int *, int *, int *, int *, int *, int *);
91static int amiga_hwclk (int, struct hwclk_time *); 91static int amiga_hwclk (int, struct hwclk_time *);
92static int amiga_set_clock_mmss (unsigned long); 92static int amiga_set_clock_mmss (unsigned long);
93#ifdef CONFIG_AMIGA_FLOPPY
94extern void amiga_floppy_setup(char *, int *);
95#endif
96static void amiga_reset (void); 93static void amiga_reset (void);
97extern void amiga_init_sound(void); 94extern void amiga_init_sound(void);
98static void amiga_savekmsg_init(void); 95static void amiga_savekmsg_init(void);
@@ -281,7 +278,7 @@ static void __init amiga_identify(void)
281 case CS_OCS: 278 case CS_OCS:
282 case CS_ECS: 279 case CS_ECS:
283 case CS_AGA: 280 case CS_AGA:
284 switch (custom.deniseid & 0xf) { 281 switch (amiga_custom.deniseid & 0xf) {
285 case 0x0c: 282 case 0x0c:
286 AMIGAHW_SET(DENISE_HR); 283 AMIGAHW_SET(DENISE_HR);
287 break; 284 break;
@@ -294,7 +291,7 @@ static void __init amiga_identify(void)
294 AMIGAHW_SET(DENISE); 291 AMIGAHW_SET(DENISE);
295 break; 292 break;
296 } 293 }
297 switch ((custom.vposr>>8) & 0x7f) { 294 switch ((amiga_custom.vposr>>8) & 0x7f) {
298 case 0x00: 295 case 0x00:
299 AMIGAHW_SET(AGNUS_PAL); 296 AMIGAHW_SET(AGNUS_PAL);
300 break; 297 break;
@@ -419,9 +416,6 @@ void __init config_amiga(void)
419 416
420 mach_hwclk = amiga_hwclk; 417 mach_hwclk = amiga_hwclk;
421 mach_set_clock_mmss = amiga_set_clock_mmss; 418 mach_set_clock_mmss = amiga_set_clock_mmss;
422#ifdef CONFIG_AMIGA_FLOPPY
423 mach_floppy_setup = amiga_floppy_setup;
424#endif
425 mach_reset = amiga_reset; 419 mach_reset = amiga_reset;
426#ifdef CONFIG_HEARTBEAT 420#ifdef CONFIG_HEARTBEAT
427 mach_heartbeat = amiga_heartbeat; 421 mach_heartbeat = amiga_heartbeat;
@@ -432,9 +426,9 @@ void __init config_amiga(void)
432 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */ 426 amiga_colorclock = 5*amiga_eclock; /* 3.5 MHz */
433 427
434 /* clear all DMA bits */ 428 /* clear all DMA bits */
435 custom.dmacon = DMAF_ALL; 429 amiga_custom.dmacon = DMAF_ALL;
436 /* ensure that the DMA master bit is set */ 430 /* ensure that the DMA master bit is set */
437 custom.dmacon = DMAF_SETCLR | DMAF_MASTER; 431 amiga_custom.dmacon = DMAF_SETCLR | DMAF_MASTER;
438 432
439 /* request all RAM */ 433 /* request all RAM */
440 for (i = 0; i < m68k_num_memory; i++) { 434 for (i = 0; i < m68k_num_memory; i++) {
@@ -753,9 +747,9 @@ static void amiga_savekmsg_init(void)
753 747
754static void amiga_serial_putc(char c) 748static void amiga_serial_putc(char c)
755{ 749{
756 custom.serdat = (unsigned char)c | 0x100; 750 amiga_custom.serdat = (unsigned char)c | 0x100;
757 mb(); 751 mb();
758 while (!(custom.serdatr & 0x2000)) 752 while (!(amiga_custom.serdatr & 0x2000))
759 ; 753 ;
760} 754}
761 755
@@ -785,11 +779,11 @@ int amiga_serial_console_wait_key(struct console *co)
785{ 779{
786 int ch; 780 int ch;
787 781
788 while (!(custom.intreqr & IF_RBF)) 782 while (!(amiga_custom.intreqr & IF_RBF))
789 barrier(); 783 barrier();
790 ch = custom.serdatr & 0xff; 784 ch = amiga_custom.serdatr & 0xff;
791 /* clear the interrupt, so that another character can be read */ 785 /* clear the interrupt, so that another character can be read */
792 custom.intreq = IF_RBF; 786 amiga_custom.intreq = IF_RBF;
793 return ch; 787 return ch;
794} 788}
795 789
diff --git a/arch/ppc/boot/Makefile b/arch/ppc/boot/Makefile
index 995f89bb049c..efd8ce515d5f 100644
--- a/arch/ppc/boot/Makefile
+++ b/arch/ppc/boot/Makefile
@@ -18,7 +18,7 @@ BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd
18bootdir-y := simple 18bootdir-y := simple
19bootdir-$(CONFIG_PPC_OF) += openfirmware 19bootdir-$(CONFIG_PPC_OF) += openfirmware
20subdir-y := lib common images 20subdir-y := lib common images
21subdir-$(CONFIG_PPC_OF) += of1275 21subdir-$(CONFIG_PPC_MULTIPLATFORM) += of1275
22 22
23# for cleaning 23# for cleaning
24subdir- += simple openfirmware 24subdir- += simple openfirmware
diff --git a/arch/ppc/boot/common/util.S b/arch/ppc/boot/common/util.S
index c96c9f80521e..368ec035e6cd 100644
--- a/arch/ppc/boot/common/util.S
+++ b/arch/ppc/boot/common/util.S
@@ -234,7 +234,8 @@ udelay:
234 * First, flush the data cache in case it was enabled and may be 234 * First, flush the data cache in case it was enabled and may be
235 * holding instructions for copy back. 235 * holding instructions for copy back.
236 */ 236 */
237_GLOBAL(flush_instruction_cache) 237 .globl flush_instruction_cache
238flush_instruction_cache:
238 mflr r6 239 mflr r6
239 bl flush_data_cache 240 bl flush_data_cache
240 241
@@ -279,7 +280,8 @@ _GLOBAL(flush_instruction_cache)
279 * Flush data cache 280 * Flush data cache
280 * Do this by just reading lots of stuff into the cache. 281 * Do this by just reading lots of stuff into the cache.
281 */ 282 */
282_GLOBAL(flush_data_cache) 283 .globl flush_data_cache
284flush_data_cache:
283 lis r3,cache_flush_buffer@h 285 lis r3,cache_flush_buffer@h
284 ori r3,r3,cache_flush_buffer@l 286 ori r3,r3,cache_flush_buffer@l
285 li r4,NUM_CACHE_LINES 287 li r4,NUM_CACHE_LINES
diff --git a/arch/ppc/boot/images/Makefile b/arch/ppc/boot/images/Makefile
index 532e7ef1edb6..58415d5718e3 100644
--- a/arch/ppc/boot/images/Makefile
+++ b/arch/ppc/boot/images/Makefile
@@ -26,7 +26,7 @@ quiet_cmd_uimage = UIMAGE $@
26targets += uImage 26targets += uImage
27$(obj)/uImage: $(obj)/vmlinux.gz 27$(obj)/uImage: $(obj)/vmlinux.gz
28 $(Q)rm -f $@ 28 $(Q)rm -f $@
29 $(call if_changed,uimage) 29 $(call cmd,uimage)
30 @echo -n ' Image: $@ ' 30 @echo -n ' Image: $@ '
31 @if [ -f $@ ]; then echo 'is ready' ; else echo 'not made'; fi 31 @if [ -f $@ ]; then echo 'is ready' ; else echo 'not made'; fi
32 32
diff --git a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile
index 83a6433459ce..2a411ec2e650 100644
--- a/arch/ppc/boot/openfirmware/Makefile
+++ b/arch/ppc/boot/openfirmware/Makefile
@@ -21,26 +21,16 @@ bootlib := $(boot)/lib
21of1275 := $(boot)/of1275 21of1275 := $(boot)/of1275
22images := $(boot)/images 22images := $(boot)/images
23 23
24OBJCOPY_ARGS := -O aixcoff-rs6000 -R .stab -R .stabstr -R .comment
25COFF_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00500000 \
26 -Bstatic
27CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000 24CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
28NEWWORLD_LD_ARGS:= -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x01000000
29 25
30COMMONOBJS := start.o misc.o common.o 26COMMONOBJS := start.o misc.o common.o
31COFFOBJS := coffcrt0.o $(COMMONOBJS) coffmain.o
32CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o 27CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o
33NEWWORLDOBJS := crt0.o $(COMMONOBJS) newworldmain.o
34 28
35targets := $(COFFOBJS) $(CHRPOBJS) $(NEWWORLDOBJS) dummy.o 29targets := $(CHRPOBJS) dummy.o
36COFFOBJS := $(addprefix $(obj)/, $(COFFOBJS))
37CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS)) 30CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS))
38NEWWORLDOBJS := $(addprefix $(obj)/, $(NEWWORLDOBJS))
39 31
40LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a 32LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
41 33
42HACKCOFF := $(utils)/hack-coff
43
44ifdef CONFIG_SMP 34ifdef CONFIG_SMP
45END := .smp 35END := .smp
46endif 36endif
@@ -72,56 +62,11 @@ targets += image.initrd.o
72$(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE 62$(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
73 $(call if_changed,genimage-initrd) 63 $(call if_changed,genimage-initrd)
74 64
75# Create the note section for New-World PowerMacs.
76quiet_cmd_mknote = MKNOTE $@
77 cmd_mknote = $(utils)/mknote > $@
78targets += note
79$(obj)/note: $(utils)/mknote FORCE
80 $(call if_changed,mknote)
81
82 65
83$(obj)/coffcrt0.o: EXTRA_AFLAGS := -DXCOFF 66targets += crt0.o
84targets += coffcrt0.o crt0.o 67$(obj)/crt0.o: $(common)/crt0.S FORCE
85$(obj)/coffcrt0.o $(obj)/crt0.o: $(common)/crt0.S FORCE
86 $(call if_changed_dep,as_o_S) 68 $(call if_changed_dep,as_o_S)
87 69
88quiet_cmd_gencoffb = COFF $@
89 cmd_gencoffb = $(LD) -o $@ $(COFF_LD_ARGS) $(COFFOBJS) $< $(LIBS) && \
90 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
91targets += coffboot
92$(obj)/coffboot: $(obj)/image.o $(COFFOBJS) $(LIBS) $(srctree)/$(boot)/ld.script FORCE
93 $(call if_changed,gencoffb)
94targets += coffboot.initrd
95$(obj)/coffboot.initrd: $(obj)/image.initrd.o $(COFFOBJS) $(LIBS) \
96 $(srctree)/$(boot)/ld.script FORCE
97 $(call if_changed,gencoffb)
98
99
100quiet_cmd_gen-coff = COFF $@
101 cmd_gen-coff = $(OBJCOPY) $(OBJCOPY_ARGS) $< $@ && \
102 $(HACKCOFF) $@ && \
103 ln -sf $(notdir $@) $(images)/zImage$(initrd).pmac
104
105$(images)/vmlinux.coff: $(obj)/coffboot
106 $(call cmd,gen-coff)
107
108$(images)/vmlinux.initrd.coff: $(obj)/coffboot.initrd
109 $(call cmd,gen-coff)
110
111quiet_cmd_gen-elf-pmac = ELF $@
112 cmd_gen-elf-pmac = $(LD) $(NEWWORLD_LD_ARGS) -o $@ \
113 $(NEWWORLDOBJS) $(LIBS) $< && \
114 $(OBJCOPY) $@ $@ --add-section=.note=$(obj)/note \
115 -R .comment $(del-ramdisk-sec)
116
117$(images)/vmlinux.elf-pmac: $(obj)/image.o $(NEWWORLDOBJS) $(LIBS) \
118 $(obj)/note $(srctree)/$(boot)/ld.script
119 $(call cmd,gen-elf-pmac)
120$(images)/vmlinux.initrd.elf-pmac: $(obj)/image.initrd.o $(NEWWORLDOBJS) \
121 $(LIBS) $(obj)/note \
122 $(srctree)/$(boot)/ld.script
123 $(call cmd,gen-elf-pmac)
124
125quiet_cmd_gen-chrp = CHRP $@ 70quiet_cmd_gen-chrp = CHRP $@
126 cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \ 71 cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
127 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec) 72 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
@@ -139,46 +84,23 @@ $(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \
139 %-rs6k: % 84 %-rs6k: %
140 $(call cmd,addnote) 85 $(call cmd,addnote)
141 86
142quiet_cmd_gen-miboot = GEN $@
143 cmd_gen-miboot = $(OBJCOPY) $(OBJCOPY_ARGS) \
144 --add-section=$1=$(word 2, $^) $< $@
145$(images)/miboot.image: $(obj)/dummy.o $(images)/vmlinux.gz
146 $(call cmd,gen-miboot,image)
147
148$(images)/miboot.initrd.image: $(images)/miboot.image $(images)/ramdisk.image.gz
149 $(call cmd,gen-miboot,initrd)
150
151# The targets used on the make command-line 87# The targets used on the make command-line
152 88
153.PHONY: zImage zImage.initrd 89.PHONY: zImage zImage.initrd
154zImage: $(images)/vmlinux.coff \ 90zImage: $(images)/zImage.chrp \
155 $(images)/vmlinux.elf-pmac \ 91 $(images)/zImage.chrp-rs6k
156 $(images)/zImage.chrp \
157 $(images)/zImage.chrp-rs6k \
158 $(images)/miboot.image
159 @echo ' kernel: $@ is ready ($<)' 92 @echo ' kernel: $@ is ready ($<)'
160zImage.initrd: $(images)/vmlinux.initrd.coff \ 93zImage.initrd: $(images)/zImage.initrd.chrp \
161 $(images)/vmlinux.initrd.elf-pmac \ 94 $(images)/zImage.initrd.chrp-rs6k
162 $(images)/zImage.initrd.chrp \
163 $(images)/zImage.initrd.chrp-rs6k \
164 $(images)/miboot.initrd.image
165 @echo ' kernel: $@ is ready ($<)' 95 @echo ' kernel: $@ is ready ($<)'
166 96
167TFTPIMAGE := /tftpboot/zImage 97TFTPIMAGE := /tftpboot/zImage
168 98
169.PHONY: znetboot znetboot.initrd 99.PHONY: znetboot znetboot.initrd
170znetboot: $(images)/vmlinux.coff \ 100znetboot: $(images)/zImage.chrp
171 $(images)/vmlinux.elf-pmac \
172 $(images)/zImage.chrp
173 cp $(images)/vmlinux.coff $(TFTPIMAGE).pmac$(END)
174 cp $(images)/vmlinux.elf-pmac $(TFTPIMAGE).pmac$(END).elf
175 cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END) 101 cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
176 @echo ' kernel: $@ is ready ($<)' 102 @echo ' kernel: $@ is ready ($<)'
177znetboot.initrd:$(images)/vmlinux.initrd.coff \ 103znetboot.initrd:$(images)/zImage.initrd.chrp
178 $(images)/vmlinux.initrd.elf-pmac \
179 $(images)/zImage.initrd.chrp
180 cp $(images)/vmlinux.initrd.coff $(TFTPIMAGE).pmac$(END)
181 cp $(images)/vmlinux.initrd.elf-pmac $(TFTPIMAGE).pmac$(END).elf
182 cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END) 104 cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
183 @echo ' kernel: $@ is ready ($<)' 105 @echo ' kernel: $@ is ready ($<)'
184 106
diff --git a/arch/ppc/boot/openfirmware/coffmain.c b/arch/ppc/boot/openfirmware/coffmain.c
deleted file mode 100644
index 2da8855e2be0..000000000000
--- a/arch/ppc/boot/openfirmware/coffmain.c
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/string.h>
10#include <asm/processor.h>
11#include <asm/page.h>
12
13#include "nonstdio.h"
14#include "of1275.h"
15
16/* Passed from the linker */
17extern char __image_begin, __image_end;
18extern char __ramdisk_begin[], __ramdisk_end;
19extern char _start, _end;
20
21extern char image_data[], initrd_data[];
22extern int initrd_len, image_len;
23extern unsigned int heap_max;
24extern void flush_cache(void *start, unsigned int len);
25extern void gunzip(void *, int, unsigned char *, int *);
26extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
27 unsigned int progend);
28extern void setup_bats(unsigned long start);
29
30char *avail_ram;
31char *begin_avail, *end_avail;
32char *avail_high;
33
34#define SCRATCH_SIZE (128 << 10)
35
36static char heap[SCRATCH_SIZE];
37
38static unsigned long ram_start = 0;
39static unsigned long ram_end = 0x1000000;
40
41static unsigned long prog_start = 0x800000;
42static unsigned long prog_size = 0x700000;
43
44typedef void (*kernel_start_t)(int, int, void *);
45
46void boot(int a1, int a2, void *prom)
47{
48 unsigned sa, len;
49 void *dst;
50 unsigned char *im;
51 unsigned initrd_start, initrd_size;
52
53 printf("coffboot starting: loaded at 0x%p\n", &_start);
54 setup_bats(ram_start);
55
56 initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin);
57 if (initrd_size) {
58 initrd_start = (ram_end - initrd_size) & ~0xFFF;
59 a1 = initrd_start;
60 a2 = initrd_size;
61 claim(initrd_start, ram_end - initrd_start, 0);
62 printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r",
63 initrd_start, (char *)(&__ramdisk_begin), initrd_size);
64 memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size);
65 prog_size = initrd_start - prog_start;
66 } else
67 a2 = 0xdeadbeef;
68
69 im = (char *)(&__image_begin);
70 len = (char *)(&__image_end) - (char *)(&__image_begin);
71 /* claim 4MB starting at PROG_START */
72 claim(prog_start, prog_size, 0);
73 map(prog_start, prog_start, prog_size);
74 dst = (void *) prog_start;
75 if (im[0] == 0x1f && im[1] == 0x8b) {
76 /* set up scratch space */
77 begin_avail = avail_high = avail_ram = heap;
78 end_avail = heap + sizeof(heap);
79 printf("heap at 0x%p\n", avail_ram);
80 printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len);
81 gunzip(dst, prog_size, im, &len);
82 printf("done %u bytes\n", len);
83 printf("%u bytes of heap consumed, max in use %u\n",
84 avail_high - begin_avail, heap_max);
85 } else {
86 memmove(dst, im, len);
87 }
88
89 flush_cache(dst, len);
90 make_bi_recs(((unsigned long) dst + len), "coffboot", _MACH_Pmac,
91 (prog_start + prog_size));
92
93 sa = (unsigned long)prog_start;
94 printf("start address = 0x%x\n", sa);
95
96 (*(kernel_start_t)sa)(a1, a2, prom);
97
98 printf("returned?\n");
99
100 pause();
101}
diff --git a/arch/ppc/boot/openfirmware/newworldmain.c b/arch/ppc/boot/openfirmware/newworldmain.c
deleted file mode 100644
index fa8a8f9313f9..000000000000
--- a/arch/ppc/boot/openfirmware/newworldmain.c
+++ /dev/null
@@ -1,94 +0,0 @@
1/*
2 * Copyright (C) Paul Mackerras 1997.
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version
7 * 2 of the License, or (at your option) any later version.
8 */
9#include <linux/string.h>
10#include "nonstdio.h"
11#include "of1275.h"
12#include <asm/processor.h>
13#include <asm/page.h>
14
15/* Passed from the linker */
16extern char __image_begin, __image_end;
17extern char __ramdisk_begin[], __ramdisk_end;
18extern char _start, _end;
19
20extern unsigned int heap_max;
21extern void flush_cache(void *start, unsigned int len);
22extern void gunzip(void *, int, unsigned char *, int *);
23extern void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
24 unsigned int progend);
25
26char *avail_ram;
27char *begin_avail, *end_avail;
28char *avail_high;
29
30
31#define RAM_END (16 << 20)
32
33#define PROG_START 0x00010000
34#define PROG_SIZE 0x007f0000
35
36#define SCRATCH_SIZE (128 << 10)
37
38typedef void (*kernel_start_t)(int, int, void *);
39
40void boot(int a1, int a2, void *prom)
41{
42 unsigned sa, len;
43 void *dst;
44 unsigned char *im;
45 unsigned initrd_start, initrd_size;
46
47 printf("chrpboot starting: loaded at 0x%p\n", &_start);
48
49 initrd_size = (char *)(&__ramdisk_end) - (char *)(&__ramdisk_begin);
50 if (initrd_size) {
51 initrd_start = (RAM_END - initrd_size) & ~0xFFF;
52 a1 = initrd_start;
53 a2 = initrd_size;
54 claim(initrd_start, RAM_END - initrd_start, 0);
55 printf("initial ramdisk moving 0x%x <- 0x%p (%x bytes)\n\r",
56 initrd_start, (char *)(&__ramdisk_begin), initrd_size);
57 memcpy((char *)initrd_start, (char *)(&__ramdisk_begin), initrd_size);
58 } else
59 a2 = 0xdeadbeef;
60
61 im = (char *)(&__image_begin);
62 len = (char *)(&__image_end) - (char *)(&__image_begin);
63 /* claim 3MB starting at PROG_START */
64 claim(PROG_START, PROG_SIZE, 0);
65 dst = (void *) PROG_START;
66 if (im[0] == 0x1f && im[1] == 0x8b) {
67 /* claim some memory for scratch space */
68 avail_ram = (char *) claim(0, SCRATCH_SIZE, 0x10);
69 begin_avail = avail_high = avail_ram;
70 end_avail = avail_ram + SCRATCH_SIZE;
71 printf("heap at 0x%p\n", avail_ram);
72 printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len);
73 gunzip(dst, PROG_SIZE, im, &len);
74 printf("done %u bytes\n", len);
75 printf("%u bytes of heap consumed, max in use %u\n",
76 avail_high - begin_avail, heap_max);
77 release(begin_avail, SCRATCH_SIZE);
78 } else {
79 memmove(dst, im, len);
80 }
81
82 flush_cache(dst, len);
83 make_bi_recs(((unsigned long) dst + len), "chrpboot", _MACH_Pmac,
84 (PROG_START + PROG_SIZE));
85
86 sa = (unsigned long)PROG_START;
87 printf("start address = 0x%x\n", sa);
88
89 (*(kernel_start_t)sa)(a1, a2, prom);
90
91 printf("returned?\n");
92
93 pause();
94}
diff --git a/arch/ppc/boot/simple/Makefile b/arch/ppc/boot/simple/Makefile
index 82df88b01bbe..9533f8de238f 100644
--- a/arch/ppc/boot/simple/Makefile
+++ b/arch/ppc/boot/simple/Makefile
@@ -190,6 +190,8 @@ boot-$(CONFIG_REDWOOD_5) += embed_config.o
190boot-$(CONFIG_REDWOOD_6) += embed_config.o 190boot-$(CONFIG_REDWOOD_6) += embed_config.o
191boot-$(CONFIG_8xx) += embed_config.o 191boot-$(CONFIG_8xx) += embed_config.o
192boot-$(CONFIG_8260) += embed_config.o 192boot-$(CONFIG_8260) += embed_config.o
193boot-$(CONFIG_EP405) += embed_config.o
194boot-$(CONFIG_XILINX_ML300) += embed_config.o
193boot-$(CONFIG_BSEIP) += iic.o 195boot-$(CONFIG_BSEIP) += iic.o
194boot-$(CONFIG_MBX) += iic.o pci.o qspan_pci.o 196boot-$(CONFIG_MBX) += iic.o pci.o qspan_pci.o
195boot-$(CONFIG_MV64X60) += misc-mv64x60.o 197boot-$(CONFIG_MV64X60) += misc-mv64x60.o
@@ -262,11 +264,11 @@ $(images)/zImage.initrd-STRIPELF: $(obj)/zvmlinux.initrd
262 skip=64 bs=1k 264 skip=64 bs=1k
263 265
264$(images)/zImage-TREE: $(obj)/zvmlinux $(MKTREE) 266$(images)/zImage-TREE: $(obj)/zvmlinux $(MKTREE)
265 $(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(end-y) $(ENTRYPOINT) 267 $(MKTREE) $(obj)/zvmlinux $(images)/zImage.$(end-y) $(entrypoint-y)
266 268
267$(images)/zImage.initrd-TREE: $(obj)/zvmlinux.initrd $(MKTREE) 269$(images)/zImage.initrd-TREE: $(obj)/zvmlinux.initrd $(MKTREE)
268 $(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(end-y) \ 270 $(MKTREE) $(obj)/zvmlinux.initrd $(images)/zImage.initrd.$(end-y) \
269 $(ENTRYPOINT) 271 $(entrypoint-y)
270 272
271$(images)/zImage-PPLUS: $(obj)/zvmlinux $(MKPREP) $(MKBUGBOOT) 273$(images)/zImage-PPLUS: $(obj)/zvmlinux $(MKPREP) $(MKBUGBOOT)
272 $(MKPREP) -pbp $(obj)/zvmlinux $(images)/zImage.$(end-y) 274 $(MKPREP) -pbp $(obj)/zvmlinux $(images)/zImage.$(end-y)
diff --git a/arch/ppc/configs/TQM8540_defconfig b/arch/ppc/configs/TQM8540_defconfig
new file mode 100644
index 000000000000..99bf3b7a2762
--- /dev/null
+++ b/arch/ppc/configs/TQM8540_defconfig
@@ -0,0 +1,973 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc2
4# Fri Nov 25 17:26:50 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_PPC=y
11CONFIG_PPC32=y
12CONFIG_GENERIC_NVRAM=y
13CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
14CONFIG_ARCH_MAY_HAVE_PC_FDC=y
15
16#
17# Code maturity level options
18#
19CONFIG_EXPERIMENTAL=y
20CONFIG_CLEAN_COMPILE=y
21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
23
24#
25# General setup
26#
27CONFIG_LOCALVERSION=""
28CONFIG_LOCALVERSION_AUTO=y
29CONFIG_SWAP=y
30CONFIG_SYSVIPC=y
31# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set
33CONFIG_SYSCTL=y
34# CONFIG_AUDIT is not set
35# CONFIG_HOTPLUG is not set
36CONFIG_KOBJECT_UEVENT=y
37# CONFIG_IKCONFIG is not set
38CONFIG_INITRAMFS_SOURCE=""
39CONFIG_EMBEDDED=y
40# CONFIG_KALLSYMS is not set
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_BASE_FULL=y
44CONFIG_FUTEX=y
45# CONFIG_EPOLL is not set
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SHMEM=y
48CONFIG_CC_ALIGN_FUNCTIONS=0
49CONFIG_CC_ALIGN_LABELS=0
50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0
52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
54
55#
56# Loadable module support
57#
58# CONFIG_MODULES is not set
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Processor
80#
81# CONFIG_6xx is not set
82# CONFIG_40x is not set
83# CONFIG_44x is not set
84# CONFIG_POWER3 is not set
85# CONFIG_POWER4 is not set
86# CONFIG_8xx is not set
87# CONFIG_E200 is not set
88CONFIG_E500=y
89CONFIG_BOOKE=y
90CONFIG_FSL_BOOKE=y
91# CONFIG_PHYS_64BIT is not set
92CONFIG_SPE=y
93CONFIG_MATH_EMULATION=y
94# CONFIG_KEXEC is not set
95# CONFIG_CPU_FREQ is not set
96# CONFIG_WANT_EARLY_SERIAL is not set
97CONFIG_PPC_GEN550=y
98CONFIG_85xx=y
99CONFIG_PPC_INDIRECT_PCI_BE=y
100
101#
102# Freescale 85xx options
103#
104# CONFIG_MPC8540_ADS is not set
105# CONFIG_MPC8548_CDS is not set
106# CONFIG_MPC8555_CDS is not set
107# CONFIG_MPC8560_ADS is not set
108# CONFIG_SBC8560 is not set
109# CONFIG_STX_GP3 is not set
110CONFIG_TQM8540=y
111# CONFIG_TQM8541 is not set
112# CONFIG_TQM8555 is not set
113# CONFIG_TQM8560 is not set
114CONFIG_MPC8540=y
115
116#
117# Platform options
118#
119# CONFIG_HIGHMEM is not set
120# CONFIG_HZ_100 is not set
121CONFIG_HZ_250=y
122# CONFIG_HZ_1000 is not set
123CONFIG_HZ=250
124CONFIG_PREEMPT_NONE=y
125# CONFIG_PREEMPT_VOLUNTARY is not set
126# CONFIG_PREEMPT is not set
127CONFIG_SELECT_MEMORY_MODEL=y
128CONFIG_FLATMEM_MANUAL=y
129# CONFIG_DISCONTIGMEM_MANUAL is not set
130# CONFIG_SPARSEMEM_MANUAL is not set
131CONFIG_FLATMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y
133# CONFIG_SPARSEMEM_STATIC is not set
134CONFIG_SPLIT_PTLOCK_CPUS=4
135CONFIG_BINFMT_ELF=y
136# CONFIG_BINFMT_MISC is not set
137# CONFIG_CMDLINE_BOOL is not set
138# CONFIG_PM is not set
139# CONFIG_SOFTWARE_SUSPEND is not set
140CONFIG_SECCOMP=y
141CONFIG_ISA_DMA_API=y
142
143#
144# Bus options
145#
146CONFIG_PPC_I8259=y
147CONFIG_PPC_INDIRECT_PCI=y
148CONFIG_PCI=y
149CONFIG_PCI_DOMAINS=y
150# CONFIG_PCI_LEGACY_PROC is not set
151
152#
153# PCCARD (PCMCIA/CardBus) support
154#
155# CONFIG_PCCARD is not set
156# CONFIG_RAPIDIO is not set
157
158#
159# Advanced setup
160#
161# CONFIG_ADVANCED_OPTIONS is not set
162
163#
164# Default settings for advanced configuration options are used
165#
166CONFIG_HIGHMEM_START=0xfe000000
167CONFIG_LOWMEM_SIZE=0x30000000
168CONFIG_KERNEL_START=0xc0000000
169CONFIG_TASK_SIZE=0x80000000
170CONFIG_BOOT_LOAD=0x00800000
171
172#
173# Networking
174#
175CONFIG_NET=y
176
177#
178# Networking options
179#
180CONFIG_PACKET=y
181# CONFIG_PACKET_MMAP is not set
182CONFIG_UNIX=y
183# CONFIG_NET_KEY is not set
184CONFIG_INET=y
185CONFIG_IP_MULTICAST=y
186# CONFIG_IP_ADVANCED_ROUTER is not set
187CONFIG_IP_FIB_HASH=y
188CONFIG_IP_PNP=y
189CONFIG_IP_PNP_DHCP=y
190CONFIG_IP_PNP_BOOTP=y
191# CONFIG_IP_PNP_RARP is not set
192# CONFIG_NET_IPIP is not set
193# CONFIG_NET_IPGRE is not set
194# CONFIG_IP_MROUTE is not set
195# CONFIG_ARPD is not set
196CONFIG_SYN_COOKIES=y
197# CONFIG_INET_AH is not set
198# CONFIG_INET_ESP is not set
199# CONFIG_INET_IPCOMP is not set
200# CONFIG_INET_TUNNEL is not set
201CONFIG_INET_DIAG=y
202CONFIG_INET_TCP_DIAG=y
203# CONFIG_TCP_CONG_ADVANCED is not set
204CONFIG_TCP_CONG_BIC=y
205# CONFIG_IPV6 is not set
206# CONFIG_NETFILTER is not set
207
208#
209# DCCP Configuration (EXPERIMENTAL)
210#
211# CONFIG_IP_DCCP is not set
212
213#
214# SCTP Configuration (EXPERIMENTAL)
215#
216# CONFIG_IP_SCTP is not set
217# CONFIG_ATM is not set
218# CONFIG_BRIDGE is not set
219# CONFIG_VLAN_8021Q is not set
220# CONFIG_DECNET is not set
221# CONFIG_LLC2 is not set
222# CONFIG_IPX is not set
223# CONFIG_ATALK is not set
224# CONFIG_X25 is not set
225# CONFIG_LAPB is not set
226# CONFIG_NET_DIVERT is not set
227# CONFIG_ECONET is not set
228# CONFIG_WAN_ROUTER is not set
229
230#
231# QoS and/or fair queueing
232#
233# CONFIG_NET_SCHED is not set
234
235#
236# Network testing
237#
238# CONFIG_NET_PKTGEN is not set
239# CONFIG_HAMRADIO is not set
240# CONFIG_IRDA is not set
241# CONFIG_BT is not set
242# CONFIG_IEEE80211 is not set
243
244#
245# Device Drivers
246#
247
248#
249# Generic Driver Options
250#
251CONFIG_STANDALONE=y
252CONFIG_PREVENT_FIRMWARE_BUILD=y
253# CONFIG_FW_LOADER is not set
254
255#
256# Connector - unified userspace <-> kernelspace linker
257#
258# CONFIG_CONNECTOR is not set
259
260#
261# Memory Technology Devices (MTD)
262#
263CONFIG_MTD=y
264# CONFIG_MTD_DEBUG is not set
265CONFIG_MTD_CONCAT=y
266CONFIG_MTD_PARTITIONS=y
267# CONFIG_MTD_REDBOOT_PARTS is not set
268CONFIG_MTD_CMDLINE_PARTS=y
269
270#
271# User Modules And Translation Layers
272#
273CONFIG_MTD_CHAR=y
274CONFIG_MTD_BLOCK=y
275# CONFIG_FTL is not set
276# CONFIG_NFTL is not set
277# CONFIG_INFTL is not set
278# CONFIG_RFD_FTL is not set
279
280#
281# RAM/ROM/Flash chip drivers
282#
283CONFIG_MTD_CFI=y
284# CONFIG_MTD_JEDECPROBE is not set
285CONFIG_MTD_GEN_PROBE=y
286# CONFIG_MTD_CFI_ADV_OPTIONS is not set
287CONFIG_MTD_MAP_BANK_WIDTH_1=y
288CONFIG_MTD_MAP_BANK_WIDTH_2=y
289CONFIG_MTD_MAP_BANK_WIDTH_4=y
290# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
291# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
292# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
293CONFIG_MTD_CFI_I1=y
294CONFIG_MTD_CFI_I2=y
295# CONFIG_MTD_CFI_I4 is not set
296# CONFIG_MTD_CFI_I8 is not set
297# CONFIG_MTD_CFI_INTELEXT is not set
298CONFIG_MTD_CFI_AMDSTD=y
299CONFIG_MTD_CFI_AMDSTD_RETRY=0
300# CONFIG_MTD_CFI_STAA is not set
301CONFIG_MTD_CFI_UTIL=y
302# CONFIG_MTD_RAM is not set
303# CONFIG_MTD_ROM is not set
304# CONFIG_MTD_ABSENT is not set
305
306#
307# Mapping drivers for chip access
308#
309# CONFIG_MTD_COMPLEX_MAPPINGS is not set
310# CONFIG_MTD_PHYSMAP is not set
311CONFIG_MTD_TQM85xx=y
312# CONFIG_MTD_PLATRAM is not set
313
314#
315# Self-contained MTD device drivers
316#
317# CONFIG_MTD_PMC551 is not set
318# CONFIG_MTD_SLRAM is not set
319# CONFIG_MTD_PHRAM is not set
320# CONFIG_MTD_MTDRAM is not set
321# CONFIG_MTD_BLKMTD is not set
322# CONFIG_MTD_BLOCK2MTD is not set
323
324#
325# Disk-On-Chip Device Drivers
326#
327# CONFIG_MTD_DOC2000 is not set
328# CONFIG_MTD_DOC2001 is not set
329# CONFIG_MTD_DOC2001PLUS is not set
330
331#
332# NAND Flash Device Drivers
333#
334# CONFIG_MTD_NAND is not set
335
336#
337# OneNAND Flash Device Drivers
338#
339# CONFIG_MTD_ONENAND is not set
340
341#
342# Parallel port support
343#
344# CONFIG_PARPORT is not set
345
346#
347# Plug and Play support
348#
349
350#
351# Block devices
352#
353# CONFIG_BLK_DEV_FD is not set
354# CONFIG_BLK_CPQ_DA is not set
355# CONFIG_BLK_CPQ_CISS_DA is not set
356# CONFIG_BLK_DEV_DAC960 is not set
357# CONFIG_BLK_DEV_UMEM is not set
358# CONFIG_BLK_DEV_COW_COMMON is not set
359CONFIG_BLK_DEV_LOOP=y
360# CONFIG_BLK_DEV_CRYPTOLOOP is not set
361# CONFIG_BLK_DEV_NBD is not set
362# CONFIG_BLK_DEV_SX8 is not set
363CONFIG_BLK_DEV_RAM=y
364CONFIG_BLK_DEV_RAM_COUNT=16
365CONFIG_BLK_DEV_RAM_SIZE=32768
366CONFIG_BLK_DEV_INITRD=y
367# CONFIG_CDROM_PKTCDVD is not set
368# CONFIG_ATA_OVER_ETH is not set
369
370#
371# ATA/ATAPI/MFM/RLL support
372#
373CONFIG_IDE=y
374CONFIG_BLK_DEV_IDE=y
375
376#
377# Please see Documentation/ide.txt for help/info on IDE drives
378#
379# CONFIG_BLK_DEV_IDE_SATA is not set
380CONFIG_BLK_DEV_IDEDISK=y
381# CONFIG_IDEDISK_MULTI_MODE is not set
382# CONFIG_BLK_DEV_IDECD is not set
383# CONFIG_BLK_DEV_IDETAPE is not set
384# CONFIG_BLK_DEV_IDEFLOPPY is not set
385# CONFIG_IDE_TASK_IOCTL is not set
386
387#
388# IDE chipset support/bugfixes
389#
390CONFIG_IDE_GENERIC=y
391CONFIG_BLK_DEV_IDEPCI=y
392CONFIG_IDEPCI_SHARE_IRQ=y
393# CONFIG_BLK_DEV_OFFBOARD is not set
394CONFIG_BLK_DEV_GENERIC=y
395# CONFIG_BLK_DEV_OPTI621 is not set
396# CONFIG_BLK_DEV_SL82C105 is not set
397CONFIG_BLK_DEV_IDEDMA_PCI=y
398# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
399CONFIG_IDEDMA_PCI_AUTO=y
400# CONFIG_IDEDMA_ONLYDISK is not set
401# CONFIG_BLK_DEV_AEC62XX is not set
402# CONFIG_BLK_DEV_ALI15X3 is not set
403# CONFIG_BLK_DEV_AMD74XX is not set
404# CONFIG_BLK_DEV_CMD64X is not set
405# CONFIG_BLK_DEV_TRIFLEX is not set
406# CONFIG_BLK_DEV_CY82C693 is not set
407# CONFIG_BLK_DEV_CS5520 is not set
408# CONFIG_BLK_DEV_CS5530 is not set
409# CONFIG_BLK_DEV_HPT34X is not set
410# CONFIG_BLK_DEV_HPT366 is not set
411# CONFIG_BLK_DEV_SC1200 is not set
412# CONFIG_BLK_DEV_PIIX is not set
413# CONFIG_BLK_DEV_IT821X is not set
414# CONFIG_BLK_DEV_NS87415 is not set
415# CONFIG_BLK_DEV_PDC202XX_OLD is not set
416# CONFIG_BLK_DEV_PDC202XX_NEW is not set
417# CONFIG_BLK_DEV_SVWKS is not set
418# CONFIG_BLK_DEV_SIIMAGE is not set
419# CONFIG_BLK_DEV_SLC90E66 is not set
420# CONFIG_BLK_DEV_TRM290 is not set
421CONFIG_BLK_DEV_VIA82CXXX=y
422# CONFIG_IDE_ARM is not set
423CONFIG_BLK_DEV_IDEDMA=y
424# CONFIG_IDEDMA_IVB is not set
425CONFIG_IDEDMA_AUTO=y
426# CONFIG_BLK_DEV_HD is not set
427
428#
429# SCSI device support
430#
431# CONFIG_RAID_ATTRS is not set
432# CONFIG_SCSI is not set
433
434#
435# Multi-device support (RAID and LVM)
436#
437# CONFIG_MD is not set
438
439#
440# Fusion MPT device support
441#
442# CONFIG_FUSION is not set
443
444#
445# IEEE 1394 (FireWire) support
446#
447# CONFIG_IEEE1394 is not set
448
449#
450# I2O device support
451#
452# CONFIG_I2O is not set
453
454#
455# Macintosh device drivers
456#
457# CONFIG_WINDFARM is not set
458
459#
460# Network device support
461#
462CONFIG_NETDEVICES=y
463# CONFIG_DUMMY is not set
464# CONFIG_BONDING is not set
465# CONFIG_EQUALIZER is not set
466# CONFIG_TUN is not set
467
468#
469# ARCnet devices
470#
471# CONFIG_ARCNET is not set
472
473#
474# PHY device support
475#
476CONFIG_PHYLIB=y
477
478#
479# MII PHY device drivers
480#
481# CONFIG_MARVELL_PHY is not set
482# CONFIG_DAVICOM_PHY is not set
483# CONFIG_QSEMI_PHY is not set
484# CONFIG_LXT_PHY is not set
485# CONFIG_CICADA_PHY is not set
486
487#
488# Ethernet (10 or 100Mbit)
489#
490CONFIG_NET_ETHERNET=y
491CONFIG_MII=y
492# CONFIG_HAPPYMEAL is not set
493# CONFIG_SUNGEM is not set
494# CONFIG_CASSINI is not set
495# CONFIG_NET_VENDOR_3COM is not set
496
497#
498# Tulip family network device support
499#
500# CONFIG_NET_TULIP is not set
501# CONFIG_HP100 is not set
502CONFIG_NET_PCI=y
503# CONFIG_PCNET32 is not set
504# CONFIG_AMD8111_ETH is not set
505# CONFIG_ADAPTEC_STARFIRE is not set
506# CONFIG_B44 is not set
507# CONFIG_FORCEDETH is not set
508# CONFIG_DGRS is not set
509# CONFIG_EEPRO100 is not set
510CONFIG_E100=y
511# CONFIG_FEALNX is not set
512# CONFIG_NATSEMI is not set
513# CONFIG_NE2K_PCI is not set
514# CONFIG_8139CP is not set
515# CONFIG_8139TOO is not set
516# CONFIG_SIS900 is not set
517# CONFIG_EPIC100 is not set
518# CONFIG_SUNDANCE is not set
519# CONFIG_TLAN is not set
520# CONFIG_VIA_RHINE is not set
521
522#
523# Ethernet (1000 Mbit)
524#
525# CONFIG_ACENIC is not set
526# CONFIG_DL2K is not set
527# CONFIG_E1000 is not set
528# CONFIG_NS83820 is not set
529# CONFIG_HAMACHI is not set
530# CONFIG_YELLOWFIN is not set
531# CONFIG_R8169 is not set
532# CONFIG_SIS190 is not set
533# CONFIG_SKGE is not set
534# CONFIG_SK98LIN is not set
535# CONFIG_VIA_VELOCITY is not set
536# CONFIG_TIGON3 is not set
537# CONFIG_BNX2 is not set
538CONFIG_GIANFAR=y
539CONFIG_GFAR_NAPI=y
540
541#
542# Ethernet (10000 Mbit)
543#
544# CONFIG_CHELSIO_T1 is not set
545# CONFIG_IXGB is not set
546# CONFIG_S2IO is not set
547
548#
549# Token Ring devices
550#
551# CONFIG_TR is not set
552
553#
554# Wireless LAN (non-hamradio)
555#
556# CONFIG_NET_RADIO is not set
557
558#
559# Wan interfaces
560#
561# CONFIG_WAN is not set
562# CONFIG_FDDI is not set
563# CONFIG_HIPPI is not set
564# CONFIG_PPP is not set
565# CONFIG_SLIP is not set
566# CONFIG_SHAPER is not set
567# CONFIG_NETCONSOLE is not set
568# CONFIG_NETPOLL is not set
569# CONFIG_NET_POLL_CONTROLLER is not set
570
571#
572# ISDN subsystem
573#
574# CONFIG_ISDN is not set
575
576#
577# Telephony Support
578#
579# CONFIG_PHONE is not set
580
581#
582# Input device support
583#
584CONFIG_INPUT=y
585
586#
587# Userland interfaces
588#
589# CONFIG_INPUT_MOUSEDEV is not set
590# CONFIG_INPUT_JOYDEV is not set
591# CONFIG_INPUT_TSDEV is not set
592# CONFIG_INPUT_EVDEV is not set
593# CONFIG_INPUT_EVBUG is not set
594
595#
596# Input Device Drivers
597#
598# CONFIG_INPUT_KEYBOARD is not set
599# CONFIG_INPUT_MOUSE is not set
600# CONFIG_INPUT_JOYSTICK is not set
601# CONFIG_INPUT_TOUCHSCREEN is not set
602# CONFIG_INPUT_MISC is not set
603
604#
605# Hardware I/O ports
606#
607# CONFIG_SERIO is not set
608# CONFIG_GAMEPORT is not set
609
610#
611# Character devices
612#
613# CONFIG_VT is not set
614# CONFIG_SERIAL_NONSTANDARD is not set
615
616#
617# Serial drivers
618#
619CONFIG_SERIAL_8250=y
620CONFIG_SERIAL_8250_CONSOLE=y
621CONFIG_SERIAL_8250_NR_UARTS=4
622# CONFIG_SERIAL_8250_EXTENDED is not set
623
624#
625# Non-8250 serial port support
626#
627CONFIG_SERIAL_CORE=y
628CONFIG_SERIAL_CORE_CONSOLE=y
629# CONFIG_SERIAL_JSM is not set
630CONFIG_UNIX98_PTYS=y
631CONFIG_LEGACY_PTYS=y
632CONFIG_LEGACY_PTY_COUNT=256
633
634#
635# IPMI
636#
637# CONFIG_IPMI_HANDLER is not set
638
639#
640# Watchdog Cards
641#
642# CONFIG_WATCHDOG is not set
643# CONFIG_NVRAM is not set
644CONFIG_GEN_RTC=y
645# CONFIG_GEN_RTC_X is not set
646# CONFIG_DTLK is not set
647# CONFIG_R3964 is not set
648# CONFIG_APPLICOM is not set
649
650#
651# Ftape, the floppy tape device driver
652#
653# CONFIG_AGP is not set
654# CONFIG_DRM is not set
655# CONFIG_RAW_DRIVER is not set
656
657#
658# TPM devices
659#
660# CONFIG_TCG_TPM is not set
661# CONFIG_TELCLOCK is not set
662
663#
664# I2C support
665#
666CONFIG_I2C=y
667CONFIG_I2C_CHARDEV=y
668
669#
670# I2C Algorithms
671#
672# CONFIG_I2C_ALGOBIT is not set
673# CONFIG_I2C_ALGOPCF is not set
674# CONFIG_I2C_ALGOPCA is not set
675
676#
677# I2C Hardware Bus support
678#
679# CONFIG_I2C_ALI1535 is not set
680# CONFIG_I2C_ALI1563 is not set
681# CONFIG_I2C_ALI15X3 is not set
682# CONFIG_I2C_AMD756 is not set
683# CONFIG_I2C_AMD8111 is not set
684# CONFIG_I2C_I801 is not set
685# CONFIG_I2C_I810 is not set
686# CONFIG_I2C_PIIX4 is not set
687CONFIG_I2C_MPC=y
688# CONFIG_I2C_NFORCE2 is not set
689# CONFIG_I2C_PARPORT_LIGHT is not set
690# CONFIG_I2C_PROSAVAGE is not set
691# CONFIG_I2C_SAVAGE4 is not set
692# CONFIG_SCx200_ACB is not set
693# CONFIG_I2C_SIS5595 is not set
694# CONFIG_I2C_SIS630 is not set
695# CONFIG_I2C_SIS96X is not set
696# CONFIG_I2C_VIA is not set
697# CONFIG_I2C_VIAPRO is not set
698# CONFIG_I2C_VOODOO3 is not set
699# CONFIG_I2C_PCA_ISA is not set
700
701#
702# Miscellaneous I2C Chip support
703#
704CONFIG_SENSORS_DS1337=y
705# CONFIG_SENSORS_DS1374 is not set
706# CONFIG_SENSORS_EEPROM is not set
707# CONFIG_SENSORS_PCF8574 is not set
708# CONFIG_SENSORS_PCA9539 is not set
709# CONFIG_SENSORS_PCF8591 is not set
710# CONFIG_SENSORS_RTC8564 is not set
711# CONFIG_SENSORS_M41T00 is not set
712# CONFIG_SENSORS_MAX6875 is not set
713# CONFIG_RTC_X1205_I2C is not set
714# CONFIG_I2C_DEBUG_CORE is not set
715# CONFIG_I2C_DEBUG_ALGO is not set
716# CONFIG_I2C_DEBUG_BUS is not set
717# CONFIG_I2C_DEBUG_CHIP is not set
718
719#
720# Dallas's 1-wire bus
721#
722# CONFIG_W1 is not set
723
724#
725# Hardware Monitoring support
726#
727CONFIG_HWMON=y
728# CONFIG_HWMON_VID is not set
729# CONFIG_SENSORS_ADM1021 is not set
730# CONFIG_SENSORS_ADM1025 is not set
731# CONFIG_SENSORS_ADM1026 is not set
732# CONFIG_SENSORS_ADM1031 is not set
733# CONFIG_SENSORS_ADM9240 is not set
734# CONFIG_SENSORS_ASB100 is not set
735# CONFIG_SENSORS_ATXP1 is not set
736# CONFIG_SENSORS_DS1621 is not set
737# CONFIG_SENSORS_FSCHER is not set
738# CONFIG_SENSORS_FSCPOS is not set
739# CONFIG_SENSORS_GL518SM is not set
740# CONFIG_SENSORS_GL520SM is not set
741# CONFIG_SENSORS_IT87 is not set
742# CONFIG_SENSORS_LM63 is not set
743CONFIG_SENSORS_LM75=y
744# CONFIG_SENSORS_LM77 is not set
745# CONFIG_SENSORS_LM78 is not set
746# CONFIG_SENSORS_LM80 is not set
747# CONFIG_SENSORS_LM83 is not set
748# CONFIG_SENSORS_LM85 is not set
749# CONFIG_SENSORS_LM87 is not set
750# CONFIG_SENSORS_LM90 is not set
751# CONFIG_SENSORS_LM92 is not set
752# CONFIG_SENSORS_MAX1619 is not set
753# CONFIG_SENSORS_PC87360 is not set
754# CONFIG_SENSORS_SIS5595 is not set
755# CONFIG_SENSORS_SMSC47M1 is not set
756# CONFIG_SENSORS_SMSC47B397 is not set
757# CONFIG_SENSORS_VIA686A is not set
758# CONFIG_SENSORS_W83781D is not set
759# CONFIG_SENSORS_W83792D is not set
760# CONFIG_SENSORS_W83L785TS is not set
761# CONFIG_SENSORS_W83627HF is not set
762# CONFIG_SENSORS_W83627EHF is not set
763CONFIG_HWMON_DEBUG_CHIP=y
764
765#
766# Misc devices
767#
768
769#
770# Multimedia Capabilities Port drivers
771#
772
773#
774# Multimedia devices
775#
776# CONFIG_VIDEO_DEV is not set
777
778#
779# Digital Video Broadcasting Devices
780#
781# CONFIG_DVB is not set
782
783#
784# Graphics support
785#
786# CONFIG_FB is not set
787
788#
789# Sound
790#
791# CONFIG_SOUND is not set
792
793#
794# USB support
795#
796CONFIG_USB_ARCH_HAS_HCD=y
797CONFIG_USB_ARCH_HAS_OHCI=y
798# CONFIG_USB is not set
799
800#
801# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
802#
803
804#
805# USB Gadget Support
806#
807# CONFIG_USB_GADGET is not set
808
809#
810# MMC/SD Card support
811#
812# CONFIG_MMC is not set
813
814#
815# InfiniBand support
816#
817# CONFIG_INFINIBAND is not set
818
819#
820# SN Devices
821#
822
823#
824# File systems
825#
826CONFIG_EXT2_FS=y
827# CONFIG_EXT2_FS_XATTR is not set
828# CONFIG_EXT2_FS_XIP is not set
829CONFIG_EXT3_FS=y
830CONFIG_EXT3_FS_XATTR=y
831# CONFIG_EXT3_FS_POSIX_ACL is not set
832# CONFIG_EXT3_FS_SECURITY is not set
833CONFIG_JBD=y
834# CONFIG_JBD_DEBUG is not set
835CONFIG_FS_MBCACHE=y
836# CONFIG_REISERFS_FS is not set
837# CONFIG_JFS_FS is not set
838# CONFIG_FS_POSIX_ACL is not set
839# CONFIG_XFS_FS is not set
840# CONFIG_MINIX_FS is not set
841# CONFIG_ROMFS_FS is not set
842CONFIG_INOTIFY=y
843# CONFIG_QUOTA is not set
844CONFIG_DNOTIFY=y
845# CONFIG_AUTOFS_FS is not set
846# CONFIG_AUTOFS4_FS is not set
847# CONFIG_FUSE_FS is not set
848
849#
850# CD-ROM/DVD Filesystems
851#
852# CONFIG_ISO9660_FS is not set
853# CONFIG_UDF_FS is not set
854
855#
856# DOS/FAT/NT Filesystems
857#
858# CONFIG_MSDOS_FS is not set
859# CONFIG_VFAT_FS is not set
860# CONFIG_NTFS_FS is not set
861
862#
863# Pseudo filesystems
864#
865CONFIG_PROC_FS=y
866CONFIG_PROC_KCORE=y
867CONFIG_SYSFS=y
868CONFIG_TMPFS=y
869# CONFIG_HUGETLB_PAGE is not set
870CONFIG_RAMFS=y
871# CONFIG_RELAYFS_FS is not set
872
873#
874# Miscellaneous filesystems
875#
876# CONFIG_ADFS_FS is not set
877# CONFIG_AFFS_FS is not set
878# CONFIG_HFS_FS is not set
879# CONFIG_HFSPLUS_FS is not set
880# CONFIG_BEFS_FS is not set
881# CONFIG_BFS_FS is not set
882# CONFIG_EFS_FS is not set
883# CONFIG_JFFS_FS is not set
884CONFIG_JFFS2_FS=y
885CONFIG_JFFS2_FS_DEBUG=0
886CONFIG_JFFS2_FS_WRITEBUFFER=y
887# CONFIG_JFFS2_SUMMARY is not set
888# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
889CONFIG_JFFS2_ZLIB=y
890CONFIG_JFFS2_RTIME=y
891# CONFIG_JFFS2_RUBIN is not set
892CONFIG_CRAMFS=y
893# CONFIG_VXFS_FS is not set
894# CONFIG_HPFS_FS is not set
895# CONFIG_QNX4FS_FS is not set
896# CONFIG_SYSV_FS is not set
897# CONFIG_UFS_FS is not set
898
899#
900# Network File Systems
901#
902CONFIG_NFS_FS=y
903# CONFIG_NFS_V3 is not set
904# CONFIG_NFS_V4 is not set
905# CONFIG_NFS_DIRECTIO is not set
906# CONFIG_NFSD is not set
907CONFIG_ROOT_NFS=y
908CONFIG_LOCKD=y
909CONFIG_NFS_COMMON=y
910CONFIG_SUNRPC=y
911# CONFIG_RPCSEC_GSS_KRB5 is not set
912# CONFIG_RPCSEC_GSS_SPKM3 is not set
913# CONFIG_SMB_FS is not set
914# CONFIG_CIFS is not set
915# CONFIG_NCP_FS is not set
916# CONFIG_CODA_FS is not set
917# CONFIG_AFS_FS is not set
918# CONFIG_9P_FS is not set
919
920#
921# Partition Types
922#
923CONFIG_PARTITION_ADVANCED=y
924# CONFIG_ACORN_PARTITION is not set
925# CONFIG_OSF_PARTITION is not set
926# CONFIG_AMIGA_PARTITION is not set
927# CONFIG_ATARI_PARTITION is not set
928# CONFIG_MAC_PARTITION is not set
929# CONFIG_MSDOS_PARTITION is not set
930# CONFIG_LDM_PARTITION is not set
931# CONFIG_SGI_PARTITION is not set
932# CONFIG_ULTRIX_PARTITION is not set
933# CONFIG_SUN_PARTITION is not set
934# CONFIG_EFI_PARTITION is not set
935
936#
937# Native Language Support
938#
939# CONFIG_NLS is not set
940
941#
942# Library routines
943#
944# CONFIG_CRC_CCITT is not set
945# CONFIG_CRC16 is not set
946CONFIG_CRC32=y
947# CONFIG_LIBCRC32C is not set
948CONFIG_ZLIB_INFLATE=y
949CONFIG_ZLIB_DEFLATE=y
950# CONFIG_PROFILING is not set
951
952#
953# Kernel hacking
954#
955# CONFIG_PRINTK_TIME is not set
956# CONFIG_DEBUG_KERNEL is not set
957CONFIG_LOG_BUF_SHIFT=14
958# CONFIG_SERIAL_TEXT_DEBUG is not set
959
960#
961# Security options
962#
963# CONFIG_KEYS is not set
964# CONFIG_SECURITY is not set
965
966#
967# Cryptographic options
968#
969# CONFIG_CRYPTO is not set
970
971#
972# Hardware crypto devices
973#
diff --git a/arch/ppc/configs/TQM8541_defconfig b/arch/ppc/configs/TQM8541_defconfig
new file mode 100644
index 000000000000..0ff56695d349
--- /dev/null
+++ b/arch/ppc/configs/TQM8541_defconfig
@@ -0,0 +1,986 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc2
4# Wed Nov 30 13:36:28 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_PPC=y
11CONFIG_PPC32=y
12CONFIG_GENERIC_NVRAM=y
13CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
14CONFIG_ARCH_MAY_HAVE_PC_FDC=y
15
16#
17# Code maturity level options
18#
19CONFIG_EXPERIMENTAL=y
20CONFIG_CLEAN_COMPILE=y
21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
23
24#
25# General setup
26#
27CONFIG_LOCALVERSION=""
28CONFIG_LOCALVERSION_AUTO=y
29CONFIG_SWAP=y
30CONFIG_SYSVIPC=y
31# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set
33CONFIG_SYSCTL=y
34# CONFIG_AUDIT is not set
35# CONFIG_HOTPLUG is not set
36CONFIG_KOBJECT_UEVENT=y
37# CONFIG_IKCONFIG is not set
38CONFIG_INITRAMFS_SOURCE=""
39CONFIG_EMBEDDED=y
40# CONFIG_KALLSYMS is not set
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_BASE_FULL=y
44CONFIG_FUTEX=y
45# CONFIG_EPOLL is not set
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SHMEM=y
48CONFIG_CC_ALIGN_FUNCTIONS=0
49CONFIG_CC_ALIGN_LABELS=0
50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0
52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
54
55#
56# Loadable module support
57#
58# CONFIG_MODULES is not set
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Processor
80#
81# CONFIG_6xx is not set
82# CONFIG_40x is not set
83# CONFIG_44x is not set
84# CONFIG_POWER3 is not set
85# CONFIG_POWER4 is not set
86# CONFIG_8xx is not set
87# CONFIG_E200 is not set
88CONFIG_E500=y
89CONFIG_BOOKE=y
90CONFIG_FSL_BOOKE=y
91# CONFIG_PHYS_64BIT is not set
92CONFIG_SPE=y
93CONFIG_MATH_EMULATION=y
94# CONFIG_KEXEC is not set
95# CONFIG_CPU_FREQ is not set
96# CONFIG_WANT_EARLY_SERIAL is not set
97CONFIG_PPC_GEN550=y
98CONFIG_85xx=y
99CONFIG_PPC_INDIRECT_PCI_BE=y
100
101#
102# Freescale 85xx options
103#
104# CONFIG_MPC8540_ADS is not set
105# CONFIG_MPC8548_CDS is not set
106# CONFIG_MPC8555_CDS is not set
107# CONFIG_MPC8560_ADS is not set
108# CONFIG_SBC8560 is not set
109# CONFIG_STX_GP3 is not set
110# CONFIG_TQM8540 is not set
111CONFIG_TQM8541=y
112# CONFIG_TQM8555 is not set
113# CONFIG_TQM8560 is not set
114CONFIG_MPC8555=y
115
116#
117# Platform options
118#
119CONFIG_CPM2=y
120# CONFIG_PC_KEYBOARD is not set
121# CONFIG_HIGHMEM is not set
122# CONFIG_HZ_100 is not set
123CONFIG_HZ_250=y
124# CONFIG_HZ_1000 is not set
125CONFIG_HZ=250
126CONFIG_PREEMPT_NONE=y
127# CONFIG_PREEMPT_VOLUNTARY is not set
128# CONFIG_PREEMPT is not set
129CONFIG_SELECT_MEMORY_MODEL=y
130CONFIG_FLATMEM_MANUAL=y
131# CONFIG_DISCONTIGMEM_MANUAL is not set
132# CONFIG_SPARSEMEM_MANUAL is not set
133CONFIG_FLATMEM=y
134CONFIG_FLAT_NODE_MEM_MAP=y
135# CONFIG_SPARSEMEM_STATIC is not set
136CONFIG_SPLIT_PTLOCK_CPUS=4
137CONFIG_BINFMT_ELF=y
138# CONFIG_BINFMT_MISC is not set
139# CONFIG_CMDLINE_BOOL is not set
140# CONFIG_PM is not set
141# CONFIG_SOFTWARE_SUSPEND is not set
142CONFIG_SECCOMP=y
143CONFIG_ISA_DMA_API=y
144
145#
146# Bus options
147#
148CONFIG_PPC_I8259=y
149CONFIG_PPC_INDIRECT_PCI=y
150CONFIG_PCI=y
151CONFIG_PCI_DOMAINS=y
152# CONFIG_PCI_LEGACY_PROC is not set
153
154#
155# PCCARD (PCMCIA/CardBus) support
156#
157# CONFIG_PCCARD is not set
158
159#
160# Advanced setup
161#
162# CONFIG_ADVANCED_OPTIONS is not set
163
164#
165# Default settings for advanced configuration options are used
166#
167CONFIG_HIGHMEM_START=0xfe000000
168CONFIG_LOWMEM_SIZE=0x30000000
169CONFIG_KERNEL_START=0xc0000000
170CONFIG_TASK_SIZE=0x80000000
171CONFIG_BOOT_LOAD=0x00800000
172
173#
174# Networking
175#
176CONFIG_NET=y
177
178#
179# Networking options
180#
181CONFIG_PACKET=y
182# CONFIG_PACKET_MMAP is not set
183CONFIG_UNIX=y
184# CONFIG_NET_KEY is not set
185CONFIG_INET=y
186CONFIG_IP_MULTICAST=y
187# CONFIG_IP_ADVANCED_ROUTER is not set
188CONFIG_IP_FIB_HASH=y
189CONFIG_IP_PNP=y
190CONFIG_IP_PNP_DHCP=y
191CONFIG_IP_PNP_BOOTP=y
192# CONFIG_IP_PNP_RARP is not set
193# CONFIG_NET_IPIP is not set
194# CONFIG_NET_IPGRE is not set
195# CONFIG_IP_MROUTE is not set
196# CONFIG_ARPD is not set
197CONFIG_SYN_COOKIES=y
198# CONFIG_INET_AH is not set
199# CONFIG_INET_ESP is not set
200# CONFIG_INET_IPCOMP is not set
201# CONFIG_INET_TUNNEL is not set
202CONFIG_INET_DIAG=y
203CONFIG_INET_TCP_DIAG=y
204# CONFIG_TCP_CONG_ADVANCED is not set
205CONFIG_TCP_CONG_BIC=y
206# CONFIG_IPV6 is not set
207# CONFIG_NETFILTER is not set
208
209#
210# DCCP Configuration (EXPERIMENTAL)
211#
212# CONFIG_IP_DCCP is not set
213
214#
215# SCTP Configuration (EXPERIMENTAL)
216#
217# CONFIG_IP_SCTP is not set
218# CONFIG_ATM is not set
219# CONFIG_BRIDGE is not set
220# CONFIG_VLAN_8021Q is not set
221# CONFIG_DECNET is not set
222# CONFIG_LLC2 is not set
223# CONFIG_IPX is not set
224# CONFIG_ATALK is not set
225# CONFIG_X25 is not set
226# CONFIG_LAPB is not set
227# CONFIG_NET_DIVERT is not set
228# CONFIG_ECONET is not set
229# CONFIG_WAN_ROUTER is not set
230
231#
232# QoS and/or fair queueing
233#
234# CONFIG_NET_SCHED is not set
235
236#
237# Network testing
238#
239# CONFIG_NET_PKTGEN is not set
240# CONFIG_HAMRADIO is not set
241# CONFIG_IRDA is not set
242# CONFIG_BT is not set
243# CONFIG_IEEE80211 is not set
244
245#
246# Device Drivers
247#
248
249#
250# Generic Driver Options
251#
252CONFIG_STANDALONE=y
253CONFIG_PREVENT_FIRMWARE_BUILD=y
254# CONFIG_FW_LOADER is not set
255
256#
257# Connector - unified userspace <-> kernelspace linker
258#
259# CONFIG_CONNECTOR is not set
260
261#
262# Memory Technology Devices (MTD)
263#
264CONFIG_MTD=y
265# CONFIG_MTD_DEBUG is not set
266CONFIG_MTD_CONCAT=y
267CONFIG_MTD_PARTITIONS=y
268# CONFIG_MTD_REDBOOT_PARTS is not set
269CONFIG_MTD_CMDLINE_PARTS=y
270
271#
272# User Modules And Translation Layers
273#
274CONFIG_MTD_CHAR=y
275CONFIG_MTD_BLOCK=y
276# CONFIG_FTL is not set
277# CONFIG_NFTL is not set
278# CONFIG_INFTL is not set
279# CONFIG_RFD_FTL is not set
280
281#
282# RAM/ROM/Flash chip drivers
283#
284CONFIG_MTD_CFI=y
285# CONFIG_MTD_JEDECPROBE is not set
286CONFIG_MTD_GEN_PROBE=y
287# CONFIG_MTD_CFI_ADV_OPTIONS is not set
288CONFIG_MTD_MAP_BANK_WIDTH_1=y
289CONFIG_MTD_MAP_BANK_WIDTH_2=y
290CONFIG_MTD_MAP_BANK_WIDTH_4=y
291# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
292# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
293# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
294CONFIG_MTD_CFI_I1=y
295CONFIG_MTD_CFI_I2=y
296# CONFIG_MTD_CFI_I4 is not set
297# CONFIG_MTD_CFI_I8 is not set
298# CONFIG_MTD_CFI_INTELEXT is not set
299CONFIG_MTD_CFI_AMDSTD=y
300CONFIG_MTD_CFI_AMDSTD_RETRY=0
301# CONFIG_MTD_CFI_STAA is not set
302CONFIG_MTD_CFI_UTIL=y
303# CONFIG_MTD_RAM is not set
304# CONFIG_MTD_ROM is not set
305# CONFIG_MTD_ABSENT is not set
306
307#
308# Mapping drivers for chip access
309#
310# CONFIG_MTD_COMPLEX_MAPPINGS is not set
311# CONFIG_MTD_PHYSMAP is not set
312CONFIG_MTD_TQM85xx=y
313# CONFIG_MTD_PLATRAM is not set
314
315#
316# Self-contained MTD device drivers
317#
318# CONFIG_MTD_PMC551 is not set
319# CONFIG_MTD_SLRAM is not set
320# CONFIG_MTD_PHRAM is not set
321# CONFIG_MTD_MTDRAM is not set
322# CONFIG_MTD_BLKMTD is not set
323# CONFIG_MTD_BLOCK2MTD is not set
324
325#
326# Disk-On-Chip Device Drivers
327#
328# CONFIG_MTD_DOC2000 is not set
329# CONFIG_MTD_DOC2001 is not set
330# CONFIG_MTD_DOC2001PLUS is not set
331
332#
333# NAND Flash Device Drivers
334#
335# CONFIG_MTD_NAND is not set
336
337#
338# OneNAND Flash Device Drivers
339#
340# CONFIG_MTD_ONENAND is not set
341
342#
343# Parallel port support
344#
345# CONFIG_PARPORT is not set
346
347#
348# Plug and Play support
349#
350
351#
352# Block devices
353#
354# CONFIG_BLK_DEV_FD is not set
355# CONFIG_BLK_CPQ_DA is not set
356# CONFIG_BLK_CPQ_CISS_DA is not set
357# CONFIG_BLK_DEV_DAC960 is not set
358# CONFIG_BLK_DEV_UMEM is not set
359# CONFIG_BLK_DEV_COW_COMMON is not set
360CONFIG_BLK_DEV_LOOP=y
361# CONFIG_BLK_DEV_CRYPTOLOOP is not set
362# CONFIG_BLK_DEV_NBD is not set
363# CONFIG_BLK_DEV_SX8 is not set
364CONFIG_BLK_DEV_RAM=y
365CONFIG_BLK_DEV_RAM_COUNT=16
366CONFIG_BLK_DEV_RAM_SIZE=32768
367CONFIG_BLK_DEV_INITRD=y
368# CONFIG_CDROM_PKTCDVD is not set
369# CONFIG_ATA_OVER_ETH is not set
370
371#
372# ATA/ATAPI/MFM/RLL support
373#
374CONFIG_IDE=y
375CONFIG_BLK_DEV_IDE=y
376
377#
378# Please see Documentation/ide.txt for help/info on IDE drives
379#
380# CONFIG_BLK_DEV_IDE_SATA is not set
381CONFIG_BLK_DEV_IDEDISK=y
382# CONFIG_IDEDISK_MULTI_MODE is not set
383# CONFIG_BLK_DEV_IDECD is not set
384# CONFIG_BLK_DEV_IDETAPE is not set
385# CONFIG_BLK_DEV_IDEFLOPPY is not set
386# CONFIG_IDE_TASK_IOCTL is not set
387
388#
389# IDE chipset support/bugfixes
390#
391CONFIG_IDE_GENERIC=y
392CONFIG_BLK_DEV_IDEPCI=y
393CONFIG_IDEPCI_SHARE_IRQ=y
394# CONFIG_BLK_DEV_OFFBOARD is not set
395CONFIG_BLK_DEV_GENERIC=y
396# CONFIG_BLK_DEV_OPTI621 is not set
397# CONFIG_BLK_DEV_SL82C105 is not set
398CONFIG_BLK_DEV_IDEDMA_PCI=y
399# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
400CONFIG_IDEDMA_PCI_AUTO=y
401# CONFIG_IDEDMA_ONLYDISK is not set
402# CONFIG_BLK_DEV_AEC62XX is not set
403# CONFIG_BLK_DEV_ALI15X3 is not set
404# CONFIG_BLK_DEV_AMD74XX is not set
405# CONFIG_BLK_DEV_CMD64X is not set
406# CONFIG_BLK_DEV_TRIFLEX is not set
407# CONFIG_BLK_DEV_CY82C693 is not set
408# CONFIG_BLK_DEV_CS5520 is not set
409# CONFIG_BLK_DEV_CS5530 is not set
410# CONFIG_BLK_DEV_HPT34X is not set
411# CONFIG_BLK_DEV_HPT366 is not set
412# CONFIG_BLK_DEV_SC1200 is not set
413# CONFIG_BLK_DEV_PIIX is not set
414# CONFIG_BLK_DEV_IT821X is not set
415# CONFIG_BLK_DEV_NS87415 is not set
416# CONFIG_BLK_DEV_PDC202XX_OLD is not set
417# CONFIG_BLK_DEV_PDC202XX_NEW is not set
418# CONFIG_BLK_DEV_SVWKS is not set
419# CONFIG_BLK_DEV_SIIMAGE is not set
420# CONFIG_BLK_DEV_SLC90E66 is not set
421# CONFIG_BLK_DEV_TRM290 is not set
422CONFIG_BLK_DEV_VIA82CXXX=y
423# CONFIG_IDE_ARM is not set
424CONFIG_BLK_DEV_IDEDMA=y
425# CONFIG_IDEDMA_IVB is not set
426CONFIG_IDEDMA_AUTO=y
427# CONFIG_BLK_DEV_HD is not set
428
429#
430# SCSI device support
431#
432# CONFIG_RAID_ATTRS is not set
433# CONFIG_SCSI is not set
434
435#
436# Multi-device support (RAID and LVM)
437#
438# CONFIG_MD is not set
439
440#
441# Fusion MPT device support
442#
443# CONFIG_FUSION is not set
444
445#
446# IEEE 1394 (FireWire) support
447#
448# CONFIG_IEEE1394 is not set
449
450#
451# I2O device support
452#
453# CONFIG_I2O is not set
454
455#
456# Macintosh device drivers
457#
458# CONFIG_WINDFARM is not set
459
460#
461# Network device support
462#
463CONFIG_NETDEVICES=y
464# CONFIG_DUMMY is not set
465# CONFIG_BONDING is not set
466# CONFIG_EQUALIZER is not set
467# CONFIG_TUN is not set
468
469#
470# ARCnet devices
471#
472# CONFIG_ARCNET is not set
473
474#
475# PHY device support
476#
477CONFIG_PHYLIB=y
478
479#
480# MII PHY device drivers
481#
482# CONFIG_MARVELL_PHY is not set
483# CONFIG_DAVICOM_PHY is not set
484# CONFIG_QSEMI_PHY is not set
485# CONFIG_LXT_PHY is not set
486# CONFIG_CICADA_PHY is not set
487
488#
489# Ethernet (10 or 100Mbit)
490#
491CONFIG_NET_ETHERNET=y
492CONFIG_MII=y
493# CONFIG_HAPPYMEAL is not set
494# CONFIG_SUNGEM is not set
495# CONFIG_CASSINI is not set
496# CONFIG_NET_VENDOR_3COM is not set
497
498#
499# Tulip family network device support
500#
501# CONFIG_NET_TULIP is not set
502# CONFIG_HP100 is not set
503CONFIG_NET_PCI=y
504# CONFIG_PCNET32 is not set
505# CONFIG_AMD8111_ETH is not set
506# CONFIG_ADAPTEC_STARFIRE is not set
507# CONFIG_B44 is not set
508# CONFIG_FORCEDETH is not set
509# CONFIG_DGRS is not set
510# CONFIG_EEPRO100 is not set
511CONFIG_E100=y
512# CONFIG_FEALNX is not set
513# CONFIG_NATSEMI is not set
514# CONFIG_NE2K_PCI is not set
515# CONFIG_8139CP is not set
516# CONFIG_8139TOO is not set
517# CONFIG_SIS900 is not set
518# CONFIG_EPIC100 is not set
519# CONFIG_SUNDANCE is not set
520# CONFIG_TLAN is not set
521# CONFIG_VIA_RHINE is not set
522# CONFIG_FS_ENET is not set
523
524#
525# Ethernet (1000 Mbit)
526#
527# CONFIG_ACENIC is not set
528# CONFIG_DL2K is not set
529# CONFIG_E1000 is not set
530# CONFIG_NS83820 is not set
531# CONFIG_HAMACHI is not set
532# CONFIG_YELLOWFIN is not set
533# CONFIG_R8169 is not set
534# CONFIG_SIS190 is not set
535# CONFIG_SKGE is not set
536# CONFIG_SK98LIN is not set
537# CONFIG_VIA_VELOCITY is not set
538# CONFIG_TIGON3 is not set
539# CONFIG_BNX2 is not set
540CONFIG_GIANFAR=y
541CONFIG_GFAR_NAPI=y
542
543#
544# Ethernet (10000 Mbit)
545#
546# CONFIG_CHELSIO_T1 is not set
547# CONFIG_IXGB is not set
548# CONFIG_S2IO is not set
549
550#
551# Token Ring devices
552#
553# CONFIG_TR is not set
554
555#
556# Wireless LAN (non-hamradio)
557#
558# CONFIG_NET_RADIO is not set
559
560#
561# Wan interfaces
562#
563# CONFIG_WAN is not set
564# CONFIG_FDDI is not set
565# CONFIG_HIPPI is not set
566# CONFIG_PPP is not set
567# CONFIG_SLIP is not set
568# CONFIG_SHAPER is not set
569# CONFIG_NETCONSOLE is not set
570# CONFIG_NETPOLL is not set
571# CONFIG_NET_POLL_CONTROLLER is not set
572
573#
574# ISDN subsystem
575#
576# CONFIG_ISDN is not set
577
578#
579# Telephony Support
580#
581# CONFIG_PHONE is not set
582
583#
584# Input device support
585#
586CONFIG_INPUT=y
587
588#
589# Userland interfaces
590#
591# CONFIG_INPUT_MOUSEDEV is not set
592# CONFIG_INPUT_JOYDEV is not set
593# CONFIG_INPUT_TSDEV is not set
594# CONFIG_INPUT_EVDEV is not set
595# CONFIG_INPUT_EVBUG is not set
596
597#
598# Input Device Drivers
599#
600# CONFIG_INPUT_KEYBOARD is not set
601# CONFIG_INPUT_MOUSE is not set
602# CONFIG_INPUT_JOYSTICK is not set
603# CONFIG_INPUT_TOUCHSCREEN is not set
604# CONFIG_INPUT_MISC is not set
605
606#
607# Hardware I/O ports
608#
609# CONFIG_SERIO is not set
610# CONFIG_GAMEPORT is not set
611
612#
613# Character devices
614#
615# CONFIG_VT is not set
616# CONFIG_SERIAL_NONSTANDARD is not set
617
618#
619# Serial drivers
620#
621CONFIG_SERIAL_8250=y
622CONFIG_SERIAL_8250_CONSOLE=y
623CONFIG_SERIAL_8250_NR_UARTS=4
624# CONFIG_SERIAL_8250_EXTENDED is not set
625
626#
627# Non-8250 serial port support
628#
629CONFIG_SERIAL_CORE=y
630CONFIG_SERIAL_CORE_CONSOLE=y
631# CONFIG_SERIAL_CPM is not set
632# CONFIG_SERIAL_JSM is not set
633CONFIG_UNIX98_PTYS=y
634CONFIG_LEGACY_PTYS=y
635CONFIG_LEGACY_PTY_COUNT=256
636
637#
638# IPMI
639#
640# CONFIG_IPMI_HANDLER is not set
641
642#
643# Watchdog Cards
644#
645# CONFIG_WATCHDOG is not set
646# CONFIG_NVRAM is not set
647CONFIG_GEN_RTC=y
648# CONFIG_GEN_RTC_X is not set
649# CONFIG_DTLK is not set
650# CONFIG_R3964 is not set
651# CONFIG_APPLICOM is not set
652
653#
654# Ftape, the floppy tape device driver
655#
656# CONFIG_AGP is not set
657# CONFIG_DRM is not set
658# CONFIG_RAW_DRIVER is not set
659
660#
661# TPM devices
662#
663# CONFIG_TCG_TPM is not set
664# CONFIG_TELCLOCK is not set
665
666#
667# I2C support
668#
669CONFIG_I2C=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_ALI1535 is not set
683# CONFIG_I2C_ALI1563 is not set
684# CONFIG_I2C_ALI15X3 is not set
685# CONFIG_I2C_AMD756 is not set
686# CONFIG_I2C_AMD8111 is not set
687# CONFIG_I2C_I801 is not set
688# CONFIG_I2C_I810 is not set
689# CONFIG_I2C_PIIX4 is not set
690CONFIG_I2C_MPC=y
691# CONFIG_I2C_MPC8260 is not set
692# CONFIG_I2C_NFORCE2 is not set
693# CONFIG_I2C_PARPORT_LIGHT is not set
694# CONFIG_I2C_PROSAVAGE is not set
695# CONFIG_I2C_SAVAGE4 is not set
696# CONFIG_SCx200_ACB is not set
697# CONFIG_I2C_SIS5595 is not set
698# CONFIG_I2C_SIS630 is not set
699# CONFIG_I2C_SIS96X is not set
700# CONFIG_I2C_VIA is not set
701# CONFIG_I2C_VIAPRO is not set
702# CONFIG_I2C_VOODOO3 is not set
703# CONFIG_I2C_PCA_ISA is not set
704
705#
706# Miscellaneous I2C Chip support
707#
708CONFIG_SENSORS_DS1337=y
709# CONFIG_SENSORS_DS1374 is not set
710# CONFIG_SENSORS_EEPROM is not set
711# CONFIG_SENSORS_MAX6900 is not set
712# CONFIG_SENSORS_PCF8574 is not set
713# CONFIG_SENSORS_PCF8563 is not set
714# CONFIG_SENSORS_PCA9539 is not set
715# CONFIG_SENSORS_PCF8591 is not set
716# CONFIG_SENSORS_RTC8564 is not set
717# CONFIG_SENSORS_M41T00 is not set
718# CONFIG_SENSORS_MAX6875 is not set
719# CONFIG_RTC_X1205_I2C is not set
720# CONFIG_I2C_DEBUG_CORE is not set
721# CONFIG_I2C_DEBUG_ALGO is not set
722# CONFIG_I2C_DEBUG_BUS is not set
723# CONFIG_I2C_DEBUG_CHIP is not set
724
725#
726# Dallas's 1-wire bus
727#
728# CONFIG_W1 is not set
729
730#
731# Hardware Monitoring support
732#
733CONFIG_HWMON=y
734# CONFIG_HWMON_VID is not set
735# CONFIG_SENSORS_ADM1021 is not set
736# CONFIG_SENSORS_ADM1025 is not set
737# CONFIG_SENSORS_ADM1026 is not set
738# CONFIG_SENSORS_ADM1031 is not set
739# CONFIG_SENSORS_ADM9240 is not set
740# CONFIG_SENSORS_ASB100 is not set
741# CONFIG_SENSORS_ATXP1 is not set
742# CONFIG_SENSORS_DS1621 is not set
743# CONFIG_SENSORS_FSCHER is not set
744# CONFIG_SENSORS_FSCPOS is not set
745# CONFIG_SENSORS_GL518SM is not set
746# CONFIG_SENSORS_GL520SM is not set
747# CONFIG_SENSORS_IT87 is not set
748# CONFIG_SENSORS_LM63 is not set
749CONFIG_SENSORS_LM75=y
750# CONFIG_SENSORS_LM77 is not set
751# CONFIG_SENSORS_LM78 is not set
752# CONFIG_SENSORS_LM80 is not set
753# CONFIG_SENSORS_LM83 is not set
754# CONFIG_SENSORS_LM85 is not set
755# CONFIG_SENSORS_LM87 is not set
756# CONFIG_SENSORS_LM90 is not set
757# CONFIG_SENSORS_LM92 is not set
758# CONFIG_SENSORS_MAX1619 is not set
759# CONFIG_SENSORS_PC87360 is not set
760# CONFIG_SENSORS_SIS5595 is not set
761# CONFIG_SENSORS_SMSC47M1 is not set
762# CONFIG_SENSORS_SMSC47B397 is not set
763# CONFIG_SENSORS_VIA686A is not set
764# CONFIG_SENSORS_W83781D is not set
765# CONFIG_SENSORS_W83792D is not set
766# CONFIG_SENSORS_W83L785TS is not set
767# CONFIG_SENSORS_W83627HF is not set
768# CONFIG_SENSORS_W83627EHF is not set
769CONFIG_HWMON_DEBUG_CHIP=y
770
771#
772# Misc devices
773#
774
775#
776# Multimedia Capabilities Port drivers
777#
778
779#
780# Multimedia devices
781#
782# CONFIG_VIDEO_DEV is not set
783
784#
785# Digital Video Broadcasting Devices
786#
787# CONFIG_DVB is not set
788
789#
790# Graphics support
791#
792# CONFIG_FB is not set
793
794#
795# Sound
796#
797# CONFIG_SOUND is not set
798
799#
800# USB support
801#
802CONFIG_USB_ARCH_HAS_HCD=y
803CONFIG_USB_ARCH_HAS_OHCI=y
804# CONFIG_USB is not set
805
806#
807# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
808#
809
810#
811# USB Gadget Support
812#
813# CONFIG_USB_GADGET is not set
814
815#
816# MMC/SD Card support
817#
818# CONFIG_MMC is not set
819
820#
821# InfiniBand support
822#
823# CONFIG_INFINIBAND is not set
824
825#
826# SN Devices
827#
828
829#
830# File systems
831#
832CONFIG_EXT2_FS=y
833# CONFIG_EXT2_FS_XATTR is not set
834# CONFIG_EXT2_FS_XIP is not set
835CONFIG_EXT3_FS=y
836CONFIG_EXT3_FS_XATTR=y
837# CONFIG_EXT3_FS_POSIX_ACL is not set
838# CONFIG_EXT3_FS_SECURITY is not set
839CONFIG_JBD=y
840# CONFIG_JBD_DEBUG is not set
841CONFIG_FS_MBCACHE=y
842# CONFIG_REISERFS_FS is not set
843# CONFIG_JFS_FS is not set
844# CONFIG_FS_POSIX_ACL is not set
845# CONFIG_XFS_FS is not set
846# CONFIG_MINIX_FS is not set
847# CONFIG_ROMFS_FS is not set
848CONFIG_INOTIFY=y
849# CONFIG_QUOTA is not set
850CONFIG_DNOTIFY=y
851# CONFIG_AUTOFS_FS is not set
852# CONFIG_AUTOFS4_FS is not set
853# CONFIG_FUSE_FS is not set
854
855#
856# CD-ROM/DVD Filesystems
857#
858# CONFIG_ISO9660_FS is not set
859# CONFIG_UDF_FS is not set
860
861#
862# DOS/FAT/NT Filesystems
863#
864# CONFIG_MSDOS_FS is not set
865# CONFIG_VFAT_FS is not set
866# CONFIG_NTFS_FS is not set
867
868#
869# Pseudo filesystems
870#
871CONFIG_PROC_FS=y
872CONFIG_PROC_KCORE=y
873CONFIG_SYSFS=y
874CONFIG_TMPFS=y
875# CONFIG_HUGETLB_PAGE is not set
876CONFIG_RAMFS=y
877# CONFIG_RELAYFS_FS is not set
878
879#
880# Miscellaneous filesystems
881#
882# CONFIG_ADFS_FS is not set
883# CONFIG_AFFS_FS is not set
884# CONFIG_HFS_FS is not set
885# CONFIG_HFSPLUS_FS is not set
886# CONFIG_BEFS_FS is not set
887# CONFIG_BFS_FS is not set
888# CONFIG_EFS_FS is not set
889# CONFIG_JFFS_FS is not set
890CONFIG_JFFS2_FS=y
891CONFIG_JFFS2_FS_DEBUG=0
892CONFIG_JFFS2_FS_WRITEBUFFER=y
893# CONFIG_JFFS2_SUMMARY is not set
894# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
895CONFIG_JFFS2_ZLIB=y
896CONFIG_JFFS2_RTIME=y
897# CONFIG_JFFS2_RUBIN is not set
898CONFIG_CRAMFS=y
899# CONFIG_VXFS_FS is not set
900# CONFIG_HPFS_FS is not set
901# CONFIG_QNX4FS_FS is not set
902# CONFIG_SYSV_FS is not set
903# CONFIG_UFS_FS is not set
904
905#
906# Network File Systems
907#
908CONFIG_NFS_FS=y
909# CONFIG_NFS_V3 is not set
910# CONFIG_NFS_V4 is not set
911# CONFIG_NFS_DIRECTIO is not set
912# CONFIG_NFSD is not set
913CONFIG_ROOT_NFS=y
914CONFIG_LOCKD=y
915CONFIG_NFS_COMMON=y
916CONFIG_SUNRPC=y
917# CONFIG_RPCSEC_GSS_KRB5 is not set
918# CONFIG_RPCSEC_GSS_SPKM3 is not set
919# CONFIG_SMB_FS is not set
920# CONFIG_CIFS is not set
921# CONFIG_NCP_FS is not set
922# CONFIG_CODA_FS is not set
923# CONFIG_AFS_FS is not set
924# CONFIG_9P_FS is not set
925
926#
927# Partition Types
928#
929CONFIG_PARTITION_ADVANCED=y
930# CONFIG_ACORN_PARTITION is not set
931# CONFIG_OSF_PARTITION is not set
932# CONFIG_AMIGA_PARTITION is not set
933# CONFIG_ATARI_PARTITION is not set
934# CONFIG_MAC_PARTITION is not set
935# CONFIG_MSDOS_PARTITION is not set
936# CONFIG_LDM_PARTITION is not set
937# CONFIG_SGI_PARTITION is not set
938# CONFIG_ULTRIX_PARTITION is not set
939# CONFIG_SUN_PARTITION is not set
940# CONFIG_EFI_PARTITION is not set
941
942#
943# Native Language Support
944#
945# CONFIG_NLS is not set
946# CONFIG_SCC_ENET is not set
947# CONFIG_FEC_ENET is not set
948
949#
950# CPM2 Options
951#
952
953#
954# Library routines
955#
956# CONFIG_CRC_CCITT is not set
957# CONFIG_CRC16 is not set
958CONFIG_CRC32=y
959# CONFIG_LIBCRC32C is not set
960CONFIG_ZLIB_INFLATE=y
961CONFIG_ZLIB_DEFLATE=y
962# CONFIG_PROFILING is not set
963
964#
965# Kernel hacking
966#
967# CONFIG_PRINTK_TIME is not set
968# CONFIG_DEBUG_KERNEL is not set
969CONFIG_LOG_BUF_SHIFT=14
970# CONFIG_KGDB_CONSOLE is not set
971# CONFIG_SERIAL_TEXT_DEBUG is not set
972
973#
974# Security options
975#
976# CONFIG_KEYS is not set
977# CONFIG_SECURITY is not set
978
979#
980# Cryptographic options
981#
982# CONFIG_CRYPTO is not set
983
984#
985# Hardware crypto devices
986#
diff --git a/arch/ppc/configs/TQM8555_defconfig b/arch/ppc/configs/TQM8555_defconfig
new file mode 100644
index 000000000000..730b3db2e47a
--- /dev/null
+++ b/arch/ppc/configs/TQM8555_defconfig
@@ -0,0 +1,983 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc2
4# Thu Nov 24 17:10:52 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_PPC=y
11CONFIG_PPC32=y
12CONFIG_GENERIC_NVRAM=y
13CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
14CONFIG_ARCH_MAY_HAVE_PC_FDC=y
15
16#
17# Code maturity level options
18#
19CONFIG_EXPERIMENTAL=y
20CONFIG_CLEAN_COMPILE=y
21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
23
24#
25# General setup
26#
27CONFIG_LOCALVERSION=""
28CONFIG_LOCALVERSION_AUTO=y
29CONFIG_SWAP=y
30CONFIG_SYSVIPC=y
31# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set
33CONFIG_SYSCTL=y
34# CONFIG_AUDIT is not set
35# CONFIG_HOTPLUG is not set
36CONFIG_KOBJECT_UEVENT=y
37# CONFIG_IKCONFIG is not set
38CONFIG_INITRAMFS_SOURCE=""
39CONFIG_EMBEDDED=y
40# CONFIG_KALLSYMS is not set
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_BASE_FULL=y
44CONFIG_FUTEX=y
45# CONFIG_EPOLL is not set
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SHMEM=y
48CONFIG_CC_ALIGN_FUNCTIONS=0
49CONFIG_CC_ALIGN_LABELS=0
50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0
52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
54
55#
56# Loadable module support
57#
58# CONFIG_MODULES is not set
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Processor
80#
81# CONFIG_6xx is not set
82# CONFIG_40x is not set
83# CONFIG_44x is not set
84# CONFIG_POWER3 is not set
85# CONFIG_POWER4 is not set
86# CONFIG_8xx is not set
87# CONFIG_E200 is not set
88CONFIG_E500=y
89CONFIG_BOOKE=y
90CONFIG_FSL_BOOKE=y
91# CONFIG_PHYS_64BIT is not set
92CONFIG_SPE=y
93CONFIG_MATH_EMULATION=y
94# CONFIG_KEXEC is not set
95# CONFIG_CPU_FREQ is not set
96# CONFIG_WANT_EARLY_SERIAL is not set
97CONFIG_PPC_GEN550=y
98CONFIG_85xx=y
99CONFIG_PPC_INDIRECT_PCI_BE=y
100
101#
102# Freescale 85xx options
103#
104# CONFIG_MPC8540_ADS is not set
105# CONFIG_MPC8548_CDS is not set
106# CONFIG_MPC8555_CDS is not set
107# CONFIG_MPC8560_ADS is not set
108# CONFIG_SBC8560 is not set
109# CONFIG_STX_GP3 is not set
110# CONFIG_TQM8540 is not set
111# CONFIG_TQM8541 is not set
112CONFIG_TQM8555=y
113# CONFIG_TQM8560 is not set
114CONFIG_MPC8555=y
115
116#
117# Platform options
118#
119CONFIG_CPM2=y
120# CONFIG_PC_KEYBOARD is not set
121# CONFIG_HIGHMEM is not set
122# CONFIG_HZ_100 is not set
123CONFIG_HZ_250=y
124# CONFIG_HZ_1000 is not set
125CONFIG_HZ=250
126CONFIG_PREEMPT_NONE=y
127# CONFIG_PREEMPT_VOLUNTARY is not set
128# CONFIG_PREEMPT is not set
129CONFIG_SELECT_MEMORY_MODEL=y
130CONFIG_FLATMEM_MANUAL=y
131# CONFIG_DISCONTIGMEM_MANUAL is not set
132# CONFIG_SPARSEMEM_MANUAL is not set
133CONFIG_FLATMEM=y
134CONFIG_FLAT_NODE_MEM_MAP=y
135# CONFIG_SPARSEMEM_STATIC is not set
136CONFIG_SPLIT_PTLOCK_CPUS=4
137CONFIG_BINFMT_ELF=y
138# CONFIG_BINFMT_MISC is not set
139# CONFIG_CMDLINE_BOOL is not set
140# CONFIG_PM is not set
141# CONFIG_SOFTWARE_SUSPEND is not set
142CONFIG_SECCOMP=y
143CONFIG_ISA_DMA_API=y
144
145#
146# Bus options
147#
148CONFIG_PPC_I8259=y
149CONFIG_PPC_INDIRECT_PCI=y
150CONFIG_PCI=y
151CONFIG_PCI_DOMAINS=y
152# CONFIG_PCI_LEGACY_PROC is not set
153
154#
155# PCCARD (PCMCIA/CardBus) support
156#
157# CONFIG_PCCARD is not set
158
159#
160# Advanced setup
161#
162# CONFIG_ADVANCED_OPTIONS is not set
163
164#
165# Default settings for advanced configuration options are used
166#
167CONFIG_HIGHMEM_START=0xfe000000
168CONFIG_LOWMEM_SIZE=0x30000000
169CONFIG_KERNEL_START=0xc0000000
170CONFIG_TASK_SIZE=0x80000000
171CONFIG_BOOT_LOAD=0x00800000
172
173#
174# Networking
175#
176CONFIG_NET=y
177
178#
179# Networking options
180#
181CONFIG_PACKET=y
182# CONFIG_PACKET_MMAP is not set
183CONFIG_UNIX=y
184# CONFIG_NET_KEY is not set
185CONFIG_INET=y
186CONFIG_IP_MULTICAST=y
187# CONFIG_IP_ADVANCED_ROUTER is not set
188CONFIG_IP_FIB_HASH=y
189CONFIG_IP_PNP=y
190CONFIG_IP_PNP_DHCP=y
191CONFIG_IP_PNP_BOOTP=y
192# CONFIG_IP_PNP_RARP is not set
193# CONFIG_NET_IPIP is not set
194# CONFIG_NET_IPGRE is not set
195# CONFIG_IP_MROUTE is not set
196# CONFIG_ARPD is not set
197CONFIG_SYN_COOKIES=y
198# CONFIG_INET_AH is not set
199# CONFIG_INET_ESP is not set
200# CONFIG_INET_IPCOMP is not set
201# CONFIG_INET_TUNNEL is not set
202CONFIG_INET_DIAG=y
203CONFIG_INET_TCP_DIAG=y
204# CONFIG_TCP_CONG_ADVANCED is not set
205CONFIG_TCP_CONG_BIC=y
206# CONFIG_IPV6 is not set
207# CONFIG_NETFILTER is not set
208
209#
210# DCCP Configuration (EXPERIMENTAL)
211#
212# CONFIG_IP_DCCP is not set
213
214#
215# SCTP Configuration (EXPERIMENTAL)
216#
217# CONFIG_IP_SCTP is not set
218# CONFIG_ATM is not set
219# CONFIG_BRIDGE is not set
220# CONFIG_VLAN_8021Q is not set
221# CONFIG_DECNET is not set
222# CONFIG_LLC2 is not set
223# CONFIG_IPX is not set
224# CONFIG_ATALK is not set
225# CONFIG_X25 is not set
226# CONFIG_LAPB is not set
227# CONFIG_NET_DIVERT is not set
228# CONFIG_ECONET is not set
229# CONFIG_WAN_ROUTER is not set
230
231#
232# QoS and/or fair queueing
233#
234# CONFIG_NET_SCHED is not set
235
236#
237# Network testing
238#
239# CONFIG_NET_PKTGEN is not set
240# CONFIG_HAMRADIO is not set
241# CONFIG_IRDA is not set
242# CONFIG_BT is not set
243# CONFIG_IEEE80211 is not set
244
245#
246# Device Drivers
247#
248
249#
250# Generic Driver Options
251#
252CONFIG_STANDALONE=y
253CONFIG_PREVENT_FIRMWARE_BUILD=y
254# CONFIG_FW_LOADER is not set
255
256#
257# Connector - unified userspace <-> kernelspace linker
258#
259# CONFIG_CONNECTOR is not set
260
261#
262# Memory Technology Devices (MTD)
263#
264CONFIG_MTD=y
265# CONFIG_MTD_DEBUG is not set
266CONFIG_MTD_CONCAT=y
267CONFIG_MTD_PARTITIONS=y
268# CONFIG_MTD_REDBOOT_PARTS is not set
269CONFIG_MTD_CMDLINE_PARTS=y
270
271#
272# User Modules And Translation Layers
273#
274CONFIG_MTD_CHAR=y
275CONFIG_MTD_BLOCK=y
276# CONFIG_FTL is not set
277# CONFIG_NFTL is not set
278# CONFIG_INFTL is not set
279# CONFIG_RFD_FTL is not set
280
281#
282# RAM/ROM/Flash chip drivers
283#
284CONFIG_MTD_CFI=y
285# CONFIG_MTD_JEDECPROBE is not set
286CONFIG_MTD_GEN_PROBE=y
287# CONFIG_MTD_CFI_ADV_OPTIONS is not set
288CONFIG_MTD_MAP_BANK_WIDTH_1=y
289CONFIG_MTD_MAP_BANK_WIDTH_2=y
290CONFIG_MTD_MAP_BANK_WIDTH_4=y
291# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
292# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
293# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
294CONFIG_MTD_CFI_I1=y
295CONFIG_MTD_CFI_I2=y
296# CONFIG_MTD_CFI_I4 is not set
297# CONFIG_MTD_CFI_I8 is not set
298# CONFIG_MTD_CFI_INTELEXT is not set
299CONFIG_MTD_CFI_AMDSTD=y
300CONFIG_MTD_CFI_AMDSTD_RETRY=0
301# CONFIG_MTD_CFI_STAA is not set
302CONFIG_MTD_CFI_UTIL=y
303# CONFIG_MTD_RAM is not set
304# CONFIG_MTD_ROM is not set
305# CONFIG_MTD_ABSENT is not set
306
307#
308# Mapping drivers for chip access
309#
310# CONFIG_MTD_COMPLEX_MAPPINGS is not set
311# CONFIG_MTD_PHYSMAP is not set
312CONFIG_MTD_TQM85xx=y
313# CONFIG_MTD_PLATRAM is not set
314
315#
316# Self-contained MTD device drivers
317#
318# CONFIG_MTD_PMC551 is not set
319# CONFIG_MTD_SLRAM is not set
320# CONFIG_MTD_PHRAM is not set
321# CONFIG_MTD_MTDRAM is not set
322# CONFIG_MTD_BLKMTD is not set
323# CONFIG_MTD_BLOCK2MTD is not set
324
325#
326# Disk-On-Chip Device Drivers
327#
328# CONFIG_MTD_DOC2000 is not set
329# CONFIG_MTD_DOC2001 is not set
330# CONFIG_MTD_DOC2001PLUS is not set
331
332#
333# NAND Flash Device Drivers
334#
335# CONFIG_MTD_NAND is not set
336
337#
338# OneNAND Flash Device Drivers
339#
340# CONFIG_MTD_ONENAND is not set
341
342#
343# Parallel port support
344#
345# CONFIG_PARPORT is not set
346
347#
348# Plug and Play support
349#
350
351#
352# Block devices
353#
354# CONFIG_BLK_DEV_FD is not set
355# CONFIG_BLK_CPQ_DA is not set
356# CONFIG_BLK_CPQ_CISS_DA is not set
357# CONFIG_BLK_DEV_DAC960 is not set
358# CONFIG_BLK_DEV_UMEM is not set
359# CONFIG_BLK_DEV_COW_COMMON is not set
360CONFIG_BLK_DEV_LOOP=y
361# CONFIG_BLK_DEV_CRYPTOLOOP is not set
362# CONFIG_BLK_DEV_NBD is not set
363# CONFIG_BLK_DEV_SX8 is not set
364CONFIG_BLK_DEV_RAM=y
365CONFIG_BLK_DEV_RAM_COUNT=16
366CONFIG_BLK_DEV_RAM_SIZE=32768
367CONFIG_BLK_DEV_INITRD=y
368# CONFIG_CDROM_PKTCDVD is not set
369# CONFIG_ATA_OVER_ETH is not set
370
371#
372# ATA/ATAPI/MFM/RLL support
373#
374CONFIG_IDE=y
375CONFIG_BLK_DEV_IDE=y
376
377#
378# Please see Documentation/ide.txt for help/info on IDE drives
379#
380# CONFIG_BLK_DEV_IDE_SATA is not set
381CONFIG_BLK_DEV_IDEDISK=y
382# CONFIG_IDEDISK_MULTI_MODE is not set
383# CONFIG_BLK_DEV_IDECD is not set
384# CONFIG_BLK_DEV_IDETAPE is not set
385# CONFIG_BLK_DEV_IDEFLOPPY is not set
386# CONFIG_IDE_TASK_IOCTL is not set
387
388#
389# IDE chipset support/bugfixes
390#
391CONFIG_IDE_GENERIC=y
392CONFIG_BLK_DEV_IDEPCI=y
393CONFIG_IDEPCI_SHARE_IRQ=y
394# CONFIG_BLK_DEV_OFFBOARD is not set
395CONFIG_BLK_DEV_GENERIC=y
396# CONFIG_BLK_DEV_OPTI621 is not set
397# CONFIG_BLK_DEV_SL82C105 is not set
398CONFIG_BLK_DEV_IDEDMA_PCI=y
399# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
400CONFIG_IDEDMA_PCI_AUTO=y
401# CONFIG_IDEDMA_ONLYDISK is not set
402# CONFIG_BLK_DEV_AEC62XX is not set
403# CONFIG_BLK_DEV_ALI15X3 is not set
404# CONFIG_BLK_DEV_AMD74XX is not set
405# CONFIG_BLK_DEV_CMD64X is not set
406# CONFIG_BLK_DEV_TRIFLEX is not set
407# CONFIG_BLK_DEV_CY82C693 is not set
408# CONFIG_BLK_DEV_CS5520 is not set
409# CONFIG_BLK_DEV_CS5530 is not set
410# CONFIG_BLK_DEV_HPT34X is not set
411# CONFIG_BLK_DEV_HPT366 is not set
412# CONFIG_BLK_DEV_SC1200 is not set
413# CONFIG_BLK_DEV_PIIX is not set
414# CONFIG_BLK_DEV_IT821X is not set
415# CONFIG_BLK_DEV_NS87415 is not set
416# CONFIG_BLK_DEV_PDC202XX_OLD is not set
417# CONFIG_BLK_DEV_PDC202XX_NEW is not set
418# CONFIG_BLK_DEV_SVWKS is not set
419# CONFIG_BLK_DEV_SIIMAGE is not set
420# CONFIG_BLK_DEV_SLC90E66 is not set
421# CONFIG_BLK_DEV_TRM290 is not set
422CONFIG_BLK_DEV_VIA82CXXX=y
423# CONFIG_IDE_ARM is not set
424CONFIG_BLK_DEV_IDEDMA=y
425# CONFIG_IDEDMA_IVB is not set
426CONFIG_IDEDMA_AUTO=y
427# CONFIG_BLK_DEV_HD is not set
428
429#
430# SCSI device support
431#
432# CONFIG_RAID_ATTRS is not set
433# CONFIG_SCSI is not set
434
435#
436# Multi-device support (RAID and LVM)
437#
438# CONFIG_MD is not set
439
440#
441# Fusion MPT device support
442#
443# CONFIG_FUSION is not set
444
445#
446# IEEE 1394 (FireWire) support
447#
448# CONFIG_IEEE1394 is not set
449
450#
451# I2O device support
452#
453# CONFIG_I2O is not set
454
455#
456# Macintosh device drivers
457#
458# CONFIG_WINDFARM is not set
459
460#
461# Network device support
462#
463CONFIG_NETDEVICES=y
464# CONFIG_DUMMY is not set
465# CONFIG_BONDING is not set
466# CONFIG_EQUALIZER is not set
467# CONFIG_TUN is not set
468
469#
470# ARCnet devices
471#
472# CONFIG_ARCNET is not set
473
474#
475# PHY device support
476#
477CONFIG_PHYLIB=y
478
479#
480# MII PHY device drivers
481#
482# CONFIG_MARVELL_PHY is not set
483# CONFIG_DAVICOM_PHY is not set
484# CONFIG_QSEMI_PHY is not set
485# CONFIG_LXT_PHY is not set
486# CONFIG_CICADA_PHY is not set
487
488#
489# Ethernet (10 or 100Mbit)
490#
491CONFIG_NET_ETHERNET=y
492CONFIG_MII=y
493# CONFIG_HAPPYMEAL is not set
494# CONFIG_SUNGEM is not set
495# CONFIG_CASSINI is not set
496# CONFIG_NET_VENDOR_3COM is not set
497
498#
499# Tulip family network device support
500#
501# CONFIG_NET_TULIP is not set
502# CONFIG_HP100 is not set
503CONFIG_NET_PCI=y
504# CONFIG_PCNET32 is not set
505# CONFIG_AMD8111_ETH is not set
506# CONFIG_ADAPTEC_STARFIRE is not set
507# CONFIG_B44 is not set
508# CONFIG_FORCEDETH is not set
509# CONFIG_DGRS is not set
510# CONFIG_EEPRO100 is not set
511CONFIG_E100=y
512# CONFIG_FEALNX is not set
513# CONFIG_NATSEMI is not set
514# CONFIG_NE2K_PCI is not set
515# CONFIG_8139CP is not set
516# CONFIG_8139TOO is not set
517# CONFIG_SIS900 is not set
518# CONFIG_EPIC100 is not set
519# CONFIG_SUNDANCE is not set
520# CONFIG_TLAN is not set
521# CONFIG_VIA_RHINE is not set
522# CONFIG_FS_ENET is not set
523
524#
525# Ethernet (1000 Mbit)
526#
527# CONFIG_ACENIC is not set
528# CONFIG_DL2K is not set
529# CONFIG_E1000 is not set
530# CONFIG_NS83820 is not set
531# CONFIG_HAMACHI is not set
532# CONFIG_YELLOWFIN is not set
533# CONFIG_R8169 is not set
534# CONFIG_SIS190 is not set
535# CONFIG_SKGE is not set
536# CONFIG_SK98LIN is not set
537# CONFIG_VIA_VELOCITY is not set
538# CONFIG_TIGON3 is not set
539# CONFIG_BNX2 is not set
540CONFIG_GIANFAR=y
541CONFIG_GFAR_NAPI=y
542
543#
544# Ethernet (10000 Mbit)
545#
546# CONFIG_CHELSIO_T1 is not set
547# CONFIG_IXGB is not set
548# CONFIG_S2IO is not set
549
550#
551# Token Ring devices
552#
553# CONFIG_TR is not set
554
555#
556# Wireless LAN (non-hamradio)
557#
558# CONFIG_NET_RADIO is not set
559
560#
561# Wan interfaces
562#
563# CONFIG_WAN is not set
564# CONFIG_FDDI is not set
565# CONFIG_HIPPI is not set
566# CONFIG_PPP is not set
567# CONFIG_SLIP is not set
568# CONFIG_SHAPER is not set
569# CONFIG_NETCONSOLE is not set
570# CONFIG_NETPOLL is not set
571# CONFIG_NET_POLL_CONTROLLER is not set
572
573#
574# ISDN subsystem
575#
576# CONFIG_ISDN is not set
577
578#
579# Telephony Support
580#
581# CONFIG_PHONE is not set
582
583#
584# Input device support
585#
586CONFIG_INPUT=y
587
588#
589# Userland interfaces
590#
591# CONFIG_INPUT_MOUSEDEV is not set
592# CONFIG_INPUT_JOYDEV is not set
593# CONFIG_INPUT_TSDEV is not set
594# CONFIG_INPUT_EVDEV is not set
595# CONFIG_INPUT_EVBUG is not set
596
597#
598# Input Device Drivers
599#
600# CONFIG_INPUT_KEYBOARD is not set
601# CONFIG_INPUT_MOUSE is not set
602# CONFIG_INPUT_JOYSTICK is not set
603# CONFIG_INPUT_TOUCHSCREEN is not set
604# CONFIG_INPUT_MISC is not set
605
606#
607# Hardware I/O ports
608#
609# CONFIG_SERIO is not set
610# CONFIG_GAMEPORT is not set
611
612#
613# Character devices
614#
615# CONFIG_VT is not set
616# CONFIG_SERIAL_NONSTANDARD is not set
617
618#
619# Serial drivers
620#
621CONFIG_SERIAL_8250=y
622CONFIG_SERIAL_8250_CONSOLE=y
623CONFIG_SERIAL_8250_NR_UARTS=4
624# CONFIG_SERIAL_8250_EXTENDED is not set
625
626#
627# Non-8250 serial port support
628#
629CONFIG_SERIAL_CORE=y
630CONFIG_SERIAL_CORE_CONSOLE=y
631# CONFIG_SERIAL_CPM is not set
632# CONFIG_SERIAL_JSM is not set
633CONFIG_UNIX98_PTYS=y
634CONFIG_LEGACY_PTYS=y
635CONFIG_LEGACY_PTY_COUNT=256
636
637#
638# IPMI
639#
640# CONFIG_IPMI_HANDLER is not set
641
642#
643# Watchdog Cards
644#
645# CONFIG_WATCHDOG is not set
646# CONFIG_NVRAM is not set
647CONFIG_GEN_RTC=y
648# CONFIG_GEN_RTC_X is not set
649# CONFIG_DTLK is not set
650# CONFIG_R3964 is not set
651# CONFIG_APPLICOM is not set
652
653#
654# Ftape, the floppy tape device driver
655#
656# CONFIG_AGP is not set
657# CONFIG_DRM is not set
658# CONFIG_RAW_DRIVER is not set
659
660#
661# TPM devices
662#
663# CONFIG_TCG_TPM is not set
664# CONFIG_TELCLOCK is not set
665
666#
667# I2C support
668#
669CONFIG_I2C=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_ALI1535 is not set
683# CONFIG_I2C_ALI1563 is not set
684# CONFIG_I2C_ALI15X3 is not set
685# CONFIG_I2C_AMD756 is not set
686# CONFIG_I2C_AMD8111 is not set
687# CONFIG_I2C_I801 is not set
688# CONFIG_I2C_I810 is not set
689# CONFIG_I2C_PIIX4 is not set
690CONFIG_I2C_MPC=y
691# CONFIG_I2C_NFORCE2 is not set
692# CONFIG_I2C_PARPORT_LIGHT is not set
693# CONFIG_I2C_PROSAVAGE is not set
694# CONFIG_I2C_SAVAGE4 is not set
695# CONFIG_SCx200_ACB is not set
696# CONFIG_I2C_SIS5595 is not set
697# CONFIG_I2C_SIS630 is not set
698# CONFIG_I2C_SIS96X is not set
699# CONFIG_I2C_VIA is not set
700# CONFIG_I2C_VIAPRO is not set
701# CONFIG_I2C_VOODOO3 is not set
702# CONFIG_I2C_PCA_ISA is not set
703
704#
705# Miscellaneous I2C Chip support
706#
707CONFIG_SENSORS_DS1337=y
708# CONFIG_SENSORS_DS1374 is not set
709# CONFIG_SENSORS_EEPROM is not set
710# CONFIG_SENSORS_PCF8574 is not set
711# CONFIG_SENSORS_PCA9539 is not set
712# CONFIG_SENSORS_PCF8591 is not set
713# CONFIG_SENSORS_RTC8564 is not set
714# CONFIG_SENSORS_M41T00 is not set
715# CONFIG_SENSORS_MAX6875 is not set
716# CONFIG_RTC_X1205_I2C is not set
717# CONFIG_I2C_DEBUG_CORE is not set
718# CONFIG_I2C_DEBUG_ALGO is not set
719# CONFIG_I2C_DEBUG_BUS is not set
720# CONFIG_I2C_DEBUG_CHIP is not set
721
722#
723# Dallas's 1-wire bus
724#
725# CONFIG_W1 is not set
726
727#
728# Hardware Monitoring support
729#
730CONFIG_HWMON=y
731# CONFIG_HWMON_VID is not set
732# CONFIG_SENSORS_ADM1021 is not set
733# CONFIG_SENSORS_ADM1025 is not set
734# CONFIG_SENSORS_ADM1026 is not set
735# CONFIG_SENSORS_ADM1031 is not set
736# CONFIG_SENSORS_ADM9240 is not set
737# CONFIG_SENSORS_ASB100 is not set
738# CONFIG_SENSORS_ATXP1 is not set
739# CONFIG_SENSORS_DS1621 is not set
740# CONFIG_SENSORS_FSCHER is not set
741# CONFIG_SENSORS_FSCPOS is not set
742# CONFIG_SENSORS_GL518SM is not set
743# CONFIG_SENSORS_GL520SM is not set
744# CONFIG_SENSORS_IT87 is not set
745# CONFIG_SENSORS_LM63 is not set
746CONFIG_SENSORS_LM75=y
747# CONFIG_SENSORS_LM77 is not set
748# CONFIG_SENSORS_LM78 is not set
749# CONFIG_SENSORS_LM80 is not set
750# CONFIG_SENSORS_LM83 is not set
751# CONFIG_SENSORS_LM85 is not set
752# CONFIG_SENSORS_LM87 is not set
753# CONFIG_SENSORS_LM90 is not set
754# CONFIG_SENSORS_LM92 is not set
755# CONFIG_SENSORS_MAX1619 is not set
756# CONFIG_SENSORS_PC87360 is not set
757# CONFIG_SENSORS_SIS5595 is not set
758# CONFIG_SENSORS_SMSC47M1 is not set
759# CONFIG_SENSORS_SMSC47B397 is not set
760# CONFIG_SENSORS_VIA686A is not set
761# CONFIG_SENSORS_W83781D is not set
762# CONFIG_SENSORS_W83792D is not set
763# CONFIG_SENSORS_W83L785TS is not set
764# CONFIG_SENSORS_W83627HF is not set
765# CONFIG_SENSORS_W83627EHF is not set
766CONFIG_HWMON_DEBUG_CHIP=y
767
768#
769# Misc devices
770#
771
772#
773# Multimedia Capabilities Port drivers
774#
775
776#
777# Multimedia devices
778#
779# CONFIG_VIDEO_DEV is not set
780
781#
782# Digital Video Broadcasting Devices
783#
784# CONFIG_DVB is not set
785
786#
787# Graphics support
788#
789# CONFIG_FB is not set
790
791#
792# Sound
793#
794# CONFIG_SOUND is not set
795
796#
797# USB support
798#
799CONFIG_USB_ARCH_HAS_HCD=y
800CONFIG_USB_ARCH_HAS_OHCI=y
801# CONFIG_USB is not set
802
803#
804# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
805#
806
807#
808# USB Gadget Support
809#
810# CONFIG_USB_GADGET is not set
811
812#
813# MMC/SD Card support
814#
815# CONFIG_MMC is not set
816
817#
818# InfiniBand support
819#
820# CONFIG_INFINIBAND is not set
821
822#
823# SN Devices
824#
825
826#
827# File systems
828#
829CONFIG_EXT2_FS=y
830# CONFIG_EXT2_FS_XATTR is not set
831# CONFIG_EXT2_FS_XIP is not set
832CONFIG_EXT3_FS=y
833CONFIG_EXT3_FS_XATTR=y
834# CONFIG_EXT3_FS_POSIX_ACL is not set
835# CONFIG_EXT3_FS_SECURITY is not set
836CONFIG_JBD=y
837# CONFIG_JBD_DEBUG is not set
838CONFIG_FS_MBCACHE=y
839# CONFIG_REISERFS_FS is not set
840# CONFIG_JFS_FS is not set
841# CONFIG_FS_POSIX_ACL is not set
842# CONFIG_XFS_FS is not set
843# CONFIG_MINIX_FS is not set
844# CONFIG_ROMFS_FS is not set
845CONFIG_INOTIFY=y
846# CONFIG_QUOTA is not set
847CONFIG_DNOTIFY=y
848# CONFIG_AUTOFS_FS is not set
849# CONFIG_AUTOFS4_FS is not set
850# CONFIG_FUSE_FS is not set
851
852#
853# CD-ROM/DVD Filesystems
854#
855# CONFIG_ISO9660_FS is not set
856# CONFIG_UDF_FS is not set
857
858#
859# DOS/FAT/NT Filesystems
860#
861# CONFIG_MSDOS_FS is not set
862# CONFIG_VFAT_FS is not set
863# CONFIG_NTFS_FS is not set
864
865#
866# Pseudo filesystems
867#
868CONFIG_PROC_FS=y
869CONFIG_PROC_KCORE=y
870CONFIG_SYSFS=y
871CONFIG_TMPFS=y
872# CONFIG_HUGETLB_PAGE is not set
873CONFIG_RAMFS=y
874# CONFIG_RELAYFS_FS is not set
875
876#
877# Miscellaneous filesystems
878#
879# CONFIG_ADFS_FS is not set
880# CONFIG_AFFS_FS is not set
881# CONFIG_HFS_FS is not set
882# CONFIG_HFSPLUS_FS is not set
883# CONFIG_BEFS_FS is not set
884# CONFIG_BFS_FS is not set
885# CONFIG_EFS_FS is not set
886# CONFIG_JFFS_FS is not set
887CONFIG_JFFS2_FS=y
888CONFIG_JFFS2_FS_DEBUG=0
889CONFIG_JFFS2_FS_WRITEBUFFER=y
890# CONFIG_JFFS2_SUMMARY is not set
891# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
892CONFIG_JFFS2_ZLIB=y
893CONFIG_JFFS2_RTIME=y
894# CONFIG_JFFS2_RUBIN is not set
895CONFIG_CRAMFS=y
896# CONFIG_VXFS_FS is not set
897# CONFIG_HPFS_FS is not set
898# CONFIG_QNX4FS_FS is not set
899# CONFIG_SYSV_FS is not set
900# CONFIG_UFS_FS is not set
901
902#
903# Network File Systems
904#
905CONFIG_NFS_FS=y
906# CONFIG_NFS_V3 is not set
907# CONFIG_NFS_V4 is not set
908# CONFIG_NFS_DIRECTIO is not set
909# CONFIG_NFSD is not set
910CONFIG_ROOT_NFS=y
911CONFIG_LOCKD=y
912CONFIG_NFS_COMMON=y
913CONFIG_SUNRPC=y
914# CONFIG_RPCSEC_GSS_KRB5 is not set
915# CONFIG_RPCSEC_GSS_SPKM3 is not set
916# CONFIG_SMB_FS is not set
917# CONFIG_CIFS is not set
918# CONFIG_NCP_FS is not set
919# CONFIG_CODA_FS is not set
920# CONFIG_AFS_FS is not set
921# CONFIG_9P_FS is not set
922
923#
924# Partition Types
925#
926CONFIG_PARTITION_ADVANCED=y
927# CONFIG_ACORN_PARTITION is not set
928# CONFIG_OSF_PARTITION is not set
929# CONFIG_AMIGA_PARTITION is not set
930# CONFIG_ATARI_PARTITION is not set
931# CONFIG_MAC_PARTITION is not set
932# CONFIG_MSDOS_PARTITION is not set
933# CONFIG_LDM_PARTITION is not set
934# CONFIG_SGI_PARTITION is not set
935# CONFIG_ULTRIX_PARTITION is not set
936# CONFIG_SUN_PARTITION is not set
937# CONFIG_EFI_PARTITION is not set
938
939#
940# Native Language Support
941#
942# CONFIG_NLS is not set
943# CONFIG_SCC_ENET is not set
944# CONFIG_FEC_ENET is not set
945
946#
947# CPM2 Options
948#
949
950#
951# Library routines
952#
953# CONFIG_CRC_CCITT is not set
954# CONFIG_CRC16 is not set
955CONFIG_CRC32=y
956# CONFIG_LIBCRC32C is not set
957CONFIG_ZLIB_INFLATE=y
958CONFIG_ZLIB_DEFLATE=y
959# CONFIG_PROFILING is not set
960
961#
962# Kernel hacking
963#
964# CONFIG_PRINTK_TIME is not set
965# CONFIG_DEBUG_KERNEL is not set
966CONFIG_LOG_BUF_SHIFT=14
967# CONFIG_KGDB_CONSOLE is not set
968# CONFIG_SERIAL_TEXT_DEBUG is not set
969
970#
971# Security options
972#
973# CONFIG_KEYS is not set
974# CONFIG_SECURITY is not set
975
976#
977# Cryptographic options
978#
979# CONFIG_CRYPTO is not set
980
981#
982# Hardware crypto devices
983#
diff --git a/arch/ppc/configs/TQM8560_defconfig b/arch/ppc/configs/TQM8560_defconfig
new file mode 100644
index 000000000000..1d902072825e
--- /dev/null
+++ b/arch/ppc/configs/TQM8560_defconfig
@@ -0,0 +1,992 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.15-rc2
4# Wed Nov 30 16:47:53 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_PPC=y
11CONFIG_PPC32=y
12CONFIG_GENERIC_NVRAM=y
13CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
14CONFIG_ARCH_MAY_HAVE_PC_FDC=y
15
16#
17# Code maturity level options
18#
19CONFIG_EXPERIMENTAL=y
20CONFIG_CLEAN_COMPILE=y
21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
23
24#
25# General setup
26#
27CONFIG_LOCALVERSION=""
28CONFIG_LOCALVERSION_AUTO=y
29CONFIG_SWAP=y
30CONFIG_SYSVIPC=y
31# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set
33CONFIG_SYSCTL=y
34# CONFIG_AUDIT is not set
35# CONFIG_HOTPLUG is not set
36CONFIG_KOBJECT_UEVENT=y
37# CONFIG_IKCONFIG is not set
38CONFIG_INITRAMFS_SOURCE=""
39CONFIG_EMBEDDED=y
40# CONFIG_KALLSYMS is not set
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_BASE_FULL=y
44CONFIG_FUTEX=y
45# CONFIG_EPOLL is not set
46# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
47CONFIG_SHMEM=y
48CONFIG_CC_ALIGN_FUNCTIONS=0
49CONFIG_CC_ALIGN_LABELS=0
50CONFIG_CC_ALIGN_LOOPS=0
51CONFIG_CC_ALIGN_JUMPS=0
52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
54
55#
56# Loadable module support
57#
58# CONFIG_MODULES is not set
59
60#
61# Block layer
62#
63# CONFIG_LBD is not set
64
65#
66# IO Schedulers
67#
68CONFIG_IOSCHED_NOOP=y
69CONFIG_IOSCHED_AS=y
70CONFIG_IOSCHED_DEADLINE=y
71CONFIG_IOSCHED_CFQ=y
72CONFIG_DEFAULT_AS=y
73# CONFIG_DEFAULT_DEADLINE is not set
74# CONFIG_DEFAULT_CFQ is not set
75# CONFIG_DEFAULT_NOOP is not set
76CONFIG_DEFAULT_IOSCHED="anticipatory"
77
78#
79# Processor
80#
81# CONFIG_6xx is not set
82# CONFIG_40x is not set
83# CONFIG_44x is not set
84# CONFIG_POWER3 is not set
85# CONFIG_POWER4 is not set
86# CONFIG_8xx is not set
87# CONFIG_E200 is not set
88CONFIG_E500=y
89CONFIG_BOOKE=y
90CONFIG_FSL_BOOKE=y
91# CONFIG_PHYS_64BIT is not set
92CONFIG_SPE=y
93CONFIG_MATH_EMULATION=y
94# CONFIG_KEXEC is not set
95# CONFIG_CPU_FREQ is not set
96# CONFIG_WANT_EARLY_SERIAL is not set
97CONFIG_85xx=y
98CONFIG_PPC_INDIRECT_PCI_BE=y
99
100#
101# Freescale 85xx options
102#
103# CONFIG_MPC8540_ADS is not set
104# CONFIG_MPC8548_CDS is not set
105# CONFIG_MPC8555_CDS is not set
106# CONFIG_MPC8560_ADS is not set
107# CONFIG_SBC8560 is not set
108# CONFIG_STX_GP3 is not set
109# CONFIG_TQM8540 is not set
110# CONFIG_TQM8541 is not set
111# CONFIG_TQM8555 is not set
112CONFIG_TQM8560=y
113CONFIG_MPC8560=y
114
115#
116# Platform options
117#
118CONFIG_CPM2=y
119# CONFIG_PC_KEYBOARD is not set
120# CONFIG_HIGHMEM is not set
121# CONFIG_HZ_100 is not set
122CONFIG_HZ_250=y
123# CONFIG_HZ_1000 is not set
124CONFIG_HZ=250
125CONFIG_PREEMPT_NONE=y
126# CONFIG_PREEMPT_VOLUNTARY is not set
127# CONFIG_PREEMPT is not set
128CONFIG_SELECT_MEMORY_MODEL=y
129CONFIG_FLATMEM_MANUAL=y
130# CONFIG_DISCONTIGMEM_MANUAL is not set
131# CONFIG_SPARSEMEM_MANUAL is not set
132CONFIG_FLATMEM=y
133CONFIG_FLAT_NODE_MEM_MAP=y
134# CONFIG_SPARSEMEM_STATIC is not set
135CONFIG_SPLIT_PTLOCK_CPUS=4
136CONFIG_BINFMT_ELF=y
137# CONFIG_BINFMT_MISC is not set
138# CONFIG_CMDLINE_BOOL is not set
139# CONFIG_PM is not set
140# CONFIG_SOFTWARE_SUSPEND is not set
141CONFIG_SECCOMP=y
142CONFIG_ISA_DMA_API=y
143
144#
145# Bus options
146#
147CONFIG_PPC_I8259=y
148CONFIG_PPC_INDIRECT_PCI=y
149CONFIG_PCI=y
150CONFIG_PCI_DOMAINS=y
151# CONFIG_PCI_LEGACY_PROC is not set
152
153#
154# PCCARD (PCMCIA/CardBus) support
155#
156# CONFIG_PCCARD is not set
157# CONFIG_RAPIDIO is not set
158
159#
160# Advanced setup
161#
162# CONFIG_ADVANCED_OPTIONS is not set
163
164#
165# Default settings for advanced configuration options are used
166#
167CONFIG_HIGHMEM_START=0xfe000000
168CONFIG_LOWMEM_SIZE=0x30000000
169CONFIG_KERNEL_START=0xc0000000
170CONFIG_TASK_SIZE=0x80000000
171CONFIG_BOOT_LOAD=0x00800000
172
173#
174# Networking
175#
176CONFIG_NET=y
177
178#
179# Networking options
180#
181CONFIG_PACKET=y
182# CONFIG_PACKET_MMAP is not set
183CONFIG_UNIX=y
184# CONFIG_NET_KEY is not set
185CONFIG_INET=y
186CONFIG_IP_MULTICAST=y
187# CONFIG_IP_ADVANCED_ROUTER is not set
188CONFIG_IP_FIB_HASH=y
189CONFIG_IP_PNP=y
190CONFIG_IP_PNP_DHCP=y
191CONFIG_IP_PNP_BOOTP=y
192# CONFIG_IP_PNP_RARP is not set
193# CONFIG_NET_IPIP is not set
194# CONFIG_NET_IPGRE is not set
195# CONFIG_IP_MROUTE is not set
196# CONFIG_ARPD is not set
197CONFIG_SYN_COOKIES=y
198# CONFIG_INET_AH is not set
199# CONFIG_INET_ESP is not set
200# CONFIG_INET_IPCOMP is not set
201# CONFIG_INET_TUNNEL is not set
202CONFIG_INET_DIAG=y
203CONFIG_INET_TCP_DIAG=y
204# CONFIG_TCP_CONG_ADVANCED is not set
205CONFIG_TCP_CONG_BIC=y
206# CONFIG_IPV6 is not set
207# CONFIG_NETFILTER is not set
208
209#
210# DCCP Configuration (EXPERIMENTAL)
211#
212# CONFIG_IP_DCCP is not set
213
214#
215# SCTP Configuration (EXPERIMENTAL)
216#
217# CONFIG_IP_SCTP is not set
218# CONFIG_ATM is not set
219# CONFIG_BRIDGE is not set
220# CONFIG_VLAN_8021Q is not set
221# CONFIG_DECNET is not set
222# CONFIG_LLC2 is not set
223# CONFIG_IPX is not set
224# CONFIG_ATALK is not set
225# CONFIG_X25 is not set
226# CONFIG_LAPB is not set
227# CONFIG_NET_DIVERT is not set
228# CONFIG_ECONET is not set
229# CONFIG_WAN_ROUTER is not set
230
231#
232# QoS and/or fair queueing
233#
234# CONFIG_NET_SCHED is not set
235
236#
237# Network testing
238#
239# CONFIG_NET_PKTGEN is not set
240# CONFIG_HAMRADIO is not set
241# CONFIG_IRDA is not set
242# CONFIG_BT is not set
243# CONFIG_IEEE80211 is not set
244
245#
246# Device Drivers
247#
248
249#
250# Generic Driver Options
251#
252CONFIG_STANDALONE=y
253CONFIG_PREVENT_FIRMWARE_BUILD=y
254# CONFIG_FW_LOADER is not set
255
256#
257# Connector - unified userspace <-> kernelspace linker
258#
259# CONFIG_CONNECTOR is not set
260
261#
262# Memory Technology Devices (MTD)
263#
264CONFIG_MTD=y
265# CONFIG_MTD_DEBUG is not set
266CONFIG_MTD_CONCAT=y
267CONFIG_MTD_PARTITIONS=y
268# CONFIG_MTD_REDBOOT_PARTS is not set
269CONFIG_MTD_CMDLINE_PARTS=y
270
271#
272# User Modules And Translation Layers
273#
274CONFIG_MTD_CHAR=y
275CONFIG_MTD_BLOCK=y
276# CONFIG_FTL is not set
277# CONFIG_NFTL is not set
278# CONFIG_INFTL is not set
279# CONFIG_RFD_FTL is not set
280
281#
282# RAM/ROM/Flash chip drivers
283#
284CONFIG_MTD_CFI=y
285# CONFIG_MTD_JEDECPROBE is not set
286CONFIG_MTD_GEN_PROBE=y
287# CONFIG_MTD_CFI_ADV_OPTIONS is not set
288CONFIG_MTD_MAP_BANK_WIDTH_1=y
289CONFIG_MTD_MAP_BANK_WIDTH_2=y
290CONFIG_MTD_MAP_BANK_WIDTH_4=y
291# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
292# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
293# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
294CONFIG_MTD_CFI_I1=y
295CONFIG_MTD_CFI_I2=y
296# CONFIG_MTD_CFI_I4 is not set
297# CONFIG_MTD_CFI_I8 is not set
298# CONFIG_MTD_CFI_INTELEXT is not set
299CONFIG_MTD_CFI_AMDSTD=y
300CONFIG_MTD_CFI_AMDSTD_RETRY=0
301# CONFIG_MTD_CFI_STAA is not set
302CONFIG_MTD_CFI_UTIL=y
303# CONFIG_MTD_RAM is not set
304# CONFIG_MTD_ROM is not set
305# CONFIG_MTD_ABSENT is not set
306
307#
308# Mapping drivers for chip access
309#
310# CONFIG_MTD_COMPLEX_MAPPINGS is not set
311# CONFIG_MTD_PHYSMAP is not set
312CONFIG_MTD_TQM85xx=y
313# CONFIG_MTD_PLATRAM is not set
314
315#
316# Self-contained MTD device drivers
317#
318# CONFIG_MTD_PMC551 is not set
319# CONFIG_MTD_SLRAM is not set
320# CONFIG_MTD_PHRAM is not set
321# CONFIG_MTD_MTDRAM is not set
322# CONFIG_MTD_BLKMTD is not set
323# CONFIG_MTD_BLOCK2MTD is not set
324
325#
326# Disk-On-Chip Device Drivers
327#
328# CONFIG_MTD_DOC2000 is not set
329# CONFIG_MTD_DOC2001 is not set
330# CONFIG_MTD_DOC2001PLUS is not set
331
332#
333# NAND Flash Device Drivers
334#
335# CONFIG_MTD_NAND is not set
336
337#
338# OneNAND Flash Device Drivers
339#
340# CONFIG_MTD_ONENAND is not set
341
342#
343# Parallel port support
344#
345# CONFIG_PARPORT is not set
346
347#
348# Plug and Play support
349#
350
351#
352# Block devices
353#
354# CONFIG_BLK_DEV_FD is not set
355# CONFIG_BLK_CPQ_DA is not set
356# CONFIG_BLK_CPQ_CISS_DA is not set
357# CONFIG_BLK_DEV_DAC960 is not set
358# CONFIG_BLK_DEV_UMEM is not set
359# CONFIG_BLK_DEV_COW_COMMON is not set
360CONFIG_BLK_DEV_LOOP=y
361# CONFIG_BLK_DEV_CRYPTOLOOP is not set
362# CONFIG_BLK_DEV_NBD is not set
363# CONFIG_BLK_DEV_SX8 is not set
364CONFIG_BLK_DEV_RAM=y
365CONFIG_BLK_DEV_RAM_COUNT=16
366CONFIG_BLK_DEV_RAM_SIZE=32768
367CONFIG_BLK_DEV_INITRD=y
368# CONFIG_CDROM_PKTCDVD is not set
369# CONFIG_ATA_OVER_ETH is not set
370
371#
372# ATA/ATAPI/MFM/RLL support
373#
374CONFIG_IDE=y
375CONFIG_BLK_DEV_IDE=y
376
377#
378# Please see Documentation/ide.txt for help/info on IDE drives
379#
380# CONFIG_BLK_DEV_IDE_SATA is not set
381CONFIG_BLK_DEV_IDEDISK=y
382# CONFIG_IDEDISK_MULTI_MODE is not set
383# CONFIG_BLK_DEV_IDECD is not set
384# CONFIG_BLK_DEV_IDETAPE is not set
385# CONFIG_BLK_DEV_IDEFLOPPY is not set
386# CONFIG_IDE_TASK_IOCTL is not set
387
388#
389# IDE chipset support/bugfixes
390#
391CONFIG_IDE_GENERIC=y
392CONFIG_BLK_DEV_IDEPCI=y
393CONFIG_IDEPCI_SHARE_IRQ=y
394# CONFIG_BLK_DEV_OFFBOARD is not set
395CONFIG_BLK_DEV_GENERIC=y
396# CONFIG_BLK_DEV_OPTI621 is not set
397# CONFIG_BLK_DEV_SL82C105 is not set
398CONFIG_BLK_DEV_IDEDMA_PCI=y
399# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
400CONFIG_IDEDMA_PCI_AUTO=y
401# CONFIG_IDEDMA_ONLYDISK is not set
402# CONFIG_BLK_DEV_AEC62XX is not set
403# CONFIG_BLK_DEV_ALI15X3 is not set
404# CONFIG_BLK_DEV_AMD74XX is not set
405# CONFIG_BLK_DEV_CMD64X is not set
406# CONFIG_BLK_DEV_TRIFLEX is not set
407# CONFIG_BLK_DEV_CY82C693 is not set
408# CONFIG_BLK_DEV_CS5520 is not set
409# CONFIG_BLK_DEV_CS5530 is not set
410# CONFIG_BLK_DEV_HPT34X is not set
411# CONFIG_BLK_DEV_HPT366 is not set
412# CONFIG_BLK_DEV_SC1200 is not set
413# CONFIG_BLK_DEV_PIIX is not set
414# CONFIG_BLK_DEV_IT821X is not set
415# CONFIG_BLK_DEV_NS87415 is not set
416# CONFIG_BLK_DEV_PDC202XX_OLD is not set
417# CONFIG_BLK_DEV_PDC202XX_NEW is not set
418# CONFIG_BLK_DEV_SVWKS is not set
419# CONFIG_BLK_DEV_SIIMAGE is not set
420# CONFIG_BLK_DEV_SLC90E66 is not set
421# CONFIG_BLK_DEV_TRM290 is not set
422CONFIG_BLK_DEV_VIA82CXXX=y
423# CONFIG_IDE_ARM is not set
424CONFIG_BLK_DEV_IDEDMA=y
425# CONFIG_IDEDMA_IVB is not set
426CONFIG_IDEDMA_AUTO=y
427# CONFIG_BLK_DEV_HD is not set
428
429#
430# SCSI device support
431#
432# CONFIG_RAID_ATTRS is not set
433# CONFIG_SCSI is not set
434
435#
436# Multi-device support (RAID and LVM)
437#
438# CONFIG_MD is not set
439
440#
441# Fusion MPT device support
442#
443# CONFIG_FUSION is not set
444
445#
446# IEEE 1394 (FireWire) support
447#
448# CONFIG_IEEE1394 is not set
449
450#
451# I2O device support
452#
453# CONFIG_I2O is not set
454
455#
456# Macintosh device drivers
457#
458# CONFIG_WINDFARM is not set
459
460#
461# Network device support
462#
463CONFIG_NETDEVICES=y
464# CONFIG_DUMMY is not set
465# CONFIG_BONDING is not set
466# CONFIG_EQUALIZER is not set
467# CONFIG_TUN is not set
468
469#
470# ARCnet devices
471#
472# CONFIG_ARCNET is not set
473
474#
475# PHY device support
476#
477CONFIG_PHYLIB=y
478
479#
480# MII PHY device drivers
481#
482# CONFIG_MARVELL_PHY is not set
483# CONFIG_DAVICOM_PHY is not set
484# CONFIG_QSEMI_PHY is not set
485# CONFIG_LXT_PHY is not set
486# CONFIG_CICADA_PHY is not set
487
488#
489# Ethernet (10 or 100Mbit)
490#
491CONFIG_NET_ETHERNET=y
492CONFIG_MII=y
493# CONFIG_HAPPYMEAL is not set
494# CONFIG_SUNGEM is not set
495# CONFIG_CASSINI is not set
496# CONFIG_NET_VENDOR_3COM is not set
497
498#
499# Tulip family network device support
500#
501# CONFIG_NET_TULIP is not set
502# CONFIG_HP100 is not set
503CONFIG_NET_PCI=y
504# CONFIG_PCNET32 is not set
505# CONFIG_AMD8111_ETH is not set
506# CONFIG_ADAPTEC_STARFIRE is not set
507# CONFIG_B44 is not set
508# CONFIG_FORCEDETH is not set
509# CONFIG_DGRS is not set
510# CONFIG_EEPRO100 is not set
511CONFIG_E100=y
512# CONFIG_FEALNX is not set
513# CONFIG_NATSEMI is not set
514# CONFIG_NE2K_PCI is not set
515# CONFIG_8139CP is not set
516# CONFIG_8139TOO is not set
517# CONFIG_SIS900 is not set
518# CONFIG_EPIC100 is not set
519# CONFIG_SUNDANCE is not set
520# CONFIG_TLAN is not set
521# CONFIG_VIA_RHINE is not set
522# CONFIG_FS_ENET is not set
523
524#
525# Ethernet (1000 Mbit)
526#
527# CONFIG_ACENIC is not set
528# CONFIG_DL2K is not set
529# CONFIG_E1000 is not set
530# CONFIG_NS83820 is not set
531# CONFIG_HAMACHI is not set
532# CONFIG_YELLOWFIN is not set
533# CONFIG_R8169 is not set
534# CONFIG_SIS190 is not set
535# CONFIG_SKGE is not set
536# CONFIG_SK98LIN is not set
537# CONFIG_VIA_VELOCITY is not set
538# CONFIG_TIGON3 is not set
539# CONFIG_BNX2 is not set
540CONFIG_GIANFAR=y
541CONFIG_GFAR_NAPI=y
542
543#
544# Ethernet (10000 Mbit)
545#
546# CONFIG_CHELSIO_T1 is not set
547# CONFIG_IXGB is not set
548# CONFIG_S2IO is not set
549
550#
551# Token Ring devices
552#
553# CONFIG_TR is not set
554
555#
556# Wireless LAN (non-hamradio)
557#
558# CONFIG_NET_RADIO is not set
559
560#
561# Wan interfaces
562#
563# CONFIG_WAN is not set
564# CONFIG_FDDI is not set
565# CONFIG_HIPPI is not set
566# CONFIG_PPP is not set
567# CONFIG_SLIP is not set
568# CONFIG_SHAPER is not set
569# CONFIG_NETCONSOLE is not set
570# CONFIG_NETPOLL is not set
571# CONFIG_NET_POLL_CONTROLLER is not set
572
573#
574# ISDN subsystem
575#
576# CONFIG_ISDN is not set
577
578#
579# Telephony Support
580#
581# CONFIG_PHONE is not set
582
583#
584# Input device support
585#
586CONFIG_INPUT=y
587
588#
589# Userland interfaces
590#
591# CONFIG_INPUT_MOUSEDEV is not set
592# CONFIG_INPUT_JOYDEV is not set
593# CONFIG_INPUT_TSDEV is not set
594# CONFIG_INPUT_EVDEV is not set
595# CONFIG_INPUT_EVBUG is not set
596
597#
598# Input Device Drivers
599#
600# CONFIG_INPUT_KEYBOARD is not set
601# CONFIG_INPUT_MOUSE is not set
602# CONFIG_INPUT_JOYSTICK is not set
603# CONFIG_INPUT_TOUCHSCREEN is not set
604# CONFIG_INPUT_MISC is not set
605
606#
607# Hardware I/O ports
608#
609# CONFIG_SERIO is not set
610# CONFIG_GAMEPORT is not set
611
612#
613# Character devices
614#
615# CONFIG_VT is not set
616# CONFIG_SERIAL_NONSTANDARD is not set
617
618#
619# Serial drivers
620#
621CONFIG_SERIAL_8250=y
622CONFIG_SERIAL_8250_CONSOLE=y
623CONFIG_SERIAL_8250_NR_UARTS=4
624# CONFIG_SERIAL_8250_EXTENDED is not set
625
626#
627# Non-8250 serial port support
628#
629CONFIG_SERIAL_CORE=y
630CONFIG_SERIAL_CORE_CONSOLE=y
631CONFIG_SERIAL_CPM=y
632CONFIG_SERIAL_CPM_CONSOLE=y
633CONFIG_SERIAL_CPM_SCC1=y
634# CONFIG_SERIAL_CPM_SCC2 is not set
635# CONFIG_SERIAL_CPM_SCC3 is not set
636# CONFIG_SERIAL_CPM_SCC4 is not set
637# CONFIG_SERIAL_CPM_SMC1 is not set
638# CONFIG_SERIAL_CPM_SMC2 is not set
639# CONFIG_SERIAL_JSM is not set
640CONFIG_UNIX98_PTYS=y
641CONFIG_LEGACY_PTYS=y
642CONFIG_LEGACY_PTY_COUNT=256
643
644#
645# IPMI
646#
647# CONFIG_IPMI_HANDLER is not set
648
649#
650# Watchdog Cards
651#
652# CONFIG_WATCHDOG is not set
653# CONFIG_NVRAM is not set
654CONFIG_GEN_RTC=y
655# CONFIG_GEN_RTC_X is not set
656# CONFIG_DTLK is not set
657# CONFIG_R3964 is not set
658# CONFIG_APPLICOM is not set
659
660#
661# Ftape, the floppy tape device driver
662#
663# CONFIG_AGP is not set
664# CONFIG_DRM is not set
665# CONFIG_RAW_DRIVER is not set
666
667#
668# TPM devices
669#
670# CONFIG_TCG_TPM is not set
671# CONFIG_TELCLOCK is not set
672
673#
674# I2C support
675#
676CONFIG_I2C=y
677CONFIG_I2C_CHARDEV=y
678
679#
680# I2C Algorithms
681#
682# CONFIG_I2C_ALGOBIT is not set
683# CONFIG_I2C_ALGOPCF is not set
684# CONFIG_I2C_ALGOPCA is not set
685
686#
687# I2C Hardware Bus support
688#
689# CONFIG_I2C_ALI1535 is not set
690# CONFIG_I2C_ALI1563 is not set
691# CONFIG_I2C_ALI15X3 is not set
692# CONFIG_I2C_AMD756 is not set
693# CONFIG_I2C_AMD8111 is not set
694# CONFIG_I2C_I801 is not set
695# CONFIG_I2C_I810 is not set
696# CONFIG_I2C_PIIX4 is not set
697CONFIG_I2C_MPC=y
698# CONFIG_I2C_MPC8260 is not set
699# CONFIG_I2C_NFORCE2 is not set
700# CONFIG_I2C_PARPORT_LIGHT is not set
701# CONFIG_I2C_PROSAVAGE is not set
702# CONFIG_I2C_SAVAGE4 is not set
703# CONFIG_SCx200_ACB is not set
704# CONFIG_I2C_SIS5595 is not set
705# CONFIG_I2C_SIS630 is not set
706# CONFIG_I2C_SIS96X is not set
707# CONFIG_I2C_VIA is not set
708# CONFIG_I2C_VIAPRO is not set
709# CONFIG_I2C_VOODOO3 is not set
710# CONFIG_I2C_PCA_ISA is not set
711
712#
713# Miscellaneous I2C Chip support
714#
715CONFIG_SENSORS_DS1337=y
716# CONFIG_SENSORS_DS1374 is not set
717# CONFIG_SENSORS_EEPROM is not set
718# CONFIG_SENSORS_MAX6900 is not set
719# CONFIG_SENSORS_PCF8574 is not set
720# CONFIG_SENSORS_PCF8563 is not set
721# CONFIG_SENSORS_PCA9539 is not set
722# CONFIG_SENSORS_PCF8591 is not set
723# CONFIG_SENSORS_RTC8564 is not set
724# CONFIG_SENSORS_M41T00 is not set
725# CONFIG_SENSORS_MAX6875 is not set
726# CONFIG_RTC_X1205_I2C is not set
727# CONFIG_I2C_DEBUG_CORE is not set
728# CONFIG_I2C_DEBUG_ALGO is not set
729# CONFIG_I2C_DEBUG_BUS is not set
730# CONFIG_I2C_DEBUG_CHIP is not set
731
732#
733# Dallas's 1-wire bus
734#
735# CONFIG_W1 is not set
736
737#
738# Hardware Monitoring support
739#
740CONFIG_HWMON=y
741# CONFIG_HWMON_VID is not set
742# CONFIG_SENSORS_ADM1021 is not set
743# CONFIG_SENSORS_ADM1025 is not set
744# CONFIG_SENSORS_ADM1026 is not set
745# CONFIG_SENSORS_ADM1031 is not set
746# CONFIG_SENSORS_ADM9240 is not set
747# CONFIG_SENSORS_ASB100 is not set
748# CONFIG_SENSORS_ATXP1 is not set
749# CONFIG_SENSORS_DS1621 is not set
750# CONFIG_SENSORS_FSCHER is not set
751# CONFIG_SENSORS_FSCPOS is not set
752# CONFIG_SENSORS_GL518SM is not set
753# CONFIG_SENSORS_GL520SM is not set
754# CONFIG_SENSORS_IT87 is not set
755# CONFIG_SENSORS_LM63 is not set
756CONFIG_SENSORS_LM75=y
757# CONFIG_SENSORS_LM77 is not set
758# CONFIG_SENSORS_LM78 is not set
759# CONFIG_SENSORS_LM80 is not set
760# CONFIG_SENSORS_LM83 is not set
761# CONFIG_SENSORS_LM85 is not set
762# CONFIG_SENSORS_LM87 is not set
763# CONFIG_SENSORS_LM90 is not set
764# CONFIG_SENSORS_LM92 is not set
765# CONFIG_SENSORS_MAX1619 is not set
766# CONFIG_SENSORS_PC87360 is not set
767# CONFIG_SENSORS_SIS5595 is not set
768# CONFIG_SENSORS_SMSC47M1 is not set
769# CONFIG_SENSORS_SMSC47B397 is not set
770# CONFIG_SENSORS_VIA686A is not set
771# CONFIG_SENSORS_W83781D is not set
772# CONFIG_SENSORS_W83792D is not set
773# CONFIG_SENSORS_W83L785TS is not set
774# CONFIG_SENSORS_W83627HF is not set
775# CONFIG_SENSORS_W83627EHF is not set
776CONFIG_HWMON_DEBUG_CHIP=y
777
778#
779# Misc devices
780#
781
782#
783# Multimedia Capabilities Port drivers
784#
785
786#
787# Multimedia devices
788#
789# CONFIG_VIDEO_DEV is not set
790
791#
792# Digital Video Broadcasting Devices
793#
794# CONFIG_DVB is not set
795
796#
797# Graphics support
798#
799# CONFIG_FB is not set
800
801#
802# Sound
803#
804# CONFIG_SOUND is not set
805
806#
807# USB support
808#
809CONFIG_USB_ARCH_HAS_HCD=y
810CONFIG_USB_ARCH_HAS_OHCI=y
811# CONFIG_USB is not set
812
813#
814# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
815#
816
817#
818# USB Gadget Support
819#
820# CONFIG_USB_GADGET is not set
821
822#
823# MMC/SD Card support
824#
825# CONFIG_MMC is not set
826
827#
828# InfiniBand support
829#
830# CONFIG_INFINIBAND is not set
831
832#
833# SN Devices
834#
835
836#
837# File systems
838#
839CONFIG_EXT2_FS=y
840# CONFIG_EXT2_FS_XATTR is not set
841# CONFIG_EXT2_FS_XIP is not set
842CONFIG_EXT3_FS=y
843CONFIG_EXT3_FS_XATTR=y
844# CONFIG_EXT3_FS_POSIX_ACL is not set
845# CONFIG_EXT3_FS_SECURITY is not set
846CONFIG_JBD=y
847# CONFIG_JBD_DEBUG is not set
848CONFIG_FS_MBCACHE=y
849# CONFIG_REISERFS_FS is not set
850# CONFIG_JFS_FS is not set
851# CONFIG_FS_POSIX_ACL is not set
852# CONFIG_XFS_FS is not set
853# CONFIG_MINIX_FS is not set
854# CONFIG_ROMFS_FS is not set
855CONFIG_INOTIFY=y
856# CONFIG_QUOTA is not set
857CONFIG_DNOTIFY=y
858# CONFIG_AUTOFS_FS is not set
859# CONFIG_AUTOFS4_FS is not set
860# CONFIG_FUSE_FS is not set
861
862#
863# CD-ROM/DVD Filesystems
864#
865# CONFIG_ISO9660_FS is not set
866# CONFIG_UDF_FS is not set
867
868#
869# DOS/FAT/NT Filesystems
870#
871# CONFIG_MSDOS_FS is not set
872# CONFIG_VFAT_FS is not set
873# CONFIG_NTFS_FS is not set
874
875#
876# Pseudo filesystems
877#
878CONFIG_PROC_FS=y
879CONFIG_PROC_KCORE=y
880CONFIG_SYSFS=y
881CONFIG_TMPFS=y
882# CONFIG_HUGETLB_PAGE is not set
883CONFIG_RAMFS=y
884# CONFIG_RELAYFS_FS is not set
885
886#
887# Miscellaneous filesystems
888#
889# CONFIG_ADFS_FS is not set
890# CONFIG_AFFS_FS is not set
891# CONFIG_HFS_FS is not set
892# CONFIG_HFSPLUS_FS is not set
893# CONFIG_BEFS_FS is not set
894# CONFIG_BFS_FS is not set
895# CONFIG_EFS_FS is not set
896# CONFIG_JFFS_FS is not set
897CONFIG_JFFS2_FS=y
898CONFIG_JFFS2_FS_DEBUG=0
899CONFIG_JFFS2_FS_WRITEBUFFER=y
900# CONFIG_JFFS2_SUMMARY is not set
901# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
902CONFIG_JFFS2_ZLIB=y
903CONFIG_JFFS2_RTIME=y
904# CONFIG_JFFS2_RUBIN is not set
905CONFIG_CRAMFS=y
906# CONFIG_VXFS_FS is not set
907# CONFIG_HPFS_FS is not set
908# CONFIG_QNX4FS_FS is not set
909# CONFIG_SYSV_FS is not set
910# CONFIG_UFS_FS is not set
911
912#
913# Network File Systems
914#
915CONFIG_NFS_FS=y
916# CONFIG_NFS_V3 is not set
917# CONFIG_NFS_V4 is not set
918# CONFIG_NFS_DIRECTIO is not set
919# CONFIG_NFSD is not set
920CONFIG_ROOT_NFS=y
921CONFIG_LOCKD=y
922CONFIG_NFS_COMMON=y
923CONFIG_SUNRPC=y
924# CONFIG_RPCSEC_GSS_KRB5 is not set
925# CONFIG_RPCSEC_GSS_SPKM3 is not set
926# CONFIG_SMB_FS is not set
927# CONFIG_CIFS is not set
928# CONFIG_NCP_FS is not set
929# CONFIG_CODA_FS is not set
930# CONFIG_AFS_FS is not set
931# CONFIG_9P_FS is not set
932
933#
934# Partition Types
935#
936CONFIG_PARTITION_ADVANCED=y
937# CONFIG_ACORN_PARTITION is not set
938# CONFIG_OSF_PARTITION is not set
939# CONFIG_AMIGA_PARTITION is not set
940# CONFIG_ATARI_PARTITION is not set
941# CONFIG_MAC_PARTITION is not set
942# CONFIG_MSDOS_PARTITION is not set
943# CONFIG_LDM_PARTITION is not set
944# CONFIG_SGI_PARTITION is not set
945# CONFIG_ULTRIX_PARTITION is not set
946# CONFIG_SUN_PARTITION is not set
947# CONFIG_EFI_PARTITION is not set
948
949#
950# Native Language Support
951#
952# CONFIG_NLS is not set
953# CONFIG_SCC_ENET is not set
954# CONFIG_FEC_ENET is not set
955
956#
957# CPM2 Options
958#
959
960#
961# Library routines
962#
963# CONFIG_CRC_CCITT is not set
964# CONFIG_CRC16 is not set
965CONFIG_CRC32=y
966# CONFIG_LIBCRC32C is not set
967CONFIG_ZLIB_INFLATE=y
968CONFIG_ZLIB_DEFLATE=y
969# CONFIG_PROFILING is not set
970
971#
972# Kernel hacking
973#
974# CONFIG_PRINTK_TIME is not set
975# CONFIG_DEBUG_KERNEL is not set
976CONFIG_LOG_BUF_SHIFT=14
977# CONFIG_KGDB_CONSOLE is not set
978
979#
980# Security options
981#
982# CONFIG_KEYS is not set
983# CONFIG_SECURITY is not set
984
985#
986# Cryptographic options
987#
988# CONFIG_CRYPTO is not set
989
990#
991# Hardware crypto devices
992#
diff --git a/arch/ppc/configs/bamboo_defconfig b/arch/ppc/configs/bamboo_defconfig
index 0ba4e70d50b6..41fd3938fa5c 100644
--- a/arch/ppc/configs/bamboo_defconfig
+++ b/arch/ppc/configs/bamboo_defconfig
@@ -499,6 +499,7 @@ CONFIG_NATSEMI=y
499# CONFIG_DL2K is not set 499# CONFIG_DL2K is not set
500CONFIG_E1000=y 500CONFIG_E1000=y
501# CONFIG_E1000_NAPI is not set 501# CONFIG_E1000_NAPI is not set
502# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
502# CONFIG_NS83820 is not set 503# CONFIG_NS83820 is not set
503# CONFIG_HAMACHI is not set 504# CONFIG_HAMACHI is not set
504# CONFIG_YELLOWFIN is not set 505# CONFIG_YELLOWFIN is not set
diff --git a/arch/ppc/configs/katana_defconfig b/arch/ppc/configs/katana_defconfig
index 0f3bb9af9c22..7311fe6b42de 100644
--- a/arch/ppc/configs/katana_defconfig
+++ b/arch/ppc/configs/katana_defconfig
@@ -488,6 +488,7 @@ CONFIG_E100=y
488# CONFIG_DL2K is not set 488# CONFIG_DL2K is not set
489CONFIG_E1000=y 489CONFIG_E1000=y
490# CONFIG_E1000_NAPI is not set 490# CONFIG_E1000_NAPI is not set
491# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
491# CONFIG_NS83820 is not set 492# CONFIG_NS83820 is not set
492# CONFIG_HAMACHI is not set 493# CONFIG_HAMACHI is not set
493# CONFIG_YELLOWFIN is not set 494# CONFIG_YELLOWFIN is not set
diff --git a/arch/ppc/configs/mpc834x_sys_defconfig b/arch/ppc/configs/mpc834x_sys_defconfig
index 673dc64ebcb1..b96a6d6dad0e 100644
--- a/arch/ppc/configs/mpc834x_sys_defconfig
+++ b/arch/ppc/configs/mpc834x_sys_defconfig
@@ -402,6 +402,7 @@ CONFIG_E100=y
402# CONFIG_DL2K is not set 402# CONFIG_DL2K is not set
403CONFIG_E1000=y 403CONFIG_E1000=y
404# CONFIG_E1000_NAPI is not set 404# CONFIG_E1000_NAPI is not set
405# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
405# CONFIG_NS83820 is not set 406# CONFIG_NS83820 is not set
406# CONFIG_HAMACHI is not set 407# CONFIG_HAMACHI is not set
407# CONFIG_YELLOWFIN is not set 408# CONFIG_YELLOWFIN is not set
diff --git a/arch/ppc/configs/power3_defconfig b/arch/ppc/configs/power3_defconfig
index 93da595a4738..a1ef929bca59 100644
--- a/arch/ppc/configs/power3_defconfig
+++ b/arch/ppc/configs/power3_defconfig
@@ -442,6 +442,7 @@ CONFIG_E100=y
442# CONFIG_DL2K is not set 442# CONFIG_DL2K is not set
443CONFIG_E1000=y 443CONFIG_E1000=y
444# CONFIG_E1000_NAPI is not set 444# CONFIG_E1000_NAPI is not set
445# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
445# CONFIG_NS83820 is not set 446# CONFIG_NS83820 is not set
446# CONFIG_HAMACHI is not set 447# CONFIG_HAMACHI is not set
447# CONFIG_YELLOWFIN is not set 448# CONFIG_YELLOWFIN is not set
diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
index 0bb23fce4293..e399bbb969a4 100644
--- a/arch/ppc/kernel/Makefile
+++ b/arch/ppc/kernel/Makefile
@@ -9,16 +9,13 @@ extra-$(CONFIG_44x) := head_44x.o
9extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o 9extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o
10extra-$(CONFIG_8xx) := head_8xx.o 10extra-$(CONFIG_8xx) := head_8xx.o
11extra-$(CONFIG_6xx) += idle_6xx.o 11extra-$(CONFIG_6xx) += idle_6xx.o
12extra-$(CONFIG_POWER4) += idle_power4.o
13extra-y += vmlinux.lds 12extra-y += vmlinux.lds
14 13
15obj-y := entry.o traps.o idle.o time.o misc.o \ 14obj-y := entry.o traps.o idle.o time.o misc.o \
16 process.o \
17 setup.o \ 15 setup.o \
18 ppc_htab.o 16 ppc_htab.o
19obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o 17obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o
20obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o 18obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o
21obj-$(CONFIG_POWER4) += cpu_setup_power4.o
22obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o 19obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o
23obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o 20obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o
24obj-$(CONFIG_PCI) += pci.o 21obj-$(CONFIG_PCI) += pci.o
@@ -43,11 +40,9 @@ obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o
43obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o 40obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o
44obj-$(CONFIG_MODULES) += module.o 41obj-$(CONFIG_MODULES) += module.o
45obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o 42obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o
46obj-$(CONFIG_PCI) += pci.o
47obj-$(CONFIG_KGDB) += ppc-stub.o 43obj-$(CONFIG_KGDB) += ppc-stub.o
48obj-$(CONFIG_TAU) += temp.o 44obj-$(CONFIG_TAU) += temp.o
49ifndef CONFIG_E200 45ifndef CONFIG_E200
50obj-$(CONFIG_FSL_BOOKE) += perfmon_fsl_booke.o 46obj-$(CONFIG_FSL_BOOKE) += perfmon_fsl_booke.o
51endif 47endif
52obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
53endif 48endif
diff --git a/arch/ppc/kernel/asm-offsets.c b/arch/ppc/kernel/asm-offsets.c
index fe0e767fb94e..7964bf660e92 100644
--- a/arch/ppc/kernel/asm-offsets.c
+++ b/arch/ppc/kernel/asm-offsets.c
@@ -131,7 +131,7 @@ main(void)
131 DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); 131 DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features));
132 DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); 132 DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup));
133 133
134 DEFINE(TI_SC_NOERR, offsetof(struct thread_info, syscall_noerror)); 134 DEFINE(TI_SIGFRAME, offsetof(struct thread_info, nvgprs_frame));
135 DEFINE(TI_TASK, offsetof(struct thread_info, task)); 135 DEFINE(TI_TASK, offsetof(struct thread_info, task));
136 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain)); 136 DEFINE(TI_EXECDOMAIN, offsetof(struct thread_info, exec_domain));
137 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 137 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
index f044edbb454f..a48b950722a1 100644
--- a/arch/ppc/kernel/entry.S
+++ b/arch/ppc/kernel/entry.S
@@ -200,8 +200,6 @@ _GLOBAL(DoSyscall)
200 bl do_show_syscall 200 bl do_show_syscall
201#endif /* SHOW_SYSCALLS */ 201#endif /* SHOW_SYSCALLS */
202 rlwinm r10,r1,0,0,18 /* current_thread_info() */ 202 rlwinm r10,r1,0,0,18 /* current_thread_info() */
203 li r11,0
204 stb r11,TI_SC_NOERR(r10)
205 lwz r11,TI_FLAGS(r10) 203 lwz r11,TI_FLAGS(r10)
206 andi. r11,r11,_TIF_SYSCALL_T_OR_A 204 andi. r11,r11,_TIF_SYSCALL_T_OR_A
207 bne- syscall_dotrace 205 bne- syscall_dotrace
@@ -222,25 +220,21 @@ ret_from_syscall:
222 bl do_show_syscall_exit 220 bl do_show_syscall_exit
223#endif 221#endif
224 mr r6,r3 222 mr r6,r3
225 li r11,-_LAST_ERRNO
226 cmplw 0,r3,r11
227 rlwinm r12,r1,0,0,18 /* current_thread_info() */ 223 rlwinm r12,r1,0,0,18 /* current_thread_info() */
228 blt+ 30f
229 lbz r11,TI_SC_NOERR(r12)
230 cmpwi r11,0
231 bne 30f
232 neg r3,r3
233 lwz r10,_CCR(r1) /* Set SO bit in CR */
234 oris r10,r10,0x1000
235 stw r10,_CCR(r1)
236
237 /* disable interrupts so current_thread_info()->flags can't change */ 224 /* disable interrupts so current_thread_info()->flags can't change */
23830: LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */ 225 LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
239 SYNC 226 SYNC
240 MTMSRD(r10) 227 MTMSRD(r10)
241 lwz r9,TI_FLAGS(r12) 228 lwz r9,TI_FLAGS(r12)
242 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SIGPENDING|_TIF_NEED_RESCHED) 229 li r8,-_LAST_ERRNO
230 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL)
243 bne- syscall_exit_work 231 bne- syscall_exit_work
232 cmplw 0,r3,r8
233 blt+ syscall_exit_cont
234 lwz r11,_CCR(r1) /* Load CR */
235 neg r3,r3
236 oris r11,r11,0x1000 /* Set SO bit in CR */
237 stw r11,_CCR(r1)
244syscall_exit_cont: 238syscall_exit_cont:
245#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 239#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
246 /* If the process has its own DBCR0 value, load it up. The single 240 /* If the process has its own DBCR0 value, load it up. The single
@@ -292,46 +286,113 @@ syscall_dotrace:
292 b syscall_dotrace_cont 286 b syscall_dotrace_cont
293 287
294syscall_exit_work: 288syscall_exit_work:
295 stw r6,RESULT(r1) /* Save result */ 289 andi. r0,r9,_TIF_RESTOREALL
290 bne- 2f
291 cmplw 0,r3,r8
292 blt+ 1f
293 andi. r0,r9,_TIF_NOERROR
294 bne- 1f
295 lwz r11,_CCR(r1) /* Load CR */
296 neg r3,r3
297 oris r11,r11,0x1000 /* Set SO bit in CR */
298 stw r11,_CCR(r1)
299
3001: stw r6,RESULT(r1) /* Save result */
296 stw r3,GPR3(r1) /* Update return value */ 301 stw r3,GPR3(r1) /* Update return value */
297 andi. r0,r9,_TIF_SYSCALL_T_OR_A 3022: andi. r0,r9,(_TIF_PERSYSCALL_MASK)
298 beq 5f 303 beq 4f
299 ori r10,r10,MSR_EE 304
300 SYNC 305 /* Clear per-syscall TIF flags if any are set, but _leave_
301 MTMSRD(r10) /* re-enable interrupts */ 306 _TIF_SAVE_NVGPRS set in r9 since we haven't dealt with that
307 yet. */
308
309 li r11,_TIF_PERSYSCALL_MASK
310 addi r12,r12,TI_FLAGS
3113: lwarx r8,0,r12
312 andc r8,r8,r11
313#ifdef CONFIG_IBM405_ERR77
314 dcbt 0,r12
315#endif
316 stwcx. r8,0,r12
317 bne- 3b
318 subi r12,r12,TI_FLAGS
319
3204: /* Anything which requires enabling interrupts? */
321 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP|_TIF_SAVE_NVGPRS)
322 beq 7f
323
324 /* Save NVGPRS if they're not saved already */
302 lwz r4,TRAP(r1) 325 lwz r4,TRAP(r1)
303 andi. r4,r4,1 326 andi. r4,r4,1
304 beq 4f 327 beq 5f
305 SAVE_NVGPRS(r1) 328 SAVE_NVGPRS(r1)
306 li r4,0xc00 329 li r4,0xc00
307 stw r4,TRAP(r1) 330 stw r4,TRAP(r1)
3084: 331
332 /* Re-enable interrupts */
3335: ori r10,r10,MSR_EE
334 SYNC
335 MTMSRD(r10)
336
337 andi. r0,r9,_TIF_SAVE_NVGPRS
338 bne save_user_nvgprs
339
340save_user_nvgprs_cont:
341 andi. r0,r9,(_TIF_SYSCALL_T_OR_A|_TIF_SINGLESTEP)
342 beq 7f
343
309 addi r3,r1,STACK_FRAME_OVERHEAD 344 addi r3,r1,STACK_FRAME_OVERHEAD
310 bl do_syscall_trace_leave 345 bl do_syscall_trace_leave
311 REST_NVGPRS(r1) 346 REST_NVGPRS(r1)
3122: 347
313 lwz r3,GPR3(r1) 3486: lwz r3,GPR3(r1)
314 LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */ 349 LOAD_MSR_KERNEL(r10,MSR_KERNEL) /* doesn't include MSR_EE */
315 SYNC 350 SYNC
316 MTMSRD(r10) /* disable interrupts again */ 351 MTMSRD(r10) /* disable interrupts again */
317 rlwinm r12,r1,0,0,18 /* current_thread_info() */ 352 rlwinm r12,r1,0,0,18 /* current_thread_info() */
318 lwz r9,TI_FLAGS(r12) 353 lwz r9,TI_FLAGS(r12)
3195: 3547:
320 andi. r0,r9,_TIF_NEED_RESCHED 355 andi. r0,r9,_TIF_NEED_RESCHED
321 bne 1f 356 bne 8f
322 lwz r5,_MSR(r1) 357 lwz r5,_MSR(r1)
323 andi. r5,r5,MSR_PR 358 andi. r5,r5,MSR_PR
324 beq syscall_exit_cont 359 beq ret_from_except
325 andi. r0,r9,_TIF_SIGPENDING 360 andi. r0,r9,_TIF_SIGPENDING
326 beq syscall_exit_cont 361 beq ret_from_except
327 b do_user_signal 362 b do_user_signal
3281: 3638:
329 ori r10,r10,MSR_EE 364 ori r10,r10,MSR_EE
330 SYNC 365 SYNC
331 MTMSRD(r10) /* re-enable interrupts */ 366 MTMSRD(r10) /* re-enable interrupts */
332 bl schedule 367 bl schedule
333 b 2b 368 b 6b
369
370save_user_nvgprs:
371 lwz r8,TI_SIGFRAME(r12)
372
373.macro savewords start, end
374 1: stw \start,4*(\start)(r8)
375 .section __ex_table,"a"
376 .align 2
377 .long 1b,save_user_nvgprs_fault
378 .previous
379 .if \end - \start
380 savewords "(\start+1)",\end
381 .endif
382.endm
383 savewords 14,31
384 b save_user_nvgprs_cont
385
386
387save_user_nvgprs_fault:
388 li r3,11 /* SIGSEGV */
389 lwz r4,TI_TASK(r12)
390 bl force_sigsegv
334 391
392 rlwinm r12,r1,0,0,18 /* current_thread_info() */
393 lwz r9,TI_FLAGS(r12)
394 b save_user_nvgprs_cont
395
335#ifdef SHOW_SYSCALLS 396#ifdef SHOW_SYSCALLS
336do_show_syscall: 397do_show_syscall:
337#ifdef SHOW_SYSCALLS_TASK 398#ifdef SHOW_SYSCALLS_TASK
@@ -401,28 +462,10 @@ show_syscalls_task:
401#endif /* SHOW_SYSCALLS */ 462#endif /* SHOW_SYSCALLS */
402 463
403/* 464/*
404 * The sigsuspend and rt_sigsuspend system calls can call do_signal 465 * The fork/clone functions need to copy the full register set into
405 * and thus put the process into the stopped state where we might 466 * the child process. Therefore we need to save all the nonvolatile
406 * want to examine its user state with ptrace. Therefore we need 467 * registers (r13 - r31) before calling the C code.
407 * to save all the nonvolatile registers (r13 - r31) before calling
408 * the C code.
409 */ 468 */
410 .globl ppc_sigsuspend
411ppc_sigsuspend:
412 SAVE_NVGPRS(r1)
413 lwz r0,TRAP(r1)
414 rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
415 stw r0,TRAP(r1) /* register set saved */
416 b sys_sigsuspend
417
418 .globl ppc_rt_sigsuspend
419ppc_rt_sigsuspend:
420 SAVE_NVGPRS(r1)
421 lwz r0,TRAP(r1)
422 rlwinm r0,r0,0,0,30
423 stw r0,TRAP(r1)
424 b sys_rt_sigsuspend
425
426 .globl ppc_fork 469 .globl ppc_fork
427ppc_fork: 470ppc_fork:
428 SAVE_NVGPRS(r1) 471 SAVE_NVGPRS(r1)
@@ -447,14 +490,6 @@ ppc_clone:
447 stw r0,TRAP(r1) /* register set saved */ 490 stw r0,TRAP(r1) /* register set saved */
448 b sys_clone 491 b sys_clone
449 492
450 .globl ppc_swapcontext
451ppc_swapcontext:
452 SAVE_NVGPRS(r1)
453 lwz r0,TRAP(r1)
454 rlwinm r0,r0,0,0,30 /* clear LSB to indicate full */
455 stw r0,TRAP(r1) /* register set saved */
456 b sys_swapcontext
457
458/* 493/*
459 * Top-level page fault handling. 494 * Top-level page fault handling.
460 * This is in assembler because if do_page_fault tells us that 495 * This is in assembler because if do_page_fault tells us that
@@ -626,16 +661,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_601)
626 .long ret_from_except 661 .long ret_from_except
627#endif 662#endif
628 663
629 .globl sigreturn_exit
630sigreturn_exit:
631 subi r1,r3,STACK_FRAME_OVERHEAD
632 rlwinm r12,r1,0,0,18 /* current_thread_info() */
633 lwz r9,TI_FLAGS(r12)
634 andi. r0,r9,_TIF_SYSCALL_T_OR_A
635 beq+ ret_from_except_full
636 bl do_syscall_trace_leave
637 /* fall through */
638
639 .globl ret_from_except_full 664 .globl ret_from_except_full
640ret_from_except_full: 665ret_from_except_full:
641 REST_NVGPRS(r1) 666 REST_NVGPRS(r1)
@@ -658,7 +683,7 @@ user_exc_return: /* r10 contains MSR_KERNEL here */
658 /* Check current_thread_info()->flags */ 683 /* Check current_thread_info()->flags */
659 rlwinm r9,r1,0,0,18 684 rlwinm r9,r1,0,0,18
660 lwz r9,TI_FLAGS(r9) 685 lwz r9,TI_FLAGS(r9)
661 andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED) 686 andi. r0,r9,(_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_RESTOREALL)
662 bne do_work 687 bne do_work
663 688
664restore_user: 689restore_user:
diff --git a/arch/ppc/kernel/head_8xx.S b/arch/ppc/kernel/head_8xx.S
index de0978742221..3e6ca7f5843f 100644
--- a/arch/ppc/kernel/head_8xx.S
+++ b/arch/ppc/kernel/head_8xx.S
@@ -375,6 +375,8 @@ DataStoreTLBMiss:
375 lis r11, swapper_pg_dir@h 375 lis r11, swapper_pg_dir@h
376 ori r11, r11, swapper_pg_dir@l 376 ori r11, r11, swapper_pg_dir@l
377 rlwimi r10, r11, 0, 2, 19 377 rlwimi r10, r11, 0, 2, 19
378 stw r12, 16(r0)
379 b LoadLargeDTLB
3783: 3803:
379 lwz r11, 0(r10) /* Get the level 1 entry */ 381 lwz r11, 0(r10) /* Get the level 1 entry */
380 rlwinm. r10, r11,0,0,19 /* Extract page descriptor page address */ 382 rlwinm. r10, r11,0,0,19 /* Extract page descriptor page address */
@@ -430,6 +432,81 @@ DataStoreTLBMiss:
430InstructionTLBError: 432InstructionTLBError:
431 b InstructionAccess 433 b InstructionAccess
432 434
435LoadLargeDTLB:
436 li r12, 0
437 lwz r11, 0(r10) /* Get the level 1 entry */
438 rlwinm. r10, r11,0,0,19 /* Extract page descriptor page address */
439 beq 3f /* If zero, don't try to find a pte */
440
441 /* We have a pte table, so load fetch the pte from the table.
442 */
443 ori r11, r11, 1 /* Set valid bit in physical L2 page */
444 DO_8xx_CPU6(0x3b80, r3)
445 mtspr SPRN_MD_TWC, r11 /* Load pte table base address */
446 mfspr r10, SPRN_MD_TWC /* ....and get the pte address */
447 lwz r10, 0(r10) /* Get the pte */
448
449 /* Insert the Guarded flag into the TWC from the Linux PTE.
450 * It is bit 27 of both the Linux PTE and the TWC (at least
451 * I got that right :-). It will be better when we can put
452 * this into the Linux pgd/pmd and load it in the operation
453 * above.
454 */
455 rlwimi r11, r10, 0, 27, 27
456
457 rlwimi r12, r10, 0, 0, 9 /* extract phys. addr */
458 mfspr r3, SPRN_MD_EPN
459 rlwinm r3, r3, 0, 0, 9 /* extract virtual address */
460 tophys(r3, r3)
461 cmpw r3, r12 /* only use 8M page if it is a direct
462 kernel mapping */
463 bne 1f
464 ori r11, r11, MD_PS8MEG
465 li r12, 1
466 b 2f
4671:
468 li r12, 0 /* can't use 8MB TLB, so zero r12. */
4692:
470 DO_8xx_CPU6(0x3b80, r3)
471 mtspr SPRN_MD_TWC, r11
472
473 /* The Linux PTE won't go exactly into the MMU TLB.
474 * Software indicator bits 21, 22 and 28 must be clear.
475 * Software indicator bits 24, 25, 26, and 27 must be
476 * set. All other Linux PTE bits control the behavior
477 * of the MMU.
478 */
4793: li r11, 0x00f0
480 rlwimi r10, r11, 0, 24, 28 /* Set 24-27, clear 28 */
481 cmpwi r12, 1
482 bne 4f
483 ori r10, r10, 0x8
484
485 mfspr r12, SPRN_MD_EPN
486 lis r3, 0xff80 /* 10-19 must be clear for 8MB TLB */
487 ori r3, r3, 0x0fff
488 and r12, r3, r12
489 DO_8xx_CPU6(0x3780, r3)
490 mtspr SPRN_MD_EPN, r12
491
492 lis r3, 0xff80 /* 10-19 must be clear for 8MB TLB */
493 ori r3, r3, 0x0fff
494 and r10, r3, r10
4954:
496 DO_8xx_CPU6(0x3d80, r3)
497 mtspr SPRN_MD_RPN, r10 /* Update TLB entry */
498
499 mfspr r10, SPRN_M_TW /* Restore registers */
500 lwz r11, 0(r0)
501 mtcr r11
502 lwz r11, 4(r0)
503
504 lwz r12, 16(r0)
505#ifdef CONFIG_8xx_CPU6
506 lwz r3, 8(r0)
507#endif
508 rfi
509
433/* This is the data TLB error on the MPC8xx. This could be due to 510/* This is the data TLB error on the MPC8xx. This could be due to
434 * many reasons, including a dirty update to a pte. We can catch that 511 * many reasons, including a dirty update to a pte. We can catch that
435 * one here, but anything else is an error. First, we track down the 512 * one here, but anything else is an error. First, we track down the
diff --git a/arch/ppc/kernel/idle.c b/arch/ppc/kernel/idle.c
index 821a75e45602..1be3ca5bae40 100644
--- a/arch/ppc/kernel/idle.c
+++ b/arch/ppc/kernel/idle.c
@@ -37,7 +37,6 @@
37void default_idle(void) 37void default_idle(void)
38{ 38{
39 void (*powersave)(void); 39 void (*powersave)(void);
40 int cpu = smp_processor_id();
41 40
42 powersave = ppc_md.power_save; 41 powersave = ppc_md.power_save;
43 42
@@ -47,7 +46,8 @@ void default_idle(void)
47#ifdef CONFIG_SMP 46#ifdef CONFIG_SMP
48 else { 47 else {
49 set_thread_flag(TIF_POLLING_NRFLAG); 48 set_thread_flag(TIF_POLLING_NRFLAG);
50 while (!need_resched() && !cpu_is_offline(cpu)) 49 while (!need_resched() &&
50 !cpu_is_offline(smp_processor_id()))
51 barrier(); 51 barrier();
52 clear_thread_flag(TIF_POLLING_NRFLAG); 52 clear_thread_flag(TIF_POLLING_NRFLAG);
53 } 53 }
diff --git a/arch/ppc/kernel/machine_kexec.c b/arch/ppc/kernel/machine_kexec.c
index a882b0dbe8de..84d65a87191e 100644
--- a/arch/ppc/kernel/machine_kexec.c
+++ b/arch/ppc/kernel/machine_kexec.c
@@ -28,12 +28,6 @@ typedef NORET_TYPE void (*relocate_new_kernel_t)(
28const extern unsigned char relocate_new_kernel[]; 28const extern unsigned char relocate_new_kernel[];
29const extern unsigned int relocate_new_kernel_size; 29const extern unsigned int relocate_new_kernel_size;
30 30
31/*
32 * Provide a dummy crash_notes definition while crash dump arrives to ppc.
33 * This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
34 */
35note_buf_t crash_notes[NR_CPUS];
36
37void machine_shutdown(void) 31void machine_shutdown(void)
38{ 32{
39 if (ppc_md.machine_shutdown) 33 if (ppc_md.machine_shutdown)
diff --git a/arch/ppc/kernel/misc.S b/arch/ppc/kernel/misc.S
index 5e61124581d0..c3427eed8345 100644
--- a/arch/ppc/kernel/misc.S
+++ b/arch/ppc/kernel/misc.S
@@ -204,78 +204,6 @@ _GLOBAL(call_setup_cpu)
204 mtctr r5 204 mtctr r5
205 bctr 205 bctr
206 206
207#if defined(CONFIG_CPU_FREQ_PMAC) && defined(CONFIG_6xx)
208
209/* This gets called by via-pmu.c to switch the PLL selection
210 * on 750fx CPU. This function should really be moved to some
211 * other place (as most of the cpufreq code in via-pmu
212 */
213_GLOBAL(low_choose_750fx_pll)
214 /* Clear MSR:EE */
215 mfmsr r7
216 rlwinm r0,r7,0,17,15
217 mtmsr r0
218
219 /* If switching to PLL1, disable HID0:BTIC */
220 cmplwi cr0,r3,0
221 beq 1f
222 mfspr r5,SPRN_HID0
223 rlwinm r5,r5,0,27,25
224 sync
225 mtspr SPRN_HID0,r5
226 isync
227 sync
228
2291:
230 /* Calc new HID1 value */
231 mfspr r4,SPRN_HID1 /* Build a HID1:PS bit from parameter */
232 rlwinm r5,r3,16,15,15 /* Clear out HID1:PS from value read */
233 rlwinm r4,r4,0,16,14 /* Could have I used rlwimi here ? */
234 or r4,r4,r5
235 mtspr SPRN_HID1,r4
236
237 /* Store new HID1 image */
238 rlwinm r6,r1,0,0,18
239 lwz r6,TI_CPU(r6)
240 slwi r6,r6,2
241 addis r6,r6,nap_save_hid1@ha
242 stw r4,nap_save_hid1@l(r6)
243
244 /* If switching to PLL0, enable HID0:BTIC */
245 cmplwi cr0,r3,0
246 bne 1f
247 mfspr r5,SPRN_HID0
248 ori r5,r5,HID0_BTIC
249 sync
250 mtspr SPRN_HID0,r5
251 isync
252 sync
253
2541:
255 /* Return */
256 mtmsr r7
257 blr
258
259_GLOBAL(low_choose_7447a_dfs)
260 /* Clear MSR:EE */
261 mfmsr r7
262 rlwinm r0,r7,0,17,15
263 mtmsr r0
264
265 /* Calc new HID1 value */
266 mfspr r4,SPRN_HID1
267 insrwi r4,r3,1,9 /* insert parameter into bit 9 */
268 sync
269 mtspr SPRN_HID1,r4
270 sync
271 isync
272
273 /* Return */
274 mtmsr r7
275 blr
276
277#endif /* CONFIG_CPU_FREQ_PMAC && CONFIG_6xx */
278
279/* 207/*
280 * complement mask on the msr then "or" some values on. 208 * complement mask on the msr then "or" some values on.
281 * _nmask_and_or_msr(nmask, value_to_or) 209 * _nmask_and_or_msr(nmask, value_to_or)
@@ -1197,7 +1125,7 @@ _GLOBAL(sys_call_table)
1197 .long sys_ssetmask 1125 .long sys_ssetmask
1198 .long sys_setreuid /* 70 */ 1126 .long sys_setreuid /* 70 */
1199 .long sys_setregid 1127 .long sys_setregid
1200 .long ppc_sigsuspend 1128 .long sys_sigsuspend
1201 .long sys_sigpending 1129 .long sys_sigpending
1202 .long sys_sethostname 1130 .long sys_sethostname
1203 .long sys_setrlimit /* 75 */ 1131 .long sys_setrlimit /* 75 */
@@ -1303,7 +1231,7 @@ _GLOBAL(sys_call_table)
1303 .long sys_rt_sigpending /* 175 */ 1231 .long sys_rt_sigpending /* 175 */
1304 .long sys_rt_sigtimedwait 1232 .long sys_rt_sigtimedwait
1305 .long sys_rt_sigqueueinfo 1233 .long sys_rt_sigqueueinfo
1306 .long ppc_rt_sigsuspend 1234 .long sys_rt_sigsuspend
1307 .long sys_pread64 1235 .long sys_pread64
1308 .long sys_pwrite64 /* 180 */ 1236 .long sys_pwrite64 /* 180 */
1309 .long sys_chown 1237 .long sys_chown
@@ -1374,7 +1302,7 @@ _GLOBAL(sys_call_table)
1374 .long sys_clock_gettime 1302 .long sys_clock_gettime
1375 .long sys_clock_getres 1303 .long sys_clock_getres
1376 .long sys_clock_nanosleep 1304 .long sys_clock_nanosleep
1377 .long ppc_swapcontext 1305 .long sys_swapcontext
1378 .long sys_tgkill /* 250 */ 1306 .long sys_tgkill /* 250 */
1379 .long sys_utimes 1307 .long sys_utimes
1380 .long sys_statfs64 1308 .long sys_statfs64
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
index f7fae5f153b2..04d04c5bfdd0 100644
--- a/arch/ppc/kernel/pci.c
+++ b/arch/ppc/kernel/pci.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Common pmac/prep/chrp pci routines. -- Cort 2 * Common prep/chrp pci routines. -- Cort
3 */ 3 */
4 4
5#include <linux/config.h> 5#include <linux/config.h>
@@ -50,8 +50,7 @@ static void fixup_cpc710_pci64(struct pci_dev* dev);
50static u8* pci_to_OF_bus_map; 50static u8* pci_to_OF_bus_map;
51#endif 51#endif
52 52
53/* By default, we don't re-assign bus numbers. We do this only on 53/* By default, we don't re-assign bus numbers.
54 * some pmacs
55 */ 54 */
56int pci_assign_all_buses; 55int pci_assign_all_buses;
57 56
@@ -503,7 +502,7 @@ pcibios_allocate_resources(int pass)
503 u16 command; 502 u16 command;
504 struct resource *r; 503 struct resource *r;
505 504
506 while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 505 for_each_pci_dev(dev) {
507 pci_read_config_word(dev, PCI_COMMAND, &command); 506 pci_read_config_word(dev, PCI_COMMAND, &command);
508 for (idx = 0; idx < 6; idx++) { 507 for (idx = 0; idx < 6; idx++) {
509 r = &dev->resource[idx]; 508 r = &dev->resource[idx];
@@ -540,7 +539,7 @@ pcibios_assign_resources(void)
540 int idx; 539 int idx;
541 struct resource *r; 540 struct resource *r;
542 541
543 while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 542 for_each_pci_dev(dev) {
544 int class = dev->class >> 8; 543 int class = dev->class >> 8;
545 544
546 /* Don't touch classless devices and host bridges */ 545 /* Don't touch classless devices and host bridges */
@@ -780,17 +779,6 @@ pci_busdev_to_OF_node(struct pci_bus *bus, int devfn)
780 return NULL; 779 return NULL;
781 780
782 /* Fixup bus number according to what OF think it is. */ 781 /* Fixup bus number according to what OF think it is. */
783#ifdef CONFIG_PPC_PMAC
784 /* The G5 need a special case here. Basically, we don't remap all
785 * busses on it so we don't create the pci-OF-map. However, we do
786 * remap the AGP bus and so have to deal with it. A future better
787 * fix has to be done by making the remapping per-host and always
788 * filling the pci_to_OF map. --BenH
789 */
790 if (_machine == _MACH_Pmac && busnr >= 0xf0)
791 busnr -= 0xf0;
792 else
793#endif
794 if (pci_to_OF_bus_map) 782 if (pci_to_OF_bus_map)
795 busnr = pci_to_OF_bus_map[busnr]; 783 busnr = pci_to_OF_bus_map[busnr];
796 if (busnr == 0xff) 784 if (busnr == 0xff)
@@ -815,8 +803,7 @@ EXPORT_SYMBOL(pci_device_to_OF_node);
815 * to set pci_assign_all_buses to 1 and still use RTAS for PCI 803 * to set pci_assign_all_buses to 1 and still use RTAS for PCI
816 * config cycles. 804 * config cycles.
817 */ 805 */
818struct pci_controller* 806struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
819pci_find_hose_for_OF_device(struct device_node* node)
820{ 807{
821 if (!have_of) 808 if (!have_of)
822 return NULL; 809 return NULL;
@@ -868,14 +855,15 @@ pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
868 */ 855 */
869 if (!pci_to_OF_bus_map) 856 if (!pci_to_OF_bus_map)
870 return 0; 857 return 0;
871 while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 858
872 if (pci_to_OF_bus_map[dev->bus->number] != *bus) 859 for_each_pci_dev(dev)
873 continue; 860 if (pci_to_OF_bus_map[dev->bus->number] == *bus &&
874 if (dev->devfn != *devfn) 861 dev->devfn == *devfn) {
875 continue; 862 *bus = dev->bus->number;
876 *bus = dev->bus->number; 863 pci_dev_put(dev);
877 return 0; 864 return 0;
878 } 865 }
866
879 return -ENODEV; 867 return -ENODEV;
880} 868}
881EXPORT_SYMBOL(pci_device_from_OF_node); 869EXPORT_SYMBOL(pci_device_from_OF_node);
@@ -942,7 +930,7 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
942 while (ranges && (rlen -= np * sizeof(unsigned int)) >= 0) { 930 while (ranges && (rlen -= np * sizeof(unsigned int)) >= 0) {
943 res = NULL; 931 res = NULL;
944 size = ranges[na+4]; 932 size = ranges[na+4];
945 switch (ranges[0] >> 24) { 933 switch ((ranges[0] >> 24) & 0x3) {
946 case 1: /* I/O space */ 934 case 1: /* I/O space */
947 if (ranges[2] != 0) 935 if (ranges[2] != 0)
948 break; 936 break;
@@ -956,6 +944,8 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
956 res = &hose->io_resource; 944 res = &hose->io_resource;
957 res->flags = IORESOURCE_IO; 945 res->flags = IORESOURCE_IO;
958 res->start = ranges[2]; 946 res->start = ranges[2];
947 DBG("PCI: IO 0x%lx -> 0x%lx\n",
948 res->start, res->start + size - 1);
959 break; 949 break;
960 case 2: /* memory space */ 950 case 2: /* memory space */
961 memno = 0; 951 memno = 0;
@@ -973,7 +963,11 @@ pci_process_bridge_OF_ranges(struct pci_controller *hose,
973 if (memno < 3) { 963 if (memno < 3) {
974 res = &hose->mem_resources[memno]; 964 res = &hose->mem_resources[memno];
975 res->flags = IORESOURCE_MEM; 965 res->flags = IORESOURCE_MEM;
966 if(ranges[0] & 0x40000000)
967 res->flags |= IORESOURCE_PREFETCH;
976 res->start = ranges[na+2]; 968 res->start = ranges[na+2];
969 DBG("PCI: MEM[%d] 0x%lx -> 0x%lx\n", memno,
970 res->start, res->start + size - 1);
977 } 971 }
978 break; 972 break;
979 } 973 }
@@ -1034,216 +1028,6 @@ void pcibios_add_platform_entries(struct pci_dev *pdev)
1034} 1028}
1035 1029
1036 1030
1037#ifdef CONFIG_PPC_PMAC
1038/*
1039 * This set of routines checks for PCI<->PCI bridges that have closed
1040 * IO resources and have child devices. It tries to re-open an IO
1041 * window on them.
1042 *
1043 * This is a _temporary_ fix to workaround a problem with Apple's OF
1044 * closing IO windows on P2P bridges when the OF drivers of cards
1045 * below this bridge don't claim any IO range (typically ATI or
1046 * Adaptec).
1047 *
1048 * A more complete fix would be to use drivers/pci/setup-bus.c, which
1049 * involves a working pcibios_fixup_pbus_ranges(), some more care about
1050 * ordering when creating the host bus resources, and maybe a few more
1051 * minor tweaks
1052 */
1053
1054/* Initialize bridges with base/limit values we have collected */
1055static void __init
1056do_update_p2p_io_resource(struct pci_bus *bus, int enable_vga)
1057{
1058 struct pci_dev *bridge = bus->self;
1059 struct pci_controller* hose = (struct pci_controller *)bridge->sysdata;
1060 u32 l;
1061 u16 w;
1062 struct resource res;
1063
1064 if (bus->resource[0] == NULL)
1065 return;
1066 res = *(bus->resource[0]);
1067
1068 DBG("Remapping Bus %d, bridge: %s\n", bus->number, pci_name(bridge));
1069 res.start -= ((unsigned long) hose->io_base_virt - isa_io_base);
1070 res.end -= ((unsigned long) hose->io_base_virt - isa_io_base);
1071 DBG(" IO window: %08lx-%08lx\n", res.start, res.end);
1072
1073 /* Set up the top and bottom of the PCI I/O segment for this bus. */
1074 pci_read_config_dword(bridge, PCI_IO_BASE, &l);
1075 l &= 0xffff000f;
1076 l |= (res.start >> 8) & 0x00f0;
1077 l |= res.end & 0xf000;
1078 pci_write_config_dword(bridge, PCI_IO_BASE, l);
1079
1080 if ((l & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32) {
1081 l = (res.start >> 16) | (res.end & 0xffff0000);
1082 pci_write_config_dword(bridge, PCI_IO_BASE_UPPER16, l);
1083 }
1084
1085 pci_read_config_word(bridge, PCI_COMMAND, &w);
1086 w |= PCI_COMMAND_IO;
1087 pci_write_config_word(bridge, PCI_COMMAND, w);
1088
1089#if 0 /* Enabling this causes XFree 4.2.0 to hang during PCI probe */
1090 if (enable_vga) {
1091 pci_read_config_word(bridge, PCI_BRIDGE_CONTROL, &w);
1092 w |= PCI_BRIDGE_CTL_VGA;
1093 pci_write_config_word(bridge, PCI_BRIDGE_CONTROL, w);
1094 }
1095#endif
1096}
1097
1098/* This function is pretty basic and actually quite broken for the
1099 * general case, it's enough for us right now though. It's supposed
1100 * to tell us if we need to open an IO range at all or not and what
1101 * size.
1102 */
1103static int __init
1104check_for_io_childs(struct pci_bus *bus, struct resource* res, int *found_vga)
1105{
1106 struct pci_dev *dev;
1107 int i;
1108 int rc = 0;
1109
1110#define push_end(res, size) do { unsigned long __sz = (size) ; \
1111 res->end = ((res->end + __sz) / (__sz + 1)) * (__sz + 1) + __sz; \
1112 } while (0)
1113
1114 list_for_each_entry(dev, &bus->devices, bus_list) {
1115 u16 class = dev->class >> 8;
1116
1117 if (class == PCI_CLASS_DISPLAY_VGA ||
1118 class == PCI_CLASS_NOT_DEFINED_VGA)
1119 *found_vga = 1;
1120 if (class >> 8 == PCI_BASE_CLASS_BRIDGE && dev->subordinate)
1121 rc |= check_for_io_childs(dev->subordinate, res, found_vga);
1122 if (class == PCI_CLASS_BRIDGE_CARDBUS)
1123 push_end(res, 0xfff);
1124
1125 for (i=0; i<PCI_NUM_RESOURCES; i++) {
1126 struct resource *r;
1127 unsigned long r_size;
1128
1129 if (dev->class >> 8 == PCI_CLASS_BRIDGE_PCI
1130 && i >= PCI_BRIDGE_RESOURCES)
1131 continue;
1132 r = &dev->resource[i];
1133 r_size = r->end - r->start;
1134 if (r_size < 0xfff)
1135 r_size = 0xfff;
1136 if (r->flags & IORESOURCE_IO && (r_size) != 0) {
1137 rc = 1;
1138 push_end(res, r_size);
1139 }
1140 }
1141 }
1142
1143 return rc;
1144}
1145
1146/* Here we scan all P2P bridges of a given level that have a closed
1147 * IO window. Note that the test for the presence of a VGA card should
1148 * be improved to take into account already configured P2P bridges,
1149 * currently, we don't see them and might end up configuring 2 bridges
1150 * with VGA pass through enabled
1151 */
1152static void __init
1153do_fixup_p2p_level(struct pci_bus *bus)
1154{
1155 struct pci_bus *b;
1156 int i, parent_io;
1157 int has_vga = 0;
1158
1159 for (parent_io=0; parent_io<4; parent_io++)
1160 if (bus->resource[parent_io]
1161 && bus->resource[parent_io]->flags & IORESOURCE_IO)
1162 break;
1163 if (parent_io >= 4)
1164 return;
1165
1166 list_for_each_entry(b, &bus->children, node) {
1167 struct pci_dev *d = b->self;
1168 struct pci_controller* hose = (struct pci_controller *)d->sysdata;
1169 struct resource *res = b->resource[0];
1170 struct resource tmp_res;
1171 unsigned long max;
1172 int found_vga = 0;
1173
1174 memset(&tmp_res, 0, sizeof(tmp_res));
1175 tmp_res.start = bus->resource[parent_io]->start;
1176
1177 /* We don't let low addresses go through that closed P2P bridge, well,
1178 * that may not be necessary but I feel safer that way
1179 */
1180 if (tmp_res.start == 0)
1181 tmp_res.start = 0x1000;
1182
1183 if (!list_empty(&b->devices) && res && res->flags == 0 &&
1184 res != bus->resource[parent_io] &&
1185 (d->class >> 8) == PCI_CLASS_BRIDGE_PCI &&
1186 check_for_io_childs(b, &tmp_res, &found_vga)) {
1187 u8 io_base_lo;
1188
1189 printk(KERN_INFO "Fixing up IO bus %s\n", b->name);
1190
1191 if (found_vga) {
1192 if (has_vga) {
1193 printk(KERN_WARNING "Skipping VGA, already active"
1194 " on bus segment\n");
1195 found_vga = 0;
1196 } else
1197 has_vga = 1;
1198 }
1199 pci_read_config_byte(d, PCI_IO_BASE, &io_base_lo);
1200
1201 if ((io_base_lo & PCI_IO_RANGE_TYPE_MASK) == PCI_IO_RANGE_TYPE_32)
1202 max = ((unsigned long) hose->io_base_virt
1203 - isa_io_base) + 0xffffffff;
1204 else
1205 max = ((unsigned long) hose->io_base_virt
1206 - isa_io_base) + 0xffff;
1207
1208 *res = tmp_res;
1209 res->flags = IORESOURCE_IO;
1210 res->name = b->name;
1211
1212 /* Find a resource in the parent where we can allocate */
1213 for (i = 0 ; i < 4; i++) {
1214 struct resource *r = bus->resource[i];
1215 if (!r)
1216 continue;
1217 if ((r->flags & IORESOURCE_IO) == 0)
1218 continue;
1219 DBG("Trying to allocate from %08lx, size %08lx from parent"
1220 " res %d: %08lx -> %08lx\n",
1221 res->start, res->end, i, r->start, r->end);
1222
1223 if (allocate_resource(r, res, res->end + 1, res->start, max,
1224 res->end + 1, NULL, NULL) < 0) {
1225 DBG("Failed !\n");
1226 continue;
1227 }
1228 do_update_p2p_io_resource(b, found_vga);
1229 break;
1230 }
1231 }
1232 do_fixup_p2p_level(b);
1233 }
1234}
1235
1236static void
1237pcibios_fixup_p2p_bridges(void)
1238{
1239 struct pci_bus *b;
1240
1241 list_for_each_entry(b, &pci_root_buses, node)
1242 do_fixup_p2p_level(b);
1243}
1244
1245#endif /* CONFIG_PPC_PMAC */
1246
1247static int __init 1031static int __init
1248pcibios_init(void) 1032pcibios_init(void)
1249{ 1033{
@@ -1284,9 +1068,6 @@ pcibios_init(void)
1284 pcibios_allocate_bus_resources(&pci_root_buses); 1068 pcibios_allocate_bus_resources(&pci_root_buses);
1285 pcibios_allocate_resources(0); 1069 pcibios_allocate_resources(0);
1286 pcibios_allocate_resources(1); 1070 pcibios_allocate_resources(1);
1287#ifdef CONFIG_PPC_PMAC
1288 pcibios_fixup_p2p_bridges();
1289#endif /* CONFIG_PPC_PMAC */
1290 pcibios_assign_resources(); 1071 pcibios_assign_resources();
1291 1072
1292 /* Call machine dependent post-init code */ 1073 /* Call machine dependent post-init code */
@@ -1716,17 +1497,6 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
1716 struct pci_controller* hose; 1497 struct pci_controller* hose;
1717 long result = -EOPNOTSUPP; 1498 long result = -EOPNOTSUPP;
1718 1499
1719 /* Argh ! Please forgive me for that hack, but that's the
1720 * simplest way to get existing XFree to not lockup on some
1721 * G5 machines... So when something asks for bus 0 io base
1722 * (bus 0 is HT root), we return the AGP one instead.
1723 */
1724#ifdef CONFIG_PPC_PMAC
1725 if (_machine == _MACH_Pmac && machine_is_compatible("MacRISC4"))
1726 if (bus == 0)
1727 bus = 0xf0;
1728#endif /* CONFIG_PPC_PMAC */
1729
1730 hose = pci_bus_to_hose(bus); 1500 hose = pci_bus_to_hose(bus);
1731 if (!hose) 1501 if (!hose)
1732 return -ENODEV; 1502 return -ENODEV;
@@ -1806,6 +1576,23 @@ void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
1806EXPORT_SYMBOL(pci_iomap); 1576EXPORT_SYMBOL(pci_iomap);
1807EXPORT_SYMBOL(pci_iounmap); 1577EXPORT_SYMBOL(pci_iounmap);
1808 1578
1579unsigned long pci_address_to_pio(phys_addr_t address)
1580{
1581 struct pci_controller* hose = hose_head;
1582
1583 for (; hose; hose = hose->next) {
1584 unsigned int size = hose->io_resource.end -
1585 hose->io_resource.start + 1;
1586 if (address >= hose->io_base_phys &&
1587 address < (hose->io_base_phys + size)) {
1588 unsigned long base =
1589 (unsigned long)hose->io_base_virt - _IO_BASE;
1590 return base + (address - hose->io_base_phys);
1591 }
1592 }
1593 return (unsigned int)-1;
1594}
1595EXPORT_SYMBOL(pci_address_to_pio);
1809 1596
1810/* 1597/*
1811 * Null PCI config access functions, for the case when we can't 1598 * Null PCI config access functions, for the case when we can't
diff --git a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c
index ca810025993f..2f5c7650274f 100644
--- a/arch/ppc/kernel/ppc_htab.c
+++ b/arch/ppc/kernel/ppc_htab.c
@@ -16,6 +16,7 @@
16#include <linux/proc_fs.h> 16#include <linux/proc_fs.h>
17#include <linux/stat.h> 17#include <linux/stat.h>
18#include <linux/sysctl.h> 18#include <linux/sysctl.h>
19#include <linux/capability.h>
19#include <linux/ctype.h> 20#include <linux/ctype.h>
20#include <linux/threads.h> 21#include <linux/threads.h>
21#include <linux/smp_lock.h> 22#include <linux/smp_lock.h>
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
index bb6a5c6a64be..3a6e4bcb3c53 100644
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -34,7 +34,6 @@
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/pci-bridge.h> 35#include <asm/pci-bridge.h>
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/pmac_feature.h>
38#include <asm/dma.h> 37#include <asm/dma.h>
39#include <asm/machdep.h> 38#include <asm/machdep.h>
40#include <asm/hw_irq.h> 39#include <asm/hw_irq.h>
@@ -58,7 +57,6 @@ extern void machine_check_exception(struct pt_regs *regs);
58extern void alignment_exception(struct pt_regs *regs); 57extern void alignment_exception(struct pt_regs *regs);
59extern void program_check_exception(struct pt_regs *regs); 58extern void program_check_exception(struct pt_regs *regs);
60extern void single_step_exception(struct pt_regs *regs); 59extern void single_step_exception(struct pt_regs *regs);
61extern int pmac_newworld;
62extern int sys_sigreturn(struct pt_regs *regs); 60extern int sys_sigreturn(struct pt_regs *regs);
63 61
64long long __ashrdi3(long long, int); 62long long __ashrdi3(long long, int);
@@ -82,10 +80,6 @@ EXPORT_SYMBOL(ppc_n_lost_interrupts);
82EXPORT_SYMBOL(ISA_DMA_THRESHOLD); 80EXPORT_SYMBOL(ISA_DMA_THRESHOLD);
83EXPORT_SYMBOL(DMA_MODE_READ); 81EXPORT_SYMBOL(DMA_MODE_READ);
84EXPORT_SYMBOL(DMA_MODE_WRITE); 82EXPORT_SYMBOL(DMA_MODE_WRITE);
85#if defined(CONFIG_PPC_PREP)
86EXPORT_SYMBOL(_prep_type);
87EXPORT_SYMBOL(ucSystemType);
88#endif
89 83
90#if !defined(__INLINE_BITOPS) 84#if !defined(__INLINE_BITOPS)
91EXPORT_SYMBOL(set_bit); 85EXPORT_SYMBOL(set_bit);
@@ -217,10 +211,6 @@ EXPORT_SYMBOL(adb_try_handler_change);
217EXPORT_SYMBOL(cuda_request); 211EXPORT_SYMBOL(cuda_request);
218EXPORT_SYMBOL(cuda_poll); 212EXPORT_SYMBOL(cuda_poll);
219#endif /* CONFIG_ADB_CUDA */ 213#endif /* CONFIG_ADB_CUDA */
220#ifdef CONFIG_PPC_PMAC
221EXPORT_SYMBOL(sys_ctrler);
222EXPORT_SYMBOL(pmac_newworld);
223#endif
224#ifdef CONFIG_PPC_OF 214#ifdef CONFIG_PPC_OF
225EXPORT_SYMBOL(find_devices); 215EXPORT_SYMBOL(find_devices);
226EXPORT_SYMBOL(find_type_devices); 216EXPORT_SYMBOL(find_type_devices);
@@ -245,9 +235,6 @@ EXPORT_SYMBOL(of_node_put);
245#if defined(CONFIG_BOOTX_TEXT) 235#if defined(CONFIG_BOOTX_TEXT)
246EXPORT_SYMBOL(btext_update_display); 236EXPORT_SYMBOL(btext_update_display);
247#endif 237#endif
248#if defined(CONFIG_SCSI) && defined(CONFIG_PPC_PMAC)
249EXPORT_SYMBOL(note_scsi_host);
250#endif
251#ifdef CONFIG_VT 238#ifdef CONFIG_VT
252EXPORT_SYMBOL(kd_mksound); 239EXPORT_SYMBOL(kd_mksound);
253#endif 240#endif
@@ -274,7 +261,6 @@ EXPORT_SYMBOL(__delay);
274EXPORT_SYMBOL(timer_interrupt); 261EXPORT_SYMBOL(timer_interrupt);
275EXPORT_SYMBOL(irq_desc); 262EXPORT_SYMBOL(irq_desc);
276EXPORT_SYMBOL(tb_ticks_per_jiffy); 263EXPORT_SYMBOL(tb_ticks_per_jiffy);
277EXPORT_SYMBOL(get_wchan);
278EXPORT_SYMBOL(console_drivers); 264EXPORT_SYMBOL(console_drivers);
279#ifdef CONFIG_XMON 265#ifdef CONFIG_XMON
280EXPORT_SYMBOL(xmon); 266EXPORT_SYMBOL(xmon);
@@ -311,7 +297,6 @@ EXPORT_SYMBOL(__res);
311 297
312EXPORT_SYMBOL(next_mmu_context); 298EXPORT_SYMBOL(next_mmu_context);
313EXPORT_SYMBOL(set_context); 299EXPORT_SYMBOL(set_context);
314EXPORT_SYMBOL_GPL(__handle_mm_fault); /* For MOL */
315EXPORT_SYMBOL(disarm_decr); 300EXPORT_SYMBOL(disarm_decr);
316#ifdef CONFIG_PPC_STD_MMU 301#ifdef CONFIG_PPC_STD_MMU
317extern long mol_trampoline; 302extern long mol_trampoline;
diff --git a/arch/ppc/kernel/process.c b/arch/ppc/kernel/process.c
deleted file mode 100644
index 25cbdc8d2941..000000000000
--- a/arch/ppc/kernel/process.c
+++ /dev/null
@@ -1,851 +0,0 @@
1/*
2 * arch/ppc/kernel/process.c
3 *
4 * Derived from "arch/i386/kernel/process.c"
5 * Copyright (C) 1995 Linus Torvalds
6 *
7 * Updated and modified by Cort Dougan (cort@cs.nmt.edu) and
8 * Paul Mackerras (paulus@cs.anu.edu.au)
9 *
10 * PowerPC version
11 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version
16 * 2 of the License, or (at your option) any later version.
17 *
18 */
19
20#include <linux/config.h>
21#include <linux/errno.h>
22#include <linux/sched.h>
23#include <linux/kernel.h>
24#include <linux/mm.h>
25#include <linux/smp.h>
26#include <linux/smp_lock.h>
27#include <linux/stddef.h>
28#include <linux/unistd.h>
29#include <linux/ptrace.h>
30#include <linux/slab.h>
31#include <linux/user.h>
32#include <linux/elf.h>
33#include <linux/init.h>
34#include <linux/prctl.h>
35#include <linux/init_task.h>
36#include <linux/module.h>
37#include <linux/kallsyms.h>
38#include <linux/mqueue.h>
39#include <linux/hardirq.h>
40
41#include <asm/pgtable.h>
42#include <asm/uaccess.h>
43#include <asm/system.h>
44#include <asm/io.h>
45#include <asm/processor.h>
46#include <asm/mmu.h>
47#include <asm/prom.h>
48
49extern unsigned long _get_SP(void);
50
51struct task_struct *last_task_used_math = NULL;
52struct task_struct *last_task_used_altivec = NULL;
53struct task_struct *last_task_used_spe = NULL;
54
55static struct fs_struct init_fs = INIT_FS;
56static struct files_struct init_files = INIT_FILES;
57static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
58static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
59struct mm_struct init_mm = INIT_MM(init_mm);
60EXPORT_SYMBOL(init_mm);
61
62/* this is 8kB-aligned so we can get to the thread_info struct
63 at the base of it from the stack pointer with 1 integer instruction. */
64union thread_union init_thread_union
65 __attribute__((__section__(".data.init_task"))) =
66{ INIT_THREAD_INFO(init_task) };
67
68/* initial task structure */
69struct task_struct init_task = INIT_TASK(init_task);
70EXPORT_SYMBOL(init_task);
71
72/* only used to get secondary processor up */
73struct task_struct *current_set[NR_CPUS] = {&init_task, };
74
75#undef SHOW_TASK_SWITCHES
76#undef CHECK_STACK
77
78#if defined(CHECK_STACK)
79unsigned long
80kernel_stack_top(struct task_struct *tsk)
81{
82 return ((unsigned long)tsk) + sizeof(union task_union);
83}
84
85unsigned long
86task_top(struct task_struct *tsk)
87{
88 return ((unsigned long)tsk) + sizeof(struct thread_info);
89}
90
91/* check to make sure the kernel stack is healthy */
92int check_stack(struct task_struct *tsk)
93{
94 unsigned long stack_top = kernel_stack_top(tsk);
95 unsigned long tsk_top = task_top(tsk);
96 int ret = 0;
97
98#if 0
99 /* check thread magic */
100 if ( tsk->thread.magic != THREAD_MAGIC )
101 {
102 ret |= 1;
103 printk("thread.magic bad: %08x\n", tsk->thread.magic);
104 }
105#endif
106
107 if ( !tsk )
108 printk("check_stack(): tsk bad tsk %p\n",tsk);
109
110 /* check if stored ksp is bad */
111 if ( (tsk->thread.ksp > stack_top) || (tsk->thread.ksp < tsk_top) )
112 {
113 printk("stack out of bounds: %s/%d\n"
114 " tsk_top %08lx ksp %08lx stack_top %08lx\n",
115 tsk->comm,tsk->pid,
116 tsk_top, tsk->thread.ksp, stack_top);
117 ret |= 2;
118 }
119
120 /* check if stack ptr RIGHT NOW is bad */
121 if ( (tsk == current) && ((_get_SP() > stack_top ) || (_get_SP() < tsk_top)) )
122 {
123 printk("current stack ptr out of bounds: %s/%d\n"
124 " tsk_top %08lx sp %08lx stack_top %08lx\n",
125 current->comm,current->pid,
126 tsk_top, _get_SP(), stack_top);
127 ret |= 4;
128 }
129
130#if 0
131 /* check amount of free stack */
132 for ( i = (unsigned long *)task_top(tsk) ; i < kernel_stack_top(tsk) ; i++ )
133 {
134 if ( !i )
135 printk("check_stack(): i = %p\n", i);
136 if ( *i != 0 )
137 {
138 /* only notify if it's less than 900 bytes */
139 if ( (i - (unsigned long *)task_top(tsk)) < 900 )
140 printk("%d bytes free on stack\n",
141 i - task_top(tsk));
142 break;
143 }
144 }
145#endif
146
147 if (ret)
148 {
149 panic("bad kernel stack");
150 }
151 return(ret);
152}
153#endif /* defined(CHECK_STACK) */
154
155/*
156 * Make sure the floating-point register state in the
157 * the thread_struct is up to date for task tsk.
158 */
159void flush_fp_to_thread(struct task_struct *tsk)
160{
161 if (tsk->thread.regs) {
162 /*
163 * We need to disable preemption here because if we didn't,
164 * another process could get scheduled after the regs->msr
165 * test but before we have finished saving the FP registers
166 * to the thread_struct. That process could take over the
167 * FPU, and then when we get scheduled again we would store
168 * bogus values for the remaining FP registers.
169 */
170 preempt_disable();
171 if (tsk->thread.regs->msr & MSR_FP) {
172#ifdef CONFIG_SMP
173 /*
174 * This should only ever be called for current or
175 * for a stopped child process. Since we save away
176 * the FP register state on context switch on SMP,
177 * there is something wrong if a stopped child appears
178 * to still have its FP state in the CPU registers.
179 */
180 BUG_ON(tsk != current);
181#endif
182 giveup_fpu(current);
183 }
184 preempt_enable();
185 }
186}
187
188void enable_kernel_fp(void)
189{
190 WARN_ON(preemptible());
191
192#ifdef CONFIG_SMP
193 if (current->thread.regs && (current->thread.regs->msr & MSR_FP))
194 giveup_fpu(current);
195 else
196 giveup_fpu(NULL); /* just enables FP for kernel */
197#else
198 giveup_fpu(last_task_used_math);
199#endif /* CONFIG_SMP */
200}
201EXPORT_SYMBOL(enable_kernel_fp);
202
203int dump_task_fpu(struct task_struct *tsk, elf_fpregset_t *fpregs)
204{
205 preempt_disable();
206 if (tsk->thread.regs && (tsk->thread.regs->msr & MSR_FP))
207 giveup_fpu(tsk);
208 preempt_enable();
209 memcpy(fpregs, &tsk->thread.fpr[0], sizeof(*fpregs));
210 return 1;
211}
212
213#ifdef CONFIG_ALTIVEC
214void enable_kernel_altivec(void)
215{
216 WARN_ON(preemptible());
217
218#ifdef CONFIG_SMP
219 if (current->thread.regs && (current->thread.regs->msr & MSR_VEC))
220 giveup_altivec(current);
221 else
222 giveup_altivec(NULL); /* just enable AltiVec for kernel - force */
223#else
224 giveup_altivec(last_task_used_altivec);
225#endif /* __SMP __ */
226}
227EXPORT_SYMBOL(enable_kernel_altivec);
228
229/*
230 * Make sure the VMX/Altivec register state in the
231 * the thread_struct is up to date for task tsk.
232 */
233void flush_altivec_to_thread(struct task_struct *tsk)
234{
235 if (tsk->thread.regs) {
236 preempt_disable();
237 if (tsk->thread.regs->msr & MSR_VEC) {
238#ifdef CONFIG_SMP
239 BUG_ON(tsk != current);
240#endif
241 giveup_altivec(current);
242 }
243 preempt_enable();
244 }
245}
246
247int dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
248{
249 if (regs->msr & MSR_VEC)
250 giveup_altivec(current);
251 memcpy(vrregs, &current->thread.vr[0], sizeof(*vrregs));
252 return 1;
253}
254#endif /* CONFIG_ALTIVEC */
255
256#ifdef CONFIG_SPE
257void
258enable_kernel_spe(void)
259{
260 WARN_ON(preemptible());
261
262#ifdef CONFIG_SMP
263 if (current->thread.regs && (current->thread.regs->msr & MSR_SPE))
264 giveup_spe(current);
265 else
266 giveup_spe(NULL); /* just enable SPE for kernel - force */
267#else
268 giveup_spe(last_task_used_spe);
269#endif /* __SMP __ */
270}
271EXPORT_SYMBOL(enable_kernel_spe);
272
273void flush_spe_to_thread(struct task_struct *tsk)
274{
275 if (tsk->thread.regs) {
276 preempt_disable();
277 if (tsk->thread.regs->msr & MSR_SPE) {
278#ifdef CONFIG_SMP
279 BUG_ON(tsk != current);
280#endif
281 giveup_spe(current);
282 }
283 preempt_enable();
284 }
285}
286
287int dump_spe(struct pt_regs *regs, elf_vrregset_t *evrregs)
288{
289 if (regs->msr & MSR_SPE)
290 giveup_spe(current);
291 /* We copy u32 evr[32] + u64 acc + u32 spefscr -> 35 */
292 memcpy(evrregs, &current->thread.evr[0], sizeof(u32) * 35);
293 return 1;
294}
295#endif /* CONFIG_SPE */
296
297struct task_struct *__switch_to(struct task_struct *prev,
298 struct task_struct *new)
299{
300 struct thread_struct *new_thread, *old_thread;
301 unsigned long s;
302 struct task_struct *last;
303
304 local_irq_save(s);
305#ifdef CHECK_STACK
306 check_stack(prev);
307 check_stack(new);
308#endif
309
310#ifdef CONFIG_SMP
311 /* avoid complexity of lazy save/restore of fpu
312 * by just saving it every time we switch out if
313 * this task used the fpu during the last quantum.
314 *
315 * If it tries to use the fpu again, it'll trap and
316 * reload its fp regs. So we don't have to do a restore
317 * every switch, just a save.
318 * -- Cort
319 */
320 if (prev->thread.regs && (prev->thread.regs->msr & MSR_FP))
321 giveup_fpu(prev);
322#ifdef CONFIG_ALTIVEC
323 /*
324 * If the previous thread used altivec in the last quantum
325 * (thus changing altivec regs) then save them.
326 * We used to check the VRSAVE register but not all apps
327 * set it, so we don't rely on it now (and in fact we need
328 * to save & restore VSCR even if VRSAVE == 0). -- paulus
329 *
330 * On SMP we always save/restore altivec regs just to avoid the
331 * complexity of changing processors.
332 * -- Cort
333 */
334 if ((prev->thread.regs && (prev->thread.regs->msr & MSR_VEC)))
335 giveup_altivec(prev);
336#endif /* CONFIG_ALTIVEC */
337#ifdef CONFIG_SPE
338 /*
339 * If the previous thread used spe in the last quantum
340 * (thus changing spe regs) then save them.
341 *
342 * On SMP we always save/restore spe regs just to avoid the
343 * complexity of changing processors.
344 */
345 if ((prev->thread.regs && (prev->thread.regs->msr & MSR_SPE)))
346 giveup_spe(prev);
347#endif /* CONFIG_SPE */
348#endif /* CONFIG_SMP */
349
350#ifdef CONFIG_ALTIVEC
351 /* Avoid the trap. On smp this this never happens since
352 * we don't set last_task_used_altivec -- Cort
353 */
354 if (new->thread.regs && last_task_used_altivec == new)
355 new->thread.regs->msr |= MSR_VEC;
356#endif
357#ifdef CONFIG_SPE
358 /* Avoid the trap. On smp this this never happens since
359 * we don't set last_task_used_spe
360 */
361 if (new->thread.regs && last_task_used_spe == new)
362 new->thread.regs->msr |= MSR_SPE;
363#endif /* CONFIG_SPE */
364 new_thread = &new->thread;
365 old_thread = &current->thread;
366 last = _switch(old_thread, new_thread);
367 local_irq_restore(s);
368 return last;
369}
370
371void show_regs(struct pt_regs * regs)
372{
373 int i, trap;
374
375 printk("NIP: %08lX LR: %08lX SP: %08lX REGS: %p TRAP: %04lx %s\n",
376 regs->nip, regs->link, regs->gpr[1], regs, regs->trap,
377 print_tainted());
378 printk("MSR: %08lx EE: %01x PR: %01x FP: %01x ME: %01x IR/DR: %01x%01x\n",
379 regs->msr, regs->msr&MSR_EE ? 1 : 0, regs->msr&MSR_PR ? 1 : 0,
380 regs->msr & MSR_FP ? 1 : 0,regs->msr&MSR_ME ? 1 : 0,
381 regs->msr&MSR_IR ? 1 : 0,
382 regs->msr&MSR_DR ? 1 : 0);
383 trap = TRAP(regs);
384 if (trap == 0x300 || trap == 0x600)
385 printk("DAR: %08lX, DSISR: %08lX\n", regs->dar, regs->dsisr);
386 printk("TASK = %p[%d] '%s' THREAD: %p\n",
387 current, current->pid, current->comm, current->thread_info);
388 printk("Last syscall: %ld ", current->thread.last_syscall);
389
390#ifdef CONFIG_SMP
391 printk(" CPU: %d", smp_processor_id());
392#endif /* CONFIG_SMP */
393
394 for (i = 0; i < 32; i++) {
395 long r;
396 if ((i % 8) == 0)
397 printk("\n" KERN_INFO "GPR%02d: ", i);
398 if (__get_user(r, &regs->gpr[i]))
399 break;
400 printk("%08lX ", r);
401 if (i == 12 && !FULL_REGS(regs))
402 break;
403 }
404 printk("\n");
405#ifdef CONFIG_KALLSYMS
406 /*
407 * Lookup NIP late so we have the best change of getting the
408 * above info out without failing
409 */
410 printk("NIP [%08lx] ", regs->nip);
411 print_symbol("%s\n", regs->nip);
412 printk("LR [%08lx] ", regs->link);
413 print_symbol("%s\n", regs->link);
414#endif
415 show_stack(current, (unsigned long *) regs->gpr[1]);
416}
417
418void exit_thread(void)
419{
420 preempt_disable();
421 if (last_task_used_math == current)
422 last_task_used_math = NULL;
423 if (last_task_used_altivec == current)
424 last_task_used_altivec = NULL;
425#ifdef CONFIG_SPE
426 if (last_task_used_spe == current)
427 last_task_used_spe = NULL;
428#endif
429 preempt_enable();
430}
431
432void flush_thread(void)
433{
434 preempt_disable();
435 if (last_task_used_math == current)
436 last_task_used_math = NULL;
437 if (last_task_used_altivec == current)
438 last_task_used_altivec = NULL;
439#ifdef CONFIG_SPE
440 if (last_task_used_spe == current)
441 last_task_used_spe = NULL;
442#endif
443 preempt_enable();
444}
445
446void
447release_thread(struct task_struct *t)
448{
449}
450
451/*
452 * This gets called before we allocate a new thread and copy
453 * the current task into it.
454 */
455void prepare_to_copy(struct task_struct *tsk)
456{
457 struct pt_regs *regs = tsk->thread.regs;
458
459 if (regs == NULL)
460 return;
461 preempt_disable();
462 if (regs->msr & MSR_FP)
463 giveup_fpu(current);
464#ifdef CONFIG_ALTIVEC
465 if (regs->msr & MSR_VEC)
466 giveup_altivec(current);
467#endif /* CONFIG_ALTIVEC */
468#ifdef CONFIG_SPE
469 if (regs->msr & MSR_SPE)
470 giveup_spe(current);
471#endif /* CONFIG_SPE */
472 preempt_enable();
473}
474
475/*
476 * Copy a thread..
477 */
478int
479copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
480 unsigned long unused,
481 struct task_struct *p, struct pt_regs *regs)
482{
483 struct pt_regs *childregs, *kregs;
484 extern void ret_from_fork(void);
485 unsigned long sp = (unsigned long)p->thread_info + THREAD_SIZE;
486 unsigned long childframe;
487
488 CHECK_FULL_REGS(regs);
489 /* Copy registers */
490 sp -= sizeof(struct pt_regs);
491 childregs = (struct pt_regs *) sp;
492 *childregs = *regs;
493 if ((childregs->msr & MSR_PR) == 0) {
494 /* for kernel thread, set `current' and stackptr in new task */
495 childregs->gpr[1] = sp + sizeof(struct pt_regs);
496 childregs->gpr[2] = (unsigned long) p;
497 p->thread.regs = NULL; /* no user register state */
498 } else {
499 childregs->gpr[1] = usp;
500 p->thread.regs = childregs;
501 if (clone_flags & CLONE_SETTLS)
502 childregs->gpr[2] = childregs->gpr[6];
503 }
504 childregs->gpr[3] = 0; /* Result from fork() */
505 sp -= STACK_FRAME_OVERHEAD;
506 childframe = sp;
507
508 /*
509 * The way this works is that at some point in the future
510 * some task will call _switch to switch to the new task.
511 * That will pop off the stack frame created below and start
512 * the new task running at ret_from_fork. The new task will
513 * do some house keeping and then return from the fork or clone
514 * system call, using the stack frame created above.
515 */
516 sp -= sizeof(struct pt_regs);
517 kregs = (struct pt_regs *) sp;
518 sp -= STACK_FRAME_OVERHEAD;
519 p->thread.ksp = sp;
520 kregs->nip = (unsigned long)ret_from_fork;
521
522 p->thread.last_syscall = -1;
523
524 return 0;
525}
526
527/*
528 * Set up a thread for executing a new program
529 */
530void start_thread(struct pt_regs *regs, unsigned long nip, unsigned long sp)
531{
532 set_fs(USER_DS);
533 memset(regs->gpr, 0, sizeof(regs->gpr));
534 regs->ctr = 0;
535 regs->link = 0;
536 regs->xer = 0;
537 regs->ccr = 0;
538 regs->mq = 0;
539 regs->nip = nip;
540 regs->gpr[1] = sp;
541 regs->msr = MSR_USER;
542 preempt_disable();
543 if (last_task_used_math == current)
544 last_task_used_math = NULL;
545 if (last_task_used_altivec == current)
546 last_task_used_altivec = NULL;
547#ifdef CONFIG_SPE
548 if (last_task_used_spe == current)
549 last_task_used_spe = NULL;
550#endif
551 preempt_enable();
552 memset(current->thread.fpr, 0, sizeof(current->thread.fpr));
553 current->thread.fpscr.val = 0;
554#ifdef CONFIG_ALTIVEC
555 memset(current->thread.vr, 0, sizeof(current->thread.vr));
556 memset(&current->thread.vscr, 0, sizeof(current->thread.vscr));
557 current->thread.vrsave = 0;
558 current->thread.used_vr = 0;
559#endif /* CONFIG_ALTIVEC */
560#ifdef CONFIG_SPE
561 memset(current->thread.evr, 0, sizeof(current->thread.evr));
562 current->thread.acc = 0;
563 current->thread.spefscr = 0;
564 current->thread.used_spe = 0;
565#endif /* CONFIG_SPE */
566}
567
568#define PR_FP_ALL_EXCEPT (PR_FP_EXC_DIV | PR_FP_EXC_OVF | PR_FP_EXC_UND \
569 | PR_FP_EXC_RES | PR_FP_EXC_INV)
570
571int set_fpexc_mode(struct task_struct *tsk, unsigned int val)
572{
573 struct pt_regs *regs = tsk->thread.regs;
574
575 /* This is a bit hairy. If we are an SPE enabled processor
576 * (have embedded fp) we store the IEEE exception enable flags in
577 * fpexc_mode. fpexc_mode is also used for setting FP exception
578 * mode (asyn, precise, disabled) for 'Classic' FP. */
579 if (val & PR_FP_EXC_SW_ENABLE) {
580#ifdef CONFIG_SPE
581 tsk->thread.fpexc_mode = val &
582 (PR_FP_EXC_SW_ENABLE | PR_FP_ALL_EXCEPT);
583#else
584 return -EINVAL;
585#endif
586 } else {
587 /* on a CONFIG_SPE this does not hurt us. The bits that
588 * __pack_fe01 use do not overlap with bits used for
589 * PR_FP_EXC_SW_ENABLE. Additionally, the MSR[FE0,FE1] bits
590 * on CONFIG_SPE implementations are reserved so writing to
591 * them does not change anything */
592 if (val > PR_FP_EXC_PRECISE)
593 return -EINVAL;
594 tsk->thread.fpexc_mode = __pack_fe01(val);
595 if (regs != NULL && (regs->msr & MSR_FP) != 0)
596 regs->msr = (regs->msr & ~(MSR_FE0|MSR_FE1))
597 | tsk->thread.fpexc_mode;
598 }
599 return 0;
600}
601
602int get_fpexc_mode(struct task_struct *tsk, unsigned long adr)
603{
604 unsigned int val;
605
606 if (tsk->thread.fpexc_mode & PR_FP_EXC_SW_ENABLE)
607#ifdef CONFIG_SPE
608 val = tsk->thread.fpexc_mode;
609#else
610 return -EINVAL;
611#endif
612 else
613 val = __unpack_fe01(tsk->thread.fpexc_mode);
614 return put_user(val, (unsigned int __user *) adr);
615}
616
617int sys_clone(unsigned long clone_flags, unsigned long usp,
618 int __user *parent_tidp, void __user *child_threadptr,
619 int __user *child_tidp, int p6,
620 struct pt_regs *regs)
621{
622 CHECK_FULL_REGS(regs);
623 if (usp == 0)
624 usp = regs->gpr[1]; /* stack pointer for child */
625 return do_fork(clone_flags, usp, regs, 0, parent_tidp, child_tidp);
626}
627
628int sys_fork(unsigned long p1, unsigned long p2, unsigned long p3,
629 unsigned long p4, unsigned long p5, unsigned long p6,
630 struct pt_regs *regs)
631{
632 CHECK_FULL_REGS(regs);
633 return do_fork(SIGCHLD, regs->gpr[1], regs, 0, NULL, NULL);
634}
635
636int sys_vfork(unsigned long p1, unsigned long p2, unsigned long p3,
637 unsigned long p4, unsigned long p5, unsigned long p6,
638 struct pt_regs *regs)
639{
640 CHECK_FULL_REGS(regs);
641 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->gpr[1],
642 regs, 0, NULL, NULL);
643}
644
645int sys_execve(unsigned long a0, unsigned long a1, unsigned long a2,
646 unsigned long a3, unsigned long a4, unsigned long a5,
647 struct pt_regs *regs)
648{
649 int error;
650 char * filename;
651
652 filename = getname((char __user *) a0);
653 error = PTR_ERR(filename);
654 if (IS_ERR(filename))
655 goto out;
656 preempt_disable();
657 if (regs->msr & MSR_FP)
658 giveup_fpu(current);
659#ifdef CONFIG_ALTIVEC
660 if (regs->msr & MSR_VEC)
661 giveup_altivec(current);
662#endif /* CONFIG_ALTIVEC */
663#ifdef CONFIG_SPE
664 if (regs->msr & MSR_SPE)
665 giveup_spe(current);
666#endif /* CONFIG_SPE */
667 preempt_enable();
668 error = do_execve(filename, (char __user *__user *) a1,
669 (char __user *__user *) a2, regs);
670 if (error == 0) {
671 task_lock(current);
672 current->ptrace &= ~PT_DTRACE;
673 task_unlock(current);
674 }
675 putname(filename);
676out:
677 return error;
678}
679
680void dump_stack(void)
681{
682 show_stack(current, NULL);
683}
684
685EXPORT_SYMBOL(dump_stack);
686
687void show_stack(struct task_struct *tsk, unsigned long *stack)
688{
689 unsigned long sp, stack_top, prev_sp, ret;
690 int count = 0;
691 unsigned long next_exc = 0;
692 struct pt_regs *regs;
693 extern char ret_from_except, ret_from_except_full, ret_from_syscall;
694
695 sp = (unsigned long) stack;
696 if (tsk == NULL)
697 tsk = current;
698 if (sp == 0) {
699 if (tsk == current)
700 asm("mr %0,1" : "=r" (sp));
701 else
702 sp = tsk->thread.ksp;
703 }
704
705 prev_sp = (unsigned long) (tsk->thread_info + 1);
706 stack_top = (unsigned long) tsk->thread_info + THREAD_SIZE;
707 while (count < 16 && sp > prev_sp && sp < stack_top && (sp & 3) == 0) {
708 if (count == 0) {
709 printk("Call trace:");
710#ifdef CONFIG_KALLSYMS
711 printk("\n");
712#endif
713 } else {
714 if (next_exc) {
715 ret = next_exc;
716 next_exc = 0;
717 } else
718 ret = *(unsigned long *)(sp + 4);
719 printk(" [%08lx] ", ret);
720#ifdef CONFIG_KALLSYMS
721 print_symbol("%s", ret);
722 printk("\n");
723#endif
724 if (ret == (unsigned long) &ret_from_except
725 || ret == (unsigned long) &ret_from_except_full
726 || ret == (unsigned long) &ret_from_syscall) {
727 /* sp + 16 points to an exception frame */
728 regs = (struct pt_regs *) (sp + 16);
729 if (sp + 16 + sizeof(*regs) <= stack_top)
730 next_exc = regs->nip;
731 }
732 }
733 ++count;
734 sp = *(unsigned long *)sp;
735 }
736#ifndef CONFIG_KALLSYMS
737 if (count > 0)
738 printk("\n");
739#endif
740}
741
742#if 0
743/*
744 * Low level print for debugging - Cort
745 */
746int __init ll_printk(const char *fmt, ...)
747{
748 va_list args;
749 char buf[256];
750 int i;
751
752 va_start(args, fmt);
753 i=vsprintf(buf,fmt,args);
754 ll_puts(buf);
755 va_end(args);
756 return i;
757}
758
759int lines = 24, cols = 80;
760int orig_x = 0, orig_y = 0;
761
762void puthex(unsigned long val)
763{
764 unsigned char buf[10];
765 int i;
766 for (i = 7; i >= 0; i--)
767 {
768 buf[i] = "0123456789ABCDEF"[val & 0x0F];
769 val >>= 4;
770 }
771 buf[8] = '\0';
772 prom_print(buf);
773}
774
775void __init ll_puts(const char *s)
776{
777 int x,y;
778 char *vidmem = (char *)/*(_ISA_MEM_BASE + 0xB8000) */0xD00B8000;
779 char c;
780 extern int mem_init_done;
781
782 if ( mem_init_done ) /* assume this means we can printk */
783 {
784 printk(s);
785 return;
786 }
787
788#if 0
789 if ( have_of )
790 {
791 prom_print(s);
792 return;
793 }
794#endif
795
796 /*
797 * can't ll_puts on chrp without openfirmware yet.
798 * vidmem just needs to be setup for it.
799 * -- Cort
800 */
801 if ( _machine != _MACH_prep )
802 return;
803 x = orig_x;
804 y = orig_y;
805
806 while ( ( c = *s++ ) != '\0' ) {
807 if ( c == '\n' ) {
808 x = 0;
809 if ( ++y >= lines ) {
810 /*scroll();*/
811 /*y--;*/
812 y = 0;
813 }
814 } else {
815 vidmem [ ( x + cols * y ) * 2 ] = c;
816 if ( ++x >= cols ) {
817 x = 0;
818 if ( ++y >= lines ) {
819 /*scroll();*/
820 /*y--;*/
821 y = 0;
822 }
823 }
824 }
825 }
826
827 orig_x = x;
828 orig_y = y;
829}
830#endif
831
832unsigned long get_wchan(struct task_struct *p)
833{
834 unsigned long ip, sp;
835 unsigned long stack_page = (unsigned long) p->thread_info;
836 int count = 0;
837 if (!p || p == current || p->state == TASK_RUNNING)
838 return 0;
839 sp = p->thread.ksp;
840 do {
841 sp = *(unsigned long *)sp;
842 if (sp < stack_page || sp >= stack_page + 8188)
843 return 0;
844 if (count > 0) {
845 ip = *(unsigned long *)(sp + 4);
846 if (!in_sched_functions(ip))
847 return ip;
848 }
849 } while (count++ < 16);
850 return 0;
851}
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
index 0eb0b7085e6a..c08ab432e958 100644
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Common prep/pmac/chrp boot and setup code. 2 * Common prep/chrp boot and setup code.
3 */ 3 */
4 4
5#include <linux/config.h> 5#include <linux/config.h>
@@ -35,7 +35,6 @@
35#include <asm/machdep.h> 35#include <asm/machdep.h>
36#include <asm/uaccess.h> 36#include <asm/uaccess.h>
37#include <asm/system.h> 37#include <asm/system.h>
38#include <asm/pmac_feature.h>
39#include <asm/sections.h> 38#include <asm/sections.h>
40#include <asm/nvram.h> 39#include <asm/nvram.h>
41#include <asm/xmon.h> 40#include <asm/xmon.h>
@@ -55,7 +54,6 @@
55 54
56extern void platform_init(unsigned long r3, unsigned long r4, 55extern void platform_init(unsigned long r3, unsigned long r4,
57 unsigned long r5, unsigned long r6, unsigned long r7); 56 unsigned long r5, unsigned long r6, unsigned long r7);
58extern void bootx_init(unsigned long r4, unsigned long phys);
59extern void identify_cpu(unsigned long offset, unsigned long cpu); 57extern void identify_cpu(unsigned long offset, unsigned long cpu);
60extern void do_cpu_ftr_fixups(unsigned long offset); 58extern void do_cpu_ftr_fixups(unsigned long offset);
61extern void reloc_got2(unsigned long offset); 59extern void reloc_got2(unsigned long offset);
@@ -80,8 +78,6 @@ EXPORT_SYMBOL(_machine);
80 78
81extern void prep_init(unsigned long r3, unsigned long r4, 79extern void prep_init(unsigned long r3, unsigned long r4,
82 unsigned long r5, unsigned long r6, unsigned long r7); 80 unsigned long r5, unsigned long r6, unsigned long r7);
83extern void pmac_init(unsigned long r3, unsigned long r4,
84 unsigned long r5, unsigned long r6, unsigned long r7);
85extern void chrp_init(unsigned long r3, unsigned long r4, 81extern void chrp_init(unsigned long r3, unsigned long r4,
86 unsigned long r5, unsigned long r6, unsigned long r7); 82 unsigned long r5, unsigned long r6, unsigned long r7);
87 83
@@ -324,20 +320,15 @@ early_init(int r3, int r4, int r5)
324 identify_cpu(offset, 0); 320 identify_cpu(offset, 0);
325 do_cpu_ftr_fixups(offset); 321 do_cpu_ftr_fixups(offset);
326 322
327#if defined(CONFIG_PPC_MULTIPLATFORM) 323#if defined(CONFIG_PPC_OF)
328 reloc_got2(offset); 324 reloc_got2(offset);
329 325
330 /* If we came here from BootX, clear the screen,
331 * set up some pointers and return. */
332 if ((r3 == 0x426f6f58) && (r5 == 0))
333 bootx_init(r4, phys);
334
335 /* 326 /*
336 * don't do anything on prep 327 * don't do anything on prep
337 * for now, don't use bootinfo because it breaks yaboot 0.5 328 * for now, don't use bootinfo because it breaks yaboot 0.5
338 * and assume that if we didn't find a magic number, we have OF 329 * and assume that if we didn't find a magic number, we have OF
339 */ 330 */
340 else if (*(unsigned long *)(0) != 0xdeadc0de) 331 if (*(unsigned long *)(0) != 0xdeadc0de)
341 phys = prom_init(r3, r4, (prom_entry)r5); 332 phys = prom_init(r3, r4, (prom_entry)r5);
342 333
343 reloc_got2(-offset); 334 reloc_got2(-offset);
@@ -424,6 +415,7 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
424 } 415 }
425#endif 416#endif
426 417
418#ifdef CONFIG_PPC_OF
427 have_of = 1; 419 have_of = 1;
428 420
429 /* prom_init has already been called from __start */ 421 /* prom_init has already been called from __start */
@@ -495,19 +487,17 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
495#endif /* CONFIG_ADB */ 487#endif /* CONFIG_ADB */
496 488
497 switch (_machine) { 489 switch (_machine) {
498#ifdef CONFIG_PPC_PMAC
499 case _MACH_Pmac:
500 pmac_init(r3, r4, r5, r6, r7);
501 break;
502#endif
503#ifdef CONFIG_PPC_CHRP 490#ifdef CONFIG_PPC_CHRP
504 case _MACH_chrp: 491 case _MACH_chrp:
505 chrp_init(r3, r4, r5, r6, r7); 492 chrp_init(r3, r4, r5, r6, r7);
506 break; 493 break;
507#endif 494#endif
508 } 495 }
496#endif /* CONFIG_PPC_OF */
509} 497}
498#endif /* CONFIG_PPC_MULTIPLATFORM */
510 499
500#ifdef CONFIG_PPC_OF
511#ifdef CONFIG_SERIAL_CORE_CONSOLE 501#ifdef CONFIG_SERIAL_CORE_CONSOLE
512extern char *of_stdout_device; 502extern char *of_stdout_device;
513 503
@@ -564,7 +554,7 @@ static int __init set_preferred_console(void)
564} 554}
565console_initcall(set_preferred_console); 555console_initcall(set_preferred_console);
566#endif /* CONFIG_SERIAL_CORE_CONSOLE */ 556#endif /* CONFIG_SERIAL_CORE_CONSOLE */
567#endif /* CONFIG_PPC_MULTIPLATFORM */ 557#endif /* CONFIG_PPC_OF */
568 558
569struct bi_record *find_bootinfo(void) 559struct bi_record *find_bootinfo(void)
570{ 560{
@@ -744,13 +734,8 @@ void __init setup_arch(char **cmdline_p)
744 /* so udelay does something sensible, assume <= 1000 bogomips */ 734 /* so udelay does something sensible, assume <= 1000 bogomips */
745 loops_per_jiffy = 500000000 / HZ; 735 loops_per_jiffy = 500000000 / HZ;
746 736
747#ifdef CONFIG_PPC_MULTIPLATFORM 737 if (ppc_md.init_early)
748 /* This could be called "early setup arch", it must be done 738 ppc_md.init_early();
749 * now because xmon need it
750 */
751 if (_machine == _MACH_Pmac)
752 pmac_feature_init(); /* New cool way */
753#endif
754 739
755#ifdef CONFIG_XMON 740#ifdef CONFIG_XMON
756 xmon_init(1); 741 xmon_init(1);
diff --git a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c
index 43b8fc2ca591..e55cdda6149a 100644
--- a/arch/ppc/kernel/smp.c
+++ b/arch/ppc/kernel/smp.c
@@ -301,6 +301,10 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
301 301
302 /* Probe platform for CPUs: always linear. */ 302 /* Probe platform for CPUs: always linear. */
303 num_cpus = smp_ops->probe(); 303 num_cpus = smp_ops->probe();
304
305 if (num_cpus < 2)
306 smp_tb_synchronized = 1;
307
304 for (i = 0; i < num_cpus; ++i) 308 for (i = 0; i < num_cpus; ++i)
305 cpu_set(i, cpu_possible_map); 309 cpu_set(i, cpu_possible_map);
306 310
@@ -314,7 +318,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
314 p = fork_idle(cpu); 318 p = fork_idle(cpu);
315 if (IS_ERR(p)) 319 if (IS_ERR(p))
316 panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p)); 320 panic("failed fork for CPU %u: %li", cpu, PTR_ERR(p));
317 p->thread_info->cpu = cpu; 321 task_thread_info(p)->cpu = cpu;
318 idle_tasks[cpu] = p; 322 idle_tasks[cpu] = p;
319 } 323 }
320} 324}
@@ -365,7 +369,7 @@ int __cpu_up(unsigned int cpu)
365 char buf[32]; 369 char buf[32];
366 int c; 370 int c;
367 371
368 secondary_ti = idle_tasks[cpu]->thread_info; 372 secondary_ti = task_thread_info(idle_tasks[cpu]);
369 mb(); 373 mb();
370 374
371 /* 375 /*
diff --git a/arch/ppc/kernel/traps.c b/arch/ppc/kernel/traps.c
index 9dbc4d28fa28..6d0a1838d94c 100644
--- a/arch/ppc/kernel/traps.c
+++ b/arch/ppc/kernel/traps.c
@@ -38,9 +38,6 @@
38#include <asm/io.h> 38#include <asm/io.h>
39#include <asm/reg.h> 39#include <asm/reg.h>
40#include <asm/xmon.h> 40#include <asm/xmon.h>
41#ifdef CONFIG_PMAC_BACKLIGHT
42#include <asm/backlight.h>
43#endif
44#include <asm/pmc.h> 41#include <asm/pmc.h>
45 42
46#ifdef CONFIG_XMON 43#ifdef CONFIG_XMON
@@ -85,12 +82,6 @@ int die(const char * str, struct pt_regs * fp, long err)
85 int nl = 0; 82 int nl = 0;
86 console_verbose(); 83 console_verbose();
87 spin_lock_irq(&die_lock); 84 spin_lock_irq(&die_lock);
88#ifdef CONFIG_PMAC_BACKLIGHT
89 if (_machine == _MACH_Pmac) {
90 set_backlight_enable(1);
91 set_backlight_level(BACKLIGHT_MAX);
92 }
93#endif
94 printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); 85 printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
95#ifdef CONFIG_PREEMPT 86#ifdef CONFIG_PREEMPT
96 printk("PREEMPT "); 87 printk("PREEMPT ");
@@ -159,7 +150,7 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
159 */ 150 */
160static inline int check_io_access(struct pt_regs *regs) 151static inline int check_io_access(struct pt_regs *regs)
161{ 152{
162#if defined CONFIG_PPC_PMAC || defined CONFIG_8xx 153#if defined CONFIG_8xx
163 unsigned long msr = regs->msr; 154 unsigned long msr = regs->msr;
164 const struct exception_table_entry *entry; 155 const struct exception_table_entry *entry;
165 unsigned int *nip = (unsigned int *)regs->nip; 156 unsigned int *nip = (unsigned int *)regs->nip;
@@ -196,7 +187,7 @@ static inline int check_io_access(struct pt_regs *regs)
196 return 1; 187 return 1;
197 } 188 }
198 } 189 }
199#endif /* CONFIG_PPC_PMAC */ 190#endif /* CONFIG_8xx */
200 return 0; 191 return 0;
201} 192}
202 193
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
index 45f0782059f1..134db5c04203 100644
--- a/arch/ppc/mm/init.c
+++ b/arch/ppc/mm/init.c
@@ -67,10 +67,6 @@ unsigned long ppc_memoffset = PAGE_OFFSET;
67int mem_init_done; 67int mem_init_done;
68int init_bootmem_done; 68int init_bootmem_done;
69int boot_mapsize; 69int boot_mapsize;
70#ifdef CONFIG_PPC_PMAC
71unsigned long agp_special_page;
72EXPORT_SYMBOL(agp_special_page);
73#endif
74 70
75extern char _end[]; 71extern char _end[];
76extern char etext[], _stext[]; 72extern char etext[], _stext[];
@@ -424,10 +420,6 @@ void __init mem_init(void)
424 addr += PAGE_SIZE) 420 addr += PAGE_SIZE)
425 SetPageReserved(virt_to_page(addr)); 421 SetPageReserved(virt_to_page(addr));
426#endif 422#endif
427#ifdef CONFIG_PPC_PMAC
428 if (agp_special_page)
429 SetPageReserved(virt_to_page(agp_special_page));
430#endif
431 for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory; 423 for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory;
432 addr += PAGE_SIZE) { 424 addr += PAGE_SIZE) {
433 if (!PageReserved(virt_to_page(addr))) 425 if (!PageReserved(virt_to_page(addr)))
@@ -463,11 +455,6 @@ void __init mem_init(void)
463 initpages<< (PAGE_SHIFT-10), 455 initpages<< (PAGE_SHIFT-10),
464 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10))); 456 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)));
465 457
466#ifdef CONFIG_PPC_PMAC
467 if (agp_special_page)
468 printk(KERN_INFO "AGP special page: 0x%08lx\n", agp_special_page);
469#endif
470
471 mem_init_done = 1; 458 mem_init_done = 1;
472} 459}
473 460
@@ -512,22 +499,6 @@ set_phys_avail(unsigned long total_memory)
512 if (rtas_data) 499 if (rtas_data)
513 mem_pieces_remove(&phys_avail, rtas_data, rtas_size, 1); 500 mem_pieces_remove(&phys_avail, rtas_data, rtas_size, 1);
514#endif 501#endif
515#ifdef CONFIG_PPC_PMAC
516 /* Because of some uninorth weirdness, we need a page of
517 * memory as high as possible (it must be outside of the
518 * bus address seen as the AGP aperture). It will be used
519 * by the r128 DRM driver
520 *
521 * FIXME: We need to make sure that page doesn't overlap any of the\
522 * above. This could be done by improving mem_pieces_find to be able
523 * to do a backward search from the end of the list.
524 */
525 if (_machine == _MACH_Pmac && find_devices("uni-north-agp")) {
526 agp_special_page = (total_memory - PAGE_SIZE);
527 mem_pieces_remove(&phys_avail, agp_special_page, PAGE_SIZE, 0);
528 agp_special_page = (unsigned long)__va(agp_special_page);
529 }
530#endif /* CONFIG_PPC_PMAC */
531} 502}
532 503
533/* Mark some memory as reserved by removing it from phys_avail. */ 504/* Mark some memory as reserved by removing it from phys_avail. */
diff --git a/arch/ppc/platforms/4xx/ibm440gx.c b/arch/ppc/platforms/4xx/ibm440gx.c
index 956f45e4ef97..d24c09ee7b18 100644
--- a/arch/ppc/platforms/4xx/ibm440gx.c
+++ b/arch/ppc/platforms/4xx/ibm440gx.c
@@ -58,7 +58,6 @@ static struct ocp_func_emac_data ibm440gx_emac2_def = {
58 .wol_irq = 65, /* WOL interrupt number */ 58 .wol_irq = 65, /* WOL interrupt number */
59 .mdio_idx = -1, /* No shared MDIO */ 59 .mdio_idx = -1, /* No shared MDIO */
60 .tah_idx = 0, /* TAH device index */ 60 .tah_idx = 0, /* TAH device index */
61 .jumbo = 1, /* Jumbo frames supported */
62}; 61};
63 62
64static struct ocp_func_emac_data ibm440gx_emac3_def = { 63static struct ocp_func_emac_data ibm440gx_emac3_def = {
@@ -72,7 +71,6 @@ static struct ocp_func_emac_data ibm440gx_emac3_def = {
72 .wol_irq = 67, /* WOL interrupt number */ 71 .wol_irq = 67, /* WOL interrupt number */
73 .mdio_idx = -1, /* No shared MDIO */ 72 .mdio_idx = -1, /* No shared MDIO */
74 .tah_idx = 1, /* TAH device index */ 73 .tah_idx = 1, /* TAH device index */
75 .jumbo = 1, /* Jumbo frames supported */
76}; 74};
77OCP_SYSFS_EMAC_DATA() 75OCP_SYSFS_EMAC_DATA()
78 76
diff --git a/arch/ppc/platforms/4xx/ibm440sp.c b/arch/ppc/platforms/4xx/ibm440sp.c
index feb17e41ef69..71a0117d3597 100644
--- a/arch/ppc/platforms/4xx/ibm440sp.c
+++ b/arch/ppc/platforms/4xx/ibm440sp.c
@@ -31,7 +31,6 @@ static struct ocp_func_emac_data ibm440sp_emac0_def = {
31 .wol_irq = 61, /* WOL interrupt number */ 31 .wol_irq = 61, /* WOL interrupt number */
32 .mdio_idx = -1, /* No shared MDIO */ 32 .mdio_idx = -1, /* No shared MDIO */
33 .tah_idx = -1, /* No TAH */ 33 .tah_idx = -1, /* No TAH */
34 .jumbo = 1, /* Jumbo frames supported */
35}; 34};
36OCP_SYSFS_EMAC_DATA() 35OCP_SYSFS_EMAC_DATA()
37 36
diff --git a/arch/ppc/platforms/83xx/mpc834x_sys.c b/arch/ppc/platforms/83xx/mpc834x_sys.c
index 04bdc39bf47b..012e1e652c03 100644
--- a/arch/ppc/platforms/83xx/mpc834x_sys.c
+++ b/arch/ppc/platforms/83xx/mpc834x_sys.c
@@ -51,9 +51,6 @@
51 51
52#include <syslib/ppc83xx_setup.h> 52#include <syslib/ppc83xx_setup.h>
53 53
54static const char *GFAR_PHY_0 = "phy0:0";
55static const char *GFAR_PHY_1 = "phy0:1";
56
57#ifndef CONFIG_PCI 54#ifndef CONFIG_PCI
58unsigned long isa_io_base = 0; 55unsigned long isa_io_base = 0;
59unsigned long isa_mem_base = 0; 56unsigned long isa_mem_base = 0;
@@ -129,20 +126,21 @@ mpc834x_sys_setup_arch(void)
129 mdata->irq[1] = MPC83xx_IRQ_EXT2; 126 mdata->irq[1] = MPC83xx_IRQ_EXT2;
130 mdata->irq[2] = -1; 127 mdata->irq[2] = -1;
131 mdata->irq[31] = -1; 128 mdata->irq[31] = -1;
132 mdata->paddr += binfo->bi_immr_base;
133 129
134 /* setup the board related information for the enet controllers */ 130 /* setup the board related information for the enet controllers */
135 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC1); 131 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC1);
136 if (pdata) { 132 if (pdata) {
137 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 133 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
138 pdata->bus_id = GFAR_PHY_0; 134 pdata->bus_id = 0;
135 pdata->phy_id = 0;
139 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 136 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
140 } 137 }
141 138
142 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC2); 139 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC83xx_TSEC2);
143 if (pdata) { 140 if (pdata) {
144 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 141 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
145 pdata->bus_id = GFAR_PHY_1; 142 pdata->bus_id = 0;
143 pdata->phy_id = 1;
146 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 144 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
147 } 145 }
148 146
diff --git a/arch/ppc/platforms/85xx/Kconfig b/arch/ppc/platforms/85xx/Kconfig
index c5bc2821d991..7ddd331a7145 100644
--- a/arch/ppc/platforms/85xx/Kconfig
+++ b/arch/ppc/platforms/85xx/Kconfig
@@ -39,7 +39,7 @@ config MPC8560_ADS
39config SBC8560 39config SBC8560
40 bool "WindRiver PowerQUICC III SBC8560" 40 bool "WindRiver PowerQUICC III SBC8560"
41 help 41 help
42 This option enables support for the WindRiver PowerQUICC III 42 This option enables support for the WindRiver PowerQUICC III
43 SBC8560 board. 43 SBC8560 board.
44 44
45config STX_GP3 45config STX_GP3
@@ -48,6 +48,26 @@ config STX_GP3
48 This option enables support for the Silicon Turnkey Express GP3 48 This option enables support for the Silicon Turnkey Express GP3
49 board. 49 board.
50 50
51config TQM8540
52 bool "TQ Components TQM8540"
53 help
54 This option enablese support for the TQ Components TQM8540 board.
55
56config TQM8541
57 bool "TQ Components TQM8541"
58 help
59 This option enablese support for the TQ Components TQM8541 board.
60
61config TQM8555
62 bool "TQ Components TQM8555"
63 help
64 This option enablese support for the TQ Components TQM8555 board.
65
66config TQM8560
67 bool "TQ Components TQM8560"
68 help
69 This option enablese support for the TQ Components TQM8560 board.
70
51endchoice 71endchoice
52 72
53# It's often necessary to know the specific 85xx processor type. 73# It's often necessary to know the specific 85xx processor type.
@@ -55,7 +75,7 @@ endchoice
55# don't need to ask more redundant questions. 75# don't need to ask more redundant questions.
56config MPC8540 76config MPC8540
57 bool 77 bool
58 depends on MPC8540_ADS 78 depends on MPC8540_ADS || TQM8540
59 default y 79 default y
60 80
61config MPC8548 81config MPC8548
@@ -65,12 +85,12 @@ config MPC8548
65 85
66config MPC8555 86config MPC8555
67 bool 87 bool
68 depends on MPC8555_CDS 88 depends on MPC8555_CDS || TQM8541 || TQM8555
69 default y 89 default y
70 90
71config MPC8560 91config MPC8560
72 bool 92 bool
73 depends on SBC8560 || MPC8560_ADS || STX_GP3 93 depends on SBC8560 || MPC8560_ADS || STX_GP3 || TQM8560
74 default y 94 default y
75 95
76config 85xx_PCI2 96config 85xx_PCI2
diff --git a/arch/ppc/platforms/85xx/Makefile b/arch/ppc/platforms/85xx/Makefile
index efdf813108f2..6c4753c144d3 100644
--- a/arch/ppc/platforms/85xx/Makefile
+++ b/arch/ppc/platforms/85xx/Makefile
@@ -7,3 +7,7 @@ obj-$(CONFIG_MPC8555_CDS) += mpc85xx_cds_common.o
7obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads_common.o mpc8560_ads.o 7obj-$(CONFIG_MPC8560_ADS) += mpc85xx_ads_common.o mpc8560_ads.o
8obj-$(CONFIG_SBC8560) += sbc85xx.o sbc8560.o 8obj-$(CONFIG_SBC8560) += sbc85xx.o sbc8560.o
9obj-$(CONFIG_STX_GP3) += stx_gp3.o 9obj-$(CONFIG_STX_GP3) += stx_gp3.o
10obj-$(CONFIG_TQM8540) += tqm85xx.o
11obj-$(CONFIG_TQM8541) += tqm85xx.o
12obj-$(CONFIG_TQM8555) += tqm85xx.o
13obj-$(CONFIG_TQM8560) += tqm85xx.o
diff --git a/arch/ppc/platforms/85xx/mpc8540_ads.c b/arch/ppc/platforms/85xx/mpc8540_ads.c
index c5cde97c6ef0..2eceb1e6f4eb 100644
--- a/arch/ppc/platforms/85xx/mpc8540_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8540_ads.c
@@ -52,10 +52,6 @@
52 52
53#include <syslib/ppc85xx_setup.h> 53#include <syslib/ppc85xx_setup.h>
54 54
55static const char *GFAR_PHY_0 = "phy0:0";
56static const char *GFAR_PHY_1 = "phy0:1";
57static const char *GFAR_PHY_3 = "phy0:3";
58
59/* ************************************************************************ 55/* ************************************************************************
60 * 56 *
61 * Setup the architecture 57 * Setup the architecture
@@ -102,27 +98,29 @@ mpc8540ads_setup_arch(void)
102 mdata->irq[2] = -1; 98 mdata->irq[2] = -1;
103 mdata->irq[3] = MPC85xx_IRQ_EXT5; 99 mdata->irq[3] = MPC85xx_IRQ_EXT5;
104 mdata->irq[31] = -1; 100 mdata->irq[31] = -1;
105 mdata->paddr += binfo->bi_immr_base;
106 101
107 /* setup the board related information for the enet controllers */ 102 /* setup the board related information for the enet controllers */
108 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 103 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
109 if (pdata) { 104 if (pdata) {
110 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 105 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
111 pdata->bus_id = GFAR_PHY_0; 106 pdata->bus_id = 0;
107 pdata->phy_id = 0;
112 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 108 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
113 } 109 }
114 110
115 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 111 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
116 if (pdata) { 112 if (pdata) {
117 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 113 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
118 pdata->bus_id = GFAR_PHY_1; 114 pdata->bus_id = 0;
115 pdata->phy_id = 1;
119 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 116 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
120 } 117 }
121 118
122 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC); 119 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC);
123 if (pdata) { 120 if (pdata) {
124 pdata->board_flags = 0; 121 pdata->board_flags = 0;
125 pdata->bus_id = GFAR_PHY_3; 122 pdata->bus_id = 0;
123 pdata->phy_id = 3;
126 memcpy(pdata->mac_addr, binfo->bi_enet2addr, 6); 124 memcpy(pdata->mac_addr, binfo->bi_enet2addr, 6);
127 } 125 }
128 126
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c
index 8e39a5517092..442c7ff195d3 100644
--- a/arch/ppc/platforms/85xx/mpc8560_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.c
@@ -56,10 +56,6 @@
56#include <syslib/ppc85xx_setup.h> 56#include <syslib/ppc85xx_setup.h>
57 57
58 58
59static const char *GFAR_PHY_0 = "phy0:0";
60static const char *GFAR_PHY_1 = "phy0:1";
61static const char *GFAR_PHY_3 = "phy0:3";
62
63/* ************************************************************************ 59/* ************************************************************************
64 * 60 *
65 * Setup the architecture 61 * Setup the architecture
@@ -99,20 +95,21 @@ mpc8560ads_setup_arch(void)
99 mdata->irq[2] = -1; 95 mdata->irq[2] = -1;
100 mdata->irq[3] = MPC85xx_IRQ_EXT5; 96 mdata->irq[3] = MPC85xx_IRQ_EXT5;
101 mdata->irq[31] = -1; 97 mdata->irq[31] = -1;
102 mdata->paddr += binfo->bi_immr_base;
103 98
104 /* setup the board related information for the enet controllers */ 99 /* setup the board related information for the enet controllers */
105 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 100 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
106 if (pdata) { 101 if (pdata) {
107 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 102 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
108 pdata->bus_id = GFAR_PHY_0; 103 pdata->bus_id = 0;
104 pdata->phy_id = 0;
109 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 105 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
110 } 106 }
111 107
112 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 108 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
113 if (pdata) { 109 if (pdata) {
114 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 110 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
115 pdata->bus_id = GFAR_PHY_1; 111 pdata->bus_id = 0;
112 pdata->phy_id = 1;
116 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 113 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
117 } 114 }
118 115
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index d8991b88dc9c..b332ebae6bd3 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -130,10 +130,11 @@ mpc85xx_cds_show_cpuinfo(struct seq_file *m)
130} 130}
131 131
132#ifdef CONFIG_CPM2 132#ifdef CONFIG_CPM2
133static void cpm2_cascade(int irq, void *dev_id, struct pt_regs *regs) 133static irqreturn_t cpm2_cascade(int irq, void *dev_id, struct pt_regs *regs)
134{ 134{
135 while((irq = cpm2_get_irq(regs)) >= 0) 135 while((irq = cpm2_get_irq(regs)) >= 0)
136 __do_IRQ(irq, regs); 136 __do_IRQ(irq, regs);
137 return IRQ_HANDLED;
137} 138}
138 139
139static struct irqaction cpm2_irqaction = { 140static struct irqaction cpm2_irqaction = {
@@ -350,10 +351,10 @@ mpc85xx_cds_fixup_via(struct pci_controller *hose)
350void __init 351void __init
351mpc85xx_cds_pcibios_fixup(void) 352mpc85xx_cds_pcibios_fixup(void)
352{ 353{
353 struct pci_dev *dev = NULL; 354 struct pci_dev *dev;
354 u_char c; 355 u_char c;
355 356
356 if ((dev = pci_find_device(PCI_VENDOR_ID_VIA, 357 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
357 PCI_DEVICE_ID_VIA_82C586_1, NULL))) { 358 PCI_DEVICE_ID_VIA_82C586_1, NULL))) {
358 /* 359 /*
359 * U-Boot does not set the enable bits 360 * U-Boot does not set the enable bits
@@ -370,30 +371,30 @@ mpc85xx_cds_pcibios_fixup(void)
370 */ 371 */
371 dev->irq = 14; 372 dev->irq = 14;
372 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq); 373 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
374 pci_dev_put(dev);
373 } 375 }
374 376
375 /* 377 /*
376 * Force legacy USB interrupt routing 378 * Force legacy USB interrupt routing
377 */ 379 */
378 if ((dev = pci_find_device(PCI_VENDOR_ID_VIA, 380 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
379 PCI_DEVICE_ID_VIA_82C586_2, NULL))) { 381 PCI_DEVICE_ID_VIA_82C586_2, NULL))) {
380 dev->irq = 10; 382 dev->irq = 10;
381 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 10); 383 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 10);
384 pci_dev_put(dev);
382 } 385 }
383 386
384 if ((dev = pci_find_device(PCI_VENDOR_ID_VIA, 387 if ((dev = pci_get_device(PCI_VENDOR_ID_VIA,
385 PCI_DEVICE_ID_VIA_82C586_2, dev))) { 388 PCI_DEVICE_ID_VIA_82C586_2, dev))) {
386 dev->irq = 11; 389 dev->irq = 11;
387 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 11); 390 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, 11);
391 pci_dev_put(dev);
388 } 392 }
389} 393}
390#endif /* CONFIG_PCI */ 394#endif /* CONFIG_PCI */
391 395
392TODC_ALLOC(); 396TODC_ALLOC();
393 397
394static const char *GFAR_PHY_0 = "phy0:0";
395static const char *GFAR_PHY_1 = "phy0:1";
396
397/* ************************************************************************ 398/* ************************************************************************
398 * 399 *
399 * Setup the architecture 400 * Setup the architecture
@@ -457,34 +458,37 @@ mpc85xx_cds_setup_arch(void)
457 mdata->irq[2] = -1; 458 mdata->irq[2] = -1;
458 mdata->irq[3] = -1; 459 mdata->irq[3] = -1;
459 mdata->irq[31] = -1; 460 mdata->irq[31] = -1;
460 mdata->paddr += binfo->bi_immr_base;
461 461
462 /* setup the board related information for the enet controllers */ 462 /* setup the board related information for the enet controllers */
463 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 463 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
464 if (pdata) { 464 if (pdata) {
465 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 465 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
466 pdata->bus_id = GFAR_PHY_0; 466 pdata->bus_id = 0;
467 pdata->phy_id = 0;
467 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 468 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
468 } 469 }
469 470
470 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 471 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
471 if (pdata) { 472 if (pdata) {
472 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 473 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
473 pdata->bus_id = GFAR_PHY_1; 474 pdata->bus_id = 0;
475 pdata->phy_id = 1;
474 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 476 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
475 } 477 }
476 478
477 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC1); 479 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC1);
478 if (pdata) { 480 if (pdata) {
479 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 481 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
480 pdata->bus_id = GFAR_PHY_0; 482 pdata->bus_id = 0;
483 pdata->phy_id = 0;
481 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 484 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
482 } 485 }
483 486
484 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC2); 487 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_eTSEC2);
485 if (pdata) { 488 if (pdata) {
486 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 489 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
487 pdata->bus_id = GFAR_PHY_1; 490 pdata->bus_id = 0;
491 pdata->phy_id = 1;
488 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 492 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
489 } 493 }
490 494
diff --git a/arch/ppc/platforms/85xx/sbc8560.c b/arch/ppc/platforms/85xx/sbc8560.c
index 45a5b81b4ed1..e777ba824aa9 100644
--- a/arch/ppc/platforms/85xx/sbc8560.c
+++ b/arch/ppc/platforms/85xx/sbc8560.c
@@ -91,9 +91,6 @@ sbc8560_early_serial_map(void)
91} 91}
92#endif 92#endif
93 93
94static const char *GFAR_PHY_25 = "phy0:25";
95static const char *GFAR_PHY_26 = "phy0:26";
96
97/* ************************************************************************ 94/* ************************************************************************
98 * 95 *
99 * Setup the architecture 96 * Setup the architecture
@@ -136,20 +133,21 @@ sbc8560_setup_arch(void)
136 mdata->irq[25] = MPC85xx_IRQ_EXT6; 133 mdata->irq[25] = MPC85xx_IRQ_EXT6;
137 mdata->irq[26] = MPC85xx_IRQ_EXT7; 134 mdata->irq[26] = MPC85xx_IRQ_EXT7;
138 mdata->irq[31] = -1; 135 mdata->irq[31] = -1;
139 mdata->paddr += binfo->bi_immr_base;
140 136
141 /* setup the board related information for the enet controllers */ 137 /* setup the board related information for the enet controllers */
142 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 138 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
143 if (pdata) { 139 if (pdata) {
144 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 140 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
145 pdata->bus_id = GFAR_PHY_25; 141 pdata->bus_id = 0;
142 pdata->phy_id = 25;
146 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 143 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
147 } 144 }
148 145
149 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 146 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
150 if (pdata) { 147 if (pdata) {
151 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; 148 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
152 pdata->bus_id = GFAR_PHY_26; 149 pdata->bus_id = 0;
150 pdata->phy_id = 26;
153 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 151 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
154 } 152 }
155 153
diff --git a/arch/ppc/platforms/85xx/stx_gp3.c b/arch/ppc/platforms/85xx/stx_gp3.c
index 15ce9d070634..061bb7cf2d9a 100644
--- a/arch/ppc/platforms/85xx/stx_gp3.c
+++ b/arch/ppc/platforms/85xx/stx_gp3.c
@@ -93,9 +93,6 @@ static u8 gp3_openpic_initsenses[] __initdata = {
93 0x0, /* External 11: */ 93 0x0, /* External 11: */
94}; 94};
95 95
96static const char *GFAR_PHY_2 = "phy0:2";
97static const char *GFAR_PHY_4 = "phy0:4";
98
99/* 96/*
100 * Setup the architecture 97 * Setup the architecture
101 */ 98 */
@@ -130,20 +127,21 @@ gp3_setup_arch(void)
130 mdata->irq[2] = MPC85xx_IRQ_EXT5; 127 mdata->irq[2] = MPC85xx_IRQ_EXT5;
131 mdata->irq[4] = MPC85xx_IRQ_EXT5; 128 mdata->irq[4] = MPC85xx_IRQ_EXT5;
132 mdata->irq[31] = -1; 129 mdata->irq[31] = -1;
133 mdata->paddr += binfo->bi_immr_base;
134 130
135 /* setup the board related information for the enet controllers */ 131 /* setup the board related information for the enet controllers */
136 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1); 132 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
137 if (pdata) { 133 if (pdata) {
138 /* pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */ 134 /* pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */
139 pdata->bus_id = GFAR_PHY_2; 135 pdata->bus_id = 0;
136 pdata->phy_id = 2;
140 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6); 137 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
141 } 138 }
142 139
143 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2); 140 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
144 if (pdata) { 141 if (pdata) {
145 /* pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */ 142 /* pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR; */
146 pdata->bus_id = GFAR_PHY_4; 143 pdata->bus_id = 0;
144 pdata->phy_id = 4;
147 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6); 145 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
148 } 146 }
149 147
diff --git a/arch/ppc/platforms/85xx/tqm85xx.c b/arch/ppc/platforms/85xx/tqm85xx.c
new file mode 100644
index 000000000000..b436f4d0a3fa
--- /dev/null
+++ b/arch/ppc/platforms/85xx/tqm85xx.c
@@ -0,0 +1,415 @@
1/*
2 * arch/ppc/platforms/85xx/tqm85xx.c
3 *
4 * TQM85xx (40/41/55/60) board specific routines
5 *
6 * Copyright (c) 2005 DENX Software Engineering
7 * Stefan Roese <sr@denx.de>
8 *
9 * Based on original work by
10 * Kumar Gala <galak@kernel.crashing.org>
11 * Copyright 2004 Freescale Semiconductor Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 */
18
19#include <linux/config.h>
20#include <linux/stddef.h>
21#include <linux/kernel.h>
22#include <linux/init.h>
23#include <linux/errno.h>
24#include <linux/reboot.h>
25#include <linux/pci.h>
26#include <linux/kdev_t.h>
27#include <linux/major.h>
28#include <linux/console.h>
29#include <linux/delay.h>
30#include <linux/seq_file.h>
31#include <linux/root_dev.h>
32#include <linux/serial.h>
33#include <linux/tty.h> /* for linux/serial_core.h */
34#include <linux/serial_core.h>
35#include <linux/initrd.h>
36#include <linux/module.h>
37#include <linux/fsl_devices.h>
38
39#include <asm/system.h>
40#include <asm/pgtable.h>
41#include <asm/page.h>
42#include <asm/atomic.h>
43#include <asm/time.h>
44#include <asm/io.h>
45#include <asm/machdep.h>
46#include <asm/open_pic.h>
47#include <asm/bootinfo.h>
48#include <asm/pci-bridge.h>
49#include <asm/mpc85xx.h>
50#include <asm/irq.h>
51#include <asm/immap_85xx.h>
52#include <asm/kgdb.h>
53#include <asm/ppc_sys.h>
54#include <asm/cpm2.h>
55#include <mm/mmu_decl.h>
56
57#include <syslib/ppc85xx_setup.h>
58#include <syslib/cpm2_pic.h>
59#include <syslib/ppc85xx_common.h>
60#include <syslib/ppc85xx_rio.h>
61
62#ifndef CONFIG_PCI
63unsigned long isa_io_base = 0;
64unsigned long isa_mem_base = 0;
65#endif
66
67
68extern unsigned long total_memory; /* in mm/init */
69
70unsigned char __res[sizeof (bd_t)];
71
72/* Internal interrupts are all Level Sensitive, and Positive Polarity */
73static u_char tqm85xx_openpic_initsenses[] __initdata = {
74 MPC85XX_INTERNAL_IRQ_SENSES,
75 0x0, /* External 0: */
76 0x0, /* External 1: */
77#if defined(CONFIG_PCI)
78 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 2: PCI INTA */
79 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 3: PCI INTB */
80#else
81 0x0, /* External 2: */
82 0x0, /* External 3: */
83#endif
84 0x0, /* External 4: */
85 0x0, /* External 5: */
86 0x0, /* External 6: */
87 0x0, /* External 7: */
88 (IRQ_SENSE_LEVEL | IRQ_POLARITY_NEGATIVE), /* External 8: PHY */
89 0x0, /* External 9: */
90 0x0, /* External 10: */
91 0x0, /* External 11: */
92};
93
94/* ************************************************************************
95 *
96 * Setup the architecture
97 *
98 */
99static void __init
100tqm85xx_setup_arch(void)
101{
102 bd_t *binfo = (bd_t *) __res;
103 unsigned int freq;
104 struct gianfar_platform_data *pdata;
105 struct gianfar_mdio_data *mdata;
106
107#ifdef CONFIG_MPC8560
108 cpm2_reset();
109#endif
110
111 /* get the core frequency */
112 freq = binfo->bi_intfreq;
113
114 if (ppc_md.progress)
115 ppc_md.progress("tqm85xx_setup_arch()", 0);
116
117 /* Set loops_per_jiffy to a half-way reasonable value,
118 for use until calibrate_delay gets called. */
119 loops_per_jiffy = freq / HZ;
120
121#ifdef CONFIG_PCI
122 /* setup PCI host bridges */
123 mpc85xx_setup_hose();
124#endif
125
126#ifndef CONFIG_MPC8560
127#if defined(CONFIG_SERIAL_8250)
128 mpc85xx_early_serial_map();
129#endif
130
131#ifdef CONFIG_SERIAL_TEXT_DEBUG
132 /* Invalidate the entry we stole earlier the serial ports
133 * should be properly mapped */
134 invalidate_tlbcam_entry(num_tlbcam_entries - 1);
135#endif
136#endif /* CONFIG_MPC8560 */
137
138 /* setup the board related info for the MDIO bus */
139 mdata = (struct gianfar_mdio_data *) ppc_sys_get_pdata(MPC85xx_MDIO);
140
141 mdata->irq[0] = MPC85xx_IRQ_EXT8;
142 mdata->irq[1] = MPC85xx_IRQ_EXT8;
143 mdata->irq[2] = -1;
144 mdata->irq[3] = MPC85xx_IRQ_EXT8;
145 mdata->irq[31] = -1;
146
147 /* setup the board related information for the enet controllers */
148 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC1);
149 if (pdata) {
150 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
151 pdata->bus_id = 0;
152 pdata->phy_id = 2;
153 memcpy(pdata->mac_addr, binfo->bi_enetaddr, 6);
154 }
155
156 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_TSEC2);
157 if (pdata) {
158 pdata->board_flags = FSL_GIANFAR_BRD_HAS_PHY_INTR;
159 pdata->bus_id = 0;
160 pdata->phy_id = 1;
161 memcpy(pdata->mac_addr, binfo->bi_enet1addr, 6);
162 }
163
164#ifdef CONFIG_MPC8540
165 pdata = (struct gianfar_platform_data *) ppc_sys_get_pdata(MPC85xx_FEC);
166 if (pdata) {
167 pdata->board_flags = 0;
168 pdata->bus_id = 0;
169 pdata->phy_id = 3;
170 memcpy(pdata->mac_addr, binfo->bi_enet2addr, 6);
171 }
172#endif
173
174#ifdef CONFIG_BLK_DEV_INITRD
175 if (initrd_start)
176 ROOT_DEV = Root_RAM0;
177 else
178#endif
179#ifdef CONFIG_ROOT_NFS
180 ROOT_DEV = Root_NFS;
181#else
182 ROOT_DEV = Root_HDA1;
183#endif
184}
185
186#ifdef CONFIG_MPC8560
187static irqreturn_t cpm2_cascade(int irq, void *dev_id, struct pt_regs *regs)
188{
189 while ((irq = cpm2_get_irq(regs)) >= 0)
190 __do_IRQ(irq, regs);
191 return IRQ_HANDLED;
192}
193
194static struct irqaction cpm2_irqaction = {
195 .handler = cpm2_cascade,
196 .flags = SA_INTERRUPT,
197 .mask = CPU_MASK_NONE,
198 .name = "cpm2_cascade",
199};
200#endif /* CONFIG_MPC8560 */
201
202void __init
203tqm85xx_init_IRQ(void)
204{
205 bd_t *binfo = (bd_t *) __res;
206
207 /* Determine the Physical Address of the OpenPIC regs */
208 phys_addr_t OpenPIC_PAddr =
209 binfo->bi_immr_base + MPC85xx_OPENPIC_OFFSET;
210 OpenPIC_Addr = ioremap(OpenPIC_PAddr, MPC85xx_OPENPIC_SIZE);
211 OpenPIC_InitSenses = tqm85xx_openpic_initsenses;
212 OpenPIC_NumInitSenses = sizeof (tqm85xx_openpic_initsenses);
213
214 /* Skip reserved space and internal sources */
215 openpic_set_sources(0, 32, OpenPIC_Addr + 0x10200);
216
217 /* Map PIC IRQs 0-11 */
218 openpic_set_sources(48, 12, OpenPIC_Addr + 0x10000);
219
220 /* we let openpic interrupts starting from an offset, to
221 * leave space for cascading interrupts underneath.
222 */
223 openpic_init(MPC85xx_OPENPIC_IRQ_OFFSET);
224
225#ifdef CONFIG_MPC8560
226 /* Setup CPM2 PIC */
227 cpm2_init_IRQ();
228
229 setup_irq(MPC85xx_IRQ_CPM, &cpm2_irqaction);
230#endif /* CONFIG_MPC8560 */
231
232 return;
233}
234
235int tqm85xx_show_cpuinfo(struct seq_file *m)
236{
237 uint pvid, svid, phid1;
238 uint memsize = total_memory;
239 bd_t *binfo = (bd_t *) __res;
240 unsigned int freq;
241
242 /* get the core frequency */
243 freq = binfo->bi_intfreq;
244
245 pvid = mfspr(SPRN_PVR);
246 svid = mfspr(SPRN_SVR);
247
248 seq_printf(m, "Vendor\t\t: TQ Components\n");
249 seq_printf(m, "Machine\t\t: TQM%s\n", cur_ppc_sys_spec->ppc_sys_name);
250 seq_printf(m, "clock\t\t: %dMHz\n", freq / 1000000);
251 seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
252 seq_printf(m, "SVR\t\t: 0x%x\n", svid);
253
254 /* Display cpu Pll setting */
255 phid1 = mfspr(SPRN_HID1);
256 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
257
258 /* Display the amount of memory */
259 seq_printf(m, "Memory\t\t: %d MB\n", memsize / (1024 * 1024));
260
261 return 0;
262}
263
264#if defined(CONFIG_I2C) && defined(CONFIG_SENSORS_DS1337)
265extern ulong ds1337_get_rtc_time(void);
266extern int ds1337_set_rtc_time(unsigned long nowtime);
267
268static int __init
269tqm85xx_rtc_hookup(void)
270{
271 struct timespec tv;
272
273 ppc_md.set_rtc_time = ds1337_set_rtc_time;
274 ppc_md.get_rtc_time = ds1337_get_rtc_time;
275
276 tv.tv_nsec = 0;
277 tv.tv_sec = (ppc_md.get_rtc_time)();
278 do_settimeofday(&tv);
279
280 return 0;
281}
282late_initcall(tqm85xx_rtc_hookup);
283#endif
284
285#ifdef CONFIG_PCI
286/*
287 * interrupt routing
288 */
289int mpc85xx_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
290{
291 static char pci_irq_table[][4] =
292 /*
293 * PCI IDSEL/INTPIN->INTLINE
294 * A B C D
295 */
296 {
297 {PIRQA, PIRQB, 0, 0},
298 };
299
300 const long min_idsel = 0x1c, max_idsel = 0x1c, irqs_per_slot = 4;
301 return PCI_IRQ_TABLE_LOOKUP;
302}
303
304int mpc85xx_exclude_device(u_char bus, u_char devfn)
305{
306 if (bus == 0 && PCI_SLOT(devfn) == 0)
307 return PCIBIOS_DEVICE_NOT_FOUND;
308 else
309 return PCIBIOS_SUCCESSFUL;
310}
311
312#endif /* CONFIG_PCI */
313
314#ifdef CONFIG_RAPIDIO
315void platform_rio_init(void)
316{
317 /* 512MB RIO LAW at 0xc0000000 */
318 mpc85xx_rio_setup(0xc0000000, 0x20000000);
319}
320#endif /* CONFIG_RAPIDIO */
321
322/* ************************************************************************ */
323void __init
324platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
325 unsigned long r6, unsigned long r7)
326{
327 /* parse_bootinfo must always be called first */
328 parse_bootinfo(find_bootinfo());
329
330 /*
331 * If we were passed in a board information, copy it into the
332 * residual data area.
333 */
334 if (r3) {
335 memcpy((void *) __res, (void *) (r3 + KERNELBASE),
336 sizeof (bd_t));
337 }
338
339#if defined(CONFIG_SERIAL_TEXT_DEBUG) && !defined(CONFIG_MPC8560)
340 {
341 bd_t *binfo = (bd_t *) __res;
342 struct uart_port p;
343
344 /* Use the last TLB entry to map CCSRBAR to allow access to DUART regs */
345 settlbcam(num_tlbcam_entries - 1, binfo->bi_immr_base,
346 binfo->bi_immr_base, MPC85xx_CCSRBAR_SIZE, _PAGE_IO, 0);
347
348 memset(&p, 0, sizeof (p));
349 p.iotype = SERIAL_IO_MEM;
350 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART0_OFFSET;
351 p.uartclk = binfo->bi_busfreq;
352
353 gen550_init(0, &p);
354
355 memset(&p, 0, sizeof (p));
356 p.iotype = SERIAL_IO_MEM;
357 p.membase = (void *) binfo->bi_immr_base + MPC85xx_UART1_OFFSET;
358 p.uartclk = binfo->bi_busfreq;
359
360 gen550_init(1, &p);
361 }
362#endif
363
364#if defined(CONFIG_BLK_DEV_INITRD)
365 /*
366 * If the init RAM disk has been configured in, and there's a valid
367 * starting address for it, set it up.
368 */
369 if (r4) {
370 initrd_start = r4 + KERNELBASE;
371 initrd_end = r5 + KERNELBASE;
372 }
373#endif /* CONFIG_BLK_DEV_INITRD */
374
375 /* Copy the kernel command line arguments to a safe place. */
376
377 if (r6) {
378 *(char *) (r7 + KERNELBASE) = 0;
379 strcpy(cmd_line, (char *) (r6 + KERNELBASE));
380 }
381
382 identify_ppc_sys_by_id(mfspr(SPRN_SVR));
383
384 /* setup the PowerPC module struct */
385 ppc_md.setup_arch = tqm85xx_setup_arch;
386 ppc_md.show_cpuinfo = tqm85xx_show_cpuinfo;
387
388 ppc_md.init_IRQ = tqm85xx_init_IRQ;
389 ppc_md.get_irq = openpic_get_irq;
390
391 ppc_md.restart = mpc85xx_restart;
392 ppc_md.power_off = mpc85xx_power_off;
393 ppc_md.halt = mpc85xx_halt;
394
395 ppc_md.find_end_of_memory = mpc85xx_find_end_of_memory;
396
397 ppc_md.time_init = NULL;
398 ppc_md.set_rtc_time = NULL;
399 ppc_md.get_rtc_time = NULL;
400 ppc_md.calibrate_decr = mpc85xx_calibrate_decr;
401
402#ifndef CONFIG_MPC8560
403#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_SERIAL_TEXT_DEBUG)
404 ppc_md.progress = gen550_progress;
405#endif /* CONFIG_SERIAL_8250 && CONFIG_SERIAL_TEXT_DEBUG */
406#if defined(CONFIG_SERIAL_8250) && defined(CONFIG_KGDB)
407 ppc_md.early_serial_map = mpc85xx_early_serial_map;
408#endif /* CONFIG_SERIAL_8250 && CONFIG_KGDB */
409#endif /* CONFIG_MPC8560 */
410
411 if (ppc_md.progress)
412 ppc_md.progress("tqm85xx_init(): exit", 0);
413
414 return;
415}
diff --git a/arch/ppc/platforms/85xx/tqm85xx.h b/arch/ppc/platforms/85xx/tqm85xx.h
new file mode 100644
index 000000000000..3775eb363fde
--- /dev/null
+++ b/arch/ppc/platforms/85xx/tqm85xx.h
@@ -0,0 +1,56 @@
1/*
2 * arch/ppc/platforms/85xx/tqm85xx.h
3 *
4 * TQM85xx (40/41/55/60) board definitions
5 *
6 * Copyright (c) 2005 DENX Software Engineering
7 * Stefan Roese <sr@denx.de>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 */
15
16#ifndef __MACH_TQM85XX_H
17#define __MACH_TQM85XX_H
18
19#include <linux/config.h>
20#include <linux/init.h>
21#include <asm/ppcboot.h>
22
23#define BOARD_CCSRBAR ((uint)0xe0000000)
24#define CCSRBAR_SIZE ((uint)1024*1024)
25
26#define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET)
27
28#define PCI_CFG_ADDR_OFFSET (0x8000)
29#define PCI_CFG_DATA_OFFSET (0x8004)
30
31/* PCI interrupt controller */
32#define PIRQA MPC85xx_IRQ_EXT2
33#define PIRQB MPC85xx_IRQ_EXT3
34
35#define MPC85XX_PCI1_LOWER_IO 0x00000000
36#define MPC85XX_PCI1_UPPER_IO 0x00ffffff
37
38#define MPC85XX_PCI1_LOWER_MEM 0x80000000
39#define MPC85XX_PCI1_UPPER_MEM 0x9fffffff
40
41#define MPC85XX_PCI1_IO_BASE 0xe2000000
42#define MPC85XX_PCI1_MEM_OFFSET 0x00000000
43
44#define MPC85XX_PCI1_IO_SIZE 0x01000000
45
46#define BASE_BAUD 115200
47
48extern void mpc85xx_setup_hose(void) __init;
49extern void mpc85xx_restart(char *cmd);
50extern void mpc85xx_power_off(void);
51extern void mpc85xx_halt(void);
52extern void mpc85xx_init_IRQ(void) __init;
53extern unsigned long mpc85xx_find_end_of_memory(void) __init;
54extern void mpc85xx_calibrate_decr(void) __init;
55
56#endif /* __MACH_TQM85XX_H */
diff --git a/arch/ppc/platforms/Makefile b/arch/ppc/platforms/Makefile
index 7c5cdabf6f3c..51430e294b32 100644
--- a/arch/ppc/platforms/Makefile
+++ b/arch/ppc/platforms/Makefile
@@ -3,26 +3,18 @@
3# 3#
4 4
5# Extra CFLAGS so we don't have to do relative includes 5# Extra CFLAGS so we don't have to do relative includes
6CFLAGS_pmac_setup.o += -Iarch/$(ARCH)/mm 6CFLAGS_chrp_setup.o += -Iarch/$(ARCH)/mm
7 7
8obj-$(CONFIG_APUS) += apus_setup.o 8obj-$(CONFIG_APUS) += apus_setup.o
9ifeq ($(CONFIG_APUS),y) 9ifeq ($(CONFIG_APUS),y)
10obj-$(CONFIG_PCI) += apus_pci.o 10obj-$(CONFIG_PCI) += apus_pci.o
11endif 11endif
12obj-$(CONFIG_PPC_PMAC) += pmac_pic.o pmac_setup.o pmac_time.o \
13 pmac_feature.o pmac_pci.o pmac_sleep.o \
14 pmac_low_i2c.o pmac_cache.o
15obj-$(CONFIG_PPC_CHRP) += chrp_setup.o chrp_time.o chrp_pci.o \ 12obj-$(CONFIG_PPC_CHRP) += chrp_setup.o chrp_time.o chrp_pci.o \
16 chrp_pegasos_eth.o 13 chrp_pegasos_eth.o
17ifeq ($(CONFIG_PPC_CHRP),y) 14ifeq ($(CONFIG_PPC_CHRP),y)
18obj-$(CONFIG_NVRAM) += chrp_nvram.o 15obj-$(CONFIG_NVRAM) += chrp_nvram.o
19endif 16endif
20obj-$(CONFIG_PPC_PREP) += prep_pci.o prep_setup.o 17obj-$(CONFIG_PPC_PREP) += prep_pci.o prep_setup.o
21ifeq ($(CONFIG_PPC_PMAC),y)
22obj-$(CONFIG_NVRAM) += pmac_nvram.o
23obj-$(CONFIG_CPU_FREQ_PMAC) += pmac_cpufreq.o
24endif
25obj-$(CONFIG_PMAC_BACKLIGHT) += pmac_backlight.o
26obj-$(CONFIG_PREP_RESIDUAL) += residual.o 18obj-$(CONFIG_PREP_RESIDUAL) += residual.o
27obj-$(CONFIG_PQ2ADS) += pq2ads.o 19obj-$(CONFIG_PQ2ADS) += pq2ads.o
28obj-$(CONFIG_TQM8260) += tqm8260_setup.o 20obj-$(CONFIG_TQM8260) += tqm8260_setup.o
@@ -47,6 +39,5 @@ obj-$(CONFIG_LITE5200) += lite5200.o
47obj-$(CONFIG_EV64360) += ev64360.o 39obj-$(CONFIG_EV64360) += ev64360.o
48 40
49ifeq ($(CONFIG_SMP),y) 41ifeq ($(CONFIG_SMP),y)
50obj-$(CONFIG_PPC_PMAC) += pmac_smp.o
51obj-$(CONFIG_PPC_CHRP) += chrp_smp.o 42obj-$(CONFIG_PPC_CHRP) += chrp_smp.o
52endif 43endif
diff --git a/arch/ppc/platforms/apus_setup.c b/arch/ppc/platforms/apus_setup.c
index 2f74fde98ebc..c42c50073da5 100644
--- a/arch/ppc/platforms/apus_setup.c
+++ b/arch/ppc/platforms/apus_setup.c
@@ -55,9 +55,6 @@ int (*mach_hwclk) (int, struct hwclk_time*) = NULL;
55int (*mach_set_clock_mmss) (unsigned long) = NULL; 55int (*mach_set_clock_mmss) (unsigned long) = NULL;
56void (*mach_reset)( void ); 56void (*mach_reset)( void );
57long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */ 57long mach_max_dma_address = 0x00ffffff; /* default set to the lower 16MB */
58#if defined(CONFIG_AMIGA_FLOPPY)
59void (*mach_floppy_setup) (char *, int *) __initdata = NULL;
60#endif
61#ifdef CONFIG_HEARTBEAT 58#ifdef CONFIG_HEARTBEAT
62void (*mach_heartbeat) (int) = NULL; 59void (*mach_heartbeat) (int) = NULL;
63extern void apus_heartbeat (void); 60extern void apus_heartbeat (void);
@@ -76,7 +73,6 @@ struct mem_info m68k_memory[NUM_MEMINFO];/* memory description */
76 73
77struct mem_info ramdisk; 74struct mem_info ramdisk;
78 75
79extern void amiga_floppy_setup(char *, int *);
80extern void config_amiga(void); 76extern void config_amiga(void);
81 77
82static int __60nsram = 0; 78static int __60nsram = 0;
@@ -305,16 +301,6 @@ void kbd_reset_setup(char *str, int *ints)
305{ 301{
306} 302}
307 303
308/*********************************************************** FLOPPY */
309#if defined(CONFIG_AMIGA_FLOPPY)
310__init
311void floppy_setup(char *str, int *ints)
312{
313 if (mach_floppy_setup)
314 mach_floppy_setup (str, ints);
315}
316#endif
317
318/*********************************************************** MEMORY */ 304/*********************************************************** MEMORY */
319#define KMAP_MAX 32 305#define KMAP_MAX 32
320unsigned long kmap_chunks[KMAP_MAX*3]; 306unsigned long kmap_chunks[KMAP_MAX*3];
@@ -574,9 +560,9 @@ static __inline__ void ser_RTSon(void)
574 560
575int __debug_ser_out( unsigned char c ) 561int __debug_ser_out( unsigned char c )
576{ 562{
577 custom.serdat = c | 0x100; 563 amiga_custom.serdat = c | 0x100;
578 mb(); 564 mb();
579 while (!(custom.serdatr & 0x2000)) 565 while (!(amiga_custom.serdatr & 0x2000))
580 barrier(); 566 barrier();
581 return 1; 567 return 1;
582} 568}
@@ -586,11 +572,11 @@ unsigned char __debug_ser_in( void )
586 unsigned char c; 572 unsigned char c;
587 573
588 /* XXX: is that ok?? derived from amiga_ser.c... */ 574 /* XXX: is that ok?? derived from amiga_ser.c... */
589 while( !(custom.intreqr & IF_RBF) ) 575 while( !(amiga_custom.intreqr & IF_RBF) )
590 barrier(); 576 barrier();
591 c = custom.serdatr; 577 c = amiga_custom.serdatr;
592 /* clear the interrupt, so that another character can be read */ 578 /* clear the interrupt, so that another character can be read */
593 custom.intreq = IF_RBF; 579 amiga_custom.intreq = IF_RBF;
594 return c; 580 return c;
595} 581}
596 582
@@ -601,10 +587,10 @@ int __debug_serinit( void )
601 local_irq_save(flags); 587 local_irq_save(flags);
602 588
603 /* turn off Rx and Tx interrupts */ 589 /* turn off Rx and Tx interrupts */
604 custom.intena = IF_RBF | IF_TBE; 590 amiga_custom.intena = IF_RBF | IF_TBE;
605 591
606 /* clear any pending interrupt */ 592 /* clear any pending interrupt */
607 custom.intreq = IF_RBF | IF_TBE; 593 amiga_custom.intreq = IF_RBF | IF_TBE;
608 594
609 local_irq_restore(flags); 595 local_irq_restore(flags);
610 596
@@ -617,7 +603,7 @@ int __debug_serinit( void )
617 603
618#ifdef CONFIG_KGDB 604#ifdef CONFIG_KGDB
619 /* turn Rx interrupts on for GDB */ 605 /* turn Rx interrupts on for GDB */
620 custom.intena = IF_SETCLR | IF_RBF; 606 amiga_custom.intena = IF_SETCLR | IF_RBF;
621 ser_RTSon(); 607 ser_RTSon();
622#endif 608#endif
623 609
diff --git a/arch/ppc/platforms/chrp_pci.c b/arch/ppc/platforms/chrp_pci.c
index bd047aac01b1..c7fe6182bb77 100644
--- a/arch/ppc/platforms/chrp_pci.c
+++ b/arch/ppc/platforms/chrp_pci.c
@@ -275,7 +275,7 @@ chrp_find_bridges(void)
275 setup_python(hose, dev); 275 setup_python(hose, dev);
276 } else if (is_mot 276 } else if (is_mot
277 || strncmp(model, "Motorola, Grackle", 17) == 0) { 277 || strncmp(model, "Motorola, Grackle", 17) == 0) {
278 setup_grackle(hose); 278 setup_indirect_pci(hose, 0xfec00000, 0xfee00000);
279 } else if (is_longtrail) { 279 } else if (is_longtrail) {
280 void __iomem *p = ioremap(GG2_PCI_CONFIG_BASE, 0x80000); 280 void __iomem *p = ioremap(GG2_PCI_CONFIG_BASE, 0x80000);
281 hose->ops = &gg2_pci_ops; 281 hose->ops = &gg2_pci_ops;
diff --git a/arch/ppc/platforms/chrp_setup.c b/arch/ppc/platforms/chrp_setup.c
index f1b70ab3c6fd..48996b787378 100644
--- a/arch/ppc/platforms/chrp_setup.c
+++ b/arch/ppc/platforms/chrp_setup.c
@@ -53,6 +53,7 @@
53#include <asm/i8259.h> 53#include <asm/i8259.h>
54#include <asm/open_pic.h> 54#include <asm/open_pic.h>
55#include <asm/xmon.h> 55#include <asm/xmon.h>
56#include "mem_pieces.h"
56 57
57unsigned long chrp_get_rtc_time(void); 58unsigned long chrp_get_rtc_time(void);
58int chrp_set_rtc_time(unsigned long nowtime); 59int chrp_set_rtc_time(unsigned long nowtime);
@@ -65,7 +66,6 @@ void rtas_display_progress(char *, unsigned short);
65void rtas_indicator_progress(char *, unsigned short); 66void rtas_indicator_progress(char *, unsigned short);
66void btext_progress(char *, unsigned short); 67void btext_progress(char *, unsigned short);
67 68
68extern unsigned long pmac_find_end_of_memory(void);
69extern int of_show_percpuinfo(struct seq_file *, int); 69extern int of_show_percpuinfo(struct seq_file *, int);
70 70
71int _chrp_type; 71int _chrp_type;
@@ -404,7 +404,6 @@ static struct irqaction xmon_irqaction = {
404void __init chrp_init_IRQ(void) 404void __init chrp_init_IRQ(void)
405{ 405{
406 struct device_node *np; 406 struct device_node *np;
407 int i;
408 unsigned long chrp_int_ack = 0; 407 unsigned long chrp_int_ack = 0;
409 unsigned char init_senses[NR_IRQS - NUM_8259_INTERRUPTS]; 408 unsigned char init_senses[NR_IRQS - NUM_8259_INTERRUPTS];
410#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON) 409#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
@@ -468,6 +467,75 @@ chrp_init2(void)
468 ppc_md.progress(" Have fun! ", 0x7777); 467 ppc_md.progress(" Have fun! ", 0x7777);
469} 468}
470 469
470static struct device_node *memory_node;
471
472static int __init get_mem_prop(char *name, struct mem_pieces *mp)
473{
474 struct reg_property *rp;
475 int i, s;
476 unsigned int *ip;
477 int nac = prom_n_addr_cells(memory_node);
478 int nsc = prom_n_size_cells(memory_node);
479
480 ip = (unsigned int *) get_property(memory_node, name, &s);
481 if (ip == NULL) {
482 printk(KERN_ERR "error: couldn't get %s property on /memory\n",
483 name);
484 return 0;
485 }
486 s /= (nsc + nac) * 4;
487 rp = mp->regions;
488 for (i = 0; i < s; ++i, ip += nac+nsc) {
489 if (nac >= 2 && ip[nac-2] != 0)
490 continue;
491 rp->address = ip[nac-1];
492 if (nsc >= 2 && ip[nac+nsc-2] != 0)
493 rp->size = ~0U;
494 else
495 rp->size = ip[nac+nsc-1];
496 ++rp;
497 }
498 mp->n_regions = rp - mp->regions;
499
500 /* Make sure the pieces are sorted. */
501 mem_pieces_sort(mp);
502 mem_pieces_coalesce(mp);
503 return 1;
504}
505
506static unsigned long __init chrp_find_end_of_memory(void)
507{
508 unsigned long a, total;
509 struct mem_pieces phys_mem;
510
511 /*
512 * Find out where physical memory is, and check that it
513 * starts at 0 and is contiguous. It seems that RAM is
514 * always physically contiguous on Power Macintoshes.
515 *
516 * Supporting discontiguous physical memory isn't hard,
517 * it just makes the virtual <-> physical mapping functions
518 * more complicated (or else you end up wasting space
519 * in mem_map).
520 */
521 memory_node = find_devices("memory");
522 if (memory_node == NULL || !get_mem_prop("reg", &phys_mem)
523 || phys_mem.n_regions == 0)
524 panic("No RAM??");
525 a = phys_mem.regions[0].address;
526 if (a != 0)
527 panic("RAM doesn't start at physical address 0");
528 total = phys_mem.regions[0].size;
529
530 if (phys_mem.n_regions > 1) {
531 printk("RAM starting at 0x%x is not contiguous\n",
532 phys_mem.regions[1].address);
533 printk("Using RAM from 0 to 0x%lx\n", total-1);
534 }
535
536 return total;
537}
538
471void __init 539void __init
472chrp_init(unsigned long r3, unsigned long r4, unsigned long r5, 540chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
473 unsigned long r6, unsigned long r7) 541 unsigned long r6, unsigned long r7)
@@ -526,7 +594,7 @@ chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
526 ppc_md.get_rtc_time = chrp_get_rtc_time; 594 ppc_md.get_rtc_time = chrp_get_rtc_time;
527 ppc_md.calibrate_decr = chrp_calibrate_decr; 595 ppc_md.calibrate_decr = chrp_calibrate_decr;
528 596
529 ppc_md.find_end_of_memory = pmac_find_end_of_memory; 597 ppc_md.find_end_of_memory = chrp_find_end_of_memory;
530 598
531 if (rtas_data) { 599 if (rtas_data) {
532 struct device_node *rtas; 600 struct device_node *rtas;
diff --git a/arch/ppc/platforms/chrp_time.c b/arch/ppc/platforms/chrp_time.c
index 29d074c305f0..57753a55b580 100644
--- a/arch/ppc/platforms/chrp_time.c
+++ b/arch/ppc/platforms/chrp_time.c
@@ -163,13 +163,75 @@ unsigned long chrp_get_rtc_time(void)
163 return mktime(year, mon, day, hour, min, sec); 163 return mktime(year, mon, day, hour, min, sec);
164} 164}
165 165
166/*
167 * Calibrate the decrementer frequency with the VIA timer 1.
168 */
169#define VIA_TIMER_FREQ_6 4700000 /* time 1 frequency * 6 */
170
171/* VIA registers */
172#define RS 0x200 /* skip between registers */
173#define T1CL (4*RS) /* Timer 1 ctr/latch (low 8 bits) */
174#define T1CH (5*RS) /* Timer 1 counter (high 8 bits) */
175#define T1LL (6*RS) /* Timer 1 latch (low 8 bits) */
176#define T1LH (7*RS) /* Timer 1 latch (high 8 bits) */
177#define ACR (11*RS) /* Auxiliary control register */
178#define IFR (13*RS) /* Interrupt flag register */
179
180/* Bits in ACR */
181#define T1MODE 0xc0 /* Timer 1 mode */
182#define T1MODE_CONT 0x40 /* continuous interrupts */
183
184/* Bits in IFR and IER */
185#define T1_INT 0x40 /* Timer 1 interrupt */
186
187static int __init chrp_via_calibrate_decr(void)
188{
189 struct device_node *vias;
190 volatile unsigned char __iomem *via;
191 int count = VIA_TIMER_FREQ_6 / 100;
192 unsigned int dstart, dend;
193
194 vias = find_devices("via-cuda");
195 if (vias == 0)
196 vias = find_devices("via");
197 if (vias == 0 || vias->n_addrs == 0)
198 return 0;
199 via = ioremap(vias->addrs[0].address, vias->addrs[0].size);
200
201 /* set timer 1 for continuous interrupts */
202 out_8(&via[ACR], (via[ACR] & ~T1MODE) | T1MODE_CONT);
203 /* set the counter to a small value */
204 out_8(&via[T1CH], 2);
205 /* set the latch to `count' */
206 out_8(&via[T1LL], count);
207 out_8(&via[T1LH], count >> 8);
208 /* wait until it hits 0 */
209 while ((in_8(&via[IFR]) & T1_INT) == 0)
210 ;
211 dstart = get_dec();
212 /* clear the interrupt & wait until it hits 0 again */
213 in_8(&via[T1CL]);
214 while ((in_8(&via[IFR]) & T1_INT) == 0)
215 ;
216 dend = get_dec();
217
218 tb_ticks_per_jiffy = (dstart - dend) / ((6 * HZ)/100);
219 tb_to_us = mulhwu_scale_factor(dstart - dend, 60000);
220
221 printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n",
222 tb_ticks_per_jiffy, dstart - dend);
223
224 iounmap(via);
225
226 return 1;
227}
166 228
167void __init chrp_calibrate_decr(void) 229void __init chrp_calibrate_decr(void)
168{ 230{
169 struct device_node *cpu; 231 struct device_node *cpu;
170 unsigned int freq, *fp; 232 unsigned int freq, *fp;
171 233
172 if (via_calibrate_decr()) 234 if (chrp_via_calibrate_decr())
173 return; 235 return;
174 236
175 /* 237 /*
diff --git a/arch/ppc/platforms/lite5200.c b/arch/ppc/platforms/lite5200.c
index d44cc991179f..7ed52dc340c9 100644
--- a/arch/ppc/platforms/lite5200.c
+++ b/arch/ppc/platforms/lite5200.c
@@ -196,8 +196,10 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
196 mpc52xx_set_bat(); 196 mpc52xx_set_bat();
197 197
198 /* No ISA bus by default */ 198 /* No ISA bus by default */
199#ifdef CONFIG_PCI
199 isa_io_base = 0; 200 isa_io_base = 0;
200 isa_mem_base = 0; 201 isa_mem_base = 0;
202#endif
201 203
202 /* Powersave */ 204 /* Powersave */
203 /* This is provided as an example on how to do it. But you 205 /* This is provided as an example on how to do it. But you
diff --git a/arch/ppc/platforms/mpc5200.c b/arch/ppc/platforms/mpc5200.c
deleted file mode 100644
index a58db438c162..000000000000
--- a/arch/ppc/platforms/mpc5200.c
+++ /dev/null
@@ -1,53 +0,0 @@
1/*
2 * arch/ppc/platforms/mpc5200.c
3 *
4 * OCP Definitions for the boards based on MPC5200 processor. Contains
5 * definitions for every common peripherals. (Mostly all but PSCs)
6 *
7 * Maintainer : Sylvain Munaut <tnt@246tNt.com>
8 *
9 * Copyright 2004 Sylvain Munaut <tnt@246tNt.com>
10 *
11 * This file is licensed under the terms of the GNU General Public License
12 * version 2. This program is licensed "as is" without any warranty of any
13 * kind, whether express or implied.
14 */
15
16#include <asm/ocp.h>
17#include <asm/mpc52xx.h>
18
19
20static struct ocp_fs_i2c_data mpc5200_i2c_def = {
21 .flags = FS_I2C_CLOCK_5200,
22};
23
24
25/* Here is the core_ocp struct.
26 * With all the devices common to all board. Even if port multiplexing is
27 * not setup for them (if the user don't want them, just don't select the
28 * config option). The potentially conflicting devices (like PSCs) goes in
29 * board specific file.
30 */
31struct ocp_def core_ocp[] = {
32 {
33 .vendor = OCP_VENDOR_FREESCALE,
34 .function = OCP_FUNC_IIC,
35 .index = 0,
36 .paddr = MPC52xx_I2C1,
37 .irq = OCP_IRQ_NA, /* MPC52xx_IRQ_I2C1 - Buggy */
38 .pm = OCP_CPM_NA,
39 .additions = &mpc5200_i2c_def,
40 },
41 {
42 .vendor = OCP_VENDOR_FREESCALE,
43 .function = OCP_FUNC_IIC,
44 .index = 1,
45 .paddr = MPC52xx_I2C2,
46 .irq = OCP_IRQ_NA, /* MPC52xx_IRQ_I2C2 - Buggy */
47 .pm = OCP_CPM_NA,
48 .additions = &mpc5200_i2c_def,
49 },
50 { /* Terminating entry */
51 .vendor = OCP_VENDOR_INVALID
52 }
53};
diff --git a/arch/ppc/platforms/pmac_backlight.c b/arch/ppc/platforms/pmac_backlight.c
deleted file mode 100644
index 8be2f7d071f0..000000000000
--- a/arch/ppc/platforms/pmac_backlight.c
+++ /dev/null
@@ -1,202 +0,0 @@
1/*
2 * Miscellaneous procedures for dealing with the PowerMac hardware.
3 * Contains support for the backlight.
4 *
5 * Copyright (C) 2000 Benjamin Herrenschmidt
6 *
7 */
8
9#include <linux/config.h>
10#include <linux/kernel.h>
11#include <linux/module.h>
12#include <linux/stddef.h>
13#include <linux/reboot.h>
14#include <linux/nvram.h>
15#include <linux/console.h>
16#include <asm/sections.h>
17#include <asm/ptrace.h>
18#include <asm/io.h>
19#include <asm/pgtable.h>
20#include <asm/system.h>
21#include <asm/prom.h>
22#include <asm/machdep.h>
23#include <asm/nvram.h>
24#include <asm/backlight.h>
25
26#include <linux/adb.h>
27#include <linux/pmu.h>
28
29static struct backlight_controller *backlighter;
30static void* backlighter_data;
31static int backlight_autosave;
32static int backlight_level = BACKLIGHT_MAX;
33static int backlight_enabled = 1;
34static int backlight_req_level = -1;
35static int backlight_req_enable = -1;
36
37static void backlight_callback(void *);
38static DECLARE_WORK(backlight_work, backlight_callback, NULL);
39
40void register_backlight_controller(struct backlight_controller *ctrler,
41 void *data, char *type)
42{
43 struct device_node* bk_node;
44 char *prop;
45 int valid = 0;
46
47 /* There's already a matching controller, bail out */
48 if (backlighter != NULL)
49 return;
50
51 bk_node = find_devices("backlight");
52
53#ifdef CONFIG_ADB_PMU
54 /* Special case for the old PowerBook since I can't test on it */
55 backlight_autosave = machine_is_compatible("AAPL,3400/2400")
56 || machine_is_compatible("AAPL,3500");
57 if ((backlight_autosave
58 || machine_is_compatible("AAPL,PowerBook1998")
59 || machine_is_compatible("PowerBook1,1"))
60 && !strcmp(type, "pmu"))
61 valid = 1;
62#endif
63 if (bk_node) {
64 prop = get_property(bk_node, "backlight-control", NULL);
65 if (prop && !strncmp(prop, type, strlen(type)))
66 valid = 1;
67 }
68 if (!valid)
69 return;
70 backlighter = ctrler;
71 backlighter_data = data;
72
73 if (bk_node && !backlight_autosave)
74 prop = get_property(bk_node, "bklt", NULL);
75 else
76 prop = NULL;
77 if (prop) {
78 backlight_level = ((*prop)+1) >> 1;
79 if (backlight_level > BACKLIGHT_MAX)
80 backlight_level = BACKLIGHT_MAX;
81 }
82
83#ifdef CONFIG_ADB_PMU
84 if (backlight_autosave) {
85 struct adb_request req;
86 pmu_request(&req, NULL, 2, 0xd9, 0);
87 while (!req.complete)
88 pmu_poll();
89 backlight_level = req.reply[0] >> 4;
90 }
91#endif
92 acquire_console_sem();
93 if (!backlighter->set_enable(1, backlight_level, data))
94 backlight_enabled = 1;
95 release_console_sem();
96
97 printk(KERN_INFO "Registered \"%s\" backlight controller,"
98 "level: %d/15\n", type, backlight_level);
99}
100EXPORT_SYMBOL(register_backlight_controller);
101
102void unregister_backlight_controller(struct backlight_controller
103 *ctrler, void *data)
104{
105 /* We keep the current backlight level (for now) */
106 if (ctrler == backlighter && data == backlighter_data)
107 backlighter = NULL;
108}
109EXPORT_SYMBOL(unregister_backlight_controller);
110
111static int __set_backlight_enable(int enable)
112{
113 int rc;
114
115 if (!backlighter)
116 return -ENODEV;
117 acquire_console_sem();
118 rc = backlighter->set_enable(enable, backlight_level,
119 backlighter_data);
120 if (!rc)
121 backlight_enabled = enable;
122 release_console_sem();
123 return rc;
124}
125int set_backlight_enable(int enable)
126{
127 if (!backlighter)
128 return -ENODEV;
129 backlight_req_enable = enable;
130 schedule_work(&backlight_work);
131 return 0;
132}
133
134EXPORT_SYMBOL(set_backlight_enable);
135
136int get_backlight_enable(void)
137{
138 if (!backlighter)
139 return -ENODEV;
140 return backlight_enabled;
141}
142EXPORT_SYMBOL(get_backlight_enable);
143
144static int __set_backlight_level(int level)
145{
146 int rc = 0;
147
148 if (!backlighter)
149 return -ENODEV;
150 if (level < BACKLIGHT_MIN)
151 level = BACKLIGHT_OFF;
152 if (level > BACKLIGHT_MAX)
153 level = BACKLIGHT_MAX;
154 acquire_console_sem();
155 if (backlight_enabled)
156 rc = backlighter->set_level(level, backlighter_data);
157 if (!rc)
158 backlight_level = level;
159 release_console_sem();
160 if (!rc && !backlight_autosave) {
161 level <<=1;
162 if (level & 0x10)
163 level |= 0x01;
164 // -- todo: save to property "bklt"
165 }
166 return rc;
167}
168int set_backlight_level(int level)
169{
170 if (!backlighter)
171 return -ENODEV;
172 backlight_req_level = level;
173 schedule_work(&backlight_work);
174 return 0;
175}
176
177EXPORT_SYMBOL(set_backlight_level);
178
179int get_backlight_level(void)
180{
181 if (!backlighter)
182 return -ENODEV;
183 return backlight_level;
184}
185EXPORT_SYMBOL(get_backlight_level);
186
187static void backlight_callback(void *dummy)
188{
189 int level, enable;
190
191 do {
192 level = backlight_req_level;
193 enable = backlight_req_enable;
194 mb();
195
196 if (level >= 0)
197 __set_backlight_level(level);
198 if (enable >= 0)
199 __set_backlight_enable(enable);
200 } while(cmpxchg(&backlight_req_level, level, -1) != level ||
201 cmpxchg(&backlight_req_enable, enable, -1) != enable);
202}
diff --git a/arch/ppc/platforms/pmac_cache.S b/arch/ppc/platforms/pmac_cache.S
deleted file mode 100644
index fb977de6b704..000000000000
--- a/arch/ppc/platforms/pmac_cache.S
+++ /dev/null
@@ -1,359 +0,0 @@
1/*
2 * This file contains low-level cache management functions
3 * used for sleep and CPU speed changes on Apple machines.
4 * (In fact the only thing that is Apple-specific is that we assume
5 * that we can read from ROM at physical address 0xfff00000.)
6 *
7 * Copyright (C) 2004 Paul Mackerras (paulus@samba.org) and
8 * Benjamin Herrenschmidt (benh@kernel.crashing.org)
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License
12 * as published by the Free Software Foundation; either version
13 * 2 of the License, or (at your option) any later version.
14 *
15 */
16
17#include <linux/config.h>
18#include <asm/processor.h>
19#include <asm/ppc_asm.h>
20#include <asm/cputable.h>
21
22/*
23 * Flush and disable all data caches (dL1, L2, L3). This is used
24 * when going to sleep, when doing a PMU based cpufreq transition,
25 * or when "offlining" a CPU on SMP machines. This code is over
26 * paranoid, but I've had enough issues with various CPU revs and
27 * bugs that I decided it was worth beeing over cautious
28 */
29
30_GLOBAL(flush_disable_caches)
31#ifndef CONFIG_6xx
32 blr
33#else
34BEGIN_FTR_SECTION
35 b flush_disable_745x
36END_FTR_SECTION_IFSET(CPU_FTR_SPEC7450)
37BEGIN_FTR_SECTION
38 b flush_disable_75x
39END_FTR_SECTION_IFSET(CPU_FTR_L2CR)
40 b __flush_disable_L1
41
42/* This is the code for G3 and 74[01]0 */
43flush_disable_75x:
44 mflr r10
45
46 /* Turn off EE and DR in MSR */
47 mfmsr r11
48 rlwinm r0,r11,0,~MSR_EE
49 rlwinm r0,r0,0,~MSR_DR
50 sync
51 mtmsr r0
52 isync
53
54 /* Stop DST streams */
55BEGIN_FTR_SECTION
56 DSSALL
57 sync
58END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
59
60 /* Stop DPM */
61 mfspr r8,SPRN_HID0 /* Save SPRN_HID0 in r8 */
62 rlwinm r4,r8,0,12,10 /* Turn off HID0[DPM] */
63 sync
64 mtspr SPRN_HID0,r4 /* Disable DPM */
65 sync
66
67 /* Disp-flush L1. We have a weird problem here that I never
68 * totally figured out. On 750FX, using the ROM for the flush
69 * results in a non-working flush. We use that workaround for
70 * now until I finally understand what's going on. --BenH
71 */
72
73 /* ROM base by default */
74 lis r4,0xfff0
75 mfpvr r3
76 srwi r3,r3,16
77 cmplwi cr0,r3,0x7000
78 bne+ 1f
79 /* RAM base on 750FX */
80 li r4,0
811: li r4,0x4000
82 mtctr r4
831: lwz r0,0(r4)
84 addi r4,r4,32
85 bdnz 1b
86 sync
87 isync
88
89 /* Disable / invalidate / enable L1 data */
90 mfspr r3,SPRN_HID0
91 rlwinm r3,r3,0,~(HID0_DCE | HID0_ICE)
92 mtspr SPRN_HID0,r3
93 sync
94 isync
95 ori r3,r3,(HID0_DCE|HID0_DCI|HID0_ICE|HID0_ICFI)
96 sync
97 isync
98 mtspr SPRN_HID0,r3
99 xori r3,r3,(HID0_DCI|HID0_ICFI)
100 mtspr SPRN_HID0,r3
101 sync
102
103 /* Get the current enable bit of the L2CR into r4 */
104 mfspr r5,SPRN_L2CR
105 /* Set to data-only (pre-745x bit) */
106 oris r3,r5,L2CR_L2DO@h
107 b 2f
108 /* When disabling L2, code must be in L1 */
109 .balign 32
1101: mtspr SPRN_L2CR,r3
1113: sync
112 isync
113 b 1f
1142: b 3f
1153: sync
116 isync
117 b 1b
1181: /* disp-flush L2. The interesting thing here is that the L2 can be
119 * up to 2Mb ... so using the ROM, we'll end up wrapping back to memory
120 * but that is probbaly fine. We disp-flush over 4Mb to be safe
121 */
122 lis r4,2
123 mtctr r4
124 lis r4,0xfff0
1251: lwz r0,0(r4)
126 addi r4,r4,32
127 bdnz 1b
128 sync
129 isync
130 lis r4,2
131 mtctr r4
132 lis r4,0xfff0
1331: dcbf 0,r4
134 addi r4,r4,32
135 bdnz 1b
136 sync
137 isync
138
139 /* now disable L2 */
140 rlwinm r5,r5,0,~L2CR_L2E
141 b 2f
142 /* When disabling L2, code must be in L1 */
143 .balign 32
1441: mtspr SPRN_L2CR,r5
1453: sync
146 isync
147 b 1f
1482: b 3f
1493: sync
150 isync
151 b 1b
1521: sync
153 isync
154 /* Invalidate L2. This is pre-745x, we clear the L2I bit ourselves */
155 oris r4,r5,L2CR_L2I@h
156 mtspr SPRN_L2CR,r4
157 sync
158 isync
159
160 /* Wait for the invalidation to complete */
1611: mfspr r3,SPRN_L2CR
162 rlwinm. r0,r3,0,31,31
163 bne 1b
164
165 /* Clear L2I */
166 xoris r4,r4,L2CR_L2I@h
167 sync
168 mtspr SPRN_L2CR,r4
169 sync
170
171 /* now disable the L1 data cache */
172 mfspr r0,SPRN_HID0
173 rlwinm r0,r0,0,~(HID0_DCE|HID0_ICE)
174 mtspr SPRN_HID0,r0
175 sync
176 isync
177
178 /* Restore HID0[DPM] to whatever it was before */
179 sync
180 mfspr r0,SPRN_HID0
181 rlwimi r0,r8,0,11,11 /* Turn back HID0[DPM] */
182 mtspr SPRN_HID0,r0
183 sync
184
185 /* restore DR and EE */
186 sync
187 mtmsr r11
188 isync
189
190 mtlr r10
191 blr
192
193/* This code is for 745x processors */
194flush_disable_745x:
195 /* Turn off EE and DR in MSR */
196 mfmsr r11
197 rlwinm r0,r11,0,~MSR_EE
198 rlwinm r0,r0,0,~MSR_DR
199 sync
200 mtmsr r0
201 isync
202
203 /* Stop prefetch streams */
204 DSSALL
205 sync
206
207 /* Disable L2 prefetching */
208 mfspr r0,SPRN_MSSCR0
209 rlwinm r0,r0,0,0,29
210 mtspr SPRN_MSSCR0,r0
211 sync
212 isync
213 lis r4,0
214 dcbf 0,r4
215 dcbf 0,r4
216 dcbf 0,r4
217 dcbf 0,r4
218 dcbf 0,r4
219 dcbf 0,r4
220 dcbf 0,r4
221 dcbf 0,r4
222
223 /* Due to a bug with the HW flush on some CPU revs, we occasionally
224 * experience data corruption. I'm adding a displacement flush along
225 * with a dcbf loop over a few Mb to "help". The problem isn't totally
226 * fixed by this in theory, but at least, in practice, I couldn't reproduce
227 * it even with a big hammer...
228 */
229
230 lis r4,0x0002
231 mtctr r4
232 li r4,0
2331:
234 lwz r0,0(r4)
235 addi r4,r4,32 /* Go to start of next cache line */
236 bdnz 1b
237 isync
238
239 /* Now, flush the first 4MB of memory */
240 lis r4,0x0002
241 mtctr r4
242 li r4,0
243 sync
2441:
245 dcbf 0,r4
246 addi r4,r4,32 /* Go to start of next cache line */
247 bdnz 1b
248
249 /* Flush and disable the L1 data cache */
250 mfspr r6,SPRN_LDSTCR
251 lis r3,0xfff0 /* read from ROM for displacement flush */
252 li r4,0xfe /* start with only way 0 unlocked */
253 li r5,128 /* 128 lines in each way */
2541: mtctr r5
255 rlwimi r6,r4,0,24,31
256 mtspr SPRN_LDSTCR,r6
257 sync
258 isync
2592: lwz r0,0(r3) /* touch each cache line */
260 addi r3,r3,32
261 bdnz 2b
262 rlwinm r4,r4,1,24,30 /* move on to the next way */
263 ori r4,r4,1
264 cmpwi r4,0xff /* all done? */
265 bne 1b
266 /* now unlock the L1 data cache */
267 li r4,0
268 rlwimi r6,r4,0,24,31
269 sync
270 mtspr SPRN_LDSTCR,r6
271 sync
272 isync
273
274 /* Flush the L2 cache using the hardware assist */
275 mfspr r3,SPRN_L2CR
276 cmpwi r3,0 /* check if it is enabled first */
277 bge 4f
278 oris r0,r3,(L2CR_L2IO_745x|L2CR_L2DO_745x)@h
279 b 2f
280 /* When disabling/locking L2, code must be in L1 */
281 .balign 32
2821: mtspr SPRN_L2CR,r0 /* lock the L2 cache */
2833: sync
284 isync
285 b 1f
2862: b 3f
2873: sync
288 isync
289 b 1b
2901: sync
291 isync
292 ori r0,r3,L2CR_L2HWF_745x
293 sync
294 mtspr SPRN_L2CR,r0 /* set the hardware flush bit */
2953: mfspr r0,SPRN_L2CR /* wait for it to go to 0 */
296 andi. r0,r0,L2CR_L2HWF_745x
297 bne 3b
298 sync
299 rlwinm r3,r3,0,~L2CR_L2E
300 b 2f
301 /* When disabling L2, code must be in L1 */
302 .balign 32
3031: mtspr SPRN_L2CR,r3 /* disable the L2 cache */
3043: sync
305 isync
306 b 1f
3072: b 3f
3083: sync
309 isync
310 b 1b
3111: sync
312 isync
313 oris r4,r3,L2CR_L2I@h
314 mtspr SPRN_L2CR,r4
315 sync
316 isync
3171: mfspr r4,SPRN_L2CR
318 andis. r0,r4,L2CR_L2I@h
319 bne 1b
320 sync
321
322BEGIN_FTR_SECTION
323 /* Flush the L3 cache using the hardware assist */
3244: mfspr r3,SPRN_L3CR
325 cmpwi r3,0 /* check if it is enabled */
326 bge 6f
327 oris r0,r3,L3CR_L3IO@h
328 ori r0,r0,L3CR_L3DO
329 sync
330 mtspr SPRN_L3CR,r0 /* lock the L3 cache */
331 sync
332 isync
333 ori r0,r0,L3CR_L3HWF
334 sync
335 mtspr SPRN_L3CR,r0 /* set the hardware flush bit */
3365: mfspr r0,SPRN_L3CR /* wait for it to go to zero */
337 andi. r0,r0,L3CR_L3HWF
338 bne 5b
339 rlwinm r3,r3,0,~L3CR_L3E
340 sync
341 mtspr SPRN_L3CR,r3 /* disable the L3 cache */
342 sync
343 ori r4,r3,L3CR_L3I
344 mtspr SPRN_L3CR,r4
3451: mfspr r4,SPRN_L3CR
346 andi. r0,r4,L3CR_L3I
347 bne 1b
348 sync
349END_FTR_SECTION_IFSET(CPU_FTR_L3CR)
350
3516: mfspr r0,SPRN_HID0 /* now disable the L1 data cache */
352 rlwinm r0,r0,0,~HID0_DCE
353 mtspr SPRN_HID0,r0
354 sync
355 isync
356 mtmsr r11 /* restore DR and EE */
357 isync
358 blr
359#endif /* CONFIG_6xx */
diff --git a/arch/ppc/platforms/pmac_cpufreq.c b/arch/ppc/platforms/pmac_cpufreq.c
deleted file mode 100644
index fba7e4d7c0bf..000000000000
--- a/arch/ppc/platforms/pmac_cpufreq.c
+++ /dev/null
@@ -1,735 +0,0 @@
1/*
2 * arch/ppc/platforms/pmac_cpufreq.c
3 *
4 * Copyright (C) 2002 - 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>
5 * Copyright (C) 2004 John Steele Scott <toojays@toojays.net>
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 * TODO: Need a big cleanup here. Basically, we need to have different
12 * cpufreq_driver structures for the different type of HW instead of the
13 * current mess. We also need to better deal with the detection of the
14 * type of machine.
15 *
16 */
17
18#include <linux/config.h>
19#include <linux/module.h>
20#include <linux/types.h>
21#include <linux/errno.h>
22#include <linux/kernel.h>
23#include <linux/delay.h>
24#include <linux/sched.h>
25#include <linux/adb.h>
26#include <linux/pmu.h>
27#include <linux/slab.h>
28#include <linux/cpufreq.h>
29#include <linux/init.h>
30#include <linux/sysdev.h>
31#include <linux/i2c.h>
32#include <linux/hardirq.h>
33#include <asm/prom.h>
34#include <asm/machdep.h>
35#include <asm/irq.h>
36#include <asm/pmac_feature.h>
37#include <asm/mmu_context.h>
38#include <asm/sections.h>
39#include <asm/cputable.h>
40#include <asm/time.h>
41#include <asm/system.h>
42#include <asm/open_pic.h>
43#include <asm/keylargo.h>
44
45/* WARNING !!! This will cause calibrate_delay() to be called,
46 * but this is an __init function ! So you MUST go edit
47 * init/main.c to make it non-init before enabling DEBUG_FREQ
48 */
49#undef DEBUG_FREQ
50
51/*
52 * There is a problem with the core cpufreq code on SMP kernels,
53 * it won't recalculate the Bogomips properly
54 */
55#ifdef CONFIG_SMP
56#warning "WARNING, CPUFREQ not recommended on SMP kernels"
57#endif
58
59extern void low_choose_7447a_dfs(int dfs);
60extern void low_choose_750fx_pll(int pll);
61extern void low_sleep_handler(void);
62
63/*
64 * Currently, PowerMac cpufreq supports only high & low frequencies
65 * that are set by the firmware
66 */
67static unsigned int low_freq;
68static unsigned int hi_freq;
69static unsigned int cur_freq;
70static unsigned int sleep_freq;
71
72/*
73 * Different models uses different mecanisms to switch the frequency
74 */
75static int (*set_speed_proc)(int low_speed);
76static unsigned int (*get_speed_proc)(void);
77
78/*
79 * Some definitions used by the various speedprocs
80 */
81static u32 voltage_gpio;
82static u32 frequency_gpio;
83static u32 slew_done_gpio;
84static int no_schedule;
85static int has_cpu_l2lve;
86static int is_pmu_based;
87
88/* There are only two frequency states for each processor. Values
89 * are in kHz for the time being.
90 */
91#define CPUFREQ_HIGH 0
92#define CPUFREQ_LOW 1
93
94static struct cpufreq_frequency_table pmac_cpu_freqs[] = {
95 {CPUFREQ_HIGH, 0},
96 {CPUFREQ_LOW, 0},
97 {0, CPUFREQ_TABLE_END},
98};
99
100static struct freq_attr* pmac_cpu_freqs_attr[] = {
101 &cpufreq_freq_attr_scaling_available_freqs,
102 NULL,
103};
104
105static inline void local_delay(unsigned long ms)
106{
107 if (no_schedule)
108 mdelay(ms);
109 else
110 msleep(ms);
111}
112
113static inline void wakeup_decrementer(void)
114{
115 set_dec(tb_ticks_per_jiffy);
116 /* No currently-supported powerbook has a 601,
117 * so use get_tbl, not native
118 */
119 last_jiffy_stamp(0) = tb_last_stamp = get_tbl();
120}
121
122#ifdef DEBUG_FREQ
123static inline void debug_calc_bogomips(void)
124{
125 /* This will cause a recalc of bogomips and display the
126 * result. We backup/restore the value to avoid affecting the
127 * core cpufreq framework's own calculation.
128 */
129 extern void calibrate_delay(void);
130
131 unsigned long save_lpj = loops_per_jiffy;
132 calibrate_delay();
133 loops_per_jiffy = save_lpj;
134}
135#endif /* DEBUG_FREQ */
136
137/* Switch CPU speed under 750FX CPU control
138 */
139static int cpu_750fx_cpu_speed(int low_speed)
140{
141 u32 hid2;
142
143 if (low_speed == 0) {
144 /* ramping up, set voltage first */
145 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05);
146 /* Make sure we sleep for at least 1ms */
147 local_delay(10);
148
149 /* tweak L2 for high voltage */
150 if (has_cpu_l2lve) {
151 hid2 = mfspr(SPRN_HID2);
152 hid2 &= ~0x2000;
153 mtspr(SPRN_HID2, hid2);
154 }
155 }
156#ifdef CONFIG_6xx
157 low_choose_750fx_pll(low_speed);
158#endif
159 if (low_speed == 1) {
160 /* tweak L2 for low voltage */
161 if (has_cpu_l2lve) {
162 hid2 = mfspr(SPRN_HID2);
163 hid2 |= 0x2000;
164 mtspr(SPRN_HID2, hid2);
165 }
166
167 /* ramping down, set voltage last */
168 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04);
169 local_delay(10);
170 }
171
172 return 0;
173}
174
175static unsigned int cpu_750fx_get_cpu_speed(void)
176{
177 if (mfspr(SPRN_HID1) & HID1_PS)
178 return low_freq;
179 else
180 return hi_freq;
181}
182
183/* Switch CPU speed using DFS */
184static int dfs_set_cpu_speed(int low_speed)
185{
186 if (low_speed == 0) {
187 /* ramping up, set voltage first */
188 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05);
189 /* Make sure we sleep for at least 1ms */
190 local_delay(1);
191 }
192
193 /* set frequency */
194#ifdef CONFIG_6xx
195 low_choose_7447a_dfs(low_speed);
196#endif
197 udelay(100);
198
199 if (low_speed == 1) {
200 /* ramping down, set voltage last */
201 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04);
202 local_delay(1);
203 }
204
205 return 0;
206}
207
208static unsigned int dfs_get_cpu_speed(void)
209{
210 if (mfspr(SPRN_HID1) & HID1_DFS)
211 return low_freq;
212 else
213 return hi_freq;
214}
215
216
217/* Switch CPU speed using slewing GPIOs
218 */
219static int gpios_set_cpu_speed(int low_speed)
220{
221 int gpio, timeout = 0;
222
223 /* If ramping up, set voltage first */
224 if (low_speed == 0) {
225 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x05);
226 /* Delay is way too big but it's ok, we schedule */
227 local_delay(10);
228 }
229
230 /* Set frequency */
231 gpio = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, frequency_gpio, 0);
232 if (low_speed == ((gpio & 0x01) == 0))
233 goto skip;
234
235 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, frequency_gpio,
236 low_speed ? 0x04 : 0x05);
237 udelay(200);
238 do {
239 if (++timeout > 100)
240 break;
241 local_delay(1);
242 gpio = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, slew_done_gpio, 0);
243 } while((gpio & 0x02) == 0);
244 skip:
245 /* If ramping down, set voltage last */
246 if (low_speed == 1) {
247 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, voltage_gpio, 0x04);
248 /* Delay is way too big but it's ok, we schedule */
249 local_delay(10);
250 }
251
252#ifdef DEBUG_FREQ
253 debug_calc_bogomips();
254#endif
255
256 return 0;
257}
258
259/* Switch CPU speed under PMU control
260 */
261static int pmu_set_cpu_speed(int low_speed)
262{
263 struct adb_request req;
264 unsigned long save_l2cr;
265 unsigned long save_l3cr;
266 unsigned int pic_prio;
267 unsigned long flags;
268
269 preempt_disable();
270
271#ifdef DEBUG_FREQ
272 printk(KERN_DEBUG "HID1, before: %x\n", mfspr(SPRN_HID1));
273#endif
274 pmu_suspend();
275
276 /* Disable all interrupt sources on openpic */
277 pic_prio = openpic_get_priority();
278 openpic_set_priority(0xf);
279
280 /* Make sure the decrementer won't interrupt us */
281 asm volatile("mtdec %0" : : "r" (0x7fffffff));
282 /* Make sure any pending DEC interrupt occuring while we did
283 * the above didn't re-enable the DEC */
284 mb();
285 asm volatile("mtdec %0" : : "r" (0x7fffffff));
286
287 /* We can now disable MSR_EE */
288 local_irq_save(flags);
289
290 /* Giveup the FPU & vec */
291 enable_kernel_fp();
292
293#ifdef CONFIG_ALTIVEC
294 if (cpu_has_feature(CPU_FTR_ALTIVEC))
295 enable_kernel_altivec();
296#endif /* CONFIG_ALTIVEC */
297
298 /* Save & disable L2 and L3 caches */
299 save_l3cr = _get_L3CR(); /* (returns -1 if not available) */
300 save_l2cr = _get_L2CR(); /* (returns -1 if not available) */
301
302 /* Send the new speed command. My assumption is that this command
303 * will cause PLL_CFG[0..3] to be changed next time CPU goes to sleep
304 */
305 pmu_request(&req, NULL, 6, PMU_CPU_SPEED, 'W', 'O', 'O', 'F', low_speed);
306 while (!req.complete)
307 pmu_poll();
308
309 /* Prepare the northbridge for the speed transition */
310 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,1);
311
312 /* Call low level code to backup CPU state and recover from
313 * hardware reset
314 */
315 low_sleep_handler();
316
317 /* Restore the northbridge */
318 pmac_call_feature(PMAC_FTR_SLEEP_STATE,NULL,1,0);
319
320 /* Restore L2 cache */
321 if (save_l2cr != 0xffffffff && (save_l2cr & L2CR_L2E) != 0)
322 _set_L2CR(save_l2cr);
323 /* Restore L3 cache */
324 if (save_l3cr != 0xffffffff && (save_l3cr & L3CR_L3E) != 0)
325 _set_L3CR(save_l3cr);
326
327 /* Restore userland MMU context */
328 set_context(current->active_mm->context, current->active_mm->pgd);
329
330#ifdef DEBUG_FREQ
331 printk(KERN_DEBUG "HID1, after: %x\n", mfspr(SPRN_HID1));
332#endif
333
334 /* Restore low level PMU operations */
335 pmu_unlock();
336
337 /* Restore decrementer */
338 wakeup_decrementer();
339
340 /* Restore interrupts */
341 openpic_set_priority(pic_prio);
342
343 /* Let interrupts flow again ... */
344 local_irq_restore(flags);
345
346#ifdef DEBUG_FREQ
347 debug_calc_bogomips();
348#endif
349
350 pmu_resume();
351
352 preempt_enable();
353
354 return 0;
355}
356
357static int do_set_cpu_speed(int speed_mode, int notify)
358{
359 struct cpufreq_freqs freqs;
360 unsigned long l3cr;
361 static unsigned long prev_l3cr;
362
363 freqs.old = cur_freq;
364 freqs.new = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq;
365 freqs.cpu = smp_processor_id();
366
367 if (freqs.old == freqs.new)
368 return 0;
369
370 if (notify)
371 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
372 if (speed_mode == CPUFREQ_LOW &&
373 cpu_has_feature(CPU_FTR_L3CR)) {
374 l3cr = _get_L3CR();
375 if (l3cr & L3CR_L3E) {
376 prev_l3cr = l3cr;
377 _set_L3CR(0);
378 }
379 }
380 set_speed_proc(speed_mode == CPUFREQ_LOW);
381 if (speed_mode == CPUFREQ_HIGH &&
382 cpu_has_feature(CPU_FTR_L3CR)) {
383 l3cr = _get_L3CR();
384 if ((prev_l3cr & L3CR_L3E) && l3cr != prev_l3cr)
385 _set_L3CR(prev_l3cr);
386 }
387 if (notify)
388 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
389 cur_freq = (speed_mode == CPUFREQ_HIGH) ? hi_freq : low_freq;
390
391 return 0;
392}
393
394static unsigned int pmac_cpufreq_get_speed(unsigned int cpu)
395{
396 return cur_freq;
397}
398
399static int pmac_cpufreq_verify(struct cpufreq_policy *policy)
400{
401 return cpufreq_frequency_table_verify(policy, pmac_cpu_freqs);
402}
403
404static int pmac_cpufreq_target( struct cpufreq_policy *policy,
405 unsigned int target_freq,
406 unsigned int relation)
407{
408 unsigned int newstate = 0;
409
410 if (cpufreq_frequency_table_target(policy, pmac_cpu_freqs,
411 target_freq, relation, &newstate))
412 return -EINVAL;
413
414 return do_set_cpu_speed(newstate, 1);
415}
416
417unsigned int pmac_get_one_cpufreq(int i)
418{
419 /* Supports only one CPU for now */
420 return (i == 0) ? cur_freq : 0;
421}
422
423static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy)
424{
425 if (policy->cpu != 0)
426 return -ENODEV;
427
428 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
429 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
430 policy->cur = cur_freq;
431
432 cpufreq_frequency_table_get_attr(pmac_cpu_freqs, policy->cpu);
433 return cpufreq_frequency_table_cpuinfo(policy, pmac_cpu_freqs);
434}
435
436static u32 read_gpio(struct device_node *np)
437{
438 u32 *reg = (u32 *)get_property(np, "reg", NULL);
439 u32 offset;
440
441 if (reg == NULL)
442 return 0;
443 /* That works for all keylargos but shall be fixed properly
444 * some day... The problem is that it seems we can't rely
445 * on the "reg" property of the GPIO nodes, they are either
446 * relative to the base of KeyLargo or to the base of the
447 * GPIO space, and the device-tree doesn't help.
448 */
449 offset = *reg;
450 if (offset < KEYLARGO_GPIO_LEVELS0)
451 offset += KEYLARGO_GPIO_LEVELS0;
452 return offset;
453}
454
455static int pmac_cpufreq_suspend(struct cpufreq_policy *policy, pm_message_t pmsg)
456{
457 /* Ok, this could be made a bit smarter, but let's be robust for now. We
458 * always force a speed change to high speed before sleep, to make sure
459 * we have appropriate voltage and/or bus speed for the wakeup process,
460 * and to make sure our loops_per_jiffies are "good enough", that is will
461 * not cause too short delays if we sleep in low speed and wake in high
462 * speed..
463 */
464 no_schedule = 1;
465 sleep_freq = cur_freq;
466 if (cur_freq == low_freq && !is_pmu_based)
467 do_set_cpu_speed(CPUFREQ_HIGH, 0);
468 return 0;
469}
470
471static int pmac_cpufreq_resume(struct cpufreq_policy *policy)
472{
473 /* If we resume, first check if we have a get() function */
474 if (get_speed_proc)
475 cur_freq = get_speed_proc();
476 else
477 cur_freq = 0;
478
479 /* We don't, hrm... we don't really know our speed here, best
480 * is that we force a switch to whatever it was, which is
481 * probably high speed due to our suspend() routine
482 */
483 do_set_cpu_speed(sleep_freq == low_freq ?
484 CPUFREQ_LOW : CPUFREQ_HIGH, 0);
485
486 no_schedule = 0;
487 return 0;
488}
489
490static struct cpufreq_driver pmac_cpufreq_driver = {
491 .verify = pmac_cpufreq_verify,
492 .target = pmac_cpufreq_target,
493 .get = pmac_cpufreq_get_speed,
494 .init = pmac_cpufreq_cpu_init,
495 .suspend = pmac_cpufreq_suspend,
496 .resume = pmac_cpufreq_resume,
497 .flags = CPUFREQ_PM_NO_WARN,
498 .attr = pmac_cpu_freqs_attr,
499 .name = "powermac",
500 .owner = THIS_MODULE,
501};
502
503
504static int pmac_cpufreq_init_MacRISC3(struct device_node *cpunode)
505{
506 struct device_node *volt_gpio_np = of_find_node_by_name(NULL,
507 "voltage-gpio");
508 struct device_node *freq_gpio_np = of_find_node_by_name(NULL,
509 "frequency-gpio");
510 struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL,
511 "slewing-done");
512 u32 *value;
513
514 /*
515 * Check to see if it's GPIO driven or PMU only
516 *
517 * The way we extract the GPIO address is slightly hackish, but it
518 * works well enough for now. We need to abstract the whole GPIO
519 * stuff sooner or later anyway
520 */
521
522 if (volt_gpio_np)
523 voltage_gpio = read_gpio(volt_gpio_np);
524 if (freq_gpio_np)
525 frequency_gpio = read_gpio(freq_gpio_np);
526 if (slew_done_gpio_np)
527 slew_done_gpio = read_gpio(slew_done_gpio_np);
528
529 /* If we use the frequency GPIOs, calculate the min/max speeds based
530 * on the bus frequencies
531 */
532 if (frequency_gpio && slew_done_gpio) {
533 int lenp, rc;
534 u32 *freqs, *ratio;
535
536 freqs = (u32 *)get_property(cpunode, "bus-frequencies", &lenp);
537 lenp /= sizeof(u32);
538 if (freqs == NULL || lenp != 2) {
539 printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n");
540 return 1;
541 }
542 ratio = (u32 *)get_property(cpunode, "processor-to-bus-ratio*2", NULL);
543 if (ratio == NULL) {
544 printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n");
545 return 1;
546 }
547
548 /* Get the min/max bus frequencies */
549 low_freq = min(freqs[0], freqs[1]);
550 hi_freq = max(freqs[0], freqs[1]);
551
552 /* Grrrr.. It _seems_ that the device-tree is lying on the low bus
553 * frequency, it claims it to be around 84Mhz on some models while
554 * it appears to be approx. 101Mhz on all. Let's hack around here...
555 * fortunately, we don't need to be too precise
556 */
557 if (low_freq < 98000000)
558 low_freq = 101000000;
559
560 /* Convert those to CPU core clocks */
561 low_freq = (low_freq * (*ratio)) / 2000;
562 hi_freq = (hi_freq * (*ratio)) / 2000;
563
564 /* Now we get the frequencies, we read the GPIO to see what is out current
565 * speed
566 */
567 rc = pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, frequency_gpio, 0);
568 cur_freq = (rc & 0x01) ? hi_freq : low_freq;
569
570 set_speed_proc = gpios_set_cpu_speed;
571 return 1;
572 }
573
574 /* If we use the PMU, look for the min & max frequencies in the
575 * device-tree
576 */
577 value = (u32 *)get_property(cpunode, "min-clock-frequency", NULL);
578 if (!value)
579 return 1;
580 low_freq = (*value) / 1000;
581 /* The PowerBook G4 12" (PowerBook6,1) has an error in the device-tree
582 * here */
583 if (low_freq < 100000)
584 low_freq *= 10;
585
586 value = (u32 *)get_property(cpunode, "max-clock-frequency", NULL);
587 if (!value)
588 return 1;
589 hi_freq = (*value) / 1000;
590 set_speed_proc = pmu_set_cpu_speed;
591 is_pmu_based = 1;
592
593 return 0;
594}
595
596static int pmac_cpufreq_init_7447A(struct device_node *cpunode)
597{
598 struct device_node *volt_gpio_np;
599
600 if (get_property(cpunode, "dynamic-power-step", NULL) == NULL)
601 return 1;
602
603 volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select");
604 if (volt_gpio_np)
605 voltage_gpio = read_gpio(volt_gpio_np);
606 if (!voltage_gpio){
607 printk(KERN_ERR "cpufreq: missing cpu-vcore-select gpio\n");
608 return 1;
609 }
610
611 /* OF only reports the high frequency */
612 hi_freq = cur_freq;
613 low_freq = cur_freq/2;
614
615 /* Read actual frequency from CPU */
616 cur_freq = dfs_get_cpu_speed();
617 set_speed_proc = dfs_set_cpu_speed;
618 get_speed_proc = dfs_get_cpu_speed;
619
620 return 0;
621}
622
623static int pmac_cpufreq_init_750FX(struct device_node *cpunode)
624{
625 struct device_node *volt_gpio_np;
626 u32 pvr, *value;
627
628 if (get_property(cpunode, "dynamic-power-step", NULL) == NULL)
629 return 1;
630
631 hi_freq = cur_freq;
632 value = (u32 *)get_property(cpunode, "reduced-clock-frequency", NULL);
633 if (!value)
634 return 1;
635 low_freq = (*value) / 1000;
636
637 volt_gpio_np = of_find_node_by_name(NULL, "cpu-vcore-select");
638 if (volt_gpio_np)
639 voltage_gpio = read_gpio(volt_gpio_np);
640
641 pvr = mfspr(SPRN_PVR);
642 has_cpu_l2lve = !((pvr & 0xf00) == 0x100);
643
644 set_speed_proc = cpu_750fx_cpu_speed;
645 get_speed_proc = cpu_750fx_get_cpu_speed;
646 cur_freq = cpu_750fx_get_cpu_speed();
647
648 return 0;
649}
650
651/* Currently, we support the following machines:
652 *
653 * - Titanium PowerBook 1Ghz (PMU based, 667Mhz & 1Ghz)
654 * - Titanium PowerBook 800 (PMU based, 667Mhz & 800Mhz)
655 * - Titanium PowerBook 400 (PMU based, 300Mhz & 400Mhz)
656 * - Titanium PowerBook 500 (PMU based, 300Mhz & 500Mhz)
657 * - iBook2 500/600 (PMU based, 400Mhz & 500/600Mhz)
658 * - iBook2 700 (CPU based, 400Mhz & 700Mhz, support low voltage)
659 * - Recent MacRISC3 laptops
660 * - All new machines with 7447A CPUs
661 */
662static int __init pmac_cpufreq_setup(void)
663{
664 struct device_node *cpunode;
665 u32 *value;
666
667 if (strstr(cmd_line, "nocpufreq"))
668 return 0;
669
670 /* Assume only one CPU */
671 cpunode = find_type_devices("cpu");
672 if (!cpunode)
673 goto out;
674
675 /* Get current cpu clock freq */
676 value = (u32 *)get_property(cpunode, "clock-frequency", NULL);
677 if (!value)
678 goto out;
679 cur_freq = (*value) / 1000;
680
681 /* Check for 7447A based MacRISC3 */
682 if (machine_is_compatible("MacRISC3") &&
683 get_property(cpunode, "dynamic-power-step", NULL) &&
684 PVR_VER(mfspr(SPRN_PVR)) == 0x8003) {
685 pmac_cpufreq_init_7447A(cpunode);
686 /* Check for other MacRISC3 machines */
687 } else if (machine_is_compatible("PowerBook3,4") ||
688 machine_is_compatible("PowerBook3,5") ||
689 machine_is_compatible("MacRISC3")) {
690 pmac_cpufreq_init_MacRISC3(cpunode);
691 /* Else check for iBook2 500/600 */
692 } else if (machine_is_compatible("PowerBook4,1")) {
693 hi_freq = cur_freq;
694 low_freq = 400000;
695 set_speed_proc = pmu_set_cpu_speed;
696 is_pmu_based = 1;
697 }
698 /* Else check for TiPb 550 */
699 else if (machine_is_compatible("PowerBook3,3") && cur_freq == 550000) {
700 hi_freq = cur_freq;
701 low_freq = 500000;
702 set_speed_proc = pmu_set_cpu_speed;
703 is_pmu_based = 1;
704 }
705 /* Else check for TiPb 400 & 500 */
706 else if (machine_is_compatible("PowerBook3,2")) {
707 /* We only know about the 400 MHz and the 500Mhz model
708 * they both have 300 MHz as low frequency
709 */
710 if (cur_freq < 350000 || cur_freq > 550000)
711 goto out;
712 hi_freq = cur_freq;
713 low_freq = 300000;
714 set_speed_proc = pmu_set_cpu_speed;
715 is_pmu_based = 1;
716 }
717 /* Else check for 750FX */
718 else if (PVR_VER(mfspr(SPRN_PVR)) == 0x7000)
719 pmac_cpufreq_init_750FX(cpunode);
720out:
721 if (set_speed_proc == NULL)
722 return -ENODEV;
723
724 pmac_cpu_freqs[CPUFREQ_LOW].frequency = low_freq;
725 pmac_cpu_freqs[CPUFREQ_HIGH].frequency = hi_freq;
726
727 printk(KERN_INFO "Registering PowerMac CPU frequency driver\n");
728 printk(KERN_INFO "Low: %d Mhz, High: %d Mhz, Boot: %d Mhz\n",
729 low_freq/1000, hi_freq/1000, cur_freq/1000);
730
731 return cpufreq_register_driver(&pmac_cpufreq_driver);
732}
733
734module_init(pmac_cpufreq_setup);
735
diff --git a/arch/ppc/platforms/pmac_feature.c b/arch/ppc/platforms/pmac_feature.c
deleted file mode 100644
index 1e69b0593162..000000000000
--- a/arch/ppc/platforms/pmac_feature.c
+++ /dev/null
@@ -1,3013 +0,0 @@
1/*
2 * arch/ppc/platforms/pmac_feature.c
3 *
4 * Copyright (C) 1996-2001 Paul Mackerras (paulus@cs.anu.edu.au)
5 * Ben. Herrenschmidt (benh@kernel.crashing.org)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 * TODO:
13 *
14 * - Replace mdelay with some schedule loop if possible
15 * - Shorten some obfuscated delays on some routines (like modem
16 * power)
17 * - Refcount some clocks (see darwin)
18 * - Split split split...
19 *
20 */
21#include <linux/config.h>
22#include <linux/types.h>
23#include <linux/init.h>
24#include <linux/delay.h>
25#include <linux/kernel.h>
26#include <linux/sched.h>
27#include <linux/spinlock.h>
28#include <linux/adb.h>
29#include <linux/pmu.h>
30#include <linux/ioport.h>
31#include <linux/pci.h>
32#include <asm/sections.h>
33#include <asm/errno.h>
34#include <asm/ohare.h>
35#include <asm/heathrow.h>
36#include <asm/keylargo.h>
37#include <asm/uninorth.h>
38#include <asm/io.h>
39#include <asm/prom.h>
40#include <asm/machdep.h>
41#include <asm/pmac_feature.h>
42#include <asm/dbdma.h>
43#include <asm/pci-bridge.h>
44#include <asm/pmac_low_i2c.h>
45
46#undef DEBUG_FEATURE
47
48#ifdef DEBUG_FEATURE
49#define DBG(fmt,...) printk(KERN_DEBUG fmt)
50#else
51#define DBG(fmt,...)
52#endif
53
54#ifdef CONFIG_6xx
55extern int powersave_lowspeed;
56#endif
57
58extern int powersave_nap;
59extern struct device_node *k2_skiplist[2];
60
61
62/*
63 * We use a single global lock to protect accesses. Each driver has
64 * to take care of its own locking
65 */
66static DEFINE_SPINLOCK(feature_lock);
67
68#define LOCK(flags) spin_lock_irqsave(&feature_lock, flags);
69#define UNLOCK(flags) spin_unlock_irqrestore(&feature_lock, flags);
70
71
72/*
73 * Instance of some macio stuffs
74 */
75struct macio_chip macio_chips[MAX_MACIO_CHIPS];
76
77struct macio_chip* macio_find(struct device_node* child, int type)
78{
79 while(child) {
80 int i;
81
82 for (i=0; i < MAX_MACIO_CHIPS && macio_chips[i].of_node; i++)
83 if (child == macio_chips[i].of_node &&
84 (!type || macio_chips[i].type == type))
85 return &macio_chips[i];
86 child = child->parent;
87 }
88 return NULL;
89}
90EXPORT_SYMBOL_GPL(macio_find);
91
92static const char* macio_names[] =
93{
94 "Unknown",
95 "Grand Central",
96 "OHare",
97 "OHareII",
98 "Heathrow",
99 "Gatwick",
100 "Paddington",
101 "Keylargo",
102 "Pangea",
103 "Intrepid",
104 "K2"
105};
106
107
108
109/*
110 * Uninorth reg. access. Note that Uni-N regs are big endian
111 */
112
113#define UN_REG(r) (uninorth_base + ((r) >> 2))
114#define UN_IN(r) (in_be32(UN_REG(r)))
115#define UN_OUT(r,v) (out_be32(UN_REG(r), (v)))
116#define UN_BIS(r,v) (UN_OUT((r), UN_IN(r) | (v)))
117#define UN_BIC(r,v) (UN_OUT((r), UN_IN(r) & ~(v)))
118
119static struct device_node* uninorth_node;
120static u32 __iomem * uninorth_base;
121static u32 uninorth_rev;
122static int uninorth_u3;
123static void __iomem *u3_ht;
124
125/*
126 * For each motherboard family, we have a table of functions pointers
127 * that handle the various features.
128 */
129
130typedef long (*feature_call)(struct device_node* node, long param, long value);
131
132struct feature_table_entry {
133 unsigned int selector;
134 feature_call function;
135};
136
137struct pmac_mb_def
138{
139 const char* model_string;
140 const char* model_name;
141 int model_id;
142 struct feature_table_entry* features;
143 unsigned long board_flags;
144};
145static struct pmac_mb_def pmac_mb;
146
147/*
148 * Here are the chip specific feature functions
149 */
150
151static inline int
152simple_feature_tweak(struct device_node* node, int type, int reg, u32 mask, int value)
153{
154 struct macio_chip* macio;
155 unsigned long flags;
156
157 macio = macio_find(node, type);
158 if (!macio)
159 return -ENODEV;
160 LOCK(flags);
161 if (value)
162 MACIO_BIS(reg, mask);
163 else
164 MACIO_BIC(reg, mask);
165 (void)MACIO_IN32(reg);
166 UNLOCK(flags);
167
168 return 0;
169}
170
171#ifndef CONFIG_POWER4
172
173static long
174ohare_htw_scc_enable(struct device_node* node, long param, long value)
175{
176 struct macio_chip* macio;
177 unsigned long chan_mask;
178 unsigned long fcr;
179 unsigned long flags;
180 int htw, trans;
181 unsigned long rmask;
182
183 macio = macio_find(node, 0);
184 if (!macio)
185 return -ENODEV;
186 if (!strcmp(node->name, "ch-a"))
187 chan_mask = MACIO_FLAG_SCCA_ON;
188 else if (!strcmp(node->name, "ch-b"))
189 chan_mask = MACIO_FLAG_SCCB_ON;
190 else
191 return -ENODEV;
192
193 htw = (macio->type == macio_heathrow || macio->type == macio_paddington
194 || macio->type == macio_gatwick);
195 /* On these machines, the HRW_SCC_TRANS_EN_N bit mustn't be touched */
196 trans = (pmac_mb.model_id != PMAC_TYPE_YOSEMITE &&
197 pmac_mb.model_id != PMAC_TYPE_YIKES);
198 if (value) {
199#ifdef CONFIG_ADB_PMU
200 if ((param & 0xfff) == PMAC_SCC_IRDA)
201 pmu_enable_irled(1);
202#endif /* CONFIG_ADB_PMU */
203 LOCK(flags);
204 fcr = MACIO_IN32(OHARE_FCR);
205 /* Check if scc cell need enabling */
206 if (!(fcr & OH_SCC_ENABLE)) {
207 fcr |= OH_SCC_ENABLE;
208 if (htw) {
209 /* Side effect: this will also power up the
210 * modem, but it's too messy to figure out on which
211 * ports this controls the tranceiver and on which
212 * it controls the modem
213 */
214 if (trans)
215 fcr &= ~HRW_SCC_TRANS_EN_N;
216 MACIO_OUT32(OHARE_FCR, fcr);
217 fcr |= (rmask = HRW_RESET_SCC);
218 MACIO_OUT32(OHARE_FCR, fcr);
219 } else {
220 fcr |= (rmask = OH_SCC_RESET);
221 MACIO_OUT32(OHARE_FCR, fcr);
222 }
223 UNLOCK(flags);
224 (void)MACIO_IN32(OHARE_FCR);
225 mdelay(15);
226 LOCK(flags);
227 fcr &= ~rmask;
228 MACIO_OUT32(OHARE_FCR, fcr);
229 }
230 if (chan_mask & MACIO_FLAG_SCCA_ON)
231 fcr |= OH_SCCA_IO;
232 if (chan_mask & MACIO_FLAG_SCCB_ON)
233 fcr |= OH_SCCB_IO;
234 MACIO_OUT32(OHARE_FCR, fcr);
235 macio->flags |= chan_mask;
236 UNLOCK(flags);
237 if (param & PMAC_SCC_FLAG_XMON)
238 macio->flags |= MACIO_FLAG_SCC_LOCKED;
239 } else {
240 if (macio->flags & MACIO_FLAG_SCC_LOCKED)
241 return -EPERM;
242 LOCK(flags);
243 fcr = MACIO_IN32(OHARE_FCR);
244 if (chan_mask & MACIO_FLAG_SCCA_ON)
245 fcr &= ~OH_SCCA_IO;
246 if (chan_mask & MACIO_FLAG_SCCB_ON)
247 fcr &= ~OH_SCCB_IO;
248 MACIO_OUT32(OHARE_FCR, fcr);
249 if ((fcr & (OH_SCCA_IO | OH_SCCB_IO)) == 0) {
250 fcr &= ~OH_SCC_ENABLE;
251 if (htw && trans)
252 fcr |= HRW_SCC_TRANS_EN_N;
253 MACIO_OUT32(OHARE_FCR, fcr);
254 }
255 macio->flags &= ~(chan_mask);
256 UNLOCK(flags);
257 mdelay(10);
258#ifdef CONFIG_ADB_PMU
259 if ((param & 0xfff) == PMAC_SCC_IRDA)
260 pmu_enable_irled(0);
261#endif /* CONFIG_ADB_PMU */
262 }
263 return 0;
264}
265
266static long
267ohare_floppy_enable(struct device_node* node, long param, long value)
268{
269 return simple_feature_tweak(node, macio_ohare,
270 OHARE_FCR, OH_FLOPPY_ENABLE, value);
271}
272
273static long
274ohare_mesh_enable(struct device_node* node, long param, long value)
275{
276 return simple_feature_tweak(node, macio_ohare,
277 OHARE_FCR, OH_MESH_ENABLE, value);
278}
279
280static long
281ohare_ide_enable(struct device_node* node, long param, long value)
282{
283 switch(param) {
284 case 0:
285 /* For some reason, setting the bit in set_initial_features()
286 * doesn't stick. I'm still investigating... --BenH.
287 */
288 if (value)
289 simple_feature_tweak(node, macio_ohare,
290 OHARE_FCR, OH_IOBUS_ENABLE, 1);
291 return simple_feature_tweak(node, macio_ohare,
292 OHARE_FCR, OH_IDE0_ENABLE, value);
293 case 1:
294 return simple_feature_tweak(node, macio_ohare,
295 OHARE_FCR, OH_BAY_IDE_ENABLE, value);
296 default:
297 return -ENODEV;
298 }
299}
300
301static long
302ohare_ide_reset(struct device_node* node, long param, long value)
303{
304 switch(param) {
305 case 0:
306 return simple_feature_tweak(node, macio_ohare,
307 OHARE_FCR, OH_IDE0_RESET_N, !value);
308 case 1:
309 return simple_feature_tweak(node, macio_ohare,
310 OHARE_FCR, OH_IDE1_RESET_N, !value);
311 default:
312 return -ENODEV;
313 }
314}
315
316static long
317ohare_sleep_state(struct device_node* node, long param, long value)
318{
319 struct macio_chip* macio = &macio_chips[0];
320
321 if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0)
322 return -EPERM;
323 if (value == 1) {
324 MACIO_BIC(OHARE_FCR, OH_IOBUS_ENABLE);
325 } else if (value == 0) {
326 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE);
327 }
328
329 return 0;
330}
331
332static long
333heathrow_modem_enable(struct device_node* node, long param, long value)
334{
335 struct macio_chip* macio;
336 u8 gpio;
337 unsigned long flags;
338
339 macio = macio_find(node, macio_unknown);
340 if (!macio)
341 return -ENODEV;
342 gpio = MACIO_IN8(HRW_GPIO_MODEM_RESET) & ~1;
343 if (!value) {
344 LOCK(flags);
345 MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio);
346 UNLOCK(flags);
347 (void)MACIO_IN8(HRW_GPIO_MODEM_RESET);
348 mdelay(250);
349 }
350 if (pmac_mb.model_id != PMAC_TYPE_YOSEMITE &&
351 pmac_mb.model_id != PMAC_TYPE_YIKES) {
352 LOCK(flags);
353 if (value)
354 MACIO_BIC(HEATHROW_FCR, HRW_SCC_TRANS_EN_N);
355 else
356 MACIO_BIS(HEATHROW_FCR, HRW_SCC_TRANS_EN_N);
357 UNLOCK(flags);
358 (void)MACIO_IN32(HEATHROW_FCR);
359 mdelay(250);
360 }
361 if (value) {
362 LOCK(flags);
363 MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio | 1);
364 (void)MACIO_IN8(HRW_GPIO_MODEM_RESET);
365 UNLOCK(flags); mdelay(250); LOCK(flags);
366 MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio);
367 (void)MACIO_IN8(HRW_GPIO_MODEM_RESET);
368 UNLOCK(flags); mdelay(250); LOCK(flags);
369 MACIO_OUT8(HRW_GPIO_MODEM_RESET, gpio | 1);
370 (void)MACIO_IN8(HRW_GPIO_MODEM_RESET);
371 UNLOCK(flags); mdelay(250);
372 }
373 return 0;
374}
375
376static long
377heathrow_floppy_enable(struct device_node* node, long param, long value)
378{
379 return simple_feature_tweak(node, macio_unknown,
380 HEATHROW_FCR,
381 HRW_SWIM_ENABLE|HRW_BAY_FLOPPY_ENABLE,
382 value);
383}
384
385static long
386heathrow_mesh_enable(struct device_node* node, long param, long value)
387{
388 struct macio_chip* macio;
389 unsigned long flags;
390
391 macio = macio_find(node, macio_unknown);
392 if (!macio)
393 return -ENODEV;
394 LOCK(flags);
395 /* Set clear mesh cell enable */
396 if (value)
397 MACIO_BIS(HEATHROW_FCR, HRW_MESH_ENABLE);
398 else
399 MACIO_BIC(HEATHROW_FCR, HRW_MESH_ENABLE);
400 (void)MACIO_IN32(HEATHROW_FCR);
401 udelay(10);
402 /* Set/Clear termination power */
403 if (value)
404 MACIO_BIC(HEATHROW_MBCR, 0x04000000);
405 else
406 MACIO_BIS(HEATHROW_MBCR, 0x04000000);
407 (void)MACIO_IN32(HEATHROW_MBCR);
408 udelay(10);
409 UNLOCK(flags);
410
411 return 0;
412}
413
414static long
415heathrow_ide_enable(struct device_node* node, long param, long value)
416{
417 switch(param) {
418 case 0:
419 return simple_feature_tweak(node, macio_unknown,
420 HEATHROW_FCR, HRW_IDE0_ENABLE, value);
421 case 1:
422 return simple_feature_tweak(node, macio_unknown,
423 HEATHROW_FCR, HRW_BAY_IDE_ENABLE, value);
424 default:
425 return -ENODEV;
426 }
427}
428
429static long
430heathrow_ide_reset(struct device_node* node, long param, long value)
431{
432 switch(param) {
433 case 0:
434 return simple_feature_tweak(node, macio_unknown,
435 HEATHROW_FCR, HRW_IDE0_RESET_N, !value);
436 case 1:
437 return simple_feature_tweak(node, macio_unknown,
438 HEATHROW_FCR, HRW_IDE1_RESET_N, !value);
439 default:
440 return -ENODEV;
441 }
442}
443
444static long
445heathrow_bmac_enable(struct device_node* node, long param, long value)
446{
447 struct macio_chip* macio;
448 unsigned long flags;
449
450 macio = macio_find(node, 0);
451 if (!macio)
452 return -ENODEV;
453 if (value) {
454 LOCK(flags);
455 MACIO_BIS(HEATHROW_FCR, HRW_BMAC_IO_ENABLE);
456 MACIO_BIS(HEATHROW_FCR, HRW_BMAC_RESET);
457 UNLOCK(flags);
458 (void)MACIO_IN32(HEATHROW_FCR);
459 mdelay(10);
460 LOCK(flags);
461 MACIO_BIC(HEATHROW_FCR, HRW_BMAC_RESET);
462 UNLOCK(flags);
463 (void)MACIO_IN32(HEATHROW_FCR);
464 mdelay(10);
465 } else {
466 LOCK(flags);
467 MACIO_BIC(HEATHROW_FCR, HRW_BMAC_IO_ENABLE);
468 UNLOCK(flags);
469 }
470 return 0;
471}
472
473static long
474heathrow_sound_enable(struct device_node* node, long param, long value)
475{
476 struct macio_chip* macio;
477 unsigned long flags;
478
479 /* B&W G3 and Yikes don't support that properly (the
480 * sound appear to never come back after beeing shut down).
481 */
482 if (pmac_mb.model_id == PMAC_TYPE_YOSEMITE ||
483 pmac_mb.model_id == PMAC_TYPE_YIKES)
484 return 0;
485
486 macio = macio_find(node, 0);
487 if (!macio)
488 return -ENODEV;
489 if (value) {
490 LOCK(flags);
491 MACIO_BIS(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE);
492 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_POWER_N);
493 UNLOCK(flags);
494 (void)MACIO_IN32(HEATHROW_FCR);
495 } else {
496 LOCK(flags);
497 MACIO_BIS(HEATHROW_FCR, HRW_SOUND_POWER_N);
498 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE);
499 UNLOCK(flags);
500 }
501 return 0;
502}
503
504static u32 save_fcr[6];
505static u32 save_mbcr;
506static u32 save_gpio_levels[2];
507static u8 save_gpio_extint[KEYLARGO_GPIO_EXTINT_CNT];
508static u8 save_gpio_normal[KEYLARGO_GPIO_CNT];
509static u32 save_unin_clock_ctl;
510static struct dbdma_regs save_dbdma[13];
511static struct dbdma_regs save_alt_dbdma[13];
512
513static void
514dbdma_save(struct macio_chip* macio, struct dbdma_regs* save)
515{
516 int i;
517
518 /* Save state & config of DBDMA channels */
519 for (i=0; i<13; i++) {
520 volatile struct dbdma_regs __iomem * chan = (void __iomem *)
521 (macio->base + ((0x8000+i*0x100)>>2));
522 save[i].cmdptr_hi = in_le32(&chan->cmdptr_hi);
523 save[i].cmdptr = in_le32(&chan->cmdptr);
524 save[i].intr_sel = in_le32(&chan->intr_sel);
525 save[i].br_sel = in_le32(&chan->br_sel);
526 save[i].wait_sel = in_le32(&chan->wait_sel);
527 }
528}
529
530static void
531dbdma_restore(struct macio_chip* macio, struct dbdma_regs* save)
532{
533 int i;
534
535 /* Save state & config of DBDMA channels */
536 for (i=0; i<13; i++) {
537 volatile struct dbdma_regs __iomem * chan = (void __iomem *)
538 (macio->base + ((0x8000+i*0x100)>>2));
539 out_le32(&chan->control, (ACTIVE|DEAD|WAKE|FLUSH|PAUSE|RUN)<<16);
540 while (in_le32(&chan->status) & ACTIVE)
541 mb();
542 out_le32(&chan->cmdptr_hi, save[i].cmdptr_hi);
543 out_le32(&chan->cmdptr, save[i].cmdptr);
544 out_le32(&chan->intr_sel, save[i].intr_sel);
545 out_le32(&chan->br_sel, save[i].br_sel);
546 out_le32(&chan->wait_sel, save[i].wait_sel);
547 }
548}
549
550static void
551heathrow_sleep(struct macio_chip* macio, int secondary)
552{
553 if (secondary) {
554 dbdma_save(macio, save_alt_dbdma);
555 save_fcr[2] = MACIO_IN32(0x38);
556 save_fcr[3] = MACIO_IN32(0x3c);
557 } else {
558 dbdma_save(macio, save_dbdma);
559 save_fcr[0] = MACIO_IN32(0x38);
560 save_fcr[1] = MACIO_IN32(0x3c);
561 save_mbcr = MACIO_IN32(0x34);
562 /* Make sure sound is shut down */
563 MACIO_BIS(HEATHROW_FCR, HRW_SOUND_POWER_N);
564 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE);
565 /* This seems to be necessary as well or the fan
566 * keeps coming up and battery drains fast */
567 MACIO_BIC(HEATHROW_FCR, HRW_IOBUS_ENABLE);
568 MACIO_BIC(HEATHROW_FCR, HRW_IDE0_RESET_N);
569 /* Make sure eth is down even if module or sleep
570 * won't work properly */
571 MACIO_BIC(HEATHROW_FCR, HRW_BMAC_IO_ENABLE | HRW_BMAC_RESET);
572 }
573 /* Make sure modem is shut down */
574 MACIO_OUT8(HRW_GPIO_MODEM_RESET,
575 MACIO_IN8(HRW_GPIO_MODEM_RESET) & ~1);
576 MACIO_BIS(HEATHROW_FCR, HRW_SCC_TRANS_EN_N);
577 MACIO_BIC(HEATHROW_FCR, OH_SCCA_IO|OH_SCCB_IO|HRW_SCC_ENABLE);
578
579 /* Let things settle */
580 (void)MACIO_IN32(HEATHROW_FCR);
581}
582
583static void
584heathrow_wakeup(struct macio_chip* macio, int secondary)
585{
586 if (secondary) {
587 MACIO_OUT32(0x38, save_fcr[2]);
588 (void)MACIO_IN32(0x38);
589 mdelay(1);
590 MACIO_OUT32(0x3c, save_fcr[3]);
591 (void)MACIO_IN32(0x38);
592 mdelay(10);
593 dbdma_restore(macio, save_alt_dbdma);
594 } else {
595 MACIO_OUT32(0x38, save_fcr[0] | HRW_IOBUS_ENABLE);
596 (void)MACIO_IN32(0x38);
597 mdelay(1);
598 MACIO_OUT32(0x3c, save_fcr[1]);
599 (void)MACIO_IN32(0x38);
600 mdelay(1);
601 MACIO_OUT32(0x34, save_mbcr);
602 (void)MACIO_IN32(0x38);
603 mdelay(10);
604 dbdma_restore(macio, save_dbdma);
605 }
606}
607
608static long
609heathrow_sleep_state(struct device_node* node, long param, long value)
610{
611 if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0)
612 return -EPERM;
613 if (value == 1) {
614 if (macio_chips[1].type == macio_gatwick)
615 heathrow_sleep(&macio_chips[0], 1);
616 heathrow_sleep(&macio_chips[0], 0);
617 } else if (value == 0) {
618 heathrow_wakeup(&macio_chips[0], 0);
619 if (macio_chips[1].type == macio_gatwick)
620 heathrow_wakeup(&macio_chips[0], 1);
621 }
622 return 0;
623}
624
625static long
626core99_scc_enable(struct device_node* node, long param, long value)
627{
628 struct macio_chip* macio;
629 unsigned long flags;
630 unsigned long chan_mask;
631 u32 fcr;
632
633 macio = macio_find(node, 0);
634 if (!macio)
635 return -ENODEV;
636 if (!strcmp(node->name, "ch-a"))
637 chan_mask = MACIO_FLAG_SCCA_ON;
638 else if (!strcmp(node->name, "ch-b"))
639 chan_mask = MACIO_FLAG_SCCB_ON;
640 else
641 return -ENODEV;
642
643 if (value) {
644 int need_reset_scc = 0;
645 int need_reset_irda = 0;
646
647 LOCK(flags);
648 fcr = MACIO_IN32(KEYLARGO_FCR0);
649 /* Check if scc cell need enabling */
650 if (!(fcr & KL0_SCC_CELL_ENABLE)) {
651 fcr |= KL0_SCC_CELL_ENABLE;
652 need_reset_scc = 1;
653 }
654 if (chan_mask & MACIO_FLAG_SCCA_ON) {
655 fcr |= KL0_SCCA_ENABLE;
656 /* Don't enable line drivers for I2S modem */
657 if ((param & 0xfff) == PMAC_SCC_I2S1)
658 fcr &= ~KL0_SCC_A_INTF_ENABLE;
659 else
660 fcr |= KL0_SCC_A_INTF_ENABLE;
661 }
662 if (chan_mask & MACIO_FLAG_SCCB_ON) {
663 fcr |= KL0_SCCB_ENABLE;
664 /* Perform irda specific inits */
665 if ((param & 0xfff) == PMAC_SCC_IRDA) {
666 fcr &= ~KL0_SCC_B_INTF_ENABLE;
667 fcr |= KL0_IRDA_ENABLE;
668 fcr |= KL0_IRDA_CLK32_ENABLE | KL0_IRDA_CLK19_ENABLE;
669 fcr |= KL0_IRDA_SOURCE1_SEL;
670 fcr &= ~(KL0_IRDA_FAST_CONNECT|KL0_IRDA_DEFAULT1|KL0_IRDA_DEFAULT0);
671 fcr &= ~(KL0_IRDA_SOURCE2_SEL|KL0_IRDA_HIGH_BAND);
672 need_reset_irda = 1;
673 } else
674 fcr |= KL0_SCC_B_INTF_ENABLE;
675 }
676 MACIO_OUT32(KEYLARGO_FCR0, fcr);
677 macio->flags |= chan_mask;
678 if (need_reset_scc) {
679 MACIO_BIS(KEYLARGO_FCR0, KL0_SCC_RESET);
680 (void)MACIO_IN32(KEYLARGO_FCR0);
681 UNLOCK(flags);
682 mdelay(15);
683 LOCK(flags);
684 MACIO_BIC(KEYLARGO_FCR0, KL0_SCC_RESET);
685 }
686 if (need_reset_irda) {
687 MACIO_BIS(KEYLARGO_FCR0, KL0_IRDA_RESET);
688 (void)MACIO_IN32(KEYLARGO_FCR0);
689 UNLOCK(flags);
690 mdelay(15);
691 LOCK(flags);
692 MACIO_BIC(KEYLARGO_FCR0, KL0_IRDA_RESET);
693 }
694 UNLOCK(flags);
695 if (param & PMAC_SCC_FLAG_XMON)
696 macio->flags |= MACIO_FLAG_SCC_LOCKED;
697 } else {
698 if (macio->flags & MACIO_FLAG_SCC_LOCKED)
699 return -EPERM;
700 LOCK(flags);
701 fcr = MACIO_IN32(KEYLARGO_FCR0);
702 if (chan_mask & MACIO_FLAG_SCCA_ON)
703 fcr &= ~KL0_SCCA_ENABLE;
704 if (chan_mask & MACIO_FLAG_SCCB_ON) {
705 fcr &= ~KL0_SCCB_ENABLE;
706 /* Perform irda specific clears */
707 if ((param & 0xfff) == PMAC_SCC_IRDA) {
708 fcr &= ~KL0_IRDA_ENABLE;
709 fcr &= ~(KL0_IRDA_CLK32_ENABLE | KL0_IRDA_CLK19_ENABLE);
710 fcr &= ~(KL0_IRDA_FAST_CONNECT|KL0_IRDA_DEFAULT1|KL0_IRDA_DEFAULT0);
711 fcr &= ~(KL0_IRDA_SOURCE1_SEL|KL0_IRDA_SOURCE2_SEL|KL0_IRDA_HIGH_BAND);
712 }
713 }
714 MACIO_OUT32(KEYLARGO_FCR0, fcr);
715 if ((fcr & (KL0_SCCA_ENABLE | KL0_SCCB_ENABLE)) == 0) {
716 fcr &= ~KL0_SCC_CELL_ENABLE;
717 MACIO_OUT32(KEYLARGO_FCR0, fcr);
718 }
719 macio->flags &= ~(chan_mask);
720 UNLOCK(flags);
721 mdelay(10);
722 }
723 return 0;
724}
725
726static long
727core99_modem_enable(struct device_node* node, long param, long value)
728{
729 struct macio_chip* macio;
730 u8 gpio;
731 unsigned long flags;
732
733 /* Hack for internal USB modem */
734 if (node == NULL) {
735 if (macio_chips[0].type != macio_keylargo)
736 return -ENODEV;
737 node = macio_chips[0].of_node;
738 }
739 macio = macio_find(node, 0);
740 if (!macio)
741 return -ENODEV;
742 gpio = MACIO_IN8(KL_GPIO_MODEM_RESET);
743 gpio |= KEYLARGO_GPIO_OUTPUT_ENABLE;
744 gpio &= ~KEYLARGO_GPIO_OUTOUT_DATA;
745
746 if (!value) {
747 LOCK(flags);
748 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio);
749 UNLOCK(flags);
750 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
751 mdelay(250);
752 }
753 LOCK(flags);
754 if (value) {
755 MACIO_BIC(KEYLARGO_FCR2, KL2_ALT_DATA_OUT);
756 UNLOCK(flags);
757 (void)MACIO_IN32(KEYLARGO_FCR2);
758 mdelay(250);
759 } else {
760 MACIO_BIS(KEYLARGO_FCR2, KL2_ALT_DATA_OUT);
761 UNLOCK(flags);
762 }
763 if (value) {
764 LOCK(flags);
765 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA);
766 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
767 UNLOCK(flags); mdelay(250); LOCK(flags);
768 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio);
769 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
770 UNLOCK(flags); mdelay(250); LOCK(flags);
771 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA);
772 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
773 UNLOCK(flags); mdelay(250);
774 }
775 return 0;
776}
777
778static long
779pangea_modem_enable(struct device_node* node, long param, long value)
780{
781 struct macio_chip* macio;
782 u8 gpio;
783 unsigned long flags;
784
785 /* Hack for internal USB modem */
786 if (node == NULL) {
787 if (macio_chips[0].type != macio_pangea &&
788 macio_chips[0].type != macio_intrepid)
789 return -ENODEV;
790 node = macio_chips[0].of_node;
791 }
792 macio = macio_find(node, 0);
793 if (!macio)
794 return -ENODEV;
795 gpio = MACIO_IN8(KL_GPIO_MODEM_RESET);
796 gpio |= KEYLARGO_GPIO_OUTPUT_ENABLE;
797 gpio &= ~KEYLARGO_GPIO_OUTOUT_DATA;
798
799 if (!value) {
800 LOCK(flags);
801 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio);
802 UNLOCK(flags);
803 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
804 mdelay(250);
805 }
806 LOCK(flags);
807 if (value) {
808 MACIO_OUT8(KL_GPIO_MODEM_POWER,
809 KEYLARGO_GPIO_OUTPUT_ENABLE);
810 UNLOCK(flags);
811 (void)MACIO_IN32(KEYLARGO_FCR2);
812 mdelay(250);
813 } else {
814 MACIO_OUT8(KL_GPIO_MODEM_POWER,
815 KEYLARGO_GPIO_OUTPUT_ENABLE | KEYLARGO_GPIO_OUTOUT_DATA);
816 UNLOCK(flags);
817 }
818 if (value) {
819 LOCK(flags);
820 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA);
821 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
822 UNLOCK(flags); mdelay(250); LOCK(flags);
823 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio);
824 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
825 UNLOCK(flags); mdelay(250); LOCK(flags);
826 MACIO_OUT8(KL_GPIO_MODEM_RESET, gpio | KEYLARGO_GPIO_OUTOUT_DATA);
827 (void)MACIO_IN8(KL_GPIO_MODEM_RESET);
828 UNLOCK(flags); mdelay(250);
829 }
830 return 0;
831}
832
833static long
834core99_ata100_enable(struct device_node* node, long value)
835{
836 unsigned long flags;
837 struct pci_dev *pdev = NULL;
838 u8 pbus, pid;
839
840 if (uninorth_rev < 0x24)
841 return -ENODEV;
842
843 LOCK(flags);
844 if (value)
845 UN_BIS(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_ATA100);
846 else
847 UN_BIC(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_ATA100);
848 (void)UN_IN(UNI_N_CLOCK_CNTL);
849 UNLOCK(flags);
850 udelay(20);
851
852 if (value) {
853 if (pci_device_from_OF_node(node, &pbus, &pid) == 0)
854 pdev = pci_find_slot(pbus, pid);
855 if (pdev == NULL)
856 return 0;
857 pci_enable_device(pdev);
858 pci_set_master(pdev);
859 }
860 return 0;
861}
862
863static long
864core99_ide_enable(struct device_node* node, long param, long value)
865{
866 /* Bus ID 0 to 2 are KeyLargo based IDE, busID 3 is U2
867 * based ata-100
868 */
869 switch(param) {
870 case 0:
871 return simple_feature_tweak(node, macio_unknown,
872 KEYLARGO_FCR1, KL1_EIDE0_ENABLE, value);
873 case 1:
874 return simple_feature_tweak(node, macio_unknown,
875 KEYLARGO_FCR1, KL1_EIDE1_ENABLE, value);
876 case 2:
877 return simple_feature_tweak(node, macio_unknown,
878 KEYLARGO_FCR1, KL1_UIDE_ENABLE, value);
879 case 3:
880 return core99_ata100_enable(node, value);
881 default:
882 return -ENODEV;
883 }
884}
885
886static long
887core99_ide_reset(struct device_node* node, long param, long value)
888{
889 switch(param) {
890 case 0:
891 return simple_feature_tweak(node, macio_unknown,
892 KEYLARGO_FCR1, KL1_EIDE0_RESET_N, !value);
893 case 1:
894 return simple_feature_tweak(node, macio_unknown,
895 KEYLARGO_FCR1, KL1_EIDE1_RESET_N, !value);
896 case 2:
897 return simple_feature_tweak(node, macio_unknown,
898 KEYLARGO_FCR1, KL1_UIDE_RESET_N, !value);
899 default:
900 return -ENODEV;
901 }
902}
903
904static long
905core99_gmac_enable(struct device_node* node, long param, long value)
906{
907 unsigned long flags;
908
909 LOCK(flags);
910 if (value)
911 UN_BIS(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_GMAC);
912 else
913 UN_BIC(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_GMAC);
914 (void)UN_IN(UNI_N_CLOCK_CNTL);
915 UNLOCK(flags);
916 udelay(20);
917
918 return 0;
919}
920
921static long
922core99_gmac_phy_reset(struct device_node* node, long param, long value)
923{
924 unsigned long flags;
925 struct macio_chip* macio;
926
927 macio = &macio_chips[0];
928 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
929 macio->type != macio_intrepid)
930 return -ENODEV;
931
932 LOCK(flags);
933 MACIO_OUT8(KL_GPIO_ETH_PHY_RESET, KEYLARGO_GPIO_OUTPUT_ENABLE);
934 (void)MACIO_IN8(KL_GPIO_ETH_PHY_RESET);
935 UNLOCK(flags);
936 mdelay(10);
937 LOCK(flags);
938 MACIO_OUT8(KL_GPIO_ETH_PHY_RESET, /*KEYLARGO_GPIO_OUTPUT_ENABLE | */
939 KEYLARGO_GPIO_OUTOUT_DATA);
940 UNLOCK(flags);
941 mdelay(10);
942
943 return 0;
944}
945
946static long
947core99_sound_chip_enable(struct device_node* node, long param, long value)
948{
949 struct macio_chip* macio;
950 unsigned long flags;
951
952 macio = macio_find(node, 0);
953 if (!macio)
954 return -ENODEV;
955
956 /* Do a better probe code, screamer G4 desktops &
957 * iMacs can do that too, add a recalibrate in
958 * the driver as well
959 */
960 if (pmac_mb.model_id == PMAC_TYPE_PISMO ||
961 pmac_mb.model_id == PMAC_TYPE_TITANIUM) {
962 LOCK(flags);
963 if (value)
964 MACIO_OUT8(KL_GPIO_SOUND_POWER,
965 KEYLARGO_GPIO_OUTPUT_ENABLE |
966 KEYLARGO_GPIO_OUTOUT_DATA);
967 else
968 MACIO_OUT8(KL_GPIO_SOUND_POWER,
969 KEYLARGO_GPIO_OUTPUT_ENABLE);
970 (void)MACIO_IN8(KL_GPIO_SOUND_POWER);
971 UNLOCK(flags);
972 }
973 return 0;
974}
975
976static long
977core99_airport_enable(struct device_node* node, long param, long value)
978{
979 struct macio_chip* macio;
980 unsigned long flags;
981 int state;
982
983 macio = macio_find(node, 0);
984 if (!macio)
985 return -ENODEV;
986
987 /* Hint: we allow passing of macio itself for the sake of the
988 * sleep code
989 */
990 if (node != macio->of_node &&
991 (!node->parent || node->parent != macio->of_node))
992 return -ENODEV;
993 state = (macio->flags & MACIO_FLAG_AIRPORT_ON) != 0;
994 if (value == state)
995 return 0;
996 if (value) {
997 /* This code is a reproduction of OF enable-cardslot
998 * and init-wireless methods, slightly hacked until
999 * I got it working.
1000 */
1001 LOCK(flags);
1002 MACIO_OUT8(KEYLARGO_GPIO_0+0xf, 5);
1003 (void)MACIO_IN8(KEYLARGO_GPIO_0+0xf);
1004 UNLOCK(flags);
1005 mdelay(10);
1006 LOCK(flags);
1007 MACIO_OUT8(KEYLARGO_GPIO_0+0xf, 4);
1008 (void)MACIO_IN8(KEYLARGO_GPIO_0+0xf);
1009 UNLOCK(flags);
1010
1011 mdelay(10);
1012
1013 LOCK(flags);
1014 MACIO_BIC(KEYLARGO_FCR2, KL2_CARDSEL_16);
1015 (void)MACIO_IN32(KEYLARGO_FCR2);
1016 udelay(10);
1017 MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+0xb, 0);
1018 (void)MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+0xb);
1019 udelay(10);
1020 MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+0xa, 0x28);
1021 (void)MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+0xa);
1022 udelay(10);
1023 MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+0xd, 0x28);
1024 (void)MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+0xd);
1025 udelay(10);
1026 MACIO_OUT8(KEYLARGO_GPIO_0+0xd, 0x28);
1027 (void)MACIO_IN8(KEYLARGO_GPIO_0+0xd);
1028 udelay(10);
1029 MACIO_OUT8(KEYLARGO_GPIO_0+0xe, 0x28);
1030 (void)MACIO_IN8(KEYLARGO_GPIO_0+0xe);
1031 UNLOCK(flags);
1032 udelay(10);
1033 MACIO_OUT32(0x1c000, 0);
1034 mdelay(1);
1035 MACIO_OUT8(0x1a3e0, 0x41);
1036 (void)MACIO_IN8(0x1a3e0);
1037 udelay(10);
1038 LOCK(flags);
1039 MACIO_BIS(KEYLARGO_FCR2, KL2_CARDSEL_16);
1040 (void)MACIO_IN32(KEYLARGO_FCR2);
1041 UNLOCK(flags);
1042 mdelay(100);
1043
1044 macio->flags |= MACIO_FLAG_AIRPORT_ON;
1045 } else {
1046 LOCK(flags);
1047 MACIO_BIC(KEYLARGO_FCR2, KL2_CARDSEL_16);
1048 (void)MACIO_IN32(KEYLARGO_FCR2);
1049 MACIO_OUT8(KL_GPIO_AIRPORT_0, 0);
1050 MACIO_OUT8(KL_GPIO_AIRPORT_1, 0);
1051 MACIO_OUT8(KL_GPIO_AIRPORT_2, 0);
1052 MACIO_OUT8(KL_GPIO_AIRPORT_3, 0);
1053 MACIO_OUT8(KL_GPIO_AIRPORT_4, 0);
1054 (void)MACIO_IN8(KL_GPIO_AIRPORT_4);
1055 UNLOCK(flags);
1056
1057 macio->flags &= ~MACIO_FLAG_AIRPORT_ON;
1058 }
1059 return 0;
1060}
1061
1062#ifdef CONFIG_SMP
1063static long
1064core99_reset_cpu(struct device_node* node, long param, long value)
1065{
1066 unsigned int reset_io = 0;
1067 unsigned long flags;
1068 struct macio_chip* macio;
1069 struct device_node* np;
1070 const int dflt_reset_lines[] = { KL_GPIO_RESET_CPU0,
1071 KL_GPIO_RESET_CPU1,
1072 KL_GPIO_RESET_CPU2,
1073 KL_GPIO_RESET_CPU3 };
1074
1075 macio = &macio_chips[0];
1076 if (macio->type != macio_keylargo)
1077 return -ENODEV;
1078
1079 np = find_path_device("/cpus");
1080 if (np == NULL)
1081 return -ENODEV;
1082 for (np = np->child; np != NULL; np = np->sibling) {
1083 u32* num = (u32 *)get_property(np, "reg", NULL);
1084 u32* rst = (u32 *)get_property(np, "soft-reset", NULL);
1085 if (num == NULL || rst == NULL)
1086 continue;
1087 if (param == *num) {
1088 reset_io = *rst;
1089 break;
1090 }
1091 }
1092 if (np == NULL || reset_io == 0)
1093 reset_io = dflt_reset_lines[param];
1094
1095 LOCK(flags);
1096 MACIO_OUT8(reset_io, KEYLARGO_GPIO_OUTPUT_ENABLE);
1097 (void)MACIO_IN8(reset_io);
1098 udelay(1);
1099 MACIO_OUT8(reset_io, 0);
1100 (void)MACIO_IN8(reset_io);
1101 UNLOCK(flags);
1102
1103 return 0;
1104}
1105#endif /* CONFIG_SMP */
1106
1107static long
1108core99_usb_enable(struct device_node* node, long param, long value)
1109{
1110 struct macio_chip* macio;
1111 unsigned long flags;
1112 char* prop;
1113 int number;
1114 u32 reg;
1115
1116 macio = &macio_chips[0];
1117 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
1118 macio->type != macio_intrepid)
1119 return -ENODEV;
1120
1121 prop = (char *)get_property(node, "AAPL,clock-id", NULL);
1122 if (!prop)
1123 return -ENODEV;
1124 if (strncmp(prop, "usb0u048", 8) == 0)
1125 number = 0;
1126 else if (strncmp(prop, "usb1u148", 8) == 0)
1127 number = 2;
1128 else if (strncmp(prop, "usb2u248", 8) == 0)
1129 number = 4;
1130 else
1131 return -ENODEV;
1132
1133 /* Sorry for the brute-force locking, but this is only used during
1134 * sleep and the timing seem to be critical
1135 */
1136 LOCK(flags);
1137 if (value) {
1138 /* Turn ON */
1139 if (number == 0) {
1140 MACIO_BIC(KEYLARGO_FCR0, (KL0_USB0_PAD_SUSPEND0 | KL0_USB0_PAD_SUSPEND1));
1141 (void)MACIO_IN32(KEYLARGO_FCR0);
1142 UNLOCK(flags);
1143 mdelay(1);
1144 LOCK(flags);
1145 MACIO_BIS(KEYLARGO_FCR0, KL0_USB0_CELL_ENABLE);
1146 } else if (number == 2) {
1147 MACIO_BIC(KEYLARGO_FCR0, (KL0_USB1_PAD_SUSPEND0 | KL0_USB1_PAD_SUSPEND1));
1148 UNLOCK(flags);
1149 (void)MACIO_IN32(KEYLARGO_FCR0);
1150 mdelay(1);
1151 LOCK(flags);
1152 MACIO_BIS(KEYLARGO_FCR0, KL0_USB1_CELL_ENABLE);
1153 } else if (number == 4) {
1154 MACIO_BIC(KEYLARGO_FCR1, (KL1_USB2_PAD_SUSPEND0 | KL1_USB2_PAD_SUSPEND1));
1155 UNLOCK(flags);
1156 (void)MACIO_IN32(KEYLARGO_FCR1);
1157 mdelay(1);
1158 LOCK(flags);
1159 MACIO_BIS(KEYLARGO_FCR1, KL1_USB2_CELL_ENABLE);
1160 }
1161 if (number < 4) {
1162 reg = MACIO_IN32(KEYLARGO_FCR4);
1163 reg &= ~(KL4_PORT_WAKEUP_ENABLE(number) | KL4_PORT_RESUME_WAKE_EN(number) |
1164 KL4_PORT_CONNECT_WAKE_EN(number) | KL4_PORT_DISCONNECT_WAKE_EN(number));
1165 reg &= ~(KL4_PORT_WAKEUP_ENABLE(number+1) | KL4_PORT_RESUME_WAKE_EN(number+1) |
1166 KL4_PORT_CONNECT_WAKE_EN(number+1) | KL4_PORT_DISCONNECT_WAKE_EN(number+1));
1167 MACIO_OUT32(KEYLARGO_FCR4, reg);
1168 (void)MACIO_IN32(KEYLARGO_FCR4);
1169 udelay(10);
1170 } else {
1171 reg = MACIO_IN32(KEYLARGO_FCR3);
1172 reg &= ~(KL3_IT_PORT_WAKEUP_ENABLE(0) | KL3_IT_PORT_RESUME_WAKE_EN(0) |
1173 KL3_IT_PORT_CONNECT_WAKE_EN(0) | KL3_IT_PORT_DISCONNECT_WAKE_EN(0));
1174 reg &= ~(KL3_IT_PORT_WAKEUP_ENABLE(1) | KL3_IT_PORT_RESUME_WAKE_EN(1) |
1175 KL3_IT_PORT_CONNECT_WAKE_EN(1) | KL3_IT_PORT_DISCONNECT_WAKE_EN(1));
1176 MACIO_OUT32(KEYLARGO_FCR3, reg);
1177 (void)MACIO_IN32(KEYLARGO_FCR3);
1178 udelay(10);
1179 }
1180 if (macio->type == macio_intrepid) {
1181 /* wait for clock stopped bits to clear */
1182 u32 test0 = 0, test1 = 0;
1183 u32 status0, status1;
1184 int timeout = 1000;
1185
1186 UNLOCK(flags);
1187 switch (number) {
1188 case 0:
1189 test0 = UNI_N_CLOCK_STOPPED_USB0;
1190 test1 = UNI_N_CLOCK_STOPPED_USB0PCI;
1191 break;
1192 case 2:
1193 test0 = UNI_N_CLOCK_STOPPED_USB1;
1194 test1 = UNI_N_CLOCK_STOPPED_USB1PCI;
1195 break;
1196 case 4:
1197 test0 = UNI_N_CLOCK_STOPPED_USB2;
1198 test1 = UNI_N_CLOCK_STOPPED_USB2PCI;
1199 break;
1200 }
1201 do {
1202 if (--timeout <= 0) {
1203 printk(KERN_ERR "core99_usb_enable: "
1204 "Timeout waiting for clocks\n");
1205 break;
1206 }
1207 mdelay(1);
1208 status0 = UN_IN(UNI_N_CLOCK_STOP_STATUS0);
1209 status1 = UN_IN(UNI_N_CLOCK_STOP_STATUS1);
1210 } while ((status0 & test0) | (status1 & test1));
1211 LOCK(flags);
1212 }
1213 } else {
1214 /* Turn OFF */
1215 if (number < 4) {
1216 reg = MACIO_IN32(KEYLARGO_FCR4);
1217 reg |= KL4_PORT_WAKEUP_ENABLE(number) | KL4_PORT_RESUME_WAKE_EN(number) |
1218 KL4_PORT_CONNECT_WAKE_EN(number) | KL4_PORT_DISCONNECT_WAKE_EN(number);
1219 reg |= KL4_PORT_WAKEUP_ENABLE(number+1) | KL4_PORT_RESUME_WAKE_EN(number+1) |
1220 KL4_PORT_CONNECT_WAKE_EN(number+1) | KL4_PORT_DISCONNECT_WAKE_EN(number+1);
1221 MACIO_OUT32(KEYLARGO_FCR4, reg);
1222 (void)MACIO_IN32(KEYLARGO_FCR4);
1223 udelay(1);
1224 } else {
1225 reg = MACIO_IN32(KEYLARGO_FCR3);
1226 reg |= KL3_IT_PORT_WAKEUP_ENABLE(0) | KL3_IT_PORT_RESUME_WAKE_EN(0) |
1227 KL3_IT_PORT_CONNECT_WAKE_EN(0) | KL3_IT_PORT_DISCONNECT_WAKE_EN(0);
1228 reg |= KL3_IT_PORT_WAKEUP_ENABLE(1) | KL3_IT_PORT_RESUME_WAKE_EN(1) |
1229 KL3_IT_PORT_CONNECT_WAKE_EN(1) | KL3_IT_PORT_DISCONNECT_WAKE_EN(1);
1230 MACIO_OUT32(KEYLARGO_FCR3, reg);
1231 (void)MACIO_IN32(KEYLARGO_FCR3);
1232 udelay(1);
1233 }
1234 if (number == 0) {
1235 if (macio->type != macio_intrepid)
1236 MACIO_BIC(KEYLARGO_FCR0, KL0_USB0_CELL_ENABLE);
1237 (void)MACIO_IN32(KEYLARGO_FCR0);
1238 udelay(1);
1239 MACIO_BIS(KEYLARGO_FCR0, (KL0_USB0_PAD_SUSPEND0 | KL0_USB0_PAD_SUSPEND1));
1240 (void)MACIO_IN32(KEYLARGO_FCR0);
1241 } else if (number == 2) {
1242 if (macio->type != macio_intrepid)
1243 MACIO_BIC(KEYLARGO_FCR0, KL0_USB1_CELL_ENABLE);
1244 (void)MACIO_IN32(KEYLARGO_FCR0);
1245 udelay(1);
1246 MACIO_BIS(KEYLARGO_FCR0, (KL0_USB1_PAD_SUSPEND0 | KL0_USB1_PAD_SUSPEND1));
1247 (void)MACIO_IN32(KEYLARGO_FCR0);
1248 } else if (number == 4) {
1249 udelay(1);
1250 MACIO_BIS(KEYLARGO_FCR1, (KL1_USB2_PAD_SUSPEND0 | KL1_USB2_PAD_SUSPEND1));
1251 (void)MACIO_IN32(KEYLARGO_FCR1);
1252 }
1253 udelay(1);
1254 }
1255 UNLOCK(flags);
1256
1257 return 0;
1258}
1259
1260static long
1261core99_firewire_enable(struct device_node* node, long param, long value)
1262{
1263 unsigned long flags;
1264 struct macio_chip* macio;
1265
1266 macio = &macio_chips[0];
1267 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
1268 macio->type != macio_intrepid)
1269 return -ENODEV;
1270 if (!(macio->flags & MACIO_FLAG_FW_SUPPORTED))
1271 return -ENODEV;
1272
1273 LOCK(flags);
1274 if (value) {
1275 UN_BIS(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_FW);
1276 (void)UN_IN(UNI_N_CLOCK_CNTL);
1277 } else {
1278 UN_BIC(UNI_N_CLOCK_CNTL, UNI_N_CLOCK_CNTL_FW);
1279 (void)UN_IN(UNI_N_CLOCK_CNTL);
1280 }
1281 UNLOCK(flags);
1282 mdelay(1);
1283
1284 return 0;
1285}
1286
1287static long
1288core99_firewire_cable_power(struct device_node* node, long param, long value)
1289{
1290 unsigned long flags;
1291 struct macio_chip* macio;
1292
1293 /* Trick: we allow NULL node */
1294 if ((pmac_mb.board_flags & PMAC_MB_HAS_FW_POWER) == 0)
1295 return -ENODEV;
1296 macio = &macio_chips[0];
1297 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
1298 macio->type != macio_intrepid)
1299 return -ENODEV;
1300 if (!(macio->flags & MACIO_FLAG_FW_SUPPORTED))
1301 return -ENODEV;
1302
1303 LOCK(flags);
1304 if (value) {
1305 MACIO_OUT8(KL_GPIO_FW_CABLE_POWER , 0);
1306 MACIO_IN8(KL_GPIO_FW_CABLE_POWER);
1307 udelay(10);
1308 } else {
1309 MACIO_OUT8(KL_GPIO_FW_CABLE_POWER , 4);
1310 MACIO_IN8(KL_GPIO_FW_CABLE_POWER); udelay(10);
1311 }
1312 UNLOCK(flags);
1313 mdelay(1);
1314
1315 return 0;
1316}
1317
1318static long
1319intrepid_aack_delay_enable(struct device_node* node, long param, long value)
1320{
1321 unsigned long flags;
1322
1323 if (uninorth_rev < 0xd2)
1324 return -ENODEV;
1325
1326 LOCK(flags);
1327 if (param)
1328 UN_BIS(UNI_N_AACK_DELAY, UNI_N_AACK_DELAY_ENABLE);
1329 else
1330 UN_BIC(UNI_N_AACK_DELAY, UNI_N_AACK_DELAY_ENABLE);
1331 UNLOCK(flags);
1332
1333 return 0;
1334}
1335
1336
1337#endif /* CONFIG_POWER4 */
1338
1339static long
1340core99_read_gpio(struct device_node* node, long param, long value)
1341{
1342 struct macio_chip* macio = &macio_chips[0];
1343
1344 return MACIO_IN8(param);
1345}
1346
1347
1348static long
1349core99_write_gpio(struct device_node* node, long param, long value)
1350{
1351 struct macio_chip* macio = &macio_chips[0];
1352
1353 MACIO_OUT8(param, (u8)(value & 0xff));
1354 return 0;
1355}
1356
1357#ifdef CONFIG_POWER4
1358
1359static long
1360g5_gmac_enable(struct device_node* node, long param, long value)
1361{
1362 struct macio_chip* macio = &macio_chips[0];
1363 unsigned long flags;
1364 u8 pbus, pid;
1365
1366 LOCK(flags);
1367 if (value) {
1368 MACIO_BIS(KEYLARGO_FCR1, K2_FCR1_GMAC_CLK_ENABLE);
1369 mb();
1370 k2_skiplist[0] = NULL;
1371 } else {
1372 k2_skiplist[0] = node;
1373 mb();
1374 MACIO_BIC(KEYLARGO_FCR1, K2_FCR1_GMAC_CLK_ENABLE);
1375 }
1376
1377 UNLOCK(flags);
1378 mdelay(1);
1379
1380 return 0;
1381}
1382
1383static long
1384g5_fw_enable(struct device_node* node, long param, long value)
1385{
1386 struct macio_chip* macio = &macio_chips[0];
1387 unsigned long flags;
1388
1389 LOCK(flags);
1390 if (value) {
1391 MACIO_BIS(KEYLARGO_FCR1, K2_FCR1_FW_CLK_ENABLE);
1392 mb();
1393 k2_skiplist[1] = NULL;
1394 } else {
1395 k2_skiplist[1] = node;
1396 mb();
1397 MACIO_BIC(KEYLARGO_FCR1, K2_FCR1_FW_CLK_ENABLE);
1398 }
1399
1400 UNLOCK(flags);
1401 mdelay(1);
1402
1403 return 0;
1404}
1405
1406static long
1407g5_mpic_enable(struct device_node* node, long param, long value)
1408{
1409 unsigned long flags;
1410
1411 if (node->parent == NULL || strcmp(node->parent->name, "u3"))
1412 return 0;
1413
1414 LOCK(flags);
1415 UN_BIS(U3_TOGGLE_REG, U3_MPIC_RESET | U3_MPIC_OUTPUT_ENABLE);
1416 UNLOCK(flags);
1417
1418 return 0;
1419}
1420
1421#ifdef CONFIG_SMP
1422static long
1423g5_reset_cpu(struct device_node* node, long param, long value)
1424{
1425 unsigned int reset_io = 0;
1426 unsigned long flags;
1427 struct macio_chip* macio;
1428 struct device_node* np;
1429
1430 macio = &macio_chips[0];
1431 if (macio->type != macio_keylargo2)
1432 return -ENODEV;
1433
1434 np = find_path_device("/cpus");
1435 if (np == NULL)
1436 return -ENODEV;
1437 for (np = np->child; np != NULL; np = np->sibling) {
1438 u32* num = (u32 *)get_property(np, "reg", NULL);
1439 u32* rst = (u32 *)get_property(np, "soft-reset", NULL);
1440 if (num == NULL || rst == NULL)
1441 continue;
1442 if (param == *num) {
1443 reset_io = *rst;
1444 break;
1445 }
1446 }
1447 if (np == NULL || reset_io == 0)
1448 return -ENODEV;
1449
1450 LOCK(flags);
1451 MACIO_OUT8(reset_io, KEYLARGO_GPIO_OUTPUT_ENABLE);
1452 (void)MACIO_IN8(reset_io);
1453 udelay(1);
1454 MACIO_OUT8(reset_io, 0);
1455 (void)MACIO_IN8(reset_io);
1456 UNLOCK(flags);
1457
1458 return 0;
1459}
1460#endif /* CONFIG_SMP */
1461
1462/*
1463 * This can be called from pmac_smp so isn't static
1464 *
1465 * This takes the second CPU off the bus on dual CPU machines
1466 * running UP
1467 */
1468void g5_phy_disable_cpu1(void)
1469{
1470 UN_OUT(U3_API_PHY_CONFIG_1, 0);
1471}
1472
1473#endif /* CONFIG_POWER4 */
1474
1475#ifndef CONFIG_POWER4
1476
1477static void
1478keylargo_shutdown(struct macio_chip* macio, int sleep_mode)
1479{
1480 u32 temp;
1481
1482 if (sleep_mode) {
1483 mdelay(1);
1484 MACIO_BIS(KEYLARGO_FCR0, KL0_USB_REF_SUSPEND);
1485 (void)MACIO_IN32(KEYLARGO_FCR0);
1486 mdelay(1);
1487 }
1488
1489 MACIO_BIC(KEYLARGO_FCR0,KL0_SCCA_ENABLE | KL0_SCCB_ENABLE |
1490 KL0_SCC_CELL_ENABLE |
1491 KL0_IRDA_ENABLE | KL0_IRDA_CLK32_ENABLE |
1492 KL0_IRDA_CLK19_ENABLE);
1493
1494 MACIO_BIC(KEYLARGO_MBCR, KL_MBCR_MB0_DEV_MASK);
1495 MACIO_BIS(KEYLARGO_MBCR, KL_MBCR_MB0_IDE_ENABLE);
1496
1497 MACIO_BIC(KEYLARGO_FCR1,
1498 KL1_AUDIO_SEL_22MCLK | KL1_AUDIO_CLK_ENABLE_BIT |
1499 KL1_AUDIO_CLK_OUT_ENABLE | KL1_AUDIO_CELL_ENABLE |
1500 KL1_I2S0_CELL_ENABLE | KL1_I2S0_CLK_ENABLE_BIT |
1501 KL1_I2S0_ENABLE | KL1_I2S1_CELL_ENABLE |
1502 KL1_I2S1_CLK_ENABLE_BIT | KL1_I2S1_ENABLE |
1503 KL1_EIDE0_ENABLE | KL1_EIDE0_RESET_N |
1504 KL1_EIDE1_ENABLE | KL1_EIDE1_RESET_N |
1505 KL1_UIDE_ENABLE);
1506
1507 MACIO_BIS(KEYLARGO_FCR2, KL2_ALT_DATA_OUT);
1508 MACIO_BIC(KEYLARGO_FCR2, KL2_IOBUS_ENABLE);
1509
1510 temp = MACIO_IN32(KEYLARGO_FCR3);
1511 if (macio->rev >= 2) {
1512 temp |= KL3_SHUTDOWN_PLL2X;
1513 if (sleep_mode)
1514 temp |= KL3_SHUTDOWN_PLL_TOTAL;
1515 }
1516
1517 temp |= KL3_SHUTDOWN_PLLKW6 | KL3_SHUTDOWN_PLLKW4 |
1518 KL3_SHUTDOWN_PLLKW35;
1519 if (sleep_mode)
1520 temp |= KL3_SHUTDOWN_PLLKW12;
1521 temp &= ~(KL3_CLK66_ENABLE | KL3_CLK49_ENABLE | KL3_CLK45_ENABLE
1522 | KL3_CLK31_ENABLE | KL3_I2S1_CLK18_ENABLE | KL3_I2S0_CLK18_ENABLE);
1523 if (sleep_mode)
1524 temp &= ~(KL3_TIMER_CLK18_ENABLE | KL3_VIA_CLK16_ENABLE);
1525 MACIO_OUT32(KEYLARGO_FCR3, temp);
1526
1527 /* Flush posted writes & wait a bit */
1528 (void)MACIO_IN32(KEYLARGO_FCR0); mdelay(1);
1529}
1530
1531static void
1532pangea_shutdown(struct macio_chip* macio, int sleep_mode)
1533{
1534 u32 temp;
1535
1536 MACIO_BIC(KEYLARGO_FCR0,KL0_SCCA_ENABLE | KL0_SCCB_ENABLE |
1537 KL0_SCC_CELL_ENABLE |
1538 KL0_USB0_CELL_ENABLE | KL0_USB1_CELL_ENABLE);
1539
1540 MACIO_BIC(KEYLARGO_FCR1,
1541 KL1_AUDIO_SEL_22MCLK | KL1_AUDIO_CLK_ENABLE_BIT |
1542 KL1_AUDIO_CLK_OUT_ENABLE | KL1_AUDIO_CELL_ENABLE |
1543 KL1_I2S0_CELL_ENABLE | KL1_I2S0_CLK_ENABLE_BIT |
1544 KL1_I2S0_ENABLE | KL1_I2S1_CELL_ENABLE |
1545 KL1_I2S1_CLK_ENABLE_BIT | KL1_I2S1_ENABLE |
1546 KL1_UIDE_ENABLE);
1547 if (pmac_mb.board_flags & PMAC_MB_MOBILE)
1548 MACIO_BIC(KEYLARGO_FCR1, KL1_UIDE_RESET_N);
1549
1550 MACIO_BIS(KEYLARGO_FCR2, KL2_ALT_DATA_OUT);
1551
1552 temp = MACIO_IN32(KEYLARGO_FCR3);
1553 temp |= KL3_SHUTDOWN_PLLKW6 | KL3_SHUTDOWN_PLLKW4 |
1554 KL3_SHUTDOWN_PLLKW35;
1555 temp &= ~(KL3_CLK49_ENABLE | KL3_CLK45_ENABLE | KL3_CLK31_ENABLE
1556 | KL3_I2S0_CLK18_ENABLE | KL3_I2S1_CLK18_ENABLE);
1557 if (sleep_mode)
1558 temp &= ~(KL3_VIA_CLK16_ENABLE | KL3_TIMER_CLK18_ENABLE);
1559 MACIO_OUT32(KEYLARGO_FCR3, temp);
1560
1561 /* Flush posted writes & wait a bit */
1562 (void)MACIO_IN32(KEYLARGO_FCR0); mdelay(1);
1563}
1564
1565static void
1566intrepid_shutdown(struct macio_chip* macio, int sleep_mode)
1567{
1568 u32 temp;
1569
1570 MACIO_BIC(KEYLARGO_FCR0,KL0_SCCA_ENABLE | KL0_SCCB_ENABLE |
1571 KL0_SCC_CELL_ENABLE);
1572
1573 MACIO_BIC(KEYLARGO_FCR1,
1574 /*KL1_USB2_CELL_ENABLE |*/
1575 KL1_I2S0_CELL_ENABLE | KL1_I2S0_CLK_ENABLE_BIT |
1576 KL1_I2S0_ENABLE | KL1_I2S1_CELL_ENABLE |
1577 KL1_I2S1_CLK_ENABLE_BIT | KL1_I2S1_ENABLE);
1578 if (pmac_mb.board_flags & PMAC_MB_MOBILE)
1579 MACIO_BIC(KEYLARGO_FCR1, KL1_UIDE_RESET_N);
1580
1581 temp = MACIO_IN32(KEYLARGO_FCR3);
1582 temp &= ~(KL3_CLK49_ENABLE | KL3_CLK45_ENABLE |
1583 KL3_I2S1_CLK18_ENABLE | KL3_I2S0_CLK18_ENABLE);
1584 if (sleep_mode)
1585 temp &= ~(KL3_TIMER_CLK18_ENABLE | KL3_IT_VIA_CLK32_ENABLE);
1586 MACIO_OUT32(KEYLARGO_FCR3, temp);
1587
1588 /* Flush posted writes & wait a bit */
1589 (void)MACIO_IN32(KEYLARGO_FCR0);
1590 mdelay(10);
1591}
1592
1593
1594void pmac_tweak_clock_spreading(int enable)
1595{
1596 struct macio_chip* macio = &macio_chips[0];
1597
1598 /* Hack for doing clock spreading on some machines PowerBooks and
1599 * iBooks. This implements the "platform-do-clockspreading" OF
1600 * property as decoded manually on various models. For safety, we also
1601 * check the product ID in the device-tree in cases we'll whack the i2c
1602 * chip to make reasonably sure we won't set wrong values in there
1603 *
1604 * Of course, ultimately, we have to implement a real parser for
1605 * the platform-do-* stuff...
1606 */
1607
1608 if (macio->type == macio_intrepid) {
1609 if (enable)
1610 UN_OUT(UNI_N_CLOCK_SPREADING, 2);
1611 else
1612 UN_OUT(UNI_N_CLOCK_SPREADING, 0);
1613 mdelay(40);
1614 }
1615
1616 while (machine_is_compatible("PowerBook5,2") ||
1617 machine_is_compatible("PowerBook5,3") ||
1618 machine_is_compatible("PowerBook6,2") ||
1619 machine_is_compatible("PowerBook6,3")) {
1620 struct device_node *ui2c = of_find_node_by_type(NULL, "i2c");
1621 struct device_node *dt = of_find_node_by_name(NULL, "device-tree");
1622 u8 buffer[9];
1623 u32 *productID;
1624 int i, rc, changed = 0;
1625
1626 if (dt == NULL)
1627 break;
1628 productID = (u32 *)get_property(dt, "pid#", NULL);
1629 if (productID == NULL)
1630 break;
1631 while(ui2c) {
1632 struct device_node *p = of_get_parent(ui2c);
1633 if (p && !strcmp(p->name, "uni-n"))
1634 break;
1635 ui2c = of_find_node_by_type(ui2c, "i2c");
1636 }
1637 if (ui2c == NULL)
1638 break;
1639 DBG("Trying to bump clock speed for PID: %08x...\n", *productID);
1640 rc = pmac_low_i2c_open(ui2c, 1);
1641 if (rc != 0)
1642 break;
1643 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_combined);
1644 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_read, 0x80, buffer, 9);
1645 DBG("read result: %d,", rc);
1646 if (rc != 0) {
1647 pmac_low_i2c_close(ui2c);
1648 break;
1649 }
1650 for (i=0; i<9; i++)
1651 DBG(" %02x", buffer[i]);
1652 DBG("\n");
1653
1654 switch(*productID) {
1655 case 0x1182: /* AlBook 12" rev 2 */
1656 case 0x1183: /* iBook G4 12" */
1657 buffer[0] = (buffer[0] & 0x8f) | 0x70;
1658 buffer[2] = (buffer[2] & 0x7f) | 0x00;
1659 buffer[5] = (buffer[5] & 0x80) | 0x31;
1660 buffer[6] = (buffer[6] & 0x40) | 0xb0;
1661 buffer[7] = (buffer[7] & 0x00) | (enable ? 0xc0 : 0xba);
1662 buffer[8] = (buffer[8] & 0x00) | 0x30;
1663 changed = 1;
1664 break;
1665 case 0x3142: /* AlBook 15" (ATI M10) */
1666 case 0x3143: /* AlBook 17" (ATI M10) */
1667 buffer[0] = (buffer[0] & 0xaf) | 0x50;
1668 buffer[2] = (buffer[2] & 0x7f) | 0x00;
1669 buffer[5] = (buffer[5] & 0x80) | 0x31;
1670 buffer[6] = (buffer[6] & 0x40) | 0xb0;
1671 buffer[7] = (buffer[7] & 0x00) | (enable ? 0xd0 : 0xc0);
1672 buffer[8] = (buffer[8] & 0x00) | 0x30;
1673 changed = 1;
1674 break;
1675 default:
1676 DBG("i2c-hwclock: Machine model not handled\n");
1677 break;
1678 }
1679 if (!changed) {
1680 pmac_low_i2c_close(ui2c);
1681 break;
1682 }
1683 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_stdsub);
1684 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_write, 0x80, buffer, 9);
1685 DBG("write result: %d,", rc);
1686 pmac_low_i2c_setmode(ui2c, pmac_low_i2c_mode_combined);
1687 rc = pmac_low_i2c_xfer(ui2c, 0xd2 | pmac_low_i2c_read, 0x80, buffer, 9);
1688 DBG("read result: %d,", rc);
1689 if (rc != 0) {
1690 pmac_low_i2c_close(ui2c);
1691 break;
1692 }
1693 for (i=0; i<9; i++)
1694 DBG(" %02x", buffer[i]);
1695 pmac_low_i2c_close(ui2c);
1696 break;
1697 }
1698}
1699
1700
1701static int
1702core99_sleep(void)
1703{
1704 struct macio_chip* macio;
1705 int i;
1706
1707 macio = &macio_chips[0];
1708 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
1709 macio->type != macio_intrepid)
1710 return -ENODEV;
1711
1712 /* We power off the wireless slot in case it was not done
1713 * by the driver. We don't power it on automatically however
1714 */
1715 if (macio->flags & MACIO_FLAG_AIRPORT_ON)
1716 core99_airport_enable(macio->of_node, 0, 0);
1717
1718 /* We power off the FW cable. Should be done by the driver... */
1719 if (macio->flags & MACIO_FLAG_FW_SUPPORTED) {
1720 core99_firewire_enable(NULL, 0, 0);
1721 core99_firewire_cable_power(NULL, 0, 0);
1722 }
1723
1724 /* We make sure int. modem is off (in case driver lost it) */
1725 if (macio->type == macio_keylargo)
1726 core99_modem_enable(macio->of_node, 0, 0);
1727 else
1728 pangea_modem_enable(macio->of_node, 0, 0);
1729
1730 /* We make sure the sound is off as well */
1731 core99_sound_chip_enable(macio->of_node, 0, 0);
1732
1733 /*
1734 * Save various bits of KeyLargo
1735 */
1736
1737 /* Save the state of the various GPIOs */
1738 save_gpio_levels[0] = MACIO_IN32(KEYLARGO_GPIO_LEVELS0);
1739 save_gpio_levels[1] = MACIO_IN32(KEYLARGO_GPIO_LEVELS1);
1740 for (i=0; i<KEYLARGO_GPIO_EXTINT_CNT; i++)
1741 save_gpio_extint[i] = MACIO_IN8(KEYLARGO_GPIO_EXTINT_0+i);
1742 for (i=0; i<KEYLARGO_GPIO_CNT; i++)
1743 save_gpio_normal[i] = MACIO_IN8(KEYLARGO_GPIO_0+i);
1744
1745 /* Save the FCRs */
1746 if (macio->type == macio_keylargo)
1747 save_mbcr = MACIO_IN32(KEYLARGO_MBCR);
1748 save_fcr[0] = MACIO_IN32(KEYLARGO_FCR0);
1749 save_fcr[1] = MACIO_IN32(KEYLARGO_FCR1);
1750 save_fcr[2] = MACIO_IN32(KEYLARGO_FCR2);
1751 save_fcr[3] = MACIO_IN32(KEYLARGO_FCR3);
1752 save_fcr[4] = MACIO_IN32(KEYLARGO_FCR4);
1753 if (macio->type == macio_pangea || macio->type == macio_intrepid)
1754 save_fcr[5] = MACIO_IN32(KEYLARGO_FCR5);
1755
1756 /* Save state & config of DBDMA channels */
1757 dbdma_save(macio, save_dbdma);
1758
1759 /*
1760 * Turn off as much as we can
1761 */
1762 if (macio->type == macio_pangea)
1763 pangea_shutdown(macio, 1);
1764 else if (macio->type == macio_intrepid)
1765 intrepid_shutdown(macio, 1);
1766 else if (macio->type == macio_keylargo)
1767 keylargo_shutdown(macio, 1);
1768
1769 /*
1770 * Put the host bridge to sleep
1771 */
1772
1773 save_unin_clock_ctl = UN_IN(UNI_N_CLOCK_CNTL);
1774 /* Note: do not switch GMAC off, driver does it when necessary, WOL must keep it
1775 * enabled !
1776 */
1777 UN_OUT(UNI_N_CLOCK_CNTL, save_unin_clock_ctl &
1778 ~(/*UNI_N_CLOCK_CNTL_GMAC|*/UNI_N_CLOCK_CNTL_FW/*|UNI_N_CLOCK_CNTL_PCI*/));
1779 udelay(100);
1780 UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_SLEEPING);
1781 UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_SLEEP);
1782 mdelay(10);
1783
1784 /*
1785 * FIXME: A bit of black magic with OpenPIC (don't ask me why)
1786 */
1787 if (pmac_mb.model_id == PMAC_TYPE_SAWTOOTH) {
1788 MACIO_BIS(0x506e0, 0x00400000);
1789 MACIO_BIS(0x506e0, 0x80000000);
1790 }
1791 return 0;
1792}
1793
1794static int
1795core99_wake_up(void)
1796{
1797 struct macio_chip* macio;
1798 int i;
1799
1800 macio = &macio_chips[0];
1801 if (macio->type != macio_keylargo && macio->type != macio_pangea &&
1802 macio->type != macio_intrepid)
1803 return -ENODEV;
1804
1805 /*
1806 * Wakeup the host bridge
1807 */
1808 UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_NORMAL);
1809 udelay(10);
1810 UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_RUNNING);
1811 udelay(10);
1812
1813 /*
1814 * Restore KeyLargo
1815 */
1816
1817 if (macio->type == macio_keylargo) {
1818 MACIO_OUT32(KEYLARGO_MBCR, save_mbcr);
1819 (void)MACIO_IN32(KEYLARGO_MBCR); udelay(10);
1820 }
1821 MACIO_OUT32(KEYLARGO_FCR0, save_fcr[0]);
1822 (void)MACIO_IN32(KEYLARGO_FCR0); udelay(10);
1823 MACIO_OUT32(KEYLARGO_FCR1, save_fcr[1]);
1824 (void)MACIO_IN32(KEYLARGO_FCR1); udelay(10);
1825 MACIO_OUT32(KEYLARGO_FCR2, save_fcr[2]);
1826 (void)MACIO_IN32(KEYLARGO_FCR2); udelay(10);
1827 MACIO_OUT32(KEYLARGO_FCR3, save_fcr[3]);
1828 (void)MACIO_IN32(KEYLARGO_FCR3); udelay(10);
1829 MACIO_OUT32(KEYLARGO_FCR4, save_fcr[4]);
1830 (void)MACIO_IN32(KEYLARGO_FCR4); udelay(10);
1831 if (macio->type == macio_pangea || macio->type == macio_intrepid) {
1832 MACIO_OUT32(KEYLARGO_FCR5, save_fcr[5]);
1833 (void)MACIO_IN32(KEYLARGO_FCR5); udelay(10);
1834 }
1835
1836 dbdma_restore(macio, save_dbdma);
1837
1838 MACIO_OUT32(KEYLARGO_GPIO_LEVELS0, save_gpio_levels[0]);
1839 MACIO_OUT32(KEYLARGO_GPIO_LEVELS1, save_gpio_levels[1]);
1840 for (i=0; i<KEYLARGO_GPIO_EXTINT_CNT; i++)
1841 MACIO_OUT8(KEYLARGO_GPIO_EXTINT_0+i, save_gpio_extint[i]);
1842 for (i=0; i<KEYLARGO_GPIO_CNT; i++)
1843 MACIO_OUT8(KEYLARGO_GPIO_0+i, save_gpio_normal[i]);
1844
1845 /* FIXME more black magic with OpenPIC ... */
1846 if (pmac_mb.model_id == PMAC_TYPE_SAWTOOTH) {
1847 MACIO_BIC(0x506e0, 0x00400000);
1848 MACIO_BIC(0x506e0, 0x80000000);
1849 }
1850
1851 UN_OUT(UNI_N_CLOCK_CNTL, save_unin_clock_ctl);
1852 udelay(100);
1853
1854 return 0;
1855}
1856
1857static long
1858core99_sleep_state(struct device_node* node, long param, long value)
1859{
1860 /* Param == 1 means to enter the "fake sleep" mode that is
1861 * used for CPU speed switch
1862 */
1863 if (param == 1) {
1864 if (value == 1) {
1865 UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_SLEEPING);
1866 UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_IDLE2);
1867 } else {
1868 UN_OUT(UNI_N_POWER_MGT, UNI_N_POWER_MGT_NORMAL);
1869 udelay(10);
1870 UN_OUT(UNI_N_HWINIT_STATE, UNI_N_HWINIT_STATE_RUNNING);
1871 udelay(10);
1872 }
1873 return 0;
1874 }
1875 if ((pmac_mb.board_flags & PMAC_MB_CAN_SLEEP) == 0)
1876 return -EPERM;
1877
1878 if (value == 1)
1879 return core99_sleep();
1880 else if (value == 0)
1881 return core99_wake_up();
1882 return 0;
1883}
1884
1885#endif /* CONFIG_POWER4 */
1886
1887static long
1888generic_dev_can_wake(struct device_node* node, long param, long value)
1889{
1890 /* Todo: eventually check we are really dealing with on-board
1891 * video device ...
1892 */
1893
1894 if (pmac_mb.board_flags & PMAC_MB_MAY_SLEEP)
1895 pmac_mb.board_flags |= PMAC_MB_CAN_SLEEP;
1896 return 0;
1897}
1898
1899static long
1900generic_get_mb_info(struct device_node* node, long param, long value)
1901{
1902 switch(param) {
1903 case PMAC_MB_INFO_MODEL:
1904 return pmac_mb.model_id;
1905 case PMAC_MB_INFO_FLAGS:
1906 return pmac_mb.board_flags;
1907 case PMAC_MB_INFO_NAME:
1908 /* hack hack hack... but should work */
1909 *((const char **)value) = pmac_mb.model_name;
1910 return 0;
1911 }
1912 return -EINVAL;
1913}
1914
1915
1916/*
1917 * Table definitions
1918 */
1919
1920/* Used on any machine
1921 */
1922static struct feature_table_entry any_features[] = {
1923 { PMAC_FTR_GET_MB_INFO, generic_get_mb_info },
1924 { PMAC_FTR_DEVICE_CAN_WAKE, generic_dev_can_wake },
1925 { 0, NULL }
1926};
1927
1928#ifndef CONFIG_POWER4
1929
1930/* OHare based motherboards. Currently, we only use these on the
1931 * 2400,3400 and 3500 series powerbooks. Some older desktops seem
1932 * to have issues with turning on/off those asic cells
1933 */
1934static struct feature_table_entry ohare_features[] = {
1935 { PMAC_FTR_SCC_ENABLE, ohare_htw_scc_enable },
1936 { PMAC_FTR_SWIM3_ENABLE, ohare_floppy_enable },
1937 { PMAC_FTR_MESH_ENABLE, ohare_mesh_enable },
1938 { PMAC_FTR_IDE_ENABLE, ohare_ide_enable},
1939 { PMAC_FTR_IDE_RESET, ohare_ide_reset},
1940 { PMAC_FTR_SLEEP_STATE, ohare_sleep_state },
1941 { 0, NULL }
1942};
1943
1944/* Heathrow desktop machines (Beige G3).
1945 * Separated as some features couldn't be properly tested
1946 * and the serial port control bits appear to confuse it.
1947 */
1948static struct feature_table_entry heathrow_desktop_features[] = {
1949 { PMAC_FTR_SWIM3_ENABLE, heathrow_floppy_enable },
1950 { PMAC_FTR_MESH_ENABLE, heathrow_mesh_enable },
1951 { PMAC_FTR_IDE_ENABLE, heathrow_ide_enable },
1952 { PMAC_FTR_IDE_RESET, heathrow_ide_reset },
1953 { PMAC_FTR_BMAC_ENABLE, heathrow_bmac_enable },
1954 { 0, NULL }
1955};
1956
1957/* Heathrow based laptop, that is the Wallstreet and mainstreet
1958 * powerbooks.
1959 */
1960static struct feature_table_entry heathrow_laptop_features[] = {
1961 { PMAC_FTR_SCC_ENABLE, ohare_htw_scc_enable },
1962 { PMAC_FTR_MODEM_ENABLE, heathrow_modem_enable },
1963 { PMAC_FTR_SWIM3_ENABLE, heathrow_floppy_enable },
1964 { PMAC_FTR_MESH_ENABLE, heathrow_mesh_enable },
1965 { PMAC_FTR_IDE_ENABLE, heathrow_ide_enable },
1966 { PMAC_FTR_IDE_RESET, heathrow_ide_reset },
1967 { PMAC_FTR_BMAC_ENABLE, heathrow_bmac_enable },
1968 { PMAC_FTR_SOUND_CHIP_ENABLE, heathrow_sound_enable },
1969 { PMAC_FTR_SLEEP_STATE, heathrow_sleep_state },
1970 { 0, NULL }
1971};
1972
1973/* Paddington based machines
1974 * The lombard (101) powerbook, first iMac models, B&W G3 and Yikes G4.
1975 */
1976static struct feature_table_entry paddington_features[] = {
1977 { PMAC_FTR_SCC_ENABLE, ohare_htw_scc_enable },
1978 { PMAC_FTR_MODEM_ENABLE, heathrow_modem_enable },
1979 { PMAC_FTR_SWIM3_ENABLE, heathrow_floppy_enable },
1980 { PMAC_FTR_MESH_ENABLE, heathrow_mesh_enable },
1981 { PMAC_FTR_IDE_ENABLE, heathrow_ide_enable },
1982 { PMAC_FTR_IDE_RESET, heathrow_ide_reset },
1983 { PMAC_FTR_BMAC_ENABLE, heathrow_bmac_enable },
1984 { PMAC_FTR_SOUND_CHIP_ENABLE, heathrow_sound_enable },
1985 { PMAC_FTR_SLEEP_STATE, heathrow_sleep_state },
1986 { 0, NULL }
1987};
1988
1989/* Core99 & MacRISC 2 machines (all machines released since the
1990 * iBook (included), that is all AGP machines, except pangea
1991 * chipset. The pangea chipset is the "combo" UniNorth/KeyLargo
1992 * used on iBook2 & iMac "flow power".
1993 */
1994static struct feature_table_entry core99_features[] = {
1995 { PMAC_FTR_SCC_ENABLE, core99_scc_enable },
1996 { PMAC_FTR_MODEM_ENABLE, core99_modem_enable },
1997 { PMAC_FTR_IDE_ENABLE, core99_ide_enable },
1998 { PMAC_FTR_IDE_RESET, core99_ide_reset },
1999 { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable },
2000 { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset },
2001 { PMAC_FTR_SOUND_CHIP_ENABLE, core99_sound_chip_enable },
2002 { PMAC_FTR_AIRPORT_ENABLE, core99_airport_enable },
2003 { PMAC_FTR_USB_ENABLE, core99_usb_enable },
2004 { PMAC_FTR_1394_ENABLE, core99_firewire_enable },
2005 { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power },
2006 { PMAC_FTR_SLEEP_STATE, core99_sleep_state },
2007#ifdef CONFIG_SMP
2008 { PMAC_FTR_RESET_CPU, core99_reset_cpu },
2009#endif /* CONFIG_SMP */
2010 { PMAC_FTR_READ_GPIO, core99_read_gpio },
2011 { PMAC_FTR_WRITE_GPIO, core99_write_gpio },
2012 { 0, NULL }
2013};
2014
2015/* RackMac
2016 */
2017static struct feature_table_entry rackmac_features[] = {
2018 { PMAC_FTR_SCC_ENABLE, core99_scc_enable },
2019 { PMAC_FTR_IDE_ENABLE, core99_ide_enable },
2020 { PMAC_FTR_IDE_RESET, core99_ide_reset },
2021 { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable },
2022 { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset },
2023 { PMAC_FTR_USB_ENABLE, core99_usb_enable },
2024 { PMAC_FTR_1394_ENABLE, core99_firewire_enable },
2025 { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power },
2026 { PMAC_FTR_SLEEP_STATE, core99_sleep_state },
2027#ifdef CONFIG_SMP
2028 { PMAC_FTR_RESET_CPU, core99_reset_cpu },
2029#endif /* CONFIG_SMP */
2030 { PMAC_FTR_READ_GPIO, core99_read_gpio },
2031 { PMAC_FTR_WRITE_GPIO, core99_write_gpio },
2032 { 0, NULL }
2033};
2034
2035/* Pangea features
2036 */
2037static struct feature_table_entry pangea_features[] = {
2038 { PMAC_FTR_SCC_ENABLE, core99_scc_enable },
2039 { PMAC_FTR_MODEM_ENABLE, pangea_modem_enable },
2040 { PMAC_FTR_IDE_ENABLE, core99_ide_enable },
2041 { PMAC_FTR_IDE_RESET, core99_ide_reset },
2042 { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable },
2043 { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset },
2044 { PMAC_FTR_SOUND_CHIP_ENABLE, core99_sound_chip_enable },
2045 { PMAC_FTR_AIRPORT_ENABLE, core99_airport_enable },
2046 { PMAC_FTR_USB_ENABLE, core99_usb_enable },
2047 { PMAC_FTR_1394_ENABLE, core99_firewire_enable },
2048 { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power },
2049 { PMAC_FTR_SLEEP_STATE, core99_sleep_state },
2050 { PMAC_FTR_READ_GPIO, core99_read_gpio },
2051 { PMAC_FTR_WRITE_GPIO, core99_write_gpio },
2052 { 0, NULL }
2053};
2054
2055/* Intrepid features
2056 */
2057static struct feature_table_entry intrepid_features[] = {
2058 { PMAC_FTR_SCC_ENABLE, core99_scc_enable },
2059 { PMAC_FTR_MODEM_ENABLE, pangea_modem_enable },
2060 { PMAC_FTR_IDE_ENABLE, core99_ide_enable },
2061 { PMAC_FTR_IDE_RESET, core99_ide_reset },
2062 { PMAC_FTR_GMAC_ENABLE, core99_gmac_enable },
2063 { PMAC_FTR_GMAC_PHY_RESET, core99_gmac_phy_reset },
2064 { PMAC_FTR_SOUND_CHIP_ENABLE, core99_sound_chip_enable },
2065 { PMAC_FTR_AIRPORT_ENABLE, core99_airport_enable },
2066 { PMAC_FTR_USB_ENABLE, core99_usb_enable },
2067 { PMAC_FTR_1394_ENABLE, core99_firewire_enable },
2068 { PMAC_FTR_1394_CABLE_POWER, core99_firewire_cable_power },
2069 { PMAC_FTR_SLEEP_STATE, core99_sleep_state },
2070 { PMAC_FTR_READ_GPIO, core99_read_gpio },
2071 { PMAC_FTR_WRITE_GPIO, core99_write_gpio },
2072 { PMAC_FTR_AACK_DELAY_ENABLE, intrepid_aack_delay_enable },
2073 { 0, NULL }
2074};
2075
2076#else /* CONFIG_POWER4 */
2077
2078/* G5 features
2079 */
2080static struct feature_table_entry g5_features[] = {
2081 { PMAC_FTR_GMAC_ENABLE, g5_gmac_enable },
2082 { PMAC_FTR_1394_ENABLE, g5_fw_enable },
2083 { PMAC_FTR_ENABLE_MPIC, g5_mpic_enable },
2084#ifdef CONFIG_SMP
2085 { PMAC_FTR_RESET_CPU, g5_reset_cpu },
2086#endif /* CONFIG_SMP */
2087 { PMAC_FTR_READ_GPIO, core99_read_gpio },
2088 { PMAC_FTR_WRITE_GPIO, core99_write_gpio },
2089 { 0, NULL }
2090};
2091
2092#endif /* CONFIG_POWER4 */
2093
2094static struct pmac_mb_def pmac_mb_defs[] = {
2095#ifndef CONFIG_POWER4
2096 /*
2097 * Desktops
2098 */
2099
2100 { "AAPL,8500", "PowerMac 8500/8600",
2101 PMAC_TYPE_PSURGE, NULL,
2102 0
2103 },
2104 { "AAPL,9500", "PowerMac 9500/9600",
2105 PMAC_TYPE_PSURGE, NULL,
2106 0
2107 },
2108 { "AAPL,7200", "PowerMac 7200",
2109 PMAC_TYPE_PSURGE, NULL,
2110 0
2111 },
2112 { "AAPL,7300", "PowerMac 7200/7300",
2113 PMAC_TYPE_PSURGE, NULL,
2114 0
2115 },
2116 { "AAPL,7500", "PowerMac 7500",
2117 PMAC_TYPE_PSURGE, NULL,
2118 0
2119 },
2120 { "AAPL,ShinerESB", "Apple Network Server",
2121 PMAC_TYPE_ANS, NULL,
2122 0
2123 },
2124 { "AAPL,e407", "Alchemy",
2125 PMAC_TYPE_ALCHEMY, NULL,
2126 0
2127 },
2128 { "AAPL,e411", "Gazelle",
2129 PMAC_TYPE_GAZELLE, NULL,
2130 0
2131 },
2132 { "AAPL,Gossamer", "PowerMac G3 (Gossamer)",
2133 PMAC_TYPE_GOSSAMER, heathrow_desktop_features,
2134 0
2135 },
2136 { "AAPL,PowerMac G3", "PowerMac G3 (Silk)",
2137 PMAC_TYPE_SILK, heathrow_desktop_features,
2138 0
2139 },
2140 { "PowerMac1,1", "Blue&White G3",
2141 PMAC_TYPE_YOSEMITE, paddington_features,
2142 0
2143 },
2144 { "PowerMac1,2", "PowerMac G4 PCI Graphics",
2145 PMAC_TYPE_YIKES, paddington_features,
2146 0
2147 },
2148 { "PowerMac2,1", "iMac FireWire",
2149 PMAC_TYPE_FW_IMAC, core99_features,
2150 PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99
2151 },
2152 { "PowerMac2,2", "iMac FireWire",
2153 PMAC_TYPE_FW_IMAC, core99_features,
2154 PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99
2155 },
2156 { "PowerMac3,1", "PowerMac G4 AGP Graphics",
2157 PMAC_TYPE_SAWTOOTH, core99_features,
2158 PMAC_MB_OLD_CORE99
2159 },
2160 { "PowerMac3,2", "PowerMac G4 AGP Graphics",
2161 PMAC_TYPE_SAWTOOTH, core99_features,
2162 PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99
2163 },
2164 { "PowerMac3,3", "PowerMac G4 AGP Graphics",
2165 PMAC_TYPE_SAWTOOTH, core99_features,
2166 PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99
2167 },
2168 { "PowerMac3,4", "PowerMac G4 Silver",
2169 PMAC_TYPE_QUICKSILVER, core99_features,
2170 PMAC_MB_MAY_SLEEP
2171 },
2172 { "PowerMac3,5", "PowerMac G4 Silver",
2173 PMAC_TYPE_QUICKSILVER, core99_features,
2174 PMAC_MB_MAY_SLEEP
2175 },
2176 { "PowerMac3,6", "PowerMac G4 Windtunnel",
2177 PMAC_TYPE_WINDTUNNEL, core99_features,
2178 PMAC_MB_MAY_SLEEP,
2179 },
2180 { "PowerMac4,1", "iMac \"Flower Power\"",
2181 PMAC_TYPE_PANGEA_IMAC, pangea_features,
2182 PMAC_MB_MAY_SLEEP
2183 },
2184 { "PowerMac4,2", "Flat panel iMac",
2185 PMAC_TYPE_FLAT_PANEL_IMAC, pangea_features,
2186 PMAC_MB_CAN_SLEEP
2187 },
2188 { "PowerMac4,4", "eMac",
2189 PMAC_TYPE_EMAC, core99_features,
2190 PMAC_MB_MAY_SLEEP
2191 },
2192 { "PowerMac5,1", "PowerMac G4 Cube",
2193 PMAC_TYPE_CUBE, core99_features,
2194 PMAC_MB_MAY_SLEEP | PMAC_MB_OLD_CORE99
2195 },
2196 { "PowerMac6,1", "Flat panel iMac",
2197 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2198 PMAC_MB_MAY_SLEEP,
2199 },
2200 { "PowerMac6,3", "Flat panel iMac",
2201 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2202 PMAC_MB_MAY_SLEEP,
2203 },
2204 { "PowerMac6,4", "eMac",
2205 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2206 PMAC_MB_MAY_SLEEP,
2207 },
2208 { "PowerMac10,1", "Mac mini",
2209 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2210 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER,
2211 },
2212 { "iMac,1", "iMac (first generation)",
2213 PMAC_TYPE_ORIG_IMAC, paddington_features,
2214 0
2215 },
2216
2217 /*
2218 * Xserve's
2219 */
2220
2221 { "RackMac1,1", "XServe",
2222 PMAC_TYPE_RACKMAC, rackmac_features,
2223 0,
2224 },
2225 { "RackMac1,2", "XServe rev. 2",
2226 PMAC_TYPE_RACKMAC, rackmac_features,
2227 0,
2228 },
2229
2230 /*
2231 * Laptops
2232 */
2233
2234 { "AAPL,3400/2400", "PowerBook 3400",
2235 PMAC_TYPE_HOOPER, ohare_features,
2236 PMAC_MB_CAN_SLEEP | PMAC_MB_MOBILE
2237 },
2238 { "AAPL,3500", "PowerBook 3500",
2239 PMAC_TYPE_KANGA, ohare_features,
2240 PMAC_MB_CAN_SLEEP | PMAC_MB_MOBILE
2241 },
2242 { "AAPL,PowerBook1998", "PowerBook Wallstreet",
2243 PMAC_TYPE_WALLSTREET, heathrow_laptop_features,
2244 PMAC_MB_CAN_SLEEP | PMAC_MB_MOBILE
2245 },
2246 { "PowerBook1,1", "PowerBook 101 (Lombard)",
2247 PMAC_TYPE_101_PBOOK, paddington_features,
2248 PMAC_MB_CAN_SLEEP | PMAC_MB_MOBILE
2249 },
2250 { "PowerBook2,1", "iBook (first generation)",
2251 PMAC_TYPE_ORIG_IBOOK, core99_features,
2252 PMAC_MB_CAN_SLEEP | PMAC_MB_OLD_CORE99 | PMAC_MB_MOBILE
2253 },
2254 { "PowerBook2,2", "iBook FireWire",
2255 PMAC_TYPE_FW_IBOOK, core99_features,
2256 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER |
2257 PMAC_MB_OLD_CORE99 | PMAC_MB_MOBILE
2258 },
2259 { "PowerBook3,1", "PowerBook Pismo",
2260 PMAC_TYPE_PISMO, core99_features,
2261 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER |
2262 PMAC_MB_OLD_CORE99 | PMAC_MB_MOBILE
2263 },
2264 { "PowerBook3,2", "PowerBook Titanium",
2265 PMAC_TYPE_TITANIUM, core99_features,
2266 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2267 },
2268 { "PowerBook3,3", "PowerBook Titanium II",
2269 PMAC_TYPE_TITANIUM2, core99_features,
2270 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2271 },
2272 { "PowerBook3,4", "PowerBook Titanium III",
2273 PMAC_TYPE_TITANIUM3, core99_features,
2274 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2275 },
2276 { "PowerBook3,5", "PowerBook Titanium IV",
2277 PMAC_TYPE_TITANIUM4, core99_features,
2278 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2279 },
2280 { "PowerBook4,1", "iBook 2",
2281 PMAC_TYPE_IBOOK2, pangea_features,
2282 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2283 },
2284 { "PowerBook4,2", "iBook 2",
2285 PMAC_TYPE_IBOOK2, pangea_features,
2286 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2287 },
2288 { "PowerBook4,3", "iBook 2 rev. 2",
2289 PMAC_TYPE_IBOOK2, pangea_features,
2290 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE
2291 },
2292 { "PowerBook5,1", "PowerBook G4 17\"",
2293 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2294 PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2295 },
2296 { "PowerBook5,2", "PowerBook G4 15\"",
2297 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2298 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2299 },
2300 { "PowerBook5,3", "PowerBook G4 17\"",
2301 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2302 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2303 },
2304 { "PowerBook5,4", "PowerBook G4 15\"",
2305 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2306 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2307 },
2308 { "PowerBook5,5", "PowerBook G4 17\"",
2309 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2310 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2311 },
2312 { "PowerBook5,6", "PowerBook G4 15\"",
2313 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2314 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2315 },
2316 { "PowerBook5,7", "PowerBook G4 17\"",
2317 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2318 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2319 },
2320 { "PowerBook5,8", "PowerBook G4 15\"",
2321 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2322 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2323 },
2324 { "PowerBook5,9", "PowerBook G4 17\"",
2325 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2326 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2327 },
2328 { "PowerBook6,1", "PowerBook G4 12\"",
2329 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2330 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2331 },
2332 { "PowerBook6,2", "PowerBook G4",
2333 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2334 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2335 },
2336 { "PowerBook6,3", "iBook G4",
2337 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2338 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2339 },
2340 { "PowerBook6,4", "PowerBook G4 12\"",
2341 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2342 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2343 },
2344 { "PowerBook6,5", "iBook G4",
2345 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2346 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2347 },
2348 { "PowerBook6,7", "iBook G4",
2349 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2350 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2351 },
2352 { "PowerBook6,8", "PowerBook G4 12\"",
2353 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2354 PMAC_MB_MAY_SLEEP | PMAC_MB_HAS_FW_POWER | PMAC_MB_MOBILE,
2355 },
2356#else /* CONFIG_POWER4 */
2357 { "PowerMac7,2", "PowerMac G5",
2358 PMAC_TYPE_POWERMAC_G5, g5_features,
2359 0,
2360 },
2361#endif /* CONFIG_POWER4 */
2362};
2363
2364/*
2365 * The toplevel feature_call callback
2366 */
2367long
2368pmac_do_feature_call(unsigned int selector, ...)
2369{
2370 struct device_node* node;
2371 long param, value;
2372 int i;
2373 feature_call func = NULL;
2374 va_list args;
2375
2376 if (pmac_mb.features)
2377 for (i=0; pmac_mb.features[i].function; i++)
2378 if (pmac_mb.features[i].selector == selector) {
2379 func = pmac_mb.features[i].function;
2380 break;
2381 }
2382 if (!func)
2383 for (i=0; any_features[i].function; i++)
2384 if (any_features[i].selector == selector) {
2385 func = any_features[i].function;
2386 break;
2387 }
2388 if (!func)
2389 return -ENODEV;
2390
2391 va_start(args, selector);
2392 node = (struct device_node*)va_arg(args, void*);
2393 param = va_arg(args, long);
2394 value = va_arg(args, long);
2395 va_end(args);
2396
2397 return func(node, param, value);
2398}
2399
2400static int __init
2401probe_motherboard(void)
2402{
2403 int i;
2404 struct macio_chip* macio = &macio_chips[0];
2405 const char* model = NULL;
2406 struct device_node *dt;
2407
2408 /* Lookup known motherboard type in device-tree. First try an
2409 * exact match on the "model" property, then try a "compatible"
2410 * match is none is found.
2411 */
2412 dt = find_devices("device-tree");
2413 if (dt != NULL)
2414 model = (const char *) get_property(dt, "model", NULL);
2415 for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) {
2416 if (strcmp(model, pmac_mb_defs[i].model_string) == 0) {
2417 pmac_mb = pmac_mb_defs[i];
2418 goto found;
2419 }
2420 }
2421 for(i=0; i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) {
2422 if (machine_is_compatible(pmac_mb_defs[i].model_string)) {
2423 pmac_mb = pmac_mb_defs[i];
2424 goto found;
2425 }
2426 }
2427
2428 /* Fallback to selection depending on mac-io chip type */
2429 switch(macio->type) {
2430#ifndef CONFIG_POWER4
2431 case macio_grand_central:
2432 pmac_mb.model_id = PMAC_TYPE_PSURGE;
2433 pmac_mb.model_name = "Unknown PowerSurge";
2434 break;
2435 case macio_ohare:
2436 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_OHARE;
2437 pmac_mb.model_name = "Unknown OHare-based";
2438 break;
2439 case macio_heathrow:
2440 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_HEATHROW;
2441 pmac_mb.model_name = "Unknown Heathrow-based";
2442 pmac_mb.features = heathrow_desktop_features;
2443 break;
2444 case macio_paddington:
2445 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_PADDINGTON;
2446 pmac_mb.model_name = "Unknown Paddington-based";
2447 pmac_mb.features = paddington_features;
2448 break;
2449 case macio_keylargo:
2450 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_CORE99;
2451 pmac_mb.model_name = "Unknown Keylargo-based";
2452 pmac_mb.features = core99_features;
2453 break;
2454 case macio_pangea:
2455 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_PANGEA;
2456 pmac_mb.model_name = "Unknown Pangea-based";
2457 pmac_mb.features = pangea_features;
2458 break;
2459 case macio_intrepid:
2460 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_INTREPID;
2461 pmac_mb.model_name = "Unknown Intrepid-based";
2462 pmac_mb.features = intrepid_features;
2463 break;
2464#else /* CONFIG_POWER4 */
2465 case macio_keylargo2:
2466 pmac_mb.model_id = PMAC_TYPE_UNKNOWN_K2;
2467 pmac_mb.model_name = "Unknown G5";
2468 pmac_mb.features = g5_features;
2469 break;
2470#endif /* CONFIG_POWER4 */
2471 default:
2472 return -ENODEV;
2473 }
2474found:
2475#ifndef CONFIG_POWER4
2476 /* Fixup Hooper vs. Comet */
2477 if (pmac_mb.model_id == PMAC_TYPE_HOOPER) {
2478 u32 __iomem * mach_id_ptr = ioremap(0xf3000034, 4);
2479 if (!mach_id_ptr)
2480 return -ENODEV;
2481 /* Here, I used to disable the media-bay on comet. It
2482 * appears this is wrong, the floppy connector is actually
2483 * a kind of media-bay and works with the current driver.
2484 */
2485 if (__raw_readl(mach_id_ptr) & 0x20000000UL)
2486 pmac_mb.model_id = PMAC_TYPE_COMET;
2487 iounmap(mach_id_ptr);
2488 }
2489#endif /* CONFIG_POWER4 */
2490
2491#ifdef CONFIG_6xx
2492 /* Set default value of powersave_nap on machines that support it.
2493 * It appears that uninorth rev 3 has a problem with it, we don't
2494 * enable it on those. In theory, the flush-on-lock property is
2495 * supposed to be set when not supported, but I'm not very confident
2496 * that all Apple OF revs did it properly, I do it the paranoid way.
2497 */
2498 while (uninorth_base && uninorth_rev > 3) {
2499 struct device_node* np = find_path_device("/cpus");
2500 if (!np || !np->child) {
2501 printk(KERN_WARNING "Can't find CPU(s) in device tree !\n");
2502 break;
2503 }
2504 np = np->child;
2505 /* Nap mode not supported on SMP */
2506 if (np->sibling)
2507 break;
2508 /* Nap mode not supported if flush-on-lock property is present */
2509 if (get_property(np, "flush-on-lock", NULL))
2510 break;
2511 powersave_nap = 1;
2512 printk(KERN_INFO "Processor NAP mode on idle enabled.\n");
2513 break;
2514 }
2515
2516 /* On CPUs that support it (750FX), lowspeed by default during
2517 * NAP mode
2518 */
2519 powersave_lowspeed = 1;
2520#endif /* CONFIG_6xx */
2521#ifdef CONFIG_POWER4
2522 powersave_nap = 1;
2523#endif
2524 /* Check for "mobile" machine */
2525 if (model && (strncmp(model, "PowerBook", 9) == 0
2526 || strncmp(model, "iBook", 5) == 0))
2527 pmac_mb.board_flags |= PMAC_MB_MOBILE;
2528
2529
2530 printk(KERN_INFO "PowerMac motherboard: %s\n", pmac_mb.model_name);
2531 return 0;
2532}
2533
2534/* Initialize the Core99 UniNorth host bridge and memory controller
2535 */
2536static void __init
2537probe_uninorth(void)
2538{
2539 unsigned long actrl;
2540
2541 /* Locate core99 Uni-N */
2542 uninorth_node = of_find_node_by_name(NULL, "uni-n");
2543 /* Locate G5 u3 */
2544 if (uninorth_node == NULL) {
2545 uninorth_node = of_find_node_by_name(NULL, "u3");
2546 uninorth_u3 = 1;
2547 }
2548 if (uninorth_node && uninorth_node->n_addrs > 0) {
2549 unsigned long address = uninorth_node->addrs[0].address;
2550 uninorth_base = ioremap(address, 0x40000);
2551 uninorth_rev = in_be32(UN_REG(UNI_N_VERSION));
2552 if (uninorth_u3)
2553 u3_ht = ioremap(address + U3_HT_CONFIG_BASE, 0x1000);
2554 } else
2555 uninorth_node = NULL;
2556
2557 if (!uninorth_node)
2558 return;
2559
2560 printk(KERN_INFO "Found %s memory controller & host bridge, revision: %d\n",
2561 uninorth_u3 ? "U3" : "UniNorth", uninorth_rev);
2562 printk(KERN_INFO "Mapped at 0x%08lx\n", (unsigned long)uninorth_base);
2563
2564 /* Set the arbitrer QAck delay according to what Apple does
2565 */
2566 if (uninorth_rev < 0x11) {
2567 actrl = UN_IN(UNI_N_ARB_CTRL) & ~UNI_N_ARB_CTRL_QACK_DELAY_MASK;
2568 actrl |= ((uninorth_rev < 3) ? UNI_N_ARB_CTRL_QACK_DELAY105 :
2569 UNI_N_ARB_CTRL_QACK_DELAY) << UNI_N_ARB_CTRL_QACK_DELAY_SHIFT;
2570 UN_OUT(UNI_N_ARB_CTRL, actrl);
2571 }
2572
2573 /* Some more magic as done by them in recent MacOS X on UniNorth
2574 * revs 1.5 to 2.O and Pangea. Seem to toggle the UniN Maxbus/PCI
2575 * memory timeout
2576 */
2577 if ((uninorth_rev >= 0x11 && uninorth_rev <= 0x24) || uninorth_rev == 0xc0)
2578 UN_OUT(0x2160, UN_IN(0x2160) & 0x00ffffff);
2579}
2580
2581static void __init
2582probe_one_macio(const char* name, const char* compat, int type)
2583{
2584 struct device_node* node;
2585 int i;
2586 volatile u32 __iomem * base;
2587 u32* revp;
2588
2589 node = find_devices(name);
2590 if (!node || !node->n_addrs)
2591 return;
2592 if (compat)
2593 do {
2594 if (device_is_compatible(node, compat))
2595 break;
2596 node = node->next;
2597 } while (node);
2598 if (!node)
2599 return;
2600 for(i=0; i<MAX_MACIO_CHIPS; i++) {
2601 if (!macio_chips[i].of_node)
2602 break;
2603 if (macio_chips[i].of_node == node)
2604 return;
2605 }
2606 if (i >= MAX_MACIO_CHIPS) {
2607 printk(KERN_ERR "pmac_feature: Please increase MAX_MACIO_CHIPS !\n");
2608 printk(KERN_ERR "pmac_feature: %s skipped\n", node->full_name);
2609 return;
2610 }
2611 base = ioremap(node->addrs[0].address, node->addrs[0].size);
2612 if (!base) {
2613 printk(KERN_ERR "pmac_feature: Can't map mac-io chip !\n");
2614 return;
2615 }
2616 if (type == macio_keylargo) {
2617 u32* did = (u32 *)get_property(node, "device-id", NULL);
2618 if (*did == 0x00000025)
2619 type = macio_pangea;
2620 if (*did == 0x0000003e)
2621 type = macio_intrepid;
2622 }
2623 macio_chips[i].of_node = node;
2624 macio_chips[i].type = type;
2625 macio_chips[i].base = base;
2626 macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON;
2627 macio_chips[i].name = macio_names[type];
2628 revp = (u32 *)get_property(node, "revision-id", NULL);
2629 if (revp)
2630 macio_chips[i].rev = *revp;
2631 printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n",
2632 macio_names[type], macio_chips[i].rev, macio_chips[i].base);
2633}
2634
2635static int __init
2636probe_macios(void)
2637{
2638 /* Warning, ordering is important */
2639 probe_one_macio("gc", NULL, macio_grand_central);
2640 probe_one_macio("ohare", NULL, macio_ohare);
2641 probe_one_macio("pci106b,7", NULL, macio_ohareII);
2642 probe_one_macio("mac-io", "keylargo", macio_keylargo);
2643 probe_one_macio("mac-io", "paddington", macio_paddington);
2644 probe_one_macio("mac-io", "gatwick", macio_gatwick);
2645 probe_one_macio("mac-io", "heathrow", macio_heathrow);
2646 probe_one_macio("mac-io", "K2-Keylargo", macio_keylargo2);
2647
2648 /* Make sure the "main" macio chip appear first */
2649 if (macio_chips[0].type == macio_gatwick
2650 && macio_chips[1].type == macio_heathrow) {
2651 struct macio_chip temp = macio_chips[0];
2652 macio_chips[0] = macio_chips[1];
2653 macio_chips[1] = temp;
2654 }
2655 if (macio_chips[0].type == macio_ohareII
2656 && macio_chips[1].type == macio_ohare) {
2657 struct macio_chip temp = macio_chips[0];
2658 macio_chips[0] = macio_chips[1];
2659 macio_chips[1] = temp;
2660 }
2661 macio_chips[0].lbus.index = 0;
2662 macio_chips[1].lbus.index = 1;
2663
2664 return (macio_chips[0].of_node == NULL) ? -ENODEV : 0;
2665}
2666
2667static void __init
2668initial_serial_shutdown(struct device_node* np)
2669{
2670 int len;
2671 struct slot_names_prop {
2672 int count;
2673 char name[1];
2674 } *slots;
2675 char *conn;
2676 int port_type = PMAC_SCC_ASYNC;
2677 int modem = 0;
2678
2679 slots = (struct slot_names_prop *)get_property(np, "slot-names", &len);
2680 conn = get_property(np, "AAPL,connector", &len);
2681 if (conn && (strcmp(conn, "infrared") == 0))
2682 port_type = PMAC_SCC_IRDA;
2683 else if (device_is_compatible(np, "cobalt"))
2684 modem = 1;
2685 else if (slots && slots->count > 0) {
2686 if (strcmp(slots->name, "IrDA") == 0)
2687 port_type = PMAC_SCC_IRDA;
2688 else if (strcmp(slots->name, "Modem") == 0)
2689 modem = 1;
2690 }
2691 if (modem)
2692 pmac_call_feature(PMAC_FTR_MODEM_ENABLE, np, 0, 0);
2693 pmac_call_feature(PMAC_FTR_SCC_ENABLE, np, port_type, 0);
2694}
2695
2696static void __init
2697set_initial_features(void)
2698{
2699 struct device_node* np;
2700
2701 /* That hack appears to be necessary for some StarMax motherboards
2702 * but I'm not too sure it was audited for side-effects on other
2703 * ohare based machines...
2704 * Since I still have difficulties figuring the right way to
2705 * differenciate them all and since that hack was there for a long
2706 * time, I'll keep it around
2707 */
2708 if (macio_chips[0].type == macio_ohare && !find_devices("via-pmu")) {
2709 struct macio_chip* macio = &macio_chips[0];
2710 MACIO_OUT32(OHARE_FCR, STARMAX_FEATURES);
2711 } else if (macio_chips[0].type == macio_ohare) {
2712 struct macio_chip* macio = &macio_chips[0];
2713 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE);
2714 } else if (macio_chips[1].type == macio_ohare) {
2715 struct macio_chip* macio = &macio_chips[1];
2716 MACIO_BIS(OHARE_FCR, OH_IOBUS_ENABLE);
2717 }
2718
2719#ifdef CONFIG_POWER4
2720 if (macio_chips[0].type == macio_keylargo2) {
2721#ifndef CONFIG_SMP
2722 /* On SMP machines running UP, we have the second CPU eating
2723 * bus cycles. We need to take it off the bus. This is done
2724 * from pmac_smp for SMP kernels running on one CPU
2725 */
2726 np = of_find_node_by_type(NULL, "cpu");
2727 if (np != NULL)
2728 np = of_find_node_by_type(np, "cpu");
2729 if (np != NULL) {
2730 g5_phy_disable_cpu1();
2731 of_node_put(np);
2732 }
2733#endif /* CONFIG_SMP */
2734 /* Enable GMAC for now for PCI probing. It will be disabled
2735 * later on after PCI probe
2736 */
2737 np = of_find_node_by_name(NULL, "ethernet");
2738 while(np) {
2739 if (device_is_compatible(np, "K2-GMAC"))
2740 g5_gmac_enable(np, 0, 1);
2741 np = of_find_node_by_name(np, "ethernet");
2742 }
2743
2744 /* Enable FW before PCI probe. Will be disabled later on
2745 * Note: We should have a batter way to check that we are
2746 * dealing with uninorth internal cell and not a PCI cell
2747 * on the external PCI. The code below works though.
2748 */
2749 np = of_find_node_by_name(NULL, "firewire");
2750 while(np) {
2751 if (device_is_compatible(np, "pci106b,5811")) {
2752 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
2753 g5_fw_enable(np, 0, 1);
2754 }
2755 np = of_find_node_by_name(np, "firewire");
2756 }
2757 }
2758#else /* CONFIG_POWER4 */
2759
2760 if (macio_chips[0].type == macio_keylargo ||
2761 macio_chips[0].type == macio_pangea ||
2762 macio_chips[0].type == macio_intrepid) {
2763 /* Enable GMAC for now for PCI probing. It will be disabled
2764 * later on after PCI probe
2765 */
2766 np = of_find_node_by_name(NULL, "ethernet");
2767 while(np) {
2768 if (np->parent
2769 && device_is_compatible(np->parent, "uni-north")
2770 && device_is_compatible(np, "gmac"))
2771 core99_gmac_enable(np, 0, 1);
2772 np = of_find_node_by_name(np, "ethernet");
2773 }
2774
2775 /* Enable FW before PCI probe. Will be disabled later on
2776 * Note: We should have a batter way to check that we are
2777 * dealing with uninorth internal cell and not a PCI cell
2778 * on the external PCI. The code below works though.
2779 */
2780 np = of_find_node_by_name(NULL, "firewire");
2781 while(np) {
2782 if (np->parent
2783 && device_is_compatible(np->parent, "uni-north")
2784 && (device_is_compatible(np, "pci106b,18") ||
2785 device_is_compatible(np, "pci106b,30") ||
2786 device_is_compatible(np, "pci11c1,5811"))) {
2787 macio_chips[0].flags |= MACIO_FLAG_FW_SUPPORTED;
2788 core99_firewire_enable(np, 0, 1);
2789 }
2790 np = of_find_node_by_name(np, "firewire");
2791 }
2792
2793 /* Enable ATA-100 before PCI probe. */
2794 np = of_find_node_by_name(NULL, "ata-6");
2795 while(np) {
2796 if (np->parent
2797 && device_is_compatible(np->parent, "uni-north")
2798 && device_is_compatible(np, "kauai-ata")) {
2799 core99_ata100_enable(np, 1);
2800 }
2801 np = of_find_node_by_name(np, "ata-6");
2802 }
2803
2804 /* Switch airport off */
2805 np = find_devices("radio");
2806 while(np) {
2807 if (np && np->parent == macio_chips[0].of_node) {
2808 macio_chips[0].flags |= MACIO_FLAG_AIRPORT_ON;
2809 core99_airport_enable(np, 0, 0);
2810 }
2811 np = np->next;
2812 }
2813 }
2814
2815 /* On all machines that support sound PM, switch sound off */
2816 if (macio_chips[0].of_node)
2817 pmac_do_feature_call(PMAC_FTR_SOUND_CHIP_ENABLE,
2818 macio_chips[0].of_node, 0, 0);
2819
2820 /* While on some desktop G3s, we turn it back on */
2821 if (macio_chips[0].of_node && macio_chips[0].type == macio_heathrow
2822 && (pmac_mb.model_id == PMAC_TYPE_GOSSAMER ||
2823 pmac_mb.model_id == PMAC_TYPE_SILK)) {
2824 struct macio_chip* macio = &macio_chips[0];
2825 MACIO_BIS(HEATHROW_FCR, HRW_SOUND_CLK_ENABLE);
2826 MACIO_BIC(HEATHROW_FCR, HRW_SOUND_POWER_N);
2827 }
2828
2829 /* Some machine models need the clock chip to be properly setup for
2830 * clock spreading now. This should be a platform function but we
2831 * don't do these at the moment
2832 */
2833 pmac_tweak_clock_spreading(1);
2834
2835#endif /* CONFIG_POWER4 */
2836
2837 /* On all machines, switch modem & serial ports off */
2838 np = find_devices("ch-a");
2839 while(np) {
2840 initial_serial_shutdown(np);
2841 np = np->next;
2842 }
2843 np = find_devices("ch-b");
2844 while(np) {
2845 initial_serial_shutdown(np);
2846 np = np->next;
2847 }
2848}
2849
2850void __init
2851pmac_feature_init(void)
2852{
2853 /* Detect the UniNorth memory controller */
2854 probe_uninorth();
2855
2856 /* Probe mac-io controllers */
2857 if (probe_macios()) {
2858 printk(KERN_WARNING "No mac-io chip found\n");
2859 return;
2860 }
2861
2862 /* Setup low-level i2c stuffs */
2863 pmac_init_low_i2c();
2864
2865 /* Probe machine type */
2866 if (probe_motherboard())
2867 printk(KERN_WARNING "Unknown PowerMac !\n");
2868
2869 /* Set some initial features (turn off some chips that will
2870 * be later turned on)
2871 */
2872 set_initial_features();
2873}
2874
2875int __init
2876pmac_feature_late_init(void)
2877{
2878 struct device_node* np;
2879
2880 /* Request some resources late */
2881 if (uninorth_node)
2882 request_OF_resource(uninorth_node, 0, NULL);
2883 np = find_devices("hammerhead");
2884 if (np)
2885 request_OF_resource(np, 0, NULL);
2886 np = find_devices("interrupt-controller");
2887 if (np)
2888 request_OF_resource(np, 0, NULL);
2889 return 0;
2890}
2891
2892device_initcall(pmac_feature_late_init);
2893
2894#ifdef CONFIG_POWER4
2895
2896static void dump_HT_speeds(char *name, u32 cfg, u32 frq)
2897{
2898 int freqs[16] = { 200,300,400,500,600,800,1000,0,0,0,0,0,0,0,0,0 };
2899 int bits[8] = { 8,16,0,32,2,4,0,0 };
2900 int freq = (frq >> 8) & 0xf;
2901
2902 if (freqs[freq] == 0)
2903 printk("%s: Unknown HT link frequency %x\n", name, freq);
2904 else
2905 printk("%s: %d MHz on main link, (%d in / %d out) bits width\n",
2906 name, freqs[freq],
2907 bits[(cfg >> 28) & 0x7], bits[(cfg >> 24) & 0x7]);
2908}
2909
2910void __init pmac_check_ht_link(void)
2911{
2912 u32 ufreq, freq, ucfg, cfg;
2913 struct device_node *pcix_node;
2914 u8 px_bus, px_devfn;
2915 struct pci_controller *px_hose;
2916
2917 (void)in_be32(u3_ht + U3_HT_LINK_COMMAND);
2918 ucfg = cfg = in_be32(u3_ht + U3_HT_LINK_CONFIG);
2919 ufreq = freq = in_be32(u3_ht + U3_HT_LINK_FREQ);
2920 dump_HT_speeds("U3 HyperTransport", cfg, freq);
2921
2922 pcix_node = of_find_compatible_node(NULL, "pci", "pci-x");
2923 if (pcix_node == NULL) {
2924 printk("No PCI-X bridge found\n");
2925 return;
2926 }
2927 if (pci_device_from_OF_node(pcix_node, &px_bus, &px_devfn) != 0) {
2928 printk("PCI-X bridge found but not matched to pci\n");
2929 return;
2930 }
2931 px_hose = pci_find_hose_for_OF_device(pcix_node);
2932 if (px_hose == NULL) {
2933 printk("PCI-X bridge found but not matched to host\n");
2934 return;
2935 }
2936 early_read_config_dword(px_hose, px_bus, px_devfn, 0xc4, &cfg);
2937 early_read_config_dword(px_hose, px_bus, px_devfn, 0xcc, &freq);
2938 dump_HT_speeds("PCI-X HT Uplink", cfg, freq);
2939 early_read_config_dword(px_hose, px_bus, px_devfn, 0xc8, &cfg);
2940 early_read_config_dword(px_hose, px_bus, px_devfn, 0xd0, &freq);
2941 dump_HT_speeds("PCI-X HT Downlink", cfg, freq);
2942}
2943
2944#endif /* CONFIG_POWER4 */
2945
2946/*
2947 * Early video resume hook
2948 */
2949
2950static void (*pmac_early_vresume_proc)(void *data);
2951static void *pmac_early_vresume_data;
2952
2953void pmac_set_early_video_resume(void (*proc)(void *data), void *data)
2954{
2955 if (_machine != _MACH_Pmac)
2956 return;
2957 preempt_disable();
2958 pmac_early_vresume_proc = proc;
2959 pmac_early_vresume_data = data;
2960 preempt_enable();
2961}
2962EXPORT_SYMBOL(pmac_set_early_video_resume);
2963
2964void pmac_call_early_video_resume(void)
2965{
2966 if (pmac_early_vresume_proc)
2967 pmac_early_vresume_proc(pmac_early_vresume_data);
2968}
2969
2970/*
2971 * AGP related suspend/resume code
2972 */
2973
2974static struct pci_dev *pmac_agp_bridge;
2975static int (*pmac_agp_suspend)(struct pci_dev *bridge);
2976static int (*pmac_agp_resume)(struct pci_dev *bridge);
2977
2978void pmac_register_agp_pm(struct pci_dev *bridge,
2979 int (*suspend)(struct pci_dev *bridge),
2980 int (*resume)(struct pci_dev *bridge))
2981{
2982 if (suspend || resume) {
2983 pmac_agp_bridge = bridge;
2984 pmac_agp_suspend = suspend;
2985 pmac_agp_resume = resume;
2986 return;
2987 }
2988 if (bridge != pmac_agp_bridge)
2989 return;
2990 pmac_agp_suspend = pmac_agp_resume = NULL;
2991 return;
2992}
2993EXPORT_SYMBOL(pmac_register_agp_pm);
2994
2995void pmac_suspend_agp_for_card(struct pci_dev *dev)
2996{
2997 if (pmac_agp_bridge == NULL || pmac_agp_suspend == NULL)
2998 return;
2999 if (pmac_agp_bridge->bus != dev->bus)
3000 return;
3001 pmac_agp_suspend(pmac_agp_bridge);
3002}
3003EXPORT_SYMBOL(pmac_suspend_agp_for_card);
3004
3005void pmac_resume_agp_for_card(struct pci_dev *dev)
3006{
3007 if (pmac_agp_bridge == NULL || pmac_agp_resume == NULL)
3008 return;
3009 if (pmac_agp_bridge->bus != dev->bus)
3010 return;
3011 pmac_agp_resume(pmac_agp_bridge);
3012}
3013EXPORT_SYMBOL(pmac_resume_agp_for_card);
diff --git a/arch/ppc/platforms/pmac_low_i2c.c b/arch/ppc/platforms/pmac_low_i2c.c
deleted file mode 100644
index 08583fce1692..000000000000
--- a/arch/ppc/platforms/pmac_low_i2c.c
+++ /dev/null
@@ -1,511 +0,0 @@
1/*
2 * arch/ppc/platforms/pmac_low_i2c.c
3 *
4 * Copyright (C) 2003 Ben. Herrenschmidt (benh@kernel.crashing.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * This file contains some low-level i2c access routines that
12 * need to be used by various bits of the PowerMac platform code
13 * at times where the real asynchronous & interrupt driven driver
14 * cannot be used. The API borrows some semantics from the darwin
15 * driver in order to ease the implementation of the platform
16 * properties parser
17 */
18
19#include <linux/config.h>
20#include <linux/types.h>
21#include <linux/delay.h>
22#include <linux/sched.h>
23#include <linux/init.h>
24#include <linux/module.h>
25#include <linux/adb.h>
26#include <linux/pmu.h>
27#include <asm/keylargo.h>
28#include <asm/uninorth.h>
29#include <asm/io.h>
30#include <asm/prom.h>
31#include <asm/machdep.h>
32#include <asm/pmac_low_i2c.h>
33
34#define MAX_LOW_I2C_HOST 4
35
36#if 1
37#define DBG(x...) do {\
38 printk(KERN_DEBUG "KW:" x); \
39 } while(0)
40#else
41#define DBGG(x...)
42#endif
43
44struct low_i2c_host;
45
46typedef int (*low_i2c_func_t)(struct low_i2c_host *host, u8 addr, u8 sub, u8 *data, int len);
47
48struct low_i2c_host
49{
50 struct device_node *np; /* OF device node */
51 struct semaphore mutex; /* Access mutex for use by i2c-keywest */
52 low_i2c_func_t func; /* Access function */
53 int is_open : 1; /* Poor man's access control */
54 int mode; /* Current mode */
55 int channel; /* Current channel */
56 int num_channels; /* Number of channels */
57 void __iomem * base; /* For keywest-i2c, base address */
58 int bsteps; /* And register stepping */
59 int speed; /* And speed */
60};
61
62static struct low_i2c_host low_i2c_hosts[MAX_LOW_I2C_HOST];
63
64/* No locking is necessary on allocation, we are running way before
65 * anything can race with us
66 */
67static struct low_i2c_host *find_low_i2c_host(struct device_node *np)
68{
69 int i;
70
71 for (i = 0; i < MAX_LOW_I2C_HOST; i++)
72 if (low_i2c_hosts[i].np == np)
73 return &low_i2c_hosts[i];
74 return NULL;
75}
76
77/*
78 *
79 * i2c-keywest implementation (UniNorth, U2, U3, Keylargo's)
80 *
81 */
82
83/*
84 * Keywest i2c definitions borrowed from drivers/i2c/i2c-keywest.h,
85 * should be moved somewhere in include/asm-ppc/
86 */
87/* Register indices */
88typedef enum {
89 reg_mode = 0,
90 reg_control,
91 reg_status,
92 reg_isr,
93 reg_ier,
94 reg_addr,
95 reg_subaddr,
96 reg_data
97} reg_t;
98
99
100/* Mode register */
101#define KW_I2C_MODE_100KHZ 0x00
102#define KW_I2C_MODE_50KHZ 0x01
103#define KW_I2C_MODE_25KHZ 0x02
104#define KW_I2C_MODE_DUMB 0x00
105#define KW_I2C_MODE_STANDARD 0x04
106#define KW_I2C_MODE_STANDARDSUB 0x08
107#define KW_I2C_MODE_COMBINED 0x0C
108#define KW_I2C_MODE_MODE_MASK 0x0C
109#define KW_I2C_MODE_CHAN_MASK 0xF0
110
111/* Control register */
112#define KW_I2C_CTL_AAK 0x01
113#define KW_I2C_CTL_XADDR 0x02
114#define KW_I2C_CTL_STOP 0x04
115#define KW_I2C_CTL_START 0x08
116
117/* Status register */
118#define KW_I2C_STAT_BUSY 0x01
119#define KW_I2C_STAT_LAST_AAK 0x02
120#define KW_I2C_STAT_LAST_RW 0x04
121#define KW_I2C_STAT_SDA 0x08
122#define KW_I2C_STAT_SCL 0x10
123
124/* IER & ISR registers */
125#define KW_I2C_IRQ_DATA 0x01
126#define KW_I2C_IRQ_ADDR 0x02
127#define KW_I2C_IRQ_STOP 0x04
128#define KW_I2C_IRQ_START 0x08
129#define KW_I2C_IRQ_MASK 0x0F
130
131/* State machine states */
132enum {
133 state_idle,
134 state_addr,
135 state_read,
136 state_write,
137 state_stop,
138 state_dead
139};
140
141#define WRONG_STATE(name) do {\
142 printk(KERN_DEBUG "KW: wrong state. Got %s, state: %s (isr: %02x)\n", \
143 name, __kw_state_names[state], isr); \
144 } while(0)
145
146static const char *__kw_state_names[] = {
147 "state_idle",
148 "state_addr",
149 "state_read",
150 "state_write",
151 "state_stop",
152 "state_dead"
153};
154
155static inline u8 __kw_read_reg(struct low_i2c_host *host, reg_t reg)
156{
157 return in_8(host->base + (((unsigned)reg) << host->bsteps));
158}
159
160static inline void __kw_write_reg(struct low_i2c_host *host, reg_t reg, u8 val)
161{
162 out_8(host->base + (((unsigned)reg) << host->bsteps), val);
163 (void)__kw_read_reg(host, reg_subaddr);
164}
165
166#define kw_write_reg(reg, val) __kw_write_reg(host, reg, val)
167#define kw_read_reg(reg) __kw_read_reg(host, reg)
168
169
170/* Don't schedule, the g5 fan controller is too
171 * timing sensitive
172 */
173static u8 kw_wait_interrupt(struct low_i2c_host* host)
174{
175 int i;
176 u8 isr;
177
178 for (i = 0; i < 200000; i++) {
179 isr = kw_read_reg(reg_isr) & KW_I2C_IRQ_MASK;
180 if (isr != 0)
181 return isr;
182 udelay(1);
183 }
184 return isr;
185}
186
187static int kw_handle_interrupt(struct low_i2c_host *host, int state, int rw, int *rc, u8 **data, int *len, u8 isr)
188{
189 u8 ack;
190
191 if (isr == 0) {
192 if (state != state_stop) {
193 DBG("KW: Timeout !\n");
194 *rc = -EIO;
195 goto stop;
196 }
197 if (state == state_stop) {
198 ack = kw_read_reg(reg_status);
199 if (!(ack & KW_I2C_STAT_BUSY)) {
200 state = state_idle;
201 kw_write_reg(reg_ier, 0x00);
202 }
203 }
204 return state;
205 }
206
207 if (isr & KW_I2C_IRQ_ADDR) {
208 ack = kw_read_reg(reg_status);
209 if (state != state_addr) {
210 kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR);
211 WRONG_STATE("KW_I2C_IRQ_ADDR");
212 *rc = -EIO;
213 goto stop;
214 }
215 if ((ack & KW_I2C_STAT_LAST_AAK) == 0) {
216 *rc = -ENODEV;
217 DBG("KW: NAK on address\n");
218 return state_stop;
219 } else {
220 if (rw) {
221 state = state_read;
222 if (*len > 1)
223 kw_write_reg(reg_control, KW_I2C_CTL_AAK);
224 } else {
225 state = state_write;
226 kw_write_reg(reg_data, **data);
227 (*data)++; (*len)--;
228 }
229 }
230 kw_write_reg(reg_isr, KW_I2C_IRQ_ADDR);
231 }
232
233 if (isr & KW_I2C_IRQ_DATA) {
234 if (state == state_read) {
235 **data = kw_read_reg(reg_data);
236 (*data)++; (*len)--;
237 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA);
238 if ((*len) == 0)
239 state = state_stop;
240 else if ((*len) == 1)
241 kw_write_reg(reg_control, 0);
242 } else if (state == state_write) {
243 ack = kw_read_reg(reg_status);
244 if ((ack & KW_I2C_STAT_LAST_AAK) == 0) {
245 DBG("KW: nack on data write\n");
246 *rc = -EIO;
247 goto stop;
248 } else if (*len) {
249 kw_write_reg(reg_data, **data);
250 (*data)++; (*len)--;
251 } else {
252 kw_write_reg(reg_control, KW_I2C_CTL_STOP);
253 state = state_stop;
254 *rc = 0;
255 }
256 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA);
257 } else {
258 kw_write_reg(reg_isr, KW_I2C_IRQ_DATA);
259 WRONG_STATE("KW_I2C_IRQ_DATA");
260 if (state != state_stop) {
261 *rc = -EIO;
262 goto stop;
263 }
264 }
265 }
266
267 if (isr & KW_I2C_IRQ_STOP) {
268 kw_write_reg(reg_isr, KW_I2C_IRQ_STOP);
269 if (state != state_stop) {
270 WRONG_STATE("KW_I2C_IRQ_STOP");
271 *rc = -EIO;
272 }
273 return state_idle;
274 }
275
276 if (isr & KW_I2C_IRQ_START)
277 kw_write_reg(reg_isr, KW_I2C_IRQ_START);
278
279 return state;
280
281 stop:
282 kw_write_reg(reg_control, KW_I2C_CTL_STOP);
283 return state_stop;
284}
285
286static int keywest_low_i2c_func(struct low_i2c_host *host, u8 addr, u8 subaddr, u8 *data, int len)
287{
288 u8 mode_reg = host->speed;
289 int state = state_addr;
290 int rc = 0;
291
292 /* Setup mode & subaddress if any */
293 switch(host->mode) {
294 case pmac_low_i2c_mode_dumb:
295 printk(KERN_ERR "low_i2c: Dumb mode not supported !\n");
296 return -EINVAL;
297 case pmac_low_i2c_mode_std:
298 mode_reg |= KW_I2C_MODE_STANDARD;
299 break;
300 case pmac_low_i2c_mode_stdsub:
301 mode_reg |= KW_I2C_MODE_STANDARDSUB;
302 kw_write_reg(reg_subaddr, subaddr);
303 break;
304 case pmac_low_i2c_mode_combined:
305 mode_reg |= KW_I2C_MODE_COMBINED;
306 kw_write_reg(reg_subaddr, subaddr);
307 break;
308 }
309
310 /* Setup channel & clear pending irqs */
311 kw_write_reg(reg_isr, kw_read_reg(reg_isr));
312 kw_write_reg(reg_mode, mode_reg | (host->channel << 4));
313 kw_write_reg(reg_status, 0);
314
315 /* Set up address and r/w bit */
316 kw_write_reg(reg_addr, addr);
317
318 /* Start sending address & disable interrupt*/
319 kw_write_reg(reg_ier, 0 /*KW_I2C_IRQ_MASK*/);
320 kw_write_reg(reg_control, KW_I2C_CTL_XADDR);
321
322 /* State machine, to turn into an interrupt handler */
323 while(state != state_idle) {
324 u8 isr = kw_wait_interrupt(host);
325 state = kw_handle_interrupt(host, state, addr & 1, &rc, &data, &len, isr);
326 }
327
328 return rc;
329}
330
331static void keywest_low_i2c_add(struct device_node *np)
332{
333 struct low_i2c_host *host = find_low_i2c_host(NULL);
334 unsigned long *psteps, *prate, steps, aoffset = 0;
335 struct device_node *parent;
336
337 if (host == NULL) {
338 printk(KERN_ERR "low_i2c: Can't allocate host for %s\n",
339 np->full_name);
340 return;
341 }
342 memset(host, 0, sizeof(*host));
343
344 init_MUTEX(&host->mutex);
345 host->np = of_node_get(np);
346 psteps = (unsigned long *)get_property(np, "AAPL,address-step", NULL);
347 steps = psteps ? (*psteps) : 0x10;
348 for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++)
349 steps >>= 1;
350 parent = of_get_parent(np);
351 host->num_channels = 1;
352 if (parent && parent->name[0] == 'u') {
353 host->num_channels = 2;
354 aoffset = 3;
355 }
356 /* Select interface rate */
357 host->speed = KW_I2C_MODE_100KHZ;
358 prate = (unsigned long *)get_property(np, "AAPL,i2c-rate", NULL);
359 if (prate) switch(*prate) {
360 case 100:
361 host->speed = KW_I2C_MODE_100KHZ;
362 break;
363 case 50:
364 host->speed = KW_I2C_MODE_50KHZ;
365 break;
366 case 25:
367 host->speed = KW_I2C_MODE_25KHZ;
368 break;
369 }
370 host->mode = pmac_low_i2c_mode_std;
371 host->base = ioremap(np->addrs[0].address + aoffset,
372 np->addrs[0].size);
373 host->func = keywest_low_i2c_func;
374}
375
376/*
377 *
378 * PMU implementation
379 *
380 */
381
382
383#ifdef CONFIG_ADB_PMU
384
385static int pmu_low_i2c_func(struct low_i2c_host *host, u8 addr, u8 sub, u8 *data, int len)
386{
387 // TODO
388 return -ENODEV;
389}
390
391static void pmu_low_i2c_add(struct device_node *np)
392{
393 struct low_i2c_host *host = find_low_i2c_host(NULL);
394
395 if (host == NULL) {
396 printk(KERN_ERR "low_i2c: Can't allocate host for %s\n",
397 np->full_name);
398 return;
399 }
400 memset(host, 0, sizeof(*host));
401
402 init_MUTEX(&host->mutex);
403 host->np = of_node_get(np);
404 host->num_channels = 3;
405 host->mode = pmac_low_i2c_mode_std;
406 host->func = pmu_low_i2c_func;
407}
408
409#endif /* CONFIG_ADB_PMU */
410
411void __init pmac_init_low_i2c(void)
412{
413 struct device_node *np;
414
415 /* Probe keywest-i2c busses */
416 np = of_find_compatible_node(NULL, "i2c", "keywest-i2c");
417 while(np) {
418 keywest_low_i2c_add(np);
419 np = of_find_compatible_node(np, "i2c", "keywest-i2c");
420 }
421
422#ifdef CONFIG_ADB_PMU
423 /* Probe PMU busses */
424 np = of_find_node_by_name(NULL, "via-pmu");
425 if (np)
426 pmu_low_i2c_add(np);
427#endif /* CONFIG_ADB_PMU */
428
429 /* TODO: Add CUDA support as well */
430}
431
432int pmac_low_i2c_lock(struct device_node *np)
433{
434 struct low_i2c_host *host = find_low_i2c_host(np);
435
436 if (!host)
437 return -ENODEV;
438 down(&host->mutex);
439 return 0;
440}
441EXPORT_SYMBOL(pmac_low_i2c_lock);
442
443int pmac_low_i2c_unlock(struct device_node *np)
444{
445 struct low_i2c_host *host = find_low_i2c_host(np);
446
447 if (!host)
448 return -ENODEV;
449 up(&host->mutex);
450 return 0;
451}
452EXPORT_SYMBOL(pmac_low_i2c_unlock);
453
454
455int pmac_low_i2c_open(struct device_node *np, int channel)
456{
457 struct low_i2c_host *host = find_low_i2c_host(np);
458
459 if (!host)
460 return -ENODEV;
461
462 if (channel >= host->num_channels)
463 return -EINVAL;
464
465 down(&host->mutex);
466 host->is_open = 1;
467 host->channel = channel;
468
469 return 0;
470}
471EXPORT_SYMBOL(pmac_low_i2c_open);
472
473int pmac_low_i2c_close(struct device_node *np)
474{
475 struct low_i2c_host *host = find_low_i2c_host(np);
476
477 if (!host)
478 return -ENODEV;
479
480 host->is_open = 0;
481 up(&host->mutex);
482
483 return 0;
484}
485EXPORT_SYMBOL(pmac_low_i2c_close);
486
487int pmac_low_i2c_setmode(struct device_node *np, int mode)
488{
489 struct low_i2c_host *host = find_low_i2c_host(np);
490
491 if (!host)
492 return -ENODEV;
493 WARN_ON(!host->is_open);
494 host->mode = mode;
495
496 return 0;
497}
498EXPORT_SYMBOL(pmac_low_i2c_setmode);
499
500int pmac_low_i2c_xfer(struct device_node *np, u8 addrdir, u8 subaddr, u8 *data, int len)
501{
502 struct low_i2c_host *host = find_low_i2c_host(np);
503
504 if (!host)
505 return -ENODEV;
506 WARN_ON(!host->is_open);
507
508 return host->func(host, addrdir, subaddr, data, len);
509}
510EXPORT_SYMBOL(pmac_low_i2c_xfer);
511
diff --git a/arch/ppc/platforms/pmac_nvram.c b/arch/ppc/platforms/pmac_nvram.c
deleted file mode 100644
index 8c9b008c7226..000000000000
--- a/arch/ppc/platforms/pmac_nvram.c
+++ /dev/null
@@ -1,584 +0,0 @@
1/*
2 * arch/ppc/platforms/pmac_nvram.c
3 *
4 * Copyright (C) 2002 Benjamin Herrenschmidt (benh@kernel.crashing.org)
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * Todo: - add support for the OF persistent properties
12 */
13#include <linux/config.h>
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/stddef.h>
17#include <linux/string.h>
18#include <linux/nvram.h>
19#include <linux/init.h>
20#include <linux/slab.h>
21#include <linux/delay.h>
22#include <linux/errno.h>
23#include <linux/adb.h>
24#include <linux/pmu.h>
25#include <linux/bootmem.h>
26#include <linux/completion.h>
27#include <linux/spinlock.h>
28#include <asm/sections.h>
29#include <asm/io.h>
30#include <asm/system.h>
31#include <asm/prom.h>
32#include <asm/machdep.h>
33#include <asm/nvram.h>
34
35#define DEBUG
36
37#ifdef DEBUG
38#define DBG(x...) printk(x)
39#else
40#define DBG(x...)
41#endif
42
43#define NVRAM_SIZE 0x2000 /* 8kB of non-volatile RAM */
44
45#define CORE99_SIGNATURE 0x5a
46#define CORE99_ADLER_START 0x14
47
48/* On Core99, nvram is either a sharp, a micron or an AMD flash */
49#define SM_FLASH_STATUS_DONE 0x80
50#define SM_FLASH_STATUS_ERR 0x38
51#define SM_FLASH_CMD_ERASE_CONFIRM 0xd0
52#define SM_FLASH_CMD_ERASE_SETUP 0x20
53#define SM_FLASH_CMD_RESET 0xff
54#define SM_FLASH_CMD_WRITE_SETUP 0x40
55#define SM_FLASH_CMD_CLEAR_STATUS 0x50
56#define SM_FLASH_CMD_READ_STATUS 0x70
57
58/* CHRP NVRAM header */
59struct chrp_header {
60 u8 signature;
61 u8 cksum;
62 u16 len;
63 char name[12];
64 u8 data[0];
65};
66
67struct core99_header {
68 struct chrp_header hdr;
69 u32 adler;
70 u32 generation;
71 u32 reserved[2];
72};
73
74/*
75 * Read and write the non-volatile RAM on PowerMacs and CHRP machines.
76 */
77static int nvram_naddrs;
78static volatile unsigned char *nvram_addr;
79static volatile unsigned char *nvram_data;
80static int nvram_mult, is_core_99;
81static int core99_bank = 0;
82static int nvram_partitions[3];
83static DEFINE_SPINLOCK(nv_lock);
84
85extern int pmac_newworld;
86extern int system_running;
87
88static int (*core99_write_bank)(int bank, u8* datas);
89static int (*core99_erase_bank)(int bank);
90
91static char *nvram_image;
92
93
94static unsigned char core99_nvram_read_byte(int addr)
95{
96 if (nvram_image == NULL)
97 return 0xff;
98 return nvram_image[addr];
99}
100
101static void core99_nvram_write_byte(int addr, unsigned char val)
102{
103 if (nvram_image == NULL)
104 return;
105 nvram_image[addr] = val;
106}
107
108
109static unsigned char direct_nvram_read_byte(int addr)
110{
111 return in_8(&nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult]);
112}
113
114static void direct_nvram_write_byte(int addr, unsigned char val)
115{
116 out_8(&nvram_data[(addr & (NVRAM_SIZE - 1)) * nvram_mult], val);
117}
118
119
120static unsigned char indirect_nvram_read_byte(int addr)
121{
122 unsigned char val;
123 unsigned long flags;
124
125 spin_lock_irqsave(&nv_lock, flags);
126 out_8(nvram_addr, addr >> 5);
127 val = in_8(&nvram_data[(addr & 0x1f) << 4]);
128 spin_unlock_irqrestore(&nv_lock, flags);
129
130 return val;
131}
132
133static void indirect_nvram_write_byte(int addr, unsigned char val)
134{
135 unsigned long flags;
136
137 spin_lock_irqsave(&nv_lock, flags);
138 out_8(nvram_addr, addr >> 5);
139 out_8(&nvram_data[(addr & 0x1f) << 4], val);
140 spin_unlock_irqrestore(&nv_lock, flags);
141}
142
143
144#ifdef CONFIG_ADB_PMU
145
146static void pmu_nvram_complete(struct adb_request *req)
147{
148 if (req->arg)
149 complete((struct completion *)req->arg);
150}
151
152static unsigned char pmu_nvram_read_byte(int addr)
153{
154 struct adb_request req;
155 DECLARE_COMPLETION(req_complete);
156
157 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL;
158 if (pmu_request(&req, pmu_nvram_complete, 3, PMU_READ_NVRAM,
159 (addr >> 8) & 0xff, addr & 0xff))
160 return 0xff;
161 if (system_state == SYSTEM_RUNNING)
162 wait_for_completion(&req_complete);
163 while (!req.complete)
164 pmu_poll();
165 return req.reply[0];
166}
167
168static void pmu_nvram_write_byte(int addr, unsigned char val)
169{
170 struct adb_request req;
171 DECLARE_COMPLETION(req_complete);
172
173 req.arg = system_state == SYSTEM_RUNNING ? &req_complete : NULL;
174 if (pmu_request(&req, pmu_nvram_complete, 4, PMU_WRITE_NVRAM,
175 (addr >> 8) & 0xff, addr & 0xff, val))
176 return;
177 if (system_state == SYSTEM_RUNNING)
178 wait_for_completion(&req_complete);
179 while (!req.complete)
180 pmu_poll();
181}
182
183#endif /* CONFIG_ADB_PMU */
184
185
186static u8 chrp_checksum(struct chrp_header* hdr)
187{
188 u8 *ptr;
189 u16 sum = hdr->signature;
190 for (ptr = (u8 *)&hdr->len; ptr < hdr->data; ptr++)
191 sum += *ptr;
192 while (sum > 0xFF)
193 sum = (sum & 0xFF) + (sum>>8);
194 return sum;
195}
196
197static u32 core99_calc_adler(u8 *buffer)
198{
199 int cnt;
200 u32 low, high;
201
202 buffer += CORE99_ADLER_START;
203 low = 1;
204 high = 0;
205 for (cnt=0; cnt<(NVRAM_SIZE-CORE99_ADLER_START); cnt++) {
206 if ((cnt % 5000) == 0) {
207 high %= 65521UL;
208 high %= 65521UL;
209 }
210 low += buffer[cnt];
211 high += low;
212 }
213 low %= 65521UL;
214 high %= 65521UL;
215
216 return (high << 16) | low;
217}
218
219static u32 core99_check(u8* datas)
220{
221 struct core99_header* hdr99 = (struct core99_header*)datas;
222
223 if (hdr99->hdr.signature != CORE99_SIGNATURE) {
224 DBG("Invalid signature\n");
225 return 0;
226 }
227 if (hdr99->hdr.cksum != chrp_checksum(&hdr99->hdr)) {
228 DBG("Invalid checksum\n");
229 return 0;
230 }
231 if (hdr99->adler != core99_calc_adler(datas)) {
232 DBG("Invalid adler\n");
233 return 0;
234 }
235 return hdr99->generation;
236}
237
238static int sm_erase_bank(int bank)
239{
240 int stat, i;
241 unsigned long timeout;
242
243 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
244
245 DBG("nvram: Sharp/Micron Erasing bank %d...\n", bank);
246
247 out_8(base, SM_FLASH_CMD_ERASE_SETUP);
248 out_8(base, SM_FLASH_CMD_ERASE_CONFIRM);
249 timeout = 0;
250 do {
251 if (++timeout > 1000000) {
252 printk(KERN_ERR "nvram: Sharp/Miron flash erase timeout !\n");
253 break;
254 }
255 out_8(base, SM_FLASH_CMD_READ_STATUS);
256 stat = in_8(base);
257 } while (!(stat & SM_FLASH_STATUS_DONE));
258
259 out_8(base, SM_FLASH_CMD_CLEAR_STATUS);
260 out_8(base, SM_FLASH_CMD_RESET);
261
262 for (i=0; i<NVRAM_SIZE; i++)
263 if (base[i] != 0xff) {
264 printk(KERN_ERR "nvram: Sharp/Micron flash erase failed !\n");
265 return -ENXIO;
266 }
267 return 0;
268}
269
270static int sm_write_bank(int bank, u8* datas)
271{
272 int i, stat = 0;
273 unsigned long timeout;
274
275 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
276
277 DBG("nvram: Sharp/Micron Writing bank %d...\n", bank);
278
279 for (i=0; i<NVRAM_SIZE; i++) {
280 out_8(base+i, SM_FLASH_CMD_WRITE_SETUP);
281 udelay(1);
282 out_8(base+i, datas[i]);
283 timeout = 0;
284 do {
285 if (++timeout > 1000000) {
286 printk(KERN_ERR "nvram: Sharp/Micron flash write timeout !\n");
287 break;
288 }
289 out_8(base, SM_FLASH_CMD_READ_STATUS);
290 stat = in_8(base);
291 } while (!(stat & SM_FLASH_STATUS_DONE));
292 if (!(stat & SM_FLASH_STATUS_DONE))
293 break;
294 }
295 out_8(base, SM_FLASH_CMD_CLEAR_STATUS);
296 out_8(base, SM_FLASH_CMD_RESET);
297 for (i=0; i<NVRAM_SIZE; i++)
298 if (base[i] != datas[i]) {
299 printk(KERN_ERR "nvram: Sharp/Micron flash write failed !\n");
300 return -ENXIO;
301 }
302 return 0;
303}
304
305static int amd_erase_bank(int bank)
306{
307 int i, stat = 0;
308 unsigned long timeout;
309
310 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
311
312 DBG("nvram: AMD Erasing bank %d...\n", bank);
313
314 /* Unlock 1 */
315 out_8(base+0x555, 0xaa);
316 udelay(1);
317 /* Unlock 2 */
318 out_8(base+0x2aa, 0x55);
319 udelay(1);
320
321 /* Sector-Erase */
322 out_8(base+0x555, 0x80);
323 udelay(1);
324 out_8(base+0x555, 0xaa);
325 udelay(1);
326 out_8(base+0x2aa, 0x55);
327 udelay(1);
328 out_8(base, 0x30);
329 udelay(1);
330
331 timeout = 0;
332 do {
333 if (++timeout > 1000000) {
334 printk(KERN_ERR "nvram: AMD flash erase timeout !\n");
335 break;
336 }
337 stat = in_8(base) ^ in_8(base);
338 } while (stat != 0);
339
340 /* Reset */
341 out_8(base, 0xf0);
342 udelay(1);
343
344 for (i=0; i<NVRAM_SIZE; i++)
345 if (base[i] != 0xff) {
346 printk(KERN_ERR "nvram: AMD flash erase failed !\n");
347 return -ENXIO;
348 }
349 return 0;
350}
351
352static int amd_write_bank(int bank, u8* datas)
353{
354 int i, stat = 0;
355 unsigned long timeout;
356
357 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE;
358
359 DBG("nvram: AMD Writing bank %d...\n", bank);
360
361 for (i=0; i<NVRAM_SIZE; i++) {
362 /* Unlock 1 */
363 out_8(base+0x555, 0xaa);
364 udelay(1);
365 /* Unlock 2 */
366 out_8(base+0x2aa, 0x55);
367 udelay(1);
368
369 /* Write single word */
370 out_8(base+0x555, 0xa0);
371 udelay(1);
372 out_8(base+i, datas[i]);
373
374 timeout = 0;
375 do {
376 if (++timeout > 1000000) {
377 printk(KERN_ERR "nvram: AMD flash write timeout !\n");
378 break;
379 }
380 stat = in_8(base) ^ in_8(base);
381 } while (stat != 0);
382 if (stat != 0)
383 break;
384 }
385
386 /* Reset */
387 out_8(base, 0xf0);
388 udelay(1);
389
390 for (i=0; i<NVRAM_SIZE; i++)
391 if (base[i] != datas[i]) {
392 printk(KERN_ERR "nvram: AMD flash write failed !\n");
393 return -ENXIO;
394 }
395 return 0;
396}
397
398static void __init lookup_partitions(void)
399{
400 u8 buffer[17];
401 int i, offset;
402 struct chrp_header* hdr;
403
404 if (pmac_newworld) {
405 nvram_partitions[pmac_nvram_OF] = -1;
406 nvram_partitions[pmac_nvram_XPRAM] = -1;
407 nvram_partitions[pmac_nvram_NR] = -1;
408 hdr = (struct chrp_header *)buffer;
409
410 offset = 0;
411 buffer[16] = 0;
412 do {
413 for (i=0;i<16;i++)
414 buffer[i] = nvram_read_byte(offset+i);
415 if (!strcmp(hdr->name, "common"))
416 nvram_partitions[pmac_nvram_OF] = offset + 0x10;
417 if (!strcmp(hdr->name, "APL,MacOS75")) {
418 nvram_partitions[pmac_nvram_XPRAM] = offset + 0x10;
419 nvram_partitions[pmac_nvram_NR] = offset + 0x110;
420 }
421 offset += (hdr->len * 0x10);
422 } while(offset < NVRAM_SIZE);
423 } else {
424 nvram_partitions[pmac_nvram_OF] = 0x1800;
425 nvram_partitions[pmac_nvram_XPRAM] = 0x1300;
426 nvram_partitions[pmac_nvram_NR] = 0x1400;
427 }
428 DBG("nvram: OF partition at 0x%x\n", nvram_partitions[pmac_nvram_OF]);
429 DBG("nvram: XP partition at 0x%x\n", nvram_partitions[pmac_nvram_XPRAM]);
430 DBG("nvram: NR partition at 0x%x\n", nvram_partitions[pmac_nvram_NR]);
431}
432
433static void core99_nvram_sync(void)
434{
435 struct core99_header* hdr99;
436 unsigned long flags;
437
438 if (!is_core_99 || !nvram_data || !nvram_image)
439 return;
440
441 spin_lock_irqsave(&nv_lock, flags);
442 if (!memcmp(nvram_image, (u8*)nvram_data + core99_bank*NVRAM_SIZE,
443 NVRAM_SIZE))
444 goto bail;
445
446 DBG("Updating nvram...\n");
447
448 hdr99 = (struct core99_header*)nvram_image;
449 hdr99->generation++;
450 hdr99->hdr.signature = CORE99_SIGNATURE;
451 hdr99->hdr.cksum = chrp_checksum(&hdr99->hdr);
452 hdr99->adler = core99_calc_adler(nvram_image);
453 core99_bank = core99_bank ? 0 : 1;
454 if (core99_erase_bank)
455 if (core99_erase_bank(core99_bank)) {
456 printk("nvram: Error erasing bank %d\n", core99_bank);
457 goto bail;
458 }
459 if (core99_write_bank)
460 if (core99_write_bank(core99_bank, nvram_image))
461 printk("nvram: Error writing bank %d\n", core99_bank);
462 bail:
463 spin_unlock_irqrestore(&nv_lock, flags);
464
465#ifdef DEBUG
466 mdelay(2000);
467#endif
468}
469
470void __init pmac_nvram_init(void)
471{
472 struct device_node *dp;
473
474 nvram_naddrs = 0;
475
476 dp = find_devices("nvram");
477 if (dp == NULL) {
478 printk(KERN_ERR "Can't find NVRAM device\n");
479 return;
480 }
481 nvram_naddrs = dp->n_addrs;
482 is_core_99 = device_is_compatible(dp, "nvram,flash");
483 if (is_core_99) {
484 int i;
485 u32 gen_bank0, gen_bank1;
486
487 if (nvram_naddrs < 1) {
488 printk(KERN_ERR "nvram: no address\n");
489 return;
490 }
491 nvram_image = alloc_bootmem(NVRAM_SIZE);
492 if (nvram_image == NULL) {
493 printk(KERN_ERR "nvram: can't allocate ram image\n");
494 return;
495 }
496 nvram_data = ioremap(dp->addrs[0].address, NVRAM_SIZE*2);
497 nvram_naddrs = 1; /* Make sure we get the correct case */
498
499 DBG("nvram: Checking bank 0...\n");
500
501 gen_bank0 = core99_check((u8 *)nvram_data);
502 gen_bank1 = core99_check((u8 *)nvram_data + NVRAM_SIZE);
503 core99_bank = (gen_bank0 < gen_bank1) ? 1 : 0;
504
505 DBG("nvram: gen0=%d, gen1=%d\n", gen_bank0, gen_bank1);
506 DBG("nvram: Active bank is: %d\n", core99_bank);
507
508 for (i=0; i<NVRAM_SIZE; i++)
509 nvram_image[i] = nvram_data[i + core99_bank*NVRAM_SIZE];
510
511 ppc_md.nvram_read_val = core99_nvram_read_byte;
512 ppc_md.nvram_write_val = core99_nvram_write_byte;
513 ppc_md.nvram_sync = core99_nvram_sync;
514 /*
515 * Maybe we could be smarter here though making an exclusive list
516 * of known flash chips is a bit nasty as older OF didn't provide us
517 * with a useful "compatible" entry. A solution would be to really
518 * identify the chip using flash id commands and base ourselves on
519 * a list of known chips IDs
520 */
521 if (device_is_compatible(dp, "amd-0137")) {
522 core99_erase_bank = amd_erase_bank;
523 core99_write_bank = amd_write_bank;
524 } else {
525 core99_erase_bank = sm_erase_bank;
526 core99_write_bank = sm_write_bank;
527 }
528 } else if (_machine == _MACH_chrp && nvram_naddrs == 1) {
529 nvram_data = ioremap(dp->addrs[0].address + isa_mem_base,
530 dp->addrs[0].size);
531 nvram_mult = 1;
532 ppc_md.nvram_read_val = direct_nvram_read_byte;
533 ppc_md.nvram_write_val = direct_nvram_write_byte;
534 } else if (nvram_naddrs == 1) {
535 nvram_data = ioremap(dp->addrs[0].address, dp->addrs[0].size);
536 nvram_mult = (dp->addrs[0].size + NVRAM_SIZE - 1) / NVRAM_SIZE;
537 ppc_md.nvram_read_val = direct_nvram_read_byte;
538 ppc_md.nvram_write_val = direct_nvram_write_byte;
539 } else if (nvram_naddrs == 2) {
540 nvram_addr = ioremap(dp->addrs[0].address, dp->addrs[0].size);
541 nvram_data = ioremap(dp->addrs[1].address, dp->addrs[1].size);
542 ppc_md.nvram_read_val = indirect_nvram_read_byte;
543 ppc_md.nvram_write_val = indirect_nvram_write_byte;
544 } else if (nvram_naddrs == 0 && sys_ctrler == SYS_CTRLER_PMU) {
545#ifdef CONFIG_ADB_PMU
546 nvram_naddrs = -1;
547 ppc_md.nvram_read_val = pmu_nvram_read_byte;
548 ppc_md.nvram_write_val = pmu_nvram_write_byte;
549#endif /* CONFIG_ADB_PMU */
550 } else {
551 printk(KERN_ERR "Don't know how to access NVRAM with %d addresses\n",
552 nvram_naddrs);
553 }
554 lookup_partitions();
555}
556
557int pmac_get_partition(int partition)
558{
559 return nvram_partitions[partition];
560}
561
562u8 pmac_xpram_read(int xpaddr)
563{
564 int offset = nvram_partitions[pmac_nvram_XPRAM];
565
566 if (offset < 0)
567 return 0xff;
568
569 return ppc_md.nvram_read_val(xpaddr + offset);
570}
571
572void pmac_xpram_write(int xpaddr, u8 data)
573{
574 int offset = nvram_partitions[pmac_nvram_XPRAM];
575
576 if (offset < 0)
577 return;
578
579 ppc_md.nvram_write_val(xpaddr + offset, data);
580}
581
582EXPORT_SYMBOL(pmac_get_partition);
583EXPORT_SYMBOL(pmac_xpram_read);
584EXPORT_SYMBOL(pmac_xpram_write);
diff --git a/arch/ppc/platforms/pmac_pci.c b/arch/ppc/platforms/pmac_pci.c
deleted file mode 100644
index 786295b6ddd0..000000000000
--- a/arch/ppc/platforms/pmac_pci.c
+++ /dev/null
@@ -1,1124 +0,0 @@
1/*
2 * Support for PCI bridges found on Power Macintoshes.
3 * At present the "bandit" and "chaos" bridges are supported.
4 * Fortunately you access configuration space in the same
5 * way with either bridge.
6 *
7 * Copyright (C) 1997 Paul Mackerras (paulus@cs.anu.edu.au)
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 */
14
15#include <linux/kernel.h>
16#include <linux/pci.h>
17#include <linux/delay.h>
18#include <linux/string.h>
19#include <linux/init.h>
20
21#include <asm/sections.h>
22#include <asm/io.h>
23#include <asm/prom.h>
24#include <asm/pci-bridge.h>
25#include <asm/machdep.h>
26#include <asm/pmac_feature.h>
27
28#undef DEBUG
29
30#ifdef DEBUG
31#ifdef CONFIG_XMON
32extern void xmon_printf(const char *fmt, ...);
33#define DBG(x...) xmon_printf(x)
34#else
35#define DBG(x...) printk(x)
36#endif
37#else
38#define DBG(x...)
39#endif
40
41static int add_bridge(struct device_node *dev);
42extern void pmac_check_ht_link(void);
43
44/* XXX Could be per-controller, but I don't think we risk anything by
45 * assuming we won't have both UniNorth and Bandit */
46static int has_uninorth;
47#ifdef CONFIG_POWER4
48static struct pci_controller *u3_agp;
49#endif /* CONFIG_POWER4 */
50
51extern u8 pci_cache_line_size;
52extern int pcibios_assign_bus_offset;
53
54struct device_node *k2_skiplist[2];
55
56/*
57 * Magic constants for enabling cache coherency in the bandit/PSX bridge.
58 */
59#define BANDIT_DEVID_2 8
60#define BANDIT_REVID 3
61
62#define BANDIT_DEVNUM 11
63#define BANDIT_MAGIC 0x50
64#define BANDIT_COHERENT 0x40
65
66static int __init
67fixup_one_level_bus_range(struct device_node *node, int higher)
68{
69 for (; node != 0;node = node->sibling) {
70 int * bus_range;
71 unsigned int *class_code;
72 int len;
73
74 /* For PCI<->PCI bridges or CardBus bridges, we go down */
75 class_code = (unsigned int *) get_property(node, "class-code", NULL);
76 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
77 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
78 continue;
79 bus_range = (int *) get_property(node, "bus-range", &len);
80 if (bus_range != NULL && len > 2 * sizeof(int)) {
81 if (bus_range[1] > higher)
82 higher = bus_range[1];
83 }
84 higher = fixup_one_level_bus_range(node->child, higher);
85 }
86 return higher;
87}
88
89/* This routine fixes the "bus-range" property of all bridges in the
90 * system since they tend to have their "last" member wrong on macs
91 *
92 * Note that the bus numbers manipulated here are OF bus numbers, they
93 * are not Linux bus numbers.
94 */
95static void __init
96fixup_bus_range(struct device_node *bridge)
97{
98 int * bus_range;
99 int len;
100
101 /* Lookup the "bus-range" property for the hose */
102 bus_range = (int *) get_property(bridge, "bus-range", &len);
103 if (bus_range == NULL || len < 2 * sizeof(int)) {
104 printk(KERN_WARNING "Can't get bus-range for %s\n",
105 bridge->full_name);
106 return;
107 }
108 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]);
109}
110
111/*
112 * Apple MacRISC (U3, UniNorth, Bandit, Chaos) PCI controllers.
113 *
114 * The "Bandit" version is present in all early PCI PowerMacs,
115 * and up to the first ones using Grackle. Some machines may
116 * have 2 bandit controllers (2 PCI busses).
117 *
118 * "Chaos" is used in some "Bandit"-type machines as a bridge
119 * for the separate display bus. It is accessed the same
120 * way as bandit, but cannot be probed for devices. It therefore
121 * has its own config access functions.
122 *
123 * The "UniNorth" version is present in all Core99 machines
124 * (iBook, G4, new IMacs, and all the recent Apple machines).
125 * It contains 3 controllers in one ASIC.
126 *
127 * The U3 is the bridge used on G5 machines. It contains an
128 * AGP bus which is dealt with the old UniNorth access routines
129 * and a HyperTransport bus which uses its own set of access
130 * functions.
131 */
132
133#define MACRISC_CFA0(devfn, off) \
134 ((1 << (unsigned long)PCI_SLOT(dev_fn)) \
135 | (((unsigned long)PCI_FUNC(dev_fn)) << 8) \
136 | (((unsigned long)(off)) & 0xFCUL))
137
138#define MACRISC_CFA1(bus, devfn, off) \
139 ((((unsigned long)(bus)) << 16) \
140 |(((unsigned long)(devfn)) << 8) \
141 |(((unsigned long)(off)) & 0xFCUL) \
142 |1UL)
143
144static void volatile __iomem *
145macrisc_cfg_access(struct pci_controller* hose, u8 bus, u8 dev_fn, u8 offset)
146{
147 unsigned int caddr;
148
149 if (bus == hose->first_busno) {
150 if (dev_fn < (11 << 3))
151 return NULL;
152 caddr = MACRISC_CFA0(dev_fn, offset);
153 } else
154 caddr = MACRISC_CFA1(bus, dev_fn, offset);
155
156 /* Uninorth will return garbage if we don't read back the value ! */
157 do {
158 out_le32(hose->cfg_addr, caddr);
159 } while (in_le32(hose->cfg_addr) != caddr);
160
161 offset &= has_uninorth ? 0x07 : 0x03;
162 return hose->cfg_data + offset;
163}
164
165static int
166macrisc_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
167 int len, u32 *val)
168{
169 struct pci_controller *hose = bus->sysdata;
170 void volatile __iomem *addr;
171
172 addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
173 if (!addr)
174 return PCIBIOS_DEVICE_NOT_FOUND;
175 /*
176 * Note: the caller has already checked that offset is
177 * suitably aligned and that len is 1, 2 or 4.
178 */
179 switch (len) {
180 case 1:
181 *val = in_8(addr);
182 break;
183 case 2:
184 *val = in_le16(addr);
185 break;
186 default:
187 *val = in_le32(addr);
188 break;
189 }
190 return PCIBIOS_SUCCESSFUL;
191}
192
193static int
194macrisc_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
195 int len, u32 val)
196{
197 struct pci_controller *hose = bus->sysdata;
198 void volatile __iomem *addr;
199
200 addr = macrisc_cfg_access(hose, bus->number, devfn, offset);
201 if (!addr)
202 return PCIBIOS_DEVICE_NOT_FOUND;
203 /*
204 * Note: the caller has already checked that offset is
205 * suitably aligned and that len is 1, 2 or 4.
206 */
207 switch (len) {
208 case 1:
209 out_8(addr, val);
210 (void) in_8(addr);
211 break;
212 case 2:
213 out_le16(addr, val);
214 (void) in_le16(addr);
215 break;
216 default:
217 out_le32(addr, val);
218 (void) in_le32(addr);
219 break;
220 }
221 return PCIBIOS_SUCCESSFUL;
222}
223
224static struct pci_ops macrisc_pci_ops =
225{
226 macrisc_read_config,
227 macrisc_write_config
228};
229
230/*
231 * Verifiy that a specific (bus, dev_fn) exists on chaos
232 */
233static int
234chaos_validate_dev(struct pci_bus *bus, int devfn, int offset)
235{
236 struct device_node *np;
237 u32 *vendor, *device;
238
239 np = pci_busdev_to_OF_node(bus, devfn);
240 if (np == NULL)
241 return PCIBIOS_DEVICE_NOT_FOUND;
242
243 vendor = (u32 *)get_property(np, "vendor-id", NULL);
244 device = (u32 *)get_property(np, "device-id", NULL);
245 if (vendor == NULL || device == NULL)
246 return PCIBIOS_DEVICE_NOT_FOUND;
247
248 if ((*vendor == 0x106b) && (*device == 3) && (offset >= 0x10)
249 && (offset != 0x14) && (offset != 0x18) && (offset <= 0x24))
250 return PCIBIOS_BAD_REGISTER_NUMBER;
251
252 return PCIBIOS_SUCCESSFUL;
253}
254
255static int
256chaos_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
257 int len, u32 *val)
258{
259 int result = chaos_validate_dev(bus, devfn, offset);
260 if (result == PCIBIOS_BAD_REGISTER_NUMBER)
261 *val = ~0U;
262 if (result != PCIBIOS_SUCCESSFUL)
263 return result;
264 return macrisc_read_config(bus, devfn, offset, len, val);
265}
266
267static int
268chaos_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
269 int len, u32 val)
270{
271 int result = chaos_validate_dev(bus, devfn, offset);
272 if (result != PCIBIOS_SUCCESSFUL)
273 return result;
274 return macrisc_write_config(bus, devfn, offset, len, val);
275}
276
277static struct pci_ops chaos_pci_ops =
278{
279 chaos_read_config,
280 chaos_write_config
281};
282
283#ifdef CONFIG_POWER4
284
285/*
286 * These versions of U3 HyperTransport config space access ops do not
287 * implement self-view of the HT host yet
288 */
289
290#define U3_HT_CFA0(devfn, off) \
291 ((((unsigned long)devfn) << 8) | offset)
292#define U3_HT_CFA1(bus, devfn, off) \
293 (U3_HT_CFA0(devfn, off) \
294 + (((unsigned long)bus) << 16) \
295 + 0x01000000UL)
296
297static void volatile __iomem *
298u3_ht_cfg_access(struct pci_controller* hose, u8 bus, u8 devfn, u8 offset)
299{
300 if (bus == hose->first_busno) {
301 /* For now, we don't self probe U3 HT bridge */
302 if (PCI_FUNC(devfn) != 0 || PCI_SLOT(devfn) > 7 ||
303 PCI_SLOT(devfn) < 1)
304 return 0;
305 return hose->cfg_data + U3_HT_CFA0(devfn, offset);
306 } else
307 return hose->cfg_data + U3_HT_CFA1(bus, devfn, offset);
308}
309
310static int
311u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
312 int len, u32 *val)
313{
314 struct pci_controller *hose = bus->sysdata;
315 void volatile __iomem *addr;
316 int i;
317
318 struct device_node *np = pci_busdev_to_OF_node(bus, devfn);
319 if (np == NULL)
320 return PCIBIOS_DEVICE_NOT_FOUND;
321
322 /*
323 * When a device in K2 is powered down, we die on config
324 * cycle accesses. Fix that here.
325 */
326 for (i=0; i<2; i++)
327 if (k2_skiplist[i] == np) {
328 switch (len) {
329 case 1:
330 *val = 0xff; break;
331 case 2:
332 *val = 0xffff; break;
333 default:
334 *val = 0xfffffffful; break;
335 }
336 return PCIBIOS_SUCCESSFUL;
337 }
338
339 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
340 if (!addr)
341 return PCIBIOS_DEVICE_NOT_FOUND;
342 /*
343 * Note: the caller has already checked that offset is
344 * suitably aligned and that len is 1, 2 or 4.
345 */
346 switch (len) {
347 case 1:
348 *val = in_8(addr);
349 break;
350 case 2:
351 *val = in_le16(addr);
352 break;
353 default:
354 *val = in_le32(addr);
355 break;
356 }
357 return PCIBIOS_SUCCESSFUL;
358}
359
360static int
361u3_ht_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
362 int len, u32 val)
363{
364 struct pci_controller *hose = bus->sysdata;
365 void volatile __iomem *addr;
366 int i;
367
368 struct device_node *np = pci_busdev_to_OF_node(bus, devfn);
369 if (np == NULL)
370 return PCIBIOS_DEVICE_NOT_FOUND;
371 /*
372 * When a device in K2 is powered down, we die on config
373 * cycle accesses. Fix that here.
374 */
375 for (i=0; i<2; i++)
376 if (k2_skiplist[i] == np)
377 return PCIBIOS_SUCCESSFUL;
378
379 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset);
380 if (!addr)
381 return PCIBIOS_DEVICE_NOT_FOUND;
382 /*
383 * Note: the caller has already checked that offset is
384 * suitably aligned and that len is 1, 2 or 4.
385 */
386 switch (len) {
387 case 1:
388 out_8(addr, val);
389 (void) in_8(addr);
390 break;
391 case 2:
392 out_le16(addr, val);
393 (void) in_le16(addr);
394 break;
395 default:
396 out_le32(addr, val);
397 (void) in_le32(addr);
398 break;
399 }
400 return PCIBIOS_SUCCESSFUL;
401}
402
403static struct pci_ops u3_ht_pci_ops =
404{
405 u3_ht_read_config,
406 u3_ht_write_config
407};
408
409#endif /* CONFIG_POWER4 */
410
411/*
412 * For a bandit bridge, turn on cache coherency if necessary.
413 * N.B. we could clean this up using the hose ops directly.
414 */
415static void __init
416init_bandit(struct pci_controller *bp)
417{
418 unsigned int vendev, magic;
419 int rev;
420
421 /* read the word at offset 0 in config space for device 11 */
422 out_le32(bp->cfg_addr, (1UL << BANDIT_DEVNUM) + PCI_VENDOR_ID);
423 udelay(2);
424 vendev = in_le32(bp->cfg_data);
425 if (vendev == (PCI_DEVICE_ID_APPLE_BANDIT << 16) +
426 PCI_VENDOR_ID_APPLE) {
427 /* read the revision id */
428 out_le32(bp->cfg_addr,
429 (1UL << BANDIT_DEVNUM) + PCI_REVISION_ID);
430 udelay(2);
431 rev = in_8(bp->cfg_data);
432 if (rev != BANDIT_REVID)
433 printk(KERN_WARNING
434 "Unknown revision %d for bandit\n", rev);
435 } else if (vendev != (BANDIT_DEVID_2 << 16) + PCI_VENDOR_ID_APPLE) {
436 printk(KERN_WARNING "bandit isn't? (%x)\n", vendev);
437 return;
438 }
439
440 /* read the word at offset 0x50 */
441 out_le32(bp->cfg_addr, (1UL << BANDIT_DEVNUM) + BANDIT_MAGIC);
442 udelay(2);
443 magic = in_le32(bp->cfg_data);
444 if ((magic & BANDIT_COHERENT) != 0)
445 return;
446 magic |= BANDIT_COHERENT;
447 udelay(2);
448 out_le32(bp->cfg_data, magic);
449 printk(KERN_INFO "Cache coherency enabled for bandit/PSX\n");
450}
451
452
453/*
454 * Tweak the PCI-PCI bridge chip on the blue & white G3s.
455 */
456static void __init
457init_p2pbridge(void)
458{
459 struct device_node *p2pbridge;
460 struct pci_controller* hose;
461 u8 bus, devfn;
462 u16 val;
463
464 /* XXX it would be better here to identify the specific
465 PCI-PCI bridge chip we have. */
466 if ((p2pbridge = find_devices("pci-bridge")) == 0
467 || p2pbridge->parent == NULL
468 || strcmp(p2pbridge->parent->name, "pci") != 0)
469 return;
470 if (pci_device_from_OF_node(p2pbridge, &bus, &devfn) < 0) {
471 DBG("Can't find PCI infos for PCI<->PCI bridge\n");
472 return;
473 }
474 /* Warning: At this point, we have not yet renumbered all busses.
475 * So we must use OF walking to find out hose
476 */
477 hose = pci_find_hose_for_OF_device(p2pbridge);
478 if (!hose) {
479 DBG("Can't find hose for PCI<->PCI bridge\n");
480 return;
481 }
482 if (early_read_config_word(hose, bus, devfn,
483 PCI_BRIDGE_CONTROL, &val) < 0) {
484 printk(KERN_ERR "init_p2pbridge: couldn't read bridge control\n");
485 return;
486 }
487 val &= ~PCI_BRIDGE_CTL_MASTER_ABORT;
488 early_write_config_word(hose, bus, devfn, PCI_BRIDGE_CONTROL, val);
489}
490
491/*
492 * Some Apple desktop machines have a NEC PD720100A USB2 controller
493 * on the motherboard. Open Firmware, on these, will disable the
494 * EHCI part of it so it behaves like a pair of OHCI's. This fixup
495 * code re-enables it ;)
496 */
497static void __init
498fixup_nec_usb2(void)
499{
500 struct device_node *nec;
501
502 for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) {
503 struct pci_controller *hose;
504 u32 data, *prop;
505 u8 bus, devfn;
506
507 prop = (u32 *)get_property(nec, "vendor-id", NULL);
508 if (prop == NULL)
509 continue;
510 if (0x1033 != *prop)
511 continue;
512 prop = (u32 *)get_property(nec, "device-id", NULL);
513 if (prop == NULL)
514 continue;
515 if (0x0035 != *prop)
516 continue;
517 prop = (u32 *)get_property(nec, "reg", NULL);
518 if (prop == NULL)
519 continue;
520 devfn = (prop[0] >> 8) & 0xff;
521 bus = (prop[0] >> 16) & 0xff;
522 if (PCI_FUNC(devfn) != 0)
523 continue;
524 hose = pci_find_hose_for_OF_device(nec);
525 if (!hose)
526 continue;
527 early_read_config_dword(hose, bus, devfn, 0xe4, &data);
528 if (data & 1UL) {
529 printk("Found NEC PD720100A USB2 chip with disabled EHCI, fixing up...\n");
530 data &= ~1UL;
531 early_write_config_dword(hose, bus, devfn, 0xe4, data);
532 early_write_config_byte(hose, bus, devfn | 2, PCI_INTERRUPT_LINE,
533 nec->intrs[0].line);
534 }
535 }
536}
537
538void __init
539pmac_find_bridges(void)
540{
541 struct device_node *np, *root;
542 struct device_node *ht = NULL;
543
544 root = of_find_node_by_path("/");
545 if (root == NULL) {
546 printk(KERN_CRIT "pmac_find_bridges: can't find root of device tree\n");
547 return;
548 }
549 for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) {
550 if (np->name == NULL)
551 continue;
552 if (strcmp(np->name, "bandit") == 0
553 || strcmp(np->name, "chaos") == 0
554 || strcmp(np->name, "pci") == 0) {
555 if (add_bridge(np) == 0)
556 of_node_get(np);
557 }
558 if (strcmp(np->name, "ht") == 0) {
559 of_node_get(np);
560 ht = np;
561 }
562 }
563 of_node_put(root);
564
565 /* Probe HT last as it relies on the agp resources to be already
566 * setup
567 */
568 if (ht && add_bridge(ht) != 0)
569 of_node_put(ht);
570
571 init_p2pbridge();
572 fixup_nec_usb2();
573
574 /* We are still having some issues with the Xserve G4, enabling
575 * some offset between bus number and domains for now when we
576 * assign all busses should help for now
577 */
578 if (pci_assign_all_buses)
579 pcibios_assign_bus_offset = 0x10;
580
581#ifdef CONFIG_POWER4
582 /* There is something wrong with DMA on U3/HT. I haven't figured out
583 * the details yet, but if I set the cache line size to 128 bytes like
584 * it should, I'm getting memory corruption caused by devices like
585 * sungem (even without the MWI bit set, but maybe sungem doesn't
586 * care). Right now, it appears that setting up a 64 bytes line size
587 * works properly, 64 bytes beeing the max transfer size of HT, I
588 * suppose this is related the way HT/PCI are hooked together. I still
589 * need to dive into more specs though to be really sure of what's
590 * going on. --BenH.
591 *
592 * Ok, apparently, it's just that HT can't do more than 64 bytes
593 * transactions. MWI seem to be meaningless there as well, it may
594 * be worth nop'ing out pci_set_mwi too though I haven't done that
595 * yet.
596 *
597 * Note that it's a bit different for whatever is in the AGP slot.
598 * For now, I don't care, but this can become a real issue, we
599 * should probably hook pci_set_mwi anyway to make sure it sets
600 * the real cache line size in there.
601 */
602 if (machine_is_compatible("MacRISC4"))
603 pci_cache_line_size = 16; /* 64 bytes */
604
605 pmac_check_ht_link();
606#endif /* CONFIG_POWER4 */
607}
608
609#define GRACKLE_CFA(b, d, o) (0x80 | ((b) << 8) | ((d) << 16) \
610 | (((o) & ~3) << 24))
611
612#define GRACKLE_PICR1_STG 0x00000040
613#define GRACKLE_PICR1_LOOPSNOOP 0x00000010
614
615/* N.B. this is called before bridges is initialized, so we can't
616 use grackle_pcibios_{read,write}_config_dword. */
617static inline void grackle_set_stg(struct pci_controller* bp, int enable)
618{
619 unsigned int val;
620
621 out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
622 val = in_le32(bp->cfg_data);
623 val = enable? (val | GRACKLE_PICR1_STG) :
624 (val & ~GRACKLE_PICR1_STG);
625 out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
626 out_le32(bp->cfg_data, val);
627 (void)in_le32(bp->cfg_data);
628}
629
630static inline void grackle_set_loop_snoop(struct pci_controller *bp, int enable)
631{
632 unsigned int val;
633
634 out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
635 val = in_le32(bp->cfg_data);
636 val = enable? (val | GRACKLE_PICR1_LOOPSNOOP) :
637 (val & ~GRACKLE_PICR1_LOOPSNOOP);
638 out_be32(bp->cfg_addr, GRACKLE_CFA(0, 0, 0xa8));
639 out_le32(bp->cfg_data, val);
640 (void)in_le32(bp->cfg_data);
641}
642
643static int __init
644setup_uninorth(struct pci_controller* hose, struct reg_property* addr)
645{
646 pci_assign_all_buses = 1;
647 has_uninorth = 1;
648 hose->ops = &macrisc_pci_ops;
649 hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000);
650 hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000);
651 /* We "know" that the bridge at f2000000 has the PCI slots. */
652 return addr->address == 0xf2000000;
653}
654
655static void __init
656setup_bandit(struct pci_controller* hose, struct reg_property* addr)
657{
658 hose->ops = &macrisc_pci_ops;
659 hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000);
660 hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000);
661 init_bandit(hose);
662}
663
664static void __init
665setup_chaos(struct pci_controller* hose, struct reg_property* addr)
666{
667 /* assume a `chaos' bridge */
668 hose->ops = &chaos_pci_ops;
669 hose->cfg_addr = ioremap(addr->address + 0x800000, 0x1000);
670 hose->cfg_data = ioremap(addr->address + 0xc00000, 0x1000);
671}
672
673#ifdef CONFIG_POWER4
674
675static void __init
676setup_u3_agp(struct pci_controller* hose, struct reg_property* addr)
677{
678 /* On G5, we move AGP up to high bus number so we don't need
679 * to reassign bus numbers for HT. If we ever have P2P bridges
680 * on AGP, we'll have to move pci_assign_all_buses to the
681 * pci_controller structure so we enable it for AGP and not for
682 * HT childs.
683 * We hard code the address because of the different size of
684 * the reg address cell, we shall fix that by killing struct
685 * reg_property and using some accessor functions instead
686 */
687 hose->first_busno = 0xf0;
688 hose->last_busno = 0xff;
689 has_uninorth = 1;
690 hose->ops = &macrisc_pci_ops;
691 hose->cfg_addr = ioremap(0xf0000000 + 0x800000, 0x1000);
692 hose->cfg_data = ioremap(0xf0000000 + 0xc00000, 0x1000);
693
694 u3_agp = hose;
695}
696
697static void __init
698setup_u3_ht(struct pci_controller* hose, struct reg_property *addr)
699{
700 struct device_node *np = (struct device_node *)hose->arch_data;
701 int i, cur;
702
703 hose->ops = &u3_ht_pci_ops;
704
705 /* We hard code the address because of the different size of
706 * the reg address cell, we shall fix that by killing struct
707 * reg_property and using some accessor functions instead
708 */
709 hose->cfg_data = ioremap(0xf2000000, 0x02000000);
710
711 /*
712 * /ht node doesn't expose a "ranges" property, so we "remove" regions that
713 * have been allocated to AGP. So far, this version of the code doesn't assign
714 * any of the 0xfxxxxxxx "fine" memory regions to /ht.
715 * We need to fix that sooner or later by either parsing all child "ranges"
716 * properties or figuring out the U3 address space decoding logic and
717 * then read its configuration register (if any).
718 */
719 hose->io_base_phys = 0xf4000000;
720 hose->io_base_virt = ioremap(hose->io_base_phys, 0x00400000);
721 isa_io_base = (unsigned long) hose->io_base_virt;
722 hose->io_resource.name = np->full_name;
723 hose->io_resource.start = 0;
724 hose->io_resource.end = 0x003fffff;
725 hose->io_resource.flags = IORESOURCE_IO;
726 hose->pci_mem_offset = 0;
727 hose->first_busno = 0;
728 hose->last_busno = 0xef;
729 hose->mem_resources[0].name = np->full_name;
730 hose->mem_resources[0].start = 0x80000000;
731 hose->mem_resources[0].end = 0xefffffff;
732 hose->mem_resources[0].flags = IORESOURCE_MEM;
733
734 if (u3_agp == NULL) {
735 DBG("U3 has no AGP, using full resource range\n");
736 return;
737 }
738
739 /* We "remove" the AGP resources from the resources allocated to HT, that
740 * is we create "holes". However, that code does assumptions that so far
741 * happen to be true (cross fingers...), typically that resources in the
742 * AGP node are properly ordered
743 */
744 cur = 0;
745 for (i=0; i<3; i++) {
746 struct resource *res = &u3_agp->mem_resources[i];
747 if (res->flags != IORESOURCE_MEM)
748 continue;
749 /* We don't care about "fine" resources */
750 if (res->start >= 0xf0000000)
751 continue;
752 /* Check if it's just a matter of "shrinking" us in one direction */
753 if (hose->mem_resources[cur].start == res->start) {
754 DBG("U3/HT: shrink start of %d, %08lx -> %08lx\n",
755 cur, hose->mem_resources[cur].start, res->end + 1);
756 hose->mem_resources[cur].start = res->end + 1;
757 continue;
758 }
759 if (hose->mem_resources[cur].end == res->end) {
760 DBG("U3/HT: shrink end of %d, %08lx -> %08lx\n",
761 cur, hose->mem_resources[cur].end, res->start - 1);
762 hose->mem_resources[cur].end = res->start - 1;
763 continue;
764 }
765 /* No, it's not the case, we need a hole */
766 if (cur == 2) {
767 /* not enough resources to make a hole, we drop part of the range */
768 printk(KERN_WARNING "Running out of resources for /ht host !\n");
769 hose->mem_resources[cur].end = res->start - 1;
770 continue;
771 }
772 cur++;
773 DBG("U3/HT: hole, %d end at %08lx, %d start at %08lx\n",
774 cur-1, res->start - 1, cur, res->end + 1);
775 hose->mem_resources[cur].name = np->full_name;
776 hose->mem_resources[cur].flags = IORESOURCE_MEM;
777 hose->mem_resources[cur].start = res->end + 1;
778 hose->mem_resources[cur].end = hose->mem_resources[cur-1].end;
779 hose->mem_resources[cur-1].end = res->start - 1;
780 }
781}
782
783#endif /* CONFIG_POWER4 */
784
785void __init
786setup_grackle(struct pci_controller *hose)
787{
788 setup_indirect_pci(hose, 0xfec00000, 0xfee00000);
789 if (machine_is_compatible("AAPL,PowerBook1998"))
790 grackle_set_loop_snoop(hose, 1);
791#if 0 /* Disabled for now, HW problems ??? */
792 grackle_set_stg(hose, 1);
793#endif
794}
795
796/*
797 * We assume that if we have a G3 powermac, we have one bridge called
798 * "pci" (a MPC106) and no bandit or chaos bridges, and contrariwise,
799 * if we have one or more bandit or chaos bridges, we don't have a MPC106.
800 */
801static int __init
802add_bridge(struct device_node *dev)
803{
804 int len;
805 struct pci_controller *hose;
806 struct reg_property *addr;
807 char* disp_name;
808 int *bus_range;
809 int primary = 1;
810
811 DBG("Adding PCI host bridge %s\n", dev->full_name);
812
813 addr = (struct reg_property *) get_property(dev, "reg", &len);
814 if (addr == NULL || len < sizeof(*addr)) {
815 printk(KERN_WARNING "Can't use %s: no address\n",
816 dev->full_name);
817 return -ENODEV;
818 }
819 bus_range = (int *) get_property(dev, "bus-range", &len);
820 if (bus_range == NULL || len < 2 * sizeof(int)) {
821 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n",
822 dev->full_name);
823 }
824
825 hose = pcibios_alloc_controller();
826 if (!hose)
827 return -ENOMEM;
828 hose->arch_data = dev;
829 hose->first_busno = bus_range ? bus_range[0] : 0;
830 hose->last_busno = bus_range ? bus_range[1] : 0xff;
831
832 disp_name = NULL;
833#ifdef CONFIG_POWER4
834 if (device_is_compatible(dev, "u3-agp")) {
835 setup_u3_agp(hose, addr);
836 disp_name = "U3-AGP";
837 primary = 0;
838 } else if (device_is_compatible(dev, "u3-ht")) {
839 setup_u3_ht(hose, addr);
840 disp_name = "U3-HT";
841 primary = 1;
842 } else
843#endif /* CONFIG_POWER4 */
844 if (device_is_compatible(dev, "uni-north")) {
845 primary = setup_uninorth(hose, addr);
846 disp_name = "UniNorth";
847 } else if (strcmp(dev->name, "pci") == 0) {
848 /* XXX assume this is a mpc106 (grackle) */
849 setup_grackle(hose);
850 disp_name = "Grackle (MPC106)";
851 } else if (strcmp(dev->name, "bandit") == 0) {
852 setup_bandit(hose, addr);
853 disp_name = "Bandit";
854 } else if (strcmp(dev->name, "chaos") == 0) {
855 setup_chaos(hose, addr);
856 disp_name = "Chaos";
857 primary = 0;
858 }
859 printk(KERN_INFO "Found %s PCI host bridge at 0x%08x. Firmware bus number: %d->%d\n",
860 disp_name, addr->address, hose->first_busno, hose->last_busno);
861 DBG(" ->Hose at 0x%p, cfg_addr=0x%p,cfg_data=0x%p\n",
862 hose, hose->cfg_addr, hose->cfg_data);
863
864 /* Interpret the "ranges" property */
865 /* This also maps the I/O region and sets isa_io/mem_base */
866 pci_process_bridge_OF_ranges(hose, dev, primary);
867
868 /* Fixup "bus-range" OF property */
869 fixup_bus_range(dev);
870
871 return 0;
872}
873
874static void __init
875pcibios_fixup_OF_interrupts(void)
876{
877 struct pci_dev* dev = NULL;
878
879 /*
880 * Open Firmware often doesn't initialize the
881 * PCI_INTERRUPT_LINE config register properly, so we
882 * should find the device node and apply the interrupt
883 * obtained from the OF device-tree
884 */
885 for_each_pci_dev(dev) {
886 struct device_node *node;
887 node = pci_device_to_OF_node(dev);
888 /* this is the node, see if it has interrupts */
889 if (node && node->n_intrs > 0)
890 dev->irq = node->intrs[0].line;
891 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
892 }
893}
894
895void __init
896pmac_pcibios_fixup(void)
897{
898 /* Fixup interrupts according to OF tree */
899 pcibios_fixup_OF_interrupts();
900}
901
902int
903pmac_pci_enable_device_hook(struct pci_dev *dev, int initial)
904{
905 struct device_node* node;
906 int updatecfg = 0;
907 int uninorth_child;
908
909 node = pci_device_to_OF_node(dev);
910
911 /* We don't want to enable USB controllers absent from the OF tree
912 * (iBook second controller)
913 */
914 if (dev->vendor == PCI_VENDOR_ID_APPLE
915 && (dev->class == ((PCI_CLASS_SERIAL_USB << 8) | 0x10))
916 && !node) {
917 printk(KERN_INFO "Apple USB OHCI %s disabled by firmware\n",
918 pci_name(dev));
919 return -EINVAL;
920 }
921
922 if (!node)
923 return 0;
924
925 uninorth_child = node->parent &&
926 device_is_compatible(node->parent, "uni-north");
927
928 /* Firewire & GMAC were disabled after PCI probe, the driver is
929 * claiming them, we must re-enable them now.
930 */
931 if (uninorth_child && !strcmp(node->name, "firewire") &&
932 (device_is_compatible(node, "pci106b,18") ||
933 device_is_compatible(node, "pci106b,30") ||
934 device_is_compatible(node, "pci11c1,5811"))) {
935 pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, node, 0, 1);
936 pmac_call_feature(PMAC_FTR_1394_ENABLE, node, 0, 1);
937 updatecfg = 1;
938 }
939 if (uninorth_child && !strcmp(node->name, "ethernet") &&
940 device_is_compatible(node, "gmac")) {
941 pmac_call_feature(PMAC_FTR_GMAC_ENABLE, node, 0, 1);
942 updatecfg = 1;
943 }
944
945 if (updatecfg) {
946 u16 cmd;
947
948 /*
949 * Make sure PCI is correctly configured
950 *
951 * We use old pci_bios versions of the function since, by
952 * default, gmac is not powered up, and so will be absent
953 * from the kernel initial PCI lookup.
954 *
955 * Should be replaced by 2.4 new PCI mechanisms and really
956 * register the device.
957 */
958 pci_read_config_word(dev, PCI_COMMAND, &cmd);
959 cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_INVALIDATE;
960 pci_write_config_word(dev, PCI_COMMAND, cmd);
961 pci_write_config_byte(dev, PCI_LATENCY_TIMER, 16);
962 pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE, pci_cache_line_size);
963 }
964
965 return 0;
966}
967
968/* We power down some devices after they have been probed. They'll
969 * be powered back on later on
970 */
971void __init
972pmac_pcibios_after_init(void)
973{
974 struct device_node* nd;
975
976#ifdef CONFIG_BLK_DEV_IDE
977 struct pci_dev *dev = NULL;
978
979 /* OF fails to initialize IDE controllers on macs
980 * (and maybe other machines)
981 *
982 * Ideally, this should be moved to the IDE layer, but we need
983 * to check specifically with Andre Hedrick how to do it cleanly
984 * since the common IDE code seem to care about the fact that the
985 * BIOS may have disabled a controller.
986 *
987 * -- BenH
988 */
989 for_each_pci_dev(dev) {
990 if ((dev->class >> 16) == PCI_BASE_CLASS_STORAGE)
991 pci_enable_device(dev);
992 }
993#endif /* CONFIG_BLK_DEV_IDE */
994
995 nd = find_devices("firewire");
996 while (nd) {
997 if (nd->parent && (device_is_compatible(nd, "pci106b,18") ||
998 device_is_compatible(nd, "pci106b,30") ||
999 device_is_compatible(nd, "pci11c1,5811"))
1000 && device_is_compatible(nd->parent, "uni-north")) {
1001 pmac_call_feature(PMAC_FTR_1394_ENABLE, nd, 0, 0);
1002 pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, nd, 0, 0);
1003 }
1004 nd = nd->next;
1005 }
1006 nd = find_devices("ethernet");
1007 while (nd) {
1008 if (nd->parent && device_is_compatible(nd, "gmac")
1009 && device_is_compatible(nd->parent, "uni-north"))
1010 pmac_call_feature(PMAC_FTR_GMAC_ENABLE, nd, 0, 0);
1011 nd = nd->next;
1012 }
1013}
1014
1015void pmac_pci_fixup_cardbus(struct pci_dev* dev)
1016{
1017 if (_machine != _MACH_Pmac)
1018 return;
1019 /*
1020 * Fix the interrupt routing on the various cardbus bridges
1021 * used on powerbooks
1022 */
1023 if (dev->vendor != PCI_VENDOR_ID_TI)
1024 return;
1025 if (dev->device == PCI_DEVICE_ID_TI_1130 ||
1026 dev->device == PCI_DEVICE_ID_TI_1131) {
1027 u8 val;
1028 /* Enable PCI interrupt */
1029 if (pci_read_config_byte(dev, 0x91, &val) == 0)
1030 pci_write_config_byte(dev, 0x91, val | 0x30);
1031 /* Disable ISA interrupt mode */
1032 if (pci_read_config_byte(dev, 0x92, &val) == 0)
1033 pci_write_config_byte(dev, 0x92, val & ~0x06);
1034 }
1035 if (dev->device == PCI_DEVICE_ID_TI_1210 ||
1036 dev->device == PCI_DEVICE_ID_TI_1211 ||
1037 dev->device == PCI_DEVICE_ID_TI_1410 ||
1038 dev->device == PCI_DEVICE_ID_TI_1510) {
1039 u8 val;
1040 /* 0x8c == TI122X_IRQMUX, 2 says to route the INTA
1041 signal out the MFUNC0 pin */
1042 if (pci_read_config_byte(dev, 0x8c, &val) == 0)
1043 pci_write_config_byte(dev, 0x8c, (val & ~0x0f) | 2);
1044 /* Disable ISA interrupt mode */
1045 if (pci_read_config_byte(dev, 0x92, &val) == 0)
1046 pci_write_config_byte(dev, 0x92, val & ~0x06);
1047 }
1048}
1049
1050DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_TI, PCI_ANY_ID, pmac_pci_fixup_cardbus);
1051
1052void pmac_pci_fixup_pciata(struct pci_dev* dev)
1053{
1054 u8 progif = 0;
1055
1056 /*
1057 * On PowerMacs, we try to switch any PCI ATA controller to
1058 * fully native mode
1059 */
1060 if (_machine != _MACH_Pmac)
1061 return;
1062 /* Some controllers don't have the class IDE */
1063 if (dev->vendor == PCI_VENDOR_ID_PROMISE)
1064 switch(dev->device) {
1065 case PCI_DEVICE_ID_PROMISE_20246:
1066 case PCI_DEVICE_ID_PROMISE_20262:
1067 case PCI_DEVICE_ID_PROMISE_20263:
1068 case PCI_DEVICE_ID_PROMISE_20265:
1069 case PCI_DEVICE_ID_PROMISE_20267:
1070 case PCI_DEVICE_ID_PROMISE_20268:
1071 case PCI_DEVICE_ID_PROMISE_20269:
1072 case PCI_DEVICE_ID_PROMISE_20270:
1073 case PCI_DEVICE_ID_PROMISE_20271:
1074 case PCI_DEVICE_ID_PROMISE_20275:
1075 case PCI_DEVICE_ID_PROMISE_20276:
1076 case PCI_DEVICE_ID_PROMISE_20277:
1077 goto good;
1078 }
1079 /* Others, check PCI class */
1080 if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
1081 return;
1082 good:
1083 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif);
1084 if ((progif & 5) != 5) {
1085 printk(KERN_INFO "Forcing PCI IDE into native mode: %s\n", pci_name(dev));
1086 (void) pci_write_config_byte(dev, PCI_CLASS_PROG, progif|5);
1087 if (pci_read_config_byte(dev, PCI_CLASS_PROG, &progif) ||
1088 (progif & 5) != 5)
1089 printk(KERN_ERR "Rewrite of PROGIF failed !\n");
1090 }
1091}
1092DECLARE_PCI_FIXUP_FINAL(PCI_ANY_ID, PCI_ANY_ID, pmac_pci_fixup_pciata);
1093
1094
1095/*
1096 * Disable second function on K2-SATA, it's broken
1097 * and disable IO BARs on first one
1098 */
1099void pmac_pci_fixup_k2_sata(struct pci_dev* dev)
1100{
1101 int i;
1102 u16 cmd;
1103
1104 if (PCI_FUNC(dev->devfn) > 0) {
1105 pci_read_config_word(dev, PCI_COMMAND, &cmd);
1106 cmd &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY);
1107 pci_write_config_word(dev, PCI_COMMAND, cmd);
1108 for (i = 0; i < 6; i++) {
1109 dev->resource[i].start = dev->resource[i].end = 0;
1110 dev->resource[i].flags = 0;
1111 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i, 0);
1112 }
1113 } else {
1114 pci_read_config_word(dev, PCI_COMMAND, &cmd);
1115 cmd &= ~PCI_COMMAND_IO;
1116 pci_write_config_word(dev, PCI_COMMAND, cmd);
1117 for (i = 0; i < 5; i++) {
1118 dev->resource[i].start = dev->resource[i].end = 0;
1119 dev->resource[i].flags = 0;
1120 pci_write_config_dword(dev, PCI_BASE_ADDRESS_0 + 4 * i, 0);
1121 }
1122 }
1123}
1124DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_SERVERWORKS, 0x0240, pmac_pci_fixup_k2_sata);
diff --git a/arch/ppc/platforms/pmac_pic.c b/arch/ppc/platforms/pmac_pic.c
deleted file mode 100644
index 4742bf609357..000000000000
--- a/arch/ppc/platforms/pmac_pic.c
+++ /dev/null
@@ -1,693 +0,0 @@
1/*
2 * Support for the interrupt controllers found on Power Macintosh,
3 * currently Apple's "Grand Central" interrupt controller in all
4 * it's incarnations. OpenPIC support used on newer machines is
5 * in a separate file
6 *
7 * Copyright (C) 1997 Paul Mackerras (paulus@cs.anu.edu.au)
8 *
9 * Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.org)
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version
14 * 2 of the License, or (at your option) any later version.
15 *
16 */
17
18#include <linux/config.h>
19#include <linux/stddef.h>
20#include <linux/init.h>
21#include <linux/sched.h>
22#include <linux/signal.h>
23#include <linux/pci.h>
24#include <linux/interrupt.h>
25#include <linux/sysdev.h>
26#include <linux/adb.h>
27#include <linux/pmu.h>
28
29#include <asm/sections.h>
30#include <asm/io.h>
31#include <asm/smp.h>
32#include <asm/prom.h>
33#include <asm/pci-bridge.h>
34#include <asm/time.h>
35#include <asm/open_pic.h>
36#include <asm/xmon.h>
37#include <asm/pmac_feature.h>
38#include <asm/machdep.h>
39
40#include "pmac_pic.h"
41
42/*
43 * XXX this should be in xmon.h, but putting it there means xmon.h
44 * has to include <linux/interrupt.h> (to get irqreturn_t), which
45 * causes all sorts of problems. -- paulus
46 */
47extern irqreturn_t xmon_irq(int, void *, struct pt_regs *);
48
49struct pmac_irq_hw {
50 unsigned int event;
51 unsigned int enable;
52 unsigned int ack;
53 unsigned int level;
54};
55
56/* Default addresses */
57static volatile struct pmac_irq_hw *pmac_irq_hw[4] = {
58 (struct pmac_irq_hw *) 0xf3000020,
59 (struct pmac_irq_hw *) 0xf3000010,
60 (struct pmac_irq_hw *) 0xf4000020,
61 (struct pmac_irq_hw *) 0xf4000010,
62};
63
64#define GC_LEVEL_MASK 0x3ff00000
65#define OHARE_LEVEL_MASK 0x1ff00000
66#define HEATHROW_LEVEL_MASK 0x1ff00000
67
68static int max_irqs;
69static int max_real_irqs;
70static u32 level_mask[4];
71
72static DEFINE_SPINLOCK(pmac_pic_lock);
73
74
75#define GATWICK_IRQ_POOL_SIZE 10
76static struct interrupt_info gatwick_int_pool[GATWICK_IRQ_POOL_SIZE];
77
78#define NR_MASK_WORDS ((NR_IRQS + 31) / 32)
79static unsigned long ppc_lost_interrupts[NR_MASK_WORDS];
80
81/*
82 * Mark an irq as "lost". This is only used on the pmac
83 * since it can lose interrupts (see pmac_set_irq_mask).
84 * -- Cort
85 */
86void
87__set_lost(unsigned long irq_nr, int nokick)
88{
89 if (!test_and_set_bit(irq_nr, ppc_lost_interrupts)) {
90 atomic_inc(&ppc_n_lost_interrupts);
91 if (!nokick)
92 set_dec(1);
93 }
94}
95
96static void
97pmac_mask_and_ack_irq(unsigned int irq_nr)
98{
99 unsigned long bit = 1UL << (irq_nr & 0x1f);
100 int i = irq_nr >> 5;
101 unsigned long flags;
102
103 if ((unsigned)irq_nr >= max_irqs)
104 return;
105
106 clear_bit(irq_nr, ppc_cached_irq_mask);
107 if (test_and_clear_bit(irq_nr, ppc_lost_interrupts))
108 atomic_dec(&ppc_n_lost_interrupts);
109 spin_lock_irqsave(&pmac_pic_lock, flags);
110 out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]);
111 out_le32(&pmac_irq_hw[i]->ack, bit);
112 do {
113 /* make sure ack gets to controller before we enable
114 interrupts */
115 mb();
116 } while((in_le32(&pmac_irq_hw[i]->enable) & bit)
117 != (ppc_cached_irq_mask[i] & bit));
118 spin_unlock_irqrestore(&pmac_pic_lock, flags);
119}
120
121static void pmac_set_irq_mask(unsigned int irq_nr, int nokicklost)
122{
123 unsigned long bit = 1UL << (irq_nr & 0x1f);
124 int i = irq_nr >> 5;
125 unsigned long flags;
126
127 if ((unsigned)irq_nr >= max_irqs)
128 return;
129
130 spin_lock_irqsave(&pmac_pic_lock, flags);
131 /* enable unmasked interrupts */
132 out_le32(&pmac_irq_hw[i]->enable, ppc_cached_irq_mask[i]);
133
134 do {
135 /* make sure mask gets to controller before we
136 return to user */
137 mb();
138 } while((in_le32(&pmac_irq_hw[i]->enable) & bit)
139 != (ppc_cached_irq_mask[i] & bit));
140
141 /*
142 * Unfortunately, setting the bit in the enable register
143 * when the device interrupt is already on *doesn't* set
144 * the bit in the flag register or request another interrupt.
145 */
146 if (bit & ppc_cached_irq_mask[i] & in_le32(&pmac_irq_hw[i]->level))
147 __set_lost((ulong)irq_nr, nokicklost);
148 spin_unlock_irqrestore(&pmac_pic_lock, flags);
149}
150
151/* When an irq gets requested for the first client, if it's an
152 * edge interrupt, we clear any previous one on the controller
153 */
154static unsigned int pmac_startup_irq(unsigned int irq_nr)
155{
156 unsigned long bit = 1UL << (irq_nr & 0x1f);
157 int i = irq_nr >> 5;
158
159 if ((irq_desc[irq_nr].status & IRQ_LEVEL) == 0)
160 out_le32(&pmac_irq_hw[i]->ack, bit);
161 set_bit(irq_nr, ppc_cached_irq_mask);
162 pmac_set_irq_mask(irq_nr, 0);
163
164 return 0;
165}
166
167static void pmac_mask_irq(unsigned int irq_nr)
168{
169 clear_bit(irq_nr, ppc_cached_irq_mask);
170 pmac_set_irq_mask(irq_nr, 0);
171 mb();
172}
173
174static void pmac_unmask_irq(unsigned int irq_nr)
175{
176 set_bit(irq_nr, ppc_cached_irq_mask);
177 pmac_set_irq_mask(irq_nr, 0);
178}
179
180static void pmac_end_irq(unsigned int irq_nr)
181{
182 if (!(irq_desc[irq_nr].status & (IRQ_DISABLED|IRQ_INPROGRESS))
183 && irq_desc[irq_nr].action) {
184 set_bit(irq_nr, ppc_cached_irq_mask);
185 pmac_set_irq_mask(irq_nr, 1);
186 }
187}
188
189
190struct hw_interrupt_type pmac_pic = {
191 .typename = " PMAC-PIC ",
192 .startup = pmac_startup_irq,
193 .enable = pmac_unmask_irq,
194 .disable = pmac_mask_irq,
195 .ack = pmac_mask_and_ack_irq,
196 .end = pmac_end_irq,
197};
198
199struct hw_interrupt_type gatwick_pic = {
200 .typename = " GATWICK ",
201 .startup = pmac_startup_irq,
202 .enable = pmac_unmask_irq,
203 .disable = pmac_mask_irq,
204 .ack = pmac_mask_and_ack_irq,
205 .end = pmac_end_irq,
206};
207
208static irqreturn_t gatwick_action(int cpl, void *dev_id, struct pt_regs *regs)
209{
210 int irq, bits;
211
212 for (irq = max_irqs; (irq -= 32) >= max_real_irqs; ) {
213 int i = irq >> 5;
214 bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i];
215 /* We must read level interrupts from the level register */
216 bits |= (in_le32(&pmac_irq_hw[i]->level) & level_mask[i]);
217 bits &= ppc_cached_irq_mask[i];
218 if (bits == 0)
219 continue;
220 irq += __ilog2(bits);
221 __do_IRQ(irq, regs);
222 return IRQ_HANDLED;
223 }
224 printk("gatwick irq not from gatwick pic\n");
225 return IRQ_NONE;
226}
227
228int
229pmac_get_irq(struct pt_regs *regs)
230{
231 int irq;
232 unsigned long bits = 0;
233
234#ifdef CONFIG_SMP
235 void psurge_smp_message_recv(struct pt_regs *);
236
237 /* IPI's are a hack on the powersurge -- Cort */
238 if ( smp_processor_id() != 0 ) {
239 psurge_smp_message_recv(regs);
240 return -2; /* ignore, already handled */
241 }
242#endif /* CONFIG_SMP */
243 for (irq = max_real_irqs; (irq -= 32) >= 0; ) {
244 int i = irq >> 5;
245 bits = in_le32(&pmac_irq_hw[i]->event) | ppc_lost_interrupts[i];
246 /* We must read level interrupts from the level register */
247 bits |= (in_le32(&pmac_irq_hw[i]->level) & level_mask[i]);
248 bits &= ppc_cached_irq_mask[i];
249 if (bits == 0)
250 continue;
251 irq += __ilog2(bits);
252 break;
253 }
254
255 return irq;
256}
257
258/* This routine will fix some missing interrupt values in the device tree
259 * on the gatwick mac-io controller used by some PowerBooks
260 */
261static void __init
262pmac_fix_gatwick_interrupts(struct device_node *gw, int irq_base)
263{
264 struct device_node *node;
265 int count;
266
267 memset(gatwick_int_pool, 0, sizeof(gatwick_int_pool));
268 node = gw->child;
269 count = 0;
270 while(node)
271 {
272 /* Fix SCC */
273 if (strcasecmp(node->name, "escc") == 0)
274 if (node->child) {
275 if (node->child->n_intrs < 3) {
276 node->child->intrs = &gatwick_int_pool[count];
277 count += 3;
278 }
279 node->child->n_intrs = 3;
280 node->child->intrs[0].line = 15+irq_base;
281 node->child->intrs[1].line = 4+irq_base;
282 node->child->intrs[2].line = 5+irq_base;
283 printk(KERN_INFO "irq: fixed SCC on second controller (%d,%d,%d)\n",
284 node->child->intrs[0].line,
285 node->child->intrs[1].line,
286 node->child->intrs[2].line);
287 }
288 /* Fix media-bay & left SWIM */
289 if (strcasecmp(node->name, "media-bay") == 0) {
290 struct device_node* ya_node;
291
292 if (node->n_intrs == 0)
293 node->intrs = &gatwick_int_pool[count++];
294 node->n_intrs = 1;
295 node->intrs[0].line = 29+irq_base;
296 printk(KERN_INFO "irq: fixed media-bay on second controller (%d)\n",
297 node->intrs[0].line);
298
299 ya_node = node->child;
300 while(ya_node)
301 {
302 if (strcasecmp(ya_node->name, "floppy") == 0) {
303 if (ya_node->n_intrs < 2) {
304 ya_node->intrs = &gatwick_int_pool[count];
305 count += 2;
306 }
307 ya_node->n_intrs = 2;
308 ya_node->intrs[0].line = 19+irq_base;
309 ya_node->intrs[1].line = 1+irq_base;
310 printk(KERN_INFO "irq: fixed floppy on second controller (%d,%d)\n",
311 ya_node->intrs[0].line, ya_node->intrs[1].line);
312 }
313 if (strcasecmp(ya_node->name, "ata4") == 0) {
314 if (ya_node->n_intrs < 2) {
315 ya_node->intrs = &gatwick_int_pool[count];
316 count += 2;
317 }
318 ya_node->n_intrs = 2;
319 ya_node->intrs[0].line = 14+irq_base;
320 ya_node->intrs[1].line = 3+irq_base;
321 printk(KERN_INFO "irq: fixed ide on second controller (%d,%d)\n",
322 ya_node->intrs[0].line, ya_node->intrs[1].line);
323 }
324 ya_node = ya_node->sibling;
325 }
326 }
327 node = node->sibling;
328 }
329 if (count > 10) {
330 printk("WARNING !! Gatwick interrupt pool overflow\n");
331 printk(" GATWICK_IRQ_POOL_SIZE = %d\n", GATWICK_IRQ_POOL_SIZE);
332 printk(" requested = %d\n", count);
333 }
334}
335
336/*
337 * The PowerBook 3400/2400/3500 can have a combo ethernet/modem
338 * card which includes an ohare chip that acts as a second interrupt
339 * controller. If we find this second ohare, set it up and fix the
340 * interrupt value in the device tree for the ethernet chip.
341 */
342static int __init enable_second_ohare(void)
343{
344 unsigned char bus, devfn;
345 unsigned short cmd;
346 unsigned long addr;
347 struct device_node *irqctrler = find_devices("pci106b,7");
348 struct device_node *ether;
349
350 if (irqctrler == NULL || irqctrler->n_addrs <= 0)
351 return -1;
352 addr = (unsigned long) ioremap(irqctrler->addrs[0].address, 0x40);
353 pmac_irq_hw[1] = (volatile struct pmac_irq_hw *)(addr + 0x20);
354 max_irqs = 64;
355 if (pci_device_from_OF_node(irqctrler, &bus, &devfn) == 0) {
356 struct pci_controller* hose = pci_find_hose_for_OF_device(irqctrler);
357 if (!hose)
358 printk(KERN_ERR "Can't find PCI hose for OHare2 !\n");
359 else {
360 early_read_config_word(hose, bus, devfn, PCI_COMMAND, &cmd);
361 cmd |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER;
362 cmd &= ~PCI_COMMAND_IO;
363 early_write_config_word(hose, bus, devfn, PCI_COMMAND, cmd);
364 }
365 }
366
367 /* Fix interrupt for the modem/ethernet combo controller. The number
368 in the device tree (27) is bogus (correct for the ethernet-only
369 board but not the combo ethernet/modem board).
370 The real interrupt is 28 on the second controller -> 28+32 = 60.
371 */
372 ether = find_devices("pci1011,14");
373 if (ether && ether->n_intrs > 0) {
374 ether->intrs[0].line = 60;
375 printk(KERN_INFO "irq: Fixed ethernet IRQ to %d\n",
376 ether->intrs[0].line);
377 }
378
379 /* Return the interrupt number of the cascade */
380 return irqctrler->intrs[0].line;
381}
382
383#ifdef CONFIG_POWER4
384static irqreturn_t k2u3_action(int cpl, void *dev_id, struct pt_regs *regs)
385{
386 int irq;
387
388 irq = openpic2_get_irq(regs);
389 if (irq != -1)
390 __do_IRQ(irq, regs);
391 return IRQ_HANDLED;
392}
393
394static struct irqaction k2u3_cascade_action = {
395 .handler = k2u3_action,
396 .flags = 0,
397 .mask = CPU_MASK_NONE,
398 .name = "U3->K2 Cascade",
399};
400#endif /* CONFIG_POWER4 */
401
402#ifdef CONFIG_XMON
403static struct irqaction xmon_action = {
404 .handler = xmon_irq,
405 .flags = 0,
406 .mask = CPU_MASK_NONE,
407 .name = "NMI - XMON"
408};
409#endif
410
411static struct irqaction gatwick_cascade_action = {
412 .handler = gatwick_action,
413 .flags = SA_INTERRUPT,
414 .mask = CPU_MASK_NONE,
415 .name = "cascade",
416};
417
418void __init pmac_pic_init(void)
419{
420 int i;
421 struct device_node *irqctrler = NULL;
422 struct device_node *irqctrler2 = NULL;
423 struct device_node *np;
424 unsigned long addr;
425 int irq_cascade = -1;
426
427 /* We first try to detect Apple's new Core99 chipset, since mac-io
428 * is quite different on those machines and contains an IBM MPIC2.
429 */
430 np = find_type_devices("open-pic");
431 while(np) {
432 if (np->parent && !strcmp(np->parent->name, "u3"))
433 irqctrler2 = np;
434 else
435 irqctrler = np;
436 np = np->next;
437 }
438 if (irqctrler != NULL)
439 {
440 if (irqctrler->n_addrs > 0)
441 {
442 unsigned char senses[128];
443
444 printk(KERN_INFO "PowerMac using OpenPIC irq controller at 0x%08x\n",
445 irqctrler->addrs[0].address);
446
447 prom_get_irq_senses(senses, 0, 128);
448 OpenPIC_InitSenses = senses;
449 OpenPIC_NumInitSenses = 128;
450 ppc_md.get_irq = openpic_get_irq;
451 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, irqctrler, 0, 0);
452 OpenPIC_Addr = ioremap(irqctrler->addrs[0].address,
453 irqctrler->addrs[0].size);
454 openpic_init(0);
455
456#ifdef CONFIG_POWER4
457 if (irqctrler2 != NULL && irqctrler2->n_intrs > 0 &&
458 irqctrler2->n_addrs > 0) {
459 printk(KERN_INFO "Slave OpenPIC at 0x%08x hooked on IRQ %d\n",
460 irqctrler2->addrs[0].address,
461 irqctrler2->intrs[0].line);
462 pmac_call_feature(PMAC_FTR_ENABLE_MPIC, irqctrler2, 0, 0);
463 OpenPIC2_Addr = ioremap(irqctrler2->addrs[0].address,
464 irqctrler2->addrs[0].size);
465 prom_get_irq_senses(senses, PMAC_OPENPIC2_OFFSET,
466 PMAC_OPENPIC2_OFFSET+128);
467 OpenPIC_InitSenses = senses;
468 OpenPIC_NumInitSenses = 128;
469 openpic2_init(PMAC_OPENPIC2_OFFSET);
470
471 if (setup_irq(irqctrler2->intrs[0].line,
472 &k2u3_cascade_action))
473 printk("Unable to get OpenPIC IRQ for cascade\n");
474 }
475#endif /* CONFIG_POWER4 */
476
477#ifdef CONFIG_XMON
478 {
479 struct device_node* pswitch;
480 int nmi_irq;
481
482 pswitch = find_devices("programmer-switch");
483 if (pswitch && pswitch->n_intrs) {
484 nmi_irq = pswitch->intrs[0].line;
485 openpic_init_nmi_irq(nmi_irq);
486 setup_irq(nmi_irq, &xmon_action);
487 }
488 }
489#endif /* CONFIG_XMON */
490 return;
491 }
492 irqctrler = NULL;
493 }
494
495 /* Get the level/edge settings, assume if it's not
496 * a Grand Central nor an OHare, then it's an Heathrow
497 * (or Paddington).
498 */
499 if (find_devices("gc"))
500 level_mask[0] = GC_LEVEL_MASK;
501 else if (find_devices("ohare")) {
502 level_mask[0] = OHARE_LEVEL_MASK;
503 /* We might have a second cascaded ohare */
504 level_mask[1] = OHARE_LEVEL_MASK;
505 } else {
506 level_mask[0] = HEATHROW_LEVEL_MASK;
507 level_mask[1] = 0;
508 /* We might have a second cascaded heathrow */
509 level_mask[2] = HEATHROW_LEVEL_MASK;
510 level_mask[3] = 0;
511 }
512
513 /*
514 * G3 powermacs and 1999 G3 PowerBooks have 64 interrupts,
515 * 1998 G3 Series PowerBooks have 128,
516 * other powermacs have 32.
517 * The combo ethernet/modem card for the Powerstar powerbooks
518 * (2400/3400/3500, ohare based) has a second ohare chip
519 * effectively making a total of 64.
520 */
521 max_irqs = max_real_irqs = 32;
522 irqctrler = find_devices("mac-io");
523 if (irqctrler)
524 {
525 max_real_irqs = 64;
526 if (irqctrler->next)
527 max_irqs = 128;
528 else
529 max_irqs = 64;
530 }
531 for ( i = 0; i < max_real_irqs ; i++ )
532 irq_desc[i].handler = &pmac_pic;
533
534 /* get addresses of first controller */
535 if (irqctrler) {
536 if (irqctrler->n_addrs > 0) {
537 addr = (unsigned long)
538 ioremap(irqctrler->addrs[0].address, 0x40);
539 for (i = 0; i < 2; ++i)
540 pmac_irq_hw[i] = (volatile struct pmac_irq_hw*)
541 (addr + (2 - i) * 0x10);
542 }
543
544 /* get addresses of second controller */
545 irqctrler = irqctrler->next;
546 if (irqctrler && irqctrler->n_addrs > 0) {
547 addr = (unsigned long)
548 ioremap(irqctrler->addrs[0].address, 0x40);
549 for (i = 2; i < 4; ++i)
550 pmac_irq_hw[i] = (volatile struct pmac_irq_hw*)
551 (addr + (4 - i) * 0x10);
552 irq_cascade = irqctrler->intrs[0].line;
553 if (device_is_compatible(irqctrler, "gatwick"))
554 pmac_fix_gatwick_interrupts(irqctrler, max_real_irqs);
555 }
556 } else {
557 /* older powermacs have a GC (grand central) or ohare at
558 f3000000, with interrupt control registers at f3000020. */
559 addr = (unsigned long) ioremap(0xf3000000, 0x40);
560 pmac_irq_hw[0] = (volatile struct pmac_irq_hw *) (addr + 0x20);
561 }
562
563 /* PowerBooks 3400 and 3500 can have a second controller in a second
564 ohare chip, on the combo ethernet/modem card */
565 if (machine_is_compatible("AAPL,3400/2400")
566 || machine_is_compatible("AAPL,3500"))
567 irq_cascade = enable_second_ohare();
568
569 /* disable all interrupts in all controllers */
570 for (i = 0; i * 32 < max_irqs; ++i)
571 out_le32(&pmac_irq_hw[i]->enable, 0);
572 /* mark level interrupts */
573 for (i = 0; i < max_irqs; i++)
574 if (level_mask[i >> 5] & (1UL << (i & 0x1f)))
575 irq_desc[i].status = IRQ_LEVEL;
576
577 /* get interrupt line of secondary interrupt controller */
578 if (irq_cascade >= 0) {
579 printk(KERN_INFO "irq: secondary controller on irq %d\n",
580 (int)irq_cascade);
581 for ( i = max_real_irqs ; i < max_irqs ; i++ )
582 irq_desc[i].handler = &gatwick_pic;
583 setup_irq(irq_cascade, &gatwick_cascade_action);
584 }
585 printk("System has %d possible interrupts\n", max_irqs);
586 if (max_irqs != max_real_irqs)
587 printk(KERN_DEBUG "%d interrupts on main controller\n",
588 max_real_irqs);
589
590#ifdef CONFIG_XMON
591 setup_irq(20, &xmon_action);
592#endif /* CONFIG_XMON */
593}
594
595#ifdef CONFIG_PM
596/*
597 * These procedures are used in implementing sleep on the powerbooks.
598 * sleep_save_intrs() saves the states of all interrupt enables
599 * and disables all interrupts except for the nominated one.
600 * sleep_restore_intrs() restores the states of all interrupt enables.
601 */
602unsigned long sleep_save_mask[2];
603
604/* This used to be passed by the PMU driver but that link got
605 * broken with the new driver model. We use this tweak for now...
606 */
607static int pmacpic_find_viaint(void)
608{
609 int viaint = -1;
610
611#ifdef CONFIG_ADB_PMU
612 struct device_node *np;
613
614 if (pmu_get_model() != PMU_OHARE_BASED)
615 goto not_found;
616 np = of_find_node_by_name(NULL, "via-pmu");
617 if (np == NULL)
618 goto not_found;
619 viaint = np->intrs[0].line;
620#endif /* CONFIG_ADB_PMU */
621
622not_found:
623 return viaint;
624}
625
626static int pmacpic_suspend(struct sys_device *sysdev, pm_message_t state)
627{
628 int viaint = pmacpic_find_viaint();
629
630 sleep_save_mask[0] = ppc_cached_irq_mask[0];
631 sleep_save_mask[1] = ppc_cached_irq_mask[1];
632 ppc_cached_irq_mask[0] = 0;
633 ppc_cached_irq_mask[1] = 0;
634 if (viaint > 0)
635 set_bit(viaint, ppc_cached_irq_mask);
636 out_le32(&pmac_irq_hw[0]->enable, ppc_cached_irq_mask[0]);
637 if (max_real_irqs > 32)
638 out_le32(&pmac_irq_hw[1]->enable, ppc_cached_irq_mask[1]);
639 (void)in_le32(&pmac_irq_hw[0]->event);
640 /* make sure mask gets to controller before we return to caller */
641 mb();
642 (void)in_le32(&pmac_irq_hw[0]->enable);
643
644 return 0;
645}
646
647static int pmacpic_resume(struct sys_device *sysdev)
648{
649 int i;
650
651 out_le32(&pmac_irq_hw[0]->enable, 0);
652 if (max_real_irqs > 32)
653 out_le32(&pmac_irq_hw[1]->enable, 0);
654 mb();
655 for (i = 0; i < max_real_irqs; ++i)
656 if (test_bit(i, sleep_save_mask))
657 pmac_unmask_irq(i);
658
659 return 0;
660}
661
662#endif /* CONFIG_PM */
663
664static struct sysdev_class pmacpic_sysclass = {
665 set_kset_name("pmac_pic"),
666};
667
668static struct sys_device device_pmacpic = {
669 .id = 0,
670 .cls = &pmacpic_sysclass,
671};
672
673static struct sysdev_driver driver_pmacpic = {
674#ifdef CONFIG_PM
675 .suspend = &pmacpic_suspend,
676 .resume = &pmacpic_resume,
677#endif /* CONFIG_PM */
678};
679
680static int __init init_pmacpic_sysfs(void)
681{
682 if (max_irqs == 0)
683 return -ENODEV;
684
685 printk(KERN_DEBUG "Registering pmac pic with sysfs...\n");
686 sysdev_class_register(&pmacpic_sysclass);
687 sysdev_register(&device_pmacpic);
688 sysdev_driver_register(&pmacpic_sysclass, &driver_pmacpic);
689 return 0;
690}
691
692subsys_initcall(init_pmacpic_sysfs);
693
diff --git a/arch/ppc/platforms/pmac_pic.h b/arch/ppc/platforms/pmac_pic.h
deleted file mode 100644
index 664103dfeef9..000000000000
--- a/arch/ppc/platforms/pmac_pic.h
+++ /dev/null
@@ -1,11 +0,0 @@
1#ifndef __PPC_PLATFORMS_PMAC_PIC_H
2#define __PPC_PLATFORMS_PMAC_PIC_H
3
4#include <linux/irq.h>
5
6extern struct hw_interrupt_type pmac_pic;
7
8void pmac_pic_init(void);
9int pmac_get_irq(struct pt_regs *regs);
10
11#endif /* __PPC_PLATFORMS_PMAC_PIC_H */
diff --git a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c
deleted file mode 100644
index 55d2beffe560..000000000000
--- a/arch/ppc/platforms/pmac_setup.c
+++ /dev/null
@@ -1,745 +0,0 @@
1/*
2 * arch/ppc/platforms/setup.c
3 *
4 * PowerPC version
5 * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org)
6 *
7 * Adapted for Power Macintosh by Paul Mackerras
8 * Copyright (C) 1996 Paul Mackerras (paulus@cs.anu.edu.au)
9 *
10 * Derived from "arch/alpha/kernel/setup.c"
11 * Copyright (C) 1995 Linus Torvalds
12 *
13 * Maintained by Benjamin Herrenschmidt (benh@kernel.crashing.org)
14 *
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
19 *
20 */
21
22/*
23 * bootup setup stuff..
24 */
25
26#include <linux/config.h>
27#include <linux/init.h>
28#include <linux/errno.h>
29#include <linux/sched.h>
30#include <linux/kernel.h>
31#include <linux/mm.h>
32#include <linux/stddef.h>
33#include <linux/unistd.h>
34#include <linux/ptrace.h>
35#include <linux/slab.h>
36#include <linux/user.h>
37#include <linux/a.out.h>
38#include <linux/tty.h>
39#include <linux/string.h>
40#include <linux/delay.h>
41#include <linux/ioport.h>
42#include <linux/major.h>
43#include <linux/initrd.h>
44#include <linux/vt_kern.h>
45#include <linux/console.h>
46#include <linux/ide.h>
47#include <linux/pci.h>
48#include <linux/adb.h>
49#include <linux/cuda.h>
50#include <linux/pmu.h>
51#include <linux/seq_file.h>
52#include <linux/root_dev.h>
53#include <linux/bitops.h>
54#include <linux/suspend.h>
55
56#include <asm/reg.h>
57#include <asm/sections.h>
58#include <asm/prom.h>
59#include <asm/system.h>
60#include <asm/pgtable.h>
61#include <asm/io.h>
62#include <asm/pci-bridge.h>
63#include <asm/ohare.h>
64#include <asm/mediabay.h>
65#include <asm/machdep.h>
66#include <asm/dma.h>
67#include <asm/bootx.h>
68#include <asm/cputable.h>
69#include <asm/btext.h>
70#include <asm/pmac_feature.h>
71#include <asm/time.h>
72#include <asm/of_device.h>
73#include <asm/mmu_context.h>
74
75#include "pmac_pic.h"
76#include "mem_pieces.h"
77
78#undef SHOW_GATWICK_IRQS
79
80extern long pmac_time_init(void);
81extern unsigned long pmac_get_rtc_time(void);
82extern int pmac_set_rtc_time(unsigned long nowtime);
83extern void pmac_read_rtc_time(void);
84extern void pmac_calibrate_decr(void);
85extern void pmac_pcibios_fixup(void);
86extern void pmac_find_bridges(void);
87extern unsigned long pmac_ide_get_base(int index);
88extern void pmac_ide_init_hwif_ports(hw_regs_t *hw,
89 unsigned long data_port, unsigned long ctrl_port, int *irq);
90
91extern void pmac_nvram_update(void);
92extern unsigned char pmac_nvram_read_byte(int addr);
93extern void pmac_nvram_write_byte(int addr, unsigned char val);
94extern int pmac_pci_enable_device_hook(struct pci_dev *dev, int initial);
95extern void pmac_pcibios_after_init(void);
96extern int of_show_percpuinfo(struct seq_file *m, int i);
97
98struct device_node *memory_node;
99
100unsigned char drive_info;
101
102int ppc_override_l2cr = 0;
103int ppc_override_l2cr_value;
104int has_l2cache = 0;
105
106static int current_root_goodness = -1;
107
108extern int pmac_newworld;
109
110#define DEFAULT_ROOT_DEVICE Root_SDA1 /* sda1 - slightly silly choice */
111
112extern void zs_kgdb_hook(int tty_num);
113static void ohare_init(void);
114#ifdef CONFIG_BOOTX_TEXT
115static void pmac_progress(char *s, unsigned short hex);
116#endif
117
118sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
119
120#ifdef CONFIG_SMP
121extern struct smp_ops_t psurge_smp_ops;
122extern struct smp_ops_t core99_smp_ops;
123#endif /* CONFIG_SMP */
124
125static int
126pmac_show_cpuinfo(struct seq_file *m)
127{
128 struct device_node *np;
129 char *pp;
130 int plen;
131 int mbmodel = pmac_call_feature(PMAC_FTR_GET_MB_INFO,
132 NULL, PMAC_MB_INFO_MODEL, 0);
133 unsigned int mbflags = (unsigned int)pmac_call_feature(PMAC_FTR_GET_MB_INFO,
134 NULL, PMAC_MB_INFO_FLAGS, 0);
135 char* mbname;
136
137 if (pmac_call_feature(PMAC_FTR_GET_MB_INFO, NULL, PMAC_MB_INFO_NAME, (int)&mbname) != 0)
138 mbname = "Unknown";
139
140 /* find motherboard type */
141 seq_printf(m, "machine\t\t: ");
142 np = find_devices("device-tree");
143 if (np != NULL) {
144 pp = (char *) get_property(np, "model", NULL);
145 if (pp != NULL)
146 seq_printf(m, "%s\n", pp);
147 else
148 seq_printf(m, "PowerMac\n");
149 pp = (char *) get_property(np, "compatible", &plen);
150 if (pp != NULL) {
151 seq_printf(m, "motherboard\t:");
152 while (plen > 0) {
153 int l = strlen(pp) + 1;
154 seq_printf(m, " %s", pp);
155 plen -= l;
156 pp += l;
157 }
158 seq_printf(m, "\n");
159 }
160 } else
161 seq_printf(m, "PowerMac\n");
162
163 /* print parsed model */
164 seq_printf(m, "detected as\t: %d (%s)\n", mbmodel, mbname);
165 seq_printf(m, "pmac flags\t: %08x\n", mbflags);
166
167 /* find l2 cache info */
168 np = find_devices("l2-cache");
169 if (np == 0)
170 np = find_type_devices("cache");
171 if (np != 0) {
172 unsigned int *ic = (unsigned int *)
173 get_property(np, "i-cache-size", NULL);
174 unsigned int *dc = (unsigned int *)
175 get_property(np, "d-cache-size", NULL);
176 seq_printf(m, "L2 cache\t:");
177 has_l2cache = 1;
178 if (get_property(np, "cache-unified", NULL) != 0 && dc) {
179 seq_printf(m, " %dK unified", *dc / 1024);
180 } else {
181 if (ic)
182 seq_printf(m, " %dK instruction", *ic / 1024);
183 if (dc)
184 seq_printf(m, "%s %dK data",
185 (ic? " +": ""), *dc / 1024);
186 }
187 pp = get_property(np, "ram-type", NULL);
188 if (pp)
189 seq_printf(m, " %s", pp);
190 seq_printf(m, "\n");
191 }
192
193 /* find ram info */
194 np = find_devices("memory");
195 if (np != 0) {
196 int n;
197 struct reg_property *reg = (struct reg_property *)
198 get_property(np, "reg", &n);
199
200 if (reg != 0) {
201 unsigned long total = 0;
202
203 for (n /= sizeof(struct reg_property); n > 0; --n)
204 total += (reg++)->size;
205 seq_printf(m, "memory\t\t: %luMB\n", total >> 20);
206 }
207 }
208
209 /* Checks "l2cr-value" property in the registry */
210 np = find_devices("cpus");
211 if (np == 0)
212 np = find_type_devices("cpu");
213 if (np != 0) {
214 unsigned int *l2cr = (unsigned int *)
215 get_property(np, "l2cr-value", NULL);
216 if (l2cr != 0) {
217 seq_printf(m, "l2cr override\t: 0x%x\n", *l2cr);
218 }
219 }
220
221 /* Indicate newworld/oldworld */
222 seq_printf(m, "pmac-generation\t: %s\n",
223 pmac_newworld ? "NewWorld" : "OldWorld");
224
225
226 return 0;
227}
228
229static int
230pmac_show_percpuinfo(struct seq_file *m, int i)
231{
232#ifdef CONFIG_CPU_FREQ_PMAC
233 extern unsigned int pmac_get_one_cpufreq(int i);
234 unsigned int freq = pmac_get_one_cpufreq(i);
235 if (freq != 0) {
236 seq_printf(m, "clock\t\t: %dMHz\n", freq/1000);
237 return 0;
238 }
239#endif /* CONFIG_CPU_FREQ_PMAC */
240 return of_show_percpuinfo(m, i);
241}
242
243static volatile u32 *sysctrl_regs;
244
245void __init
246pmac_setup_arch(void)
247{
248 struct device_node *cpu;
249 int *fp;
250 unsigned long pvr;
251
252 pvr = PVR_VER(mfspr(SPRN_PVR));
253
254 /* Set loops_per_jiffy to a half-way reasonable value,
255 for use until calibrate_delay gets called. */
256 cpu = find_type_devices("cpu");
257 if (cpu != 0) {
258 fp = (int *) get_property(cpu, "clock-frequency", NULL);
259 if (fp != 0) {
260 if (pvr == 4 || pvr >= 8)
261 /* 604, G3, G4 etc. */
262 loops_per_jiffy = *fp / HZ;
263 else
264 /* 601, 603, etc. */
265 loops_per_jiffy = *fp / (2*HZ);
266 } else
267 loops_per_jiffy = 50000000 / HZ;
268 }
269
270 /* this area has the CPU identification register
271 and some registers used by smp boards */
272 sysctrl_regs = (volatile u32 *) ioremap(0xf8000000, 0x1000);
273 ohare_init();
274
275 /* Lookup PCI hosts */
276 pmac_find_bridges();
277
278 /* Checks "l2cr-value" property in the registry */
279 if (cpu_has_feature(CPU_FTR_L2CR)) {
280 struct device_node *np = find_devices("cpus");
281 if (np == 0)
282 np = find_type_devices("cpu");
283 if (np != 0) {
284 unsigned int *l2cr = (unsigned int *)
285 get_property(np, "l2cr-value", NULL);
286 if (l2cr != 0) {
287 ppc_override_l2cr = 1;
288 ppc_override_l2cr_value = *l2cr;
289 _set_L2CR(0);
290 _set_L2CR(ppc_override_l2cr_value);
291 }
292 }
293 }
294
295 if (ppc_override_l2cr)
296 printk(KERN_INFO "L2CR overriden (0x%x), backside cache is %s\n",
297 ppc_override_l2cr_value, (ppc_override_l2cr_value & 0x80000000)
298 ? "enabled" : "disabled");
299
300#ifdef CONFIG_KGDB
301 zs_kgdb_hook(0);
302#endif
303
304#ifdef CONFIG_ADB_CUDA
305 find_via_cuda();
306#else
307 if (find_devices("via-cuda")) {
308 printk("WARNING ! Your machine is Cuda based but your kernel\n");
309 printk(" wasn't compiled with CONFIG_ADB_CUDA option !\n");
310 }
311#endif
312#ifdef CONFIG_ADB_PMU
313 find_via_pmu();
314#else
315 if (find_devices("via-pmu")) {
316 printk("WARNING ! Your machine is PMU based but your kernel\n");
317 printk(" wasn't compiled with CONFIG_ADB_PMU option !\n");
318 }
319#endif
320#ifdef CONFIG_NVRAM
321 pmac_nvram_init();
322#endif
323#ifdef CONFIG_BLK_DEV_INITRD
324 if (initrd_start)
325 ROOT_DEV = Root_RAM0;
326 else
327#endif
328 ROOT_DEV = DEFAULT_ROOT_DEVICE;
329
330#ifdef CONFIG_SMP
331 /* Check for Core99 */
332 if (find_devices("uni-n") || find_devices("u3"))
333 smp_ops = &core99_smp_ops;
334 else
335 smp_ops = &psurge_smp_ops;
336#endif /* CONFIG_SMP */
337
338 pci_create_OF_bus_map();
339}
340
341static void __init ohare_init(void)
342{
343 /*
344 * Turn on the L2 cache.
345 * We assume that we have a PSX memory controller iff
346 * we have an ohare I/O controller.
347 */
348 if (find_devices("ohare") != NULL) {
349 if (((sysctrl_regs[2] >> 24) & 0xf) >= 3) {
350 if (sysctrl_regs[4] & 0x10)
351 sysctrl_regs[4] |= 0x04000020;
352 else
353 sysctrl_regs[4] |= 0x04000000;
354 if(has_l2cache)
355 printk(KERN_INFO "Level 2 cache enabled\n");
356 }
357 }
358}
359
360extern char *bootpath;
361extern char *bootdevice;
362void *boot_host;
363int boot_target;
364int boot_part;
365extern dev_t boot_dev;
366
367#ifdef CONFIG_SCSI
368void __init
369note_scsi_host(struct device_node *node, void *host)
370{
371 int l;
372 char *p;
373
374 l = strlen(node->full_name);
375 if (bootpath != NULL && bootdevice != NULL
376 && strncmp(node->full_name, bootdevice, l) == 0
377 && (bootdevice[l] == '/' || bootdevice[l] == 0)) {
378 boot_host = host;
379 /*
380 * There's a bug in OF 1.0.5. (Why am I not surprised.)
381 * If you pass a path like scsi/sd@1:0 to canon, it returns
382 * something like /bandit@F2000000/gc@10/53c94@10000/sd@0,0
383 * That is, the scsi target number doesn't get preserved.
384 * So we pick the target number out of bootpath and use that.
385 */
386 p = strstr(bootpath, "/sd@");
387 if (p != NULL) {
388 p += 4;
389 boot_target = simple_strtoul(p, NULL, 10);
390 p = strchr(p, ':');
391 if (p != NULL)
392 boot_part = simple_strtoul(p + 1, NULL, 10);
393 }
394 }
395}
396#endif
397
398#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
399static dev_t __init
400find_ide_boot(void)
401{
402 char *p;
403 int n;
404 dev_t __init pmac_find_ide_boot(char *bootdevice, int n);
405
406 if (bootdevice == NULL)
407 return 0;
408 p = strrchr(bootdevice, '/');
409 if (p == NULL)
410 return 0;
411 n = p - bootdevice;
412
413 return pmac_find_ide_boot(bootdevice, n);
414}
415#endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */
416
417static void __init
418find_boot_device(void)
419{
420#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
421 boot_dev = find_ide_boot();
422#endif
423}
424
425static int initializing = 1;
426/* TODO: Merge the suspend-to-ram with the common code !!!
427 * currently, this is a stub implementation for suspend-to-disk
428 * only
429 */
430
431#ifdef CONFIG_SOFTWARE_SUSPEND
432
433static int pmac_pm_prepare(suspend_state_t state)
434{
435 printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
436
437 return 0;
438}
439
440static int pmac_pm_enter(suspend_state_t state)
441{
442 printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
443
444 /* Giveup the lazy FPU & vec so we don't have to back them
445 * up from the low level code
446 */
447 enable_kernel_fp();
448
449#ifdef CONFIG_ALTIVEC
450 if (cur_cpu_spec->cpu_features & CPU_FTR_ALTIVEC)
451 enable_kernel_altivec();
452#endif /* CONFIG_ALTIVEC */
453
454 return 0;
455}
456
457static int pmac_pm_finish(suspend_state_t state)
458{
459 printk(KERN_DEBUG "%s(%d)\n", __FUNCTION__, state);
460
461 /* Restore userland MMU context */
462 set_context(current->active_mm->context, current->active_mm->pgd);
463
464 return 0;
465}
466
467static struct pm_ops pmac_pm_ops = {
468 .pm_disk_mode = PM_DISK_SHUTDOWN,
469 .prepare = pmac_pm_prepare,
470 .enter = pmac_pm_enter,
471 .finish = pmac_pm_finish,
472};
473
474#endif /* CONFIG_SOFTWARE_SUSPEND */
475
476static int pmac_late_init(void)
477{
478 initializing = 0;
479#ifdef CONFIG_SOFTWARE_SUSPEND
480 pm_set_ops(&pmac_pm_ops);
481#endif /* CONFIG_SOFTWARE_SUSPEND */
482 return 0;
483}
484
485late_initcall(pmac_late_init);
486
487/* can't be __init - can be called whenever a disk is first accessed */
488void
489note_bootable_part(dev_t dev, int part, int goodness)
490{
491 static int found_boot = 0;
492 char *p;
493
494 if (!initializing)
495 return;
496 if ((goodness <= current_root_goodness) &&
497 ROOT_DEV != DEFAULT_ROOT_DEVICE)
498 return;
499 p = strstr(saved_command_line, "root=");
500 if (p != NULL && (p == saved_command_line || p[-1] == ' '))
501 return;
502
503 if (!found_boot) {
504 find_boot_device();
505 found_boot = 1;
506 }
507 if (!boot_dev || dev == boot_dev) {
508 ROOT_DEV = dev + part;
509 boot_dev = 0;
510 current_root_goodness = goodness;
511 }
512}
513
514static void
515pmac_restart(char *cmd)
516{
517#ifdef CONFIG_ADB_CUDA
518 struct adb_request req;
519#endif /* CONFIG_ADB_CUDA */
520
521 switch (sys_ctrler) {
522#ifdef CONFIG_ADB_CUDA
523 case SYS_CTRLER_CUDA:
524 cuda_request(&req, NULL, 2, CUDA_PACKET,
525 CUDA_RESET_SYSTEM);
526 for (;;)
527 cuda_poll();
528 break;
529#endif /* CONFIG_ADB_CUDA */
530#ifdef CONFIG_ADB_PMU
531 case SYS_CTRLER_PMU:
532 pmu_restart();
533 break;
534#endif /* CONFIG_ADB_PMU */
535 default: ;
536 }
537}
538
539static void
540pmac_power_off(void)
541{
542#ifdef CONFIG_ADB_CUDA
543 struct adb_request req;
544#endif /* CONFIG_ADB_CUDA */
545
546 switch (sys_ctrler) {
547#ifdef CONFIG_ADB_CUDA
548 case SYS_CTRLER_CUDA:
549 cuda_request(&req, NULL, 2, CUDA_PACKET,
550 CUDA_POWERDOWN);
551 for (;;)
552 cuda_poll();
553 break;
554#endif /* CONFIG_ADB_CUDA */
555#ifdef CONFIG_ADB_PMU
556 case SYS_CTRLER_PMU:
557 pmu_shutdown();
558 break;
559#endif /* CONFIG_ADB_PMU */
560 default: ;
561 }
562}
563
564static void
565pmac_halt(void)
566{
567 pmac_power_off();
568}
569
570/*
571 * Read in a property describing some pieces of memory.
572 */
573
574static int __init
575get_mem_prop(char *name, struct mem_pieces *mp)
576{
577 struct reg_property *rp;
578 int i, s;
579 unsigned int *ip;
580 int nac = prom_n_addr_cells(memory_node);
581 int nsc = prom_n_size_cells(memory_node);
582
583 ip = (unsigned int *) get_property(memory_node, name, &s);
584 if (ip == NULL) {
585 printk(KERN_ERR "error: couldn't get %s property on /memory\n",
586 name);
587 return 0;
588 }
589 s /= (nsc + nac) * 4;
590 rp = mp->regions;
591 for (i = 0; i < s; ++i, ip += nac+nsc) {
592 if (nac >= 2 && ip[nac-2] != 0)
593 continue;
594 rp->address = ip[nac-1];
595 if (nsc >= 2 && ip[nac+nsc-2] != 0)
596 rp->size = ~0U;
597 else
598 rp->size = ip[nac+nsc-1];
599 ++rp;
600 }
601 mp->n_regions = rp - mp->regions;
602
603 /* Make sure the pieces are sorted. */
604 mem_pieces_sort(mp);
605 mem_pieces_coalesce(mp);
606 return 1;
607}
608
609/*
610 * On systems with Open Firmware, collect information about
611 * physical RAM and which pieces are already in use.
612 * At this point, we have (at least) the first 8MB mapped with a BAT.
613 * Our text, data, bss use something over 1MB, starting at 0.
614 * Open Firmware may be using 1MB at the 4MB point.
615 */
616unsigned long __init
617pmac_find_end_of_memory(void)
618{
619 unsigned long a, total;
620 struct mem_pieces phys_mem;
621
622 /*
623 * Find out where physical memory is, and check that it
624 * starts at 0 and is contiguous. It seems that RAM is
625 * always physically contiguous on Power Macintoshes.
626 *
627 * Supporting discontiguous physical memory isn't hard,
628 * it just makes the virtual <-> physical mapping functions
629 * more complicated (or else you end up wasting space
630 * in mem_map).
631 */
632 memory_node = find_devices("memory");
633 if (memory_node == NULL || !get_mem_prop("reg", &phys_mem)
634 || phys_mem.n_regions == 0)
635 panic("No RAM??");
636 a = phys_mem.regions[0].address;
637 if (a != 0)
638 panic("RAM doesn't start at physical address 0");
639 total = phys_mem.regions[0].size;
640
641 if (phys_mem.n_regions > 1) {
642 printk("RAM starting at 0x%x is not contiguous\n",
643 phys_mem.regions[1].address);
644 printk("Using RAM from 0 to 0x%lx\n", total-1);
645 }
646
647 return total;
648}
649
650void __init
651pmac_init(unsigned long r3, unsigned long r4, unsigned long r5,
652 unsigned long r6, unsigned long r7)
653{
654 /* isa_io_base gets set in pmac_find_bridges */
655 isa_mem_base = PMAC_ISA_MEM_BASE;
656 pci_dram_offset = PMAC_PCI_DRAM_OFFSET;
657 ISA_DMA_THRESHOLD = ~0L;
658 DMA_MODE_READ = 1;
659 DMA_MODE_WRITE = 2;
660
661 ppc_md.setup_arch = pmac_setup_arch;
662 ppc_md.show_cpuinfo = pmac_show_cpuinfo;
663 ppc_md.show_percpuinfo = pmac_show_percpuinfo;
664 ppc_md.init_IRQ = pmac_pic_init;
665 ppc_md.get_irq = pmac_get_irq; /* Changed later on ... */
666
667 ppc_md.pcibios_fixup = pmac_pcibios_fixup;
668 ppc_md.pcibios_enable_device_hook = pmac_pci_enable_device_hook;
669 ppc_md.pcibios_after_init = pmac_pcibios_after_init;
670 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
671
672 ppc_md.restart = pmac_restart;
673 ppc_md.power_off = pmac_power_off;
674 ppc_md.halt = pmac_halt;
675
676 ppc_md.time_init = pmac_time_init;
677 ppc_md.set_rtc_time = pmac_set_rtc_time;
678 ppc_md.get_rtc_time = pmac_get_rtc_time;
679 ppc_md.calibrate_decr = pmac_calibrate_decr;
680
681 ppc_md.find_end_of_memory = pmac_find_end_of_memory;
682
683 ppc_md.feature_call = pmac_do_feature_call;
684
685#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
686#ifdef CONFIG_BLK_DEV_IDE_PMAC
687 ppc_ide_md.ide_init_hwif = pmac_ide_init_hwif_ports;
688 ppc_ide_md.default_io_base = pmac_ide_get_base;
689#endif /* CONFIG_BLK_DEV_IDE_PMAC */
690#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
691
692#ifdef CONFIG_BOOTX_TEXT
693 ppc_md.progress = pmac_progress;
694#endif /* CONFIG_BOOTX_TEXT */
695
696 if (ppc_md.progress) ppc_md.progress("pmac_init(): exit", 0);
697
698}
699
700#ifdef CONFIG_BOOTX_TEXT
701static void __init
702pmac_progress(char *s, unsigned short hex)
703{
704 if (boot_text_mapped) {
705 btext_drawstring(s);
706 btext_drawchar('\n');
707 }
708}
709#endif /* CONFIG_BOOTX_TEXT */
710
711static int __init
712pmac_declare_of_platform_devices(void)
713{
714 struct device_node *np;
715
716 np = find_devices("uni-n");
717 if (np) {
718 for (np = np->child; np != NULL; np = np->sibling)
719 if (strncmp(np->name, "i2c", 3) == 0) {
720 of_platform_device_create(np, "uni-n-i2c",
721 NULL);
722 break;
723 }
724 }
725 np = find_devices("u3");
726 if (np) {
727 for (np = np->child; np != NULL; np = np->sibling)
728 if (strncmp(np->name, "i2c", 3) == 0) {
729 of_platform_device_create(np, "u3-i2c",
730 NULL);
731 break;
732 }
733 }
734
735 np = find_devices("valkyrie");
736 if (np)
737 of_platform_device_create(np, "valkyrie", NULL);
738 np = find_devices("platinum");
739 if (np)
740 of_platform_device_create(np, "platinum", NULL);
741
742 return 0;
743}
744
745device_initcall(pmac_declare_of_platform_devices);
diff --git a/arch/ppc/platforms/pmac_sleep.S b/arch/ppc/platforms/pmac_sleep.S
deleted file mode 100644
index 22b113d19b24..000000000000
--- a/arch/ppc/platforms/pmac_sleep.S
+++ /dev/null
@@ -1,396 +0,0 @@
1/*
2 * This file contains sleep low-level functions for PowerBook G3.
3 * Copyright (C) 1999 Benjamin Herrenschmidt (benh@kernel.crashing.org)
4 * and Paul Mackerras (paulus@samba.org).
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
13#include <linux/config.h>
14#include <asm/processor.h>
15#include <asm/page.h>
16#include <asm/ppc_asm.h>
17#include <asm/cputable.h>
18#include <asm/cache.h>
19#include <asm/thread_info.h>
20#include <asm/asm-offsets.h>
21
22#define MAGIC 0x4c617273 /* 'Lars' */
23
24/*
25 * Structure for storing CPU registers on the stack.
26 */
27#define SL_SP 0
28#define SL_PC 4
29#define SL_MSR 8
30#define SL_SDR1 0xc
31#define SL_SPRG0 0x10 /* 4 sprg's */
32#define SL_DBAT0 0x20
33#define SL_IBAT0 0x28
34#define SL_DBAT1 0x30
35#define SL_IBAT1 0x38
36#define SL_DBAT2 0x40
37#define SL_IBAT2 0x48
38#define SL_DBAT3 0x50
39#define SL_IBAT3 0x58
40#define SL_TB 0x60
41#define SL_R2 0x68
42#define SL_CR 0x6c
43#define SL_R12 0x70 /* r12 to r31 */
44#define SL_SIZE (SL_R12 + 80)
45
46 .section .text
47 .align 5
48
49#if defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ_PMAC)
50
51/* This gets called by via-pmu.c late during the sleep process.
52 * The PMU was already send the sleep command and will shut us down
53 * soon. We need to save all that is needed and setup the wakeup
54 * vector that will be called by the ROM on wakeup
55 */
56_GLOBAL(low_sleep_handler)
57#ifndef CONFIG_6xx
58 blr
59#else
60 mflr r0
61 stw r0,4(r1)
62 stwu r1,-SL_SIZE(r1)
63 mfcr r0
64 stw r0,SL_CR(r1)
65 stw r2,SL_R2(r1)
66 stmw r12,SL_R12(r1)
67
68 /* Save MSR & SDR1 */
69 mfmsr r4
70 stw r4,SL_MSR(r1)
71 mfsdr1 r4
72 stw r4,SL_SDR1(r1)
73
74 /* Get a stable timebase and save it */
751: mftbu r4
76 stw r4,SL_TB(r1)
77 mftb r5
78 stw r5,SL_TB+4(r1)
79 mftbu r3
80 cmpw r3,r4
81 bne 1b
82
83 /* Save SPRGs */
84 mfsprg r4,0
85 stw r4,SL_SPRG0(r1)
86 mfsprg r4,1
87 stw r4,SL_SPRG0+4(r1)
88 mfsprg r4,2
89 stw r4,SL_SPRG0+8(r1)
90 mfsprg r4,3
91 stw r4,SL_SPRG0+12(r1)
92
93 /* Save BATs */
94 mfdbatu r4,0
95 stw r4,SL_DBAT0(r1)
96 mfdbatl r4,0
97 stw r4,SL_DBAT0+4(r1)
98 mfdbatu r4,1
99 stw r4,SL_DBAT1(r1)
100 mfdbatl r4,1
101 stw r4,SL_DBAT1+4(r1)
102 mfdbatu r4,2
103 stw r4,SL_DBAT2(r1)
104 mfdbatl r4,2
105 stw r4,SL_DBAT2+4(r1)
106 mfdbatu r4,3
107 stw r4,SL_DBAT3(r1)
108 mfdbatl r4,3
109 stw r4,SL_DBAT3+4(r1)
110 mfibatu r4,0
111 stw r4,SL_IBAT0(r1)
112 mfibatl r4,0
113 stw r4,SL_IBAT0+4(r1)
114 mfibatu r4,1
115 stw r4,SL_IBAT1(r1)
116 mfibatl r4,1
117 stw r4,SL_IBAT1+4(r1)
118 mfibatu r4,2
119 stw r4,SL_IBAT2(r1)
120 mfibatl r4,2
121 stw r4,SL_IBAT2+4(r1)
122 mfibatu r4,3
123 stw r4,SL_IBAT3(r1)
124 mfibatl r4,3
125 stw r4,SL_IBAT3+4(r1)
126
127 /* Backup various CPU config stuffs */
128 bl __save_cpu_setup
129
130 /* The ROM can wake us up via 2 different vectors:
131 * - On wallstreet & lombard, we must write a magic
132 * value 'Lars' at address 4 and a pointer to a
133 * memory location containing the PC to resume from
134 * at address 0.
135 * - On Core99, we must store the wakeup vector at
136 * address 0x80 and eventually it's parameters
137 * at address 0x84. I've have some trouble with those
138 * parameters however and I no longer use them.
139 */
140 lis r5,grackle_wake_up@ha
141 addi r5,r5,grackle_wake_up@l
142 tophys(r5,r5)
143 stw r5,SL_PC(r1)
144 lis r4,KERNELBASE@h
145 tophys(r5,r1)
146 addi r5,r5,SL_PC
147 lis r6,MAGIC@ha
148 addi r6,r6,MAGIC@l
149 stw r5,0(r4)
150 stw r6,4(r4)
151 /* Setup stuffs at 0x80-0x84 for Core99 */
152 lis r3,core99_wake_up@ha
153 addi r3,r3,core99_wake_up@l
154 tophys(r3,r3)
155 stw r3,0x80(r4)
156 stw r5,0x84(r4)
157 /* Store a pointer to our backup storage into
158 * a kernel global
159 */
160 lis r3,sleep_storage@ha
161 addi r3,r3,sleep_storage@l
162 stw r5,0(r3)
163
164 .globl low_cpu_die
165low_cpu_die:
166 /* Flush & disable all caches */
167 bl flush_disable_caches
168
169 /* Turn off data relocation. */
170 mfmsr r3 /* Save MSR in r7 */
171 rlwinm r3,r3,0,28,26 /* Turn off DR bit */
172 sync
173 mtmsr r3
174 isync
175
176BEGIN_FTR_SECTION
177 /* Flush any pending L2 data prefetches to work around HW bug */
178 sync
179 lis r3,0xfff0
180 lwz r0,0(r3) /* perform cache-inhibited load to ROM */
181 sync /* (caches are disabled at this point) */
182END_FTR_SECTION_IFSET(CPU_FTR_SPEC7450)
183
184/*
185 * Set the HID0 and MSR for sleep.
186 */
187 mfspr r2,SPRN_HID0
188 rlwinm r2,r2,0,10,7 /* clear doze, nap */
189 oris r2,r2,HID0_SLEEP@h
190 sync
191 isync
192 mtspr SPRN_HID0,r2
193 sync
194
195/* This loop puts us back to sleep in case we have a spurrious
196 * wakeup so that the host bridge properly stays asleep. The
197 * CPU will be turned off, either after a known time (about 1
198 * second) on wallstreet & lombard, or as soon as the CPU enters
199 * SLEEP mode on core99
200 */
201 mfmsr r2
202 oris r2,r2,MSR_POW@h
2031: sync
204 mtmsr r2
205 isync
206 b 1b
207
208/*
209 * Here is the resume code.
210 */
211
212
213/*
214 * Core99 machines resume here
215 * r4 has the physical address of SL_PC(sp) (unused)
216 */
217_GLOBAL(core99_wake_up)
218 /* Make sure HID0 no longer contains any sleep bit and that data cache
219 * is disabled
220 */
221 mfspr r3,SPRN_HID0
222 rlwinm r3,r3,0,11,7 /* clear SLEEP, NAP, DOZE bits */
223 rlwinm 3,r3,0,18,15 /* clear DCE, ICE */
224 mtspr SPRN_HID0,r3
225 sync
226 isync
227
228 /* sanitize MSR */
229 mfmsr r3
230 ori r3,r3,MSR_EE|MSR_IP
231 xori r3,r3,MSR_EE|MSR_IP
232 sync
233 isync
234 mtmsr r3
235 sync
236 isync
237
238 /* Recover sleep storage */
239 lis r3,sleep_storage@ha
240 addi r3,r3,sleep_storage@l
241 tophys(r3,r3)
242 lwz r1,0(r3)
243
244 /* Pass thru to older resume code ... */
245/*
246 * Here is the resume code for older machines.
247 * r1 has the physical address of SL_PC(sp).
248 */
249
250grackle_wake_up:
251
252 /* Restore the kernel's segment registers before
253 * we do any r1 memory access as we are not sure they
254 * are in a sane state above the first 256Mb region
255 */
256 li r0,16 /* load up segment register values */
257 mtctr r0 /* for context 0 */
258 lis r3,0x2000 /* Ku = 1, VSID = 0 */
259 li r4,0
2603: mtsrin r3,r4
261 addi r3,r3,0x111 /* increment VSID */
262 addis r4,r4,0x1000 /* address of next segment */
263 bdnz 3b
264 sync
265 isync
266
267 subi r1,r1,SL_PC
268
269 /* Restore various CPU config stuffs */
270 bl __restore_cpu_setup
271
272 /* Make sure all FPRs have been initialized */
273 bl reloc_offset
274 bl __init_fpu_registers
275
276 /* Invalidate & enable L1 cache, we don't care about
277 * whatever the ROM may have tried to write to memory
278 */
279 bl __inval_enable_L1
280
281 /* Restore the BATs, and SDR1. Then we can turn on the MMU. */
282 lwz r4,SL_SDR1(r1)
283 mtsdr1 r4
284 lwz r4,SL_SPRG0(r1)
285 mtsprg 0,r4
286 lwz r4,SL_SPRG0+4(r1)
287 mtsprg 1,r4
288 lwz r4,SL_SPRG0+8(r1)
289 mtsprg 2,r4
290 lwz r4,SL_SPRG0+12(r1)
291 mtsprg 3,r4
292
293 lwz r4,SL_DBAT0(r1)
294 mtdbatu 0,r4
295 lwz r4,SL_DBAT0+4(r1)
296 mtdbatl 0,r4
297 lwz r4,SL_DBAT1(r1)
298 mtdbatu 1,r4
299 lwz r4,SL_DBAT1+4(r1)
300 mtdbatl 1,r4
301 lwz r4,SL_DBAT2(r1)
302 mtdbatu 2,r4
303 lwz r4,SL_DBAT2+4(r1)
304 mtdbatl 2,r4
305 lwz r4,SL_DBAT3(r1)
306 mtdbatu 3,r4
307 lwz r4,SL_DBAT3+4(r1)
308 mtdbatl 3,r4
309 lwz r4,SL_IBAT0(r1)
310 mtibatu 0,r4
311 lwz r4,SL_IBAT0+4(r1)
312 mtibatl 0,r4
313 lwz r4,SL_IBAT1(r1)
314 mtibatu 1,r4
315 lwz r4,SL_IBAT1+4(r1)
316 mtibatl 1,r4
317 lwz r4,SL_IBAT2(r1)
318 mtibatu 2,r4
319 lwz r4,SL_IBAT2+4(r1)
320 mtibatl 2,r4
321 lwz r4,SL_IBAT3(r1)
322 mtibatu 3,r4
323 lwz r4,SL_IBAT3+4(r1)
324 mtibatl 3,r4
325
326BEGIN_FTR_SECTION
327 li r4,0
328 mtspr SPRN_DBAT4U,r4
329 mtspr SPRN_DBAT4L,r4
330 mtspr SPRN_DBAT5U,r4
331 mtspr SPRN_DBAT5L,r4
332 mtspr SPRN_DBAT6U,r4
333 mtspr SPRN_DBAT6L,r4
334 mtspr SPRN_DBAT7U,r4
335 mtspr SPRN_DBAT7L,r4
336 mtspr SPRN_IBAT4U,r4
337 mtspr SPRN_IBAT4L,r4
338 mtspr SPRN_IBAT5U,r4
339 mtspr SPRN_IBAT5L,r4
340 mtspr SPRN_IBAT6U,r4
341 mtspr SPRN_IBAT6L,r4
342 mtspr SPRN_IBAT7U,r4
343 mtspr SPRN_IBAT7L,r4
344END_FTR_SECTION_IFSET(CPU_FTR_HAS_HIGH_BATS)
345
346 /* Flush all TLBs */
347 lis r4,0x1000
3481: addic. r4,r4,-0x1000
349 tlbie r4
350 blt 1b
351 sync
352
353 /* restore the MSR and turn on the MMU */
354 lwz r3,SL_MSR(r1)
355 bl turn_on_mmu
356
357 /* get back the stack pointer */
358 tovirt(r1,r1)
359
360 /* Restore TB */
361 li r3,0
362 mttbl r3
363 lwz r3,SL_TB(r1)
364 lwz r4,SL_TB+4(r1)
365 mttbu r3
366 mttbl r4
367
368 /* Restore the callee-saved registers and return */
369 lwz r0,SL_CR(r1)
370 mtcr r0
371 lwz r2,SL_R2(r1)
372 lmw r12,SL_R12(r1)
373 addi r1,r1,SL_SIZE
374 lwz r0,4(r1)
375 mtlr r0
376 blr
377
378turn_on_mmu:
379 mflr r4
380 tovirt(r4,r4)
381 mtsrr0 r4
382 mtsrr1 r3
383 sync
384 isync
385 rfi
386
387#endif /* defined(CONFIG_PM) || defined(CONFIG_CPU_FREQ) */
388
389 .section .data
390 .balign L1_CACHE_BYTES
391sleep_storage:
392 .long 0
393 .balign L1_CACHE_BYTES, 0
394
395#endif /* CONFIG_6xx */
396 .section .text
diff --git a/arch/ppc/platforms/pmac_smp.c b/arch/ppc/platforms/pmac_smp.c
deleted file mode 100644
index 26ff26238f03..000000000000
--- a/arch/ppc/platforms/pmac_smp.c
+++ /dev/null
@@ -1,692 +0,0 @@
1/*
2 * SMP support for power macintosh.
3 *
4 * We support both the old "powersurge" SMP architecture
5 * and the current Core99 (G4 PowerMac) machines.
6 *
7 * Note that we don't support the very first rev. of
8 * Apple/DayStar 2 CPUs board, the one with the funky
9 * watchdog. Hopefully, none of these should be there except
10 * maybe internally to Apple. I should probably still add some
11 * code to detect this card though and disable SMP. --BenH.
12 *
13 * Support Macintosh G4 SMP by Troy Benjegerdes (hozer@drgw.net)
14 * and Ben Herrenschmidt <benh@kernel.crashing.org>.
15 *
16 * Support for DayStar quad CPU cards
17 * Copyright (C) XLR8, Inc. 1994-2000
18 *
19 * This program is free software; you can redistribute it and/or
20 * modify it under the terms of the GNU General Public License
21 * as published by the Free Software Foundation; either version
22 * 2 of the License, or (at your option) any later version.
23 */
24#include <linux/config.h>
25#include <linux/kernel.h>
26#include <linux/sched.h>
27#include <linux/smp.h>
28#include <linux/smp_lock.h>
29#include <linux/interrupt.h>
30#include <linux/kernel_stat.h>
31#include <linux/delay.h>
32#include <linux/init.h>
33#include <linux/spinlock.h>
34#include <linux/errno.h>
35#include <linux/hardirq.h>
36#include <linux/cpu.h>
37
38#include <asm/ptrace.h>
39#include <asm/atomic.h>
40#include <asm/irq.h>
41#include <asm/page.h>
42#include <asm/pgtable.h>
43#include <asm/sections.h>
44#include <asm/io.h>
45#include <asm/prom.h>
46#include <asm/smp.h>
47#include <asm/residual.h>
48#include <asm/machdep.h>
49#include <asm/pmac_feature.h>
50#include <asm/time.h>
51#include <asm/open_pic.h>
52#include <asm/cacheflush.h>
53#include <asm/keylargo.h>
54
55/*
56 * Powersurge (old powermac SMP) support.
57 */
58
59extern void __secondary_start_pmac_0(void);
60
61/* Addresses for powersurge registers */
62#define HAMMERHEAD_BASE 0xf8000000
63#define HHEAD_CONFIG 0x90
64#define HHEAD_SEC_INTR 0xc0
65
66/* register for interrupting the primary processor on the powersurge */
67/* N.B. this is actually the ethernet ROM! */
68#define PSURGE_PRI_INTR 0xf3019000
69
70/* register for storing the start address for the secondary processor */
71/* N.B. this is the PCI config space address register for the 1st bridge */
72#define PSURGE_START 0xf2800000
73
74/* Daystar/XLR8 4-CPU card */
75#define PSURGE_QUAD_REG_ADDR 0xf8800000
76
77#define PSURGE_QUAD_IRQ_SET 0
78#define PSURGE_QUAD_IRQ_CLR 1
79#define PSURGE_QUAD_IRQ_PRIMARY 2
80#define PSURGE_QUAD_CKSTOP_CTL 3
81#define PSURGE_QUAD_PRIMARY_ARB 4
82#define PSURGE_QUAD_BOARD_ID 6
83#define PSURGE_QUAD_WHICH_CPU 7
84#define PSURGE_QUAD_CKSTOP_RDBK 8
85#define PSURGE_QUAD_RESET_CTL 11
86
87#define PSURGE_QUAD_OUT(r, v) (out_8(quad_base + ((r) << 4) + 4, (v)))
88#define PSURGE_QUAD_IN(r) (in_8(quad_base + ((r) << 4) + 4) & 0x0f)
89#define PSURGE_QUAD_BIS(r, v) (PSURGE_QUAD_OUT((r), PSURGE_QUAD_IN(r) | (v)))
90#define PSURGE_QUAD_BIC(r, v) (PSURGE_QUAD_OUT((r), PSURGE_QUAD_IN(r) & ~(v)))
91
92/* virtual addresses for the above */
93static volatile u8 __iomem *hhead_base;
94static volatile u8 __iomem *quad_base;
95static volatile u32 __iomem *psurge_pri_intr;
96static volatile u8 __iomem *psurge_sec_intr;
97static volatile u32 __iomem *psurge_start;
98
99/* values for psurge_type */
100#define PSURGE_NONE -1
101#define PSURGE_DUAL 0
102#define PSURGE_QUAD_OKEE 1
103#define PSURGE_QUAD_COTTON 2
104#define PSURGE_QUAD_ICEGRASS 3
105
106/* what sort of powersurge board we have */
107static int psurge_type = PSURGE_NONE;
108
109/* L2 and L3 cache settings to pass from CPU0 to CPU1 */
110volatile static long int core99_l2_cache;
111volatile static long int core99_l3_cache;
112
113/* Timebase freeze GPIO */
114static unsigned int core99_tb_gpio;
115
116/* Sync flag for HW tb sync */
117static volatile int sec_tb_reset = 0;
118static unsigned int pri_tb_hi, pri_tb_lo;
119static unsigned int pri_tb_stamp;
120
121static void __devinit core99_init_caches(int cpu)
122{
123 if (!cpu_has_feature(CPU_FTR_L2CR))
124 return;
125
126 if (cpu == 0) {
127 core99_l2_cache = _get_L2CR();
128 printk("CPU0: L2CR is %lx\n", core99_l2_cache);
129 } else {
130 printk("CPU%d: L2CR was %lx\n", cpu, _get_L2CR());
131 _set_L2CR(0);
132 _set_L2CR(core99_l2_cache);
133 printk("CPU%d: L2CR set to %lx\n", cpu, core99_l2_cache);
134 }
135
136 if (!cpu_has_feature(CPU_FTR_L3CR))
137 return;
138
139 if (cpu == 0){
140 core99_l3_cache = _get_L3CR();
141 printk("CPU0: L3CR is %lx\n", core99_l3_cache);
142 } else {
143 printk("CPU%d: L3CR was %lx\n", cpu, _get_L3CR());
144 _set_L3CR(0);
145 _set_L3CR(core99_l3_cache);
146 printk("CPU%d: L3CR set to %lx\n", cpu, core99_l3_cache);
147 }
148}
149
150/*
151 * Set and clear IPIs for powersurge.
152 */
153static inline void psurge_set_ipi(int cpu)
154{
155 if (psurge_type == PSURGE_NONE)
156 return;
157 if (cpu == 0)
158 in_be32(psurge_pri_intr);
159 else if (psurge_type == PSURGE_DUAL)
160 out_8(psurge_sec_intr, 0);
161 else
162 PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_SET, 1 << cpu);
163}
164
165static inline void psurge_clr_ipi(int cpu)
166{
167 if (cpu > 0) {
168 switch(psurge_type) {
169 case PSURGE_DUAL:
170 out_8(psurge_sec_intr, ~0);
171 case PSURGE_NONE:
172 break;
173 default:
174 PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_CLR, 1 << cpu);
175 }
176 }
177}
178
179/*
180 * On powersurge (old SMP powermac architecture) we don't have
181 * separate IPIs for separate messages like openpic does. Instead
182 * we have a bitmap for each processor, where a 1 bit means that
183 * the corresponding message is pending for that processor.
184 * Ideally each cpu's entry would be in a different cache line.
185 * -- paulus.
186 */
187static unsigned long psurge_smp_message[NR_CPUS];
188
189void psurge_smp_message_recv(struct pt_regs *regs)
190{
191 int cpu = smp_processor_id();
192 int msg;
193
194 /* clear interrupt */
195 psurge_clr_ipi(cpu);
196
197 if (num_online_cpus() < 2)
198 return;
199
200 /* make sure there is a message there */
201 for (msg = 0; msg < 4; msg++)
202 if (test_and_clear_bit(msg, &psurge_smp_message[cpu]))
203 smp_message_recv(msg, regs);
204}
205
206irqreturn_t psurge_primary_intr(int irq, void *d, struct pt_regs *regs)
207{
208 psurge_smp_message_recv(regs);
209 return IRQ_HANDLED;
210}
211
212static void smp_psurge_message_pass(int target, int msg)
213{
214 int i;
215
216 if (num_online_cpus() < 2)
217 return;
218
219 for (i = 0; i < NR_CPUS; i++) {
220 if (!cpu_online(i))
221 continue;
222 if (target == MSG_ALL
223 || (target == MSG_ALL_BUT_SELF && i != smp_processor_id())
224 || target == i) {
225 set_bit(msg, &psurge_smp_message[i]);
226 psurge_set_ipi(i);
227 }
228 }
229}
230
231/*
232 * Determine a quad card presence. We read the board ID register, we
233 * force the data bus to change to something else, and we read it again.
234 * It it's stable, then the register probably exist (ugh !)
235 */
236static int __init psurge_quad_probe(void)
237{
238 int type;
239 unsigned int i;
240
241 type = PSURGE_QUAD_IN(PSURGE_QUAD_BOARD_ID);
242 if (type < PSURGE_QUAD_OKEE || type > PSURGE_QUAD_ICEGRASS
243 || type != PSURGE_QUAD_IN(PSURGE_QUAD_BOARD_ID))
244 return PSURGE_DUAL;
245
246 /* looks OK, try a slightly more rigorous test */
247 /* bogus is not necessarily cacheline-aligned,
248 though I don't suppose that really matters. -- paulus */
249 for (i = 0; i < 100; i++) {
250 volatile u32 bogus[8];
251 bogus[(0+i)%8] = 0x00000000;
252 bogus[(1+i)%8] = 0x55555555;
253 bogus[(2+i)%8] = 0xFFFFFFFF;
254 bogus[(3+i)%8] = 0xAAAAAAAA;
255 bogus[(4+i)%8] = 0x33333333;
256 bogus[(5+i)%8] = 0xCCCCCCCC;
257 bogus[(6+i)%8] = 0xCCCCCCCC;
258 bogus[(7+i)%8] = 0x33333333;
259 wmb();
260 asm volatile("dcbf 0,%0" : : "r" (bogus) : "memory");
261 mb();
262 if (type != PSURGE_QUAD_IN(PSURGE_QUAD_BOARD_ID))
263 return PSURGE_DUAL;
264 }
265 return type;
266}
267
268static void __init psurge_quad_init(void)
269{
270 int procbits;
271
272 if (ppc_md.progress) ppc_md.progress("psurge_quad_init", 0x351);
273 procbits = ~PSURGE_QUAD_IN(PSURGE_QUAD_WHICH_CPU);
274 if (psurge_type == PSURGE_QUAD_ICEGRASS)
275 PSURGE_QUAD_BIS(PSURGE_QUAD_RESET_CTL, procbits);
276 else
277 PSURGE_QUAD_BIC(PSURGE_QUAD_CKSTOP_CTL, procbits);
278 mdelay(33);
279 out_8(psurge_sec_intr, ~0);
280 PSURGE_QUAD_OUT(PSURGE_QUAD_IRQ_CLR, procbits);
281 PSURGE_QUAD_BIS(PSURGE_QUAD_RESET_CTL, procbits);
282 if (psurge_type != PSURGE_QUAD_ICEGRASS)
283 PSURGE_QUAD_BIS(PSURGE_QUAD_CKSTOP_CTL, procbits);
284 PSURGE_QUAD_BIC(PSURGE_QUAD_PRIMARY_ARB, procbits);
285 mdelay(33);
286 PSURGE_QUAD_BIC(PSURGE_QUAD_RESET_CTL, procbits);
287 mdelay(33);
288 PSURGE_QUAD_BIS(PSURGE_QUAD_PRIMARY_ARB, procbits);
289 mdelay(33);
290}
291
292static int __init smp_psurge_probe(void)
293{
294 int i, ncpus;
295
296 /* We don't do SMP on the PPC601 -- paulus */
297 if (PVR_VER(mfspr(SPRN_PVR)) == 1)
298 return 1;
299
300 /*
301 * The powersurge cpu board can be used in the generation
302 * of powermacs that have a socket for an upgradeable cpu card,
303 * including the 7500, 8500, 9500, 9600.
304 * The device tree doesn't tell you if you have 2 cpus because
305 * OF doesn't know anything about the 2nd processor.
306 * Instead we look for magic bits in magic registers,
307 * in the hammerhead memory controller in the case of the
308 * dual-cpu powersurge board. -- paulus.
309 */
310 if (find_devices("hammerhead") == NULL)
311 return 1;
312
313 hhead_base = ioremap(HAMMERHEAD_BASE, 0x800);
314 quad_base = ioremap(PSURGE_QUAD_REG_ADDR, 1024);
315 psurge_sec_intr = hhead_base + HHEAD_SEC_INTR;
316
317 psurge_type = psurge_quad_probe();
318 if (psurge_type != PSURGE_DUAL) {
319 psurge_quad_init();
320 /* All released cards using this HW design have 4 CPUs */
321 ncpus = 4;
322 } else {
323 iounmap(quad_base);
324 if ((in_8(hhead_base + HHEAD_CONFIG) & 0x02) == 0) {
325 /* not a dual-cpu card */
326 iounmap(hhead_base);
327 psurge_type = PSURGE_NONE;
328 return 1;
329 }
330 ncpus = 2;
331 }
332
333 psurge_start = ioremap(PSURGE_START, 4);
334 psurge_pri_intr = ioremap(PSURGE_PRI_INTR, 4);
335
336 /* this is not actually strictly necessary -- paulus. */
337 for (i = 1; i < ncpus; ++i)
338 smp_hw_index[i] = i;
339
340 if (ppc_md.progress) ppc_md.progress("smp_psurge_probe - done", 0x352);
341
342 return ncpus;
343}
344
345static void __init smp_psurge_kick_cpu(int nr)
346{
347 unsigned long start = __pa(__secondary_start_pmac_0) + nr * 8;
348 unsigned long a;
349
350 /* may need to flush here if secondary bats aren't setup */
351 for (a = KERNELBASE; a < KERNELBASE + 0x800000; a += 32)
352 asm volatile("dcbf 0,%0" : : "r" (a) : "memory");
353 asm volatile("sync");
354
355 if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu", 0x353);
356
357 out_be32(psurge_start, start);
358 mb();
359
360 psurge_set_ipi(nr);
361 udelay(10);
362 psurge_clr_ipi(nr);
363
364 if (ppc_md.progress) ppc_md.progress("smp_psurge_kick_cpu - done", 0x354);
365}
366
367/*
368 * With the dual-cpu powersurge board, the decrementers and timebases
369 * of both cpus are frozen after the secondary cpu is started up,
370 * until we give the secondary cpu another interrupt. This routine
371 * uses this to get the timebases synchronized.
372 * -- paulus.
373 */
374static void __init psurge_dual_sync_tb(int cpu_nr)
375{
376 int t;
377
378 set_dec(tb_ticks_per_jiffy);
379 set_tb(0, 0);
380 last_jiffy_stamp(cpu_nr) = 0;
381
382 if (cpu_nr > 0) {
383 mb();
384 sec_tb_reset = 1;
385 return;
386 }
387
388 /* wait for the secondary to have reset its TB before proceeding */
389 for (t = 10000000; t > 0 && !sec_tb_reset; --t)
390 ;
391
392 /* now interrupt the secondary, starting both TBs */
393 psurge_set_ipi(1);
394
395 smp_tb_synchronized = 1;
396}
397
398static struct irqaction psurge_irqaction = {
399 .handler = psurge_primary_intr,
400 .flags = SA_INTERRUPT,
401 .mask = CPU_MASK_NONE,
402 .name = "primary IPI",
403};
404
405static void __init smp_psurge_setup_cpu(int cpu_nr)
406{
407
408 if (cpu_nr == 0) {
409 /* If we failed to start the second CPU, we should still
410 * send it an IPI to start the timebase & DEC or we might
411 * have them stuck.
412 */
413 if (num_online_cpus() < 2) {
414 if (psurge_type == PSURGE_DUAL)
415 psurge_set_ipi(1);
416 return;
417 }
418 /* reset the entry point so if we get another intr we won't
419 * try to startup again */
420 out_be32(psurge_start, 0x100);
421 if (setup_irq(30, &psurge_irqaction))
422 printk(KERN_ERR "Couldn't get primary IPI interrupt");
423 }
424
425 if (psurge_type == PSURGE_DUAL)
426 psurge_dual_sync_tb(cpu_nr);
427}
428
429void __init smp_psurge_take_timebase(void)
430{
431 /* Dummy implementation */
432}
433
434void __init smp_psurge_give_timebase(void)
435{
436 /* Dummy implementation */
437}
438
439static int __init smp_core99_probe(void)
440{
441#ifdef CONFIG_6xx
442 extern int powersave_nap;
443#endif
444 struct device_node *cpus, *firstcpu;
445 int i, ncpus = 0, boot_cpu = -1;
446 u32 *tbprop = NULL;
447
448 if (ppc_md.progress) ppc_md.progress("smp_core99_probe", 0x345);
449 cpus = firstcpu = find_type_devices("cpu");
450 while(cpus != NULL) {
451 u32 *regprop = (u32 *)get_property(cpus, "reg", NULL);
452 char *stateprop = (char *)get_property(cpus, "state", NULL);
453 if (regprop != NULL && stateprop != NULL &&
454 !strncmp(stateprop, "running", 7))
455 boot_cpu = *regprop;
456 ++ncpus;
457 cpus = cpus->next;
458 }
459 if (boot_cpu == -1)
460 printk(KERN_WARNING "Couldn't detect boot CPU !\n");
461 if (boot_cpu != 0)
462 printk(KERN_WARNING "Boot CPU is %d, unsupported setup !\n", boot_cpu);
463
464 if (machine_is_compatible("MacRISC4")) {
465 extern struct smp_ops_t core99_smp_ops;
466
467 core99_smp_ops.take_timebase = smp_generic_take_timebase;
468 core99_smp_ops.give_timebase = smp_generic_give_timebase;
469 } else {
470 if (firstcpu != NULL)
471 tbprop = (u32 *)get_property(firstcpu, "timebase-enable", NULL);
472 if (tbprop)
473 core99_tb_gpio = *tbprop;
474 else
475 core99_tb_gpio = KL_GPIO_TB_ENABLE;
476 }
477
478 if (ncpus > 1) {
479 openpic_request_IPIs();
480 for (i = 1; i < ncpus; ++i)
481 smp_hw_index[i] = i;
482#ifdef CONFIG_6xx
483 powersave_nap = 0;
484#endif
485 core99_init_caches(0);
486 }
487
488 return ncpus;
489}
490
491static void __devinit smp_core99_kick_cpu(int nr)
492{
493 unsigned long save_vector, new_vector;
494 unsigned long flags;
495
496 volatile unsigned long *vector
497 = ((volatile unsigned long *)(KERNELBASE+0x100));
498 if (nr < 0 || nr > 3)
499 return;
500 if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu", 0x346);
501
502 local_irq_save(flags);
503 local_irq_disable();
504
505 /* Save reset vector */
506 save_vector = *vector;
507
508 /* Setup fake reset vector that does
509 * b __secondary_start_pmac_0 + nr*8 - KERNELBASE
510 */
511 new_vector = (unsigned long) __secondary_start_pmac_0 + nr * 8;
512 *vector = 0x48000002 + new_vector - KERNELBASE;
513
514 /* flush data cache and inval instruction cache */
515 flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
516
517 /* Put some life in our friend */
518 pmac_call_feature(PMAC_FTR_RESET_CPU, NULL, nr, 0);
519
520 /* FIXME: We wait a bit for the CPU to take the exception, I should
521 * instead wait for the entry code to set something for me. Well,
522 * ideally, all that crap will be done in prom.c and the CPU left
523 * in a RAM-based wait loop like CHRP.
524 */
525 mdelay(1);
526
527 /* Restore our exception vector */
528 *vector = save_vector;
529 flush_icache_range((unsigned long) vector, (unsigned long) vector + 4);
530
531 local_irq_restore(flags);
532 if (ppc_md.progress) ppc_md.progress("smp_core99_kick_cpu done", 0x347);
533}
534
535static void __devinit smp_core99_setup_cpu(int cpu_nr)
536{
537 /* Setup L2/L3 */
538 if (cpu_nr != 0)
539 core99_init_caches(cpu_nr);
540
541 /* Setup openpic */
542 do_openpic_setup_cpu();
543
544 if (cpu_nr == 0) {
545#ifdef CONFIG_POWER4
546 extern void g5_phy_disable_cpu1(void);
547
548 /* If we didn't start the second CPU, we must take
549 * it off the bus
550 */
551 if (machine_is_compatible("MacRISC4") &&
552 num_online_cpus() < 2)
553 g5_phy_disable_cpu1();
554#endif /* CONFIG_POWER4 */
555 if (ppc_md.progress) ppc_md.progress("core99_setup_cpu 0 done", 0x349);
556 }
557}
558
559/* not __init, called in sleep/wakeup code */
560void smp_core99_take_timebase(void)
561{
562 unsigned long flags;
563
564 /* tell the primary we're here */
565 sec_tb_reset = 1;
566 mb();
567
568 /* wait for the primary to set pri_tb_hi/lo */
569 while (sec_tb_reset < 2)
570 mb();
571
572 /* set our stuff the same as the primary */
573 local_irq_save(flags);
574 set_dec(1);
575 set_tb(pri_tb_hi, pri_tb_lo);
576 last_jiffy_stamp(smp_processor_id()) = pri_tb_stamp;
577 mb();
578
579 /* tell the primary we're done */
580 sec_tb_reset = 0;
581 mb();
582 local_irq_restore(flags);
583}
584
585/* not __init, called in sleep/wakeup code */
586void smp_core99_give_timebase(void)
587{
588 unsigned long flags;
589 unsigned int t;
590
591 /* wait for the secondary to be in take_timebase */
592 for (t = 100000; t > 0 && !sec_tb_reset; --t)
593 udelay(10);
594 if (!sec_tb_reset) {
595 printk(KERN_WARNING "Timeout waiting sync on second CPU\n");
596 return;
597 }
598
599 /* freeze the timebase and read it */
600 /* disable interrupts so the timebase is disabled for the
601 shortest possible time */
602 local_irq_save(flags);
603 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, core99_tb_gpio, 4);
604 pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, core99_tb_gpio, 0);
605 mb();
606 pri_tb_hi = get_tbu();
607 pri_tb_lo = get_tbl();
608 pri_tb_stamp = last_jiffy_stamp(smp_processor_id());
609 mb();
610
611 /* tell the secondary we're ready */
612 sec_tb_reset = 2;
613 mb();
614
615 /* wait for the secondary to have taken it */
616 for (t = 100000; t > 0 && sec_tb_reset; --t)
617 udelay(10);
618 if (sec_tb_reset)
619 printk(KERN_WARNING "Timeout waiting sync(2) on second CPU\n");
620 else
621 smp_tb_synchronized = 1;
622
623 /* Now, restart the timebase by leaving the GPIO to an open collector */
624 pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, core99_tb_gpio, 0);
625 pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, core99_tb_gpio, 0);
626 local_irq_restore(flags);
627}
628
629
630/* PowerSurge-style Macs */
631struct smp_ops_t psurge_smp_ops = {
632 .message_pass = smp_psurge_message_pass,
633 .probe = smp_psurge_probe,
634 .kick_cpu = smp_psurge_kick_cpu,
635 .setup_cpu = smp_psurge_setup_cpu,
636 .give_timebase = smp_psurge_give_timebase,
637 .take_timebase = smp_psurge_take_timebase,
638};
639
640/* Core99 Macs (dual G4s) */
641struct smp_ops_t core99_smp_ops = {
642 .message_pass = smp_openpic_message_pass,
643 .probe = smp_core99_probe,
644 .kick_cpu = smp_core99_kick_cpu,
645 .setup_cpu = smp_core99_setup_cpu,
646 .give_timebase = smp_core99_give_timebase,
647 .take_timebase = smp_core99_take_timebase,
648};
649
650#ifdef CONFIG_HOTPLUG_CPU
651
652int __cpu_disable(void)
653{
654 cpu_clear(smp_processor_id(), cpu_online_map);
655
656 /* XXX reset cpu affinity here */
657 openpic_set_priority(0xf);
658 asm volatile("mtdec %0" : : "r" (0x7fffffff));
659 mb();
660 udelay(20);
661 asm volatile("mtdec %0" : : "r" (0x7fffffff));
662 return 0;
663}
664
665extern void low_cpu_die(void) __attribute__((noreturn)); /* in pmac_sleep.S */
666static int cpu_dead[NR_CPUS];
667
668void cpu_die(void)
669{
670 local_irq_disable();
671 cpu_dead[smp_processor_id()] = 1;
672 mb();
673 low_cpu_die();
674}
675
676void __cpu_die(unsigned int cpu)
677{
678 int timeout;
679
680 timeout = 1000;
681 while (!cpu_dead[cpu]) {
682 if (--timeout == 0) {
683 printk("CPU %u refused to die!\n", cpu);
684 break;
685 }
686 msleep(1);
687 }
688 cpu_callin_map[cpu] = 0;
689 cpu_dead[cpu] = 0;
690}
691
692#endif
diff --git a/arch/ppc/platforms/pmac_time.c b/arch/ppc/platforms/pmac_time.c
deleted file mode 100644
index edb9fcc64790..000000000000
--- a/arch/ppc/platforms/pmac_time.c
+++ /dev/null
@@ -1,291 +0,0 @@
1/*
2 * Support for periodic interrupts (100 per second) and for getting
3 * the current time from the RTC on Power Macintoshes.
4 *
5 * We use the decrementer register for our periodic interrupts.
6 *
7 * Paul Mackerras August 1996.
8 * Copyright (C) 1996 Paul Mackerras.
9 */
10#include <linux/config.h>
11#include <linux/errno.h>
12#include <linux/sched.h>
13#include <linux/kernel.h>
14#include <linux/param.h>
15#include <linux/string.h>
16#include <linux/mm.h>
17#include <linux/init.h>
18#include <linux/time.h>
19#include <linux/adb.h>
20#include <linux/cuda.h>
21#include <linux/pmu.h>
22#include <linux/hardirq.h>
23
24#include <asm/sections.h>
25#include <asm/prom.h>
26#include <asm/system.h>
27#include <asm/io.h>
28#include <asm/pgtable.h>
29#include <asm/machdep.h>
30#include <asm/time.h>
31#include <asm/nvram.h>
32
33/* Apparently the RTC stores seconds since 1 Jan 1904 */
34#define RTC_OFFSET 2082844800
35
36/*
37 * Calibrate the decrementer frequency with the VIA timer 1.
38 */
39#define VIA_TIMER_FREQ_6 4700000 /* time 1 frequency * 6 */
40
41/* VIA registers */
42#define RS 0x200 /* skip between registers */
43#define T1CL (4*RS) /* Timer 1 ctr/latch (low 8 bits) */
44#define T1CH (5*RS) /* Timer 1 counter (high 8 bits) */
45#define T1LL (6*RS) /* Timer 1 latch (low 8 bits) */
46#define T1LH (7*RS) /* Timer 1 latch (high 8 bits) */
47#define ACR (11*RS) /* Auxiliary control register */
48#define IFR (13*RS) /* Interrupt flag register */
49
50/* Bits in ACR */
51#define T1MODE 0xc0 /* Timer 1 mode */
52#define T1MODE_CONT 0x40 /* continuous interrupts */
53
54/* Bits in IFR and IER */
55#define T1_INT 0x40 /* Timer 1 interrupt */
56
57extern struct timezone sys_tz;
58
59long __init
60pmac_time_init(void)
61{
62#ifdef CONFIG_NVRAM
63 s32 delta = 0;
64 int dst;
65
66 delta = ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x9)) << 16;
67 delta |= ((s32)pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xa)) << 8;
68 delta |= pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0xb);
69 if (delta & 0x00800000UL)
70 delta |= 0xFF000000UL;
71 dst = ((pmac_xpram_read(PMAC_XPRAM_MACHINE_LOC + 0x8) & 0x80) != 0);
72 printk("GMT Delta read from XPRAM: %d minutes, DST: %s\n", delta/60,
73 dst ? "on" : "off");
74 return delta;
75#else
76 return 0;
77#endif
78}
79
80unsigned long
81pmac_get_rtc_time(void)
82{
83#if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU)
84 struct adb_request req;
85 unsigned long now;
86#endif
87
88 /* Get the time from the RTC */
89 switch (sys_ctrler) {
90#ifdef CONFIG_ADB_CUDA
91 case SYS_CTRLER_CUDA:
92 if (cuda_request(&req, NULL, 2, CUDA_PACKET, CUDA_GET_TIME) < 0)
93 return 0;
94 while (!req.complete)
95 cuda_poll();
96 if (req.reply_len != 7)
97 printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n",
98 req.reply_len);
99 now = (req.reply[3] << 24) + (req.reply[4] << 16)
100 + (req.reply[5] << 8) + req.reply[6];
101 return now - RTC_OFFSET;
102#endif /* CONFIG_ADB_CUDA */
103#ifdef CONFIG_ADB_PMU
104 case SYS_CTRLER_PMU:
105 if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0)
106 return 0;
107 while (!req.complete)
108 pmu_poll();
109 if (req.reply_len != 4)
110 printk(KERN_ERR "pmac_get_rtc_time: got %d byte reply\n",
111 req.reply_len);
112 now = (req.reply[0] << 24) + (req.reply[1] << 16)
113 + (req.reply[2] << 8) + req.reply[3];
114 return now - RTC_OFFSET;
115#endif /* CONFIG_ADB_PMU */
116 default: ;
117 }
118 return 0;
119}
120
121int
122pmac_set_rtc_time(unsigned long nowtime)
123{
124#if defined(CONFIG_ADB_CUDA) || defined(CONFIG_ADB_PMU)
125 struct adb_request req;
126#endif
127
128 nowtime += RTC_OFFSET;
129
130 switch (sys_ctrler) {
131#ifdef CONFIG_ADB_CUDA
132 case SYS_CTRLER_CUDA:
133 if (cuda_request(&req, NULL, 6, CUDA_PACKET, CUDA_SET_TIME,
134 nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
135 return 0;
136 while (!req.complete)
137 cuda_poll();
138 if ((req.reply_len != 3) && (req.reply_len != 7))
139 printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
140 req.reply_len);
141 return 1;
142#endif /* CONFIG_ADB_CUDA */
143#ifdef CONFIG_ADB_PMU
144 case SYS_CTRLER_PMU:
145 if (pmu_request(&req, NULL, 5, PMU_SET_RTC,
146 nowtime >> 24, nowtime >> 16, nowtime >> 8, nowtime) < 0)
147 return 0;
148 while (!req.complete)
149 pmu_poll();
150 if (req.reply_len != 0)
151 printk(KERN_ERR "pmac_set_rtc_time: got %d byte reply\n",
152 req.reply_len);
153 return 1;
154#endif /* CONFIG_ADB_PMU */
155 default:
156 return 0;
157 }
158}
159
160/*
161 * Calibrate the decrementer register using VIA timer 1.
162 * This is used both on powermacs and CHRP machines.
163 */
164int __init
165via_calibrate_decr(void)
166{
167 struct device_node *vias;
168 volatile unsigned char __iomem *via;
169 int count = VIA_TIMER_FREQ_6 / 100;
170 unsigned int dstart, dend;
171
172 vias = find_devices("via-cuda");
173 if (vias == 0)
174 vias = find_devices("via-pmu");
175 if (vias == 0)
176 vias = find_devices("via");
177 if (vias == 0 || vias->n_addrs == 0)
178 return 0;
179 via = ioremap(vias->addrs[0].address, vias->addrs[0].size);
180
181 /* set timer 1 for continuous interrupts */
182 out_8(&via[ACR], (via[ACR] & ~T1MODE) | T1MODE_CONT);
183 /* set the counter to a small value */
184 out_8(&via[T1CH], 2);
185 /* set the latch to `count' */
186 out_8(&via[T1LL], count);
187 out_8(&via[T1LH], count >> 8);
188 /* wait until it hits 0 */
189 while ((in_8(&via[IFR]) & T1_INT) == 0)
190 ;
191 dstart = get_dec();
192 /* clear the interrupt & wait until it hits 0 again */
193 in_8(&via[T1CL]);
194 while ((in_8(&via[IFR]) & T1_INT) == 0)
195 ;
196 dend = get_dec();
197
198 tb_ticks_per_jiffy = (dstart - dend) / ((6 * HZ)/100);
199 tb_to_us = mulhwu_scale_factor(dstart - dend, 60000);
200
201 printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n",
202 tb_ticks_per_jiffy, dstart - dend);
203
204 iounmap(via);
205
206 return 1;
207}
208
209#ifdef CONFIG_PM
210/*
211 * Reset the time after a sleep.
212 */
213static int
214time_sleep_notify(struct pmu_sleep_notifier *self, int when)
215{
216 static unsigned long time_diff;
217 unsigned long flags;
218 unsigned long seq;
219
220 switch (when) {
221 case PBOOK_SLEEP_NOW:
222 do {
223 seq = read_seqbegin_irqsave(&xtime_lock, flags);
224 time_diff = xtime.tv_sec - pmac_get_rtc_time();
225 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
226 break;
227 case PBOOK_WAKE:
228 write_seqlock_irqsave(&xtime_lock, flags);
229 xtime.tv_sec = pmac_get_rtc_time() + time_diff;
230 xtime.tv_nsec = 0;
231 last_rtc_update = xtime.tv_sec;
232 write_sequnlock_irqrestore(&xtime_lock, flags);
233 break;
234 }
235 return PBOOK_SLEEP_OK;
236}
237
238static struct pmu_sleep_notifier time_sleep_notifier = {
239 time_sleep_notify, SLEEP_LEVEL_MISC,
240};
241#endif /* CONFIG_PM */
242
243/*
244 * Query the OF and get the decr frequency.
245 * This was taken from the pmac time_init() when merging the prep/pmac
246 * time functions.
247 */
248void __init
249pmac_calibrate_decr(void)
250{
251 struct device_node *cpu;
252 unsigned int freq, *fp;
253
254#ifdef CONFIG_PM
255 pmu_register_sleep_notifier(&time_sleep_notifier);
256#endif /* CONFIG_PM */
257
258 /* We assume MacRISC2 machines have correct device-tree
259 * calibration. That's better since the VIA itself seems
260 * to be slightly off. --BenH
261 */
262 if (!machine_is_compatible("MacRISC2") &&
263 !machine_is_compatible("MacRISC3") &&
264 !machine_is_compatible("MacRISC4"))
265 if (via_calibrate_decr())
266 return;
267
268 /* Special case: QuickSilver G4s seem to have a badly calibrated
269 * timebase-frequency in OF, VIA is much better on these. We should
270 * probably implement calibration based on the KL timer on these
271 * machines anyway... -BenH
272 */
273 if (machine_is_compatible("PowerMac3,5"))
274 if (via_calibrate_decr())
275 return;
276 /*
277 * The cpu node should have a timebase-frequency property
278 * to tell us the rate at which the decrementer counts.
279 */
280 cpu = find_type_devices("cpu");
281 if (cpu == 0)
282 panic("can't find cpu node in time_init");
283 fp = (unsigned int *) get_property(cpu, "timebase-frequency", NULL);
284 if (fp == 0)
285 panic("can't get cpu timebase frequency");
286 freq = *fp;
287 printk("time_init: decrementer frequency = %u.%.6u MHz\n",
288 freq/1000000, freq%1000000);
289 tb_ticks_per_jiffy = freq / HZ;
290 tb_to_us = mulhwu_scale_factor(freq, 1000000);
291}
diff --git a/arch/ppc/platforms/prep_setup.c b/arch/ppc/platforms/prep_setup.c
index 4415748071dc..d06535802003 100644
--- a/arch/ppc/platforms/prep_setup.c
+++ b/arch/ppc/platforms/prep_setup.c
@@ -72,7 +72,6 @@
72 72
73TODC_ALLOC(); 73TODC_ALLOC();
74 74
75unsigned char ucSystemType;
76unsigned char ucBoardRev; 75unsigned char ucBoardRev;
77unsigned char ucBoardRevMaj, ucBoardRevMin; 76unsigned char ucBoardRevMaj, ucBoardRevMin;
78 77
@@ -954,7 +953,6 @@ prep_calibrate_decr(void)
954static void __init 953static void __init
955prep_init_IRQ(void) 954prep_init_IRQ(void)
956{ 955{
957 int i;
958 unsigned int pci_viddid, pci_did; 956 unsigned int pci_viddid, pci_did;
959 957
960 if (OpenPIC_Addr != NULL) { 958 if (OpenPIC_Addr != NULL) {
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
index 5b7f2b80e56e..159dcd92a6d1 100644
--- a/arch/ppc/syslib/Makefile
+++ b/arch/ppc/syslib/Makefile
@@ -39,8 +39,6 @@ obj-$(CONFIG_8xx) += m8xx_setup.o ppc8xx_pic.o $(wdt-mpc8xx-y) \
39 ppc_sys.o mpc8xx_devices.o mpc8xx_sys.o 39 ppc_sys.o mpc8xx_devices.o mpc8xx_sys.o
40obj-$(CONFIG_PCI_QSPAN) += qspan_pci.o 40obj-$(CONFIG_PCI_QSPAN) += qspan_pci.o
41obj-$(CONFIG_PPC_OF) += prom_init.o prom.o 41obj-$(CONFIG_PPC_OF) += prom_init.o prom.o
42obj-$(CONFIG_PPC_PMAC) += open_pic.o
43obj-$(CONFIG_POWER4) += open_pic2.o
44obj-$(CONFIG_PPC_CHRP) += open_pic.o 42obj-$(CONFIG_PPC_CHRP) += open_pic.o
45obj-$(CONFIG_PPC_PREP) += open_pic.o todc_time.o 43obj-$(CONFIG_PPC_PREP) += open_pic.o todc_time.o
46obj-$(CONFIG_BAMBOO) += pci_auto.o todc_time.o 44obj-$(CONFIG_BAMBOO) += pci_auto.o todc_time.o
@@ -96,7 +94,7 @@ ifeq ($(CONFIG_85xx),y)
96obj-$(CONFIG_PCI) += pci_auto.o 94obj-$(CONFIG_PCI) += pci_auto.o
97endif 95endif
98obj-$(CONFIG_RAPIDIO) += ppc85xx_rio.o 96obj-$(CONFIG_RAPIDIO) += ppc85xx_rio.o
99obj-$(CONFIG_83xx) += ipic.o ppc83xx_setup.o ppc_sys.o \ 97obj-$(CONFIG_83xx) += ppc83xx_setup.o ppc_sys.o \
100 mpc83xx_sys.o mpc83xx_devices.o 98 mpc83xx_sys.o mpc83xx_devices.o
101ifeq ($(CONFIG_83xx),y) 99ifeq ($(CONFIG_83xx),y)
102obj-$(CONFIG_PCI) += pci_auto.o 100obj-$(CONFIG_PCI) += pci_auto.o
diff --git a/arch/ppc/syslib/m82xx_pci.c b/arch/ppc/syslib/m82xx_pci.c
index 1d1c3956c1ae..1941a8c7ca9a 100644
--- a/arch/ppc/syslib/m82xx_pci.c
+++ b/arch/ppc/syslib/m82xx_pci.c
@@ -248,7 +248,8 @@ pq2ads_setup_pci(struct pci_controller *hose)
248 pci_div = ( (sccr & SCCR_PCI_MODCK) ? 2 : 1) * 248 pci_div = ( (sccr & SCCR_PCI_MODCK) ? 2 : 1) *
249 ( ( (sccr & SCCR_PCIDF_MSK) >> SCCR_PCIDF_SHIFT) + 1); 249 ( ( (sccr & SCCR_PCIDF_MSK) >> SCCR_PCIDF_SHIFT) + 1);
250 freq = (uint)((2*binfo->bi_cpmfreq)/(pci_div)); 250 freq = (uint)((2*binfo->bi_cpmfreq)/(pci_div));
251 time = (int)666666/freq; 251 time = (int)66666666/freq;
252
252 /* due to PCI Local Bus spec, some devices needs to wait such a long 253 /* due to PCI Local Bus spec, some devices needs to wait such a long
253 time after RST deassertion. More specifically, 0.508s for 66MHz & twice more for 33 */ 254 time after RST deassertion. More specifically, 0.508s for 66MHz & twice more for 33 */
254 printk("%s: The PCI bus is %d Mhz.\nWaiting %s after deasserting RST...\n",__FILE__,freq, 255 printk("%s: The PCI bus is %d Mhz.\nWaiting %s after deasserting RST...\n",__FILE__,freq,
diff --git a/arch/ppc/syslib/m8xx_setup.c b/arch/ppc/syslib/m8xx_setup.c
index 1cc3abe6fa43..688616de3cde 100644
--- a/arch/ppc/syslib/m8xx_setup.c
+++ b/arch/ppc/syslib/m8xx_setup.c
@@ -135,6 +135,16 @@ static struct irqaction tbint_irqaction = {
135 .name = "tbint", 135 .name = "tbint",
136}; 136};
137 137
138/* per-board overridable init_internal_rtc() function. */
139void __init __attribute__ ((weak))
140init_internal_rtc(void)
141{
142 /* Disable the RTC one second and alarm interrupts. */
143 out_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc, in_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc) & ~(RTCSC_SIE | RTCSC_ALE));
144 /* Enable the RTC */
145 out_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc, in_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc) | (RTCSC_RTF | RTCSC_RTE));
146}
147
138/* The decrementer counts at the system (internal) clock frequency divided by 148/* The decrementer counts at the system (internal) clock frequency divided by
139 * sixteen, or external oscillator divided by four. We force the processor 149 * sixteen, or external oscillator divided by four. We force the processor
140 * to use system clock divided by sixteen. 150 * to use system clock divided by sixteen.
@@ -183,10 +193,7 @@ void __init m8xx_calibrate_decr(void)
183 out_be32(&((immap_t *)IMAP_ADDR)->im_sitk.sitk_rtcsck, KAPWR_KEY); 193 out_be32(&((immap_t *)IMAP_ADDR)->im_sitk.sitk_rtcsck, KAPWR_KEY);
184 out_be32(&((immap_t *)IMAP_ADDR)->im_sitk.sitk_tbk, KAPWR_KEY); 194 out_be32(&((immap_t *)IMAP_ADDR)->im_sitk.sitk_tbk, KAPWR_KEY);
185 195
186 /* Disable the RTC one second and alarm interrupts. */ 196 init_internal_rtc();
187 out_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc, in_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc) & ~(RTCSC_SIE | RTCSC_ALE));
188 /* Enable the RTC */
189 out_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc, in_be16(&((immap_t *)IMAP_ADDR)->im_sit.sit_rtcsc) | (RTCSC_RTF | RTCSC_RTE));
190 197
191 /* Enabling the decrementer also enables the timebase interrupts 198 /* Enabling the decrementer also enables the timebase interrupts
192 * (or from the other point of view, to get decrementer interrupts 199 * (or from the other point of view, to get decrementer interrupts
diff --git a/arch/ppc/syslib/m8xx_wdt.c b/arch/ppc/syslib/m8xx_wdt.c
index a21632d37e5a..df6c9557b86a 100644
--- a/arch/ppc/syslib/m8xx_wdt.c
+++ b/arch/ppc/syslib/m8xx_wdt.c
@@ -19,6 +19,7 @@
19#include <syslib/m8xx_wdt.h> 19#include <syslib/m8xx_wdt.h>
20 20
21static int wdt_timeout; 21static int wdt_timeout;
22int m8xx_has_internal_rtc = 0;
22 23
23static irqreturn_t m8xx_wdt_interrupt(int, void *, struct pt_regs *); 24static irqreturn_t m8xx_wdt_interrupt(int, void *, struct pt_regs *);
24static struct irqaction m8xx_wdt_irqaction = { 25static struct irqaction m8xx_wdt_irqaction = {
@@ -45,35 +46,15 @@ static irqreturn_t m8xx_wdt_interrupt(int irq, void *dev, struct pt_regs *regs)
45 return IRQ_HANDLED; 46 return IRQ_HANDLED;
46} 47}
47 48
48void __init m8xx_wdt_handler_install(bd_t * binfo) 49#define SYPCR_SWP 0x1
50#define SYPCR_SWE 0x4
51
52
53void __init m8xx_wdt_install_irq(volatile immap_t *imap, bd_t *binfo)
49{ 54{
50 volatile immap_t *imap = (volatile immap_t *)IMAP_ADDR;
51 u32 pitc; 55 u32 pitc;
52 u32 sypcr;
53 u32 pitrtclk; 56 u32 pitrtclk;
54 57
55 sypcr = in_be32(&imap->im_siu_conf.sc_sypcr);
56
57 if (!(sypcr & 0x04)) {
58 printk(KERN_NOTICE "m8xx_wdt: wdt disabled (SYPCR: 0x%08X)\n",
59 sypcr);
60 return;
61 }
62
63 m8xx_wdt_reset();
64
65 printk(KERN_NOTICE
66 "m8xx_wdt: active wdt found (SWTC: 0x%04X, SWP: 0x%01X)\n",
67 (sypcr >> 16), sypcr & 0x01);
68
69 wdt_timeout = (sypcr >> 16) & 0xFFFF;
70
71 if (!wdt_timeout)
72 wdt_timeout = 0xFFFF;
73
74 if (sypcr & 0x01)
75 wdt_timeout *= 2048;
76
77 /* 58 /*
78 * Fire trigger if half of the wdt ticked down 59 * Fire trigger if half of the wdt ticked down
79 */ 60 */
@@ -98,6 +79,67 @@ void __init m8xx_wdt_handler_install(bd_t * binfo)
98 printk(KERN_NOTICE 79 printk(KERN_NOTICE
99 "m8xx_wdt: keep-alive trigger installed (PITC: 0x%04X)\n", pitc); 80 "m8xx_wdt: keep-alive trigger installed (PITC: 0x%04X)\n", pitc);
100 81
82}
83
84static void m8xx_wdt_timer_func(unsigned long data);
85
86static struct timer_list m8xx_wdt_timer =
87 TIMER_INITIALIZER(m8xx_wdt_timer_func, 0, 0);
88
89void m8xx_wdt_stop_timer(void)
90{
91 del_timer(&m8xx_wdt_timer);
92}
93
94void m8xx_wdt_install_timer(void)
95{
96 m8xx_wdt_timer.expires = jiffies + (HZ/2);
97 add_timer(&m8xx_wdt_timer);
98}
99
100static void m8xx_wdt_timer_func(unsigned long data)
101{
102 m8xx_wdt_reset();
103 m8xx_wdt_install_timer();
104}
105
106void __init m8xx_wdt_handler_install(bd_t * binfo)
107{
108 volatile immap_t *imap = (volatile immap_t *)IMAP_ADDR;
109 u32 sypcr;
110
111 sypcr = in_be32(&imap->im_siu_conf.sc_sypcr);
112
113 if (!(sypcr & SYPCR_SWE)) {
114 printk(KERN_NOTICE "m8xx_wdt: wdt disabled (SYPCR: 0x%08X)\n",
115 sypcr);
116 return;
117 }
118
119 m8xx_wdt_reset();
120
121 printk(KERN_NOTICE
122 "m8xx_wdt: active wdt found (SWTC: 0x%04X, SWP: 0x%01X)\n",
123 (sypcr >> 16), sypcr & SYPCR_SWP);
124
125 wdt_timeout = (sypcr >> 16) & 0xFFFF;
126
127 if (!wdt_timeout)
128 wdt_timeout = 0xFFFF;
129
130 if (sypcr & SYPCR_SWP)
131 wdt_timeout *= 2048;
132
133 m8xx_has_internal_rtc = in_be16(&imap->im_sit.sit_rtcsc) & RTCSC_RTE;
134
135 /* if the internal RTC is off use a kernel timer */
136 if (!m8xx_has_internal_rtc) {
137 if (wdt_timeout < (binfo->bi_intfreq/HZ))
138 printk(KERN_ERR "m8xx_wdt: timeout too short for ktimer!\n");
139 m8xx_wdt_install_timer();
140 } else
141 m8xx_wdt_install_irq(imap, binfo);
142
101 wdt_timeout /= binfo->bi_intfreq; 143 wdt_timeout /= binfo->bi_intfreq;
102} 144}
103 145
diff --git a/arch/ppc/syslib/m8xx_wdt.h b/arch/ppc/syslib/m8xx_wdt.h
index 0d81a9f8155f..e75835f0012b 100644
--- a/arch/ppc/syslib/m8xx_wdt.h
+++ b/arch/ppc/syslib/m8xx_wdt.h
@@ -9,8 +9,12 @@
9#ifndef _PPC_SYSLIB_M8XX_WDT_H 9#ifndef _PPC_SYSLIB_M8XX_WDT_H
10#define _PPC_SYSLIB_M8XX_WDT_H 10#define _PPC_SYSLIB_M8XX_WDT_H
11 11
12extern int m8xx_has_internal_rtc;
13
12extern void m8xx_wdt_handler_install(bd_t * binfo); 14extern void m8xx_wdt_handler_install(bd_t * binfo);
13extern int m8xx_wdt_get_timeout(void); 15extern int m8xx_wdt_get_timeout(void);
14extern void m8xx_wdt_reset(void); 16extern void m8xx_wdt_reset(void);
17extern void m8xx_wdt_install_timer(void);
18extern void m8xx_wdt_stop_timer(void);
15 19
16#endif /* _PPC_SYSLIB_M8XX_WDT_H */ 20#endif /* _PPC_SYSLIB_M8XX_WDT_H */
diff --git a/arch/ppc/syslib/mpc52xx_pci.c b/arch/ppc/syslib/mpc52xx_pci.c
index 4ac19080eb85..313c96ec7eb1 100644
--- a/arch/ppc/syslib/mpc52xx_pci.c
+++ b/arch/ppc/syslib/mpc52xx_pci.c
@@ -24,6 +24,12 @@
24#include <asm/machdep.h> 24#include <asm/machdep.h>
25 25
26 26
27/* This macro is defined to activate the workaround for the bug
28 435 of the MPC5200 (L25R). With it activated, we don't do any
29 32 bits configuration access during type-1 cycles */
30#define MPC5200_BUG_435_WORKAROUND
31
32
27static int 33static int
28mpc52xx_pci_read_config(struct pci_bus *bus, unsigned int devfn, 34mpc52xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
29 int offset, int len, u32 *val) 35 int offset, int len, u32 *val)
@@ -40,17 +46,39 @@ mpc52xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
40 ((bus->number - hose->bus_offset) << 16) | 46 ((bus->number - hose->bus_offset) << 16) |
41 (devfn << 8) | 47 (devfn << 8) |
42 (offset & 0xfc)); 48 (offset & 0xfc));
49 mb();
50
51#ifdef MPC5200_BUG_435_WORKAROUND
52 if (bus->number != hose->bus_offset) {
53 switch (len) {
54 case 1:
55 value = in_8(((u8 __iomem *)hose->cfg_data) + (offset & 3));
56 break;
57 case 2:
58 value = in_le16(((u16 __iomem *)hose->cfg_data) + ((offset>>1) & 1));
59 break;
60
61 default:
62 value = in_le16((u16 __iomem *)hose->cfg_data) |
63 (in_le16(((u16 __iomem *)hose->cfg_data) + 1) << 16);
64 break;
65 }
66 }
67 else
68#endif
69 {
70 value = in_le32(hose->cfg_data);
43 71
44 value = in_le32(hose->cfg_data); 72 if (len != 4) {
45 73 value >>= ((offset & 0x3) << 3);
46 if (len != 4) { 74 value &= 0xffffffff >> (32 - (len << 3));
47 value >>= ((offset & 0x3) << 3); 75 }
48 value &= 0xffffffff >> (32 - (len << 3));
49 } 76 }
50 77
51 *val = value; 78 *val = value;
52 79
53 out_be32(hose->cfg_addr, 0); 80 out_be32(hose->cfg_addr, 0);
81 mb();
54 82
55 return PCIBIOS_SUCCESSFUL; 83 return PCIBIOS_SUCCESSFUL;
56} 84}
@@ -71,21 +99,48 @@ mpc52xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
71 ((bus->number - hose->bus_offset) << 16) | 99 ((bus->number - hose->bus_offset) << 16) |
72 (devfn << 8) | 100 (devfn << 8) |
73 (offset & 0xfc)); 101 (offset & 0xfc));
102 mb();
103
104#ifdef MPC5200_BUG_435_WORKAROUND
105 if (bus->number != hose->bus_offset) {
106 switch (len) {
107 case 1:
108 out_8(((u8 __iomem *)hose->cfg_data) +
109 (offset & 3), val);
110 break;
111 case 2:
112 out_le16(((u16 __iomem *)hose->cfg_data) +
113 ((offset>>1) & 1), val);
114 break;
115
116 default:
117 out_le16((u16 __iomem *)hose->cfg_data,
118 (u16)val);
119 out_le16(((u16 __iomem *)hose->cfg_data) + 1,
120 (u16)(val>>16));
121 break;
122 }
123 }
124 else
125#endif
126 {
127 if (len != 4) {
128 value = in_le32(hose->cfg_data);
74 129
75 if (len != 4) { 130 offset = (offset & 0x3) << 3;
76 value = in_le32(hose->cfg_data); 131 mask = (0xffffffff >> (32 - (len << 3)));
132 mask <<= offset;
77 133
78 offset = (offset & 0x3) << 3; 134 value &= ~mask;
79 mask = (0xffffffff >> (32 - (len << 3))); 135 val = value | ((val << offset) & mask);
80 mask <<= offset; 136 }
81 137
82 value &= ~mask; 138 out_le32(hose->cfg_data, val);
83 val = value | ((val << offset) & mask);
84 } 139 }
85 140 mb();
86 out_le32(hose->cfg_data, val);
87 141
88 out_be32(hose->cfg_addr, 0); 142 out_be32(hose->cfg_addr, 0);
143 mb();
89 144
90 return PCIBIOS_SUCCESSFUL; 145 return PCIBIOS_SUCCESSFUL;
91} 146}
@@ -99,9 +154,12 @@ static struct pci_ops mpc52xx_pci_ops = {
99static void __init 154static void __init
100mpc52xx_pci_setup(struct mpc52xx_pci __iomem *pci_regs) 155mpc52xx_pci_setup(struct mpc52xx_pci __iomem *pci_regs)
101{ 156{
157 u32 tmp;
102 158
103 /* Setup control regs */ 159 /* Setup control regs */
104 /* Nothing to do afaik */ 160 tmp = in_be32(&pci_regs->scr);
161 tmp |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY;
162 out_be32(&pci_regs->scr, tmp);
105 163
106 /* Setup windows */ 164 /* Setup windows */
107 out_be32(&pci_regs->iw0btar, MPC52xx_PCI_IWBTAR_TRANSLATION( 165 out_be32(&pci_regs->iw0btar, MPC52xx_PCI_IWBTAR_TRANSLATION(
@@ -142,16 +200,15 @@ mpc52xx_pci_setup(struct mpc52xx_pci __iomem *pci_regs)
142 /* Not necessary and can be a bad thing if for example the bootloader 200 /* Not necessary and can be a bad thing if for example the bootloader
143 is displaying a splash screen or ... Just left here for 201 is displaying a splash screen or ... Just left here for
144 documentation purpose if anyone need it */ 202 documentation purpose if anyone need it */
145#if 0
146 u32 tmp;
147 tmp = in_be32(&pci_regs->gscr); 203 tmp = in_be32(&pci_regs->gscr);
204#if 0
148 out_be32(&pci_regs->gscr, tmp | MPC52xx_PCI_GSCR_PR); 205 out_be32(&pci_regs->gscr, tmp | MPC52xx_PCI_GSCR_PR);
149 udelay(50); 206 udelay(50);
150 out_be32(&pci_regs->gscr, tmp);
151#endif 207#endif
208 out_be32(&pci_regs->gscr, tmp & ~MPC52xx_PCI_GSCR_PR);
152} 209}
153 210
154static void __init 211static void
155mpc52xx_pci_fixup_resources(struct pci_dev *dev) 212mpc52xx_pci_fixup_resources(struct pci_dev *dev)
156{ 213{
157 int i; 214 int i;
diff --git a/arch/ppc/syslib/mpc52xx_setup.c b/arch/ppc/syslib/mpc52xx_setup.c
index bb2374585a7b..a4a4b02227df 100644
--- a/arch/ppc/syslib/mpc52xx_setup.c
+++ b/arch/ppc/syslib/mpc52xx_setup.c
@@ -84,9 +84,11 @@ mpc52xx_set_bat(void)
84void __init 84void __init
85mpc52xx_map_io(void) 85mpc52xx_map_io(void)
86{ 86{
87 /* Here we only map the MBAR */ 87 /* Here we map the MBAR and the whole upper zone. MBAR is only
88 64k but we can't map only 64k with BATs. Map the whole
89 0xf0000000 range is ok and helps eventual lpb devices placed there */
88 io_block_mapping( 90 io_block_mapping(
89 MPC52xx_MBAR_VIRT, MPC52xx_MBAR, MPC52xx_MBAR_SIZE, _PAGE_IO); 91 MPC52xx_MBAR_VIRT, MPC52xx_MBAR, 0x10000000, _PAGE_IO);
90} 92}
91 93
92 94
diff --git a/arch/ppc/syslib/mpc83xx_devices.c b/arch/ppc/syslib/mpc83xx_devices.c
index 847df4409982..f9b95de70e23 100644
--- a/arch/ppc/syslib/mpc83xx_devices.c
+++ b/arch/ppc/syslib/mpc83xx_devices.c
@@ -28,7 +28,6 @@
28 */ 28 */
29 29
30struct gianfar_mdio_data mpc83xx_mdio_pdata = { 30struct gianfar_mdio_data mpc83xx_mdio_pdata = {
31 .paddr = 0x24520,
32}; 31};
33 32
34static struct gianfar_platform_data mpc83xx_tsec1_pdata = { 33static struct gianfar_platform_data mpc83xx_tsec1_pdata = {
@@ -226,7 +225,14 @@ struct platform_device ppc_sys_platform_devices[] = {
226 .name = "fsl-gianfar_mdio", 225 .name = "fsl-gianfar_mdio",
227 .id = 0, 226 .id = 0,
228 .dev.platform_data = &mpc83xx_mdio_pdata, 227 .dev.platform_data = &mpc83xx_mdio_pdata,
229 .num_resources = 0, 228 .num_resources = 1,
229 .resource = (struct resource[]) {
230 {
231 .start = 0x24520,
232 .end = 0x2453f,
233 .flags = IORESOURCE_MEM,
234 },
235 },
230 }, 236 },
231}; 237};
232 238
diff --git a/arch/ppc/syslib/mpc85xx_devices.c b/arch/ppc/syslib/mpc85xx_devices.c
index 69949d255658..00e9b6ff2f6e 100644
--- a/arch/ppc/syslib/mpc85xx_devices.c
+++ b/arch/ppc/syslib/mpc85xx_devices.c
@@ -26,7 +26,6 @@
26 * what CCSRBAR is, will get fixed up by mach_mpc85xx_fixup 26 * what CCSRBAR is, will get fixed up by mach_mpc85xx_fixup
27 */ 27 */
28struct gianfar_mdio_data mpc85xx_mdio_pdata = { 28struct gianfar_mdio_data mpc85xx_mdio_pdata = {
29 .paddr = MPC85xx_MIIM_OFFSET,
30}; 29};
31 30
32static struct gianfar_platform_data mpc85xx_tsec1_pdata = { 31static struct gianfar_platform_data mpc85xx_tsec1_pdata = {
@@ -720,7 +719,14 @@ struct platform_device ppc_sys_platform_devices[] = {
720 .name = "fsl-gianfar_mdio", 719 .name = "fsl-gianfar_mdio",
721 .id = 0, 720 .id = 0,
722 .dev.platform_data = &mpc85xx_mdio_pdata, 721 .dev.platform_data = &mpc85xx_mdio_pdata,
723 .num_resources = 0, 722 .num_resources = 1,
723 .resource = (struct resource[]) {
724 {
725 .start = 0x24520,
726 .end = 0x2453f,
727 .flags = IORESOURCE_MEM,
728 },
729 },
724 }, 730 },
725}; 731};
726 732
diff --git a/arch/ppc/syslib/ocp.c b/arch/ppc/syslib/ocp.c
index 9ccce438bd7a..ab34b1d6072f 100644
--- a/arch/ppc/syslib/ocp.c
+++ b/arch/ppc/syslib/ocp.c
@@ -189,6 +189,8 @@ ocp_device_resume(struct device *dev)
189struct bus_type ocp_bus_type = { 189struct bus_type ocp_bus_type = {
190 .name = "ocp", 190 .name = "ocp",
191 .match = ocp_device_match, 191 .match = ocp_device_match,
192 .probe = ocp_driver_probe,
193 .remove = ocp_driver_remove,
192 .suspend = ocp_device_suspend, 194 .suspend = ocp_device_suspend,
193 .resume = ocp_device_resume, 195 .resume = ocp_device_resume,
194}; 196};
@@ -210,8 +212,6 @@ ocp_register_driver(struct ocp_driver *drv)
210 /* initialize common driver fields */ 212 /* initialize common driver fields */
211 drv->driver.name = drv->name; 213 drv->driver.name = drv->name;
212 drv->driver.bus = &ocp_bus_type; 214 drv->driver.bus = &ocp_bus_type;
213 drv->driver.probe = ocp_device_probe;
214 drv->driver.remove = ocp_device_remove;
215 215
216 /* register with core */ 216 /* register with core */
217 return driver_register(&drv->driver); 217 return driver_register(&drv->driver);
diff --git a/arch/ppc/syslib/ppc4xx_dma.c b/arch/ppc/syslib/ppc4xx_dma.c
index f15e64285f96..05ccd598dd4e 100644
--- a/arch/ppc/syslib/ppc4xx_dma.c
+++ b/arch/ppc/syslib/ppc4xx_dma.c
@@ -30,6 +30,7 @@
30 30
31#include <asm/system.h> 31#include <asm/system.h>
32#include <asm/io.h> 32#include <asm/io.h>
33#include <asm/dma.h>
33#include <asm/ppc4xx_dma.h> 34#include <asm/ppc4xx_dma.h>
34 35
35ppc_dma_ch_t dma_channels[MAX_PPC4xx_DMA_CHANNELS]; 36ppc_dma_ch_t dma_channels[MAX_PPC4xx_DMA_CHANNELS];
diff --git a/arch/ppc/syslib/prom.c b/arch/ppc/syslib/prom.c
index af4deace49e0..482f837fd373 100644
--- a/arch/ppc/syslib/prom.c
+++ b/arch/ppc/syslib/prom.c
@@ -70,8 +70,6 @@ int use_of_interrupt_tree;
70struct device_node *dflt_interrupt_controller; 70struct device_node *dflt_interrupt_controller;
71int num_interrupt_controllers; 71int num_interrupt_controllers;
72 72
73int pmac_newworld;
74
75extern unsigned int rtas_entry; /* physical pointer */ 73extern unsigned int rtas_entry; /* physical pointer */
76 74
77extern struct device_node *allnodes; 75extern struct device_node *allnodes;
@@ -123,22 +121,13 @@ finish_device_tree(void)
123 unsigned long mem = (unsigned long) klimit; 121 unsigned long mem = (unsigned long) klimit;
124 struct device_node *np; 122 struct device_node *np;
125 123
126 /* All newworld pmac machines and CHRPs now use the interrupt tree */ 124 /* All CHRPs now use the interrupt tree */
127 for (np = allnodes; np != NULL; np = np->allnext) { 125 for (np = allnodes; np != NULL; np = np->allnext) {
128 if (get_property(np, "interrupt-parent", NULL)) { 126 if (get_property(np, "interrupt-parent", NULL)) {
129 use_of_interrupt_tree = 1; 127 use_of_interrupt_tree = 1;
130 break; 128 break;
131 } 129 }
132 } 130 }
133 if (_machine == _MACH_Pmac && use_of_interrupt_tree)
134 pmac_newworld = 1;
135
136#ifdef CONFIG_BOOTX_TEXT
137 if (boot_infos && pmac_newworld) {
138 prom_print("WARNING ! BootX/miBoot booting is not supported on this machine\n");
139 prom_print(" You should use an Open Firmware bootloader\n");
140 }
141#endif /* CONFIG_BOOTX_TEXT */
142 131
143 if (use_of_interrupt_tree) { 132 if (use_of_interrupt_tree) {
144 /* 133 /*
@@ -434,16 +423,10 @@ finish_node_interrupts(struct device_node *np, unsigned long mem_start)
434 * those machines, we want to offset interrupts from the 423 * those machines, we want to offset interrupts from the
435 * second openpic by 128 -- BenH 424 * second openpic by 128 -- BenH
436 */ 425 */
437 if (_machine != _MACH_Pmac && num_interrupt_controllers > 1 426 if (num_interrupt_controllers > 1
438 && ic != NULL 427 && ic != NULL
439 && get_property(ic, "interrupt-parent", NULL) == NULL) 428 && get_property(ic, "interrupt-parent", NULL) == NULL)
440 offset = 16; 429 offset = 16;
441 else if (_machine == _MACH_Pmac && num_interrupt_controllers > 1
442 && ic != NULL && ic->parent != NULL) {
443 char *name = get_property(ic->parent, "name", NULL);
444 if (name && !strcmp(name, "u3"))
445 offset = 128;
446 }
447 430
448 np->intrs[i].line = irq[0] + offset; 431 np->intrs[i].line = irq[0] + offset;
449 if (n > 1) 432 if (n > 1)
diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c
index c80177f8ec04..4344cbe9b5c5 100644
--- a/arch/ppc/xmon/start.c
+++ b/arch/ppc/xmon/start.c
@@ -18,7 +18,6 @@
18#include <asm/bootx.h> 18#include <asm/bootx.h>
19#include <asm/machdep.h> 19#include <asm/machdep.h>
20#include <asm/errno.h> 20#include <asm/errno.h>
21#include <asm/pmac_feature.h>
22#include <asm/processor.h> 21#include <asm/processor.h>
23#include <asm/delay.h> 22#include <asm/delay.h>
24#include <asm/btext.h> 23#include <asm/btext.h>
@@ -27,11 +26,9 @@ static volatile unsigned char *sccc, *sccd;
27unsigned int TXRDY, RXRDY, DLAB; 26unsigned int TXRDY, RXRDY, DLAB;
28static int xmon_expect(const char *str, unsigned int timeout); 27static int xmon_expect(const char *str, unsigned int timeout);
29 28
30static int use_serial;
31static int use_screen; 29static int use_screen;
32static int via_modem; 30static int via_modem;
33static int xmon_use_sccb; 31static int xmon_use_sccb;
34static struct device_node *channel_node;
35 32
36#define TB_SPEED 25000000 33#define TB_SPEED 25000000
37 34
@@ -112,96 +109,21 @@ xmon_map_scc(void)
112#ifdef CONFIG_PPC_MULTIPLATFORM 109#ifdef CONFIG_PPC_MULTIPLATFORM
113 volatile unsigned char *base; 110 volatile unsigned char *base;
114 111
115 if (_machine == _MACH_Pmac) {
116 struct device_node *np;
117 unsigned long addr;
118#ifdef CONFIG_BOOTX_TEXT
119 if (!use_screen && !use_serial
120 && !machine_is_compatible("iMac")) {
121 /* see if there is a keyboard in the device tree
122 with a parent of type "adb" */
123 for (np = find_devices("keyboard"); np; np = np->next)
124 if (np->parent && np->parent->type
125 && strcmp(np->parent->type, "adb") == 0)
126 break;
127
128 /* needs to be hacked if xmon_printk is to be used
129 from within find_via_pmu() */
130#ifdef CONFIG_ADB_PMU
131 if (np != NULL && boot_text_mapped && find_via_pmu())
132 use_screen = 1;
133#endif
134#ifdef CONFIG_ADB_CUDA
135 if (np != NULL && boot_text_mapped && find_via_cuda())
136 use_screen = 1;
137#endif
138 }
139 if (!use_screen && (np = find_devices("escc")) != NULL) {
140 /*
141 * look for the device node for the serial port
142 * we're using and see if it says it has a modem
143 */
144 char *name = xmon_use_sccb? "ch-b": "ch-a";
145 char *slots;
146 int l;
147
148 np = np->child;
149 while (np != NULL && strcmp(np->name, name) != 0)
150 np = np->sibling;
151 if (np != NULL) {
152 /* XXX should parse this properly */
153 channel_node = np;
154 slots = get_property(np, "slot-names", &l);
155 if (slots != NULL && l >= 10
156 && strcmp(slots+4, "Modem") == 0)
157 via_modem = 1;
158 }
159 }
160 btext_drawstring("xmon uses ");
161 if (use_screen)
162 btext_drawstring("screen and keyboard\n");
163 else {
164 if (via_modem)
165 btext_drawstring("modem on ");
166 btext_drawstring(xmon_use_sccb? "printer": "modem");
167 btext_drawstring(" port\n");
168 }
169
170#endif /* CONFIG_BOOTX_TEXT */
171
172#ifdef CHRP_ESCC
173 addr = 0xc1013020;
174#else
175 addr = 0xf3013020;
176#endif
177 TXRDY = 4;
178 RXRDY = 1;
179
180 np = find_devices("mac-io");
181 if (np && np->n_addrs)
182 addr = np->addrs[0].address + 0x13020;
183 base = (volatile unsigned char *) ioremap(addr & PAGE_MASK, PAGE_SIZE);
184 sccc = base + (addr & ~PAGE_MASK);
185 sccd = sccc + 0x10;
186
187 }
188#ifdef CONFIG_PPC_CHRP 112#ifdef CONFIG_PPC_CHRP
189 else { 113 base = (volatile unsigned char *) isa_io_base;
190 base = (volatile unsigned char *) isa_io_base; 114 if (_machine == _MACH_chrp)
191 if (_machine == _MACH_chrp) 115 base = (volatile unsigned char *)
192 base = (volatile unsigned char *) 116 ioremap(chrp_find_phys_io_base(), 0x1000);
193 ioremap(chrp_find_phys_io_base(), 0x1000); 117
194 118 sccc = base + 0x3fd;
195 sccc = base + 0x3fd; 119 sccd = base + 0x3f8;
196 sccd = base + 0x3f8; 120 if (xmon_use_sccb) {
197 if (xmon_use_sccb) { 121 sccc -= 0x100;
198 sccc -= 0x100; 122 sccd -= 0x100;
199 sccd -= 0x100;
200 }
201 TXRDY = 0x20;
202 RXRDY = 1;
203 DLAB = 0x80;
204 } 123 }
124 TXRDY = 0x20;
125 RXRDY = 1;
126 DLAB = 0x80;
205#endif /* CONFIG_PPC_CHRP */ 127#endif /* CONFIG_PPC_CHRP */
206#elif defined(CONFIG_GEMINI) 128#elif defined(CONFIG_GEMINI)
207 /* should already be mapped by the kernel boot */ 129 /* should already be mapped by the kernel boot */
@@ -385,16 +307,6 @@ xmon_read_poll(void)
385 return *sccd; 307 return *sccd;
386} 308}
387 309
388static unsigned char scc_inittab[] = {
389 13, 0, /* set baud rate divisor */
390 12, 1,
391 14, 1, /* baud rate gen enable, src=rtxc */
392 11, 0x50, /* clocks = br gen */
393 5, 0xea, /* tx 8 bits, assert DTR & RTS */
394 4, 0x46, /* x16 clock, 1 stop */
395 3, 0xc1, /* rx enable, 8 bits */
396};
397
398void 310void
399xmon_init_scc(void) 311xmon_init_scc(void)
400{ 312{
@@ -407,43 +319,6 @@ xmon_init_scc(void)
407 sccd[3] = 3; eieio(); /* LCR = 8N1 */ 319 sccd[3] = 3; eieio(); /* LCR = 8N1 */
408 sccd[1] = 0; eieio(); /* IER = 0 */ 320 sccd[1] = 0; eieio(); /* IER = 0 */
409 } 321 }
410 else if ( _machine == _MACH_Pmac )
411 {
412 int i, x;
413
414 if (channel_node != 0)
415 pmac_call_feature(
416 PMAC_FTR_SCC_ENABLE,
417 channel_node,
418 PMAC_SCC_ASYNC | PMAC_SCC_FLAG_XMON, 1);
419 printk(KERN_INFO "Serial port locked ON by debugger !\n");
420 if (via_modem && channel_node != 0) {
421 unsigned int t0;
422
423 pmac_call_feature(
424 PMAC_FTR_MODEM_ENABLE,
425 channel_node, 0, 1);
426 printk(KERN_INFO "Modem powered up by debugger !\n");
427 t0 = readtb();
428 while (readtb() - t0 < 3*TB_SPEED)
429 eieio();
430 }
431 /* use the B channel if requested */
432 if (xmon_use_sccb) {
433 sccc = (volatile unsigned char *)
434 ((unsigned long)sccc & ~0x20);
435 sccd = sccc + 0x10;
436 }
437 for (i = 20000; i != 0; --i) {
438 x = *sccc; eieio();
439 }
440 *sccc = 9; eieio(); /* reset A or B side */
441 *sccc = ((unsigned long)sccc & 0x20)? 0x80: 0x40; eieio();
442 for (i = 0; i < sizeof(scc_inittab); ++i) {
443 *sccc = scc_inittab[i];
444 eieio();
445 }
446 }
447 scc_initialized = 1; 322 scc_initialized = 1;
448 if (via_modem) { 323 if (via_modem) {
449 for (;;) { 324 for (;;) {
@@ -632,19 +507,9 @@ xmon_fgets(char *str, int nb, void *f)
632void 507void
633xmon_enter(void) 508xmon_enter(void)
634{ 509{
635#ifdef CONFIG_ADB_PMU
636 if (_machine == _MACH_Pmac) {
637 pmu_suspend();
638 }
639#endif
640} 510}
641 511
642void 512void
643xmon_leave(void) 513xmon_leave(void)
644{ 514{
645#ifdef CONFIG_ADB_PMU
646 if (_machine == _MACH_Pmac) {
647 pmu_resume();
648 }
649#endif
650} 515}
diff --git a/arch/ppc/xmon/xmon.c b/arch/ppc/xmon/xmon.c
index 2b483b4f1602..bdaf6597b4c2 100644
--- a/arch/ppc/xmon/xmon.c
+++ b/arch/ppc/xmon/xmon.c
@@ -16,9 +16,6 @@
16#include <asm/bootx.h> 16#include <asm/bootx.h>
17#include <asm/machdep.h> 17#include <asm/machdep.h>
18#include <asm/xmon.h> 18#include <asm/xmon.h>
19#ifdef CONFIG_PMAC_BACKLIGHT
20#include <asm/backlight.h>
21#endif
22#include "nonstdio.h" 19#include "nonstdio.h"
23#include "privinst.h" 20#include "privinst.h"
24 21
@@ -99,7 +96,7 @@ static void remove_bpts(void);
99static void insert_bpts(void); 96static void insert_bpts(void);
100static struct bpt *at_breakpoint(unsigned pc); 97static struct bpt *at_breakpoint(unsigned pc);
101static void bpt_cmds(void); 98static void bpt_cmds(void);
102static void cacheflush(void); 99void cacheflush(void);
103#ifdef CONFIG_SMP 100#ifdef CONFIG_SMP
104static void cpu_cmd(void); 101static void cpu_cmd(void);
105#endif /* CONFIG_SMP */ 102#endif /* CONFIG_SMP */
@@ -260,16 +257,6 @@ int xmon(struct pt_regs *excp)
260 */ 257 */
261#endif /* CONFIG_SMP */ 258#endif /* CONFIG_SMP */
262 remove_bpts(); 259 remove_bpts();
263#ifdef CONFIG_PMAC_BACKLIGHT
264 if( setjmp(bus_error_jmp) == 0 ) {
265 debugger_fault_handler = handle_fault;
266 sync();
267 set_backlight_enable(1);
268 set_backlight_level(BACKLIGHT_MAX);
269 sync();
270 }
271 debugger_fault_handler = NULL;
272#endif /* CONFIG_PMAC_BACKLIGHT */
273 cmd = cmds(excp); 260 cmd = cmds(excp);
274 if (cmd == 's') { 261 if (cmd == 's') {
275 xmon_trace[smp_processor_id()] = SSTEP; 262 xmon_trace[smp_processor_id()] = SSTEP;
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 477ac2758bd5..b66602ad7b33 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -23,35 +23,22 @@ config GENERIC_BUST_SPINLOCK
23 23
24mainmenu "Linux Kernel Configuration" 24mainmenu "Linux Kernel Configuration"
25 25
26config ARCH_S390 26config S390
27 bool 27 bool
28 default y 28 default y
29 29
30config UID16
31 bool
32 default y
33 depends on ARCH_S390X = 'n'
34
35source "init/Kconfig" 30source "init/Kconfig"
36 31
37menu "Base setup" 32menu "Base setup"
38 33
39comment "Processor type and features" 34comment "Processor type and features"
40 35
41config ARCH_S390X 36config 64BIT
42 bool "64 bit kernel" 37 bool "64 bit kernel"
43 help 38 help
44 Select this option if you have a 64 bit IBM zSeries machine 39 Select this option if you have a 64 bit IBM zSeries machine
45 and want to use the 64 bit addressing mode. 40 and want to use the 64 bit addressing mode.
46 41
47config 64BIT
48 def_bool ARCH_S390X
49
50config ARCH_S390_31
51 bool
52 depends on ARCH_S390X = 'n'
53 default y
54
55config SMP 42config SMP
56 bool "Symmetric multi-processing support" 43 bool "Symmetric multi-processing support"
57 ---help--- 44 ---help---
@@ -101,20 +88,15 @@ config MATHEMU
101 on older S/390 machines. Say Y unless you know your machine doesn't 88 on older S/390 machines. Say Y unless you know your machine doesn't
102 need this. 89 need this.
103 90
104config S390_SUPPORT 91config COMPAT
105 bool "Kernel support for 31 bit emulation" 92 bool "Kernel support for 31 bit emulation"
106 depends on ARCH_S390X 93 depends on 64BIT
107 help 94 help
108 Select this option if you want to enable your system kernel to 95 Select this option if you want to enable your system kernel to
109 handle system-calls from ELF binaries for 31 bit ESA. This option 96 handle system-calls from ELF binaries for 31 bit ESA. This option
110 (and some other stuff like libraries and such) is needed for 97 (and some other stuff like libraries and such) is needed for
111 executing 31 bit applications. It is safe to say "Y". 98 executing 31 bit applications. It is safe to say "Y".
112 99
113config COMPAT
114 bool
115 depends on S390_SUPPORT
116 default y
117
118config SYSVIPC_COMPAT 100config SYSVIPC_COMPAT
119 bool 101 bool
120 depends on COMPAT && SYSVIPC 102 depends on COMPAT && SYSVIPC
@@ -122,7 +104,7 @@ config SYSVIPC_COMPAT
122 104
123config BINFMT_ELF32 105config BINFMT_ELF32
124 tristate "Kernel support for 31 bit ELF binaries" 106 tristate "Kernel support for 31 bit ELF binaries"
125 depends on S390_SUPPORT 107 depends on COMPAT
126 help 108 help
127 This allows you to run 32-bit Linux/ELF binaries on your zSeries 109 This allows you to run 32-bit Linux/ELF binaries on your zSeries
128 in 64 bit mode. Everybody wants this; say Y. 110 in 64 bit mode. Everybody wants this; say Y.
@@ -135,7 +117,7 @@ choice
135 117
136config MARCH_G5 118config MARCH_G5
137 bool "S/390 model G5 and G6" 119 bool "S/390 model G5 and G6"
138 depends on ARCH_S390_31 120 depends on !64BIT
139 help 121 help
140 Select this to build a 31 bit kernel that works 122 Select this to build a 31 bit kernel that works
141 on all S/390 and zSeries machines. 123 on all S/390 and zSeries machines.
@@ -240,8 +222,8 @@ config MACHCHK_WARNING
240config QDIO 222config QDIO
241 tristate "QDIO support" 223 tristate "QDIO support"
242 ---help--- 224 ---help---
243 This driver provides the Queued Direct I/O base support for the 225 This driver provides the Queued Direct I/O base support for
244 IBM S/390 (G5 and G6) and eServer zSeries (z800, z890, z900 and z990). 226 IBM mainframes.
245 227
246 For details please refer to the documentation provided by IBM at 228 For details please refer to the documentation provided by IBM at
247 <http://www10.software.ibm.com/developerworks/opensource/linux390> 229 <http://www10.software.ibm.com/developerworks/opensource/linux390>
@@ -263,7 +245,8 @@ config QDIO_DEBUG
263 bool "Extended debugging information" 245 bool "Extended debugging information"
264 depends on QDIO 246 depends on QDIO
265 help 247 help
266 Say Y here to get extended debugging output in /proc/s390dbf/qdio... 248 Say Y here to get extended debugging output in
249 /sys/kernel/debug/s390dbf/qdio...
267 Warning: this option reduces the performance of the QDIO module. 250 Warning: this option reduces the performance of the QDIO module.
268 251
269 If unsure, say N. 252 If unsure, say N.
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 73a09a6ee6c8..6c6b197898d0 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -13,16 +13,14 @@
13# Copyright (C) 1994 by Linus Torvalds 13# Copyright (C) 1994 by Linus Torvalds
14# 14#
15 15
16ifdef CONFIG_ARCH_S390_31 16ifndef CONFIG_64BIT
17LDFLAGS := -m elf_s390 17LDFLAGS := -m elf_s390
18CFLAGS += -m31 18CFLAGS += -m31
19AFLAGS += -m31 19AFLAGS += -m31
20UTS_MACHINE := s390 20UTS_MACHINE := s390
21STACK_SIZE := 8192 21STACK_SIZE := 8192
22CHECKFLAGS += -D__s390__ 22CHECKFLAGS += -D__s390__
23endif 23else
24
25ifdef CONFIG_ARCH_S390X
26LDFLAGS := -m elf64_s390 24LDFLAGS := -m elf64_s390
27MODFLAGS += -fpic -D__PIC__ 25MODFLAGS += -fpic -D__PIC__
28CFLAGS += -m64 26CFLAGS += -m64
diff --git a/arch/s390/appldata/appldata_base.c b/arch/s390/appldata/appldata_base.c
index dee6ab54984d..d06a8d71c71d 100644
--- a/arch/s390/appldata/appldata_base.c
+++ b/arch/s390/appldata/appldata_base.c
@@ -40,7 +40,7 @@
40 40
41#define TOD_MICRO 0x01000 /* nr. of TOD clock units 41#define TOD_MICRO 0x01000 /* nr. of TOD clock units
42 for 1 microsecond */ 42 for 1 microsecond */
43#ifndef CONFIG_ARCH_S390X 43#ifndef CONFIG_64BIT
44 44
45#define APPLDATA_START_INTERVAL_REC 0x00 /* Function codes for */ 45#define APPLDATA_START_INTERVAL_REC 0x00 /* Function codes for */
46#define APPLDATA_STOP_REC 0x01 /* DIAG 0xDC */ 46#define APPLDATA_STOP_REC 0x01 /* DIAG 0xDC */
@@ -54,13 +54,13 @@
54#define APPLDATA_GEN_EVENT_RECORD 0x82 54#define APPLDATA_GEN_EVENT_RECORD 0x82
55#define APPLDATA_START_CONFIG_REC 0x83 55#define APPLDATA_START_CONFIG_REC 0x83
56 56
57#endif /* CONFIG_ARCH_S390X */ 57#endif /* CONFIG_64BIT */
58 58
59 59
60/* 60/*
61 * Parameter list for DIAGNOSE X'DC' 61 * Parameter list for DIAGNOSE X'DC'
62 */ 62 */
63#ifndef CONFIG_ARCH_S390X 63#ifndef CONFIG_64BIT
64struct appldata_parameter_list { 64struct appldata_parameter_list {
65 u16 diag; /* The DIAGNOSE code X'00DC' */ 65 u16 diag; /* The DIAGNOSE code X'00DC' */
66 u8 function; /* The function code for the DIAGNOSE */ 66 u8 function; /* The function code for the DIAGNOSE */
@@ -82,7 +82,7 @@ struct appldata_parameter_list {
82 u64 product_id_addr; 82 u64 product_id_addr;
83 u64 buffer_addr; 83 u64 buffer_addr;
84}; 84};
85#endif /* CONFIG_ARCH_S390X */ 85#endif /* CONFIG_64BIT */
86 86
87/* 87/*
88 * /proc entries (sysctl) 88 * /proc entries (sysctl)
diff --git a/arch/s390/appldata/appldata_os.c b/arch/s390/appldata/appldata_os.c
index e0a476bf4fd6..99ddd3bf2fba 100644
--- a/arch/s390/appldata/appldata_os.c
+++ b/arch/s390/appldata/appldata_os.c
@@ -141,19 +141,19 @@ static void appldata_get_os_data(void *data)
141 j = 0; 141 j = 0;
142 for_each_online_cpu(i) { 142 for_each_online_cpu(i) {
143 os_data->os_cpu[j].per_cpu_user = 143 os_data->os_cpu[j].per_cpu_user =
144 kstat_cpu(i).cpustat.user; 144 cputime_to_jiffies(kstat_cpu(i).cpustat.user);
145 os_data->os_cpu[j].per_cpu_nice = 145 os_data->os_cpu[j].per_cpu_nice =
146 kstat_cpu(i).cpustat.nice; 146 cputime_to_jiffies(kstat_cpu(i).cpustat.nice);
147 os_data->os_cpu[j].per_cpu_system = 147 os_data->os_cpu[j].per_cpu_system =
148 kstat_cpu(i).cpustat.system; 148 cputime_to_jiffies(kstat_cpu(i).cpustat.system);
149 os_data->os_cpu[j].per_cpu_idle = 149 os_data->os_cpu[j].per_cpu_idle =
150 kstat_cpu(i).cpustat.idle; 150 cputime_to_jiffies(kstat_cpu(i).cpustat.idle);
151 os_data->os_cpu[j].per_cpu_irq = 151 os_data->os_cpu[j].per_cpu_irq =
152 kstat_cpu(i).cpustat.irq; 152 cputime_to_jiffies(kstat_cpu(i).cpustat.irq);
153 os_data->os_cpu[j].per_cpu_softirq = 153 os_data->os_cpu[j].per_cpu_softirq =
154 kstat_cpu(i).cpustat.softirq; 154 cputime_to_jiffies(kstat_cpu(i).cpustat.softirq);
155 os_data->os_cpu[j].per_cpu_iowait = 155 os_data->os_cpu[j].per_cpu_iowait =
156 kstat_cpu(i).cpustat.iowait; 156 cputime_to_jiffies(kstat_cpu(i).cpustat.iowait);
157 j++; 157 j++;
158 } 158 }
159 159
diff --git a/arch/s390/crypto/Makefile b/arch/s390/crypto/Makefile
index 96a05e6b51e0..bfe2541dc5cf 100644
--- a/arch/s390/crypto/Makefile
+++ b/arch/s390/crypto/Makefile
@@ -2,7 +2,9 @@
2# Cryptographic API 2# Cryptographic API
3# 3#
4 4
5obj-$(CONFIG_CRYPTO_SHA1_Z990) += sha1_z990.o 5obj-$(CONFIG_CRYPTO_SHA1_S390) += sha1_s390.o
6obj-$(CONFIG_CRYPTO_DES_Z990) += des_z990.o des_check_key.o 6obj-$(CONFIG_CRYPTO_SHA256_S390) += sha256_s390.o
7obj-$(CONFIG_CRYPTO_DES_S390) += des_s390.o des_check_key.o
8obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o
7 9
8obj-$(CONFIG_CRYPTO_TEST) += crypt_z990_query.o 10obj-$(CONFIG_CRYPTO_TEST) += crypt_s390_query.o
diff --git a/arch/s390/crypto/aes_s390.c b/arch/s390/crypto/aes_s390.c
new file mode 100644
index 000000000000..c5ca2dc5d428
--- /dev/null
+++ b/arch/s390/crypto/aes_s390.c
@@ -0,0 +1,276 @@
1/*
2 * Cryptographic API.
3 *
4 * s390 implementation of the AES Cipher Algorithm.
5 *
6 * s390 Version:
7 * Copyright (C) 2005 IBM Deutschland GmbH, IBM Corporation
8 * Author(s): Jan Glauber (jang@de.ibm.com)
9 *
10 * Derived from "crypto/aes.c"
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
15 * any later version.
16 *
17 */
18
19#include <linux/module.h>
20#include <linux/init.h>
21#include <linux/crypto.h>
22#include "crypt_s390.h"
23
24#define AES_MIN_KEY_SIZE 16
25#define AES_MAX_KEY_SIZE 32
26
27/* data block size for all key lengths */
28#define AES_BLOCK_SIZE 16
29
30int has_aes_128 = 0;
31int has_aes_192 = 0;
32int has_aes_256 = 0;
33
34struct s390_aes_ctx {
35 u8 iv[AES_BLOCK_SIZE];
36 u8 key[AES_MAX_KEY_SIZE];
37 int key_len;
38};
39
40static int aes_set_key(void *ctx, const u8 *in_key, unsigned int key_len,
41 u32 *flags)
42{
43 struct s390_aes_ctx *sctx = ctx;
44
45 switch (key_len) {
46 case 16:
47 if (!has_aes_128)
48 goto fail;
49 break;
50 case 24:
51 if (!has_aes_192)
52 goto fail;
53
54 break;
55 case 32:
56 if (!has_aes_256)
57 goto fail;
58 break;
59 default:
60 /* invalid key length */
61 goto fail;
62 break;
63 }
64
65 sctx->key_len = key_len;
66 memcpy(sctx->key, in_key, key_len);
67 return 0;
68fail:
69 *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
70 return -EINVAL;
71}
72
73static void aes_encrypt(void *ctx, u8 *out, const u8 *in)
74{
75 const struct s390_aes_ctx *sctx = ctx;
76
77 switch (sctx->key_len) {
78 case 16:
79 crypt_s390_km(KM_AES_128_ENCRYPT, &sctx->key, out, in,
80 AES_BLOCK_SIZE);
81 break;
82 case 24:
83 crypt_s390_km(KM_AES_192_ENCRYPT, &sctx->key, out, in,
84 AES_BLOCK_SIZE);
85 break;
86 case 32:
87 crypt_s390_km(KM_AES_256_ENCRYPT, &sctx->key, out, in,
88 AES_BLOCK_SIZE);
89 break;
90 }
91}
92
93static void aes_decrypt(void *ctx, u8 *out, const u8 *in)
94{
95 const struct s390_aes_ctx *sctx = ctx;
96
97 switch (sctx->key_len) {
98 case 16:
99 crypt_s390_km(KM_AES_128_DECRYPT, &sctx->key, out, in,
100 AES_BLOCK_SIZE);
101 break;
102 case 24:
103 crypt_s390_km(KM_AES_192_DECRYPT, &sctx->key, out, in,
104 AES_BLOCK_SIZE);
105 break;
106 case 32:
107 crypt_s390_km(KM_AES_256_DECRYPT, &sctx->key, out, in,
108 AES_BLOCK_SIZE);
109 break;
110 }
111}
112
113static unsigned int aes_encrypt_ecb(const struct cipher_desc *desc, u8 *out,
114 const u8 *in, unsigned int nbytes)
115{
116 struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm);
117 int ret;
118
119 /* only use complete blocks */
120 nbytes &= ~(AES_BLOCK_SIZE - 1);
121
122 switch (sctx->key_len) {
123 case 16:
124 ret = crypt_s390_km(KM_AES_128_ENCRYPT, &sctx->key, out, in, nbytes);
125 BUG_ON((ret < 0) || (ret != nbytes));
126 break;
127 case 24:
128 ret = crypt_s390_km(KM_AES_192_ENCRYPT, &sctx->key, out, in, nbytes);
129 BUG_ON((ret < 0) || (ret != nbytes));
130 break;
131 case 32:
132 ret = crypt_s390_km(KM_AES_256_ENCRYPT, &sctx->key, out, in, nbytes);
133 BUG_ON((ret < 0) || (ret != nbytes));
134 break;
135 }
136 return nbytes;
137}
138
139static unsigned int aes_decrypt_ecb(const struct cipher_desc *desc, u8 *out,
140 const u8 *in, unsigned int nbytes)
141{
142 struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm);
143 int ret;
144
145 /* only use complete blocks */
146 nbytes &= ~(AES_BLOCK_SIZE - 1);
147
148 switch (sctx->key_len) {
149 case 16:
150 ret = crypt_s390_km(KM_AES_128_DECRYPT, &sctx->key, out, in, nbytes);
151 BUG_ON((ret < 0) || (ret != nbytes));
152 break;
153 case 24:
154 ret = crypt_s390_km(KM_AES_192_DECRYPT, &sctx->key, out, in, nbytes);
155 BUG_ON((ret < 0) || (ret != nbytes));
156 break;
157 case 32:
158 ret = crypt_s390_km(KM_AES_256_DECRYPT, &sctx->key, out, in, nbytes);
159 BUG_ON((ret < 0) || (ret != nbytes));
160 break;
161 }
162 return nbytes;
163}
164
165static unsigned int aes_encrypt_cbc(const struct cipher_desc *desc, u8 *out,
166 const u8 *in, unsigned int nbytes)
167{
168 struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm);
169 int ret;
170
171 /* only use complete blocks */
172 nbytes &= ~(AES_BLOCK_SIZE - 1);
173
174 memcpy(&sctx->iv, desc->info, AES_BLOCK_SIZE);
175 switch (sctx->key_len) {
176 case 16:
177 ret = crypt_s390_kmc(KMC_AES_128_ENCRYPT, &sctx->iv, out, in, nbytes);
178 BUG_ON((ret < 0) || (ret != nbytes));
179 break;
180 case 24:
181 ret = crypt_s390_kmc(KMC_AES_192_ENCRYPT, &sctx->iv, out, in, nbytes);
182 BUG_ON((ret < 0) || (ret != nbytes));
183 break;
184 case 32:
185 ret = crypt_s390_kmc(KMC_AES_256_ENCRYPT, &sctx->iv, out, in, nbytes);
186 BUG_ON((ret < 0) || (ret != nbytes));
187 break;
188 }
189 memcpy(desc->info, &sctx->iv, AES_BLOCK_SIZE);
190
191 return nbytes;
192}
193
194static unsigned int aes_decrypt_cbc(const struct cipher_desc *desc, u8 *out,
195 const u8 *in, unsigned int nbytes)
196{
197 struct s390_aes_ctx *sctx = crypto_tfm_ctx(desc->tfm);
198 int ret;
199
200 /* only use complete blocks */
201 nbytes &= ~(AES_BLOCK_SIZE - 1);
202
203 memcpy(&sctx->iv, desc->info, AES_BLOCK_SIZE);
204 switch (sctx->key_len) {
205 case 16:
206 ret = crypt_s390_kmc(KMC_AES_128_DECRYPT, &sctx->iv, out, in, nbytes);
207 BUG_ON((ret < 0) || (ret != nbytes));
208 break;
209 case 24:
210 ret = crypt_s390_kmc(KMC_AES_192_DECRYPT, &sctx->iv, out, in, nbytes);
211 BUG_ON((ret < 0) || (ret != nbytes));
212 break;
213 case 32:
214 ret = crypt_s390_kmc(KMC_AES_256_DECRYPT, &sctx->iv, out, in, nbytes);
215 BUG_ON((ret < 0) || (ret != nbytes));
216 break;
217 }
218 return nbytes;
219}
220
221
222static struct crypto_alg aes_alg = {
223 .cra_name = "aes",
224 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
225 .cra_blocksize = AES_BLOCK_SIZE,
226 .cra_ctxsize = sizeof(struct s390_aes_ctx),
227 .cra_module = THIS_MODULE,
228 .cra_list = LIST_HEAD_INIT(aes_alg.cra_list),
229 .cra_u = {
230 .cipher = {
231 .cia_min_keysize = AES_MIN_KEY_SIZE,
232 .cia_max_keysize = AES_MAX_KEY_SIZE,
233 .cia_setkey = aes_set_key,
234 .cia_encrypt = aes_encrypt,
235 .cia_decrypt = aes_decrypt,
236 .cia_encrypt_ecb = aes_encrypt_ecb,
237 .cia_decrypt_ecb = aes_decrypt_ecb,
238 .cia_encrypt_cbc = aes_encrypt_cbc,
239 .cia_decrypt_cbc = aes_decrypt_cbc,
240 }
241 }
242};
243
244static int __init aes_init(void)
245{
246 int ret;
247
248 if (crypt_s390_func_available(KM_AES_128_ENCRYPT))
249 has_aes_128 = 1;
250 if (crypt_s390_func_available(KM_AES_192_ENCRYPT))
251 has_aes_192 = 1;
252 if (crypt_s390_func_available(KM_AES_256_ENCRYPT))
253 has_aes_256 = 1;
254
255 if (!has_aes_128 && !has_aes_192 && !has_aes_256)
256 return -ENOSYS;
257
258 ret = crypto_register_alg(&aes_alg);
259 if (ret != 0)
260 printk(KERN_INFO "crypt_s390: aes_s390 couldn't be loaded.\n");
261 return ret;
262}
263
264static void __exit aes_fini(void)
265{
266 crypto_unregister_alg(&aes_alg);
267}
268
269module_init(aes_init);
270module_exit(aes_fini);
271
272MODULE_ALIAS("aes");
273
274MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm");
275MODULE_LICENSE("GPL");
276
diff --git a/arch/s390/crypto/crypt_z990.h b/arch/s390/crypto/crypt_s390.h
index 4df660b99e5a..d1c259a7fe33 100644
--- a/arch/s390/crypto/crypt_z990.h
+++ b/arch/s390/crypto/crypt_s390.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * Cryptographic API. 2 * Cryptographic API.
3 * 3 *
4 * Support for z990 cryptographic instructions. 4 * Support for s390 cryptographic instructions.
5 * 5 *
6 * Copyright (C) 2003 IBM Deutschland GmbH, IBM Corporation 6 * Copyright (C) 2003 IBM Deutschland GmbH, IBM Corporation
7 * Author(s): Thomas Spatzier (tspat@de.ibm.com) 7 * Author(s): Thomas Spatzier (tspat@de.ibm.com)
@@ -12,84 +12,108 @@
12 * any later version. 12 * any later version.
13 * 13 *
14 */ 14 */
15#ifndef _CRYPTO_ARCH_S390_CRYPT_Z990_H 15#ifndef _CRYPTO_ARCH_S390_CRYPT_S390_H
16#define _CRYPTO_ARCH_S390_CRYPT_Z990_H 16#define _CRYPTO_ARCH_S390_CRYPT_S390_H
17 17
18#include <asm/errno.h> 18#include <asm/errno.h>
19 19
20#define CRYPT_Z990_OP_MASK 0xFF00 20#define CRYPT_S390_OP_MASK 0xFF00
21#define CRYPT_Z990_FUNC_MASK 0x00FF 21#define CRYPT_S390_FUNC_MASK 0x00FF
22 22
23 23/* s930 cryptographic operations */
24/*z990 cryptographic operations*/ 24enum crypt_s390_operations {
25enum crypt_z990_operations { 25 CRYPT_S390_KM = 0x0100,
26 CRYPT_Z990_KM = 0x0100, 26 CRYPT_S390_KMC = 0x0200,
27 CRYPT_Z990_KMC = 0x0200, 27 CRYPT_S390_KIMD = 0x0300,
28 CRYPT_Z990_KIMD = 0x0300, 28 CRYPT_S390_KLMD = 0x0400,
29 CRYPT_Z990_KLMD = 0x0400, 29 CRYPT_S390_KMAC = 0x0500
30 CRYPT_Z990_KMAC = 0x0500
31}; 30};
32 31
33/*function codes for KM (CIPHER MESSAGE) instruction*/ 32/* function codes for KM (CIPHER MESSAGE) instruction
34enum crypt_z990_km_func { 33 * 0x80 is the decipher modifier bit
35 KM_QUERY = CRYPT_Z990_KM | 0, 34 */
36 KM_DEA_ENCRYPT = CRYPT_Z990_KM | 1, 35enum crypt_s390_km_func {
37 KM_DEA_DECRYPT = CRYPT_Z990_KM | 1 | 0x80, //modifier bit->decipher 36 KM_QUERY = CRYPT_S390_KM | 0x0,
38 KM_TDEA_128_ENCRYPT = CRYPT_Z990_KM | 2, 37 KM_DEA_ENCRYPT = CRYPT_S390_KM | 0x1,
39 KM_TDEA_128_DECRYPT = CRYPT_Z990_KM | 2 | 0x80, 38 KM_DEA_DECRYPT = CRYPT_S390_KM | 0x1 | 0x80,
40 KM_TDEA_192_ENCRYPT = CRYPT_Z990_KM | 3, 39 KM_TDEA_128_ENCRYPT = CRYPT_S390_KM | 0x2,
41 KM_TDEA_192_DECRYPT = CRYPT_Z990_KM | 3 | 0x80, 40 KM_TDEA_128_DECRYPT = CRYPT_S390_KM | 0x2 | 0x80,
41 KM_TDEA_192_ENCRYPT = CRYPT_S390_KM | 0x3,
42 KM_TDEA_192_DECRYPT = CRYPT_S390_KM | 0x3 | 0x80,
43 KM_AES_128_ENCRYPT = CRYPT_S390_KM | 0x12,
44 KM_AES_128_DECRYPT = CRYPT_S390_KM | 0x12 | 0x80,
45 KM_AES_192_ENCRYPT = CRYPT_S390_KM | 0x13,
46 KM_AES_192_DECRYPT = CRYPT_S390_KM | 0x13 | 0x80,
47 KM_AES_256_ENCRYPT = CRYPT_S390_KM | 0x14,
48 KM_AES_256_DECRYPT = CRYPT_S390_KM | 0x14 | 0x80,
42}; 49};
43 50
44/*function codes for KMC (CIPHER MESSAGE WITH CHAINING) instruction*/ 51/* function codes for KMC (CIPHER MESSAGE WITH CHAINING)
45enum crypt_z990_kmc_func { 52 * instruction
46 KMC_QUERY = CRYPT_Z990_KMC | 0, 53 */
47 KMC_DEA_ENCRYPT = CRYPT_Z990_KMC | 1, 54enum crypt_s390_kmc_func {
48 KMC_DEA_DECRYPT = CRYPT_Z990_KMC | 1 | 0x80, //modifier bit->decipher 55 KMC_QUERY = CRYPT_S390_KMC | 0x0,
49 KMC_TDEA_128_ENCRYPT = CRYPT_Z990_KMC | 2, 56 KMC_DEA_ENCRYPT = CRYPT_S390_KMC | 0x1,
50 KMC_TDEA_128_DECRYPT = CRYPT_Z990_KMC | 2 | 0x80, 57 KMC_DEA_DECRYPT = CRYPT_S390_KMC | 0x1 | 0x80,
51 KMC_TDEA_192_ENCRYPT = CRYPT_Z990_KMC | 3, 58 KMC_TDEA_128_ENCRYPT = CRYPT_S390_KMC | 0x2,
52 KMC_TDEA_192_DECRYPT = CRYPT_Z990_KMC | 3 | 0x80, 59 KMC_TDEA_128_DECRYPT = CRYPT_S390_KMC | 0x2 | 0x80,
60 KMC_TDEA_192_ENCRYPT = CRYPT_S390_KMC | 0x3,
61 KMC_TDEA_192_DECRYPT = CRYPT_S390_KMC | 0x3 | 0x80,
62 KMC_AES_128_ENCRYPT = CRYPT_S390_KMC | 0x12,
63 KMC_AES_128_DECRYPT = CRYPT_S390_KMC | 0x12 | 0x80,
64 KMC_AES_192_ENCRYPT = CRYPT_S390_KMC | 0x13,
65 KMC_AES_192_DECRYPT = CRYPT_S390_KMC | 0x13 | 0x80,
66 KMC_AES_256_ENCRYPT = CRYPT_S390_KMC | 0x14,
67 KMC_AES_256_DECRYPT = CRYPT_S390_KMC | 0x14 | 0x80,
53}; 68};
54 69
55/*function codes for KIMD (COMPUTE INTERMEDIATE MESSAGE DIGEST) instruction*/ 70/* function codes for KIMD (COMPUTE INTERMEDIATE MESSAGE DIGEST)
56enum crypt_z990_kimd_func { 71 * instruction
57 KIMD_QUERY = CRYPT_Z990_KIMD | 0, 72 */
58 KIMD_SHA_1 = CRYPT_Z990_KIMD | 1, 73enum crypt_s390_kimd_func {
74 KIMD_QUERY = CRYPT_S390_KIMD | 0,
75 KIMD_SHA_1 = CRYPT_S390_KIMD | 1,
76 KIMD_SHA_256 = CRYPT_S390_KIMD | 2,
59}; 77};
60 78
61/*function codes for KLMD (COMPUTE LAST MESSAGE DIGEST) instruction*/ 79/* function codes for KLMD (COMPUTE LAST MESSAGE DIGEST)
62enum crypt_z990_klmd_func { 80 * instruction
63 KLMD_QUERY = CRYPT_Z990_KLMD | 0, 81 */
64 KLMD_SHA_1 = CRYPT_Z990_KLMD | 1, 82enum crypt_s390_klmd_func {
83 KLMD_QUERY = CRYPT_S390_KLMD | 0,
84 KLMD_SHA_1 = CRYPT_S390_KLMD | 1,
85 KLMD_SHA_256 = CRYPT_S390_KLMD | 2,
65}; 86};
66 87
67/*function codes for KMAC (COMPUTE MESSAGE AUTHENTICATION CODE) instruction*/ 88/* function codes for KMAC (COMPUTE MESSAGE AUTHENTICATION CODE)
68enum crypt_z990_kmac_func { 89 * instruction
69 KMAC_QUERY = CRYPT_Z990_KMAC | 0, 90 */
70 KMAC_DEA = CRYPT_Z990_KMAC | 1, 91enum crypt_s390_kmac_func {
71 KMAC_TDEA_128 = CRYPT_Z990_KMAC | 2, 92 KMAC_QUERY = CRYPT_S390_KMAC | 0,
72 KMAC_TDEA_192 = CRYPT_Z990_KMAC | 3 93 KMAC_DEA = CRYPT_S390_KMAC | 1,
94 KMAC_TDEA_128 = CRYPT_S390_KMAC | 2,
95 KMAC_TDEA_192 = CRYPT_S390_KMAC | 3
73}; 96};
74 97
75/*status word for z990 crypto instructions' QUERY functions*/ 98/* status word for s390 crypto instructions' QUERY functions */
76struct crypt_z990_query_status { 99struct crypt_s390_query_status {
77 u64 high; 100 u64 high;
78 u64 low; 101 u64 low;
79}; 102};
80 103
81/* 104/*
82 * Standard fixup and ex_table sections for crypt_z990 inline functions. 105 * Standard fixup and ex_table sections for crypt_s390 inline functions.
83 * label 0: the z990 crypto operation 106 * label 0: the s390 crypto operation
84 * label 1: just after 1 to catch illegal operation exception on non-z990 107 * label 1: just after 1 to catch illegal operation exception
108 * (unsupported model)
85 * label 6: the return point after fixup 109 * label 6: the return point after fixup
86 * label 7: set error value if exception _in_ crypto operation 110 * label 7: set error value if exception _in_ crypto operation
87 * label 8: set error value if illegal operation exception 111 * label 8: set error value if illegal operation exception
88 * [ret] is the variable to receive the error code 112 * [ret] is the variable to receive the error code
89 * [ERR] is the error code value 113 * [ERR] is the error code value
90 */ 114 */
91#ifndef __s390x__ 115#ifndef CONFIG_64BIT
92#define __crypt_z990_fixup \ 116#define __crypt_s390_fixup \
93 ".section .fixup,\"ax\" \n" \ 117 ".section .fixup,\"ax\" \n" \
94 "7: lhi %0,%h[e1] \n" \ 118 "7: lhi %0,%h[e1] \n" \
95 " bras 1,9f \n" \ 119 " bras 1,9f \n" \
@@ -105,8 +129,8 @@ struct crypt_z990_query_status {
105 " .long 0b,7b \n" \ 129 " .long 0b,7b \n" \
106 " .long 1b,8b \n" \ 130 " .long 1b,8b \n" \
107 ".previous" 131 ".previous"
108#else /* __s390x__ */ 132#else /* CONFIG_64BIT */
109#define __crypt_z990_fixup \ 133#define __crypt_s390_fixup \
110 ".section .fixup,\"ax\" \n" \ 134 ".section .fixup,\"ax\" \n" \
111 "7: lhi %0,%h[e1] \n" \ 135 "7: lhi %0,%h[e1] \n" \
112 " jg 6b \n" \ 136 " jg 6b \n" \
@@ -118,25 +142,25 @@ struct crypt_z990_query_status {
118 " .quad 0b,7b \n" \ 142 " .quad 0b,7b \n" \
119 " .quad 1b,8b \n" \ 143 " .quad 1b,8b \n" \
120 ".previous" 144 ".previous"
121#endif /* __s390x__ */ 145#endif /* CONFIG_64BIT */
122 146
123/* 147/*
124 * Standard code for setting the result of z990 crypto instructions. 148 * Standard code for setting the result of s390 crypto instructions.
125 * %0: the register which will receive the result 149 * %0: the register which will receive the result
126 * [result]: the register containing the result (e.g. second operand length 150 * [result]: the register containing the result (e.g. second operand length
127 * to compute number of processed bytes]. 151 * to compute number of processed bytes].
128 */ 152 */
129#ifndef __s390x__ 153#ifndef CONFIG_64BIT
130#define __crypt_z990_set_result \ 154#define __crypt_s390_set_result \
131 " lr %0,%[result] \n" 155 " lr %0,%[result] \n"
132#else /* __s390x__ */ 156#else /* CONFIG_64BIT */
133#define __crypt_z990_set_result \ 157#define __crypt_s390_set_result \
134 " lgr %0,%[result] \n" 158 " lgr %0,%[result] \n"
135#endif 159#endif
136 160
137/* 161/*
138 * Executes the KM (CIPHER MESSAGE) operation of the z990 CPU. 162 * Executes the KM (CIPHER MESSAGE) operation of the CPU.
139 * @param func: the function code passed to KM; see crypt_z990_km_func 163 * @param func: the function code passed to KM; see crypt_s390_km_func
140 * @param param: address of parameter block; see POP for details on each func 164 * @param param: address of parameter block; see POP for details on each func
141 * @param dest: address of destination memory area 165 * @param dest: address of destination memory area
142 * @param src: address of source memory area 166 * @param src: address of source memory area
@@ -145,9 +169,9 @@ struct crypt_z990_query_status {
145 * for encryption/decryption funcs 169 * for encryption/decryption funcs
146 */ 170 */
147static inline int 171static inline int
148crypt_z990_km(long func, void* param, u8* dest, const u8* src, long src_len) 172crypt_s390_km(long func, void* param, u8* dest, const u8* src, long src_len)
149{ 173{
150 register long __func asm("0") = func & CRYPT_Z990_FUNC_MASK; 174 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK;
151 register void* __param asm("1") = param; 175 register void* __param asm("1") = param;
152 register u8* __dest asm("4") = dest; 176 register u8* __dest asm("4") = dest;
153 register const u8* __src asm("2") = src; 177 register const u8* __src asm("2") = src;
@@ -156,26 +180,26 @@ crypt_z990_km(long func, void* param, u8* dest, const u8* src, long src_len)
156 180
157 ret = 0; 181 ret = 0;
158 __asm__ __volatile__ ( 182 __asm__ __volatile__ (
159 "0: .insn rre,0xB92E0000,%1,%2 \n" //KM opcode 183 "0: .insn rre,0xB92E0000,%1,%2 \n" /* KM opcode */
160 "1: brc 1,0b \n" //handle partial completion 184 "1: brc 1,0b \n" /* handle partial completion */
161 __crypt_z990_set_result 185 __crypt_s390_set_result
162 "6: \n" 186 "6: \n"
163 __crypt_z990_fixup 187 __crypt_s390_fixup
164 : "+d" (ret), "+a" (__dest), "+a" (__src), 188 : "+d" (ret), "+a" (__dest), "+a" (__src),
165 [result] "+d" (__src_len) 189 [result] "+d" (__src_len)
166 : [e1] "K" (-EFAULT), [e2] "K" (-ENOSYS), "d" (__func), 190 : [e1] "K" (-EFAULT), [e2] "K" (-ENOSYS), "d" (__func),
167 "a" (__param) 191 "a" (__param)
168 : "cc", "memory" 192 : "cc", "memory"
169 ); 193 );
170 if (ret >= 0 && func & CRYPT_Z990_FUNC_MASK){ 194 if (ret >= 0 && func & CRYPT_S390_FUNC_MASK){
171 ret = src_len - ret; 195 ret = src_len - ret;
172 } 196 }
173 return ret; 197 return ret;
174} 198}
175 199
176/* 200/*
177 * Executes the KMC (CIPHER MESSAGE WITH CHAINING) operation of the z990 CPU. 201 * Executes the KMC (CIPHER MESSAGE WITH CHAINING) operation of the CPU.
178 * @param func: the function code passed to KM; see crypt_z990_kmc_func 202 * @param func: the function code passed to KM; see crypt_s390_kmc_func
179 * @param param: address of parameter block; see POP for details on each func 203 * @param param: address of parameter block; see POP for details on each func
180 * @param dest: address of destination memory area 204 * @param dest: address of destination memory area
181 * @param src: address of source memory area 205 * @param src: address of source memory area
@@ -184,9 +208,9 @@ crypt_z990_km(long func, void* param, u8* dest, const u8* src, long src_len)
184 * for encryption/decryption funcs 208 * for encryption/decryption funcs
185 */ 209 */
186static inline int 210static inline int
187crypt_z990_kmc(long func, void* param, u8* dest, const u8* src, long src_len) 211crypt_s390_kmc(long func, void* param, u8* dest, const u8* src, long src_len)
188{ 212{
189 register long __func asm("0") = func & CRYPT_Z990_FUNC_MASK; 213 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK;
190 register void* __param asm("1") = param; 214 register void* __param asm("1") = param;
191 register u8* __dest asm("4") = dest; 215 register u8* __dest asm("4") = dest;
192 register const u8* __src asm("2") = src; 216 register const u8* __src asm("2") = src;
@@ -195,18 +219,18 @@ crypt_z990_kmc(long func, void* param, u8* dest, const u8* src, long src_len)
195 219
196 ret = 0; 220 ret = 0;
197 __asm__ __volatile__ ( 221 __asm__ __volatile__ (
198 "0: .insn rre,0xB92F0000,%1,%2 \n" //KMC opcode 222 "0: .insn rre,0xB92F0000,%1,%2 \n" /* KMC opcode */
199 "1: brc 1,0b \n" //handle partial completion 223 "1: brc 1,0b \n" /* handle partial completion */
200 __crypt_z990_set_result 224 __crypt_s390_set_result
201 "6: \n" 225 "6: \n"
202 __crypt_z990_fixup 226 __crypt_s390_fixup
203 : "+d" (ret), "+a" (__dest), "+a" (__src), 227 : "+d" (ret), "+a" (__dest), "+a" (__src),
204 [result] "+d" (__src_len) 228 [result] "+d" (__src_len)
205 : [e1] "K" (-EFAULT), [e2] "K" (-ENOSYS), "d" (__func), 229 : [e1] "K" (-EFAULT), [e2] "K" (-ENOSYS), "d" (__func),
206 "a" (__param) 230 "a" (__param)
207 : "cc", "memory" 231 : "cc", "memory"
208 ); 232 );
209 if (ret >= 0 && func & CRYPT_Z990_FUNC_MASK){ 233 if (ret >= 0 && func & CRYPT_S390_FUNC_MASK){
210 ret = src_len - ret; 234 ret = src_len - ret;
211 } 235 }
212 return ret; 236 return ret;
@@ -214,8 +238,8 @@ crypt_z990_kmc(long func, void* param, u8* dest, const u8* src, long src_len)
214 238
215/* 239/*
216 * Executes the KIMD (COMPUTE INTERMEDIATE MESSAGE DIGEST) operation 240 * Executes the KIMD (COMPUTE INTERMEDIATE MESSAGE DIGEST) operation
217 * of the z990 CPU. 241 * of the CPU.
218 * @param func: the function code passed to KM; see crypt_z990_kimd_func 242 * @param func: the function code passed to KM; see crypt_s390_kimd_func
219 * @param param: address of parameter block; see POP for details on each func 243 * @param param: address of parameter block; see POP for details on each func
220 * @param src: address of source memory area 244 * @param src: address of source memory area
221 * @param src_len: length of src operand in bytes 245 * @param src_len: length of src operand in bytes
@@ -223,9 +247,9 @@ crypt_z990_kmc(long func, void* param, u8* dest, const u8* src, long src_len)
223 * for digest funcs 247 * for digest funcs
224 */ 248 */
225static inline int 249static inline int
226crypt_z990_kimd(long func, void* param, const u8* src, long src_len) 250crypt_s390_kimd(long func, void* param, const u8* src, long src_len)
227{ 251{
228 register long __func asm("0") = func & CRYPT_Z990_FUNC_MASK; 252 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK;
229 register void* __param asm("1") = param; 253 register void* __param asm("1") = param;
230 register const u8* __src asm("2") = src; 254 register const u8* __src asm("2") = src;
231 register long __src_len asm("3") = src_len; 255 register long __src_len asm("3") = src_len;
@@ -233,25 +257,25 @@ crypt_z990_kimd(long func, void* param, const u8* src, long src_len)
233 257
234 ret = 0; 258 ret = 0;
235 __asm__ __volatile__ ( 259 __asm__ __volatile__ (
236 "0: .insn rre,0xB93E0000,%1,%1 \n" //KIMD opcode 260 "0: .insn rre,0xB93E0000,%1,%1 \n" /* KIMD opcode */
237 "1: brc 1,0b \n" /*handle partical completion of kimd*/ 261 "1: brc 1,0b \n" /* handle partical completion */
238 __crypt_z990_set_result 262 __crypt_s390_set_result
239 "6: \n" 263 "6: \n"
240 __crypt_z990_fixup 264 __crypt_s390_fixup
241 : "+d" (ret), "+a" (__src), [result] "+d" (__src_len) 265 : "+d" (ret), "+a" (__src), [result] "+d" (__src_len)
242 : [e1] "K" (-EFAULT), [e2] "K" (-ENOSYS), "d" (__func), 266 : [e1] "K" (-EFAULT), [e2] "K" (-ENOSYS), "d" (__func),
243 "a" (__param) 267 "a" (__param)
244 : "cc", "memory" 268 : "cc", "memory"
245 ); 269 );
246 if (ret >= 0 && (func & CRYPT_Z990_FUNC_MASK)){ 270 if (ret >= 0 && (func & CRYPT_S390_FUNC_MASK)){
247 ret = src_len - ret; 271 ret = src_len - ret;
248 } 272 }
249 return ret; 273 return ret;
250} 274}
251 275
252/* 276/*
253 * Executes the KLMD (COMPUTE LAST MESSAGE DIGEST) operation of the z990 CPU. 277 * Executes the KLMD (COMPUTE LAST MESSAGE DIGEST) operation of the CPU.
254 * @param func: the function code passed to KM; see crypt_z990_klmd_func 278 * @param func: the function code passed to KM; see crypt_s390_klmd_func
255 * @param param: address of parameter block; see POP for details on each func 279 * @param param: address of parameter block; see POP for details on each func
256 * @param src: address of source memory area 280 * @param src: address of source memory area
257 * @param src_len: length of src operand in bytes 281 * @param src_len: length of src operand in bytes
@@ -259,9 +283,9 @@ crypt_z990_kimd(long func, void* param, const u8* src, long src_len)
259 * for digest funcs 283 * for digest funcs
260 */ 284 */
261static inline int 285static inline int
262crypt_z990_klmd(long func, void* param, const u8* src, long src_len) 286crypt_s390_klmd(long func, void* param, const u8* src, long src_len)
263{ 287{
264 register long __func asm("0") = func & CRYPT_Z990_FUNC_MASK; 288 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK;
265 register void* __param asm("1") = param; 289 register void* __param asm("1") = param;
266 register const u8* __src asm("2") = src; 290 register const u8* __src asm("2") = src;
267 register long __src_len asm("3") = src_len; 291 register long __src_len asm("3") = src_len;
@@ -269,17 +293,17 @@ crypt_z990_klmd(long func, void* param, const u8* src, long src_len)
269 293
270 ret = 0; 294 ret = 0;
271 __asm__ __volatile__ ( 295 __asm__ __volatile__ (
272 "0: .insn rre,0xB93F0000,%1,%1 \n" //KLMD opcode 296 "0: .insn rre,0xB93F0000,%1,%1 \n" /* KLMD opcode */
273 "1: brc 1,0b \n" /*handle partical completion of klmd*/ 297 "1: brc 1,0b \n" /* handle partical completion */
274 __crypt_z990_set_result 298 __crypt_s390_set_result
275 "6: \n" 299 "6: \n"
276 __crypt_z990_fixup 300 __crypt_s390_fixup
277 : "+d" (ret), "+a" (__src), [result] "+d" (__src_len) 301 : "+d" (ret), "+a" (__src), [result] "+d" (__src_len)
278 : [e1] "K" (-EFAULT), [e2] "K" (-ENOSYS), "d" (__func), 302 : [e1] "K" (-EFAULT), [e2] "K" (-ENOSYS), "d" (__func),
279 "a" (__param) 303 "a" (__param)
280 : "cc", "memory" 304 : "cc", "memory"
281 ); 305 );
282 if (ret >= 0 && func & CRYPT_Z990_FUNC_MASK){ 306 if (ret >= 0 && func & CRYPT_S390_FUNC_MASK){
283 ret = src_len - ret; 307 ret = src_len - ret;
284 } 308 }
285 return ret; 309 return ret;
@@ -287,8 +311,8 @@ crypt_z990_klmd(long func, void* param, const u8* src, long src_len)
287 311
288/* 312/*
289 * Executes the KMAC (COMPUTE MESSAGE AUTHENTICATION CODE) operation 313 * Executes the KMAC (COMPUTE MESSAGE AUTHENTICATION CODE) operation
290 * of the z990 CPU. 314 * of the CPU.
291 * @param func: the function code passed to KM; see crypt_z990_klmd_func 315 * @param func: the function code passed to KM; see crypt_s390_klmd_func
292 * @param param: address of parameter block; see POP for details on each func 316 * @param param: address of parameter block; see POP for details on each func
293 * @param src: address of source memory area 317 * @param src: address of source memory area
294 * @param src_len: length of src operand in bytes 318 * @param src_len: length of src operand in bytes
@@ -296,9 +320,9 @@ crypt_z990_klmd(long func, void* param, const u8* src, long src_len)
296 * for digest funcs 320 * for digest funcs
297 */ 321 */
298static inline int 322static inline int
299crypt_z990_kmac(long func, void* param, const u8* src, long src_len) 323crypt_s390_kmac(long func, void* param, const u8* src, long src_len)
300{ 324{
301 register long __func asm("0") = func & CRYPT_Z990_FUNC_MASK; 325 register long __func asm("0") = func & CRYPT_S390_FUNC_MASK;
302 register void* __param asm("1") = param; 326 register void* __param asm("1") = param;
303 register const u8* __src asm("2") = src; 327 register const u8* __src asm("2") = src;
304 register long __src_len asm("3") = src_len; 328 register long __src_len asm("3") = src_len;
@@ -306,58 +330,58 @@ crypt_z990_kmac(long func, void* param, const u8* src, long src_len)
306 330
307 ret = 0; 331 ret = 0;
308 __asm__ __volatile__ ( 332 __asm__ __volatile__ (
309 "0: .insn rre,0xB91E0000,%5,%5 \n" //KMAC opcode 333 "0: .insn rre,0xB91E0000,%5,%5 \n" /* KMAC opcode */
310 "1: brc 1,0b \n" /*handle partical completion of klmd*/ 334 "1: brc 1,0b \n" /* handle partical completion */
311 __crypt_z990_set_result 335 __crypt_s390_set_result
312 "6: \n" 336 "6: \n"
313 __crypt_z990_fixup 337 __crypt_s390_fixup
314 : "+d" (ret), "+a" (__src), [result] "+d" (__src_len) 338 : "+d" (ret), "+a" (__src), [result] "+d" (__src_len)
315 : [e1] "K" (-EFAULT), [e2] "K" (-ENOSYS), "d" (__func), 339 : [e1] "K" (-EFAULT), [e2] "K" (-ENOSYS), "d" (__func),
316 "a" (__param) 340 "a" (__param)
317 : "cc", "memory" 341 : "cc", "memory"
318 ); 342 );
319 if (ret >= 0 && func & CRYPT_Z990_FUNC_MASK){ 343 if (ret >= 0 && func & CRYPT_S390_FUNC_MASK){
320 ret = src_len - ret; 344 ret = src_len - ret;
321 } 345 }
322 return ret; 346 return ret;
323} 347}
324 348
325/** 349/**
326 * Tests if a specific z990 crypto function is implemented on the machine. 350 * Tests if a specific crypto function is implemented on the machine.
327 * @param func: the function code of the specific function; 0 if op in general 351 * @param func: the function code of the specific function; 0 if op in general
328 * @return 1 if func available; 0 if func or op in general not available 352 * @return 1 if func available; 0 if func or op in general not available
329 */ 353 */
330static inline int 354static inline int
331crypt_z990_func_available(int func) 355crypt_s390_func_available(int func)
332{ 356{
333 int ret; 357 int ret;
334 358
335 struct crypt_z990_query_status status = { 359 struct crypt_s390_query_status status = {
336 .high = 0, 360 .high = 0,
337 .low = 0 361 .low = 0
338 }; 362 };
339 switch (func & CRYPT_Z990_OP_MASK){ 363 switch (func & CRYPT_S390_OP_MASK){
340 case CRYPT_Z990_KM: 364 case CRYPT_S390_KM:
341 ret = crypt_z990_km(KM_QUERY, &status, NULL, NULL, 0); 365 ret = crypt_s390_km(KM_QUERY, &status, NULL, NULL, 0);
342 break; 366 break;
343 case CRYPT_Z990_KMC: 367 case CRYPT_S390_KMC:
344 ret = crypt_z990_kmc(KMC_QUERY, &status, NULL, NULL, 0); 368 ret = crypt_s390_kmc(KMC_QUERY, &status, NULL, NULL, 0);
345 break; 369 break;
346 case CRYPT_Z990_KIMD: 370 case CRYPT_S390_KIMD:
347 ret = crypt_z990_kimd(KIMD_QUERY, &status, NULL, 0); 371 ret = crypt_s390_kimd(KIMD_QUERY, &status, NULL, 0);
348 break; 372 break;
349 case CRYPT_Z990_KLMD: 373 case CRYPT_S390_KLMD:
350 ret = crypt_z990_klmd(KLMD_QUERY, &status, NULL, 0); 374 ret = crypt_s390_klmd(KLMD_QUERY, &status, NULL, 0);
351 break; 375 break;
352 case CRYPT_Z990_KMAC: 376 case CRYPT_S390_KMAC:
353 ret = crypt_z990_kmac(KMAC_QUERY, &status, NULL, 0); 377 ret = crypt_s390_kmac(KMAC_QUERY, &status, NULL, 0);
354 break; 378 break;
355 default: 379 default:
356 ret = 0; 380 ret = 0;
357 return ret; 381 return ret;
358 } 382 }
359 if (ret >= 0){ 383 if (ret >= 0){
360 func &= CRYPT_Z990_FUNC_MASK; 384 func &= CRYPT_S390_FUNC_MASK;
361 func &= 0x7f; //mask modifier bit 385 func &= 0x7f; //mask modifier bit
362 if (func < 64){ 386 if (func < 64){
363 ret = (status.high >> (64 - func - 1)) & 0x1; 387 ret = (status.high >> (64 - func - 1)) & 0x1;
@@ -370,5 +394,4 @@ crypt_z990_func_available(int func)
370 return ret; 394 return ret;
371} 395}
372 396
373 397#endif // _CRYPTO_ARCH_S390_CRYPT_S390_H
374#endif // _CRYPTO_ARCH_S390_CRYPT_Z990_H
diff --git a/arch/s390/crypto/crypt_s390_query.c b/arch/s390/crypto/crypt_s390_query.c
new file mode 100644
index 000000000000..def02bdc44a4
--- /dev/null
+++ b/arch/s390/crypto/crypt_s390_query.c
@@ -0,0 +1,129 @@
1/*
2 * Cryptographic API.
3 *
4 * Support for s390 cryptographic instructions.
5 * Testing module for querying processor crypto capabilities.
6 *
7 * Copyright (c) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
8 * Author(s): Thomas Spatzier (tspat@de.ibm.com)
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version.
14 *
15 */
16#include <linux/module.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <asm/errno.h>
20#include "crypt_s390.h"
21
22static void query_available_functions(void)
23{
24 printk(KERN_INFO "#####################\n");
25
26 /* query available KM functions */
27 printk(KERN_INFO "KM_QUERY: %d\n",
28 crypt_s390_func_available(KM_QUERY));
29 printk(KERN_INFO "KM_DEA: %d\n",
30 crypt_s390_func_available(KM_DEA_ENCRYPT));
31 printk(KERN_INFO "KM_TDEA_128: %d\n",
32 crypt_s390_func_available(KM_TDEA_128_ENCRYPT));
33 printk(KERN_INFO "KM_TDEA_192: %d\n",
34 crypt_s390_func_available(KM_TDEA_192_ENCRYPT));
35 printk(KERN_INFO "KM_AES_128: %d\n",
36 crypt_s390_func_available(KM_AES_128_ENCRYPT));
37 printk(KERN_INFO "KM_AES_192: %d\n",
38 crypt_s390_func_available(KM_AES_192_ENCRYPT));
39 printk(KERN_INFO "KM_AES_256: %d\n",
40 crypt_s390_func_available(KM_AES_256_ENCRYPT));
41
42 /* query available KMC functions */
43 printk(KERN_INFO "KMC_QUERY: %d\n",
44 crypt_s390_func_available(KMC_QUERY));
45 printk(KERN_INFO "KMC_DEA: %d\n",
46 crypt_s390_func_available(KMC_DEA_ENCRYPT));
47 printk(KERN_INFO "KMC_TDEA_128: %d\n",
48 crypt_s390_func_available(KMC_TDEA_128_ENCRYPT));
49 printk(KERN_INFO "KMC_TDEA_192: %d\n",
50 crypt_s390_func_available(KMC_TDEA_192_ENCRYPT));
51 printk(KERN_INFO "KMC_AES_128: %d\n",
52 crypt_s390_func_available(KMC_AES_128_ENCRYPT));
53 printk(KERN_INFO "KMC_AES_192: %d\n",
54 crypt_s390_func_available(KMC_AES_192_ENCRYPT));
55 printk(KERN_INFO "KMC_AES_256: %d\n",
56 crypt_s390_func_available(KMC_AES_256_ENCRYPT));
57
58 /* query available KIMD fucntions */
59 printk(KERN_INFO "KIMD_QUERY: %d\n",
60 crypt_s390_func_available(KIMD_QUERY));
61 printk(KERN_INFO "KIMD_SHA_1: %d\n",
62 crypt_s390_func_available(KIMD_SHA_1));
63 printk(KERN_INFO "KIMD_SHA_256: %d\n",
64 crypt_s390_func_available(KIMD_SHA_256));
65
66 /* query available KLMD functions */
67 printk(KERN_INFO "KLMD_QUERY: %d\n",
68 crypt_s390_func_available(KLMD_QUERY));
69 printk(KERN_INFO "KLMD_SHA_1: %d\n",
70 crypt_s390_func_available(KLMD_SHA_1));
71 printk(KERN_INFO "KLMD_SHA_256: %d\n",
72 crypt_s390_func_available(KLMD_SHA_256));
73
74 /* query available KMAC functions */
75 printk(KERN_INFO "KMAC_QUERY: %d\n",
76 crypt_s390_func_available(KMAC_QUERY));
77 printk(KERN_INFO "KMAC_DEA: %d\n",
78 crypt_s390_func_available(KMAC_DEA));
79 printk(KERN_INFO "KMAC_TDEA_128: %d\n",
80 crypt_s390_func_available(KMAC_TDEA_128));
81 printk(KERN_INFO "KMAC_TDEA_192: %d\n",
82 crypt_s390_func_available(KMAC_TDEA_192));
83}
84
85static int init(void)
86{
87 struct crypt_s390_query_status status = {
88 .high = 0,
89 .low = 0
90 };
91
92 printk(KERN_INFO "crypt_s390: querying available crypto functions\n");
93 crypt_s390_km(KM_QUERY, &status, NULL, NULL, 0);
94 printk(KERN_INFO "KM:\t%016llx %016llx\n",
95 (unsigned long long) status.high,
96 (unsigned long long) status.low);
97 status.high = status.low = 0;
98 crypt_s390_kmc(KMC_QUERY, &status, NULL, NULL, 0);
99 printk(KERN_INFO "KMC:\t%016llx %016llx\n",
100 (unsigned long long) status.high,
101 (unsigned long long) status.low);
102 status.high = status.low = 0;
103 crypt_s390_kimd(KIMD_QUERY, &status, NULL, 0);
104 printk(KERN_INFO "KIMD:\t%016llx %016llx\n",
105 (unsigned long long) status.high,
106 (unsigned long long) status.low);
107 status.high = status.low = 0;
108 crypt_s390_klmd(KLMD_QUERY, &status, NULL, 0);
109 printk(KERN_INFO "KLMD:\t%016llx %016llx\n",
110 (unsigned long long) status.high,
111 (unsigned long long) status.low);
112 status.high = status.low = 0;
113 crypt_s390_kmac(KMAC_QUERY, &status, NULL, 0);
114 printk(KERN_INFO "KMAC:\t%016llx %016llx\n",
115 (unsigned long long) status.high,
116 (unsigned long long) status.low);
117
118 query_available_functions();
119 return -ECANCELED;
120}
121
122static void __exit cleanup(void)
123{
124}
125
126module_init(init);
127module_exit(cleanup);
128
129MODULE_LICENSE("GPL");
diff --git a/arch/s390/crypto/crypt_z990_query.c b/arch/s390/crypto/crypt_z990_query.c
deleted file mode 100644
index 7133983d1384..000000000000
--- a/arch/s390/crypto/crypt_z990_query.c
+++ /dev/null
@@ -1,111 +0,0 @@
1/*
2 * Cryptographic API.
3 *
4 * Support for z990 cryptographic instructions.
5 * Testing module for querying processor crypto capabilities.
6 *
7 * Copyright (c) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
8 * Author(s): Thomas Spatzier (tspat@de.ibm.com)
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the Free
12 * Software Foundation; either version 2 of the License, or (at your option)
13 * any later version.
14 *
15 */
16#include <linux/module.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <asm/errno.h>
20#include "crypt_z990.h"
21
22static void
23query_available_functions(void)
24{
25 printk(KERN_INFO "#####################\n");
26 //query available KM functions
27 printk(KERN_INFO "KM_QUERY: %d\n",
28 crypt_z990_func_available(KM_QUERY));
29 printk(KERN_INFO "KM_DEA: %d\n",
30 crypt_z990_func_available(KM_DEA_ENCRYPT));
31 printk(KERN_INFO "KM_TDEA_128: %d\n",
32 crypt_z990_func_available(KM_TDEA_128_ENCRYPT));
33 printk(KERN_INFO "KM_TDEA_192: %d\n",
34 crypt_z990_func_available(KM_TDEA_192_ENCRYPT));
35 //query available KMC functions
36 printk(KERN_INFO "KMC_QUERY: %d\n",
37 crypt_z990_func_available(KMC_QUERY));
38 printk(KERN_INFO "KMC_DEA: %d\n",
39 crypt_z990_func_available(KMC_DEA_ENCRYPT));
40 printk(KERN_INFO "KMC_TDEA_128: %d\n",
41 crypt_z990_func_available(KMC_TDEA_128_ENCRYPT));
42 printk(KERN_INFO "KMC_TDEA_192: %d\n",
43 crypt_z990_func_available(KMC_TDEA_192_ENCRYPT));
44 //query available KIMD fucntions
45 printk(KERN_INFO "KIMD_QUERY: %d\n",
46 crypt_z990_func_available(KIMD_QUERY));
47 printk(KERN_INFO "KIMD_SHA_1: %d\n",
48 crypt_z990_func_available(KIMD_SHA_1));
49 //query available KLMD functions
50 printk(KERN_INFO "KLMD_QUERY: %d\n",
51 crypt_z990_func_available(KLMD_QUERY));
52 printk(KERN_INFO "KLMD_SHA_1: %d\n",
53 crypt_z990_func_available(KLMD_SHA_1));
54 //query available KMAC functions
55 printk(KERN_INFO "KMAC_QUERY: %d\n",
56 crypt_z990_func_available(KMAC_QUERY));
57 printk(KERN_INFO "KMAC_DEA: %d\n",
58 crypt_z990_func_available(KMAC_DEA));
59 printk(KERN_INFO "KMAC_TDEA_128: %d\n",
60 crypt_z990_func_available(KMAC_TDEA_128));
61 printk(KERN_INFO "KMAC_TDEA_192: %d\n",
62 crypt_z990_func_available(KMAC_TDEA_192));
63}
64
65static int
66init(void)
67{
68 struct crypt_z990_query_status status = {
69 .high = 0,
70 .low = 0
71 };
72
73 printk(KERN_INFO "crypt_z990: querying available crypto functions\n");
74 crypt_z990_km(KM_QUERY, &status, NULL, NULL, 0);
75 printk(KERN_INFO "KM: %016llx %016llx\n",
76 (unsigned long long) status.high,
77 (unsigned long long) status.low);
78 status.high = status.low = 0;
79 crypt_z990_kmc(KMC_QUERY, &status, NULL, NULL, 0);
80 printk(KERN_INFO "KMC: %016llx %016llx\n",
81 (unsigned long long) status.high,
82 (unsigned long long) status.low);
83 status.high = status.low = 0;
84 crypt_z990_kimd(KIMD_QUERY, &status, NULL, 0);
85 printk(KERN_INFO "KIMD: %016llx %016llx\n",
86 (unsigned long long) status.high,
87 (unsigned long long) status.low);
88 status.high = status.low = 0;
89 crypt_z990_klmd(KLMD_QUERY, &status, NULL, 0);
90 printk(KERN_INFO "KLMD: %016llx %016llx\n",
91 (unsigned long long) status.high,
92 (unsigned long long) status.low);
93 status.high = status.low = 0;
94 crypt_z990_kmac(KMAC_QUERY, &status, NULL, 0);
95 printk(KERN_INFO "KMAC: %016llx %016llx\n",
96 (unsigned long long) status.high,
97 (unsigned long long) status.low);
98
99 query_available_functions();
100 return -1;
101}
102
103static void __exit
104cleanup(void)
105{
106}
107
108module_init(init);
109module_exit(cleanup);
110
111MODULE_LICENSE("GPL");
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
new file mode 100644
index 000000000000..e3c37aa0a199
--- /dev/null
+++ b/arch/s390/crypto/des_s390.c
@@ -0,0 +1,466 @@
1/*
2 * Cryptographic API.
3 *
4 * s390 implementation of the DES Cipher Algorithm.
5 *
6 * Copyright (c) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Thomas Spatzier (tspat@de.ibm.com)
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 */
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/crypto.h>
19
20#include "crypt_s390.h"
21#include "crypto_des.h"
22
23#define DES_BLOCK_SIZE 8
24#define DES_KEY_SIZE 8
25
26#define DES3_128_KEY_SIZE (2 * DES_KEY_SIZE)
27#define DES3_128_BLOCK_SIZE DES_BLOCK_SIZE
28
29#define DES3_192_KEY_SIZE (3 * DES_KEY_SIZE)
30#define DES3_192_BLOCK_SIZE DES_BLOCK_SIZE
31
32struct crypt_s390_des_ctx {
33 u8 iv[DES_BLOCK_SIZE];
34 u8 key[DES_KEY_SIZE];
35};
36
37struct crypt_s390_des3_128_ctx {
38 u8 iv[DES_BLOCK_SIZE];
39 u8 key[DES3_128_KEY_SIZE];
40};
41
42struct crypt_s390_des3_192_ctx {
43 u8 iv[DES_BLOCK_SIZE];
44 u8 key[DES3_192_KEY_SIZE];
45};
46
47static int des_setkey(void *ctx, const u8 *key, unsigned int keylen,
48 u32 *flags)
49{
50 struct crypt_s390_des_ctx *dctx = ctx;
51 int ret;
52
53 /* test if key is valid (not a weak key) */
54 ret = crypto_des_check_key(key, keylen, flags);
55 if (ret == 0)
56 memcpy(dctx->key, key, keylen);
57 return ret;
58}
59
60static void des_encrypt(void *ctx, u8 *out, const u8 *in)
61{
62 struct crypt_s390_des_ctx *dctx = ctx;
63
64 crypt_s390_km(KM_DEA_ENCRYPT, dctx->key, out, in, DES_BLOCK_SIZE);
65}
66
67static void des_decrypt(void *ctx, u8 *out, const u8 *in)
68{
69 struct crypt_s390_des_ctx *dctx = ctx;
70
71 crypt_s390_km(KM_DEA_DECRYPT, dctx->key, out, in, DES_BLOCK_SIZE);
72}
73
74static unsigned int des_encrypt_ecb(const struct cipher_desc *desc, u8 *out,
75 const u8 *in, unsigned int nbytes)
76{
77 struct crypt_s390_des_ctx *sctx = crypto_tfm_ctx(desc->tfm);
78 int ret;
79
80 /* only use complete blocks */
81 nbytes &= ~(DES_BLOCK_SIZE - 1);
82 ret = crypt_s390_km(KM_DEA_ENCRYPT, sctx->key, out, in, nbytes);
83 BUG_ON((ret < 0) || (ret != nbytes));
84
85 return nbytes;
86}
87
88static unsigned int des_decrypt_ecb(const struct cipher_desc *desc, u8 *out,
89 const u8 *in, unsigned int nbytes)
90{
91 struct crypt_s390_des_ctx *sctx = crypto_tfm_ctx(desc->tfm);
92 int ret;
93
94 /* only use complete blocks */
95 nbytes &= ~(DES_BLOCK_SIZE - 1);
96 ret = crypt_s390_km(KM_DEA_DECRYPT, sctx->key, out, in, nbytes);
97 BUG_ON((ret < 0) || (ret != nbytes));
98
99 return nbytes;
100}
101
102static unsigned int des_encrypt_cbc(const struct cipher_desc *desc, u8 *out,
103 const u8 *in, unsigned int nbytes)
104{
105 struct crypt_s390_des_ctx *sctx = crypto_tfm_ctx(desc->tfm);
106 int ret;
107
108 /* only use complete blocks */
109 nbytes &= ~(DES_BLOCK_SIZE - 1);
110
111 memcpy(sctx->iv, desc->info, DES_BLOCK_SIZE);
112 ret = crypt_s390_kmc(KMC_DEA_ENCRYPT, &sctx->iv, out, in, nbytes);
113 BUG_ON((ret < 0) || (ret != nbytes));
114
115 memcpy(desc->info, sctx->iv, DES_BLOCK_SIZE);
116 return nbytes;
117}
118
119static unsigned int des_decrypt_cbc(const struct cipher_desc *desc, u8 *out,
120 const u8 *in, unsigned int nbytes)
121{
122 struct crypt_s390_des_ctx *sctx = crypto_tfm_ctx(desc->tfm);
123 int ret;
124
125 /* only use complete blocks */
126 nbytes &= ~(DES_BLOCK_SIZE - 1);
127
128 memcpy(&sctx->iv, desc->info, DES_BLOCK_SIZE);
129 ret = crypt_s390_kmc(KMC_DEA_DECRYPT, &sctx->iv, out, in, nbytes);
130 BUG_ON((ret < 0) || (ret != nbytes));
131
132 return nbytes;
133}
134
135static struct crypto_alg des_alg = {
136 .cra_name = "des",
137 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
138 .cra_blocksize = DES_BLOCK_SIZE,
139 .cra_ctxsize = sizeof(struct crypt_s390_des_ctx),
140 .cra_module = THIS_MODULE,
141 .cra_list = LIST_HEAD_INIT(des_alg.cra_list),
142 .cra_u = {
143 .cipher = {
144 .cia_min_keysize = DES_KEY_SIZE,
145 .cia_max_keysize = DES_KEY_SIZE,
146 .cia_setkey = des_setkey,
147 .cia_encrypt = des_encrypt,
148 .cia_decrypt = des_decrypt,
149 .cia_encrypt_ecb = des_encrypt_ecb,
150 .cia_decrypt_ecb = des_decrypt_ecb,
151 .cia_encrypt_cbc = des_encrypt_cbc,
152 .cia_decrypt_cbc = des_decrypt_cbc,
153 }
154 }
155};
156
157/*
158 * RFC2451:
159 *
160 * For DES-EDE3, there is no known need to reject weak or
161 * complementation keys. Any weakness is obviated by the use of
162 * multiple keys.
163 *
164 * However, if the two independent 64-bit keys are equal,
165 * then the DES3 operation is simply the same as DES.
166 * Implementers MUST reject keys that exhibit this property.
167 *
168 */
169static int des3_128_setkey(void *ctx, const u8 *key, unsigned int keylen,
170 u32 *flags)
171{
172 int i, ret;
173 struct crypt_s390_des3_128_ctx *dctx = ctx;
174 const u8* temp_key = key;
175
176 if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE))) {
177 *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED;
178 return -EINVAL;
179 }
180 for (i = 0; i < 2; i++, temp_key += DES_KEY_SIZE) {
181 ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags);
182 if (ret < 0)
183 return ret;
184 }
185 memcpy(dctx->key, key, keylen);
186 return 0;
187}
188
189static void des3_128_encrypt(void *ctx, u8 *dst, const u8 *src)
190{
191 struct crypt_s390_des3_128_ctx *dctx = ctx;
192
193 crypt_s390_km(KM_TDEA_128_ENCRYPT, dctx->key, dst, (void*)src,
194 DES3_128_BLOCK_SIZE);
195}
196
197static void des3_128_decrypt(void *ctx, u8 *dst, const u8 *src)
198{
199 struct crypt_s390_des3_128_ctx *dctx = ctx;
200
201 crypt_s390_km(KM_TDEA_128_DECRYPT, dctx->key, dst, (void*)src,
202 DES3_128_BLOCK_SIZE);
203}
204
205static unsigned int des3_128_encrypt_ecb(const struct cipher_desc *desc,
206 u8 *out, const u8 *in,
207 unsigned int nbytes)
208{
209 struct crypt_s390_des3_128_ctx *sctx = crypto_tfm_ctx(desc->tfm);
210 int ret;
211
212 /* only use complete blocks */
213 nbytes &= ~(DES3_128_BLOCK_SIZE - 1);
214 ret = crypt_s390_km(KM_TDEA_128_ENCRYPT, sctx->key, out, in, nbytes);
215 BUG_ON((ret < 0) || (ret != nbytes));
216
217 return nbytes;
218}
219
220static unsigned int des3_128_decrypt_ecb(const struct cipher_desc *desc,
221 u8 *out, const u8 *in,
222 unsigned int nbytes)
223{
224 struct crypt_s390_des3_128_ctx *sctx = crypto_tfm_ctx(desc->tfm);
225 int ret;
226
227 /* only use complete blocks */
228 nbytes &= ~(DES3_128_BLOCK_SIZE - 1);
229 ret = crypt_s390_km(KM_TDEA_128_DECRYPT, sctx->key, out, in, nbytes);
230 BUG_ON((ret < 0) || (ret != nbytes));
231
232 return nbytes;
233}
234
235static unsigned int des3_128_encrypt_cbc(const struct cipher_desc *desc,
236 u8 *out, const u8 *in,
237 unsigned int nbytes)
238{
239 struct crypt_s390_des3_128_ctx *sctx = crypto_tfm_ctx(desc->tfm);
240 int ret;
241
242 /* only use complete blocks */
243 nbytes &= ~(DES3_128_BLOCK_SIZE - 1);
244
245 memcpy(sctx->iv, desc->info, DES3_128_BLOCK_SIZE);
246 ret = crypt_s390_kmc(KMC_TDEA_128_ENCRYPT, &sctx->iv, out, in, nbytes);
247 BUG_ON((ret < 0) || (ret != nbytes));
248
249 memcpy(desc->info, sctx->iv, DES3_128_BLOCK_SIZE);
250 return nbytes;
251}
252
253static unsigned int des3_128_decrypt_cbc(const struct cipher_desc *desc,
254 u8 *out, const u8 *in,
255 unsigned int nbytes)
256{
257 struct crypt_s390_des3_128_ctx *sctx = crypto_tfm_ctx(desc->tfm);
258 int ret;
259
260 /* only use complete blocks */
261 nbytes &= ~(DES3_128_BLOCK_SIZE - 1);
262
263 memcpy(&sctx->iv, desc->info, DES3_128_BLOCK_SIZE);
264 ret = crypt_s390_kmc(KMC_TDEA_128_DECRYPT, &sctx->iv, out, in, nbytes);
265 BUG_ON((ret < 0) || (ret != nbytes));
266
267 return nbytes;
268}
269
270static struct crypto_alg des3_128_alg = {
271 .cra_name = "des3_ede128",
272 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
273 .cra_blocksize = DES3_128_BLOCK_SIZE,
274 .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx),
275 .cra_module = THIS_MODULE,
276 .cra_list = LIST_HEAD_INIT(des3_128_alg.cra_list),
277 .cra_u = {
278 .cipher = {
279 .cia_min_keysize = DES3_128_KEY_SIZE,
280 .cia_max_keysize = DES3_128_KEY_SIZE,
281 .cia_setkey = des3_128_setkey,
282 .cia_encrypt = des3_128_encrypt,
283 .cia_decrypt = des3_128_decrypt,
284 .cia_encrypt_ecb = des3_128_encrypt_ecb,
285 .cia_decrypt_ecb = des3_128_decrypt_ecb,
286 .cia_encrypt_cbc = des3_128_encrypt_cbc,
287 .cia_decrypt_cbc = des3_128_decrypt_cbc,
288 }
289 }
290};
291
292/*
293 * RFC2451:
294 *
295 * For DES-EDE3, there is no known need to reject weak or
296 * complementation keys. Any weakness is obviated by the use of
297 * multiple keys.
298 *
299 * However, if the first two or last two independent 64-bit keys are
300 * equal (k1 == k2 or k2 == k3), then the DES3 operation is simply the
301 * same as DES. Implementers MUST reject keys that exhibit this
302 * property.
303 *
304 */
305static int des3_192_setkey(void *ctx, const u8 *key, unsigned int keylen,
306 u32 *flags)
307{
308 int i, ret;
309 struct crypt_s390_des3_192_ctx *dctx = ctx;
310 const u8* temp_key = key;
311
312 if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) &&
313 memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2],
314 DES_KEY_SIZE))) {
315
316 *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED;
317 return -EINVAL;
318 }
319 for (i = 0; i < 3; i++, temp_key += DES_KEY_SIZE) {
320 ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags);
321 if (ret < 0)
322 return ret;
323 }
324 memcpy(dctx->key, key, keylen);
325 return 0;
326}
327
328static void des3_192_encrypt(void *ctx, u8 *dst, const u8 *src)
329{
330 struct crypt_s390_des3_192_ctx *dctx = ctx;
331
332 crypt_s390_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src,
333 DES3_192_BLOCK_SIZE);
334}
335
336static void des3_192_decrypt(void *ctx, u8 *dst, const u8 *src)
337{
338 struct crypt_s390_des3_192_ctx *dctx = ctx;
339
340 crypt_s390_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src,
341 DES3_192_BLOCK_SIZE);
342}
343
344static unsigned int des3_192_encrypt_ecb(const struct cipher_desc *desc,
345 u8 *out, const u8 *in,
346 unsigned int nbytes)
347{
348 struct crypt_s390_des3_192_ctx *sctx = crypto_tfm_ctx(desc->tfm);
349 int ret;
350
351 /* only use complete blocks */
352 nbytes &= ~(DES3_192_BLOCK_SIZE - 1);
353 ret = crypt_s390_km(KM_TDEA_192_ENCRYPT, sctx->key, out, in, nbytes);
354 BUG_ON((ret < 0) || (ret != nbytes));
355
356 return nbytes;
357}
358
359static unsigned int des3_192_decrypt_ecb(const struct cipher_desc *desc,
360 u8 *out, const u8 *in,
361 unsigned int nbytes)
362{
363 struct crypt_s390_des3_192_ctx *sctx = crypto_tfm_ctx(desc->tfm);
364 int ret;
365
366 /* only use complete blocks */
367 nbytes &= ~(DES3_192_BLOCK_SIZE - 1);
368 ret = crypt_s390_km(KM_TDEA_192_DECRYPT, sctx->key, out, in, nbytes);
369 BUG_ON((ret < 0) || (ret != nbytes));
370
371 return nbytes;
372}
373
374static unsigned int des3_192_encrypt_cbc(const struct cipher_desc *desc,
375 u8 *out, const u8 *in,
376 unsigned int nbytes)
377{
378 struct crypt_s390_des3_192_ctx *sctx = crypto_tfm_ctx(desc->tfm);
379 int ret;
380
381 /* only use complete blocks */
382 nbytes &= ~(DES3_192_BLOCK_SIZE - 1);
383
384 memcpy(sctx->iv, desc->info, DES3_192_BLOCK_SIZE);
385 ret = crypt_s390_kmc(KMC_TDEA_192_ENCRYPT, &sctx->iv, out, in, nbytes);
386 BUG_ON((ret < 0) || (ret != nbytes));
387
388 memcpy(desc->info, sctx->iv, DES3_192_BLOCK_SIZE);
389 return nbytes;
390}
391
392static unsigned int des3_192_decrypt_cbc(const struct cipher_desc *desc,
393 u8 *out, const u8 *in,
394 unsigned int nbytes)
395{
396 struct crypt_s390_des3_192_ctx *sctx = crypto_tfm_ctx(desc->tfm);
397 int ret;
398
399 /* only use complete blocks */
400 nbytes &= ~(DES3_192_BLOCK_SIZE - 1);
401
402 memcpy(&sctx->iv, desc->info, DES3_192_BLOCK_SIZE);
403 ret = crypt_s390_kmc(KMC_TDEA_192_DECRYPT, &sctx->iv, out, in, nbytes);
404 BUG_ON((ret < 0) || (ret != nbytes));
405
406 return nbytes;
407}
408
409static struct crypto_alg des3_192_alg = {
410 .cra_name = "des3_ede",
411 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
412 .cra_blocksize = DES3_192_BLOCK_SIZE,
413 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx),
414 .cra_module = THIS_MODULE,
415 .cra_list = LIST_HEAD_INIT(des3_192_alg.cra_list),
416 .cra_u = {
417 .cipher = {
418 .cia_min_keysize = DES3_192_KEY_SIZE,
419 .cia_max_keysize = DES3_192_KEY_SIZE,
420 .cia_setkey = des3_192_setkey,
421 .cia_encrypt = des3_192_encrypt,
422 .cia_decrypt = des3_192_decrypt,
423 .cia_encrypt_ecb = des3_192_encrypt_ecb,
424 .cia_decrypt_ecb = des3_192_decrypt_ecb,
425 .cia_encrypt_cbc = des3_192_encrypt_cbc,
426 .cia_decrypt_cbc = des3_192_decrypt_cbc,
427 }
428 }
429};
430
431static int init(void)
432{
433 int ret = 0;
434
435 if (!crypt_s390_func_available(KM_DEA_ENCRYPT) ||
436 !crypt_s390_func_available(KM_TDEA_128_ENCRYPT) ||
437 !crypt_s390_func_available(KM_TDEA_192_ENCRYPT))
438 return -ENOSYS;
439
440 ret |= (crypto_register_alg(&des_alg) == 0) ? 0:1;
441 ret |= (crypto_register_alg(&des3_128_alg) == 0) ? 0:2;
442 ret |= (crypto_register_alg(&des3_192_alg) == 0) ? 0:4;
443 if (ret) {
444 crypto_unregister_alg(&des3_192_alg);
445 crypto_unregister_alg(&des3_128_alg);
446 crypto_unregister_alg(&des_alg);
447 return -EEXIST;
448 }
449 return 0;
450}
451
452static void __exit fini(void)
453{
454 crypto_unregister_alg(&des3_192_alg);
455 crypto_unregister_alg(&des3_128_alg);
456 crypto_unregister_alg(&des_alg);
457}
458
459module_init(init);
460module_exit(fini);
461
462MODULE_ALIAS("des");
463MODULE_ALIAS("des3_ede");
464
465MODULE_LICENSE("GPL");
466MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms");
diff --git a/arch/s390/crypto/des_z990.c b/arch/s390/crypto/des_z990.c
deleted file mode 100644
index 813cf37b1177..000000000000
--- a/arch/s390/crypto/des_z990.c
+++ /dev/null
@@ -1,284 +0,0 @@
1/*
2 * Cryptographic API.
3 *
4 * z990 implementation of the DES Cipher Algorithm.
5 *
6 * Copyright (c) 2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Thomas Spatzier (tspat@de.ibm.com)
8 *
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 */
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/mm.h>
19#include <linux/errno.h>
20#include <asm/scatterlist.h>
21#include <linux/crypto.h>
22#include "crypt_z990.h"
23#include "crypto_des.h"
24
25#define DES_BLOCK_SIZE 8
26#define DES_KEY_SIZE 8
27
28#define DES3_128_KEY_SIZE (2 * DES_KEY_SIZE)
29#define DES3_128_BLOCK_SIZE DES_BLOCK_SIZE
30
31#define DES3_192_KEY_SIZE (3 * DES_KEY_SIZE)
32#define DES3_192_BLOCK_SIZE DES_BLOCK_SIZE
33
34struct crypt_z990_des_ctx {
35 u8 iv[DES_BLOCK_SIZE];
36 u8 key[DES_KEY_SIZE];
37};
38
39struct crypt_z990_des3_128_ctx {
40 u8 iv[DES_BLOCK_SIZE];
41 u8 key[DES3_128_KEY_SIZE];
42};
43
44struct crypt_z990_des3_192_ctx {
45 u8 iv[DES_BLOCK_SIZE];
46 u8 key[DES3_192_KEY_SIZE];
47};
48
49static int
50des_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags)
51{
52 struct crypt_z990_des_ctx *dctx;
53 int ret;
54
55 dctx = ctx;
56 //test if key is valid (not a weak key)
57 ret = crypto_des_check_key(key, keylen, flags);
58 if (ret == 0){
59 memcpy(dctx->key, key, keylen);
60 }
61 return ret;
62}
63
64
65static void
66des_encrypt(void *ctx, u8 *dst, const u8 *src)
67{
68 struct crypt_z990_des_ctx *dctx;
69
70 dctx = ctx;
71 crypt_z990_km(KM_DEA_ENCRYPT, dctx->key, dst, src, DES_BLOCK_SIZE);
72}
73
74static void
75des_decrypt(void *ctx, u8 *dst, const u8 *src)
76{
77 struct crypt_z990_des_ctx *dctx;
78
79 dctx = ctx;
80 crypt_z990_km(KM_DEA_DECRYPT, dctx->key, dst, src, DES_BLOCK_SIZE);
81}
82
83static struct crypto_alg des_alg = {
84 .cra_name = "des",
85 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
86 .cra_blocksize = DES_BLOCK_SIZE,
87 .cra_ctxsize = sizeof(struct crypt_z990_des_ctx),
88 .cra_module = THIS_MODULE,
89 .cra_list = LIST_HEAD_INIT(des_alg.cra_list),
90 .cra_u = { .cipher = {
91 .cia_min_keysize = DES_KEY_SIZE,
92 .cia_max_keysize = DES_KEY_SIZE,
93 .cia_setkey = des_setkey,
94 .cia_encrypt = des_encrypt,
95 .cia_decrypt = des_decrypt } }
96};
97
98/*
99 * RFC2451:
100 *
101 * For DES-EDE3, there is no known need to reject weak or
102 * complementation keys. Any weakness is obviated by the use of
103 * multiple keys.
104 *
105 * However, if the two independent 64-bit keys are equal,
106 * then the DES3 operation is simply the same as DES.
107 * Implementers MUST reject keys that exhibit this property.
108 *
109 */
110static int
111des3_128_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags)
112{
113 int i, ret;
114 struct crypt_z990_des3_128_ctx *dctx;
115 const u8* temp_key = key;
116
117 dctx = ctx;
118 if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE))) {
119
120 *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED;
121 return -EINVAL;
122 }
123 for (i = 0; i < 2; i++, temp_key += DES_KEY_SIZE) {
124 ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags);
125 if (ret < 0)
126 return ret;
127 }
128 memcpy(dctx->key, key, keylen);
129 return 0;
130}
131
132static void
133des3_128_encrypt(void *ctx, u8 *dst, const u8 *src)
134{
135 struct crypt_z990_des3_128_ctx *dctx;
136
137 dctx = ctx;
138 crypt_z990_km(KM_TDEA_128_ENCRYPT, dctx->key, dst, (void*)src,
139 DES3_128_BLOCK_SIZE);
140}
141
142static void
143des3_128_decrypt(void *ctx, u8 *dst, const u8 *src)
144{
145 struct crypt_z990_des3_128_ctx *dctx;
146
147 dctx = ctx;
148 crypt_z990_km(KM_TDEA_128_DECRYPT, dctx->key, dst, (void*)src,
149 DES3_128_BLOCK_SIZE);
150}
151
152static struct crypto_alg des3_128_alg = {
153 .cra_name = "des3_ede128",
154 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
155 .cra_blocksize = DES3_128_BLOCK_SIZE,
156 .cra_ctxsize = sizeof(struct crypt_z990_des3_128_ctx),
157 .cra_module = THIS_MODULE,
158 .cra_list = LIST_HEAD_INIT(des3_128_alg.cra_list),
159 .cra_u = { .cipher = {
160 .cia_min_keysize = DES3_128_KEY_SIZE,
161 .cia_max_keysize = DES3_128_KEY_SIZE,
162 .cia_setkey = des3_128_setkey,
163 .cia_encrypt = des3_128_encrypt,
164 .cia_decrypt = des3_128_decrypt } }
165};
166
167/*
168 * RFC2451:
169 *
170 * For DES-EDE3, there is no known need to reject weak or
171 * complementation keys. Any weakness is obviated by the use of
172 * multiple keys.
173 *
174 * However, if the first two or last two independent 64-bit keys are
175 * equal (k1 == k2 or k2 == k3), then the DES3 operation is simply the
176 * same as DES. Implementers MUST reject keys that exhibit this
177 * property.
178 *
179 */
180static int
181des3_192_setkey(void *ctx, const u8 *key, unsigned int keylen, u32 *flags)
182{
183 int i, ret;
184 struct crypt_z990_des3_192_ctx *dctx;
185 const u8* temp_key;
186
187 dctx = ctx;
188 temp_key = key;
189 if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) &&
190 memcmp(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2],
191 DES_KEY_SIZE))) {
192
193 *flags |= CRYPTO_TFM_RES_BAD_KEY_SCHED;
194 return -EINVAL;
195 }
196 for (i = 0; i < 3; i++, temp_key += DES_KEY_SIZE) {
197 ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags);
198 if (ret < 0){
199 return ret;
200 }
201 }
202 memcpy(dctx->key, key, keylen);
203 return 0;
204}
205
206static void
207des3_192_encrypt(void *ctx, u8 *dst, const u8 *src)
208{
209 struct crypt_z990_des3_192_ctx *dctx;
210
211 dctx = ctx;
212 crypt_z990_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src,
213 DES3_192_BLOCK_SIZE);
214}
215
216static void
217des3_192_decrypt(void *ctx, u8 *dst, const u8 *src)
218{
219 struct crypt_z990_des3_192_ctx *dctx;
220
221 dctx = ctx;
222 crypt_z990_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src,
223 DES3_192_BLOCK_SIZE);
224}
225
226static struct crypto_alg des3_192_alg = {
227 .cra_name = "des3_ede",
228 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
229 .cra_blocksize = DES3_192_BLOCK_SIZE,
230 .cra_ctxsize = sizeof(struct crypt_z990_des3_192_ctx),
231 .cra_module = THIS_MODULE,
232 .cra_list = LIST_HEAD_INIT(des3_192_alg.cra_list),
233 .cra_u = { .cipher = {
234 .cia_min_keysize = DES3_192_KEY_SIZE,
235 .cia_max_keysize = DES3_192_KEY_SIZE,
236 .cia_setkey = des3_192_setkey,
237 .cia_encrypt = des3_192_encrypt,
238 .cia_decrypt = des3_192_decrypt } }
239};
240
241
242
243static int
244init(void)
245{
246 int ret;
247
248 if (!crypt_z990_func_available(KM_DEA_ENCRYPT) ||
249 !crypt_z990_func_available(KM_TDEA_128_ENCRYPT) ||
250 !crypt_z990_func_available(KM_TDEA_192_ENCRYPT)){
251 return -ENOSYS;
252 }
253
254 ret = 0;
255 ret |= (crypto_register_alg(&des_alg) == 0)? 0:1;
256 ret |= (crypto_register_alg(&des3_128_alg) == 0)? 0:2;
257 ret |= (crypto_register_alg(&des3_192_alg) == 0)? 0:4;
258 if (ret){
259 crypto_unregister_alg(&des3_192_alg);
260 crypto_unregister_alg(&des3_128_alg);
261 crypto_unregister_alg(&des_alg);
262 return -EEXIST;
263 }
264
265 printk(KERN_INFO "crypt_z990: des_z990 loaded.\n");
266 return 0;
267}
268
269static void __exit
270fini(void)
271{
272 crypto_unregister_alg(&des3_192_alg);
273 crypto_unregister_alg(&des3_128_alg);
274 crypto_unregister_alg(&des_alg);
275}
276
277module_init(init);
278module_exit(fini);
279
280MODULE_ALIAS("des");
281MODULE_ALIAS("des3_ede");
282
283MODULE_LICENSE("GPL");
284MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms");
diff --git a/arch/s390/crypto/sha1_z990.c b/arch/s390/crypto/sha1_s390.c
index 298174ddf5b1..98c896b86dcd 100644
--- a/arch/s390/crypto/sha1_z990.c
+++ b/arch/s390/crypto/sha1_s390.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * Cryptographic API. 2 * Cryptographic API.
3 * 3 *
4 * z990 implementation of the SHA1 Secure Hash Algorithm. 4 * s390 implementation of the SHA1 Secure Hash Algorithm.
5 * 5 *
6 * Derived from cryptoapi implementation, adapted for in-place 6 * Derived from cryptoapi implementation, adapted for in-place
7 * scatterlist interface. Originally based on the public domain 7 * scatterlist interface. Originally based on the public domain
@@ -28,22 +28,22 @@
28#include <linux/crypto.h> 28#include <linux/crypto.h>
29#include <asm/scatterlist.h> 29#include <asm/scatterlist.h>
30#include <asm/byteorder.h> 30#include <asm/byteorder.h>
31#include "crypt_z990.h" 31#include "crypt_s390.h"
32 32
33#define SHA1_DIGEST_SIZE 20 33#define SHA1_DIGEST_SIZE 20
34#define SHA1_BLOCK_SIZE 64 34#define SHA1_BLOCK_SIZE 64
35 35
36struct crypt_z990_sha1_ctx { 36struct crypt_s390_sha1_ctx {
37 u64 count; 37 u64 count;
38 u32 state[5]; 38 u32 state[5];
39 u32 buf_len; 39 u32 buf_len;
40 u8 buffer[2 * SHA1_BLOCK_SIZE]; 40 u8 buffer[2 * SHA1_BLOCK_SIZE];
41}; 41};
42 42
43static void 43static void
44sha1_init(void *ctx) 44sha1_init(void *ctx)
45{ 45{
46 static const struct crypt_z990_sha1_ctx initstate = { 46 static const struct crypt_s390_sha1_ctx initstate = {
47 .state = { 47 .state = {
48 0x67452301, 48 0x67452301,
49 0xEFCDAB89, 49 0xEFCDAB89,
@@ -58,7 +58,7 @@ sha1_init(void *ctx)
58static void 58static void
59sha1_update(void *ctx, const u8 *data, unsigned int len) 59sha1_update(void *ctx, const u8 *data, unsigned int len)
60{ 60{
61 struct crypt_z990_sha1_ctx *sctx; 61 struct crypt_s390_sha1_ctx *sctx;
62 long imd_len; 62 long imd_len;
63 63
64 sctx = ctx; 64 sctx = ctx;
@@ -69,7 +69,7 @@ sha1_update(void *ctx, const u8 *data, unsigned int len)
69 //complete full block and hash 69 //complete full block and hash
70 memcpy(sctx->buffer + sctx->buf_len, data, 70 memcpy(sctx->buffer + sctx->buf_len, data,
71 SHA1_BLOCK_SIZE - sctx->buf_len); 71 SHA1_BLOCK_SIZE - sctx->buf_len);
72 crypt_z990_kimd(KIMD_SHA_1, sctx->state, sctx->buffer, 72 crypt_s390_kimd(KIMD_SHA_1, sctx->state, sctx->buffer,
73 SHA1_BLOCK_SIZE); 73 SHA1_BLOCK_SIZE);
74 data += SHA1_BLOCK_SIZE - sctx->buf_len; 74 data += SHA1_BLOCK_SIZE - sctx->buf_len;
75 len -= SHA1_BLOCK_SIZE - sctx->buf_len; 75 len -= SHA1_BLOCK_SIZE - sctx->buf_len;
@@ -79,7 +79,7 @@ sha1_update(void *ctx, const u8 *data, unsigned int len)
79 //rest of data contains full blocks? 79 //rest of data contains full blocks?
80 imd_len = len & ~0x3ful; 80 imd_len = len & ~0x3ful;
81 if (imd_len){ 81 if (imd_len){
82 crypt_z990_kimd(KIMD_SHA_1, sctx->state, data, imd_len); 82 crypt_s390_kimd(KIMD_SHA_1, sctx->state, data, imd_len);
83 data += imd_len; 83 data += imd_len;
84 len -= imd_len; 84 len -= imd_len;
85 } 85 }
@@ -92,7 +92,7 @@ sha1_update(void *ctx, const u8 *data, unsigned int len)
92 92
93 93
94static void 94static void
95pad_message(struct crypt_z990_sha1_ctx* sctx) 95pad_message(struct crypt_s390_sha1_ctx* sctx)
96{ 96{
97 int index; 97 int index;
98 98
@@ -113,11 +113,11 @@ pad_message(struct crypt_z990_sha1_ctx* sctx)
113static void 113static void
114sha1_final(void* ctx, u8 *out) 114sha1_final(void* ctx, u8 *out)
115{ 115{
116 struct crypt_z990_sha1_ctx *sctx = ctx; 116 struct crypt_s390_sha1_ctx *sctx = ctx;
117 117
118 //must perform manual padding 118 //must perform manual padding
119 pad_message(sctx); 119 pad_message(sctx);
120 crypt_z990_kimd(KIMD_SHA_1, sctx->state, sctx->buffer, sctx->buf_len); 120 crypt_s390_kimd(KIMD_SHA_1, sctx->state, sctx->buffer, sctx->buf_len);
121 //copy digest to out 121 //copy digest to out
122 memcpy(out, sctx->state, SHA1_DIGEST_SIZE); 122 memcpy(out, sctx->state, SHA1_DIGEST_SIZE);
123 /* Wipe context */ 123 /* Wipe context */
@@ -128,7 +128,7 @@ static struct crypto_alg alg = {
128 .cra_name = "sha1", 128 .cra_name = "sha1",
129 .cra_flags = CRYPTO_ALG_TYPE_DIGEST, 129 .cra_flags = CRYPTO_ALG_TYPE_DIGEST,
130 .cra_blocksize = SHA1_BLOCK_SIZE, 130 .cra_blocksize = SHA1_BLOCK_SIZE,
131 .cra_ctxsize = sizeof(struct crypt_z990_sha1_ctx), 131 .cra_ctxsize = sizeof(struct crypt_s390_sha1_ctx),
132 .cra_module = THIS_MODULE, 132 .cra_module = THIS_MODULE,
133 .cra_list = LIST_HEAD_INIT(alg.cra_list), 133 .cra_list = LIST_HEAD_INIT(alg.cra_list),
134 .cra_u = { .digest = { 134 .cra_u = { .digest = {
@@ -143,10 +143,10 @@ init(void)
143{ 143{
144 int ret = -ENOSYS; 144 int ret = -ENOSYS;
145 145
146 if (crypt_z990_func_available(KIMD_SHA_1)){ 146 if (crypt_s390_func_available(KIMD_SHA_1)){
147 ret = crypto_register_alg(&alg); 147 ret = crypto_register_alg(&alg);
148 if (ret == 0){ 148 if (ret == 0){
149 printk(KERN_INFO "crypt_z990: sha1_z990 loaded.\n"); 149 printk(KERN_INFO "crypt_s390: sha1_s390 loaded.\n");
150 } 150 }
151 } 151 }
152 return ret; 152 return ret;
diff --git a/arch/s390/crypto/sha256_s390.c b/arch/s390/crypto/sha256_s390.c
new file mode 100644
index 000000000000..1ec5e92b3454
--- /dev/null
+++ b/arch/s390/crypto/sha256_s390.c
@@ -0,0 +1,166 @@
1/*
2 * Cryptographic API.
3 *
4 * s390 implementation of the SHA256 Secure Hash Algorithm.
5 *
6 * s390 Version:
7 * Copyright (C) 2005 IBM Deutschland GmbH, IBM Corporation
8 * Author(s): Jan Glauber (jang@de.ibm.com)
9 *
10 * Derived from "crypto/sha256.c"
11 * and "arch/s390/crypto/sha1_s390.c"
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the Free
15 * Software Foundation; either version 2 of the License, or (at your option)
16 * any later version.
17 *
18 */
19#include <linux/init.h>
20#include <linux/module.h>
21#include <linux/crypto.h>
22
23#include "crypt_s390.h"
24
25#define SHA256_DIGEST_SIZE 32
26#define SHA256_BLOCK_SIZE 64
27
28struct s390_sha256_ctx {
29 u64 count;
30 u32 state[8];
31 u8 buf[2 * SHA256_BLOCK_SIZE];
32};
33
34static void sha256_init(void *ctx)
35{
36 struct s390_sha256_ctx *sctx = ctx;
37
38 sctx->state[0] = 0x6a09e667;
39 sctx->state[1] = 0xbb67ae85;
40 sctx->state[2] = 0x3c6ef372;
41 sctx->state[3] = 0xa54ff53a;
42 sctx->state[4] = 0x510e527f;
43 sctx->state[5] = 0x9b05688c;
44 sctx->state[6] = 0x1f83d9ab;
45 sctx->state[7] = 0x5be0cd19;
46 sctx->count = 0;
47 memset(sctx->buf, 0, sizeof(sctx->buf));
48}
49
50static void sha256_update(void *ctx, const u8 *data, unsigned int len)
51{
52 struct s390_sha256_ctx *sctx = ctx;
53 unsigned int index;
54 int ret;
55
56 /* how much is already in the buffer? */
57 index = sctx->count / 8 & 0x3f;
58
59 /* update message bit length */
60 sctx->count += len * 8;
61
62 if ((index + len) < SHA256_BLOCK_SIZE)
63 goto store;
64
65 /* process one stored block */
66 if (index) {
67 memcpy(sctx->buf + index, data, SHA256_BLOCK_SIZE - index);
68 ret = crypt_s390_kimd(KIMD_SHA_256, sctx->state, sctx->buf,
69 SHA256_BLOCK_SIZE);
70 BUG_ON(ret != SHA256_BLOCK_SIZE);
71 data += SHA256_BLOCK_SIZE - index;
72 len -= SHA256_BLOCK_SIZE - index;
73 }
74
75 /* process as many blocks as possible */
76 if (len >= SHA256_BLOCK_SIZE) {
77 ret = crypt_s390_kimd(KIMD_SHA_256, sctx->state, data,
78 len & ~(SHA256_BLOCK_SIZE - 1));
79 BUG_ON(ret != (len & ~(SHA256_BLOCK_SIZE - 1)));
80 data += ret;
81 len -= ret;
82 }
83
84store:
85 /* anything left? */
86 if (len)
87 memcpy(sctx->buf + index , data, len);
88}
89
90static void pad_message(struct s390_sha256_ctx* sctx)
91{
92 int index, end;
93
94 index = sctx->count / 8 & 0x3f;
95 end = index < 56 ? SHA256_BLOCK_SIZE : 2 * SHA256_BLOCK_SIZE;
96
97 /* start pad with 1 */
98 sctx->buf[index] = 0x80;
99
100 /* pad with zeros */
101 index++;
102 memset(sctx->buf + index, 0x00, end - index - 8);
103
104 /* append message length */
105 memcpy(sctx->buf + end - 8, &sctx->count, sizeof sctx->count);
106
107 sctx->count = end * 8;
108}
109
110/* Add padding and return the message digest */
111static void sha256_final(void* ctx, u8 *out)
112{
113 struct s390_sha256_ctx *sctx = ctx;
114
115 /* must perform manual padding */
116 pad_message(sctx);
117
118 crypt_s390_kimd(KIMD_SHA_256, sctx->state, sctx->buf,
119 sctx->count / 8);
120
121 /* copy digest to out */
122 memcpy(out, sctx->state, SHA256_DIGEST_SIZE);
123
124 /* wipe context */
125 memset(sctx, 0, sizeof *sctx);
126}
127
128static struct crypto_alg alg = {
129 .cra_name = "sha256",
130 .cra_flags = CRYPTO_ALG_TYPE_DIGEST,
131 .cra_blocksize = SHA256_BLOCK_SIZE,
132 .cra_ctxsize = sizeof(struct s390_sha256_ctx),
133 .cra_module = THIS_MODULE,
134 .cra_list = LIST_HEAD_INIT(alg.cra_list),
135 .cra_u = { .digest = {
136 .dia_digestsize = SHA256_DIGEST_SIZE,
137 .dia_init = sha256_init,
138 .dia_update = sha256_update,
139 .dia_final = sha256_final } }
140};
141
142static int init(void)
143{
144 int ret;
145
146 if (!crypt_s390_func_available(KIMD_SHA_256))
147 return -ENOSYS;
148
149 ret = crypto_register_alg(&alg);
150 if (ret != 0)
151 printk(KERN_INFO "crypt_s390: sha256_s390 couldn't be loaded.");
152 return ret;
153}
154
155static void __exit fini(void)
156{
157 crypto_unregister_alg(&alg);
158}
159
160module_init(init);
161module_exit(fini);
162
163MODULE_ALIAS("sha256");
164
165MODULE_LICENSE("GPL");
166MODULE_DESCRIPTION("SHA256 Secure Hash Algorithm");
diff --git a/arch/s390/defconfig b/arch/s390/defconfig
index 45d44c6bb39d..7d23edc6facb 100644
--- a/arch/s390/defconfig
+++ b/arch/s390/defconfig
@@ -1,12 +1,12 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.14-rc1 3# Linux kernel version: 2.6.15-rc2
4# Wed Sep 14 16:46:19 2005 4# Mon Nov 21 13:51:30 2005
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_RWSEM_XCHGADD_ALGORITHM=y 7CONFIG_RWSEM_XCHGADD_ALGORITHM=y
8CONFIG_GENERIC_CALIBRATE_DELAY=y 8CONFIG_GENERIC_CALIBRATE_DELAY=y
9CONFIG_ARCH_S390=y 9CONFIG_S390=y
10CONFIG_UID16=y 10CONFIG_UID16=y
11 11
12# 12#
@@ -65,15 +65,31 @@ CONFIG_KMOD=y
65CONFIG_STOP_MACHINE=y 65CONFIG_STOP_MACHINE=y
66 66
67# 67#
68# Block layer
69#
70# CONFIG_LBD 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
79CONFIG_DEFAULT_AS=y
80# CONFIG_DEFAULT_DEADLINE is not set
81# CONFIG_DEFAULT_CFQ is not set
82# CONFIG_DEFAULT_NOOP is not set
83CONFIG_DEFAULT_IOSCHED="anticipatory"
84
85#
68# Base setup 86# Base setup
69# 87#
70 88
71# 89#
72# Processor type and features 90# Processor type and features
73# 91#
74# CONFIG_ARCH_S390X is not set
75# CONFIG_64BIT is not set 92# CONFIG_64BIT is not set
76CONFIG_ARCH_S390_31=y
77CONFIG_SMP=y 93CONFIG_SMP=y
78CONFIG_NR_CPUS=32 94CONFIG_NR_CPUS=32
79CONFIG_HOTPLUG_CPU=y 95CONFIG_HOTPLUG_CPU=y
@@ -97,6 +113,7 @@ CONFIG_FLATMEM_MANUAL=y
97CONFIG_FLATMEM=y 113CONFIG_FLATMEM=y
98CONFIG_FLAT_NODE_MEM_MAP=y 114CONFIG_FLAT_NODE_MEM_MAP=y
99# CONFIG_SPARSEMEM_STATIC is not set 115# CONFIG_SPARSEMEM_STATIC is not set
116CONFIG_SPLIT_PTLOCK_CPUS=4
100 117
101# 118#
102# I/O subsystem configuration 119# I/O subsystem configuration
@@ -188,10 +205,18 @@ CONFIG_IPV6=y
188# CONFIG_NET_DIVERT is not set 205# CONFIG_NET_DIVERT is not set
189# CONFIG_ECONET is not set 206# CONFIG_ECONET is not set
190# CONFIG_WAN_ROUTER is not set 207# CONFIG_WAN_ROUTER is not set
208
209#
210# QoS and/or fair queueing
211#
191CONFIG_NET_SCHED=y 212CONFIG_NET_SCHED=y
192CONFIG_NET_SCH_CLK_JIFFIES=y 213CONFIG_NET_SCH_CLK_JIFFIES=y
193# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set 214# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
194# CONFIG_NET_SCH_CLK_CPU is not set 215# CONFIG_NET_SCH_CLK_CPU is not set
216
217#
218# Queueing/Scheduling
219#
195CONFIG_NET_SCH_CBQ=m 220CONFIG_NET_SCH_CBQ=m
196# CONFIG_NET_SCH_HTB is not set 221# CONFIG_NET_SCH_HTB is not set
197# CONFIG_NET_SCH_HFSC is not set 222# CONFIG_NET_SCH_HFSC is not set
@@ -204,8 +229,10 @@ CONFIG_NET_SCH_GRED=m
204CONFIG_NET_SCH_DSMARK=m 229CONFIG_NET_SCH_DSMARK=m
205# CONFIG_NET_SCH_NETEM is not set 230# CONFIG_NET_SCH_NETEM is not set
206# CONFIG_NET_SCH_INGRESS is not set 231# CONFIG_NET_SCH_INGRESS is not set
207CONFIG_NET_QOS=y 232
208CONFIG_NET_ESTIMATOR=y 233#
234# Classification
235#
209CONFIG_NET_CLS=y 236CONFIG_NET_CLS=y
210# CONFIG_NET_CLS_BASIC is not set 237# CONFIG_NET_CLS_BASIC is not set
211CONFIG_NET_CLS_TCINDEX=m 238CONFIG_NET_CLS_TCINDEX=m
@@ -214,18 +241,18 @@ CONFIG_NET_CLS_ROUTE=y
214CONFIG_NET_CLS_FW=m 241CONFIG_NET_CLS_FW=m
215CONFIG_NET_CLS_U32=m 242CONFIG_NET_CLS_U32=m
216# CONFIG_CLS_U32_PERF is not set 243# CONFIG_CLS_U32_PERF is not set
217# CONFIG_NET_CLS_IND is not set
218CONFIG_NET_CLS_RSVP=m 244CONFIG_NET_CLS_RSVP=m
219CONFIG_NET_CLS_RSVP6=m 245CONFIG_NET_CLS_RSVP6=m
220# CONFIG_NET_EMATCH is not set 246# CONFIG_NET_EMATCH is not set
221# CONFIG_NET_CLS_ACT is not set 247# CONFIG_NET_CLS_ACT is not set
222CONFIG_NET_CLS_POLICE=y 248CONFIG_NET_CLS_POLICE=y
249# CONFIG_NET_CLS_IND is not set
250CONFIG_NET_ESTIMATOR=y
223 251
224# 252#
225# Network testing 253# Network testing
226# 254#
227# CONFIG_NET_PKTGEN is not set 255# CONFIG_NET_PKTGEN is not set
228# CONFIG_NETFILTER_NETLINK is not set
229# CONFIG_HAMRADIO is not set 256# CONFIG_HAMRADIO is not set
230# CONFIG_IRDA is not set 257# CONFIG_IRDA is not set
231# CONFIG_BT is not set 258# CONFIG_BT is not set
@@ -276,6 +303,7 @@ CONFIG_SCSI_FC_ATTRS=y
276# 303#
277# SCSI low-level drivers 304# SCSI low-level drivers
278# 305#
306# CONFIG_ISCSI_TCP is not set
279# CONFIG_SCSI_SATA is not set 307# CONFIG_SCSI_SATA is not set
280# CONFIG_SCSI_DEBUG is not set 308# CONFIG_SCSI_DEBUG is not set
281CONFIG_ZFCP=y 309CONFIG_ZFCP=y
@@ -292,7 +320,6 @@ CONFIG_BLK_DEV_RAM=y
292CONFIG_BLK_DEV_RAM_COUNT=16 320CONFIG_BLK_DEV_RAM_COUNT=16
293CONFIG_BLK_DEV_RAM_SIZE=4096 321CONFIG_BLK_DEV_RAM_SIZE=4096
294CONFIG_BLK_DEV_INITRD=y 322CONFIG_BLK_DEV_INITRD=y
295# CONFIG_LBD is not set
296# CONFIG_CDROM_PKTCDVD is not set 323# CONFIG_CDROM_PKTCDVD is not set
297 324
298# 325#
@@ -305,15 +332,8 @@ CONFIG_DASD_PROFILE=y
305CONFIG_DASD_ECKD=y 332CONFIG_DASD_ECKD=y
306CONFIG_DASD_FBA=y 333CONFIG_DASD_FBA=y
307CONFIG_DASD_DIAG=y 334CONFIG_DASD_DIAG=y
335CONFIG_DASD_EER=m
308# CONFIG_DASD_CMB is not set 336# CONFIG_DASD_CMB is not set
309
310#
311# IO Schedulers
312#
313CONFIG_IOSCHED_NOOP=y
314CONFIG_IOSCHED_AS=y
315CONFIG_IOSCHED_DEADLINE=y
316CONFIG_IOSCHED_CFQ=y
317# CONFIG_ATA_OVER_ETH is not set 337# CONFIG_ATA_OVER_ETH is not set
318 338
319# 339#
@@ -378,7 +398,6 @@ CONFIG_S390_TAPE_34XX=m
378# CONFIG_VMLOGRDR is not set 398# CONFIG_VMLOGRDR is not set
379# CONFIG_VMCP is not set 399# CONFIG_VMCP is not set
380# CONFIG_MONREADER is not set 400# CONFIG_MONREADER is not set
381# CONFIG_DCSS_SHM is not set
382 401
383# 402#
384# Cryptographic devices 403# Cryptographic devices
@@ -593,6 +612,8 @@ CONFIG_DEBUG_PREEMPT=y
593# CONFIG_DEBUG_KOBJECT is not set 612# CONFIG_DEBUG_KOBJECT is not set
594# CONFIG_DEBUG_INFO is not set 613# CONFIG_DEBUG_INFO is not set
595CONFIG_DEBUG_FS=y 614CONFIG_DEBUG_FS=y
615# CONFIG_DEBUG_VM is not set
616# CONFIG_RCU_TORTURE_TEST is not set
596 617
597# 618#
598# Security options 619# Security options
@@ -609,17 +630,19 @@ CONFIG_CRYPTO=y
609# CONFIG_CRYPTO_MD4 is not set 630# CONFIG_CRYPTO_MD4 is not set
610# CONFIG_CRYPTO_MD5 is not set 631# CONFIG_CRYPTO_MD5 is not set
611# CONFIG_CRYPTO_SHA1 is not set 632# CONFIG_CRYPTO_SHA1 is not set
612# CONFIG_CRYPTO_SHA1_Z990 is not set 633# CONFIG_CRYPTO_SHA1_S390 is not set
613# CONFIG_CRYPTO_SHA256 is not set 634# CONFIG_CRYPTO_SHA256 is not set
635# CONFIG_CRYPTO_SHA256_S390 is not set
614# CONFIG_CRYPTO_SHA512 is not set 636# CONFIG_CRYPTO_SHA512 is not set
615# CONFIG_CRYPTO_WP512 is not set 637# CONFIG_CRYPTO_WP512 is not set
616# CONFIG_CRYPTO_TGR192 is not set 638# CONFIG_CRYPTO_TGR192 is not set
617# CONFIG_CRYPTO_DES is not set 639# CONFIG_CRYPTO_DES is not set
618# CONFIG_CRYPTO_DES_Z990 is not set 640# CONFIG_CRYPTO_DES_S390 is not set
619# CONFIG_CRYPTO_BLOWFISH is not set 641# CONFIG_CRYPTO_BLOWFISH is not set
620# CONFIG_CRYPTO_TWOFISH is not set 642# CONFIG_CRYPTO_TWOFISH is not set
621# CONFIG_CRYPTO_SERPENT is not set 643# CONFIG_CRYPTO_SERPENT is not set
622# CONFIG_CRYPTO_AES is not set 644# CONFIG_CRYPTO_AES is not set
645# CONFIG_CRYPTO_AES_S390 is not set
623# CONFIG_CRYPTO_CAST5 is not set 646# CONFIG_CRYPTO_CAST5 is not set
624# CONFIG_CRYPTO_CAST6 is not set 647# CONFIG_CRYPTO_CAST6 is not set
625# CONFIG_CRYPTO_TEA is not set 648# CONFIG_CRYPTO_TEA is not set
diff --git a/arch/s390/kernel/Makefile b/arch/s390/kernel/Makefile
index 7434c32bc631..9269b5788fac 100644
--- a/arch/s390/kernel/Makefile
+++ b/arch/s390/kernel/Makefile
@@ -8,31 +8,25 @@ obj-y := bitmap.o traps.o time.o process.o \
8 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \ 8 setup.o sys_s390.o ptrace.o signal.o cpcmd.o ebcdic.o \
9 semaphore.o s390_ext.o debug.o profile.o irq.o reipl_diag.o 9 semaphore.o s390_ext.o debug.o profile.o irq.o reipl_diag.o
10 10
11obj-y += $(if $(CONFIG_64BIT),entry64.o,entry.o)
12obj-y += $(if $(CONFIG_64BIT),reipl64.o,reipl.o)
13
11extra-y += head.o init_task.o vmlinux.lds 14extra-y += head.o init_task.o vmlinux.lds
12 15
13obj-$(CONFIG_MODULES) += s390_ksyms.o module.o 16obj-$(CONFIG_MODULES) += s390_ksyms.o module.o
14obj-$(CONFIG_SMP) += smp.o 17obj-$(CONFIG_SMP) += smp.o
15 18
16obj-$(CONFIG_S390_SUPPORT) += compat_linux.o compat_signal.o \ 19obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o \
17 compat_ioctl.o compat_wrapper.o \ 20 compat_wrapper.o compat_exec_domain.o
18 compat_exec_domain.o
19obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o 21obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o
20 22
21obj-$(CONFIG_ARCH_S390_31) += entry.o reipl.o
22obj-$(CONFIG_ARCH_S390X) += entry64.o reipl64.o
23
24obj-$(CONFIG_VIRT_TIMER) += vtime.o 23obj-$(CONFIG_VIRT_TIMER) += vtime.o
25 24
26# Kexec part 25# Kexec part
27S390_KEXEC_OBJS := machine_kexec.o crash.o 26S390_KEXEC_OBJS := machine_kexec.o crash.o
28ifeq ($(CONFIG_ARCH_S390X),y) 27S390_KEXEC_OBJS += $(if $(CONFIG_64BIT),relocate_kernel64.o,relocate_kernel.o)
29S390_KEXEC_OBJS += relocate_kernel64.o
30else
31S390_KEXEC_OBJS += relocate_kernel.o
32endif
33obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS) 28obj-$(CONFIG_KEXEC) += $(S390_KEXEC_OBJS)
34 29
35
36# 30#
37# This is just to get the dependencies... 31# This is just to get the dependencies...
38# 32#
diff --git a/arch/s390/kernel/binfmt_elf32.c b/arch/s390/kernel/binfmt_elf32.c
index 03ba5893f17b..1f451c2cb071 100644
--- a/arch/s390/kernel/binfmt_elf32.c
+++ b/arch/s390/kernel/binfmt_elf32.c
@@ -112,7 +112,7 @@ static inline int dump_regs32(struct pt_regs *ptregs, elf_gregset_t *regs)
112 112
113static inline int dump_task_regs32(struct task_struct *tsk, elf_gregset_t *regs) 113static inline int dump_task_regs32(struct task_struct *tsk, elf_gregset_t *regs)
114{ 114{
115 struct pt_regs *ptregs = __KSTK_PTREGS(tsk); 115 struct pt_regs *ptregs = task_pt_regs(tsk);
116 int i; 116 int i;
117 117
118 memcpy(&regs->psw.mask, &ptregs->psw.mask, 4); 118 memcpy(&regs->psw.mask, &ptregs->psw.mask, 4);
diff --git a/arch/s390/kernel/compat_ioctl.c b/arch/s390/kernel/compat_ioctl.c
deleted file mode 100644
index 6504c4e69986..000000000000
--- a/arch/s390/kernel/compat_ioctl.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
3 *
4 * S390 version
5 * Copyright (C) 2000-2003 IBM Deutschland Entwicklung GmbH, IBM Corporation
6 * Author(s): Gerhard Tonn (ton@de.ibm.com)
7 * Arnd Bergmann (arndb@de.ibm.com)
8 *
9 * Original implementation from 32-bit Sparc compat code which is
10 * Copyright (C) 2000 Silicon Graphics, Inc.
11 * Written by Ulf Carlsson (ulfc@engr.sgi.com)
12 */
13
14#include "compat_linux.h"
15#define INCLUDES
16#define CODE
17#include "../../../fs/compat_ioctl.c"
18#include <asm/dasd.h>
19#include <asm/cmb.h>
20#include <asm/tape390.h>
21#include <asm/ccwdev.h>
22#include "../../../drivers/s390/char/raw3270.h"
23
24static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd,
25 unsigned long arg, struct file *f)
26{
27 return sys_ioctl(fd, cmd, (unsigned long)compat_ptr(arg));
28}
29
30static int do_ioctl32_ulong(unsigned int fd, unsigned int cmd,
31 unsigned long arg, struct file *f)
32{
33 return sys_ioctl(fd, cmd, arg);
34}
35
36#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)do_ioctl32_pointer)
37#define ULONG_IOCTL(cmd) HANDLE_IOCTL((cmd),(ioctl_trans_handler_t)do_ioctl32_ulong)
38#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL },
39
40struct ioctl_trans ioctl_start[] = {
41/* architecture independent ioctls */
42#include <linux/compat_ioctl.h>
43#define DECLARES
44#include "../../../fs/compat_ioctl.c"
45
46/* s390 only ioctls */
47COMPATIBLE_IOCTL(DASDAPIVER)
48COMPATIBLE_IOCTL(BIODASDDISABLE)
49COMPATIBLE_IOCTL(BIODASDENABLE)
50COMPATIBLE_IOCTL(BIODASDRSRV)
51COMPATIBLE_IOCTL(BIODASDRLSE)
52COMPATIBLE_IOCTL(BIODASDSLCK)
53COMPATIBLE_IOCTL(BIODASDINFO)
54COMPATIBLE_IOCTL(BIODASDINFO2)
55COMPATIBLE_IOCTL(BIODASDFMT)
56COMPATIBLE_IOCTL(BIODASDPRRST)
57COMPATIBLE_IOCTL(BIODASDQUIESCE)
58COMPATIBLE_IOCTL(BIODASDRESUME)
59COMPATIBLE_IOCTL(BIODASDPRRD)
60COMPATIBLE_IOCTL(BIODASDPSRD)
61COMPATIBLE_IOCTL(BIODASDGATTR)
62COMPATIBLE_IOCTL(BIODASDSATTR)
63COMPATIBLE_IOCTL(BIODASDCMFENABLE)
64COMPATIBLE_IOCTL(BIODASDCMFDISABLE)
65COMPATIBLE_IOCTL(BIODASDREADALLCMB)
66
67COMPATIBLE_IOCTL(TUBICMD)
68COMPATIBLE_IOCTL(TUBOCMD)
69COMPATIBLE_IOCTL(TUBGETI)
70COMPATIBLE_IOCTL(TUBGETO)
71COMPATIBLE_IOCTL(TUBSETMOD)
72COMPATIBLE_IOCTL(TUBGETMOD)
73
74COMPATIBLE_IOCTL(TAPE390_DISPLAY)
75
76/* s390 doesn't need handlers here */
77COMPATIBLE_IOCTL(TIOCGSERIAL)
78COMPATIBLE_IOCTL(TIOCSSERIAL)
79};
80
81int ioctl_table_size = ARRAY_SIZE(ioctl_start);
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index ed877d0f27e6..bf9a7a361b34 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -55,6 +55,7 @@
55#include <linux/syscalls.h> 55#include <linux/syscalls.h>
56#include <linux/sysctl.h> 56#include <linux/sysctl.h>
57#include <linux/binfmts.h> 57#include <linux/binfmts.h>
58#include <linux/capability.h>
58#include <linux/compat.h> 59#include <linux/compat.h>
59#include <linux/vfs.h> 60#include <linux/vfs.h>
60#include <linux/ptrace.h> 61#include <linux/ptrace.h>
@@ -279,7 +280,7 @@ asmlinkage long sys32_getegid16(void)
279 280
280static inline long get_tv32(struct timeval *o, struct compat_timeval *i) 281static inline long get_tv32(struct timeval *o, struct compat_timeval *i)
281{ 282{
282 return (!access_ok(VERIFY_READ, tv32, sizeof(*tv32)) || 283 return (!access_ok(VERIFY_READ, o, sizeof(*o)) ||
283 (__get_user(o->tv_sec, &i->tv_sec) || 284 (__get_user(o->tv_sec, &i->tv_sec) ||
284 __get_user(o->tv_usec, &i->tv_usec))); 285 __get_user(o->tv_usec, &i->tv_usec)));
285} 286}
@@ -1014,38 +1015,6 @@ asmlinkage long sys32_clone(struct pt_regs regs)
1014} 1015}
1015 1016
1016/* 1017/*
1017 * Wrapper function for sys_timer_create.
1018 */
1019extern asmlinkage long
1020sys_timer_create(clockid_t, struct sigevent *, timer_t *);
1021
1022asmlinkage long
1023sys32_timer_create(clockid_t which_clock, struct compat_sigevent *se32,
1024 timer_t *timer_id)
1025{
1026 struct sigevent se;
1027 timer_t ktimer_id;
1028 mm_segment_t old_fs;
1029 long ret;
1030
1031 if (se32 == NULL)
1032 return sys_timer_create(which_clock, NULL, timer_id);
1033
1034 if (get_compat_sigevent(&se, se32))
1035 return -EFAULT;
1036
1037 old_fs = get_fs();
1038 set_fs(KERNEL_DS);
1039 ret = sys_timer_create(which_clock, &se, &ktimer_id);
1040 set_fs(old_fs);
1041
1042 if (!ret)
1043 ret = put_user (ktimer_id, timer_id);
1044
1045 return ret;
1046}
1047
1048/*
1049 * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64. 1018 * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64.
1050 * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE} 1019 * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE}
1051 * because the 31 bit values differ from the 64 bit values. 1020 * because the 31 bit values differ from the 64 bit values.
diff --git a/arch/s390/kernel/compat_signal.c b/arch/s390/kernel/compat_signal.c
index 4ff6808456ea..fa2b3bc22f20 100644
--- a/arch/s390/kernel/compat_signal.c
+++ b/arch/s390/kernel/compat_signal.c
@@ -467,8 +467,6 @@ asmlinkage long sys32_rt_sigreturn(struct pt_regs *regs)
467 if (err) 467 if (err)
468 goto badframe; 468 goto badframe;
469 469
470 /* It is more difficult to avoid calling this function than to
471 call it and ignore errors. */
472 set_fs (KERNEL_DS); 470 set_fs (KERNEL_DS);
473 do_sigaltstack((stack_t __user *)&st, NULL, regs->gprs[15]); 471 do_sigaltstack((stack_t __user *)&st, NULL, regs->gprs[15]);
474 set_fs (old_fs); 472 set_fs (old_fs);
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index 23fe94e58688..cfde1905d07d 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1289,7 +1289,7 @@ sys32_timer_create_wrapper:
1289 lgfr %r2,%r2 # timer_t (int) 1289 lgfr %r2,%r2 # timer_t (int)
1290 llgtr %r3,%r3 # struct compat_sigevent * 1290 llgtr %r3,%r3 # struct compat_sigevent *
1291 llgtr %r4,%r4 # timer_t * 1291 llgtr %r4,%r4 # timer_t *
1292 jg sys32_timer_create 1292 jg compat_sys_timer_create
1293 1293
1294 .globl sys32_timer_settime_wrapper 1294 .globl sys32_timer_settime_wrapper
1295sys32_timer_settime_wrapper: 1295sys32_timer_settime_wrapper:
diff --git a/arch/s390/kernel/cpcmd.c b/arch/s390/kernel/cpcmd.c
index d47fecb42cc5..4ef44e536b2c 100644
--- a/arch/s390/kernel/cpcmd.c
+++ b/arch/s390/kernel/cpcmd.c
@@ -39,7 +39,7 @@ int __cpcmd(const char *cmd, char *response, int rlen, int *response_code)
39 39
40 if (response != NULL && rlen > 0) { 40 if (response != NULL && rlen > 0) {
41 memset(response, 0, rlen); 41 memset(response, 0, rlen);
42#ifndef CONFIG_ARCH_S390X 42#ifndef CONFIG_64BIT
43 asm volatile ( "lra 2,0(%2)\n" 43 asm volatile ( "lra 2,0(%2)\n"
44 "lr 4,%3\n" 44 "lr 4,%3\n"
45 "o 4,%6\n" 45 "o 4,%6\n"
@@ -55,7 +55,7 @@ int __cpcmd(const char *cmd, char *response, int rlen, int *response_code)
55 : "a" (cpcmd_buf), "d" (cmdlen), 55 : "a" (cpcmd_buf), "d" (cmdlen),
56 "a" (response), "d" (rlen), "m" (mask) 56 "a" (response), "d" (rlen), "m" (mask)
57 : "cc", "2", "3", "4", "5" ); 57 : "cc", "2", "3", "4", "5" );
58#else /* CONFIG_ARCH_S390X */ 58#else /* CONFIG_64BIT */
59 asm volatile ( "lrag 2,0(%2)\n" 59 asm volatile ( "lrag 2,0(%2)\n"
60 "lgr 4,%3\n" 60 "lgr 4,%3\n"
61 "o 4,%6\n" 61 "o 4,%6\n"
@@ -73,11 +73,11 @@ int __cpcmd(const char *cmd, char *response, int rlen, int *response_code)
73 : "a" (cpcmd_buf), "d" (cmdlen), 73 : "a" (cpcmd_buf), "d" (cmdlen),
74 "a" (response), "d" (rlen), "m" (mask) 74 "a" (response), "d" (rlen), "m" (mask)
75 : "cc", "2", "3", "4", "5" ); 75 : "cc", "2", "3", "4", "5" );
76#endif /* CONFIG_ARCH_S390X */ 76#endif /* CONFIG_64BIT */
77 EBCASC(response, rlen); 77 EBCASC(response, rlen);
78 } else { 78 } else {
79 return_len = 0; 79 return_len = 0;
80#ifndef CONFIG_ARCH_S390X 80#ifndef CONFIG_64BIT
81 asm volatile ( "lra 2,0(%1)\n" 81 asm volatile ( "lra 2,0(%1)\n"
82 "lr 3,%2\n" 82 "lr 3,%2\n"
83 "diag 2,3,0x8\n" 83 "diag 2,3,0x8\n"
@@ -85,7 +85,7 @@ int __cpcmd(const char *cmd, char *response, int rlen, int *response_code)
85 : "=d" (return_code) 85 : "=d" (return_code)
86 : "a" (cpcmd_buf), "d" (cmdlen) 86 : "a" (cpcmd_buf), "d" (cmdlen)
87 : "2", "3" ); 87 : "2", "3" );
88#else /* CONFIG_ARCH_S390X */ 88#else /* CONFIG_64BIT */
89 asm volatile ( "lrag 2,0(%1)\n" 89 asm volatile ( "lrag 2,0(%1)\n"
90 "lgr 3,%2\n" 90 "lgr 3,%2\n"
91 "sam31\n" 91 "sam31\n"
@@ -95,7 +95,7 @@ int __cpcmd(const char *cmd, char *response, int rlen, int *response_code)
95 : "=d" (return_code) 95 : "=d" (return_code)
96 : "a" (cpcmd_buf), "d" (cmdlen) 96 : "a" (cpcmd_buf), "d" (cmdlen)
97 : "2", "3" ); 97 : "2", "3" );
98#endif /* CONFIG_ARCH_S390X */ 98#endif /* CONFIG_64BIT */
99 } 99 }
100 spin_unlock_irqrestore(&cpcmd_lock, flags); 100 spin_unlock_irqrestore(&cpcmd_lock, flags);
101 if (response_code != NULL) 101 if (response_code != NULL)
@@ -105,7 +105,7 @@ int __cpcmd(const char *cmd, char *response, int rlen, int *response_code)
105 105
106EXPORT_SYMBOL(__cpcmd); 106EXPORT_SYMBOL(__cpcmd);
107 107
108#ifdef CONFIG_ARCH_S390X 108#ifdef CONFIG_64BIT
109int cpcmd(const char *cmd, char *response, int rlen, int *response_code) 109int cpcmd(const char *cmd, char *response, int rlen, int *response_code)
110{ 110{
111 char *lowbuf; 111 char *lowbuf;
@@ -129,4 +129,4 @@ int cpcmd(const char *cmd, char *response, int rlen, int *response_code)
129} 129}
130 130
131EXPORT_SYMBOL(cpcmd); 131EXPORT_SYMBOL(cpcmd);
132#endif /* CONFIG_ARCH_S390X */ 132#endif /* CONFIG_64BIT */
diff --git a/arch/s390/kernel/crash.c b/arch/s390/kernel/crash.c
index 7bd169c58b0c..926cceeae0fa 100644
--- a/arch/s390/kernel/crash.c
+++ b/arch/s390/kernel/crash.c
@@ -10,8 +10,6 @@
10#include <linux/threads.h> 10#include <linux/threads.h>
11#include <linux/kexec.h> 11#include <linux/kexec.h>
12 12
13note_buf_t crash_notes[NR_CPUS];
14
15void machine_crash_shutdown(struct pt_regs *regs) 13void machine_crash_shutdown(struct pt_regs *regs)
16{ 14{
17} 15}
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 4eb71ffcf484..369ab4413ec7 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -213,7 +213,7 @@ sysc_nr_ok:
213 mvc SP_ARGS(8,%r15),SP_R7(%r15) 213 mvc SP_ARGS(8,%r15),SP_R7(%r15)
214sysc_do_restart: 214sysc_do_restart:
215 larl %r10,sys_call_table 215 larl %r10,sys_call_table
216#ifdef CONFIG_S390_SUPPORT 216#ifdef CONFIG_COMPAT
217 tm __TI_flags+5(%r9),(_TIF_31BIT>>16) # running in 31 bit mode ? 217 tm __TI_flags+5(%r9),(_TIF_31BIT>>16) # running in 31 bit mode ?
218 jno sysc_noemu 218 jno sysc_noemu
219 larl %r10,sys_call_table_emu # use 31 bit emulation system calls 219 larl %r10,sys_call_table_emu # use 31 bit emulation system calls
@@ -361,7 +361,7 @@ sys_clone_glue:
361 la %r2,SP_PTREGS(%r15) # load pt_regs 361 la %r2,SP_PTREGS(%r15) # load pt_regs
362 jg sys_clone # branch to sys_clone 362 jg sys_clone # branch to sys_clone
363 363
364#ifdef CONFIG_S390_SUPPORT 364#ifdef CONFIG_COMPAT
365sys32_clone_glue: 365sys32_clone_glue:
366 la %r2,SP_PTREGS(%r15) # load pt_regs 366 la %r2,SP_PTREGS(%r15) # load pt_regs
367 jg sys32_clone # branch to sys32_clone 367 jg sys32_clone # branch to sys32_clone
@@ -383,7 +383,7 @@ sys_execve_glue:
383 bnz 0(%r12) # it did fail -> store result in gpr2 383 bnz 0(%r12) # it did fail -> store result in gpr2
384 b 6(%r12) # SKIP STG 2,SP_R2(15) in 384 b 6(%r12) # SKIP STG 2,SP_R2(15) in
385 # system_call/sysc_tracesys 385 # system_call/sysc_tracesys
386#ifdef CONFIG_S390_SUPPORT 386#ifdef CONFIG_COMPAT
387sys32_execve_glue: 387sys32_execve_glue:
388 la %r2,SP_PTREGS(%r15) # load pt_regs 388 la %r2,SP_PTREGS(%r15) # load pt_regs
389 lgr %r12,%r14 # save return address 389 lgr %r12,%r14 # save return address
@@ -398,7 +398,7 @@ sys_sigreturn_glue:
398 la %r2,SP_PTREGS(%r15) # load pt_regs as parameter 398 la %r2,SP_PTREGS(%r15) # load pt_regs as parameter
399 jg sys_sigreturn # branch to sys_sigreturn 399 jg sys_sigreturn # branch to sys_sigreturn
400 400
401#ifdef CONFIG_S390_SUPPORT 401#ifdef CONFIG_COMPAT
402sys32_sigreturn_glue: 402sys32_sigreturn_glue:
403 la %r2,SP_PTREGS(%r15) # load pt_regs as parameter 403 la %r2,SP_PTREGS(%r15) # load pt_regs as parameter
404 jg sys32_sigreturn # branch to sys32_sigreturn 404 jg sys32_sigreturn # branch to sys32_sigreturn
@@ -408,7 +408,7 @@ sys_rt_sigreturn_glue:
408 la %r2,SP_PTREGS(%r15) # load pt_regs as parameter 408 la %r2,SP_PTREGS(%r15) # load pt_regs as parameter
409 jg sys_rt_sigreturn # branch to sys_sigreturn 409 jg sys_rt_sigreturn # branch to sys_sigreturn
410 410
411#ifdef CONFIG_S390_SUPPORT 411#ifdef CONFIG_COMPAT
412sys32_rt_sigreturn_glue: 412sys32_rt_sigreturn_glue:
413 la %r2,SP_PTREGS(%r15) # load pt_regs as parameter 413 la %r2,SP_PTREGS(%r15) # load pt_regs as parameter
414 jg sys32_rt_sigreturn # branch to sys32_sigreturn 414 jg sys32_rt_sigreturn # branch to sys32_sigreturn
@@ -429,7 +429,7 @@ sys_sigsuspend_glue:
429 la %r14,6(%r14) # skip store of return value 429 la %r14,6(%r14) # skip store of return value
430 jg sys_sigsuspend # branch to sys_sigsuspend 430 jg sys_sigsuspend # branch to sys_sigsuspend
431 431
432#ifdef CONFIG_S390_SUPPORT 432#ifdef CONFIG_COMPAT
433sys32_sigsuspend_glue: 433sys32_sigsuspend_glue:
434 llgfr %r4,%r4 # unsigned long 434 llgfr %r4,%r4 # unsigned long
435 lgr %r5,%r4 # move mask back 435 lgr %r5,%r4 # move mask back
@@ -449,7 +449,7 @@ sys_rt_sigsuspend_glue:
449 la %r14,6(%r14) # skip store of return value 449 la %r14,6(%r14) # skip store of return value
450 jg sys_rt_sigsuspend # branch to sys_rt_sigsuspend 450 jg sys_rt_sigsuspend # branch to sys_rt_sigsuspend
451 451
452#ifdef CONFIG_S390_SUPPORT 452#ifdef CONFIG_COMPAT
453sys32_rt_sigsuspend_glue: 453sys32_rt_sigsuspend_glue:
454 llgfr %r3,%r3 # size_t 454 llgfr %r3,%r3 # size_t
455 lgr %r4,%r3 # move sigsetsize parameter 455 lgr %r4,%r3 # move sigsetsize parameter
@@ -464,7 +464,7 @@ sys_sigaltstack_glue:
464 la %r4,SP_PTREGS(%r15) # load pt_regs as parameter 464 la %r4,SP_PTREGS(%r15) # load pt_regs as parameter
465 jg sys_sigaltstack # branch to sys_sigreturn 465 jg sys_sigaltstack # branch to sys_sigreturn
466 466
467#ifdef CONFIG_S390_SUPPORT 467#ifdef CONFIG_COMPAT
468sys32_sigaltstack_glue: 468sys32_sigaltstack_glue:
469 la %r4,SP_PTREGS(%r15) # load pt_regs as parameter 469 la %r4,SP_PTREGS(%r15) # load pt_regs as parameter
470 jg sys32_sigaltstack_wrapper # branch to sys_sigreturn 470 jg sys32_sigaltstack_wrapper # branch to sys_sigreturn
@@ -1009,7 +1009,7 @@ sys_call_table:
1009#include "syscalls.S" 1009#include "syscalls.S"
1010#undef SYSCALL 1010#undef SYSCALL
1011 1011
1012#ifdef CONFIG_S390_SUPPORT 1012#ifdef CONFIG_COMPAT
1013 1013
1014#define SYSCALL(esa,esame,emu) .long emu 1014#define SYSCALL(esa,esame,emu) .long emu
1015 .globl sys_call_table_emu 1015 .globl sys_call_table_emu
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index d31a97c89f68..ea88d066bf04 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -30,7 +30,7 @@
30#include <asm/thread_info.h> 30#include <asm/thread_info.h>
31#include <asm/page.h> 31#include <asm/page.h>
32 32
33#ifdef CONFIG_ARCH_S390X 33#ifdef CONFIG_64BIT
34#define ARCH_OFFSET 4 34#define ARCH_OFFSET 4
35#else 35#else
36#define ARCH_OFFSET 0 36#define ARCH_OFFSET 0
@@ -539,7 +539,7 @@ ipl_devno:
539 .word 0 539 .word 0
540.endm 540.endm
541 541
542#ifdef CONFIG_ARCH_S390X 542#ifdef CONFIG_64BIT
543#include "head64.S" 543#include "head64.S"
544#else 544#else
545#include "head31.S" 545#include "head31.S"
diff --git a/arch/s390/kernel/machine_kexec.c b/arch/s390/kernel/machine_kexec.c
index 5aa71b05b8ae..f0ed5c642c74 100644
--- a/arch/s390/kernel/machine_kexec.c
+++ b/arch/s390/kernel/machine_kexec.c
@@ -85,7 +85,7 @@ kexec_halt_all_cpus(void *kernel_image)
85 pfault_fini(); 85 pfault_fini();
86#endif 86#endif
87 87
88 if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid)) 88 if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1)
89 signal_processor(smp_processor_id(), sigp_stop); 89 signal_processor(smp_processor_id(), sigp_stop);
90 90
91 /* Wait for all other cpus to enter stopped state */ 91 /* Wait for all other cpus to enter stopped state */
diff --git a/arch/s390/kernel/module.c b/arch/s390/kernel/module.c
index 607d506689c8..c271cdab58e2 100644
--- a/arch/s390/kernel/module.c
+++ b/arch/s390/kernel/module.c
@@ -37,11 +37,11 @@
37#define DEBUGP(fmt , ...) 37#define DEBUGP(fmt , ...)
38#endif 38#endif
39 39
40#ifndef CONFIG_ARCH_S390X 40#ifndef CONFIG_64BIT
41#define PLT_ENTRY_SIZE 12 41#define PLT_ENTRY_SIZE 12
42#else /* CONFIG_ARCH_S390X */ 42#else /* CONFIG_64BIT */
43#define PLT_ENTRY_SIZE 20 43#define PLT_ENTRY_SIZE 20
44#endif /* CONFIG_ARCH_S390X */ 44#endif /* CONFIG_64BIT */
45 45
46void *module_alloc(unsigned long size) 46void *module_alloc(unsigned long size)
47{ 47{
@@ -294,17 +294,17 @@ apply_rela(Elf_Rela *rela, Elf_Addr base, Elf_Sym *symtab,
294 unsigned int *ip; 294 unsigned int *ip;
295 ip = me->module_core + me->arch.plt_offset + 295 ip = me->module_core + me->arch.plt_offset +
296 info->plt_offset; 296 info->plt_offset;
297#ifndef CONFIG_ARCH_S390X 297#ifndef CONFIG_64BIT
298 ip[0] = 0x0d105810; /* basr 1,0; l 1,6(1); br 1 */ 298 ip[0] = 0x0d105810; /* basr 1,0; l 1,6(1); br 1 */
299 ip[1] = 0x100607f1; 299 ip[1] = 0x100607f1;
300 ip[2] = val; 300 ip[2] = val;
301#else /* CONFIG_ARCH_S390X */ 301#else /* CONFIG_64BIT */
302 ip[0] = 0x0d10e310; /* basr 1,0; lg 1,10(1); br 1 */ 302 ip[0] = 0x0d10e310; /* basr 1,0; lg 1,10(1); br 1 */
303 ip[1] = 0x100a0004; 303 ip[1] = 0x100a0004;
304 ip[2] = 0x07f10000; 304 ip[2] = 0x07f10000;
305 ip[3] = (unsigned int) (val >> 32); 305 ip[3] = (unsigned int) (val >> 32);
306 ip[4] = (unsigned int) val; 306 ip[4] = (unsigned int) val;
307#endif /* CONFIG_ARCH_S390X */ 307#endif /* CONFIG_64BIT */
308 info->plt_initialized = 1; 308 info->plt_initialized = 1;
309 } 309 }
310 if (r_type == R_390_PLTOFF16 || 310 if (r_type == R_390_PLTOFF16 ||
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 78b64fe5e7c2..008c74526fd3 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -58,10 +58,18 @@ asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
58 */ 58 */
59unsigned long thread_saved_pc(struct task_struct *tsk) 59unsigned long thread_saved_pc(struct task_struct *tsk)
60{ 60{
61 struct stack_frame *sf; 61 struct stack_frame *sf, *low, *high;
62 62
63 sf = (struct stack_frame *) tsk->thread.ksp; 63 if (!tsk || !task_stack_page(tsk))
64 sf = (struct stack_frame *) sf->back_chain; 64 return 0;
65 low = task_stack_page(tsk);
66 high = (struct stack_frame *) task_pt_regs(tsk);
67 sf = (struct stack_frame *) (tsk->thread.ksp & PSW_ADDR_INSN);
68 if (sf <= low || sf > high)
69 return 0;
70 sf = (struct stack_frame *) (sf->back_chain & PSW_ADDR_INSN);
71 if (sf <= low || sf > high)
72 return 0;
65 return sf->gprs[8]; 73 return sf->gprs[8];
66} 74}
67 75
@@ -153,7 +161,7 @@ void show_regs(struct pt_regs *regs)
153{ 161{
154 struct task_struct *tsk = current; 162 struct task_struct *tsk = current;
155 163
156 printk("CPU: %d %s\n", tsk->thread_info->cpu, print_tainted()); 164 printk("CPU: %d %s\n", task_thread_info(tsk)->cpu, print_tainted());
157 printk("Process %s (pid: %d, task: %p, ksp: %p)\n", 165 printk("Process %s (pid: %d, task: %p, ksp: %p)\n",
158 current->comm, current->pid, (void *) tsk, 166 current->comm, current->pid, (void *) tsk,
159 (void *) tsk->thread.ksp); 167 (void *) tsk->thread.ksp);
@@ -217,8 +225,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
217 struct pt_regs childregs; 225 struct pt_regs childregs;
218 } *frame; 226 } *frame;
219 227
220 frame = ((struct fake_frame *) 228 frame = container_of(task_pt_regs(p), struct fake_frame, childregs);
221 (THREAD_SIZE + (unsigned long) p->thread_info)) - 1;
222 p->thread.ksp = (unsigned long) frame; 229 p->thread.ksp = (unsigned long) frame;
223 /* Store access registers to kernel stack of new process. */ 230 /* Store access registers to kernel stack of new process. */
224 frame->childregs = *regs; 231 frame->childregs = *regs;
@@ -235,7 +242,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
235 /* Save access registers to new thread structure. */ 242 /* Save access registers to new thread structure. */
236 save_access_regs(&p->thread.acrs[0]); 243 save_access_regs(&p->thread.acrs[0]);
237 244
238#ifndef CONFIG_ARCH_S390X 245#ifndef CONFIG_64BIT
239 /* 246 /*
240 * save fprs to current->thread.fp_regs to merge them with 247 * save fprs to current->thread.fp_regs to merge them with
241 * the emulated registers and then copy the result to the child. 248 * the emulated registers and then copy the result to the child.
@@ -247,7 +254,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
247 /* Set a new TLS ? */ 254 /* Set a new TLS ? */
248 if (clone_flags & CLONE_SETTLS) 255 if (clone_flags & CLONE_SETTLS)
249 p->thread.acrs[0] = regs->gprs[6]; 256 p->thread.acrs[0] = regs->gprs[6];
250#else /* CONFIG_ARCH_S390X */ 257#else /* CONFIG_64BIT */
251 /* Save the fpu registers to new thread structure. */ 258 /* Save the fpu registers to new thread structure. */
252 save_fp_regs(&p->thread.fp_regs); 259 save_fp_regs(&p->thread.fp_regs);
253 p->thread.user_seg = __pa((unsigned long) p->mm->pgd) | _REGION_TABLE; 260 p->thread.user_seg = __pa((unsigned long) p->mm->pgd) | _REGION_TABLE;
@@ -260,7 +267,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long new_stackp,
260 p->thread.acrs[1] = (unsigned int) regs->gprs[6]; 267 p->thread.acrs[1] = (unsigned int) regs->gprs[6];
261 } 268 }
262 } 269 }
263#endif /* CONFIG_ARCH_S390X */ 270#endif /* CONFIG_64BIT */
264 /* start new process with ar4 pointing to the correct address space */ 271 /* start new process with ar4 pointing to the correct address space */
265 p->thread.mm_segment = get_fs(); 272 p->thread.mm_segment = get_fs();
266 /* Don't copy debug registers */ 273 /* Don't copy debug registers */
@@ -339,51 +346,29 @@ out:
339 */ 346 */
340int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs) 347int dump_fpu (struct pt_regs * regs, s390_fp_regs *fpregs)
341{ 348{
342#ifndef CONFIG_ARCH_S390X 349#ifndef CONFIG_64BIT
343 /* 350 /*
344 * save fprs to current->thread.fp_regs to merge them with 351 * save fprs to current->thread.fp_regs to merge them with
345 * the emulated registers and then copy the result to the dump. 352 * the emulated registers and then copy the result to the dump.
346 */ 353 */
347 save_fp_regs(&current->thread.fp_regs); 354 save_fp_regs(&current->thread.fp_regs);
348 memcpy(fpregs, &current->thread.fp_regs, sizeof(s390_fp_regs)); 355 memcpy(fpregs, &current->thread.fp_regs, sizeof(s390_fp_regs));
349#else /* CONFIG_ARCH_S390X */ 356#else /* CONFIG_64BIT */
350 save_fp_regs(fpregs); 357 save_fp_regs(fpregs);
351#endif /* CONFIG_ARCH_S390X */ 358#endif /* CONFIG_64BIT */
352 return 1; 359 return 1;
353} 360}
354 361
355/*
356 * fill in the user structure for a core dump..
357 */
358void dump_thread(struct pt_regs * regs, struct user * dump)
359{
360
361/* changed the size calculations - should hopefully work better. lbt */
362 dump->magic = CMAGIC;
363 dump->start_code = 0;
364 dump->start_stack = regs->gprs[15] & ~(PAGE_SIZE - 1);
365 dump->u_tsize = current->mm->end_code >> PAGE_SHIFT;
366 dump->u_dsize = (current->mm->brk + PAGE_SIZE - 1) >> PAGE_SHIFT;
367 dump->u_dsize -= dump->u_tsize;
368 dump->u_ssize = 0;
369 if (dump->start_stack < TASK_SIZE)
370 dump->u_ssize = (TASK_SIZE - dump->start_stack) >> PAGE_SHIFT;
371 memcpy(&dump->regs, regs, sizeof(s390_regs));
372 dump_fpu (regs, &dump->regs.fp_regs);
373 dump->regs.per_info = current->thread.per_info;
374}
375
376unsigned long get_wchan(struct task_struct *p) 362unsigned long get_wchan(struct task_struct *p)
377{ 363{
378 struct stack_frame *sf, *low, *high; 364 struct stack_frame *sf, *low, *high;
379 unsigned long return_address; 365 unsigned long return_address;
380 int count; 366 int count;
381 367
382 if (!p || p == current || p->state == TASK_RUNNING || !p->thread_info) 368 if (!p || p == current || p->state == TASK_RUNNING || !task_stack_page(p))
383 return 0; 369 return 0;
384 low = (struct stack_frame *) p->thread_info; 370 low = task_stack_page(p);
385 high = (struct stack_frame *) 371 high = (struct stack_frame *) task_pt_regs(p);
386 ((unsigned long) p->thread_info + THREAD_SIZE) - 1;
387 sf = (struct stack_frame *) (p->thread.ksp & PSW_ADDR_INSN); 372 sf = (struct stack_frame *) (p->thread.ksp & PSW_ADDR_INSN);
388 if (sf <= low || sf > high) 373 if (sf <= low || sf > high)
389 return 0; 374 return 0;
diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 06afa3103ace..37dfe33dab73 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -42,7 +42,7 @@
42#include <asm/uaccess.h> 42#include <asm/uaccess.h>
43#include <asm/unistd.h> 43#include <asm/unistd.h>
44 44
45#ifdef CONFIG_S390_SUPPORT 45#ifdef CONFIG_COMPAT
46#include "compat_ptrace.h" 46#include "compat_ptrace.h"
47#endif 47#endif
48 48
@@ -52,14 +52,14 @@ FixPerRegisters(struct task_struct *task)
52 struct pt_regs *regs; 52 struct pt_regs *regs;
53 per_struct *per_info; 53 per_struct *per_info;
54 54
55 regs = __KSTK_PTREGS(task); 55 regs = task_pt_regs(task);
56 per_info = (per_struct *) &task->thread.per_info; 56 per_info = (per_struct *) &task->thread.per_info;
57 per_info->control_regs.bits.em_instruction_fetch = 57 per_info->control_regs.bits.em_instruction_fetch =
58 per_info->single_step | per_info->instruction_fetch; 58 per_info->single_step | per_info->instruction_fetch;
59 59
60 if (per_info->single_step) { 60 if (per_info->single_step) {
61 per_info->control_regs.bits.starting_addr = 0; 61 per_info->control_regs.bits.starting_addr = 0;
62#ifdef CONFIG_S390_SUPPORT 62#ifdef CONFIG_COMPAT
63 if (test_thread_flag(TIF_31BIT)) 63 if (test_thread_flag(TIF_31BIT))
64 per_info->control_regs.bits.ending_addr = 0x7fffffffUL; 64 per_info->control_regs.bits.ending_addr = 0x7fffffffUL;
65 else 65 else
@@ -112,7 +112,7 @@ ptrace_disable(struct task_struct *child)
112 clear_single_step(child); 112 clear_single_step(child);
113} 113}
114 114
115#ifndef CONFIG_ARCH_S390X 115#ifndef CONFIG_64BIT
116# define __ADDR_MASK 3 116# define __ADDR_MASK 3
117#else 117#else
118# define __ADDR_MASK 7 118# define __ADDR_MASK 7
@@ -138,7 +138,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data)
138 * an alignment of 4. Programmers from hell... 138 * an alignment of 4. Programmers from hell...
139 */ 139 */
140 mask = __ADDR_MASK; 140 mask = __ADDR_MASK;
141#ifdef CONFIG_ARCH_S390X 141#ifdef CONFIG_64BIT
142 if (addr >= (addr_t) &dummy->regs.acrs && 142 if (addr >= (addr_t) &dummy->regs.acrs &&
143 addr < (addr_t) &dummy->regs.orig_gpr2) 143 addr < (addr_t) &dummy->regs.orig_gpr2)
144 mask = 3; 144 mask = 3;
@@ -150,7 +150,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data)
150 /* 150 /*
151 * psw and gprs are stored on the stack 151 * psw and gprs are stored on the stack
152 */ 152 */
153 tmp = *(addr_t *)((addr_t) &__KSTK_PTREGS(child)->psw + addr); 153 tmp = *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr);
154 if (addr == (addr_t) &dummy->regs.psw.mask) 154 if (addr == (addr_t) &dummy->regs.psw.mask)
155 /* Remove per bit from user psw. */ 155 /* Remove per bit from user psw. */
156 tmp &= ~PSW_MASK_PER; 156 tmp &= ~PSW_MASK_PER;
@@ -160,7 +160,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data)
160 * access registers are stored in the thread structure 160 * access registers are stored in the thread structure
161 */ 161 */
162 offset = addr - (addr_t) &dummy->regs.acrs; 162 offset = addr - (addr_t) &dummy->regs.acrs;
163#ifdef CONFIG_ARCH_S390X 163#ifdef CONFIG_64BIT
164 /* 164 /*
165 * Very special case: old & broken 64 bit gdb reading 165 * Very special case: old & broken 64 bit gdb reading
166 * from acrs[15]. Result is a 64 bit value. Read the 166 * from acrs[15]. Result is a 64 bit value. Read the
@@ -176,7 +176,7 @@ peek_user(struct task_struct *child, addr_t addr, addr_t data)
176 /* 176 /*
177 * orig_gpr2 is stored on the kernel stack 177 * orig_gpr2 is stored on the kernel stack
178 */ 178 */
179 tmp = (addr_t) __KSTK_PTREGS(child)->orig_gpr2; 179 tmp = (addr_t) task_pt_regs(child)->orig_gpr2;
180 180
181 } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) { 181 } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
182 /* 182 /*
@@ -218,7 +218,7 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
218 * an alignment of 4. Programmers from hell indeed... 218 * an alignment of 4. Programmers from hell indeed...
219 */ 219 */
220 mask = __ADDR_MASK; 220 mask = __ADDR_MASK;
221#ifdef CONFIG_ARCH_S390X 221#ifdef CONFIG_64BIT
222 if (addr >= (addr_t) &dummy->regs.acrs && 222 if (addr >= (addr_t) &dummy->regs.acrs &&
223 addr < (addr_t) &dummy->regs.orig_gpr2) 223 addr < (addr_t) &dummy->regs.orig_gpr2)
224 mask = 3; 224 mask = 3;
@@ -231,26 +231,26 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
231 * psw and gprs are stored on the stack 231 * psw and gprs are stored on the stack
232 */ 232 */
233 if (addr == (addr_t) &dummy->regs.psw.mask && 233 if (addr == (addr_t) &dummy->regs.psw.mask &&
234#ifdef CONFIG_S390_SUPPORT 234#ifdef CONFIG_COMPAT
235 data != PSW_MASK_MERGE(PSW_USER32_BITS, data) && 235 data != PSW_MASK_MERGE(PSW_USER32_BITS, data) &&
236#endif 236#endif
237 data != PSW_MASK_MERGE(PSW_USER_BITS, data)) 237 data != PSW_MASK_MERGE(PSW_USER_BITS, data))
238 /* Invalid psw mask. */ 238 /* Invalid psw mask. */
239 return -EINVAL; 239 return -EINVAL;
240#ifndef CONFIG_ARCH_S390X 240#ifndef CONFIG_64BIT
241 if (addr == (addr_t) &dummy->regs.psw.addr) 241 if (addr == (addr_t) &dummy->regs.psw.addr)
242 /* I'd like to reject addresses without the 242 /* I'd like to reject addresses without the
243 high order bit but older gdb's rely on it */ 243 high order bit but older gdb's rely on it */
244 data |= PSW_ADDR_AMODE; 244 data |= PSW_ADDR_AMODE;
245#endif 245#endif
246 *(addr_t *)((addr_t) &__KSTK_PTREGS(child)->psw + addr) = data; 246 *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr) = data;
247 247
248 } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) { 248 } else if (addr < (addr_t) (&dummy->regs.orig_gpr2)) {
249 /* 249 /*
250 * access registers are stored in the thread structure 250 * access registers are stored in the thread structure
251 */ 251 */
252 offset = addr - (addr_t) &dummy->regs.acrs; 252 offset = addr - (addr_t) &dummy->regs.acrs;
253#ifdef CONFIG_ARCH_S390X 253#ifdef CONFIG_64BIT
254 /* 254 /*
255 * Very special case: old & broken 64 bit gdb writing 255 * Very special case: old & broken 64 bit gdb writing
256 * to acrs[15] with a 64 bit value. Ignore the lower 256 * to acrs[15] with a 64 bit value. Ignore the lower
@@ -267,7 +267,7 @@ poke_user(struct task_struct *child, addr_t addr, addr_t data)
267 /* 267 /*
268 * orig_gpr2 is stored on the kernel stack 268 * orig_gpr2 is stored on the kernel stack
269 */ 269 */
270 __KSTK_PTREGS(child)->orig_gpr2 = data; 270 task_pt_regs(child)->orig_gpr2 = data;
271 271
272 } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) { 272 } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) {
273 /* 273 /*
@@ -357,7 +357,7 @@ do_ptrace_normal(struct task_struct *child, long request, long addr, long data)
357 return ptrace_request(child, request, addr, data); 357 return ptrace_request(child, request, addr, data);
358} 358}
359 359
360#ifdef CONFIG_S390_SUPPORT 360#ifdef CONFIG_COMPAT
361/* 361/*
362 * Now the fun part starts... a 31 bit program running in the 362 * Now the fun part starts... a 31 bit program running in the
363 * 31 bit emulation tracing another program. PTRACE_PEEKTEXT, 363 * 31 bit emulation tracing another program. PTRACE_PEEKTEXT,
@@ -393,15 +393,15 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
393 */ 393 */
394 if (addr == (addr_t) &dummy32->regs.psw.mask) { 394 if (addr == (addr_t) &dummy32->regs.psw.mask) {
395 /* Fake a 31 bit psw mask. */ 395 /* Fake a 31 bit psw mask. */
396 tmp = (__u32)(__KSTK_PTREGS(child)->psw.mask >> 32); 396 tmp = (__u32)(task_pt_regs(child)->psw.mask >> 32);
397 tmp = PSW32_MASK_MERGE(PSW32_USER_BITS, tmp); 397 tmp = PSW32_MASK_MERGE(PSW32_USER_BITS, tmp);
398 } else if (addr == (addr_t) &dummy32->regs.psw.addr) { 398 } else if (addr == (addr_t) &dummy32->regs.psw.addr) {
399 /* Fake a 31 bit psw address. */ 399 /* Fake a 31 bit psw address. */
400 tmp = (__u32) __KSTK_PTREGS(child)->psw.addr | 400 tmp = (__u32) task_pt_regs(child)->psw.addr |
401 PSW32_ADDR_AMODE31; 401 PSW32_ADDR_AMODE31;
402 } else { 402 } else {
403 /* gpr 0-15 */ 403 /* gpr 0-15 */
404 tmp = *(__u32 *)((addr_t) &__KSTK_PTREGS(child)->psw + 404 tmp = *(__u32 *)((addr_t) &task_pt_regs(child)->psw +
405 addr*2 + 4); 405 addr*2 + 4);
406 } 406 }
407 } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) { 407 } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {
@@ -415,7 +415,7 @@ peek_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
415 /* 415 /*
416 * orig_gpr2 is stored on the kernel stack 416 * orig_gpr2 is stored on the kernel stack
417 */ 417 */
418 tmp = *(__u32*)((addr_t) &__KSTK_PTREGS(child)->orig_gpr2 + 4); 418 tmp = *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4);
419 419
420 } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { 420 } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
421 /* 421 /*
@@ -472,15 +472,15 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
472 if (tmp != PSW32_MASK_MERGE(PSW32_USER_BITS, tmp)) 472 if (tmp != PSW32_MASK_MERGE(PSW32_USER_BITS, tmp))
473 /* Invalid psw mask. */ 473 /* Invalid psw mask. */
474 return -EINVAL; 474 return -EINVAL;
475 __KSTK_PTREGS(child)->psw.mask = 475 task_pt_regs(child)->psw.mask =
476 PSW_MASK_MERGE(PSW_USER32_BITS, (__u64) tmp << 32); 476 PSW_MASK_MERGE(PSW_USER32_BITS, (__u64) tmp << 32);
477 } else if (addr == (addr_t) &dummy32->regs.psw.addr) { 477 } else if (addr == (addr_t) &dummy32->regs.psw.addr) {
478 /* Build a 64 bit psw address from 31 bit address. */ 478 /* Build a 64 bit psw address from 31 bit address. */
479 __KSTK_PTREGS(child)->psw.addr = 479 task_pt_regs(child)->psw.addr =
480 (__u64) tmp & PSW32_ADDR_INSN; 480 (__u64) tmp & PSW32_ADDR_INSN;
481 } else { 481 } else {
482 /* gpr 0-15 */ 482 /* gpr 0-15 */
483 *(__u32*)((addr_t) &__KSTK_PTREGS(child)->psw 483 *(__u32*)((addr_t) &task_pt_regs(child)->psw
484 + addr*2 + 4) = tmp; 484 + addr*2 + 4) = tmp;
485 } 485 }
486 } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) { 486 } else if (addr < (addr_t) (&dummy32->regs.orig_gpr2)) {
@@ -494,7 +494,7 @@ poke_user_emu31(struct task_struct *child, addr_t addr, addr_t data)
494 /* 494 /*
495 * orig_gpr2 is stored on the kernel stack 495 * orig_gpr2 is stored on the kernel stack
496 */ 496 */
497 *(__u32*)((addr_t) &__KSTK_PTREGS(child)->orig_gpr2 + 4) = tmp; 497 *(__u32*)((addr_t) &task_pt_regs(child)->orig_gpr2 + 4) = tmp;
498 498
499 } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) { 499 } else if (addr < (addr_t) (&dummy32->regs.fp_regs + 1)) {
500 /* 500 /*
@@ -629,7 +629,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
629 return peek_user(child, addr, data); 629 return peek_user(child, addr, data);
630 if (request == PTRACE_POKEUSR && addr == PT_IEEE_IP) 630 if (request == PTRACE_POKEUSR && addr == PT_IEEE_IP)
631 return poke_user(child, addr, data); 631 return poke_user(child, addr, data);
632#ifdef CONFIG_S390_SUPPORT 632#ifdef CONFIG_COMPAT
633 if (request == PTRACE_PEEKUSR && 633 if (request == PTRACE_PEEKUSR &&
634 addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT)) 634 addr == PT32_IEEE_IP && test_thread_flag(TIF_31BIT))
635 return peek_user_emu31(child, addr, data); 635 return peek_user_emu31(child, addr, data);
@@ -695,7 +695,7 @@ do_ptrace(struct task_struct *child, long request, long addr, long data)
695 695
696 /* Do requests that differ for 31/64 bit */ 696 /* Do requests that differ for 31/64 bit */
697 default: 697 default:
698#ifdef CONFIG_S390_SUPPORT 698#ifdef CONFIG_COMPAT
699 if (test_thread_flag(TIF_31BIT)) 699 if (test_thread_flag(TIF_31BIT))
700 return do_ptrace_emu31(child, request, addr, data); 700 return do_ptrace_emu31(child, request, addr, data);
701#endif 701#endif
@@ -712,35 +712,18 @@ sys_ptrace(long request, long pid, long addr, long data)
712 int ret; 712 int ret;
713 713
714 lock_kernel(); 714 lock_kernel();
715
716 if (request == PTRACE_TRACEME) { 715 if (request == PTRACE_TRACEME) {
717 /* are we already being traced? */ 716 ret = ptrace_traceme();
718 ret = -EPERM; 717 goto out;
719 if (current->ptrace & PT_PTRACED)
720 goto out;
721 ret = security_ptrace(current->parent, current);
722 if (ret)
723 goto out;
724 /* set the ptrace bit in the process flags. */
725 current->ptrace |= PT_PTRACED;
726 goto out;
727 } 718 }
728 719
729 ret = -EPERM; 720 child = ptrace_get_task_struct(pid);
730 if (pid == 1) /* you may not mess with init */ 721 if (IS_ERR(child)) {
731 goto out; 722 ret = PTR_ERR(child);
732
733 ret = -ESRCH;
734 read_lock(&tasklist_lock);
735 child = find_task_by_pid(pid);
736 if (child)
737 get_task_struct(child);
738 read_unlock(&tasklist_lock);
739 if (!child)
740 goto out; 723 goto out;
724 }
741 725
742 ret = do_ptrace(child, request, addr, data); 726 ret = do_ptrace(child, request, addr, data);
743
744 put_task_struct(child); 727 put_task_struct(child);
745out: 728out:
746 unlock_kernel(); 729 unlock_kernel();
diff --git a/arch/s390/kernel/reipl_diag.c b/arch/s390/kernel/reipl_diag.c
index 83cb42bc0b76..1f33951ba439 100644
--- a/arch/s390/kernel/reipl_diag.c
+++ b/arch/s390/kernel/reipl_diag.c
@@ -26,7 +26,7 @@ void reipl_diag(void)
26 " st %%r4,%0\n" 26 " st %%r4,%0\n"
27 " st %%r5,%1\n" 27 " st %%r5,%1\n"
28 ".section __ex_table,\"a\"\n" 28 ".section __ex_table,\"a\"\n"
29#ifdef __s390x__ 29#ifdef CONFIG_64BIT
30 " .align 8\n" 30 " .align 8\n"
31 " .quad 0b, 0b\n" 31 " .quad 0b, 0b\n"
32#else 32#else
diff --git a/arch/s390/kernel/s390_ksyms.c b/arch/s390/kernel/s390_ksyms.c
index bee654abb6d3..4176c77670c4 100644
--- a/arch/s390/kernel/s390_ksyms.c
+++ b/arch/s390/kernel/s390_ksyms.c
@@ -10,7 +10,6 @@
10#include <linux/smp.h> 10#include <linux/smp.h>
11#include <linux/syscalls.h> 11#include <linux/syscalls.h>
12#include <linux/interrupt.h> 12#include <linux/interrupt.h>
13#include <linux/ioctl32.h>
14#include <asm/checksum.h> 13#include <asm/checksum.h>
15#include <asm/cpcmd.h> 14#include <asm/cpcmd.h>
16#include <asm/delay.h> 15#include <asm/delay.h>
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 31e7b19348b7..de8784267473 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -268,7 +268,7 @@ static void do_machine_restart_nonsmp(char * __unused)
268 reipl_diag(); 268 reipl_diag();
269 269
270 if (MACHINE_IS_VM) 270 if (MACHINE_IS_VM)
271 cpcmd ("IPL", NULL, 0); 271 cpcmd ("IPL", NULL, 0, NULL);
272 else 272 else
273 reipl (0x10000 | S390_lowcore.ipl_device); 273 reipl (0x10000 | S390_lowcore.ipl_device);
274} 274}
@@ -276,14 +276,14 @@ static void do_machine_restart_nonsmp(char * __unused)
276static void do_machine_halt_nonsmp(void) 276static void do_machine_halt_nonsmp(void)
277{ 277{
278 if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) 278 if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0)
279 cpcmd(vmhalt_cmd, NULL, 0); 279 cpcmd(vmhalt_cmd, NULL, 0, NULL);
280 signal_processor(smp_processor_id(), sigp_stop_and_store_status); 280 signal_processor(smp_processor_id(), sigp_stop_and_store_status);
281} 281}
282 282
283static void do_machine_power_off_nonsmp(void) 283static void do_machine_power_off_nonsmp(void)
284{ 284{
285 if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) 285 if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0)
286 cpcmd(vmpoff_cmd, NULL, 0); 286 cpcmd(vmpoff_cmd, NULL, 0, NULL);
287 signal_processor(smp_processor_id(), sigp_stop_and_store_status); 287 signal_processor(smp_processor_id(), sigp_stop_and_store_status);
288} 288}
289 289
@@ -315,6 +315,11 @@ void machine_power_off(void)
315 _machine_power_off(); 315 _machine_power_off();
316} 316}
317 317
318/*
319 * Dummy power off function.
320 */
321void (*pm_power_off)(void) = machine_power_off;
322
318static void __init 323static void __init
319add_memory_hole(unsigned long start, unsigned long end) 324add_memory_hole(unsigned long start, unsigned long end)
320{ 325{
@@ -427,7 +432,7 @@ setup_lowcore(void)
427 __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0) + PAGE_SIZE; 432 __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0) + PAGE_SIZE;
428 lc->current_task = (unsigned long) init_thread_union.thread_info.task; 433 lc->current_task = (unsigned long) init_thread_union.thread_info.task;
429 lc->thread_info = (unsigned long) &init_thread_union; 434 lc->thread_info = (unsigned long) &init_thread_union;
430#ifndef CONFIG_ARCH_S390X 435#ifndef CONFIG_64BIT
431 if (MACHINE_HAS_IEEE) { 436 if (MACHINE_HAS_IEEE) {
432 lc->extended_save_area_addr = (__u32) 437 lc->extended_save_area_addr = (__u32)
433 __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0); 438 __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0);
@@ -562,21 +567,21 @@ setup_arch(char **cmdline_p)
562 /* 567 /*
563 * print what head.S has found out about the machine 568 * print what head.S has found out about the machine
564 */ 569 */
565#ifndef CONFIG_ARCH_S390X 570#ifndef CONFIG_64BIT
566 printk((MACHINE_IS_VM) ? 571 printk((MACHINE_IS_VM) ?
567 "We are running under VM (31 bit mode)\n" : 572 "We are running under VM (31 bit mode)\n" :
568 "We are running native (31 bit mode)\n"); 573 "We are running native (31 bit mode)\n");
569 printk((MACHINE_HAS_IEEE) ? 574 printk((MACHINE_HAS_IEEE) ?
570 "This machine has an IEEE fpu\n" : 575 "This machine has an IEEE fpu\n" :
571 "This machine has no IEEE fpu\n"); 576 "This machine has no IEEE fpu\n");
572#else /* CONFIG_ARCH_S390X */ 577#else /* CONFIG_64BIT */
573 printk((MACHINE_IS_VM) ? 578 printk((MACHINE_IS_VM) ?
574 "We are running under VM (64 bit mode)\n" : 579 "We are running under VM (64 bit mode)\n" :
575 "We are running native (64 bit mode)\n"); 580 "We are running native (64 bit mode)\n");
576#endif /* CONFIG_ARCH_S390X */ 581#endif /* CONFIG_64BIT */
577 582
578 ROOT_DEV = Root_RAM0; 583 ROOT_DEV = Root_RAM0;
579#ifndef CONFIG_ARCH_S390X 584#ifndef CONFIG_64BIT
580 memory_end = memory_size & ~0x400000UL; /* align memory end to 4MB */ 585 memory_end = memory_size & ~0x400000UL; /* align memory end to 4MB */
581 /* 586 /*
582 * We need some free virtual space to be able to do vmalloc. 587 * We need some free virtual space to be able to do vmalloc.
@@ -585,9 +590,9 @@ setup_arch(char **cmdline_p)
585 */ 590 */
586 if (memory_end > 1920*1024*1024) 591 if (memory_end > 1920*1024*1024)
587 memory_end = 1920*1024*1024; 592 memory_end = 1920*1024*1024;
588#else /* CONFIG_ARCH_S390X */ 593#else /* CONFIG_64BIT */
589 memory_end = memory_size & ~0x200000UL; /* detected in head.s */ 594 memory_end = memory_size & ~0x200000UL; /* detected in head.s */
590#endif /* CONFIG_ARCH_S390X */ 595#endif /* CONFIG_64BIT */
591 596
592 init_mm.start_code = PAGE_OFFSET; 597 init_mm.start_code = PAGE_OFFSET;
593 init_mm.end_code = (unsigned long) &_etext; 598 init_mm.end_code = (unsigned long) &_etext;
diff --git a/arch/s390/kernel/signal.c b/arch/s390/kernel/signal.c
index 6e0110d71191..6ae4a77270b5 100644
--- a/arch/s390/kernel/signal.c
+++ b/arch/s390/kernel/signal.c
@@ -254,9 +254,9 @@ asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
254 if (restore_sigregs(regs, &frame->uc.uc_mcontext)) 254 if (restore_sigregs(regs, &frame->uc.uc_mcontext))
255 goto badframe; 255 goto badframe;
256 256
257 /* It is more difficult to avoid calling this function than to 257 if (do_sigaltstack(&frame->uc.uc_stack, NULL,
258 call it and ignore errors. */ 258 regs->gprs[15]) == -EFAULT)
259 do_sigaltstack(&frame->uc.uc_stack, NULL, regs->gprs[15]); 259 goto badframe;
260 return regs->gprs[2]; 260 return regs->gprs[2];
261 261
262badframe: 262badframe:
@@ -501,7 +501,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
501 501
502 if (signr > 0) { 502 if (signr > 0) {
503 /* Whee! Actually deliver the signal. */ 503 /* Whee! Actually deliver the signal. */
504#ifdef CONFIG_S390_SUPPORT 504#ifdef CONFIG_COMPAT
505 if (test_thread_flag(TIF_31BIT)) { 505 if (test_thread_flag(TIF_31BIT)) {
506 extern void handle_signal32(unsigned long sig, 506 extern void handle_signal32(unsigned long sig,
507 struct k_sigaction *ka, 507 struct k_sigaction *ka,
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 5856b3fda6bf..cbfcfd02a43a 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -263,7 +263,7 @@ static void do_machine_restart(void * __unused)
263 int cpu; 263 int cpu;
264 static atomic_t cpuid = ATOMIC_INIT(-1); 264 static atomic_t cpuid = ATOMIC_INIT(-1);
265 265
266 if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid)) 266 if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) != -1)
267 signal_processor(smp_processor_id(), sigp_stop); 267 signal_processor(smp_processor_id(), sigp_stop);
268 268
269 /* Wait for all other cpus to enter stopped state */ 269 /* Wait for all other cpus to enter stopped state */
@@ -313,7 +313,7 @@ static void do_machine_halt(void * __unused)
313{ 313{
314 static atomic_t cpuid = ATOMIC_INIT(-1); 314 static atomic_t cpuid = ATOMIC_INIT(-1);
315 315
316 if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) { 316 if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) == -1) {
317 smp_send_stop(); 317 smp_send_stop();
318 if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) 318 if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0)
319 cpcmd(vmhalt_cmd, NULL, 0, NULL); 319 cpcmd(vmhalt_cmd, NULL, 0, NULL);
@@ -332,7 +332,7 @@ static void do_machine_power_off(void * __unused)
332{ 332{
333 static atomic_t cpuid = ATOMIC_INIT(-1); 333 static atomic_t cpuid = ATOMIC_INIT(-1);
334 334
335 if (atomic_compare_and_swap(-1, smp_processor_id(), &cpuid) == 0) { 335 if (atomic_cmpxchg(&cpuid, -1, smp_processor_id()) == -1) {
336 smp_send_stop(); 336 smp_send_stop();
337 if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0) 337 if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0)
338 cpcmd(vmpoff_cmd, NULL, 0, NULL); 338 cpcmd(vmpoff_cmd, NULL, 0, NULL);
@@ -402,7 +402,7 @@ static void smp_ext_bitcall_others(ec_bit_sig sig)
402 } 402 }
403} 403}
404 404
405#ifndef CONFIG_ARCH_S390X 405#ifndef CONFIG_64BIT
406/* 406/*
407 * this function sends a 'purge tlb' signal to another CPU. 407 * this function sends a 'purge tlb' signal to another CPU.
408 */ 408 */
@@ -416,7 +416,7 @@ void smp_ptlb_all(void)
416 on_each_cpu(smp_ptlb_callback, NULL, 0, 1); 416 on_each_cpu(smp_ptlb_callback, NULL, 0, 1);
417} 417}
418EXPORT_SYMBOL(smp_ptlb_all); 418EXPORT_SYMBOL(smp_ptlb_all);
419#endif /* ! CONFIG_ARCH_S390X */ 419#endif /* ! CONFIG_64BIT */
420 420
421/* 421/*
422 * this function sends a 'reschedule' IPI to another CPU. 422 * this function sends a 'reschedule' IPI to another CPU.
@@ -657,7 +657,7 @@ __cpu_up(unsigned int cpu)
657 idle = current_set[cpu]; 657 idle = current_set[cpu];
658 cpu_lowcore = lowcore_ptr[cpu]; 658 cpu_lowcore = lowcore_ptr[cpu];
659 cpu_lowcore->kernel_stack = (unsigned long) 659 cpu_lowcore->kernel_stack = (unsigned long)
660 idle->thread_info + (THREAD_SIZE); 660 task_stack_page(idle) + (THREAD_SIZE);
661 sf = (struct stack_frame *) (cpu_lowcore->kernel_stack 661 sf = (struct stack_frame *) (cpu_lowcore->kernel_stack
662 - sizeof(struct pt_regs) 662 - sizeof(struct pt_regs)
663 - sizeof(struct stack_frame)); 663 - sizeof(struct stack_frame));
@@ -783,7 +783,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
783 if (stack == 0ULL) 783 if (stack == 0ULL)
784 panic("smp_boot_cpus failed to allocate memory\n"); 784 panic("smp_boot_cpus failed to allocate memory\n");
785 lowcore_ptr[i]->panic_stack = stack + (PAGE_SIZE); 785 lowcore_ptr[i]->panic_stack = stack + (PAGE_SIZE);
786#ifndef __s390x__ 786#ifndef CONFIG_64BIT
787 if (MACHINE_HAS_IEEE) { 787 if (MACHINE_HAS_IEEE) {
788 lowcore_ptr[i]->extended_save_area_addr = 788 lowcore_ptr[i]->extended_save_area_addr =
789 (__u32) __get_free_pages(GFP_KERNEL,0); 789 (__u32) __get_free_pages(GFP_KERNEL,0);
@@ -793,7 +793,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
793 } 793 }
794#endif 794#endif
795 } 795 }
796#ifndef __s390x__ 796#ifndef CONFIG_64BIT
797 if (MACHINE_HAS_IEEE) 797 if (MACHINE_HAS_IEEE)
798 ctl_set_bit(14, 29); /* enable extended save area */ 798 ctl_set_bit(14, 29); /* enable extended save area */
799#endif 799#endif
diff --git a/arch/s390/kernel/sys_s390.c b/arch/s390/kernel/sys_s390.c
index efe6b83b53f7..6a63553493c5 100644
--- a/arch/s390/kernel/sys_s390.c
+++ b/arch/s390/kernel/sys_s390.c
@@ -26,9 +26,7 @@
26#include <linux/mman.h> 26#include <linux/mman.h>
27#include <linux/file.h> 27#include <linux/file.h>
28#include <linux/utsname.h> 28#include <linux/utsname.h>
29#ifdef CONFIG_ARCH_S390X
30#include <linux/personality.h> 29#include <linux/personality.h>
31#endif /* CONFIG_ARCH_S390X */
32 30
33#include <asm/uaccess.h> 31#include <asm/uaccess.h>
34#include <asm/ipc.h> 32#include <asm/ipc.h>
@@ -121,7 +119,7 @@ out:
121 return error; 119 return error;
122} 120}
123 121
124#ifndef CONFIG_ARCH_S390X 122#ifndef CONFIG_64BIT
125struct sel_arg_struct { 123struct sel_arg_struct {
126 unsigned long n; 124 unsigned long n;
127 fd_set *inp, *outp, *exp; 125 fd_set *inp, *outp, *exp;
@@ -138,7 +136,7 @@ asmlinkage long old_select(struct sel_arg_struct __user *arg)
138 return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp); 136 return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
139 137
140} 138}
141#endif /* CONFIG_ARCH_S390X */ 139#endif /* CONFIG_64BIT */
142 140
143/* 141/*
144 * sys_ipc() is the de-multiplexer for the SysV IPC calls.. 142 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
@@ -211,7 +209,7 @@ asmlinkage long sys_ipc(uint call, int first, unsigned long second,
211 return -EINVAL; 209 return -EINVAL;
212} 210}
213 211
214#ifdef CONFIG_ARCH_S390X 212#ifdef CONFIG_64BIT
215asmlinkage long s390x_newuname(struct new_utsname __user *name) 213asmlinkage long s390x_newuname(struct new_utsname __user *name)
216{ 214{
217 int ret = sys_newuname(name); 215 int ret = sys_newuname(name);
@@ -235,12 +233,12 @@ asmlinkage long s390x_personality(unsigned long personality)
235 233
236 return ret; 234 return ret;
237} 235}
238#endif /* CONFIG_ARCH_S390X */ 236#endif /* CONFIG_64BIT */
239 237
240/* 238/*
241 * Wrapper function for sys_fadvise64/fadvise64_64 239 * Wrapper function for sys_fadvise64/fadvise64_64
242 */ 240 */
243#ifndef CONFIG_ARCH_S390X 241#ifndef CONFIG_64BIT
244 242
245asmlinkage long 243asmlinkage long
246s390_fadvise64(int fd, u32 offset_high, u32 offset_low, size_t len, int advice) 244s390_fadvise64(int fd, u32 offset_high, u32 offset_low, size_t len, int advice)
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index c36353e8c140..7c0fe152a111 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -214,7 +214,7 @@ void account_ticks(struct pt_regs *regs)
214#endif 214#endif
215 215
216#ifdef CONFIG_VIRT_CPU_ACCOUNTING 216#ifdef CONFIG_VIRT_CPU_ACCOUNTING
217 account_user_vtime(current); 217 account_tick_vtime(current);
218#else 218#else
219 while (ticks--) 219 while (ticks--)
220 update_process_times(user_mode(regs)); 220 update_process_times(user_mode(regs));
@@ -282,7 +282,7 @@ static inline void start_hz_timer(void)
282{ 282{
283 if (!cpu_isset(smp_processor_id(), nohz_cpu_mask)) 283 if (!cpu_isset(smp_processor_id(), nohz_cpu_mask))
284 return; 284 return;
285 account_ticks(__KSTK_PTREGS(current)); 285 account_ticks(task_pt_regs(current));
286 cpu_clear(smp_processor_id(), nohz_cpu_mask); 286 cpu_clear(smp_processor_id(), nohz_cpu_mask);
287} 287}
288 288
diff --git a/arch/s390/kernel/traps.c b/arch/s390/kernel/traps.c
index c5bd36fae56b..5d21e9e6e7b4 100644
--- a/arch/s390/kernel/traps.c
+++ b/arch/s390/kernel/traps.c
@@ -67,13 +67,13 @@ extern pgm_check_handler_t do_monitor_call;
67 67
68#define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; }) 68#define stack_pointer ({ void **sp; asm("la %0,0(15)" : "=&d" (sp)); sp; })
69 69
70#ifndef CONFIG_ARCH_S390X 70#ifndef CONFIG_64BIT
71#define FOURLONG "%08lx %08lx %08lx %08lx\n" 71#define FOURLONG "%08lx %08lx %08lx %08lx\n"
72static int kstack_depth_to_print = 12; 72static int kstack_depth_to_print = 12;
73#else /* CONFIG_ARCH_S390X */ 73#else /* CONFIG_64BIT */
74#define FOURLONG "%016lx %016lx %016lx %016lx\n" 74#define FOURLONG "%016lx %016lx %016lx %016lx\n"
75static int kstack_depth_to_print = 20; 75static int kstack_depth_to_print = 20;
76#endif /* CONFIG_ARCH_S390X */ 76#endif /* CONFIG_64BIT */
77 77
78/* 78/*
79 * For show_trace we have tree different stack to consider: 79 * For show_trace we have tree different stack to consider:
@@ -136,8 +136,8 @@ void show_trace(struct task_struct *task, unsigned long * stack)
136 sp = __show_trace(sp, S390_lowcore.async_stack - ASYNC_SIZE, 136 sp = __show_trace(sp, S390_lowcore.async_stack - ASYNC_SIZE,
137 S390_lowcore.async_stack); 137 S390_lowcore.async_stack);
138 if (task) 138 if (task)
139 __show_trace(sp, (unsigned long) task->thread_info, 139 __show_trace(sp, (unsigned long) task_stack_page(task),
140 (unsigned long) task->thread_info + THREAD_SIZE); 140 (unsigned long) task_stack_page(task) + THREAD_SIZE);
141 else 141 else
142 __show_trace(sp, S390_lowcore.thread_info, 142 __show_trace(sp, S390_lowcore.thread_info,
143 S390_lowcore.thread_info + THREAD_SIZE); 143 S390_lowcore.thread_info + THREAD_SIZE);
@@ -240,7 +240,7 @@ char *task_show_regs(struct task_struct *task, char *buffer)
240{ 240{
241 struct pt_regs *regs; 241 struct pt_regs *regs;
242 242
243 regs = __KSTK_PTREGS(task); 243 regs = task_pt_regs(task);
244 buffer += sprintf(buffer, "task: %p, ksp: %p\n", 244 buffer += sprintf(buffer, "task: %p, ksp: %p\n",
245 task, (void *)task->thread.ksp); 245 task, (void *)task->thread.ksp);
246 buffer += sprintf(buffer, "User PSW : %p %p\n", 246 buffer += sprintf(buffer, "User PSW : %p %p\n",
@@ -702,12 +702,12 @@ void __init trap_init(void)
702 pgm_check_table[0x11] = &do_dat_exception; 702 pgm_check_table[0x11] = &do_dat_exception;
703 pgm_check_table[0x12] = &translation_exception; 703 pgm_check_table[0x12] = &translation_exception;
704 pgm_check_table[0x13] = &special_op_exception; 704 pgm_check_table[0x13] = &special_op_exception;
705#ifdef CONFIG_ARCH_S390X 705#ifdef CONFIG_64BIT
706 pgm_check_table[0x38] = &do_dat_exception; 706 pgm_check_table[0x38] = &do_dat_exception;
707 pgm_check_table[0x39] = &do_dat_exception; 707 pgm_check_table[0x39] = &do_dat_exception;
708 pgm_check_table[0x3A] = &do_dat_exception; 708 pgm_check_table[0x3A] = &do_dat_exception;
709 pgm_check_table[0x3B] = &do_dat_exception; 709 pgm_check_table[0x3B] = &do_dat_exception;
710#endif /* CONFIG_ARCH_S390X */ 710#endif /* CONFIG_64BIT */
711 pgm_check_table[0x15] = &operand_exception; 711 pgm_check_table[0x15] = &operand_exception;
712 pgm_check_table[0x1C] = &space_switch_exception; 712 pgm_check_table[0x1C] = &space_switch_exception;
713 pgm_check_table[0x1D] = &hfp_sqrt_exception; 713 pgm_check_table[0x1D] = &hfp_sqrt_exception;
diff --git a/arch/s390/kernel/vmlinux.lds.S b/arch/s390/kernel/vmlinux.lds.S
index 89fdb3808bc0..9289face3027 100644
--- a/arch/s390/kernel/vmlinux.lds.S
+++ b/arch/s390/kernel/vmlinux.lds.S
@@ -5,7 +5,7 @@
5#include <asm-generic/vmlinux.lds.h> 5#include <asm-generic/vmlinux.lds.h>
6#include <linux/config.h> 6#include <linux/config.h>
7 7
8#ifndef CONFIG_ARCH_S390X 8#ifndef CONFIG_64BIT
9OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390") 9OUTPUT_FORMAT("elf32-s390", "elf32-s390", "elf32-s390")
10OUTPUT_ARCH(s390) 10OUTPUT_ARCH(s390)
11ENTRY(_start) 11ENTRY(_start)
diff --git a/arch/s390/kernel/vtime.c b/arch/s390/kernel/vtime.c
index 22a895ecb7a4..dfe6f0856617 100644
--- a/arch/s390/kernel/vtime.c
+++ b/arch/s390/kernel/vtime.c
@@ -32,7 +32,7 @@ DEFINE_PER_CPU(struct vtimer_queue, virt_cpu_timer);
32 * Update process times based on virtual cpu times stored by entry.S 32 * Update process times based on virtual cpu times stored by entry.S
33 * to the lowcore fields user_timer, system_timer & steal_clock. 33 * to the lowcore fields user_timer, system_timer & steal_clock.
34 */ 34 */
35void account_user_vtime(struct task_struct *tsk) 35void account_tick_vtime(struct task_struct *tsk)
36{ 36{
37 cputime_t cputime; 37 cputime_t cputime;
38 __u64 timer, clock; 38 __u64 timer, clock;
@@ -76,6 +76,31 @@ void account_user_vtime(struct task_struct *tsk)
76 * Update process times based on virtual cpu times stored by entry.S 76 * Update process times based on virtual cpu times stored by entry.S
77 * to the lowcore fields user_timer, system_timer & steal_clock. 77 * to the lowcore fields user_timer, system_timer & steal_clock.
78 */ 78 */
79void account_vtime(struct task_struct *tsk)
80{
81 cputime_t cputime;
82 __u64 timer;
83
84 timer = S390_lowcore.last_update_timer;
85 asm volatile (" STPT %0" /* Store current cpu timer value */
86 : "=m" (S390_lowcore.last_update_timer) );
87 S390_lowcore.system_timer += timer - S390_lowcore.last_update_timer;
88
89 cputime = S390_lowcore.user_timer >> 12;
90 S390_lowcore.user_timer -= cputime << 12;
91 S390_lowcore.steal_clock -= cputime << 12;
92 account_user_time(tsk, cputime);
93
94 cputime = S390_lowcore.system_timer >> 12;
95 S390_lowcore.system_timer -= cputime << 12;
96 S390_lowcore.steal_clock -= cputime << 12;
97 account_system_time(tsk, 0, cputime);
98}
99
100/*
101 * Update process times based on virtual cpu times stored by entry.S
102 * to the lowcore fields user_timer, system_timer & steal_clock.
103 */
79void account_system_vtime(struct task_struct *tsk) 104void account_system_vtime(struct task_struct *tsk)
80{ 105{
81 cputime_t cputime; 106 cputime_t cputime;
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index b701efa1f00e..f20b51ff1d86 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -5,5 +5,5 @@
5EXTRA_AFLAGS := -traditional 5EXTRA_AFLAGS := -traditional
6 6
7lib-y += delay.o string.o 7lib-y += delay.o string.o
8lib-$(CONFIG_ARCH_S390_31) += uaccess.o spinlock.o 8lib-y += $(if $(CONFIG_64BIT),uaccess64.o,uaccess.o)
9lib-$(CONFIG_ARCH_S390X) += uaccess64.o spinlock.o 9lib-$(CONFIG_SMP) += spinlock.o \ No newline at end of file
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
index 2dc14e9c8327..60f80a4eed4e 100644
--- a/arch/s390/lib/spinlock.c
+++ b/arch/s390/lib/spinlock.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/io.h> 14#include <asm/io.h>
15 15
16atomic_t spin_retry_counter;
17int spin_retry = 1000; 16int spin_retry = 1000;
18 17
19/** 18/**
@@ -29,7 +28,7 @@ __setup("spin_retry=", spin_retry_setup);
29static inline void 28static inline void
30_diag44(void) 29_diag44(void)
31{ 30{
32#ifdef __s390x__ 31#ifdef CONFIG_64BIT
33 if (MACHINE_HAS_DIAG44) 32 if (MACHINE_HAS_DIAG44)
34#endif 33#endif
35 asm volatile("diag 0,0,0x44"); 34 asm volatile("diag 0,0,0x44");
@@ -45,7 +44,6 @@ _raw_spin_lock_wait(raw_spinlock_t *lp, unsigned int pc)
45 _diag44(); 44 _diag44();
46 count = spin_retry; 45 count = spin_retry;
47 } 46 }
48 atomic_inc(&spin_retry_counter);
49 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0) 47 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0)
50 return; 48 return;
51 } 49 }
@@ -58,7 +56,6 @@ _raw_spin_trylock_retry(raw_spinlock_t *lp, unsigned int pc)
58 int count = spin_retry; 56 int count = spin_retry;
59 57
60 while (count-- > 0) { 58 while (count-- > 0) {
61 atomic_inc(&spin_retry_counter);
62 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0) 59 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0)
63 return 1; 60 return 1;
64 } 61 }
@@ -77,7 +74,6 @@ _raw_read_lock_wait(raw_rwlock_t *rw)
77 _diag44(); 74 _diag44();
78 count = spin_retry; 75 count = spin_retry;
79 } 76 }
80 atomic_inc(&spin_retry_counter);
81 old = rw->lock & 0x7fffffffU; 77 old = rw->lock & 0x7fffffffU;
82 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) 78 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
83 return; 79 return;
@@ -92,7 +88,6 @@ _raw_read_trylock_retry(raw_rwlock_t *rw)
92 int count = spin_retry; 88 int count = spin_retry;
93 89
94 while (count-- > 0) { 90 while (count-- > 0) {
95 atomic_inc(&spin_retry_counter);
96 old = rw->lock & 0x7fffffffU; 91 old = rw->lock & 0x7fffffffU;
97 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old) 92 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
98 return 1; 93 return 1;
@@ -111,7 +106,6 @@ _raw_write_lock_wait(raw_rwlock_t *rw)
111 _diag44(); 106 _diag44();
112 count = spin_retry; 107 count = spin_retry;
113 } 108 }
114 atomic_inc(&spin_retry_counter);
115 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) 109 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
116 return; 110 return;
117 } 111 }
@@ -124,7 +118,6 @@ _raw_write_trylock_retry(raw_rwlock_t *rw)
124 int count = spin_retry; 118 int count = spin_retry;
125 119
126 while (count-- > 0) { 120 while (count-- > 0) {
127 atomic_inc(&spin_retry_counter);
128 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0) 121 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
129 return 1; 122 return 1;
130 } 123 }
diff --git a/arch/s390/mm/extmem.c b/arch/s390/mm/extmem.c
index 506a33b51e4f..a9566bcab682 100644
--- a/arch/s390/mm/extmem.c
+++ b/arch/s390/mm/extmem.c
@@ -143,7 +143,7 @@ dcss_diag (__u8 func, void *parameter,
143 rx = (unsigned long) parameter; 143 rx = (unsigned long) parameter;
144 ry = (unsigned long) func; 144 ry = (unsigned long) func;
145 __asm__ __volatile__( 145 __asm__ __volatile__(
146#ifdef CONFIG_ARCH_S390X 146#ifdef CONFIG_64BIT
147 " sam31\n" // switch to 31 bit 147 " sam31\n" // switch to 31 bit
148 " diag %0,%1,0x64\n" 148 " diag %0,%1,0x64\n"
149 " sam64\n" // switch back to 64 bit 149 " sam64\n" // switch back to 64 bit
diff --git a/arch/s390/mm/fault.c b/arch/s390/mm/fault.c
index fb2607c369ed..81ade401b073 100644
--- a/arch/s390/mm/fault.c
+++ b/arch/s390/mm/fault.c
@@ -31,17 +31,17 @@
31#include <asm/uaccess.h> 31#include <asm/uaccess.h>
32#include <asm/pgtable.h> 32#include <asm/pgtable.h>
33 33
34#ifndef CONFIG_ARCH_S390X 34#ifndef CONFIG_64BIT
35#define __FAIL_ADDR_MASK 0x7ffff000 35#define __FAIL_ADDR_MASK 0x7ffff000
36#define __FIXUP_MASK 0x7fffffff 36#define __FIXUP_MASK 0x7fffffff
37#define __SUBCODE_MASK 0x0200 37#define __SUBCODE_MASK 0x0200
38#define __PF_RES_FIELD 0ULL 38#define __PF_RES_FIELD 0ULL
39#else /* CONFIG_ARCH_S390X */ 39#else /* CONFIG_64BIT */
40#define __FAIL_ADDR_MASK -4096L 40#define __FAIL_ADDR_MASK -4096L
41#define __FIXUP_MASK ~0L 41#define __FIXUP_MASK ~0L
42#define __SUBCODE_MASK 0x0600 42#define __SUBCODE_MASK 0x0600
43#define __PF_RES_FIELD 0x8000000000000000ULL 43#define __PF_RES_FIELD 0x8000000000000000ULL
44#endif /* CONFIG_ARCH_S390X */ 44#endif /* CONFIG_64BIT */
45 45
46#ifdef CONFIG_SYSCTL 46#ifdef CONFIG_SYSCTL
47extern int sysctl_userprocess_debug; 47extern int sysctl_userprocess_debug;
@@ -393,11 +393,11 @@ int pfault_init(void)
393 "2:\n" 393 "2:\n"
394 ".section __ex_table,\"a\"\n" 394 ".section __ex_table,\"a\"\n"
395 " .align 4\n" 395 " .align 4\n"
396#ifndef CONFIG_ARCH_S390X 396#ifndef CONFIG_64BIT
397 " .long 0b,1b\n" 397 " .long 0b,1b\n"
398#else /* CONFIG_ARCH_S390X */ 398#else /* CONFIG_64BIT */
399 " .quad 0b,1b\n" 399 " .quad 0b,1b\n"
400#endif /* CONFIG_ARCH_S390X */ 400#endif /* CONFIG_64BIT */
401 ".previous" 401 ".previous"
402 : "=d" (rc) : "a" (&refbk), "m" (refbk) : "cc" ); 402 : "=d" (rc) : "a" (&refbk), "m" (refbk) : "cc" );
403 __ctl_set_bit(0, 9); 403 __ctl_set_bit(0, 9);
@@ -417,11 +417,11 @@ void pfault_fini(void)
417 "0:\n" 417 "0:\n"
418 ".section __ex_table,\"a\"\n" 418 ".section __ex_table,\"a\"\n"
419 " .align 4\n" 419 " .align 4\n"
420#ifndef CONFIG_ARCH_S390X 420#ifndef CONFIG_64BIT
421 " .long 0b,0b\n" 421 " .long 0b,0b\n"
422#else /* CONFIG_ARCH_S390X */ 422#else /* CONFIG_64BIT */
423 " .quad 0b,0b\n" 423 " .quad 0b,0b\n"
424#endif /* CONFIG_ARCH_S390X */ 424#endif /* CONFIG_64BIT */
425 ".previous" 425 ".previous"
426 : : "a" (&refbk), "m" (refbk) : "cc" ); 426 : : "a" (&refbk), "m" (refbk) : "cc" );
427} 427}
diff --git a/arch/s390/mm/init.c b/arch/s390/mm/init.c
index 6ec5cd981e74..df953383724d 100644
--- a/arch/s390/mm/init.c
+++ b/arch/s390/mm/init.c
@@ -44,7 +44,7 @@ void diag10(unsigned long addr)
44{ 44{
45 if (addr >= 0x7ff00000) 45 if (addr >= 0x7ff00000)
46 return; 46 return;
47#ifdef __s390x__ 47#ifdef CONFIG_64BIT
48 asm volatile ( 48 asm volatile (
49 " sam31\n" 49 " sam31\n"
50 " diag %0,%0,0x10\n" 50 " diag %0,%0,0x10\n"
@@ -106,7 +106,7 @@ extern unsigned long __initdata zholes_size[];
106 * paging_init() sets up the page tables 106 * paging_init() sets up the page tables
107 */ 107 */
108 108
109#ifndef CONFIG_ARCH_S390X 109#ifndef CONFIG_64BIT
110void __init paging_init(void) 110void __init paging_init(void)
111{ 111{
112 pgd_t * pg_dir; 112 pgd_t * pg_dir;
@@ -175,7 +175,7 @@ void __init paging_init(void)
175 return; 175 return;
176} 176}
177 177
178#else /* CONFIG_ARCH_S390X */ 178#else /* CONFIG_64BIT */
179void __init paging_init(void) 179void __init paging_init(void)
180{ 180{
181 pgd_t * pg_dir; 181 pgd_t * pg_dir;
@@ -256,7 +256,7 @@ void __init paging_init(void)
256 256
257 return; 257 return;
258} 258}
259#endif /* CONFIG_ARCH_S390X */ 259#endif /* CONFIG_64BIT */
260 260
261void __init mem_init(void) 261void __init mem_init(void)
262{ 262{
diff --git a/arch/s390/mm/mmap.c b/arch/s390/mm/mmap.c
index fb187e5a54b4..356257c171de 100644
--- a/arch/s390/mm/mmap.c
+++ b/arch/s390/mm/mmap.c
@@ -50,7 +50,7 @@ static inline unsigned long mmap_base(void)
50 50
51static inline int mmap_is_legacy(void) 51static inline int mmap_is_legacy(void)
52{ 52{
53#ifdef CONFIG_ARCH_S390X 53#ifdef CONFIG_64BIT
54 /* 54 /*
55 * Force standard allocation for 64 bit programs. 55 * Force standard allocation for 64 bit programs.
56 */ 56 */
diff --git a/arch/s390/oprofile/Makefile b/arch/s390/oprofile/Makefile
index ec349276258a..537b2d840e69 100644
--- a/arch/s390/oprofile/Makefile
+++ b/arch/s390/oprofile/Makefile
@@ -6,4 +6,4 @@ DRIVER_OBJS = $(addprefix ../../../drivers/oprofile/, \
6 oprofilefs.o oprofile_stats.o \ 6 oprofilefs.o oprofile_stats.o \
7 timer_int.o ) 7 timer_int.o )
8 8
9oprofile-y := $(DRIVER_OBJS) init.o 9oprofile-y := $(DRIVER_OBJS) init.o backtrace.o
diff --git a/arch/s390/oprofile/backtrace.c b/arch/s390/oprofile/backtrace.c
new file mode 100644
index 000000000000..bc4b84a35cad
--- /dev/null
+++ b/arch/s390/oprofile/backtrace.c
@@ -0,0 +1,79 @@
1/**
2 * arch/s390/oprofile/backtrace.c
3 *
4 * S390 Version
5 * Copyright (C) 2005 IBM Corporation, IBM Deutschland Entwicklung GmbH.
6 * Author(s): Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
7 */
8
9#include <linux/oprofile.h>
10
11#include <asm/processor.h> /* for struct stack_frame */
12
13static unsigned long
14__show_trace(unsigned int *depth, unsigned long sp,
15 unsigned long low, unsigned long high)
16{
17 struct stack_frame *sf;
18 struct pt_regs *regs;
19
20 while (*depth) {
21 sp = sp & PSW_ADDR_INSN;
22 if (sp < low || sp > high - sizeof(*sf))
23 return sp;
24 sf = (struct stack_frame *) sp;
25 (*depth)--;
26 oprofile_add_trace(sf->gprs[8] & PSW_ADDR_INSN);
27
28 /* Follow the backchain. */
29 while (*depth) {
30 low = sp;
31 sp = sf->back_chain & PSW_ADDR_INSN;
32 if (!sp)
33 break;
34 if (sp <= low || sp > high - sizeof(*sf))
35 return sp;
36 sf = (struct stack_frame *) sp;
37 (*depth)--;
38 oprofile_add_trace(sf->gprs[8] & PSW_ADDR_INSN);
39
40 }
41
42 if (*depth == 0)
43 break;
44
45 /* Zero backchain detected, check for interrupt frame. */
46 sp = (unsigned long) (sf + 1);
47 if (sp <= low || sp > high - sizeof(*regs))
48 return sp;
49 regs = (struct pt_regs *) sp;
50 (*depth)--;
51 oprofile_add_trace(sf->gprs[8] & PSW_ADDR_INSN);
52 low = sp;
53 sp = regs->gprs[15];
54 }
55 return sp;
56}
57
58void s390_backtrace(struct pt_regs * const regs, unsigned int depth)
59{
60 unsigned long head;
61 struct stack_frame* head_sf;
62
63 if (user_mode (regs))
64 return;
65
66 head = regs->gprs[15];
67 head_sf = (struct stack_frame*)head;
68
69 if (!head_sf->back_chain)
70 return;
71
72 head = head_sf->back_chain;
73
74 head = __show_trace(&depth, head, S390_lowcore.async_stack - ASYNC_SIZE,
75 S390_lowcore.async_stack);
76
77 __show_trace(&depth, head, S390_lowcore.thread_info,
78 S390_lowcore.thread_info + THREAD_SIZE);
79}
diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c
index a65ead0e200a..7a995113b918 100644
--- a/arch/s390/oprofile/init.c
+++ b/arch/s390/oprofile/init.c
@@ -12,8 +12,12 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14 14
15
16extern void s390_backtrace(struct pt_regs * const regs, unsigned int depth);
17
15int __init oprofile_arch_init(struct oprofile_operations* ops) 18int __init oprofile_arch_init(struct oprofile_operations* ops)
16{ 19{
20 ops->backtrace = s390_backtrace;
17 return -ENODEV; 21 return -ENODEV;
18} 22}
19 23
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 64f5ae0ff96d..01bc7d589afe 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -14,10 +14,6 @@ config SUPERH
14 gaming console. The SuperH port has a home page at 14 gaming console. The SuperH port has a home page at
15 <http://www.linux-sh.org/>. 15 <http://www.linux-sh.org/>.
16 16
17config UID16
18 bool
19 default y
20
21config RWSEM_GENERIC_SPINLOCK 17config RWSEM_GENERIC_SPINLOCK
22 bool 18 bool
23 default y 19 default y
@@ -37,9 +33,11 @@ config GENERIC_CALIBRATE_DELAY
37 bool 33 bool
38 default y 34 default y
39 35
36config GENERIC_IOMAP
37 bool
38
40config ARCH_MAY_HAVE_PC_FDC 39config ARCH_MAY_HAVE_PC_FDC
41 bool 40 bool
42 default y
43 41
44source "init/Kconfig" 42source "init/Kconfig"
45 43
@@ -57,24 +55,28 @@ config SH_SOLUTION_ENGINE
57 55
58config SH_7751_SOLUTION_ENGINE 56config SH_7751_SOLUTION_ENGINE
59 bool "SolutionEngine7751" 57 bool "SolutionEngine7751"
58 select CPU_SUBTYPE_SH7751
60 help 59 help
61 Select 7751 SolutionEngine if configuring for a Hitachi SH7751 60 Select 7751 SolutionEngine if configuring for a Hitachi SH7751
62 evaluation board. 61 evaluation board.
63 62
64config SH_7300_SOLUTION_ENGINE 63config SH_7300_SOLUTION_ENGINE
65 bool "SolutionEngine7300" 64 bool "SolutionEngine7300"
65 select CPU_SUBTYPE_SH7300
66 help 66 help
67 Select 7300 SolutionEngine if configuring for a Hitachi SH7300(SH-Mobile V) 67 Select 7300 SolutionEngine if configuring for a Hitachi SH7300(SH-Mobile V)
68 evaluation board. 68 evaluation board.
69 69
70config SH_73180_SOLUTION_ENGINE 70config SH_73180_SOLUTION_ENGINE
71 bool "SolutionEngine73180" 71 bool "SolutionEngine73180"
72 select CPU_SUBTYPE_SH73180
72 help 73 help
73 Select 73180 SolutionEngine if configuring for a Hitachi SH73180(SH-Mobile 3) 74 Select 73180 SolutionEngine if configuring for a Hitachi SH73180(SH-Mobile 3)
74 evaluation board. 75 evaluation board.
75 76
76config SH_7751_SYSTEMH 77config SH_7751_SYSTEMH
77 bool "SystemH7751R" 78 bool "SystemH7751R"
79 select CPU_SUBTYPE_SH7751R
78 help 80 help
79 Select SystemH if you are configuring for a Renesas SystemH 81 Select SystemH if you are configuring for a Renesas SystemH
80 7751R evaluation board. 82 7751R evaluation board.
@@ -85,27 +87,13 @@ config SH_STB1_HARP
85config SH_STB1_OVERDRIVE 87config SH_STB1_OVERDRIVE
86 bool "STB1_Overdrive" 88 bool "STB1_Overdrive"
87 89
88config SH_HP620 90config SH_HP6XX
89 bool "HP620" 91 bool "HP6XX"
90 help 92 help
91 Select HP620 if configuring for a HP jornada HP620. 93 Select HP6XX if configuring for a HP jornada HP6xx.
92 More information (hardware only) at 94 More information (hardware only) at
93 <http://www.hp.com/jornada/>. 95 <http://www.hp.com/jornada/>.
94 96
95config SH_HP680
96 bool "HP680"
97 help
98 Select HP680 if configuring for a HP Jornada HP680.
99 More information (hardware only) at
100 <http://www.hp.com/jornada/products/680/>.
101
102config SH_HP690
103 bool "HP690"
104 help
105 Select HP690 if configuring for a HP Jornada HP690.
106 More information (hardware only)
107 at <http://www.hp.com/jornada/products/680/>.
108
109config SH_CQREEK 97config SH_CQREEK
110 bool "CqREEK" 98 bool "CqREEK"
111 help 99 help
@@ -127,11 +115,13 @@ config SH_EC3104
127 115
128config SH_SATURN 116config SH_SATURN
129 bool "Saturn" 117 bool "Saturn"
118 select CPU_SUBTYPE_SH7604
130 help 119 help
131 Select Saturn if configuring for a SEGA Saturn. 120 Select Saturn if configuring for a SEGA Saturn.
132 121
133config SH_DREAMCAST 122config SH_DREAMCAST
134 bool "Dreamcast" 123 bool "Dreamcast"
124 select CPU_SUBTYPE_SH7091
135 help 125 help
136 Select Dreamcast if configuring for a SEGA Dreamcast. 126 Select Dreamcast if configuring for a SEGA Dreamcast.
137 More information at 127 More information at
@@ -146,6 +136,7 @@ config SH_BIGSUR
146 136
147config SH_SH2000 137config SH_SH2000
148 bool "SH2000" 138 bool "SH2000"
139 select CPU_SUBTYPE_SH7709
149 help 140 help
150 SH-2000 is a single-board computer based around SH7709A chip 141 SH-2000 is a single-board computer based around SH7709A chip
151 intended for embedded applications. 142 intended for embedded applications.
@@ -157,20 +148,22 @@ config SH_ADX
157 bool "ADX" 148 bool "ADX"
158 149
159config SH_MPC1211 150config SH_MPC1211
160 bool "MPC1211" 151 bool "Interface MPC1211"
152 help
153 CTP/PCI-SH02 is a CPU module computer that is produced
154 by Interface Corporation.
155 More information at <http://www.interface.co.jp>
161 156
162config SH_SH03 157config SH_SH03
163 bool "SH03" 158 bool "Interface CTP/PCI-SH03"
164 help 159 help
165 CTP/PCI-SH03 is a CPU module computer that produced 160 CTP/PCI-SH03 is a CPU module computer that is produced
166 by Interface Corporation. 161 by Interface Corporation.
167 It is compact and excellent in durability.
168 It will play an active part in your factory or laboratory
169 as a FA computer.
170 More information at <http://www.interface.co.jp> 162 More information at <http://www.interface.co.jp>
171 163
172config SH_SECUREEDGE5410 164config SH_SECUREEDGE5410
173 bool "SecureEdge5410" 165 bool "SecureEdge5410"
166 select CPU_SUBTYPE_SH7751R
174 help 167 help
175 Select SecureEdge5410 if configuring for a SnapGear SH board. 168 Select SecureEdge5410 if configuring for a SnapGear SH board.
176 This includes both the OEM SecureEdge products as well as the 169 This includes both the OEM SecureEdge products as well as the
@@ -178,25 +171,49 @@ config SH_SECUREEDGE5410
178 171
179config SH_HS7751RVOIP 172config SH_HS7751RVOIP
180 bool "HS7751RVOIP" 173 bool "HS7751RVOIP"
174 select CPU_SUBTYPE_SH7751R
181 help 175 help
182 Select HS7751RVOIP if configuring for a Renesas Technology 176 Select HS7751RVOIP if configuring for a Renesas Technology
183 Sales VoIP board. 177 Sales VoIP board.
184 178
185config SH_RTS7751R2D 179config SH_RTS7751R2D
186 bool "RTS7751R2D" 180 bool "RTS7751R2D"
181 select CPU_SUBTYPE_SH7751R
187 help 182 help
188 Select RTS7751R2D if configuring for a Renesas Technology 183 Select RTS7751R2D if configuring for a Renesas Technology
189 Sales SH-Graphics board. 184 Sales SH-Graphics board.
190 185
186config SH_R7780RP
187 bool "R7780RP-1"
188 select CPU_SUBTYPE_SH7780
189 help
190 Select R7780RP-1 if configuring for a Renesas Solutions
191 HIGHLANDER board.
192
191config SH_EDOSK7705 193config SH_EDOSK7705
192 bool "EDOSK7705" 194 bool "EDOSK7705"
195 select CPU_SUBTYPE_SH7705
193 196
194config SH_SH4202_MICRODEV 197config SH_SH4202_MICRODEV
195 bool "SH4-202 MicroDev" 198 bool "SH4-202 MicroDev"
199 select CPU_SUBTYPE_SH4_202
196 help 200 help
197 Select SH4-202 MicroDev if configuring for a SuperH MicroDev board 201 Select SH4-202 MicroDev if configuring for a SuperH MicroDev board
198 with an SH4-202 CPU. 202 with an SH4-202 CPU.
199 203
204config SH_LANDISK
205 bool "LANDISK"
206 select CPU_SUBTYPE_SH7751R
207 help
208 I-O DATA DEVICE, INC. "LANDISK Series" support.
209
210config SH_TITAN
211 bool "TITAN"
212 select CPU_SUBTYPE_SH7751R
213 help
214 Select Titan if you are configuring for a Nimble Microsystems
215 NetEngine NP51R.
216
200config SH_UNKNOWN 217config SH_UNKNOWN
201 bool "BareCPU" 218 bool "BareCPU"
202 help 219 help
@@ -211,168 +228,27 @@ config SH_UNKNOWN
211 228
212endchoice 229endchoice
213 230
214choice 231source "arch/sh/mm/Kconfig"
215 prompt "Processor family"
216 default CPU_SH4
217 help
218 This option determines the CPU family to compile for. Supported
219 targets are SH-2, SH-3, and SH-4. These options are independent of
220 CPU functionality. As such, SH-DSP users will still want to select
221 their respective processor family in addition to the DSP support
222 option.
223
224config CPU_SH2
225 bool "SH-2"
226 select SH_WRITETHROUGH
227
228config CPU_SH3
229 bool "SH-3"
230
231config CPU_SH4
232 bool "SH-4"
233
234endchoice
235
236choice
237 prompt "Processor subtype"
238
239config CPU_SUBTYPE_SH7604
240 bool "SH7604"
241 depends on CPU_SH2
242 help
243 Select SH7604 if you have SH7604
244
245config CPU_SUBTYPE_SH7300
246 bool "SH7300"
247 depends on CPU_SH3
248
249config CPU_SUBTYPE_SH7705
250 bool "SH7705"
251 depends on CPU_SH3
252
253config CPU_SUBTYPE_SH7707
254 bool "SH7707"
255 depends on CPU_SH3
256 help
257 Select SH7707 if you have a 60 Mhz SH-3 HD6417707 CPU.
258
259config CPU_SUBTYPE_SH7708
260 bool "SH7708"
261 depends on CPU_SH3
262 help
263 Select SH7708 if you have a 60 Mhz SH-3 HD6417708S or
264 if you have a 100 Mhz SH-3 HD6417708R CPU.
265
266config CPU_SUBTYPE_SH7709
267 bool "SH7709"
268 depends on CPU_SH3
269 help
270 Select SH7709 if you have a 80 Mhz SH-3 HD6417709 CPU.
271
272config CPU_SUBTYPE_SH7750
273 bool "SH7750"
274 depends on CPU_SH4
275 help
276 Select SH7750 if you have a 200 Mhz SH-4 HD6417750 CPU.
277
278config CPU_SUBTYPE_SH7751
279 bool "SH7751/SH7751R"
280 depends on CPU_SH4
281 help
282 Select SH7751 if you have a 166 Mhz SH-4 HD6417751 CPU,
283 or if you have a HD6417751R CPU.
284
285config CPU_SUBTYPE_SH7760
286 bool "SH7760"
287 depends on CPU_SH4
288
289config CPU_SUBTYPE_SH73180
290 bool "SH73180"
291 depends on CPU_SH4
292
293config CPU_SUBTYPE_ST40STB1
294 bool "ST40STB1 / ST40RA"
295 depends on CPU_SH4
296 help
297 Select ST40STB1 if you have a ST40RA CPU.
298 This was previously called the ST40STB1, hence the option name.
299
300config CPU_SUBTYPE_ST40GX1
301 bool "ST40GX1"
302 depends on CPU_SH4
303 help
304 Select ST40GX1 if you have a ST40GX1 CPU.
305
306config CPU_SUBTYPE_SH4_202
307 bool "SH4-202"
308 depends on CPU_SH4
309
310endchoice
311
312config SH7705_CACHE_32KB
313 bool "Enable 32KB cache size for SH7705"
314 depends on CPU_SUBTYPE_SH7705
315 default y
316
317config MMU
318 bool "Support for memory management hardware"
319 depends on !CPU_SH2
320 default y
321 help
322 Early SH processors (such as the SH7604) lack an MMU. In order to
323 boot on these systems, this option must not be set.
324
325 On other systems (such as the SH-3 and 4) where an MMU exists,
326 turning this off will boot the kernel on these machines with the
327 MMU implicitly switched off.
328
329choice
330 prompt "HugeTLB page size"
331 depends on HUGETLB_PAGE && CPU_SH4 && MMU
332 default HUGETLB_PAGE_SIZE_64K
333
334config HUGETLB_PAGE_SIZE_64K
335 bool "64K"
336
337config HUGETLB_PAGE_SIZE_1MB
338 bool "1MB"
339
340endchoice
341
342config CMDLINE_BOOL
343 bool "Default bootloader kernel arguments"
344
345config CMDLINE
346 string "Initial kernel command string"
347 depends on CMDLINE_BOOL
348 default "console=ttySC1,115200"
349 232
350# Platform-specific memory start and size definitions
351config MEMORY_START 233config MEMORY_START
352 hex "Physical memory start address" if !MEMORY_SET || MEMORY_OVERRIDE 234 hex "Physical memory start address"
353 default "0x08000000" if !MEMORY_SET || MEMORY_OVERRIDE || !MEMORY_OVERRIDE && SH_ADX || SH_MPC1211 || SH_SH03 || SH_SECUREEDGE5410 || SH_SH4202_MICRODEV 235 default "0x08000000"
354 default "0x0c000000" if !MEMORY_OVERRIDE && (SH_DREAMCAST || SH_HP600 || SH_BIGSUR || SH_SH2000 || SH_73180_SOLUTION_ENGINE || SH_7300_SOLUTION_ENGINE || SH_7751_SOLUTION_ENGINE || SH_SOLUTION_ENGINE || SH_HS7751RVOIP || SH_RTS7751R2D || SH_EDOSK7705)
355 ---help--- 236 ---help---
356 Computers built with Hitachi SuperH processors always 237 Computers built with Hitachi SuperH processors always
357 map the ROM starting at address zero. But the processor 238 map the ROM starting at address zero. But the processor
358 does not specify the range that RAM takes. 239 does not specify the range that RAM takes.
359 240
360 The physical memory (RAM) start address will be automatically 241 The physical memory (RAM) start address will be automatically
361 set to 08000000, unless you selected one of the following 242 set to 08000000. Other platforms, such as the Solution Engine
362 processor types: SolutionEngine, Overdrive, HP620, HP680, HP690, 243 boards typically map RAM at 0C000000.
363 in which case the start address will be set to 0c000000.
364 244
365 Tweak this only when porting to a new machine which is not already 245 Tweak this only when porting to a new machine which does not
366 known by the config system. Changing it from the known correct 246 already have a defconfig. Changing it from the known correct
367 value on any of the known systems will only lead to disaster. 247 value on any of the known systems will only lead to disaster.
368 248
369config MEMORY_SIZE 249config MEMORY_SIZE
370 hex "Physical memory size" if !MEMORY_SET || MEMORY_OVERRIDE 250 hex "Physical memory size"
371 default "0x00400000" if !MEMORY_SET || MEMORY_OVERRIDE || !MEMORY_OVERRIDE && SH_ADX || !MEMORY_OVERRIDE && (SH_HP600 || SH_BIGSUR || SH_SH2000) 251 default "0x00400000"
372 default "0x01000000" if !MEMORY_OVERRIDE && SH_DREAMCAST || SH_SECUREEDGE5410 || SH_EDOSK7705
373 default "0x02000000" if !MEMORY_OVERRIDE && (SH_73180_SOLUTION_ENGINE || SH_SOLUTION_ENGINE)
374 default "0x04000000" if !MEMORY_OVERRIDE && (SH_7300_SOLUTION_ENGINE || SH_7751_SOLUTION_ENGINE || SH_HS7751RVOIP || SH_RTS7751R2D || SH_SH4202_MICRODEV)
375 default "0x08000000" if SH_MPC1211 || SH_SH03
376 help 252 help
377 This sets the default memory size assumed by your SH kernel. It can 253 This sets the default memory size assumed by your SH kernel. It can
378 be overridden as normal by the 'mem=' argument on the kernel command 254 be overridden as normal by the 'mem=' argument on the kernel command
@@ -380,21 +256,6 @@ config MEMORY_SIZE
380 as 0x00400000 which was the default value before this became 256 as 0x00400000 which was the default value before this became
381 configurable. 257 configurable.
382 258
383config MEMORY_SET
384 bool
385 depends on !MEMORY_OVERRIDE && (SH_MPC1211 || SH_SH03 || SH_ADX || SH_DREAMCAST || SH_HP600 || SH_BIGSUR || SH_SH2000 || SH_7751_SOLUTION_ENGINE || SH_SOLUTION_ENGINE || SH_SECUREEDGE5410 || SH_HS7751RVOIP || SH_RTS7751R2D || SH_SH4202_MICRODEV || SH_EDOSK7705)
386 default y
387 help
388 This is an option about which you will never be asked a question.
389 Therefore, I conclude that you do not exist - go away.
390
391 There is a grue here.
392
393# If none of the above have set memory start/size, ask the user.
394config MEMORY_OVERRIDE
395 bool "Override default load address and memory size"
396
397# XXX: break these out into the board-specific configs below
398config CF_ENABLER 259config CF_ENABLER
399 bool "Compact Flash Enabler support" 260 bool "Compact Flash Enabler support"
400 depends on SH_ADX || SH_SOLUTION_ENGINE || SH_UNKNOWN || SH_CAT68701 || SH_SH03 261 depends on SH_ADX || SH_SOLUTION_ENGINE || SH_UNKNOWN || SH_CAT68701 || SH_SH03
@@ -438,10 +299,21 @@ config CF_BASE_ADDR
438 default "0xb8000000" if CF_AREA6 299 default "0xb8000000" if CF_AREA6
439 default "0xb4000000" if CF_AREA5 300 default "0xb4000000" if CF_AREA5
440 301
302menu "Processor features"
303
304config CPU_LITTLE_ENDIAN
305 bool "Little Endian"
306 help
307 Some SuperH machines can be configured for either little or big
308 endian byte order. These modes require different kernels. Say Y if
309 your machine is little endian, N if it's a big endian machine.
310
441# The SH7750 RTC module is disabled in the Dreamcast 311# The SH7750 RTC module is disabled in the Dreamcast
442config SH_RTC 312config SH_RTC
443 bool 313 bool
444 depends on !SH_DREAMCAST && !SH_SATURN && !SH_7300_SOLUTION_ENGINE && !SH_73180_SOLUTION_ENGINE 314 depends on !SH_DREAMCAST && !SH_SATURN && !SH_7300_SOLUTION_ENGINE && \
315 !SH_73180_SOLUTION_ENGINE && !SH_LANDISK && \
316 !SH_R7780RP
445 default y 317 default y
446 help 318 help
447 Selecting this option will allow the Linux kernel to emulate 319 Selecting this option will allow the Linux kernel to emulate
@@ -480,104 +352,131 @@ config SH_ADC
480 352
481 If unsure, say N. 353 If unsure, say N.
482 354
483config SH_HP600 355config SH_STORE_QUEUES
356 bool "Support for Store Queues"
357 depends on CPU_SH4
358 help
359 Selecting this option will enable an in-kernel API for manipulating
360 the store queues integrated in the SH-4 processors.
361
362config CPU_HAS_INTEVT
484 bool 363 bool
485 depends on SH_HP620 || SH_HP680 || SH_HP690
486 default y
487 364
488config CPU_SUBTYPE_ST40 365config CPU_HAS_PINT_IRQ
489 bool 366 bool
490 depends on CPU_SUBTYPE_ST40STB1 || CPU_SUBTYPE_ST40GX1
491 default y
492 367
493source "mm/Kconfig" 368config CPU_HAS_INTC2_IRQ
369 bool
494 370
495config ZERO_PAGE_OFFSET 371config CPU_HAS_SR_RB
496 hex "Zero page offset" 372 bool "CPU has SR.RB"
497 default "0x00001000" if !(SH_MPC1211 || SH_SH03) 373 depends on CPU_SH3 || CPU_SH4
498 default "0x00004000" if SH_MPC1211 || SH_SH03 374 default y
499 help 375 help
500 This sets the default offset of zero page. 376 This will enable the use of SR.RB register bank usage. Processors
377 that are lacking this bit must have another method in place for
378 accomplishing what is taken care of by the banked registers.
501 379
502# XXX: needs to lose subtype for system type 380 See <file:Documentation/sh/register-banks.txt> for further
503config ST40_LMI_MEMORY 381 information on SR.RB and register banking in the kernel in general.
504 bool "Memory on LMI"
505 depends on CPU_SUBTYPE_ST40STB1
506 382
507config MEMORY_START 383endmenu
508 hex
509 depends on CPU_SUBTYPE_ST40STB1 && ST40_LMI_MEMORY
510 default "0x08000000"
511 384
512config MEMORY_SIZE 385menu "Timer support"
513 hex
514 depends on CPU_SUBTYPE_ST40STB1 && ST40_LMI_MEMORY
515 default "0x00400000"
516 386
517config MEMORY_SET 387config SH_TMU
518 bool 388 bool "TMU timer support"
519 depends on CPU_SUBTYPE_ST40STB1 && ST40_LMI_MEMORY
520 default y 389 default y
521
522config BOOT_LINK_OFFSET
523 hex "Link address offset for booting"
524 default "0x00800000"
525 help 390 help
526 This option allows you to set the link address offset of the zImage. 391 This enables the use of the TMU as the system timer.
527 This can be useful if you are on a board which has a small amount of
528 memory.
529 392
530config CPU_LITTLE_ENDIAN 393endmenu
531 bool "Little Endian"
532 help
533 Some SuperH machines can be configured for either little or big
534 endian byte order. These modes require different kernels. Say Y if
535 your machine is little endian, N if it's a big endian machine.
536 394
537config PREEMPT 395source "arch/sh/boards/renesas/hs7751rvoip/Kconfig"
538 bool "Preemptible Kernel (EXPERIMENTAL)"
539 depends on EXPERIMENTAL
540 396
541config UBC_WAKEUP 397source "arch/sh/boards/renesas/rts7751r2d/Kconfig"
542 bool "Wakeup UBC on startup" 398
399config SH_PCLK_FREQ_BOOL
400 bool "Set default pclk frequency"
401 default y if !SH_RTC
402 default n
403
404config SH_PCLK_FREQ
405 int "Peripheral clock frequency (in Hz)"
406 depends on SH_PCLK_FREQ_BOOL
407 default "50000000" if CPU_SUBTYPE_SH7750 || CPU_SUBTYPE_SH7780
408 default "60000000" if CPU_SUBTYPE_SH7751
409 default "33333333" if CPU_SUBTYPE_SH7300 || CPU_SUBTYPE_SH7770 || CPU_SUBTYPE_SH7760
410 default "27000000" if CPU_SUBTYPE_SH73180
411 default "66000000" if CPU_SUBTYPE_SH4_202
543 help 412 help
544 Selecting this option will wakeup the User Break Controller (UBC) on 413 This option is used to specify the peripheral clock frequency.
545 startup. Although the UBC is left in an awake state when the processor 414 This is necessary for determining the reference clock value on
546 comes up, some boot loaders misbehave by putting the UBC to sleep in a 415 platforms lacking an RTC.
547 power saving state, which causes issues with things like ptrace().
548 416
549 If unsure, say N. 417menu "CPU Frequency scaling"
418
419source "drivers/cpufreq/Kconfig"
550 420
551config SH_WRITETHROUGH 421config SH_CPU_FREQ
552 bool "Use write-through caching" 422 tristate "SuperH CPU Frequency driver"
553 default y if CPU_SH2 423 depends on CPU_FREQ
424 select CPU_FREQ_TABLE
554 help 425 help
555 Selecting this option will configure the caches in write-through 426 This adds the cpufreq driver for SuperH. At present, only
556 mode, as opposed to the default write-back configuration. 427 the SH-4 is supported.
557 428
558 Since there's sill some aliasing issues on SH-4, this option will 429 For details, take a look at <file:Documentation/cpu-freq>.
559 unfortunately still require the majority of flushing functions to
560 be implemented to deal with aliasing.
561 430
562 If unsure, say N. 431 If unsure, say N.
563 432
564config SH_OCRAM 433endmenu
565 bool "Operand Cache RAM (OCRAM) support" 434
435source "arch/sh/drivers/dma/Kconfig"
436
437source "arch/sh/cchips/Kconfig"
438
439config HEARTBEAT
440 bool "Heartbeat LED"
441 depends on SH_MPC1211 || SH_SH03 || SH_CAT68701 || \
442 SH_STB1_HARP || SH_STB1_OVERDRIVE || SH_BIGSUR || \
443 SH_7751_SOLUTION_ENGINE || SH_7300_SOLUTION_ENGINE || \
444 SH_73180_SOLUTION_ENGINE || SH_SOLUTION_ENGINE || \
445 SH_RTS7751R2D || SH_SH4202_MICRODEV || SH_LANDISK
566 help 446 help
567 Selecting this option will automatically tear down the number of 447 Use the power-on LED on your machine as a load meter. The exact
568 sets in the dcache by half, which in turn exposes a memory range. 448 behavior is platform-dependent, but normally the flash frequency is
449 a hyperbolic function of the 5-minute load average.
569 450
570 The addresses for the OC RAM base will vary according to the 451endmenu
571 processor version. Consult vendor documentation for specifics.
572 452
573 If unsure, say N. 453config ISA_DMA_API
454 bool
455 depends on MPC1211
456 default y
574 457
575config SH_STORE_QUEUES 458menu "Kernel features"
576 bool "Support for Store Queues" 459
577 depends on CPU_SH4 460config KEXEC
461 bool "kexec system call (EXPERIMENTAL)"
462 depends on EXPERIMENTAL
578 help 463 help
579 Selecting this option will enable an in-kernel API for manipulating 464 kexec is a system call that implements the ability to shutdown your
580 the store queues integrated in the SH-4 processors. 465 current kernel, and to start another kernel. It is like a reboot
466 but it is indepedent of the system firmware. And like a reboot
467 you can start any kernel with it, not just Linux.
468
469 The name comes from the similiarity to the exec system call.
470
471 It is an ongoing process to be certain the hardware in a machine
472 is properly shutdown, so do not be surprised if this code does not
473 initially work for you. It may help to enable device hotplugging
474 support. As of this writing the exact hardware interface is
475 strongly in flux, so no good recommendation can be made.
476
477config PREEMPT
478 bool "Preemptible Kernel (EXPERIMENTAL)"
479 depends on EXPERIMENTAL
581 480
582config SMP 481config SMP
583 bool "Symmetric multi-processing support" 482 bool "Symmetric multi-processing support"
@@ -614,87 +513,58 @@ config NR_CPUS
614 This is purely to save memory - each supported CPU adds 513 This is purely to save memory - each supported CPU adds
615 approximately eight kilobytes to the kernel image. 514 approximately eight kilobytes to the kernel image.
616 515
617config HS7751RVOIP_CODEC 516config CPU_HAS_SR_RB
618 bool "Support VoIP Codec section" 517 bool "CPU has SR.RB"
619 depends on SH_HS7751RVOIP 518 depends on CPU_SH3 || CPU_SH4
620 help
621 Selecting this option will support CODEC section.
622
623config RTS7751R2D_REV11
624 bool "RTS7751R2D Rev. 1.1 board support"
625 depends on SH_RTS7751R2D
626 help
627 Selecting this option will support version rev. 1.1.
628
629config SH_PCLK_CALC
630 bool
631 default n if CPU_SUBTYPE_SH7300 || CPU_SUBTYPE_SH73180
632 default y 519 default y
633 help 520 help
634 This option will cause the PCLK value to be probed at run-time. It 521 This will enable the use of SR.RB register bank usage. Processors
635 will display a notification if the probed value has greater than a 522 that are lacking this bit must have another method in place for
636 1% variance of the hardcoded CONFIG_SH_PCLK_FREQ. 523 accomplishing what is taken care of by the banked registers.
637 524
638config SH_PCLK_FREQ 525 See <file:Documentation/sh/register-banks.txt> for further
639 int "Peripheral clock frequency (in Hz)" 526 information on SR.RB and register banking in the kernel in general.
640 default "50000000" if CPU_SUBTYPE_SH7750
641 default "60000000" if CPU_SUBTYPE_SH7751
642 default "33333333" if CPU_SUBTYPE_SH7300
643 default "27000000" if CPU_SUBTYPE_SH73180
644 default "66000000" if CPU_SUBTYPE_SH4_202
645 default "1193182"
646 help
647 This option is used to specify the peripheral clock frequency. This
648 option must be set for each processor in order for the kernel to
649 function reliably. If no sane default exists, we use a default from
650 the legacy i8254. Any discrepancies will be reported on boot time
651 with an auto-probed frequency which should be considered the proper
652 value for your hardware.
653 527
654menu "CPU Frequency scaling" 528endmenu
655 529
656source "drivers/cpufreq/Kconfig" 530menu "Boot options"
657 531
658config SH_CPU_FREQ 532config ZERO_PAGE_OFFSET
659 tristate "SuperH CPU Frequency driver" 533 hex "Zero page offset"
660 depends on CPU_FREQ 534 default "0x00004000" if SH_MPC1211 || SH_SH03
661 select CPU_FREQ_TABLE 535 default "0x00001000"
662 help 536 help
663 This adds the cpufreq driver for SuperH. At present, only 537 This sets the default offset of zero page.
664 the SH-4 is supported.
665
666 For details, take a look at <file:Documentation/cpu-freq>.
667
668 If unsure, say N.
669 538
670endmenu 539config BOOT_LINK_OFFSET
540 hex "Link address offset for booting"
541 default "0x00800000"
542 help
543 This option allows you to set the link address offset of the zImage.
544 This can be useful if you are on a board which has a small amount of
545 memory.
671 546
672source "arch/sh/drivers/dma/Kconfig" 547config UBC_WAKEUP
548 bool "Wakeup UBC on startup"
549 help
550 Selecting this option will wakeup the User Break Controller (UBC) on
551 startup. Although the UBC is left in an awake state when the processor
552 comes up, some boot loaders misbehave by putting the UBC to sleep in a
553 power saving state, which causes issues with things like ptrace().
673 554
674source "arch/sh/cchips/Kconfig" 555 If unsure, say N.
675 556
676config HEARTBEAT 557config CMDLINE_BOOL
677 bool "Heartbeat LED" 558 bool "Default bootloader kernel arguments"
678 depends on SH_MPC1211 || SH_SH03 || SH_CAT68701 || SH_STB1_HARP || SH_STB1_OVERDRIVE || SH_BIGSUR || SH_7751_SOLUTION_ENGINE || SH_7300_SOLUTION_ENGINE || SH_73180_SOLUTION_ENGINE || SH_SOLUTION_ENGINE || SH_RTS7751R2D || SH_SH4202_MICRODEV
679 help
680 Use the power-on LED on your machine as a load meter. The exact
681 behavior is platform-dependent, but normally the flash frequency is
682 a hyperbolic function of the 5-minute load average.
683 559
684config RTC_9701JE 560config CMDLINE
685 tristate "EPSON RTC-9701JE support" 561 string "Initial kernel command string"
686 depends on SH_RTS7751R2D 562 depends on CMDLINE_BOOL
687 help 563 default "console=ttySC1,115200"
688 Selecting this option will support EPSON RTC-9701JE.
689 564
690endmenu 565endmenu
691 566
692config ISA_DMA_API 567menu "Bus options"
693 bool
694 depends on MPC1211
695 default y
696
697menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)"
698 568
699# Even on SuperH devices which don't have an ISA bus, 569# Even on SuperH devices which don't have an ISA bus,
700# this variable helps the PCMCIA modules handle 570# this variable helps the PCMCIA modules handle
@@ -705,7 +575,7 @@ menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)"
705# PCMCIA outright. -- PFM. 575# PCMCIA outright. -- PFM.
706config ISA 576config ISA
707 bool 577 bool
708 default y if PCMCIA || SMC91X 578 default y if PCMCIA
709 help 579 help
710 Find out whether you have ISA slots on your motherboard. ISA is the 580 Find out whether you have ISA slots on your motherboard. ISA is the
711 name of a bus system, i.e. the way the CPU talks to the other stuff 581 name of a bus system, i.e. the way the CPU talks to the other stuff
@@ -739,10 +609,9 @@ config MCA
739config SBUS 609config SBUS
740 bool 610 bool
741 611
742config MAPLE 612config SUPERHYWAY
743 tristate "Maple Bus support" 613 tristate "SuperHyway Bus support"
744 depends on SH_DREAMCAST 614 depends on CPU_SUBTYPE_SH4_202
745 default y
746 615
747source "arch/sh/drivers/pci/Kconfig" 616source "arch/sh/drivers/pci/Kconfig"
748 617
diff --git a/arch/sh/Kconfig.debug b/arch/sh/Kconfig.debug
index 3fab181da364..8fb31ab2c02c 100644
--- a/arch/sh/Kconfig.debug
+++ b/arch/sh/Kconfig.debug
@@ -17,7 +17,7 @@ config SH_STANDARD_BIOS
17 17
18config EARLY_SCIF_CONSOLE 18config EARLY_SCIF_CONSOLE
19 bool "Use early SCIF console" 19 bool "Use early SCIF console"
20 depends on CPU_SH4 20 depends on CPU_SH4 || CPU_SH2A && !SH_STANDARD_BIOS
21 21
22config EARLY_PRINTK 22config EARLY_PRINTK
23 bool "Early printk support" 23 bool "Early printk support"
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 67192d6b00d8..08c9515c4806 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -17,10 +17,30 @@
17cflags-y := -mb 17cflags-y := -mb
18cflags-$(CONFIG_CPU_LITTLE_ENDIAN) := -ml 18cflags-$(CONFIG_CPU_LITTLE_ENDIAN) := -ml
19 19
20isa-y := any
21isa-$(CONFIG_CPU_SH2) := sh2
22isa-$(CONFIG_CPU_SH3) := sh3
23isa-$(CONFIG_CPU_SH4) := sh4
24isa-$(CONFIG_CPU_SH4A) := sh4a
25isa-$(CONFIG_CPU_SH2A) := sh2a
26
27isa-$(CONFIG_SH_DSP) := $(isa-y)-dsp
28
29ifndef CONFIG_MMU
30isa-y := $(isa-y)-nommu
31endif
32
33ifndef CONFIG_SH_FPU
34isa-y := $(isa-y)-nofpu
35endif
36
37cflags-y += $(call as-option,-Wa$(comma)-isa=$(isa-y),)
38
20cflags-$(CONFIG_CPU_SH2) += -m2 39cflags-$(CONFIG_CPU_SH2) += -m2
21cflags-$(CONFIG_CPU_SH3) += -m3 40cflags-$(CONFIG_CPU_SH3) += -m3
22cflags-$(CONFIG_CPU_SH4) += -m4 \ 41cflags-$(CONFIG_CPU_SH4) += -m4 \
23 $(call cc-option,-mno-implicit-fp,-m4-nofpu) 42 $(call cc-option,-mno-implicit-fp,-m4-nofpu)
43cflags-$(CONFIG_CPU_SH4A) += $(call cc-option,-m4a-nofpu,)
24 44
25cflags-$(CONFIG_SH_DSP) += -Wa,-dsp 45cflags-$(CONFIG_SH_DSP) += -Wa,-dsp
26cflags-$(CONFIG_SH_KGDB) += -g 46cflags-$(CONFIG_SH_KGDB) += -g
@@ -67,9 +87,7 @@ machdir-$(CONFIG_SH_7300_SOLUTION_ENGINE) := se/7300
67machdir-$(CONFIG_SH_73180_SOLUTION_ENGINE) := se/73180 87machdir-$(CONFIG_SH_73180_SOLUTION_ENGINE) := se/73180
68machdir-$(CONFIG_SH_STB1_HARP) := harp 88machdir-$(CONFIG_SH_STB1_HARP) := harp
69machdir-$(CONFIG_SH_STB1_OVERDRIVE) := overdrive 89machdir-$(CONFIG_SH_STB1_OVERDRIVE) := overdrive
70machdir-$(CONFIG_SH_HP620) := hp6xx/hp620 90machdir-$(CONFIG_SH_HP6XX) := hp6xx
71machdir-$(CONFIG_SH_HP680) := hp6xx/hp680
72machdir-$(CONFIG_SH_HP690) := hp6xx/hp690
73machdir-$(CONFIG_SH_CQREEK) := cqreek 91machdir-$(CONFIG_SH_CQREEK) := cqreek
74machdir-$(CONFIG_SH_DMIDA) := dmida 92machdir-$(CONFIG_SH_DMIDA) := dmida
75machdir-$(CONFIG_SH_EC3104) := ec3104 93machdir-$(CONFIG_SH_EC3104) := ec3104
@@ -119,31 +137,39 @@ boot := arch/sh/boot
119 137
120CPPFLAGS_vmlinux.lds := -traditional 138CPPFLAGS_vmlinux.lds := -traditional
121 139
140ifneq ($(KBUILD_SRC),)
141incdir-prefix := $(srctree)/include/asm-sh/
142else
143incdir-prefix :=
144endif
145
122# Update machine arch and proc symlinks if something which affects 146# Update machine arch and proc symlinks if something which affects
123# them changed. We use .arch and .mach to indicate when they were 147# them changed. We use .arch and .mach to indicate when they were
124# updated last, otherwise make uses the target directory mtime. 148# updated last, otherwise make uses the target directory mtime.
125 149
126include/asm-sh/.cpu: $(wildcard include/config/cpu/*.h) include/config/MARKER 150include/asm-sh/.cpu: $(wildcard include/config/cpu/*.h) include/config/MARKER
127 @echo ' SYMLINK include/asm-sh/cpu -> include/asm-sh/$(cpuincdir-y)' 151 @echo ' SYMLINK include/asm-sh/cpu -> include/asm-sh/$(cpuincdir-y)'
128ifneq ($(KBUILD_SRC),) 152 $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
129 $(Q)mkdir -p include/asm-sh 153 $(Q)ln -fsn $(incdir-prefix)$(cpuincdir-y) include/asm-sh/cpu
130 $(Q)ln -fsn $(srctree)/include/asm-sh/$(cpuincdir-y) include/asm-sh/cpu
131else
132 $(Q)ln -fsn $(cpuincdir-y) include/asm-sh/cpu
133endif
134 @touch $@ 154 @touch $@
135 155
156# Most boards have their own mach directories. For the ones that
157# don't, just reference the parent directory so the semantics are
158# kept roughly the same.
159
136include/asm-sh/.mach: $(wildcard include/config/sh/*.h) include/config/MARKER 160include/asm-sh/.mach: $(wildcard include/config/sh/*.h) include/config/MARKER
137 @echo ' SYMLINK include/asm-sh/mach -> include/asm-sh/$(incdir-y)' 161 @echo -n ' SYMLINK include/asm-sh/mach -> '
138ifneq ($(KBUILD_SRC),) 162 $(Q)if [ ! -d include/asm-sh ]; then mkdir -p include/asm-sh; fi
139 $(Q)mkdir -p include/asm-sh 163 $(Q)if [ -d $(incdir-prefix)$(incdir-y) ]; then \
140 $(Q)ln -fsn $(srctree)/include/asm-sh/$(incdir-y) include/asm-sh/mach 164 echo -e 'include/asm-sh/$(incdir-y)'; \
141else 165 ln -fsn $(incdir-prefix)$(incdir-y) \
142 $(Q)ln -fsn $(incdir-y) include/asm-sh/mach 166 include/asm-sh/mach; \
143endif 167 else \
168 echo -e 'include/asm-sh'; \
169 ln -fsn $(incdir-prefix) include/asm-sh/mach; \
170 fi
144 @touch $@ 171 @touch $@
145 172
146
147archprepare: maketools include/asm-sh/.cpu include/asm-sh/.mach 173archprepare: maketools include/asm-sh/.cpu include/asm-sh/.mach
148 174
149.PHONY: maketools FORCE 175.PHONY: maketools FORCE
diff --git a/arch/sh/boards/hp6xx/Makefile b/arch/sh/boards/hp6xx/Makefile
new file mode 100644
index 000000000000..927fe0aa5dfa
--- /dev/null
+++ b/arch/sh/boards/hp6xx/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile for the HP6xx specific parts of the kernel
3#
4
5obj-y := mach.o setup.o
6
diff --git a/arch/sh/boards/hp6xx/hp620/Makefile b/arch/sh/boards/hp6xx/hp620/Makefile
deleted file mode 100644
index 20691dbce347..000000000000
--- a/arch/sh/boards/hp6xx/hp620/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
1#
2# Makefile for the HP620 specific parts of the kernel
3#
4
5obj-y := mach.o setup.o
6
diff --git a/arch/sh/boards/hp6xx/hp620/mach.c b/arch/sh/boards/hp6xx/hp620/mach.c
deleted file mode 100644
index 0392d82b4a7b..000000000000
--- a/arch/sh/boards/hp6xx/hp620/mach.c
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * linux/arch/sh/boards/hp6xx/hp620/mach.c
3 *
4 * Copyright (C) 2000 Stuart Menefy (stuart.menefy@st.com)
5 *
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
8 *
9 * Machine vector for the HP620
10 */
11
12#include <linux/init.h>
13
14#include <asm/machvec.h>
15#include <asm/rtc.h>
16#include <asm/machvec_init.h>
17
18#include <asm/io.h>
19#include <asm/hd64461/hd64461.h>
20#include <asm/irq.h>
21
22/*
23 * The Machine Vector
24 */
25
26struct sh_machine_vector mv_hp620 __initmv = {
27 .mv_nr_irqs = HD64461_IRQBASE+HD64461_IRQ_NUM,
28
29 .mv_inb = hd64461_inb,
30 .mv_inw = hd64461_inw,
31 .mv_inl = hd64461_inl,
32 .mv_outb = hd64461_outb,
33 .mv_outw = hd64461_outw,
34 .mv_outl = hd64461_outl,
35
36 .mv_inb_p = hd64461_inb_p,
37 .mv_inw_p = hd64461_inw,
38 .mv_inl_p = hd64461_inl,
39 .mv_outb_p = hd64461_outb_p,
40 .mv_outw_p = hd64461_outw,
41 .mv_outl_p = hd64461_outl,
42
43 .mv_insb = hd64461_insb,
44 .mv_insw = hd64461_insw,
45 .mv_insl = hd64461_insl,
46 .mv_outsb = hd64461_outsb,
47 .mv_outsw = hd64461_outsw,
48 .mv_outsl = hd64461_outsl,
49
50 .mv_irq_demux = hd64461_irq_demux,
51};
52ALIAS_MV(hp620)
diff --git a/arch/sh/boards/hp6xx/hp620/setup.c b/arch/sh/boards/hp6xx/hp620/setup.c
deleted file mode 100644
index 045fc5da7274..000000000000
--- a/arch/sh/boards/hp6xx/hp620/setup.c
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * linux/arch/sh/boards/hp6xx/hp620/setup.c
3 *
4 * Copyright (C) 2002 Andriy Skulysh, 2005 Kristoffer Ericson
5 *
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See Linux/COPYING for more information.
8 *
9 * Setup code for an HP620.
10 * Due to similiarity with hp680/hp690 same inits are done (for now)
11 */
12
13#include <linux/config.h>
14#include <linux/init.h>
15#include <asm/hd64461/hd64461.h>
16#include <asm/io.h>
17#include <asm/hp6xx/hp6xx.h>
18#include <asm/cpu/dac.h>
19
20const char *get_system_type(void)
21{
22 return "HP620";
23}
24
25int __init platform_setup(void)
26{
27 u16 v;
28
29 v = inw(HD64461_STBCR);
30 v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
31 HD64461_STBCR_STM1ST | HD64461_STBCR_STM0ST |
32 HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
33 HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST |
34 HD64461_STBCR_SAFECKE_IST;
35 outw(v, HD64461_STBCR);
36
37 v = inw(HD64461_GPADR);
38 v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
39 outw(v, HD64461_GPADR);
40
41 sh_dac_disable(DAC_SPEAKER_VOLUME);
42
43 return 0;
44}
45
diff --git a/arch/sh/boards/hp6xx/hp680/Makefile b/arch/sh/boards/hp6xx/hp680/Makefile
deleted file mode 100644
index 0beef11d9b11..000000000000
--- a/arch/sh/boards/hp6xx/hp680/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
1#
2# Makefile for the HP680 specific parts of the kernel
3#
4
5obj-y := mach.o setup.o
6
diff --git a/arch/sh/boards/hp6xx/hp690/Makefile b/arch/sh/boards/hp6xx/hp690/Makefile
deleted file mode 100644
index fbbe95e75f83..000000000000
--- a/arch/sh/boards/hp6xx/hp690/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
1#
2# Makefile for the HP690 specific parts of the kernel
3#
4
5obj-y := mach.o
6
diff --git a/arch/sh/boards/hp6xx/hp690/mach.c b/arch/sh/boards/hp6xx/hp690/mach.c
deleted file mode 100644
index 2a4c68783cd6..000000000000
--- a/arch/sh/boards/hp6xx/hp690/mach.c
+++ /dev/null
@@ -1,48 +0,0 @@
1/*
2 * linux/arch/sh/boards/hp6xx/hp690/mach.c
3 *
4 * Copyright (C) 2000 Stuart Menefy (stuart.menefy@st.com)
5 *
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
8 *
9 * Machine vector for the HP690
10 */
11
12#include <linux/init.h>
13
14#include <asm/machvec.h>
15#include <asm/rtc.h>
16#include <asm/machvec_init.h>
17
18#include <asm/io.h>
19#include <asm/hd64461/hd64461.h>
20#include <asm/irq.h>
21
22struct sh_machine_vector mv_hp690 __initmv = {
23 .mv_nr_irqs = HD64461_IRQBASE+HD64461_IRQ_NUM,
24
25 .mv_inb = hd64461_inb,
26 .mv_inw = hd64461_inw,
27 .mv_inl = hd64461_inl,
28 .mv_outb = hd64461_outb,
29 .mv_outw = hd64461_outw,
30 .mv_outl = hd64461_outl,
31
32 .mv_inb_p = hd64461_inb_p,
33 .mv_inw_p = hd64461_inw,
34 .mv_inl_p = hd64461_inl,
35 .mv_outb_p = hd64461_outb_p,
36 .mv_outw_p = hd64461_outw,
37 .mv_outl_p = hd64461_outl,
38
39 .mv_insb = hd64461_insb,
40 .mv_insw = hd64461_insw,
41 .mv_insl = hd64461_insl,
42 .mv_outsb = hd64461_outsb,
43 .mv_outsw = hd64461_outsw,
44 .mv_outsl = hd64461_outsl,
45
46 .mv_irq_demux = hd64461_irq_demux,
47};
48ALIAS_MV(hp690)
diff --git a/arch/sh/boards/hp6xx/hp680/mach.c b/arch/sh/boards/hp6xx/mach.c
index d73486136045..08dbba910f74 100644
--- a/arch/sh/boards/hp6xx/hp680/mach.c
+++ b/arch/sh/boards/hp6xx/mach.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/sh/boards/hp6xx/hp680/mach.c 2 * linux/arch/sh/boards/hp6xx/mach.c
3 * 3 *
4 * Copyright (C) 2000 Stuart Menefy (stuart.menefy@st.com) 4 * Copyright (C) 2000 Stuart Menefy (stuart.menefy@st.com)
5 * 5 *
@@ -8,19 +8,12 @@
8 * 8 *
9 * Machine vector for the HP680 9 * Machine vector for the HP680
10 */ 10 */
11
12#include <linux/init.h>
13
14#include <asm/machvec.h> 11#include <asm/machvec.h>
15#include <asm/rtc.h> 12#include <asm/hd64461.h>
16#include <asm/machvec_init.h>
17
18#include <asm/io.h> 13#include <asm/io.h>
19#include <asm/hd64461/hd64461.h>
20#include <asm/hp6xx/io.h>
21#include <asm/irq.h> 14#include <asm/irq.h>
22 15
23struct sh_machine_vector mv_hp680 __initmv = { 16struct sh_machine_vector mv_hp6xx __initmv = {
24 .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM, 17 .mv_nr_irqs = HD64461_IRQBASE + HD64461_IRQ_NUM,
25 18
26 .mv_inb = hd64461_inb, 19 .mv_inb = hd64461_inb,
@@ -50,4 +43,4 @@ struct sh_machine_vector mv_hp680 __initmv = {
50 .mv_irq_demux = hd64461_irq_demux, 43 .mv_irq_demux = hd64461_irq_demux,
51}; 44};
52 45
53ALIAS_MV(hp680) 46ALIAS_MV(hp6xx)
diff --git a/arch/sh/boards/hp6xx/hp680/setup.c b/arch/sh/boards/hp6xx/setup.c
index 4170190f2644..6d94a8e2e67a 100644
--- a/arch/sh/boards/hp6xx/hp680/setup.c
+++ b/arch/sh/boards/hp6xx/setup.c
@@ -11,18 +11,19 @@
11 11
12#include <linux/config.h> 12#include <linux/config.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <asm/hd64461/hd64461.h>
15#include <asm/io.h> 14#include <asm/io.h>
15#include <asm/hd64461.h>
16#include <asm/hp6xx/hp6xx.h> 16#include <asm/hp6xx/hp6xx.h>
17#include <asm/cpu/dac.h> 17#include <asm/cpu/dac.h>
18 18
19const char *get_system_type(void) 19const char *get_system_type(void)
20{ 20{
21 return "HP680"; 21 return "HP6xx";
22} 22}
23 23
24int __init platform_setup(void) 24int __init platform_setup(void)
25{ 25{
26 u8 v8;
26 u16 v; 27 u16 v;
27 v = inw(HD64461_STBCR); 28 v = inw(HD64461_STBCR);
28 v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST | 29 v |= HD64461_STBCR_SURTST | HD64461_STBCR_SIRST |
@@ -30,12 +31,25 @@ int __init platform_setup(void)
30 HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST | 31 HD64461_STBCR_SAFEST | HD64461_STBCR_SPC0ST |
31 HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST | 32 HD64461_STBCR_SMIAST | HD64461_STBCR_SAFECKE_OST |
32 HD64461_STBCR_SAFECKE_IST; 33 HD64461_STBCR_SAFECKE_IST;
34#ifndef CONFIG_HD64461_ENABLER
35 v |= HD64461_STBCR_SPC1ST;
36#endif
33 outw(v, HD64461_STBCR); 37 outw(v, HD64461_STBCR);
34 v = inw(HD64461_GPADR); 38 v = inw(HD64461_GPADR);
35 v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0; 39 v |= HD64461_GPADR_SPEAKER | HD64461_GPADR_PCMCIA0;
36 outw(v, HD64461_GPADR); 40 outw(v, HD64461_GPADR);
37 41
42 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC0GCR);
43
44#ifndef CONFIG_HD64461_ENABLER
45 outw(HD64461_PCCGCR_VCC0 | HD64461_PCCSCR_VCC1, HD64461_PCC1GCR);
46#endif
47
48 sh_dac_output(0, DAC_SPEAKER_VOLUME);
38 sh_dac_disable(DAC_SPEAKER_VOLUME); 49 sh_dac_disable(DAC_SPEAKER_VOLUME);
50 v8 = ctrl_inb(DACR);
51 v8 &= ~DACR_DAE;
52 ctrl_outb(v8,DACR);
39 53
40 return 0; 54 return 0;
41} 55}
diff --git a/arch/sh/boards/overdrive/Makefile b/arch/sh/boards/overdrive/Makefile
index 1762b59e9279..245f03baf762 100644
--- a/arch/sh/boards/overdrive/Makefile
+++ b/arch/sh/boards/overdrive/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the STMicroelectronics Overdrive specific parts of the kernel 2# Makefile for the STMicroelectronics Overdrive specific parts of the kernel
3# 3#
4 4
5obj-y := mach.o setup.o io.o irq.o led.o time.o 5obj-y := mach.o setup.o io.o irq.o led.o
6 6
7obj-$(CONFIG_PCI) += fpga.o galileo.o pcidma.o 7obj-$(CONFIG_PCI) += fpga.o galileo.o pcidma.o
8 8
diff --git a/arch/sh/boards/overdrive/setup.c b/arch/sh/boards/overdrive/setup.c
index a36ce0284ed3..94f6165d33b8 100644
--- a/arch/sh/boards/overdrive/setup.c
+++ b/arch/sh/boards/overdrive/setup.c
@@ -17,8 +17,6 @@
17#include <asm/overdrive/overdrive.h> 17#include <asm/overdrive/overdrive.h>
18#include <asm/overdrive/fpga.h> 18#include <asm/overdrive/fpga.h>
19 19
20extern void od_time_init(void);
21
22const char *get_system_type(void) 20const char *get_system_type(void)
23{ 21{
24 return "SH7750 Overdrive"; 22 return "SH7750 Overdrive";
@@ -31,11 +29,9 @@ int __init platform_setup(void)
31{ 29{
32#ifdef CONFIG_PCI 30#ifdef CONFIG_PCI
33 init_overdrive_fpga(); 31 init_overdrive_fpga();
34 galileo_init(); 32 galileo_init();
35#endif 33#endif
36 34
37 board_time_init = od_time_init;
38
39 /* Enable RS232 receive buffers */ 35 /* Enable RS232 receive buffers */
40 writel(0x1e, OVERDRIVE_CTRL); 36 writel(0x1e, OVERDRIVE_CTRL);
41} 37}
diff --git a/arch/sh/boards/overdrive/time.c b/arch/sh/boards/overdrive/time.c
deleted file mode 100644
index 68533690e097..000000000000
--- a/arch/sh/boards/overdrive/time.c
+++ /dev/null
@@ -1,119 +0,0 @@
1/*
2 * arch/sh/boards/overdrive/time.c
3 *
4 * Copyright (C) 2000 Stuart Menefy (stuart.menefy@st.com)
5 * Copyright (C) 2002 Paul Mundt (lethal@chaoticdreams.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 * STMicroelectronics Overdrive Support.
11 */
12
13void od_time_init(void)
14{
15 struct frqcr_data {
16 unsigned short frqcr;
17 struct {
18 unsigned char multiplier;
19 unsigned char divisor;
20 } factor[3];
21 };
22
23 static struct frqcr_data st40_frqcr_table[] = {
24 { 0x000, {{1,1}, {1,1}, {1,2}}},
25 { 0x002, {{1,1}, {1,1}, {1,4}}},
26 { 0x004, {{1,1}, {1,1}, {1,8}}},
27 { 0x008, {{1,1}, {1,2}, {1,2}}},
28 { 0x00A, {{1,1}, {1,2}, {1,4}}},
29 { 0x00C, {{1,1}, {1,2}, {1,8}}},
30 { 0x011, {{1,1}, {2,3}, {1,6}}},
31 { 0x013, {{1,1}, {2,3}, {1,3}}},
32 { 0x01A, {{1,1}, {1,2}, {1,4}}},
33 { 0x01C, {{1,1}, {1,2}, {1,8}}},
34 { 0x023, {{1,1}, {2,3}, {1,3}}},
35 { 0x02C, {{1,1}, {1,2}, {1,8}}},
36 { 0x048, {{1,2}, {1,2}, {1,4}}},
37 { 0x04A, {{1,2}, {1,2}, {1,6}}},
38 { 0x04C, {{1,2}, {1,2}, {1,8}}},
39 { 0x05A, {{1,2}, {1,3}, {1,6}}},
40 { 0x05C, {{1,2}, {1,3}, {1,6}}},
41 { 0x063, {{1,2}, {1,4}, {1,4}}},
42 { 0x06C, {{1,2}, {1,4}, {1,8}}},
43 { 0x091, {{1,3}, {1,3}, {1,6}}},
44 { 0x093, {{1,3}, {1,3}, {1,6}}},
45 { 0x0A3, {{1,3}, {1,6}, {1,6}}},
46 { 0x0DA, {{1,4}, {1,4}, {1,8}}},
47 { 0x0DC, {{1,4}, {1,4}, {1,8}}},
48 { 0x0EC, {{1,4}, {1,8}, {1,8}}},
49 { 0x123, {{1,4}, {1,4}, {1,8}}},
50 { 0x16C, {{1,4}, {1,8}, {1,8}}},
51 };
52
53 struct memclk_data {
54 unsigned char multiplier;
55 unsigned char divisor;
56 };
57 static struct memclk_data st40_memclk_table[8] = {
58 {1,1}, // 000
59 {1,2}, // 001
60 {1,3}, // 010
61 {2,3}, // 011
62 {1,4}, // 100
63 {1,6}, // 101
64 {1,8}, // 110
65 {1,8} // 111
66 };
67
68 unsigned long pvr;
69
70 /*
71 * This should probably be moved into the SH3 probing code, and then
72 * use the processor structure to determine which CPU we are running
73 * on.
74 */
75 pvr = ctrl_inl(CCN_PVR);
76 printk("PVR %08x\n", pvr);
77
78 if (((pvr >> CCN_PVR_CHIP_SHIFT) & CCN_PVR_CHIP_MASK) == CCN_PVR_CHIP_ST40STB1) {
79 /*
80 * Unfortunatly the STB1 FRQCR values are different from the
81 * 7750 ones.
82 */
83 struct frqcr_data *d;
84 int a;
85 unsigned long memclkcr;
86 struct memclk_data *e;
87
88 for (a=0; a<ARRAY_SIZE(st40_frqcr_table); a++) {
89 d = &st40_frqcr_table[a];
90 if (d->frqcr == (frqcr & 0x1ff))
91 break;
92 }
93 if (a == ARRAY_SIZE(st40_frqcr_table)) {
94 d = st40_frqcr_table;
95 printk("ERROR: Unrecognised FRQCR value, using default multipliers\n");
96 }
97
98 memclkcr = ctrl_inl(CLOCKGEN_MEMCLKCR);
99 e = &st40_memclk_table[memclkcr & MEMCLKCR_RATIO_MASK];
100
101 printk("Clock multipliers: CPU: %d/%d Bus: %d/%d Mem: %d/%d Periph: %d/%d\n",
102 d->factor[0].multiplier, d->factor[0].divisor,
103 d->factor[1].multiplier, d->factor[1].divisor,
104 e->multiplier, e->divisor,
105 d->factor[2].multiplier, d->factor[2].divisor);
106
107 current_cpu_data.master_clock = current_cpu_data.module_clock *
108 d->factor[2].divisor /
109 d->factor[2].multiplier;
110 current_cpu_data.bus_clock = current_cpu_data.master_clock *
111 d->factor[1].multiplier /
112 d->factor[1].divisor;
113 current_cpu_data.memory_clock = current_cpu_data.master_clock *
114 e->multiplier / e->divisor;
115 current_cpu_data.cpu_clock = current_cpu_data.master_clock *
116 d->factor[0].multiplier /
117 d->factor[0].divisor;
118}
119
diff --git a/arch/sh/configs/hp680_defconfig b/arch/sh/configs/hp6xx_defconfig
index c85d3655b53c..b36f102cec81 100644
--- a/arch/sh/configs/hp680_defconfig
+++ b/arch/sh/configs/hp6xx_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-sh 3# Linux kernel version: 2.6.15-sh
4# Wed Mar 2 15:09:41 2005 4# Wed Jan 4 15:32:56 2006
5# 5#
6CONFIG_SUPERH=y 6CONFIG_SUPERH=y
7CONFIG_UID16=y 7CONFIG_UID16=y
@@ -17,31 +17,36 @@ CONFIG_EXPERIMENTAL=y
17# CONFIG_CLEAN_COMPILE is not set 17# CONFIG_CLEAN_COMPILE is not set
18CONFIG_BROKEN=y 18CONFIG_BROKEN=y
19CONFIG_BROKEN_ON_SMP=y 19CONFIG_BROKEN_ON_SMP=y
20CONFIG_INIT_ENV_ARG_LIMIT=32
20 21
21# 22#
22# General setup 23# General setup
23# 24#
24CONFIG_LOCALVERSION="" 25CONFIG_LOCALVERSION=""
26CONFIG_LOCALVERSION_AUTO=y
25CONFIG_SWAP=y 27CONFIG_SWAP=y
26# CONFIG_SYSVIPC is not set 28# CONFIG_SYSVIPC is not set
27# CONFIG_BSD_PROCESS_ACCT is not set 29# CONFIG_BSD_PROCESS_ACCT is not set
28# CONFIG_SYSCTL is not set 30# CONFIG_SYSCTL is not set
29# CONFIG_AUDIT is not set 31CONFIG_HOTPLUG=y
30CONFIG_LOG_BUF_SHIFT=14
31# CONFIG_HOTPLUG is not set
32# CONFIG_IKCONFIG is not set 32# CONFIG_IKCONFIG is not set
33CONFIG_INITRAMFS_SOURCE=""
34CONFIG_CC_OPTIMIZE_FOR_SIZE=y
33# CONFIG_EMBEDDED is not set 35# CONFIG_EMBEDDED is not set
34CONFIG_KALLSYMS=y 36CONFIG_KALLSYMS=y
35# CONFIG_KALLSYMS_EXTRA_PASS is not set 37# CONFIG_KALLSYMS_EXTRA_PASS is not set
38CONFIG_PRINTK=y
39CONFIG_BUG=y
40CONFIG_BASE_FULL=y
36CONFIG_FUTEX=y 41CONFIG_FUTEX=y
37CONFIG_EPOLL=y 42CONFIG_EPOLL=y
38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39CONFIG_SHMEM=y 43CONFIG_SHMEM=y
40CONFIG_CC_ALIGN_FUNCTIONS=0 44CONFIG_CC_ALIGN_FUNCTIONS=0
41CONFIG_CC_ALIGN_LABELS=0 45CONFIG_CC_ALIGN_LABELS=0
42CONFIG_CC_ALIGN_LOOPS=0 46CONFIG_CC_ALIGN_LOOPS=0
43CONFIG_CC_ALIGN_JUMPS=0 47CONFIG_CC_ALIGN_JUMPS=0
44# CONFIG_TINY_SHMEM is not set 48# CONFIG_TINY_SHMEM is not set
49CONFIG_BASE_SMALL=0
45 50
46# 51#
47# Loadable module support 52# Loadable module support
@@ -49,6 +54,24 @@ CONFIG_CC_ALIGN_JUMPS=0
49# CONFIG_MODULES is not set 54# CONFIG_MODULES is not set
50 55
51# 56#
57# Block layer
58#
59# CONFIG_LBD is not set
60
61#
62# IO Schedulers
63#
64CONFIG_IOSCHED_NOOP=y
65CONFIG_IOSCHED_AS=y
66CONFIG_IOSCHED_DEADLINE=y
67CONFIG_IOSCHED_CFQ=y
68CONFIG_DEFAULT_AS=y
69# CONFIG_DEFAULT_DEADLINE is not set
70# CONFIG_DEFAULT_CFQ is not set
71# CONFIG_DEFAULT_NOOP is not set
72CONFIG_DEFAULT_IOSCHED="anticipatory"
73
74#
52# System type 75# System type
53# 76#
54# CONFIG_SH_SOLUTION_ENGINE is not set 77# CONFIG_SH_SOLUTION_ENGINE is not set
@@ -58,9 +81,7 @@ CONFIG_CC_ALIGN_JUMPS=0
58# CONFIG_SH_7751_SYSTEMH is not set 81# CONFIG_SH_7751_SYSTEMH is not set
59# CONFIG_SH_STB1_HARP is not set 82# CONFIG_SH_STB1_HARP is not set
60# CONFIG_SH_STB1_OVERDRIVE is not set 83# CONFIG_SH_STB1_OVERDRIVE is not set
61# CONFIG_SH_HP620 is not set 84CONFIG_SH_HP6XX=y
62CONFIG_SH_HP680=y
63# CONFIG_SH_HP690 is not set
64# CONFIG_SH_CQREEK is not set 85# CONFIG_SH_CQREEK is not set
65# CONFIG_SH_DMIDA is not set 86# CONFIG_SH_DMIDA is not set
66# CONFIG_SH_EC3104 is not set 87# CONFIG_SH_EC3104 is not set
@@ -77,43 +98,90 @@ CONFIG_SH_HP680=y
77# CONFIG_SH_RTS7751R2D is not set 98# CONFIG_SH_RTS7751R2D is not set
78# CONFIG_SH_EDOSK7705 is not set 99# CONFIG_SH_EDOSK7705 is not set
79# CONFIG_SH_SH4202_MICRODEV is not set 100# CONFIG_SH_SH4202_MICRODEV is not set
101# CONFIG_SH_LANDISK is not set
102# CONFIG_SH_TITAN is not set
80# CONFIG_SH_UNKNOWN is not set 103# CONFIG_SH_UNKNOWN is not set
81# CONFIG_CPU_SH2 is not set 104
105#
106# Processor selection
107#
82CONFIG_CPU_SH3=y 108CONFIG_CPU_SH3=y
83# CONFIG_CPU_SH4 is not set 109
110#
111# SH-2 Processor Support
112#
84# CONFIG_CPU_SUBTYPE_SH7604 is not set 113# CONFIG_CPU_SUBTYPE_SH7604 is not set
114
115#
116# SH-3 Processor Support
117#
85# CONFIG_CPU_SUBTYPE_SH7300 is not set 118# CONFIG_CPU_SUBTYPE_SH7300 is not set
86# CONFIG_CPU_SUBTYPE_SH7705 is not set 119# CONFIG_CPU_SUBTYPE_SH7705 is not set
87# CONFIG_CPU_SUBTYPE_SH7707 is not set 120# CONFIG_CPU_SUBTYPE_SH7707 is not set
88# CONFIG_CPU_SUBTYPE_SH7708 is not set 121# CONFIG_CPU_SUBTYPE_SH7708 is not set
89CONFIG_CPU_SUBTYPE_SH7709=y 122CONFIG_CPU_SUBTYPE_SH7709=y
123
124#
125# SH-4 Processor Support
126#
90# CONFIG_CPU_SUBTYPE_SH7750 is not set 127# CONFIG_CPU_SUBTYPE_SH7750 is not set
128# CONFIG_CPU_SUBTYPE_SH7091 is not set
129# CONFIG_CPU_SUBTYPE_SH7750R is not set
130# CONFIG_CPU_SUBTYPE_SH7750S is not set
91# CONFIG_CPU_SUBTYPE_SH7751 is not set 131# CONFIG_CPU_SUBTYPE_SH7751 is not set
132# CONFIG_CPU_SUBTYPE_SH7751R is not set
92# CONFIG_CPU_SUBTYPE_SH7760 is not set 133# CONFIG_CPU_SUBTYPE_SH7760 is not set
93# CONFIG_CPU_SUBTYPE_SH73180 is not set 134# CONFIG_CPU_SUBTYPE_SH4_202 is not set
135
136#
137# ST40 Processor Support
138#
94# CONFIG_CPU_SUBTYPE_ST40STB1 is not set 139# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
95# CONFIG_CPU_SUBTYPE_ST40GX1 is not set 140# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
96# CONFIG_CPU_SUBTYPE_SH4_202 is not set 141
142#
143# SH-4A Processor Support
144#
145# CONFIG_CPU_SUBTYPE_SH73180 is not set
146# CONFIG_CPU_SUBTYPE_SH7770 is not set
147# CONFIG_CPU_SUBTYPE_SH7780 is not set
148
149#
150# Memory management options
151#
97CONFIG_MMU=y 152CONFIG_MMU=y
98# CONFIG_CMDLINE_BOOL is not set 153CONFIG_SELECT_MEMORY_MODEL=y
154CONFIG_FLATMEM_MANUAL=y
155# CONFIG_DISCONTIGMEM_MANUAL is not set
156# CONFIG_SPARSEMEM_MANUAL is not set
157CONFIG_FLATMEM=y
158CONFIG_FLAT_NODE_MEM_MAP=y
159# CONFIG_SPARSEMEM_STATIC is not set
160CONFIG_SPLIT_PTLOCK_CPUS=4
161
162#
163# Cache configuration
164#
165# CONFIG_SH_DIRECT_MAPPED is not set
166# CONFIG_SH_WRITETHROUGH is not set
167# CONFIG_SH_OCRAM is not set
99CONFIG_MEMORY_START=0x0c000000 168CONFIG_MEMORY_START=0x0c000000
100CONFIG_MEMORY_SIZE=0x00400000 169CONFIG_MEMORY_SIZE=0x00400000
101CONFIG_MEMORY_SET=y 170
102# CONFIG_MEMORY_OVERRIDE is not set 171#
172# Processor features
173#
174CONFIG_CPU_LITTLE_ENDIAN=y
103CONFIG_SH_RTC=y 175CONFIG_SH_RTC=y
104# CONFIG_SH_DSP is not set 176# CONFIG_SH_DSP is not set
105CONFIG_SH_ADC=y 177CONFIG_SH_ADC=y
106CONFIG_SH_HP600=y 178
107CONFIG_ZERO_PAGE_OFFSET=0x00001000 179#
108CONFIG_BOOT_LINK_OFFSET=0x00800000 180# Timer support
109CONFIG_CPU_LITTLE_ENDIAN=y 181#
110# CONFIG_PREEMPT is not set 182CONFIG_SH_TMU=y
111# CONFIG_UBC_WAKEUP is not set 183CONFIG_SH_PCLK_FREQ_BOOL=y
112# CONFIG_SH_WRITETHROUGH is not set 184CONFIG_SH_PCLK_FREQ=22110000
113# CONFIG_SH_OCRAM is not set
114# CONFIG_SMP is not set
115CONFIG_SH_PCLK_CALC=y
116CONFIG_SH_PCLK_FREQ=1193182
117 185
118# 186#
119# CPU Frequency scaling 187# CPU Frequency scaling
@@ -123,7 +191,10 @@ CONFIG_SH_PCLK_FREQ=1193182
123# 191#
124# DMA support 192# DMA support
125# 193#
126# CONFIG_SH_DMA is not set 194CONFIG_SH_DMA=y
195CONFIG_NR_ONCHIP_DMA_CHANNELS=4
196# CONFIG_NR_DMA_CHANNELS_BOOL is not set
197# CONFIG_DMA_PAGE_OPS is not set
127 198
128# 199#
129# Companion Chips 200# Companion Chips
@@ -132,21 +203,47 @@ CONFIG_HD6446X_SERIES=y
132CONFIG_HD64461=y 203CONFIG_HD64461=y
133# CONFIG_HD64465 is not set 204# CONFIG_HD64465 is not set
134CONFIG_HD64461_IRQ=36 205CONFIG_HD64461_IRQ=36
135# CONFIG_HD64461_ENABLER is not set 206CONFIG_HD64461_IOBASE=0xb0000000
207CONFIG_HD64461_ENABLER=y
208
209#
210# Kernel features
211#
212# CONFIG_KEXEC is not set
213# CONFIG_PREEMPT is not set
214# CONFIG_SMP is not set
136 215
137# 216#
138# Bus options (PCI, PCMCIA, EISA, MCA, ISA) 217# Boot options
139# 218#
219CONFIG_ZERO_PAGE_OFFSET=0x00001000
220CONFIG_BOOT_LINK_OFFSET=0x00800000
221# CONFIG_UBC_WAKEUP is not set
222# CONFIG_CMDLINE_BOOL is not set
223
224#
225# Bus options
226#
227CONFIG_ISA=y
140# CONFIG_PCI is not set 228# CONFIG_PCI is not set
141 229
142# 230#
143# PCCARD (PCMCIA/CardBus) support 231# PCCARD (PCMCIA/CardBus) support
144# 232#
145# CONFIG_PCCARD is not set 233CONFIG_PCCARD=y
234# CONFIG_PCMCIA_DEBUG is not set
235CONFIG_PCMCIA=y
236CONFIG_PCMCIA_LOAD_CIS=y
237CONFIG_PCMCIA_IOCTL=y
146 238
147# 239#
148# PC-card bridges 240# PC-card bridges
149# 241#
242# CONFIG_I82365 is not set
243# CONFIG_TCIC is not set
244CONFIG_HD64461_PCMCIA=y
245CONFIG_HD64461_PCMCIA_SOCKETS=1
246CONFIG_PCMCIA_PROBE=y
150 247
151# 248#
152# PCI Hotplug Support 249# PCI Hotplug Support
@@ -160,9 +257,9 @@ CONFIG_BINFMT_ELF=y
160# CONFIG_BINFMT_MISC is not set 257# CONFIG_BINFMT_MISC is not set
161 258
162# 259#
163# SH initrd options 260# Networking
164# 261#
165# CONFIG_EMBEDDED_RAMDISK is not set 262# CONFIG_NET is not set
166 263
167# 264#
168# Device Drivers 265# Device Drivers
@@ -173,7 +270,11 @@ CONFIG_BINFMT_ELF=y
173# 270#
174# CONFIG_STANDALONE is not set 271# CONFIG_STANDALONE is not set
175CONFIG_PREVENT_FIRMWARE_BUILD=y 272CONFIG_PREVENT_FIRMWARE_BUILD=y
176# CONFIG_FW_LOADER is not set 273CONFIG_FW_LOADER=y
274
275#
276# Connector - unified userspace <-> kernelspace linker
277#
177 278
178# 279#
179# Memory Technology Devices (MTD) 280# Memory Technology Devices (MTD)
@@ -188,30 +289,20 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
188# 289#
189# Plug and Play support 290# Plug and Play support
190# 291#
292# CONFIG_PNP is not set
191 293
192# 294#
193# Block devices 295# Block devices
194# 296#
195# CONFIG_BLK_DEV_FD is not set
196# CONFIG_BLK_DEV_COW_COMMON is not set 297# CONFIG_BLK_DEV_COW_COMMON is not set
197# CONFIG_BLK_DEV_LOOP is not set 298# CONFIG_BLK_DEV_LOOP is not set
198CONFIG_BLK_DEV_RAM=y 299CONFIG_BLK_DEV_RAM=y
199CONFIG_BLK_DEV_RAM_COUNT=16 300CONFIG_BLK_DEV_RAM_COUNT=16
200CONFIG_BLK_DEV_RAM_SIZE=4096 301CONFIG_BLK_DEV_RAM_SIZE=4096
201CONFIG_BLK_DEV_INITRD=y 302CONFIG_BLK_DEV_INITRD=y
202CONFIG_INITRAMFS_SOURCE=""
203# CONFIG_LBD is not set
204# CONFIG_CDROM_PKTCDVD is not set 303# CONFIG_CDROM_PKTCDVD is not set
205 304
206# 305#
207# IO Schedulers
208#
209CONFIG_IOSCHED_NOOP=y
210CONFIG_IOSCHED_AS=y
211CONFIG_IOSCHED_DEADLINE=y
212CONFIG_IOSCHED_CFQ=y
213
214#
215# ATA/ATAPI/MFM/RLL support 306# ATA/ATAPI/MFM/RLL support
216# 307#
217CONFIG_IDE=y 308CONFIG_IDE=y
@@ -224,6 +315,7 @@ CONFIG_BLK_DEV_IDE=y
224# CONFIG_BLK_DEV_IDE_SATA is not set 315# CONFIG_BLK_DEV_IDE_SATA is not set
225CONFIG_BLK_DEV_IDEDISK=y 316CONFIG_BLK_DEV_IDEDISK=y
226# CONFIG_IDEDISK_MULTI_MODE is not set 317# CONFIG_IDEDISK_MULTI_MODE is not set
318# CONFIG_BLK_DEV_IDECS is not set
227# CONFIG_BLK_DEV_IDECD is not set 319# CONFIG_BLK_DEV_IDECD is not set
228# CONFIG_BLK_DEV_IDETAPE is not set 320# CONFIG_BLK_DEV_IDETAPE is not set
229# CONFIG_BLK_DEV_IDEFLOPPY is not set 321# CONFIG_BLK_DEV_IDEFLOPPY is not set
@@ -235,6 +327,7 @@ CONFIG_BLK_DEV_IDEDISK=y
235CONFIG_IDE_GENERIC=y 327CONFIG_IDE_GENERIC=y
236CONFIG_IDE_SH=y 328CONFIG_IDE_SH=y
237# CONFIG_IDE_ARM is not set 329# CONFIG_IDE_ARM is not set
330# CONFIG_IDE_CHIPSETS is not set
238# CONFIG_BLK_DEV_IDEDMA is not set 331# CONFIG_BLK_DEV_IDEDMA is not set
239# CONFIG_IDEDMA_AUTO is not set 332# CONFIG_IDEDMA_AUTO is not set
240# CONFIG_BLK_DEV_HD is not set 333# CONFIG_BLK_DEV_HD is not set
@@ -242,9 +335,15 @@ CONFIG_IDE_SH=y
242# 335#
243# SCSI device support 336# SCSI device support
244# 337#
338# CONFIG_RAID_ATTRS is not set
245# CONFIG_SCSI is not set 339# CONFIG_SCSI is not set
246 340
247# 341#
342# Old CD-ROM drivers (not SCSI, not IDE)
343#
344# CONFIG_CD_NO_IDESCSI is not set
345
346#
248# Multi-device support (RAID and LVM) 347# Multi-device support (RAID and LVM)
249# 348#
250# CONFIG_MD is not set 349# CONFIG_MD is not set
@@ -252,6 +351,7 @@ CONFIG_IDE_SH=y
252# 351#
253# Fusion MPT device support 352# Fusion MPT device support
254# 353#
354# CONFIG_FUSION is not set
255 355
256# 356#
257# IEEE 1394 (FireWire) support 357# IEEE 1394 (FireWire) support
@@ -263,9 +363,8 @@ CONFIG_IDE_SH=y
263# 363#
264 364
265# 365#
266# Networking support 366# Network device support
267# 367#
268# CONFIG_NET is not set
269# CONFIG_NETPOLL is not set 368# CONFIG_NETPOLL is not set
270# CONFIG_NET_POLL_CONTROLLER is not set 369# CONFIG_NET_POLL_CONTROLLER is not set
271 370
@@ -296,17 +395,6 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
296# CONFIG_INPUT_EVBUG is not set 395# CONFIG_INPUT_EVBUG is not set
297 396
298# 397#
299# Input I/O drivers
300#
301# CONFIG_GAMEPORT is not set
302CONFIG_SOUND_GAMEPORT=y
303CONFIG_SERIO=y
304# CONFIG_SERIO_I8042 is not set
305# CONFIG_SERIO_SERPORT is not set
306# CONFIG_SERIO_CT82C710 is not set
307# CONFIG_SERIO_RAW is not set
308
309#
310# Input Device Drivers 398# Input Device Drivers
311# 399#
312# CONFIG_INPUT_KEYBOARD is not set 400# CONFIG_INPUT_KEYBOARD is not set
@@ -316,6 +404,15 @@ CONFIG_SERIO=y
316# CONFIG_INPUT_MISC is not set 404# CONFIG_INPUT_MISC is not set
317 405
318# 406#
407# Hardware I/O ports
408#
409CONFIG_SERIO=y
410# CONFIG_SERIO_I8042 is not set
411# CONFIG_SERIO_SERPORT is not set
412# CONFIG_SERIO_RAW is not set
413# CONFIG_GAMEPORT is not set
414
415#
319# Character devices 416# Character devices
320# 417#
321CONFIG_VT=y 418CONFIG_VT=y
@@ -353,10 +450,22 @@ CONFIG_LEGACY_PTY_COUNT=256
353# 450#
354# Ftape, the floppy tape device driver 451# Ftape, the floppy tape device driver
355# 452#
356# CONFIG_DRM is not set 453
454#
455# PCMCIA character devices
456#
457# CONFIG_SYNCLINK_CS is not set
458# CONFIG_CARDMAN_4000 is not set
459# CONFIG_CARDMAN_4040 is not set
357# CONFIG_RAW_DRIVER is not set 460# CONFIG_RAW_DRIVER is not set
358 461
359# 462#
463# TPM devices
464#
465# CONFIG_TCG_TPM is not set
466# CONFIG_TELCLOCK is not set
467
468#
360# I2C support 469# I2C support
361# 470#
362# CONFIG_I2C is not set 471# CONFIG_I2C is not set
@@ -367,10 +476,21 @@ CONFIG_LEGACY_PTY_COUNT=256
367# CONFIG_W1 is not set 476# CONFIG_W1 is not set
368 477
369# 478#
479# Hardware Monitoring support
480#
481CONFIG_HWMON=y
482# CONFIG_HWMON_VID is not set
483# CONFIG_HWMON_DEBUG_CHIP is not set
484
485#
370# Misc devices 486# Misc devices
371# 487#
372 488
373# 489#
490# Multimedia Capabilities Port drivers
491#
492
493#
374# Multimedia devices 494# Multimedia devices
375# 495#
376# CONFIG_VIDEO_DEV is not set 496# CONFIG_VIDEO_DEV is not set
@@ -383,27 +503,35 @@ CONFIG_LEGACY_PTY_COUNT=256
383# Graphics support 503# Graphics support
384# 504#
385CONFIG_FB=y 505CONFIG_FB=y
506CONFIG_FB_CFB_FILLRECT=y
507CONFIG_FB_CFB_COPYAREA=y
508CONFIG_FB_CFB_IMAGEBLIT=y
509# CONFIG_FB_MACMODES is not set
386# CONFIG_FB_MODE_HELPERS is not set 510# CONFIG_FB_MODE_HELPERS is not set
387# CONFIG_FB_TILEBLITTING is not set 511# CONFIG_FB_TILEBLITTING is not set
388# CONFIG_FB_EPSON1355 is not set 512# CONFIG_FB_EPSON1355 is not set
513# CONFIG_FB_S1D13XXX is not set
389CONFIG_FB_HIT=y 514CONFIG_FB_HIT=y
390# CONFIG_FB_VIRTUAL is not set 515# CONFIG_FB_VIRTUAL is not set
391 516
392# 517#
393# Console display driver support 518# Console display driver support
394# 519#
395# CONFIG_VGA_CONSOLE is not set 520# CONFIG_MDA_CONSOLE is not set
396CONFIG_DUMMY_CONSOLE=y 521CONFIG_DUMMY_CONSOLE=y
397CONFIG_FRAMEBUFFER_CONSOLE=y 522CONFIG_FRAMEBUFFER_CONSOLE=y
523# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
398CONFIG_FONTS=y 524CONFIG_FONTS=y
399# CONFIG_FONT_8x8 is not set 525# CONFIG_FONT_8x8 is not set
400# CONFIG_FONT_8x16 is not set 526# CONFIG_FONT_8x16 is not set
401# CONFIG_FONT_6x11 is not set 527# CONFIG_FONT_6x11 is not set
528# CONFIG_FONT_7x14 is not set
402CONFIG_FONT_PEARL_8x8=y 529CONFIG_FONT_PEARL_8x8=y
403# CONFIG_FONT_ACORN_8x8 is not set 530# CONFIG_FONT_ACORN_8x8 is not set
404# CONFIG_FONT_MINI_4x6 is not set 531# CONFIG_FONT_MINI_4x6 is not set
405# CONFIG_FONT_SUN8x16 is not set 532# CONFIG_FONT_SUN8x16 is not set
406# CONFIG_FONT_SUN12x22 is not set 533# CONFIG_FONT_SUN12x22 is not set
534# CONFIG_FONT_10x18 is not set
407 535
408# 536#
409# Logo configuration 537# Logo configuration
@@ -414,7 +542,22 @@ CONFIG_FONT_PEARL_8x8=y
414# 542#
415# Sound 543# Sound
416# 544#
417# CONFIG_SOUND is not set 545CONFIG_SOUND=y
546
547#
548# Advanced Linux Sound Architecture
549#
550# CONFIG_SND is not set
551
552#
553# Open Sound System
554#
555CONFIG_SOUND_PRIME=y
556# CONFIG_OBSOLETE_OSS_DRIVER is not set
557# CONFIG_SOUND_MSNDCLAS is not set
558# CONFIG_SOUND_MSNDPIN is not set
559CONFIG_SOUND_SH_DAC_AUDIO=y
560CONFIG_SOUND_SH_DAC_AUDIO_CHANNEL=1
418 561
419# 562#
420# USB support 563# USB support
@@ -423,7 +566,7 @@ CONFIG_FONT_PEARL_8x8=y
423# CONFIG_USB_ARCH_HAS_OHCI is not set 566# CONFIG_USB_ARCH_HAS_OHCI is not set
424 567
425# 568#
426# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information 569# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
427# 570#
428 571
429# 572#
@@ -442,25 +585,29 @@ CONFIG_FONT_PEARL_8x8=y
442# CONFIG_INFINIBAND is not set 585# CONFIG_INFINIBAND is not set
443 586
444# 587#
588# SN Devices
589#
590
591#
445# File systems 592# File systems
446# 593#
447CONFIG_EXT2_FS=y 594CONFIG_EXT2_FS=y
448# CONFIG_EXT2_FS_XATTR is not set 595# CONFIG_EXT2_FS_XATTR is not set
596# CONFIG_EXT2_FS_XIP is not set
449# CONFIG_EXT3_FS is not set 597# CONFIG_EXT3_FS is not set
450# CONFIG_JBD is not set 598# CONFIG_JBD is not set
451# CONFIG_REISERFS_FS is not set 599# CONFIG_REISERFS_FS is not set
452# CONFIG_JFS_FS is not set 600# CONFIG_JFS_FS is not set
453 601# CONFIG_FS_POSIX_ACL is not set
454#
455# XFS support
456#
457# CONFIG_XFS_FS is not set 602# CONFIG_XFS_FS is not set
458# CONFIG_MINIX_FS is not set 603# CONFIG_MINIX_FS is not set
459# CONFIG_ROMFS_FS is not set 604# CONFIG_ROMFS_FS is not set
605CONFIG_INOTIFY=y
460# CONFIG_QUOTA is not set 606# CONFIG_QUOTA is not set
461CONFIG_DNOTIFY=y 607CONFIG_DNOTIFY=y
462# CONFIG_AUTOFS_FS is not set 608# CONFIG_AUTOFS_FS is not set
463# CONFIG_AUTOFS4_FS is not set 609# CONFIG_AUTOFS4_FS is not set
610# CONFIG_FUSE_FS is not set
464 611
465# 612#
466# CD-ROM/DVD Filesystems 613# CD-ROM/DVD Filesystems
@@ -471,8 +618,11 @@ CONFIG_DNOTIFY=y
471# 618#
472# DOS/FAT/NT Filesystems 619# DOS/FAT/NT Filesystems
473# 620#
621CONFIG_FAT_FS=y
474# CONFIG_MSDOS_FS is not set 622# CONFIG_MSDOS_FS is not set
475# CONFIG_VFAT_FS is not set 623CONFIG_VFAT_FS=y
624CONFIG_FAT_DEFAULT_CODEPAGE=437
625CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
476# CONFIG_NTFS_FS is not set 626# CONFIG_NTFS_FS is not set
477 627
478# 628#
@@ -481,14 +631,11 @@ CONFIG_DNOTIFY=y
481CONFIG_PROC_FS=y 631CONFIG_PROC_FS=y
482CONFIG_PROC_KCORE=y 632CONFIG_PROC_KCORE=y
483CONFIG_SYSFS=y 633CONFIG_SYSFS=y
484CONFIG_DEVFS_FS=y
485CONFIG_DEVFS_MOUNT=y
486# CONFIG_DEVFS_DEBUG is not set
487# CONFIG_DEVPTS_FS_XATTR is not set
488# CONFIG_TMPFS is not set 634# CONFIG_TMPFS is not set
489# CONFIG_HUGETLBFS is not set 635# CONFIG_HUGETLBFS is not set
490# CONFIG_HUGETLB_PAGE is not set 636# CONFIG_HUGETLB_PAGE is not set
491CONFIG_RAMFS=y 637CONFIG_RAMFS=y
638# CONFIG_RELAYFS_FS is not set
492 639
493# 640#
494# Miscellaneous filesystems 641# Miscellaneous filesystems
@@ -516,7 +663,46 @@ CONFIG_MSDOS_PARTITION=y
516# 663#
517# Native Language Support 664# Native Language Support
518# 665#
519# CONFIG_NLS is not set 666CONFIG_NLS=y
667CONFIG_NLS_DEFAULT="iso8859-1"
668# CONFIG_NLS_CODEPAGE_437 is not set
669# CONFIG_NLS_CODEPAGE_737 is not set
670# CONFIG_NLS_CODEPAGE_775 is not set
671# CONFIG_NLS_CODEPAGE_850 is not set
672# CONFIG_NLS_CODEPAGE_852 is not set
673# CONFIG_NLS_CODEPAGE_855 is not set
674# CONFIG_NLS_CODEPAGE_857 is not set
675# CONFIG_NLS_CODEPAGE_860 is not set
676# CONFIG_NLS_CODEPAGE_861 is not set
677# CONFIG_NLS_CODEPAGE_862 is not set
678# CONFIG_NLS_CODEPAGE_863 is not set
679# CONFIG_NLS_CODEPAGE_864 is not set
680# CONFIG_NLS_CODEPAGE_865 is not set
681# CONFIG_NLS_CODEPAGE_866 is not set
682# CONFIG_NLS_CODEPAGE_869 is not set
683# CONFIG_NLS_CODEPAGE_936 is not set
684# CONFIG_NLS_CODEPAGE_950 is not set
685# CONFIG_NLS_CODEPAGE_932 is not set
686# CONFIG_NLS_CODEPAGE_949 is not set
687# CONFIG_NLS_CODEPAGE_874 is not set
688# CONFIG_NLS_ISO8859_8 is not set
689# CONFIG_NLS_CODEPAGE_1250 is not set
690# CONFIG_NLS_CODEPAGE_1251 is not set
691# CONFIG_NLS_ASCII is not set
692# CONFIG_NLS_ISO8859_1 is not set
693# CONFIG_NLS_ISO8859_2 is not set
694# CONFIG_NLS_ISO8859_3 is not set
695# CONFIG_NLS_ISO8859_4 is not set
696# CONFIG_NLS_ISO8859_5 is not set
697# CONFIG_NLS_ISO8859_6 is not set
698# CONFIG_NLS_ISO8859_7 is not set
699# CONFIG_NLS_ISO8859_9 is not set
700# CONFIG_NLS_ISO8859_13 is not set
701# CONFIG_NLS_ISO8859_14 is not set
702# CONFIG_NLS_ISO8859_15 is not set
703# CONFIG_NLS_KOI8_R is not set
704# CONFIG_NLS_KOI8_U is not set
705# CONFIG_NLS_UTF8 is not set
520 706
521# 707#
522# Profiling support 708# Profiling support
@@ -526,7 +712,9 @@ CONFIG_MSDOS_PARTITION=y
526# 712#
527# Kernel hacking 713# Kernel hacking
528# 714#
715# CONFIG_PRINTK_TIME is not set
529# CONFIG_DEBUG_KERNEL is not set 716# CONFIG_DEBUG_KERNEL is not set
717CONFIG_LOG_BUF_SHIFT=14
530# CONFIG_FRAME_POINTER is not set 718# CONFIG_FRAME_POINTER is not set
531# CONFIG_SH_STANDARD_BIOS is not set 719# CONFIG_SH_STANDARD_BIOS is not set
532# CONFIG_KGDB is not set 720# CONFIG_KGDB is not set
@@ -550,5 +738,6 @@ CONFIG_MSDOS_PARTITION=y
550# Library routines 738# Library routines
551# 739#
552# CONFIG_CRC_CCITT is not set 740# CONFIG_CRC_CCITT is not set
741# CONFIG_CRC16 is not set
553CONFIG_CRC32=y 742CONFIG_CRC32=y
554# CONFIG_LIBCRC32C is not set 743# CONFIG_LIBCRC32C is not set
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index 96e3036ec2bb..47c3e837599b 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * SuperH-specific DMA management API 4 * SuperH-specific DMA management API
5 * 5 *
6 * Copyright (C) 2003, 2004 Paul Mundt 6 * Copyright (C) 2003, 2004, 2005 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -15,6 +15,7 @@
15#include <linux/spinlock.h> 15#include <linux/spinlock.h>
16#include <linux/proc_fs.h> 16#include <linux/proc_fs.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/platform_device.h>
18#include <asm/dma.h> 19#include <asm/dma.h>
19 20
20DEFINE_SPINLOCK(dma_spin_lock); 21DEFINE_SPINLOCK(dma_spin_lock);
@@ -55,16 +56,14 @@ static LIST_HEAD(registered_dmac_list);
55 56
56struct dma_info *get_dma_info(unsigned int chan) 57struct dma_info *get_dma_info(unsigned int chan)
57{ 58{
58 struct list_head *pos, *tmp; 59 struct dma_info *info;
59 unsigned int total = 0; 60 unsigned int total = 0;
60 61
61 /* 62 /*
62 * Look for each DMAC's range to determine who the owner of 63 * Look for each DMAC's range to determine who the owner of
63 * the channel is. 64 * the channel is.
64 */ 65 */
65 list_for_each_safe(pos, tmp, &registered_dmac_list) { 66 list_for_each_entry(info, &registered_dmac_list, list) {
66 struct dma_info *info = list_entry(pos, struct dma_info, list);
67
68 total += info->nr_channels; 67 total += info->nr_channels;
69 if (chan > total) 68 if (chan > total)
70 continue; 69 continue;
@@ -75,6 +74,20 @@ struct dma_info *get_dma_info(unsigned int chan)
75 return NULL; 74 return NULL;
76} 75}
77 76
77static unsigned int get_nr_channels(void)
78{
79 struct dma_info *info;
80 unsigned int nr = 0;
81
82 if (unlikely(list_empty(&registered_dmac_list)))
83 return nr;
84
85 list_for_each_entry(info, &registered_dmac_list, list)
86 nr += info->nr_channels;
87
88 return nr;
89}
90
78struct dma_channel *get_dma_channel(unsigned int chan) 91struct dma_channel *get_dma_channel(unsigned int chan)
79{ 92{
80 struct dma_info *info = get_dma_info(chan); 93 struct dma_info *info = get_dma_info(chan);
@@ -173,7 +186,7 @@ int dma_xfer(unsigned int chan, unsigned long from,
173static int dma_read_proc(char *buf, char **start, off_t off, 186static int dma_read_proc(char *buf, char **start, off_t off,
174 int len, int *eof, void *data) 187 int len, int *eof, void *data)
175{ 188{
176 struct list_head *pos, *tmp; 189 struct dma_info *info;
177 char *p = buf; 190 char *p = buf;
178 191
179 if (list_empty(&registered_dmac_list)) 192 if (list_empty(&registered_dmac_list))
@@ -182,8 +195,7 @@ static int dma_read_proc(char *buf, char **start, off_t off,
182 /* 195 /*
183 * Iterate over each registered DMAC 196 * Iterate over each registered DMAC
184 */ 197 */
185 list_for_each_safe(pos, tmp, &registered_dmac_list) { 198 list_for_each_entry(info, &registered_dmac_list, list) {
186 struct dma_info *info = list_entry(pos, struct dma_info, list);
187 int i; 199 int i;
188 200
189 /* 201 /*
@@ -205,9 +217,9 @@ static int dma_read_proc(char *buf, char **start, off_t off,
205#endif 217#endif
206 218
207 219
208int __init register_dmac(struct dma_info *info) 220int register_dmac(struct dma_info *info)
209{ 221{
210 int i; 222 unsigned int total_channels, i;
211 223
212 INIT_LIST_HEAD(&info->list); 224 INIT_LIST_HEAD(&info->list);
213 225
@@ -217,6 +229,11 @@ int __init register_dmac(struct dma_info *info)
217 229
218 BUG_ON((info->flags & DMAC_CHANNELS_CONFIGURED) && !info->channels); 230 BUG_ON((info->flags & DMAC_CHANNELS_CONFIGURED) && !info->channels);
219 231
232 info->pdev = platform_device_register_simple((char *)info->name, -1,
233 NULL, 0);
234 if (IS_ERR(info->pdev))
235 return PTR_ERR(info->pdev);
236
220 /* 237 /*
221 * Don't touch pre-configured channels 238 * Don't touch pre-configured channels
222 */ 239 */
@@ -232,10 +249,12 @@ int __init register_dmac(struct dma_info *info)
232 memset(info->channels, 0, size); 249 memset(info->channels, 0, size);
233 } 250 }
234 251
252 total_channels = get_nr_channels();
235 for (i = 0; i < info->nr_channels; i++) { 253 for (i = 0; i < info->nr_channels; i++) {
236 struct dma_channel *chan = info->channels + i; 254 struct dma_channel *chan = info->channels + i;
237 255
238 chan->chan = i; 256 chan->chan = i;
257 chan->vchan = i + total_channels;
239 258
240 memcpy(chan->dev_id, "Unused", 7); 259 memcpy(chan->dev_id, "Unused", 7);
241 260
@@ -245,9 +264,7 @@ int __init register_dmac(struct dma_info *info)
245 init_MUTEX(&chan->sem); 264 init_MUTEX(&chan->sem);
246 init_waitqueue_head(&chan->wait_queue); 265 init_waitqueue_head(&chan->wait_queue);
247 266
248#ifdef CONFIG_SYSFS 267 dma_create_sysfs_files(chan, info);
249 dma_create_sysfs_files(chan);
250#endif
251 } 268 }
252 269
253 list_add(&info->list, &registered_dmac_list); 270 list_add(&info->list, &registered_dmac_list);
@@ -255,12 +272,18 @@ int __init register_dmac(struct dma_info *info)
255 return 0; 272 return 0;
256} 273}
257 274
258void __exit unregister_dmac(struct dma_info *info) 275void unregister_dmac(struct dma_info *info)
259{ 276{
277 unsigned int i;
278
279 for (i = 0; i < info->nr_channels; i++)
280 dma_remove_sysfs_files(info->channels + i, info);
281
260 if (!(info->flags & DMAC_CHANNELS_CONFIGURED)) 282 if (!(info->flags & DMAC_CHANNELS_CONFIGURED))
261 kfree(info->channels); 283 kfree(info->channels);
262 284
263 list_del(&info->list); 285 list_del(&info->list);
286 platform_device_unregister(info->pdev);
264} 287}
265 288
266static int __init dma_api_init(void) 289static int __init dma_api_init(void)
diff --git a/arch/sh/drivers/dma/dma-g2.c b/arch/sh/drivers/dma/dma-g2.c
index 231e3f6fb28f..5afab6f56ec3 100644
--- a/arch/sh/drivers/dma/dma-g2.c
+++ b/arch/sh/drivers/dma/dma-g2.c
@@ -140,7 +140,7 @@ static struct dma_ops g2_dma_ops = {
140}; 140};
141 141
142static struct dma_info g2_dma_info = { 142static struct dma_info g2_dma_info = {
143 .name = "G2 DMA", 143 .name = "g2_dmac",
144 .nr_channels = 4, 144 .nr_channels = 4,
145 .ops = &g2_dma_ops, 145 .ops = &g2_dma_ops,
146 .flags = DMAC_CHANNELS_TEI_CAPABLE, 146 .flags = DMAC_CHANNELS_TEI_CAPABLE,
@@ -160,6 +160,7 @@ static int __init g2_dma_init(void)
160static void __exit g2_dma_exit(void) 160static void __exit g2_dma_exit(void)
161{ 161{
162 free_irq(HW_EVENT_G2_DMA, 0); 162 free_irq(HW_EVENT_G2_DMA, 0);
163 unregister_dmac(&g2_dma_info);
163} 164}
164 165
165subsys_initcall(g2_dma_init); 166subsys_initcall(g2_dma_init);
diff --git a/arch/sh/drivers/dma/dma-isa.c b/arch/sh/drivers/dma/dma-isa.c
index 1c9bc45b8bcb..05a74ffdb68d 100644
--- a/arch/sh/drivers/dma/dma-isa.c
+++ b/arch/sh/drivers/dma/dma-isa.c
@@ -25,14 +25,14 @@
25 * such, this code is meant for only the simplest of tasks (and shouldn't be 25 * such, this code is meant for only the simplest of tasks (and shouldn't be
26 * used in any new drivers at all). 26 * used in any new drivers at all).
27 * 27 *
28 * It should also be noted that various functions here are labelled as 28 * NOTE: ops->xfer() is the preferred way of doing things. However, there
29 * being deprecated. This is due to the fact that the ops->xfer() method is 29 * are some users of the ISA DMA API that exist in common code that we
30 * the preferred way of doing things (as well as just grabbing the spinlock 30 * don't necessarily want to go out of our way to break, so we still
31 * directly). As such, any users of this interface will be warned rather 31 * allow for some compatability at that level. Any new code is strongly
32 * loudly. 32 * advised to run far away from the ISA DMA API and use the SH DMA API
33 * directly.
33 */ 34 */
34 35unsigned long claim_dma_lock(void)
35unsigned long __deprecated claim_dma_lock(void)
36{ 36{
37 unsigned long flags; 37 unsigned long flags;
38 38
@@ -42,19 +42,19 @@ unsigned long __deprecated claim_dma_lock(void)
42} 42}
43EXPORT_SYMBOL(claim_dma_lock); 43EXPORT_SYMBOL(claim_dma_lock);
44 44
45void __deprecated release_dma_lock(unsigned long flags) 45void release_dma_lock(unsigned long flags)
46{ 46{
47 spin_unlock_irqrestore(&dma_spin_lock, flags); 47 spin_unlock_irqrestore(&dma_spin_lock, flags);
48} 48}
49EXPORT_SYMBOL(release_dma_lock); 49EXPORT_SYMBOL(release_dma_lock);
50 50
51void __deprecated disable_dma(unsigned int chan) 51void disable_dma(unsigned int chan)
52{ 52{
53 /* Nothing */ 53 /* Nothing */
54} 54}
55EXPORT_SYMBOL(disable_dma); 55EXPORT_SYMBOL(disable_dma);
56 56
57void __deprecated enable_dma(unsigned int chan) 57void enable_dma(unsigned int chan)
58{ 58{
59 struct dma_info *info = get_dma_info(chan); 59 struct dma_info *info = get_dma_info(chan);
60 struct dma_channel *channel = &info->channels[chan]; 60 struct dma_channel *channel = &info->channels[chan];
diff --git a/arch/sh/drivers/dma/dma-pvr2.c b/arch/sh/drivers/dma/dma-pvr2.c
index 2e1d58f2d1b9..df604975ccc8 100644
--- a/arch/sh/drivers/dma/dma-pvr2.c
+++ b/arch/sh/drivers/dma/dma-pvr2.c
@@ -80,7 +80,7 @@ static struct dma_ops pvr2_dma_ops = {
80}; 80};
81 81
82static struct dma_info pvr2_dma_info = { 82static struct dma_info pvr2_dma_info = {
83 .name = "PowerVR 2 DMA", 83 .name = "pvr2_dmac",
84 .nr_channels = 1, 84 .nr_channels = 1,
85 .ops = &pvr2_dma_ops, 85 .ops = &pvr2_dma_ops,
86 .flags = DMAC_CHANNELS_TEI_CAPABLE, 86 .flags = DMAC_CHANNELS_TEI_CAPABLE,
@@ -98,6 +98,7 @@ static void __exit pvr2_dma_exit(void)
98{ 98{
99 free_dma(PVR2_CASCADE_CHAN); 99 free_dma(PVR2_CASCADE_CHAN);
100 free_irq(HW_EVENT_PVR2_DMA, 0); 100 free_irq(HW_EVENT_PVR2_DMA, 0);
101 unregister_dmac(&pvr2_dma_info);
101} 102}
102 103
103subsys_initcall(pvr2_dma_init); 104subsys_initcall(pvr2_dma_init);
diff --git a/arch/sh/drivers/dma/dma-sh.c b/arch/sh/drivers/dma/dma-sh.c
index 31dacd4444b2..cca26c4c9d1b 100644
--- a/arch/sh/drivers/dma/dma-sh.c
+++ b/arch/sh/drivers/dma/dma-sh.c
@@ -5,6 +5,7 @@
5 * 5 *
6 * Copyright (C) 2000 Takashi YOSHII 6 * Copyright (C) 2000 Takashi YOSHII
7 * Copyright (C) 2003, 2004 Paul Mundt 7 * Copyright (C) 2003, 2004 Paul Mundt
8 * Copyright (C) 2005 Andriy Skulysh
8 * 9 *
9 * This file is subject to the terms and conditions of the GNU General Public 10 * This file is subject to the terms and conditions of the GNU General Public
10 * License. See the file "COPYING" in the main directory of this archive 11 * License. See the file "COPYING" in the main directory of this archive
@@ -16,51 +17,28 @@
16#include <linux/irq.h> 17#include <linux/irq.h>
17#include <linux/interrupt.h> 18#include <linux/interrupt.h>
18#include <linux/module.h> 19#include <linux/module.h>
20#include <asm/dreamcast/dma.h>
19#include <asm/signal.h> 21#include <asm/signal.h>
20#include <asm/irq.h> 22#include <asm/irq.h>
21#include <asm/dma.h> 23#include <asm/dma.h>
22#include <asm/io.h> 24#include <asm/io.h>
23#include "dma-sh.h" 25#include "dma-sh.h"
24 26
25/*
26 * The SuperH DMAC supports a number of transmit sizes, we list them here,
27 * with their respective values as they appear in the CHCR registers.
28 *
29 * Defaults to a 64-bit transfer size.
30 */
31enum {
32 XMIT_SZ_64BIT,
33 XMIT_SZ_8BIT,
34 XMIT_SZ_16BIT,
35 XMIT_SZ_32BIT,
36 XMIT_SZ_256BIT,
37};
38
39/*
40 * The DMA count is defined as the number of bytes to transfer.
41 */
42static unsigned int ts_shift[] = {
43 [XMIT_SZ_64BIT] = 3,
44 [XMIT_SZ_8BIT] = 0,
45 [XMIT_SZ_16BIT] = 1,
46 [XMIT_SZ_32BIT] = 2,
47 [XMIT_SZ_256BIT] = 5,
48};
49
50static inline unsigned int get_dmte_irq(unsigned int chan) 27static inline unsigned int get_dmte_irq(unsigned int chan)
51{ 28{
52 unsigned int irq; 29 unsigned int irq = 0;
53 30
54 /* 31 /*
55 * Normally we could just do DMTE0_IRQ + chan outright, though in the 32 * Normally we could just do DMTE0_IRQ + chan outright, though in the
56 * case of the 7751R, the DMTE IRQs for channels > 4 start right above 33 * case of the 7751R, the DMTE IRQs for channels > 4 start right above
57 * the SCIF 34 * the SCIF
58 */ 35 */
59
60 if (chan < 4) { 36 if (chan < 4) {
61 irq = DMTE0_IRQ + chan; 37 irq = DMTE0_IRQ + chan;
62 } else { 38 } else {
39#ifdef DMTE4_IRQ
63 irq = DMTE4_IRQ + chan - 4; 40 irq = DMTE4_IRQ + chan - 4;
41#endif
64 } 42 }
65 43
66 return irq; 44 return irq;
@@ -78,9 +56,7 @@ static inline unsigned int calc_xmit_shift(struct dma_channel *chan)
78{ 56{
79 u32 chcr = ctrl_inl(CHCR[chan->chan]); 57 u32 chcr = ctrl_inl(CHCR[chan->chan]);
80 58
81 chcr >>= 4; 59 return ts_shift[(chcr & CHCR_TS_MASK)>>CHCR_TS_SHIFT];
82
83 return ts_shift[chcr & 0x0007];
84} 60}
85 61
86/* 62/*
@@ -109,8 +85,13 @@ static irqreturn_t dma_tei(int irq, void *dev_id, struct pt_regs *regs)
109 85
110static int sh_dmac_request_dma(struct dma_channel *chan) 86static int sh_dmac_request_dma(struct dma_channel *chan)
111{ 87{
88 char name[32];
89
90 snprintf(name, sizeof(name), "DMAC Transfer End (Channel %d)",
91 chan->chan);
92
112 return request_irq(get_dmte_irq(chan->chan), dma_tei, 93 return request_irq(get_dmte_irq(chan->chan), dma_tei,
113 SA_INTERRUPT, "DMAC Transfer End", chan); 94 SA_INTERRUPT, name, chan);
114} 95}
115 96
116static void sh_dmac_free_dma(struct dma_channel *chan) 97static void sh_dmac_free_dma(struct dma_channel *chan)
@@ -118,10 +99,18 @@ static void sh_dmac_free_dma(struct dma_channel *chan)
118 free_irq(get_dmte_irq(chan->chan), chan); 99 free_irq(get_dmte_irq(chan->chan), chan);
119} 100}
120 101
121static void sh_dmac_configure_channel(struct dma_channel *chan, unsigned long chcr) 102static void
103sh_dmac_configure_channel(struct dma_channel *chan, unsigned long chcr)
122{ 104{
123 if (!chcr) 105 if (!chcr)
124 chcr = RS_DUAL; 106 chcr = RS_DUAL | CHCR_IE;
107
108 if (chcr & CHCR_IE) {
109 chcr &= ~CHCR_IE;
110 chan->flags |= DMA_TEI_CAPABLE;
111 } else {
112 chan->flags &= ~DMA_TEI_CAPABLE;
113 }
125 114
126 ctrl_outl(chcr, CHCR[chan->chan]); 115 ctrl_outl(chcr, CHCR[chan->chan]);
127 116
@@ -130,22 +119,32 @@ static void sh_dmac_configure_channel(struct dma_channel *chan, unsigned long ch
130 119
131static void sh_dmac_enable_dma(struct dma_channel *chan) 120static void sh_dmac_enable_dma(struct dma_channel *chan)
132{ 121{
133 int irq = get_dmte_irq(chan->chan); 122 int irq;
134 u32 chcr; 123 u32 chcr;
135 124
136 chcr = ctrl_inl(CHCR[chan->chan]); 125 chcr = ctrl_inl(CHCR[chan->chan]);
137 chcr |= CHCR_DE | CHCR_IE; 126 chcr |= CHCR_DE;
127
128 if (chan->flags & DMA_TEI_CAPABLE)
129 chcr |= CHCR_IE;
130
138 ctrl_outl(chcr, CHCR[chan->chan]); 131 ctrl_outl(chcr, CHCR[chan->chan]);
139 132
140 enable_irq(irq); 133 if (chan->flags & DMA_TEI_CAPABLE) {
134 irq = get_dmte_irq(chan->chan);
135 enable_irq(irq);
136 }
141} 137}
142 138
143static void sh_dmac_disable_dma(struct dma_channel *chan) 139static void sh_dmac_disable_dma(struct dma_channel *chan)
144{ 140{
145 int irq = get_dmte_irq(chan->chan); 141 int irq;
146 u32 chcr; 142 u32 chcr;
147 143
148 disable_irq(irq); 144 if (chan->flags & DMA_TEI_CAPABLE) {
145 irq = get_dmte_irq(chan->chan);
146 disable_irq(irq);
147 }
149 148
150 chcr = ctrl_inl(CHCR[chan->chan]); 149 chcr = ctrl_inl(CHCR[chan->chan]);
151 chcr &= ~(CHCR_DE | CHCR_TE | CHCR_IE); 150 chcr &= ~(CHCR_DE | CHCR_TE | CHCR_IE);
@@ -158,7 +157,7 @@ static int sh_dmac_xfer_dma(struct dma_channel *chan)
158 * If we haven't pre-configured the channel with special flags, use 157 * If we haven't pre-configured the channel with special flags, use
159 * the defaults. 158 * the defaults.
160 */ 159 */
161 if (!(chan->flags & DMA_CONFIGURED)) 160 if (unlikely(!(chan->flags & DMA_CONFIGURED)))
162 sh_dmac_configure_channel(chan, 0); 161 sh_dmac_configure_channel(chan, 0);
163 162
164 sh_dmac_disable_dma(chan); 163 sh_dmac_disable_dma(chan);
@@ -178,9 +177,11 @@ static int sh_dmac_xfer_dma(struct dma_channel *chan)
178 * cascading to the PVR2 DMAC. In this case, we still need to write 177 * cascading to the PVR2 DMAC. In this case, we still need to write
179 * SAR and DAR, regardless of value, in order for cascading to work. 178 * SAR and DAR, regardless of value, in order for cascading to work.
180 */ 179 */
181 if (chan->sar || (mach_is_dreamcast() && chan->chan == 2)) 180 if (chan->sar || (mach_is_dreamcast() &&
181 chan->chan == PVR2_CASCADE_CHAN))
182 ctrl_outl(chan->sar, SAR[chan->chan]); 182 ctrl_outl(chan->sar, SAR[chan->chan]);
183 if (chan->dar || (mach_is_dreamcast() && chan->chan == 2)) 183 if (chan->dar || (mach_is_dreamcast() &&
184 chan->chan == PVR2_CASCADE_CHAN))
184 ctrl_outl(chan->dar, DAR[chan->chan]); 185 ctrl_outl(chan->dar, DAR[chan->chan]);
185 186
186 ctrl_outl(chan->count >> calc_xmit_shift(chan), DMATCR[chan->chan]); 187 ctrl_outl(chan->count >> calc_xmit_shift(chan), DMATCR[chan->chan]);
@@ -198,17 +199,38 @@ static int sh_dmac_get_dma_residue(struct dma_channel *chan)
198 return ctrl_inl(DMATCR[chan->chan]) << calc_xmit_shift(chan); 199 return ctrl_inl(DMATCR[chan->chan]) << calc_xmit_shift(chan);
199} 200}
200 201
201#if defined(CONFIG_CPU_SH4) 202#ifdef CONFIG_CPU_SUBTYPE_SH7780
202static irqreturn_t dma_err(int irq, void *dev_id, struct pt_regs *regs) 203#define dmaor_read_reg() ctrl_inw(DMAOR)
204#define dmaor_write_reg(data) ctrl_outw(data, DMAOR)
205#else
206#define dmaor_read_reg() ctrl_inl(DMAOR)
207#define dmaor_write_reg(data) ctrl_outl(data, DMAOR)
208#endif
209
210static inline int dmaor_reset(void)
203{ 211{
204 unsigned long dmaor = ctrl_inl(DMAOR); 212 unsigned long dmaor = dmaor_read_reg();
213
214 /* Try to clear the error flags first, incase they are set */
215 dmaor &= ~(DMAOR_NMIF | DMAOR_AE);
216 dmaor_write_reg(dmaor);
205 217
206 printk("DMAE: DMAOR=%lx\n", dmaor); 218 dmaor |= DMAOR_INIT;
219 dmaor_write_reg(dmaor);
207 220
208 ctrl_outl(ctrl_inl(DMAOR)&~DMAOR_NMIF, DMAOR); 221 /* See if we got an error again */
209 ctrl_outl(ctrl_inl(DMAOR)&~DMAOR_AE, DMAOR); 222 if ((dmaor_read_reg() & (DMAOR_AE | DMAOR_NMIF))) {
210 ctrl_outl(ctrl_inl(DMAOR)|DMAOR_DME, DMAOR); 223 printk(KERN_ERR "dma-sh: Can't initialize DMAOR.\n");
224 return -EINVAL;
225 }
211 226
227 return 0;
228}
229
230#if defined(CONFIG_CPU_SH4)
231static irqreturn_t dma_err(int irq, void *dev_id, struct pt_regs *regs)
232{
233 dmaor_reset();
212 disable_irq(irq); 234 disable_irq(irq);
213 235
214 return IRQ_HANDLED; 236 return IRQ_HANDLED;
@@ -224,8 +246,8 @@ static struct dma_ops sh_dmac_ops = {
224}; 246};
225 247
226static struct dma_info sh_dmac_info = { 248static struct dma_info sh_dmac_info = {
227 .name = "SuperH DMAC", 249 .name = "sh_dmac",
228 .nr_channels = 4, 250 .nr_channels = CONFIG_NR_ONCHIP_DMA_CHANNELS,
229 .ops = &sh_dmac_ops, 251 .ops = &sh_dmac_ops,
230 .flags = DMAC_CHANNELS_TEI_CAPABLE, 252 .flags = DMAC_CHANNELS_TEI_CAPABLE,
231}; 253};
@@ -248,7 +270,13 @@ static int __init sh_dmac_init(void)
248 make_ipr_irq(irq, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY); 270 make_ipr_irq(irq, DMA_IPR_ADDR, DMA_IPR_POS, DMA_PRIORITY);
249 } 271 }
250 272
251 ctrl_outl(0x8000 | DMAOR_DME, DMAOR); 273 /*
274 * Initialize DMAOR, and clean up any error flags that may have
275 * been set.
276 */
277 i = dmaor_reset();
278 if (i < 0)
279 return i;
252 280
253 return register_dmac(info); 281 return register_dmac(info);
254} 282}
@@ -258,10 +286,12 @@ static void __exit sh_dmac_exit(void)
258#ifdef CONFIG_CPU_SH4 286#ifdef CONFIG_CPU_SH4
259 free_irq(DMAE_IRQ, 0); 287 free_irq(DMAE_IRQ, 0);
260#endif 288#endif
289 unregister_dmac(&sh_dmac_info);
261} 290}
262 291
263subsys_initcall(sh_dmac_init); 292subsys_initcall(sh_dmac_init);
264module_exit(sh_dmac_exit); 293module_exit(sh_dmac_exit);
265 294
295MODULE_AUTHOR("Takashi YOSHII, Paul Mundt, Andriy Skulysh");
296MODULE_DESCRIPTION("SuperH On-Chip DMAC Support");
266MODULE_LICENSE("GPL"); 297MODULE_LICENSE("GPL");
267
diff --git a/arch/sh/drivers/dma/dma-sh.h b/arch/sh/drivers/dma/dma-sh.h
index dd9d547539a2..0f591fbc922d 100644
--- a/arch/sh/drivers/dma/dma-sh.h
+++ b/arch/sh/drivers/dma/dma-sh.h
@@ -11,6 +11,8 @@
11#ifndef __DMA_SH_H 11#ifndef __DMA_SH_H
12#define __DMA_SH_H 12#define __DMA_SH_H
13 13
14#include <asm/cpu/dma.h>
15
14/* Definitions for the SuperH DMAC */ 16/* Definitions for the SuperH DMAC */
15#define REQ_L 0x00000000 17#define REQ_L 0x00000000
16#define REQ_E 0x00080000 18#define REQ_E 0x00080000
@@ -26,27 +28,47 @@
26#define SM_DEC 0x00002000 28#define SM_DEC 0x00002000
27#define RS_IN 0x00000200 29#define RS_IN 0x00000200
28#define RS_OUT 0x00000300 30#define RS_OUT 0x00000300
29#define TM_BURST 0x0000080
30#define TS_8 0x00000010
31#define TS_16 0x00000020
32#define TS_32 0x00000030
33#define TS_64 0x00000000
34#define TS_BLK 0x00000040 31#define TS_BLK 0x00000040
35#define CHCR_DE 0x00000001 32#define CHCR_DE 0x00000001
36#define CHCR_TE 0x00000002 33#define CHCR_TE 0x00000002
37#define CHCR_IE 0x00000004 34#define CHCR_IE 0x00000004
38 35
39/* Define the default configuration for dual address memory-memory transfer. 36/* DMAOR definitions */
40 * The 0x400 value represents auto-request, external->external.
41 */
42#define RS_DUAL (DM_INC | SM_INC | 0x400 | TS_32)
43
44#define DMAOR_COD 0x00000008
45#define DMAOR_AE 0x00000004 37#define DMAOR_AE 0x00000004
46#define DMAOR_NMIF 0x00000002 38#define DMAOR_NMIF 0x00000002
47#define DMAOR_DME 0x00000001 39#define DMAOR_DME 0x00000001
48 40
41/*
42 * Define the default configuration for dual address memory-memory transfer.
43 * The 0x400 value represents auto-request, external->external.
44 */
45#define RS_DUAL (DM_INC | SM_INC | 0x400 | TS_32)
46
49#define MAX_DMAC_CHANNELS (CONFIG_NR_ONCHIP_DMA_CHANNELS) 47#define MAX_DMAC_CHANNELS (CONFIG_NR_ONCHIP_DMA_CHANNELS)
50 48
49/*
50 * Subtypes that have fewer channels than this simply need to change
51 * CONFIG_NR_ONCHIP_DMA_CHANNELS. Likewise, subtypes with a larger number
52 * of channels should expand on this.
53 *
54 * For most subtypes we can easily figure these values out with some
55 * basic calculation, unfortunately on other subtypes these are more
56 * scattered, so we just leave it unrolled for simplicity.
57 */
58#define SAR ((unsigned long[]){SH_DMAC_BASE + 0x00, SH_DMAC_BASE + 0x10, \
59 SH_DMAC_BASE + 0x20, SH_DMAC_BASE + 0x30, \
60 SH_DMAC_BASE + 0x50, SH_DMAC_BASE + 0x60})
61#define DAR ((unsigned long[]){SH_DMAC_BASE + 0x04, SH_DMAC_BASE + 0x14, \
62 SH_DMAC_BASE + 0x24, SH_DMAC_BASE + 0x34, \
63 SH_DMAC_BASE + 0x54, SH_DMAC_BASE + 0x64})
64#define DMATCR ((unsigned long[]){SH_DMAC_BASE + 0x08, SH_DMAC_BASE + 0x18, \
65 SH_DMAC_BASE + 0x28, SH_DMAC_BASE + 0x38, \
66 SH_DMAC_BASE + 0x58, SH_DMAC_BASE + 0x68})
67#define CHCR ((unsigned long[]){SH_DMAC_BASE + 0x0c, SH_DMAC_BASE + 0x1c, \
68 SH_DMAC_BASE + 0x2c, SH_DMAC_BASE + 0x3c, \
69 SH_DMAC_BASE + 0x5c, SH_DMAC_BASE + 0x6c})
70
71#define DMAOR (SH_DMAC_BASE + 0x40)
72
51#endif /* __DMA_SH_H */ 73#endif /* __DMA_SH_H */
52 74
diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c
index 6e3b58bd8795..70a5d82eb2f8 100644
--- a/arch/sh/drivers/dma/dma-sysfs.c
+++ b/arch/sh/drivers/dma/dma-sysfs.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * sysfs interface for SH DMA API 4 * sysfs interface for SH DMA API
5 * 5 *
6 * Copyright (C) 2004 Paul Mundt 6 * Copyright (C) 2004, 2005 Paul Mundt
7 * 7 *
8 * This file is subject to the terms and conditions of the GNU General Public 8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive 9 * License. See the file "COPYING" in the main directory of this archive
@@ -12,7 +12,9 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/sysdev.h> 14#include <linux/sysdev.h>
15#include <linux/platform_device.h>
15#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/err.h>
16#include <linux/string.h> 18#include <linux/string.h>
17#include <asm/dma.h> 19#include <asm/dma.h>
18 20
@@ -77,7 +79,7 @@ static ssize_t dma_store_config(struct sys_device *dev,
77 unsigned long config; 79 unsigned long config;
78 80
79 config = simple_strtoul(buf, NULL, 0); 81 config = simple_strtoul(buf, NULL, 0);
80 dma_configure_channel(channel->chan, config); 82 dma_configure_channel(channel->vchan, config);
81 83
82 return count; 84 return count;
83} 85}
@@ -111,12 +113,13 @@ static SYSDEV_ATTR(field, S_IRUGO, dma_show_##field, NULL);
111dma_ro_attr(count, "0x%08x\n"); 113dma_ro_attr(count, "0x%08x\n");
112dma_ro_attr(flags, "0x%08lx\n"); 114dma_ro_attr(flags, "0x%08lx\n");
113 115
114int __init dma_create_sysfs_files(struct dma_channel *chan) 116int dma_create_sysfs_files(struct dma_channel *chan, struct dma_info *info)
115{ 117{
116 struct sys_device *dev = &chan->dev; 118 struct sys_device *dev = &chan->dev;
119 char name[16];
117 int ret; 120 int ret;
118 121
119 dev->id = chan->chan; 122 dev->id = chan->vchan;
120 dev->cls = &dma_sysclass; 123 dev->cls = &dma_sysclass;
121 124
122 ret = sysdev_register(dev); 125 ret = sysdev_register(dev);
@@ -129,6 +132,24 @@ int __init dma_create_sysfs_files(struct dma_channel *chan)
129 sysdev_create_file(dev, &attr_flags); 132 sysdev_create_file(dev, &attr_flags);
130 sysdev_create_file(dev, &attr_config); 133 sysdev_create_file(dev, &attr_config);
131 134
132 return 0; 135 snprintf(name, sizeof(name), "dma%d", chan->chan);
136 return sysfs_create_link(&info->pdev->dev.kobj, &dev->kobj, name);
137}
138
139void dma_remove_sysfs_files(struct dma_channel *chan, struct dma_info *info)
140{
141 struct sys_device *dev = &chan->dev;
142 char name[16];
143
144 sysdev_remove_file(dev, &attr_dev_id);
145 sysdev_remove_file(dev, &attr_count);
146 sysdev_remove_file(dev, &attr_mode);
147 sysdev_remove_file(dev, &attr_flags);
148 sysdev_remove_file(dev, &attr_config);
149
150 snprintf(name, sizeof(name), "dma%d", chan->chan);
151 sysfs_remove_link(&info->pdev->dev.kobj, name);
152
153 sysdev_unregister(dev);
133} 154}
134 155
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index 8b819698df14..7a86eeb22655 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -17,6 +17,4 @@ obj-$(CONFIG_SH_KGDB) += kgdb_stub.o kgdb_jmp.o
17obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o 17obj-$(CONFIG_SH_CPU_FREQ) += cpufreq.o
18obj-$(CONFIG_MODULES) += module.o 18obj-$(CONFIG_MODULES) += module.o
19obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 19obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
20 20obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
21USE_STANDARD_AS_RULE := true
22
diff --git a/arch/sh/kernel/cpu/Makefile b/arch/sh/kernel/cpu/Makefile
index cd43714df61a..5bfc33bec5d0 100644
--- a/arch/sh/kernel/cpu/Makefile
+++ b/arch/sh/kernel/cpu/Makefile
@@ -2,15 +2,12 @@
2# Makefile for the Linux/SuperH CPU-specifc backends. 2# Makefile for the Linux/SuperH CPU-specifc backends.
3# 3#
4 4
5obj-y := irq_ipr.o irq_imask.o init.o bus.o 5obj-y += irq/ init.o bus.o clock.o
6 6
7obj-$(CONFIG_CPU_SH2) += sh2/ 7obj-$(CONFIG_CPU_SH2) += sh2/
8obj-$(CONFIG_CPU_SH3) += sh3/ 8obj-$(CONFIG_CPU_SH3) += sh3/
9obj-$(CONFIG_CPU_SH4) += sh4/ 9obj-$(CONFIG_CPU_SH4) += sh4/
10 10
11obj-$(CONFIG_SH_RTC) += rtc.o 11obj-$(CONFIG_SH_RTC) += rtc.o
12obj-$(CONFIG_UBC_WAKEUP) += ubc.o 12obj-$(CONFIG_UBC_WAKEUP) += ubc.o
13obj-$(CONFIG_SH_ADC) += adc.o 13obj-$(CONFIG_SH_ADC) += adc.o
14
15USE_STANDARD_AS_RULE := true
16
diff --git a/arch/sh/kernel/cpu/bus.c b/arch/sh/kernel/cpu/bus.c
index d4fee2a79373..fc6c4bd40c65 100644
--- a/arch/sh/kernel/cpu/bus.c
+++ b/arch/sh/kernel/cpu/bus.c
@@ -53,21 +53,6 @@ static int sh_bus_resume(struct device *dev)
53 return 0; 53 return 0;
54} 54}
55 55
56static struct device sh_bus_devices[SH_NR_BUSES] = {
57 {
58 .bus_id = SH_BUS_NAME_VIRT,
59 },
60};
61
62struct bus_type sh_bus_types[SH_NR_BUSES] = {
63 {
64 .name = SH_BUS_NAME_VIRT,
65 .match = sh_bus_match,
66 .suspend = sh_bus_suspend,
67 .resume = sh_bus_resume,
68 },
69};
70
71static int sh_device_probe(struct device *dev) 56static int sh_device_probe(struct device *dev)
72{ 57{
73 struct sh_dev *shdev = to_sh_dev(dev); 58 struct sh_dev *shdev = to_sh_dev(dev);
@@ -90,6 +75,23 @@ static int sh_device_remove(struct device *dev)
90 return 0; 75 return 0;
91} 76}
92 77
78static struct device sh_bus_devices[SH_NR_BUSES] = {
79 {
80 .bus_id = SH_BUS_NAME_VIRT,
81 },
82};
83
84struct bus_type sh_bus_types[SH_NR_BUSES] = {
85 {
86 .name = SH_BUS_NAME_VIRT,
87 .match = sh_bus_match,
88 .probe = sh_bus_probe,
89 .remove = sh_bus_remove,
90 .suspend = sh_bus_suspend,
91 .resume = sh_bus_resume,
92 },
93};
94
93int sh_device_register(struct sh_dev *dev) 95int sh_device_register(struct sh_dev *dev)
94{ 96{
95 if (!dev) 97 if (!dev)
@@ -107,6 +109,8 @@ int sh_device_register(struct sh_dev *dev)
107 /* This is needed for USB OHCI to work */ 109 /* This is needed for USB OHCI to work */
108 if (dev->dma_mask) 110 if (dev->dma_mask)
109 dev->dev.dma_mask = dev->dma_mask; 111 dev->dev.dma_mask = dev->dma_mask;
112 if (dev->coherent_dma_mask)
113 dev->dev.coherent_dma_mask = dev->coherent_dma_mask;
110 114
111 snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%s%u", 115 snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%s%u",
112 dev->name, dev->dev_id); 116 dev->name, dev->dev_id);
@@ -133,8 +137,6 @@ int sh_driver_register(struct sh_driver *drv)
133 return -EINVAL; 137 return -EINVAL;
134 } 138 }
135 139
136 drv->drv.probe = sh_device_probe;
137 drv->drv.remove = sh_device_remove;
138 drv->drv.bus = &sh_bus_types[drv->bus_id]; 140 drv->drv.bus = &sh_bus_types[drv->bus_id];
139 141
140 return driver_register(&drv->drv); 142 return driver_register(&drv->drv);
diff --git a/arch/sh/kernel/cpu/clock.c b/arch/sh/kernel/cpu/clock.c
new file mode 100644
index 000000000000..989e7fdd524d
--- /dev/null
+++ b/arch/sh/kernel/cpu/clock.c
@@ -0,0 +1,287 @@
1/*
2 * arch/sh/kernel/cpu/clock.c - SuperH clock framework
3 *
4 * Copyright (C) 2005 Paul Mundt
5 *
6 * This clock framework is derived from the OMAP version by:
7 *
8 * Copyright (C) 2004 Nokia Corporation
9 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/list.h>
19#include <linux/kref.h>
20#include <linux/seq_file.h>
21#include <linux/err.h>
22#include <asm/clock.h>
23#include <asm/timer.h>
24
25static LIST_HEAD(clock_list);
26static DEFINE_SPINLOCK(clock_lock);
27static DECLARE_MUTEX(clock_list_sem);
28
29/*
30 * Each subtype is expected to define the init routines for these clocks,
31 * as each subtype (or processor family) will have these clocks at the
32 * very least. These are all provided through the CPG, which even some of
33 * the more quirky parts (such as ST40, SH4-202, etc.) still have.
34 *
35 * The processor-specific code is expected to register any additional
36 * clock sources that are of interest.
37 */
38static struct clk master_clk = {
39 .name = "master_clk",
40 .flags = CLK_ALWAYS_ENABLED | CLK_RATE_PROPAGATES,
41#ifdef CONFIG_SH_PCLK_FREQ_BOOL
42 .rate = CONFIG_SH_PCLK_FREQ,
43#endif
44};
45
46static struct clk module_clk = {
47 .name = "module_clk",
48 .parent = &master_clk,
49 .flags = CLK_ALWAYS_ENABLED | CLK_RATE_PROPAGATES,
50};
51
52static struct clk bus_clk = {
53 .name = "bus_clk",
54 .parent = &master_clk,
55 .flags = CLK_ALWAYS_ENABLED | CLK_RATE_PROPAGATES,
56};
57
58static struct clk cpu_clk = {
59 .name = "cpu_clk",
60 .parent = &master_clk,
61 .flags = CLK_ALWAYS_ENABLED,
62};
63
64/*
65 * The ordering of these clocks matters, do not change it.
66 */
67static struct clk *onchip_clocks[] = {
68 &master_clk,
69 &module_clk,
70 &bus_clk,
71 &cpu_clk,
72};
73
74static void propagate_rate(struct clk *clk)
75{
76 struct clk *clkp;
77
78 list_for_each_entry(clkp, &clock_list, node) {
79 if (likely(clkp->parent != clk))
80 continue;
81 if (likely(clkp->ops && clkp->ops->recalc))
82 clkp->ops->recalc(clkp);
83 }
84}
85
86int __clk_enable(struct clk *clk)
87{
88 /*
89 * See if this is the first time we're enabling the clock, some
90 * clocks that are always enabled still require "special"
91 * initialization. This is especially true if the clock mode
92 * changes and the clock needs to hunt for the proper set of
93 * divisors to use before it can effectively recalc.
94 */
95 if (unlikely(atomic_read(&clk->kref.refcount) == 1))
96 if (clk->ops && clk->ops->init)
97 clk->ops->init(clk);
98
99 if (clk->flags & CLK_ALWAYS_ENABLED)
100 return 0;
101
102 if (likely(clk->ops && clk->ops->enable))
103 clk->ops->enable(clk);
104
105 kref_get(&clk->kref);
106 return 0;
107}
108
109int clk_enable(struct clk *clk)
110{
111 unsigned long flags;
112 int ret;
113
114 spin_lock_irqsave(&clock_lock, flags);
115 ret = __clk_enable(clk);
116 spin_unlock_irqrestore(&clock_lock, flags);
117
118 return ret;
119}
120
121static void clk_kref_release(struct kref *kref)
122{
123 /* Nothing to do */
124}
125
126void __clk_disable(struct clk *clk)
127{
128 if (clk->flags & CLK_ALWAYS_ENABLED)
129 return;
130
131 kref_put(&clk->kref, clk_kref_release);
132}
133
134void clk_disable(struct clk *clk)
135{
136 unsigned long flags;
137
138 spin_lock_irqsave(&clock_lock, flags);
139 __clk_disable(clk);
140 spin_unlock_irqrestore(&clock_lock, flags);
141}
142
143int clk_register(struct clk *clk)
144{
145 down(&clock_list_sem);
146
147 list_add(&clk->node, &clock_list);
148 kref_init(&clk->kref);
149
150 up(&clock_list_sem);
151
152 return 0;
153}
154
155void clk_unregister(struct clk *clk)
156{
157 down(&clock_list_sem);
158 list_del(&clk->node);
159 up(&clock_list_sem);
160}
161
162inline unsigned long clk_get_rate(struct clk *clk)
163{
164 return clk->rate;
165}
166
167int clk_set_rate(struct clk *clk, unsigned long rate)
168{
169 int ret = -EOPNOTSUPP;
170
171 if (likely(clk->ops && clk->ops->set_rate)) {
172 unsigned long flags;
173
174 spin_lock_irqsave(&clock_lock, flags);
175 ret = clk->ops->set_rate(clk, rate);
176 spin_unlock_irqrestore(&clock_lock, flags);
177 }
178
179 if (unlikely(clk->flags & CLK_RATE_PROPAGATES))
180 propagate_rate(clk);
181
182 return ret;
183}
184
185void clk_recalc_rate(struct clk *clk)
186{
187 if (likely(clk->ops && clk->ops->recalc)) {
188 unsigned long flags;
189
190 spin_lock_irqsave(&clock_lock, flags);
191 clk->ops->recalc(clk);
192 spin_unlock_irqrestore(&clock_lock, flags);
193 }
194
195 if (unlikely(clk->flags & CLK_RATE_PROPAGATES))
196 propagate_rate(clk);
197}
198
199struct clk *clk_get(const char *id)
200{
201 struct clk *p, *clk = ERR_PTR(-ENOENT);
202
203 down(&clock_list_sem);
204 list_for_each_entry(p, &clock_list, node) {
205 if (strcmp(id, p->name) == 0 && try_module_get(p->owner)) {
206 clk = p;
207 break;
208 }
209 }
210 up(&clock_list_sem);
211
212 return clk;
213}
214
215void clk_put(struct clk *clk)
216{
217 if (clk && !IS_ERR(clk))
218 module_put(clk->owner);
219}
220
221void __init __attribute__ ((weak))
222arch_init_clk_ops(struct clk_ops **ops, int type)
223{
224}
225
226int __init clk_init(void)
227{
228 int i, ret = 0;
229
230 if (unlikely(!master_clk.rate))
231 /*
232 * NOTE: This will break if the default divisor has been
233 * changed.
234 *
235 * No one should be changing the default on us however,
236 * expect that a sane value for CONFIG_SH_PCLK_FREQ will
237 * be defined in the event of a different divisor.
238 */
239 master_clk.rate = get_timer_frequency() * 4;
240
241 for (i = 0; i < ARRAY_SIZE(onchip_clocks); i++) {
242 struct clk *clk = onchip_clocks[i];
243
244 arch_init_clk_ops(&clk->ops, i);
245 ret |= clk_register(clk);
246 clk_enable(clk);
247 }
248
249 /* Kick the child clocks.. */
250 propagate_rate(&master_clk);
251 propagate_rate(&bus_clk);
252
253 return ret;
254}
255
256int show_clocks(struct seq_file *m)
257{
258 struct clk *clk;
259
260 list_for_each_entry_reverse(clk, &clock_list, node) {
261 unsigned long rate = clk_get_rate(clk);
262
263 /*
264 * Don't bother listing dummy clocks with no ancestry
265 * that only support enable and disable ops.
266 */
267 if (unlikely(!rate && !clk->parent))
268 continue;
269
270 seq_printf(m, "%-12s\t: %ld.%02ldMHz\n", clk->name,
271 rate / 1000000, (rate % 1000000) / 10000);
272 }
273
274 return 0;
275}
276
277EXPORT_SYMBOL_GPL(clk_register);
278EXPORT_SYMBOL_GPL(clk_unregister);
279EXPORT_SYMBOL_GPL(clk_get);
280EXPORT_SYMBOL_GPL(clk_put);
281EXPORT_SYMBOL_GPL(clk_enable);
282EXPORT_SYMBOL_GPL(clk_disable);
283EXPORT_SYMBOL_GPL(__clk_enable);
284EXPORT_SYMBOL_GPL(__clk_disable);
285EXPORT_SYMBOL_GPL(clk_get_rate);
286EXPORT_SYMBOL_GPL(clk_set_rate);
287EXPORT_SYMBOL_GPL(clk_recalc_rate);
diff --git a/arch/sh/kernel/cpu/irq/Makefile b/arch/sh/kernel/cpu/irq/Makefile
new file mode 100644
index 000000000000..e3cccea15e1d
--- /dev/null
+++ b/arch/sh/kernel/cpu/irq/Makefile
@@ -0,0 +1,7 @@
1#
2# Makefile for the Linux/SuperH CPU-specifc IRQ handlers.
3#
4obj-y += ipr.o imask.o
5
6obj-$(CONFIG_CPU_HAS_PINT_IRQ) += pint.o
7obj-$(CONFIG_CPU_HAS_INTC2_IRQ) += intc2.o
diff --git a/arch/sh/kernel/cpu/irq_imask.c b/arch/sh/kernel/cpu/irq/imask.c
index a963d00a971e..baed9a550d39 100644
--- a/arch/sh/kernel/cpu/irq_imask.c
+++ b/arch/sh/kernel/cpu/irq/imask.c
@@ -1,16 +1,12 @@
1/* $Id: irq_imask.c,v 1.1.2.1 2002/11/17 10:53:43 mrbrown Exp $ 1/*
2 * 2 * arch/sh/kernel/cpu/irq/imask.c
3 * linux/arch/sh/kernel/irq_imask.c
4 * 3 *
5 * Copyright (C) 1999, 2000 Niibe Yutaka 4 * Copyright (C) 1999, 2000 Niibe Yutaka
6 * 5 *
7 * Simple interrupt handling using IMASK of SR register. 6 * Simple interrupt handling using IMASK of SR register.
8 * 7 *
9 */ 8 */
10
11/* NOTE: Will not work on level 15 */ 9/* NOTE: Will not work on level 15 */
12
13
14#include <linux/ptrace.h> 10#include <linux/ptrace.h>
15#include <linux/errno.h> 11#include <linux/errno.h>
16#include <linux/kernel_stat.h> 12#include <linux/kernel_stat.h>
@@ -19,13 +15,11 @@
19#include <linux/interrupt.h> 15#include <linux/interrupt.h>
20#include <linux/init.h> 16#include <linux/init.h>
21#include <linux/bitops.h> 17#include <linux/bitops.h>
22
23#include <asm/system.h>
24#include <asm/irq.h>
25
26#include <linux/spinlock.h> 18#include <linux/spinlock.h>
27#include <linux/cache.h> 19#include <linux/cache.h>
28#include <linux/irq.h> 20#include <linux/irq.h>
21#include <asm/system.h>
22#include <asm/irq.h>
29 23
30/* Bitmap of IRQ masked */ 24/* Bitmap of IRQ masked */
31static unsigned long imask_mask = 0x7fff; 25static unsigned long imask_mask = 0x7fff;
@@ -40,7 +34,7 @@ static void end_imask_irq(unsigned int irq);
40#define IMASK_PRIORITY 15 34#define IMASK_PRIORITY 15
41 35
42static unsigned int startup_imask_irq(unsigned int irq) 36static unsigned int startup_imask_irq(unsigned int irq)
43{ 37{
44 /* Nothing to do */ 38 /* Nothing to do */
45 return 0; /* never anything pending */ 39 return 0; /* never anything pending */
46} 40}
diff --git a/arch/sh/kernel/cpu/irq/intc2.c b/arch/sh/kernel/cpu/irq/intc2.c
new file mode 100644
index 000000000000..06e8afab32e4
--- /dev/null
+++ b/arch/sh/kernel/cpu/irq/intc2.c
@@ -0,0 +1,284 @@
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
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/irq.h>
17#include <asm/system.h>
18#include <asm/io.h>
19#include <asm/machvec.h>
20
21struct intc2_data {
22 unsigned char msk_offset;
23 unsigned char msk_shift;
24
25 int (*clear_irq) (int);
26};
27
28static struct intc2_data intc2_data[NR_INTC2_IRQS];
29
30static void enable_intc2_irq(unsigned int irq);
31static void disable_intc2_irq(unsigned int irq);
32
33/* shutdown is same as "disable" */
34#define shutdown_intc2_irq disable_intc2_irq
35
36static void mask_and_ack_intc2(unsigned int);
37static void end_intc2_irq(unsigned int irq);
38
39static unsigned int startup_intc2_irq(unsigned int irq)
40{
41 enable_intc2_irq(irq);
42 return 0; /* never anything pending */
43}
44
45static struct hw_interrupt_type intc2_irq_type = {
46 .typename = "INTC2-IRQ",
47 .startup = startup_intc2_irq,
48 .shutdown = shutdown_intc2_irq,
49 .enable = enable_intc2_irq,
50 .disable = disable_intc2_irq,
51 .ack = mask_and_ack_intc2,
52 .end = end_intc2_irq
53};
54
55static void disable_intc2_irq(unsigned int irq)
56{
57 int irq_offset = irq - INTC2_FIRST_IRQ;
58 int msk_shift, msk_offset;
59
60 /* Sanity check */
61 if (unlikely(irq_offset < 0 || irq_offset >= NR_INTC2_IRQS))
62 return;
63
64 msk_shift = intc2_data[irq_offset].msk_shift;
65 msk_offset = intc2_data[irq_offset].msk_offset;
66
67 ctrl_outl(1 << msk_shift,
68 INTC2_BASE + INTC2_INTMSK_OFFSET + msk_offset);
69}
70
71static void enable_intc2_irq(unsigned int irq)
72{
73 int irq_offset = irq - INTC2_FIRST_IRQ;
74 int msk_shift, msk_offset;
75
76 /* Sanity check */
77 if (unlikely(irq_offset < 0 || irq_offset >= NR_INTC2_IRQS))
78 return;
79
80 msk_shift = intc2_data[irq_offset].msk_shift;
81 msk_offset = intc2_data[irq_offset].msk_offset;
82
83 ctrl_outl(1 << msk_shift,
84 INTC2_BASE + INTC2_INTMSKCLR_OFFSET + msk_offset);
85}
86
87static void mask_and_ack_intc2(unsigned int irq)
88{
89 disable_intc2_irq(irq);
90}
91
92static void end_intc2_irq(unsigned int irq)
93{
94 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
95 enable_intc2_irq(irq);
96
97 if (unlikely(intc2_data[irq - INTC2_FIRST_IRQ].clear_irq))
98 intc2_data[irq - INTC2_FIRST_IRQ].clear_irq(irq);
99}
100
101/*
102 * Setup an INTC2 style interrupt.
103 * NOTE: Unlike IPR interrupts, parameters are not shifted by this code,
104 * allowing the use of the numbers straight out of the datasheet.
105 * For example:
106 * PIO1 which is INTPRI00[19,16] and INTMSK00[13]
107 * would be: ^ ^ ^ ^
108 * | | | |
109 * make_intc2_irq(84, 0, 16, 0, 13);
110 */
111void make_intc2_irq(unsigned int irq,
112 unsigned int ipr_offset, unsigned int ipr_shift,
113 unsigned int msk_offset, unsigned int msk_shift,
114 unsigned int priority)
115{
116 int irq_offset = irq - INTC2_FIRST_IRQ;
117 unsigned int flags;
118 unsigned long ipr;
119
120 if (unlikely(irq_offset < 0 || irq_offset >= NR_INTC2_IRQS))
121 return;
122
123 disable_irq_nosync(irq);
124
125 /* Fill the data we need */
126 intc2_data[irq_offset].msk_offset = msk_offset;
127 intc2_data[irq_offset].msk_shift = msk_shift;
128 intc2_data[irq_offset].clear_irq = NULL;
129
130 /* Set the priority level */
131 local_irq_save(flags);
132
133 ipr = ctrl_inl(INTC2_BASE + INTC2_INTPRI_OFFSET + ipr_offset);
134 ipr &= ~(0xf << ipr_shift);
135 ipr |= priority << ipr_shift;
136 ctrl_outl(ipr, INTC2_BASE + INTC2_INTPRI_OFFSET + ipr_offset);
137
138 local_irq_restore(flags);
139
140 irq_desc[irq].handler = &intc2_irq_type;
141
142 disable_intc2_irq(irq);
143}
144
145static struct intc2_init {
146 unsigned short irq;
147 unsigned char ipr_offset, ipr_shift;
148 unsigned char msk_offset, msk_shift;
149 unsigned char priority;
150} intc2_init_data[] __initdata = {
151#if defined(CONFIG_CPU_SUBTYPE_ST40)
152 {64, 0, 0, 0, 0, 13}, /* PCI serr */
153 {65, 0, 4, 0, 1, 13}, /* PCI err */
154 {66, 0, 4, 0, 2, 13}, /* PCI ad */
155 {67, 0, 4, 0, 3, 13}, /* PCI pwd down */
156 {72, 0, 8, 0, 5, 13}, /* DMAC INT0 */
157 {73, 0, 8, 0, 6, 13}, /* DMAC INT1 */
158 {74, 0, 8, 0, 7, 13}, /* DMAC INT2 */
159 {75, 0, 8, 0, 8, 13}, /* DMAC INT3 */
160 {76, 0, 8, 0, 9, 13}, /* DMAC INT4 */
161 {78, 0, 8, 0, 11, 13}, /* DMAC ERR */
162 {80, 0, 12, 0, 12, 13}, /* PIO0 */
163 {84, 0, 16, 0, 13, 13}, /* PIO1 */
164 {88, 0, 20, 0, 14, 13}, /* PIO2 */
165 {112, 4, 0, 4, 0, 13}, /* Mailbox */
166 #ifdef CONFIG_CPU_SUBTYPE_ST40GX1
167 {116, 4, 4, 4, 4, 13}, /* SSC0 */
168 {120, 4, 8, 4, 8, 13}, /* IR Blaster */
169 {124, 4, 12, 4, 12, 13}, /* USB host */
170 {128, 4, 16, 4, 16, 13}, /* Video processor BLITTER */
171 {132, 4, 20, 4, 20, 13}, /* UART0 */
172 {134, 4, 20, 4, 22, 13}, /* UART2 */
173 {136, 4, 24, 4, 24, 13}, /* IO_PIO0 */
174 {140, 4, 28, 4, 28, 13}, /* EMPI */
175 {144, 8, 0, 8, 0, 13}, /* MAFE */
176 {148, 8, 4, 8, 4, 13}, /* PWM */
177 {152, 8, 8, 8, 8, 13}, /* SSC1 */
178 {156, 8, 12, 8, 12, 13}, /* IO_PIO1 */
179 {160, 8, 16, 8, 16, 13}, /* USB target */
180 {164, 8, 20, 8, 20, 13}, /* UART1 */
181 {168, 8, 24, 8, 24, 13}, /* Teletext */
182 {172, 8, 28, 8, 28, 13}, /* VideoSync VTG */
183 {173, 8, 28, 8, 29, 13}, /* VideoSync DVP0 */
184 {174, 8, 28, 8, 30, 13}, /* VideoSync DVP1 */
185#endif
186#elif defined(CONFIG_CPU_SUBTYPE_SH7760)
187/*
188 * SH7760 INTC2-Style interrupts, vectors IRQ48-111 INTEVT 0x800-0xFE0
189 */
190 /* INTPRIO0 | INTMSK0 */
191 {48, 0, 28, 0, 31, 3}, /* IRQ 4 */
192 {49, 0, 24, 0, 30, 3}, /* IRQ 3 */
193 {50, 0, 20, 0, 29, 3}, /* IRQ 2 */
194 {51, 0, 16, 0, 28, 3}, /* IRQ 1 */
195 /* 52-55 (INTEVT 0x880-0x8E0) unused/reserved */
196 /* INTPRIO4 | INTMSK0 */
197 {56, 4, 28, 0, 25, 3}, /* HCAN2_CHAN0 */
198 {57, 4, 24, 0, 24, 3}, /* HCAN2_CHAN1 */
199 {58, 4, 20, 0, 23, 3}, /* I2S_CHAN0 */
200 {59, 4, 16, 0, 22, 3}, /* I2S_CHAN1 */
201 {60, 4, 12, 0, 21, 3}, /* AC97_CHAN0 */
202 {61, 4, 8, 0, 20, 3}, /* AC97_CHAN1 */
203 {62, 4, 4, 0, 19, 3}, /* I2C_CHAN0 */
204 {63, 4, 0, 0, 18, 3}, /* I2C_CHAN1 */
205 /* INTPRIO8 | INTMSK0 */
206 {52, 8, 16, 0, 11, 3}, /* SCIF0_ERI_IRQ */
207 {53, 8, 16, 0, 10, 3}, /* SCIF0_RXI_IRQ */
208 {54, 8, 16, 0, 9, 3}, /* SCIF0_BRI_IRQ */
209 {55, 8, 16, 0, 8, 3}, /* SCIF0_TXI_IRQ */
210 {64, 8, 28, 0, 17, 3}, /* USBHI_IRQ */
211 {65, 8, 24, 0, 16, 3}, /* LCDC */
212 /* 66, 67 unused */
213 {68, 8, 20, 0, 14, 13}, /* DMABRGI0_IRQ */
214 {69, 8, 20, 0, 13, 13}, /* DMABRGI1_IRQ */
215 {70, 8, 20, 0, 12, 13}, /* DMABRGI2_IRQ */
216 /* 71 unused */
217 {72, 8, 12, 0, 7, 3}, /* SCIF1_ERI_IRQ */
218 {73, 8, 12, 0, 6, 3}, /* SCIF1_RXI_IRQ */
219 {74, 8, 12, 0, 5, 3}, /* SCIF1_BRI_IRQ */
220 {75, 8, 12, 0, 4, 3}, /* SCIF1_TXI_IRQ */
221 {76, 8, 8, 0, 3, 3}, /* SCIF2_ERI_IRQ */
222 {77, 8, 8, 0, 2, 3}, /* SCIF2_RXI_IRQ */
223 {78, 8, 8, 0, 1, 3}, /* SCIF2_BRI_IRQ */
224 {79, 8, 8, 0, 0, 3}, /* SCIF2_TXI_IRQ */
225 /* | INTMSK4 */
226 {80, 8, 4, 4, 23, 3}, /* SIM_ERI */
227 {81, 8, 4, 4, 22, 3}, /* SIM_RXI */
228 {82, 8, 4, 4, 21, 3}, /* SIM_TXI */
229 {83, 8, 4, 4, 20, 3}, /* SIM_TEI */
230 {84, 8, 0, 4, 19, 3}, /* HSPII */
231 /* INTPRIOC | INTMSK4 */
232 /* 85-87 unused/reserved */
233 {88, 12, 20, 4, 18, 3}, /* MMCI0 */
234 {89, 12, 20, 4, 17, 3}, /* MMCI1 */
235 {90, 12, 20, 4, 16, 3}, /* MMCI2 */
236 {91, 12, 20, 4, 15, 3}, /* MMCI3 */
237 {92, 12, 12, 4, 6, 3}, /* MFI (unsure, bug? in my 7760 manual*/
238 /* 93-107 reserved/undocumented */
239 {108,12, 4, 4, 1, 3}, /* ADC */
240 {109,12, 0, 4, 0, 3}, /* CMTI */
241 /* 110-111 reserved/unused */
242#elif defined(CONFIG_CPU_SUBTYPE_SH7780)
243 { TIMER_IRQ, 0, 24, 0, INTC_TMU0_MSK, 2},
244#ifdef CONFIG_SH_RTC
245 { RTC_IRQ, 4, 0, 0, INTC_RTC_MSK, TIMER_PRIORITY },
246#endif
247 { SCIF0_ERI_IRQ, 8, 24, 0, INTC_SCIF0_MSK, SCIF0_PRIORITY },
248 { SCIF0_RXI_IRQ, 8, 24, 0, INTC_SCIF0_MSK, SCIF0_PRIORITY },
249 { SCIF0_BRI_IRQ, 8, 24, 0, INTC_SCIF0_MSK, SCIF0_PRIORITY },
250 { SCIF0_TXI_IRQ, 8, 24, 0, INTC_SCIF0_MSK, SCIF0_PRIORITY },
251
252 { SCIF1_ERI_IRQ, 8, 16, 0, INTC_SCIF1_MSK, SCIF1_PRIORITY },
253 { SCIF1_RXI_IRQ, 8, 16, 0, INTC_SCIF1_MSK, SCIF1_PRIORITY },
254 { SCIF1_BRI_IRQ, 8, 16, 0, INTC_SCIF1_MSK, SCIF1_PRIORITY },
255 { SCIF1_TXI_IRQ, 8, 16, 0, INTC_SCIF1_MSK, SCIF1_PRIORITY },
256
257 { PCIC0_IRQ, 0x10, 8, 0, INTC_PCIC0_MSK, PCIC0_PRIORITY },
258 { PCIC1_IRQ, 0x10, 0, 0, INTC_PCIC1_MSK, PCIC1_PRIORITY },
259 { PCIC2_IRQ, 0x14, 24, 0, INTC_PCIC2_MSK, PCIC2_PRIORITY },
260 { PCIC3_IRQ, 0x14, 16, 0, INTC_PCIC3_MSK, PCIC3_PRIORITY },
261 { PCIC4_IRQ, 0x14, 8, 0, INTC_PCIC4_MSK, PCIC4_PRIORITY },
262#endif
263};
264
265void __init init_IRQ_intc2(void)
266{
267 int i;
268
269 for (i = 0; i < ARRAY_SIZE(intc2_init_data); i++) {
270 struct intc2_init *p = intc2_init_data + i;
271 make_intc2_irq(p->irq, p->ipr_offset, p->ipr_shift,
272 p-> msk_offset, p->msk_shift, p->priority);
273 }
274}
275
276/* Adds a termination callback to the interrupt */
277void intc2_add_clear_irq(int irq, int (*fn)(int))
278{
279 if (unlikely(irq < INTC2_FIRST_IRQ))
280 return;
281
282 intc2_data[irq - INTC2_FIRST_IRQ].clear_irq = fn;
283}
284
diff --git a/arch/sh/kernel/cpu/irq_ipr.c b/arch/sh/kernel/cpu/irq/ipr.c
index 71f92096132b..fdbd718ae5c6 100644
--- a/arch/sh/kernel/cpu/irq_ipr.c
+++ b/arch/sh/kernel/cpu/irq/ipr.c
@@ -1,6 +1,5 @@
1/* $Id: irq_ipr.c,v 1.1.2.1 2002/11/17 10:53:43 mrbrown Exp $ 1/*
2 * 2 * arch/sh/kernel/cpu/irq/ipr.c
3 * linux/arch/sh/kernel/irq_ipr.c
4 * 3 *
5 * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi 4 * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi
6 * Copyright (C) 2000 Kazumoto Kojima 5 * Copyright (C) 2000 Kazumoto Kojima
@@ -109,7 +108,8 @@ static void end_ipr_irq(unsigned int irq)
109 enable_ipr_irq(irq); 108 enable_ipr_irq(irq);
110} 109}
111 110
112void make_ipr_irq(unsigned int irq, unsigned int addr, int pos, int priority) 111void make_ipr_irq(unsigned int irq, unsigned int addr, int pos,
112 int priority, int maskpos)
113{ 113{
114 disable_irq_nosync(irq); 114 disable_irq_nosync(irq);
115 ipr_data[irq].addr = addr; 115 ipr_data[irq].addr = addr;
@@ -120,126 +120,47 @@ void make_ipr_irq(unsigned int irq, unsigned int addr, int pos, int priority)
120 disable_ipr_irq(irq); 120 disable_ipr_irq(irq);
121} 121}
122 122
123#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \
124 defined(CONFIG_CPU_SUBTYPE_SH7707) || \
125 defined(CONFIG_CPU_SUBTYPE_SH7709)
126static unsigned char pint_map[256];
127static unsigned long portcr_mask = 0;
128
129static void enable_pint_irq(unsigned int irq);
130static void disable_pint_irq(unsigned int irq);
131
132/* shutdown is same as "disable" */
133#define shutdown_pint_irq disable_pint_irq
134
135static void mask_and_ack_pint(unsigned int);
136static void end_pint_irq(unsigned int irq);
137
138static unsigned int startup_pint_irq(unsigned int irq)
139{
140 enable_pint_irq(irq);
141 return 0; /* never anything pending */
142}
143
144static struct hw_interrupt_type pint_irq_type = {
145 .typename = "PINT-IRQ",
146 .startup = startup_pint_irq,
147 .shutdown = shutdown_pint_irq,
148 .enable = enable_pint_irq,
149 .disable = disable_pint_irq,
150 .ack = mask_and_ack_pint,
151 .end = end_pint_irq
152};
153
154static void disable_pint_irq(unsigned int irq)
155{
156 unsigned long val, flags;
157
158 local_irq_save(flags);
159 val = ctrl_inw(INTC_INTER);
160 val &= ~(1 << (irq - PINT_IRQ_BASE));
161 ctrl_outw(val, INTC_INTER); /* disable PINTn */
162 portcr_mask &= ~(3 << (irq - PINT_IRQ_BASE)*2);
163 local_irq_restore(flags);
164}
165
166static void enable_pint_irq(unsigned int irq)
167{
168 unsigned long val, flags;
169
170 local_irq_save(flags);
171 val = ctrl_inw(INTC_INTER);
172 val |= 1 << (irq - PINT_IRQ_BASE);
173 ctrl_outw(val, INTC_INTER); /* enable PINTn */
174 portcr_mask |= 3 << (irq - PINT_IRQ_BASE)*2;
175 local_irq_restore(flags);
176}
177
178static void mask_and_ack_pint(unsigned int irq)
179{
180 disable_pint_irq(irq);
181}
182
183static void end_pint_irq(unsigned int irq)
184{
185 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
186 enable_pint_irq(irq);
187}
188
189void make_pint_irq(unsigned int irq)
190{
191 disable_irq_nosync(irq);
192 irq_desc[irq].handler = &pint_irq_type;
193 disable_pint_irq(irq);
194}
195#endif
196
197void __init init_IRQ(void) 123void __init init_IRQ(void)
198{ 124{
199#if defined(CONFIG_CPU_SUBTYPE_SH7705) || \ 125#ifndef CONFIG_CPU_SUBTYPE_SH7780
200 defined(CONFIG_CPU_SUBTYPE_SH7707) || \ 126 make_ipr_irq(TIMER_IRQ, TIMER_IPR_ADDR, TIMER_IPR_POS, TIMER_PRIORITY, 0);
201 defined(CONFIG_CPU_SUBTYPE_SH7709) 127 make_ipr_irq(TIMER1_IRQ, TIMER1_IPR_ADDR, TIMER1_IPR_POS, TIMER1_PRIORITY, 0);
202 int i;
203#endif
204
205 make_ipr_irq(TIMER_IRQ, TIMER_IPR_ADDR, TIMER_IPR_POS, TIMER_PRIORITY);
206 make_ipr_irq(TIMER1_IRQ, TIMER1_IPR_ADDR, TIMER1_IPR_POS, TIMER1_PRIORITY);
207#if defined(CONFIG_SH_RTC) 128#if defined(CONFIG_SH_RTC)
208 make_ipr_irq(RTC_IRQ, RTC_IPR_ADDR, RTC_IPR_POS, RTC_PRIORITY); 129 make_ipr_irq(RTC_IRQ, RTC_IPR_ADDR, RTC_IPR_POS, RTC_PRIORITY, 0);
209#endif 130#endif
210 131
211#ifdef SCI_ERI_IRQ 132#ifdef SCI_ERI_IRQ
212 make_ipr_irq(SCI_ERI_IRQ, SCI_IPR_ADDR, SCI_IPR_POS, SCI_PRIORITY); 133 make_ipr_irq(SCI_ERI_IRQ, SCI_IPR_ADDR, SCI_IPR_POS, SCI_PRIORITY, 0);
213 make_ipr_irq(SCI_RXI_IRQ, SCI_IPR_ADDR, SCI_IPR_POS, SCI_PRIORITY); 134 make_ipr_irq(SCI_RXI_IRQ, SCI_IPR_ADDR, SCI_IPR_POS, SCI_PRIORITY, 0);
214 make_ipr_irq(SCI_TXI_IRQ, SCI_IPR_ADDR, SCI_IPR_POS, SCI_PRIORITY); 135 make_ipr_irq(SCI_TXI_IRQ, SCI_IPR_ADDR, SCI_IPR_POS, SCI_PRIORITY, 0);
215#endif 136#endif
216 137
217#ifdef SCIF1_ERI_IRQ 138#ifdef SCIF1_ERI_IRQ
218 make_ipr_irq(SCIF1_ERI_IRQ, SCIF1_IPR_ADDR, SCIF1_IPR_POS, SCIF1_PRIORITY); 139 make_ipr_irq(SCIF1_ERI_IRQ, SCIF1_IPR_ADDR, SCIF1_IPR_POS, SCIF1_PRIORITY, 0);
219 make_ipr_irq(SCIF1_RXI_IRQ, SCIF1_IPR_ADDR, SCIF1_IPR_POS, SCIF1_PRIORITY); 140 make_ipr_irq(SCIF1_RXI_IRQ, SCIF1_IPR_ADDR, SCIF1_IPR_POS, SCIF1_PRIORITY, 0);
220 make_ipr_irq(SCIF1_BRI_IRQ, SCIF1_IPR_ADDR, SCIF1_IPR_POS, SCIF1_PRIORITY); 141 make_ipr_irq(SCIF1_BRI_IRQ, SCIF1_IPR_ADDR, SCIF1_IPR_POS, SCIF1_PRIORITY, 0);
221 make_ipr_irq(SCIF1_TXI_IRQ, SCIF1_IPR_ADDR, SCIF1_IPR_POS, SCIF1_PRIORITY); 142 make_ipr_irq(SCIF1_TXI_IRQ, SCIF1_IPR_ADDR, SCIF1_IPR_POS, SCIF1_PRIORITY, 0);
222#endif 143#endif
223 144
224#if defined(CONFIG_CPU_SUBTYPE_SH7300) 145#if defined(CONFIG_CPU_SUBTYPE_SH7300)
225 make_ipr_irq(SCIF0_IRQ, SCIF0_IPR_ADDR, SCIF0_IPR_POS, SCIF0_PRIORITY); 146 make_ipr_irq(SCIF0_IRQ, SCIF0_IPR_ADDR, SCIF0_IPR_POS, SCIF0_PRIORITY, 0);
226 make_ipr_irq(DMTE2_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY); 147 make_ipr_irq(DMTE2_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY, 0);
227 make_ipr_irq(DMTE3_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY); 148 make_ipr_irq(DMTE3_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY, 0);
228 make_ipr_irq(VIO_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY); 149 make_ipr_irq(VIO_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY, 0);
229#endif 150#endif
230 151
231#ifdef SCIF_ERI_IRQ 152#ifdef SCIF_ERI_IRQ
232 make_ipr_irq(SCIF_ERI_IRQ, SCIF_IPR_ADDR, SCIF_IPR_POS, SCIF_PRIORITY); 153 make_ipr_irq(SCIF_ERI_IRQ, SCIF_IPR_ADDR, SCIF_IPR_POS, SCIF_PRIORITY, 0);
233 make_ipr_irq(SCIF_RXI_IRQ, SCIF_IPR_ADDR, SCIF_IPR_POS, SCIF_PRIORITY); 154 make_ipr_irq(SCIF_RXI_IRQ, SCIF_IPR_ADDR, SCIF_IPR_POS, SCIF_PRIORITY, 0);
234 make_ipr_irq(SCIF_BRI_IRQ, SCIF_IPR_ADDR, SCIF_IPR_POS, SCIF_PRIORITY); 155 make_ipr_irq(SCIF_BRI_IRQ, SCIF_IPR_ADDR, SCIF_IPR_POS, SCIF_PRIORITY, 0);
235 make_ipr_irq(SCIF_TXI_IRQ, SCIF_IPR_ADDR, SCIF_IPR_POS, SCIF_PRIORITY); 156 make_ipr_irq(SCIF_TXI_IRQ, SCIF_IPR_ADDR, SCIF_IPR_POS, SCIF_PRIORITY, 0);
236#endif 157#endif
237 158
238#ifdef IRDA_ERI_IRQ 159#ifdef IRDA_ERI_IRQ
239 make_ipr_irq(IRDA_ERI_IRQ, IRDA_IPR_ADDR, IRDA_IPR_POS, IRDA_PRIORITY); 160 make_ipr_irq(IRDA_ERI_IRQ, IRDA_IPR_ADDR, IRDA_IPR_POS, IRDA_PRIORITY, 0);
240 make_ipr_irq(IRDA_RXI_IRQ, IRDA_IPR_ADDR, IRDA_IPR_POS, IRDA_PRIORITY); 161 make_ipr_irq(IRDA_RXI_IRQ, IRDA_IPR_ADDR, IRDA_IPR_POS, IRDA_PRIORITY, 0);
241 make_ipr_irq(IRDA_BRI_IRQ, IRDA_IPR_ADDR, IRDA_IPR_POS, IRDA_PRIORITY); 162 make_ipr_irq(IRDA_BRI_IRQ, IRDA_IPR_ADDR, IRDA_IPR_POS, IRDA_PRIORITY, 0);
242 make_ipr_irq(IRDA_TXI_IRQ, IRDA_IPR_ADDR, IRDA_IPR_POS, IRDA_PRIORITY); 163 make_ipr_irq(IRDA_TXI_IRQ, IRDA_IPR_ADDR, IRDA_IPR_POS, IRDA_PRIORITY, 0);
243#endif 164#endif
244 165
245#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) || \ 166#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) || \
@@ -254,86 +175,32 @@ void __init init_IRQ(void)
254 * You should set corresponding bits of PFC to "00" 175 * You should set corresponding bits of PFC to "00"
255 * to enable these interrupts. 176 * to enable these interrupts.
256 */ 177 */
257 make_ipr_irq(IRQ0_IRQ, IRQ0_IPR_ADDR, IRQ0_IPR_POS, IRQ0_PRIORITY); 178 make_ipr_irq(IRQ0_IRQ, IRQ0_IPR_ADDR, IRQ0_IPR_POS, IRQ0_PRIORITY, 0);
258 make_ipr_irq(IRQ1_IRQ, IRQ1_IPR_ADDR, IRQ1_IPR_POS, IRQ1_PRIORITY); 179 make_ipr_irq(IRQ1_IRQ, IRQ1_IPR_ADDR, IRQ1_IPR_POS, IRQ1_PRIORITY, 0);
259 make_ipr_irq(IRQ2_IRQ, IRQ2_IPR_ADDR, IRQ2_IPR_POS, IRQ2_PRIORITY); 180 make_ipr_irq(IRQ2_IRQ, IRQ2_IPR_ADDR, IRQ2_IPR_POS, IRQ2_PRIORITY, 0);
260 make_ipr_irq(IRQ3_IRQ, IRQ3_IPR_ADDR, IRQ3_IPR_POS, IRQ3_PRIORITY); 181 make_ipr_irq(IRQ3_IRQ, IRQ3_IPR_ADDR, IRQ3_IPR_POS, IRQ3_PRIORITY, 0);
261 make_ipr_irq(IRQ4_IRQ, IRQ4_IPR_ADDR, IRQ4_IPR_POS, IRQ4_PRIORITY); 182 make_ipr_irq(IRQ4_IRQ, IRQ4_IPR_ADDR, IRQ4_IPR_POS, IRQ4_PRIORITY, 0);
262 make_ipr_irq(IRQ5_IRQ, IRQ5_IPR_ADDR, IRQ5_IPR_POS, IRQ5_PRIORITY); 183 make_ipr_irq(IRQ5_IRQ, IRQ5_IPR_ADDR, IRQ5_IPR_POS, IRQ5_PRIORITY, 0);
263#if !defined(CONFIG_CPU_SUBTYPE_SH7300) 184#endif
264 make_ipr_irq(PINT0_IRQ, PINT0_IPR_ADDR, PINT0_IPR_POS, PINT0_PRIORITY); 185#endif
265 make_ipr_irq(PINT8_IRQ, PINT8_IPR_ADDR, PINT8_IPR_POS, PINT8_PRIORITY);
266 enable_ipr_irq(PINT0_IRQ);
267 enable_ipr_irq(PINT8_IRQ);
268 186
269 for(i = 0; i < 16; i++) 187#ifdef CONFIG_CPU_HAS_PINT_IRQ
270 make_pint_irq(PINT_IRQ_BASE + i); 188 init_IRQ_pint();
271 for(i = 0; i < 256; i++) 189#endif
272 {
273 if(i & 1) pint_map[i] = 0;
274 else if(i & 2) pint_map[i] = 1;
275 else if(i & 4) pint_map[i] = 2;
276 else if(i & 8) pint_map[i] = 3;
277 else if(i & 0x10) pint_map[i] = 4;
278 else if(i & 0x20) pint_map[i] = 5;
279 else if(i & 0x40) pint_map[i] = 6;
280 else if(i & 0x80) pint_map[i] = 7;
281 }
282#endif /* !CONFIG_CPU_SUBTYPE_SH7300 */
283#endif /* CONFIG_CPU_SUBTYPE_SH7707 || CONFIG_CPU_SUBTYPE_SH7709 || CONFIG_CPU_SUBTYPE_SH7300*/
284 190
285#ifdef CONFIG_CPU_SUBTYPE_ST40 191#ifdef CONFIG_CPU_HAS_INTC2_IRQ
286 init_IRQ_intc2(); 192 init_IRQ_intc2();
287#endif 193#endif
288
289 /* Perform the machine specific initialisation */ 194 /* Perform the machine specific initialisation */
290 if (sh_mv.mv_init_irq != NULL) { 195 if (sh_mv.mv_init_irq != NULL)
291 sh_mv.mv_init_irq(); 196 sh_mv.mv_init_irq();
292 }
293} 197}
294#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) || \ 198
295 defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7705) 199#if !defined(CONFIG_CPU_HAS_PINT_IRQ)
296int ipr_irq_demux(int irq) 200int ipr_irq_demux(int irq)
297{ 201{
298#if !defined(CONFIG_CPU_SUBTYPE_SH7300)
299 unsigned long creg, dreg, d, sav;
300
301 if(irq == PINT0_IRQ)
302 {
303#if defined(CONFIG_CPU_SUBTYPE_SH7707)
304 creg = PORT_PACR;
305 dreg = PORT_PADR;
306#else
307 creg = PORT_PCCR;
308 dreg = PORT_PCDR;
309#endif
310 sav = ctrl_inw(creg);
311 ctrl_outw(sav | portcr_mask, creg);
312 d = (~ctrl_inb(dreg) ^ ctrl_inw(INTC_ICR2)) & ctrl_inw(INTC_INTER) & 0xff;
313 ctrl_outw(sav, creg);
314 if(d == 0) return irq;
315 return PINT_IRQ_BASE + pint_map[d];
316 }
317 else if(irq == PINT8_IRQ)
318 {
319#if defined(CONFIG_CPU_SUBTYPE_SH7707)
320 creg = PORT_PBCR;
321 dreg = PORT_PBDR;
322#else
323 creg = PORT_PFCR;
324 dreg = PORT_PFDR;
325#endif
326 sav = ctrl_inw(creg);
327 ctrl_outw(sav | (portcr_mask >> 16), creg);
328 d = (~ctrl_inb(dreg) ^ (ctrl_inw(INTC_ICR2) >> 8)) & (ctrl_inw(INTC_INTER) >> 8) & 0xff;
329 ctrl_outw(sav, creg);
330 if(d == 0) return irq;
331 return PINT_IRQ_BASE + 8 + pint_map[d];
332 }
333#endif
334 return irq; 202 return irq;
335} 203}
336#endif 204#endif
337 205
338EXPORT_SYMBOL(make_ipr_irq); 206EXPORT_SYMBOL(make_ipr_irq);
339
diff --git a/arch/sh/kernel/cpu/irq/pint.c b/arch/sh/kernel/cpu/irq/pint.c
new file mode 100644
index 000000000000..95d6024fe1ae
--- /dev/null
+++ b/arch/sh/kernel/cpu/irq/pint.c
@@ -0,0 +1,169 @@
1/*
2 * arch/sh/kernel/cpu/irq/pint.c - Interrupt handling for PINT-based IRQs.
3 *
4 * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi
5 * Copyright (C) 2000 Kazumoto Kojima
6 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
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
13#include <linux/config.h>
14#include <linux/init.h>
15#include <linux/irq.h>
16#include <linux/module.h>
17
18#include <asm/system.h>
19#include <asm/io.h>
20#include <asm/machvec.h>
21
22static unsigned char pint_map[256];
23static unsigned long portcr_mask;
24
25static void enable_pint_irq(unsigned int irq);
26static void disable_pint_irq(unsigned int irq);
27
28/* shutdown is same as "disable" */
29#define shutdown_pint_irq disable_pint_irq
30
31static void mask_and_ack_pint(unsigned int);
32static void end_pint_irq(unsigned int irq);
33
34static unsigned int startup_pint_irq(unsigned int irq)
35{
36 enable_pint_irq(irq);
37 return 0; /* never anything pending */
38}
39
40static struct hw_interrupt_type pint_irq_type = {
41 .typename = "PINT-IRQ",
42 .startup = startup_pint_irq,
43 .shutdown = shutdown_pint_irq,
44 .enable = enable_pint_irq,
45 .disable = disable_pint_irq,
46 .ack = mask_and_ack_pint,
47 .end = end_pint_irq
48};
49
50static void disable_pint_irq(unsigned int irq)
51{
52 unsigned long val, flags;
53
54 local_irq_save(flags);
55 val = ctrl_inw(INTC_INTER);
56 val &= ~(1 << (irq - PINT_IRQ_BASE));
57 ctrl_outw(val, INTC_INTER); /* disable PINTn */
58 portcr_mask &= ~(3 << (irq - PINT_IRQ_BASE)*2);
59 local_irq_restore(flags);
60}
61
62static void enable_pint_irq(unsigned int irq)
63{
64 unsigned long val, flags;
65
66 local_irq_save(flags);
67 val = ctrl_inw(INTC_INTER);
68 val |= 1 << (irq - PINT_IRQ_BASE);
69 ctrl_outw(val, INTC_INTER); /* enable PINTn */
70 portcr_mask |= 3 << (irq - PINT_IRQ_BASE)*2;
71 local_irq_restore(flags);
72}
73
74static void mask_and_ack_pint(unsigned int irq)
75{
76 disable_pint_irq(irq);
77}
78
79static void end_pint_irq(unsigned int irq)
80{
81 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
82 enable_pint_irq(irq);
83}
84
85void make_pint_irq(unsigned int irq)
86{
87 disable_irq_nosync(irq);
88 irq_desc[irq].handler = &pint_irq_type;
89 disable_pint_irq(irq);
90}
91
92void __init init_IRQ_pint(void)
93{
94 int i;
95
96 make_ipr_irq(PINT0_IRQ, PINT0_IPR_ADDR, PINT0_IPR_POS, PINT0_PRIORITY);
97 make_ipr_irq(PINT8_IRQ, PINT8_IPR_ADDR, PINT8_IPR_POS, PINT8_PRIORITY);
98
99 enable_irq(PINT0_IRQ);
100 enable_irq(PINT8_IRQ);
101
102 for(i = 0; i < 16; i++)
103 make_pint_irq(PINT_IRQ_BASE + i);
104
105 for(i = 0; i < 256; i++) {
106 if (i & 1)
107 pint_map[i] = 0;
108 else if (i & 2)
109 pint_map[i] = 1;
110 else if (i & 4)
111 pint_map[i] = 2;
112 else if (i & 8)
113 pint_map[i] = 3;
114 else if (i & 0x10)
115 pint_map[i] = 4;
116 else if (i & 0x20)
117 pint_map[i] = 5;
118 else if (i & 0x40)
119 pint_map[i] = 6;
120 else if (i & 0x80)
121 pint_map[i] = 7;
122 }
123}
124
125int ipr_irq_demux(int irq)
126{
127 unsigned long creg, dreg, d, sav;
128
129 if (irq == PINT0_IRQ) {
130#if defined(CONFIG_CPU_SUBTYPE_SH7707)
131 creg = PORT_PACR;
132 dreg = PORT_PADR;
133#else
134 creg = PORT_PCCR;
135 dreg = PORT_PCDR;
136#endif
137 sav = ctrl_inw(creg);
138 ctrl_outw(sav | portcr_mask, creg);
139 d = (~ctrl_inb(dreg) ^ ctrl_inw(INTC_ICR2)) &
140 ctrl_inw(INTC_INTER) & 0xff;
141 ctrl_outw(sav, creg);
142
143 if (d == 0)
144 return irq;
145
146 return PINT_IRQ_BASE + pint_map[d];
147 } else if (irq == PINT8_IRQ) {
148#if defined(CONFIG_CPU_SUBTYPE_SH7707)
149 creg = PORT_PBCR;
150 dreg = PORT_PBDR;
151#else
152 creg = PORT_PFCR;
153 dreg = PORT_PFDR;
154#endif
155 sav = ctrl_inw(creg);
156 ctrl_outw(sav | (portcr_mask >> 16), creg);
157 d = (~ctrl_inb(dreg) ^ (ctrl_inw(INTC_ICR2) >> 8)) &
158 (ctrl_inw(INTC_INTER) >> 8) & 0xff;
159 ctrl_outw(sav, creg);
160
161 if (d == 0)
162 return irq;
163
164 return PINT_IRQ_BASE + 8 + pint_map[d];
165 }
166
167 return irq;
168}
169
diff --git a/arch/sh/kernel/cpu/sh3/Makefile b/arch/sh/kernel/cpu/sh3/Makefile
index a64532e4dc63..b54dbb9a0c86 100644
--- a/arch/sh/kernel/cpu/sh3/Makefile
+++ b/arch/sh/kernel/cpu/sh3/Makefile
@@ -4,3 +4,10 @@
4 4
5obj-y := ex.o probe.o 5obj-y := ex.o probe.o
6 6
7clock-$(CONFIG_CPU_SH3) := clock-sh3.o
8clock-$(CONFIG_CPU_SUBTYPE_SH7300) := clock-sh7300.o
9clock-$(CONFIG_CPU_SUBTYPE_SH7705) := clock-sh7705.o
10clock-$(CONFIG_CPU_SUBTYPE_SH7709) := clock-sh7709.o
11
12obj-y += $(clock-y)
13
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh3.c b/arch/sh/kernel/cpu/sh3/clock-sh3.c
new file mode 100644
index 000000000000..c3c945958baf
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh3/clock-sh3.c
@@ -0,0 +1,89 @@
1/*
2 * arch/sh/kernel/cpu/sh3/clock-sh3.c
3 *
4 * Generic SH-3 support for the clock framework
5 *
6 * Copyright (C) 2005 Paul Mundt
7 *
8 * FRQCR parsing hacked out of arch/sh/kernel/time.c
9 *
10 * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka
11 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
12 * Copyright (C) 2002, 2003, 2004 Paul Mundt
13 * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org>
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <asm/clock.h>
22#include <asm/freq.h>
23#include <asm/io.h>
24
25static int stc_multipliers[] = { 1, 2, 3, 4, 6, 1, 1, 1 };
26static int ifc_divisors[] = { 1, 2, 3, 4, 1, 1, 1, 1 };
27static int pfc_divisors[] = { 1, 2, 3, 4, 6, 1, 1, 1 };
28
29static void master_clk_init(struct clk *clk)
30{
31 int frqcr = ctrl_inw(FRQCR);
32 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
33
34 clk->rate *= pfc_divisors[idx];
35}
36
37static struct clk_ops sh3_master_clk_ops = {
38 .init = master_clk_init,
39};
40
41static void module_clk_recalc(struct clk *clk)
42{
43 int frqcr = ctrl_inw(FRQCR);
44 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
45
46 clk->rate = clk->parent->rate / pfc_divisors[idx];
47}
48
49static struct clk_ops sh3_module_clk_ops = {
50 .recalc = module_clk_recalc,
51};
52
53static void bus_clk_recalc(struct clk *clk)
54{
55 int frqcr = ctrl_inw(FRQCR);
56 int idx = ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4);
57
58 clk->rate = clk->parent->rate / stc_multipliers[idx];
59}
60
61static struct clk_ops sh3_bus_clk_ops = {
62 .recalc = bus_clk_recalc,
63};
64
65static void cpu_clk_recalc(struct clk *clk)
66{
67 int frqcr = ctrl_inw(FRQCR);
68 int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
69
70 clk->rate = clk->parent->rate / ifc_divisors[idx];
71}
72
73static struct clk_ops sh3_cpu_clk_ops = {
74 .recalc = cpu_clk_recalc,
75};
76
77static struct clk_ops *sh3_clk_ops[] = {
78 &sh3_master_clk_ops,
79 &sh3_module_clk_ops,
80 &sh3_bus_clk_ops,
81 &sh3_cpu_clk_ops,
82};
83
84void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
85{
86 if (idx < ARRAY_SIZE(sh3_clk_ops))
87 *ops = sh3_clk_ops[idx];
88}
89
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7300.c b/arch/sh/kernel/cpu/sh3/clock-sh7300.c
new file mode 100644
index 000000000000..e804174b9625
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7300.c
@@ -0,0 +1,78 @@
1/*
2 * arch/sh/kernel/cpu/sh3/clock-sh7300.c
3 *
4 * SH7300 support for the clock framework
5 *
6 * Copyright (C) 2005 Paul Mundt
7 *
8 * FRQCR parsing hacked out of arch/sh/kernel/time.c
9 *
10 * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka
11 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
12 * Copyright (C) 2002, 2003, 2004 Paul Mundt
13 * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org>
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <asm/clock.h>
22#include <asm/freq.h>
23#include <asm/io.h>
24
25static int md_table[] = { 1, 2, 3, 4, 6, 8, 12 };
26
27static void master_clk_init(struct clk *clk)
28{
29 clk->rate *= md_table[ctrl_inw(FRQCR) & 0x0007];
30}
31
32static struct clk_ops sh7300_master_clk_ops = {
33 .init = master_clk_init,
34};
35
36static void module_clk_recalc(struct clk *clk)
37{
38 int idx = (ctrl_inw(FRQCR) & 0x0007);
39 clk->rate = clk->parent->rate / md_table[idx];
40}
41
42static struct clk_ops sh7300_module_clk_ops = {
43 .recalc = module_clk_recalc,
44};
45
46static void bus_clk_recalc(struct clk *clk)
47{
48 int idx = (ctrl_inw(FRQCR) & 0x0700) >> 8;
49 clk->rate = clk->parent->rate / md_table[idx];
50}
51
52static struct clk_ops sh7300_bus_clk_ops = {
53 .recalc = bus_clk_recalc,
54};
55
56static void cpu_clk_recalc(struct clk *clk)
57{
58 int idx = (ctrl_inw(FRQCR) & 0x0070) >> 4;
59 clk->rate = clk->parent->rate / md_table[idx];
60}
61
62static struct clk_ops sh7300_cpu_clk_ops = {
63 .recalc = cpu_clk_recalc,
64};
65
66static struct clk_ops *sh7300_clk_ops[] = {
67 &sh7300_master_clk_ops,
68 &sh7300_module_clk_ops,
69 &sh7300_bus_clk_ops,
70 &sh7300_cpu_clk_ops,
71};
72
73void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
74{
75 if (idx < ARRAY_SIZE(sh7300_clk_ops))
76 *ops = sh7300_clk_ops[idx];
77}
78
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7705.c b/arch/sh/kernel/cpu/sh3/clock-sh7705.c
new file mode 100644
index 000000000000..dfdbf3277fd7
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7705.c
@@ -0,0 +1,84 @@
1/*
2 * arch/sh/kernel/cpu/sh3/clock-sh7705.c
3 *
4 * SH7705 support for the clock framework
5 *
6 * Copyright (C) 2005 Paul Mundt
7 *
8 * FRQCR parsing hacked out of arch/sh/kernel/time.c
9 *
10 * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka
11 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
12 * Copyright (C) 2002, 2003, 2004 Paul Mundt
13 * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org>
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <asm/clock.h>
22#include <asm/freq.h>
23#include <asm/io.h>
24
25/*
26 * SH7705 uses the same divisors as the generic SH-3 case, it's just the
27 * FRQCR layout that is a bit different..
28 */
29static int stc_multipliers[] = { 1, 2, 3, 4, 6, 1, 1, 1 };
30static int ifc_divisors[] = { 1, 2, 3, 4, 1, 1, 1, 1 };
31static int pfc_divisors[] = { 1, 2, 3, 4, 6, 1, 1, 1 };
32
33static void master_clk_init(struct clk *clk)
34{
35 clk->rate *= pfc_divisors[ctrl_inw(FRQCR) & 0x0003];
36}
37
38static struct clk_ops sh7705_master_clk_ops = {
39 .init = master_clk_init,
40};
41
42static void module_clk_recalc(struct clk *clk)
43{
44 int idx = ctrl_inw(FRQCR) & 0x0003;
45 clk->rate = clk->parent->rate / pfc_divisors[idx];
46}
47
48static struct clk_ops sh7705_module_clk_ops = {
49 .recalc = module_clk_recalc,
50};
51
52static void bus_clk_recalc(struct clk *clk)
53{
54 int idx = (ctrl_inw(FRQCR) & 0x0300) >> 8;
55 clk->rate = clk->parent->rate / stc_multipliers[idx];
56}
57
58static struct clk_ops sh7705_bus_clk_ops = {
59 .recalc = bus_clk_recalc,
60};
61
62static void cpu_clk_recalc(struct clk *clk)
63{
64 int idx = (ctrl_inw(FRQCR) & 0x0030) >> 4;
65 clk->rate = clk->parent->rate / ifc_divisors[idx];
66}
67
68static struct clk_ops sh7705_cpu_clk_ops = {
69 .recalc = cpu_clk_recalc,
70};
71
72static struct clk_ops *sh7705_clk_ops[] = {
73 &sh7705_master_clk_ops,
74 &sh7705_module_clk_ops,
75 &sh7705_bus_clk_ops,
76 &sh7705_cpu_clk_ops,
77};
78
79void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
80{
81 if (idx < ARRAY_SIZE(sh7705_clk_ops))
82 *ops = sh7705_clk_ops[idx];
83}
84
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7709.c b/arch/sh/kernel/cpu/sh3/clock-sh7709.c
new file mode 100644
index 000000000000..10461a745e5f
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7709.c
@@ -0,0 +1,96 @@
1/*
2 * arch/sh/kernel/cpu/sh3/clock-sh7709.c
3 *
4 * SH7709 support for the clock framework
5 *
6 * Copyright (C) 2005 Andriy Skulysh
7 *
8 * Based on arch/sh/kernel/cpu/sh3/clock-sh7705.c
9 * Copyright (C) 2005 Paul Mundt
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file "COPYING" in the main directory of this archive
13 * for more details.
14 */
15#include <linux/init.h>
16#include <linux/kernel.h>
17#include <asm/clock.h>
18#include <asm/freq.h>
19#include <asm/io.h>
20
21static int stc_multipliers[] = { 1, 2, 4, 8, 3, 6, 1, 1 };
22static int ifc_divisors[] = { 1, 2, 4, 1, 3, 1, 1, 1 };
23static int pfc_divisors[] = { 1, 2, 4, 1, 3, 6, 1, 1 };
24
25static void set_bus_parent(struct clk *clk)
26{
27 struct clk *bus_clk = clk_get("bus_clk");
28 clk->parent = bus_clk;
29 clk_put(bus_clk);
30}
31
32static void master_clk_init(struct clk *clk)
33{
34 int frqcr = ctrl_inw(FRQCR);
35 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
36
37 clk->rate *= pfc_divisors[idx];
38}
39
40static struct clk_ops sh7709_master_clk_ops = {
41 .init = master_clk_init,
42};
43
44static void module_clk_recalc(struct clk *clk)
45{
46 int frqcr = ctrl_inw(FRQCR);
47 int idx = ((frqcr & 0x2000) >> 11) | (frqcr & 0x0003);
48
49 clk->rate = clk->parent->rate / pfc_divisors[idx];
50}
51
52static struct clk_ops sh7709_module_clk_ops = {
53#ifdef CLOCK_MODE_0_1_2_7
54 .init = set_bus_parent,
55#endif
56 .recalc = module_clk_recalc,
57};
58
59static void bus_clk_recalc(struct clk *clk)
60{
61 int frqcr = ctrl_inw(FRQCR);
62 int idx = (frqcr & 0x0080) ?
63 ((frqcr & 0x8000) >> 13) | ((frqcr & 0x0030) >> 4) : 1;
64
65 clk->rate = clk->parent->rate * stc_multipliers[idx];
66}
67
68static struct clk_ops sh7709_bus_clk_ops = {
69 .recalc = bus_clk_recalc,
70};
71
72static void cpu_clk_recalc(struct clk *clk)
73{
74 int frqcr = ctrl_inw(FRQCR);
75 int idx = ((frqcr & 0x4000) >> 12) | ((frqcr & 0x000c) >> 2);
76
77 clk->rate = clk->parent->rate / ifc_divisors[idx];
78}
79
80static struct clk_ops sh7709_cpu_clk_ops = {
81 .init = set_bus_parent,
82 .recalc = cpu_clk_recalc,
83};
84
85static struct clk_ops *sh7709_clk_ops[] = {
86 &sh7709_master_clk_ops,
87 &sh7709_module_clk_ops,
88 &sh7709_bus_clk_ops,
89 &sh7709_cpu_clk_ops,
90};
91
92void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
93{
94 if (idx < ARRAY_SIZE(sh7709_clk_ops))
95 *ops = sh7709_clk_ops[idx];
96}
diff --git a/arch/sh/kernel/cpu/sh4/Makefile b/arch/sh/kernel/cpu/sh4/Makefile
index ead1071eac73..3d5cafc71ae3 100644
--- a/arch/sh/kernel/cpu/sh4/Makefile
+++ b/arch/sh/kernel/cpu/sh4/Makefile
@@ -5,6 +5,15 @@
5obj-y := ex.o probe.o 5obj-y := ex.o probe.o
6 6
7obj-$(CONFIG_SH_FPU) += fpu.o 7obj-$(CONFIG_SH_FPU) += fpu.o
8obj-$(CONFIG_CPU_SUBTYPE_ST40STB1) += irq_intc2.o
9obj-$(CONFIG_SH_STORE_QUEUES) += sq.o 8obj-$(CONFIG_SH_STORE_QUEUES) += sq.o
10 9
10# Primary on-chip clocks (common)
11clock-$(CONFIG_CPU_SH4) := clock-sh4.o
12clock-$(CONFIG_CPU_SUBTYPE_SH73180) := clock-sh73180.o
13clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o
14clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o
15
16# Additional clocks by subtype
17clock-$(CONFIG_CPU_SUBTYPE_SH4_202) += clock-sh4-202.o
18
19obj-y += $(clock-y)
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4-202.c b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
new file mode 100644
index 000000000000..bfdf5fe8d948
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4/clock-sh4-202.c
@@ -0,0 +1,179 @@
1/*
2 * arch/sh/kernel/cpu/sh4/clock-sh4-202.c
3 *
4 * Additional SH4-202 support for the clock framework
5 *
6 * Copyright (C) 2005 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/err.h>
15#include <asm/clock.h>
16#include <asm/freq.h>
17#include <asm/io.h>
18
19#define CPG2_FRQCR3 0xfe0a0018
20
21static int frqcr3_divisors[] = { 1, 2, 3, 4, 6, 8, 16 };
22static int frqcr3_values[] = { 0, 1, 2, 3, 4, 5, 6 };
23
24static void emi_clk_recalc(struct clk *clk)
25{
26 int idx = ctrl_inl(CPG2_FRQCR3) & 0x0007;
27 clk->rate = clk->parent->rate / frqcr3_divisors[idx];
28}
29
30static inline int frqcr3_lookup(struct clk *clk, unsigned long rate)
31{
32 int divisor = clk->parent->rate / rate;
33 int i;
34
35 for (i = 0; i < ARRAY_SIZE(frqcr3_divisors); i++)
36 if (frqcr3_divisors[i] == divisor)
37 return frqcr3_values[i];
38
39 /* Safe fallback */
40 return 5;
41}
42
43static struct clk_ops sh4202_emi_clk_ops = {
44 .recalc = emi_clk_recalc,
45};
46
47static struct clk sh4202_emi_clk = {
48 .name = "emi_clk",
49 .flags = CLK_ALWAYS_ENABLED,
50 .ops = &sh4202_emi_clk_ops,
51};
52
53static void femi_clk_recalc(struct clk *clk)
54{
55 int idx = (ctrl_inl(CPG2_FRQCR3) >> 3) & 0x0007;
56 clk->rate = clk->parent->rate / frqcr3_divisors[idx];
57}
58
59static struct clk_ops sh4202_femi_clk_ops = {
60 .recalc = femi_clk_recalc,
61};
62
63static struct clk sh4202_femi_clk = {
64 .name = "femi_clk",
65 .flags = CLK_ALWAYS_ENABLED,
66 .ops = &sh4202_femi_clk_ops,
67};
68
69static void shoc_clk_init(struct clk *clk)
70{
71 int i;
72
73 /*
74 * For some reason, the shoc_clk seems to be set to some really
75 * insane value at boot (values outside of the allowable frequency
76 * range for instance). We deal with this by scaling it back down
77 * to something sensible just in case.
78 *
79 * Start scaling from the high end down until we find something
80 * that passes rate verification..
81 */
82 for (i = 0; i < ARRAY_SIZE(frqcr3_divisors); i++) {
83 int divisor = frqcr3_divisors[i];
84
85 if (clk->ops->set_rate(clk, clk->parent->rate / divisor) == 0)
86 break;
87 }
88
89 WARN_ON(i == ARRAY_SIZE(frqcr3_divisors)); /* Undefined clock */
90}
91
92static void shoc_clk_recalc(struct clk *clk)
93{
94 int idx = (ctrl_inl(CPG2_FRQCR3) >> 6) & 0x0007;
95 clk->rate = clk->parent->rate / frqcr3_divisors[idx];
96}
97
98static int shoc_clk_verify_rate(struct clk *clk, unsigned long rate)
99{
100 struct clk *bclk = clk_get("bus_clk");
101 unsigned long bclk_rate = clk_get_rate(bclk);
102
103 clk_put(bclk);
104
105 if (rate > bclk_rate)
106 return 1;
107 if (rate > 66000000)
108 return 1;
109
110 return 0;
111}
112
113static int shoc_clk_set_rate(struct clk *clk, unsigned long rate)
114{
115 unsigned long frqcr3;
116 unsigned int tmp;
117
118 /* Make sure we have something sensible to switch to */
119 if (shoc_clk_verify_rate(clk, rate) != 0)
120 return -EINVAL;
121
122 tmp = frqcr3_lookup(clk, rate);
123
124 frqcr3 = ctrl_inl(CPG2_FRQCR3);
125 frqcr3 &= ~(0x0007 << 6);
126 frqcr3 |= tmp << 6;
127 ctrl_outl(frqcr3, CPG2_FRQCR3);
128
129 clk->rate = clk->parent->rate / frqcr3_divisors[tmp];
130
131 return 0;
132}
133
134static struct clk_ops sh4202_shoc_clk_ops = {
135 .init = shoc_clk_init,
136 .recalc = shoc_clk_recalc,
137 .set_rate = shoc_clk_set_rate,
138};
139
140static struct clk sh4202_shoc_clk = {
141 .name = "shoc_clk",
142 .flags = CLK_ALWAYS_ENABLED,
143 .ops = &sh4202_shoc_clk_ops,
144};
145
146static struct clk *sh4202_onchip_clocks[] = {
147 &sh4202_emi_clk,
148 &sh4202_femi_clk,
149 &sh4202_shoc_clk,
150};
151
152static int __init sh4202_clk_init(void)
153{
154 struct clk *clk = clk_get("master_clk");
155 int i;
156
157 for (i = 0; i < ARRAY_SIZE(sh4202_onchip_clocks); i++) {
158 struct clk *clkp = sh4202_onchip_clocks[i];
159
160 clkp->parent = clk;
161 clk_register(clkp);
162 clk_enable(clkp);
163 }
164
165 /*
166 * Now that we have the rest of the clocks registered, we need to
167 * force the parent clock to propagate so that these clocks will
168 * automatically figure out their rate. We cheat by handing the
169 * parent clock its current rate and forcing child propagation.
170 */
171 clk_set_rate(clk, clk_get_rate(clk));
172
173 clk_put(clk);
174
175 return 0;
176}
177
178arch_initcall(sh4202_clk_init);
179
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh4.c b/arch/sh/kernel/cpu/sh4/clock-sh4.c
new file mode 100644
index 000000000000..dca9f87a12d6
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4/clock-sh4.c
@@ -0,0 +1,80 @@
1/*
2 * arch/sh/kernel/cpu/sh4/clock-sh4.c
3 *
4 * Generic SH-4 support for the clock framework
5 *
6 * Copyright (C) 2005 Paul Mundt
7 *
8 * FRQCR parsing hacked out of arch/sh/kernel/time.c
9 *
10 * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka
11 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
12 * Copyright (C) 2002, 2003, 2004 Paul Mundt
13 * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org>
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <asm/clock.h>
22#include <asm/freq.h>
23#include <asm/io.h>
24
25static int ifc_divisors[] = { 1, 2, 3, 4, 6, 8, 1, 1 };
26#define bfc_divisors ifc_divisors /* Same */
27static int pfc_divisors[] = { 2, 3, 4, 6, 8, 2, 2, 2 };
28
29static void master_clk_init(struct clk *clk)
30{
31 clk->rate *= pfc_divisors[ctrl_inw(FRQCR) & 0x0007];
32}
33
34static struct clk_ops sh4_master_clk_ops = {
35 .init = master_clk_init,
36};
37
38static void module_clk_recalc(struct clk *clk)
39{
40 int idx = (ctrl_inw(FRQCR) & 0x0007);
41 clk->rate = clk->parent->rate / pfc_divisors[idx];
42}
43
44static struct clk_ops sh4_module_clk_ops = {
45 .recalc = module_clk_recalc,
46};
47
48static void bus_clk_recalc(struct clk *clk)
49{
50 int idx = (ctrl_inw(FRQCR) >> 3) & 0x0007;
51 clk->rate = clk->parent->rate / bfc_divisors[idx];
52}
53
54static struct clk_ops sh4_bus_clk_ops = {
55 .recalc = bus_clk_recalc,
56};
57
58static void cpu_clk_recalc(struct clk *clk)
59{
60 int idx = (ctrl_inw(FRQCR) >> 6) & 0x0007;
61 clk->rate = clk->parent->rate / ifc_divisors[idx];
62}
63
64static struct clk_ops sh4_cpu_clk_ops = {
65 .recalc = cpu_clk_recalc,
66};
67
68static struct clk_ops *sh4_clk_ops[] = {
69 &sh4_master_clk_ops,
70 &sh4_module_clk_ops,
71 &sh4_bus_clk_ops,
72 &sh4_cpu_clk_ops,
73};
74
75void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
76{
77 if (idx < ARRAY_SIZE(sh4_clk_ops))
78 *ops = sh4_clk_ops[idx];
79}
80
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh73180.c b/arch/sh/kernel/cpu/sh4/clock-sh73180.c
new file mode 100644
index 000000000000..2fa5cb2ae68d
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4/clock-sh73180.c
@@ -0,0 +1,81 @@
1/*
2 * arch/sh/kernel/cpu/sh4/clock-sh73180.c
3 *
4 * SH73180 support for the clock framework
5 *
6 * Copyright (C) 2005 Paul Mundt
7 *
8 * FRQCR parsing hacked out of arch/sh/kernel/time.c
9 *
10 * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka
11 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
12 * Copyright (C) 2002, 2003, 2004 Paul Mundt
13 * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org>
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <asm/clock.h>
22#include <asm/freq.h>
23#include <asm/io.h>
24
25/*
26 * SH73180 uses a common set of divisors, so this is quite simple..
27 */
28static int divisors[] = { 1, 2, 3, 4, 6, 8, 12, 16 };
29
30static void master_clk_init(struct clk *clk)
31{
32 clk->rate *= divisors[ctrl_inl(FRQCR) & 0x0007];
33}
34
35static struct clk_ops sh73180_master_clk_ops = {
36 .init = master_clk_init,
37};
38
39static void module_clk_recalc(struct clk *clk)
40{
41 int idx = (ctrl_inl(FRQCR) & 0x0007);
42 clk->rate = clk->parent->rate / divisors[idx];
43}
44
45static struct clk_ops sh73180_module_clk_ops = {
46 .recalc = module_clk_recalc,
47};
48
49static void bus_clk_recalc(struct clk *clk)
50{
51 int idx = (ctrl_inl(FRQCR) >> 12) & 0x0007;
52 clk->rate = clk->parent->rate / divisors[idx];
53}
54
55static struct clk_ops sh73180_bus_clk_ops = {
56 .recalc = bus_clk_recalc,
57};
58
59static void cpu_clk_recalc(struct clk *clk)
60{
61 int idx = (ctrl_inl(FRQCR) >> 20) & 0x0007;
62 clk->rate = clk->parent->rate / divisors[idx];
63}
64
65static struct clk_ops sh73180_cpu_clk_ops = {
66 .recalc = cpu_clk_recalc,
67};
68
69static struct clk_ops *sh73180_clk_ops[] = {
70 &sh73180_master_clk_ops,
71 &sh73180_module_clk_ops,
72 &sh73180_bus_clk_ops,
73 &sh73180_cpu_clk_ops,
74};
75
76void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
77{
78 if (idx < ARRAY_SIZE(sh73180_clk_ops))
79 *ops = sh73180_clk_ops[idx];
80}
81
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh7770.c b/arch/sh/kernel/cpu/sh4/clock-sh7770.c
new file mode 100644
index 000000000000..c8694bac6477
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4/clock-sh7770.c
@@ -0,0 +1,73 @@
1/*
2 * arch/sh/kernel/cpu/sh4/clock-sh7770.c
3 *
4 * SH7770 support for the clock framework
5 *
6 * Copyright (C) 2005 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 <asm/clock.h>
15#include <asm/freq.h>
16#include <asm/io.h>
17
18static int ifc_divisors[] = { 1, 1, 1, 1, 1, 1, 1, 1 };
19static int bfc_divisors[] = { 1, 1, 1, 1, 1, 8,12, 1 };
20static int pfc_divisors[] = { 1, 8, 1,10,12,16, 1, 1 };
21
22static void master_clk_init(struct clk *clk)
23{
24 clk->rate *= pfc_divisors[(ctrl_inl(FRQCR) >> 28) & 0x000f];
25}
26
27static struct clk_ops sh7770_master_clk_ops = {
28 .init = master_clk_init,
29};
30
31static void module_clk_recalc(struct clk *clk)
32{
33 int idx = ((ctrl_inl(FRQCR) >> 28) & 0x000f);
34 clk->rate = clk->parent->rate / pfc_divisors[idx];
35}
36
37static struct clk_ops sh7770_module_clk_ops = {
38 .recalc = module_clk_recalc,
39};
40
41static void bus_clk_recalc(struct clk *clk)
42{
43 int idx = (ctrl_inl(FRQCR) & 0x000f);
44 clk->rate = clk->parent->rate / bfc_divisors[idx];
45}
46
47static struct clk_ops sh7770_bus_clk_ops = {
48 .recalc = bus_clk_recalc,
49};
50
51static void cpu_clk_recalc(struct clk *clk)
52{
53 int idx = ((ctrl_inl(FRQCR) >> 24) & 0x000f);
54 clk->rate = clk->parent->rate / ifc_divisors[idx];
55}
56
57static struct clk_ops sh7770_cpu_clk_ops = {
58 .recalc = cpu_clk_recalc,
59};
60
61static struct clk_ops *sh7770_clk_ops[] = {
62 &sh7770_master_clk_ops,
63 &sh7770_module_clk_ops,
64 &sh7770_bus_clk_ops,
65 &sh7770_cpu_clk_ops,
66};
67
68void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
69{
70 if (idx < ARRAY_SIZE(sh7770_clk_ops))
71 *ops = sh7770_clk_ops[idx];
72}
73
diff --git a/arch/sh/kernel/cpu/sh4/clock-sh7780.c b/arch/sh/kernel/cpu/sh4/clock-sh7780.c
new file mode 100644
index 000000000000..93ad367342c9
--- /dev/null
+++ b/arch/sh/kernel/cpu/sh4/clock-sh7780.c
@@ -0,0 +1,126 @@
1/*
2 * arch/sh/kernel/cpu/sh4/clock-sh7780.c
3 *
4 * SH7780 support for the clock framework
5 *
6 * Copyright (C) 2005 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 <asm/clock.h>
15#include <asm/freq.h>
16#include <asm/io.h>
17
18static int ifc_divisors[] = { 2, 4 };
19static int bfc_divisors[] = { 1, 1, 1, 8, 12, 16, 24, 1 };
20static int pfc_divisors[] = { 1, 24, 24, 1 };
21static int cfc_divisors[] = { 1, 1, 4, 1, 6, 1, 1, 1 };
22
23static void master_clk_init(struct clk *clk)
24{
25 clk->rate *= pfc_divisors[ctrl_inl(FRQCR) & 0x0003];
26}
27
28static struct clk_ops sh7780_master_clk_ops = {
29 .init = master_clk_init,
30};
31
32static void module_clk_recalc(struct clk *clk)
33{
34 int idx = (ctrl_inl(FRQCR) & 0x0003);
35 clk->rate = clk->parent->rate / pfc_divisors[idx];
36}
37
38static struct clk_ops sh7780_module_clk_ops = {
39 .recalc = module_clk_recalc,
40};
41
42static void bus_clk_recalc(struct clk *clk)
43{
44 int idx = ((ctrl_inl(FRQCR) >> 16) & 0x0007);
45 clk->rate = clk->parent->rate / bfc_divisors[idx];
46}
47
48static struct clk_ops sh7780_bus_clk_ops = {
49 .recalc = bus_clk_recalc,
50};
51
52static void cpu_clk_recalc(struct clk *clk)
53{
54 int idx = ((ctrl_inl(FRQCR) >> 24) & 0x0001);
55 clk->rate = clk->parent->rate / ifc_divisors[idx];
56}
57
58static struct clk_ops sh7780_cpu_clk_ops = {
59 .recalc = cpu_clk_recalc,
60};
61
62static struct clk_ops *sh7780_clk_ops[] = {
63 &sh7780_master_clk_ops,
64 &sh7780_module_clk_ops,
65 &sh7780_bus_clk_ops,
66 &sh7780_cpu_clk_ops,
67};
68
69void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
70{
71 if (idx < ARRAY_SIZE(sh7780_clk_ops))
72 *ops = sh7780_clk_ops[idx];
73}
74
75static void shyway_clk_recalc(struct clk *clk)
76{
77 int idx = ((ctrl_inl(FRQCR) >> 20) & 0x0007);
78 clk->rate = clk->parent->rate / cfc_divisors[idx];
79}
80
81static struct clk_ops sh7780_shyway_clk_ops = {
82 .recalc = shyway_clk_recalc,
83};
84
85static struct clk sh7780_shyway_clk = {
86 .name = "shyway_clk",
87 .flags = CLK_ALWAYS_ENABLED,
88 .ops = &sh7780_shyway_clk_ops,
89};
90
91/*
92 * Additional SH7780-specific on-chip clocks that aren't already part of the
93 * clock framework
94 */
95static struct clk *sh7780_onchip_clocks[] = {
96 &sh7780_shyway_clk,
97};
98
99static int __init sh7780_clk_init(void)
100{
101 struct clk *clk = clk_get("master_clk");
102 int i;
103
104 for (i = 0; i < ARRAY_SIZE(sh7780_onchip_clocks); i++) {
105 struct clk *clkp = sh7780_onchip_clocks[i];
106
107 clkp->parent = clk;
108 clk_register(clkp);
109 clk_enable(clkp);
110 }
111
112 /*
113 * Now that we have the rest of the clocks registered, we need to
114 * force the parent clock to propagate so that these clocks will
115 * automatically figure out their rate. We cheat by handing the
116 * parent clock its current rate and forcing child propagation.
117 */
118 clk_set_rate(clk, clk_get_rate(clk));
119
120 clk_put(clk);
121
122 return 0;
123}
124
125arch_initcall(sh7780_clk_init);
126
diff --git a/arch/sh/kernel/cpu/sh4/irq_intc2.c b/arch/sh/kernel/cpu/sh4/irq_intc2.c
deleted file mode 100644
index f6b16ba01932..000000000000
--- a/arch/sh/kernel/cpu/sh4/irq_intc2.c
+++ /dev/null
@@ -1,222 +0,0 @@
1/*
2 * linux/arch/sh/kernel/irq_intc2.c
3 *
4 * Copyright (C) 2001 David J. Mckay (david.mckay@st.com)
5 *
6 * May be copied or modified under the terms of the GNU General Public
7 * License. See linux/COPYING for more information.
8 *
9 * Interrupt handling for INTC2-based IRQ.
10 *
11 * These are the "new Hitachi style" interrupts, as present on the
12 * Hitachi 7751 and the STM ST40 STB1.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/irq.h>
18
19#include <asm/system.h>
20#include <asm/io.h>
21#include <asm/machvec.h>
22
23
24struct intc2_data {
25 unsigned char msk_offset;
26 unsigned char msk_shift;
27#ifdef CONFIG_CPU_SUBTYPE_ST40
28 int (*clear_irq) (int);
29#endif
30};
31
32
33static struct intc2_data intc2_data[NR_INTC2_IRQS];
34
35static void enable_intc2_irq(unsigned int irq);
36static void disable_intc2_irq(unsigned int irq);
37
38/* shutdown is same as "disable" */
39#define shutdown_intc2_irq disable_intc2_irq
40
41static void mask_and_ack_intc2(unsigned int);
42static void end_intc2_irq(unsigned int irq);
43
44static unsigned int startup_intc2_irq(unsigned int irq)
45{
46 enable_intc2_irq(irq);
47 return 0; /* never anything pending */
48}
49
50static struct hw_interrupt_type intc2_irq_type = {
51 .typename = "INTC2-IRQ",
52 .startup = startup_intc2_irq,
53 .shutdown = shutdown_intc2_irq,
54 .enable = enable_intc2_irq,
55 .disable = disable_intc2_irq,
56 .ack = mask_and_ack_intc2,
57 .end = end_intc2_irq
58};
59
60static void disable_intc2_irq(unsigned int irq)
61{
62 int irq_offset = irq - INTC2_FIRST_IRQ;
63 int msk_shift, msk_offset;
64
65 // Sanity check
66 if((irq_offset<0) || (irq_offset>=NR_INTC2_IRQS))
67 return;
68
69 msk_shift = intc2_data[irq_offset].msk_shift;
70 msk_offset = intc2_data[irq_offset].msk_offset;
71
72 ctrl_outl(1<<msk_shift,
73 INTC2_BASE+INTC2_INTMSK_OFFSET+msk_offset);
74}
75
76static void enable_intc2_irq(unsigned int irq)
77{
78 int irq_offset = irq - INTC2_FIRST_IRQ;
79 int msk_shift, msk_offset;
80
81 /* Sanity check */
82 if((irq_offset<0) || (irq_offset>=NR_INTC2_IRQS))
83 return;
84
85 msk_shift = intc2_data[irq_offset].msk_shift;
86 msk_offset = intc2_data[irq_offset].msk_offset;
87
88 ctrl_outl(1<<msk_shift,
89 INTC2_BASE+INTC2_INTMSKCLR_OFFSET+msk_offset);
90}
91
92static void mask_and_ack_intc2(unsigned int irq)
93{
94 disable_intc2_irq(irq);
95}
96
97static void end_intc2_irq(unsigned int irq)
98{
99 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
100 enable_intc2_irq(irq);
101
102#ifdef CONFIG_CPU_SUBTYPE_ST40
103 if (intc2_data[irq - INTC2_FIRST_IRQ].clear_irq)
104 intc2_data[irq - INTC2_FIRST_IRQ].clear_irq (irq);
105#endif
106}
107
108/*
109 * Setup an INTC2 style interrupt.
110 * NOTE: Unlike IPR interrupts, parameters are not shifted by this code,
111 * allowing the use of the numbers straight out of the datasheet.
112 * For example:
113 * PIO1 which is INTPRI00[19,16] and INTMSK00[13]
114 * would be: ^ ^ ^ ^
115 * | | | |
116 * make_intc2_irq(84, 0, 16, 0, 13);
117 */
118void make_intc2_irq(unsigned int irq,
119 unsigned int ipr_offset, unsigned int ipr_shift,
120 unsigned int msk_offset, unsigned int msk_shift,
121 unsigned int priority)
122{
123 int irq_offset = irq - INTC2_FIRST_IRQ;
124 unsigned int flags;
125 unsigned long ipr;
126
127 if((irq_offset<0) || (irq_offset>=NR_INTC2_IRQS))
128 return;
129
130 disable_irq_nosync(irq);
131
132 /* Fill the data we need */
133 intc2_data[irq_offset].msk_offset = msk_offset;
134 intc2_data[irq_offset].msk_shift = msk_shift;
135#ifdef CONFIG_CPU_SUBTYPE_ST40
136 intc2_data[irq_offset].clear_irq = NULL;
137#endif
138
139 /* Set the priority level */
140 local_irq_save(flags);
141
142 ipr=ctrl_inl(INTC2_BASE+INTC2_INTPRI_OFFSET+ipr_offset);
143 ipr&=~(0xf<<ipr_shift);
144 ipr|=(priority)<<ipr_shift;
145 ctrl_outl(ipr, INTC2_BASE+INTC2_INTPRI_OFFSET+ipr_offset);
146
147 local_irq_restore(flags);
148
149 irq_desc[irq].handler=&intc2_irq_type;
150
151 disable_intc2_irq(irq);
152}
153
154#ifdef CONFIG_CPU_SUBTYPE_ST40
155
156struct intc2_init {
157 unsigned short irq;
158 unsigned char ipr_offset, ipr_shift;
159 unsigned char msk_offset, msk_shift;
160};
161
162static struct intc2_init intc2_init_data[] __initdata = {
163 {64, 0, 0, 0, 0}, /* PCI serr */
164 {65, 0, 4, 0, 1}, /* PCI err */
165 {66, 0, 4, 0, 2}, /* PCI ad */
166 {67, 0, 4, 0, 3}, /* PCI pwd down */
167 {72, 0, 8, 0, 5}, /* DMAC INT0 */
168 {73, 0, 8, 0, 6}, /* DMAC INT1 */
169 {74, 0, 8, 0, 7}, /* DMAC INT2 */
170 {75, 0, 8, 0, 8}, /* DMAC INT3 */
171 {76, 0, 8, 0, 9}, /* DMAC INT4 */
172 {78, 0, 8, 0, 11}, /* DMAC ERR */
173 {80, 0, 12, 0, 12}, /* PIO0 */
174 {84, 0, 16, 0, 13}, /* PIO1 */
175 {88, 0, 20, 0, 14}, /* PIO2 */
176 {112, 4, 0, 4, 0}, /* Mailbox */
177#ifdef CONFIG_CPU_SUBTYPE_ST40GX1
178 {116, 4, 4, 4, 4}, /* SSC0 */
179 {120, 4, 8, 4, 8}, /* IR Blaster */
180 {124, 4, 12, 4, 12}, /* USB host */
181 {128, 4, 16, 4, 16}, /* Video processor BLITTER */
182 {132, 4, 20, 4, 20}, /* UART0 */
183 {134, 4, 20, 4, 22}, /* UART2 */
184 {136, 4, 24, 4, 24}, /* IO_PIO0 */
185 {140, 4, 28, 4, 28}, /* EMPI */
186 {144, 8, 0, 8, 0}, /* MAFE */
187 {148, 8, 4, 8, 4}, /* PWM */
188 {152, 8, 8, 8, 8}, /* SSC1 */
189 {156, 8, 12, 8, 12}, /* IO_PIO1 */
190 {160, 8, 16, 8, 16}, /* USB target */
191 {164, 8, 20, 8, 20}, /* UART1 */
192 {168, 8, 24, 8, 24}, /* Teletext */
193 {172, 8, 28, 8, 28}, /* VideoSync VTG */
194 {173, 8, 28, 8, 29}, /* VideoSync DVP0 */
195 {174, 8, 28, 8, 30}, /* VideoSync DVP1 */
196#endif
197};
198
199void __init init_IRQ_intc2(void)
200{
201 struct intc2_init *p;
202
203 printk(KERN_ALERT "init_IRQ_intc2\n");
204
205 for (p = intc2_init_data;
206 p<intc2_init_data+ARRAY_SIZE(intc2_init_data);
207 p++) {
208 make_intc2_irq(p->irq, p->ipr_offset, p->ipr_shift,
209 p-> msk_offset, p->msk_shift, 13);
210 }
211}
212
213/* Adds a termination callback to the interrupt */
214void intc2_add_clear_irq(int irq, int (*fn)(int))
215{
216 if (irq < INTC2_FIRST_IRQ)
217 return;
218
219 intc2_data[irq - INTC2_FIRST_IRQ].clear_irq = fn;
220}
221
222#endif /* CONFIG_CPU_SUBTYPE_ST40 */
diff --git a/arch/sh/kernel/io.c b/arch/sh/kernel/io.c
index d9932f25993b..71c9fde2fd90 100644
--- a/arch/sh/kernel/io.c
+++ b/arch/sh/kernel/io.c
@@ -2,58 +2,73 @@
2 * linux/arch/sh/kernel/io.c 2 * linux/arch/sh/kernel/io.c
3 * 3 *
4 * Copyright (C) 2000 Stuart Menefy 4 * Copyright (C) 2000 Stuart Menefy
5 * Copyright (C) 2005 Paul Mundt
5 * 6 *
6 * Provide real functions which expand to whatever the header file defined. 7 * Provide real functions which expand to whatever the header file defined.
7 * Also definitions of machine independent IO functions. 8 * Also definitions of machine independent IO functions.
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.
8 */ 13 */
9
10#include <asm/io.h>
11#include <linux/module.h> 14#include <linux/module.h>
15#include <asm/machvec.h>
16#include <asm/io.h>
12 17
13/* 18/*
14 * Copy data from IO memory space to "real" memory space. 19 * Copy data from IO memory space to "real" memory space.
15 * This needs to be optimized. 20 * This needs to be optimized.
16 */ 21 */
17void memcpy_fromio(void * to, unsigned long from, unsigned long count) 22void memcpy_fromio(void *to, volatile void __iomem *from, unsigned long count)
18{ 23{
19 char *p = to; 24 char *p = to;
20 while (count) { 25 while (count) {
21 count--; 26 count--;
22 *p = readb(from); 27 *p = readb((void __iomem *)from);
23 p++; 28 p++;
24 from++; 29 from++;
25 } 30 }
26} 31}
27 32EXPORT_SYMBOL(memcpy_fromio);
33
28/* 34/*
29 * Copy data from "real" memory space to IO memory space. 35 * Copy data from "real" memory space to IO memory space.
30 * This needs to be optimized. 36 * This needs to be optimized.
31 */ 37 */
32void memcpy_toio(unsigned long to, const void * from, unsigned long count) 38void memcpy_toio(volatile void __iomem *to, const void *from, unsigned long count)
33{ 39{
34 const char *p = from; 40 const char *p = from;
35 while (count) { 41 while (count) {
36 count--; 42 count--;
37 writeb(*p, to); 43 writeb(*p, (void __iomem *)to);
38 p++; 44 p++;
39 to++; 45 to++;
40 } 46 }
41} 47}
42 48EXPORT_SYMBOL(memcpy_toio);
49
43/* 50/*
44 * "memset" on IO memory space. 51 * "memset" on IO memory space.
45 * This needs to be optimized. 52 * This needs to be optimized.
46 */ 53 */
47void memset_io(unsigned long dst, int c, unsigned long count) 54void memset_io(volatile void __iomem *dst, int c, unsigned long count)
48{ 55{
49 while (count) { 56 while (count) {
50 count--; 57 count--;
51 writeb(c, dst); 58 writeb(c, (void __iomem *)dst);
52 dst++; 59 dst++;
53 } 60 }
54} 61}
55
56EXPORT_SYMBOL(memcpy_fromio);
57EXPORT_SYMBOL(memcpy_toio);
58EXPORT_SYMBOL(memset_io); 62EXPORT_SYMBOL(memset_io);
59 63
64void __iomem *ioport_map(unsigned long port, unsigned int nr)
65{
66 return sh_mv.mv_ioport_map(port, nr);
67}
68EXPORT_SYMBOL(ioport_map);
69
70void ioport_unmap(void __iomem *addr)
71{
72 sh_mv.mv_ioport_unmap(addr);
73}
74EXPORT_SYMBOL(ioport_unmap);
diff --git a/arch/sh/kernel/io_generic.c b/arch/sh/kernel/io_generic.c
index a911b0149d1f..28ec7487de8c 100644
--- a/arch/sh/kernel/io_generic.c
+++ b/arch/sh/kernel/io_generic.c
@@ -3,6 +3,7 @@
3 * linux/arch/sh/kernel/io_generic.c 3 * linux/arch/sh/kernel/io_generic.c
4 * 4 *
5 * Copyright (C) 2000 Niibe Yutaka 5 * Copyright (C) 2000 Niibe Yutaka
6 * Copyright (C) 2005 Paul Mundt
6 * 7 *
7 * Generic I/O routine. These can be used where a machine specific version 8 * Generic I/O routine. These can be used where a machine specific version
8 * is not required. 9 * is not required.
@@ -10,21 +11,20 @@
10 * This file is subject to the terms and conditions of the GNU General Public 11 * 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 * License. See the file "COPYING" in the main directory of this archive
12 * for more details. 13 * for more details.
13 *
14 */ 14 */
15 15#include <linux/module.h>
16#include <asm/io.h> 16#include <asm/io.h>
17#include <asm/machvec.h> 17#include <asm/machvec.h>
18#include <linux/module.h>
19 18
20#if defined(CONFIG_CPU_SH3) 19#ifdef CONFIG_CPU_SH3
20/* SH3 has a PCMCIA bug that needs a dummy read from area 6 for a
21 * workaround. */
21/* I'm not sure SH7709 has this kind of bug */ 22/* I'm not sure SH7709 has this kind of bug */
22#define SH3_PCMCIA_BUG_WORKAROUND 1 23#define dummy_read() ctrl_inb(0xba000000)
23#define DUMMY_READ_AREA6 0xba000000 24#else
25#define dummy_read()
24#endif 26#endif
25 27
26#define PORT2ADDR(x) (sh_mv.mv_isa_port2addr(x))
27
28unsigned long generic_io_base; 28unsigned long generic_io_base;
29 29
30static inline void delay(void) 30static inline void delay(void)
@@ -32,40 +32,40 @@ static inline void delay(void)
32 ctrl_inw(0xa0000000); 32 ctrl_inw(0xa0000000);
33} 33}
34 34
35unsigned char generic_inb(unsigned long port) 35u8 generic_inb(unsigned long port)
36{ 36{
37 return *(volatile unsigned char*)PORT2ADDR(port); 37 return ctrl_inb((unsigned long __force)ioport_map(port, 1));
38} 38}
39 39
40unsigned short generic_inw(unsigned long port) 40u16 generic_inw(unsigned long port)
41{ 41{
42 return *(volatile unsigned short*)PORT2ADDR(port); 42 return ctrl_inw((unsigned long __force)ioport_map(port, 2));
43} 43}
44 44
45unsigned int generic_inl(unsigned long port) 45u32 generic_inl(unsigned long port)
46{ 46{
47 return *(volatile unsigned long*)PORT2ADDR(port); 47 return ctrl_inl((unsigned long __force)ioport_map(port, 4));
48} 48}
49 49
50unsigned char generic_inb_p(unsigned long port) 50u8 generic_inb_p(unsigned long port)
51{ 51{
52 unsigned long v = *(volatile unsigned char*)PORT2ADDR(port); 52 unsigned long v = generic_inb(port);
53 53
54 delay(); 54 delay();
55 return v; 55 return v;
56} 56}
57 57
58unsigned short generic_inw_p(unsigned long port) 58u16 generic_inw_p(unsigned long port)
59{ 59{
60 unsigned long v = *(volatile unsigned short*)PORT2ADDR(port); 60 unsigned long v = generic_inw(port);
61 61
62 delay(); 62 delay();
63 return v; 63 return v;
64} 64}
65 65
66unsigned int generic_inl_p(unsigned long port) 66u32 generic_inl_p(unsigned long port)
67{ 67{
68 unsigned long v = *(volatile unsigned long*)PORT2ADDR(port); 68 unsigned long v = generic_inl(port);
69 69
70 delay(); 70 delay();
71 return v; 71 return v;
@@ -77,75 +77,70 @@ unsigned int generic_inl_p(unsigned long port)
77 * convert the port address to real address once. 77 * convert the port address to real address once.
78 */ 78 */
79 79
80void generic_insb(unsigned long port, void *buffer, unsigned long count) 80void generic_insb(unsigned long port, void *dst, unsigned long count)
81{ 81{
82 volatile unsigned char *port_addr; 82 volatile u8 *port_addr;
83 unsigned char *buf=buffer; 83 u8 *buf = dst;
84
85 port_addr = (volatile unsigned char *)PORT2ADDR(port);
86 84
87 while(count--) 85 port_addr = (volatile u8 *)ioport_map(port, 1);
88 *buf++ = *port_addr; 86 while (count--)
87 *buf++ = *port_addr;
89} 88}
90 89
91void generic_insw(unsigned long port, void *buffer, unsigned long count) 90void generic_insw(unsigned long port, void *dst, unsigned long count)
92{ 91{
93 volatile unsigned short *port_addr; 92 volatile u16 *port_addr;
94 unsigned short *buf=buffer; 93 u16 *buf = dst;
95 94
96 port_addr = (volatile unsigned short *)PORT2ADDR(port); 95 port_addr = (volatile u16 *)ioport_map(port, 2);
96 while (count--)
97 *buf++ = *port_addr;
97 98
98 while(count--) 99 dummy_read();
99 *buf++ = *port_addr;
100#ifdef SH3_PCMCIA_BUG_WORKAROUND
101 ctrl_inb (DUMMY_READ_AREA6);
102#endif
103} 100}
104 101
105void generic_insl(unsigned long port, void *buffer, unsigned long count) 102void generic_insl(unsigned long port, void *dst, unsigned long count)
106{ 103{
107 volatile unsigned long *port_addr; 104 volatile u32 *port_addr;
108 unsigned long *buf=buffer; 105 u32 *buf = dst;
109 106
110 port_addr = (volatile unsigned long *)PORT2ADDR(port); 107 port_addr = (volatile u32 *)ioport_map(port, 4);
108 while (count--)
109 *buf++ = *port_addr;
111 110
112 while(count--) 111 dummy_read();
113 *buf++ = *port_addr;
114#ifdef SH3_PCMCIA_BUG_WORKAROUND
115 ctrl_inb (DUMMY_READ_AREA6);
116#endif
117} 112}
118 113
119void generic_outb(unsigned char b, unsigned long port) 114void generic_outb(u8 b, unsigned long port)
120{ 115{
121 *(volatile unsigned char*)PORT2ADDR(port) = b; 116 ctrl_outb(b, (unsigned long __force)ioport_map(port, 1));
122} 117}
123 118
124void generic_outw(unsigned short b, unsigned long port) 119void generic_outw(u16 b, unsigned long port)
125{ 120{
126 *(volatile unsigned short*)PORT2ADDR(port) = b; 121 ctrl_outw(b, (unsigned long __force)ioport_map(port, 2));
127} 122}
128 123
129void generic_outl(unsigned int b, unsigned long port) 124void generic_outl(u32 b, unsigned long port)
130{ 125{
131 *(volatile unsigned long*)PORT2ADDR(port) = b; 126 ctrl_outl(b, (unsigned long __force)ioport_map(port, 4));
132} 127}
133 128
134void generic_outb_p(unsigned char b, unsigned long port) 129void generic_outb_p(u8 b, unsigned long port)
135{ 130{
136 *(volatile unsigned char*)PORT2ADDR(port) = b; 131 generic_outb(b, port);
137 delay(); 132 delay();
138} 133}
139 134
140void generic_outw_p(unsigned short b, unsigned long port) 135void generic_outw_p(u16 b, unsigned long port)
141{ 136{
142 *(volatile unsigned short*)PORT2ADDR(port) = b; 137 generic_outw(b, port);
143 delay(); 138 delay();
144} 139}
145 140
146void generic_outl_p(unsigned int b, unsigned long port) 141void generic_outl_p(u32 b, unsigned long port)
147{ 142{
148 *(volatile unsigned long*)PORT2ADDR(port) = b; 143 generic_outl(b, port);
149 delay(); 144 delay();
150} 145}
151 146
@@ -154,90 +149,77 @@ void generic_outl_p(unsigned int b, unsigned long port)
154 * address. However as the port address doesn't change we only need to 149 * address. However as the port address doesn't change we only need to
155 * convert the port address to real address once. 150 * convert the port address to real address once.
156 */ 151 */
157 152void generic_outsb(unsigned long port, const void *src, unsigned long count)
158void generic_outsb(unsigned long port, const void *buffer, unsigned long count)
159{ 153{
160 volatile unsigned char *port_addr; 154 volatile u8 *port_addr;
161 const unsigned char *buf=buffer; 155 const u8 *buf = src;
162 156
163 port_addr = (volatile unsigned char *)PORT2ADDR(port); 157 port_addr = (volatile u8 __force *)ioport_map(port, 1);
164 158
165 while(count--) 159 while (count--)
166 *port_addr = *buf++; 160 *port_addr = *buf++;
167} 161}
168 162
169void generic_outsw(unsigned long port, const void *buffer, unsigned long count) 163void generic_outsw(unsigned long port, const void *src, unsigned long count)
170{ 164{
171 volatile unsigned short *port_addr; 165 volatile u16 *port_addr;
172 const unsigned short *buf=buffer; 166 const u16 *buf = src;
173 167
174 port_addr = (volatile unsigned short *)PORT2ADDR(port); 168 port_addr = (volatile u16 __force *)ioport_map(port, 2);
175 169
176 while(count--) 170 while (count--)
177 *port_addr = *buf++; 171 *port_addr = *buf++;
178 172
179#ifdef SH3_PCMCIA_BUG_WORKAROUND 173 dummy_read();
180 ctrl_inb (DUMMY_READ_AREA6);
181#endif
182} 174}
183 175
184void generic_outsl(unsigned long port, const void *buffer, unsigned long count) 176void generic_outsl(unsigned long port, const void *src, unsigned long count)
185{ 177{
186 volatile unsigned long *port_addr; 178 volatile u32 *port_addr;
187 const unsigned long *buf=buffer; 179 const u32 *buf = src;
188 180
189 port_addr = (volatile unsigned long *)PORT2ADDR(port); 181 port_addr = (volatile u32 __force *)ioport_map(port, 4);
182 while (count--)
183 *port_addr = *buf++;
190 184
191 while(count--) 185 dummy_read();
192 *port_addr = *buf++;
193
194#ifdef SH3_PCMCIA_BUG_WORKAROUND
195 ctrl_inb (DUMMY_READ_AREA6);
196#endif
197}
198
199unsigned char generic_readb(unsigned long addr)
200{
201 return *(volatile unsigned char*)addr;
202} 186}
203 187
204unsigned short generic_readw(unsigned long addr) 188u8 generic_readb(void __iomem *addr)
205{ 189{
206 return *(volatile unsigned short*)addr; 190 return ctrl_inb((unsigned long __force)addr);
207} 191}
208 192
209unsigned int generic_readl(unsigned long addr) 193u16 generic_readw(void __iomem *addr)
210{ 194{
211 return *(volatile unsigned long*)addr; 195 return ctrl_inw((unsigned long __force)addr);
212} 196}
213 197
214void generic_writeb(unsigned char b, unsigned long addr) 198u32 generic_readl(void __iomem *addr)
215{ 199{
216 *(volatile unsigned char*)addr = b; 200 return ctrl_inl((unsigned long __force)addr);
217} 201}
218 202
219void generic_writew(unsigned short b, unsigned long addr) 203void generic_writeb(u8 b, void __iomem *addr)
220{ 204{
221 *(volatile unsigned short*)addr = b; 205 ctrl_outb(b, (unsigned long __force)addr);
222} 206}
223 207
224void generic_writel(unsigned int b, unsigned long addr) 208void generic_writew(u16 b, void __iomem *addr)
225{ 209{
226 *(volatile unsigned long*)addr = b; 210 ctrl_outw(b, (unsigned long __force)addr);
227} 211}
228 212
229void * generic_ioremap(unsigned long offset, unsigned long size) 213void generic_writel(u32 b, void __iomem *addr)
230{ 214{
231 return (void *) P2SEGADDR(offset); 215 ctrl_outl(b, (unsigned long __force)addr);
232} 216}
233EXPORT_SYMBOL(generic_ioremap);
234 217
235void generic_iounmap(void *addr) 218void __iomem *generic_ioport_map(unsigned long addr, unsigned int size)
236{ 219{
220 return (void __iomem *)(addr + generic_io_base);
237} 221}
238EXPORT_SYMBOL(generic_iounmap);
239 222
240unsigned long generic_isa_port2addr(unsigned long offset) 223void generic_ioport_unmap(void __iomem *addr)
241{ 224{
242 return offset + generic_io_base;
243} 225}
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 54c171225b78..6883c00728cb 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -8,38 +8,13 @@
8 * SuperH version: Copyright (C) 1999 Niibe Yutaka 8 * SuperH version: Copyright (C) 1999 Niibe Yutaka
9 */ 9 */
10 10
11/* 11#include <linux/irq.h>
12 * IRQs are in fact implemented a bit like signal handlers for the kernel.
13 * Naturally it's not a 1:1 relation, but there are similarities.
14 */
15
16#include <linux/config.h>
17#include <linux/module.h>
18#include <linux/ptrace.h>
19#include <linux/errno.h>
20#include <linux/kernel_stat.h>
21#include <linux/signal.h>
22#include <linux/sched.h>
23#include <linux/ioport.h>
24#include <linux/interrupt.h> 12#include <linux/interrupt.h>
25#include <linux/timex.h> 13#include <linux/kernel_stat.h>
26#include <linux/mm.h>
27#include <linux/slab.h>
28#include <linux/random.h>
29#include <linux/smp.h>
30#include <linux/smp_lock.h>
31#include <linux/init.h>
32#include <linux/seq_file.h> 14#include <linux/seq_file.h>
33#include <linux/kallsyms.h>
34#include <linux/bitops.h>
35
36#include <asm/system.h>
37#include <asm/io.h>
38#include <asm/pgalloc.h>
39#include <asm/delay.h>
40#include <asm/irq.h> 15#include <asm/irq.h>
41#include <linux/irq.h> 16#include <asm/processor.h>
42 17#include <asm/cpu/mmu_context.h>
43 18
44/* 19/*
45 * 'what should we do if we get a hw irq event on an illegal vector'. 20 * 'what should we do if we get a hw irq event on an illegal vector'.
@@ -66,7 +41,7 @@ int show_interrupts(struct seq_file *p, void *v)
66 seq_putc(p, '\n'); 41 seq_putc(p, '\n');
67 } 42 }
68 43
69 if (i < ACTUAL_NR_IRQS) { 44 if (i < NR_IRQS) {
70 spin_lock_irqsave(&irq_desc[i].lock, flags); 45 spin_lock_irqsave(&irq_desc[i].lock, flags);
71 action = irq_desc[i].action; 46 action = irq_desc[i].action;
72 if (!action) 47 if (!action)
@@ -86,19 +61,32 @@ unlock:
86} 61}
87#endif 62#endif
88 63
64
89asmlinkage int do_IRQ(unsigned long r4, unsigned long r5, 65asmlinkage int do_IRQ(unsigned long r4, unsigned long r5,
90 unsigned long r6, unsigned long r7, 66 unsigned long r6, unsigned long r7,
91 struct pt_regs regs) 67 struct pt_regs regs)
92{ 68{
93 int irq; 69 int irq = r4;
94 70
95 irq_enter(); 71 irq_enter();
96 asm volatile("stc r2_bank, %0\n\t" 72
97 "shlr2 %0\n\t" 73#ifdef CONFIG_CPU_HAS_INTEVT
98 "shlr2 %0\n\t" 74 __asm__ __volatile__ (
99 "shlr %0\n\t" 75#ifdef CONFIG_CPU_HAS_SR_RB
100 "add #-16, %0\n\t" 76 "stc r2_bank, %0\n\t"
101 :"=z" (irq)); 77#else
78 "mov.l @%1, %0\n\t"
79#endif
80 "shlr2 %0\n\t"
81 "shlr2 %0\n\t"
82 "shlr %0\n\t"
83 "add #-16, %0\n\t"
84 : "=z" (irq), "=r" (r4)
85 : "1" (INTEVT)
86 : "memory"
87 );
88#endif
89
102 irq = irq_demux(irq); 90 irq = irq_demux(irq);
103 __do_IRQ(irq, &regs); 91 __do_IRQ(irq, &regs);
104 irq_exit(); 92 irq_exit();
diff --git a/arch/sh/kernel/machine_kexec.c b/arch/sh/kernel/machine_kexec.c
new file mode 100644
index 000000000000..43546525f28f
--- /dev/null
+++ b/arch/sh/kernel/machine_kexec.c
@@ -0,0 +1,112 @@
1/*
2 * machine_kexec.c - handle transition of Linux booting another kernel
3 * Copyright (C) 2002-2003 Eric Biederman <ebiederm@xmission.com>
4 *
5 * GameCube/ppc32 port Copyright (C) 2004 Albert Herranz
6 * LANDISK/sh4 supported by kogiidena
7 *
8 * This source code is licensed under the GNU General Public License,
9 * Version 2. See the file COPYING for more details.
10 */
11
12#include <linux/mm.h>
13#include <linux/kexec.h>
14#include <linux/delay.h>
15#include <linux/reboot.h>
16#include <asm/pgtable.h>
17#include <asm/pgalloc.h>
18#include <asm/mmu_context.h>
19#include <asm/io.h>
20#include <asm/cacheflush.h>
21
22typedef NORET_TYPE void (*relocate_new_kernel_t)(
23 unsigned long indirection_page,
24 unsigned long reboot_code_buffer,
25 unsigned long start_address,
26 unsigned long vbr_reg) ATTRIB_NORET;
27
28const extern unsigned char relocate_new_kernel[];
29const extern unsigned int relocate_new_kernel_size;
30extern void *gdb_vbr_vector;
31
32/*
33 * Provide a dummy crash_notes definition while crash dump arrives to ppc.
34 * This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
35 */
36void *crash_notes = NULL;
37
38void machine_shutdown(void)
39{
40}
41
42void machine_crash_shutdown(struct pt_regs *regs)
43{
44}
45
46/*
47 * Do what every setup is needed on image and the
48 * reboot code buffer to allow us to avoid allocations
49 * later.
50 */
51int machine_kexec_prepare(struct kimage *image)
52{
53 return 0;
54}
55
56void machine_kexec_cleanup(struct kimage *image)
57{
58}
59
60static void kexec_info(struct kimage *image)
61{
62 int i;
63 printk("kexec information\n");
64 for (i = 0; i < image->nr_segments; i++) {
65 printk(" segment[%d]: 0x%08x - 0x%08x (0x%08x)\n",
66 i,
67 (unsigned int)image->segment[i].mem,
68 (unsigned int)image->segment[i].mem + image->segment[i].memsz,
69 (unsigned int)image->segment[i].memsz);
70 }
71 printk(" start : 0x%08x\n\n", (unsigned int)image->start);
72}
73
74
75/*
76 * Do not allocate memory (or fail in any way) in machine_kexec().
77 * We are past the point of no return, committed to rebooting now.
78 */
79NORET_TYPE void machine_kexec(struct kimage *image)
80{
81
82 unsigned long page_list;
83 unsigned long reboot_code_buffer;
84 unsigned long vbr_reg;
85 relocate_new_kernel_t rnk;
86
87#if defined(CONFIG_SH_STANDARD_BIOS)
88 vbr_reg = ((unsigned long )gdb_vbr_vector) - 0x100;
89#else
90 vbr_reg = 0x80000000; // dummy
91#endif
92 /* Interrupts aren't acceptable while we reboot */
93 local_irq_disable();
94
95 page_list = image->head;
96
97 /* we need both effective and real address here */
98 reboot_code_buffer =
99 (unsigned long)page_address(image->control_code_page);
100
101 /* copy our kernel relocation code to the control code page */
102 memcpy((void *)reboot_code_buffer, relocate_new_kernel,
103 relocate_new_kernel_size);
104
105 kexec_info(image);
106 flush_cache_all();
107
108 /* now call it */
109 rnk = (relocate_new_kernel_t) reboot_code_buffer;
110 (*rnk)(page_list, reboot_code_buffer, image->start, vbr_reg);
111}
112
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index fd4f240b833d..a4dc2b532e10 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -71,6 +71,16 @@ void cpu_idle(void)
71 71
72void machine_restart(char * __unused) 72void machine_restart(char * __unused)
73{ 73{
74
75#ifdef CONFIG_KEXEC
76 struct kimage *image;
77 image = xchg(&kexec_image, 0);
78 if (image) {
79 machine_shutdown();
80 machine_kexec(image);
81 }
82#endif
83
74 /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */ 84 /* SR.BL=1 and invoke address error to let CPU reset (manual reset) */
75 asm volatile("ldc %0, sr\n\t" 85 asm volatile("ldc %0, sr\n\t"
76 "mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001)); 86 "mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001));
@@ -191,13 +201,8 @@ void flush_thread(void)
191{ 201{
192#if defined(CONFIG_SH_FPU) 202#if defined(CONFIG_SH_FPU)
193 struct task_struct *tsk = current; 203 struct task_struct *tsk = current;
194 struct pt_regs *regs = (struct pt_regs *)
195 ((unsigned long)tsk->thread_info
196 + THREAD_SIZE - sizeof(struct pt_regs)
197 - sizeof(unsigned long));
198
199 /* Forget lazy FPU state */ 204 /* Forget lazy FPU state */
200 clear_fpu(tsk, regs); 205 clear_fpu(tsk, task_pt_regs(tsk));
201 clear_used_math(); 206 clear_used_math();
202#endif 207#endif
203} 208}
@@ -232,13 +237,7 @@ int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
232{ 237{
233 struct pt_regs ptregs; 238 struct pt_regs ptregs;
234 239
235 ptregs = *(struct pt_regs *) 240 ptregs = *task_pt_regs(tsk);
236 ((unsigned long)tsk->thread_info + THREAD_SIZE
237 - sizeof(struct pt_regs)
238#ifdef CONFIG_SH_DSP
239 - sizeof(struct pt_dspregs)
240#endif
241 - sizeof(unsigned long));
242 elf_core_copy_regs(regs, &ptregs); 241 elf_core_copy_regs(regs, &ptregs);
243 242
244 return 1; 243 return 1;
@@ -252,11 +251,7 @@ dump_task_fpu (struct task_struct *tsk, elf_fpregset_t *fpu)
252#if defined(CONFIG_SH_FPU) 251#if defined(CONFIG_SH_FPU)
253 fpvalid = !!tsk_used_math(tsk); 252 fpvalid = !!tsk_used_math(tsk);
254 if (fpvalid) { 253 if (fpvalid) {
255 struct pt_regs *regs = (struct pt_regs *) 254 unlazy_fpu(tsk, task_pt_regs(tsk));
256 ((unsigned long)tsk->thread_info
257 + THREAD_SIZE - sizeof(struct pt_regs)
258 - sizeof(unsigned long));
259 unlazy_fpu(tsk, regs);
260 memcpy(fpu, &tsk->thread.fpu.hard, sizeof(*fpu)); 255 memcpy(fpu, &tsk->thread.fpu.hard, sizeof(*fpu));
261 } 256 }
262#endif 257#endif
@@ -279,18 +274,13 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
279 copy_to_stopped_child_used_math(p); 274 copy_to_stopped_child_used_math(p);
280#endif 275#endif
281 276
282 childregs = ((struct pt_regs *) 277 childregs = task_pt_regs(p);
283 (THREAD_SIZE + (unsigned long) p->thread_info)
284#ifdef CONFIG_SH_DSP
285 - sizeof(struct pt_dspregs)
286#endif
287 - sizeof(unsigned long)) - 1;
288 *childregs = *regs; 278 *childregs = *regs;
289 279
290 if (user_mode(regs)) { 280 if (user_mode(regs)) {
291 childregs->regs[15] = usp; 281 childregs->regs[15] = usp;
292 } else { 282 } else {
293 childregs->regs[15] = (unsigned long)p->thread_info + THREAD_SIZE; 283 childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE;
294 } 284 }
295 if (clone_flags & CLONE_SETTLS) { 285 if (clone_flags & CLONE_SETTLS) {
296 childregs->gbr = childregs->regs[0]; 286 childregs->gbr = childregs->regs[0];
@@ -305,26 +295,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
305 return 0; 295 return 0;
306} 296}
307 297
308/*
309 * fill in the user structure for a core dump..
310 */
311void dump_thread(struct pt_regs * regs, struct user * dump)
312{
313 dump->magic = CMAGIC;
314 dump->start_code = current->mm->start_code;
315 dump->start_data = current->mm->start_data;
316 dump->start_stack = regs->regs[15] & ~(PAGE_SIZE - 1);
317 dump->u_tsize = (current->mm->end_code - dump->start_code) >> PAGE_SHIFT;
318 dump->u_dsize = (current->mm->brk + (PAGE_SIZE-1) - dump->start_data) >> PAGE_SHIFT;
319 dump->u_ssize = (current->mm->start_stack - dump->start_stack +
320 PAGE_SIZE - 1) >> PAGE_SHIFT;
321 /* Debug registers will come here. */
322
323 dump->regs = *regs;
324
325 dump->u_fpvalid = dump_fpu(regs, &dump->fpu);
326}
327
328/* Tracing by user break controller. */ 298/* Tracing by user break controller. */
329static void 299static void
330ubc_set_tracing(int asid, unsigned long pc) 300ubc_set_tracing(int asid, unsigned long pc)
@@ -353,11 +323,7 @@ ubc_set_tracing(int asid, unsigned long pc)
353struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next) 323struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *next)
354{ 324{
355#if defined(CONFIG_SH_FPU) 325#if defined(CONFIG_SH_FPU)
356 struct pt_regs *regs = (struct pt_regs *) 326 unlazy_fpu(prev, task_pt_regs(prev));
357 ((unsigned long)prev->thread_info
358 + THREAD_SIZE - sizeof(struct pt_regs)
359 - sizeof(unsigned long));
360 unlazy_fpu(prev, regs);
361#endif 327#endif
362 328
363#ifdef CONFIG_PREEMPT 329#ifdef CONFIG_PREEMPT
@@ -366,13 +332,7 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne
366 struct pt_regs *regs; 332 struct pt_regs *regs;
367 333
368 local_irq_save(flags); 334 local_irq_save(flags);
369 regs = (struct pt_regs *) 335 regs = task_pt_regs(prev);
370 ((unsigned long)prev->thread_info
371 + THREAD_SIZE - sizeof(struct pt_regs)
372#ifdef CONFIG_SH_DSP
373 - sizeof(struct pt_dspregs)
374#endif
375 - sizeof(unsigned long));
376 if (user_mode(regs) && regs->regs[15] >= 0xc0000000) { 336 if (user_mode(regs) && regs->regs[15] >= 0xc0000000) {
377 int offset = (int)regs->regs[15]; 337 int offset = (int)regs->regs[15];
378 338
@@ -392,7 +352,7 @@ struct task_struct *__switch_to(struct task_struct *prev, struct task_struct *ne
392 */ 352 */
393 asm volatile("ldc %0, r7_bank" 353 asm volatile("ldc %0, r7_bank"
394 : /* no output */ 354 : /* no output */
395 : "r" (next->thread_info)); 355 : "r" (task_thread_info(next)));
396 356
397#ifdef CONFIG_MMU 357#ifdef CONFIG_MMU
398 /* If no tasks are using the UBC, we're done */ 358 /* If no tasks are using the UBC, we're done */
diff --git a/arch/sh/kernel/ptrace.c b/arch/sh/kernel/ptrace.c
index 1a8be06519ec..3887b4f6feb2 100644
--- a/arch/sh/kernel/ptrace.c
+++ b/arch/sh/kernel/ptrace.c
@@ -41,12 +41,7 @@ static inline int get_stack_long(struct task_struct *task, int offset)
41{ 41{
42 unsigned char *stack; 42 unsigned char *stack;
43 43
44 stack = (unsigned char *) 44 stack = (unsigned char *)task_pt_regs(task);
45 task->thread_info + THREAD_SIZE - sizeof(struct pt_regs)
46#ifdef CONFIG_SH_DSP
47 - sizeof(struct pt_dspregs)
48#endif
49 - sizeof(unsigned long);
50 stack += offset; 45 stack += offset;
51 return (*((int *)stack)); 46 return (*((int *)stack));
52} 47}
@@ -59,12 +54,7 @@ static inline int put_stack_long(struct task_struct *task, int offset,
59{ 54{
60 unsigned char *stack; 55 unsigned char *stack;
61 56
62 stack = (unsigned char *) 57 stack = (unsigned char *)task_pt_regs(task);
63 task->thread_info + THREAD_SIZE - sizeof(struct pt_regs)
64#ifdef CONFIG_SH_DSP
65 - sizeof(struct pt_dspregs)
66#endif
67 - sizeof(unsigned long);
68 stack += offset; 58 stack += offset;
69 *(unsigned long *) stack = data; 59 *(unsigned long *) stack = data;
70 return 0; 60 return 0;
diff --git a/arch/sh/kernel/relocate_kernel.S b/arch/sh/kernel/relocate_kernel.S
new file mode 100644
index 000000000000..b0695cffec6e
--- /dev/null
+++ b/arch/sh/kernel/relocate_kernel.S
@@ -0,0 +1,102 @@
1/*
2 * relocate_kernel.S - put the kernel image in place to boot
3 * 2005.9.17 kogiidena@eggplant.ddo.jp
4 *
5 * LANDISK/sh4 is supported. Maybe, SH archtecture works well.
6 *
7 * This source code is licensed under the GNU General Public License,
8 * Version 2. See the file COPYING for more details.
9 */
10
11#include <linux/config.h>
12#include <linux/linkage.h>
13
14#define PAGE_SIZE 4096 /* must be same value as in <asm/page.h> */
15
16
17 .globl relocate_new_kernel
18relocate_new_kernel:
19 /* r4 = indirection_page */
20 /* r5 = reboot_code_buffer */
21 /* r6 = start_address */
22 /* r7 = vbr_reg */
23
24 mov.l 10f,r8 /* 4096 */
25 mov.l 11f,r9 /* 0xa0000000 */
26
27 /* stack setting */
28 add r8,r5
29 mov r5,r15
30
31 bra 1f
32 mov r4,r0 /* cmd = indirection_page */
330:
34 mov.l @r4+,r0 /* cmd = *ind++ */
35
361: /* addr = (cmd | 0xa0000000) & 0xfffffff0 */
37 mov r0,r2
38 or r9,r2
39 mov #-16,r1
40 and r1,r2
41
42 /* if(cmd & IND_DESTINATION) dst = addr */
43 tst #1,r0
44 bt 2f
45 bra 0b
46 mov r2,r5
47
482: /* else if(cmd & IND_INDIRECTION) ind = addr */
49 tst #2,r0
50 bt 3f
51 bra 0b
52 mov r2,r4
53
543: /* else if(cmd & IND_DONE) goto 6 */
55 tst #4,r0
56 bt 4f
57 bra 6f
58 nop
59
604: /* else if(cmd & IND_SOURCE) memcpy(dst,addr,PAGE_SIZE) */
61 tst #8,r0
62 bt 0b
63
64 mov r8,r3
65 shlr2 r3
66 shlr2 r3
675:
68 dt r3
69 mov.l @r2+,r1 /* 16n+0 */
70 mov.l r1,@r5
71 add #4,r5
72 mov.l @r2+,r1 /* 16n+4 */
73 mov.l r1,@r5
74 add #4,r5
75 mov.l @r2+,r1 /* 16n+8 */
76 mov.l r1,@r5
77 add #4,r5
78 mov.l @r2+,r1 /* 16n+12 */
79 mov.l r1,@r5
80 add #4,r5
81 bf 5b
82
83 bra 0b
84 nop
856:
86#ifdef CONFIG_SH_STANDARD_BIOS
87 ldc r7, vbr
88#endif
89 jmp @r6
90 nop
91
92 .align 2
9310:
94 .long PAGE_SIZE
9511:
96 .long 0xa0000000
97
98relocate_new_kernel_end:
99
100 .globl relocate_new_kernel_size
101relocate_new_kernel_size:
102 .long relocate_new_kernel_end - relocate_new_kernel
diff --git a/arch/sh/kernel/sh_ksyms.c b/arch/sh/kernel/sh_ksyms.c
index 6954fd62470a..1cf94a618be3 100644
--- a/arch/sh/kernel/sh_ksyms.c
+++ b/arch/sh/kernel/sh_ksyms.c
@@ -21,14 +21,12 @@
21#include <asm/cacheflush.h> 21#include <asm/cacheflush.h>
22#include <asm/checksum.h> 22#include <asm/checksum.h>
23 23
24extern void dump_thread(struct pt_regs *, struct user *);
25extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); 24extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
26extern struct hw_interrupt_type no_irq_type; 25extern struct hw_interrupt_type no_irq_type;
27 26
28EXPORT_SYMBOL(sh_mv); 27EXPORT_SYMBOL(sh_mv);
29 28
30/* platform dependent support */ 29/* platform dependent support */
31EXPORT_SYMBOL(dump_thread);
32EXPORT_SYMBOL(dump_fpu); 30EXPORT_SYMBOL(dump_fpu);
33EXPORT_SYMBOL(iounmap); 31EXPORT_SYMBOL(iounmap);
34EXPORT_SYMBOL(enable_irq); 32EXPORT_SYMBOL(enable_irq);
diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c
index 59e49b18252c..62c7d1c0ad7b 100644
--- a/arch/sh/kernel/smp.c
+++ b/arch/sh/kernel/smp.c
@@ -103,7 +103,7 @@ int __cpu_up(unsigned int cpu)
103 if (IS_ERR(tsk)) 103 if (IS_ERR(tsk))
104 panic("Failed forking idle task for cpu %d\n", cpu); 104 panic("Failed forking idle task for cpu %d\n", cpu);
105 105
106 tsk->thread_info->cpu = cpu; 106 task_thread_info(tsk)->cpu = cpu;
107 107
108 cpu_set(cpu, cpu_online_map); 108 cpu_set(cpu, cpu_online_map);
109 109
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index 671b876416bf..314a275c04e0 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka 4 * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka
5 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org> 5 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
6 * Copyright (C) 2002, 2003, 2004 Paul Mundt 6 * Copyright (C) 2002, 2003, 2004, 2005 Paul Mundt
7 * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org> 7 * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org>
8 * 8 *
9 * Some code taken from i386 version. 9 * Some code taken from i386 version.
@@ -11,50 +11,21 @@
11 */ 11 */
12 12
13#include <linux/config.h> 13#include <linux/config.h>
14#include <linux/errno.h>
15#include <linux/module.h>
16#include <linux/sched.h>
17#include <linux/kernel.h> 14#include <linux/kernel.h>
18#include <linux/param.h> 15#include <linux/module.h>
19#include <linux/string.h>
20#include <linux/mm.h>
21#include <linux/interrupt.h>
22#include <linux/time.h>
23#include <linux/delay.h>
24#include <linux/init.h> 16#include <linux/init.h>
25#include <linux/smp.h>
26#include <linux/profile.h> 17#include <linux/profile.h>
27 18#include <asm/clock.h>
28#include <asm/processor.h>
29#include <asm/uaccess.h>
30#include <asm/io.h>
31#include <asm/irq.h>
32#include <asm/delay.h>
33#include <asm/machvec.h>
34#include <asm/rtc.h> 19#include <asm/rtc.h>
35#include <asm/freq.h> 20#include <asm/timer.h>
36#include <asm/cpu/timer.h>
37#ifdef CONFIG_SH_KGDB
38#include <asm/kgdb.h> 21#include <asm/kgdb.h>
39#endif
40
41#include <linux/timex.h>
42#include <linux/irq.h>
43
44#define TMU_TOCR_INIT 0x00
45#define TMU0_TCR_INIT 0x0020
46#define TMU_TSTR_INIT 1
47
48#define TMU0_TCR_CALIB 0x0000
49
50#ifdef CONFIG_CPU_SUBTYPE_ST40STB1
51#define CLOCKGEN_MEMCLKCR 0xbb040038
52#define MEMCLKCR_RATIO_MASK 0x7
53#endif /* CONFIG_CPU_SUBTYPE_ST40STB1 */
54 22
55extern unsigned long wall_jiffies; 23extern unsigned long wall_jiffies;
56#define TICK_SIZE (tick_nsec / 1000) 24struct sys_timer *sys_timer;
57DEFINE_SPINLOCK(tmu0_lock); 25
26/* Move this somewhere more sensible.. */
27DEFINE_SPINLOCK(rtc_lock);
28EXPORT_SYMBOL(rtc_lock);
58 29
59/* XXX: Can we initialize this in a routine somewhere? Dreamcast doesn't want 30/* XXX: Can we initialize this in a routine somewhere? Dreamcast doesn't want
60 * these routines anywhere... */ 31 * these routines anywhere... */
@@ -66,98 +37,14 @@ void (*rtc_get_time)(struct timespec *);
66int (*rtc_set_time)(const time_t); 37int (*rtc_set_time)(const time_t);
67#endif 38#endif
68 39
69#if defined(CONFIG_CPU_SUBTYPE_SH7300)
70static int md_table[] = { 1, 2, 3, 4, 6, 8, 12 };
71#endif
72#if defined(CONFIG_CPU_SH3)
73static int stc_multipliers[] = { 1, 2, 3, 4, 6, 1, 1, 1 };
74static int stc_values[] = { 0, 1, 4, 2, 5, 0, 0, 0 };
75#define bfc_divisors stc_multipliers
76#define bfc_values stc_values
77static int ifc_divisors[] = { 1, 2, 3, 4, 1, 1, 1, 1 };
78static int ifc_values[] = { 0, 1, 4, 2, 0, 0, 0, 0 };
79static int pfc_divisors[] = { 1, 2, 3, 4, 6, 1, 1, 1 };
80static int pfc_values[] = { 0, 1, 4, 2, 5, 0, 0, 0 };
81#elif defined(CONFIG_CPU_SH4)
82#if defined(CONFIG_CPU_SUBTYPE_SH73180)
83static int ifc_divisors[] = { 1, 2, 3, 4, 6, 8, 12, 16 };
84static int ifc_values[] = { 0, 1, 2, 3, 4, 5, 6, 7 };
85#define bfc_divisors ifc_divisors /* Same */
86#define bfc_values ifc_values
87#define pfc_divisors ifc_divisors /* Same */
88#define pfc_values ifc_values
89#else
90static int ifc_divisors[] = { 1, 2, 3, 4, 6, 8, 1, 1 };
91static int ifc_values[] = { 0, 1, 2, 3, 0, 4, 0, 5 };
92#define bfc_divisors ifc_divisors /* Same */
93#define bfc_values ifc_values
94static int pfc_divisors[] = { 2, 3, 4, 6, 8, 2, 2, 2 };
95static int pfc_values[] = { 0, 0, 1, 2, 0, 3, 0, 4 };
96#endif
97#else
98#error "Unknown ifc/bfc/pfc/stc values for this processor"
99#endif
100
101/* 40/*
102 * Scheduler clock - returns current time in nanosec units. 41 * Scheduler clock - returns current time in nanosec units.
103 */ 42 */
104unsigned long long sched_clock(void) 43unsigned long long __attribute__ ((weak)) sched_clock(void)
105{ 44{
106 return (unsigned long long)jiffies * (1000000000 / HZ); 45 return (unsigned long long)jiffies * (1000000000 / HZ);
107} 46}
108 47
109static unsigned long do_gettimeoffset(void)
110{
111 int count;
112 unsigned long flags;
113
114 static int count_p = 0x7fffffff; /* for the first call after boot */
115 static unsigned long jiffies_p = 0;
116
117 /*
118 * cache volatile jiffies temporarily; we have IRQs turned off.
119 */
120 unsigned long jiffies_t;
121
122 spin_lock_irqsave(&tmu0_lock, flags);
123 /* timer count may underflow right here */
124 count = ctrl_inl(TMU0_TCNT); /* read the latched count */
125
126 jiffies_t = jiffies;
127
128 /*
129 * avoiding timer inconsistencies (they are rare, but they happen)...
130 * there is one kind of problem that must be avoided here:
131 * 1. the timer counter underflows
132 */
133
134 if( jiffies_t == jiffies_p ) {
135 if( count > count_p ) {
136 /* the nutcase */
137
138 if(ctrl_inw(TMU0_TCR) & 0x100) { /* Check UNF bit */
139 /*
140 * We cannot detect lost timer interrupts ...
141 * well, that's why we call them lost, don't we? :)
142 * [hmm, on the Pentium and Alpha we can ... sort of]
143 */
144 count -= LATCH;
145 } else {
146 printk("do_slow_gettimeoffset(): hardware timer problem?\n");
147 }
148 }
149 } else
150 jiffies_p = jiffies_t;
151
152 count_p = count;
153 spin_unlock_irqrestore(&tmu0_lock, flags);
154
155 count = ((LATCH-1) - count) * TICK_SIZE;
156 count = (count + LATCH/2) / LATCH;
157
158 return count;
159}
160
161void do_gettimeofday(struct timeval *tv) 48void do_gettimeofday(struct timeval *tv)
162{ 49{
163 unsigned long seq; 50 unsigned long seq;
@@ -166,7 +53,7 @@ void do_gettimeofday(struct timeval *tv)
166 53
167 do { 54 do {
168 seq = read_seqbegin(&xtime_lock); 55 seq = read_seqbegin(&xtime_lock);
169 usec = do_gettimeoffset(); 56 usec = get_timer_offset();
170 57
171 lost = jiffies - wall_jiffies; 58 lost = jiffies - wall_jiffies;
172 if (lost) 59 if (lost)
@@ -202,7 +89,7 @@ int do_settimeofday(struct timespec *tv)
202 * wall time. Discover what correction gettimeofday() would have 89 * wall time. Discover what correction gettimeofday() would have
203 * made, and then undo it! 90 * made, and then undo it!
204 */ 91 */
205 nsec -= 1000 * (do_gettimeoffset() + 92 nsec -= 1000 * (get_timer_offset() +
206 (jiffies - wall_jiffies) * (1000000 / HZ)); 93 (jiffies - wall_jiffies) * (1000000 / HZ));
207 94
208 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec); 95 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
@@ -224,10 +111,10 @@ EXPORT_SYMBOL(do_settimeofday);
224static long last_rtc_update; 111static long last_rtc_update;
225 112
226/* 113/*
227 * timer_interrupt() needs to keep up the real-time clock, 114 * handle_timer_tick() needs to keep up the real-time clock,
228 * as well as call the "do_timer()" routine every clocktick 115 * as well as call the "do_timer()" routine every clocktick
229 */ 116 */
230static inline void do_timer_interrupt(int irq, struct pt_regs *regs) 117void handle_timer_tick(struct pt_regs *regs)
231{ 118{
232 do_timer(regs); 119 do_timer(regs);
233#ifndef CONFIG_SMP 120#ifndef CONFIG_SMP
@@ -252,337 +139,35 @@ static inline void do_timer_interrupt(int irq, struct pt_regs *regs)
252 if (rtc_set_time(xtime.tv_sec) == 0) 139 if (rtc_set_time(xtime.tv_sec) == 0)
253 last_rtc_update = xtime.tv_sec; 140 last_rtc_update = xtime.tv_sec;
254 else 141 else
255 last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */ 142 /* do it again in 60s */
143 last_rtc_update = xtime.tv_sec - 600;
256 } 144 }
257} 145}
258 146
259/* 147static struct sysdev_class timer_sysclass = {
260 * This is the same as the above, except we _also_ save the current 148 set_kset_name("timer"),
261 * Time Stamp Counter value at the time of the timer interrupt, so that
262 * we later on can estimate the time of day more exactly.
263 */
264static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
265{
266 unsigned long timer_status;
267
268 /* Clear UNF bit */
269 timer_status = ctrl_inw(TMU0_TCR);
270 timer_status &= ~0x100;
271 ctrl_outw(timer_status, TMU0_TCR);
272
273 /*
274 * Here we are in the timer irq handler. We just have irqs locally
275 * disabled but we don't know if the timer_bh is running on the other
276 * CPU. We need to avoid to SMP race with it. NOTE: we don' t need
277 * the irq version of write_lock because as just said we have irq
278 * locally disabled. -arca
279 */
280 write_seqlock(&xtime_lock);
281 do_timer_interrupt(irq, regs);
282 write_sequnlock(&xtime_lock);
283
284 return IRQ_HANDLED;
285}
286
287/*
288 * Hah! We'll see if this works (switching from usecs to nsecs).
289 */
290static unsigned int __init get_timer_frequency(void)
291{
292 u32 freq;
293 struct timespec ts1, ts2;
294 unsigned long diff_nsec;
295 unsigned long factor;
296
297 /* Setup the timer: We don't want to generate interrupts, just
298 * have it count down at its natural rate.
299 */
300 ctrl_outb(0, TMU_TSTR);
301#if !defined(CONFIG_CPU_SUBTYPE_SH7300)
302 ctrl_outb(TMU_TOCR_INIT, TMU_TOCR);
303#endif
304 ctrl_outw(TMU0_TCR_CALIB, TMU0_TCR);
305 ctrl_outl(0xffffffff, TMU0_TCOR);
306 ctrl_outl(0xffffffff, TMU0_TCNT);
307
308 rtc_get_time(&ts2);
309
310 do {
311 rtc_get_time(&ts1);
312 } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec);
313
314 /* actually start the timer */
315 ctrl_outb(TMU_TSTR_INIT, TMU_TSTR);
316
317 do {
318 rtc_get_time(&ts2);
319 } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec);
320
321 freq = 0xffffffff - ctrl_inl(TMU0_TCNT);
322 if (ts2.tv_nsec < ts1.tv_nsec) {
323 ts2.tv_nsec += 1000000000;
324 ts2.tv_sec--;
325 }
326
327 diff_nsec = (ts2.tv_sec - ts1.tv_sec) * 1000000000 + (ts2.tv_nsec - ts1.tv_nsec);
328
329 /* this should work well if the RTC has a precision of n Hz, where
330 * n is an integer. I don't think we have to worry about the other
331 * cases. */
332 factor = (1000000000 + diff_nsec/2) / diff_nsec;
333
334 if (factor * diff_nsec > 1100000000 ||
335 factor * diff_nsec < 900000000)
336 panic("weird RTC (diff_nsec %ld)", diff_nsec);
337
338 return freq * factor;
339}
340
341void (*board_time_init)(void);
342void (*board_timer_setup)(struct irqaction *irq);
343
344static unsigned int sh_pclk_freq __initdata = CONFIG_SH_PCLK_FREQ;
345
346static int __init sh_pclk_setup(char *str)
347{
348 unsigned int freq;
349
350 if (get_option(&str, &freq))
351 sh_pclk_freq = freq;
352
353 return 1;
354}
355__setup("sh_pclk=", sh_pclk_setup);
356
357static struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL};
358
359void get_current_frequency_divisors(unsigned int *ifc, unsigned int *bfc, unsigned int *pfc)
360{
361 unsigned int frqcr = ctrl_inw(FRQCR);
362
363#if defined(CONFIG_CPU_SH3)
364#if defined(CONFIG_CPU_SUBTYPE_SH7300)
365 *ifc = md_table[((frqcr & 0x0070) >> 4)];
366 *bfc = md_table[((frqcr & 0x0700) >> 8)];
367 *pfc = md_table[frqcr & 0x0007];
368#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
369 *bfc = stc_multipliers[(frqcr & 0x0300) >> 8];
370 *ifc = ifc_divisors[(frqcr & 0x0030) >> 4];
371 *pfc = pfc_divisors[frqcr & 0x0003];
372#else
373 unsigned int tmp;
374
375 tmp = (frqcr & 0x8000) >> 13;
376 tmp |= (frqcr & 0x0030) >> 4;
377 *bfc = stc_multipliers[tmp];
378 tmp = (frqcr & 0x4000) >> 12;
379 tmp |= (frqcr & 0x000c) >> 2;
380 *ifc = ifc_divisors[tmp];
381 tmp = (frqcr & 0x2000) >> 11;
382 tmp |= frqcr & 0x0003;
383 *pfc = pfc_divisors[tmp];
384#endif
385#elif defined(CONFIG_CPU_SH4)
386#if defined(CONFIG_CPU_SUBTYPE_SH73180)
387 *ifc = ifc_divisors[(frqcr>> 20) & 0x0007];
388 *bfc = bfc_divisors[(frqcr>> 12) & 0x0007];
389 *pfc = pfc_divisors[frqcr & 0x0007];
390#else
391 *ifc = ifc_divisors[(frqcr >> 6) & 0x0007];
392 *bfc = bfc_divisors[(frqcr >> 3) & 0x0007];
393 *pfc = pfc_divisors[frqcr & 0x0007];
394#endif
395#endif
396}
397
398/*
399 * This bit of ugliness builds up accessor routines to get at both
400 * the divisors and the physical values.
401 */
402#define _FREQ_TABLE(x) \
403 unsigned int get_##x##_divisor(unsigned int value) \
404 { return x##_divisors[value]; } \
405 \
406 unsigned int get_##x##_value(unsigned int divisor) \
407 { return x##_values[(divisor - 1)]; }
408
409_FREQ_TABLE(ifc);
410_FREQ_TABLE(bfc);
411_FREQ_TABLE(pfc);
412
413#ifdef CONFIG_CPU_SUBTYPE_ST40STB1
414
415/*
416 * The ST40 divisors are totally different so we set the cpu data
417 * clocks using a different algorithm
418 *
419 * I've just plugged this from the 2.4 code
420 * - Alex Bennee <kernel-hacker@bennee.com>
421 */
422#define CCN_PVR_CHIP_SHIFT 24
423#define CCN_PVR_CHIP_MASK 0xff
424#define CCN_PVR_CHIP_ST40STB1 0x4
425
426
427struct frqcr_data {
428 unsigned short frqcr;
429
430 struct {
431 unsigned char multiplier;
432 unsigned char divisor;
433 } factor[3];
434};
435
436static struct frqcr_data st40_frqcr_table[] = {
437 { 0x000, {{1,1}, {1,1}, {1,2}}},
438 { 0x002, {{1,1}, {1,1}, {1,4}}},
439 { 0x004, {{1,1}, {1,1}, {1,8}}},
440 { 0x008, {{1,1}, {1,2}, {1,2}}},
441 { 0x00A, {{1,1}, {1,2}, {1,4}}},
442 { 0x00C, {{1,1}, {1,2}, {1,8}}},
443 { 0x011, {{1,1}, {2,3}, {1,6}}},
444 { 0x013, {{1,1}, {2,3}, {1,3}}},
445 { 0x01A, {{1,1}, {1,2}, {1,4}}},
446 { 0x01C, {{1,1}, {1,2}, {1,8}}},
447 { 0x023, {{1,1}, {2,3}, {1,3}}},
448 { 0x02C, {{1,1}, {1,2}, {1,8}}},
449 { 0x048, {{1,2}, {1,2}, {1,4}}},
450 { 0x04A, {{1,2}, {1,2}, {1,6}}},
451 { 0x04C, {{1,2}, {1,2}, {1,8}}},
452 { 0x05A, {{1,2}, {1,3}, {1,6}}},
453 { 0x05C, {{1,2}, {1,3}, {1,6}}},
454 { 0x063, {{1,2}, {1,4}, {1,4}}},
455 { 0x06C, {{1,2}, {1,4}, {1,8}}},
456 { 0x091, {{1,3}, {1,3}, {1,6}}},
457 { 0x093, {{1,3}, {1,3}, {1,6}}},
458 { 0x0A3, {{1,3}, {1,6}, {1,6}}},
459 { 0x0DA, {{1,4}, {1,4}, {1,8}}},
460 { 0x0DC, {{1,4}, {1,4}, {1,8}}},
461 { 0x0EC, {{1,4}, {1,8}, {1,8}}},
462 { 0x123, {{1,4}, {1,4}, {1,8}}},
463 { 0x16C, {{1,4}, {1,8}, {1,8}}},
464}; 149};
465 150
466struct memclk_data { 151static int __init timer_init_sysfs(void)
467 unsigned char multiplier;
468 unsigned char divisor;
469};
470
471static struct memclk_data st40_memclk_table[8] = {
472 {1,1}, // 000
473 {1,2}, // 001
474 {1,3}, // 010
475 {2,3}, // 011
476 {1,4}, // 100
477 {1,6}, // 101
478 {1,8}, // 110
479 {1,8} // 111
480};
481
482static void st40_specific_time_init(unsigned int module_clock, unsigned short frqcr)
483{ 152{
484 unsigned int cpu_clock, master_clock, bus_clock, memory_clock; 153 int ret = sysdev_class_register(&timer_sysclass);
485 struct frqcr_data *d; 154 if (ret != 0)
486 int a; 155 return ret;
487 unsigned long memclkcr;
488 struct memclk_data *e;
489 156
490 for (a = 0; a < ARRAY_SIZE(st40_frqcr_table); a++) { 157 sys_timer->dev.cls = &timer_sysclass;
491 d = &st40_frqcr_table[a]; 158 return sysdev_register(&sys_timer->dev);
492 159}
493 if (d->frqcr == (frqcr & 0x1ff))
494 break;
495 }
496 160
497 if (a == ARRAY_SIZE(st40_frqcr_table)) { 161device_initcall(timer_init_sysfs);
498 d = st40_frqcr_table;
499 162
500 printk("ERROR: Unrecognised FRQCR value (0x%x), " 163void (*board_time_init)(void);
501 "using default multipliers\n", frqcr);
502 }
503
504 memclkcr = ctrl_inl(CLOCKGEN_MEMCLKCR);
505 e = &st40_memclk_table[memclkcr & MEMCLKCR_RATIO_MASK];
506
507 printk(KERN_INFO "Clock multipliers: CPU: %d/%d Bus: %d/%d "
508 "Mem: %d/%d Periph: %d/%d\n",
509 d->factor[0].multiplier, d->factor[0].divisor,
510 d->factor[1].multiplier, d->factor[1].divisor,
511 e->multiplier, e->divisor,
512 d->factor[2].multiplier, d->factor[2].divisor);
513
514 master_clock = module_clock * d->factor[2].divisor
515 / d->factor[2].multiplier;
516 bus_clock = master_clock * d->factor[1].multiplier
517 / d->factor[1].divisor;
518 memory_clock = master_clock * e->multiplier
519 / e->divisor;
520 cpu_clock = master_clock * d->factor[0].multiplier
521 / d->factor[0].divisor;
522
523 current_cpu_data.cpu_clock = cpu_clock;
524 current_cpu_data.master_clock = master_clock;
525 current_cpu_data.bus_clock = bus_clock;
526 current_cpu_data.memory_clock = memory_clock;
527 current_cpu_data.module_clock = module_clock;
528}
529#endif
530 164
531void __init time_init(void) 165void __init time_init(void)
532{ 166{
533 unsigned int timer_freq = 0;
534 unsigned int ifc, pfc, bfc;
535 unsigned long interval;
536#ifdef CONFIG_CPU_SUBTYPE_ST40STB1
537 unsigned long pvr;
538 unsigned short frqcr;
539#endif
540
541 if (board_time_init) 167 if (board_time_init)
542 board_time_init(); 168 board_time_init();
543 169
544 /* 170 clk_init();
545 * If we don't have an RTC (such as with the SH7300), don't attempt to
546 * probe the timer frequency. Rely on an either hardcoded peripheral
547 * clock value, or on the sh_pclk command line option. Note that we
548 * still need to have CONFIG_SH_PCLK_FREQ set in order for things like
549 * CLOCK_TICK_RATE to be sane.
550 */
551 current_cpu_data.module_clock = sh_pclk_freq;
552
553#ifdef CONFIG_SH_PCLK_CALC
554 /* XXX: Switch this over to a more generic test. */
555 {
556 unsigned int freq;
557
558 /*
559 * If we've specified a peripheral clock frequency, and we have
560 * an RTC, compare it against the autodetected value. Complain
561 * if there's a mismatch.
562 */
563 timer_freq = get_timer_frequency();
564 freq = timer_freq * 4;
565
566 if (sh_pclk_freq && (sh_pclk_freq/100*99 > freq || sh_pclk_freq/100*101 < freq)) {
567 printk(KERN_NOTICE "Calculated peripheral clock value "
568 "%d differs from sh_pclk value %d, fixing..\n",
569 freq, sh_pclk_freq);
570 current_cpu_data.module_clock = freq;
571 }
572 }
573#endif
574
575#ifdef CONFIG_CPU_SUBTYPE_ST40STB1
576 /* XXX: Update ST40 code to use board_time_init() */
577 pvr = ctrl_inl(CCN_PVR);
578 frqcr = ctrl_inw(FRQCR);
579 printk("time.c ST40 Probe: PVR %08lx, FRQCR %04hx\n", pvr, frqcr);
580
581 if (((pvr >> CCN_PVR_CHIP_SHIFT) & CCN_PVR_CHIP_MASK) == CCN_PVR_CHIP_ST40STB1)
582 st40_specific_time_init(current_cpu_data.module_clock, frqcr);
583 else
584#endif
585 get_current_frequency_divisors(&ifc, &bfc, &pfc);
586 171
587 if (rtc_get_time) { 172 if (rtc_get_time) {
588 rtc_get_time(&xtime); 173 rtc_get_time(&xtime);
@@ -594,51 +179,12 @@ void __init time_init(void)
594 set_normalized_timespec(&wall_to_monotonic, 179 set_normalized_timespec(&wall_to_monotonic,
595 -xtime.tv_sec, -xtime.tv_nsec); 180 -xtime.tv_sec, -xtime.tv_nsec);
596 181
597 if (board_timer_setup) {
598 board_timer_setup(&irq0);
599 } else {
600 setup_irq(TIMER_IRQ, &irq0);
601 }
602
603 /* 182 /*
604 * for ST40 chips the current_cpu_data should already be set 183 * Find the timer to use as the system timer, it will be
605 * so not having valid pfc/bfc/ifc shouldn't be a problem 184 * initialized for us.
606 */ 185 */
607 if (!current_cpu_data.master_clock) 186 sys_timer = get_sys_timer();
608 current_cpu_data.master_clock = current_cpu_data.module_clock * pfc; 187 printk(KERN_INFO "Using %s for system timer\n", sys_timer->name);
609 if (!current_cpu_data.bus_clock)
610 current_cpu_data.bus_clock = current_cpu_data.master_clock / bfc;
611 if (!current_cpu_data.cpu_clock)
612 current_cpu_data.cpu_clock = current_cpu_data.master_clock / ifc;
613
614 printk("CPU clock: %d.%02dMHz\n",
615 (current_cpu_data.cpu_clock / 1000000),
616 (current_cpu_data.cpu_clock % 1000000)/10000);
617 printk("Bus clock: %d.%02dMHz\n",
618 (current_cpu_data.bus_clock / 1000000),
619 (current_cpu_data.bus_clock % 1000000)/10000);
620#ifdef CONFIG_CPU_SUBTYPE_ST40STB1
621 printk("Memory clock: %d.%02dMHz\n",
622 (current_cpu_data.memory_clock / 1000000),
623 (current_cpu_data.memory_clock % 1000000)/10000);
624#endif
625 printk("Module clock: %d.%02dMHz\n",
626 (current_cpu_data.module_clock / 1000000),
627 (current_cpu_data.module_clock % 1000000)/10000);
628
629 interval = (current_cpu_data.module_clock/4 + HZ/2) / HZ;
630
631 printk("Interval = %ld\n", interval);
632
633 /* Start TMU0 */
634 ctrl_outb(0, TMU_TSTR);
635#if !defined(CONFIG_CPU_SUBTYPE_SH7300)
636 ctrl_outb(TMU_TOCR_INIT, TMU_TOCR);
637#endif
638 ctrl_outw(TMU0_TCR_INIT, TMU0_TCR);
639 ctrl_outl(interval, TMU0_TCOR);
640 ctrl_outl(interval, TMU0_TCNT);
641 ctrl_outb(TMU_TSTR_INIT, TMU_TSTR);
642 188
643#if defined(CONFIG_SH_KGDB) 189#if defined(CONFIG_SH_KGDB)
644 /* 190 /*
diff --git a/arch/sh/kernel/timers/Makefile b/arch/sh/kernel/timers/Makefile
new file mode 100644
index 000000000000..151a6a304cec
--- /dev/null
+++ b/arch/sh/kernel/timers/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for the various Linux/SuperH timers
3#
4
5obj-y := timer.o
6
7obj-$(CONFIG_SH_TMU) += timer-tmu.o
8
diff --git a/arch/sh/kernel/timers/timer-tmu.c b/arch/sh/kernel/timers/timer-tmu.c
new file mode 100644
index 000000000000..96a64cb13106
--- /dev/null
+++ b/arch/sh/kernel/timers/timer-tmu.c
@@ -0,0 +1,229 @@
1/*
2 * arch/sh/kernel/timers/timer-tmu.c - TMU Timer Support
3 *
4 * Copyright (C) 2005 Paul Mundt
5 *
6 * TMU handling code hacked out of arch/sh/kernel/time.c
7 *
8 * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka
9 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
10 * Copyright (C) 2002, 2003, 2004 Paul Mundt
11 * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org>
12 *
13 * This file is subject to the terms and conditions of the GNU General Public
14 * License. See the file "COPYING" in the main directory of this archive
15 * for more details.
16 */
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/interrupt.h>
20#include <linux/spinlock.h>
21#include <linux/seqlock.h>
22#include <asm/timer.h>
23#include <asm/rtc.h>
24#include <asm/io.h>
25#include <asm/irq.h>
26#include <asm/clock.h>
27
28#define TMU_TOCR_INIT 0x00
29#define TMU0_TCR_INIT 0x0020
30#define TMU_TSTR_INIT 1
31
32#define TMU0_TCR_CALIB 0x0000
33
34static DEFINE_SPINLOCK(tmu0_lock);
35
36static unsigned long tmu_timer_get_offset(void)
37{
38 int count;
39 unsigned long flags;
40
41 static int count_p = 0x7fffffff; /* for the first call after boot */
42 static unsigned long jiffies_p = 0;
43
44 /*
45 * cache volatile jiffies temporarily; we have IRQs turned off.
46 */
47 unsigned long jiffies_t;
48
49 spin_lock_irqsave(&tmu0_lock, flags);
50 /* timer count may underflow right here */
51 count = ctrl_inl(TMU0_TCNT); /* read the latched count */
52
53 jiffies_t = jiffies;
54
55 /*
56 * avoiding timer inconsistencies (they are rare, but they happen)...
57 * there is one kind of problem that must be avoided here:
58 * 1. the timer counter underflows
59 */
60
61 if (jiffies_t == jiffies_p) {
62 if (count > count_p) {
63 /* the nutcase */
64 if (ctrl_inw(TMU0_TCR) & 0x100) { /* Check UNF bit */
65 count -= LATCH;
66 } else {
67 printk("%s (): hardware timer problem?\n",
68 __FUNCTION__);
69 }
70 }
71 } else
72 jiffies_p = jiffies_t;
73
74 count_p = count;
75 spin_unlock_irqrestore(&tmu0_lock, flags);
76
77 count = ((LATCH-1) - count) * TICK_SIZE;
78 count = (count + LATCH/2) / LATCH;
79
80 return count;
81}
82
83static irqreturn_t tmu_timer_interrupt(int irq, void *dev_id,
84 struct pt_regs *regs)
85{
86 unsigned long timer_status;
87
88 /* Clear UNF bit */
89 timer_status = ctrl_inw(TMU0_TCR);
90 timer_status &= ~0x100;
91 ctrl_outw(timer_status, TMU0_TCR);
92
93 /*
94 * Here we are in the timer irq handler. We just have irqs locally
95 * disabled but we don't know if the timer_bh is running on the other
96 * CPU. We need to avoid to SMP race with it. NOTE: we don' t need
97 * the irq version of write_lock because as just said we have irq
98 * locally disabled. -arca
99 */
100 write_seqlock(&xtime_lock);
101 handle_timer_tick(regs);
102 write_sequnlock(&xtime_lock);
103
104 return IRQ_HANDLED;
105}
106
107static struct irqaction tmu_irq = {
108 .name = "timer",
109 .handler = tmu_timer_interrupt,
110 .flags = SA_INTERRUPT,
111 .mask = CPU_MASK_NONE,
112};
113
114/*
115 * Hah! We'll see if this works (switching from usecs to nsecs).
116 */
117static unsigned long tmu_timer_get_frequency(void)
118{
119 u32 freq;
120 struct timespec ts1, ts2;
121 unsigned long diff_nsec;
122 unsigned long factor;
123
124 /* Setup the timer: We don't want to generate interrupts, just
125 * have it count down at its natural rate.
126 */
127 ctrl_outb(0, TMU_TSTR);
128#if !defined(CONFIG_CPU_SUBTYPE_SH7300) && !defined(CONFIG_CPU_SUBTYPE_SH7760)
129 ctrl_outb(TMU_TOCR_INIT, TMU_TOCR);
130#endif
131 ctrl_outw(TMU0_TCR_CALIB, TMU0_TCR);
132 ctrl_outl(0xffffffff, TMU0_TCOR);
133 ctrl_outl(0xffffffff, TMU0_TCNT);
134
135 rtc_get_time(&ts2);
136
137 do {
138 rtc_get_time(&ts1);
139 } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec);
140
141 /* actually start the timer */
142 ctrl_outb(TMU_TSTR_INIT, TMU_TSTR);
143
144 do {
145 rtc_get_time(&ts2);
146 } while (ts1.tv_nsec == ts2.tv_nsec && ts1.tv_sec == ts2.tv_sec);
147
148 freq = 0xffffffff - ctrl_inl(TMU0_TCNT);
149 if (ts2.tv_nsec < ts1.tv_nsec) {
150 ts2.tv_nsec += 1000000000;
151 ts2.tv_sec--;
152 }
153
154 diff_nsec = (ts2.tv_sec - ts1.tv_sec) * 1000000000 + (ts2.tv_nsec - ts1.tv_nsec);
155
156 /* this should work well if the RTC has a precision of n Hz, where
157 * n is an integer. I don't think we have to worry about the other
158 * cases. */
159 factor = (1000000000 + diff_nsec/2) / diff_nsec;
160
161 if (factor * diff_nsec > 1100000000 ||
162 factor * diff_nsec < 900000000)
163 panic("weird RTC (diff_nsec %ld)", diff_nsec);
164
165 return freq * factor;
166}
167
168static void tmu_clk_init(struct clk *clk)
169{
170 u8 divisor = TMU0_TCR_INIT & 0x7;
171 ctrl_outw(TMU0_TCR_INIT, TMU0_TCR);
172 clk->rate = clk->parent->rate / (4 << (divisor << 1));
173}
174
175static void tmu_clk_recalc(struct clk *clk)
176{
177 u8 divisor = ctrl_inw(TMU0_TCR) & 0x7;
178 clk->rate = clk->parent->rate / (4 << (divisor << 1));
179}
180
181static struct clk_ops tmu_clk_ops = {
182 .init = tmu_clk_init,
183 .recalc = tmu_clk_recalc,
184};
185
186static struct clk tmu0_clk = {
187 .name = "tmu0_clk",
188 .ops = &tmu_clk_ops,
189};
190
191static int tmu_timer_init(void)
192{
193 unsigned long interval;
194
195 setup_irq(TIMER_IRQ, &tmu_irq);
196
197 tmu0_clk.parent = clk_get("module_clk");
198
199 /* Start TMU0 */
200 ctrl_outb(0, TMU_TSTR);
201#if !defined(CONFIG_CPU_SUBTYPE_SH7300) && !defined(CONFIG_CPU_SUBTYPE_SH7760)
202 ctrl_outb(TMU_TOCR_INIT, TMU_TOCR);
203#endif
204
205 clk_register(&tmu0_clk);
206 clk_enable(&tmu0_clk);
207
208 interval = (clk_get_rate(&tmu0_clk) + HZ / 2) / HZ;
209 printk(KERN_INFO "Interval = %ld\n", interval);
210
211 ctrl_outl(interval, TMU0_TCOR);
212 ctrl_outl(interval, TMU0_TCNT);
213
214 ctrl_outb(TMU_TSTR_INIT, TMU_TSTR);
215
216 return 0;
217}
218
219struct sys_timer_ops tmu_timer_ops = {
220 .init = tmu_timer_init,
221 .get_frequency = tmu_timer_get_frequency,
222 .get_offset = tmu_timer_get_offset,
223};
224
225struct sys_timer tmu_timer = {
226 .name = "tmu",
227 .ops = &tmu_timer_ops,
228};
229
diff --git a/arch/sh/kernel/timers/timer.c b/arch/sh/kernel/timers/timer.c
new file mode 100644
index 000000000000..dc1f631053a8
--- /dev/null
+++ b/arch/sh/kernel/timers/timer.c
@@ -0,0 +1,50 @@
1/*
2 * arch/sh/kernel/timers/timer.c - Common timer code
3 *
4 * Copyright (C) 2005 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/kernel.h>
11#include <linux/init.h>
12#include <linux/timer.h>
13#include <linux/string.h>
14#include <asm/timer.h>
15
16static struct sys_timer *sys_timers[] __initdata = {
17#ifdef CONFIG_SH_TMU
18 &tmu_timer,
19#endif
20 NULL,
21};
22
23static char timer_override[10] __initdata;
24static int __init timer_setup(char *str)
25{
26 if (str)
27 strlcpy(timer_override, str, sizeof(timer_override));
28 return 1;
29}
30__setup("timer=", timer_setup);
31
32struct sys_timer *get_sys_timer(void)
33{
34 int i;
35
36 for (i = 0; i < ARRAY_SIZE(sys_timers); i++) {
37 struct sys_timer *t = sys_timers[i];
38
39 if (unlikely(!t))
40 break;
41 if (unlikely(timer_override[0]))
42 if ((strcmp(timer_override, t->name) != 0))
43 continue;
44 if (likely(t->ops->init() == 0))
45 return t;
46 }
47
48 return NULL;
49}
50
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
new file mode 100644
index 000000000000..fb586b1cf8bb
--- /dev/null
+++ b/arch/sh/mm/Kconfig
@@ -0,0 +1,233 @@
1menu "Processor selection"
2
3#
4# Processor families
5#
6config CPU_SH2
7 bool
8 select SH_WRITETHROUGH
9
10config CPU_SH3
11 bool
12 select CPU_HAS_INTEVT
13 select CPU_HAS_SR_RB
14
15config CPU_SH4
16 bool
17 select CPU_HAS_INTEVT
18 select CPU_HAS_SR_RB
19
20config CPU_SH4A
21 bool
22 select CPU_SH4
23 select CPU_HAS_INTC2_IRQ
24
25config CPU_SUBTYPE_ST40
26 bool
27 select CPU_SH4
28 select CPU_HAS_INTC2_IRQ
29
30#
31# Processor subtypes
32#
33
34comment "SH-2 Processor Support"
35
36config CPU_SUBTYPE_SH7604
37 bool "Support SH7604 processor"
38 select CPU_SH2
39
40comment "SH-3 Processor Support"
41
42config CPU_SUBTYPE_SH7300
43 bool "Support SH7300 processor"
44 select CPU_SH3
45
46config CPU_SUBTYPE_SH7705
47 bool "Support SH7705 processor"
48 select CPU_SH3
49 select CPU_HAS_PINT_IRQ
50
51config CPU_SUBTYPE_SH7707
52 bool "Support SH7707 processor"
53 select CPU_SH3
54 select CPU_HAS_PINT_IRQ
55 help
56 Select SH7707 if you have a 60 Mhz SH-3 HD6417707 CPU.
57
58config CPU_SUBTYPE_SH7708
59 bool "Support SH7708 processor"
60 select CPU_SH3
61 help
62 Select SH7708 if you have a 60 Mhz SH-3 HD6417708S or
63 if you have a 100 Mhz SH-3 HD6417708R CPU.
64
65config CPU_SUBTYPE_SH7709
66 bool "Support SH7709 processor"
67 select CPU_SH3
68 select CPU_HAS_PINT_IRQ
69 help
70 Select SH7709 if you have a 80 Mhz SH-3 HD6417709 CPU.
71
72comment "SH-4 Processor Support"
73
74config CPU_SUBTYPE_SH7750
75 bool "Support SH7750 processor"
76 select CPU_SH4
77 help
78 Select SH7750 if you have a 200 Mhz SH-4 HD6417750 CPU.
79
80config CPU_SUBTYPE_SH7091
81 bool "Support SH7091 processor"
82 select CPU_SH4
83 select CPU_SUBTYPE_SH7750
84 help
85 Select SH7091 if you have an SH-4 based Sega device (such as
86 the Dreamcast, Naomi, and Naomi 2).
87
88config CPU_SUBTYPE_SH7750R
89 bool "Support SH7750R processor"
90 select CPU_SH4
91 select CPU_SUBTYPE_SH7750
92
93config CPU_SUBTYPE_SH7750S
94 bool "Support SH7750S processor"
95 select CPU_SH4
96 select CPU_SUBTYPE_SH7750
97
98config CPU_SUBTYPE_SH7751
99 bool "Support SH7751 processor"
100 select CPU_SH4
101 help
102 Select SH7751 if you have a 166 Mhz SH-4 HD6417751 CPU,
103 or if you have a HD6417751R CPU.
104
105config CPU_SUBTYPE_SH7751R
106 bool "Support SH7751R processor"
107 select CPU_SH4
108 select CPU_SUBTYPE_SH7751
109
110config CPU_SUBTYPE_SH7760
111 bool "Support SH7760 processor"
112 select CPU_SH4
113 select CPU_HAS_INTC2_IRQ
114
115config CPU_SUBTYPE_SH4_202
116 bool "Support SH4-202 processor"
117 select CPU_SH4
118
119comment "ST40 Processor Support"
120
121config CPU_SUBTYPE_ST40STB1
122 bool "Support ST40STB1/ST40RA processors"
123 select CPU_SUBTYPE_ST40
124 help
125 Select ST40STB1 if you have a ST40RA CPU.
126 This was previously called the ST40STB1, hence the option name.
127
128config CPU_SUBTYPE_ST40GX1
129 bool "Support ST40GX1 processor"
130 select CPU_SUBTYPE_ST40
131 help
132 Select ST40GX1 if you have a ST40GX1 CPU.
133
134comment "SH-4A Processor Support"
135
136config CPU_SUBTYPE_SH73180
137 bool "Support SH73180 processor"
138 select CPU_SH4A
139
140config CPU_SUBTYPE_SH7770
141 bool "Support SH7770 processor"
142 select CPU_SH4A
143
144config CPU_SUBTYPE_SH7780
145 bool "Support SH7780 processor"
146 select CPU_SH4A
147
148endmenu
149
150menu "Memory management options"
151
152config MMU
153 bool "Support for memory management hardware"
154 depends on !CPU_SH2
155 default y
156 help
157 Some SH processors (such as SH-2/SH-2A) lack an MMU. In order to
158 boot on these systems, this option must not be set.
159
160 On other systems (such as the SH-3 and 4) where an MMU exists,
161 turning this off will boot the kernel on these machines with the
162 MMU implicitly switched off.
163
164config 32BIT
165 bool "Support 32-bit physical addressing through PMB"
166 depends on CPU_SH4A
167 default y
168 help
169 If you say Y here, physical addressing will be extended to
170 32-bits through the SH-4A PMB. If this is not set, legacy
171 29-bit physical addressing will be used.
172
173choice
174 prompt "HugeTLB page size"
175 depends on HUGETLB_PAGE && CPU_SH4 && MMU
176 default HUGETLB_PAGE_SIZE_64K
177
178config HUGETLB_PAGE_SIZE_64K
179 bool "64K"
180
181config HUGETLB_PAGE_SIZE_1MB
182 bool "1MB"
183
184endchoice
185
186source "mm/Kconfig"
187
188endmenu
189
190menu "Cache configuration"
191
192config SH7705_CACHE_32KB
193 bool "Enable 32KB cache size for SH7705"
194 depends on CPU_SUBTYPE_SH7705
195 default y
196
197config SH_DIRECT_MAPPED
198 bool "Use direct-mapped caching"
199 default n
200 help
201 Selecting this option will configure the caches to be direct-mapped,
202 even if the cache supports a 2 or 4-way mode. This is useful primarily
203 for debugging on platforms with 2 and 4-way caches (SH7750R/SH7751R,
204 SH4-202, SH4-501, etc.)
205
206 Turn this option off for platforms that do not have a direct-mapped
207 cache, and you have no need to run the caches in such a configuration.
208
209config SH_WRITETHROUGH
210 bool "Use write-through caching"
211 default y if CPU_SH2
212 help
213 Selecting this option will configure the caches in write-through
214 mode, as opposed to the default write-back configuration.
215
216 Since there's sill some aliasing issues on SH-4, this option will
217 unfortunately still require the majority of flushing functions to
218 be implemented to deal with aliasing.
219
220 If unsure, say N.
221
222config SH_OCRAM
223 bool "Operand Cache RAM (OCRAM) support"
224 help
225 Selecting this option will automatically tear down the number of
226 sets in the dcache by half, which in turn exposes a memory range.
227
228 The addresses for the OC RAM base will vary according to the
229 processor version. Consult vendor documentation for specifics.
230
231 If unsure, say N.
232
233endmenu
diff --git a/arch/sh/mm/ioremap.c b/arch/sh/mm/ioremap.c
index e794e27a72f1..96fa4a999e2a 100644
--- a/arch/sh/mm/ioremap.c
+++ b/arch/sh/mm/ioremap.c
@@ -6,13 +6,19 @@
6 * 640k-1MB IO memory area on PC's 6 * 640k-1MB IO memory area on PC's
7 * 7 *
8 * (C) Copyright 1995 1996 Linus Torvalds 8 * (C) Copyright 1995 1996 Linus Torvalds
9 * (C) Copyright 2005, 2006 Paul Mundt
10 *
11 * This file is subject to the terms and conditions of the GNU General
12 * Public License. See the file "COPYING" in the main directory of this
13 * archive for more details.
9 */ 14 */
10
11#include <linux/vmalloc.h> 15#include <linux/vmalloc.h>
16#include <linux/module.h>
12#include <linux/mm.h> 17#include <linux/mm.h>
13#include <asm/io.h> 18#include <asm/io.h>
14#include <asm/page.h> 19#include <asm/page.h>
15#include <asm/pgalloc.h> 20#include <asm/pgalloc.h>
21#include <asm/addrspace.h>
16#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
17#include <asm/tlbflush.h> 23#include <asm/tlbflush.h>
18 24
@@ -80,9 +86,15 @@ int remap_area_pages(unsigned long address, unsigned long phys_addr,
80 if (address >= end) 86 if (address >= end)
81 BUG(); 87 BUG();
82 do { 88 do {
89 pud_t *pud;
83 pmd_t *pmd; 90 pmd_t *pmd;
84 pmd = pmd_alloc(&init_mm, dir, address); 91
85 error = -ENOMEM; 92 error = -ENOMEM;
93
94 pud = pud_alloc(&init_mm, dir, address);
95 if (!pud)
96 break;
97 pmd = pmd_alloc(&init_mm, pud, address);
86 if (!pmd) 98 if (!pmd)
87 break; 99 break;
88 if (remap_area_pmd(pmd, address, end - address, 100 if (remap_area_pmd(pmd, address, end - address,
@@ -97,10 +109,6 @@ int remap_area_pages(unsigned long address, unsigned long phys_addr,
97} 109}
98 110
99/* 111/*
100 * Generic mapping function (not visible outside):
101 */
102
103/*
104 * Remap an arbitrary physical address space into the kernel virtual 112 * Remap an arbitrary physical address space into the kernel virtual
105 * address space. Needed when the kernel wants to access high addresses 113 * address space. Needed when the kernel wants to access high addresses
106 * directly. 114 * directly.
@@ -109,11 +117,11 @@ int remap_area_pages(unsigned long address, unsigned long phys_addr,
109 * have to convert them into an offset in a page-aligned mapping, but the 117 * have to convert them into an offset in a page-aligned mapping, but the
110 * caller shouldn't need to know that small detail. 118 * caller shouldn't need to know that small detail.
111 */ 119 */
112void * p3_ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) 120void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,
121 unsigned long flags)
113{ 122{
114 void * addr;
115 struct vm_struct * area; 123 struct vm_struct * area;
116 unsigned long offset, last_addr; 124 unsigned long offset, last_addr, addr, orig_addr;
117 125
118 /* Don't allow wraparound or zero size */ 126 /* Don't allow wraparound or zero size */
119 last_addr = phys_addr + size - 1; 127 last_addr = phys_addr + size - 1;
@@ -124,7 +132,7 @@ void * p3_ioremap(unsigned long phys_addr, unsigned long size, unsigned long fla
124 * Don't remap the low PCI/ISA area, it's always mapped.. 132 * Don't remap the low PCI/ISA area, it's always mapped..
125 */ 133 */
126 if (phys_addr >= 0xA0000 && last_addr < 0x100000) 134 if (phys_addr >= 0xA0000 && last_addr < 0x100000)
127 return phys_to_virt(phys_addr); 135 return (void __iomem *)phys_to_virt(phys_addr);
128 136
129 /* 137 /*
130 * Don't allow anybody to remap normal RAM that we're using.. 138 * Don't allow anybody to remap normal RAM that we're using..
@@ -146,16 +154,71 @@ void * p3_ioremap(unsigned long phys_addr, unsigned long size, unsigned long fla
146 if (!area) 154 if (!area)
147 return NULL; 155 return NULL;
148 area->phys_addr = phys_addr; 156 area->phys_addr = phys_addr;
149 addr = area->addr; 157 orig_addr = addr = (unsigned long)area->addr;
150 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { 158
151 vunmap(addr); 159#ifdef CONFIG_32BIT
152 return NULL; 160 /*
161 * First try to remap through the PMB once a valid VMA has been
162 * established. Smaller allocations (or the rest of the size
163 * remaining after a PMB mapping due to the size not being
164 * perfectly aligned on a PMB size boundary) are then mapped
165 * through the UTLB using conventional page tables.
166 *
167 * PMB entries are all pre-faulted.
168 */
169 if (unlikely(size >= 0x1000000)) {
170 unsigned long mapped = pmb_remap(addr, phys_addr, size, flags);
171
172 if (likely(mapped)) {
173 addr += mapped;
174 phys_addr += mapped;
175 size -= mapped;
176 }
153 } 177 }
154 return (void *) (offset + (char *)addr); 178#endif
179
180 if (likely(size))
181 if (remap_area_pages(addr, phys_addr, size, flags)) {
182 vunmap((void *)orig_addr);
183 return NULL;
184 }
185
186 return (void __iomem *)(offset + (char *)orig_addr);
155} 187}
188EXPORT_SYMBOL(__ioremap);
156 189
157void p3_iounmap(void *addr) 190void __iounmap(void __iomem *addr)
158{ 191{
159 if (addr > high_memory) 192 unsigned long vaddr = (unsigned long __force)addr;
160 vfree((void *)(PAGE_MASK & (unsigned long)addr)); 193 struct vm_struct *p;
194
195 if (PXSEG(vaddr) < P3SEG)
196 return;
197
198#ifdef CONFIG_32BIT
199 /*
200 * Purge any PMB entries that may have been established for this
201 * mapping, then proceed with conventional VMA teardown.
202 *
203 * XXX: Note that due to the way that remove_vm_area() does
204 * matching of the resultant VMA, we aren't able to fast-forward
205 * the address past the PMB space until the end of the VMA where
206 * the page tables reside. As such, unmap_vm_area() will be
207 * forced to linearly scan over the area until it finds the page
208 * tables where PTEs that need to be unmapped actually reside,
209 * which is far from optimal. Perhaps we need to use a separate
210 * VMA for the PMB mappings?
211 * -- PFM.
212 */
213 pmb_unmap(vaddr);
214#endif
215
216 p = remove_vm_area((void *)(vaddr & PAGE_MASK));
217 if (!p) {
218 printk(KERN_ERR "%s: bad address %p\n", __FUNCTION__, addr);
219 return;
220 }
221
222 kfree(p);
161} 223}
224EXPORT_SYMBOL(__iounmap);
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types
index 0693fbd1f956..182fe9092577 100644
--- a/arch/sh/tools/mach-types
+++ b/arch/sh/tools/mach-types
@@ -10,10 +10,7 @@ SE SH_SOLUTION_ENGINE
107300SE SH_7300_SOLUTION_ENGINE 107300SE SH_7300_SOLUTION_ENGINE
1173180SE SH_73180_SOLUTION_ENGINE 1173180SE SH_73180_SOLUTION_ENGINE
127751SYSTEMH SH_7751_SYSTEMH 127751SYSTEMH SH_7751_SYSTEMH
13HP600 SH_HP600 13HP6XX SH_HP6XX
14HP620 SH_HP620
15HP680 SH_HP680
16HP690 SH_HP690
17HD64461 HD64461 14HD64461 HD64461
18HD64465 HD64465 15HD64465 HD64465
19SH2000 SH_SH2000 16SH2000 SH_SH2000
diff --git a/arch/sh64/Kconfig b/arch/sh64/Kconfig
index fb35b45dc130..07b172deb872 100644
--- a/arch/sh64/Kconfig
+++ b/arch/sh64/Kconfig
@@ -17,10 +17,6 @@ config MMU
17 bool 17 bool
18 default y 18 default y
19 19
20config UID16
21 bool
22 default y
23
24config RWSEM_GENERIC_SPINLOCK 20config RWSEM_GENERIC_SPINLOCK
25 bool 21 bool
26 default y 22 default y
diff --git a/arch/sh64/kernel/process.c b/arch/sh64/kernel/process.c
index b95d04141855..1da9c61d6823 100644
--- a/arch/sh64/kernel/process.c
+++ b/arch/sh64/kernel/process.c
@@ -744,7 +744,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
744 } 744 }
745#endif 745#endif
746 /* Copy from sh version */ 746 /* Copy from sh version */
747 childregs = ((struct pt_regs *)(THREAD_SIZE + (unsigned long) p->thread_info )) - 1; 747 childregs = (struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1;
748 748
749 *childregs = *regs; 749 *childregs = *regs;
750 750
@@ -752,7 +752,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
752 childregs->regs[15] = usp; 752 childregs->regs[15] = usp;
753 p->thread.uregs = childregs; 753 p->thread.uregs = childregs;
754 } else { 754 } else {
755 childregs->regs[15] = (unsigned long)p->thread_info + THREAD_SIZE; 755 childregs->regs[15] = (unsigned long)task_stack_page(p) + THREAD_SIZE;
756 } 756 }
757 757
758 childregs->regs[9] = 0; /* Set return value for child */ 758 childregs->regs[9] = 0; /* Set return value for child */
@@ -775,26 +775,6 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
775 return 0; 775 return 0;
776} 776}
777 777
778/*
779 * fill in the user structure for a core dump..
780 */
781void dump_thread(struct pt_regs * regs, struct user * dump)
782{
783 dump->magic = CMAGIC;
784 dump->start_code = current->mm->start_code;
785 dump->start_data = current->mm->start_data;
786 dump->start_stack = regs->regs[15] & ~(PAGE_SIZE - 1);
787 dump->u_tsize = (current->mm->end_code - dump->start_code) >> PAGE_SHIFT;
788 dump->u_dsize = (current->mm->brk + (PAGE_SIZE-1) - dump->start_data) >> PAGE_SHIFT;
789 dump->u_ssize = (current->mm->start_stack - dump->start_stack +
790 PAGE_SIZE - 1) >> PAGE_SHIFT;
791 /* Debug registers will come here. */
792
793 dump->regs = *regs;
794
795 dump->u_fpvalid = dump_fpu(regs, &dump->fpu);
796}
797
798asmlinkage int sys_fork(unsigned long r2, unsigned long r3, 778asmlinkage int sys_fork(unsigned long r2, unsigned long r3,
799 unsigned long r4, unsigned long r5, 779 unsigned long r4, unsigned long r5,
800 unsigned long r6, unsigned long r7, 780 unsigned long r6, unsigned long r7,
diff --git a/arch/sh64/kernel/sh_ksyms.c b/arch/sh64/kernel/sh_ksyms.c
index 0b5497d70bd3..472b450e61be 100644
--- a/arch/sh64/kernel/sh_ksyms.c
+++ b/arch/sh64/kernel/sh_ksyms.c
@@ -29,7 +29,6 @@
29#include <asm/delay.h> 29#include <asm/delay.h>
30#include <asm/irq.h> 30#include <asm/irq.h>
31 31
32extern void dump_thread(struct pt_regs *, struct user *);
33extern int dump_fpu(struct pt_regs *, elf_fpregset_t *); 32extern int dump_fpu(struct pt_regs *, elf_fpregset_t *);
34 33
35#if 0 34#if 0
@@ -41,7 +40,6 @@ EXPORT_SYMBOL(drive_info);
41#endif 40#endif
42 41
43/* platform dependent support */ 42/* platform dependent support */
44EXPORT_SYMBOL(dump_thread);
45EXPORT_SYMBOL(dump_fpu); 43EXPORT_SYMBOL(dump_fpu);
46EXPORT_SYMBOL(iounmap); 44EXPORT_SYMBOL(iounmap);
47EXPORT_SYMBOL(enable_irq); 45EXPORT_SYMBOL(enable_irq);
diff --git a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c
index 870fe5327e09..1195af37ee5a 100644
--- a/arch/sh64/kernel/time.c
+++ b/arch/sh64/kernel/time.c
@@ -417,7 +417,7 @@ static __init unsigned int get_cpu_hz(void)
417 /* 417 /*
418 ** Regardless the toolchain, force the compiler to use the 418 ** Regardless the toolchain, force the compiler to use the
419 ** arbitrary register r3 as a clock tick counter. 419 ** arbitrary register r3 as a clock tick counter.
420 ** NOTE: r3 must be in accordance with rtc_interrupt() 420 ** NOTE: r3 must be in accordance with sh64_rtc_interrupt()
421 */ 421 */
422 register unsigned long long __rtc_irq_flag __asm__ ("r3"); 422 register unsigned long long __rtc_irq_flag __asm__ ("r3");
423 423
@@ -482,7 +482,8 @@ static __init unsigned int get_cpu_hz(void)
482#endif 482#endif
483} 483}
484 484
485static irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs) 485static irqreturn_t sh64_rtc_interrupt(int irq, void *dev_id,
486 struct pt_regs *regs)
486{ 487{
487 ctrl_outb(0, RCR1); /* Disable Carry Interrupts */ 488 ctrl_outb(0, RCR1); /* Disable Carry Interrupts */
488 regs->regs[3] = 1; /* Using r3 */ 489 regs->regs[3] = 1; /* Using r3 */
@@ -491,7 +492,7 @@ static irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
491} 492}
492 493
493static struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL}; 494static struct irqaction irq0 = { timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL};
494static struct irqaction irq1 = { rtc_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "rtc", NULL, NULL}; 495static struct irqaction irq1 = { sh64_rtc_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "rtc", NULL, NULL};
495 496
496void __init time_init(void) 497void __init time_init(void)
497{ 498{
diff --git a/arch/sh64/lib/dbg.c b/arch/sh64/lib/dbg.c
index 526fedae6db8..58087331b8a6 100644
--- a/arch/sh64/lib/dbg.c
+++ b/arch/sh64/lib/dbg.c
@@ -174,7 +174,7 @@ void evt_debug(int evt, int ret_addr, int event, int tra, struct pt_regs *regs)
174 struct ring_node *rr; 174 struct ring_node *rr;
175 175
176 pid = current->pid; 176 pid = current->pid;
177 stack_bottom = (unsigned long) current->thread_info; 177 stack_bottom = (unsigned long) task_stack_page(current);
178 asm volatile("ori r15, 0, %0" : "=r" (sp)); 178 asm volatile("ori r15, 0, %0" : "=r" (sp));
179 rr = event_ring + event_ptr; 179 rr = event_ring + event_ptr;
180 rr->evt = evt; 180 rr->evt = evt;
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 3cfb8be3ff6d..f944b58cdfe7 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -9,10 +9,6 @@ config MMU
9 bool 9 bool
10 default y 10 default y
11 11
12config UID16
13 bool
14 default y
15
16config HIGHMEM 12config HIGHMEM
17 bool 13 bool
18 default y 14 default y
@@ -55,6 +51,10 @@ config NR_CPUS
55 depends on SMP 51 depends on SMP
56 default "32" 52 default "32"
57 53
54config SPARC
55 bool
56 default y
57
58# Identify this as a Sparc32 build 58# Identify this as a Sparc32 build
59config SPARC32 59config SPARC32
60 bool 60 bool
diff --git a/arch/sparc/Makefile b/arch/sparc/Makefile
index dea48f6cff38..4cdbb2d59ed0 100644
--- a/arch/sparc/Makefile
+++ b/arch/sparc/Makefile
@@ -34,7 +34,7 @@ libs-y += arch/sparc/prom/ arch/sparc/lib/
34# Renaming is done to avoid confusing pattern matching rules in 2.5.45 (multy-) 34# Renaming is done to avoid confusing pattern matching rules in 2.5.45 (multy-)
35INIT_Y := $(patsubst %/, %/built-in.o, $(init-y)) 35INIT_Y := $(patsubst %/, %/built-in.o, $(init-y))
36CORE_Y := $(core-y) 36CORE_Y := $(core-y)
37CORE_Y += kernel/ mm/ fs/ ipc/ security/ crypto/ 37CORE_Y += kernel/ mm/ fs/ ipc/ security/ crypto/ block/
38CORE_Y := $(patsubst %/, %/built-in.o, $(CORE_Y)) 38CORE_Y := $(patsubst %/, %/built-in.o, $(CORE_Y))
39DRIVERS_Y := $(patsubst %/, %/built-in.o, $(drivers-y)) 39DRIVERS_Y := $(patsubst %/, %/built-in.o, $(drivers-y))
40NET_Y := $(patsubst %/, %/built-in.o, $(net-y)) 40NET_Y := $(patsubst %/, %/built-in.o, $(net-y))
diff --git a/arch/sparc/kernel/ebus.c b/arch/sparc/kernel/ebus.c
index 1754192c69d0..5c3529ceb5d6 100644
--- a/arch/sparc/kernel/ebus.c
+++ b/arch/sparc/kernel/ebus.c
@@ -22,7 +22,7 @@
22#include <asm/oplib.h> 22#include <asm/oplib.h>
23#include <asm/bpp.h> 23#include <asm/bpp.h>
24 24
25struct linux_ebus *ebus_chain = 0; 25struct linux_ebus *ebus_chain = NULL;
26 26
27/* We are together with pcic.c under CONFIG_PCI. */ 27/* We are together with pcic.c under CONFIG_PCI. */
28extern unsigned int pcic_pin_to_irq(unsigned int, char *name); 28extern unsigned int pcic_pin_to_irq(unsigned int, char *name);
@@ -46,7 +46,7 @@ static struct ebus_device_irq je1_1[] = {
46 { "SUNW,CS4231", 0 }, 46 { "SUNW,CS4231", 0 },
47 { "parallel", 0 }, 47 { "parallel", 0 },
48 { "se", 2 }, 48 { "se", 2 },
49 { 0, 0 } 49 { NULL, 0 }
50}; 50};
51 51
52/* 52/*
@@ -55,7 +55,7 @@ static struct ebus_device_irq je1_1[] = {
55 */ 55 */
56static struct ebus_system_entry ebus_blacklist[] = { 56static struct ebus_system_entry ebus_blacklist[] = {
57 { "SUNW,JavaEngine1", je1_1 }, 57 { "SUNW,JavaEngine1", je1_1 },
58 { 0, 0 } 58 { NULL, NULL }
59}; 59};
60 60
61static struct ebus_device_irq *ebus_blackp = NULL; 61static struct ebus_device_irq *ebus_blackp = NULL;
@@ -233,7 +233,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev)
233 ebus_alloc(sizeof(struct linux_ebus_child)); 233 ebus_alloc(sizeof(struct linux_ebus_child));
234 234
235 child = dev->children; 235 child = dev->children;
236 child->next = 0; 236 child->next = NULL;
237 child->parent = dev; 237 child->parent = dev;
238 child->bus = dev->bus; 238 child->bus = dev->bus;
239 fill_ebus_child(node, &regs[0], child); 239 fill_ebus_child(node, &regs[0], child);
@@ -243,7 +243,7 @@ void __init fill_ebus_device(int node, struct linux_ebus_device *dev)
243 ebus_alloc(sizeof(struct linux_ebus_child)); 243 ebus_alloc(sizeof(struct linux_ebus_child));
244 244
245 child = child->next; 245 child = child->next;
246 child->next = 0; 246 child->next = NULL;
247 child->parent = dev; 247 child->parent = dev;
248 child->bus = dev->bus; 248 child->bus = dev->bus;
249 fill_ebus_child(node, &regs[0], child); 249 fill_ebus_child(node, &regs[0], child);
@@ -275,7 +275,7 @@ void __init ebus_init(void)
275 } 275 }
276 } 276 }
277 277
278 pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, 0); 278 pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_DEVICE_ID_SUN_EBUS, NULL);
279 if (!pdev) { 279 if (!pdev) {
280 return; 280 return;
281 } 281 }
@@ -284,7 +284,7 @@ void __init ebus_init(void)
284 284
285 ebus_chain = ebus = (struct linux_ebus *) 285 ebus_chain = ebus = (struct linux_ebus *)
286 ebus_alloc(sizeof(struct linux_ebus)); 286 ebus_alloc(sizeof(struct linux_ebus));
287 ebus->next = 0; 287 ebus->next = NULL;
288 288
289 while (ebusnd) { 289 while (ebusnd) {
290 290
@@ -325,8 +325,8 @@ void __init ebus_init(void)
325 ebus_alloc(sizeof(struct linux_ebus_device)); 325 ebus_alloc(sizeof(struct linux_ebus_device));
326 326
327 dev = ebus->devices; 327 dev = ebus->devices;
328 dev->next = 0; 328 dev->next = NULL;
329 dev->children = 0; 329 dev->children = NULL;
330 dev->bus = ebus; 330 dev->bus = ebus;
331 fill_ebus_device(nd, dev); 331 fill_ebus_device(nd, dev);
332 332
@@ -335,8 +335,8 @@ void __init ebus_init(void)
335 ebus_alloc(sizeof(struct linux_ebus_device)); 335 ebus_alloc(sizeof(struct linux_ebus_device));
336 336
337 dev = dev->next; 337 dev = dev->next;
338 dev->next = 0; 338 dev->next = NULL;
339 dev->children = 0; 339 dev->children = NULL;
340 dev->bus = ebus; 340 dev->bus = ebus;
341 fill_ebus_device(nd, dev); 341 fill_ebus_device(nd, dev);
342 } 342 }
@@ -353,7 +353,7 @@ void __init ebus_init(void)
353 ebus->next = (struct linux_ebus *) 353 ebus->next = (struct linux_ebus *)
354 ebus_alloc(sizeof(struct linux_ebus)); 354 ebus_alloc(sizeof(struct linux_ebus));
355 ebus = ebus->next; 355 ebus = ebus->next;
356 ebus->next = 0; 356 ebus->next = NULL;
357 ++num_ebus; 357 ++num_ebus;
358 } 358 }
359 if (pdev) 359 if (pdev)
diff --git a/arch/sparc/kernel/entry.S b/arch/sparc/kernel/entry.S
index 03ecb4e4614e..c51d08d218ef 100644
--- a/arch/sparc/kernel/entry.S
+++ b/arch/sparc/kernel/entry.S
@@ -1277,62 +1277,6 @@ sys_sigstack:
1277 mov %l5, %o7 1277 mov %l5, %o7
1278 1278
1279 .align 4 1279 .align 4
1280 .globl sys_sigpause
1281sys_sigpause:
1282 /* Note: %o0 already has correct value... */
1283 call do_sigpause
1284 add %sp, STACKFRAME_SZ, %o1
1285
1286 ld [%curptr + TI_FLAGS], %l5
1287 andcc %l5, _TIF_SYSCALL_TRACE, %g0
1288 be 1f
1289 nop
1290
1291 call syscall_trace
1292 nop
1293
12941:
1295 /* We are returning to a signal handler. */
1296 RESTORE_ALL
1297
1298 .align 4
1299 .globl sys_sigsuspend
1300sys_sigsuspend:
1301 call do_sigsuspend
1302 add %sp, STACKFRAME_SZ, %o0
1303
1304 ld [%curptr + TI_FLAGS], %l5
1305 andcc %l5, _TIF_SYSCALL_TRACE, %g0
1306 be 1f
1307 nop
1308
1309 call syscall_trace
1310 nop
1311
13121:
1313 /* We are returning to a signal handler. */
1314 RESTORE_ALL
1315
1316 .align 4
1317 .globl sys_rt_sigsuspend
1318sys_rt_sigsuspend:
1319 /* Note: %o0, %o1 already have correct value... */
1320 call do_rt_sigsuspend
1321 add %sp, STACKFRAME_SZ, %o2
1322
1323 ld [%curptr + TI_FLAGS], %l5
1324 andcc %l5, _TIF_SYSCALL_TRACE, %g0
1325 be 1f
1326 nop
1327
1328 call syscall_trace
1329 nop
1330
13311:
1332 /* We are returning to a signal handler. */
1333 RESTORE_ALL
1334
1335 .align 4
1336 .globl sys_sigreturn 1280 .globl sys_sigreturn
1337sys_sigreturn: 1281sys_sigreturn:
1338 call do_sigreturn 1282 call do_sigreturn
diff --git a/arch/sparc/kernel/led.c b/arch/sparc/kernel/led.c
index 2a3afca453c9..313d1620ae8e 100644
--- a/arch/sparc/kernel/led.c
+++ b/arch/sparc/kernel/led.c
@@ -55,7 +55,7 @@ static int led_read_proc(char *buf, char **start, off_t offset, int count,
55 return len; 55 return len;
56} 56}
57 57
58static int led_write_proc(struct file *file, const char *buffer, 58static int led_write_proc(struct file *file, const char __user *buffer,
59 unsigned long count, void *data) 59 unsigned long count, void *data)
60{ 60{
61 char *buf = NULL; 61 char *buf = NULL;
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index cccfc12802ed..42002b742deb 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -161,7 +161,7 @@ static struct pcic_sn2list pcic_known_sysnames[] = {
161static int pcic0_up; 161static int pcic0_up;
162static struct linux_pcic pcic0; 162static struct linux_pcic pcic0;
163 163
164void * __iomem pcic_regs; 164void __iomem *pcic_regs;
165volatile int pcic_speculative; 165volatile int pcic_speculative;
166volatile int pcic_trapped; 166volatile int pcic_trapped;
167 167
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index ea8647411462..fbb05a452e51 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -302,7 +302,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
302 int count = 0; 302 int count = 0;
303 303
304 if (tsk != NULL) 304 if (tsk != NULL)
305 task_base = (unsigned long) tsk->thread_info; 305 task_base = (unsigned long) task_stack_page(tsk);
306 else 306 else
307 task_base = (unsigned long) current_thread_info(); 307 task_base = (unsigned long) current_thread_info();
308 308
@@ -337,7 +337,7 @@ EXPORT_SYMBOL(dump_stack);
337 */ 337 */
338unsigned long thread_saved_pc(struct task_struct *tsk) 338unsigned long thread_saved_pc(struct task_struct *tsk)
339{ 339{
340 return tsk->thread_info->kpc; 340 return task_thread_info(tsk)->kpc;
341} 341}
342 342
343/* 343/*
@@ -392,7 +392,7 @@ void flush_thread(void)
392 /* We must fixup kregs as well. */ 392 /* We must fixup kregs as well. */
393 /* XXX This was not fixed for ti for a while, worked. Unused? */ 393 /* XXX This was not fixed for ti for a while, worked. Unused? */
394 current->thread.kregs = (struct pt_regs *) 394 current->thread.kregs = (struct pt_regs *)
395 ((char *)current->thread_info + (THREAD_SIZE - TRACEREG_SZ)); 395 (task_stack_page(current) + (THREAD_SIZE - TRACEREG_SZ));
396 } 396 }
397} 397}
398 398
@@ -459,7 +459,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
459 unsigned long unused, 459 unsigned long unused,
460 struct task_struct *p, struct pt_regs *regs) 460 struct task_struct *p, struct pt_regs *regs)
461{ 461{
462 struct thread_info *ti = p->thread_info; 462 struct thread_info *ti = task_thread_info(p);
463 struct pt_regs *childregs; 463 struct pt_regs *childregs;
464 char *new_stack; 464 char *new_stack;
465 465
@@ -482,7 +482,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
482 * V V (stk.fr.) V (pt_regs) { (stk.fr.) } 482 * V V (stk.fr.) V (pt_regs) { (stk.fr.) }
483 * +----- - - - - - ------+===========+============={+==========}+ 483 * +----- - - - - - ------+===========+============={+==========}+
484 */ 484 */
485 new_stack = (char*)ti + THREAD_SIZE; 485 new_stack = task_stack_page(p) + THREAD_SIZE;
486 if (regs->psr & PSR_PS) 486 if (regs->psr & PSR_PS)
487 new_stack -= STACKFRAME_SZ; 487 new_stack -= STACKFRAME_SZ;
488 new_stack -= STACKFRAME_SZ + TRACEREG_SZ; 488 new_stack -= STACKFRAME_SZ + TRACEREG_SZ;
@@ -724,7 +724,7 @@ unsigned long get_wchan(struct task_struct *task)
724 task->state == TASK_RUNNING) 724 task->state == TASK_RUNNING)
725 goto out; 725 goto out;
726 726
727 fp = task->thread_info->ksp + bias; 727 fp = task_thread_info(task)->ksp + bias;
728 do { 728 do {
729 /* Bogus frame pointer? */ 729 /* Bogus frame pointer? */
730 if (fp < (task_base + sizeof(struct thread_info)) || 730 if (fp < (task_base + sizeof(struct thread_info)) ||
diff --git a/arch/sparc/kernel/ptrace.c b/arch/sparc/kernel/ptrace.c
index 475c4c13462c..1baf13ed5c3a 100644
--- a/arch/sparc/kernel/ptrace.c
+++ b/arch/sparc/kernel/ptrace.c
@@ -75,7 +75,7 @@ static inline void read_sunos_user(struct pt_regs *regs, unsigned long offset,
75 struct task_struct *tsk, long __user *addr) 75 struct task_struct *tsk, long __user *addr)
76{ 76{
77 struct pt_regs *cregs = tsk->thread.kregs; 77 struct pt_regs *cregs = tsk->thread.kregs;
78 struct thread_info *t = tsk->thread_info; 78 struct thread_info *t = task_thread_info(tsk);
79 int v; 79 int v;
80 80
81 if(offset >= 1024) 81 if(offset >= 1024)
@@ -170,7 +170,7 @@ static inline void write_sunos_user(struct pt_regs *regs, unsigned long offset,
170 struct task_struct *tsk) 170 struct task_struct *tsk)
171{ 171{
172 struct pt_regs *cregs = tsk->thread.kregs; 172 struct pt_regs *cregs = tsk->thread.kregs;
173 struct thread_info *t = tsk->thread_info; 173 struct thread_info *t = task_thread_info(tsk);
174 unsigned long value = regs->u_regs[UREG_I3]; 174 unsigned long value = regs->u_regs[UREG_I3];
175 175
176 if(offset >= 1024) 176 if(offset >= 1024)
@@ -286,40 +286,17 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
286 s, (int) request, (int) pid, addr, data, addr2); 286 s, (int) request, (int) pid, addr, data, addr2);
287 } 287 }
288#endif 288#endif
289 if (request == PTRACE_TRACEME) {
290 int my_ret;
291
292 /* are we already being traced? */
293 if (current->ptrace & PT_PTRACED) {
294 pt_error_return(regs, EPERM);
295 goto out;
296 }
297 my_ret = security_ptrace(current->parent, current);
298 if (my_ret) {
299 pt_error_return(regs, -my_ret);
300 goto out;
301 }
302 289
303 /* set the ptrace bit in the process flags. */ 290 if (request == PTRACE_TRACEME) {
304 current->ptrace |= PT_PTRACED; 291 ret = ptrace_traceme();
305 pt_succ_return(regs, 0); 292 pt_succ_return(regs, 0);
306 goto out; 293 goto out;
307 } 294 }
308#ifndef ALLOW_INIT_TRACING
309 if (pid == 1) {
310 /* Can't dork with init. */
311 pt_error_return(regs, EPERM);
312 goto out;
313 }
314#endif
315 read_lock(&tasklist_lock);
316 child = find_task_by_pid(pid);
317 if (child)
318 get_task_struct(child);
319 read_unlock(&tasklist_lock);
320 295
321 if (!child) { 296 child = ptrace_get_task_struct(pid);
322 pt_error_return(regs, ESRCH); 297 if (IS_ERR(child)) {
298 ret = PTR_ERR(child);
299 pt_error_return(regs, -ret);
323 goto out; 300 goto out;
324 } 301 }
325 302
diff --git a/arch/sparc/kernel/rtrap.S b/arch/sparc/kernel/rtrap.S
index f7460d897e79..77ca6fd81253 100644
--- a/arch/sparc/kernel/rtrap.S
+++ b/arch/sparc/kernel/rtrap.S
@@ -68,15 +68,14 @@ ret_trap_lockless_ipi:
68 68
69 ld [%curptr + TI_FLAGS], %g2 69 ld [%curptr + TI_FLAGS], %g2
70signal_p: 70signal_p:
71 andcc %g2, (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING), %g0 71 andcc %g2, (_TIF_SIGPENDING|_TIF_RESTORE_SIGMASK), %g0
72 bz,a ret_trap_continue 72 bz,a ret_trap_continue
73 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr 73 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr
74 74
75 clr %o0 75 mov %l5, %o1
76 mov %l5, %o2 76 mov %l6, %o2
77 mov %l6, %o3
78 call do_signal 77 call do_signal
79 add %sp, STACKFRAME_SZ, %o1 ! pt_regs ptr 78 add %sp, STACKFRAME_SZ, %o0 ! pt_regs ptr
80 79
81 /* Fall through. */ 80 /* Fall through. */
82 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr 81 ld [%sp + STACKFRAME_SZ + PT_PSR], %t_psr
diff --git a/arch/sparc/kernel/signal.c b/arch/sparc/kernel/signal.c
index 5f34d7dc2b89..0748d8147bbf 100644
--- a/arch/sparc/kernel/signal.c
+++ b/arch/sparc/kernel/signal.c
@@ -35,9 +35,6 @@ extern void fpsave(unsigned long *fpregs, unsigned long *fsr,
35 void *fpqueue, unsigned long *fpqdepth); 35 void *fpqueue, unsigned long *fpqdepth);
36extern void fpload(unsigned long *fpregs, unsigned long *fsr); 36extern void fpload(unsigned long *fpregs, unsigned long *fsr);
37 37
38asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
39 unsigned long orig_o0, int restart_syscall);
40
41/* Signal frames: the original one (compatible with SunOS): 38/* Signal frames: the original one (compatible with SunOS):
42 * 39 *
43 * Set up a signal frame... Make the stack look the way SunOS 40 * Set up a signal frame... Make the stack look the way SunOS
@@ -95,98 +92,30 @@ struct rt_signal_frame {
95#define NF_ALIGNEDSZ (((sizeof(struct new_signal_frame) + 7) & (~7))) 92#define NF_ALIGNEDSZ (((sizeof(struct new_signal_frame) + 7) & (~7)))
96#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame) + 7) & (~7))) 93#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame) + 7) & (~7)))
97 94
98/* 95static int _sigpause_common(old_sigset_t set)
99 * atomically swap in the new signal mask, and wait for a signal.
100 * This is really tricky on the Sparc, watch out...
101 */
102asmlinkage void _sigpause_common(old_sigset_t set, struct pt_regs *regs)
103{ 96{
104 sigset_t saveset;
105
106 set &= _BLOCKABLE; 97 set &= _BLOCKABLE;
107 spin_lock_irq(&current->sighand->siglock); 98 spin_lock_irq(&current->sighand->siglock);
108 saveset = current->blocked; 99 current->saved_sigmask = current->blocked;
109 siginitset(&current->blocked, set); 100 siginitset(&current->blocked, set);
110 recalc_sigpending(); 101 recalc_sigpending();
111 spin_unlock_irq(&current->sighand->siglock); 102 spin_unlock_irq(&current->sighand->siglock);
112 103
113 regs->pc = regs->npc; 104 current->state = TASK_INTERRUPTIBLE;
114 regs->npc += 4; 105 schedule();
115 106 set_thread_flag(TIF_RESTORE_SIGMASK);
116 /* Condition codes and return value where set here for sigpause,
117 * and so got used by setup_frame, which again causes sigreturn()
118 * to return -EINTR.
119 */
120 while (1) {
121 current->state = TASK_INTERRUPTIBLE;
122 schedule();
123 /*
124 * Return -EINTR and set condition code here,
125 * so the interrupted system call actually returns
126 * these.
127 */
128 regs->psr |= PSR_C;
129 regs->u_regs[UREG_I0] = EINTR;
130 if (do_signal(&saveset, regs, 0, 0))
131 return;
132 }
133}
134 107
135asmlinkage void do_sigpause(unsigned int set, struct pt_regs *regs) 108 return -ERESTARTNOHAND;
136{
137 _sigpause_common(set, regs);
138} 109}
139 110
140asmlinkage void do_sigsuspend (struct pt_regs *regs) 111asmlinkage int sys_sigpause(unsigned int set)
141{ 112{
142 _sigpause_common(regs->u_regs[UREG_I0], regs); 113 return _sigpause_common(set);
143} 114}
144 115
145asmlinkage void do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, 116asmlinkage int sys_sigsuspend(old_sigset_t set)
146 struct pt_regs *regs)
147{ 117{
148 sigset_t oldset, set; 118 return _sigpause_common(set);
149
150 /* XXX: Don't preclude handling different sized sigset_t's. */
151 if (sigsetsize != sizeof(sigset_t)) {
152 regs->psr |= PSR_C;
153 regs->u_regs[UREG_I0] = EINVAL;
154 return;
155 }
156
157 if (copy_from_user(&set, uset, sizeof(set))) {
158 regs->psr |= PSR_C;
159 regs->u_regs[UREG_I0] = EFAULT;
160 return;
161 }
162
163 sigdelsetmask(&set, ~_BLOCKABLE);
164 spin_lock_irq(&current->sighand->siglock);
165 oldset = current->blocked;
166 current->blocked = set;
167 recalc_sigpending();
168 spin_unlock_irq(&current->sighand->siglock);
169
170 regs->pc = regs->npc;
171 regs->npc += 4;
172
173 /* Condition codes and return value where set here for sigpause,
174 * and so got used by setup_frame, which again causes sigreturn()
175 * to return -EINTR.
176 */
177 while (1) {
178 current->state = TASK_INTERRUPTIBLE;
179 schedule();
180 /*
181 * Return -EINTR and set condition code here,
182 * so the interrupted system call actually returns
183 * these.
184 */
185 regs->psr |= PSR_C;
186 regs->u_regs[UREG_I0] = EINTR;
187 if (do_signal(&oldset, regs, 0, 0))
188 return;
189 }
190} 119}
191 120
192static inline int 121static inline int
@@ -1067,13 +996,13 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
1067 * want to handle. Thus you cannot kill init even with a SIGKILL even by 996 * want to handle. Thus you cannot kill init even with a SIGKILL even by
1068 * mistake. 997 * mistake.
1069 */ 998 */
1070asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs, 999asmlinkage void do_signal(struct pt_regs * regs, unsigned long orig_i0, int restart_syscall)
1071 unsigned long orig_i0, int restart_syscall)
1072{ 1000{
1073 siginfo_t info; 1001 siginfo_t info;
1074 struct sparc_deliver_cookie cookie; 1002 struct sparc_deliver_cookie cookie;
1075 struct k_sigaction ka; 1003 struct k_sigaction ka;
1076 int signr; 1004 int signr;
1005 sigset_t *oldset;
1077 1006
1078 /* 1007 /*
1079 * XXX Disable svr4 signal handling until solaris emulation works. 1008 * XXX Disable svr4 signal handling until solaris emulation works.
@@ -1089,7 +1018,9 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
1089 cookie.restart_syscall = restart_syscall; 1018 cookie.restart_syscall = restart_syscall;
1090 cookie.orig_i0 = orig_i0; 1019 cookie.orig_i0 = orig_i0;
1091 1020
1092 if (!oldset) 1021 if (test_thread_flag(TIF_RESTORE_SIGMASK))
1022 oldset = &current->saved_sigmask;
1023 else
1093 oldset = &current->blocked; 1024 oldset = &current->blocked;
1094 1025
1095 signr = get_signal_to_deliver(&info, &ka, regs, &cookie); 1026 signr = get_signal_to_deliver(&info, &ka, regs, &cookie);
@@ -1098,7 +1029,14 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
1098 syscall_restart(cookie.orig_i0, regs, &ka.sa); 1029 syscall_restart(cookie.orig_i0, regs, &ka.sa);
1099 handle_signal(signr, &ka, &info, oldset, 1030 handle_signal(signr, &ka, &info, oldset,
1100 regs, svr4_signal); 1031 regs, svr4_signal);
1101 return 1; 1032 /* a signal was successfully delivered; the saved
1033 * sigmask will have been stored in the signal frame,
1034 * and will be restored by sigreturn, so we can simply
1035 * clear the TIF_RESTORE_SIGMASK flag.
1036 */
1037 if (test_thread_flag(TIF_RESTORE_SIGMASK))
1038 clear_thread_flag(TIF_RESTORE_SIGMASK);
1039 return;
1102 } 1040 }
1103 if (cookie.restart_syscall && 1041 if (cookie.restart_syscall &&
1104 (regs->u_regs[UREG_I0] == ERESTARTNOHAND || 1042 (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
@@ -1115,7 +1053,14 @@ asmlinkage int do_signal(sigset_t *oldset, struct pt_regs * regs,
1115 regs->pc -= 4; 1053 regs->pc -= 4;
1116 regs->npc -= 4; 1054 regs->npc -= 4;
1117 } 1055 }
1118 return 0; 1056
1057 /* if there's no signal to deliver, we just put the saved sigmask
1058 * back
1059 */
1060 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
1061 clear_thread_flag(TIF_RESTORE_SIGMASK);
1062 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
1063 }
1119} 1064}
1120 1065
1121asmlinkage int 1066asmlinkage int
diff --git a/arch/sparc/kernel/sparc_ksyms.c b/arch/sparc/kernel/sparc_ksyms.c
index 1c8fd0fd9305..19b25399d7e4 100644
--- a/arch/sparc/kernel/sparc_ksyms.c
+++ b/arch/sparc/kernel/sparc_ksyms.c
@@ -66,7 +66,6 @@ struct poll {
66 66
67extern int svr4_getcontext (svr4_ucontext_t *, struct pt_regs *); 67extern int svr4_getcontext (svr4_ucontext_t *, struct pt_regs *);
68extern int svr4_setcontext (svr4_ucontext_t *, struct pt_regs *); 68extern int svr4_setcontext (svr4_ucontext_t *, struct pt_regs *);
69void _sigpause_common (unsigned int set, struct pt_regs *);
70extern void (*__copy_1page)(void *, const void *); 69extern void (*__copy_1page)(void *, const void *);
71extern void __memmove(void *, const void *, __kernel_size_t); 70extern void __memmove(void *, const void *, __kernel_size_t);
72extern void (*bzero_1page)(void *); 71extern void (*bzero_1page)(void *);
@@ -82,8 +81,6 @@ extern int __lshrdi3(int, int);
82extern int __muldi3(int, int); 81extern int __muldi3(int, int);
83extern int __divdi3(int, int); 82extern int __divdi3(int, int);
84 83
85extern void dump_thread(struct pt_regs *, struct user *);
86
87/* Private functions with odd calling conventions. */ 84/* Private functions with odd calling conventions. */
88extern void ___atomic24_add(void); 85extern void ___atomic24_add(void);
89extern void ___atomic24_sub(void); 86extern void ___atomic24_sub(void);
@@ -229,7 +226,6 @@ EXPORT_SYMBOL(kunmap_atomic);
229/* Solaris/SunOS binary compatibility */ 226/* Solaris/SunOS binary compatibility */
230EXPORT_SYMBOL(svr4_setcontext); 227EXPORT_SYMBOL(svr4_setcontext);
231EXPORT_SYMBOL(svr4_getcontext); 228EXPORT_SYMBOL(svr4_getcontext);
232EXPORT_SYMBOL(_sigpause_common);
233 229
234EXPORT_SYMBOL(dump_thread); 230EXPORT_SYMBOL(dump_thread);
235 231
diff --git a/arch/sparc/kernel/sun4d_smp.c b/arch/sparc/kernel/sun4d_smp.c
index cc1fc898495c..40d426cce824 100644
--- a/arch/sparc/kernel/sun4d_smp.c
+++ b/arch/sparc/kernel/sun4d_smp.c
@@ -200,7 +200,7 @@ void __init smp4d_boot_cpus(void)
200 /* Cook up an idler for this guy. */ 200 /* Cook up an idler for this guy. */
201 p = fork_idle(i); 201 p = fork_idle(i);
202 cpucount++; 202 cpucount++;
203 current_set[i] = p->thread_info; 203 current_set[i] = task_thread_info(p);
204 for (no = 0; !cpu_find_by_instance(no, NULL, &mid) 204 for (no = 0; !cpu_find_by_instance(no, NULL, &mid)
205 && mid != i; no++) ; 205 && mid != i; no++) ;
206 206
diff --git a/arch/sparc/kernel/sun4m_smp.c b/arch/sparc/kernel/sun4m_smp.c
index f113422a3727..a21f27d10e55 100644
--- a/arch/sparc/kernel/sun4m_smp.c
+++ b/arch/sparc/kernel/sun4m_smp.c
@@ -173,7 +173,7 @@ void __init smp4m_boot_cpus(void)
173 /* Cook up an idler for this guy. */ 173 /* Cook up an idler for this guy. */
174 p = fork_idle(i); 174 p = fork_idle(i);
175 cpucount++; 175 cpucount++;
176 current_set[i] = p->thread_info; 176 current_set[i] = task_thread_info(p);
177 /* See trampoline.S for details... */ 177 /* See trampoline.S for details... */
178 entry += ((i-1) * 3); 178 entry += ((i-1) * 3);
179 179
diff --git a/arch/sparc/kernel/sys_sunos.c b/arch/sparc/kernel/sys_sunos.c
index 81c894acd0db..288de276d9ff 100644
--- a/arch/sparc/kernel/sys_sunos.c
+++ b/arch/sparc/kernel/sys_sunos.c
@@ -30,6 +30,7 @@
30#include <linux/stat.h> 30#include <linux/stat.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/pagemap.h> 32#include <linux/pagemap.h>
33#include <linux/capability.h>
33#include <linux/errno.h> 34#include <linux/errno.h>
34#include <linux/smp.h> 35#include <linux/smp.h>
35#include <linux/smp_lock.h> 36#include <linux/smp_lock.h>
@@ -894,7 +895,7 @@ asmlinkage long sunos_sysconf (int name)
894 ret = ARG_MAX; 895 ret = ARG_MAX;
895 break; 896 break;
896 case _SC_CHILD_MAX: 897 case _SC_CHILD_MAX:
897 ret = CHILD_MAX; 898 ret = -1; /* no limit */
898 break; 899 break;
899 case _SC_CLK_TCK: 900 case _SC_CLK_TCK:
900 ret = HZ; 901 ret = HZ;
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index e457a40838fc..6877ae4cd1d9 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -75,7 +75,10 @@ sys_call_table:
75/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy 75/*265*/ .long sys_timer_delete, sys_timer_create, sys_nis_syscall, sys_io_setup, sys_io_destroy
76/*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink 76/*270*/ .long sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
77/*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid 77/*275*/ .long sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
78/*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl 78/*280*/ .long sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat
79/*285*/ .long sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, sys_newfstatat
80/*290*/ .long sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
81/*295*/ .long sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll
79 82
80#ifdef CONFIG_SUNOS_EMUL 83#ifdef CONFIG_SUNOS_EMUL
81 /* Now the SunOS syscall table. */ 84 /* Now the SunOS syscall table. */
@@ -181,6 +184,11 @@ sunos_sys_table:
181 .long sunos_nosys, sunos_nosys, sunos_nosys 184 .long sunos_nosys, sunos_nosys, sunos_nosys
182 .long sunos_nosys 185 .long sunos_nosys
183/*280*/ .long sunos_nosys, sunos_nosys, sunos_nosys 186/*280*/ .long sunos_nosys, sunos_nosys, sunos_nosys
187 .long sunos_nosys, sunos_nosys, sunos_nosys
188 .long sunos_nosys, sunos_nosys, sunos_nosys
184 .long sunos_nosys 189 .long sunos_nosys
190/*290*/ .long sunos_nosys, sunos_nosys, sunos_nosys
191 .long sunos_nosys, sunos_nosys, sunos_nosys
192 .long sunos_nosys, sunos_nosys, sunos_nosys
185 193
186#endif 194#endif
diff --git a/arch/sparc/kernel/time.c b/arch/sparc/kernel/time.c
index 24814d58f9e1..7dadcdb4ca42 100644
--- a/arch/sparc/kernel/time.c
+++ b/arch/sparc/kernel/time.c
@@ -49,7 +49,7 @@ DEFINE_SPINLOCK(rtc_lock);
49enum sparc_clock_type sp_clock_typ; 49enum sparc_clock_type sp_clock_typ;
50DEFINE_SPINLOCK(mostek_lock); 50DEFINE_SPINLOCK(mostek_lock);
51void __iomem *mstk48t02_regs = NULL; 51void __iomem *mstk48t02_regs = NULL;
52static struct mostek48t08 *mstk48t08_regs = NULL; 52static struct mostek48t08 __iomem *mstk48t08_regs = NULL;
53static int set_rtc_mmss(unsigned long); 53static int set_rtc_mmss(unsigned long);
54static int sbus_do_settimeofday(struct timespec *tv); 54static int sbus_do_settimeofday(struct timespec *tv);
55 55
@@ -342,7 +342,7 @@ static __inline__ void clock_probe(void)
342 /* XXX r/o attribute is somewhere in r.flags */ 342 /* XXX r/o attribute is somewhere in r.flags */
343 r.flags = clk_reg[0].which_io; 343 r.flags = clk_reg[0].which_io;
344 r.start = clk_reg[0].phys_addr; 344 r.start = clk_reg[0].phys_addr;
345 mstk48t08_regs = (struct mostek48t08 *) sbus_ioremap(&r, 0, 345 mstk48t08_regs = sbus_ioremap(&r, 0,
346 sizeof(struct mostek48t08), "mk48t08"); 346 sizeof(struct mostek48t08), "mk48t08");
347 347
348 mstk48t02_regs = &mstk48t08_regs->regs; 348 mstk48t02_regs = &mstk48t08_regs->regs;
diff --git a/arch/sparc/kernel/traps.c b/arch/sparc/kernel/traps.c
index 3f451ae66482..41d45c298fb2 100644
--- a/arch/sparc/kernel/traps.c
+++ b/arch/sparc/kernel/traps.c
@@ -291,7 +291,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
291#ifndef CONFIG_SMP 291#ifndef CONFIG_SMP
292 if(!fpt) { 292 if(!fpt) {
293#else 293#else
294 if(!(fpt->thread_info->flags & _TIF_USEDFPU)) { 294 if(!(task_thread_info(fpt)->flags & _TIF_USEDFPU)) {
295#endif 295#endif
296 fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth); 296 fpsave(&fake_regs[0], &fake_fsr, &fake_queue[0], &fake_depth);
297 regs->psr &= ~PSR_EF; 297 regs->psr &= ~PSR_EF;
@@ -334,7 +334,7 @@ void do_fpe_trap(struct pt_regs *regs, unsigned long pc, unsigned long npc,
334 /* nope, better SIGFPE the offending process... */ 334 /* nope, better SIGFPE the offending process... */
335 335
336#ifdef CONFIG_SMP 336#ifdef CONFIG_SMP
337 fpt->thread_info->flags &= ~_TIF_USEDFPU; 337 task_thread_info(fpt)->flags &= ~_TIF_USEDFPU;
338#endif 338#endif
339 if(psr & PSR_PS) { 339 if(psr & PSR_PS) {
340 /* The first fsr store/load we tried trapped, 340 /* The first fsr store/load we tried trapped,
diff --git a/arch/sparc/kernel/vmlinux.lds.S b/arch/sparc/kernel/vmlinux.lds.S
index 38938d2e63aa..346c19a949fd 100644
--- a/arch/sparc/kernel/vmlinux.lds.S
+++ b/arch/sparc/kernel/vmlinux.lds.S
@@ -85,19 +85,9 @@ SECTIONS
85 } 85 }
86 _end = . ; 86 _end = . ;
87 PROVIDE (end = .); 87 PROVIDE (end = .);
88 /* Stabs debugging sections. */
89 .stab 0 : { *(.stab) }
90 .stabstr 0 : { *(.stabstr) }
91 .stab.excl 0 : { *(.stab.excl) }
92 .stab.exclstr 0 : { *(.stab.exclstr) }
93 .stab.index 0 : { *(.stab.index) }
94 .stab.indexstr 0 : { *(.stab.indexstr) }
95 .comment 0 : { *(.comment) }
96 .debug 0 : { *(.debug) }
97 .debug_srcinfo 0 : { *(.debug_srcinfo) }
98 .debug_aranges 0 : { *(.debug_aranges) }
99 .debug_pubnames 0 : { *(.debug_pubnames) }
100 .debug_sfnames 0 : { *(.debug_sfnames) }
101 .line 0 : { *(.line) }
102 /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) } 88 /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) }
89
90 STABS_DEBUG
91
92 DWARF_DEBUG
103} 93}
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c
index cb3cf0f22822..de84f8534bac 100644
--- a/arch/sparc/lib/atomic32.c
+++ b/arch/sparc/lib/atomic32.c
@@ -66,7 +66,6 @@ int atomic_add_unless(atomic_t *v, int a, int u)
66 return ret != u; 66 return ret != u;
67} 67}
68 68
69static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
70/* Atomic operations are already serializing */ 69/* Atomic operations are already serializing */
71void atomic_set(atomic_t *v, int i) 70void atomic_set(atomic_t *v, int i)
72{ 71{
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index 489bf68d5f05..77840c804786 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -295,8 +295,7 @@ static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus)
295 int ioptex; 295 int ioptex;
296 int i; 296 int i;
297 297
298 if (busa < iommu->start) 298 BUG_ON(busa < iommu->start);
299 BUG();
300 ioptex = (busa - iommu->start) >> PAGE_SHIFT; 299 ioptex = (busa - iommu->start) >> PAGE_SHIFT;
301 for (i = 0; i < npages; i++) { 300 for (i = 0; i < npages; i++) {
302 iopte_val(iommu->page_table[ioptex + i]) = 0; 301 iopte_val(iommu->page_table[ioptex + i]) = 0;
@@ -340,9 +339,9 @@ static int iommu_map_dma_area(dma_addr_t *pba, unsigned long va,
340 iopte_t *first; 339 iopte_t *first;
341 int ioptex; 340 int ioptex;
342 341
343 if ((va & ~PAGE_MASK) != 0) BUG(); 342 BUG_ON((va & ~PAGE_MASK) != 0);
344 if ((addr & ~PAGE_MASK) != 0) BUG(); 343 BUG_ON((addr & ~PAGE_MASK) != 0);
345 if ((len & ~PAGE_MASK) != 0) BUG(); 344 BUG_ON((len & ~PAGE_MASK) != 0);
346 345
347 /* page color = physical address */ 346 /* page color = physical address */
348 ioptex = bit_map_string_get(&iommu->usemap, len >> PAGE_SHIFT, 347 ioptex = bit_map_string_get(&iommu->usemap, len >> PAGE_SHIFT,
@@ -405,8 +404,8 @@ static void iommu_unmap_dma_area(unsigned long busa, int len)
405 unsigned long end; 404 unsigned long end;
406 int ioptex = (busa - iommu->start) >> PAGE_SHIFT; 405 int ioptex = (busa - iommu->start) >> PAGE_SHIFT;
407 406
408 if ((busa & ~PAGE_MASK) != 0) BUG(); 407 BUG_ON((busa & ~PAGE_MASK) != 0);
409 if ((len & ~PAGE_MASK) != 0) BUG(); 408 BUG_ON((len & ~PAGE_MASK) != 0);
410 409
411 iopte += ioptex; 410 iopte += ioptex;
412 end = busa + len; 411 end = busa + len;
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index 1d560390e282..731f19603cad 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -497,7 +497,7 @@ static void __init sun4c_probe_mmu(void)
497 patch_kernel_fault_handler(); 497 patch_kernel_fault_handler();
498} 498}
499 499
500volatile unsigned long *sun4c_memerr_reg = NULL; 500volatile unsigned long __iomem *sun4c_memerr_reg = NULL;
501 501
502void __init sun4c_probe_memerr_reg(void) 502void __init sun4c_probe_memerr_reg(void)
503{ 503{
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 3fded69b1922..ab733be9af08 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -5,6 +5,10 @@
5 5
6mainmenu "Linux/UltraSPARC Kernel Configuration" 6mainmenu "Linux/UltraSPARC Kernel Configuration"
7 7
8config SPARC
9 bool
10 default y
11
8config SPARC64 12config SPARC64
9 bool 13 bool
10 default y 14 default y
@@ -175,7 +179,7 @@ config HUGETLB_PAGE_SIZE_512K
175 bool "512K" 179 bool "512K"
176 180
177config HUGETLB_PAGE_SIZE_64K 181config HUGETLB_PAGE_SIZE_64K
178 depends on !SPARC64_PAGE_SIZE_4MB && !SPARC64_PAGE_SIZE_512K 182 depends on !SPARC64_PAGE_SIZE_4MB && !SPARC64_PAGE_SIZE_512KB
179 bool "64K" 183 bool "64K"
180 184
181endchoice 185endchoice
@@ -305,11 +309,6 @@ config COMPAT
305 depends on SPARC32_COMPAT 309 depends on SPARC32_COMPAT
306 default y 310 default y
307 311
308config UID16
309 bool
310 depends on SPARC32_COMPAT
311 default y
312
313config BINFMT_ELF32 312config BINFMT_ELF32
314 tristate "Kernel support for 32-bit ELF binaries" 313 tristate "Kernel support for 32-bit ELF binaries"
315 depends on SPARC32_COMPAT 314 depends on SPARC32_COMPAT
diff --git a/arch/sparc64/Makefile b/arch/sparc64/Makefile
index 43fe382da078..cad10c5b83d3 100644
--- a/arch/sparc64/Makefile
+++ b/arch/sparc64/Makefile
@@ -17,7 +17,6 @@ CC := $(shell if $(CC) -m64 -S -o /dev/null -xc /dev/null >/dev/null 2>&1; then
17NEW_GCC := $(call cc-option-yn, -m64 -mcmodel=medlow) 17NEW_GCC := $(call cc-option-yn, -m64 -mcmodel=medlow)
18NEW_GAS := $(shell if $(LD) -V 2>&1 | grep 'elf64_sparc' > /dev/null; then echo y; else echo n; fi) 18NEW_GAS := $(shell if $(LD) -V 2>&1 | grep 'elf64_sparc' > /dev/null; then echo y; else echo n; fi)
19UNDECLARED_REGS := $(shell if $(CC) -c -x assembler /dev/null -Wa,--help | grep undeclared-regs > /dev/null; then echo y; else echo n; fi; ) 19UNDECLARED_REGS := $(shell if $(CC) -c -x assembler /dev/null -Wa,--help | grep undeclared-regs > /dev/null; then echo y; else echo n; fi; )
20INLINE_LIMIT := $(call cc-option-yn, -m64 -finline-limit=100000)
21 20
22export NEW_GCC 21export NEW_GCC
23 22
@@ -49,10 +48,6 @@ else
49 AFLAGS += -m64 -mcpu=ultrasparc $(CC_UNDECL) 48 AFLAGS += -m64 -mcpu=ultrasparc $(CC_UNDECL)
50endif 49endif
51 50
52ifeq ($(INLINE_LIMIT),y)
53 CFLAGS := $(CFLAGS) -finline-limit=100000
54endif
55
56ifeq ($(CONFIG_MCOUNT),y) 51ifeq ($(CONFIG_MCOUNT),y)
57 CFLAGS := $(CFLAGS) -pg 52 CFLAGS := $(CFLAGS) -pg
58endif 53endif
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index 46a6ad60a8f5..9ceddad0fb49 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,46 +1,67 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11 3# Linux kernel version: 2.6.16-rc1
4# Sun Mar 6 20:47:29 2005 4# Wed Jan 18 13:41:02 2006
5# 5#
6CONFIG_SPARC=y
7CONFIG_SPARC64=y
6CONFIG_64BIT=y 8CONFIG_64BIT=y
7CONFIG_MMU=y 9CONFIG_MMU=y
8CONFIG_TIME_INTERPOLATION=y 10CONFIG_TIME_INTERPOLATION=y
11CONFIG_ARCH_MAY_HAVE_PC_FDC=y
12CONFIG_SPARC64_PAGE_SIZE_8KB=y
13# CONFIG_SPARC64_PAGE_SIZE_64KB is not set
14# CONFIG_SPARC64_PAGE_SIZE_512KB is not set
15# CONFIG_SPARC64_PAGE_SIZE_4MB is not set
16CONFIG_SECCOMP=y
17# CONFIG_HZ_100 is not set
18CONFIG_HZ_250=y
19# CONFIG_HZ_1000 is not set
20CONFIG_HZ=250
9 21
10# 22#
11# Code maturity level options 23# Code maturity level options
12# 24#
13CONFIG_EXPERIMENTAL=y 25CONFIG_EXPERIMENTAL=y
14CONFIG_CLEAN_COMPILE=y 26CONFIG_CLEAN_COMPILE=y
15CONFIG_LOCK_KERNEL=y 27CONFIG_BROKEN_ON_SMP=y
28CONFIG_INIT_ENV_ARG_LIMIT=32
16 29
17# 30#
18# General setup 31# General setup
19# 32#
20CONFIG_LOCALVERSION="" 33CONFIG_LOCALVERSION=""
34CONFIG_LOCALVERSION_AUTO=y
21CONFIG_SWAP=y 35CONFIG_SWAP=y
22CONFIG_SYSVIPC=y 36CONFIG_SYSVIPC=y
23CONFIG_POSIX_MQUEUE=y 37CONFIG_POSIX_MQUEUE=y
24# CONFIG_BSD_PROCESS_ACCT is not set 38# CONFIG_BSD_PROCESS_ACCT is not set
25CONFIG_SYSCTL=y 39CONFIG_SYSCTL=y
26# CONFIG_AUDIT is not set 40# CONFIG_AUDIT is not set
27CONFIG_LOG_BUF_SHIFT=15
28CONFIG_HOTPLUG=y
29CONFIG_KOBJECT_UEVENT=y
30# CONFIG_IKCONFIG is not set 41# CONFIG_IKCONFIG is not set
42CONFIG_INITRAMFS_SOURCE=""
43CONFIG_UID16=y
44CONFIG_CC_OPTIMIZE_FOR_SIZE=y
31# CONFIG_EMBEDDED is not set 45# CONFIG_EMBEDDED is not set
32CONFIG_KALLSYMS=y 46CONFIG_KALLSYMS=y
33# CONFIG_KALLSYMS_ALL is not set 47# CONFIG_KALLSYMS_ALL is not set
34# CONFIG_KALLSYMS_EXTRA_PASS is not set 48# CONFIG_KALLSYMS_EXTRA_PASS is not set
49CONFIG_HOTPLUG=y
50CONFIG_PRINTK=y
51CONFIG_BUG=y
52CONFIG_ELF_CORE=y
53CONFIG_BASE_FULL=y
35CONFIG_FUTEX=y 54CONFIG_FUTEX=y
36CONFIG_EPOLL=y 55CONFIG_EPOLL=y
37# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
38CONFIG_SHMEM=y 56CONFIG_SHMEM=y
39CONFIG_CC_ALIGN_FUNCTIONS=0 57CONFIG_CC_ALIGN_FUNCTIONS=0
40CONFIG_CC_ALIGN_LABELS=0 58CONFIG_CC_ALIGN_LABELS=0
41CONFIG_CC_ALIGN_LOOPS=0 59CONFIG_CC_ALIGN_LOOPS=0
42CONFIG_CC_ALIGN_JUMPS=0 60CONFIG_CC_ALIGN_JUMPS=0
61CONFIG_SLAB=y
43# CONFIG_TINY_SHMEM is not set 62# CONFIG_TINY_SHMEM is not set
63CONFIG_BASE_SMALL=0
64# CONFIG_SLOB is not set
44 65
45# 66#
46# Loadable module support 67# Loadable module support
@@ -52,20 +73,32 @@ CONFIG_OBSOLETE_MODPARM=y
52CONFIG_MODVERSIONS=y 73CONFIG_MODVERSIONS=y
53CONFIG_MODULE_SRCVERSION_ALL=y 74CONFIG_MODULE_SRCVERSION_ALL=y
54CONFIG_KMOD=y 75CONFIG_KMOD=y
55CONFIG_STOP_MACHINE=y 76
77#
78# Block layer
79#
80
81#
82# IO Schedulers
83#
84CONFIG_IOSCHED_NOOP=y
85CONFIG_IOSCHED_AS=y
86CONFIG_IOSCHED_DEADLINE=y
87CONFIG_IOSCHED_CFQ=y
88CONFIG_DEFAULT_AS=y
89# CONFIG_DEFAULT_DEADLINE is not set
90# CONFIG_DEFAULT_CFQ is not set
91# CONFIG_DEFAULT_NOOP is not set
92CONFIG_DEFAULT_IOSCHED="anticipatory"
56CONFIG_SYSVIPC_COMPAT=y 93CONFIG_SYSVIPC_COMPAT=y
57 94
58# 95#
59# General machine setup 96# General machine setup
60# 97#
61CONFIG_BBC_I2C=m 98# CONFIG_SMP is not set
62CONFIG_VT=y
63CONFIG_VT_CONSOLE=y
64CONFIG_HW_CONSOLE=y
65CONFIG_SMP=y
66# CONFIG_PREEMPT is not set 99# CONFIG_PREEMPT is not set
67CONFIG_NR_CPUS=4
68CONFIG_CPU_FREQ=y 100CONFIG_CPU_FREQ=y
101CONFIG_CPU_FREQ_TABLE=m
69# CONFIG_CPU_FREQ_DEBUG is not set 102# CONFIG_CPU_FREQ_DEBUG is not set
70CONFIG_CPU_FREQ_STAT=m 103CONFIG_CPU_FREQ_STAT=m
71CONFIG_CPU_FREQ_STAT_DETAILS=y 104CONFIG_CPU_FREQ_STAT_DETAILS=y
@@ -75,15 +108,22 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
75CONFIG_CPU_FREQ_GOV_POWERSAVE=m 108CONFIG_CPU_FREQ_GOV_POWERSAVE=m
76CONFIG_CPU_FREQ_GOV_USERSPACE=m 109CONFIG_CPU_FREQ_GOV_USERSPACE=m
77CONFIG_CPU_FREQ_GOV_ONDEMAND=m 110CONFIG_CPU_FREQ_GOV_ONDEMAND=m
78CONFIG_CPU_FREQ_TABLE=y 111CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
79CONFIG_US3_FREQ=m 112CONFIG_US3_FREQ=m
80CONFIG_US2E_FREQ=m 113CONFIG_US2E_FREQ=m
81CONFIG_SPARC64=y
82CONFIG_RWSEM_XCHGADD_ALGORITHM=y 114CONFIG_RWSEM_XCHGADD_ALGORITHM=y
83CONFIG_GENERIC_CALIBRATE_DELAY=y 115CONFIG_GENERIC_CALIBRATE_DELAY=y
84CONFIG_HUGETLB_PAGE_SIZE_4MB=y 116CONFIG_HUGETLB_PAGE_SIZE_4MB=y
85# CONFIG_HUGETLB_PAGE_SIZE_512K is not set 117# CONFIG_HUGETLB_PAGE_SIZE_512K is not set
86# CONFIG_HUGETLB_PAGE_SIZE_64K is not set 118# CONFIG_HUGETLB_PAGE_SIZE_64K is not set
119CONFIG_SELECT_MEMORY_MODEL=y
120CONFIG_FLATMEM_MANUAL=y
121# CONFIG_DISCONTIGMEM_MANUAL is not set
122# CONFIG_SPARSEMEM_MANUAL is not set
123CONFIG_FLATMEM=y
124CONFIG_FLAT_NODE_MEM_MAP=y
125# CONFIG_SPARSEMEM_STATIC is not set
126CONFIG_SPLIT_PTLOCK_CPUS=4
87CONFIG_GENERIC_ISA_DMA=y 127CONFIG_GENERIC_ISA_DMA=y
88CONFIG_SBUS=y 128CONFIG_SBUS=y
89CONFIG_SBUSCHAR=y 129CONFIG_SBUSCHAR=y
@@ -91,130 +131,147 @@ CONFIG_SUN_AUXIO=y
91CONFIG_SUN_IO=y 131CONFIG_SUN_IO=y
92CONFIG_PCI=y 132CONFIG_PCI=y
93CONFIG_PCI_DOMAINS=y 133CONFIG_PCI_DOMAINS=y
94CONFIG_RTC=y
95# CONFIG_PCI_LEGACY_PROC is not set 134# CONFIG_PCI_LEGACY_PROC is not set
96# CONFIG_PCI_NAMES is not set 135# CONFIG_PCI_DEBUG is not set
97CONFIG_SUN_OPENPROMFS=m 136CONFIG_SUN_OPENPROMFS=m
98CONFIG_SPARC32_COMPAT=y 137CONFIG_SPARC32_COMPAT=y
99CONFIG_COMPAT=y 138CONFIG_COMPAT=y
100CONFIG_UID16=y
101CONFIG_BINFMT_ELF32=y 139CONFIG_BINFMT_ELF32=y
102# CONFIG_BINFMT_AOUT32 is not set 140# CONFIG_BINFMT_AOUT32 is not set
141
142#
143# Executable file formats
144#
103CONFIG_BINFMT_ELF=y 145CONFIG_BINFMT_ELF=y
104CONFIG_BINFMT_MISC=m 146CONFIG_BINFMT_MISC=m
105CONFIG_SOLARIS_EMUL=m 147# CONFIG_SOLARIS_EMUL is not set
148# CONFIG_CMDLINE_BOOL is not set
106 149
107# 150#
108# Parallel port support 151# Networking
109# 152#
110CONFIG_PARPORT=m 153CONFIG_NET=y
111CONFIG_PARPORT_PC=m
112CONFIG_PARPORT_PC_FIFO=y
113# CONFIG_PARPORT_PC_SUPERIO is not set
114# CONFIG_PARPORT_SUNBPP is not set
115# CONFIG_PARPORT_OTHER is not set
116CONFIG_PARPORT_1284=y
117CONFIG_PRINTER=m
118CONFIG_ENVCTRL=m
119CONFIG_DISPLAY7SEG=m
120# CONFIG_CMDLINE_BOOL is not set
121 154
122# 155#
123# Generic Driver Options 156# Networking options
124# 157#
125CONFIG_STANDALONE=y 158CONFIG_PACKET=y
126# CONFIG_PREVENT_FIRMWARE_BUILD is not set 159CONFIG_PACKET_MMAP=y
127CONFIG_FW_LOADER=m 160CONFIG_UNIX=y
128# CONFIG_DEBUG_DRIVER is not set 161CONFIG_XFRM=y
162CONFIG_XFRM_USER=m
163CONFIG_NET_KEY=m
164CONFIG_INET=y
165CONFIG_IP_MULTICAST=y
166# CONFIG_IP_ADVANCED_ROUTER is not set
167CONFIG_IP_FIB_HASH=y
168# CONFIG_IP_PNP is not set
169CONFIG_NET_IPIP=m
170CONFIG_NET_IPGRE=m
171CONFIG_NET_IPGRE_BROADCAST=y
172CONFIG_IP_MROUTE=y
173CONFIG_IP_PIMSM_V1=y
174CONFIG_IP_PIMSM_V2=y
175CONFIG_ARPD=y
176CONFIG_SYN_COOKIES=y
177CONFIG_INET_AH=y
178CONFIG_INET_ESP=y
179CONFIG_INET_IPCOMP=y
180CONFIG_INET_TUNNEL=y
181CONFIG_INET_DIAG=y
182CONFIG_INET_TCP_DIAG=y
183CONFIG_TCP_CONG_ADVANCED=y
129 184
130# 185#
131# Graphics support 186# TCP congestion control
132# 187#
133CONFIG_FB=y 188CONFIG_TCP_CONG_BIC=y
134CONFIG_FB_MODE_HELPERS=y 189CONFIG_TCP_CONG_CUBIC=m
135CONFIG_FB_TILEBLITTING=y 190CONFIG_TCP_CONG_WESTWOOD=m
136# CONFIG_FB_CIRRUS is not set 191CONFIG_TCP_CONG_HTCP=m
137CONFIG_FB_PM2=y 192CONFIG_TCP_CONG_HSTCP=m
138# CONFIG_FB_PM2_FIFO_DISCONNECT is not set 193CONFIG_TCP_CONG_HYBLA=m
139# CONFIG_FB_ASILIANT is not set 194CONFIG_TCP_CONG_VEGAS=m
140# CONFIG_FB_IMSTT is not set 195CONFIG_TCP_CONG_SCALABLE=m
141# CONFIG_FB_BW2 is not set 196CONFIG_IPV6=m
142# CONFIG_FB_CG3 is not set 197CONFIG_IPV6_PRIVACY=y
143CONFIG_FB_CG6=y 198CONFIG_INET6_AH=m
144# CONFIG_FB_RIVA is not set 199CONFIG_INET6_ESP=m
145# CONFIG_FB_MATROX is not set 200CONFIG_INET6_IPCOMP=m
146# CONFIG_FB_RADEON_OLD is not set 201CONFIG_INET6_TUNNEL=m
147# CONFIG_FB_RADEON is not set 202CONFIG_IPV6_TUNNEL=m
148# CONFIG_FB_ATY128 is not set 203# CONFIG_NETFILTER is not set
149CONFIG_FB_ATY=y
150CONFIG_FB_ATY_CT=y
151# CONFIG_FB_ATY_GENERIC_LCD is not set
152# CONFIG_FB_ATY_XL_INIT is not set
153CONFIG_FB_ATY_GX=y
154# CONFIG_FB_SAVAGE is not set
155# CONFIG_FB_SIS is not set
156# CONFIG_FB_NEOMAGIC is not set
157# CONFIG_FB_KYRO is not set
158# CONFIG_FB_3DFX is not set
159# CONFIG_FB_VOODOO1 is not set
160# CONFIG_FB_TRIDENT is not set
161CONFIG_FB_SBUS=y
162CONFIG_FB_FFB=y
163# CONFIG_FB_TCX is not set
164# CONFIG_FB_CG14 is not set
165# CONFIG_FB_P9100 is not set
166# CONFIG_FB_LEO is not set
167# CONFIG_FB_PCI is not set
168# CONFIG_FB_VIRTUAL is not set
169 204
170# 205#
171# Console display driver support 206# DCCP Configuration (EXPERIMENTAL)
172# 207#
173# CONFIG_PROM_CONSOLE is not set 208CONFIG_IP_DCCP=m
174CONFIG_DUMMY_CONSOLE=y 209CONFIG_INET_DCCP_DIAG=m
175CONFIG_FRAMEBUFFER_CONSOLE=y
176CONFIG_FONTS=y
177# CONFIG_FONT_8x8 is not set
178# CONFIG_FONT_8x16 is not set
179# CONFIG_FONT_6x11 is not set
180# CONFIG_FONT_PEARL_8x8 is not set
181# CONFIG_FONT_ACORN_8x8 is not set
182CONFIG_FONT_SUN8x16=y
183# CONFIG_FONT_SUN12x22 is not set
184 210
185# 211#
186# Logo configuration 212# DCCP CCIDs Configuration (EXPERIMENTAL)
187# 213#
188CONFIG_LOGO=y 214CONFIG_IP_DCCP_CCID3=m
189# CONFIG_LOGO_LINUX_MONO is not set 215CONFIG_IP_DCCP_TFRC_LIB=m
190# CONFIG_LOGO_LINUX_VGA16 is not set
191# CONFIG_LOGO_LINUX_CLUT224 is not set
192CONFIG_LOGO_SUN_CLUT224=y
193# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
194 216
195# 217#
196# Serial drivers 218# DCCP Kernel Hacking
197# 219#
220# CONFIG_IP_DCCP_DEBUG is not set
221# CONFIG_IP_DCCP_UNLOAD_HACK is not set
198 222
199# 223#
200# Non-8250 serial port support 224# SCTP Configuration (EXPERIMENTAL)
201# 225#
202CONFIG_SERIAL_SUNCORE=y 226# CONFIG_IP_SCTP is not set
203CONFIG_SERIAL_SUNZILOG=y 227# CONFIG_ATM is not set
204CONFIG_SERIAL_SUNZILOG_CONSOLE=y 228# CONFIG_BRIDGE is not set
205CONFIG_SERIAL_SUNSU=y 229CONFIG_VLAN_8021Q=m
206CONFIG_SERIAL_SUNSU_CONSOLE=y 230# CONFIG_DECNET is not set
207CONFIG_SERIAL_SUNSAB=m 231# CONFIG_LLC2 is not set
208CONFIG_SERIAL_CORE=y 232# CONFIG_IPX is not set
209CONFIG_SERIAL_CORE_CONSOLE=y 233# CONFIG_ATALK is not set
234# CONFIG_X25 is not set
235# CONFIG_LAPB is not set
210 236
211# 237#
212# Misc Linux/SPARC drivers 238# TIPC Configuration (EXPERIMENTAL)
213# 239#
214CONFIG_SUN_OPENPROMIO=m 240# CONFIG_TIPC is not set
215CONFIG_SUN_MOSTEK_RTC=y 241# CONFIG_NET_DIVERT is not set
216CONFIG_OBP_FLASH=m 242# CONFIG_ECONET is not set
217# CONFIG_SUN_BPP is not set 243# CONFIG_WAN_ROUTER is not set
244
245#
246# QoS and/or fair queueing
247#
248# CONFIG_NET_SCHED is not set
249
250#
251# Network testing
252#
253CONFIG_NET_PKTGEN=m
254# CONFIG_HAMRADIO is not set
255# CONFIG_IRDA is not set
256# CONFIG_BT is not set
257# CONFIG_IEEE80211 is not set
258
259#
260# Device Drivers
261#
262
263#
264# Generic Driver Options
265#
266CONFIG_STANDALONE=y
267# CONFIG_PREVENT_FIRMWARE_BUILD is not set
268CONFIG_FW_LOADER=y
269# CONFIG_DEBUG_DRIVER is not set
270
271#
272# Connector - unified userspace <-> kernelspace linker
273#
274CONFIG_CONNECTOR=m
218 275
219# 276#
220# Memory Technology Devices (MTD) 277# Memory Technology Devices (MTD)
@@ -222,10 +279,18 @@ CONFIG_OBP_FLASH=m
222# CONFIG_MTD is not set 279# CONFIG_MTD is not set
223 280
224# 281#
282# Parallel port support
283#
284# CONFIG_PARPORT is not set
285
286#
287# Plug and Play support
288#
289
290#
225# Block devices 291# Block devices
226# 292#
227# CONFIG_BLK_DEV_FD is not set 293# CONFIG_BLK_DEV_FD is not set
228# CONFIG_PARIDE is not set
229# CONFIG_BLK_CPQ_DA is not set 294# CONFIG_BLK_CPQ_DA is not set
230# CONFIG_BLK_CPQ_CISS_DA is not set 295# CONFIG_BLK_CPQ_CISS_DA is not set
231# CONFIG_BLK_DEV_DAC960 is not set 296# CONFIG_BLK_DEV_DAC960 is not set
@@ -234,22 +299,13 @@ CONFIG_OBP_FLASH=m
234CONFIG_BLK_DEV_LOOP=m 299CONFIG_BLK_DEV_LOOP=m
235CONFIG_BLK_DEV_CRYPTOLOOP=m 300CONFIG_BLK_DEV_CRYPTOLOOP=m
236CONFIG_BLK_DEV_NBD=m 301CONFIG_BLK_DEV_NBD=m
237CONFIG_BLK_DEV_SX8=m 302# CONFIG_BLK_DEV_SX8 is not set
238CONFIG_BLK_DEV_UB=m 303CONFIG_BLK_DEV_UB=m
239# CONFIG_BLK_DEV_RAM is not set 304# CONFIG_BLK_DEV_RAM is not set
240CONFIG_BLK_DEV_RAM_COUNT=16 305CONFIG_BLK_DEV_RAM_COUNT=16
241CONFIG_INITRAMFS_SOURCE=""
242CONFIG_CDROM_PKTCDVD=m 306CONFIG_CDROM_PKTCDVD=m
243CONFIG_CDROM_PKTCDVD_BUFFERS=8 307CONFIG_CDROM_PKTCDVD_BUFFERS=8
244CONFIG_CDROM_PKTCDVD_WCACHE=y 308CONFIG_CDROM_PKTCDVD_WCACHE=y
245
246#
247# IO Schedulers
248#
249CONFIG_IOSCHED_NOOP=y
250CONFIG_IOSCHED_AS=y
251CONFIG_IOSCHED_DEADLINE=y
252CONFIG_IOSCHED_CFQ=y
253CONFIG_ATA_OVER_ETH=m 309CONFIG_ATA_OVER_ETH=m
254 310
255# 311#
@@ -265,7 +321,7 @@ CONFIG_BLK_DEV_IDE=y
265CONFIG_BLK_DEV_IDEDISK=y 321CONFIG_BLK_DEV_IDEDISK=y
266# CONFIG_IDEDISK_MULTI_MODE is not set 322# CONFIG_IDEDISK_MULTI_MODE is not set
267CONFIG_BLK_DEV_IDECD=y 323CONFIG_BLK_DEV_IDECD=y
268CONFIG_BLK_DEV_IDETAPE=m 324# CONFIG_BLK_DEV_IDETAPE is not set
269# CONFIG_BLK_DEV_IDEFLOPPY is not set 325# CONFIG_BLK_DEV_IDEFLOPPY is not set
270# CONFIG_BLK_DEV_IDESCSI is not set 326# CONFIG_BLK_DEV_IDESCSI is not set
271# CONFIG_IDE_TASK_IOCTL is not set 327# CONFIG_IDE_TASK_IOCTL is not set
@@ -278,7 +334,7 @@ CONFIG_BLK_DEV_IDEPCI=y
278# CONFIG_IDEPCI_SHARE_IRQ is not set 334# CONFIG_IDEPCI_SHARE_IRQ is not set
279# CONFIG_BLK_DEV_OFFBOARD is not set 335# CONFIG_BLK_DEV_OFFBOARD is not set
280# CONFIG_BLK_DEV_GENERIC is not set 336# CONFIG_BLK_DEV_GENERIC is not set
281CONFIG_BLK_DEV_OPTI621=m 337# CONFIG_BLK_DEV_OPTI621 is not set
282CONFIG_BLK_DEV_IDEDMA_PCI=y 338CONFIG_BLK_DEV_IDEDMA_PCI=y
283# CONFIG_BLK_DEV_IDEDMA_FORCED is not set 339# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
284CONFIG_IDEDMA_PCI_AUTO=y 340CONFIG_IDEDMA_PCI_AUTO=y
@@ -286,27 +342,25 @@ CONFIG_IDEDMA_ONLYDISK=y
286# CONFIG_BLK_DEV_AEC62XX is not set 342# CONFIG_BLK_DEV_AEC62XX is not set
287CONFIG_BLK_DEV_ALI15X3=y 343CONFIG_BLK_DEV_ALI15X3=y
288# CONFIG_WDC_ALI15X3 is not set 344# CONFIG_WDC_ALI15X3 is not set
289CONFIG_BLK_DEV_AMD74XX=m 345# CONFIG_BLK_DEV_AMD74XX is not set
290CONFIG_BLK_DEV_CMD64X=m 346# CONFIG_BLK_DEV_CMD64X is not set
291CONFIG_BLK_DEV_TRIFLEX=m 347# CONFIG_BLK_DEV_TRIFLEX is not set
292CONFIG_BLK_DEV_CY82C693=m 348# CONFIG_BLK_DEV_CY82C693 is not set
293CONFIG_BLK_DEV_CS5520=m 349# CONFIG_BLK_DEV_CS5520 is not set
294CONFIG_BLK_DEV_CS5530=m 350# CONFIG_BLK_DEV_CS5530 is not set
295CONFIG_BLK_DEV_HPT34X=m 351# CONFIG_BLK_DEV_HPT34X is not set
296# CONFIG_HPT34X_AUTODMA is not set 352# CONFIG_BLK_DEV_HPT366 is not set
297CONFIG_BLK_DEV_HPT366=m 353# CONFIG_BLK_DEV_SC1200 is not set
298CONFIG_BLK_DEV_SC1200=m 354# CONFIG_BLK_DEV_PIIX is not set
299CONFIG_BLK_DEV_PIIX=m 355# CONFIG_BLK_DEV_IT821X is not set
300CONFIG_BLK_DEV_NS87415=m 356# CONFIG_BLK_DEV_NS87415 is not set
301CONFIG_BLK_DEV_PDC202XX_OLD=m 357# CONFIG_BLK_DEV_PDC202XX_OLD is not set
302# CONFIG_PDC202XX_BURST is not set 358# CONFIG_BLK_DEV_PDC202XX_NEW is not set
303CONFIG_BLK_DEV_PDC202XX_NEW=m 359# CONFIG_BLK_DEV_SVWKS is not set
304# CONFIG_PDC202XX_FORCE is not set 360# CONFIG_BLK_DEV_SIIMAGE is not set
305CONFIG_BLK_DEV_SVWKS=m 361# CONFIG_BLK_DEV_SLC90E66 is not set
306CONFIG_BLK_DEV_SIIMAGE=m 362# CONFIG_BLK_DEV_TRM290 is not set
307CONFIG_BLK_DEV_SLC90E66=m 363# CONFIG_BLK_DEV_VIA82CXXX is not set
308CONFIG_BLK_DEV_TRM290=m
309CONFIG_BLK_DEV_VIA82CXXX=m
310# CONFIG_IDE_ARM is not set 364# CONFIG_IDE_ARM is not set
311CONFIG_BLK_DEV_IDEDMA=y 365CONFIG_BLK_DEV_IDEDMA=y
312# CONFIG_IDEDMA_IVB is not set 366# CONFIG_IDEDMA_IVB is not set
@@ -316,6 +370,7 @@ CONFIG_IDEDMA_AUTO=y
316# 370#
317# SCSI device support 371# SCSI device support
318# 372#
373CONFIG_RAID_ATTRS=m
319CONFIG_SCSI=y 374CONFIG_SCSI=y
320CONFIG_SCSI_PROC_FS=y 375CONFIG_SCSI_PROC_FS=y
321 376
@@ -323,11 +378,12 @@ CONFIG_SCSI_PROC_FS=y
323# SCSI support type (disk, tape, CD-ROM) 378# SCSI support type (disk, tape, CD-ROM)
324# 379#
325CONFIG_BLK_DEV_SD=y 380CONFIG_BLK_DEV_SD=y
326CONFIG_CHR_DEV_ST=m 381# CONFIG_CHR_DEV_ST is not set
327CONFIG_CHR_DEV_OSST=m 382# CONFIG_CHR_DEV_OSST is not set
328CONFIG_BLK_DEV_SR=m 383CONFIG_BLK_DEV_SR=m
329CONFIG_BLK_DEV_SR_VENDOR=y 384CONFIG_BLK_DEV_SR_VENDOR=y
330CONFIG_CHR_DEV_SG=m 385CONFIG_CHR_DEV_SG=m
386# CONFIG_CHR_DEV_SCH is not set
331 387
332# 388#
333# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 389# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -340,89 +396,41 @@ CONFIG_SCSI_CONSTANTS=y
340# SCSI Transport Attributes 396# SCSI Transport Attributes
341# 397#
342CONFIG_SCSI_SPI_ATTRS=y 398CONFIG_SCSI_SPI_ATTRS=y
343CONFIG_SCSI_FC_ATTRS=m 399CONFIG_SCSI_FC_ATTRS=y
344CONFIG_SCSI_ISCSI_ATTRS=m 400CONFIG_SCSI_ISCSI_ATTRS=m
401# CONFIG_SCSI_SAS_ATTRS is not set
345 402
346# 403#
347# SCSI low-level drivers 404# SCSI low-level drivers
348# 405#
349CONFIG_BLK_DEV_3W_XXXX_RAID=m 406CONFIG_ISCSI_TCP=m
350CONFIG_SCSI_3W_9XXX=m 407# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
351CONFIG_SCSI_ACARD=m 408# CONFIG_SCSI_3W_9XXX is not set
352CONFIG_SCSI_AACRAID=m 409# CONFIG_SCSI_ACARD is not set
410# CONFIG_SCSI_AACRAID is not set
353# CONFIG_SCSI_AIC7XXX is not set 411# CONFIG_SCSI_AIC7XXX is not set
354# CONFIG_SCSI_AIC7XXX_OLD is not set 412# CONFIG_SCSI_AIC7XXX_OLD is not set
355CONFIG_SCSI_AIC79XX=m 413# CONFIG_SCSI_AIC79XX is not set
356CONFIG_AIC79XX_CMDS_PER_DEVICE=32
357CONFIG_AIC79XX_RESET_DELAY_MS=15000
358# CONFIG_AIC79XX_BUILD_FIRMWARE is not set
359# CONFIG_AIC79XX_ENABLE_RD_STRM is not set
360# CONFIG_AIC79XX_DEBUG_ENABLE is not set
361CONFIG_AIC79XX_DEBUG_MASK=0
362# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
363# CONFIG_MEGARAID_NEWGEN is not set 414# CONFIG_MEGARAID_NEWGEN is not set
364# CONFIG_MEGARAID_LEGACY is not set 415# CONFIG_MEGARAID_LEGACY is not set
365CONFIG_SCSI_SATA=y 416# CONFIG_MEGARAID_SAS is not set
366CONFIG_SCSI_SATA_AHCI=m 417# CONFIG_SCSI_SATA is not set
367CONFIG_SCSI_SATA_SVW=m 418# CONFIG_SCSI_DMX3191D is not set
368CONFIG_SCSI_ATA_PIIX=m
369CONFIG_SCSI_SATA_NV=m
370CONFIG_SCSI_SATA_PROMISE=m
371CONFIG_SCSI_SATA_QSTOR=m
372CONFIG_SCSI_SATA_SX4=m
373CONFIG_SCSI_SATA_SIL=m
374CONFIG_SCSI_SATA_SIS=m
375CONFIG_SCSI_SATA_ULI=m
376CONFIG_SCSI_SATA_VIA=m
377CONFIG_SCSI_SATA_VITESSE=m
378CONFIG_SCSI_DMX3191D=m
379CONFIG_SCSI_EATA_PIO=m
380# CONFIG_SCSI_FUTURE_DOMAIN is not set 419# CONFIG_SCSI_FUTURE_DOMAIN is not set
381CONFIG_SCSI_IPS=m 420# CONFIG_SCSI_IPS is not set
382CONFIG_SCSI_INITIO=m 421# CONFIG_SCSI_INITIO is not set
383CONFIG_SCSI_INIA100=m 422# CONFIG_SCSI_INIA100 is not set
384CONFIG_SCSI_PPA=m 423# CONFIG_SCSI_SYM53C8XX_2 is not set
385CONFIG_SCSI_IMM=m
386# CONFIG_SCSI_IZIP_EPP16 is not set
387# CONFIG_SCSI_IZIP_SLOW_CTR is not set
388CONFIG_SCSI_SYM53C8XX_2=y
389CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
390CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
391CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
392# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
393# CONFIG_SCSI_IPR is not set 424# CONFIG_SCSI_IPR is not set
394CONFIG_SCSI_QLOGIC_ISP=m 425# CONFIG_SCSI_QLOGIC_FC is not set
395CONFIG_SCSI_QLOGIC_FC=y
396CONFIG_SCSI_QLOGIC_FC_FIRMWARE=y
397# CONFIG_SCSI_QLOGIC_1280 is not set 426# CONFIG_SCSI_QLOGIC_1280 is not set
398CONFIG_SCSI_QLOGICPTI=m 427# CONFIG_SCSI_QLOGICPTI is not set
399CONFIG_SCSI_QLA2XXX=y 428# CONFIG_SCSI_QLA_FC is not set
400# CONFIG_SCSI_QLA21XX is not set 429# CONFIG_SCSI_LPFC is not set
401# CONFIG_SCSI_QLA22XX is not set 430# CONFIG_SCSI_DC395x is not set
402# CONFIG_SCSI_QLA2300 is not set
403# CONFIG_SCSI_QLA2322 is not set
404# CONFIG_SCSI_QLA6312 is not set
405CONFIG_SCSI_DC395x=m
406# CONFIG_SCSI_DC390T is not set 431# CONFIG_SCSI_DC390T is not set
407CONFIG_SCSI_DEBUG=m 432# CONFIG_SCSI_DEBUG is not set
408CONFIG_SCSI_SUNESP=y 433# CONFIG_SCSI_SUNESP is not set
409
410#
411# Fibre Channel support
412#
413CONFIG_FC4=m
414
415#
416# FC4 drivers
417#
418CONFIG_FC4_SOC=m
419CONFIG_FC4_SOCAL=m
420
421#
422# FC4 targets
423#
424CONFIG_SCSI_PLUTO=m
425CONFIG_SCSI_FCAL=m
426 434
427# 435#
428# Multi-device support (RAID and LVM) 436# Multi-device support (RAID and LVM)
@@ -442,427 +450,34 @@ CONFIG_DM_CRYPT=m
442CONFIG_DM_SNAPSHOT=m 450CONFIG_DM_SNAPSHOT=m
443CONFIG_DM_MIRROR=m 451CONFIG_DM_MIRROR=m
444CONFIG_DM_ZERO=m 452CONFIG_DM_ZERO=m
453# CONFIG_DM_MULTIPATH is not set
445 454
446# 455#
447# Fusion MPT device support 456# Fusion MPT device support
448# 457#
449CONFIG_FUSION=m 458# CONFIG_FUSION is not set
450CONFIG_FUSION_MAX_SGE=40 459# CONFIG_FUSION_SPI is not set
451CONFIG_FUSION_CTL=m 460# CONFIG_FUSION_FC is not set
452CONFIG_FUSION_LAN=m 461# CONFIG_FUSION_SAS is not set
453 462
454# 463#
455# IEEE 1394 (FireWire) support 464# IEEE 1394 (FireWire) support
456# 465#
457CONFIG_IEEE1394=m 466# CONFIG_IEEE1394 is not set
458
459#
460# Subsystem Options
461#
462# CONFIG_IEEE1394_VERBOSEDEBUG is not set
463CONFIG_IEEE1394_OUI_DB=y
464CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
465CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
466
467#
468# Device Drivers
469#
470CONFIG_IEEE1394_PCILYNX=m
471CONFIG_IEEE1394_OHCI1394=m
472
473#
474# Protocol Drivers
475#
476CONFIG_IEEE1394_VIDEO1394=m
477CONFIG_IEEE1394_SBP2=m
478# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
479CONFIG_IEEE1394_ETH1394=m
480CONFIG_IEEE1394_DV1394=m
481CONFIG_IEEE1394_RAWIO=m
482CONFIG_IEEE1394_CMP=m
483CONFIG_IEEE1394_AMDTP=m
484
485#
486# Networking support
487#
488CONFIG_NET=y
489
490#
491# Networking options
492#
493CONFIG_PACKET=y
494CONFIG_PACKET_MMAP=y
495CONFIG_NETLINK_DEV=y
496CONFIG_UNIX=y
497CONFIG_NET_KEY=m
498CONFIG_INET=y
499CONFIG_IP_MULTICAST=y
500# CONFIG_IP_ADVANCED_ROUTER is not set
501# CONFIG_IP_PNP is not set
502CONFIG_NET_IPIP=m
503CONFIG_NET_IPGRE=m
504CONFIG_NET_IPGRE_BROADCAST=y
505CONFIG_IP_MROUTE=y
506CONFIG_IP_PIMSM_V1=y
507CONFIG_IP_PIMSM_V2=y
508CONFIG_ARPD=y
509CONFIG_SYN_COOKIES=y
510CONFIG_INET_AH=y
511CONFIG_INET_ESP=y
512CONFIG_INET_IPCOMP=y
513CONFIG_INET_TUNNEL=y
514CONFIG_IP_TCPDIAG=y
515# CONFIG_IP_TCPDIAG_IPV6 is not set
516
517#
518# IP: Virtual Server Configuration
519#
520CONFIG_IP_VS=m
521# CONFIG_IP_VS_DEBUG is not set
522CONFIG_IP_VS_TAB_BITS=12
523
524#
525# IPVS transport protocol load balancing support
526#
527CONFIG_IP_VS_PROTO_TCP=y
528CONFIG_IP_VS_PROTO_UDP=y
529CONFIG_IP_VS_PROTO_ESP=y
530CONFIG_IP_VS_PROTO_AH=y
531
532#
533# IPVS scheduler
534#
535CONFIG_IP_VS_RR=m
536CONFIG_IP_VS_WRR=m
537CONFIG_IP_VS_LC=m
538CONFIG_IP_VS_WLC=m
539CONFIG_IP_VS_LBLC=m
540CONFIG_IP_VS_LBLCR=m
541CONFIG_IP_VS_DH=m
542CONFIG_IP_VS_SH=m
543CONFIG_IP_VS_SED=m
544CONFIG_IP_VS_NQ=m
545
546#
547# IPVS application helper
548#
549CONFIG_IP_VS_FTP=m
550CONFIG_IPV6=m
551CONFIG_IPV6_PRIVACY=y
552CONFIG_INET6_AH=m
553CONFIG_INET6_ESP=m
554CONFIG_INET6_IPCOMP=m
555CONFIG_INET6_TUNNEL=m
556CONFIG_IPV6_TUNNEL=m
557CONFIG_NETFILTER=y
558# CONFIG_NETFILTER_DEBUG is not set
559CONFIG_BRIDGE_NETFILTER=y
560
561#
562# IP: Netfilter Configuration
563#
564CONFIG_IP_NF_CONNTRACK=m
565CONFIG_IP_NF_CT_ACCT=y
566CONFIG_IP_NF_CONNTRACK_MARK=y
567CONFIG_IP_NF_CT_PROTO_SCTP=m
568CONFIG_IP_NF_FTP=m
569CONFIG_IP_NF_IRC=m
570CONFIG_IP_NF_TFTP=m
571CONFIG_IP_NF_AMANDA=m
572CONFIG_IP_NF_QUEUE=m
573CONFIG_IP_NF_IPTABLES=m
574CONFIG_IP_NF_MATCH_LIMIT=m
575CONFIG_IP_NF_MATCH_IPRANGE=m
576CONFIG_IP_NF_MATCH_MAC=m
577CONFIG_IP_NF_MATCH_PKTTYPE=m
578CONFIG_IP_NF_MATCH_MARK=m
579CONFIG_IP_NF_MATCH_MULTIPORT=m
580CONFIG_IP_NF_MATCH_TOS=m
581CONFIG_IP_NF_MATCH_RECENT=m
582CONFIG_IP_NF_MATCH_ECN=m
583CONFIG_IP_NF_MATCH_DSCP=m
584CONFIG_IP_NF_MATCH_AH_ESP=m
585CONFIG_IP_NF_MATCH_LENGTH=m
586CONFIG_IP_NF_MATCH_TTL=m
587CONFIG_IP_NF_MATCH_TCPMSS=m
588CONFIG_IP_NF_MATCH_HELPER=m
589CONFIG_IP_NF_MATCH_STATE=m
590CONFIG_IP_NF_MATCH_CONNTRACK=m
591CONFIG_IP_NF_MATCH_OWNER=m
592CONFIG_IP_NF_MATCH_PHYSDEV=m
593CONFIG_IP_NF_MATCH_ADDRTYPE=m
594CONFIG_IP_NF_MATCH_REALM=m
595CONFIG_IP_NF_MATCH_SCTP=m
596CONFIG_IP_NF_MATCH_COMMENT=m
597CONFIG_IP_NF_MATCH_CONNMARK=m
598CONFIG_IP_NF_MATCH_HASHLIMIT=m
599CONFIG_IP_NF_FILTER=m
600CONFIG_IP_NF_TARGET_REJECT=m
601CONFIG_IP_NF_TARGET_LOG=m
602CONFIG_IP_NF_TARGET_ULOG=m
603CONFIG_IP_NF_TARGET_TCPMSS=m
604CONFIG_IP_NF_NAT=m
605CONFIG_IP_NF_NAT_NEEDED=y
606CONFIG_IP_NF_TARGET_MASQUERADE=m
607CONFIG_IP_NF_TARGET_REDIRECT=m
608CONFIG_IP_NF_TARGET_NETMAP=m
609CONFIG_IP_NF_TARGET_SAME=m
610CONFIG_IP_NF_NAT_SNMP_BASIC=m
611CONFIG_IP_NF_NAT_IRC=m
612CONFIG_IP_NF_NAT_FTP=m
613CONFIG_IP_NF_NAT_TFTP=m
614CONFIG_IP_NF_NAT_AMANDA=m
615CONFIG_IP_NF_MANGLE=m
616CONFIG_IP_NF_TARGET_TOS=m
617CONFIG_IP_NF_TARGET_ECN=m
618CONFIG_IP_NF_TARGET_DSCP=m
619CONFIG_IP_NF_TARGET_MARK=m
620CONFIG_IP_NF_TARGET_CLASSIFY=m
621CONFIG_IP_NF_TARGET_CONNMARK=m
622CONFIG_IP_NF_TARGET_CLUSTERIP=m
623CONFIG_IP_NF_RAW=m
624CONFIG_IP_NF_TARGET_NOTRACK=m
625CONFIG_IP_NF_ARPTABLES=m
626CONFIG_IP_NF_ARPFILTER=m
627CONFIG_IP_NF_ARP_MANGLE=m
628
629#
630# IPv6: Netfilter Configuration
631#
632CONFIG_IP6_NF_QUEUE=m
633CONFIG_IP6_NF_IPTABLES=m
634CONFIG_IP6_NF_MATCH_LIMIT=m
635CONFIG_IP6_NF_MATCH_MAC=m
636CONFIG_IP6_NF_MATCH_RT=m
637CONFIG_IP6_NF_MATCH_OPTS=m
638CONFIG_IP6_NF_MATCH_FRAG=m
639CONFIG_IP6_NF_MATCH_HL=m
640CONFIG_IP6_NF_MATCH_MULTIPORT=m
641CONFIG_IP6_NF_MATCH_OWNER=m
642CONFIG_IP6_NF_MATCH_MARK=m
643CONFIG_IP6_NF_MATCH_IPV6HEADER=m
644CONFIG_IP6_NF_MATCH_AHESP=m
645CONFIG_IP6_NF_MATCH_LENGTH=m
646CONFIG_IP6_NF_MATCH_EUI64=m
647CONFIG_IP6_NF_MATCH_PHYSDEV=m
648CONFIG_IP6_NF_FILTER=m
649CONFIG_IP6_NF_TARGET_LOG=m
650CONFIG_IP6_NF_MANGLE=m
651CONFIG_IP6_NF_TARGET_MARK=m
652CONFIG_IP6_NF_RAW=m
653
654#
655# DECnet: Netfilter Configuration
656#
657CONFIG_DECNET_NF_GRABULATOR=m
658
659#
660# Bridge: Netfilter Configuration
661#
662CONFIG_BRIDGE_NF_EBTABLES=m
663CONFIG_BRIDGE_EBT_BROUTE=m
664CONFIG_BRIDGE_EBT_T_FILTER=m
665CONFIG_BRIDGE_EBT_T_NAT=m
666CONFIG_BRIDGE_EBT_802_3=m
667CONFIG_BRIDGE_EBT_AMONG=m
668CONFIG_BRIDGE_EBT_ARP=m
669CONFIG_BRIDGE_EBT_IP=m
670CONFIG_BRIDGE_EBT_LIMIT=m
671CONFIG_BRIDGE_EBT_MARK=m
672CONFIG_BRIDGE_EBT_PKTTYPE=m
673CONFIG_BRIDGE_EBT_STP=m
674CONFIG_BRIDGE_EBT_VLAN=m
675CONFIG_BRIDGE_EBT_ARPREPLY=m
676CONFIG_BRIDGE_EBT_DNAT=m
677CONFIG_BRIDGE_EBT_MARK_T=m
678CONFIG_BRIDGE_EBT_REDIRECT=m
679CONFIG_BRIDGE_EBT_SNAT=m
680CONFIG_BRIDGE_EBT_LOG=m
681CONFIG_BRIDGE_EBT_ULOG=m
682CONFIG_XFRM=y
683CONFIG_XFRM_USER=m
684
685#
686# SCTP Configuration (EXPERIMENTAL)
687#
688CONFIG_IP_SCTP=m
689# CONFIG_SCTP_DBG_MSG is not set
690# CONFIG_SCTP_DBG_OBJCNT is not set
691# CONFIG_SCTP_HMAC_NONE is not set
692# CONFIG_SCTP_HMAC_SHA1 is not set
693CONFIG_SCTP_HMAC_MD5=y
694CONFIG_ATM=y
695CONFIG_ATM_CLIP=y
696# CONFIG_ATM_CLIP_NO_ICMP is not set
697CONFIG_ATM_LANE=m
698CONFIG_ATM_MPOA=m
699CONFIG_ATM_BR2684=m
700CONFIG_ATM_BR2684_IPFILTER=y
701CONFIG_BRIDGE=m
702CONFIG_VLAN_8021Q=m
703CONFIG_DECNET=m
704CONFIG_DECNET_ROUTER=y
705CONFIG_DECNET_ROUTE_FWMARK=y
706CONFIG_LLC=m
707CONFIG_LLC2=m
708CONFIG_IPX=m
709# CONFIG_IPX_INTERN is not set
710CONFIG_ATALK=m
711# CONFIG_DEV_APPLETALK is not set
712CONFIG_X25=m
713CONFIG_LAPB=m
714CONFIG_NET_DIVERT=y
715# CONFIG_ECONET is not set
716# CONFIG_WAN_ROUTER is not set
717 467
718# 468#
719# QoS and/or fair queueing 469# I2O device support
720# 470#
721CONFIG_NET_SCHED=y 471# CONFIG_I2O is not set
722# CONFIG_NET_SCH_CLK_JIFFIES is not set
723# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
724CONFIG_NET_SCH_CLK_CPU=y
725CONFIG_NET_SCH_CBQ=m
726CONFIG_NET_SCH_HTB=m
727CONFIG_NET_SCH_HFSC=m
728CONFIG_NET_SCH_ATM=y
729CONFIG_NET_SCH_PRIO=m
730CONFIG_NET_SCH_RED=m
731CONFIG_NET_SCH_SFQ=m
732CONFIG_NET_SCH_TEQL=m
733CONFIG_NET_SCH_TBF=m
734CONFIG_NET_SCH_GRED=m
735CONFIG_NET_SCH_DSMARK=m
736CONFIG_NET_SCH_NETEM=m
737CONFIG_NET_SCH_INGRESS=m
738CONFIG_NET_QOS=y
739CONFIG_NET_ESTIMATOR=y
740CONFIG_NET_CLS=y
741CONFIG_NET_CLS_BASIC=m
742CONFIG_NET_CLS_TCINDEX=m
743CONFIG_NET_CLS_ROUTE4=m
744CONFIG_NET_CLS_ROUTE=y
745CONFIG_NET_CLS_FW=m
746CONFIG_NET_CLS_U32=m
747CONFIG_CLS_U32_PERF=y
748CONFIG_NET_CLS_IND=y
749CONFIG_CLS_U32_MARK=y
750CONFIG_NET_CLS_RSVP=m
751CONFIG_NET_CLS_RSVP6=m
752CONFIG_NET_EMATCH=y
753CONFIG_NET_EMATCH_STACK=32
754CONFIG_NET_EMATCH_CMP=m
755CONFIG_NET_EMATCH_NBYTE=m
756CONFIG_NET_EMATCH_U32=m
757CONFIG_NET_EMATCH_META=m
758CONFIG_NET_CLS_ACT=y
759CONFIG_NET_ACT_POLICE=m
760CONFIG_NET_ACT_GACT=m
761CONFIG_GACT_PROB=y
762CONFIG_NET_ACT_MIRRED=m
763CONFIG_NET_ACT_IPT=m
764CONFIG_NET_ACT_PEDIT=m
765 472
766# 473#
767# Network testing 474# Network device support
768#
769CONFIG_NET_PKTGEN=m
770CONFIG_NETPOLL=y
771# CONFIG_NETPOLL_RX is not set
772# CONFIG_NETPOLL_TRAP is not set
773CONFIG_NET_POLL_CONTROLLER=y
774CONFIG_HAMRADIO=y
775
776#
777# Packet Radio protocols
778#
779CONFIG_AX25=m
780CONFIG_AX25_DAMA_SLAVE=y
781CONFIG_NETROM=m
782CONFIG_ROSE=m
783
784#
785# AX.25 network device drivers
786#
787# CONFIG_BPQETHER is not set
788# CONFIG_BAYCOM_SER_FDX is not set
789# CONFIG_BAYCOM_SER_HDX is not set
790# CONFIG_BAYCOM_PAR is not set
791# CONFIG_YAM is not set
792CONFIG_IRDA=m
793
794#
795# IrDA protocols
796#
797CONFIG_IRLAN=m
798CONFIG_IRNET=m
799CONFIG_IRCOMM=m
800CONFIG_IRDA_ULTRA=y
801
802#
803# IrDA options
804#
805CONFIG_IRDA_CACHE_LAST_LSAP=y
806CONFIG_IRDA_FAST_RR=y
807# CONFIG_IRDA_DEBUG is not set
808
809#
810# Infrared-port device drivers
811#
812
813#
814# SIR device drivers
815#
816# CONFIG_IRTTY_SIR is not set
817
818#
819# Dongle support
820#
821
822#
823# Old SIR device drivers
824#
825
826#
827# Old Serial dongle support
828#
829
830#
831# FIR device drivers
832#
833# CONFIG_USB_IRDA is not set
834CONFIG_SIGMATEL_FIR=m
835# CONFIG_VLSI_FIR is not set
836CONFIG_BT=m
837CONFIG_BT_L2CAP=m
838CONFIG_BT_SCO=m
839CONFIG_BT_RFCOMM=m
840CONFIG_BT_RFCOMM_TTY=y
841CONFIG_BT_BNEP=m
842CONFIG_BT_BNEP_MC_FILTER=y
843CONFIG_BT_BNEP_PROTO_FILTER=y
844CONFIG_BT_CMTP=m
845CONFIG_BT_HIDP=m
846
847# 475#
848# Bluetooth device drivers
849#
850CONFIG_BT_HCIUSB=m
851CONFIG_BT_HCIUSB_SCO=y
852CONFIG_BT_HCIUART=m
853CONFIG_BT_HCIUART_H4=y
854CONFIG_BT_HCIUART_BCSP=y
855CONFIG_BT_HCIUART_BCSP_TXCRC=y
856CONFIG_BT_HCIBCM203X=m
857CONFIG_BT_HCIBPA10X=m
858CONFIG_BT_HCIBFUSB=m
859CONFIG_BT_HCIVHCI=m
860CONFIG_NETDEVICES=y 476CONFIG_NETDEVICES=y
861CONFIG_DUMMY=m 477CONFIG_DUMMY=m
862CONFIG_BONDING=m 478# CONFIG_BONDING is not set
863CONFIG_EQUALIZER=m 479# CONFIG_EQUALIZER is not set
864CONFIG_TUN=m 480# CONFIG_TUN is not set
865# CONFIG_ETHERTAP is not set
866 481
867# 482#
868# ARCnet devices 483# ARCnet devices
@@ -870,86 +485,74 @@ CONFIG_TUN=m
870# CONFIG_ARCNET is not set 485# CONFIG_ARCNET is not set
871 486
872# 487#
488# PHY device support
489#
490# CONFIG_PHYLIB is not set
491
492#
873# Ethernet (10 or 100Mbit) 493# Ethernet (10 or 100Mbit)
874# 494#
875CONFIG_NET_ETHERNET=y 495CONFIG_NET_ETHERNET=y
876CONFIG_MII=m 496CONFIG_MII=m
877CONFIG_SUNLANCE=y 497# CONFIG_SUNLANCE is not set
878CONFIG_HAPPYMEAL=y 498# CONFIG_HAPPYMEAL is not set
879CONFIG_SUNBMAC=m 499# CONFIG_SUNBMAC is not set
880CONFIG_SUNQE=m 500# CONFIG_SUNQE is not set
881CONFIG_SUNGEM=y 501# CONFIG_SUNGEM is not set
882CONFIG_NET_VENDOR_3COM=y 502CONFIG_CASSINI=m
883CONFIG_VORTEX=m 503# CONFIG_NET_VENDOR_3COM is not set
884CONFIG_TYPHOON=m
885 504
886# 505#
887# Tulip family network device support 506# Tulip family network device support
888# 507#
889CONFIG_NET_TULIP=y 508# CONFIG_NET_TULIP is not set
890CONFIG_DE2104X=m
891CONFIG_TULIP=m
892# CONFIG_TULIP_MWI is not set
893# CONFIG_TULIP_MMIO is not set
894CONFIG_TULIP_NAPI=y
895CONFIG_TULIP_NAPI_HW_MITIGATION=y
896CONFIG_DE4X5=m
897CONFIG_WINBOND_840=m
898# CONFIG_DM9102 is not set
899# CONFIG_HP100 is not set 509# CONFIG_HP100 is not set
900CONFIG_NET_PCI=y 510CONFIG_NET_PCI=y
901CONFIG_PCNET32=m 511# CONFIG_PCNET32 is not set
902# CONFIG_AMD8111_ETH is not set 512# CONFIG_AMD8111_ETH is not set
903CONFIG_ADAPTEC_STARFIRE=m 513# CONFIG_ADAPTEC_STARFIRE is not set
904CONFIG_ADAPTEC_STARFIRE_NAPI=y 514# CONFIG_B44 is not set
905CONFIG_B44=m 515# CONFIG_FORCEDETH is not set
906CONFIG_FORCEDETH=m 516# CONFIG_DGRS is not set
907CONFIG_DGRS=m 517# CONFIG_EEPRO100 is not set
908CONFIG_EEPRO100=m 518# CONFIG_E100 is not set
909CONFIG_E100=m 519# CONFIG_FEALNX is not set
910CONFIG_FEALNX=m 520# CONFIG_NATSEMI is not set
911CONFIG_NATSEMI=m 521# CONFIG_NE2K_PCI is not set
912CONFIG_NE2K_PCI=m
913# CONFIG_8139CP is not set 522# CONFIG_8139CP is not set
914CONFIG_8139TOO=m 523# CONFIG_8139TOO is not set
915# CONFIG_8139TOO_PIO is not set 524# CONFIG_SIS900 is not set
916# CONFIG_8139TOO_TUNE_TWISTER is not set 525# CONFIG_EPIC100 is not set
917# CONFIG_8139TOO_8129 is not set 526# CONFIG_SUNDANCE is not set
918# CONFIG_8139_OLD_RX_RESET is not set 527# CONFIG_VIA_RHINE is not set
919CONFIG_SIS900=m
920CONFIG_EPIC100=m
921CONFIG_SUNDANCE=m
922CONFIG_SUNDANCE_MMIO=y
923CONFIG_VIA_RHINE=m
924# CONFIG_VIA_RHINE_MMIO is not set
925 528
926# 529#
927# Ethernet (1000 Mbit) 530# Ethernet (1000 Mbit)
928# 531#
929CONFIG_ACENIC=m 532# CONFIG_ACENIC is not set
930# CONFIG_ACENIC_OMIT_TIGON_I is not set 533# CONFIG_DL2K is not set
931CONFIG_DL2K=m
932CONFIG_E1000=m 534CONFIG_E1000=m
933CONFIG_E1000_NAPI=y 535CONFIG_E1000_NAPI=y
934CONFIG_MYRI_SBUS=m 536# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
935CONFIG_NS83820=m 537# CONFIG_MYRI_SBUS is not set
936CONFIG_HAMACHI=m 538# CONFIG_NS83820 is not set
937CONFIG_YELLOWFIN=m 539# CONFIG_HAMACHI is not set
938CONFIG_R8169=m 540# CONFIG_YELLOWFIN is not set
939CONFIG_R8169_NAPI=y 541# CONFIG_R8169 is not set
940CONFIG_R8169_VLAN=y 542# CONFIG_SIS190 is not set
941CONFIG_SK98LIN=m 543# CONFIG_SKGE is not set
942CONFIG_VIA_VELOCITY=m 544# CONFIG_SKY2 is not set
545# CONFIG_SK98LIN is not set
546# CONFIG_VIA_VELOCITY is not set
943CONFIG_TIGON3=m 547CONFIG_TIGON3=m
548CONFIG_BNX2=m
944 549
945# 550#
946# Ethernet (10000 Mbit) 551# Ethernet (10000 Mbit)
947# 552#
948CONFIG_IXGB=m 553# CONFIG_CHELSIO_T1 is not set
949CONFIG_IXGB_NAPI=y 554# CONFIG_IXGB is not set
950CONFIG_S2IO=m 555# CONFIG_S2IO is not set
951CONFIG_S2IO_NAPI=y
952CONFIG_2BUFF_MODE=y
953 556
954# 557#
955# Token Ring devices 558# Token Ring devices
@@ -959,140 +562,31 @@ CONFIG_2BUFF_MODE=y
959# 562#
960# Wireless LAN (non-hamradio) 563# Wireless LAN (non-hamradio)
961# 564#
962CONFIG_NET_RADIO=y 565# CONFIG_NET_RADIO is not set
963
964#
965# Obsolete Wireless cards support (pre-802.11)
966#
967# CONFIG_STRIP is not set
968
969#
970# Wireless 802.11b ISA/PCI cards support
971#
972CONFIG_HERMES=m
973CONFIG_PLX_HERMES=m
974CONFIG_TMD_HERMES=m
975CONFIG_PCI_HERMES=m
976CONFIG_ATMEL=m
977CONFIG_PCI_ATMEL=m
978
979#
980# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
981#
982CONFIG_PRISM54=m
983CONFIG_NET_WIRELESS=y
984 566
985# 567#
986# Wan interfaces 568# Wan interfaces
987# 569#
988# CONFIG_WAN is not set 570# CONFIG_WAN is not set
989 571# CONFIG_FDDI is not set
990# 572# CONFIG_HIPPI is not set
991# ATM drivers 573# CONFIG_PPP is not set
992# 574# CONFIG_SLIP is not set
993CONFIG_ATM_TCP=m 575# CONFIG_NET_FC is not set
994# CONFIG_ATM_LANAI is not set 576# CONFIG_SHAPER is not set
995# CONFIG_ATM_ENI is not set 577# CONFIG_NETCONSOLE is not set
996# CONFIG_ATM_FIRESTREAM is not set 578# CONFIG_NETPOLL is not set
997# CONFIG_ATM_ZATM is not set 579# CONFIG_NET_POLL_CONTROLLER is not set
998# CONFIG_ATM_IDT77252 is not set
999# CONFIG_ATM_AMBASSADOR is not set
1000# CONFIG_ATM_HORIZON is not set
1001CONFIG_ATM_FORE200E_MAYBE=m
1002CONFIG_ATM_FORE200E_PCA=y
1003CONFIG_ATM_FORE200E_PCA_DEFAULT_FW=y
1004CONFIG_ATM_FORE200E_SBA=y
1005CONFIG_ATM_FORE200E_SBA_DEFAULT_FW=y
1006CONFIG_ATM_FORE200E_USE_TASKLET=y
1007CONFIG_ATM_FORE200E_TX_RETRY=16
1008CONFIG_ATM_FORE200E_DEBUG=0
1009CONFIG_ATM_FORE200E=m
1010CONFIG_ATM_HE=m
1011CONFIG_ATM_HE_USE_SUNI=y
1012CONFIG_FDDI=y
1013# CONFIG_DEFXX is not set
1014CONFIG_SKFP=m
1015CONFIG_HIPPI=y
1016# CONFIG_ROADRUNNER is not set
1017CONFIG_PLIP=m
1018CONFIG_PPP=m
1019CONFIG_PPP_MULTILINK=y
1020CONFIG_PPP_FILTER=y
1021CONFIG_PPP_ASYNC=m
1022CONFIG_PPP_SYNC_TTY=m
1023CONFIG_PPP_DEFLATE=m
1024CONFIG_PPP_BSDCOMP=m
1025CONFIG_PPPOE=m
1026CONFIG_PPPOATM=m
1027CONFIG_SLIP=m
1028CONFIG_SLIP_COMPRESSED=y
1029CONFIG_SLIP_SMART=y
1030# CONFIG_SLIP_MODE_SLIP6 is not set
1031CONFIG_NET_FC=y
1032CONFIG_SHAPER=m
1033CONFIG_NETCONSOLE=m
1034 580
1035# 581#
1036# ISDN subsystem 582# ISDN subsystem
1037# 583#
1038CONFIG_ISDN=m 584# CONFIG_ISDN is not set
1039
1040#
1041# Old ISDN4Linux
1042#
1043# CONFIG_ISDN_I4L is not set
1044
1045#
1046# CAPI subsystem
1047#
1048CONFIG_ISDN_CAPI=m
1049# CONFIG_ISDN_DRV_AVMB1_VERBOSE_REASON is not set
1050# CONFIG_ISDN_CAPI_MIDDLEWARE is not set
1051CONFIG_ISDN_CAPI_CAPI20=m
1052
1053#
1054# CAPI hardware drivers
1055#
1056
1057#
1058# Active AVM cards
1059#
1060CONFIG_CAPI_AVM=y
1061CONFIG_ISDN_DRV_AVMB1_B1PCI=m
1062CONFIG_ISDN_DRV_AVMB1_B1PCIV4=y
1063CONFIG_ISDN_DRV_AVMB1_B1PCMCIA=m
1064CONFIG_ISDN_DRV_AVMB1_T1PCI=m
1065CONFIG_ISDN_DRV_AVMB1_C4=m
1066
1067#
1068# Active Eicon DIVA Server cards
1069#
1070CONFIG_CAPI_EICON=y
1071CONFIG_ISDN_DIVAS=m
1072CONFIG_ISDN_DIVAS_BRIPCI=y
1073CONFIG_ISDN_DIVAS_PRIPCI=y
1074CONFIG_ISDN_DIVAS_DIVACAPI=m
1075CONFIG_ISDN_DIVAS_USERIDI=m
1076CONFIG_ISDN_DIVAS_MAINT=m
1077 585
1078# 586#
1079# Telephony Support 587# Telephony Support
1080# 588#
1081CONFIG_PHONE=m 589# CONFIG_PHONE is not set
1082CONFIG_PHONE_IXJ=m
1083
1084#
1085# Unix98 PTY support
1086#
1087CONFIG_UNIX98_PTYS=y
1088CONFIG_UNIX98_PTY_COUNT=256
1089
1090#
1091# XFree86 DRI support
1092#
1093CONFIG_DRM=y
1094CONFIG_DRM_TDFX=m
1095# CONFIG_DRM_R128 is not set
1096 590
1097# 591#
1098# Input device support 592# Input device support
@@ -1112,26 +606,6 @@ CONFIG_INPUT_EVDEV=y
1112# CONFIG_INPUT_EVBUG is not set 606# CONFIG_INPUT_EVBUG is not set
1113 607
1114# 608#
1115# Input I/O drivers
1116#
1117CONFIG_GAMEPORT=m
1118CONFIG_SOUND_GAMEPORT=m
1119# CONFIG_GAMEPORT_NS558 is not set
1120# CONFIG_GAMEPORT_L4 is not set
1121# CONFIG_GAMEPORT_EMU10K1 is not set
1122# CONFIG_GAMEPORT_VORTEX is not set
1123# CONFIG_GAMEPORT_FM801 is not set
1124CONFIG_GAMEPORT_CS461X=m
1125CONFIG_SERIO=y
1126CONFIG_SERIO_I8042=y
1127# CONFIG_SERIO_SERPORT is not set
1128# CONFIG_SERIO_CT82C710 is not set
1129# CONFIG_SERIO_PARKBD is not set
1130CONFIG_SERIO_PCIPS2=m
1131CONFIG_SERIO_LIBPS2=y
1132CONFIG_SERIO_RAW=m
1133
1134#
1135# Input Device Drivers 609# Input Device Drivers
1136# 610#
1137CONFIG_INPUT_KEYBOARD=y 611CONFIG_INPUT_KEYBOARD=y
@@ -1143,7 +617,7 @@ CONFIG_KEYBOARD_LKKBD=m
1143CONFIG_INPUT_MOUSE=y 617CONFIG_INPUT_MOUSE=y
1144CONFIG_MOUSE_PS2=y 618CONFIG_MOUSE_PS2=y
1145CONFIG_MOUSE_SERIAL=y 619CONFIG_MOUSE_SERIAL=y
1146CONFIG_MOUSE_VSXXXAA=m 620# CONFIG_MOUSE_VSXXXAA is not set
1147# CONFIG_INPUT_JOYSTICK is not set 621# CONFIG_INPUT_JOYSTICK is not set
1148# CONFIG_INPUT_TOUCHSCREEN is not set 622# CONFIG_INPUT_TOUCHSCREEN is not set
1149CONFIG_INPUT_MISC=y 623CONFIG_INPUT_MISC=y
@@ -1151,406 +625,255 @@ CONFIG_INPUT_SPARCSPKR=y
1151# CONFIG_INPUT_UINPUT is not set 625# CONFIG_INPUT_UINPUT is not set
1152 626
1153# 627#
1154# I2C support 628# Hardware I/O ports
1155#
1156CONFIG_I2C=y
1157CONFIG_I2C_CHARDEV=m
1158
1159#
1160# I2C Algorithms
1161#
1162CONFIG_I2C_ALGOBIT=y
1163CONFIG_I2C_ALGOPCF=m
1164CONFIG_I2C_ALGOPCA=m
1165
1166#
1167# I2C Hardware Bus support
1168#
1169CONFIG_I2C_ALI1535=m
1170CONFIG_I2C_ALI1563=m
1171CONFIG_I2C_ALI15X3=m
1172CONFIG_I2C_AMD756=m
1173# CONFIG_I2C_AMD756_S4882 is not set
1174CONFIG_I2C_AMD8111=m
1175CONFIG_I2C_I801=m
1176CONFIG_I2C_I810=m
1177CONFIG_I2C_ISA=m
1178CONFIG_I2C_NFORCE2=m
1179CONFIG_I2C_PARPORT=m
1180CONFIG_I2C_PARPORT_LIGHT=m
1181CONFIG_I2C_PIIX4=m
1182CONFIG_I2C_PROSAVAGE=m
1183CONFIG_I2C_SAVAGE4=m
1184CONFIG_SCx200_ACB=m
1185CONFIG_I2C_SIS5595=m
1186CONFIG_I2C_SIS630=m
1187CONFIG_I2C_SIS96X=m
1188CONFIG_I2C_STUB=m
1189CONFIG_I2C_VIA=m
1190CONFIG_I2C_VIAPRO=m
1191CONFIG_I2C_VOODOO3=m
1192CONFIG_I2C_PCA_ISA=m
1193
1194#
1195# Hardware Sensors Chip support
1196#
1197CONFIG_I2C_SENSOR=m
1198CONFIG_SENSORS_ADM1021=m
1199CONFIG_SENSORS_ADM1025=m
1200CONFIG_SENSORS_ADM1026=m
1201CONFIG_SENSORS_ADM1031=m
1202CONFIG_SENSORS_ASB100=m
1203CONFIG_SENSORS_DS1621=m
1204CONFIG_SENSORS_FSCHER=m
1205CONFIG_SENSORS_FSCPOS=m
1206CONFIG_SENSORS_GL518SM=m
1207CONFIG_SENSORS_GL520SM=m
1208CONFIG_SENSORS_IT87=m
1209CONFIG_SENSORS_LM63=m
1210CONFIG_SENSORS_LM75=m
1211CONFIG_SENSORS_LM77=m
1212CONFIG_SENSORS_LM78=m
1213CONFIG_SENSORS_LM80=m
1214CONFIG_SENSORS_LM83=m
1215CONFIG_SENSORS_LM85=m
1216CONFIG_SENSORS_LM87=m
1217CONFIG_SENSORS_LM90=m
1218CONFIG_SENSORS_MAX1619=m
1219CONFIG_SENSORS_PC87360=m
1220CONFIG_SENSORS_SMSC47B397=m
1221CONFIG_SENSORS_SIS5595=m
1222CONFIG_SENSORS_SMSC47M1=m
1223CONFIG_SENSORS_VIA686A=m
1224CONFIG_SENSORS_W83781D=m
1225CONFIG_SENSORS_W83L785TS=m
1226CONFIG_SENSORS_W83627HF=m
1227
1228#
1229# Other I2C Chip support
1230#
1231CONFIG_SENSORS_EEPROM=m
1232CONFIG_SENSORS_PCF8574=m
1233CONFIG_SENSORS_PCF8591=m
1234CONFIG_SENSORS_RTC8564=m
1235# CONFIG_I2C_DEBUG_CORE is not set
1236# CONFIG_I2C_DEBUG_ALGO is not set
1237# CONFIG_I2C_DEBUG_BUS is not set
1238# CONFIG_I2C_DEBUG_CHIP is not set
1239
1240#
1241# File systems
1242#
1243CONFIG_EXT2_FS=y
1244CONFIG_EXT2_FS_XATTR=y
1245CONFIG_EXT2_FS_POSIX_ACL=y
1246CONFIG_EXT2_FS_SECURITY=y
1247CONFIG_EXT3_FS=y
1248CONFIG_EXT3_FS_XATTR=y
1249CONFIG_EXT3_FS_POSIX_ACL=y
1250CONFIG_EXT3_FS_SECURITY=y
1251CONFIG_JBD=y
1252# CONFIG_JBD_DEBUG is not set
1253CONFIG_FS_MBCACHE=y
1254# CONFIG_REISERFS_FS is not set
1255CONFIG_JFS_FS=m
1256CONFIG_JFS_POSIX_ACL=y
1257CONFIG_JFS_SECURITY=y
1258# CONFIG_JFS_DEBUG is not set
1259# CONFIG_JFS_STATISTICS is not set
1260CONFIG_FS_POSIX_ACL=y
1261
1262#
1263# XFS support
1264#
1265CONFIG_XFS_FS=m
1266CONFIG_XFS_EXPORT=y
1267# CONFIG_XFS_RT is not set
1268CONFIG_XFS_QUOTA=y
1269CONFIG_XFS_SECURITY=y
1270CONFIG_XFS_POSIX_ACL=y
1271CONFIG_MINIX_FS=m
1272CONFIG_ROMFS_FS=m
1273# CONFIG_QUOTA is not set
1274CONFIG_QUOTACTL=y
1275CONFIG_DNOTIFY=y
1276CONFIG_AUTOFS_FS=m
1277CONFIG_AUTOFS4_FS=m
1278
1279#
1280# CD-ROM/DVD Filesystems
1281#
1282CONFIG_ISO9660_FS=m
1283CONFIG_JOLIET=y
1284# CONFIG_ZISOFS is not set
1285CONFIG_UDF_FS=m
1286CONFIG_UDF_NLS=y
1287
1288# 629#
1289# DOS/FAT/NT Filesystems 630CONFIG_SERIO=y
1290# 631CONFIG_SERIO_I8042=y
1291CONFIG_FAT_FS=m 632# CONFIG_SERIO_SERPORT is not set
1292CONFIG_MSDOS_FS=m 633CONFIG_SERIO_PCIPS2=m
1293CONFIG_VFAT_FS=m 634CONFIG_SERIO_LIBPS2=y
1294CONFIG_FAT_DEFAULT_CODEPAGE=437 635CONFIG_SERIO_RAW=m
1295CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 636# CONFIG_GAMEPORT is not set
1296# CONFIG_NTFS_FS is not set
1297 637
1298# 638#
1299# Pseudo filesystems 639# Character devices
1300# 640#
1301CONFIG_PROC_FS=y 641CONFIG_VT=y
1302CONFIG_PROC_KCORE=y 642CONFIG_VT_CONSOLE=y
1303CONFIG_SYSFS=y 643CONFIG_HW_CONSOLE=y
1304CONFIG_DEVFS_FS=y 644# CONFIG_SERIAL_NONSTANDARD is not set
1305CONFIG_DEVFS_MOUNT=y
1306# CONFIG_DEVFS_DEBUG is not set
1307CONFIG_DEVPTS_FS_XATTR=y
1308# CONFIG_DEVPTS_FS_SECURITY is not set
1309CONFIG_TMPFS=y
1310CONFIG_TMPFS_XATTR=y
1311CONFIG_TMPFS_SECURITY=y
1312CONFIG_HUGETLBFS=y
1313CONFIG_HUGETLB_PAGE=y
1314CONFIG_RAMFS=y
1315 645
1316# 646#
1317# Miscellaneous filesystems 647# Serial drivers
1318# 648#
1319CONFIG_ADFS_FS=m
1320# CONFIG_ADFS_FS_RW is not set
1321CONFIG_AFFS_FS=m
1322CONFIG_HFS_FS=m
1323CONFIG_HFSPLUS_FS=m
1324CONFIG_BEFS_FS=m
1325# CONFIG_BEFS_DEBUG is not set
1326CONFIG_BFS_FS=m
1327CONFIG_EFS_FS=m
1328CONFIG_CRAMFS=m
1329CONFIG_VXFS_FS=m
1330CONFIG_HPFS_FS=m
1331CONFIG_QNX4FS_FS=m
1332CONFIG_SYSV_FS=m
1333CONFIG_UFS_FS=m
1334CONFIG_UFS_FS_WRITE=y
1335 649
1336# 650#
1337# Network File Systems 651# Non-8250 serial port support
1338# 652#
1339CONFIG_NFS_FS=m 653CONFIG_SERIAL_SUNCORE=y
1340CONFIG_NFS_V3=y 654# CONFIG_SERIAL_SUNZILOG is not set
1341CONFIG_NFS_V4=y 655CONFIG_SERIAL_SUNSU=y
1342CONFIG_NFS_DIRECTIO=y 656CONFIG_SERIAL_SUNSU_CONSOLE=y
1343CONFIG_NFSD=m 657CONFIG_SERIAL_SUNSAB=m
1344CONFIG_NFSD_V3=y 658CONFIG_SERIAL_CORE=y
1345CONFIG_NFSD_V4=y 659CONFIG_SERIAL_CORE_CONSOLE=y
1346CONFIG_NFSD_TCP=y 660CONFIG_UNIX98_PTYS=y
1347CONFIG_LOCKD=m 661# CONFIG_LEGACY_PTYS is not set
1348CONFIG_LOCKD_V4=y
1349CONFIG_EXPORTFS=m
1350CONFIG_SUNRPC=m
1351CONFIG_SUNRPC_GSS=m
1352CONFIG_RPCSEC_GSS_KRB5=m
1353CONFIG_RPCSEC_GSS_SPKM3=m
1354CONFIG_SMB_FS=m
1355# CONFIG_SMB_NLS_DEFAULT is not set
1356CONFIG_CIFS=m
1357# CONFIG_CIFS_STATS is not set
1358# CONFIG_CIFS_XATTR is not set
1359# CONFIG_CIFS_EXPERIMENTAL is not set
1360CONFIG_NCP_FS=m
1361# CONFIG_NCPFS_PACKET_SIGNING is not set
1362# CONFIG_NCPFS_IOCTL_LOCKING is not set
1363# CONFIG_NCPFS_STRONG is not set
1364# CONFIG_NCPFS_NFS_NS is not set
1365# CONFIG_NCPFS_OS2_NS is not set
1366# CONFIG_NCPFS_SMALLDOS is not set
1367# CONFIG_NCPFS_NLS is not set
1368# CONFIG_NCPFS_EXTRAS is not set
1369CONFIG_CODA_FS=m
1370# CONFIG_CODA_FS_OLD_API is not set
1371CONFIG_AFS_FS=m
1372CONFIG_RXRPC=m
1373 662
1374# 663#
1375# Partition Types 664# IPMI
1376# 665#
1377# CONFIG_PARTITION_ADVANCED is not set 666# CONFIG_IPMI_HANDLER is not set
1378CONFIG_MSDOS_PARTITION=y
1379CONFIG_SUN_PARTITION=y
1380 667
1381# 668#
1382# Native Language Support 669# Watchdog Cards
1383# 670#
1384CONFIG_NLS=y 671# CONFIG_WATCHDOG is not set
1385CONFIG_NLS_DEFAULT="iso8859-1" 672CONFIG_RTC=y
1386CONFIG_NLS_CODEPAGE_437=m 673# CONFIG_DTLK is not set
1387CONFIG_NLS_CODEPAGE_737=m 674# CONFIG_R3964 is not set
1388CONFIG_NLS_CODEPAGE_775=m 675# CONFIG_APPLICOM is not set
1389CONFIG_NLS_CODEPAGE_850=m
1390CONFIG_NLS_CODEPAGE_852=m
1391CONFIG_NLS_CODEPAGE_855=m
1392CONFIG_NLS_CODEPAGE_857=m
1393CONFIG_NLS_CODEPAGE_860=m
1394CONFIG_NLS_CODEPAGE_861=m
1395CONFIG_NLS_CODEPAGE_862=m
1396CONFIG_NLS_CODEPAGE_863=m
1397CONFIG_NLS_CODEPAGE_864=m
1398CONFIG_NLS_CODEPAGE_865=m
1399CONFIG_NLS_CODEPAGE_866=m
1400CONFIG_NLS_CODEPAGE_869=m
1401CONFIG_NLS_CODEPAGE_936=m
1402CONFIG_NLS_CODEPAGE_950=m
1403CONFIG_NLS_CODEPAGE_932=m
1404CONFIG_NLS_CODEPAGE_949=m
1405CONFIG_NLS_CODEPAGE_874=m
1406CONFIG_NLS_ISO8859_8=m
1407CONFIG_NLS_CODEPAGE_1250=m
1408CONFIG_NLS_CODEPAGE_1251=m
1409CONFIG_NLS_ASCII=m
1410CONFIG_NLS_ISO8859_1=m
1411CONFIG_NLS_ISO8859_2=m
1412CONFIG_NLS_ISO8859_3=m
1413CONFIG_NLS_ISO8859_4=m
1414CONFIG_NLS_ISO8859_5=m
1415CONFIG_NLS_ISO8859_6=m
1416CONFIG_NLS_ISO8859_7=m
1417CONFIG_NLS_ISO8859_9=m
1418CONFIG_NLS_ISO8859_13=m
1419CONFIG_NLS_ISO8859_14=m
1420CONFIG_NLS_ISO8859_15=m
1421CONFIG_NLS_KOI8_R=m
1422CONFIG_NLS_KOI8_U=m
1423CONFIG_NLS_UTF8=m
1424 676
1425# 677#
1426# Multimedia devices 678# Ftape, the floppy tape device driver
1427# 679#
1428CONFIG_VIDEO_DEV=y 680# CONFIG_DRM is not set
681# CONFIG_RAW_DRIVER is not set
1429 682
1430# 683#
1431# Video For Linux 684# TPM devices
1432# 685#
686# CONFIG_TCG_TPM is not set
687# CONFIG_TELCLOCK is not set
1433 688
1434# 689#
1435# Video Adapters 690# I2C support
1436# 691#
1437CONFIG_VIDEO_BT848=m 692CONFIG_I2C=y
1438CONFIG_VIDEO_BWQCAM=m 693# CONFIG_I2C_CHARDEV is not set
1439CONFIG_VIDEO_CQCAM=m
1440CONFIG_VIDEO_W9966=m
1441CONFIG_VIDEO_CPIA=m
1442CONFIG_VIDEO_CPIA_PP=m
1443CONFIG_VIDEO_CPIA_USB=m
1444CONFIG_VIDEO_SAA5246A=m
1445CONFIG_VIDEO_SAA5249=m
1446CONFIG_TUNER_3036=m
1447# CONFIG_VIDEO_STRADIS is not set
1448# CONFIG_VIDEO_ZORAN is not set
1449# CONFIG_VIDEO_SAA7134 is not set
1450CONFIG_VIDEO_MXB=m
1451CONFIG_VIDEO_DPC=m
1452CONFIG_VIDEO_HEXIUM_ORION=m
1453CONFIG_VIDEO_HEXIUM_GEMINI=m
1454CONFIG_VIDEO_CX88=m
1455CONFIG_VIDEO_OVCAMCHIP=m
1456 694
1457# 695#
1458# Radio Adapters 696# I2C Algorithms
1459# 697#
1460CONFIG_RADIO_GEMTEK_PCI=m 698CONFIG_I2C_ALGOBIT=y
1461CONFIG_RADIO_MAXIRADIO=m 699# CONFIG_I2C_ALGOPCF is not set
1462CONFIG_RADIO_MAESTRO=m 700# CONFIG_I2C_ALGOPCA is not set
1463 701
1464# 702#
1465# Digital Video Broadcasting Devices 703# I2C Hardware Bus support
1466# 704#
1467CONFIG_DVB=y 705# CONFIG_I2C_ALI1535 is not set
1468CONFIG_DVB_CORE=m 706# CONFIG_I2C_ALI1563 is not set
707# CONFIG_I2C_ALI15X3 is not set
708# CONFIG_I2C_AMD756 is not set
709# CONFIG_I2C_AMD8111 is not set
710# CONFIG_I2C_I801 is not set
711# CONFIG_I2C_I810 is not set
712# CONFIG_I2C_PIIX4 is not set
713# CONFIG_I2C_NFORCE2 is not set
714# CONFIG_I2C_PARPORT_LIGHT is not set
715# CONFIG_I2C_PROSAVAGE is not set
716# CONFIG_I2C_SAVAGE4 is not set
717# CONFIG_SCx200_ACB is not set
718# CONFIG_I2C_SIS5595 is not set
719# CONFIG_I2C_SIS630 is not set
720# CONFIG_I2C_SIS96X is not set
721# CONFIG_I2C_STUB is not set
722# CONFIG_I2C_VIA is not set
723# CONFIG_I2C_VIAPRO is not set
724# CONFIG_I2C_VOODOO3 is not set
725# CONFIG_I2C_PCA_ISA is not set
726
727#
728# Miscellaneous I2C Chip support
729#
730# CONFIG_SENSORS_DS1337 is not set
731# CONFIG_SENSORS_DS1374 is not set
732# CONFIG_SENSORS_EEPROM is not set
733# CONFIG_SENSORS_PCF8574 is not set
734# CONFIG_SENSORS_PCA9539 is not set
735# CONFIG_SENSORS_PCF8591 is not set
736# CONFIG_SENSORS_RTC8564 is not set
737# CONFIG_SENSORS_MAX6875 is not set
738# CONFIG_RTC_X1205_I2C is not set
739# CONFIG_I2C_DEBUG_CORE is not set
740# CONFIG_I2C_DEBUG_ALGO is not set
741# CONFIG_I2C_DEBUG_BUS is not set
742# CONFIG_I2C_DEBUG_CHIP is not set
1469 743
1470# 744#
1471# Supported SAA7146 based PCI Adapters 745# SPI support
1472# 746#
1473CONFIG_DVB_AV7110=m 747# CONFIG_SPI is not set
1474# CONFIG_DVB_AV7110_OSD is not set 748# CONFIG_SPI_MASTER is not set
1475CONFIG_DVB_BUDGET=m
1476CONFIG_DVB_BUDGET_CI=m
1477CONFIG_DVB_BUDGET_AV=m
1478CONFIG_DVB_BUDGET_PATCH=m
1479 749
1480# 750#
1481# Supported USB Adapters 751# Dallas's 1-wire bus
1482# 752#
1483# CONFIG_DVB_TTUSB_BUDGET is not set 753# CONFIG_W1 is not set
1484CONFIG_DVB_TTUSB_DEC=m
1485CONFIG_DVB_DIBUSB=m
1486# CONFIG_DVB_DIBUSB_MISDESIGNED_DEVICES is not set
1487CONFIG_DVB_DIBCOM_DEBUG=y
1488CONFIG_DVB_CINERGYT2=m
1489# CONFIG_DVB_CINERGYT2_TUNING is not set
1490 754
1491# 755#
1492# Supported FlexCopII (B2C2) Adapters 756# Hardware Monitoring support
1493# 757#
1494CONFIG_DVB_B2C2_SKYSTAR=m 758CONFIG_HWMON=y
1495CONFIG_DVB_B2C2_USB=m 759# CONFIG_HWMON_VID is not set
760# CONFIG_SENSORS_ADM1021 is not set
761# CONFIG_SENSORS_ADM1025 is not set
762# CONFIG_SENSORS_ADM1026 is not set
763# CONFIG_SENSORS_ADM1031 is not set
764# CONFIG_SENSORS_ADM9240 is not set
765# CONFIG_SENSORS_ASB100 is not set
766# CONFIG_SENSORS_ATXP1 is not set
767# CONFIG_SENSORS_DS1621 is not set
768# CONFIG_SENSORS_FSCHER is not set
769# CONFIG_SENSORS_FSCPOS is not set
770# CONFIG_SENSORS_GL518SM is not set
771# CONFIG_SENSORS_GL520SM is not set
772# CONFIG_SENSORS_IT87 is not set
773# CONFIG_SENSORS_LM63 is not set
774# CONFIG_SENSORS_LM75 is not set
775# CONFIG_SENSORS_LM77 is not set
776# CONFIG_SENSORS_LM78 is not set
777# CONFIG_SENSORS_LM80 is not set
778# CONFIG_SENSORS_LM83 is not set
779# CONFIG_SENSORS_LM85 is not set
780# CONFIG_SENSORS_LM87 is not set
781# CONFIG_SENSORS_LM90 is not set
782# CONFIG_SENSORS_LM92 is not set
783# CONFIG_SENSORS_MAX1619 is not set
784# CONFIG_SENSORS_PC87360 is not set
785# CONFIG_SENSORS_SIS5595 is not set
786# CONFIG_SENSORS_SMSC47M1 is not set
787# CONFIG_SENSORS_SMSC47B397 is not set
788# CONFIG_SENSORS_VIA686A is not set
789# CONFIG_SENSORS_VT8231 is not set
790# CONFIG_SENSORS_W83781D is not set
791# CONFIG_SENSORS_W83792D is not set
792# CONFIG_SENSORS_W83L785TS is not set
793# CONFIG_SENSORS_W83627HF is not set
794# CONFIG_SENSORS_W83627EHF is not set
795# CONFIG_HWMON_DEBUG_CHIP is not set
1496 796
1497# 797#
1498# Supported BT878 Adapters 798# Misc devices
1499# 799#
1500CONFIG_DVB_BT8XX=m
1501 800
1502# 801#
1503# Supported DVB Frontends 802# Multimedia Capabilities Port drivers
1504# 803#
1505 804
1506# 805#
1507# Customise DVB Frontends 806# Multimedia devices
1508# 807#
808# CONFIG_VIDEO_DEV is not set
1509 809
1510# 810#
1511# DVB-S (satellite) frontends 811# Digital Video Broadcasting Devices
1512# 812#
1513CONFIG_DVB_STV0299=m 813# CONFIG_DVB is not set
1514CONFIG_DVB_CX24110=m
1515CONFIG_DVB_TDA8083=m
1516CONFIG_DVB_TDA80XX=m
1517CONFIG_DVB_MT312=m
1518CONFIG_DVB_VES1X93=m
1519 814
1520# 815#
1521# DVB-T (terrestrial) frontends 816# Graphics support
1522# 817#
1523CONFIG_DVB_SP8870=m 818CONFIG_FB=y
1524CONFIG_DVB_SP887X=m 819CONFIG_FB_CFB_FILLRECT=y
1525CONFIG_DVB_CX22700=m 820CONFIG_FB_CFB_COPYAREA=y
1526CONFIG_DVB_CX22702=m 821CONFIG_FB_CFB_IMAGEBLIT=y
1527CONFIG_DVB_L64781=m 822# CONFIG_FB_MACMODES is not set
1528CONFIG_DVB_TDA1004X=m 823CONFIG_FB_MODE_HELPERS=y
1529CONFIG_DVB_NXT6000=m 824CONFIG_FB_TILEBLITTING=y
1530CONFIG_DVB_MT352=m 825# CONFIG_FB_CIRRUS is not set
1531CONFIG_DVB_DIB3000MB=m 826# CONFIG_FB_PM2 is not set
1532CONFIG_DVB_DIB3000MC=m 827# CONFIG_FB_ASILIANT is not set
828# CONFIG_FB_IMSTT is not set
829# CONFIG_FB_SBUS is not set
830# CONFIG_FB_S1D13XXX is not set
831# CONFIG_FB_NVIDIA is not set
832# CONFIG_FB_RIVA is not set
833# CONFIG_FB_MATROX is not set
834# CONFIG_FB_RADEON_OLD is not set
835CONFIG_FB_RADEON=y
836CONFIG_FB_RADEON_I2C=y
837# CONFIG_FB_RADEON_DEBUG is not set
838# CONFIG_FB_ATY128 is not set
839# CONFIG_FB_ATY is not set
840# CONFIG_FB_SAVAGE is not set
841# CONFIG_FB_SIS is not set
842# CONFIG_FB_NEOMAGIC is not set
843# CONFIG_FB_KYRO is not set
844# CONFIG_FB_3DFX is not set
845# CONFIG_FB_VOODOO1 is not set
846# CONFIG_FB_TRIDENT is not set
847# CONFIG_FB_PCI is not set
848# CONFIG_FB_VIRTUAL is not set
1533 849
1534# 850#
1535# DVB-C (cable) frontends 851# Console display driver support
1536# 852#
1537CONFIG_DVB_ATMEL_AT76C651=m 853# CONFIG_PROM_CONSOLE is not set
1538CONFIG_DVB_VES1820=m 854CONFIG_DUMMY_CONSOLE=y
1539CONFIG_DVB_TDA10021=m 855CONFIG_FRAMEBUFFER_CONSOLE=y
1540CONFIG_DVB_STV0297=m 856# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
857CONFIG_FONTS=y
858# CONFIG_FONT_8x8 is not set
859# CONFIG_FONT_8x16 is not set
860# CONFIG_FONT_6x11 is not set
861# CONFIG_FONT_7x14 is not set
862# CONFIG_FONT_PEARL_8x8 is not set
863# CONFIG_FONT_ACORN_8x8 is not set
864CONFIG_FONT_SUN8x16=y
865# CONFIG_FONT_SUN12x22 is not set
866# CONFIG_FONT_10x18 is not set
1541 867
1542# 868#
1543# ATSC (North American/Korean Terresterial DTV) frontends 869# Logo configuration
1544# 870#
1545CONFIG_DVB_NXT2002=m 871CONFIG_LOGO=y
1546CONFIG_VIDEO_SAA7146=m 872# CONFIG_LOGO_LINUX_MONO is not set
1547CONFIG_VIDEO_SAA7146_VV=m 873# CONFIG_LOGO_LINUX_VGA16 is not set
1548CONFIG_VIDEO_VIDEOBUF=m 874# CONFIG_LOGO_LINUX_CLUT224 is not set
1549CONFIG_VIDEO_TUNER=m 875CONFIG_LOGO_SUN_CLUT224=y
1550CONFIG_VIDEO_BUF=m 876# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
1551CONFIG_VIDEO_BTCX=m
1552CONFIG_VIDEO_IR=m
1553CONFIG_VIDEO_TVEEPROM=m
1554 877
1555# 878#
1556# Sound 879# Sound
@@ -1563,7 +886,6 @@ CONFIG_SOUND=m
1563CONFIG_SND=m 886CONFIG_SND=m
1564CONFIG_SND_TIMER=m 887CONFIG_SND_TIMER=m
1565CONFIG_SND_PCM=m 888CONFIG_SND_PCM=m
1566CONFIG_SND_HWDEP=m
1567CONFIG_SND_RAWMIDI=m 889CONFIG_SND_RAWMIDI=m
1568CONFIG_SND_SEQUENCER=m 890CONFIG_SND_SEQUENCER=m
1569CONFIG_SND_SEQ_DUMMY=m 891CONFIG_SND_SEQ_DUMMY=m
@@ -1571,8 +893,9 @@ CONFIG_SND_OSSEMUL=y
1571CONFIG_SND_MIXER_OSS=m 893CONFIG_SND_MIXER_OSS=m
1572CONFIG_SND_PCM_OSS=m 894CONFIG_SND_PCM_OSS=m
1573CONFIG_SND_SEQUENCER_OSS=y 895CONFIG_SND_SEQUENCER_OSS=y
1574CONFIG_SND_BIT32_EMUL=m
1575# CONFIG_SND_RTCTIMER is not set 896# CONFIG_SND_RTCTIMER is not set
897# CONFIG_SND_DYNAMIC_MINORS is not set
898CONFIG_SND_SUPPORT_OLD_API=y
1576# CONFIG_SND_VERBOSE_PRINTK is not set 899# CONFIG_SND_VERBOSE_PRINTK is not set
1577# CONFIG_SND_DEBUG is not set 900# CONFIG_SND_DEBUG is not set
1578 901
@@ -1580,59 +903,58 @@ CONFIG_SND_BIT32_EMUL=m
1580# Generic devices 903# Generic devices
1581# 904#
1582CONFIG_SND_MPU401_UART=m 905CONFIG_SND_MPU401_UART=m
1583CONFIG_SND_OPL3_LIB=m 906CONFIG_SND_AC97_CODEC=m
1584CONFIG_SND_VX_LIB=m 907CONFIG_SND_AC97_BUS=m
1585CONFIG_SND_DUMMY=m 908CONFIG_SND_DUMMY=m
1586CONFIG_SND_VIRMIDI=m 909CONFIG_SND_VIRMIDI=m
1587# CONFIG_SND_MTPAV is not set 910CONFIG_SND_MTPAV=m
1588# CONFIG_SND_SERIAL_U16550 is not set 911# CONFIG_SND_SERIAL_U16550 is not set
1589# CONFIG_SND_MPU401 is not set 912# CONFIG_SND_MPU401 is not set
1590 913
1591# 914#
1592# PCI devices 915# PCI devices
1593# 916#
1594CONFIG_SND_AC97_CODEC=m 917# CONFIG_SND_AD1889 is not set
1595CONFIG_SND_ALI5451=m 918CONFIG_SND_ALI5451=m
1596CONFIG_SND_ATIIXP=m 919# CONFIG_SND_ATIIXP is not set
1597CONFIG_SND_ATIIXP_MODEM=m 920# CONFIG_SND_ATIIXP_MODEM is not set
1598CONFIG_SND_AU8810=m 921# CONFIG_SND_AU8810 is not set
1599CONFIG_SND_AU8820=m 922# CONFIG_SND_AU8820 is not set
1600CONFIG_SND_AU8830=m 923# CONFIG_SND_AU8830 is not set
1601CONFIG_SND_AZT3328=m 924# CONFIG_SND_AZT3328 is not set
1602CONFIG_SND_BT87X=m 925# CONFIG_SND_BT87X is not set
1603# CONFIG_SND_BT87X_OVERCLOCK is not set 926# CONFIG_SND_CA0106 is not set
1604CONFIG_SND_CS46XX=m 927# CONFIG_SND_CMIPCI is not set
1605# CONFIG_SND_CS46XX_NEW_DSP is not set 928# CONFIG_SND_CS4281 is not set
1606CONFIG_SND_CS4281=m 929# CONFIG_SND_CS46XX is not set
1607CONFIG_SND_EMU10K1=m 930# CONFIG_SND_EMU10K1 is not set
1608CONFIG_SND_EMU10K1X=m 931# CONFIG_SND_EMU10K1X is not set
1609CONFIG_SND_CA0106=m 932# CONFIG_SND_ENS1370 is not set
1610CONFIG_SND_KORG1212=m 933# CONFIG_SND_ENS1371 is not set
1611CONFIG_SND_MIXART=m 934# CONFIG_SND_ES1938 is not set
1612CONFIG_SND_NM256=m 935# CONFIG_SND_ES1968 is not set
936# CONFIG_SND_FM801 is not set
937# CONFIG_SND_HDA_INTEL is not set
938# CONFIG_SND_HDSP is not set
939# CONFIG_SND_HDSPM is not set
940# CONFIG_SND_ICE1712 is not set
941# CONFIG_SND_ICE1724 is not set
942# CONFIG_SND_INTEL8X0 is not set
943# CONFIG_SND_INTEL8X0M is not set
944# CONFIG_SND_KORG1212 is not set
945# CONFIG_SND_MAESTRO3 is not set
946# CONFIG_SND_MIXART is not set
947# CONFIG_SND_NM256 is not set
948# CONFIG_SND_PCXHR is not set
1613# CONFIG_SND_RME32 is not set 949# CONFIG_SND_RME32 is not set
1614# CONFIG_SND_RME96 is not set 950# CONFIG_SND_RME96 is not set
1615# CONFIG_SND_RME9652 is not set 951# CONFIG_SND_RME9652 is not set
1616# CONFIG_SND_HDSP is not set 952# CONFIG_SND_SONICVIBES is not set
1617CONFIG_SND_TRIDENT=m 953# CONFIG_SND_TRIDENT is not set
1618CONFIG_SND_YMFPCI=m
1619CONFIG_SND_ALS4000=m
1620CONFIG_SND_CMIPCI=m
1621CONFIG_SND_ENS1370=m
1622CONFIG_SND_ENS1371=m
1623CONFIG_SND_ES1938=m
1624CONFIG_SND_ES1968=m
1625CONFIG_SND_MAESTRO3=m
1626CONFIG_SND_FM801=m
1627CONFIG_SND_FM801_TEA575X=m
1628CONFIG_SND_ICE1712=m
1629# CONFIG_SND_ICE1724 is not set
1630CONFIG_SND_INTEL8X0=m
1631CONFIG_SND_INTEL8X0M=m
1632CONFIG_SND_SONICVIBES=m
1633# CONFIG_SND_VIA82XX is not set 954# CONFIG_SND_VIA82XX is not set
1634CONFIG_SND_VIA82XX_MODEM=m 955# CONFIG_SND_VIA82XX_MODEM is not set
1635CONFIG_SND_VX222=m 956# CONFIG_SND_VX222 is not set
957# CONFIG_SND_YMFPCI is not set
1636 958
1637# 959#
1638# USB devices 960# USB devices
@@ -1642,12 +964,20 @@ CONFIG_SND_VX222=m
1642# 964#
1643# ALSA Sparc devices 965# ALSA Sparc devices
1644# 966#
1645CONFIG_SND_SUN_AMD7930=m 967# CONFIG_SND_SUN_AMD7930 is not set
1646CONFIG_SND_SUN_CS4231=m 968CONFIG_SND_SUN_CS4231=m
969# CONFIG_SND_SUN_DBRI is not set
970
971#
972# Open Sound System
973#
974# CONFIG_SOUND_PRIME is not set
1647 975
1648# 976#
1649# USB support 977# USB support
1650# 978#
979CONFIG_USB_ARCH_HAS_HCD=y
980CONFIG_USB_ARCH_HAS_OHCI=y
1651CONFIG_USB=y 981CONFIG_USB=y
1652# CONFIG_USB_DEBUG is not set 982# CONFIG_USB_DEBUG is not set
1653 983
@@ -1658,8 +988,6 @@ CONFIG_USB_DEVICEFS=y
1658# CONFIG_USB_BANDWIDTH is not set 988# CONFIG_USB_BANDWIDTH is not set
1659# CONFIG_USB_DYNAMIC_MINORS is not set 989# CONFIG_USB_DYNAMIC_MINORS is not set
1660# CONFIG_USB_OTG is not set 990# CONFIG_USB_OTG is not set
1661CONFIG_USB_ARCH_HAS_HCD=y
1662CONFIG_USB_ARCH_HAS_OHCI=y
1663 991
1664# 992#
1665# USB Host Controller Drivers 993# USB Host Controller Drivers
@@ -1667,174 +995,108 @@ CONFIG_USB_ARCH_HAS_OHCI=y
1667CONFIG_USB_EHCI_HCD=m 995CONFIG_USB_EHCI_HCD=m
1668# CONFIG_USB_EHCI_SPLIT_ISO is not set 996# CONFIG_USB_EHCI_SPLIT_ISO is not set
1669# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 997# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
998# CONFIG_USB_ISP116X_HCD is not set
1670CONFIG_USB_OHCI_HCD=y 999CONFIG_USB_OHCI_HCD=y
1000# CONFIG_USB_OHCI_BIG_ENDIAN is not set
1001CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1671CONFIG_USB_UHCI_HCD=m 1002CONFIG_USB_UHCI_HCD=m
1672CONFIG_USB_SL811_HCD=m 1003# CONFIG_USB_SL811_HCD is not set
1673 1004
1674# 1005#
1675# USB Device Class drivers 1006# USB Device Class drivers
1676# 1007#
1677# CONFIG_USB_AUDIO is not set 1008# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
1009# CONFIG_USB_ACM is not set
1010# CONFIG_USB_PRINTER is not set
1678 1011
1679# 1012#
1680# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem 1013# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1681# 1014#
1682# CONFIG_USB_MIDI is not set
1683CONFIG_USB_ACM=m
1684CONFIG_USB_PRINTER=m
1685 1015
1686# 1016#
1687# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information 1017# may also be needed; see USB_STORAGE Help for more information
1688# 1018#
1689CONFIG_USB_STORAGE=m 1019# CONFIG_USB_STORAGE is not set
1690# CONFIG_USB_STORAGE_DEBUG is not set 1020# CONFIG_USB_LIBUSUAL is not set
1691CONFIG_USB_STORAGE_RW_DETECT=y
1692# CONFIG_USB_STORAGE_DATAFAB is not set
1693CONFIG_USB_STORAGE_FREECOM=y
1694CONFIG_USB_STORAGE_ISD200=y
1695CONFIG_USB_STORAGE_DPCM=y
1696CONFIG_USB_STORAGE_HP8200e=y
1697CONFIG_USB_STORAGE_SDDR09=y
1698CONFIG_USB_STORAGE_SDDR55=y
1699# CONFIG_USB_STORAGE_JUMPSHOT is not set
1700 1021
1701# 1022#
1702# USB Input Devices 1023# USB Input Devices
1703# 1024#
1704CONFIG_USB_HID=y 1025CONFIG_USB_HID=y
1705CONFIG_USB_HIDINPUT=y 1026CONFIG_USB_HIDINPUT=y
1027# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1706# CONFIG_HID_FF is not set 1028# CONFIG_HID_FF is not set
1707CONFIG_USB_HIDDEV=y 1029CONFIG_USB_HIDDEV=y
1708# CONFIG_USB_AIPTEK is not set 1030# CONFIG_USB_AIPTEK is not set
1709CONFIG_USB_WACOM=m 1031# CONFIG_USB_WACOM is not set
1710CONFIG_USB_KBTAB=m 1032# CONFIG_USB_ACECAD is not set
1033# CONFIG_USB_KBTAB is not set
1711# CONFIG_USB_POWERMATE is not set 1034# CONFIG_USB_POWERMATE is not set
1712CONFIG_USB_MTOUCH=m 1035# CONFIG_USB_MTOUCH is not set
1713CONFIG_USB_EGALAX=m 1036# CONFIG_USB_ITMTOUCH is not set
1037# CONFIG_USB_EGALAX is not set
1038# CONFIG_USB_YEALINK is not set
1714# CONFIG_USB_XPAD is not set 1039# CONFIG_USB_XPAD is not set
1715CONFIG_USB_ATI_REMOTE=m 1040# CONFIG_USB_ATI_REMOTE is not set
1041# CONFIG_USB_ATI_REMOTE2 is not set
1042# CONFIG_USB_KEYSPAN_REMOTE is not set
1043# CONFIG_USB_APPLETOUCH is not set
1716 1044
1717# 1045#
1718# USB Imaging devices 1046# USB Imaging devices
1719# 1047#
1720CONFIG_USB_MDC800=m 1048# CONFIG_USB_MDC800 is not set
1721CONFIG_USB_MICROTEK=m 1049# CONFIG_USB_MICROTEK is not set
1722 1050
1723# 1051#
1724# USB Multimedia devices 1052# USB Multimedia devices
1725# 1053#
1726# CONFIG_USB_DABUSB is not set 1054# CONFIG_USB_DABUSB is not set
1727# CONFIG_USB_VICAM is not set
1728# CONFIG_USB_DSBR is not set
1729# CONFIG_USB_IBMCAM is not set
1730# CONFIG_USB_KONICAWC is not set
1731# CONFIG_USB_OV511 is not set
1732# CONFIG_USB_SE401 is not set
1733CONFIG_USB_SN9C102=m
1734# CONFIG_USB_STV680 is not set
1735CONFIG_USB_W9968CF=m
1736 1055
1737# 1056#
1738# USB Network Adapters 1057# Video4Linux support is needed for USB Multimedia device support
1739#
1740CONFIG_USB_CATC=m
1741CONFIG_USB_KAWETH=m
1742CONFIG_USB_PEGASUS=m
1743CONFIG_USB_RTL8150=m
1744CONFIG_USB_USBNET=m
1745
1746#
1747# USB Host-to-Host Cables
1748# 1058#
1749CONFIG_USB_ALI_M5632=y
1750CONFIG_USB_AN2720=y
1751CONFIG_USB_BELKIN=y
1752CONFIG_USB_GENESYS=y
1753CONFIG_USB_NET1080=y
1754CONFIG_USB_PL2301=y
1755CONFIG_USB_KC2190=y
1756
1757#
1758# Intelligent USB Devices/Gadgets
1759#
1760CONFIG_USB_ARMLINUX=y
1761CONFIG_USB_EPSON2888=y
1762CONFIG_USB_ZAURUS=y
1763CONFIG_USB_CDCETHER=y
1764 1059
1765# 1060#
1766# USB Network Adapters 1061# USB Network Adapters
1767# 1062#
1768CONFIG_USB_AX8817X=y 1063# CONFIG_USB_CATC is not set
1064# CONFIG_USB_KAWETH is not set
1065# CONFIG_USB_PEGASUS is not set
1066# CONFIG_USB_RTL8150 is not set
1067# CONFIG_USB_USBNET is not set
1068# CONFIG_USB_MON is not set
1769 1069
1770# 1070#
1771# USB port drivers 1071# USB port drivers
1772# 1072#
1773CONFIG_USB_USS720=m
1774 1073
1775# 1074#
1776# USB Serial Converter support 1075# USB Serial Converter support
1777# 1076#
1778CONFIG_USB_SERIAL=m 1077# CONFIG_USB_SERIAL is not set
1779CONFIG_USB_SERIAL_GENERIC=y
1780CONFIG_USB_SERIAL_BELKIN=m
1781CONFIG_USB_SERIAL_DIGI_ACCELEPORT=m
1782CONFIG_USB_SERIAL_CYPRESS_M8=m
1783CONFIG_USB_SERIAL_EMPEG=m
1784CONFIG_USB_SERIAL_FTDI_SIO=m
1785# CONFIG_USB_SERIAL_VISOR is not set
1786CONFIG_USB_SERIAL_IPAQ=m
1787# CONFIG_USB_SERIAL_IR is not set
1788CONFIG_USB_SERIAL_EDGEPORT=m
1789# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1790CONFIG_USB_SERIAL_GARMIN=m
1791CONFIG_USB_SERIAL_IPW=m
1792CONFIG_USB_SERIAL_KEYSPAN_PDA=m
1793CONFIG_USB_SERIAL_KEYSPAN=m
1794# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set
1795# CONFIG_USB_SERIAL_KEYSPAN_USA28 is not set
1796# CONFIG_USB_SERIAL_KEYSPAN_USA28X is not set
1797# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set
1798# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set
1799# CONFIG_USB_SERIAL_KEYSPAN_USA19 is not set
1800# CONFIG_USB_SERIAL_KEYSPAN_USA18X is not set
1801# CONFIG_USB_SERIAL_KEYSPAN_USA19W is not set
1802# CONFIG_USB_SERIAL_KEYSPAN_USA19QW is not set
1803# CONFIG_USB_SERIAL_KEYSPAN_USA19QI is not set
1804# CONFIG_USB_SERIAL_KEYSPAN_USA49W is not set
1805# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set
1806CONFIG_USB_SERIAL_KLSI=m
1807# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1808CONFIG_USB_SERIAL_MCT_U232=m
1809CONFIG_USB_SERIAL_PL2303=m
1810# CONFIG_USB_SERIAL_SAFE is not set
1811CONFIG_USB_SERIAL_TI=m
1812CONFIG_USB_SERIAL_CYBERJACK=m
1813CONFIG_USB_SERIAL_XIRCOM=m
1814CONFIG_USB_SERIAL_OMNINET=m
1815CONFIG_USB_EZUSB=y
1816 1078
1817# 1079#
1818# USB Miscellaneous drivers 1080# USB Miscellaneous drivers
1819# 1081#
1820CONFIG_USB_EMI62=m 1082# CONFIG_USB_EMI62 is not set
1821CONFIG_USB_EMI26=m 1083# CONFIG_USB_EMI26 is not set
1822CONFIG_USB_AUERSWALD=m 1084# CONFIG_USB_AUERSWALD is not set
1823CONFIG_USB_RIO500=m 1085# CONFIG_USB_RIO500 is not set
1824CONFIG_USB_LEGOTOWER=m 1086# CONFIG_USB_LEGOTOWER is not set
1825CONFIG_USB_LCD=m 1087# CONFIG_USB_LCD is not set
1826CONFIG_USB_LED=m 1088# CONFIG_USB_LED is not set
1827CONFIG_USB_CYTHERM=m 1089# CONFIG_USB_CYTHERM is not set
1828CONFIG_USB_PHIDGETKIT=m 1090# CONFIG_USB_PHIDGETKIT is not set
1829CONFIG_USB_PHIDGETSERVO=m 1091# CONFIG_USB_PHIDGETSERVO is not set
1830CONFIG_USB_IDMOUSE=m 1092# CONFIG_USB_IDMOUSE is not set
1831CONFIG_USB_TEST=m 1093# CONFIG_USB_SISUSBVGA is not set
1094# CONFIG_USB_LD is not set
1095# CONFIG_USB_TEST is not set
1832 1096
1833# 1097#
1834# USB ATM/DSL drivers 1098# USB DSL modem support
1835# 1099#
1836CONFIG_USB_ATM=m
1837CONFIG_USB_SPEEDTOUCH=m
1838 1100
1839# 1101#
1840# USB Gadget Support 1102# USB Gadget Support
@@ -1842,64 +1104,202 @@ CONFIG_USB_SPEEDTOUCH=m
1842# CONFIG_USB_GADGET is not set 1104# CONFIG_USB_GADGET is not set
1843 1105
1844# 1106#
1107# MMC/SD Card support
1108#
1109# CONFIG_MMC is not set
1110
1111#
1845# InfiniBand support 1112# InfiniBand support
1846# 1113#
1847CONFIG_INFINIBAND=m 1114# CONFIG_INFINIBAND is not set
1848CONFIG_INFINIBAND_MTHCA=m
1849# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
1850CONFIG_INFINIBAND_IPOIB=m
1851# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
1852 1115
1853# 1116#
1854# Watchdog Cards 1117# SN Devices
1118#
1119
1120#
1121# Misc Linux/SPARC drivers
1122#
1123CONFIG_SUN_OPENPROMIO=m
1124CONFIG_SUN_MOSTEK_RTC=y
1125# CONFIG_OBP_FLASH is not set
1126# CONFIG_SUN_BPP is not set
1127# CONFIG_BBC_I2C is not set
1128# CONFIG_ENVCTRL is not set
1129# CONFIG_DISPLAY7SEG is not set
1130
1131#
1132# Fibre Channel support
1133#
1134# CONFIG_FC4 is not set
1135
1136#
1137# File systems
1138#
1139CONFIG_EXT2_FS=y
1140CONFIG_EXT2_FS_XATTR=y
1141CONFIG_EXT2_FS_POSIX_ACL=y
1142CONFIG_EXT2_FS_SECURITY=y
1143# CONFIG_EXT2_FS_XIP is not set
1144CONFIG_EXT3_FS=y
1145CONFIG_EXT3_FS_XATTR=y
1146CONFIG_EXT3_FS_POSIX_ACL=y
1147CONFIG_EXT3_FS_SECURITY=y
1148CONFIG_JBD=y
1149# CONFIG_JBD_DEBUG is not set
1150CONFIG_FS_MBCACHE=y
1151# CONFIG_REISERFS_FS is not set
1152# CONFIG_JFS_FS is not set
1153CONFIG_FS_POSIX_ACL=y
1154# CONFIG_XFS_FS is not set
1155# CONFIG_OCFS2_FS is not set
1156# CONFIG_MINIX_FS is not set
1157# CONFIG_ROMFS_FS is not set
1158CONFIG_INOTIFY=y
1159# CONFIG_QUOTA is not set
1160CONFIG_DNOTIFY=y
1161# CONFIG_AUTOFS_FS is not set
1162# CONFIG_AUTOFS4_FS is not set
1163# CONFIG_FUSE_FS is not set
1164
1855# 1165#
1856CONFIG_WATCHDOG=y 1166# CD-ROM/DVD Filesystems
1857# CONFIG_WATCHDOG_NOWAYOUT is not set 1167#
1168# CONFIG_ISO9660_FS is not set
1169# CONFIG_UDF_FS is not set
1858 1170
1859# 1171#
1860# Watchdog Device Drivers 1172# DOS/FAT/NT Filesystems
1861# 1173#
1862CONFIG_SOFT_WATCHDOG=m 1174# CONFIG_MSDOS_FS is not set
1863CONFIG_WATCHDOG_CP1XXX=m 1175# CONFIG_VFAT_FS is not set
1864CONFIG_WATCHDOG_RIO=m 1176# CONFIG_NTFS_FS is not set
1865 1177
1866# 1178#
1867# PCI-based Watchdog Cards 1179# Pseudo filesystems
1868# 1180#
1869CONFIG_PCIPCWATCHDOG=m 1181CONFIG_PROC_FS=y
1870CONFIG_WDTPCI=m 1182CONFIG_PROC_KCORE=y
1871CONFIG_WDT_501_PCI=y 1183CONFIG_SYSFS=y
1184CONFIG_TMPFS=y
1185CONFIG_HUGETLBFS=y
1186CONFIG_HUGETLB_PAGE=y
1187CONFIG_RAMFS=y
1188CONFIG_RELAYFS_FS=m
1189# CONFIG_CONFIGFS_FS is not set
1872 1190
1873# 1191#
1874# USB-based Watchdog Cards 1192# Miscellaneous filesystems
1875# 1193#
1876CONFIG_USBPCWATCHDOG=m 1194# CONFIG_ADFS_FS is not set
1195# CONFIG_AFFS_FS is not set
1196# CONFIG_HFS_FS is not set
1197# CONFIG_HFSPLUS_FS is not set
1198# CONFIG_BEFS_FS is not set
1199# CONFIG_BFS_FS is not set
1200# CONFIG_EFS_FS is not set
1201# CONFIG_CRAMFS is not set
1202# CONFIG_VXFS_FS is not set
1203# CONFIG_HPFS_FS is not set
1204# CONFIG_QNX4FS_FS is not set
1205# CONFIG_SYSV_FS is not set
1206# CONFIG_UFS_FS is not set
1877 1207
1878# 1208#
1879# Profiling support 1209# Network File Systems
1210#
1211# CONFIG_NFS_FS is not set
1212# CONFIG_NFSD is not set
1213# CONFIG_SMB_FS is not set
1214# CONFIG_CIFS is not set
1215# CONFIG_NCP_FS is not set
1216# CONFIG_CODA_FS is not set
1217# CONFIG_AFS_FS is not set
1218# CONFIG_9P_FS is not set
1219
1220#
1221# Partition Types
1222#
1223# CONFIG_PARTITION_ADVANCED is not set
1224CONFIG_MSDOS_PARTITION=y
1225CONFIG_SUN_PARTITION=y
1226
1227#
1228# Native Language Support
1229#
1230CONFIG_NLS=m
1231CONFIG_NLS_DEFAULT="iso8859-1"
1232# CONFIG_NLS_CODEPAGE_437 is not set
1233# CONFIG_NLS_CODEPAGE_737 is not set
1234# CONFIG_NLS_CODEPAGE_775 is not set
1235# CONFIG_NLS_CODEPAGE_850 is not set
1236# CONFIG_NLS_CODEPAGE_852 is not set
1237# CONFIG_NLS_CODEPAGE_855 is not set
1238# CONFIG_NLS_CODEPAGE_857 is not set
1239# CONFIG_NLS_CODEPAGE_860 is not set
1240# CONFIG_NLS_CODEPAGE_861 is not set
1241# CONFIG_NLS_CODEPAGE_862 is not set
1242# CONFIG_NLS_CODEPAGE_863 is not set
1243# CONFIG_NLS_CODEPAGE_864 is not set
1244# CONFIG_NLS_CODEPAGE_865 is not set
1245# CONFIG_NLS_CODEPAGE_866 is not set
1246# CONFIG_NLS_CODEPAGE_869 is not set
1247# CONFIG_NLS_CODEPAGE_936 is not set
1248# CONFIG_NLS_CODEPAGE_950 is not set
1249# CONFIG_NLS_CODEPAGE_932 is not set
1250# CONFIG_NLS_CODEPAGE_949 is not set
1251# CONFIG_NLS_CODEPAGE_874 is not set
1252# CONFIG_NLS_ISO8859_8 is not set
1253# CONFIG_NLS_CODEPAGE_1250 is not set
1254# CONFIG_NLS_CODEPAGE_1251 is not set
1255# CONFIG_NLS_ASCII is not set
1256# CONFIG_NLS_ISO8859_1 is not set
1257# CONFIG_NLS_ISO8859_2 is not set
1258# CONFIG_NLS_ISO8859_3 is not set
1259# CONFIG_NLS_ISO8859_4 is not set
1260# CONFIG_NLS_ISO8859_5 is not set
1261# CONFIG_NLS_ISO8859_6 is not set
1262# CONFIG_NLS_ISO8859_7 is not set
1263# CONFIG_NLS_ISO8859_9 is not set
1264# CONFIG_NLS_ISO8859_13 is not set
1265# CONFIG_NLS_ISO8859_14 is not set
1266# CONFIG_NLS_ISO8859_15 is not set
1267# CONFIG_NLS_KOI8_R is not set
1268# CONFIG_NLS_KOI8_U is not set
1269# CONFIG_NLS_UTF8 is not set
1270
1271#
1272# Instrumentation Support
1880# 1273#
1881CONFIG_PROFILING=y 1274CONFIG_PROFILING=y
1882CONFIG_OPROFILE=m 1275CONFIG_OPROFILE=m
1276CONFIG_KPROBES=y
1883 1277
1884# 1278#
1885# Kernel hacking 1279# Kernel hacking
1886# 1280#
1887CONFIG_DEBUG_KERNEL=y 1281CONFIG_PRINTK_TIME=y
1888CONFIG_MAGIC_SYSRQ=y 1282CONFIG_MAGIC_SYSRQ=y
1283CONFIG_DEBUG_KERNEL=y
1284CONFIG_LOG_BUF_SHIFT=18
1285CONFIG_DETECT_SOFTLOCKUP=y
1889CONFIG_SCHEDSTATS=y 1286CONFIG_SCHEDSTATS=y
1890# CONFIG_DEBUG_SLAB is not set 1287# CONFIG_DEBUG_SLAB is not set
1288# CONFIG_DEBUG_MUTEXES is not set
1891# CONFIG_DEBUG_SPINLOCK is not set 1289# CONFIG_DEBUG_SPINLOCK is not set
1892# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1290# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1893# CONFIG_DEBUG_KOBJECT is not set 1291# CONFIG_DEBUG_KOBJECT is not set
1894CONFIG_DEBUG_BUGVERBOSE=y 1292CONFIG_DEBUG_BUGVERBOSE=y
1895# CONFIG_DEBUG_INFO is not set 1293# CONFIG_DEBUG_INFO is not set
1896CONFIG_DEBUG_FS=y 1294CONFIG_DEBUG_FS=y
1295# CONFIG_DEBUG_VM is not set
1296CONFIG_FORCED_INLINING=y
1297# CONFIG_RCU_TORTURE_TEST is not set
1897# CONFIG_DEBUG_STACK_USAGE is not set 1298# CONFIG_DEBUG_STACK_USAGE is not set
1898CONFIG_KPROBES=y
1899# CONFIG_DEBUG_DCFLUSH is not set 1299# CONFIG_DEBUG_DCFLUSH is not set
1900# CONFIG_STACK_DEBUG is not set 1300# CONFIG_STACK_DEBUG is not set
1901# CONFIG_DEBUG_BOOTMEM is not set 1301# CONFIG_DEBUG_BOOTMEM is not set
1902CONFIG_HAVE_DEC_LOCK=y 1302# CONFIG_DEBUG_PAGEALLOC is not set
1903 1303
1904# 1304#
1905# Security options 1305# Security options
@@ -1945,6 +1345,7 @@ CONFIG_CRYPTO_TEST=m
1945# Library routines 1345# Library routines
1946# 1346#
1947CONFIG_CRC_CCITT=m 1347CONFIG_CRC_CCITT=m
1348CONFIG_CRC16=m
1948CONFIG_CRC32=y 1349CONFIG_CRC32=y
1949CONFIG_LIBCRC32C=m 1350CONFIG_LIBCRC32C=m
1950CONFIG_ZLIB_INFLATE=y 1351CONFIG_ZLIB_INFLATE=y
diff --git a/arch/sparc64/kernel/Makefile b/arch/sparc64/kernel/Makefile
index 6f00ab8b9d23..83d67eb18895 100644
--- a/arch/sparc64/kernel/Makefile
+++ b/arch/sparc64/kernel/Makefile
@@ -16,7 +16,7 @@ obj-y := process.o setup.o cpu.o idprom.o \
16obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o pci_iommu.o \ 16obj-$(CONFIG_PCI) += ebus.o isa.o pci_common.o pci_iommu.o \
17 pci_psycho.o pci_sabre.o pci_schizo.o 17 pci_psycho.o pci_sabre.o pci_schizo.o
18obj-$(CONFIG_SMP) += smp.o trampoline.o 18obj-$(CONFIG_SMP) += smp.o trampoline.o
19obj-$(CONFIG_SPARC32_COMPAT) += sys32.o sys_sparc32.o signal32.o ioctl32.o 19obj-$(CONFIG_SPARC32_COMPAT) += sys32.o sys_sparc32.o signal32.o
20obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o 20obj-$(CONFIG_BINFMT_ELF32) += binfmt_elf32.o
21obj-$(CONFIG_BINFMT_AOUT32) += binfmt_aout32.o 21obj-$(CONFIG_BINFMT_AOUT32) += binfmt_aout32.o
22obj-$(CONFIG_MODULES) += module.o 22obj-$(CONFIG_MODULES) += module.o
@@ -40,5 +40,3 @@ endif
40 40
41head.o: head.S ttable.S itlb_base.S dtlb_base.S dtlb_backend.S dtlb_prot.S \ 41head.o: head.S ttable.S itlb_base.S dtlb_base.S dtlb_backend.S dtlb_prot.S \
42 etrap.S rtrap.S winfixup.S entry.S 42 etrap.S rtrap.S winfixup.S entry.S
43
44CFLAGS_ioctl32.o += -Ifs/
diff --git a/arch/sparc64/kernel/binfmt_aout32.c b/arch/sparc64/kernel/binfmt_aout32.c
index edf52d06b280..202a80c24b6f 100644
--- a/arch/sparc64/kernel/binfmt_aout32.c
+++ b/arch/sparc64/kernel/binfmt_aout32.c
@@ -36,8 +36,6 @@ static int load_aout32_binary(struct linux_binprm *, struct pt_regs * regs);
36static int load_aout32_library(struct file*); 36static int load_aout32_library(struct file*);
37static int aout32_core_dump(long signr, struct pt_regs * regs, struct file *file); 37static int aout32_core_dump(long signr, struct pt_regs * regs, struct file *file);
38 38
39extern void dump_thread(struct pt_regs *, struct user *);
40
41static struct linux_binfmt aout32_format = { 39static struct linux_binfmt aout32_format = {
42 NULL, THIS_MODULE, load_aout32_binary, load_aout32_library, aout32_core_dump, 40 NULL, THIS_MODULE, load_aout32_binary, load_aout32_library, aout32_core_dump,
43 PAGE_SIZE 41 PAGE_SIZE
diff --git a/arch/sparc64/kernel/ebus.c b/arch/sparc64/kernel/ebus.c
index 6ffbeb701940..7991e919d8ab 100644
--- a/arch/sparc64/kernel/ebus.c
+++ b/arch/sparc64/kernel/ebus.c
@@ -527,18 +527,12 @@ static struct pci_dev *find_next_ebus(struct pci_dev *start, int *is_rio_p)
527{ 527{
528 struct pci_dev *pdev = start; 528 struct pci_dev *pdev = start;
529 529
530 do { 530 while ((pdev = pci_get_device(PCI_VENDOR_ID_SUN, PCI_ANY_ID, pdev)))
531 pdev = pci_find_device(PCI_VENDOR_ID_SUN, PCI_ANY_ID, pdev); 531 if (pdev->device == PCI_DEVICE_ID_SUN_EBUS ||
532 if (pdev && 532 pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS)
533 (pdev->device == PCI_DEVICE_ID_SUN_EBUS ||
534 pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS))
535 break; 533 break;
536 } while (pdev != NULL);
537 534
538 if (pdev && (pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS)) 535 *is_rio_p = !!(pdev && (pdev->device == PCI_DEVICE_ID_SUN_RIO_EBUS));
539 *is_rio_p = 1;
540 else
541 *is_rio_p = 0;
542 536
543 return pdev; 537 return pdev;
544} 538}
@@ -637,6 +631,7 @@ void __init ebus_init(void)
637 ebus->is_rio = is_rio; 631 ebus->is_rio = is_rio;
638 ++num_ebus; 632 ++num_ebus;
639 } 633 }
634 pci_dev_put(pdev); /* XXX for the case, when ebusnd is 0, is it OK? */
640 635
641#ifdef CONFIG_SUN_AUXIO 636#ifdef CONFIG_SUN_AUXIO
642 auxio_probe(); 637 auxio_probe();
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index 11a848402fb1..e50e56e4ab61 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -1416,7 +1416,6 @@ execve_merge:
1416 add %sp, PTREGS_OFF, %o0 1416 add %sp, PTREGS_OFF, %o0
1417 1417
1418 .globl sys_pipe, sys_sigpause, sys_nis_syscall 1418 .globl sys_pipe, sys_sigpause, sys_nis_syscall
1419 .globl sys_sigsuspend, sys_rt_sigsuspend
1420 .globl sys_rt_sigreturn 1419 .globl sys_rt_sigreturn
1421 .globl sys_ptrace 1420 .globl sys_ptrace
1422 .globl sys_sigaltstack 1421 .globl sys_sigaltstack
@@ -1440,28 +1439,6 @@ sys32_sigaltstack:
1440 mov %i6, %o2 1439 mov %i6, %o2
1441#endif 1440#endif
1442 .align 32 1441 .align 32
1443sys_sigsuspend: add %sp, PTREGS_OFF, %o0
1444 call do_sigsuspend
1445 add %o7, 1f-.-4, %o7
1446 nop
1447sys_rt_sigsuspend: /* NOTE: %o0,%o1 have a correct value already */
1448 add %sp, PTREGS_OFF, %o2
1449 call do_rt_sigsuspend
1450 add %o7, 1f-.-4, %o7
1451 nop
1452#ifdef CONFIG_COMPAT
1453 .globl sys32_rt_sigsuspend
1454sys32_rt_sigsuspend: /* NOTE: %o0,%o1 have a correct value already */
1455 srl %o0, 0, %o0
1456 add %sp, PTREGS_OFF, %o2
1457 call do_rt_sigsuspend32
1458 add %o7, 1f-.-4, %o7
1459#endif
1460 /* NOTE: %o0 has a correct value already */
1461sys_sigpause: add %sp, PTREGS_OFF, %o1
1462 call do_sigpause
1463 add %o7, 1f-.-4, %o7
1464 nop
1465#ifdef CONFIG_COMPAT 1442#ifdef CONFIG_COMPAT
1466 .globl sys32_sigreturn 1443 .globl sys32_sigreturn
1467sys32_sigreturn: 1444sys32_sigreturn:
@@ -1657,13 +1634,10 @@ ret_sys_call:
1657 /* Check if force_successful_syscall_return() 1634 /* Check if force_successful_syscall_return()
1658 * was invoked. 1635 * was invoked.
1659 */ 1636 */
1660 ldub [%curptr + TI_SYS_NOERROR], %l0 1637 ldub [%curptr + TI_SYS_NOERROR], %l2
1661 brz,pt %l0, 1f 1638 brnz,a,pn %l2, 80f
1662 nop
1663 ba,pt %xcc, 80f
1664 stb %g0, [%curptr + TI_SYS_NOERROR] 1639 stb %g0, [%curptr + TI_SYS_NOERROR]
1665 1640
16661:
1667 cmp %o0, -ERESTART_RESTARTBLOCK 1641 cmp %o0, -ERESTART_RESTARTBLOCK
1668 bgeu,pn %xcc, 1f 1642 bgeu,pn %xcc, 1f
1669 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6 1643 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
deleted file mode 100644
index 196b208665a2..000000000000
--- a/arch/sparc64/kernel/ioctl32.c
+++ /dev/null
@@ -1,39 +0,0 @@
1/* $Id: ioctl32.c,v 1.136 2002/01/14 09:49:52 davem Exp $
2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
3 *
4 * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com)
5 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
6 * Copyright (C) 2003 Pavel Machek (pavel@suse.cz)
7 *
8 * These routines maintain argument size conversion between 32bit and 64bit
9 * ioctls.
10 */
11
12#define INCLUDES
13#include "compat_ioctl.c"
14#include <linux/syscalls.h>
15
16#define CODE
17#include "compat_ioctl.c"
18
19#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL((cmd),sys_ioctl)
20#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler), NULL },
21#define IOCTL_TABLE_START \
22 struct ioctl_trans ioctl_start[] = {
23#define IOCTL_TABLE_END \
24 };
25
26IOCTL_TABLE_START
27#include <linux/compat_ioctl.h>
28#define DECLARES
29#include "compat_ioctl.c"
30#if 0
31HANDLE_IOCTL(RTC32_IRQP_READ, do_rtc_ioctl)
32HANDLE_IOCTL(RTC32_IRQP_SET, do_rtc_ioctl)
33HANDLE_IOCTL(RTC32_EPOCH_READ, do_rtc_ioctl)
34HANDLE_IOCTL(RTC32_EPOCH_SET, do_rtc_ioctl)
35#endif
36/* take care of sizeof(sizeof()) breakage */
37IOCTL_TABLE_END
38
39int ioctl_table_size = ARRAY_SIZE(ioctl_start);
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c
index 96bd09b098f4..b9a9ce70e55c 100644
--- a/arch/sparc64/kernel/kprobes.c
+++ b/arch/sparc64/kernel/kprobes.c
@@ -43,14 +43,10 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
43 43
44int __kprobes arch_prepare_kprobe(struct kprobe *p) 44int __kprobes arch_prepare_kprobe(struct kprobe *p)
45{ 45{
46 return 0;
47}
48
49void __kprobes arch_copy_kprobe(struct kprobe *p)
50{
51 p->ainsn.insn[0] = *p->addr; 46 p->ainsn.insn[0] = *p->addr;
52 p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2; 47 p->ainsn.insn[1] = BREAKPOINT_INSTRUCTION_2;
53 p->opcode = *p->addr; 48 p->opcode = *p->addr;
49 return 0;
54} 50}
55 51
56void __kprobes arch_arm_kprobe(struct kprobe *p) 52void __kprobes arch_arm_kprobe(struct kprobe *p)
@@ -65,10 +61,6 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
65 flushi(p->addr); 61 flushi(p->addr);
66} 62}
67 63
68void __kprobes arch_remove_kprobe(struct kprobe *p)
69{
70}
71
72static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb) 64static inline void save_previous_kprobe(struct kprobe_ctlblk *kcb)
73{ 65{
74 kcb->prev_kprobe.kp = kprobe_running(); 66 kcb->prev_kprobe.kp = kprobe_running();
@@ -138,11 +130,19 @@ static int __kprobes kprobe_handler(struct pt_regs *regs)
138 */ 130 */
139 save_previous_kprobe(kcb); 131 save_previous_kprobe(kcb);
140 set_current_kprobe(p, regs, kcb); 132 set_current_kprobe(p, regs, kcb);
141 p->nmissed++; 133 kprobes_inc_nmissed_count(p);
142 kcb->kprobe_status = KPROBE_REENTER; 134 kcb->kprobe_status = KPROBE_REENTER;
143 prepare_singlestep(p, regs, kcb); 135 prepare_singlestep(p, regs, kcb);
144 return 1; 136 return 1;
145 } else { 137 } else {
138 if (*(u32 *)addr != BREAKPOINT_INSTRUCTION) {
139 /* The breakpoint instruction was removed by
140 * another cpu right after we hit, no further
141 * handling of this interrupt is appropriate
142 */
143 ret = 1;
144 goto no_kprobe;
145 }
146 p = __get_cpu_var(current_kprobe); 146 p = __get_cpu_var(current_kprobe);
147 if (p->break_handler && p->break_handler(p, regs)) 147 if (p->break_handler && p->break_handler(p, regs))
148 goto ss_probe; 148 goto ss_probe;
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
index 9e8362ea3104..30bcaf58e3ab 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc64/kernel/power.c
@@ -14,6 +14,7 @@
14#include <linux/signal.h> 14#include <linux/signal.h>
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/pm.h>
17 18
18#include <asm/system.h> 19#include <asm/system.h>
19#include <asm/ebus.h> 20#include <asm/ebus.h>
@@ -70,6 +71,9 @@ void machine_power_off(void)
70 machine_halt(); 71 machine_halt();
71} 72}
72 73
74void (*pm_power_off)(void) = machine_power_off;
75EXPORT_SYMBOL(pm_power_off);
76
73#ifdef CONFIG_PCI 77#ifdef CONFIG_PCI
74static int powerd(void *__unused) 78static int powerd(void *__unused)
75{ 79{
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index 02f9dec1d459..059b0d025224 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -164,6 +164,7 @@ void machine_restart(char * cmd)
164 panic("Reboot failed!"); 164 panic("Reboot failed!");
165} 165}
166 166
167#ifdef CONFIG_COMPAT
167static void show_regwindow32(struct pt_regs *regs) 168static void show_regwindow32(struct pt_regs *regs)
168{ 169{
169 struct reg_window32 __user *rw; 170 struct reg_window32 __user *rw;
@@ -189,6 +190,9 @@ static void show_regwindow32(struct pt_regs *regs)
189 r_w.ins[0], r_w.ins[1], r_w.ins[2], r_w.ins[3], 190 r_w.ins[0], r_w.ins[1], r_w.ins[2], r_w.ins[3],
190 r_w.ins[4], r_w.ins[5], r_w.ins[6], r_w.ins[7]); 191 r_w.ins[4], r_w.ins[5], r_w.ins[6], r_w.ins[7]);
191} 192}
193#else
194#define show_regwindow32(regs) do { } while (0)
195#endif
192 196
193static void show_regwindow(struct pt_regs *regs) 197static void show_regwindow(struct pt_regs *regs)
194{ 198{
@@ -390,7 +394,7 @@ void show_regs32(struct pt_regs32 *regs)
390 394
391unsigned long thread_saved_pc(struct task_struct *tsk) 395unsigned long thread_saved_pc(struct task_struct *tsk)
392{ 396{
393 struct thread_info *ti = tsk->thread_info; 397 struct thread_info *ti = task_thread_info(tsk);
394 unsigned long ret = 0xdeadbeefUL; 398 unsigned long ret = 0xdeadbeefUL;
395 399
396 if (ti && ti->ksp) { 400 if (ti && ti->ksp) {
@@ -616,11 +620,11 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
616 unsigned long unused, 620 unsigned long unused,
617 struct task_struct *p, struct pt_regs *regs) 621 struct task_struct *p, struct pt_regs *regs)
618{ 622{
619 struct thread_info *t = p->thread_info; 623 struct thread_info *t = task_thread_info(p);
620 char *child_trap_frame; 624 char *child_trap_frame;
621 625
622 /* Calculate offset to stack_frame & pt_regs */ 626 /* Calculate offset to stack_frame & pt_regs */
623 child_trap_frame = ((char *)t) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ)); 627 child_trap_frame = task_stack_page(p) + (THREAD_SIZE - (TRACEREG_SZ+STACKFRAME_SZ));
624 memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ)); 628 memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ));
625 629
626 t->flags = (t->flags & ~((0xffUL << TI_FLAG_CWP_SHIFT) | (0xffUL << TI_FLAG_CURRENT_DS_SHIFT))) | 630 t->flags = (t->flags & ~((0xffUL << TI_FLAG_CWP_SHIFT) | (0xffUL << TI_FLAG_CURRENT_DS_SHIFT))) |
@@ -845,9 +849,9 @@ unsigned long get_wchan(struct task_struct *task)
845 task->state == TASK_RUNNING) 849 task->state == TASK_RUNNING)
846 goto out; 850 goto out;
847 851
848 thread_info_base = (unsigned long) task->thread_info; 852 thread_info_base = (unsigned long) task_stack_page(task);
849 bias = STACK_BIAS; 853 bias = STACK_BIAS;
850 fp = task->thread_info->ksp + bias; 854 fp = task_thread_info(task)->ksp + bias;
851 855
852 do { 856 do {
853 /* Bogus frame pointer? */ 857 /* Bogus frame pointer? */
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index 774ecbb8a031..3f9746f856d2 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -198,39 +198,15 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
198 } 198 }
199#endif 199#endif
200 if (request == PTRACE_TRACEME) { 200 if (request == PTRACE_TRACEME) {
201 int ret; 201 ret = ptrace_traceme();
202
203 /* are we already being traced? */
204 if (current->ptrace & PT_PTRACED) {
205 pt_error_return(regs, EPERM);
206 goto out;
207 }
208 ret = security_ptrace(current->parent, current);
209 if (ret) {
210 pt_error_return(regs, -ret);
211 goto out;
212 }
213
214 /* set the ptrace bit in the process flags. */
215 current->ptrace |= PT_PTRACED;
216 pt_succ_return(regs, 0); 202 pt_succ_return(regs, 0);
217 goto out; 203 goto out;
218 } 204 }
219#ifndef ALLOW_INIT_TRACING
220 if (pid == 1) {
221 /* Can't dork with init. */
222 pt_error_return(regs, EPERM);
223 goto out;
224 }
225#endif
226 read_lock(&tasklist_lock);
227 child = find_task_by_pid(pid);
228 if (child)
229 get_task_struct(child);
230 read_unlock(&tasklist_lock);
231 205
232 if (!child) { 206 child = ptrace_get_task_struct(pid);
233 pt_error_return(regs, ESRCH); 207 if (IS_ERR(child)) {
208 ret = PTR_ERR(child);
209 pt_error_return(regs, -ret);
234 goto out; 210 goto out;
235 } 211 }
236 212
@@ -320,7 +296,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
320 case PTRACE_GETREGS: { 296 case PTRACE_GETREGS: {
321 struct pt_regs32 __user *pregs = 297 struct pt_regs32 __user *pregs =
322 (struct pt_regs32 __user *) addr; 298 (struct pt_regs32 __user *) addr;
323 struct pt_regs *cregs = child->thread_info->kregs; 299 struct pt_regs *cregs = task_pt_regs(child);
324 int rval; 300 int rval;
325 301
326 if (__put_user(tstate_to_psr(cregs->tstate), (&pregs->psr)) || 302 if (__put_user(tstate_to_psr(cregs->tstate), (&pregs->psr)) ||
@@ -344,11 +320,11 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
344 320
345 case PTRACE_GETREGS64: { 321 case PTRACE_GETREGS64: {
346 struct pt_regs __user *pregs = (struct pt_regs __user *) addr; 322 struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
347 struct pt_regs *cregs = child->thread_info->kregs; 323 struct pt_regs *cregs = task_pt_regs(child);
348 unsigned long tpc = cregs->tpc; 324 unsigned long tpc = cregs->tpc;
349 int rval; 325 int rval;
350 326
351 if ((child->thread_info->flags & _TIF_32BIT) != 0) 327 if ((task_thread_info(child)->flags & _TIF_32BIT) != 0)
352 tpc &= 0xffffffff; 328 tpc &= 0xffffffff;
353 if (__put_user(cregs->tstate, (&pregs->tstate)) || 329 if (__put_user(cregs->tstate, (&pregs->tstate)) ||
354 __put_user(tpc, (&pregs->tpc)) || 330 __put_user(tpc, (&pregs->tpc)) ||
@@ -372,7 +348,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
372 case PTRACE_SETREGS: { 348 case PTRACE_SETREGS: {
373 struct pt_regs32 __user *pregs = 349 struct pt_regs32 __user *pregs =
374 (struct pt_regs32 __user *) addr; 350 (struct pt_regs32 __user *) addr;
375 struct pt_regs *cregs = child->thread_info->kregs; 351 struct pt_regs *cregs = task_pt_regs(child);
376 unsigned int psr, pc, npc, y; 352 unsigned int psr, pc, npc, y;
377 int i; 353 int i;
378 354
@@ -405,7 +381,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
405 381
406 case PTRACE_SETREGS64: { 382 case PTRACE_SETREGS64: {
407 struct pt_regs __user *pregs = (struct pt_regs __user *) addr; 383 struct pt_regs __user *pregs = (struct pt_regs __user *) addr;
408 struct pt_regs *cregs = child->thread_info->kregs; 384 struct pt_regs *cregs = task_pt_regs(child);
409 unsigned long tstate, tpc, tnpc, y; 385 unsigned long tstate, tpc, tnpc, y;
410 int i; 386 int i;
411 387
@@ -419,7 +395,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
419 pt_error_return(regs, EFAULT); 395 pt_error_return(regs, EFAULT);
420 goto out_tsk; 396 goto out_tsk;
421 } 397 }
422 if ((child->thread_info->flags & _TIF_32BIT) != 0) { 398 if ((task_thread_info(child)->flags & _TIF_32BIT) != 0) {
423 tpc &= 0xffffffff; 399 tpc &= 0xffffffff;
424 tnpc &= 0xffffffff; 400 tnpc &= 0xffffffff;
425 } 401 }
@@ -454,11 +430,11 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
454 } fpq[16]; 430 } fpq[16];
455 }; 431 };
456 struct fps __user *fps = (struct fps __user *) addr; 432 struct fps __user *fps = (struct fps __user *) addr;
457 unsigned long *fpregs = child->thread_info->fpregs; 433 unsigned long *fpregs = task_thread_info(child)->fpregs;
458 434
459 if (copy_to_user(&fps->regs[0], fpregs, 435 if (copy_to_user(&fps->regs[0], fpregs,
460 (32 * sizeof(unsigned int))) || 436 (32 * sizeof(unsigned int))) ||
461 __put_user(child->thread_info->xfsr[0], (&fps->fsr)) || 437 __put_user(task_thread_info(child)->xfsr[0], (&fps->fsr)) ||
462 __put_user(0, (&fps->fpqd)) || 438 __put_user(0, (&fps->fpqd)) ||
463 __put_user(0, (&fps->flags)) || 439 __put_user(0, (&fps->flags)) ||
464 __put_user(0, (&fps->extra)) || 440 __put_user(0, (&fps->extra)) ||
@@ -476,11 +452,11 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
476 unsigned long fsr; 452 unsigned long fsr;
477 }; 453 };
478 struct fps __user *fps = (struct fps __user *) addr; 454 struct fps __user *fps = (struct fps __user *) addr;
479 unsigned long *fpregs = child->thread_info->fpregs; 455 unsigned long *fpregs = task_thread_info(child)->fpregs;
480 456
481 if (copy_to_user(&fps->regs[0], fpregs, 457 if (copy_to_user(&fps->regs[0], fpregs,
482 (64 * sizeof(unsigned int))) || 458 (64 * sizeof(unsigned int))) ||
483 __put_user(child->thread_info->xfsr[0], (&fps->fsr))) { 459 __put_user(task_thread_info(child)->xfsr[0], (&fps->fsr))) {
484 pt_error_return(regs, EFAULT); 460 pt_error_return(regs, EFAULT);
485 goto out_tsk; 461 goto out_tsk;
486 } 462 }
@@ -501,7 +477,7 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
501 } fpq[16]; 477 } fpq[16];
502 }; 478 };
503 struct fps __user *fps = (struct fps __user *) addr; 479 struct fps __user *fps = (struct fps __user *) addr;
504 unsigned long *fpregs = child->thread_info->fpregs; 480 unsigned long *fpregs = task_thread_info(child)->fpregs;
505 unsigned fsr; 481 unsigned fsr;
506 482
507 if (copy_from_user(fpregs, &fps->regs[0], 483 if (copy_from_user(fpregs, &fps->regs[0],
@@ -510,11 +486,11 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
510 pt_error_return(regs, EFAULT); 486 pt_error_return(regs, EFAULT);
511 goto out_tsk; 487 goto out_tsk;
512 } 488 }
513 child->thread_info->xfsr[0] &= 0xffffffff00000000UL; 489 task_thread_info(child)->xfsr[0] &= 0xffffffff00000000UL;
514 child->thread_info->xfsr[0] |= fsr; 490 task_thread_info(child)->xfsr[0] |= fsr;
515 if (!(child->thread_info->fpsaved[0] & FPRS_FEF)) 491 if (!(task_thread_info(child)->fpsaved[0] & FPRS_FEF))
516 child->thread_info->gsr[0] = 0; 492 task_thread_info(child)->gsr[0] = 0;
517 child->thread_info->fpsaved[0] |= (FPRS_FEF | FPRS_DL); 493 task_thread_info(child)->fpsaved[0] |= (FPRS_FEF | FPRS_DL);
518 pt_succ_return(regs, 0); 494 pt_succ_return(regs, 0);
519 goto out_tsk; 495 goto out_tsk;
520 } 496 }
@@ -525,17 +501,17 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
525 unsigned long fsr; 501 unsigned long fsr;
526 }; 502 };
527 struct fps __user *fps = (struct fps __user *) addr; 503 struct fps __user *fps = (struct fps __user *) addr;
528 unsigned long *fpregs = child->thread_info->fpregs; 504 unsigned long *fpregs = task_thread_info(child)->fpregs;
529 505
530 if (copy_from_user(fpregs, &fps->regs[0], 506 if (copy_from_user(fpregs, &fps->regs[0],
531 (64 * sizeof(unsigned int))) || 507 (64 * sizeof(unsigned int))) ||
532 __get_user(child->thread_info->xfsr[0], (&fps->fsr))) { 508 __get_user(task_thread_info(child)->xfsr[0], (&fps->fsr))) {
533 pt_error_return(regs, EFAULT); 509 pt_error_return(regs, EFAULT);
534 goto out_tsk; 510 goto out_tsk;
535 } 511 }
536 if (!(child->thread_info->fpsaved[0] & FPRS_FEF)) 512 if (!(task_thread_info(child)->fpsaved[0] & FPRS_FEF))
537 child->thread_info->gsr[0] = 0; 513 task_thread_info(child)->gsr[0] = 0;
538 child->thread_info->fpsaved[0] |= (FPRS_FEF | FPRS_DL | FPRS_DU); 514 task_thread_info(child)->fpsaved[0] |= (FPRS_FEF | FPRS_DL | FPRS_DU);
539 pt_succ_return(regs, 0); 515 pt_succ_return(regs, 0);
540 goto out_tsk; 516 goto out_tsk;
541 } 517 }
@@ -586,8 +562,8 @@ asmlinkage void do_ptrace(struct pt_regs *regs)
586#ifdef DEBUG_PTRACE 562#ifdef DEBUG_PTRACE
587 printk("CONT: %s [%d]: set exit_code = %x %lx %lx\n", child->comm, 563 printk("CONT: %s [%d]: set exit_code = %x %lx %lx\n", child->comm,
588 child->pid, child->exit_code, 564 child->pid, child->exit_code,
589 child->thread_info->kregs->tpc, 565 task_pt_regs(child)->tpc,
590 child->thread_info->kregs->tnpc); 566 task_pt_regs(child)->tnpc);
591 567
592#endif 568#endif
593 wake_up_process(child); 569 wake_up_process(child);
diff --git a/arch/sparc64/kernel/rtrap.S b/arch/sparc64/kernel/rtrap.S
index 090dcca00d2a..b80eba0081ca 100644
--- a/arch/sparc64/kernel/rtrap.S
+++ b/arch/sparc64/kernel/rtrap.S
@@ -53,14 +53,13 @@ __handle_user_windows:
53 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 53 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
54 ldx [%g6 + TI_FLAGS], %l0 54 ldx [%g6 + TI_FLAGS], %l0
55 55
561: andcc %l0, (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING), %g0 561: andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0
57 be,pt %xcc, __handle_user_windows_continue 57 be,pt %xcc, __handle_user_windows_continue
58 nop 58 nop
59 clr %o0 59 mov %l5, %o1
60 mov %l5, %o2 60 mov %l6, %o2
61 mov %l6, %o3 61 add %sp, PTREGS_OFF, %o0
62 add %sp, PTREGS_OFF, %o1 62 mov %l0, %o3
63 mov %l0, %o4
64 63
65 call do_notify_resume 64 call do_notify_resume
66 wrpr %g0, RTRAP_PSTATE, %pstate 65 wrpr %g0, RTRAP_PSTATE, %pstate
@@ -96,15 +95,14 @@ __handle_perfctrs:
96 wrpr %g0, RTRAP_PSTATE, %pstate 95 wrpr %g0, RTRAP_PSTATE, %pstate
97 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 96 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
98 ldx [%g6 + TI_FLAGS], %l0 97 ldx [%g6 + TI_FLAGS], %l0
991: andcc %l0, (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING), %g0 981: andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0
100 99
101 be,pt %xcc, __handle_perfctrs_continue 100 be,pt %xcc, __handle_perfctrs_continue
102 sethi %hi(TSTATE_PEF), %o0 101 sethi %hi(TSTATE_PEF), %o0
103 clr %o0 102 mov %l5, %o1
104 mov %l5, %o2 103 mov %l6, %o2
105 mov %l6, %o3 104 add %sp, PTREGS_OFF, %o0
106 add %sp, PTREGS_OFF, %o1 105 mov %l0, %o3
107 mov %l0, %o4
108 call do_notify_resume 106 call do_notify_resume
109 107
110 wrpr %g0, RTRAP_PSTATE, %pstate 108 wrpr %g0, RTRAP_PSTATE, %pstate
@@ -129,11 +127,10 @@ __handle_userfpu:
129 ba,a,pt %xcc, __handle_userfpu_continue 127 ba,a,pt %xcc, __handle_userfpu_continue
130 128
131__handle_signal: 129__handle_signal:
132 clr %o0 130 mov %l5, %o1
133 mov %l5, %o2 131 mov %l6, %o2
134 mov %l6, %o3 132 add %sp, PTREGS_OFF, %o0
135 add %sp, PTREGS_OFF, %o1 133 mov %l0, %o3
136 mov %l0, %o4
137 call do_notify_resume 134 call do_notify_resume
138 wrpr %g0, RTRAP_PSTATE, %pstate 135 wrpr %g0, RTRAP_PSTATE, %pstate
139 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate 136 wrpr %g0, RTRAP_PSTATE_IRQOFF, %pstate
@@ -200,7 +197,7 @@ __handle_preemption_continue:
200 andcc %l1, %o0, %g0 197 andcc %l1, %o0, %g0
201 andcc %l0, _TIF_NEED_RESCHED, %g0 198 andcc %l0, _TIF_NEED_RESCHED, %g0
202 bne,pn %xcc, __handle_preemption 199 bne,pn %xcc, __handle_preemption
203 andcc %l0, (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING), %g0 200 andcc %l0, (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK), %g0
204 bne,pn %xcc, __handle_signal 201 bne,pn %xcc, __handle_signal
205__handle_signal_continue: 202__handle_signal_continue:
206 ldub [%g6 + TI_WSAVED], %o2 203 ldub [%g6 + TI_WSAVED], %o2
diff --git a/arch/sparc64/kernel/setup.c b/arch/sparc64/kernel/setup.c
index 48180531562f..054461e6946d 100644
--- a/arch/sparc64/kernel/setup.c
+++ b/arch/sparc64/kernel/setup.c
@@ -520,7 +520,7 @@ void __init setup_arch(char **cmdline_p)
520 rd_doload = ((ram_flags & RAMDISK_LOAD_FLAG) != 0); 520 rd_doload = ((ram_flags & RAMDISK_LOAD_FLAG) != 0);
521#endif 521#endif
522 522
523 init_task.thread_info->kregs = &fake_swapper_regs; 523 task_thread_info(&init_task)->kregs = &fake_swapper_regs;
524 524
525#ifdef CONFIG_IP_PNP 525#ifdef CONFIG_IP_PNP
526 if (!ic_set_manually) { 526 if (!ic_set_manually) {
@@ -561,6 +561,8 @@ static int __init set_preferred_console(void)
561 serial_console = 1; 561 serial_console = 1;
562 } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) { 562 } else if (idev == PROMDEV_ITTYB && odev == PROMDEV_OTTYB) {
563 serial_console = 2; 563 serial_console = 2;
564 } else if (idev == PROMDEV_IRSC && odev == PROMDEV_ORSC) {
565 serial_console = 3;
564 } else { 566 } else {
565 prom_printf("Inconsistent console: " 567 prom_printf("Inconsistent console: "
566 "input %d, output %d\n", 568 "input %d, output %d\n",
diff --git a/arch/sparc64/kernel/signal.c b/arch/sparc64/kernel/signal.c
index 60f5dfabb1e1..ca11a4c457d4 100644
--- a/arch/sparc64/kernel/signal.c
+++ b/arch/sparc64/kernel/signal.c
@@ -36,9 +36,6 @@
36 36
37#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 37#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
38 38
39static int do_signal(sigset_t *oldset, struct pt_regs * regs,
40 unsigned long orig_o0, int ret_from_syscall);
41
42/* {set, get}context() needed for 64-bit SparcLinux userland. */ 39/* {set, get}context() needed for 64-bit SparcLinux userland. */
43asmlinkage void sparc64_set_context(struct pt_regs *regs) 40asmlinkage void sparc64_set_context(struct pt_regs *regs)
44{ 41{
@@ -242,114 +239,29 @@ struct rt_signal_frame {
242/* Align macros */ 239/* Align macros */
243#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame) + 7) & (~7))) 240#define RT_ALIGNEDSZ (((sizeof(struct rt_signal_frame) + 7) & (~7)))
244 241
245/* 242static long _sigpause_common(old_sigset_t set)
246 * atomically swap in the new signal mask, and wait for a signal.
247 * This is really tricky on the Sparc, watch out...
248 */
249asmlinkage void _sigpause_common(old_sigset_t set, struct pt_regs *regs)
250{ 243{
251 sigset_t saveset;
252
253#ifdef CONFIG_SPARC32_COMPAT
254 if (test_thread_flag(TIF_32BIT)) {
255 extern asmlinkage void _sigpause32_common(compat_old_sigset_t,
256 struct pt_regs *);
257 _sigpause32_common(set, regs);
258 return;
259 }
260#endif
261 set &= _BLOCKABLE; 244 set &= _BLOCKABLE;
262 spin_lock_irq(&current->sighand->siglock); 245 spin_lock_irq(&current->sighand->siglock);
263 saveset = current->blocked; 246 current->saved_sigmask = current->blocked;
264 siginitset(&current->blocked, set); 247 siginitset(&current->blocked, set);
265 recalc_sigpending(); 248 recalc_sigpending();
266 spin_unlock_irq(&current->sighand->siglock); 249 spin_unlock_irq(&current->sighand->siglock);
267
268 if (test_thread_flag(TIF_32BIT)) {
269 regs->tpc = (regs->tnpc & 0xffffffff);
270 regs->tnpc = (regs->tnpc + 4) & 0xffffffff;
271 } else {
272 regs->tpc = regs->tnpc;
273 regs->tnpc += 4;
274 }
275 250
276 /* Condition codes and return value where set here for sigpause, 251 current->state = TASK_INTERRUPTIBLE;
277 * and so got used by setup_frame, which again causes sigreturn() 252 schedule();
278 * to return -EINTR. 253 set_thread_flag(TIF_RESTORE_SIGMASK);
279 */ 254 return -ERESTARTNOHAND;
280 while (1) {
281 current->state = TASK_INTERRUPTIBLE;
282 schedule();
283 /*
284 * Return -EINTR and set condition code here,
285 * so the interrupted system call actually returns
286 * these.
287 */
288 regs->tstate |= (TSTATE_ICARRY|TSTATE_XCARRY);
289 regs->u_regs[UREG_I0] = EINTR;
290 if (do_signal(&saveset, regs, 0, 0))
291 return;
292 }
293} 255}
294 256
295asmlinkage void do_sigpause(unsigned int set, struct pt_regs *regs) 257asmlinkage long sys_sigpause(unsigned int set)
296{ 258{
297 _sigpause_common(set, regs); 259 return _sigpause_common(set);
298} 260}
299 261
300asmlinkage void do_sigsuspend(struct pt_regs *regs) 262asmlinkage long sys_sigsuspend(old_sigset_t set)
301{ 263{
302 _sigpause_common(regs->u_regs[UREG_I0], regs); 264 return _sigpause_common(set);
303}
304
305asmlinkage void do_rt_sigsuspend(sigset_t __user *uset, size_t sigsetsize, struct pt_regs *regs)
306{
307 sigset_t oldset, set;
308
309 /* XXX: Don't preclude handling different sized sigset_t's. */
310 if (sigsetsize != sizeof(sigset_t)) {
311 regs->tstate |= (TSTATE_ICARRY|TSTATE_XCARRY);
312 regs->u_regs[UREG_I0] = EINVAL;
313 return;
314 }
315 if (copy_from_user(&set, uset, sizeof(set))) {
316 regs->tstate |= (TSTATE_ICARRY|TSTATE_XCARRY);
317 regs->u_regs[UREG_I0] = EFAULT;
318 return;
319 }
320
321 sigdelsetmask(&set, ~_BLOCKABLE);
322 spin_lock_irq(&current->sighand->siglock);
323 oldset = current->blocked;
324 current->blocked = set;
325 recalc_sigpending();
326 spin_unlock_irq(&current->sighand->siglock);
327
328 if (test_thread_flag(TIF_32BIT)) {
329 regs->tpc = (regs->tnpc & 0xffffffff);
330 regs->tnpc = (regs->tnpc + 4) & 0xffffffff;
331 } else {
332 regs->tpc = regs->tnpc;
333 regs->tnpc += 4;
334 }
335
336 /* Condition codes and return value where set here for sigpause,
337 * and so got used by setup_frame, which again causes sigreturn()
338 * to return -EINTR.
339 */
340 while (1) {
341 current->state = TASK_INTERRUPTIBLE;
342 schedule();
343 /*
344 * Return -EINTR and set condition code here,
345 * so the interrupted system call actually returns
346 * these.
347 */
348 regs->tstate |= (TSTATE_ICARRY|TSTATE_XCARRY);
349 regs->u_regs[UREG_I0] = EINTR;
350 if (do_signal(&oldset, regs, 0, 0))
351 return;
352 }
353} 265}
354 266
355static inline int 267static inline int
@@ -607,26 +519,29 @@ static inline void syscall_restart(unsigned long orig_i0, struct pt_regs *regs,
607 * want to handle. Thus you cannot kill init even with a SIGKILL even by 519 * want to handle. Thus you cannot kill init even with a SIGKILL even by
608 * mistake. 520 * mistake.
609 */ 521 */
610static int do_signal(sigset_t *oldset, struct pt_regs * regs, 522static void do_signal(struct pt_regs *regs, unsigned long orig_i0, int restart_syscall)
611 unsigned long orig_i0, int restart_syscall)
612{ 523{
613 siginfo_t info; 524 siginfo_t info;
614 struct signal_deliver_cookie cookie; 525 struct signal_deliver_cookie cookie;
615 struct k_sigaction ka; 526 struct k_sigaction ka;
616 int signr; 527 int signr;
528 sigset_t *oldset;
617 529
618 cookie.restart_syscall = restart_syscall; 530 cookie.restart_syscall = restart_syscall;
619 cookie.orig_i0 = orig_i0; 531 cookie.orig_i0 = orig_i0;
620 532
621 if (!oldset) 533 if (test_thread_flag(TIF_RESTORE_SIGMASK))
534 oldset = &current->saved_sigmask;
535 else
622 oldset = &current->blocked; 536 oldset = &current->blocked;
623 537
624#ifdef CONFIG_SPARC32_COMPAT 538#ifdef CONFIG_SPARC32_COMPAT
625 if (test_thread_flag(TIF_32BIT)) { 539 if (test_thread_flag(TIF_32BIT)) {
626 extern int do_signal32(sigset_t *, struct pt_regs *, 540 extern void do_signal32(sigset_t *, struct pt_regs *,
627 unsigned long, int); 541 unsigned long, int);
628 return do_signal32(oldset, regs, orig_i0, 542 do_signal32(oldset, regs, orig_i0,
629 cookie.restart_syscall); 543 cookie.restart_syscall);
544 return;
630 } 545 }
631#endif 546#endif
632 547
@@ -635,7 +550,15 @@ static int do_signal(sigset_t *oldset, struct pt_regs * regs,
635 if (cookie.restart_syscall) 550 if (cookie.restart_syscall)
636 syscall_restart(orig_i0, regs, &ka.sa); 551 syscall_restart(orig_i0, regs, &ka.sa);
637 handle_signal(signr, &ka, &info, oldset, regs); 552 handle_signal(signr, &ka, &info, oldset, regs);
638 return 1; 553
554 /* a signal was successfully delivered; the saved
555 * sigmask will have been stored in the signal frame,
556 * and will be restored by sigreturn, so we can simply
557 * clear the TIF_RESTORE_SIGMASK flag.
558 */
559 if (test_thread_flag(TIF_RESTORE_SIGMASK))
560 clear_thread_flag(TIF_RESTORE_SIGMASK);
561 return;
639 } 562 }
640 if (cookie.restart_syscall && 563 if (cookie.restart_syscall &&
641 (regs->u_regs[UREG_I0] == ERESTARTNOHAND || 564 (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
@@ -652,15 +575,21 @@ static int do_signal(sigset_t *oldset, struct pt_regs * regs,
652 regs->tpc -= 4; 575 regs->tpc -= 4;
653 regs->tnpc -= 4; 576 regs->tnpc -= 4;
654 } 577 }
655 return 0; 578
579 /* if there's no signal to deliver, we just put the saved sigmask
580 * back
581 */
582 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
583 clear_thread_flag(TIF_RESTORE_SIGMASK);
584 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
585 }
656} 586}
657 587
658void do_notify_resume(sigset_t *oldset, struct pt_regs *regs, 588void do_notify_resume(struct pt_regs *regs, unsigned long orig_i0, int restart_syscall,
659 unsigned long orig_i0, int restart_syscall,
660 unsigned long thread_info_flags) 589 unsigned long thread_info_flags)
661{ 590{
662 if (thread_info_flags & _TIF_SIGPENDING) 591 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
663 do_signal(oldset, regs, orig_i0, restart_syscall); 592 do_signal(regs, orig_i0, restart_syscall);
664} 593}
665 594
666void ptrace_signal_deliver(struct pt_regs *regs, void *cookie) 595void ptrace_signal_deliver(struct pt_regs *regs, void *cookie)
diff --git a/arch/sparc64/kernel/signal32.c b/arch/sparc64/kernel/signal32.c
index 009a86e5ded4..708ba9b42cda 100644
--- a/arch/sparc64/kernel/signal32.c
+++ b/arch/sparc64/kernel/signal32.c
@@ -32,9 +32,6 @@
32 32
33#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP))) 33#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
34 34
35int do_signal32(sigset_t *oldset, struct pt_regs *regs,
36 unsigned long orig_o0, int ret_from_syscall);
37
38/* Signal frames: the original one (compatible with SunOS): 35/* Signal frames: the original one (compatible with SunOS):
39 * 36 *
40 * Set up a signal frame... Make the stack look the way SunOS 37 * Set up a signal frame... Make the stack look the way SunOS
@@ -226,102 +223,6 @@ int copy_siginfo_from_user32(siginfo_t *to, compat_siginfo_t __user *from)
226 return 0; 223 return 0;
227} 224}
228 225
229/*
230 * atomically swap in the new signal mask, and wait for a signal.
231 * This is really tricky on the Sparc, watch out...
232 */
233asmlinkage void _sigpause32_common(compat_old_sigset_t set, struct pt_regs *regs)
234{
235 sigset_t saveset;
236
237 set &= _BLOCKABLE;
238 spin_lock_irq(&current->sighand->siglock);
239 saveset = current->blocked;
240 siginitset(&current->blocked, set);
241 recalc_sigpending();
242 spin_unlock_irq(&current->sighand->siglock);
243
244 regs->tpc = regs->tnpc;
245 regs->tnpc += 4;
246 if (test_thread_flag(TIF_32BIT)) {
247 regs->tpc &= 0xffffffff;
248 regs->tnpc &= 0xffffffff;
249 }
250
251 /* Condition codes and return value where set here for sigpause,
252 * and so got used by setup_frame, which again causes sigreturn()
253 * to return -EINTR.
254 */
255 while (1) {
256 current->state = TASK_INTERRUPTIBLE;
257 schedule();
258 /*
259 * Return -EINTR and set condition code here,
260 * so the interrupted system call actually returns
261 * these.
262 */
263 regs->tstate |= TSTATE_ICARRY;
264 regs->u_regs[UREG_I0] = EINTR;
265 if (do_signal32(&saveset, regs, 0, 0))
266 return;
267 }
268}
269
270asmlinkage void do_rt_sigsuspend32(u32 uset, size_t sigsetsize, struct pt_regs *regs)
271{
272 sigset_t oldset, set;
273 compat_sigset_t set32;
274
275 /* XXX: Don't preclude handling different sized sigset_t's. */
276 if (((compat_size_t)sigsetsize) != sizeof(sigset_t)) {
277 regs->tstate |= TSTATE_ICARRY;
278 regs->u_regs[UREG_I0] = EINVAL;
279 return;
280 }
281 if (copy_from_user(&set32, compat_ptr(uset), sizeof(set32))) {
282 regs->tstate |= TSTATE_ICARRY;
283 regs->u_regs[UREG_I0] = EFAULT;
284 return;
285 }
286 switch (_NSIG_WORDS) {
287 case 4: set.sig[3] = set32.sig[6] + (((long)set32.sig[7]) << 32);
288 case 3: set.sig[2] = set32.sig[4] + (((long)set32.sig[5]) << 32);
289 case 2: set.sig[1] = set32.sig[2] + (((long)set32.sig[3]) << 32);
290 case 1: set.sig[0] = set32.sig[0] + (((long)set32.sig[1]) << 32);
291 }
292 sigdelsetmask(&set, ~_BLOCKABLE);
293 spin_lock_irq(&current->sighand->siglock);
294 oldset = current->blocked;
295 current->blocked = set;
296 recalc_sigpending();
297 spin_unlock_irq(&current->sighand->siglock);
298
299 regs->tpc = regs->tnpc;
300 regs->tnpc += 4;
301 if (test_thread_flag(TIF_32BIT)) {
302 regs->tpc &= 0xffffffff;
303 regs->tnpc &= 0xffffffff;
304 }
305
306 /* Condition codes and return value where set here for sigpause,
307 * and so got used by setup_frame, which again causes sigreturn()
308 * to return -EINTR.
309 */
310 while (1) {
311 current->state = TASK_INTERRUPTIBLE;
312 schedule();
313 /*
314 * Return -EINTR and set condition code here,
315 * so the interrupted system call actually returns
316 * these.
317 */
318 regs->tstate |= TSTATE_ICARRY;
319 regs->u_regs[UREG_I0] = EINTR;
320 if (do_signal32(&oldset, regs, 0, 0))
321 return;
322 }
323}
324
325static int restore_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu) 226static int restore_fpu_state32(struct pt_regs *regs, __siginfo_fpu_t __user *fpu)
326{ 227{
327 unsigned long *fpregs = current_thread_info()->fpregs; 228 unsigned long *fpregs = current_thread_info()->fpregs;
@@ -1362,8 +1263,8 @@ static inline void syscall_restart32(unsigned long orig_i0, struct pt_regs *regs
1362 * want to handle. Thus you cannot kill init even with a SIGKILL even by 1263 * want to handle. Thus you cannot kill init even with a SIGKILL even by
1363 * mistake. 1264 * mistake.
1364 */ 1265 */
1365int do_signal32(sigset_t *oldset, struct pt_regs * regs, 1266void do_signal32(sigset_t *oldset, struct pt_regs * regs,
1366 unsigned long orig_i0, int restart_syscall) 1267 unsigned long orig_i0, int restart_syscall)
1367{ 1268{
1368 siginfo_t info; 1269 siginfo_t info;
1369 struct signal_deliver_cookie cookie; 1270 struct signal_deliver_cookie cookie;
@@ -1380,7 +1281,15 @@ int do_signal32(sigset_t *oldset, struct pt_regs * regs,
1380 syscall_restart32(orig_i0, regs, &ka.sa); 1281 syscall_restart32(orig_i0, regs, &ka.sa);
1381 handle_signal32(signr, &ka, &info, oldset, 1282 handle_signal32(signr, &ka, &info, oldset,
1382 regs, svr4_signal); 1283 regs, svr4_signal);
1383 return 1; 1284
1285 /* a signal was successfully delivered; the saved
1286 * sigmask will have been stored in the signal frame,
1287 * and will be restored by sigreturn, so we can simply
1288 * clear the TIF_RESTORE_SIGMASK flag.
1289 */
1290 if (test_thread_flag(TIF_RESTORE_SIGMASK))
1291 clear_thread_flag(TIF_RESTORE_SIGMASK);
1292 return;
1384 } 1293 }
1385 if (cookie.restart_syscall && 1294 if (cookie.restart_syscall &&
1386 (regs->u_regs[UREG_I0] == ERESTARTNOHAND || 1295 (regs->u_regs[UREG_I0] == ERESTARTNOHAND ||
@@ -1397,7 +1306,14 @@ int do_signal32(sigset_t *oldset, struct pt_regs * regs,
1397 regs->tpc -= 4; 1306 regs->tpc -= 4;
1398 regs->tnpc -= 4; 1307 regs->tnpc -= 4;
1399 } 1308 }
1400 return 0; 1309
1310 /* if there's no signal to deliver, we just put the saved sigmask
1311 * back
1312 */
1313 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
1314 clear_thread_flag(TIF_RESTORE_SIGMASK);
1315 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
1316 }
1401} 1317}
1402 1318
1403struct sigstack32 { 1319struct sigstack32 {
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 6efc03df51c3..1fb6323e65a4 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -335,7 +335,7 @@ static int __devinit smp_boot_one_cpu(unsigned int cpu)
335 335
336 p = fork_idle(cpu); 336 p = fork_idle(cpu);
337 callin_flag = 0; 337 callin_flag = 0;
338 cpu_new_thread = p->thread_info; 338 cpu_new_thread = task_thread_info(p);
339 cpu_set(cpu, cpu_callout_map); 339 cpu_set(cpu, cpu_callout_map);
340 340
341 cpu_find_by_mid(cpu, &cpu_node); 341 cpu_find_by_mid(cpu, &cpu_node);
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index fb7a5370dbfc..3c06bfb92a8c 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -69,7 +69,6 @@ struct poll {
69 69
70extern void die_if_kernel(char *str, struct pt_regs *regs); 70extern void die_if_kernel(char *str, struct pt_regs *regs);
71extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags); 71extern pid_t kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
72void _sigpause_common (unsigned int set, struct pt_regs *);
73extern void *__bzero(void *, size_t); 72extern void *__bzero(void *, size_t);
74extern void *__memscan_zero(void *, size_t); 73extern void *__memscan_zero(void *, size_t);
75extern void *__memscan_generic(void *, int, size_t); 74extern void *__memscan_generic(void *, int, size_t);
@@ -94,7 +93,6 @@ extern void (*prom_palette)(int);
94 93
95extern int __ashrdi3(int, int); 94extern int __ashrdi3(int, int);
96 95
97extern void dump_thread(struct pt_regs *, struct user *);
98extern int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs); 96extern int dump_fpu (struct pt_regs * regs, elf_fpregset_t * fpregs);
99 97
100extern unsigned long phys_base; 98extern unsigned long phys_base;
@@ -237,11 +235,11 @@ EXPORT_SYMBOL(pci_dma_supported);
237/* I/O device mmaping on Sparc64. */ 235/* I/O device mmaping on Sparc64. */
238EXPORT_SYMBOL(io_remap_pfn_range); 236EXPORT_SYMBOL(io_remap_pfn_range);
239 237
238#ifdef CONFIG_COMPAT
240/* Solaris/SunOS binary compatibility */ 239/* Solaris/SunOS binary compatibility */
241EXPORT_SYMBOL(_sigpause_common);
242EXPORT_SYMBOL(verify_compat_iovec); 240EXPORT_SYMBOL(verify_compat_iovec);
241#endif
243 242
244EXPORT_SYMBOL(dump_thread);
245EXPORT_SYMBOL(dump_fpu); 243EXPORT_SYMBOL(dump_fpu);
246EXPORT_SYMBOL(pte_alloc_one_kernel); 244EXPORT_SYMBOL(pte_alloc_one_kernel);
247#ifndef CONFIG_SMP 245#ifndef CONFIG_SMP
diff --git a/arch/sparc64/kernel/sys_sparc32.c b/arch/sparc64/kernel/sys_sparc32.c
index 7f6239ed2521..9264ccbaaafa 100644
--- a/arch/sparc64/kernel/sys_sparc32.c
+++ b/arch/sparc64/kernel/sys_sparc32.c
@@ -11,6 +11,7 @@
11#include <linux/config.h> 11#include <linux/config.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/capability.h>
14#include <linux/fs.h> 15#include <linux/fs.h>
15#include <linux/mm.h> 16#include <linux/mm.h>
16#include <linux/file.h> 17#include <linux/file.h>
@@ -820,7 +821,7 @@ asmlinkage long sys32_utimes(char __user *filename,
820 return -EFAULT; 821 return -EFAULT;
821 } 822 }
822 823
823 return do_utimes(filename, (tvs ? &ktvs[0] : NULL)); 824 return do_utimes(AT_FDCWD, filename, (tvs ? &ktvs[0] : NULL));
824} 825}
825 826
826/* These are here just in case some old sparc32 binary calls it. */ 827/* These are here just in case some old sparc32 binary calls it. */
@@ -1002,7 +1003,7 @@ asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
1002asmlinkage long sparc32_open(const char __user *filename, 1003asmlinkage long sparc32_open(const char __user *filename,
1003 int flags, int mode) 1004 int flags, int mode)
1004{ 1005{
1005 return do_sys_open(filename, flags, mode); 1006 return do_sys_open(AT_FDCWD, filename, flags, mode);
1006} 1007}
1007 1008
1008extern unsigned long do_mremap(unsigned long addr, 1009extern unsigned long do_mremap(unsigned long addr,
@@ -1120,39 +1121,3 @@ long sys32_lookup_dcookie(unsigned long cookie_high,
1120 return sys_lookup_dcookie((cookie_high << 32) | cookie_low, 1121 return sys_lookup_dcookie((cookie_high << 32) | cookie_low,
1121 buf, len); 1122 buf, len);
1122} 1123}
1123
1124extern asmlinkage long
1125sys_timer_create(clockid_t which_clock,
1126 struct sigevent __user *timer_event_spec,
1127 timer_t __user *created_timer_id);
1128
1129long
1130sys32_timer_create(u32 clock, struct compat_sigevent __user *se32,
1131 timer_t __user *timer_id)
1132{
1133 struct sigevent se;
1134 mm_segment_t oldfs;
1135 timer_t t;
1136 long err;
1137
1138 if (se32 == NULL)
1139 return sys_timer_create(clock, NULL, timer_id);
1140
1141 if (get_compat_sigevent(&se, se32))
1142 return -EFAULT;
1143
1144 if (!access_ok(VERIFY_WRITE,timer_id,sizeof(timer_t)))
1145 return -EFAULT;
1146
1147 oldfs = get_fs();
1148 set_fs(KERNEL_DS);
1149 err = sys_timer_create(clock,
1150 (struct sigevent __user *) &se,
1151 (timer_t __user *) &t);
1152 set_fs(oldfs);
1153
1154 if (!err)
1155 err = __put_user (t, timer_id);
1156
1157 return err;
1158}
diff --git a/arch/sparc64/kernel/sys_sunos32.c b/arch/sparc64/kernel/sys_sunos32.c
index d0592ed54ea5..ae5b32f817f0 100644
--- a/arch/sparc64/kernel/sys_sunos32.c
+++ b/arch/sparc64/kernel/sys_sunos32.c
@@ -12,6 +12,7 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/types.h> 14#include <linux/types.h>
15#include <linux/capability.h>
15#include <linux/compat.h> 16#include <linux/compat.h>
16#include <linux/mman.h> 17#include <linux/mman.h>
17#include <linux/mm.h> 18#include <linux/mm.h>
@@ -854,7 +855,7 @@ asmlinkage s32 sunos_sysconf (int name)
854 ret = ARG_MAX; 855 ret = ARG_MAX;
855 break; 856 break;
856 case _SC_CHILD_MAX: 857 case _SC_CHILD_MAX:
857 ret = CHILD_MAX; 858 ret = -1; /* no limit */
858 break; 859 break;
859 case _SC_CLK_TCK: 860 case _SC_CLK_TCK:
860 ret = HZ; 861 ret = HZ;
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index 53eaf2345fe9..bf0fc5bfbfbe 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -41,7 +41,7 @@ sys_call_table32:
41/*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid 41/*90*/ .word sys_dup2, sys_setfsuid, compat_sys_fcntl, sys32_select, sys_setfsgid
42 .word sys_fsync, sys32_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall 42 .word sys_fsync, sys32_setpriority, sys_nis_syscall, sys_nis_syscall, sys_nis_syscall
43/*100*/ .word sys32_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending 43/*100*/ .word sys32_getpriority, sys32_rt_sigreturn, sys32_rt_sigaction, sys32_rt_sigprocmask, sys32_rt_sigpending
44 .word compat_sys_rt_sigtimedwait, sys32_rt_sigqueueinfo, sys32_rt_sigsuspend, sys_setresuid, sys_getresuid 44 .word compat_sys_rt_sigtimedwait, sys32_rt_sigqueueinfo, compat_sys_rt_sigsuspend, sys_setresuid, sys_getresuid
45/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall 45/*110*/ .word sys_setresgid, sys_getresgid, sys_setregid, sys_nis_syscall, sys_nis_syscall
46 .word sys32_getgroups, sys32_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd 46 .word sys32_getgroups, sys32_gettimeofday, sys32_getrusage, sys_nis_syscall, sys_getcwd
47/*120*/ .word compat_sys_readv, compat_sys_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod 47/*120*/ .word compat_sys_readv, compat_sys_writev, sys32_settimeofday, sys32_fchown16, sys_fchmod
@@ -73,10 +73,13 @@ sys_call_table32:
73/*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl 73/*250*/ .word sys32_mremap, sys32_sysctl, sys32_getsid, sys_fdatasync, sys32_nfsservctl
74 .word sys_ni_syscall, sys32_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep 74 .word sys_ni_syscall, sys32_clock_settime, compat_sys_clock_gettime, compat_sys_clock_getres, sys32_clock_nanosleep
75/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun 75/*260*/ .word compat_sys_sched_getaffinity, compat_sys_sched_setaffinity, sys32_timer_settime, compat_sys_timer_gettime, sys_timer_getoverrun
76 .word sys_timer_delete, sys32_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy 76 .word sys_timer_delete, compat_sys_timer_create, sys_ni_syscall, compat_sys_io_setup, sys_io_destroy
77/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink 77/*270*/ .word sys32_io_submit, sys_io_cancel, compat_sys_io_getevents, sys32_mq_open, sys_mq_unlink
78 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid 78 .word compat_sys_mq_timedsend, compat_sys_mq_timedreceive, compat_sys_mq_notify, compat_sys_mq_getsetattr, compat_sys_waitid
79/*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl 79/*280*/ .word sys_ni_syscall, sys_add_key, sys_request_key, sys_keyctl, compat_sys_openat
80 .word sys_mkdirat, sys_mknodat, sys_fchownat, compat_sys_futimesat, compat_sys_newfstatat
81/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
82 .word sys_fchmodat, sys_faccessat, compat_sys_pselect6, compat_sys_ppoll
80 83
81#endif /* CONFIG_COMPAT */ 84#endif /* CONFIG_COMPAT */
82 85
@@ -98,7 +101,7 @@ sys_call_table:
98 .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid 101 .word sys_umount, sys_setgid, sys_getgid, sys_signal, sys_geteuid
99/*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl 102/*50*/ .word sys_getegid, sys_acct, sys_memory_ordering, sys_nis_syscall, sys_ioctl
100 .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve 103 .word sys_reboot, sys_nis_syscall, sys_symlink, sys_readlink, sys_execve
101/*60*/ .word sys_umask, sys_chroot, sys_newfstat, sys_stat64, sys_getpagesize 104/*60*/ .word sys_umask, sys_chroot, sys_newfstat, sys_fstat64, sys_getpagesize
102 .word sys_msync, sys_vfork, sys_pread64, sys_pwrite64, sys_nis_syscall 105 .word sys_msync, sys_vfork, sys_pread64, sys_pwrite64, sys_nis_syscall
103/*70*/ .word sys_nis_syscall, sys_mmap, sys_nis_syscall, sys64_munmap, sys_mprotect 106/*70*/ .word sys_nis_syscall, sys_mmap, sys_nis_syscall, sys64_munmap, sys_mprotect
104 .word sys_madvise, sys_vhangup, sys_nis_syscall, sys_mincore, sys_getgroups 107 .word sys_madvise, sys_vhangup, sys_nis_syscall, sys_mincore, sys_getgroups
@@ -142,7 +145,10 @@ sys_call_table:
142 .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy 145 .word sys_timer_delete, sys_timer_create, sys_ni_syscall, sys_io_setup, sys_io_destroy
143/*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink 146/*270*/ .word sys_io_submit, sys_io_cancel, sys_io_getevents, sys_mq_open, sys_mq_unlink
144 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid 147 .word sys_mq_timedsend, sys_mq_timedreceive, sys_mq_notify, sys_mq_getsetattr, sys_waitid
145/*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl 148/*280*/ .word sys_nis_syscall, sys_add_key, sys_request_key, sys_keyctl, sys_openat
149 .word sys_mkdirat, sys_mknodat, sys_fchownat, sys_futimesat, compat_sys_newfstatat
150/*285*/ .word sys_unlinkat, sys_renameat, sys_linkat, sys_symlinkat, sys_readlinkat
151 .word sys_fchmodat, sys_faccessat, sys_pselect6, sys_ppoll
146 152
147#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \ 153#if defined(CONFIG_SUNOS_EMUL) || defined(CONFIG_SOLARIS_EMUL) || \
148 defined(CONFIG_SOLARIS_EMUL_MODULE) 154 defined(CONFIG_SOLARIS_EMUL_MODULE)
@@ -239,13 +245,20 @@ sunos_sys_table:
239/*250*/ .word sunos_nosys, sunos_nosys, sunos_nosys 245/*250*/ .word sunos_nosys, sunos_nosys, sunos_nosys
240 .word sunos_nosys, sunos_nosys, sunos_nosys 246 .word sunos_nosys, sunos_nosys, sunos_nosys
241 .word sunos_nosys, sunos_nosys, sunos_nosys 247 .word sunos_nosys, sunos_nosys, sunos_nosys
248 .word sunos_nosys
249/*260*/ .word sunos_nosys, sunos_nosys, sunos_nosys
242 .word sunos_nosys, sunos_nosys, sunos_nosys 250 .word sunos_nosys, sunos_nosys, sunos_nosys
243 .word sunos_nosys, sunos_nosys, sunos_nosys 251 .word sunos_nosys, sunos_nosys, sunos_nosys
252 .word sunos_nosys
253/*270*/ .word sunos_nosys, sunos_nosys, sunos_nosys
244 .word sunos_nosys, sunos_nosys, sunos_nosys 254 .word sunos_nosys, sunos_nosys, sunos_nosys
245 .word sunos_nosys, sunos_nosys, sunos_nosys 255 .word sunos_nosys, sunos_nosys, sunos_nosys
256 .word sunos_nosys
257/*280*/ .word sunos_nosys, sunos_nosys, sunos_nosys
246 .word sunos_nosys, sunos_nosys, sunos_nosys 258 .word sunos_nosys, sunos_nosys, sunos_nosys
247 .word sunos_nosys, sunos_nosys, sunos_nosys 259 .word sunos_nosys, sunos_nosys, sunos_nosys
260 .word sunos_nosys
261/*290*/ .word sunos_nosys, sunos_nosys, sunos_nosys
248 .word sunos_nosys, sunos_nosys, sunos_nosys 262 .word sunos_nosys, sunos_nosys, sunos_nosys
249 .word sunos_nosys, sunos_nosys, sunos_nosys 263 .word sunos_nosys, sunos_nosys, sunos_nosys
250 .word sunos_nosys
251#endif 264#endif
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 459c8fbe02b4..a22930d62adf 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -280,9 +280,9 @@ static struct sparc64_tick_ops stick_operations __read_mostly = {
280 * Since STICK is constantly updating, we have to access it carefully. 280 * Since STICK is constantly updating, we have to access it carefully.
281 * 281 *
282 * The sequence we use to read is: 282 * The sequence we use to read is:
283 * 1) read low 283 * 1) read high
284 * 2) read high 284 * 2) read low
285 * 3) read low again, if it rolled over increment high by 1 285 * 3) read high again, if it rolled re-read both low and high again.
286 * 286 *
287 * Writing STICK safely is also tricky: 287 * Writing STICK safely is also tricky:
288 * 1) write low to zero 288 * 1) write low to zero
@@ -295,18 +295,18 @@ static struct sparc64_tick_ops stick_operations __read_mostly = {
295static unsigned long __hbird_read_stick(void) 295static unsigned long __hbird_read_stick(void)
296{ 296{
297 unsigned long ret, tmp1, tmp2, tmp3; 297 unsigned long ret, tmp1, tmp2, tmp3;
298 unsigned long addr = HBIRD_STICK_ADDR; 298 unsigned long addr = HBIRD_STICK_ADDR+8;
299 299
300 __asm__ __volatile__("ldxa [%1] %5, %2\n\t" 300 __asm__ __volatile__("ldxa [%1] %5, %2\n"
301 "add %1, 0x8, %1\n\t" 301 "1:\n\t"
302 "ldxa [%1] %5, %3\n\t"
303 "sub %1, 0x8, %1\n\t" 302 "sub %1, 0x8, %1\n\t"
303 "ldxa [%1] %5, %3\n\t"
304 "add %1, 0x8, %1\n\t"
304 "ldxa [%1] %5, %4\n\t" 305 "ldxa [%1] %5, %4\n\t"
305 "cmp %4, %2\n\t" 306 "cmp %4, %2\n\t"
306 "blu,a,pn %%xcc, 1f\n\t" 307 "bne,a,pn %%xcc, 1b\n\t"
307 " add %3, 1, %3\n" 308 " mov %4, %2\n\t"
308 "1:\n\t" 309 "sllx %4, 32, %4\n\t"
309 "sllx %3, 32, %3\n\t"
310 "or %3, %4, %0\n\t" 310 "or %3, %4, %0\n\t"
311 : "=&r" (ret), "=&r" (addr), 311 : "=&r" (ret), "=&r" (addr),
312 "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3) 312 "=&r" (tmp1), "=&r" (tmp2), "=&r" (tmp3)
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index 5570e7bb22bb..8d44ae5a15e3 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -1808,7 +1808,7 @@ static void user_instruction_dump (unsigned int __user *pc)
1808void show_stack(struct task_struct *tsk, unsigned long *_ksp) 1808void show_stack(struct task_struct *tsk, unsigned long *_ksp)
1809{ 1809{
1810 unsigned long pc, fp, thread_base, ksp; 1810 unsigned long pc, fp, thread_base, ksp;
1811 struct thread_info *tp = tsk->thread_info; 1811 void *tp = task_stack_page(tsk);
1812 struct reg_window *rw; 1812 struct reg_window *rw;
1813 int count = 0; 1813 int count = 0;
1814 1814
@@ -1862,7 +1862,7 @@ static inline int is_kernel_stack(struct task_struct *task,
1862 return 0; 1862 return 0;
1863 } 1863 }
1864 1864
1865 thread_base = (unsigned long) task->thread_info; 1865 thread_base = (unsigned long) task_stack_page(task);
1866 thread_end = thread_base + sizeof(union thread_union); 1866 thread_end = thread_base + sizeof(union thread_union);
1867 if (rw_addr >= thread_base && 1867 if (rw_addr >= thread_base &&
1868 rw_addr < thread_end && 1868 rw_addr < thread_end &&
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
index 2af0cf0a8640..467d13a0d5c1 100644
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ b/arch/sparc64/kernel/vmlinux.lds.S
@@ -90,19 +90,9 @@ SECTIONS
90 } 90 }
91 _end = . ; 91 _end = . ;
92 PROVIDE (end = .); 92 PROVIDE (end = .);
93 /* Stabs debugging sections. */
94 .stab 0 : { *(.stab) }
95 .stabstr 0 : { *(.stabstr) }
96 .stab.excl 0 : { *(.stab.excl) }
97 .stab.exclstr 0 : { *(.stab.exclstr) }
98 .stab.index 0 : { *(.stab.index) }
99 .stab.indexstr 0 : { *(.stab.indexstr) }
100 .comment 0 : { *(.comment) }
101 .debug 0 : { *(.debug) }
102 .debug_srcinfo 0 : { *(.debug_srcinfo) }
103 .debug_aranges 0 : { *(.debug_aranges) }
104 .debug_pubnames 0 : { *(.debug_pubnames) }
105 .debug_sfnames 0 : { *(.debug_sfnames) }
106 .line 0 : { *(.line) }
107 /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) } 93 /DISCARD/ : { *(.exit.text) *(.exit.data) *(.exitcall.exit) }
94
95 STABS_DEBUG
96
97 DWARF_DEBUG
108} 98}
diff --git a/arch/sparc64/prom/console.c b/arch/sparc64/prom/console.c
index eae5db8dda56..ac6d035dd150 100644
--- a/arch/sparc64/prom/console.c
+++ b/arch/sparc64/prom/console.c
@@ -99,8 +99,12 @@ prom_query_input_device(void)
99 if (!strncmp(propb, "keyboard", 8)) 99 if (!strncmp(propb, "keyboard", 8))
100 return PROMDEV_ITTYA; 100 return PROMDEV_ITTYA;
101 101
102 if (!strncmp (propb, "rsc", 3))
103 return PROMDEV_IRSC;
104
102 if (strncmp (propb, "tty", 3) || !propb[3]) 105 if (strncmp (propb, "tty", 3) || !propb[3])
103 return PROMDEV_I_UNK; 106 return PROMDEV_I_UNK;
107
104 switch (propb[3]) { 108 switch (propb[3]) {
105 case 'a': return PROMDEV_ITTYA; 109 case 'a': return PROMDEV_ITTYA;
106 case 'b': return PROMDEV_ITTYB; 110 case 'b': return PROMDEV_ITTYB;
@@ -136,8 +140,12 @@ prom_query_output_device(void)
136 if (!strncmp(propb, "screen", 6)) 140 if (!strncmp(propb, "screen", 6))
137 return PROMDEV_OTTYA; 141 return PROMDEV_OTTYA;
138 142
143 if (!strncmp (propb, "rsc", 3))
144 return PROMDEV_ORSC;
145
139 if (strncmp (propb, "tty", 3) || !propb[3]) 146 if (strncmp (propb, "tty", 3) || !propb[3])
140 return PROMDEV_O_UNK; 147 return PROMDEV_O_UNK;
148
141 switch (propb[3]) { 149 switch (propb[3]) {
142 case 'a': return PROMDEV_OTTYA; 150 case 'a': return PROMDEV_OTTYA;
143 case 'b': return PROMDEV_OTTYB; 151 case 'b': return PROMDEV_OTTYB;
diff --git a/arch/sparc64/solaris/entry64.S b/arch/sparc64/solaris/entry64.S
index 4b6ae583c0a3..eb314ed23cdb 100644
--- a/arch/sparc64/solaris/entry64.S
+++ b/arch/sparc64/solaris/entry64.S
@@ -180,6 +180,8 @@ solaris_sigsuspend:
180 nop 180 nop
181 call sys_sigsuspend 181 call sys_sigsuspend
182 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] 182 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
183 b,pt %xcc, ret_from_solaris
184 nop
183 185
184 .globl solaris_getpid 186 .globl solaris_getpid
185solaris_getpid: 187solaris_getpid:
diff --git a/arch/sparc64/solaris/fs.c b/arch/sparc64/solaris/fs.c
index d7c99fa89661..4885ca6cbc77 100644
--- a/arch/sparc64/solaris/fs.c
+++ b/arch/sparc64/solaris/fs.c
@@ -10,6 +10,7 @@
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/sched.h> 11#include <linux/sched.h>
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/capability.h>
13#include <linux/fs.h> 14#include <linux/fs.h>
14#include <linux/namei.h> 15#include <linux/namei.h>
15#include <linux/mm.h> 16#include <linux/mm.h>
diff --git a/arch/sparc64/solaris/misc.c b/arch/sparc64/solaris/misc.c
index 302efbcba70e..3ab4677395f2 100644
--- a/arch/sparc64/solaris/misc.c
+++ b/arch/sparc64/solaris/misc.c
@@ -353,7 +353,7 @@ asmlinkage int solaris_sysconf(int id)
353{ 353{
354 switch (id) { 354 switch (id) {
355 case SOLARIS_CONFIG_NGROUPS: return NGROUPS_MAX; 355 case SOLARIS_CONFIG_NGROUPS: return NGROUPS_MAX;
356 case SOLARIS_CONFIG_CHILD_MAX: return CHILD_MAX; 356 case SOLARIS_CONFIG_CHILD_MAX: return -1; /* no limit */
357 case SOLARIS_CONFIG_OPEN_FILES: return OPEN_MAX; 357 case SOLARIS_CONFIG_OPEN_FILES: return OPEN_MAX;
358 case SOLARIS_CONFIG_POSIX_VER: return 199309; 358 case SOLARIS_CONFIG_POSIX_VER: return 199309;
359 case SOLARIS_CONFIG_PAGESIZE: return PAGE_SIZE; 359 case SOLARIS_CONFIG_PAGESIZE: return PAGE_SIZE;
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 563301fe5df8..5982fe2753e0 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -22,10 +22,6 @@ config SBUS
22config PCI 22config PCI
23 bool 23 bool
24 24
25config UID16
26 bool
27 default y
28
29config GENERIC_CALIBRATE_DELAY 25config GENERIC_CALIBRATE_DELAY
30 bool 26 bool
31 default y 27 default y
@@ -39,12 +35,12 @@ menu "UML-specific options"
39 35
40config MODE_TT 36config MODE_TT
41 bool "Tracing thread support" 37 bool "Tracing thread support"
42 default y 38 default n
43 help 39 help
44 This option controls whether tracing thread support is compiled 40 This option controls whether tracing thread support is compiled
45 into UML. Normally, this should be set to Y. If you intend to 41 into UML. This option is largely obsolete, given that skas0 provides
46 use only skas mode (and the host has the skas patch applied to it), 42 skas security and performance without needing to patch the host.
47 then it is OK to say N here. 43 It is safe to say 'N' here.
48 44
49config STATIC_LINK 45config STATIC_LINK
50 bool "Force a static link" 46 bool "Force a static link"
@@ -83,7 +79,7 @@ config KERNEL_HALF_GIGS
83 of physical memory. 79 of physical memory.
84 80
85config MODE_SKAS 81config MODE_SKAS
86 bool "Separate Kernel Address Space support" 82 bool "Separate Kernel Address Space support" if MODE_TT
87 default y 83 default y
88 help 84 help
89 This option controls whether skas (separate kernel address space) 85 This option controls whether skas (separate kernel address space)
@@ -147,6 +143,7 @@ config HOSTFS
147 143
148config HPPFS 144config HPPFS
149 tristate "HoneyPot ProcFS (EXPERIMENTAL)" 145 tristate "HoneyPot ProcFS (EXPERIMENTAL)"
146 depends on EXPERIMENTAL
150 help 147 help
151 hppfs (HoneyPot ProcFS) is a filesystem which allows UML /proc 148 hppfs (HoneyPot ProcFS) is a filesystem which allows UML /proc
152 entries to be overridden, removed, or fabricated from the host. 149 entries to be overridden, removed, or fabricated from the host.
@@ -159,10 +156,6 @@ config HPPFS
159 You only need this if you are setting up a UML honeypot. Otherwise, 156 You only need this if you are setting up a UML honeypot. Otherwise,
160 it is safe to say 'N' here. 157 it is safe to say 'N' here.
161 158
162 If you are actively using it, please report any problems, since it's
163 getting fixed. In this moment, it is experimental on 2.6 (it works on
164 2.4).
165
166config MCONSOLE 159config MCONSOLE
167 bool "Management console" 160 bool "Management console"
168 default y 161 default y
@@ -247,8 +240,16 @@ config NEST_LEVEL
247 Only change this if you are running nested UMLs. 240 Only change this if you are running nested UMLs.
248 241
249config HIGHMEM 242config HIGHMEM
250 bool "Highmem support" 243 bool "Highmem support (EXPERIMENTAL)"
251 depends on !64BIT 244 depends on !64BIT && EXPERIMENTAL
245 default n
246 help
247 This was used to allow UML to run with big amounts of memory.
248 Currently it is unstable, so if unsure say N.
249
250 To use big amounts of memory, it is recommended to disable TT mode (i.e.
251 CONFIG_MODE_TT) and enable static linking (i.e. CONFIG_STATIC_LINK) -
252 this should allow the guest to use up to 2.75G of memory.
252 253
253config KERNEL_STACK_ORDER 254config KERNEL_STACK_ORDER
254 int "Kernel stack size order" 255 int "Kernel stack size order"
@@ -273,22 +274,20 @@ endmenu
273 274
274source "init/Kconfig" 275source "init/Kconfig"
275 276
276source "net/Kconfig" 277source "drivers/block/Kconfig"
277
278source "drivers/base/Kconfig"
279 278
280source "arch/um/Kconfig.char" 279source "arch/um/Kconfig.char"
281 280
282source "drivers/block/Kconfig" 281source "drivers/base/Kconfig"
283 282
284config NETDEVICES 283source "net/Kconfig"
285 bool
286 default NET
287 284
288source "arch/um/Kconfig.net" 285source "arch/um/Kconfig.net"
289 286
290source "drivers/net/Kconfig" 287source "drivers/net/Kconfig"
291 288
289source "drivers/connector/Kconfig"
290
292source "fs/Kconfig" 291source "fs/Kconfig"
293 292
294source "security/Kconfig" 293source "security/Kconfig"
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386
index c71b39a677aa..ef79ed25aecd 100644
--- a/arch/um/Kconfig.i386
+++ b/arch/um/Kconfig.i386
@@ -22,13 +22,17 @@ config TOP_ADDR
22 default 0x80000000 if HOST_2G_2G 22 default 0x80000000 if HOST_2G_2G
23 23
24config 3_LEVEL_PGTABLES 24config 3_LEVEL_PGTABLES
25 bool "Three-level pagetables" 25 bool "Three-level pagetables (EXPERIMENTAL)"
26 default n 26 default n
27 depends on EXPERIMENTAL
27 help 28 help
28 Three-level pagetables will let UML have more than 4G of physical 29 Three-level pagetables will let UML have more than 4G of physical
29 memory. All the memory that can't be mapped directly will be treated 30 memory. All the memory that can't be mapped directly will be treated
30 as high memory. 31 as high memory.
31 32
33 However, this it experimental on 32-bit architectures, so if unsure say
34 N (on x86-64 it's automatically enabled, instead, as it's safe there).
35
32config STUB_CODE 36config STUB_CODE
33 hex 37 hex
34 default 0xbfffe000 38 default 0xbfffe000
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 1b12feeba368..6430a6383853 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -32,7 +32,7 @@ um-modes-$(CONFIG_MODE_TT) += tt
32um-modes-$(CONFIG_MODE_SKAS) += skas 32um-modes-$(CONFIG_MODE_SKAS) += skas
33 33
34MODE_INCLUDE += $(foreach mode,$(um-modes-y),\ 34MODE_INCLUDE += $(foreach mode,$(um-modes-y),\
35 -I$(srctree)/$(ARCH_DIR)/kernel/$(mode)/include) 35 -I$(srctree)/$(ARCH_DIR)/include/$(mode))
36 36
37MAKEFILES-INCL += $(foreach mode,$(um-modes-y),\ 37MAKEFILES-INCL += $(foreach mode,$(um-modes-y),\
38 $(srctree)/$(ARCH_DIR)/Makefile-$(mode)) 38 $(srctree)/$(ARCH_DIR)/Makefile-$(mode))
@@ -67,7 +67,8 @@ USER_CFLAGS := $(patsubst -D__KERNEL__,,$(USER_CFLAGS)) $(ARCH_INCLUDE) \
67# in CFLAGS. Otherwise, it would cause ld to complain about the two different 67# in CFLAGS. Otherwise, it would cause ld to complain about the two different
68# errnos. 68# errnos.
69 69
70CFLAGS += -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask 70CFLAGS += -Derrno=kernel_errno -Dsigprocmask=kernel_sigprocmask \
71 -Dmktime=kernel_mktime
71CFLAGS += $(call cc-option,-fno-unit-at-a-time,) 72CFLAGS += $(call cc-option,-fno-unit-at-a-time,)
72 73
73include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH) 74include $(srctree)/$(ARCH_DIR)/Makefile-$(SUBARCH)
@@ -189,6 +190,12 @@ define filechk_umlconfig
189 sed 's/ CONFIG/ UML_CONFIG/' 190 sed 's/ CONFIG/ UML_CONFIG/'
190endef 191endef
191 192
193$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h
194 $(call filechk,umlconfig)
195
196$(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c
197 $(CC) $(USER_CFLAGS) -S -o $@ $<
198
192define filechk_gen-asm-offsets 199define filechk_gen-asm-offsets
193 (set -e; \ 200 (set -e; \
194 echo "/*"; \ 201 echo "/*"; \
@@ -202,24 +209,13 @@ define filechk_gen-asm-offsets
202 echo ""; ) 209 echo ""; )
203endef 210endef
204 211
205$(ARCH_DIR)/include/uml-config.h : include/linux/autoconf.h
206 $(call filechk,umlconfig)
207
208$(ARCH_DIR)/user-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/user-offsets.c
209 $(CC) $(USER_CFLAGS) -S -o $@ $<
210
211$(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/user-offsets.s 212$(ARCH_DIR)/include/user_constants.h: $(ARCH_DIR)/user-offsets.s
212 $(call filechk,gen-asm-offsets) 213 $(call filechk,gen-asm-offsets)
213 214
214CLEAN_FILES += $(ARCH_DIR)/user-offsets.s 215CLEAN_FILES += $(ARCH_DIR)/user-offsets.s
215 216
216$(ARCH_DIR)/kernel-offsets.s: $(ARCH_DIR)/sys-$(SUBARCH)/kernel-offsets.c \ 217$(ARCH_DIR)/include/kern_constants.h:
217 archprepare 218 @echo ' SYMLINK $@'
218 $(CC) $(CFLAGS) $(NOSTDINC_FLAGS) $(CPPFLAGS) -S -o $@ $< 219 $(Q) ln -sf ../../../include/asm-um/asm-offsets.h $@
219
220$(ARCH_DIR)/include/kern_constants.h: $(ARCH_DIR)/kernel-offsets.s
221 $(call filechk,gen-asm-offsets)
222
223CLEAN_FILES += $(ARCH_DIR)/kernel-offsets.s
224 220
225export SUBARCH USER_CFLAGS OS 221export SUBARCH USER_CFLAGS OS
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index 4f118d5cc2ee..38df311e75dc 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -12,3 +12,7 @@ CHECKFLAGS += -m64
12 12
13ELF_ARCH := i386:x86-64 13ELF_ARCH := i386:x86-64
14ELF_FORMAT := elf64-x86-64 14ELF_FORMAT := elf64-x86-64
15
16# Not on all 64-bit distros /lib is a symlink to /lib64. PLD is an example.
17
18LINK-$(CONFIG_LD_SCRIPT_DYN) += -Wl,-rpath,/lib64
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 5b58fad45290..ab0d0b170816 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -58,7 +58,7 @@ static void *not_configged_init(char *str, int device, struct chan_opts *opts)
58{ 58{
59 my_puts("Using a channel type which is configured out of " 59 my_puts("Using a channel type which is configured out of "
60 "UML\n"); 60 "UML\n");
61 return(NULL); 61 return NULL;
62} 62}
63 63
64static int not_configged_open(int input, int output, int primary, void *data, 64static int not_configged_open(int input, int output, int primary, void *data,
@@ -66,7 +66,7 @@ static int not_configged_open(int input, int output, int primary, void *data,
66{ 66{
67 my_puts("Using a channel type which is configured out of " 67 my_puts("Using a channel type which is configured out of "
68 "UML\n"); 68 "UML\n");
69 return(-ENODEV); 69 return -ENODEV;
70} 70}
71 71
72static void not_configged_close(int fd, void *data) 72static void not_configged_close(int fd, void *data)
@@ -79,21 +79,21 @@ static int not_configged_read(int fd, char *c_out, void *data)
79{ 79{
80 my_puts("Using a channel type which is configured out of " 80 my_puts("Using a channel type which is configured out of "
81 "UML\n"); 81 "UML\n");
82 return(-EIO); 82 return -EIO;
83} 83}
84 84
85static int not_configged_write(int fd, const char *buf, int len, void *data) 85static int not_configged_write(int fd, const char *buf, int len, void *data)
86{ 86{
87 my_puts("Using a channel type which is configured out of " 87 my_puts("Using a channel type which is configured out of "
88 "UML\n"); 88 "UML\n");
89 return(-EIO); 89 return -EIO;
90} 90}
91 91
92static int not_configged_console_write(int fd, const char *buf, int len) 92static int not_configged_console_write(int fd, const char *buf, int len)
93{ 93{
94 my_puts("Using a channel type which is configured out of " 94 my_puts("Using a channel type which is configured out of "
95 "UML\n"); 95 "UML\n");
96 return(-EIO); 96 return -EIO;
97} 97}
98 98
99static int not_configged_window_size(int fd, void *data, unsigned short *rows, 99static int not_configged_window_size(int fd, void *data, unsigned short *rows,
@@ -101,7 +101,7 @@ static int not_configged_window_size(int fd, void *data, unsigned short *rows,
101{ 101{
102 my_puts("Using a channel type which is configured out of " 102 my_puts("Using a channel type which is configured out of "
103 "UML\n"); 103 "UML\n");
104 return(-ENODEV); 104 return -ENODEV;
105} 105}
106 106
107static void not_configged_free(void *data) 107static void not_configged_free(void *data)
@@ -135,17 +135,17 @@ int generic_read(int fd, char *c_out, void *unused)
135 n = os_read_file(fd, c_out, sizeof(*c_out)); 135 n = os_read_file(fd, c_out, sizeof(*c_out));
136 136
137 if(n == -EAGAIN) 137 if(n == -EAGAIN)
138 return(0); 138 return 0;
139 else if(n == 0) 139 else if(n == 0)
140 return(-EIO); 140 return -EIO;
141 return(n); 141 return n;
142} 142}
143 143
144/* XXX Trivial wrapper around os_write_file */ 144/* XXX Trivial wrapper around os_write_file */
145 145
146int generic_write(int fd, const char *buf, int n, void *unused) 146int generic_write(int fd, const char *buf, int n, void *unused)
147{ 147{
148 return(os_write_file(fd, buf, n)); 148 return os_write_file(fd, buf, n);
149} 149}
150 150
151int generic_window_size(int fd, void *unused, unsigned short *rows_out, 151int generic_window_size(int fd, void *unused, unsigned short *rows_out,
@@ -156,14 +156,14 @@ int generic_window_size(int fd, void *unused, unsigned short *rows_out,
156 156
157 ret = os_window_size(fd, &rows, &cols); 157 ret = os_window_size(fd, &rows, &cols);
158 if(ret < 0) 158 if(ret < 0)
159 return(ret); 159 return ret;
160 160
161 ret = ((*rows_out != rows) || (*cols_out != cols)); 161 ret = ((*rows_out != rows) || (*cols_out != cols));
162 162
163 *rows_out = rows; 163 *rows_out = rows;
164 *cols_out = cols; 164 *cols_out = cols;
165 165
166 return(ret); 166 return ret;
167} 167}
168 168
169void generic_free(void *data) 169void generic_free(void *data)
@@ -186,25 +186,26 @@ static void tty_receive_char(struct tty_struct *tty, char ch)
186 } 186 }
187 } 187 }
188 188
189 if((tty->flip.flag_buf_ptr == NULL) ||
190 (tty->flip.char_buf_ptr == NULL))
191 return;
192 tty_insert_flip_char(tty, ch, TTY_NORMAL); 189 tty_insert_flip_char(tty, ch, TTY_NORMAL);
193} 190}
194 191
195static int open_one_chan(struct chan *chan, int input, int output, int primary) 192static int open_one_chan(struct chan *chan)
196{ 193{
197 int fd; 194 int fd;
198 195
199 if(chan->opened) return(0); 196 if(chan->opened)
200 if(chan->ops->open == NULL) fd = 0; 197 return 0;
201 else fd = (*chan->ops->open)(input, output, primary, chan->data, 198
202 &chan->dev); 199 if(chan->ops->open == NULL)
203 if(fd < 0) return(fd); 200 fd = 0;
201 else fd = (*chan->ops->open)(chan->input, chan->output, chan->primary,
202 chan->data, &chan->dev);
203 if(fd < 0)
204 return fd;
204 chan->fd = fd; 205 chan->fd = fd;
205 206
206 chan->opened = 1; 207 chan->opened = 1;
207 return(0); 208 return 0;
208} 209}
209 210
210int open_chan(struct list_head *chans) 211int open_chan(struct list_head *chans)
@@ -215,11 +216,11 @@ int open_chan(struct list_head *chans)
215 216
216 list_for_each(ele, chans){ 217 list_for_each(ele, chans){
217 chan = list_entry(ele, struct chan, list); 218 chan = list_entry(ele, struct chan, list);
218 ret = open_one_chan(chan, chan->input, chan->output, 219 ret = open_one_chan(chan);
219 chan->primary); 220 if(chan->primary)
220 if(chan->primary) err = ret; 221 err = ret;
221 } 222 }
222 return(err); 223 return err;
223} 224}
224 225
225void chan_enable_winch(struct list_head *chans, struct tty_struct *tty) 226void chan_enable_winch(struct list_head *chans, struct tty_struct *tty)
@@ -236,20 +237,65 @@ void chan_enable_winch(struct list_head *chans, struct tty_struct *tty)
236 } 237 }
237} 238}
238 239
239void enable_chan(struct list_head *chans, struct tty_struct *tty) 240void enable_chan(struct line *line)
240{ 241{
241 struct list_head *ele; 242 struct list_head *ele;
242 struct chan *chan; 243 struct chan *chan;
243 244
244 list_for_each(ele, chans){ 245 list_for_each(ele, &line->chan_list){
245 chan = list_entry(ele, struct chan, list); 246 chan = list_entry(ele, struct chan, list);
246 if(!chan->opened) continue; 247 if(open_one_chan(chan))
248 continue;
247 249
248 line_setup_irq(chan->fd, chan->input, chan->output, tty); 250 if(chan->enabled)
251 continue;
252 line_setup_irq(chan->fd, chan->input, chan->output, line,
253 chan);
254 chan->enabled = 1;
249 } 255 }
250} 256}
251 257
252void close_chan(struct list_head *chans) 258static LIST_HEAD(irqs_to_free);
259
260void free_irqs(void)
261{
262 struct chan *chan;
263
264 while(!list_empty(&irqs_to_free)){
265 chan = list_entry(irqs_to_free.next, struct chan, free_list);
266 list_del(&chan->free_list);
267
268 if(chan->input)
269 free_irq(chan->line->driver->read_irq, chan);
270 if(chan->output)
271 free_irq(chan->line->driver->write_irq, chan);
272 chan->enabled = 0;
273 }
274}
275
276static void close_one_chan(struct chan *chan, int delay_free_irq)
277{
278 if(!chan->opened)
279 return;
280
281 if(delay_free_irq){
282 list_add(&chan->free_list, &irqs_to_free);
283 }
284 else {
285 if(chan->input)
286 free_irq(chan->line->driver->read_irq, chan);
287 if(chan->output)
288 free_irq(chan->line->driver->write_irq, chan);
289 chan->enabled = 0;
290 }
291 if(chan->ops->close != NULL)
292 (*chan->ops->close)(chan->fd, chan->data);
293
294 chan->opened = 0;
295 chan->fd = -1;
296}
297
298void close_chan(struct list_head *chans, int delay_free_irq)
253{ 299{
254 struct chan *chan; 300 struct chan *chan;
255 301
@@ -259,15 +305,37 @@ void close_chan(struct list_head *chans)
259 * so it must be the last closed. 305 * so it must be the last closed.
260 */ 306 */
261 list_for_each_entry_reverse(chan, chans, list) { 307 list_for_each_entry_reverse(chan, chans, list) {
262 if(!chan->opened) continue; 308 close_one_chan(chan, delay_free_irq);
263 if(chan->ops->close != NULL)
264 (*chan->ops->close)(chan->fd, chan->data);
265 chan->opened = 0;
266 chan->fd = -1;
267 } 309 }
268} 310}
269 311
270int write_chan(struct list_head *chans, const char *buf, int len, 312void deactivate_chan(struct list_head *chans, int irq)
313{
314 struct list_head *ele;
315
316 struct chan *chan;
317 list_for_each(ele, chans) {
318 chan = list_entry(ele, struct chan, list);
319
320 if(chan->enabled && chan->input)
321 deactivate_fd(chan->fd, irq);
322 }
323}
324
325void reactivate_chan(struct list_head *chans, int irq)
326{
327 struct list_head *ele;
328 struct chan *chan;
329
330 list_for_each(ele, chans) {
331 chan = list_entry(ele, struct chan, list);
332
333 if(chan->enabled && chan->input)
334 reactivate_fd(chan->fd, irq);
335 }
336}
337
338int write_chan(struct list_head *chans, const char *buf, int len,
271 int write_irq) 339 int write_irq)
272{ 340{
273 struct list_head *ele; 341 struct list_head *ele;
@@ -285,7 +353,7 @@ int write_chan(struct list_head *chans, const char *buf, int len,
285 reactivate_fd(chan->fd, write_irq); 353 reactivate_fd(chan->fd, write_irq);
286 } 354 }
287 } 355 }
288 return(ret); 356 return ret;
289} 357}
290 358
291int console_write_chan(struct list_head *chans, const char *buf, int len) 359int console_write_chan(struct list_head *chans, const char *buf, int len)
@@ -301,19 +369,18 @@ int console_write_chan(struct list_head *chans, const char *buf, int len)
301 n = chan->ops->console_write(chan->fd, buf, len); 369 n = chan->ops->console_write(chan->fd, buf, len);
302 if(chan->primary) ret = n; 370 if(chan->primary) ret = n;
303 } 371 }
304 return(ret); 372 return ret;
305} 373}
306 374
307int console_open_chan(struct line *line, struct console *co, struct chan_opts *opts) 375int console_open_chan(struct line *line, struct console *co,
376 struct chan_opts *opts)
308{ 377{
309 if (!list_empty(&line->chan_list)) 378 int err;
310 return 0; 379
380 err = open_chan(&line->chan_list);
381 if(err)
382 return err;
311 383
312 if (0 != parse_chan_pair(line->init_str, &line->chan_list,
313 line->init_pri, co->index, opts))
314 return -1;
315 if (0 != open_chan(&line->chan_list))
316 return -1;
317 printk("Console initialized on /dev/%s%d\n",co->name,co->index); 384 printk("Console initialized on /dev/%s%d\n",co->name,co->index);
318 return 0; 385 return 0;
319} 386}
@@ -327,32 +394,36 @@ int chan_window_size(struct list_head *chans, unsigned short *rows_out,
327 list_for_each(ele, chans){ 394 list_for_each(ele, chans){
328 chan = list_entry(ele, struct chan, list); 395 chan = list_entry(ele, struct chan, list);
329 if(chan->primary){ 396 if(chan->primary){
330 if(chan->ops->window_size == NULL) return(0); 397 if(chan->ops->window_size == NULL)
331 return(chan->ops->window_size(chan->fd, chan->data, 398 return 0;
332 rows_out, cols_out)); 399 return chan->ops->window_size(chan->fd, chan->data,
400 rows_out, cols_out);
333 } 401 }
334 } 402 }
335 return(0); 403 return 0;
336} 404}
337 405
338void free_one_chan(struct chan *chan) 406void free_one_chan(struct chan *chan, int delay_free_irq)
339{ 407{
340 list_del(&chan->list); 408 list_del(&chan->list);
409
410 close_one_chan(chan, delay_free_irq);
411
341 if(chan->ops->free != NULL) 412 if(chan->ops->free != NULL)
342 (*chan->ops->free)(chan->data); 413 (*chan->ops->free)(chan->data);
343 free_irq_by_fd(chan->fd); 414
344 if(chan->primary && chan->output) ignore_sigio_fd(chan->fd); 415 if(chan->primary && chan->output) ignore_sigio_fd(chan->fd);
345 kfree(chan); 416 kfree(chan);
346} 417}
347 418
348void free_chan(struct list_head *chans) 419void free_chan(struct list_head *chans, int delay_free_irq)
349{ 420{
350 struct list_head *ele, *next; 421 struct list_head *ele, *next;
351 struct chan *chan; 422 struct chan *chan;
352 423
353 list_for_each_safe(ele, next, chans){ 424 list_for_each_safe(ele, next, chans){
354 chan = list_entry(ele, struct chan, list); 425 chan = list_entry(ele, struct chan, list);
355 free_one_chan(chan); 426 free_one_chan(chan, delay_free_irq);
356 } 427 }
357} 428}
358 429
@@ -363,23 +434,23 @@ static int one_chan_config_string(struct chan *chan, char *str, int size,
363 434
364 if(chan == NULL){ 435 if(chan == NULL){
365 CONFIG_CHUNK(str, size, n, "none", 1); 436 CONFIG_CHUNK(str, size, n, "none", 1);
366 return(n); 437 return n;
367 } 438 }
368 439
369 CONFIG_CHUNK(str, size, n, chan->ops->type, 0); 440 CONFIG_CHUNK(str, size, n, chan->ops->type, 0);
370 441
371 if(chan->dev == NULL){ 442 if(chan->dev == NULL){
372 CONFIG_CHUNK(str, size, n, "", 1); 443 CONFIG_CHUNK(str, size, n, "", 1);
373 return(n); 444 return n;
374 } 445 }
375 446
376 CONFIG_CHUNK(str, size, n, ":", 0); 447 CONFIG_CHUNK(str, size, n, ":", 0);
377 CONFIG_CHUNK(str, size, n, chan->dev, 0); 448 CONFIG_CHUNK(str, size, n, chan->dev, 0);
378 449
379 return(n); 450 return n;
380} 451}
381 452
382static int chan_pair_config_string(struct chan *in, struct chan *out, 453static int chan_pair_config_string(struct chan *in, struct chan *out,
383 char *str, int size, char **error_out) 454 char *str, int size, char **error_out)
384{ 455{
385 int n; 456 int n;
@@ -390,7 +461,7 @@ static int chan_pair_config_string(struct chan *in, struct chan *out,
390 461
391 if(in == out){ 462 if(in == out){
392 CONFIG_CHUNK(str, size, n, "", 1); 463 CONFIG_CHUNK(str, size, n, "", 1);
393 return(n); 464 return n;
394 } 465 }
395 466
396 CONFIG_CHUNK(str, size, n, ",", 1); 467 CONFIG_CHUNK(str, size, n, ",", 1);
@@ -399,10 +470,10 @@ static int chan_pair_config_string(struct chan *in, struct chan *out,
399 size -= n; 470 size -= n;
400 CONFIG_CHUNK(str, size, n, "", 1); 471 CONFIG_CHUNK(str, size, n, "", 1);
401 472
402 return(n); 473 return n;
403} 474}
404 475
405int chan_config_string(struct list_head *chans, char *str, int size, 476int chan_config_string(struct list_head *chans, char *str, int size,
406 char **error_out) 477 char **error_out)
407{ 478{
408 struct list_head *ele; 479 struct list_head *ele;
@@ -418,7 +489,7 @@ int chan_config_string(struct list_head *chans, char *str, int size,
418 out = chan; 489 out = chan;
419 } 490 }
420 491
421 return(chan_pair_config_string(in, out, str, size, error_out)); 492 return chan_pair_config_string(in, out, str, size, error_out);
422} 493}
423 494
424struct chan_type { 495struct chan_type {
@@ -462,7 +533,7 @@ struct chan_type chan_table[] = {
462#endif 533#endif
463}; 534};
464 535
465static struct chan *parse_chan(char *str, int pri, int device, 536static struct chan *parse_chan(struct line *line, char *str, int device,
466 struct chan_opts *opts) 537 struct chan_opts *opts)
467{ 538{
468 struct chan_type *entry; 539 struct chan_type *entry;
@@ -484,36 +555,42 @@ static struct chan *parse_chan(char *str, int pri, int device,
484 if(ops == NULL){ 555 if(ops == NULL){
485 my_printf("parse_chan couldn't parse \"%s\"\n", 556 my_printf("parse_chan couldn't parse \"%s\"\n",
486 str); 557 str);
487 return(NULL); 558 return NULL;
488 } 559 }
489 if(ops->init == NULL) return(NULL); 560 if(ops->init == NULL)
561 return NULL;
490 data = (*ops->init)(str, device, opts); 562 data = (*ops->init)(str, device, opts);
491 if(data == NULL) return(NULL); 563 if(data == NULL)
564 return NULL;
492 565
493 chan = kmalloc(sizeof(*chan), GFP_ATOMIC); 566 chan = kmalloc(sizeof(*chan), GFP_ATOMIC);
494 if(chan == NULL) return(NULL); 567 if(chan == NULL)
568 return NULL;
495 *chan = ((struct chan) { .list = LIST_HEAD_INIT(chan->list), 569 *chan = ((struct chan) { .list = LIST_HEAD_INIT(chan->list),
570 .free_list =
571 LIST_HEAD_INIT(chan->free_list),
572 .line = line,
496 .primary = 1, 573 .primary = 1,
497 .input = 0, 574 .input = 0,
498 .output = 0, 575 .output = 0,
499 .opened = 0, 576 .opened = 0,
577 .enabled = 0,
500 .fd = -1, 578 .fd = -1,
501 .pri = pri,
502 .ops = ops, 579 .ops = ops,
503 .data = data }); 580 .data = data });
504 return(chan); 581 return chan;
505} 582}
506 583
507int parse_chan_pair(char *str, struct list_head *chans, int pri, int device, 584int parse_chan_pair(char *str, struct line *line, int device,
508 struct chan_opts *opts) 585 struct chan_opts *opts)
509{ 586{
587 struct list_head *chans = &line->chan_list;
510 struct chan *new, *chan; 588 struct chan *new, *chan;
511 char *in, *out; 589 char *in, *out;
512 590
513 if(!list_empty(chans)){ 591 if(!list_empty(chans)){
514 chan = list_entry(chans->next, struct chan, list); 592 chan = list_entry(chans->next, struct chan, list);
515 if(chan->pri >= pri) return(0); 593 free_chan(chans, 0);
516 free_chan(chans);
517 INIT_LIST_HEAD(chans); 594 INIT_LIST_HEAD(chans);
518 } 595 }
519 596
@@ -522,24 +599,30 @@ int parse_chan_pair(char *str, struct list_head *chans, int pri, int device,
522 in = str; 599 in = str;
523 *out = '\0'; 600 *out = '\0';
524 out++; 601 out++;
525 new = parse_chan(in, pri, device, opts); 602 new = parse_chan(line, in, device, opts);
526 if(new == NULL) return(-1); 603 if(new == NULL)
604 return -1;
605
527 new->input = 1; 606 new->input = 1;
528 list_add(&new->list, chans); 607 list_add(&new->list, chans);
529 608
530 new = parse_chan(out, pri, device, opts); 609 new = parse_chan(line, out, device, opts);
531 if(new == NULL) return(-1); 610 if(new == NULL)
611 return -1;
612
532 list_add(&new->list, chans); 613 list_add(&new->list, chans);
533 new->output = 1; 614 new->output = 1;
534 } 615 }
535 else { 616 else {
536 new = parse_chan(str, pri, device, opts); 617 new = parse_chan(line, str, device, opts);
537 if(new == NULL) return(-1); 618 if(new == NULL)
619 return -1;
620
538 list_add(&new->list, chans); 621 list_add(&new->list, chans);
539 new->input = 1; 622 new->input = 1;
540 new->output = 1; 623 new->output = 1;
541 } 624 }
542 return(0); 625 return 0;
543} 626}
544 627
545int chan_out_fd(struct list_head *chans) 628int chan_out_fd(struct list_head *chans)
@@ -550,9 +633,9 @@ int chan_out_fd(struct list_head *chans)
550 list_for_each(ele, chans){ 633 list_for_each(ele, chans){
551 chan = list_entry(ele, struct chan, list); 634 chan = list_entry(ele, struct chan, list);
552 if(chan->primary && chan->output) 635 if(chan->primary && chan->output)
553 return(chan->fd); 636 return chan->fd;
554 } 637 }
555 return(-1); 638 return -1;
556} 639}
557 640
558void chan_interrupt(struct list_head *chans, struct work_struct *task, 641void chan_interrupt(struct list_head *chans, struct work_struct *task,
@@ -567,9 +650,8 @@ void chan_interrupt(struct list_head *chans, struct work_struct *task,
567 chan = list_entry(ele, struct chan, list); 650 chan = list_entry(ele, struct chan, list);
568 if(!chan->input || (chan->ops->read == NULL)) continue; 651 if(!chan->input || (chan->ops->read == NULL)) continue;
569 do { 652 do {
570 if((tty != NULL) && 653 if (tty && !tty_buffer_request_room(tty, 1)) {
571 (tty->flip.count >= TTY_FLIPBUF_SIZE)){ 654 schedule_delayed_work(task, 1);
572 schedule_work(task);
573 goto out; 655 goto out;
574 } 656 }
575 err = chan->ops->read(chan->fd, &c, chan->data); 657 err = chan->ops->read(chan->fd, &c, chan->data);
@@ -582,29 +664,12 @@ void chan_interrupt(struct list_head *chans, struct work_struct *task,
582 if(chan->primary){ 664 if(chan->primary){
583 if(tty != NULL) 665 if(tty != NULL)
584 tty_hangup(tty); 666 tty_hangup(tty);
585 line_disable(tty, irq); 667 close_chan(chans, 1);
586 close_chan(chans);
587 free_chan(chans);
588 return; 668 return;
589 } 669 }
590 else { 670 else close_one_chan(chan, 1);
591 if(chan->ops->close != NULL)
592 chan->ops->close(chan->fd, chan->data);
593 free_one_chan(chan);
594 }
595 } 671 }
596 } 672 }
597 out: 673 out:
598 if(tty) tty_flip_buffer_push(tty); 674 if(tty) tty_flip_buffer_push(tty);
599} 675}
600
601/*
602 * Overrides for Emacs so that we follow Linus's tabbing style.
603 * Emacs will notice this stuff at the end of the file and automatically
604 * adjust the settings for this buffer only. This must remain at the end
605 * of the file.
606 * ---------------------------------------------------------------------------
607 * Local variables:
608 * c-file-style: "linux"
609 * End:
610 */
diff --git a/arch/um/drivers/daemon_kern.c b/arch/um/drivers/daemon_kern.c
index 30d285b266af..507e3cbac9d3 100644
--- a/arch/um/drivers/daemon_kern.c
+++ b/arch/um/drivers/daemon_kern.c
@@ -31,6 +31,10 @@ void daemon_init(struct net_device *dev, void *data)
31 dpri->fd = -1; 31 dpri->fd = -1;
32 dpri->control = -1; 32 dpri->control = -1;
33 dpri->dev = dev; 33 dpri->dev = dev;
34 /* We will free this pointer. If it contains crap we're burned. */
35 dpri->ctl_addr = NULL;
36 dpri->data_addr = NULL;
37 dpri->local_addr = NULL;
34 38
35 printk("daemon backend (uml_switch version %d) - %s:%s", 39 printk("daemon backend (uml_switch version %d) - %s:%s",
36 SWITCH_VERSION, dpri->sock_type, dpri->ctl_sock); 40 SWITCH_VERSION, dpri->sock_type, dpri->ctl_sock);
diff --git a/arch/um/drivers/daemon_user.c b/arch/um/drivers/daemon_user.c
index 1bb085b2824d..c944265955e2 100644
--- a/arch/um/drivers/daemon_user.c
+++ b/arch/um/drivers/daemon_user.c
@@ -158,10 +158,16 @@ static void daemon_remove(void *data)
158 struct daemon_data *pri = data; 158 struct daemon_data *pri = data;
159 159
160 os_close_file(pri->fd); 160 os_close_file(pri->fd);
161 pri->fd = -1;
161 os_close_file(pri->control); 162 os_close_file(pri->control);
163 pri->control = -1;
164
162 kfree(pri->data_addr); 165 kfree(pri->data_addr);
166 pri->data_addr = NULL;
163 kfree(pri->ctl_addr); 167 kfree(pri->ctl_addr);
168 pri->ctl_addr = NULL;
164 kfree(pri->local_addr); 169 kfree(pri->local_addr);
170 pri->local_addr = NULL;
165} 171}
166 172
167int daemon_user_write(int fd, void *buf, int len, struct daemon_data *pri) 173int daemon_user_write(int fd, void *buf, int len, struct daemon_data *pri)
diff --git a/arch/um/drivers/fd.c b/arch/um/drivers/fd.c
index 3296e86a03a5..c41f75e4acb5 100644
--- a/arch/um/drivers/fd.c
+++ b/arch/um/drivers/fd.c
@@ -11,6 +11,7 @@
11#include "user.h" 11#include "user.h"
12#include "user_util.h" 12#include "user_util.h"
13#include "chan_user.h" 13#include "chan_user.h"
14#include "os.h"
14 15
15struct fd_chan { 16struct fd_chan {
16 int fd; 17 int fd;
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index e0fdffa2d542..46ceb25a9959 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -23,8 +23,9 @@
23 23
24static irqreturn_t line_interrupt(int irq, void *data, struct pt_regs *unused) 24static irqreturn_t line_interrupt(int irq, void *data, struct pt_regs *unused)
25{ 25{
26 struct tty_struct *tty = data; 26 struct chan *chan = data;
27 struct line *line = tty->driver_data; 27 struct line *line = chan->line;
28 struct tty_struct *tty = line->tty;
28 29
29 if (line) 30 if (line)
30 chan_interrupt(&line->chan_list, &line->task, tty, irq); 31 chan_interrupt(&line->chan_list, &line->task, tty, irq);
@@ -33,10 +34,11 @@ static irqreturn_t line_interrupt(int irq, void *data, struct pt_regs *unused)
33 34
34static void line_timer_cb(void *arg) 35static void line_timer_cb(void *arg)
35{ 36{
36 struct tty_struct *tty = arg; 37 struct line *line = arg;
37 struct line *line = tty->driver_data;
38 38
39 line_interrupt(line->driver->read_irq, arg, NULL); 39 if(!line->throttled)
40 chan_interrupt(&line->chan_list, &line->task, line->tty,
41 line->driver->read_irq);
40} 42}
41 43
42/* Returns the free space inside the ring buffer of this line. 44/* Returns the free space inside the ring buffer of this line.
@@ -124,7 +126,8 @@ static int buffer_data(struct line *line, const char *buf, int len)
124 if (len < end){ 126 if (len < end){
125 memcpy(line->tail, buf, len); 127 memcpy(line->tail, buf, len);
126 line->tail += len; 128 line->tail += len;
127 } else { 129 }
130 else {
128 /* The circular buffer is wrapping */ 131 /* The circular buffer is wrapping */
129 memcpy(line->tail, buf, end); 132 memcpy(line->tail, buf, end);
130 buf += end; 133 buf += end;
@@ -170,7 +173,7 @@ static int flush_buffer(struct line *line)
170 } 173 }
171 174
172 count = line->tail - line->head; 175 count = line->tail - line->head;
173 n = write_chan(&line->chan_list, line->head, count, 176 n = write_chan(&line->chan_list, line->head, count,
174 line->driver->write_irq); 177 line->driver->write_irq);
175 178
176 if(n < 0) 179 if(n < 0)
@@ -227,7 +230,7 @@ int line_write(struct tty_struct *tty, const unsigned char *buf, int len)
227 if (err <= 0 && (err != -EAGAIN || !ret)) 230 if (err <= 0 && (err != -EAGAIN || !ret))
228 ret = err; 231 ret = err;
229 } else { 232 } else {
230 n = write_chan(&line->chan_list, buf, len, 233 n = write_chan(&line->chan_list, buf, len,
231 line->driver->write_irq); 234 line->driver->write_irq);
232 if (n < 0) { 235 if (n < 0) {
233 ret = n; 236 ret = n;
@@ -338,11 +341,36 @@ int line_ioctl(struct tty_struct *tty, struct file * file,
338 return ret; 341 return ret;
339} 342}
340 343
344void line_throttle(struct tty_struct *tty)
345{
346 struct line *line = tty->driver_data;
347
348 deactivate_chan(&line->chan_list, line->driver->read_irq);
349 line->throttled = 1;
350}
351
352void line_unthrottle(struct tty_struct *tty)
353{
354 struct line *line = tty->driver_data;
355
356 line->throttled = 0;
357 chan_interrupt(&line->chan_list, &line->task, tty,
358 line->driver->read_irq);
359
360 /* Maybe there is enough stuff pending that calling the interrupt
361 * throttles us again. In this case, line->throttled will be 1
362 * again and we shouldn't turn the interrupt back on.
363 */
364 if(!line->throttled)
365 reactivate_chan(&line->chan_list, line->driver->read_irq);
366}
367
341static irqreturn_t line_write_interrupt(int irq, void *data, 368static irqreturn_t line_write_interrupt(int irq, void *data,
342 struct pt_regs *unused) 369 struct pt_regs *unused)
343{ 370{
344 struct tty_struct *tty = data; 371 struct chan *chan = data;
345 struct line *line = tty->driver_data; 372 struct line *line = chan->line;
373 struct tty_struct *tty = line->tty;
346 int err; 374 int err;
347 375
348 /* Interrupts are enabled here because we registered the interrupt with 376 /* Interrupts are enabled here because we registered the interrupt with
@@ -364,7 +392,7 @@ static irqreturn_t line_write_interrupt(int irq, void *data,
364 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) && 392 if (test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags) &&
365 (tty->ldisc.write_wakeup != NULL)) 393 (tty->ldisc.write_wakeup != NULL))
366 (tty->ldisc.write_wakeup)(tty); 394 (tty->ldisc.write_wakeup)(tty);
367 395
368 /* BLOCKING mode 396 /* BLOCKING mode
369 * In blocking mode, everything sleeps on tty->write_wait. 397 * In blocking mode, everything sleeps on tty->write_wait.
370 * Sleeping in the console driver would break non-blocking 398 * Sleeping in the console driver would break non-blocking
@@ -376,53 +404,29 @@ static irqreturn_t line_write_interrupt(int irq, void *data,
376 return IRQ_HANDLED; 404 return IRQ_HANDLED;
377} 405}
378 406
379int line_setup_irq(int fd, int input, int output, struct tty_struct *tty) 407int line_setup_irq(int fd, int input, int output, struct line *line, void *data)
380{ 408{
381 struct line *line = tty->driver_data;
382 struct line_driver *driver = line->driver; 409 struct line_driver *driver = line->driver;
383 int err = 0, flags = SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM; 410 int err = 0, flags = SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM;
384 411
385 if (input) 412 if (input)
386 err = um_request_irq(driver->read_irq, fd, IRQ_READ, 413 err = um_request_irq(driver->read_irq, fd, IRQ_READ,
387 line_interrupt, flags, 414 line_interrupt, flags,
388 driver->read_irq_name, tty); 415 driver->read_irq_name, data);
389 if (err) 416 if (err)
390 return err; 417 return err;
391 if (output) 418 if (output)
392 err = um_request_irq(driver->write_irq, fd, IRQ_WRITE, 419 err = um_request_irq(driver->write_irq, fd, IRQ_WRITE,
393 line_write_interrupt, flags, 420 line_write_interrupt, flags,
394 driver->write_irq_name, tty); 421 driver->write_irq_name, data);
395 line->have_irq = 1; 422 line->have_irq = 1;
396 return err; 423 return err;
397} 424}
398 425
399void line_disable(struct tty_struct *tty, int current_irq) 426int line_open(struct line *lines, struct tty_struct *tty)
400{
401 struct line *line = tty->driver_data;
402
403 if(!line->have_irq)
404 return;
405
406 if(line->driver->read_irq == current_irq)
407 free_irq_later(line->driver->read_irq, tty);
408 else {
409 free_irq(line->driver->read_irq, tty);
410 }
411
412 if(line->driver->write_irq == current_irq)
413 free_irq_later(line->driver->write_irq, tty);
414 else {
415 free_irq(line->driver->write_irq, tty);
416 }
417
418 line->have_irq = 0;
419}
420
421int line_open(struct line *lines, struct tty_struct *tty,
422 struct chan_opts *opts)
423{ 427{
424 struct line *line; 428 struct line *line;
425 int err = 0; 429 int err = -ENODEV;
426 430
427 line = &lines[tty->index]; 431 line = &lines[tty->index];
428 tty->driver_data = line; 432 tty->driver_data = line;
@@ -430,31 +434,29 @@ int line_open(struct line *lines, struct tty_struct *tty,
430 /* The IRQ which takes this lock is not yet enabled and won't be run 434 /* The IRQ which takes this lock is not yet enabled and won't be run
431 * before the end, so we don't need to use spin_lock_irq.*/ 435 * before the end, so we don't need to use spin_lock_irq.*/
432 spin_lock(&line->lock); 436 spin_lock(&line->lock);
433 if (tty->count == 1) { 437
434 if (!line->valid) { 438 tty->driver_data = line;
435 err = -ENODEV; 439 line->tty = tty;
436 goto out; 440 if(!line->valid)
437 } 441 goto out;
438 if (list_empty(&line->chan_list)) { 442
439 err = parse_chan_pair(line->init_str, &line->chan_list, 443 if(tty->count == 1){
440 line->init_pri, tty->index, opts); 444 /* Here the device is opened, if necessary, and interrupt
441 if(err) goto out; 445 * is registered.
442 err = open_chan(&line->chan_list); 446 */
443 if(err) goto out; 447 enable_chan(line);
448 INIT_WORK(&line->task, line_timer_cb, line);
449
450 if(!line->sigio){
451 chan_enable_winch(&line->chan_list, tty);
452 line->sigio = 1;
444 } 453 }
445 /* Here the interrupt is registered.*/
446 enable_chan(&line->chan_list, tty);
447 INIT_WORK(&line->task, line_timer_cb, tty);
448 }
449 454
450 if(!line->sigio){ 455 chan_window_size(&line->chan_list, &tty->winsize.ws_row,
451 chan_enable_winch(&line->chan_list, tty); 456 &tty->winsize.ws_col);
452 line->sigio = 1;
453 } 457 }
454 chan_window_size(&line->chan_list, &tty->winsize.ws_row,
455 &tty->winsize.ws_col);
456 line->count++;
457 458
459 err = 0;
458out: 460out:
459 spin_unlock(&line->lock); 461 spin_unlock(&line->lock);
460 return err; 462 return err;
@@ -474,15 +476,14 @@ void line_close(struct tty_struct *tty, struct file * filp)
474 /* We ignore the error anyway! */ 476 /* We ignore the error anyway! */
475 flush_buffer(line); 477 flush_buffer(line);
476 478
477 line->count--; 479 if(tty->count == 1){
478 if (tty->count == 1) { 480 line->tty = NULL;
479 line_disable(tty, -1);
480 tty->driver_data = NULL; 481 tty->driver_data = NULL;
481 }
482 482
483 if((line->count == 0) && line->sigio){ 483 if(line->sigio){
484 unregister_winch(tty); 484 unregister_winch(tty);
485 line->sigio = 0; 485 line->sigio = 0;
486 }
486 } 487 }
487 488
488 spin_unlock_irq(&line->lock); 489 spin_unlock_irq(&line->lock);
@@ -493,17 +494,15 @@ void close_lines(struct line *lines, int nlines)
493 int i; 494 int i;
494 495
495 for(i = 0; i < nlines; i++) 496 for(i = 0; i < nlines; i++)
496 close_chan(&lines[i].chan_list); 497 close_chan(&lines[i].chan_list, 0);
497} 498}
498 499
499/* Common setup code for both startup command line and mconsole initialization. 500/* Common setup code for both startup command line and mconsole initialization.
500 * @lines contains the the array (of size @num) to modify; 501 * @lines contains the the array (of size @num) to modify;
501 * @init is the setup string; 502 * @init is the setup string;
502 * @all_allowed is a boolean saying if we can setup the whole @lines 503 */
503 * at once. For instance, it will be usually true for startup init. (where we
504 * can use con=xterm) and false for mconsole.*/
505 504
506int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed) 505int line_setup(struct line *lines, unsigned int num, char *init)
507{ 506{
508 int i, n; 507 int i, n;
509 char *end; 508 char *end;
@@ -512,10 +511,11 @@ int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed
512 /* We said con=/ssl= instead of con#=, so we are configuring all 511 /* We said con=/ssl= instead of con#=, so we are configuring all
513 * consoles at once.*/ 512 * consoles at once.*/
514 n = -1; 513 n = -1;
515 } else { 514 }
515 else {
516 n = simple_strtoul(init, &end, 0); 516 n = simple_strtoul(init, &end, 0);
517 if(*end != '='){ 517 if(*end != '='){
518 printk(KERN_ERR "line_setup failed to parse \"%s\"\n", 518 printk(KERN_ERR "line_setup failed to parse \"%s\"\n",
519 init); 519 init);
520 return 0; 520 return 0;
521 } 521 }
@@ -527,8 +527,9 @@ int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed
527 printk("line_setup - %d out of range ((0 ... %d) allowed)\n", 527 printk("line_setup - %d out of range ((0 ... %d) allowed)\n",
528 n, num - 1); 528 n, num - 1);
529 return 0; 529 return 0;
530 } else if (n >= 0){ 530 }
531 if (lines[n].count > 0) { 531 else if (n >= 0){
532 if (lines[n].tty != NULL) {
532 printk("line_setup - device %d is open\n", n); 533 printk("line_setup - device %d is open\n", n);
533 return 0; 534 return 0;
534 } 535 }
@@ -539,13 +540,10 @@ int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed
539 else { 540 else {
540 lines[n].init_str = init; 541 lines[n].init_str = init;
541 lines[n].valid = 1; 542 lines[n].valid = 1;
542 } 543 }
543 } 544 }
544 } else if(!all_allowed){ 545 }
545 printk("line_setup - can't configure all devices from " 546 else {
546 "mconsole\n");
547 return 0;
548 } else {
549 for(i = 0; i < num; i++){ 547 for(i = 0; i < num; i++){
550 if(lines[i].init_pri <= INIT_ALL){ 548 if(lines[i].init_pri <= INIT_ALL){
551 lines[i].init_pri = INIT_ALL; 549 lines[i].init_pri = INIT_ALL;
@@ -557,18 +555,33 @@ int line_setup(struct line *lines, unsigned int num, char *init, int all_allowed
557 } 555 }
558 } 556 }
559 } 557 }
560 return 1; 558 return n == -1 ? num : n;
561} 559}
562 560
563int line_config(struct line *lines, unsigned int num, char *str) 561int line_config(struct line *lines, unsigned int num, char *str,
562 struct chan_opts *opts)
564{ 563{
565 char *new = uml_strdup(str); 564 struct line *line;
565 char *new;
566 int n;
566 567
568 if(*str == '='){
569 printk("line_config - can't configure all devices from "
570 "mconsole\n");
571 return 1;
572 }
573
574 new = kstrdup(str, GFP_KERNEL);
567 if(new == NULL){ 575 if(new == NULL){
568 printk("line_config - uml_strdup failed\n"); 576 printk("line_config - kstrdup failed\n");
569 return -ENOMEM; 577 return 1;
570 } 578 }
571 return !line_setup(lines, num, new, 0); 579 n = line_setup(lines, num, new);
580 if(n < 0)
581 return 1;
582
583 line = &lines[n];
584 return parse_chan_pair(line->init_str, line, n, opts);
572} 585}
573 586
574int line_get_config(char *name, struct line *lines, unsigned int num, char *str, 587int line_get_config(char *name, struct line *lines, unsigned int num, char *str,
@@ -594,7 +607,7 @@ int line_get_config(char *name, struct line *lines, unsigned int num, char *str,
594 spin_lock(&line->lock); 607 spin_lock(&line->lock);
595 if(!line->valid) 608 if(!line->valid)
596 CONFIG_CHUNK(str, size, n, "none", 1); 609 CONFIG_CHUNK(str, size, n, "none", 1);
597 else if(line->count == 0) 610 else if(line->tty == NULL)
598 CONFIG_CHUNK(str, size, n, line->init_str, 1); 611 CONFIG_CHUNK(str, size, n, line->init_str, 1);
599 else n = chan_config_string(&line->chan_list, str, size, error_out); 612 else n = chan_config_string(&line->chan_list, str, size, error_out);
600 spin_unlock(&line->lock); 613 spin_unlock(&line->lock);
@@ -619,14 +632,18 @@ int line_id(char **str, int *start_out, int *end_out)
619 632
620int line_remove(struct line *lines, unsigned int num, int n) 633int line_remove(struct line *lines, unsigned int num, int n)
621{ 634{
635 int err;
622 char config[sizeof("conxxxx=none\0")]; 636 char config[sizeof("conxxxx=none\0")];
623 637
624 sprintf(config, "%d=none", n); 638 sprintf(config, "%d=none", n);
625 return !line_setup(lines, num, config, 0); 639 err = line_setup(lines, num, config);
640 if(err >= 0)
641 err = 0;
642 return err;
626} 643}
627 644
628struct tty_driver *line_register_devfs(struct lines *set, 645struct tty_driver *line_register_devfs(struct lines *set,
629 struct line_driver *line_driver, 646 struct line_driver *line_driver,
630 struct tty_operations *ops, struct line *lines, 647 struct tty_operations *ops, struct line *lines,
631 int nlines) 648 int nlines)
632{ 649{
@@ -655,7 +672,7 @@ struct tty_driver *line_register_devfs(struct lines *set,
655 } 672 }
656 673
657 for(i = 0; i < nlines; i++){ 674 for(i = 0; i < nlines; i++){
658 if(!lines[i].valid) 675 if(!lines[i].valid)
659 tty_unregister_device(driver, i); 676 tty_unregister_device(driver, i);
660 } 677 }
661 678
@@ -663,24 +680,28 @@ struct tty_driver *line_register_devfs(struct lines *set,
663 return driver; 680 return driver;
664} 681}
665 682
666static spinlock_t winch_handler_lock; 683static DEFINE_SPINLOCK(winch_handler_lock);
667LIST_HEAD(winch_handlers); 684static LIST_HEAD(winch_handlers);
668 685
669void lines_init(struct line *lines, int nlines) 686void lines_init(struct line *lines, int nlines, struct chan_opts *opts)
670{ 687{
671 struct line *line; 688 struct line *line;
672 int i; 689 int i;
673 690
674 spin_lock_init(&winch_handler_lock);
675 for(i = 0; i < nlines; i++){ 691 for(i = 0; i < nlines; i++){
676 line = &lines[i]; 692 line = &lines[i];
677 INIT_LIST_HEAD(&line->chan_list); 693 INIT_LIST_HEAD(&line->chan_list);
678 spin_lock_init(&line->lock); 694
679 if(line->init_str != NULL){ 695 if(line->init_str == NULL)
680 line->init_str = uml_strdup(line->init_str); 696 continue;
681 if(line->init_str == NULL) 697
682 printk("lines_init - uml_strdup returned " 698 line->init_str = kstrdup(line->init_str, GFP_KERNEL);
683 "NULL\n"); 699 if(line->init_str == NULL)
700 printk("lines_init - kstrdup returned NULL\n");
701
702 if(parse_chan_pair(line->init_str, line, i, opts)){
703 printk("parse_chan_pair failed for device %d\n", i);
704 line->valid = 0;
684 } 705 }
685 } 706 }
686} 707}
@@ -717,8 +738,7 @@ irqreturn_t winch_interrupt(int irq, void *data, struct pt_regs *unused)
717 tty = winch->tty; 738 tty = winch->tty;
718 if (tty != NULL) { 739 if (tty != NULL) {
719 line = tty->driver_data; 740 line = tty->driver_data;
720 chan_window_size(&line->chan_list, 741 chan_window_size(&line->chan_list, &tty->winsize.ws_row,
721 &tty->winsize.ws_row,
722 &tty->winsize.ws_col); 742 &tty->winsize.ws_col);
723 kill_pg(tty->pgrp, SIGWINCH, 1); 743 kill_pg(tty->pgrp, SIGWINCH, 1);
724 } 744 }
@@ -749,60 +769,54 @@ void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty)
749 spin_unlock(&winch_handler_lock); 769 spin_unlock(&winch_handler_lock);
750 770
751 if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt, 771 if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt,
752 SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM, 772 SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM,
753 "winch", winch) < 0) 773 "winch", winch) < 0)
754 printk("register_winch_irq - failed to register IRQ\n"); 774 printk("register_winch_irq - failed to register IRQ\n");
755} 775}
756 776
777static void free_winch(struct winch *winch)
778{
779 list_del(&winch->list);
780
781 if(winch->pid != -1)
782 os_kill_process(winch->pid, 1);
783 if(winch->fd != -1)
784 os_close_file(winch->fd);
785
786 free_irq(WINCH_IRQ, winch);
787 kfree(winch);
788}
789
757static void unregister_winch(struct tty_struct *tty) 790static void unregister_winch(struct tty_struct *tty)
758{ 791{
759 struct list_head *ele; 792 struct list_head *ele;
760 struct winch *winch, *found = NULL; 793 struct winch *winch;
761 794
762 spin_lock(&winch_handler_lock); 795 spin_lock(&winch_handler_lock);
796
763 list_for_each(ele, &winch_handlers){ 797 list_for_each(ele, &winch_handlers){
764 winch = list_entry(ele, struct winch, list); 798 winch = list_entry(ele, struct winch, list);
765 if(winch->tty == tty){ 799 if(winch->tty == tty){
766 found = winch; 800 free_winch(winch);
767 break; 801 break;
768 } 802 }
769 } 803 }
770 if(found == NULL)
771 goto err;
772
773 list_del(&winch->list);
774 spin_unlock(&winch_handler_lock);
775
776 if(winch->pid != -1)
777 os_kill_process(winch->pid, 1);
778
779 free_irq(WINCH_IRQ, winch);
780 kfree(winch);
781
782 return;
783err:
784 spin_unlock(&winch_handler_lock); 804 spin_unlock(&winch_handler_lock);
785} 805}
786 806
787/* XXX: No lock as it's an exitcall... is this valid? Depending on cleanup
788 * order... are we sure that nothing else is done on the list? */
789static void winch_cleanup(void) 807static void winch_cleanup(void)
790{ 808{
791 struct list_head *ele; 809 struct list_head *ele, *next;
792 struct winch *winch; 810 struct winch *winch;
793 811
794 list_for_each(ele, &winch_handlers){ 812 spin_lock(&winch_handler_lock);
813
814 list_for_each_safe(ele, next, &winch_handlers){
795 winch = list_entry(ele, struct winch, list); 815 winch = list_entry(ele, struct winch, list);
796 if(winch->fd != -1){ 816 free_winch(winch);
797 /* Why is this different from the above free_irq(),
798 * which deactivates SIGIO? This searches the FD
799 * somewhere else and removes it from the list... */
800 deactivate_fd(winch->fd, WINCH_IRQ);
801 os_close_file(winch->fd);
802 }
803 if(winch->pid != -1)
804 os_kill_process(winch->pid, 1);
805 } 817 }
818
819 spin_unlock(&winch_handler_lock);
806} 820}
807__uml_exitcall(winch_cleanup); 821__uml_exitcall(winch_cleanup);
808 822
@@ -811,10 +825,10 @@ char *add_xterm_umid(char *base)
811 char *umid, *title; 825 char *umid, *title;
812 int len; 826 int len;
813 827
814 umid = get_umid(1); 828 umid = get_umid();
815 if(umid == NULL) 829 if(*umid == '\0')
816 return base; 830 return base;
817 831
818 len = strlen(base) + strlen(" ()") + strlen(umid) + 1; 832 len = strlen(base) + strlen(" ()") + strlen(umid) + 1;
819 title = kmalloc(len, GFP_KERNEL); 833 title = kmalloc(len, GFP_KERNEL);
820 if(title == NULL){ 834 if(title == NULL){
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 12c95368124a..e3d576567172 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -20,6 +20,7 @@
20#include "linux/namei.h" 20#include "linux/namei.h"
21#include "linux/proc_fs.h" 21#include "linux/proc_fs.h"
22#include "linux/syscalls.h" 22#include "linux/syscalls.h"
23#include "linux/console.h"
23#include "asm/irq.h" 24#include "asm/irq.h"
24#include "asm/uaccess.h" 25#include "asm/uaccess.h"
25#include "user_util.h" 26#include "user_util.h"
@@ -34,7 +35,7 @@
34#include "irq_kern.h" 35#include "irq_kern.h"
35#include "choose-mode.h" 36#include "choose-mode.h"
36 37
37static int do_unlink_socket(struct notifier_block *notifier, 38static int do_unlink_socket(struct notifier_block *notifier,
38 unsigned long what, void *data) 39 unsigned long what, void *data)
39{ 40{
40 return(mconsole_unlink_socket()); 41 return(mconsole_unlink_socket());
@@ -46,12 +47,12 @@ static struct notifier_block reboot_notifier = {
46 .priority = 0, 47 .priority = 0,
47}; 48};
48 49
49/* Safe without explicit locking for now. Tasklets provide their own 50/* Safe without explicit locking for now. Tasklets provide their own
50 * locking, and the interrupt handler is safe because it can't interrupt 51 * locking, and the interrupt handler is safe because it can't interrupt
51 * itself and it can only happen on CPU 0. 52 * itself and it can only happen on CPU 0.
52 */ 53 */
53 54
54LIST_HEAD(mc_requests); 55static LIST_HEAD(mc_requests);
55 56
56static void mc_work_proc(void *unused) 57static void mc_work_proc(void *unused)
57{ 58{
@@ -60,7 +61,7 @@ static void mc_work_proc(void *unused)
60 61
61 while(!list_empty(&mc_requests)){ 62 while(!list_empty(&mc_requests)){
62 local_save_flags(flags); 63 local_save_flags(flags);
63 req = list_entry(mc_requests.next, struct mconsole_entry, 64 req = list_entry(mc_requests.next, struct mconsole_entry,
64 list); 65 list);
65 list_del(&req->list); 66 list_del(&req->list);
66 local_irq_restore(flags); 67 local_irq_restore(flags);
@@ -69,7 +70,7 @@ static void mc_work_proc(void *unused)
69 } 70 }
70} 71}
71 72
72DECLARE_WORK(mconsole_work, mc_work_proc, NULL); 73static DECLARE_WORK(mconsole_work, mc_work_proc, NULL);
73 74
74static irqreturn_t mconsole_interrupt(int irq, void *dev_id, 75static irqreturn_t mconsole_interrupt(int irq, void *dev_id,
75 struct pt_regs *regs) 76 struct pt_regs *regs)
@@ -103,8 +104,8 @@ void mconsole_version(struct mc_request *req)
103{ 104{
104 char version[256]; 105 char version[256];
105 106
106 sprintf(version, "%s %s %s %s %s", system_utsname.sysname, 107 sprintf(version, "%s %s %s %s %s", system_utsname.sysname,
107 system_utsname.nodename, system_utsname.release, 108 system_utsname.nodename, system_utsname.release,
108 system_utsname.version, system_utsname.machine); 109 system_utsname.version, system_utsname.machine);
109 mconsole_reply(req, version, 0, 0); 110 mconsole_reply(req, version, 0, 0);
110} 111}
@@ -348,7 +349,7 @@ static struct mc_device *mconsole_find_dev(char *name)
348 349
349#define CONFIG_BUF_SIZE 64 350#define CONFIG_BUF_SIZE 64
350 351
351static void mconsole_get_config(int (*get_config)(char *, char *, int, 352static void mconsole_get_config(int (*get_config)(char *, char *, int,
352 char **), 353 char **),
353 struct mc_request *req, char *name) 354 struct mc_request *req, char *name)
354{ 355{
@@ -389,7 +390,6 @@ static void mconsole_get_config(int (*get_config)(char *, char *, int,
389 out: 390 out:
390 if(buf != default_buf) 391 if(buf != default_buf)
391 kfree(buf); 392 kfree(buf);
392
393} 393}
394 394
395void mconsole_config(struct mc_request *req) 395void mconsole_config(struct mc_request *req)
@@ -420,9 +420,9 @@ void mconsole_config(struct mc_request *req)
420 420
421void mconsole_remove(struct mc_request *req) 421void mconsole_remove(struct mc_request *req)
422{ 422{
423 struct mc_device *dev; 423 struct mc_device *dev;
424 char *ptr = req->request.data, *err_msg = ""; 424 char *ptr = req->request.data, *err_msg = "";
425 char error[256]; 425 char error[256];
426 int err, start, end, n; 426 int err, start, end, n;
427 427
428 ptr += strlen("remove"); 428 ptr += strlen("remove");
@@ -433,37 +433,112 @@ void mconsole_remove(struct mc_request *req)
433 return; 433 return;
434 } 434 }
435 435
436 ptr = &ptr[strlen(dev->name)]; 436 ptr = &ptr[strlen(dev->name)];
437 437
438 err = 1; 438 err = 1;
439 n = (*dev->id)(&ptr, &start, &end); 439 n = (*dev->id)(&ptr, &start, &end);
440 if(n < 0){ 440 if(n < 0){
441 err_msg = "Couldn't parse device number"; 441 err_msg = "Couldn't parse device number";
442 goto out; 442 goto out;
443 } 443 }
444 else if((n < start) || (n > end)){ 444 else if((n < start) || (n > end)){
445 sprintf(error, "Invalid device number - must be between " 445 sprintf(error, "Invalid device number - must be between "
446 "%d and %d", start, end); 446 "%d and %d", start, end);
447 err_msg = error; 447 err_msg = error;
448 goto out; 448 goto out;
449 } 449 }
450 450
451 err = (*dev->remove)(n); 451 err = (*dev->remove)(n);
452 switch(err){ 452 switch(err){
453 case -ENODEV: 453 case -ENODEV:
454 err_msg = "Device doesn't exist"; 454 err_msg = "Device doesn't exist";
455 break; 455 break;
456 case -EBUSY: 456 case -EBUSY:
457 err_msg = "Device is currently open"; 457 err_msg = "Device is currently open";
458 break; 458 break;
459 default: 459 default:
460 break; 460 break;
461 } 461 }
462 out: 462out:
463 mconsole_reply(req, err_msg, err, 0); 463 mconsole_reply(req, err_msg, err, 0);
464} 464}
465 465
466static DEFINE_SPINLOCK(console_lock);
467static LIST_HEAD(clients);
468static char console_buf[MCONSOLE_MAX_DATA];
469static int console_index = 0;
470
471static void console_write(struct console *console, const char *string,
472 unsigned len)
473{
474 struct list_head *ele;
475 int n;
476
477 if(list_empty(&clients))
478 return;
479
480 while(1){
481 n = min(len, ARRAY_SIZE(console_buf) - console_index);
482 strncpy(&console_buf[console_index], string, n);
483 console_index += n;
484 string += n;
485 len -= n;
486 if(len == 0)
487 return;
488
489 list_for_each(ele, &clients){
490 struct mconsole_entry *entry;
491
492 entry = list_entry(ele, struct mconsole_entry, list);
493 mconsole_reply_len(&entry->request, console_buf,
494 console_index, 0, 1);
495 }
496
497 console_index = 0;
498 }
499}
500
501static struct console mc_console = { .name = "mc",
502 .write = console_write,
503 .flags = CON_ENABLED,
504 .index = -1 };
505
506static int mc_add_console(void)
507{
508 register_console(&mc_console);
509 return 0;
510}
511
512late_initcall(mc_add_console);
513
514static void with_console(struct mc_request *req, void (*proc)(void *),
515 void *arg)
516{
517 struct mconsole_entry entry;
518 unsigned long flags;
519
520 INIT_LIST_HEAD(&entry.list);
521 entry.request = *req;
522 list_add(&entry.list, &clients);
523 spin_lock_irqsave(&console_lock, flags);
524
525 (*proc)(arg);
526
527 mconsole_reply_len(req, console_buf, console_index, 0, 0);
528 console_index = 0;
529
530 spin_unlock_irqrestore(&console_lock, flags);
531 list_del(&entry.list);
532}
533
466#ifdef CONFIG_MAGIC_SYSRQ 534#ifdef CONFIG_MAGIC_SYSRQ
535static void sysrq_proc(void *arg)
536{
537 char *op = arg;
538
539 handle_sysrq(*op, &current->thread.regs, NULL);
540}
541
467void mconsole_sysrq(struct mc_request *req) 542void mconsole_sysrq(struct mc_request *req)
468{ 543{
469 char *ptr = req->request.data; 544 char *ptr = req->request.data;
@@ -471,8 +546,13 @@ void mconsole_sysrq(struct mc_request *req)
471 ptr += strlen("sysrq"); 546 ptr += strlen("sysrq");
472 while(isspace(*ptr)) ptr++; 547 while(isspace(*ptr)) ptr++;
473 548
474 mconsole_reply(req, "", 0, 0); 549 /* With 'b', the system will shut down without a chance to reply,
475 handle_sysrq(*ptr, &current->thread.regs, NULL); 550 * so in this case, we reply first.
551 */
552 if(*ptr == 'b')
553 mconsole_reply(req, "", 0, 0);
554
555 with_console(req, sysrq_proc, ptr);
476} 556}
477#else 557#else
478void mconsole_sysrq(struct mc_request *req) 558void mconsole_sysrq(struct mc_request *req)
@@ -481,6 +561,14 @@ void mconsole_sysrq(struct mc_request *req)
481} 561}
482#endif 562#endif
483 563
564static void stack_proc(void *arg)
565{
566 struct task_struct *from = current, *to = arg;
567
568 to->thread.saved_task = from;
569 switch_to(from, to, from);
570}
571
484/* Mconsole stack trace 572/* Mconsole stack trace
485 * Added by Allan Graves, Jeff Dike 573 * Added by Allan Graves, Jeff Dike
486 * Dumps a stacks registers to the linux console. 574 * Dumps a stacks registers to the linux console.
@@ -488,37 +576,34 @@ void mconsole_sysrq(struct mc_request *req)
488 */ 576 */
489void do_stack(struct mc_request *req) 577void do_stack(struct mc_request *req)
490{ 578{
491 char *ptr = req->request.data; 579 char *ptr = req->request.data;
492 int pid_requested= -1; 580 int pid_requested= -1;
493 struct task_struct *from = NULL; 581 struct task_struct *from = NULL;
494 struct task_struct *to = NULL; 582 struct task_struct *to = NULL;
495 583
496 /* Would be nice: 584 /* Would be nice:
497 * 1) Send showregs output to mconsole. 585 * 1) Send showregs output to mconsole.
498 * 2) Add a way to stack dump all pids. 586 * 2) Add a way to stack dump all pids.
499 */ 587 */
500 588
501 ptr += strlen("stack"); 589 ptr += strlen("stack");
502 while(isspace(*ptr)) ptr++; 590 while(isspace(*ptr)) ptr++;
503
504 /* Should really check for multiple pids or reject bad args here */
505 /* What do the arguments in mconsole_reply mean? */
506 if(sscanf(ptr, "%d", &pid_requested) == 0){
507 mconsole_reply(req, "Please specify a pid", 1, 0);
508 return;
509 }
510 591
511 from = current; 592 /* Should really check for multiple pids or reject bad args here */
512 to = find_task_by_pid(pid_requested); 593 /* What do the arguments in mconsole_reply mean? */
594 if(sscanf(ptr, "%d", &pid_requested) == 0){
595 mconsole_reply(req, "Please specify a pid", 1, 0);
596 return;
597 }
513 598
514 if((to == NULL) || (pid_requested == 0)) { 599 from = current;
515 mconsole_reply(req, "Couldn't find that pid", 1, 0);
516 return;
517 }
518 to->thread.saved_task = current;
519 600
520 switch_to(from, to, from); 601 to = find_task_by_pid(pid_requested);
521 mconsole_reply(req, "Stack Dumped to console and message log", 0, 0); 602 if((to == NULL) || (pid_requested == 0)) {
603 mconsole_reply(req, "Couldn't find that pid", 1, 0);
604 return;
605 }
606 with_console(req, stack_proc, to);
522} 607}
523 608
524void mconsole_stack(struct mc_request *req) 609void mconsole_stack(struct mc_request *req)
@@ -534,9 +619,9 @@ void mconsole_stack(struct mc_request *req)
534/* Changed by mconsole_setup, which is __setup, and called before SMP is 619/* Changed by mconsole_setup, which is __setup, and called before SMP is
535 * active. 620 * active.
536 */ 621 */
537static char *notify_socket = NULL; 622static char *notify_socket = NULL;
538 623
539int mconsole_init(void) 624static int mconsole_init(void)
540{ 625{
541 /* long to avoid size mismatch warnings from gcc */ 626 /* long to avoid size mismatch warnings from gcc */
542 long sock; 627 long sock;
@@ -563,16 +648,16 @@ int mconsole_init(void)
563 } 648 }
564 649
565 if(notify_socket != NULL){ 650 if(notify_socket != NULL){
566 notify_socket = uml_strdup(notify_socket); 651 notify_socket = kstrdup(notify_socket, GFP_KERNEL);
567 if(notify_socket != NULL) 652 if(notify_socket != NULL)
568 mconsole_notify(notify_socket, MCONSOLE_SOCKET, 653 mconsole_notify(notify_socket, MCONSOLE_SOCKET,
569 mconsole_socket_name, 654 mconsole_socket_name,
570 strlen(mconsole_socket_name) + 1); 655 strlen(mconsole_socket_name) + 1);
571 else printk(KERN_ERR "mconsole_setup failed to strdup " 656 else printk(KERN_ERR "mconsole_setup failed to strdup "
572 "string\n"); 657 "string\n");
573 } 658 }
574 659
575 printk("mconsole (version %d) initialized on %s\n", 660 printk("mconsole (version %d) initialized on %s\n",
576 MCONSOLE_VERSION, mconsole_socket_name); 661 MCONSOLE_VERSION, mconsole_socket_name);
577 return(0); 662 return(0);
578} 663}
@@ -585,7 +670,7 @@ static int write_proc_mconsole(struct file *file, const char __user *buffer,
585 char *buf; 670 char *buf;
586 671
587 buf = kmalloc(count + 1, GFP_KERNEL); 672 buf = kmalloc(count + 1, GFP_KERNEL);
588 if(buf == NULL) 673 if(buf == NULL)
589 return(-ENOMEM); 674 return(-ENOMEM);
590 675
591 if(copy_from_user(buf, buffer, count)){ 676 if(copy_from_user(buf, buffer, count)){
@@ -661,7 +746,7 @@ static int notify_panic(struct notifier_block *self, unsigned long unused1,
661 746
662 if(notify_socket == NULL) return(0); 747 if(notify_socket == NULL) return(0);
663 748
664 mconsole_notify(notify_socket, MCONSOLE_PANIC, message, 749 mconsole_notify(notify_socket, MCONSOLE_PANIC, message,
665 strlen(message) + 1); 750 strlen(message) + 1);
666 return(0); 751 return(0);
667} 752}
@@ -686,14 +771,3 @@ char *mconsole_notify_socket(void)
686} 771}
687 772
688EXPORT_SYMBOL(mconsole_notify_socket); 773EXPORT_SYMBOL(mconsole_notify_socket);
689
690/*
691 * Overrides for Emacs so that we follow Linus's tabbing style.
692 * Emacs will notice this stuff at the end of the file and automatically
693 * adjust the settings for this buffer only. This must remain at the end
694 * of the file.
695 * ---------------------------------------------------------------------------
696 * Local variables:
697 * c-file-style: "linux"
698 * End:
699 */
diff --git a/arch/um/drivers/mconsole_user.c b/arch/um/drivers/mconsole_user.c
index 310c1f823f26..4b109fe7fff8 100644
--- a/arch/um/drivers/mconsole_user.c
+++ b/arch/um/drivers/mconsole_user.c
@@ -122,12 +122,12 @@ int mconsole_get_request(int fd, struct mc_request *req)
122 return(1); 122 return(1);
123} 123}
124 124
125int mconsole_reply(struct mc_request *req, char *str, int err, int more) 125int mconsole_reply_len(struct mc_request *req, const char *str, int total,
126 int err, int more)
126{ 127{
127 struct mconsole_reply reply; 128 struct mconsole_reply reply;
128 int total, len, n; 129 int len, n;
129 130
130 total = strlen(str);
131 do { 131 do {
132 reply.err = err; 132 reply.err = err;
133 133
@@ -155,6 +155,12 @@ int mconsole_reply(struct mc_request *req, char *str, int err, int more)
155 return(0); 155 return(0);
156} 156}
157 157
158int mconsole_reply(struct mc_request *req, const char *str, int err, int more)
159{
160 return mconsole_reply_len(req, str, strlen(str), err, more);
161}
162
163
158int mconsole_unlink_socket(void) 164int mconsole_unlink_socket(void)
159{ 165{
160 unlink(mconsole_socket_name); 166 unlink(mconsole_socket_name);
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 84c73a300acb..8ebb2241ad42 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -34,7 +34,7 @@
34#define DRIVER_NAME "uml-netdev" 34#define DRIVER_NAME "uml-netdev"
35 35
36static DEFINE_SPINLOCK(opened_lock); 36static DEFINE_SPINLOCK(opened_lock);
37LIST_HEAD(opened); 37static LIST_HEAD(opened);
38 38
39static int uml_net_rx(struct net_device *dev) 39static int uml_net_rx(struct net_device *dev)
40{ 40{
@@ -68,6 +68,11 @@ static int uml_net_rx(struct net_device *dev)
68 return pkt_len; 68 return pkt_len;
69} 69}
70 70
71static void uml_dev_close(void* dev)
72{
73 dev_close( (struct net_device *) dev);
74}
75
71irqreturn_t uml_net_interrupt(int irq, void *dev_id, struct pt_regs *regs) 76irqreturn_t uml_net_interrupt(int irq, void *dev_id, struct pt_regs *regs)
72{ 77{
73 struct net_device *dev = dev_id; 78 struct net_device *dev = dev_id;
@@ -80,15 +85,21 @@ irqreturn_t uml_net_interrupt(int irq, void *dev_id, struct pt_regs *regs)
80 spin_lock(&lp->lock); 85 spin_lock(&lp->lock);
81 while((err = uml_net_rx(dev)) > 0) ; 86 while((err = uml_net_rx(dev)) > 0) ;
82 if(err < 0) { 87 if(err < 0) {
88 DECLARE_WORK(close_work, uml_dev_close, dev);
83 printk(KERN_ERR 89 printk(KERN_ERR
84 "Device '%s' read returned %d, shutting it down\n", 90 "Device '%s' read returned %d, shutting it down\n",
85 dev->name, err); 91 dev->name, err);
86 dev_close(dev); 92 /* dev_close can't be called in interrupt context, and takes
93 * again lp->lock.
94 * And dev_close() can be safely called multiple times on the
95 * same device, since it tests for (dev->flags & IFF_UP). So
96 * there's no harm in delaying the device shutdown. */
97 schedule_work(&close_work);
87 goto out; 98 goto out;
88 } 99 }
89 reactivate_fd(lp->fd, UM_ETH_IRQ); 100 reactivate_fd(lp->fd, UM_ETH_IRQ);
90 101
91 out: 102out:
92 spin_unlock(&lp->lock); 103 spin_unlock(&lp->lock);
93 return(IRQ_HANDLED); 104 return(IRQ_HANDLED);
94} 105}
@@ -150,6 +161,7 @@ static int uml_net_close(struct net_device *dev)
150 if(lp->close != NULL) 161 if(lp->close != NULL)
151 (*lp->close)(lp->fd, &lp->user); 162 (*lp->close)(lp->fd, &lp->user);
152 lp->fd = -1; 163 lp->fd = -1;
164 list_del(&lp->list);
153 165
154 spin_unlock(&lp->lock); 166 spin_unlock(&lp->lock);
155 return 0; 167 return 0;
@@ -266,7 +278,7 @@ void uml_net_user_timer_expire(unsigned long _conn)
266} 278}
267 279
268static DEFINE_SPINLOCK(devices_lock); 280static DEFINE_SPINLOCK(devices_lock);
269static struct list_head devices = LIST_HEAD_INIT(devices); 281static LIST_HEAD(devices);
270 282
271static struct platform_driver uml_net_driver = { 283static struct platform_driver uml_net_driver = {
272 .driver = { 284 .driver = {
@@ -316,6 +328,11 @@ static int eth_configure(int n, void *init, char *mac,
316 return 1; 328 return 1;
317 } 329 }
318 330
331 lp = dev->priv;
332 /* This points to the transport private data. It's still clear, but we
333 * must memset it to 0 *now*. Let's help the drivers. */
334 memset(lp, 0, size);
335
319 /* sysfs register */ 336 /* sysfs register */
320 if (!driver_registered) { 337 if (!driver_registered) {
321 platform_driver_register(&uml_net_driver); 338 platform_driver_register(&uml_net_driver);
@@ -357,7 +374,6 @@ static int eth_configure(int n, void *init, char *mac,
357 free_netdev(dev); 374 free_netdev(dev);
358 return 1; 375 return 1;
359 } 376 }
360 lp = dev->priv;
361 377
362 /* lp.user is the first four bytes of the transport data, which 378 /* lp.user is the first four bytes of the transport data, which
363 * has already been initialized. This structure assignment will 379 * has already been initialized. This structure assignment will
@@ -586,7 +602,7 @@ static int net_config(char *str)
586 err = eth_parse(str, &n, &str); 602 err = eth_parse(str, &n, &str);
587 if(err) return(err); 603 if(err) return(err);
588 604
589 str = uml_strdup(str); 605 str = kstrdup(str, GFP_KERNEL);
590 if(str == NULL){ 606 if(str == NULL){
591 printk(KERN_ERR "net_config failed to strdup string\n"); 607 printk(KERN_ERR "net_config failed to strdup string\n");
592 return(-1); 608 return(-1);
@@ -715,6 +731,7 @@ static void close_devices(void)
715 731
716 list_for_each(ele, &opened){ 732 list_for_each(ele, &opened){
717 lp = list_entry(ele, struct uml_net_private, list); 733 lp = list_entry(ele, struct uml_net_private, list);
734 free_irq(lp->dev->irq, lp->dev);
718 if((lp->close != NULL) && (lp->fd >= 0)) 735 if((lp->close != NULL) && (lp->fd >= 0))
719 (*lp->close)(lp->fd, &lp->user); 736 (*lp->close)(lp->fd, &lp->user);
720 if(lp->remove != NULL) (*lp->remove)(&lp->user); 737 if(lp->remove != NULL) (*lp->remove)(&lp->user);
diff --git a/arch/um/drivers/ssl.c b/arch/um/drivers/ssl.c
index 62e04ecfada8..a32ef55cb244 100644
--- a/arch/um/drivers/ssl.c
+++ b/arch/um/drivers/ssl.c
@@ -69,7 +69,7 @@ static struct line_driver driver = {
69 .name = "ssl", 69 .name = "ssl",
70 .config = ssl_config, 70 .config = ssl_config,
71 .get_config = ssl_get_config, 71 .get_config = ssl_get_config,
72 .id = line_id, 72 .id = line_id,
73 .remove = ssl_remove, 73 .remove = ssl_remove,
74 }, 74 },
75}; 75};
@@ -84,26 +84,23 @@ static struct lines lines = LINES_INIT(NR_PORTS);
84 84
85static int ssl_config(char *str) 85static int ssl_config(char *str)
86{ 86{
87 return(line_config(serial_lines, 87 return line_config(serial_lines, ARRAY_SIZE(serial_lines), str, &opts);
88 sizeof(serial_lines)/sizeof(serial_lines[0]), str));
89} 88}
90 89
91static int ssl_get_config(char *dev, char *str, int size, char **error_out) 90static int ssl_get_config(char *dev, char *str, int size, char **error_out)
92{ 91{
93 return(line_get_config(dev, serial_lines, 92 return line_get_config(dev, serial_lines, ARRAY_SIZE(serial_lines), str,
94 sizeof(serial_lines)/sizeof(serial_lines[0]), 93 size, error_out);
95 str, size, error_out));
96} 94}
97 95
98static int ssl_remove(int n) 96static int ssl_remove(int n)
99{ 97{
100 return line_remove(serial_lines, 98 return line_remove(serial_lines, ARRAY_SIZE(serial_lines), n);
101 sizeof(serial_lines)/sizeof(serial_lines[0]), n);
102} 99}
103 100
104int ssl_open(struct tty_struct *tty, struct file *filp) 101int ssl_open(struct tty_struct *tty, struct file *filp)
105{ 102{
106 return line_open(serial_lines, tty, &opts); 103 return line_open(serial_lines, tty);
107} 104}
108 105
109#if 0 106#if 0
@@ -112,16 +109,6 @@ static void ssl_flush_buffer(struct tty_struct *tty)
112 return; 109 return;
113} 110}
114 111
115static void ssl_throttle(struct tty_struct * tty)
116{
117 printk(KERN_ERR "Someone should implement ssl_throttle\n");
118}
119
120static void ssl_unthrottle(struct tty_struct * tty)
121{
122 printk(KERN_ERR "Someone should implement ssl_unthrottle\n");
123}
124
125static void ssl_stop(struct tty_struct *tty) 112static void ssl_stop(struct tty_struct *tty)
126{ 113{
127 printk(KERN_ERR "Someone should implement ssl_stop\n"); 114 printk(KERN_ERR "Someone should implement ssl_stop\n");
@@ -148,9 +135,9 @@ static struct tty_operations ssl_ops = {
148 .flush_chars = line_flush_chars, 135 .flush_chars = line_flush_chars,
149 .set_termios = line_set_termios, 136 .set_termios = line_set_termios,
150 .ioctl = line_ioctl, 137 .ioctl = line_ioctl,
138 .throttle = line_throttle,
139 .unthrottle = line_unthrottle,
151#if 0 140#if 0
152 .throttle = ssl_throttle,
153 .unthrottle = ssl_unthrottle,
154 .stop = ssl_stop, 141 .stop = ssl_stop,
155 .start = ssl_start, 142 .start = ssl_start,
156 .hangup = ssl_hangup, 143 .hangup = ssl_hangup,
@@ -183,7 +170,7 @@ static int ssl_console_setup(struct console *co, char *options)
183{ 170{
184 struct line *line = &serial_lines[co->index]; 171 struct line *line = &serial_lines[co->index];
185 172
186 return console_open_chan(line,co,&opts); 173 return console_open_chan(line, co, &opts);
187} 174}
188 175
189static struct console ssl_cons = { 176static struct console ssl_cons = {
@@ -199,12 +186,13 @@ int ssl_init(void)
199{ 186{
200 char *new_title; 187 char *new_title;
201 188
202 printk(KERN_INFO "Initializing software serial port version %d\n", 189 printk(KERN_INFO "Initializing software serial port version %d\n",
203 ssl_version); 190 ssl_version);
204 ssl_driver = line_register_devfs(&lines, &driver, &ssl_ops, 191 ssl_driver = line_register_devfs(&lines, &driver, &ssl_ops,
205 serial_lines, ARRAY_SIZE(serial_lines)); 192 serial_lines,
193 ARRAY_SIZE(serial_lines));
206 194
207 lines_init(serial_lines, sizeof(serial_lines)/sizeof(serial_lines[0])); 195 lines_init(serial_lines, ARRAY_SIZE(serial_lines), &opts);
208 196
209 new_title = add_xterm_umid(opts.xterm_title); 197 new_title = add_xterm_umid(opts.xterm_title);
210 if (new_title != NULL) 198 if (new_title != NULL)
@@ -212,7 +200,7 @@ int ssl_init(void)
212 200
213 ssl_init_done = 1; 201 ssl_init_done = 1;
214 register_console(&ssl_cons); 202 register_console(&ssl_cons);
215 return(0); 203 return 0;
216} 204}
217late_initcall(ssl_init); 205late_initcall(ssl_init);
218 206
@@ -220,16 +208,13 @@ static void ssl_exit(void)
220{ 208{
221 if (!ssl_init_done) 209 if (!ssl_init_done)
222 return; 210 return;
223 close_lines(serial_lines, 211 close_lines(serial_lines, ARRAY_SIZE(serial_lines));
224 sizeof(serial_lines)/sizeof(serial_lines[0]));
225} 212}
226__uml_exitcall(ssl_exit); 213__uml_exitcall(ssl_exit);
227 214
228static int ssl_chan_setup(char *str) 215static int ssl_chan_setup(char *str)
229{ 216{
230 return(line_setup(serial_lines, 217 return line_setup(serial_lines, ARRAY_SIZE(serial_lines), str);
231 sizeof(serial_lines)/sizeof(serial_lines[0]),
232 str, 1));
233} 218}
234 219
235__setup("ssl", ssl_chan_setup); 220__setup("ssl", ssl_chan_setup);
diff --git a/arch/um/drivers/stdio_console.c b/arch/um/drivers/stdio_console.c
index 005aa6333b6e..61db8b2fc83f 100644
--- a/arch/um/drivers/stdio_console.c
+++ b/arch/um/drivers/stdio_console.c
@@ -75,7 +75,7 @@ static struct line_driver driver = {
75 .name = "con", 75 .name = "con",
76 .config = con_config, 76 .config = con_config,
77 .get_config = con_get_config, 77 .get_config = con_get_config,
78 .id = line_id, 78 .id = line_id,
79 .remove = con_remove, 79 .remove = con_remove,
80 }, 80 },
81}; 81};
@@ -86,28 +86,27 @@ static struct lines console_lines = LINES_INIT(MAX_TTYS);
86 * individual elements are protected by individual semaphores. 86 * individual elements are protected by individual semaphores.
87 */ 87 */
88struct line vts[MAX_TTYS] = { LINE_INIT(CONFIG_CON_ZERO_CHAN, &driver), 88struct line vts[MAX_TTYS] = { LINE_INIT(CONFIG_CON_ZERO_CHAN, &driver),
89 [ 1 ... MAX_TTYS - 1 ] = 89 [ 1 ... MAX_TTYS - 1 ] =
90 LINE_INIT(CONFIG_CON_CHAN, &driver) }; 90 LINE_INIT(CONFIG_CON_CHAN, &driver) };
91 91
92static int con_config(char *str) 92static int con_config(char *str)
93{ 93{
94 return(line_config(vts, sizeof(vts)/sizeof(vts[0]), str)); 94 return line_config(vts, ARRAY_SIZE(vts), str, &opts);
95} 95}
96 96
97static int con_get_config(char *dev, char *str, int size, char **error_out) 97static int con_get_config(char *dev, char *str, int size, char **error_out)
98{ 98{
99 return(line_get_config(dev, vts, sizeof(vts)/sizeof(vts[0]), str, 99 return line_get_config(dev, vts, ARRAY_SIZE(vts), str, size, error_out);
100 size, error_out));
101} 100}
102 101
103static int con_remove(int n) 102static int con_remove(int n)
104{ 103{
105 return line_remove(vts, sizeof(vts)/sizeof(vts[0]), n); 104 return line_remove(vts, ARRAY_SIZE(vts), n);
106} 105}
107 106
108static int con_open(struct tty_struct *tty, struct file *filp) 107static int con_open(struct tty_struct *tty, struct file *filp)
109{ 108{
110 return line_open(vts, tty, &opts); 109 return line_open(vts, tty);
111} 110}
112 111
113static int con_init_done = 0; 112static int con_init_done = 0;
@@ -117,16 +116,18 @@ static struct tty_operations console_ops = {
117 .close = line_close, 116 .close = line_close,
118 .write = line_write, 117 .write = line_write,
119 .put_char = line_put_char, 118 .put_char = line_put_char,
120 .write_room = line_write_room, 119 .write_room = line_write_room,
121 .chars_in_buffer = line_chars_in_buffer, 120 .chars_in_buffer = line_chars_in_buffer,
122 .flush_buffer = line_flush_buffer, 121 .flush_buffer = line_flush_buffer,
123 .flush_chars = line_flush_chars, 122 .flush_chars = line_flush_chars,
124 .set_termios = line_set_termios, 123 .set_termios = line_set_termios,
125 .ioctl = line_ioctl, 124 .ioctl = line_ioctl,
125 .throttle = line_throttle,
126 .unthrottle = line_unthrottle,
126}; 127};
127 128
128static void uml_console_write(struct console *console, const char *string, 129static void uml_console_write(struct console *console, const char *string,
129 unsigned len) 130 unsigned len)
130{ 131{
131 struct line *line = &vts[console->index]; 132 struct line *line = &vts[console->index];
132 unsigned long flags; 133 unsigned long flags;
@@ -146,7 +147,7 @@ static int uml_console_setup(struct console *co, char *options)
146{ 147{
147 struct line *line = &vts[co->index]; 148 struct line *line = &vts[co->index];
148 149
149 return console_open_chan(line,co,&opts); 150 return console_open_chan(line, co, &opts);
150} 151}
151 152
152static struct console stdiocons = { 153static struct console stdiocons = {
@@ -156,7 +157,7 @@ static struct console stdiocons = {
156 .setup = uml_console_setup, 157 .setup = uml_console_setup,
157 .flags = CON_PRINTBUFFER, 158 .flags = CON_PRINTBUFFER,
158 .index = -1, 159 .index = -1,
159 .data = &vts, 160 .data = &vts,
160}; 161};
161 162
162int stdio_init(void) 163int stdio_init(void)
@@ -166,11 +167,11 @@ int stdio_init(void)
166 console_driver = line_register_devfs(&console_lines, &driver, 167 console_driver = line_register_devfs(&console_lines, &driver,
167 &console_ops, vts, 168 &console_ops, vts,
168 ARRAY_SIZE(vts)); 169 ARRAY_SIZE(vts));
169 if (NULL == console_driver) 170 if (console_driver == NULL)
170 return -1; 171 return -1;
171 printk(KERN_INFO "Initialized stdio console driver\n"); 172 printk(KERN_INFO "Initialized stdio console driver\n");
172 173
173 lines_init(vts, sizeof(vts)/sizeof(vts[0])); 174 lines_init(vts, ARRAY_SIZE(vts), &opts);
174 175
175 new_title = add_xterm_umid(opts.xterm_title); 176 new_title = add_xterm_umid(opts.xterm_title);
176 if(new_title != NULL) 177 if(new_title != NULL)
@@ -178,7 +179,7 @@ int stdio_init(void)
178 179
179 con_init_done = 1; 180 con_init_done = 1;
180 register_console(&stdiocons); 181 register_console(&stdiocons);
181 return(0); 182 return 0;
182} 183}
183late_initcall(stdio_init); 184late_initcall(stdio_init);
184 185
@@ -186,13 +187,13 @@ static void console_exit(void)
186{ 187{
187 if (!con_init_done) 188 if (!con_init_done)
188 return; 189 return;
189 close_lines(vts, sizeof(vts)/sizeof(vts[0])); 190 close_lines(vts, ARRAY_SIZE(vts));
190} 191}
191__uml_exitcall(console_exit); 192__uml_exitcall(console_exit);
192 193
193static int console_chan_setup(char *str) 194static int console_chan_setup(char *str)
194{ 195{
195 return(line_setup(vts, sizeof(vts)/sizeof(vts[0]), str, 1)); 196 return line_setup(vts, ARRAY_SIZE(vts), str);
196} 197}
197__setup("con", console_chan_setup); 198__setup("con", console_chan_setup);
198__channel_help(console_chan_setup, "con"); 199__channel_help(console_chan_setup, "con");
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 93898917cbe5..101efd26d467 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -117,6 +117,7 @@ static int ubd_open(struct inode * inode, struct file * filp);
117static int ubd_release(struct inode * inode, struct file * file); 117static int ubd_release(struct inode * inode, struct file * file);
118static int ubd_ioctl(struct inode * inode, struct file * file, 118static int ubd_ioctl(struct inode * inode, struct file * file,
119 unsigned int cmd, unsigned long arg); 119 unsigned int cmd, unsigned long arg);
120static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo);
120 121
121#define MAX_DEV (8) 122#define MAX_DEV (8)
122 123
@@ -125,6 +126,7 @@ static struct block_device_operations ubd_blops = {
125 .open = ubd_open, 126 .open = ubd_open,
126 .release = ubd_release, 127 .release = ubd_release,
127 .ioctl = ubd_ioctl, 128 .ioctl = ubd_ioctl,
129 .getgeo = ubd_getgeo,
128}; 130};
129 131
130/* Protected by the queue_lock */ 132/* Protected by the queue_lock */
@@ -706,7 +708,7 @@ static int ubd_config(char *str)
706{ 708{
707 int n, err; 709 int n, err;
708 710
709 str = uml_strdup(str); 711 str = kstrdup(str, GFP_KERNEL);
710 if(str == NULL){ 712 if(str == NULL){
711 printk(KERN_ERR "ubd_config failed to strdup string\n"); 713 printk(KERN_ERR "ubd_config failed to strdup string\n");
712 return(1); 714 return(1);
@@ -1058,10 +1060,19 @@ static void do_ubd_request(request_queue_t *q)
1058 } 1060 }
1059} 1061}
1060 1062
1063static int ubd_getgeo(struct block_device *bdev, struct hd_geometry *geo)
1064{
1065 struct ubd *dev = bdev->bd_disk->private_data;
1066
1067 geo->heads = 128;
1068 geo->sectors = 32;
1069 geo->cylinders = dev->size / (128 * 32 * 512);
1070 return 0;
1071}
1072
1061static int ubd_ioctl(struct inode * inode, struct file * file, 1073static int ubd_ioctl(struct inode * inode, struct file * file,
1062 unsigned int cmd, unsigned long arg) 1074 unsigned int cmd, unsigned long arg)
1063{ 1075{
1064 struct hd_geometry __user *loc = (struct hd_geometry __user *) arg;
1065 struct ubd *dev = inode->i_bdev->bd_disk->private_data; 1076 struct ubd *dev = inode->i_bdev->bd_disk->private_data;
1066 struct hd_driveid ubd_id = { 1077 struct hd_driveid ubd_id = {
1067 .cyls = 0, 1078 .cyls = 0,
@@ -1070,16 +1081,7 @@ static int ubd_ioctl(struct inode * inode, struct file * file,
1070 }; 1081 };
1071 1082
1072 switch (cmd) { 1083 switch (cmd) {
1073 struct hd_geometry g;
1074 struct cdrom_volctrl volume; 1084 struct cdrom_volctrl volume;
1075 case HDIO_GETGEO:
1076 if(!loc) return(-EINVAL);
1077 g.heads = 128;
1078 g.sectors = 32;
1079 g.cylinders = dev->size / (128 * 32 * 512);
1080 g.start = get_start_sect(inode->i_bdev);
1081 return(copy_to_user(loc, &g, sizeof(g)) ? -EFAULT : 0);
1082
1083 case HDIO_GET_IDENTITY: 1085 case HDIO_GET_IDENTITY:
1084 ubd_id.cyls = dev->size / (128 * 32 * 512); 1086 ubd_id.cyls = dev->size / (128 * 32 * 512);
1085 if(copy_to_user((char __user *) arg, (char *) &ubd_id, 1087 if(copy_to_user((char __user *) arg, (char *) &ubd_id,
@@ -1101,31 +1103,33 @@ static int ubd_ioctl(struct inode * inode, struct file * file,
1101 return(-EINVAL); 1103 return(-EINVAL);
1102} 1104}
1103 1105
1104static int same_backing_files(char *from_cmdline, char *from_cow, char *cow) 1106static int path_requires_switch(char *from_cmdline, char *from_cow, char *cow)
1105{ 1107{
1106 struct uml_stat buf1, buf2; 1108 struct uml_stat buf1, buf2;
1107 int err; 1109 int err;
1108 1110
1109 if(from_cmdline == NULL) return(1); 1111 if(from_cmdline == NULL)
1110 if(!strcmp(from_cmdline, from_cow)) return(1); 1112 return 0;
1113 if(!strcmp(from_cmdline, from_cow))
1114 return 0;
1111 1115
1112 err = os_stat_file(from_cmdline, &buf1); 1116 err = os_stat_file(from_cmdline, &buf1);
1113 if(err < 0){ 1117 if(err < 0){
1114 printk("Couldn't stat '%s', err = %d\n", from_cmdline, -err); 1118 printk("Couldn't stat '%s', err = %d\n", from_cmdline, -err);
1115 return(1); 1119 return 0;
1116 } 1120 }
1117 err = os_stat_file(from_cow, &buf2); 1121 err = os_stat_file(from_cow, &buf2);
1118 if(err < 0){ 1122 if(err < 0){
1119 printk("Couldn't stat '%s', err = %d\n", from_cow, -err); 1123 printk("Couldn't stat '%s', err = %d\n", from_cow, -err);
1120 return(1); 1124 return 1;
1121 } 1125 }
1122 if((buf1.ust_dev == buf2.ust_dev) && (buf1.ust_ino == buf2.ust_ino)) 1126 if((buf1.ust_dev == buf2.ust_dev) && (buf1.ust_ino == buf2.ust_ino))
1123 return(1); 1127 return 0;
1124 1128
1125 printk("Backing file mismatch - \"%s\" requested,\n" 1129 printk("Backing file mismatch - \"%s\" requested,\n"
1126 "\"%s\" specified in COW header of \"%s\"\n", 1130 "\"%s\" specified in COW header of \"%s\"\n",
1127 from_cmdline, from_cow, cow); 1131 from_cmdline, from_cow, cow);
1128 return(0); 1132 return 1;
1129} 1133}
1130 1134
1131static int backing_file_mismatch(char *file, __u64 size, time_t mtime) 1135static int backing_file_mismatch(char *file, __u64 size, time_t mtime)
@@ -1187,18 +1191,19 @@ int open_ubd_file(char *file, struct openflags *openflags,
1187 unsigned long long size; 1191 unsigned long long size;
1188 __u32 version, align; 1192 __u32 version, align;
1189 char *backing_file; 1193 char *backing_file;
1190 int fd, err, sectorsize, same, mode = 0644; 1194 int fd, err, sectorsize, asked_switch, mode = 0644;
1191 1195
1192 fd = os_open_file(file, *openflags, mode); 1196 fd = os_open_file(file, *openflags, mode);
1193 if(fd < 0){ 1197 if (fd < 0) {
1194 if((fd == -ENOENT) && (create_cow_out != NULL)) 1198 if ((fd == -ENOENT) && (create_cow_out != NULL))
1195 *create_cow_out = 1; 1199 *create_cow_out = 1;
1196 if(!openflags->w || 1200 if (!openflags->w ||
1197 ((fd != -EROFS) && (fd != -EACCES))) return(fd); 1201 ((fd != -EROFS) && (fd != -EACCES)))
1202 return fd;
1198 openflags->w = 0; 1203 openflags->w = 0;
1199 fd = os_open_file(file, *openflags, mode); 1204 fd = os_open_file(file, *openflags, mode);
1200 if(fd < 0) 1205 if (fd < 0)
1201 return(fd); 1206 return fd;
1202 } 1207 }
1203 1208
1204 err = os_lock_file(fd, openflags->w); 1209 err = os_lock_file(fd, openflags->w);
@@ -1207,7 +1212,9 @@ int open_ubd_file(char *file, struct openflags *openflags,
1207 goto out_close; 1212 goto out_close;
1208 } 1213 }
1209 1214
1210 if(backing_file_out == NULL) return(fd); 1215 /* Succesful return case! */
1216 if(backing_file_out == NULL)
1217 return(fd);
1211 1218
1212 err = read_cow_header(file_reader, &fd, &version, &backing_file, &mtime, 1219 err = read_cow_header(file_reader, &fd, &version, &backing_file, &mtime,
1213 &size, &sectorsize, &align, bitmap_offset_out); 1220 &size, &sectorsize, &align, bitmap_offset_out);
@@ -1216,34 +1223,34 @@ int open_ubd_file(char *file, struct openflags *openflags,
1216 "errno = %d\n", file, -err); 1223 "errno = %d\n", file, -err);
1217 goto out_close; 1224 goto out_close;
1218 } 1225 }
1219 if(err) return(fd); 1226 if(err)
1220 1227 return(fd);
1221 if(backing_file_out == NULL) return(fd);
1222 1228
1223 same = same_backing_files(*backing_file_out, backing_file, file); 1229 asked_switch = path_requires_switch(*backing_file_out, backing_file, file);
1224 1230
1225 if(!same && !backing_file_mismatch(*backing_file_out, size, mtime)){ 1231 /* Allow switching only if no mismatch. */
1232 if (asked_switch && !backing_file_mismatch(*backing_file_out, size, mtime)) {
1226 printk("Switching backing file to '%s'\n", *backing_file_out); 1233 printk("Switching backing file to '%s'\n", *backing_file_out);
1227 err = write_cow_header(file, fd, *backing_file_out, 1234 err = write_cow_header(file, fd, *backing_file_out,
1228 sectorsize, align, &size); 1235 sectorsize, align, &size);
1229 if(err){ 1236 if (err) {
1230 printk("Switch failed, errno = %d\n", -err); 1237 printk("Switch failed, errno = %d\n", -err);
1231 return(err); 1238 goto out_close;
1232 } 1239 }
1233 } 1240 } else {
1234 else {
1235 *backing_file_out = backing_file; 1241 *backing_file_out = backing_file;
1236 err = backing_file_mismatch(*backing_file_out, size, mtime); 1242 err = backing_file_mismatch(*backing_file_out, size, mtime);
1237 if(err) goto out_close; 1243 if (err)
1244 goto out_close;
1238 } 1245 }
1239 1246
1240 cow_sizes(version, size, sectorsize, align, *bitmap_offset_out, 1247 cow_sizes(version, size, sectorsize, align, *bitmap_offset_out,
1241 bitmap_len_out, data_offset_out); 1248 bitmap_len_out, data_offset_out);
1242 1249
1243 return(fd); 1250 return fd;
1244 out_close: 1251 out_close:
1245 os_close_file(fd); 1252 os_close_file(fd);
1246 return(err); 1253 return err;
1247} 1254}
1248 1255
1249int create_cow_file(char *cow_file, char *backing_file, struct openflags flags, 1256int create_cow_file(char *cow_file, char *backing_file, struct openflags flags,
@@ -1387,15 +1394,6 @@ int io_thread(void *arg)
1387 printk("io_thread - write failed, fd = %d, err = %d\n", 1394 printk("io_thread - write failed, fd = %d, err = %d\n",
1388 kernel_fd, -n); 1395 kernel_fd, -n);
1389 } 1396 }
1390}
1391 1397
1392/* 1398 return 0;
1393 * Overrides for Emacs so that we follow Linus's tabbing style. 1399}
1394 * Emacs will notice this stuff at the end of the file and automatically
1395 * adjust the settings for this buffer only. This must remain at the end
1396 * of the file.
1397 * ---------------------------------------------------------------------------
1398 * Local variables:
1399 * c-file-style: "linux"
1400 * End:
1401 */
diff --git a/arch/um/include/chan_kern.h b/arch/um/include/chan_kern.h
index da9a6717e7a4..1bb5e9d94270 100644
--- a/arch/um/include/chan_kern.h
+++ b/arch/um/include/chan_kern.h
@@ -14,21 +14,23 @@
14 14
15struct chan { 15struct chan {
16 struct list_head list; 16 struct list_head list;
17 struct list_head free_list;
18 struct line *line;
17 char *dev; 19 char *dev;
18 unsigned int primary:1; 20 unsigned int primary:1;
19 unsigned int input:1; 21 unsigned int input:1;
20 unsigned int output:1; 22 unsigned int output:1;
21 unsigned int opened:1; 23 unsigned int opened:1;
24 unsigned int enabled:1;
22 int fd; 25 int fd;
23 enum chan_init_pri pri;
24 struct chan_ops *ops; 26 struct chan_ops *ops;
25 void *data; 27 void *data;
26}; 28};
27 29
28extern void chan_interrupt(struct list_head *chans, struct work_struct *task, 30extern void chan_interrupt(struct list_head *chans, struct work_struct *task,
29 struct tty_struct *tty, int irq); 31 struct tty_struct *tty, int irq);
30extern int parse_chan_pair(char *str, struct list_head *chans, int pri, 32extern int parse_chan_pair(char *str, struct line *line, int device,
31 int device, struct chan_opts *opts); 33 struct chan_opts *opts);
32extern int open_chan(struct list_head *chans); 34extern int open_chan(struct list_head *chans);
33extern int write_chan(struct list_head *chans, const char *buf, int len, 35extern int write_chan(struct list_head *chans, const char *buf, int len,
34 int write_irq); 36 int write_irq);
@@ -36,9 +38,11 @@ extern int console_write_chan(struct list_head *chans, const char *buf,
36 int len); 38 int len);
37extern int console_open_chan(struct line *line, struct console *co, 39extern int console_open_chan(struct line *line, struct console *co,
38 struct chan_opts *opts); 40 struct chan_opts *opts);
39extern void close_chan(struct list_head *chans); 41extern void deactivate_chan(struct list_head *chans, int irq);
42extern void reactivate_chan(struct list_head *chans, int irq);
40extern void chan_enable_winch(struct list_head *chans, struct tty_struct *tty); 43extern void chan_enable_winch(struct list_head *chans, struct tty_struct *tty);
41extern void enable_chan(struct list_head *chans, struct tty_struct *tty); 44extern void enable_chan(struct line *line);
45extern void close_chan(struct list_head *chans, int delay_free_irq);
42extern int chan_window_size(struct list_head *chans, 46extern int chan_window_size(struct list_head *chans,
43 unsigned short *rows_out, 47 unsigned short *rows_out,
44 unsigned short *cols_out); 48 unsigned short *cols_out);
@@ -47,14 +51,3 @@ extern int chan_config_string(struct list_head *chans, char *str, int size,
47 char **error_out); 51 char **error_out);
48 52
49#endif 53#endif
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/include/choose-mode.h b/arch/um/include/choose-mode.h
index f25fa83a5da6..b87b36a87d91 100644
--- a/arch/um/include/choose-mode.h
+++ b/arch/um/include/choose-mode.h
@@ -23,6 +23,9 @@ static inline void *__choose_mode(void *tt, void *skas) {
23 23
24#elif defined(UML_CONFIG_MODE_TT) 24#elif defined(UML_CONFIG_MODE_TT)
25#define CHOOSE_MODE(tt, skas) (tt) 25#define CHOOSE_MODE(tt, skas) (tt)
26
27#else
28#error CONFIG_MODE_SKAS and CONFIG_MODE_TT are both disabled
26#endif 29#endif
27 30
28#define CHOOSE_MODE_PROC(tt, skas, args...) \ 31#define CHOOSE_MODE_PROC(tt, skas, args...) \
diff --git a/arch/um/include/irq_user.h b/arch/um/include/irq_user.h
index f724b717213f..b61deb8b362a 100644
--- a/arch/um/include/irq_user.h
+++ b/arch/um/include/irq_user.h
@@ -18,19 +18,8 @@ extern int deactivate_all_fds(void);
18extern void forward_interrupts(int pid); 18extern void forward_interrupts(int pid);
19extern void init_irq_signals(int on_sigstack); 19extern void init_irq_signals(int on_sigstack);
20extern void forward_ipi(int fd, int pid); 20extern void forward_ipi(int fd, int pid);
21extern void free_irq_later(int irq, void *dev_id);
22extern int activate_ipi(int fd, int pid); 21extern int activate_ipi(int fd, int pid);
23extern unsigned long irq_lock(void); 22extern unsigned long irq_lock(void);
24extern void irq_unlock(unsigned long flags); 23extern void irq_unlock(unsigned long flags);
25#endif
26 24
27/* 25#endif
28 * Overrides for Emacs so that we follow Linus's tabbing style.
29 * Emacs will notice this stuff at the end of the file and automatically
30 * adjust the settings for this buffer only. This must remain at the end
31 * of the file.
32 * ---------------------------------------------------------------------------
33 * Local variables:
34 * c-file-style: "linux"
35 * End:
36 */
diff --git a/arch/um/include/kern.h b/arch/um/include/kern.h
index 1e3170768b5c..7d223beccbc0 100644
--- a/arch/um/include/kern.h
+++ b/arch/um/include/kern.h
@@ -17,7 +17,7 @@ extern int errno;
17 17
18extern int clone(int (*proc)(void *), void *sp, int flags, void *data); 18extern int clone(int (*proc)(void *), void *sp, int flags, void *data);
19extern int sleep(int); 19extern int sleep(int);
20extern int printf(char *fmt, ...); 20extern int printf(const char *fmt, ...);
21extern char *strerror(int errnum); 21extern char *strerror(int errnum);
22extern char *ptsname(int __fd); 22extern char *ptsname(int __fd);
23extern int munmap(void *, int); 23extern int munmap(void *, int);
@@ -35,15 +35,6 @@ extern int read(unsigned int, char *, int);
35extern int pipe(int *); 35extern int pipe(int *);
36extern int sched_yield(void); 36extern int sched_yield(void);
37extern int ptrace(int op, int pid, long addr, long data); 37extern int ptrace(int op, int pid, long addr, long data);
38
38#endif 39#endif
39 40
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/include/kern_util.h b/arch/um/include/kern_util.h
index e5fec5570199..c649108a9e9f 100644
--- a/arch/um/include/kern_util.h
+++ b/arch/um/include/kern_util.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -10,6 +10,19 @@
10#include "sysdep/ptrace.h" 10#include "sysdep/ptrace.h"
11#include "sysdep/faultinfo.h" 11#include "sysdep/faultinfo.h"
12 12
13typedef void (*kern_hndl)(int, union uml_pt_regs *);
14
15struct kern_handlers {
16 kern_hndl relay_signal;
17 kern_hndl winch;
18 kern_hndl bus_handler;
19 kern_hndl page_fault;
20 kern_hndl sigio_handler;
21 kern_hndl timer_handler;
22};
23
24extern struct kern_handlers handlinfo_kern;
25
13extern int ncpus; 26extern int ncpus;
14extern char *linux_prog; 27extern char *linux_prog;
15extern char *gdb_init; 28extern char *gdb_init;
@@ -51,8 +64,6 @@ extern void timer_handler(int sig, union uml_pt_regs *regs);
51extern int set_signals(int enable); 64extern int set_signals(int enable);
52extern void force_sigbus(void); 65extern void force_sigbus(void);
53extern int pid_to_processor_id(int pid); 66extern int pid_to_processor_id(int pid);
54extern void block_signals(void);
55extern void unblock_signals(void);
56extern void deliver_signals(void *t); 67extern void deliver_signals(void *t);
57extern int next_syscall_index(int max); 68extern int next_syscall_index(int max);
58extern int next_trap_index(int max); 69extern int next_trap_index(int max);
@@ -109,9 +120,13 @@ extern void machine_halt(void);
109extern int is_syscall(unsigned long addr); 120extern int is_syscall(unsigned long addr);
110extern void arch_switch(void); 121extern void arch_switch(void);
111extern void free_irq(unsigned int, void *); 122extern void free_irq(unsigned int, void *);
112extern int um_in_interrupt(void);
113extern int cpu(void); 123extern int cpu(void);
114 124
125/* Are we disallowed to sleep? Used to choose between GFP_KERNEL and GFP_ATOMIC. */
126extern int __cant_sleep(void);
127extern void segv_handler(int sig, union uml_pt_regs *regs);
128extern void sigio_handler(int sig, union uml_pt_regs *regs);
129
115#endif 130#endif
116 131
117/* 132/*
diff --git a/arch/um/include/line.h b/arch/um/include/line.h
index 5323d22a6ca7..6f4d680dc1d4 100644
--- a/arch/um/include/line.h
+++ b/arch/um/include/line.h
@@ -32,11 +32,13 @@ struct line_driver {
32}; 32};
33 33
34struct line { 34struct line {
35 struct tty_struct *tty;
35 char *init_str; 36 char *init_str;
36 int init_pri; 37 int init_pri;
37 struct list_head chan_list; 38 struct list_head chan_list;
38 int valid; 39 int valid;
39 int count; 40 int count;
41 int throttled;
40 /*This lock is actually, mostly, local to*/ 42 /*This lock is actually, mostly, local to*/
41 spinlock_t lock; 43 spinlock_t lock;
42 44
@@ -58,14 +60,15 @@ struct line {
58#define LINE_INIT(str, d) \ 60#define LINE_INIT(str, d) \
59 { init_str : str, \ 61 { init_str : str, \
60 init_pri : INIT_STATIC, \ 62 init_pri : INIT_STATIC, \
61 chan_list : { }, \
62 valid : 1, \ 63 valid : 1, \
64 throttled : 0, \
65 lock : SPIN_LOCK_UNLOCKED, \
63 buffer : NULL, \ 66 buffer : NULL, \
64 head : NULL, \ 67 head : NULL, \
65 tail : NULL, \ 68 tail : NULL, \
66 sigio : 0, \ 69 sigio : 0, \
67 driver : d, \ 70 driver : d, \
68 have_irq : 0 } 71 have_irq : 0 }
69 72
70struct lines { 73struct lines {
71 int num; 74 int num;
@@ -74,11 +77,11 @@ struct lines {
74#define LINES_INIT(n) { num : n } 77#define LINES_INIT(n) { num : n }
75 78
76extern void line_close(struct tty_struct *tty, struct file * filp); 79extern void line_close(struct tty_struct *tty, struct file * filp);
77extern int line_open(struct line *lines, struct tty_struct *tty, 80extern int line_open(struct line *lines, struct tty_struct *tty);
78 struct chan_opts *opts); 81extern int line_setup(struct line *lines, unsigned int sizeof_lines,
79extern int line_setup(struct line *lines, unsigned int sizeof_lines, char *init, 82 char *init);
80 int all_allowed); 83extern int line_write(struct tty_struct *tty, const unsigned char *buf,
81extern int line_write(struct tty_struct *tty, const unsigned char *buf, int len); 84 int len);
82extern void line_put_char(struct tty_struct *tty, unsigned char ch); 85extern void line_put_char(struct tty_struct *tty, unsigned char ch);
83extern void line_set_termios(struct tty_struct *tty, struct termios * old); 86extern void line_set_termios(struct tty_struct *tty, struct termios * old);
84extern int line_chars_in_buffer(struct tty_struct *tty); 87extern int line_chars_in_buffer(struct tty_struct *tty);
@@ -87,23 +90,27 @@ extern void line_flush_chars(struct tty_struct *tty);
87extern int line_write_room(struct tty_struct *tty); 90extern int line_write_room(struct tty_struct *tty);
88extern int line_ioctl(struct tty_struct *tty, struct file * file, 91extern int line_ioctl(struct tty_struct *tty, struct file * file,
89 unsigned int cmd, unsigned long arg); 92 unsigned int cmd, unsigned long arg);
93extern void line_throttle(struct tty_struct *tty);
94extern void line_unthrottle(struct tty_struct *tty);
90 95
91extern char *add_xterm_umid(char *base); 96extern char *add_xterm_umid(char *base);
92extern int line_setup_irq(int fd, int input, int output, struct tty_struct *tty); 97extern int line_setup_irq(int fd, int input, int output, struct line *line,
98 void *data);
93extern void line_close_chan(struct line *line); 99extern void line_close_chan(struct line *line);
94extern void line_disable(struct tty_struct *tty, int current_irq); 100extern struct tty_driver * line_register_devfs(struct lines *set,
95extern struct tty_driver * line_register_devfs(struct lines *set, 101 struct line_driver *line_driver,
96 struct line_driver *line_driver,
97 struct tty_operations *driver, 102 struct tty_operations *driver,
98 struct line *lines, 103 struct line *lines,
99 int nlines); 104 int nlines);
100extern void lines_init(struct line *lines, int nlines); 105extern void lines_init(struct line *lines, int nlines, struct chan_opts *opts);
101extern void close_lines(struct line *lines, int nlines); 106extern void close_lines(struct line *lines, int nlines);
102 107
103extern int line_config(struct line *lines, unsigned int sizeof_lines, char *str); 108extern int line_config(struct line *lines, unsigned int sizeof_lines,
109 char *str, struct chan_opts *opts);
104extern int line_id(char **str, int *start_out, int *end_out); 110extern int line_id(char **str, int *start_out, int *end_out);
105extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n); 111extern int line_remove(struct line *lines, unsigned int sizeof_lines, int n);
106extern int line_get_config(char *dev, struct line *lines, unsigned int sizeof_lines, char *str, 112extern int line_get_config(char *dev, struct line *lines,
113 unsigned int sizeof_lines, char *str,
107 int size, char **error_out); 114 int size, char **error_out);
108 115
109#endif 116#endif
diff --git a/arch/um/include/longjmp.h b/arch/um/include/longjmp.h
new file mode 100644
index 000000000000..018b3819ab0b
--- /dev/null
+++ b/arch/um/include/longjmp.h
@@ -0,0 +1,19 @@
1#ifndef __UML_LONGJMP_H
2#define __UML_LONGJMP_H
3
4#include <setjmp.h>
5#include "os.h"
6
7#define UML_SIGLONGJMP(buf, val) do { \
8 longjmp(*buf, val); \
9} while(0)
10
11#define UML_SIGSETJMP(buf, enable) ({ \
12 int n; \
13 enable = get_signals(); \
14 n = setjmp(*buf); \
15 if(n != 0) \
16 set_signals(enable); \
17 n; })
18
19#endif
diff --git a/arch/um/include/mconsole.h b/arch/um/include/mconsole.h
index b1b512f47035..58f67d391105 100644
--- a/arch/um/include/mconsole.h
+++ b/arch/um/include/mconsole.h
@@ -32,7 +32,7 @@ struct mconsole_reply {
32 32
33struct mconsole_notify { 33struct mconsole_notify {
34 u32 magic; 34 u32 magic;
35 u32 version; 35 u32 version;
36 enum { MCONSOLE_SOCKET, MCONSOLE_PANIC, MCONSOLE_HANG, 36 enum { MCONSOLE_SOCKET, MCONSOLE_PANIC, MCONSOLE_HANG,
37 MCONSOLE_USER_NOTIFY } type; 37 MCONSOLE_USER_NOTIFY } type;
38 u32 len; 38 u32 len;
@@ -66,7 +66,9 @@ struct mc_request
66extern char mconsole_socket_name[]; 66extern char mconsole_socket_name[];
67 67
68extern int mconsole_unlink_socket(void); 68extern int mconsole_unlink_socket(void);
69extern int mconsole_reply(struct mc_request *req, char *reply, int err, 69extern int mconsole_reply_len(struct mc_request *req, const char *reply,
70 int len, int err, int more);
71extern int mconsole_reply(struct mc_request *req, const char *str, int err,
70 int more); 72 int more);
71 73
72extern void mconsole_version(struct mc_request *req); 74extern void mconsole_version(struct mc_request *req);
@@ -84,7 +86,7 @@ extern void mconsole_proc(struct mc_request *req);
84extern void mconsole_stack(struct mc_request *req); 86extern void mconsole_stack(struct mc_request *req);
85 87
86extern int mconsole_get_request(int fd, struct mc_request *req); 88extern int mconsole_get_request(int fd, struct mc_request *req);
87extern int mconsole_notify(char *sock_name, int type, const void *data, 89extern int mconsole_notify(char *sock_name, int type, const void *data,
88 int len); 90 int len);
89extern char *mconsole_notify_socket(void); 91extern char *mconsole_notify_socket(void);
90extern void lock_notify(void); 92extern void lock_notify(void);
diff --git a/arch/um/include/mode_kern.h b/arch/um/include/mode_kern.h
index 2d88afd0cf16..e7539a8451ef 100644
--- a/arch/um/include/mode_kern.h
+++ b/arch/um/include/mode_kern.h
@@ -9,22 +9,11 @@
9#include "linux/config.h" 9#include "linux/config.h"
10 10
11#ifdef CONFIG_MODE_TT 11#ifdef CONFIG_MODE_TT
12#include "mode_kern-tt.h" 12#include "mode_kern_tt.h"
13#endif 13#endif
14 14
15#ifdef CONFIG_MODE_SKAS 15#ifdef CONFIG_MODE_SKAS
16#include "mode_kern-skas.h" 16#include "mode_kern_skas.h"
17#endif 17#endif
18 18
19#endif 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/os.h b/arch/um/include/os.h
index 2cccfa5b8ab5..eb1710b81255 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -9,6 +9,9 @@
9#include "uml-config.h" 9#include "uml-config.h"
10#include "asm/types.h" 10#include "asm/types.h"
11#include "../os/include/file.h" 11#include "../os/include/file.h"
12#include "sysdep/ptrace.h"
13#include "kern_util.h"
14#include "skas/mm_id.h"
12 15
13#define OS_TYPE_FILE 1 16#define OS_TYPE_FILE 1
14#define OS_TYPE_DIR 2 17#define OS_TYPE_DIR 2
@@ -188,11 +191,12 @@ extern int os_protect_memory(void *addr, unsigned long len,
188 int r, int w, int x); 191 int r, int w, int x);
189extern int os_unmap_memory(void *addr, int len); 192extern int os_unmap_memory(void *addr, int len);
190extern void os_flush_stdout(void); 193extern void os_flush_stdout(void);
191extern unsigned long long os_usecs(void);
192 194
193/* tt.c 195/* tt.c
194 * for tt mode only (will be deleted in future...) 196 * for tt mode only (will be deleted in future...)
195 */ 197 */
198extern void stop(void);
199extern int wait_for_stop(int pid, int sig, int cont_type, void *relay);
196extern int protect_memory(unsigned long addr, unsigned long len, 200extern int protect_memory(unsigned long addr, unsigned long len,
197 int r, int w, int x, int must_succeed); 201 int r, int w, int x, int must_succeed);
198extern void forward_pending_sigio(int target); 202extern void forward_pending_sigio(int target);
@@ -213,15 +217,78 @@ extern int run_helper_thread(int (*proc)(void *), void *arg,
213 int stack_order); 217 int stack_order);
214extern int helper_wait(int pid); 218extern int helper_wait(int pid);
215 219
216#endif 220/* umid.c */
217 221
218/* 222extern int umid_file_name(char *name, char *buf, int len);
219 * Overrides for Emacs so that we follow Linus's tabbing style. 223extern int set_umid(char *name);
220 * Emacs will notice this stuff at the end of the file and automatically 224extern char *get_umid(void);
221 * adjust the settings for this buffer only. This must remain at the end 225
222 * of the file. 226/* signal.c */
223 * --------------------------------------------------------------------------- 227extern void set_sigstack(void *sig_stack, int size);
224 * Local variables: 228extern void remove_sigstack(void);
225 * c-file-style: "linux" 229extern void set_handler(int sig, void (*handler)(int), int flags, ...);
226 * End: 230extern int change_sig(int signal, int on);
227 */ 231extern void block_signals(void);
232extern void unblock_signals(void);
233extern int get_signals(void);
234extern int set_signals(int enable);
235extern void os_usr1_signal(int on);
236
237/* trap.c */
238extern void os_fill_handlinfo(struct kern_handlers h);
239extern void do_longjmp(void *p, int val);
240
241/* util.c */
242extern void stack_protections(unsigned long address);
243extern void task_protections(unsigned long address);
244extern int raw(int fd);
245extern void setup_machinename(char *machine_out);
246extern void setup_hostinfo(void);
247extern int setjmp_wrapper(void (*proc)(void *, void *), ...);
248
249/* time.c */
250#define BILLION (1000 * 1000 * 1000)
251
252extern void switch_timers(int to_real);
253extern void idle_sleep(int secs);
254extern void enable_timer(void);
255extern void disable_timer(void);
256extern void user_time_init(void);
257extern void uml_idle_timer(void);
258extern unsigned long long os_nsecs(void);
259
260/* skas/mem.c */
261extern long run_syscall_stub(struct mm_id * mm_idp,
262 int syscall, unsigned long *args, long expected,
263 void **addr, int done);
264extern long syscall_stub_data(struct mm_id * mm_idp,
265 unsigned long *data, int data_count,
266 void **addr, void **stub_addr);
267extern int map(struct mm_id * mm_idp, unsigned long virt,
268 unsigned long len, int r, int w, int x, int phys_fd,
269 unsigned long long offset, int done, void **data);
270extern int unmap(struct mm_id * mm_idp, void *addr, unsigned long len,
271 int done, void **data);
272extern int protect(struct mm_id * mm_idp, unsigned long addr,
273 unsigned long len, int r, int w, int x, int done,
274 void **data);
275
276/* skas/process.c */
277extern int is_skas_winch(int pid, int fd, void *data);
278extern int start_userspace(unsigned long stub_stack);
279extern int copy_context_skas0(unsigned long stack, int pid);
280extern void userspace(union uml_pt_regs *regs);
281extern void map_stub_pages(int fd, unsigned long code,
282 unsigned long data, unsigned long stack);
283extern void new_thread(void *stack, void **switch_buf_ptr,
284 void **fork_buf_ptr, void (*handler)(int));
285extern void thread_wait(void *sw, void *fb);
286extern void switch_threads(void *me, void *next);
287extern int start_idle_thread(void *stack, void *switch_buf_ptr,
288 void **fork_buf_ptr);
289extern void initial_thread_cb_skas(void (*proc)(void *),
290 void *arg);
291extern void halt_skas(void);
292extern void reboot_skas(void);
293
294#endif
diff --git a/arch/um/include/signal_user.h b/arch/um/include/signal_user.h
deleted file mode 100644
index b075e543d864..000000000000
--- a/arch/um/include/signal_user.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * Copyright (C) 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SIGNAL_USER_H__
7#define __SIGNAL_USER_H__
8
9extern int signal_stack_size;
10
11extern int change_sig(int signal, int on);
12extern void set_sigstack(void *stack, int size);
13extern void set_handler(int sig, void (*handler)(int), int flags, ...);
14extern int set_signals(int enable);
15extern int get_signals(void);
16
17#endif
18
19/*
20 * Overrides for Emacs so that we follow Linus's tabbing style.
21 * Emacs will notice this stuff at the end of the file and automatically
22 * adjust the settings for this buffer only. This must remain at the end
23 * of the file.
24 * ---------------------------------------------------------------------------
25 * Local variables:
26 * c-file-style: "linux"
27 * End:
28 */
diff --git a/arch/um/kernel/skas/include/mm_id.h b/arch/um/include/skas/mm_id.h
index 48dd0989ddaa..48dd0989ddaa 100644
--- a/arch/um/kernel/skas/include/mm_id.h
+++ b/arch/um/include/skas/mm_id.h
diff --git a/arch/um/include/skas/mmu-skas.h b/arch/um/include/skas/mmu-skas.h
new file mode 100644
index 000000000000..d8869a6ef1b4
--- /dev/null
+++ b/arch/um/include/skas/mmu-skas.h
@@ -0,0 +1,24 @@
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 "linux/config.h"
10#include "mm_id.h"
11#include "asm/ldt.h"
12
13struct mmu_context_skas {
14 struct mm_id id;
15 unsigned long last_page_table;
16#ifdef CONFIG_3_LEVEL_PGTABLES
17 unsigned long last_pmd;
18#endif
19 uml_ldt_t ldt;
20};
21
22extern void switch_mm_skas(struct mm_id * mm_idp);
23
24#endif
diff --git a/arch/um/include/skas/mode-skas.h b/arch/um/include/skas/mode-skas.h
new file mode 100644
index 000000000000..260065cfeef1
--- /dev/null
+++ b/arch/um/include/skas/mode-skas.h
@@ -0,0 +1,19 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MODE_SKAS_H__
7#define __MODE_SKAS_H__
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 sig_handler_common_skas(int sig, void *sc_ptr);
17extern void kill_off_processes_skas(void);
18
19#endif
diff --git a/arch/um/kernel/skas/include/mode_kern-skas.h b/arch/um/include/skas/mode_kern_skas.h
index c97a80dfe370..63c58739bde0 100644
--- a/arch/um/kernel/skas/include/mode_kern-skas.h
+++ b/arch/um/include/skas/mode_kern_skas.h
@@ -18,7 +18,6 @@ extern int copy_thread_skas(int nr, unsigned long clone_flags,
18 unsigned long sp, unsigned long stack_top, 18 unsigned long sp, unsigned long stack_top,
19 struct task_struct *p, struct pt_regs *regs); 19 struct task_struct *p, struct pt_regs *regs);
20extern void release_thread_skas(struct task_struct *task); 20extern void release_thread_skas(struct task_struct *task);
21extern void initial_thread_cb_skas(void (*proc)(void *), void *arg);
22extern void init_idle_skas(void); 21extern void init_idle_skas(void);
23extern void flush_tlb_kernel_range_skas(unsigned long start, 22extern void flush_tlb_kernel_range_skas(unsigned long start,
24 unsigned long end); 23 unsigned long end);
@@ -39,14 +38,3 @@ extern int thread_pid_skas(struct task_struct *task);
39#define kmem_end_skas (host_task_size - 1024 * 1024) 38#define kmem_end_skas (host_task_size - 1024 * 1024)
40 39
41#endif 40#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 */
diff --git a/arch/um/kernel/skas/include/proc_mm.h b/arch/um/include/skas/proc_mm.h
index cce61a679052..902809209603 100644
--- a/arch/um/kernel/skas/include/proc_mm.h
+++ b/arch/um/include/skas/proc_mm.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -22,13 +22,13 @@ struct mm_mmap {
22 22
23struct mm_munmap { 23struct mm_munmap {
24 unsigned long addr; 24 unsigned long addr;
25 unsigned long len; 25 unsigned long len;
26}; 26};
27 27
28struct mm_mprotect { 28struct mm_mprotect {
29 unsigned long addr; 29 unsigned long addr;
30 unsigned long len; 30 unsigned long len;
31 unsigned int prot; 31 unsigned int prot;
32}; 32};
33 33
34struct proc_mm_op { 34struct proc_mm_op {
@@ -42,14 +42,3 @@ struct proc_mm_op {
42}; 42};
43 43
44#endif 44#endif
45
46/*
47 * Overrides for Emacs so that we follow Linus's tabbing style.
48 * Emacs will notice this stuff at the end of the file and automatically
49 * adjust the settings for this buffer only. This must remain at the end
50 * of the file.
51 * ---------------------------------------------------------------------------
52 * Local variables:
53 * c-file-style: "linux"
54 * End:
55 */
diff --git a/arch/um/include/skas/skas.h b/arch/um/include/skas/skas.h
new file mode 100644
index 000000000000..86357282d681
--- /dev/null
+++ b/arch/um/include/skas/skas.h
@@ -0,0 +1,26 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SKAS_H
7#define __SKAS_H
8
9#include "mm_id.h"
10#include "sysdep/ptrace.h"
11
12extern int userspace_pid[];
13extern int proc_mm, ptrace_faultinfo, ptrace_ldt;
14extern int skas_needs_stub;
15
16extern int user_thread(unsigned long stack, int flags);
17extern void new_thread_proc(void *stack, void (*handler)(int sig));
18extern void new_thread_handler(int sig);
19extern void handle_syscall(union uml_pt_regs *regs);
20extern void user_signal(int sig, union uml_pt_regs *regs, int pid);
21extern int new_mm(unsigned long stack);
22extern void get_skas_faultinfo(int pid, struct faultinfo * fi);
23extern long execute_syscall_skas(void *r);
24extern unsigned long current_stub_stack(void);
25
26#endif
diff --git a/arch/um/kernel/skas/include/stub-data.h b/arch/um/include/skas/stub-data.h
index f6ed92c3727d..f6ed92c3727d 100644
--- a/arch/um/kernel/skas/include/stub-data.h
+++ b/arch/um/include/skas/stub-data.h
diff --git a/arch/um/kernel/skas/include/uaccess-skas.h b/arch/um/include/skas/uaccess-skas.h
index f611f83ad4ff..224a75f4c025 100644
--- a/arch/um/kernel/skas/include/uaccess-skas.h
+++ b/arch/um/include/skas/uaccess-skas.h
@@ -7,7 +7,6 @@
7#define __SKAS_UACCESS_H 7#define __SKAS_UACCESS_H
8 8
9#include "asm/errno.h" 9#include "asm/errno.h"
10#include "asm/fixmap.h"
11 10
12/* No SKAS-specific checking. */ 11/* No SKAS-specific checking. */
13#define access_ok_skas(type, addr, size) 0 12#define access_ok_skas(type, addr, size) 0
@@ -20,14 +19,3 @@ extern int clear_user_skas(void __user *mem, int len);
20extern int strnlen_user_skas(const void __user *str, int len); 19extern int strnlen_user_skas(const void __user *str, int len);
21 20
22#endif 21#endif
23
24/*
25 * Overrides for Emacs so that we follow Linus's tabbing style.
26 * Emacs will notice this stuff at the end of the file and automatically
27 * adjust the settings for this buffer only. This must remain at the end
28 * of the file.
29 * ---------------------------------------------------------------------------
30 * Local variables:
31 * c-file-style: "linux"
32 * End:
33 */
diff --git a/arch/um/include/sysdep-i386/checksum.h b/arch/um/include/sysdep-i386/checksum.h
index 764ba4db4788..7d3d202d7fff 100644
--- a/arch/um/include/sysdep-i386/checksum.h
+++ b/arch/um/include/sysdep-i386/checksum.h
@@ -36,7 +36,7 @@ unsigned int csum_partial_copy_nocheck(const unsigned char *src, unsigned char *
36 int len, int sum) 36 int len, int sum)
37{ 37{
38 memcpy(dst, src, len); 38 memcpy(dst, src, len);
39 return(csum_partial(dst, len, sum)); 39 return csum_partial(dst, len, sum);
40} 40}
41 41
42/* 42/*
@@ -104,7 +104,7 @@ static inline unsigned short ip_fast_csum(unsigned char * iph,
104 : "=r" (sum), "=r" (iph), "=r" (ihl) 104 : "=r" (sum), "=r" (iph), "=r" (ihl)
105 : "1" (iph), "2" (ihl) 105 : "1" (iph), "2" (ihl)
106 : "memory"); 106 : "memory");
107 return(sum); 107 return sum;
108} 108}
109 109
110/* 110/*
diff --git a/arch/um/sys-i386/kernel-offsets.c b/arch/um/include/sysdep-i386/kernel-offsets.h
index 35db85057506..82f96c574144 100644
--- a/arch/um/sys-i386/kernel-offsets.c
+++ b/arch/um/include/sysdep-i386/kernel-offsets.h
@@ -1,12 +1,9 @@
1#include <linux/config.h>
2#include <linux/stddef.h> 1#include <linux/stddef.h>
3#include <linux/sched.h> 2#include <linux/sched.h>
4#include <linux/time.h>
5#include <linux/elf.h> 3#include <linux/elf.h>
6#include <asm/page.h>
7 4
8#define DEFINE(sym, val) \ 5#define DEFINE(sym, val) \
9 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 6 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
10 7
11#define STR(x) #x 8#define STR(x) #x
12#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : ) 9#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " STR(val) " " #val: : )
diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/include/sysdep-i386/stub.h
index 6ba8cbbe0d36..b492b12b4a10 100644
--- a/arch/um/include/sysdep-i386/stub.h
+++ b/arch/um/include/sysdep-i386/stub.h
@@ -6,8 +6,12 @@
6#ifndef __SYSDEP_STUB_H 6#ifndef __SYSDEP_STUB_H
7#define __SYSDEP_STUB_H 7#define __SYSDEP_STUB_H
8 8
9#include <sys/mman.h>
9#include <asm/ptrace.h> 10#include <asm/ptrace.h>
10#include <asm/unistd.h> 11#include <asm/unistd.h>
12#include "stub-data.h"
13#include "kern_constants.h"
14#include "uml-config.h"
11 15
12extern void stub_segv_handler(int sig); 16extern void stub_segv_handler(int sig);
13extern void stub_clone_handler(void); 17extern void stub_clone_handler(void);
@@ -76,23 +80,22 @@ static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
76 return ret; 80 return ret;
77} 81}
78 82
79static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3, 83static inline void trap_myself(void)
80 long arg4, long arg5, long arg6)
81{ 84{
82 long ret; 85 __asm("int3");
83
84 __asm__ volatile ("push %%ebp ; movl %%eax,%%ebp ; movl %1,%%eax ; "
85 "int $0x80 ; pop %%ebp"
86 : "=a" (ret)
87 : "g" (syscall), "b" (arg1), "c" (arg2), "d" (arg3),
88 "S" (arg4), "D" (arg5), "0" (arg6));
89
90 return ret;
91} 86}
92 87
93static inline void trap_myself(void) 88static inline void remap_stack(int fd, unsigned long offset)
94{ 89{
95 __asm("int3"); 90 __asm__ volatile ("movl %%eax,%%ebp ; movl %0,%%eax ; int $0x80 ;"
91 "movl %7, %%ebx ; movl %%eax, (%%ebx)"
92 : : "g" (STUB_MMAP_NR), "b" (UML_CONFIG_STUB_DATA),
93 "c" (UM_KERN_PAGE_SIZE),
94 "d" (PROT_READ | PROT_WRITE),
95 "S" (MAP_FIXED | MAP_SHARED), "D" (fd),
96 "a" (offset),
97 "i" (&((struct stub_data *) UML_CONFIG_STUB_DATA)->err)
98 : "memory");
96} 99}
97 100
98#endif 101#endif
diff --git a/arch/um/sys-x86_64/kernel-offsets.c b/arch/um/include/sysdep-x86_64/kernel-offsets.h
index bfcb104b846e..5ce93abd0b54 100644
--- a/arch/um/sys-x86_64/kernel-offsets.c
+++ b/arch/um/include/sysdep-x86_64/kernel-offsets.h
@@ -6,7 +6,7 @@
6#include <asm/page.h> 6#include <asm/page.h>
7 7
8#define DEFINE(sym, val) \ 8#define DEFINE(sym, val) \
9 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 9 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
10 10
11#define DEFINE_STR1(x) #x 11#define DEFINE_STR1(x) #x
12#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " DEFINE_STR1(val) " " #val: : ) 12#define DEFINE_STR(sym, val) asm volatile("\n->" #sym " " DEFINE_STR1(val) " " #val: : )
diff --git a/arch/um/include/sysdep-x86_64/stub.h b/arch/um/include/sysdep-x86_64/stub.h
index c41689c13dc9..92e989f81761 100644
--- a/arch/um/include/sysdep-x86_64/stub.h
+++ b/arch/um/include/sysdep-x86_64/stub.h
@@ -6,8 +6,12 @@
6#ifndef __SYSDEP_STUB_H 6#ifndef __SYSDEP_STUB_H
7#define __SYSDEP_STUB_H 7#define __SYSDEP_STUB_H
8 8
9#include <sys/mman.h>
9#include <asm/unistd.h> 10#include <asm/unistd.h>
10#include <sysdep/ptrace_user.h> 11#include <sysdep/ptrace_user.h>
12#include "stub-data.h"
13#include "kern_constants.h"
14#include "uml-config.h"
11 15
12extern void stub_segv_handler(int sig); 16extern void stub_segv_handler(int sig);
13extern void stub_clone_handler(void); 17extern void stub_clone_handler(void);
@@ -81,23 +85,23 @@ static inline long stub_syscall5(long syscall, long arg1, long arg2, long arg3,
81 return ret; 85 return ret;
82} 86}
83 87
84static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3, 88static inline void trap_myself(void)
85 long arg4, long arg5, long arg6)
86{ 89{
87 long ret; 90 __asm("int3");
88
89 __asm__ volatile ("movq %5,%%r10 ; movq %6,%%r8 ; "
90 "movq %7, %%r9; " __syscall : "=a" (ret)
91 : "0" (syscall), "D" (arg1), "S" (arg2), "d" (arg3),
92 "g" (arg4), "g" (arg5), "g" (arg6)
93 : __syscall_clobber, "r10", "r8", "r9" );
94
95 return ret;
96} 91}
97 92
98static inline void trap_myself(void) 93static inline void remap_stack(long fd, unsigned long offset)
99{ 94{
100 __asm("int3"); 95 __asm__ volatile ("movq %4,%%r10 ; movq %5,%%r8 ; "
96 "movq %6, %%r9; " __syscall "; movq %7, %%rbx ; "
97 "movq %%rax, (%%rbx)":
98 : "a" (STUB_MMAP_NR), "D" (UML_CONFIG_STUB_DATA),
99 "S" (UM_KERN_PAGE_SIZE),
100 "d" (PROT_READ | PROT_WRITE),
101 "g" (MAP_FIXED | MAP_SHARED), "g" (fd),
102 "g" (offset),
103 "i" (&((struct stub_data *) UML_CONFIG_STUB_DATA)->err)
104 : __syscall_clobber, "r10", "r8", "r9" );
101} 105}
102 106
103#endif 107#endif
diff --git a/arch/um/include/time_user.h b/arch/um/include/time_user.h
deleted file mode 100644
index 17d7ef2141f4..000000000000
--- a/arch/um/include/time_user.h
+++ /dev/null
@@ -1,19 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __TIME_USER_H__
7#define __TIME_USER_H__
8
9extern void timer(void);
10extern void switch_timers(int to_real);
11extern void idle_sleep(int secs);
12extern void enable_timer(void);
13extern void prepare_timer(void * ptr);
14extern void disable_timer(void);
15extern unsigned long time_lock(void);
16extern void time_unlock(unsigned long);
17extern void user_time_init(void);
18
19#endif
diff --git a/arch/um/kernel/tt/include/debug.h b/arch/um/include/tt/debug.h
index 738435461e13..9778fa838296 100644
--- a/arch/um/kernel/tt/include/debug.h
+++ b/arch/um/include/tt/debug.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) and 2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) and
3 * Lars Brinkhoff. 3 * Lars Brinkhoff.
4 * Licensed under the GPL 4 * Licensed under the GPL
diff --git a/arch/um/include/tt/mmu-tt.h b/arch/um/include/tt/mmu-tt.h
new file mode 100644
index 000000000000..572a78b22587
--- /dev/null
+++ b/arch/um/include/tt/mmu-tt.h
@@ -0,0 +1,12 @@
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
new file mode 100644
index 000000000000..2823cd56eea2
--- /dev/null
+++ b/arch/um/include/tt/mode-tt.h
@@ -0,0 +1,23 @@
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
new file mode 100644
index 000000000000..efa0012550d0
--- /dev/null
+++ b/arch/um/include/tt/mode_kern_tt.h
@@ -0,0 +1,41 @@
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(int arg, unsigned long *host_size_out,
34 unsigned long *task_size_out);
35extern int start_uml_tt(void);
36extern int external_pid_tt(struct task_struct *task);
37extern int thread_pid_tt(struct task_struct *task);
38
39#define kmem_end_tt (host_task_size - ABOVE_KMEM)
40
41#endif
diff --git a/arch/um/kernel/tt/include/tt.h b/arch/um/include/tt/tt.h
index c667b67af405..808521980186 100644
--- a/arch/um/kernel/tt/include/tt.h
+++ b/arch/um/include/tt/tt.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -34,13 +34,3 @@ extern long execute_syscall_tt(void *r);
34 34
35#endif 35#endif
36 36
37/*
38 * Overrides for Emacs so that we follow Linus's tabbing style.
39 * Emacs will notice this stuff at the end of the file and automatically
40 * adjust the settings for this buffer only. This must remain at the end
41 * of the file.
42 * ---------------------------------------------------------------------------
43 * Local variables:
44 * c-file-style: "linux"
45 * End:
46 */
diff --git a/arch/um/kernel/tt/include/uaccess-tt.h b/arch/um/include/tt/uaccess-tt.h
index b9bfe9c481c4..b19645f32f24 100644
--- a/arch/um/kernel/tt/include/uaccess-tt.h
+++ b/arch/um/include/tt/uaccess-tt.h
@@ -46,14 +46,3 @@ extern int clear_user_tt(void __user *mem, int len);
46extern int strnlen_user_tt(const void __user *str, int len); 46extern int strnlen_user_tt(const void __user *str, int len);
47 47
48#endif 48#endif
49
50/*
51 * Overrides for Emacs so that we follow Linus's tabbing style.
52 * Emacs will notice this stuff at the end of the file and automatically
53 * adjust the settings for this buffer only. This must remain at the end
54 * of the file.
55 * ---------------------------------------------------------------------------
56 * Local variables:
57 * c-file-style: "linux"
58 * End:
59 */
diff --git a/arch/um/include/um_uaccess.h b/arch/um/include/um_uaccess.h
index f8760a3f43b0..4567f1eeb4a7 100644
--- a/arch/um/include/um_uaccess.h
+++ b/arch/um/include/um_uaccess.h
@@ -17,6 +17,8 @@
17#include "uaccess-skas.h" 17#include "uaccess-skas.h"
18#endif 18#endif
19 19
20#include "asm/fixmap.h"
21
20#define __under_task_size(addr, size) \ 22#define __under_task_size(addr, size) \
21 (((unsigned long) (addr) < TASK_SIZE) && \ 23 (((unsigned long) (addr) < TASK_SIZE) && \
22 (((unsigned long) (addr) + (size)) < TASK_SIZE)) 24 (((unsigned long) (addr) + (size)) < TASK_SIZE))
diff --git a/arch/um/include/user.h b/arch/um/include/user.h
index 0f865ef46918..91b0ac4ad88c 100644
--- a/arch/um/include/user.h
+++ b/arch/um/include/user.h
@@ -18,6 +18,7 @@ extern int open_gdb_chan(void);
18extern unsigned long strlcpy(char *, const char *, unsigned long); 18extern unsigned long strlcpy(char *, const char *, unsigned long);
19extern unsigned long strlcat(char *, const char *, unsigned long); 19extern unsigned long strlcat(char *, const char *, unsigned long);
20extern void *um_vmalloc(int size); 20extern void *um_vmalloc(int size);
21extern void *um_vmalloc_atomic(int size);
21extern void vfree(void *ptr); 22extern void vfree(void *ptr);
22 23
23#endif 24#endif
diff --git a/arch/um/include/user_util.h b/arch/um/include/user_util.h
index bb505e01d994..a6f1f176cf84 100644
--- a/arch/um/include/user_util.h
+++ b/arch/um/include/user_util.h
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -23,12 +23,7 @@ struct cpu_task {
23 23
24extern struct cpu_task cpu_tasks[]; 24extern struct cpu_task cpu_tasks[];
25 25
26struct signal_info { 26extern void (*sig_info[])(int, union uml_pt_regs *);
27 void (*handler)(int, union uml_pt_regs *);
28 int is_irq;
29};
30
31extern struct signal_info sig_info[];
32 27
33extern unsigned long low_physmem; 28extern unsigned long low_physmem;
34extern unsigned long high_physmem; 29extern unsigned long high_physmem;
@@ -49,10 +44,6 @@ extern unsigned long brk_start;
49extern int pty_output_sigio; 44extern int pty_output_sigio;
50extern int pty_close_sigio; 45extern int pty_close_sigio;
51 46
52extern void stop(void);
53extern void stack_protections(unsigned long address);
54extern void task_protections(unsigned long address);
55extern int wait_for_stop(int pid, int sig, int cont_type, void *relay);
56extern void *add_signal_handler(int sig, void (*handler)(int)); 47extern void *add_signal_handler(int sig, void (*handler)(int));
57extern int linux_main(int argc, char **argv); 48extern int linux_main(int argc, char **argv);
58extern void set_cmdline(char *cmd); 49extern void set_cmdline(char *cmd);
@@ -60,12 +51,8 @@ extern void input_cb(void (*proc)(void *), void *arg, int arg_len);
60extern int get_pty(void); 51extern int get_pty(void);
61extern void *um_kmalloc(int size); 52extern void *um_kmalloc(int size);
62extern int switcheroo(int fd, int prot, void *from, void *to, int size); 53extern int switcheroo(int fd, int prot, void *from, void *to, int size);
63extern void setup_machinename(char *machine_out);
64extern void setup_hostinfo(void);
65extern void do_exec(int old_pid, int new_pid); 54extern void do_exec(int old_pid, int new_pid);
66extern void tracer_panic(char *msg, ...); 55extern void tracer_panic(char *msg, ...);
67extern char *get_umid(int only_if_set);
68extern void do_longjmp(void *p, int val);
69extern int detach(int pid, int sig); 56extern int detach(int pid, int sig);
70extern int attach(int pid); 57extern int attach(int pid);
71extern void kill_child_dead(int pid); 58extern void kill_child_dead(int pid);
@@ -77,18 +64,6 @@ extern int cpu_feature(char *what, char *buf, int len);
77extern int arch_handle_signal(int sig, union uml_pt_regs *regs); 64extern int arch_handle_signal(int sig, union uml_pt_regs *regs);
78extern int arch_fixup(unsigned long address, void *sc_ptr); 65extern int arch_fixup(unsigned long address, void *sc_ptr);
79extern void arch_init_thread(void); 66extern void arch_init_thread(void);
80extern int setjmp_wrapper(void (*proc)(void *, void *), ...);
81extern int raw(int fd); 67extern int raw(int fd);
82 68
83#endif 69#endif
84
85/*
86 * Overrides for Emacs so that we follow Linus's tabbing style.
87 * Emacs will notice this stuff at the end of the file and automatically
88 * adjust the settings for this buffer only. This must remain at the end
89 * of the file.
90 * ---------------------------------------------------------------------------
91 * Local variables:
92 * c-file-style: "linux"
93 * End:
94 */
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index 3de9d21e36bf..693018ba80f1 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -9,9 +9,8 @@ clean-files :=
9obj-y = config.o exec_kern.o exitcode.o \ 9obj-y = config.o exec_kern.o exitcode.o \
10 init_task.o irq.o irq_user.o ksyms.o mem.o physmem.o \ 10 init_task.o irq.o irq_user.o ksyms.o mem.o physmem.o \
11 process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \ 11 process_kern.o ptrace.o reboot.o resource.o sigio_user.o sigio_kern.o \
12 signal_kern.o signal_user.o smp.o syscall_kern.o sysrq.o time.o \ 12 signal_kern.o smp.o syscall_kern.o sysrq.o \
13 time_kern.o tlb.o trap_kern.o trap_user.o uaccess.o um_arch.o \ 13 time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o
14 umid.o user_util.o
15 14
16obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o 15obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
17obj-$(CONFIG_GPROF) += gprof_syms.o 16obj-$(CONFIG_GPROF) += gprof_syms.o
@@ -24,7 +23,7 @@ obj-$(CONFIG_MODE_SKAS) += skas/
24 23
25user-objs-$(CONFIG_TTY_LOG) += tty_log.o 24user-objs-$(CONFIG_TTY_LOG) += tty_log.o
26 25
27USER_OBJS := $(user-objs-y) config.o time.o tty_log.o umid.o user_util.o 26USER_OBJS := $(user-objs-y) config.o tty_log.o
28 27
29include arch/um/scripts/Makefile.rules 28include arch/um/scripts/Makefile.rules
30 29
diff --git a/arch/um/kernel/asm-offsets.c b/arch/um/kernel/asm-offsets.c
index c13a64a288f6..91ea538e1612 100644
--- a/arch/um/kernel/asm-offsets.c
+++ b/arch/um/kernel/asm-offsets.c
@@ -1 +1 @@
/* Dummy file to make kbuild happy - unused! */ #include "sysdep/kernel-offsets.h"
diff --git a/arch/um/kernel/exec_kern.c b/arch/um/kernel/exec_kern.c
index efd222ffe20e..569fe8b9b053 100644
--- a/arch/um/kernel/exec_kern.c
+++ b/arch/um/kernel/exec_kern.c
@@ -17,7 +17,6 @@
17#include "irq_user.h" 17#include "irq_user.h"
18#include "tlb.h" 18#include "tlb.h"
19#include "os.h" 19#include "os.h"
20#include "time_user.h"
21#include "choose-mode.h" 20#include "choose-mode.h"
22#include "mode_kern.h" 21#include "mode_kern.h"
23 22
diff --git a/arch/um/kernel/irq_user.c b/arch/um/kernel/irq_user.c
index c3ccaf24f3e0..0e32f5f4a887 100644
--- a/arch/um/kernel/irq_user.c
+++ b/arch/um/kernel/irq_user.c
@@ -15,7 +15,6 @@
15#include "kern_util.h" 15#include "kern_util.h"
16#include "user.h" 16#include "user.h"
17#include "process.h" 17#include "process.h"
18#include "signal_user.h"
19#include "sigio.h" 18#include "sigio.h"
20#include "irq_user.h" 19#include "irq_user.h"
21#include "os.h" 20#include "os.h"
@@ -29,7 +28,6 @@ struct irq_fd {
29 int pid; 28 int pid;
30 int events; 29 int events;
31 int current_events; 30 int current_events;
32 int freed;
33}; 31};
34 32
35static struct irq_fd *active_fds = NULL; 33static struct irq_fd *active_fds = NULL;
@@ -41,9 +39,11 @@ static int pollfds_size = 0;
41 39
42extern int io_count, intr_count; 40extern int io_count, intr_count;
43 41
42extern void free_irqs(void);
43
44void sigio_handler(int sig, union uml_pt_regs *regs) 44void sigio_handler(int sig, union uml_pt_regs *regs)
45{ 45{
46 struct irq_fd *irq_fd, *next; 46 struct irq_fd *irq_fd;
47 int i, n; 47 int i, n;
48 48
49 if(smp_sigio_handler()) return; 49 if(smp_sigio_handler()) return;
@@ -66,29 +66,15 @@ void sigio_handler(int sig, union uml_pt_regs *regs)
66 irq_fd = irq_fd->next; 66 irq_fd = irq_fd->next;
67 } 67 }
68 68
69 for(irq_fd = active_fds; irq_fd != NULL; irq_fd = next){ 69 for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
70 next = irq_fd->next;
71 if(irq_fd->current_events != 0){ 70 if(irq_fd->current_events != 0){
72 irq_fd->current_events = 0; 71 irq_fd->current_events = 0;
73 do_IRQ(irq_fd->irq, regs); 72 do_IRQ(irq_fd->irq, regs);
74
75 /* This is here because the next irq may be
76 * freed in the handler. If a console goes
77 * away, both the read and write irqs will be
78 * freed. After do_IRQ, ->next will point to
79 * a good IRQ.
80 * Irqs can't be freed inside their handlers,
81 * so the next best thing is to have them
82 * marked as needing freeing, so that they
83 * can be freed here.
84 */
85 next = irq_fd->next;
86 if(irq_fd->freed){
87 free_irq(irq_fd->irq, irq_fd->id);
88 }
89 } 73 }
90 } 74 }
91 } 75 }
76
77 free_irqs();
92} 78}
93 79
94int activate_ipi(int fd, int pid) 80int activate_ipi(int fd, int pid)
@@ -136,8 +122,7 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
136 .irq = irq, 122 .irq = irq,
137 .pid = pid, 123 .pid = pid,
138 .events = events, 124 .events = events,
139 .current_events = 0, 125 .current_events = 0 } );
140 .freed = 0 } );
141 126
142 /* Critical section - locked by a spinlock because this stuff can 127 /* Critical section - locked by a spinlock because this stuff can
143 * be changed from interrupt handlers. The stuff above is done 128 * be changed from interrupt handlers. The stuff above is done
@@ -313,26 +298,6 @@ static struct irq_fd *find_irq_by_fd(int fd, int irqnum, int *index_out)
313 return(irq); 298 return(irq);
314} 299}
315 300
316void free_irq_later(int irq, void *dev_id)
317{
318 struct irq_fd *irq_fd;
319 unsigned long flags;
320
321 flags = irq_lock();
322 for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
323 if((irq_fd->irq == irq) && (irq_fd->id == dev_id))
324 break;
325 }
326 if(irq_fd == NULL){
327 printk("free_irq_later found no irq, irq = %d, "
328 "dev_id = 0x%p\n", irq, dev_id);
329 goto out;
330 }
331 irq_fd->freed = 1;
332 out:
333 irq_unlock(flags);
334}
335
336void reactivate_fd(int fd, int irqnum) 301void reactivate_fd(int fd, int irqnum)
337{ 302{
338 struct irq_fd *irq; 303 struct irq_fd *irq;
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c
index 34b54a3e2132..3113cab8675e 100644
--- a/arch/um/kernel/process_kern.c
+++ b/arch/um/kernel/process_kern.c
@@ -36,11 +36,9 @@
36#include "kern_util.h" 36#include "kern_util.h"
37#include "kern.h" 37#include "kern.h"
38#include "signal_kern.h" 38#include "signal_kern.h"
39#include "signal_user.h"
40#include "init.h" 39#include "init.h"
41#include "irq_user.h" 40#include "irq_user.h"
42#include "mem_user.h" 41#include "mem_user.h"
43#include "time_user.h"
44#include "tlb.h" 42#include "tlb.h"
45#include "frame_kern.h" 43#include "frame_kern.h"
46#include "sigcontext.h" 44#include "sigcontext.h"
@@ -108,7 +106,7 @@ void set_current(void *t)
108{ 106{
109 struct task_struct *task = t; 107 struct task_struct *task = t;
110 108
111 cpu_tasks[task->thread_info->cpu] = ((struct cpu_task) 109 cpu_tasks[task_thread_info(task)->cpu] = ((struct cpu_task)
112 { external_pid(task), task }); 110 { external_pid(task), task });
113} 111}
114 112
@@ -289,17 +287,27 @@ EXPORT_SYMBOL(disable_hlt);
289 287
290void *um_kmalloc(int size) 288void *um_kmalloc(int size)
291{ 289{
292 return(kmalloc(size, GFP_KERNEL)); 290 return kmalloc(size, GFP_KERNEL);
293} 291}
294 292
295void *um_kmalloc_atomic(int size) 293void *um_kmalloc_atomic(int size)
296{ 294{
297 return(kmalloc(size, GFP_ATOMIC)); 295 return kmalloc(size, GFP_ATOMIC);
298} 296}
299 297
300void *um_vmalloc(int size) 298void *um_vmalloc(int size)
301{ 299{
302 return(vmalloc(size)); 300 return vmalloc(size);
301}
302
303void *um_vmalloc_atomic(int size)
304{
305 return __vmalloc(size, GFP_ATOMIC | __GFP_HIGHMEM, PAGE_KERNEL);
306}
307
308int __cant_sleep(void) {
309 return in_atomic() || irqs_disabled() || in_interrupt();
310 /* Is in_interrupt() really needed? */
303} 311}
304 312
305unsigned long get_fault_addr(void) 313unsigned long get_fault_addr(void)
@@ -324,10 +332,6 @@ int user_context(unsigned long sp)
324 return(stack != (unsigned long) current_thread); 332 return(stack != (unsigned long) current_thread);
325} 333}
326 334
327extern void remove_umid_dir(void);
328
329__uml_exitcall(remove_umid_dir);
330
331extern exitcall_t __uml_exitcall_begin, __uml_exitcall_end; 335extern exitcall_t __uml_exitcall_begin, __uml_exitcall_end;
332 336
333void do_uml_exitcalls(void) 337void do_uml_exitcalls(void)
@@ -375,11 +379,6 @@ int smp_sigio_handler(void)
375 return(0); 379 return(0);
376} 380}
377 381
378int um_in_interrupt(void)
379{
380 return(in_interrupt());
381}
382
383int cpu(void) 382int cpu(void)
384{ 383{
385 return(current_thread->cpu); 384 return(current_thread->cpu);
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index a637e885c583..6f1a3a288117 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -12,6 +12,8 @@
12#include "mode.h" 12#include "mode.h"
13#include "choose-mode.h" 13#include "choose-mode.h"
14 14
15void (*pm_power_off)(void);
16
15#ifdef CONFIG_SMP 17#ifdef CONFIG_SMP
16static void kill_idlers(int me) 18static void kill_idlers(int me)
17{ 19{
diff --git a/arch/um/kernel/sigio_user.c b/arch/um/kernel/sigio_user.c
index 48b1f644b9a6..f7b18e157d35 100644
--- a/arch/um/kernel/sigio_user.c
+++ b/arch/um/kernel/sigio_user.c
@@ -216,6 +216,8 @@ static int write_sigio_thread(void *unused)
216 "err = %d\n", -n); 216 "err = %d\n", -n);
217 } 217 }
218 } 218 }
219
220 return 0;
219} 221}
220 222
221static int need_poll(int n) 223static int need_poll(int n)
@@ -335,70 +337,103 @@ int ignore_sigio_fd(int fd)
335 return(err); 337 return(err);
336} 338}
337 339
338static int setup_initial_poll(int fd) 340static struct pollfd* setup_initial_poll(int fd)
339{ 341{
340 struct pollfd *p; 342 struct pollfd *p;
341 343
342 p = um_kmalloc_atomic(sizeof(struct pollfd)); 344 p = um_kmalloc(sizeof(struct pollfd));
343 if(p == NULL){ 345 if (p == NULL) {
344 printk("setup_initial_poll : failed to allocate poll\n"); 346 printk("setup_initial_poll : failed to allocate poll\n");
345 return(-1); 347 return NULL;
346 } 348 }
347 *p = ((struct pollfd) { .fd = fd, 349 *p = ((struct pollfd) { .fd = fd,
348 .events = POLLIN, 350 .events = POLLIN,
349 .revents = 0 }); 351 .revents = 0 });
350 current_poll = ((struct pollfds) { .poll = p, 352 return p;
351 .used = 1,
352 .size = 1 });
353 return(0);
354} 353}
355 354
356void write_sigio_workaround(void) 355void write_sigio_workaround(void)
357{ 356{
358 unsigned long stack; 357 unsigned long stack;
358 struct pollfd *p;
359 int err; 359 int err;
360 int l_write_sigio_fds[2];
361 int l_sigio_private[2];
362 int l_write_sigio_pid;
360 363
364 /* We call this *tons* of times - and most ones we must just fail. */
361 sigio_lock(); 365 sigio_lock();
362 if(write_sigio_pid != -1) 366 l_write_sigio_pid = write_sigio_pid;
363 goto out; 367 sigio_unlock();
368
369 if (l_write_sigio_pid != -1)
370 return;
364 371
365 err = os_pipe(write_sigio_fds, 1, 1); 372 err = os_pipe(l_write_sigio_fds, 1, 1);
366 if(err < 0){ 373 if(err < 0){
367 printk("write_sigio_workaround - os_pipe 1 failed, " 374 printk("write_sigio_workaround - os_pipe 1 failed, "
368 "err = %d\n", -err); 375 "err = %d\n", -err);
369 goto out; 376 return;
370 } 377 }
371 err = os_pipe(sigio_private, 1, 1); 378 err = os_pipe(l_sigio_private, 1, 1);
372 if(err < 0){ 379 if(err < 0){
373 printk("write_sigio_workaround - os_pipe 2 failed, " 380 printk("write_sigio_workaround - os_pipe 1 failed, "
374 "err = %d\n", -err); 381 "err = %d\n", -err);
375 goto out_close1; 382 goto out_close1;
376 } 383 }
377 if(setup_initial_poll(sigio_private[1])) 384
385 p = setup_initial_poll(l_sigio_private[1]);
386 if(!p)
378 goto out_close2; 387 goto out_close2;
379 388
380 write_sigio_pid = run_helper_thread(write_sigio_thread, NULL, 389 sigio_lock();
390
391 /* Did we race? Don't try to optimize this, please, it's not so likely
392 * to happen, and no more than once at the boot. */
393 if(write_sigio_pid != -1)
394 goto out_unlock;
395
396 write_sigio_pid = run_helper_thread(write_sigio_thread, NULL,
381 CLONE_FILES | CLONE_VM, &stack, 0); 397 CLONE_FILES | CLONE_VM, &stack, 0);
382 398
383 if(write_sigio_pid < 0) goto out_close2; 399 if (write_sigio_pid < 0)
400 goto out_clear;
384 401
385 if(write_sigio_irq(write_sigio_fds[0])) 402 if (write_sigio_irq(l_write_sigio_fds[0]))
386 goto out_kill; 403 goto out_kill;
387 404
388 out: 405 /* Success, finally. */
406 memcpy(write_sigio_fds, l_write_sigio_fds, sizeof(l_write_sigio_fds));
407 memcpy(sigio_private, l_sigio_private, sizeof(l_sigio_private));
408
409 current_poll = ((struct pollfds) { .poll = p,
410 .used = 1,
411 .size = 1 });
412
389 sigio_unlock(); 413 sigio_unlock();
390 return; 414 return;
391 415
392 out_kill: 416 out_kill:
393 os_kill_process(write_sigio_pid, 1); 417 l_write_sigio_pid = write_sigio_pid;
418 write_sigio_pid = -1;
419 sigio_unlock();
420 /* Going to call waitpid, avoid holding the lock. */
421 os_kill_process(l_write_sigio_pid, 1);
422 goto out_free;
423
424 out_clear:
394 write_sigio_pid = -1; 425 write_sigio_pid = -1;
426 out_unlock:
427 sigio_unlock();
428 out_free:
429 kfree(p);
395 out_close2: 430 out_close2:
396 os_close_file(sigio_private[0]); 431 os_close_file(l_sigio_private[0]);
397 os_close_file(sigio_private[1]); 432 os_close_file(l_sigio_private[1]);
398 out_close1: 433 out_close1:
399 os_close_file(write_sigio_fds[0]); 434 os_close_file(l_write_sigio_fds[0]);
400 os_close_file(write_sigio_fds[1]); 435 os_close_file(l_write_sigio_fds[1]);
401 sigio_unlock(); 436 return;
402} 437}
403 438
404int read_sigio_fd(int fd) 439int read_sigio_fd(int fd)
diff --git a/arch/um/kernel/signal_kern.c b/arch/um/kernel/signal_kern.c
index 03618bd13d55..da17b7541e08 100644
--- a/arch/um/kernel/signal_kern.c
+++ b/arch/um/kernel/signal_kern.c
@@ -22,7 +22,6 @@
22#include "asm/ucontext.h" 22#include "asm/ucontext.h"
23#include "kern_util.h" 23#include "kern_util.h"
24#include "signal_kern.h" 24#include "signal_kern.h"
25#include "signal_user.h"
26#include "kern.h" 25#include "kern.h"
27#include "frame_kern.h" 26#include "frame_kern.h"
28#include "sigcontext.h" 27#include "sigcontext.h"
@@ -100,31 +99,46 @@ static int handle_signal(struct pt_regs *regs, unsigned long signr,
100 return err; 99 return err;
101} 100}
102 101
103static int kern_do_signal(struct pt_regs *regs, sigset_t *oldset) 102static int kern_do_signal(struct pt_regs *regs)
104{ 103{
105 struct k_sigaction ka_copy; 104 struct k_sigaction ka_copy;
106 siginfo_t info; 105 siginfo_t info;
106 sigset_t *oldset;
107 int sig, handled_sig = 0; 107 int sig, handled_sig = 0;
108 108
109 if (test_thread_flag(TIF_RESTORE_SIGMASK))
110 oldset = &current->saved_sigmask;
111 else
112 oldset = &current->blocked;
113
109 while((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0){ 114 while((sig = get_signal_to_deliver(&info, &ka_copy, regs, NULL)) > 0){
110 handled_sig = 1; 115 handled_sig = 1;
111 /* Whee! Actually deliver the signal. */ 116 /* Whee! Actually deliver the signal. */
112 if(!handle_signal(regs, sig, &ka_copy, &info, oldset)) 117 if(!handle_signal(regs, sig, &ka_copy, &info, oldset)){
118 /* a signal was successfully delivered; the saved
119 * sigmask will have been stored in the signal frame,
120 * and will be restored by sigreturn, so we can simply
121 * clear the TIF_RESTORE_SIGMASK flag */
122 if (test_thread_flag(TIF_RESTORE_SIGMASK))
123 clear_thread_flag(TIF_RESTORE_SIGMASK);
113 break; 124 break;
125 }
114 } 126 }
115 127
116 /* Did we come from a system call? */ 128 /* Did we come from a system call? */
117 if(!handled_sig && (PT_REGS_SYSCALL_NR(regs) >= 0)){ 129 if(!handled_sig && (PT_REGS_SYSCALL_NR(regs) >= 0)){
118 /* Restart the system call - no handlers present */ 130 /* Restart the system call - no handlers present */
119 if(PT_REGS_SYSCALL_RET(regs) == -ERESTARTNOHAND || 131 switch(PT_REGS_SYSCALL_RET(regs)){
120 PT_REGS_SYSCALL_RET(regs) == -ERESTARTSYS || 132 case -ERESTARTNOHAND:
121 PT_REGS_SYSCALL_RET(regs) == -ERESTARTNOINTR){ 133 case -ERESTARTSYS:
134 case -ERESTARTNOINTR:
122 PT_REGS_ORIG_SYSCALL(regs) = PT_REGS_SYSCALL_NR(regs); 135 PT_REGS_ORIG_SYSCALL(regs) = PT_REGS_SYSCALL_NR(regs);
123 PT_REGS_RESTART_SYSCALL(regs); 136 PT_REGS_RESTART_SYSCALL(regs);
124 } 137 break;
125 else if(PT_REGS_SYSCALL_RET(regs) == -ERESTART_RESTARTBLOCK){ 138 case -ERESTART_RESTARTBLOCK:
126 PT_REGS_SYSCALL_RET(regs) = __NR_restart_syscall; 139 PT_REGS_SYSCALL_RET(regs) = __NR_restart_syscall;
127 PT_REGS_RESTART_SYSCALL(regs); 140 PT_REGS_RESTART_SYSCALL(regs);
141 break;
128 } 142 }
129 } 143 }
130 144
@@ -138,12 +152,19 @@ static int kern_do_signal(struct pt_regs *regs, sigset_t *oldset)
138 if(current->ptrace & PT_DTRACE) 152 if(current->ptrace & PT_DTRACE)
139 current->thread.singlestep_syscall = 153 current->thread.singlestep_syscall =
140 is_syscall(PT_REGS_IP(&current->thread.regs)); 154 is_syscall(PT_REGS_IP(&current->thread.regs));
155
156 /* if there's no signal to deliver, we just put the saved sigmask
157 * back */
158 if (!handled_sig && test_thread_flag(TIF_RESTORE_SIGMASK)) {
159 clear_thread_flag(TIF_RESTORE_SIGMASK);
160 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL);
161 }
141 return(handled_sig); 162 return(handled_sig);
142} 163}
143 164
144int do_signal(void) 165int do_signal(void)
145{ 166{
146 return(kern_do_signal(&current->thread.regs, &current->blocked)); 167 return(kern_do_signal(&current->thread.regs));
147} 168}
148 169
149/* 170/*
@@ -151,63 +172,20 @@ int do_signal(void)
151 */ 172 */
152long sys_sigsuspend(int history0, int history1, old_sigset_t mask) 173long sys_sigsuspend(int history0, int history1, old_sigset_t mask)
153{ 174{
154 sigset_t saveset;
155
156 mask &= _BLOCKABLE; 175 mask &= _BLOCKABLE;
157 spin_lock_irq(&current->sighand->siglock); 176 spin_lock_irq(&current->sighand->siglock);
158 saveset = current->blocked; 177 current->saved_sigmask = current->blocked;
159 siginitset(&current->blocked, mask); 178 siginitset(&current->blocked, mask);
160 recalc_sigpending(); 179 recalc_sigpending();
161 spin_unlock_irq(&current->sighand->siglock); 180 spin_unlock_irq(&current->sighand->siglock);
162 181
163 PT_REGS_SYSCALL_RET(&current->thread.regs) = -EINTR; 182 current->state = TASK_INTERRUPTIBLE;
164 while (1) { 183 schedule();
165 current->state = TASK_INTERRUPTIBLE; 184 set_thread_flag(TIF_RESTORE_SIGMASK);
166 schedule(); 185 return -ERESTARTNOHAND;
167 if(kern_do_signal(&current->thread.regs, &saveset))
168 return(-EINTR);
169 }
170}
171
172long sys_rt_sigsuspend(sigset_t __user *unewset, size_t sigsetsize)
173{
174 sigset_t saveset, newset;
175
176 /* XXX: Don't preclude handling different sized sigset_t's. */
177 if (sigsetsize != sizeof(sigset_t))
178 return -EINVAL;
179
180 if (copy_from_user(&newset, unewset, sizeof(newset)))
181 return -EFAULT;
182 sigdelsetmask(&newset, ~_BLOCKABLE);
183
184 spin_lock_irq(&current->sighand->siglock);
185 saveset = current->blocked;
186 current->blocked = newset;
187 recalc_sigpending();
188 spin_unlock_irq(&current->sighand->siglock);
189
190 PT_REGS_SYSCALL_RET(&current->thread.regs) = -EINTR;
191 while (1) {
192 current->state = TASK_INTERRUPTIBLE;
193 schedule();
194 if (kern_do_signal(&current->thread.regs, &saveset))
195 return(-EINTR);
196 }
197} 186}
198 187
199long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss) 188long sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
200{ 189{
201 return(do_sigaltstack(uss, uoss, PT_REGS_SP(&current->thread.regs))); 190 return(do_sigaltstack(uss, uoss, PT_REGS_SP(&current->thread.regs)));
202} 191}
203
204/*
205 * Overrides for Emacs so that we follow Linus's tabbing style.
206 * Emacs will notice this stuff at the end of the file and automatically
207 * adjust the settings for this buffer only. This must remain at the end
208 * of the file.
209 * ---------------------------------------------------------------------------
210 * Local variables:
211 * c-file-style: "linux"
212 * End:
213 */
diff --git a/arch/um/kernel/signal_user.c b/arch/um/kernel/signal_user.c
deleted file mode 100644
index 62f457835fb1..000000000000
--- a/arch/um/kernel/signal_user.c
+++ /dev/null
@@ -1,157 +0,0 @@
1/*
2 * Copyright (C) 2000 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 <signal.h>
10#include <errno.h>
11#include <stdarg.h>
12#include <string.h>
13#include <sys/mman.h>
14#include "user_util.h"
15#include "kern_util.h"
16#include "user.h"
17#include "signal_user.h"
18#include "signal_kern.h"
19#include "sysdep/sigcontext.h"
20#include "sigcontext.h"
21
22void set_sigstack(void *sig_stack, int size)
23{
24 stack_t stack = ((stack_t) { .ss_flags = 0,
25 .ss_sp = (__ptr_t) sig_stack,
26 .ss_size = size - sizeof(void *) });
27
28 if(sigaltstack(&stack, NULL) != 0)
29 panic("enabling signal stack failed, errno = %d\n", errno);
30}
31
32void set_handler(int sig, void (*handler)(int), int flags, ...)
33{
34 struct sigaction action;
35 va_list ap;
36 int mask;
37
38 va_start(ap, flags);
39 action.sa_handler = handler;
40 sigemptyset(&action.sa_mask);
41 while((mask = va_arg(ap, int)) != -1){
42 sigaddset(&action.sa_mask, mask);
43 }
44 va_end(ap);
45 action.sa_flags = flags;
46 action.sa_restorer = NULL;
47 if(sigaction(sig, &action, NULL) < 0)
48 panic("sigaction failed");
49}
50
51int change_sig(int signal, int on)
52{
53 sigset_t sigset, old;
54
55 sigemptyset(&sigset);
56 sigaddset(&sigset, signal);
57 sigprocmask(on ? SIG_UNBLOCK : SIG_BLOCK, &sigset, &old);
58 return(!sigismember(&old, signal));
59}
60
61/* Both here and in set/get_signal we don't touch SIGPROF, because we must not
62 * disable profiling; it's safe because the profiling code does not interact
63 * with the kernel code at all.*/
64
65static void change_signals(int type)
66{
67 sigset_t mask;
68
69 sigemptyset(&mask);
70 sigaddset(&mask, SIGVTALRM);
71 sigaddset(&mask, SIGALRM);
72 sigaddset(&mask, SIGIO);
73 if(sigprocmask(type, &mask, NULL) < 0)
74 panic("Failed to change signal mask - errno = %d", errno);
75}
76
77void block_signals(void)
78{
79 change_signals(SIG_BLOCK);
80}
81
82void unblock_signals(void)
83{
84 change_signals(SIG_UNBLOCK);
85}
86
87/* These are the asynchronous signals. SIGVTALRM and SIGARLM are handled
88 * together under SIGVTALRM_BIT. SIGPROF is excluded because we want to
89 * be able to profile all of UML, not just the non-critical sections. If
90 * profiling is not thread-safe, then that is not my problem. We can disable
91 * profiling when SMP is enabled in that case.
92 */
93#define SIGIO_BIT 0
94#define SIGVTALRM_BIT 1
95
96static int enable_mask(sigset_t *mask)
97{
98 int sigs;
99
100 sigs = sigismember(mask, SIGIO) ? 0 : 1 << SIGIO_BIT;
101 sigs |= sigismember(mask, SIGVTALRM) ? 0 : 1 << SIGVTALRM_BIT;
102 sigs |= sigismember(mask, SIGALRM) ? 0 : 1 << SIGVTALRM_BIT;
103 return(sigs);
104}
105
106int get_signals(void)
107{
108 sigset_t mask;
109
110 if(sigprocmask(SIG_SETMASK, NULL, &mask) < 0)
111 panic("Failed to get signal mask");
112 return(enable_mask(&mask));
113}
114
115int set_signals(int enable)
116{
117 sigset_t mask;
118 int ret;
119
120 sigemptyset(&mask);
121 if(enable & (1 << SIGIO_BIT))
122 sigaddset(&mask, SIGIO);
123 if(enable & (1 << SIGVTALRM_BIT)){
124 sigaddset(&mask, SIGVTALRM);
125 sigaddset(&mask, SIGALRM);
126 }
127
128 /* This is safe - sigprocmask is guaranteed to copy locally the
129 * value of new_set, do his work and then, at the end, write to
130 * old_set.
131 */
132 if(sigprocmask(SIG_UNBLOCK, &mask, &mask) < 0)
133 panic("Failed to enable signals");
134 ret = enable_mask(&mask);
135 sigemptyset(&mask);
136 if((enable & (1 << SIGIO_BIT)) == 0)
137 sigaddset(&mask, SIGIO);
138 if((enable & (1 << SIGVTALRM_BIT)) == 0){
139 sigaddset(&mask, SIGVTALRM);
140 sigaddset(&mask, SIGALRM);
141 }
142 if(sigprocmask(SIG_BLOCK, &mask, NULL) < 0)
143 panic("Failed to block signals");
144
145 return(ret);
146}
147
148/*
149 * Overrides for Emacs so that we follow Linus's tabbing style.
150 * Emacs will notice this stuff at the end of the file and automatically
151 * adjust the settings for this buffer only. This must remain at the end
152 * of the file.
153 * ---------------------------------------------------------------------------
154 * Local variables:
155 * c-file-style: "linux"
156 * End:
157 */
diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile
index 8de471b59c1c..57181a920d48 100644
--- a/arch/um/kernel/skas/Makefile
+++ b/arch/um/kernel/skas/Makefile
@@ -1,12 +1,12 @@
1# 1#
2# Copyright (C) 2002 - 2004 Jeff Dike (jdike@addtoit.com) 2# Copyright (C) 2002 - 2004 Jeff Dike (jdike@addtoit.com)
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-y := clone.o exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \ 6obj-y := clone.o exec_kern.o mem.o mmu.o process_kern.o \
7 syscall.o tlb.o trap_user.o uaccess.o 7 syscall.o tlb.o uaccess.o
8 8
9USER_OBJS := process.o clone.o 9USER_OBJS := clone.o
10 10
11include arch/um/scripts/Makefile.rules 11include arch/um/scripts/Makefile.rules
12 12
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c
index cb37ce9124a6..47b812b3bca8 100644
--- a/arch/um/kernel/skas/clone.c
+++ b/arch/um/kernel/skas/clone.c
@@ -18,11 +18,10 @@
18 * on some systems. 18 * on some systems.
19 */ 19 */
20 20
21#define STUB_DATA(field) (((struct stub_data *) UML_CONFIG_STUB_DATA)->field)
22
23void __attribute__ ((__section__ (".__syscall_stub"))) 21void __attribute__ ((__section__ (".__syscall_stub")))
24stub_clone_handler(void) 22stub_clone_handler(void)
25{ 23{
24 struct stub_data *data = (struct stub_data *) UML_CONFIG_STUB_DATA;
26 long err; 25 long err;
27 26
28 err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD, 27 err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD,
@@ -35,17 +34,21 @@ stub_clone_handler(void)
35 if(err) 34 if(err)
36 goto out; 35 goto out;
37 36
38 err = stub_syscall3(__NR_setitimer, ITIMER_VIRTUAL, 37 err = stub_syscall3(__NR_setitimer, ITIMER_VIRTUAL,
39 (long) &STUB_DATA(timer), 0); 38 (long) &data->timer, 0);
40 if(err) 39 if(err)
41 goto out; 40 goto out;
42 41
43 err = stub_syscall6(STUB_MMAP_NR, UML_CONFIG_STUB_DATA, 42 remap_stack(data->fd, data->offset);
44 UM_KERN_PAGE_SIZE, PROT_READ | PROT_WRITE, 43 goto done;
45 MAP_FIXED | MAP_SHARED, STUB_DATA(fd), 44
46 STUB_DATA(offset));
47 out: 45 out:
48 /* save current result. Parent: pid; child: retcode of mmap */ 46 /* save current result.
49 STUB_DATA(err) = err; 47 * Parent: pid;
48 * child: retcode of mmap already saved and it jumps around this
49 * assignment
50 */
51 data->err = err;
52 done:
50 trap_myself(); 53 trap_myself();
51} 54}
diff --git a/arch/um/kernel/skas/include/mmu-skas.h b/arch/um/kernel/skas/include/mmu-skas.h
deleted file mode 100644
index 44110c521e49..000000000000
--- a/arch/um/kernel/skas/include/mmu-skas.h
+++ /dev/null
@@ -1,35 +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 "linux/config.h"
10#include "mm_id.h"
11#include "asm/ldt.h"
12
13struct mmu_context_skas {
14 struct mm_id id;
15 unsigned long last_page_table;
16#ifdef CONFIG_3_LEVEL_PGTABLES
17 unsigned long last_pmd;
18#endif
19 uml_ldt_t ldt;
20};
21
22extern void switch_mm_skas(struct mm_id * mm_idp);
23
24#endif
25
26/*
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/kernel/skas/include/mode-skas.h b/arch/um/kernel/skas/include/mode-skas.h
deleted file mode 100644
index bcd26a6a3888..000000000000
--- a/arch/um/kernel/skas/include/mode-skas.h
+++ /dev/null
@@ -1,33 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MODE_SKAS_H__
7#define __MODE_SKAS_H__
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 sig_handler_common_skas(int sig, void *sc_ptr);
17extern void halt_skas(void);
18extern void reboot_skas(void);
19extern void kill_off_processes_skas(void);
20extern int is_skas_winch(int pid, int fd, void *data);
21
22#endif
23
24/*
25 * Overrides for Emacs so that we follow Linus's tabbing style.
26 * Emacs will notice this stuff at the end of the file and automatically
27 * adjust the settings for this buffer only. This must remain at the end
28 * of the file.
29 * ---------------------------------------------------------------------------
30 * Local variables:
31 * c-file-style: "linux"
32 * End:
33 */
diff --git a/arch/um/kernel/skas/include/skas.h b/arch/um/kernel/skas/include/skas.h
deleted file mode 100644
index daa2f85b684c..000000000000
--- a/arch/um/kernel/skas/include/skas.h
+++ /dev/null
@@ -1,50 +0,0 @@
1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SKAS_H
7#define __SKAS_H
8
9#include "mm_id.h"
10#include "sysdep/ptrace.h"
11
12extern int userspace_pid[];
13extern int proc_mm, ptrace_faultinfo, ptrace_ldt;
14extern int skas_needs_stub;
15
16extern void switch_threads(void *me, void *next);
17extern void thread_wait(void *sw, void *fb);
18extern void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
19 void (*handler)(int));
20extern int start_idle_thread(void *stack, void *switch_buf_ptr,
21 void **fork_buf_ptr);
22extern int user_thread(unsigned long stack, int flags);
23extern void userspace(union uml_pt_regs *regs);
24extern void new_thread_proc(void *stack, void (*handler)(int sig));
25extern void remove_sigstack(void);
26extern void new_thread_handler(int sig);
27extern void handle_syscall(union uml_pt_regs *regs);
28extern int map(struct mm_id * mm_idp, unsigned long virt,
29 unsigned long len, int r, int w, int x, int phys_fd,
30 unsigned long long offset, int done, void **data);
31extern int unmap(struct mm_id * mm_idp, void *addr, unsigned long len,
32 int done, void **data);
33extern int protect(struct mm_id * mm_idp, unsigned long addr,
34 unsigned long len, int r, int w, int x, int done,
35 void **data);
36extern void user_signal(int sig, union uml_pt_regs *regs, int pid);
37extern int new_mm(int from, unsigned long stack);
38extern int start_userspace(unsigned long stub_stack);
39extern int copy_context_skas0(unsigned long stack, int pid);
40extern void get_skas_faultinfo(int pid, struct faultinfo * fi);
41extern long execute_syscall_skas(void *r);
42extern unsigned long current_stub_stack(void);
43extern long run_syscall_stub(struct mm_id * mm_idp,
44 int syscall, unsigned long *args, long expected,
45 void **addr, int done);
46extern long syscall_stub_data(struct mm_id * mm_idp,
47 unsigned long *data, int data_count,
48 void **addr, void **stub_addr);
49
50#endif
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 677871f1b37c..c5c9885a8297 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -78,7 +78,7 @@ int init_new_context_skas(struct task_struct *task, struct mm_struct *mm)
78 struct mmu_context_skas *from_mm = NULL; 78 struct mmu_context_skas *from_mm = NULL;
79 struct mmu_context_skas *to_mm = &mm->context.skas; 79 struct mmu_context_skas *to_mm = &mm->context.skas;
80 unsigned long stack = 0; 80 unsigned long stack = 0;
81 int from_fd, ret = -ENOMEM; 81 int ret = -ENOMEM;
82 82
83 if(skas_needs_stub){ 83 if(skas_needs_stub){
84 stack = get_zeroed_page(GFP_KERNEL); 84 stack = get_zeroed_page(GFP_KERNEL);
@@ -108,11 +108,7 @@ int init_new_context_skas(struct task_struct *task, struct mm_struct *mm)
108 from_mm = &current->mm->context.skas; 108 from_mm = &current->mm->context.skas;
109 109
110 if(proc_mm){ 110 if(proc_mm){
111 if(from_mm) 111 ret = new_mm(stack);
112 from_fd = from_mm->id.u.mm_fd;
113 else from_fd = -1;
114
115 ret = new_mm(from_fd, stack);
116 if(ret < 0){ 112 if(ret < 0){
117 printk("init_new_context_skas - new_mm failed, " 113 printk("init_new_context_skas - new_mm failed, "
118 "errno = %d\n", ret); 114 "errno = %d\n", ret);
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index 599d679bd4fc..eea1c9c4bb0f 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -18,7 +18,6 @@
18#include <asm/types.h> 18#include <asm/types.h>
19#include "user.h" 19#include "user.h"
20#include "ptrace_user.h" 20#include "ptrace_user.h"
21#include "time_user.h"
22#include "sysdep/ptrace.h" 21#include "sysdep/ptrace.h"
23#include "user_util.h" 22#include "user_util.h"
24#include "kern_util.h" 23#include "kern_util.h"
@@ -31,7 +30,6 @@
31#include "proc_mm.h" 30#include "proc_mm.h"
32#include "skas_ptrace.h" 31#include "skas_ptrace.h"
33#include "chan_user.h" 32#include "chan_user.h"
34#include "signal_user.h"
35#include "registers.h" 33#include "registers.h"
36#include "mem.h" 34#include "mem.h"
37#include "uml-config.h" 35#include "uml-config.h"
@@ -69,7 +67,7 @@ void wait_stub_done(int pid, int sig, char * fname)
69 67
70 if((n < 0) || !WIFSTOPPED(status) || 68 if((n < 0) || !WIFSTOPPED(status) ||
71 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){ 69 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
72 unsigned long regs[FRAME_SIZE]; 70 unsigned long regs[HOST_FRAME_SIZE];
73 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0) 71 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
74 printk("Failed to get registers from stub, " 72 printk("Failed to get registers from stub, "
75 "errno = %d\n", errno); 73 "errno = %d\n", errno);
@@ -77,7 +75,7 @@ void wait_stub_done(int pid, int sig, char * fname)
77 int i; 75 int i;
78 76
79 printk("Stub registers -\n"); 77 printk("Stub registers -\n");
80 for(i = 0; i < FRAME_SIZE; i++) 78 for(i = 0; i < HOST_FRAME_SIZE; i++)
81 printk("\t%d - %lx\n", i, regs[i]); 79 printk("\t%d - %lx\n", i, regs[i]);
82 } 80 }
83 panic("%s : failed to wait for SIGUSR1/SIGTRAP, " 81 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
@@ -514,16 +512,6 @@ int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
514 siglongjmp(**switch_buf, 1); 512 siglongjmp(**switch_buf, 1);
515} 513}
516 514
517void remove_sigstack(void)
518{
519 stack_t stack = ((stack_t) { .ss_flags = SS_DISABLE,
520 .ss_sp = NULL,
521 .ss_size = 0 });
522
523 if(sigaltstack(&stack, NULL) != 0)
524 panic("disabling signal stack failed, errno = %d\n", errno);
525}
526
527void initial_thread_cb_skas(void (*proc)(void *), void *arg) 515void initial_thread_cb_skas(void (*proc)(void *), void *arg)
528{ 516{
529 sigjmp_buf here; 517 sigjmp_buf here;
diff --git a/arch/um/kernel/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c
index 9c990253966c..3f70a2e12f06 100644
--- a/arch/um/kernel/skas/process_kern.c
+++ b/arch/um/kernel/skas/process_kern.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -13,15 +13,12 @@
13#include "asm/uaccess.h" 13#include "asm/uaccess.h"
14#include "asm/atomic.h" 14#include "asm/atomic.h"
15#include "kern_util.h" 15#include "kern_util.h"
16#include "time_user.h"
17#include "signal_user.h"
18#include "skas.h" 16#include "skas.h"
19#include "os.h" 17#include "os.h"
20#include "user_util.h" 18#include "user_util.h"
21#include "tlb.h" 19#include "tlb.h"
22#include "kern.h" 20#include "kern.h"
23#include "mode.h" 21#include "mode.h"
24#include "proc_mm.h"
25#include "registers.h" 22#include "registers.h"
26 23
27void switch_to_skas(void *prev, void *next) 24void switch_to_skas(void *prev, void *next)
@@ -35,7 +32,7 @@ void switch_to_skas(void *prev, void *next)
35 if(current->pid == 0) 32 if(current->pid == 0)
36 switch_timers(0); 33 switch_timers(0);
37 34
38 switch_threads(&from->thread.mode.skas.switch_buf, 35 switch_threads(&from->thread.mode.skas.switch_buf,
39 to->thread.mode.skas.switch_buf); 36 to->thread.mode.skas.switch_buf);
40 37
41 if(current->pid == 0) 38 if(current->pid == 0)
@@ -51,8 +48,8 @@ void new_thread_handler(int sig)
51 48
52 fn = current->thread.request.u.thread.proc; 49 fn = current->thread.request.u.thread.proc;
53 arg = current->thread.request.u.thread.arg; 50 arg = current->thread.request.u.thread.arg;
54 change_sig(SIGUSR1, 1); 51 os_usr1_signal(1);
55 thread_wait(&current->thread.mode.skas.switch_buf, 52 thread_wait(&current->thread.mode.skas.switch_buf,
56 current->thread.mode.skas.fork_buf); 53 current->thread.mode.skas.fork_buf);
57 54
58 if(current->thread.prev_sched != NULL) 55 if(current->thread.prev_sched != NULL)
@@ -83,8 +80,8 @@ void release_thread_skas(struct task_struct *task)
83 80
84void fork_handler(int sig) 81void fork_handler(int sig)
85{ 82{
86 change_sig(SIGUSR1, 1); 83 os_usr1_signal(1);
87 thread_wait(&current->thread.mode.skas.switch_buf, 84 thread_wait(&current->thread.mode.skas.switch_buf,
88 current->thread.mode.skas.fork_buf); 85 current->thread.mode.skas.fork_buf);
89 86
90 force_flush_all(); 87 force_flush_all();
@@ -94,13 +91,13 @@ void fork_handler(int sig)
94 schedule_tail(current->thread.prev_sched); 91 schedule_tail(current->thread.prev_sched);
95 current->thread.prev_sched = NULL; 92 current->thread.prev_sched = NULL;
96 93
97 /* Handle any immediate reschedules or signals */ 94/* Handle any immediate reschedules or signals */
98 interrupt_end(); 95 interrupt_end();
99 userspace(&current->thread.regs.regs); 96 userspace(&current->thread.regs.regs);
100} 97}
101 98
102int copy_thread_skas(int nr, unsigned long clone_flags, unsigned long sp, 99int copy_thread_skas(int nr, unsigned long clone_flags, unsigned long sp,
103 unsigned long stack_top, struct task_struct * p, 100 unsigned long stack_top, struct task_struct * p,
104 struct pt_regs *regs) 101 struct pt_regs *regs)
105{ 102{
106 void (*handler)(int); 103 void (*handler)(int);
@@ -119,32 +116,19 @@ int copy_thread_skas(int nr, unsigned long clone_flags, unsigned long sp,
119 handler = new_thread_handler; 116 handler = new_thread_handler;
120 } 117 }
121 118
122 new_thread(p->thread_info, &p->thread.mode.skas.switch_buf, 119 new_thread(task_stack_page(p), &p->thread.mode.skas.switch_buf,
123 &p->thread.mode.skas.fork_buf, handler); 120 &p->thread.mode.skas.fork_buf, handler);
124 return(0); 121 return(0);
125} 122}
126 123
127extern void map_stub_pages(int fd, unsigned long code, 124int new_mm(unsigned long stack)
128 unsigned long data, unsigned long stack);
129int new_mm(int from, unsigned long stack)
130{ 125{
131 struct proc_mm_op copy; 126 int fd;
132 int n, fd;
133 127
134 fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0); 128 fd = os_open_file("/proc/mm", of_cloexec(of_write(OPENFLAGS())), 0);
135 if(fd < 0) 129 if(fd < 0)
136 return(fd); 130 return(fd);
137 131
138 if(from != -1){
139 copy = ((struct proc_mm_op) { .op = MM_COPY_SEGMENTS,
140 .u =
141 { .copy_segments = from } } );
142 n = os_write_file(fd, &copy, sizeof(copy));
143 if(n != sizeof(copy))
144 printk("new_mm : /proc/mm copy_segments failed, "
145 "err = %d\n", -n);
146 }
147
148 if(skas_needs_stub) 132 if(skas_needs_stub)
149 map_stub_pages(fd, CONFIG_STUB_CODE, CONFIG_STUB_DATA, stack); 133 map_stub_pages(fd, CONFIG_STUB_CODE, CONFIG_STUB_DATA, stack);
150 134
@@ -186,7 +170,7 @@ int start_uml_skas(void)
186 170
187 init_task.thread.request.u.thread.proc = start_kernel_proc; 171 init_task.thread.request.u.thread.proc = start_kernel_proc;
188 init_task.thread.request.u.thread.arg = NULL; 172 init_task.thread.request.u.thread.arg = NULL;
189 return(start_idle_thread(init_task.thread_info, 173 return(start_idle_thread(task_stack_page(&init_task),
190 &init_task.thread.mode.skas.switch_buf, 174 &init_task.thread.mode.skas.switch_buf,
191 &init_task.thread.mode.skas.fork_buf)); 175 &init_task.thread.mode.skas.fork_buf));
192} 176}
diff --git a/arch/um/kernel/skas/uaccess.c b/arch/um/kernel/skas/uaccess.c
index a5a47528dec7..5992c3257167 100644
--- a/arch/um/kernel/skas/uaccess.c
+++ b/arch/um/kernel/skas/uaccess.c
@@ -13,7 +13,7 @@
13#include "asm/pgtable.h" 13#include "asm/pgtable.h"
14#include "asm/uaccess.h" 14#include "asm/uaccess.h"
15#include "kern_util.h" 15#include "kern_util.h"
16#include "user_util.h" 16#include "os.h"
17 17
18extern void *um_virt_to_phys(struct task_struct *task, unsigned long addr, 18extern void *um_virt_to_phys(struct task_struct *task, unsigned long addr,
19 pte_t *pte_out); 19 pte_t *pte_out);
diff --git a/arch/um/kernel/syscall.c b/arch/um/kernel/syscall.c
index 1429c131879d..1731d90e6850 100644
--- a/arch/um/kernel/syscall.c
+++ b/arch/um/kernel/syscall.c
@@ -25,12 +25,12 @@ int record_syscall_start(int syscall)
25 syscall_record[index].syscall = syscall; 25 syscall_record[index].syscall = syscall;
26 syscall_record[index].pid = current_pid(); 26 syscall_record[index].pid = current_pid();
27 syscall_record[index].result = 0xdeadbeef; 27 syscall_record[index].result = 0xdeadbeef;
28 syscall_record[index].start = os_usecs(); 28 syscall_record[index].start = os_nsecs();
29 return(index); 29 return(index);
30} 30}
31 31
32void record_syscall_end(int index, long result) 32void record_syscall_end(int index, long result)
33{ 33{
34 syscall_record[index].result = result; 34 syscall_record[index].result = result;
35 syscall_record[index].end = os_usecs(); 35 syscall_record[index].end = os_nsecs();
36} 36}
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index c40b611e3d93..8fa2ae7f3026 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -14,9 +14,9 @@
14#include "kern_util.h" 14#include "kern_util.h"
15#include "user.h" 15#include "user.h"
16#include "process.h" 16#include "process.h"
17#include "signal_user.h"
18#include "time_user.h" 17#include "time_user.h"
19#include "kern_constants.h" 18#include "kern_constants.h"
19#include "os.h"
20 20
21/* XXX This really needs to be declared and initialized in a kernel file since 21/* XXX This really needs to be declared and initialized in a kernel file since
22 * it's in <linux/time.h> 22 * it's in <linux/time.h>
@@ -99,7 +99,8 @@ void uml_idle_timer(void)
99 set_interval(ITIMER_REAL); 99 set_interval(ITIMER_REAL);
100} 100}
101 101
102extern int do_posix_clock_monotonic_gettime(struct timespec *tp); 102extern void ktime_get_ts(struct timespec *ts);
103#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
103 104
104void time_init(void) 105void time_init(void)
105{ 106{
@@ -114,8 +115,8 @@ void time_init(void)
114 wall_to_monotonic.tv_nsec = -now.tv_nsec; 115 wall_to_monotonic.tv_nsec = -now.tv_nsec;
115} 116}
116 117
117/* Declared in linux/time.h, which can't be included here */ 118/* Defined in linux/ktimer.h, which can't be included here */
118extern void clock_was_set(void); 119#define clock_was_set() do { } while (0)
119 120
120void do_gettimeofday(struct timeval *tv) 121void do_gettimeofday(struct timeval *tv)
121{ 122{
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c
index 020ca79b8d33..3c7626cdba4b 100644
--- a/arch/um/kernel/time_kern.c
+++ b/arch/um/kernel/time_kern.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -13,12 +13,12 @@
13#include "linux/interrupt.h" 13#include "linux/interrupt.h"
14#include "linux/init.h" 14#include "linux/init.h"
15#include "linux/delay.h" 15#include "linux/delay.h"
16#include "linux/hrtimer.h"
16#include "asm/irq.h" 17#include "asm/irq.h"
17#include "asm/param.h" 18#include "asm/param.h"
18#include "asm/current.h" 19#include "asm/current.h"
19#include "kern_util.h" 20#include "kern_util.h"
20#include "user_util.h" 21#include "user_util.h"
21#include "time_user.h"
22#include "mode.h" 22#include "mode.h"
23#include "os.h" 23#include "os.h"
24 24
@@ -39,7 +39,7 @@ unsigned long long sched_clock(void)
39int timer_irq_inited = 0; 39int timer_irq_inited = 0;
40 40
41static int first_tick; 41static int first_tick;
42static unsigned long long prev_usecs; 42static unsigned long long prev_nsecs;
43#ifdef CONFIG_UML_REAL_TIME_CLOCK 43#ifdef CONFIG_UML_REAL_TIME_CLOCK
44static long long delta; /* Deviation per interval */ 44static long long delta; /* Deviation per interval */
45#endif 45#endif
@@ -58,23 +58,23 @@ void timer_irq(union uml_pt_regs *regs)
58 if(first_tick){ 58 if(first_tick){
59#ifdef CONFIG_UML_REAL_TIME_CLOCK 59#ifdef CONFIG_UML_REAL_TIME_CLOCK
60 /* We've had 1 tick */ 60 /* We've had 1 tick */
61 unsigned long long usecs = os_usecs(); 61 unsigned long long nsecs = os_nsecs();
62 62
63 delta += usecs - prev_usecs; 63 delta += nsecs - prev_nsecs;
64 prev_usecs = usecs; 64 prev_nsecs = nsecs;
65 65
66 /* Protect against the host clock being set backwards */ 66 /* Protect against the host clock being set backwards */
67 if(delta < 0) 67 if(delta < 0)
68 delta = 0; 68 delta = 0;
69 69
70 ticks += (delta * HZ) / MILLION; 70 ticks += (delta * HZ) / BILLION;
71 delta -= (ticks * MILLION) / HZ; 71 delta -= (ticks * BILLION) / HZ;
72#else 72#else
73 ticks = 1; 73 ticks = 1;
74#endif 74#endif
75 } 75 }
76 else { 76 else {
77 prev_usecs = os_usecs(); 77 prev_nsecs = os_nsecs();
78 first_tick = 1; 78 first_tick = 1;
79 } 79 }
80 80
@@ -84,49 +84,102 @@ void timer_irq(union uml_pt_regs *regs)
84 } 84 }
85} 85}
86 86
87void boot_timer_handler(int sig) 87void do_boot_timer_handler(struct sigcontext * sc)
88{ 88{
89 struct pt_regs regs; 89 struct pt_regs regs;
90 90
91 CHOOSE_MODE((void) 91 CHOOSE_MODE((void) (UPT_SC(&regs.regs) = sc),
92 (UPT_SC(&regs.regs) = (struct sigcontext *) (&sig + 1)),
93 (void) (regs.regs.skas.is_user = 0)); 92 (void) (regs.regs.skas.is_user = 0));
94 do_timer(&regs); 93 do_timer(&regs);
95} 94}
96 95
96static DEFINE_SPINLOCK(timer_spinlock);
97
98static unsigned long long local_offset = 0;
99
100static inline unsigned long long get_time(void)
101{
102 unsigned long long nsecs;
103 unsigned long flags;
104
105 spin_lock_irqsave(&timer_spinlock, flags);
106 nsecs = os_nsecs();
107 nsecs += local_offset;
108 spin_unlock_irqrestore(&timer_spinlock, flags);
109
110 return nsecs;
111}
112
97irqreturn_t um_timer(int irq, void *dev, struct pt_regs *regs) 113irqreturn_t um_timer(int irq, void *dev, struct pt_regs *regs)
98{ 114{
115 unsigned long long nsecs;
99 unsigned long flags; 116 unsigned long flags;
100 117
101 do_timer(regs); 118 do_timer(regs);
119
102 write_seqlock_irqsave(&xtime_lock, flags); 120 write_seqlock_irqsave(&xtime_lock, flags);
103 timer(); 121 nsecs = get_time() + local_offset;
122 xtime.tv_sec = nsecs / NSEC_PER_SEC;
123 xtime.tv_nsec = nsecs - xtime.tv_sec * NSEC_PER_SEC;
104 write_sequnlock_irqrestore(&xtime_lock, flags); 124 write_sequnlock_irqrestore(&xtime_lock, flags);
125
105 return(IRQ_HANDLED); 126 return(IRQ_HANDLED);
106} 127}
107 128
108long um_time(int __user *tloc) 129long um_time(int __user *tloc)
109{ 130{
110 struct timeval now; 131 long ret = get_time() / NSEC_PER_SEC;
111 132
112 do_gettimeofday(&now); 133 if((tloc != NULL) && put_user(ret, tloc))
113 if (tloc) { 134 return -EFAULT;
114 if (put_user(now.tv_sec, tloc)) 135
115 now.tv_sec = -EFAULT; 136 return ret;
116 } 137}
117 return now.tv_sec; 138
139void do_gettimeofday(struct timeval *tv)
140{
141 unsigned long long nsecs = get_time();
142
143 tv->tv_sec = nsecs / NSEC_PER_SEC;
144 /* Careful about calculations here - this was originally done as
145 * (nsecs - tv->tv_sec * NSEC_PER_SEC) / NSEC_PER_USEC
146 * which gave bogus (> 1000000) values. Dunno why, suspect gcc
147 * (4.0.0) miscompiled it, or there's a subtle 64/32-bit conversion
148 * problem that I missed.
149 */
150 nsecs -= tv->tv_sec * NSEC_PER_SEC;
151 tv->tv_usec = (unsigned long) nsecs / NSEC_PER_USEC;
152}
153
154static inline void set_time(unsigned long long nsecs)
155{
156 unsigned long long now;
157 unsigned long flags;
158
159 spin_lock_irqsave(&timer_spinlock, flags);
160 now = os_nsecs();
161 local_offset = nsecs - now;
162 spin_unlock_irqrestore(&timer_spinlock, flags);
163
164 clock_was_set();
118} 165}
119 166
120long um_stime(int __user *tptr) 167long um_stime(int __user *tptr)
121{ 168{
122 int value; 169 int value;
123 struct timespec new;
124 170
125 if (get_user(value, tptr)) 171 if (get_user(value, tptr))
126 return -EFAULT; 172 return -EFAULT;
127 new.tv_sec = value; 173
128 new.tv_nsec = 0; 174 set_time((unsigned long long) value * NSEC_PER_SEC);
129 do_settimeofday(&new); 175
176 return 0;
177}
178
179int do_settimeofday(struct timespec *tv)
180{
181 set_time((unsigned long long) tv->tv_sec * NSEC_PER_SEC + tv->tv_nsec);
182
130 return 0; 183 return 0;
131} 184}
132 185
@@ -134,29 +187,15 @@ void timer_handler(int sig, union uml_pt_regs *regs)
134{ 187{
135 local_irq_disable(); 188 local_irq_disable();
136 irq_enter(); 189 irq_enter();
137 update_process_times(CHOOSE_MODE(user_context(UPT_SP(regs)), 190 update_process_times(CHOOSE_MODE(
138 (regs)->skas.is_user)); 191 (UPT_SC(regs) && user_context(UPT_SP(regs))),
192 (regs)->skas.is_user));
139 irq_exit(); 193 irq_exit();
140 local_irq_enable(); 194 local_irq_enable();
141 if(current_thread->cpu == 0) 195 if(current_thread->cpu == 0)
142 timer_irq(regs); 196 timer_irq(regs);
143} 197}
144 198
145static DEFINE_SPINLOCK(timer_spinlock);
146
147unsigned long time_lock(void)
148{
149 unsigned long flags;
150
151 spin_lock_irqsave(&timer_spinlock, flags);
152 return(flags);
153}
154
155void time_unlock(unsigned long flags)
156{
157 spin_unlock_irqrestore(&timer_spinlock, flags);
158}
159
160int __init timer_init(void) 199int __init timer_init(void)
161{ 200{
162 int err; 201 int err;
@@ -171,14 +210,3 @@ int __init timer_init(void)
171} 210}
172 211
173__initcall(timer_init); 212__initcall(timer_init);
174
175/*
176 * Overrides for Emacs so that we follow Linus's tabbing style.
177 * Emacs will notice this stuff at the end of the file and automatically
178 * adjust the settings for this buffer only. This must remain at the end
179 * of the file.
180 * ---------------------------------------------------------------------------
181 * Local variables:
182 * c-file-style: "linux"
183 * End:
184 */
diff --git a/arch/um/kernel/trap_kern.c b/arch/um/kernel/trap_kern.c
index 0d4c10a73607..d56046c2aba2 100644
--- a/arch/um/kernel/trap_kern.c
+++ b/arch/um/kernel/trap_kern.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -26,9 +26,13 @@
26#include "mconsole_kern.h" 26#include "mconsole_kern.h"
27#include "mem.h" 27#include "mem.h"
28#include "mem_kern.h" 28#include "mem_kern.h"
29#include "sysdep/sigcontext.h"
30#include "sysdep/ptrace.h"
31#include "os.h"
29#ifdef CONFIG_MODE_SKAS 32#ifdef CONFIG_MODE_SKAS
30#include "skas.h" 33#include "skas.h"
31#endif 34#endif
35#include "os.h"
32 36
33/* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */ 37/* Note this is constrained to return 0, -EFAULT, -EACCESS, -ENOMEM by segv(). */
34int handle_page_fault(unsigned long address, unsigned long ip, 38int handle_page_fault(unsigned long address, unsigned long ip,
@@ -125,6 +129,25 @@ out_of_memory:
125 goto out; 129 goto out;
126} 130}
127 131
132void segv_handler(int sig, union uml_pt_regs *regs)
133{
134 struct faultinfo * fi = UPT_FAULTINFO(regs);
135
136 if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){
137 bad_segv(*fi, UPT_IP(regs));
138 return;
139 }
140 segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs);
141}
142
143struct kern_handlers handlinfo_kern = {
144 .relay_signal = relay_signal,
145 .winch = winch,
146 .bus_handler = relay_signal,
147 .page_fault = segv_handler,
148 .sigio_handler = sigio_handler,
149 .timer_handler = timer_handler
150};
128/* 151/*
129 * We give a *copy* of the faultinfo in the regs to segv. 152 * We give a *copy* of the faultinfo in the regs to segv.
130 * This must be done, since nesting SEGVs could overwrite 153 * This must be done, since nesting SEGVs could overwrite
diff --git a/arch/um/kernel/trap_user.c b/arch/um/kernel/trap_user.c
deleted file mode 100644
index e9ccd6b8d3c7..000000000000
--- a/arch/um/kernel/trap_user.c
+++ /dev/null
@@ -1,98 +0,0 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdlib.h>
7#include <errno.h>
8#include <setjmp.h>
9#include <signal.h>
10#include <sys/time.h>
11#include <sys/wait.h>
12#include <asm/page.h>
13#include <asm/unistd.h>
14#include <asm/ptrace.h>
15#include "init.h"
16#include "sysdep/ptrace.h"
17#include "sigcontext.h"
18#include "sysdep/sigcontext.h"
19#include "irq_user.h"
20#include "signal_user.h"
21#include "time_user.h"
22#include "task.h"
23#include "mode.h"
24#include "choose-mode.h"
25#include "kern_util.h"
26#include "user_util.h"
27#include "os.h"
28
29void kill_child_dead(int pid)
30{
31 kill(pid, SIGKILL);
32 kill(pid, SIGCONT);
33 do {
34 int n;
35 CATCH_EINTR(n = waitpid(pid, NULL, 0));
36 if (n > 0)
37 kill(pid, SIGCONT);
38 else
39 break;
40 } while(1);
41}
42
43void segv_handler(int sig, union uml_pt_regs *regs)
44{
45 struct faultinfo * fi = UPT_FAULTINFO(regs);
46
47 if(UPT_IS_USER(regs) && !SEGV_IS_FIXABLE(fi)){
48 bad_segv(*fi, UPT_IP(regs));
49 return;
50 }
51 segv(*fi, UPT_IP(regs), UPT_IS_USER(regs), regs);
52}
53
54void usr2_handler(int sig, union uml_pt_regs *regs)
55{
56 CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0);
57}
58
59struct signal_info sig_info[] = {
60 [ SIGTRAP ] { .handler = relay_signal,
61 .is_irq = 0 },
62 [ SIGFPE ] { .handler = relay_signal,
63 .is_irq = 0 },
64 [ SIGILL ] { .handler = relay_signal,
65 .is_irq = 0 },
66 [ SIGWINCH ] { .handler = winch,
67 .is_irq = 1 },
68 [ SIGBUS ] { .handler = bus_handler,
69 .is_irq = 0 },
70 [ SIGSEGV] { .handler = segv_handler,
71 .is_irq = 0 },
72 [ SIGIO ] { .handler = sigio_handler,
73 .is_irq = 1 },
74 [ SIGVTALRM ] { .handler = timer_handler,
75 .is_irq = 1 },
76 [ SIGALRM ] { .handler = timer_handler,
77 .is_irq = 1 },
78 [ SIGUSR2 ] { .handler = usr2_handler,
79 .is_irq = 0 },
80};
81
82void do_longjmp(void *b, int val)
83{
84 sigjmp_buf *buf = b;
85
86 siglongjmp(*buf, val);
87}
88
89/*
90 * Overrides for Emacs so that we follow Linus's tabbing style.
91 * Emacs will notice this stuff at the end of the file and automatically
92 * adjust the settings for this buffer only. This must remain at the end
93 * of the file.
94 * ---------------------------------------------------------------------------
95 * Local variables:
96 * c-file-style: "linux"
97 * End:
98 */
diff --git a/arch/um/kernel/tt/exec_kern.c b/arch/um/kernel/tt/exec_kern.c
index 065b504a653b..5c1e4cc1c049 100644
--- a/arch/um/kernel/tt/exec_kern.c
+++ b/arch/um/kernel/tt/exec_kern.c
@@ -13,8 +13,6 @@
13#include "user_util.h" 13#include "user_util.h"
14#include "kern_util.h" 14#include "kern_util.h"
15#include "irq_user.h" 15#include "irq_user.h"
16#include "time_user.h"
17#include "signal_user.h"
18#include "mem_user.h" 16#include "mem_user.h"
19#include "os.h" 17#include "os.h"
20#include "tlb.h" 18#include "tlb.h"
@@ -40,7 +38,7 @@ void flush_thread_tt(void)
40 do_exit(SIGKILL); 38 do_exit(SIGKILL);
41 } 39 }
42 40
43 new_pid = start_fork_tramp(current->thread_info, stack, 0, exec_tramp); 41 new_pid = start_fork_tramp(task_stack_page(current), stack, 0, exec_tramp);
44 if(new_pid < 0){ 42 if(new_pid < 0){
45 printk(KERN_ERR 43 printk(KERN_ERR
46 "flush_thread : new thread failed, errno = %d\n", 44 "flush_thread : new thread failed, errno = %d\n",
diff --git a/arch/um/kernel/tt/gdb.c b/arch/um/kernel/tt/gdb.c
index 37e22d71a0d9..786e4edd86c5 100644
--- a/arch/um/kernel/tt/gdb.c
+++ b/arch/um/kernel/tt/gdb.c
@@ -20,6 +20,7 @@
20#include "user_util.h" 20#include "user_util.h"
21#include "tt.h" 21#include "tt.h"
22#include "sysdep/thread.h" 22#include "sysdep/thread.h"
23#include "os.h"
23 24
24extern int debugger_pid; 25extern int debugger_pid;
25extern int debugger_fd; 26extern int debugger_fd;
diff --git a/arch/um/kernel/tt/include/mmu-tt.h b/arch/um/kernel/tt/include/mmu-tt.h
deleted file mode 100644
index 0440510ab3fe..000000000000
--- a/arch/um/kernel/tt/include/mmu-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 __TT_MMU_H
7#define __TT_MMU_H
8
9struct mmu_context_tt {
10};
11
12#endif
13
14/*
15 * Overrides for Emacs so that we follow Linus's tabbing style.
16 * Emacs will notice this stuff at the end of the file and automatically
17 * adjust the settings for this buffer only. This must remain at the end
18 * of the file.
19 * ---------------------------------------------------------------------------
20 * Local variables:
21 * c-file-style: "linux"
22 * End:
23 */
diff --git a/arch/um/kernel/tt/process_kern.c b/arch/um/kernel/tt/process_kern.c
index cfaa373a6e77..295c1ac817b3 100644
--- a/arch/um/kernel/tt/process_kern.c
+++ b/arch/um/kernel/tt/process_kern.c
@@ -13,13 +13,11 @@
13#include "asm/ptrace.h" 13#include "asm/ptrace.h"
14#include "asm/tlbflush.h" 14#include "asm/tlbflush.h"
15#include "irq_user.h" 15#include "irq_user.h"
16#include "signal_user.h"
17#include "kern_util.h" 16#include "kern_util.h"
18#include "user_util.h" 17#include "user_util.h"
19#include "os.h" 18#include "os.h"
20#include "kern.h" 19#include "kern.h"
21#include "sigcontext.h" 20#include "sigcontext.h"
22#include "time_user.h"
23#include "mem_user.h" 21#include "mem_user.h"
24#include "tlb.h" 22#include "tlb.h"
25#include "mode.h" 23#include "mode.h"
@@ -37,7 +35,7 @@ void switch_to_tt(void *prev, void *next)
37 from = prev; 35 from = prev;
38 to = next; 36 to = next;
39 37
40 cpu = from->thread_info->cpu; 38 cpu = task_thread_info(from)->cpu;
41 if(cpu == 0) 39 if(cpu == 0)
42 forward_interrupts(to->thread.mode.tt.extern_pid); 40 forward_interrupts(to->thread.mode.tt.extern_pid);
43#ifdef CONFIG_SMP 41#ifdef CONFIG_SMP
@@ -254,7 +252,7 @@ int copy_thread_tt(int nr, unsigned long clone_flags, unsigned long sp,
254 252
255 clone_flags &= CLONE_VM; 253 clone_flags &= CLONE_VM;
256 p->thread.temp_stack = stack; 254 p->thread.temp_stack = stack;
257 new_pid = start_fork_tramp(p->thread_info, stack, clone_flags, tramp); 255 new_pid = start_fork_tramp(task_stack_page(p), stack, clone_flags, tramp);
258 if(new_pid < 0){ 256 if(new_pid < 0){
259 printk(KERN_ERR "copy_thread : clone failed - errno = %d\n", 257 printk(KERN_ERR "copy_thread : clone failed - errno = %d\n",
260 -new_pid); 258 -new_pid);
@@ -344,7 +342,7 @@ int do_proc_op(void *t, int proc_id)
344 pid = thread->request.u.exec.pid; 342 pid = thread->request.u.exec.pid;
345 do_exec(thread->mode.tt.extern_pid, pid); 343 do_exec(thread->mode.tt.extern_pid, pid);
346 thread->mode.tt.extern_pid = pid; 344 thread->mode.tt.extern_pid = pid;
347 cpu_tasks[task->thread_info->cpu].pid = pid; 345 cpu_tasks[task_thread_info(task)->cpu].pid = pid;
348 break; 346 break;
349 case OP_FORK: 347 case OP_FORK:
350 attach_process(thread->request.u.fork.pid); 348 attach_process(thread->request.u.fork.pid);
@@ -426,7 +424,7 @@ int start_uml_tt(void)
426 int pages; 424 int pages;
427 425
428 pages = (1 << CONFIG_KERNEL_STACK_ORDER); 426 pages = (1 << CONFIG_KERNEL_STACK_ORDER);
429 sp = (void *) ((unsigned long) init_task.thread_info) + 427 sp = task_stack_page(&init_task) +
430 pages * PAGE_SIZE - sizeof(unsigned long); 428 pages * PAGE_SIZE - sizeof(unsigned long);
431 return(tracer(start_kernel_proc, sp)); 429 return(tracer(start_kernel_proc, sp));
432} 430}
diff --git a/arch/um/kernel/tt/ptproxy/ptrace.c b/arch/um/kernel/tt/ptproxy/ptrace.c
index 528a5fc8d887..03774427d468 100644
--- a/arch/um/kernel/tt/ptproxy/ptrace.c
+++ b/arch/um/kernel/tt/ptproxy/ptrace.c
@@ -20,6 +20,7 @@ Jeff Dike (jdike@karaya.com) : Modified for integration into uml
20#include "kern_util.h" 20#include "kern_util.h"
21#include "ptrace_user.h" 21#include "ptrace_user.h"
22#include "tt.h" 22#include "tt.h"
23#include "os.h"
23 24
24long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2, 25long proxy_ptrace(struct debugger *debugger, int arg1, pid_t arg2,
25 long arg3, long arg4, pid_t child, int *ret) 26 long arg3, long arg4, pid_t child, int *ret)
diff --git a/arch/um/kernel/tt/ptproxy/sysdep.c b/arch/um/kernel/tt/ptproxy/sysdep.c
index a5f0e01e214e..99f178319d03 100644
--- a/arch/um/kernel/tt/ptproxy/sysdep.c
+++ b/arch/um/kernel/tt/ptproxy/sysdep.c
@@ -15,6 +15,7 @@ terms and conditions.
15#include "ptrace_user.h" 15#include "ptrace_user.h"
16#include "user_util.h" 16#include "user_util.h"
17#include "user.h" 17#include "user.h"
18#include "os.h"
18 19
19int get_syscall(pid_t pid, long *arg1, long *arg2, long *arg3, long *arg4, 20int get_syscall(pid_t pid, long *arg1, long *arg2, long *arg3, long *arg4,
20 long *arg5) 21 long *arg5)
diff --git a/arch/um/kernel/tt/tracer.c b/arch/um/kernel/tt/tracer.c
index d11e7399d7a1..71daae24e48a 100644
--- a/arch/um/kernel/tt/tracer.c
+++ b/arch/um/kernel/tt/tracer.c
@@ -19,7 +19,6 @@
19#include "sigcontext.h" 19#include "sigcontext.h"
20#include "sysdep/sigcontext.h" 20#include "sysdep/sigcontext.h"
21#include "os.h" 21#include "os.h"
22#include "signal_user.h"
23#include "user_util.h" 22#include "user_util.h"
24#include "mem_user.h" 23#include "mem_user.h"
25#include "process.h" 24#include "process.h"
diff --git a/arch/um/kernel/tt/trap_user.c b/arch/um/kernel/tt/trap_user.c
index fc108615beaf..b5d9d64d91e4 100644
--- a/arch/um/kernel/tt/trap_user.c
+++ b/arch/um/kernel/tt/trap_user.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -8,18 +8,18 @@
8#include <signal.h> 8#include <signal.h>
9#include "sysdep/ptrace.h" 9#include "sysdep/ptrace.h"
10#include "sysdep/sigcontext.h" 10#include "sysdep/sigcontext.h"
11#include "signal_user.h"
12#include "user_util.h" 11#include "user_util.h"
13#include "kern_util.h" 12#include "kern_util.h"
14#include "task.h" 13#include "task.h"
15#include "tt.h" 14#include "tt.h"
15#include "os.h"
16 16
17void sig_handler_common_tt(int sig, void *sc_ptr) 17void sig_handler_common_tt(int sig, void *sc_ptr)
18{ 18{
19 struct sigcontext *sc = sc_ptr; 19 struct sigcontext *sc = sc_ptr;
20 struct tt_regs save_regs, *r; 20 struct tt_regs save_regs, *r;
21 struct signal_info *info; 21 int save_errno = errno, is_user = 0;
22 int save_errno = errno, is_user; 22 void (*handler)(int, union uml_pt_regs *);
23 23
24 /* This is done because to allow SIGSEGV to be delivered inside a SEGV 24 /* This is done because to allow SIGSEGV to be delivered inside a SEGV
25 * handler. This can happen in copy_user, and if SEGV is disabled, 25 * handler. This can happen in copy_user, and if SEGV is disabled,
@@ -35,15 +35,20 @@ void sig_handler_common_tt(int sig, void *sc_ptr)
35 GET_FAULTINFO_FROM_SC(r->faultinfo, sc); 35 GET_FAULTINFO_FROM_SC(r->faultinfo, sc);
36 } 36 }
37 save_regs = *r; 37 save_regs = *r;
38 is_user = user_context(SC_SP(sc)); 38 if (sc)
39 is_user = user_context(SC_SP(sc));
39 r->sc = sc; 40 r->sc = sc;
40 if(sig != SIGUSR2) 41 if(sig != SIGUSR2)
41 r->syscall = -1; 42 r->syscall = -1;
42 43
43 info = &sig_info[sig]; 44 handler = sig_info[sig];
44 if(!info->is_irq) unblock_signals(); 45
46 /* unblock SIGALRM, SIGVTALRM, SIGIO if sig isn't IRQ signal */
47 if (sig != SIGIO && sig != SIGWINCH &&
48 sig != SIGVTALRM && sig != SIGALRM)
49 unblock_signals();
45 50
46 (*info->handler)(sig, (union uml_pt_regs *) r); 51 handler(sig, (union uml_pt_regs *) r);
47 52
48 if(is_user){ 53 if(is_user){
49 interrupt_end(); 54 interrupt_end();
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 142a9493912b..e2d3ca445ef5 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -146,8 +146,8 @@ void set_cmdline(char *cmd)
146 146
147 if(CHOOSE_MODE(honeypot, 0)) return; 147 if(CHOOSE_MODE(honeypot, 0)) return;
148 148
149 umid = get_umid(1); 149 umid = get_umid();
150 if(umid != NULL){ 150 if(*umid != '\0'){
151 snprintf(argv1_begin, 151 snprintf(argv1_begin,
152 (argv1_end - argv1_begin) * sizeof(*ptr), 152 (argv1_end - argv1_begin) * sizeof(*ptr),
153 "(%s) ", umid); 153 "(%s) ", umid);
@@ -243,10 +243,6 @@ static int __init mode_tt_setup(char *line, int *add)
243 return(0); 243 return(0);
244} 244}
245 245
246#else
247
248#error Either CONFIG_MODE_TT or CONFIG_MODE_SKAS must be enabled
249
250#endif 246#endif
251#endif 247#endif
252#endif 248#endif
@@ -363,6 +359,11 @@ int linux_main(int argc, char **argv)
363 uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0, 359 uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0,
364 &host_task_size, &task_size); 360 &host_task_size, &task_size);
365 361
362 /*
363 * Setting up handlers to 'sig_info' struct
364 */
365 os_fill_handlinfo(handlinfo_kern);
366
366 brk_start = (unsigned long) sbrk(0); 367 brk_start = (unsigned long) sbrk(0);
367 CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start); 368 CHOOSE_MODE_PROC(before_mem_tt, before_mem_skas, brk_start);
368 /* Increase physical memory size for exec-shield users 369 /* Increase physical memory size for exec-shield users
diff --git a/arch/um/kernel/umid.c b/arch/um/kernel/umid.c
index 0b21d59ba0cd..4eaee823bfd2 100644
--- a/arch/um/kernel/umid.c
+++ b/arch/um/kernel/umid.c
@@ -3,61 +3,30 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <stdio.h> 6#include "asm/errno.h"
7#include <unistd.h>
8#include <errno.h>
9#include <string.h>
10#include <stdlib.h>
11#include <dirent.h>
12#include <signal.h>
13#include <sys/stat.h>
14#include <sys/param.h>
15#include "user.h"
16#include "umid.h"
17#include "init.h" 7#include "init.h"
18#include "os.h" 8#include "os.h"
19#include "user_util.h" 9#include "kern.h"
20#include "choose-mode.h" 10#include "linux/kernel.h"
21 11
22#define UMID_LEN 64 12/* Changed by set_umid_arg */
23#define UML_DIR "~/.uml/"
24
25/* Changed by set_umid and make_umid, which are run early in boot */
26static char umid[UMID_LEN] = { 0 };
27
28/* Changed by set_uml_dir and make_uml_dir, which are run early in boot */
29static char *uml_dir = UML_DIR;
30
31/* Changed by set_umid */
32static int umid_is_random = 1;
33static int umid_inited = 0; 13static int umid_inited = 0;
34/* Have we created the files? Should we remove them? */
35static int umid_owned = 0;
36 14
37static int make_umid(int (*printer)(const char *fmt, ...)); 15static int __init set_umid_arg(char *name, int *add)
38
39static int __init set_umid(char *name, int is_random,
40 int (*printer)(const char *fmt, ...))
41{ 16{
42 if(umid_inited){ 17 int err;
43 (*printer)("Unique machine name can't be set twice\n");
44 return(-1);
45 }
46 18
47 if(strlen(name) > UMID_LEN - 1) 19 if(umid_inited)
48 (*printer)("Unique machine name is being truncated to %d " 20 return 0;
49 "characters\n", UMID_LEN);
50 strlcpy(umid, name, sizeof(umid));
51 21
52 umid_is_random = is_random;
53 umid_inited = 1;
54 return 0;
55}
56
57static int __init set_umid_arg(char *name, int *add)
58{
59 *add = 0; 22 *add = 0;
60 return(set_umid(name, 0, printf)); 23 err = set_umid(name);
24 if(err == -EEXIST)
25 printf("umid '%s' already in use\n", name);
26 else if(!err)
27 umid_inited = 1;
28
29 return 0;
61} 30}
62 31
63__uml_setup("umid=", set_umid_arg, 32__uml_setup("umid=", set_umid_arg,
@@ -66,265 +35,3 @@ __uml_setup("umid=", set_umid_arg,
66" is used for naming the pid file and management console socket.\n\n" 35" is used for naming the pid file and management console socket.\n\n"
67); 36);
68 37
69int __init umid_file_name(char *name, char *buf, int len)
70{
71 int n;
72
73 if(!umid_inited && make_umid(printk)) return(-1);
74
75 n = strlen(uml_dir) + strlen(umid) + strlen(name) + 1;
76 if(n > len){
77 printk("umid_file_name : buffer too short\n");
78 return(-1);
79 }
80
81 sprintf(buf, "%s%s/%s", uml_dir, umid, name);
82 return(0);
83}
84
85extern int tracing_pid;
86
87static void __init create_pid_file(void)
88{
89 char file[strlen(uml_dir) + UMID_LEN + sizeof("/pid\0")];
90 char pid[sizeof("nnnnn\0")];
91 int fd, n;
92
93 if(umid_file_name("pid", file, sizeof(file)))
94 return;
95
96 fd = os_open_file(file, of_create(of_excl(of_rdwr(OPENFLAGS()))),
97 0644);
98 if(fd < 0){
99 printf("Open of machine pid file \"%s\" failed: %s\n",
100 file, strerror(-fd));
101 return;
102 }
103
104 sprintf(pid, "%d\n", os_getpid());
105 n = os_write_file(fd, pid, strlen(pid));
106 if(n != strlen(pid))
107 printf("Write of pid file failed - err = %d\n", -n);
108 os_close_file(fd);
109}
110
111static int actually_do_remove(char *dir)
112{
113 DIR *directory;
114 struct dirent *ent;
115 int len;
116 char file[256];
117
118 directory = opendir(dir);
119 if(directory == NULL){
120 printk("actually_do_remove : couldn't open directory '%s', "
121 "errno = %d\n", dir, errno);
122 return(1);
123 }
124 while((ent = readdir(directory)) != NULL){
125 if(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
126 continue;
127 len = strlen(dir) + sizeof("/") + strlen(ent->d_name) + 1;
128 if(len > sizeof(file)){
129 printk("Not deleting '%s' from '%s' - name too long\n",
130 ent->d_name, dir);
131 continue;
132 }
133 sprintf(file, "%s/%s", dir, ent->d_name);
134 if(unlink(file) < 0){
135 printk("actually_do_remove : couldn't remove '%s' "
136 "from '%s', errno = %d\n", ent->d_name, dir,
137 errno);
138 return(1);
139 }
140 }
141 if(rmdir(dir) < 0){
142 printk("actually_do_remove : couldn't rmdir '%s', "
143 "errno = %d\n", dir, errno);
144 return(1);
145 }
146 return(0);
147}
148
149void remove_umid_dir(void)
150{
151 char dir[strlen(uml_dir) + UMID_LEN + 1];
152 if (!umid_owned)
153 return;
154
155 sprintf(dir, "%s%s", uml_dir, umid);
156 actually_do_remove(dir);
157}
158
159char *get_umid(int only_if_set)
160{
161 if(only_if_set && umid_is_random)
162 return NULL;
163 return umid;
164}
165
166static int not_dead_yet(char *dir)
167{
168 char file[strlen(uml_dir) + UMID_LEN + sizeof("/pid\0")];
169 char pid[sizeof("nnnnn\0")], *end;
170 int dead, fd, p, n;
171
172 sprintf(file, "%s/pid", dir);
173 dead = 0;
174 fd = os_open_file(file, of_read(OPENFLAGS()), 0);
175 if(fd < 0){
176 if(fd != -ENOENT){
177 printk("not_dead_yet : couldn't open pid file '%s', "
178 "err = %d\n", file, -fd);
179 return(1);
180 }
181 dead = 1;
182 }
183 if(fd > 0){
184 n = os_read_file(fd, pid, sizeof(pid));
185 if(n < 0){
186 printk("not_dead_yet : couldn't read pid file '%s', "
187 "err = %d\n", file, -n);
188 return(1);
189 }
190 p = strtoul(pid, &end, 0);
191 if(end == pid){
192 printk("not_dead_yet : couldn't parse pid file '%s', "
193 "errno = %d\n", file, errno);
194 dead = 1;
195 }
196 if(((kill(p, 0) < 0) && (errno == ESRCH)) ||
197 (p == CHOOSE_MODE(tracing_pid, os_getpid())))
198 dead = 1;
199 }
200 if(!dead)
201 return(1);
202 return(actually_do_remove(dir));
203}
204
205static int __init set_uml_dir(char *name, int *add)
206{
207 if((strlen(name) > 0) && (name[strlen(name) - 1] != '/')){
208 uml_dir = malloc(strlen(name) + 2);
209 if(uml_dir == NULL){
210 printf("Failed to malloc uml_dir - error = %d\n",
211 errno);
212 uml_dir = name;
213 /* Return 0 here because do_initcalls doesn't look at
214 * the return value.
215 */
216 return(0);
217 }
218 sprintf(uml_dir, "%s/", name);
219 }
220 else uml_dir = name;
221 return(0);
222}
223
224static int __init make_uml_dir(void)
225{
226 char dir[MAXPATHLEN + 1] = { '\0' };
227 int len;
228
229 if(*uml_dir == '~'){
230 char *home = getenv("HOME");
231
232 if(home == NULL){
233 printf("make_uml_dir : no value in environment for "
234 "$HOME\n");
235 exit(1);
236 }
237 strlcpy(dir, home, sizeof(dir));
238 uml_dir++;
239 }
240 strlcat(dir, uml_dir, sizeof(dir));
241 len = strlen(dir);
242 if (len > 0 && dir[len - 1] != '/')
243 strlcat(dir, "/", sizeof(dir));
244
245 uml_dir = malloc(strlen(dir) + 1);
246 if (uml_dir == NULL) {
247 printf("make_uml_dir : malloc failed, errno = %d\n", errno);
248 exit(1);
249 }
250 strcpy(uml_dir, dir);
251
252 if((mkdir(uml_dir, 0777) < 0) && (errno != EEXIST)){
253 printf("Failed to mkdir %s: %s\n", uml_dir, strerror(errno));
254 return(-1);
255 }
256 return 0;
257}
258
259static int __init make_umid(int (*printer)(const char *fmt, ...))
260{
261 int fd, err;
262 char tmp[strlen(uml_dir) + UMID_LEN + 1];
263
264 strlcpy(tmp, uml_dir, sizeof(tmp));
265
266 if(!umid_inited){
267 strcat(tmp, "XXXXXX");
268 fd = mkstemp(tmp);
269 if(fd < 0){
270 (*printer)("make_umid - mkstemp(%s) failed: %s\n",
271 tmp,strerror(errno));
272 return(1);
273 }
274
275 os_close_file(fd);
276 /* There's a nice tiny little race between this unlink and
277 * the mkdir below. It'd be nice if there were a mkstemp
278 * for directories.
279 */
280 unlink(tmp);
281 set_umid(&tmp[strlen(uml_dir)], 1, printer);
282 }
283
284 sprintf(tmp, "%s%s", uml_dir, umid);
285
286 err = mkdir(tmp, 0777);
287 if(err < 0){
288 if(errno == EEXIST){
289 if(not_dead_yet(tmp)){
290 (*printer)("umid '%s' is in use\n", umid);
291 umid_owned = 0;
292 return(-1);
293 }
294 err = mkdir(tmp, 0777);
295 }
296 }
297 if(err < 0){
298 (*printer)("Failed to create %s - errno = %d\n", umid, errno);
299 return(-1);
300 }
301
302 umid_owned = 1;
303 return 0;
304}
305
306__uml_setup("uml_dir=", set_uml_dir,
307"uml_dir=<directory>\n"
308" The location to place the pid and umid files.\n\n"
309);
310
311static int __init make_umid_setup(void)
312{
313 /* one function with the ordering we need ... */
314 make_uml_dir();
315 make_umid(printf);
316 create_pid_file();
317 return 0;
318}
319__uml_postsetup(make_umid_setup);
320
321/*
322 * Overrides for Emacs so that we follow Linus's tabbing style.
323 * Emacs will notice this stuff at the end of the file and automatically
324 * adjust the settings for this buffer only. This must remain at the end
325 * of the file.
326 * ---------------------------------------------------------------------------
327 * Local variables:
328 * c-file-style: "linux"
329 * End:
330 */
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index b83ac8e21c35..08a4e628b24c 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -4,11 +4,13 @@
4# 4#
5 5
6obj-y = aio.o elf_aux.o file.o helper.o main.o mem.o process.o signal.o \ 6obj-y = aio.o elf_aux.o file.o helper.o main.o mem.o process.o signal.o \
7 start_up.o time.o tt.o tty.o uaccess.o user_syms.o drivers/ \ 7 start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o user_syms.o \
8 sys-$(SUBARCH)/ 8 util.o drivers/ sys-$(SUBARCH)/
9
10obj-$(CONFIG_MODE_SKAS) += skas/
9 11
10USER_OBJS := aio.o elf_aux.o file.o helper.o main.o mem.o process.o signal.o \ 12USER_OBJS := aio.o elf_aux.o file.o helper.o main.o mem.o process.o signal.o \
11 start_up.o time.o tt.o tty.o uaccess.o 13 start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o util.o
12 14
13elf_aux.o: $(ARCH_DIR)/kernel-offsets.h 15elf_aux.o: $(ARCH_DIR)/kernel-offsets.h
14CFLAGS_elf_aux.o += -I$(objtree)/arch/um 16CFLAGS_elf_aux.o += -I$(objtree)/arch/um
diff --git a/arch/um/os-Linux/aio.c b/arch/um/os-Linux/aio.c
index ffa759addd3c..f897140cc4ae 100644
--- a/arch/um/os-Linux/aio.c
+++ b/arch/um/os-Linux/aio.c
@@ -16,12 +16,12 @@
16#include "mode.h" 16#include "mode.h"
17 17
18struct aio_thread_req { 18struct aio_thread_req {
19 enum aio_type type; 19 enum aio_type type;
20 int io_fd; 20 int io_fd;
21 unsigned long long offset; 21 unsigned long long offset;
22 char *buf; 22 char *buf;
23 int len; 23 int len;
24 struct aio_context *aio; 24 struct aio_context *aio;
25}; 25};
26 26
27static int aio_req_fd_r = -1; 27static int aio_req_fd_r = -1;
@@ -38,18 +38,18 @@ static int aio_req_fd_w = -1;
38 38
39static long io_setup(int n, aio_context_t *ctxp) 39static long io_setup(int n, aio_context_t *ctxp)
40{ 40{
41 return syscall(__NR_io_setup, n, ctxp); 41 return syscall(__NR_io_setup, n, ctxp);
42} 42}
43 43
44static long io_submit(aio_context_t ctx, long nr, struct iocb **iocbpp) 44static long io_submit(aio_context_t ctx, long nr, struct iocb **iocbpp)
45{ 45{
46 return syscall(__NR_io_submit, ctx, nr, iocbpp); 46 return syscall(__NR_io_submit, ctx, nr, iocbpp);
47} 47}
48 48
49static long io_getevents(aio_context_t ctx_id, long min_nr, long nr, 49static long io_getevents(aio_context_t ctx_id, long min_nr, long nr,
50 struct io_event *events, struct timespec *timeout) 50 struct io_event *events, struct timespec *timeout)
51{ 51{
52 return syscall(__NR_io_getevents, ctx_id, min_nr, nr, events, timeout); 52 return syscall(__NR_io_getevents, ctx_id, min_nr, nr, events, timeout);
53} 53}
54 54
55#endif 55#endif
@@ -66,243 +66,245 @@ static long io_getevents(aio_context_t ctx_id, long min_nr, long nr,
66 */ 66 */
67 67
68static int do_aio(aio_context_t ctx, enum aio_type type, int fd, char *buf, 68static int do_aio(aio_context_t ctx, enum aio_type type, int fd, char *buf,
69 int len, unsigned long long offset, struct aio_context *aio) 69 int len, unsigned long long offset, struct aio_context *aio)
70{ 70{
71 struct iocb iocb, *iocbp = &iocb; 71 struct iocb iocb, *iocbp = &iocb;
72 char c; 72 char c;
73 int err; 73 int err;
74 74
75 iocb = ((struct iocb) { .aio_data = (unsigned long) aio, 75 iocb = ((struct iocb) { .aio_data = (unsigned long) aio,
76 .aio_reqprio = 0, 76 .aio_reqprio = 0,
77 .aio_fildes = fd, 77 .aio_fildes = fd,
78 .aio_buf = (unsigned long) buf, 78 .aio_buf = (unsigned long) buf,
79 .aio_nbytes = len, 79 .aio_nbytes = len,
80 .aio_offset = offset, 80 .aio_offset = offset,
81 .aio_reserved1 = 0, 81 .aio_reserved1 = 0,
82 .aio_reserved2 = 0, 82 .aio_reserved2 = 0,
83 .aio_reserved3 = 0 }); 83 .aio_reserved3 = 0 });
84 84
85 switch(type){ 85 switch(type){
86 case AIO_READ: 86 case AIO_READ:
87 iocb.aio_lio_opcode = IOCB_CMD_PREAD; 87 iocb.aio_lio_opcode = IOCB_CMD_PREAD;
88 err = io_submit(ctx, 1, &iocbp); 88 err = io_submit(ctx, 1, &iocbp);
89 break; 89 break;
90 case AIO_WRITE: 90 case AIO_WRITE:
91 iocb.aio_lio_opcode = IOCB_CMD_PWRITE; 91 iocb.aio_lio_opcode = IOCB_CMD_PWRITE;
92 err = io_submit(ctx, 1, &iocbp); 92 err = io_submit(ctx, 1, &iocbp);
93 break; 93 break;
94 case AIO_MMAP: 94 case AIO_MMAP:
95 iocb.aio_lio_opcode = IOCB_CMD_PREAD; 95 iocb.aio_lio_opcode = IOCB_CMD_PREAD;
96 iocb.aio_buf = (unsigned long) &c; 96 iocb.aio_buf = (unsigned long) &c;
97 iocb.aio_nbytes = sizeof(c); 97 iocb.aio_nbytes = sizeof(c);
98 err = io_submit(ctx, 1, &iocbp); 98 err = io_submit(ctx, 1, &iocbp);
99 break; 99 break;
100 default: 100 default:
101 printk("Bogus op in do_aio - %d\n", type); 101 printk("Bogus op in do_aio - %d\n", type);
102 err = -EINVAL; 102 err = -EINVAL;
103 break; 103 break;
104 } 104 }
105 105
106 if(err > 0) 106 if(err > 0)
107 err = 0; 107 err = 0;
108 else 108 else
109 err = -errno; 109 err = -errno;
110 110
111 return err; 111 return err;
112} 112}
113 113
114static aio_context_t ctx = 0; 114static aio_context_t ctx = 0;
115 115
116static int aio_thread(void *arg) 116static int aio_thread(void *arg)
117{ 117{
118 struct aio_thread_reply reply; 118 struct aio_thread_reply reply;
119 struct io_event event; 119 struct io_event event;
120 int err, n, reply_fd; 120 int err, n, reply_fd;
121 121
122 signal(SIGWINCH, SIG_IGN); 122 signal(SIGWINCH, SIG_IGN);
123 123
124 while(1){ 124 while(1){
125 n = io_getevents(ctx, 1, 1, &event, NULL); 125 n = io_getevents(ctx, 1, 1, &event, NULL);
126 if(n < 0){ 126 if(n < 0){
127 if(errno == EINTR) 127 if(errno == EINTR)
128 continue; 128 continue;
129 printk("aio_thread - io_getevents failed, " 129 printk("aio_thread - io_getevents failed, "
130 "errno = %d\n", errno); 130 "errno = %d\n", errno);
131 } 131 }
132 else { 132 else {
133 reply = ((struct aio_thread_reply) 133 reply = ((struct aio_thread_reply)
134 { .data = (void *) (long) event.data, 134 { .data = (void *) (long) event.data,
135 .err = event.res }); 135 .err = event.res });
136 reply_fd = ((struct aio_context *) reply.data)->reply_fd; 136 reply_fd = ((struct aio_context *) reply.data)->reply_fd;
137 err = os_write_file(reply_fd, &reply, sizeof(reply)); 137 err = os_write_file(reply_fd, &reply, sizeof(reply));
138 if(err != sizeof(reply)) 138 if(err != sizeof(reply))
139 printk("aio_thread - write failed, fd = %d, " 139 printk("aio_thread - write failed, fd = %d, "
140 "err = %d\n", aio_req_fd_r, -err); 140 "err = %d\n", aio_req_fd_r, -err);
141 } 141 }
142 } 142 }
143 return 0; 143 return 0;
144} 144}
145 145
146#endif 146#endif
147 147
148static int do_not_aio(struct aio_thread_req *req) 148static int do_not_aio(struct aio_thread_req *req)
149{ 149{
150 char c; 150 char c;
151 int err; 151 int err;
152 152
153 switch(req->type){ 153 switch(req->type){
154 case AIO_READ: 154 case AIO_READ:
155 err = os_seek_file(req->io_fd, req->offset); 155 err = os_seek_file(req->io_fd, req->offset);
156 if(err) 156 if(err)
157 goto out; 157 goto out;
158 158
159 err = os_read_file(req->io_fd, req->buf, req->len); 159 err = os_read_file(req->io_fd, req->buf, req->len);
160 break; 160 break;
161 case AIO_WRITE: 161 case AIO_WRITE:
162 err = os_seek_file(req->io_fd, req->offset); 162 err = os_seek_file(req->io_fd, req->offset);
163 if(err) 163 if(err)
164 goto out; 164 goto out;
165 165
166 err = os_write_file(req->io_fd, req->buf, req->len); 166 err = os_write_file(req->io_fd, req->buf, req->len);
167 break; 167 break;
168 case AIO_MMAP: 168 case AIO_MMAP:
169 err = os_seek_file(req->io_fd, req->offset); 169 err = os_seek_file(req->io_fd, req->offset);
170 if(err) 170 if(err)
171 goto out; 171 goto out;
172 172
173 err = os_read_file(req->io_fd, &c, sizeof(c)); 173 err = os_read_file(req->io_fd, &c, sizeof(c));
174 break; 174 break;
175 default: 175 default:
176 printk("do_not_aio - bad request type : %d\n", req->type); 176 printk("do_not_aio - bad request type : %d\n", req->type);
177 err = -EINVAL; 177 err = -EINVAL;
178 break; 178 break;
179 } 179 }
180 180
181 out: 181out:
182 return err; 182 return err;
183} 183}
184 184
185static int not_aio_thread(void *arg) 185static int not_aio_thread(void *arg)
186{ 186{
187 struct aio_thread_req req; 187 struct aio_thread_req req;
188 struct aio_thread_reply reply; 188 struct aio_thread_reply reply;
189 int err; 189 int err;
190 190
191 signal(SIGWINCH, SIG_IGN); 191 signal(SIGWINCH, SIG_IGN);
192 while(1){ 192 while(1){
193 err = os_read_file(aio_req_fd_r, &req, sizeof(req)); 193 err = os_read_file(aio_req_fd_r, &req, sizeof(req));
194 if(err != sizeof(req)){ 194 if(err != sizeof(req)){
195 if(err < 0) 195 if(err < 0)
196 printk("not_aio_thread - read failed, " 196 printk("not_aio_thread - read failed, "
197 "fd = %d, err = %d\n", aio_req_fd_r, 197 "fd = %d, err = %d\n", aio_req_fd_r,
198 -err); 198 -err);
199 else { 199 else {
200 printk("not_aio_thread - short read, fd = %d, " 200 printk("not_aio_thread - short read, fd = %d, "
201 "length = %d\n", aio_req_fd_r, err); 201 "length = %d\n", aio_req_fd_r, err);
202 } 202 }
203 continue; 203 continue;
204 } 204 }
205 err = do_not_aio(&req); 205 err = do_not_aio(&req);
206 reply = ((struct aio_thread_reply) { .data = req.aio, 206 reply = ((struct aio_thread_reply) { .data = req.aio,
207 .err = err }); 207 .err = err });
208 err = os_write_file(req.aio->reply_fd, &reply, sizeof(reply)); 208 err = os_write_file(req.aio->reply_fd, &reply, sizeof(reply));
209 if(err != sizeof(reply)) 209 if(err != sizeof(reply))
210 printk("not_aio_thread - write failed, fd = %d, " 210 printk("not_aio_thread - write failed, fd = %d, "
211 "err = %d\n", aio_req_fd_r, -err); 211 "err = %d\n", aio_req_fd_r, -err);
212 } 212 }
213
214 return 0;
213} 215}
214 216
215static int aio_pid = -1; 217static int aio_pid = -1;
216 218
217static int init_aio_24(void) 219static int init_aio_24(void)
218{ 220{
219 unsigned long stack; 221 unsigned long stack;
220 int fds[2], err; 222 int fds[2], err;
221 223
222 err = os_pipe(fds, 1, 1); 224 err = os_pipe(fds, 1, 1);
223 if(err) 225 if(err)
224 goto out; 226 goto out;
225 227
226 aio_req_fd_w = fds[0]; 228 aio_req_fd_w = fds[0];
227 aio_req_fd_r = fds[1]; 229 aio_req_fd_r = fds[1];
228 err = run_helper_thread(not_aio_thread, NULL, 230 err = run_helper_thread(not_aio_thread, NULL,
229 CLONE_FILES | CLONE_VM | SIGCHLD, &stack, 0); 231 CLONE_FILES | CLONE_VM | SIGCHLD, &stack, 0);
230 if(err < 0) 232 if(err < 0)
231 goto out_close_pipe; 233 goto out_close_pipe;
232 234
233 aio_pid = err; 235 aio_pid = err;
234 goto out; 236 goto out;
235 237
236 out_close_pipe: 238out_close_pipe:
237 os_close_file(fds[0]); 239 os_close_file(fds[0]);
238 os_close_file(fds[1]); 240 os_close_file(fds[1]);
239 aio_req_fd_w = -1; 241 aio_req_fd_w = -1;
240 aio_req_fd_r = -1; 242 aio_req_fd_r = -1;
241 out: 243out:
242#ifndef HAVE_AIO_ABI 244#ifndef HAVE_AIO_ABI
243 printk("/usr/include/linux/aio_abi.h not present during build\n"); 245 printk("/usr/include/linux/aio_abi.h not present during build\n");
244#endif 246#endif
245 printk("2.6 host AIO support not used - falling back to I/O " 247 printk("2.6 host AIO support not used - falling back to I/O "
246 "thread\n"); 248 "thread\n");
247 return 0; 249 return 0;
248} 250}
249 251
250#ifdef HAVE_AIO_ABI 252#ifdef HAVE_AIO_ABI
251#define DEFAULT_24_AIO 0 253#define DEFAULT_24_AIO 0
252static int init_aio_26(void) 254static int init_aio_26(void)
253{ 255{
254 unsigned long stack; 256 unsigned long stack;
255 int err; 257 int err;
256 258
257 if(io_setup(256, &ctx)){ 259 if(io_setup(256, &ctx)){
258 err = -errno; 260 err = -errno;
259 printk("aio_thread failed to initialize context, err = %d\n", 261 printk("aio_thread failed to initialize context, err = %d\n",
260 errno); 262 errno);
261 return err; 263 return err;
262 } 264 }
263 265
264 err = run_helper_thread(aio_thread, NULL, 266 err = run_helper_thread(aio_thread, NULL,
265 CLONE_FILES | CLONE_VM | SIGCHLD, &stack, 0); 267 CLONE_FILES | CLONE_VM | SIGCHLD, &stack, 0);
266 if(err < 0) 268 if(err < 0)
267 return err; 269 return err;
268 270
269 aio_pid = err; 271 aio_pid = err;
270 272
271 printk("Using 2.6 host AIO\n"); 273 printk("Using 2.6 host AIO\n");
272 return 0; 274 return 0;
273} 275}
274 276
275static int submit_aio_26(enum aio_type type, int io_fd, char *buf, int len, 277static int submit_aio_26(enum aio_type type, int io_fd, char *buf, int len,
276 unsigned long long offset, struct aio_context *aio) 278 unsigned long long offset, struct aio_context *aio)
277{ 279{
278 struct aio_thread_reply reply; 280 struct aio_thread_reply reply;
279 int err; 281 int err;
280 282
281 err = do_aio(ctx, type, io_fd, buf, len, offset, aio); 283 err = do_aio(ctx, type, io_fd, buf, len, offset, aio);
282 if(err){ 284 if(err){
283 reply = ((struct aio_thread_reply) { .data = aio, 285 reply = ((struct aio_thread_reply) { .data = aio,
284 .err = err }); 286 .err = err });
285 err = os_write_file(aio->reply_fd, &reply, sizeof(reply)); 287 err = os_write_file(aio->reply_fd, &reply, sizeof(reply));
286 if(err != sizeof(reply)) 288 if(err != sizeof(reply))
287 printk("submit_aio_26 - write failed, " 289 printk("submit_aio_26 - write failed, "
288 "fd = %d, err = %d\n", aio->reply_fd, -err); 290 "fd = %d, err = %d\n", aio->reply_fd, -err);
289 else err = 0; 291 else err = 0;
290 } 292 }
291 293
292 return err; 294 return err;
293} 295}
294 296
295#else 297#else
296#define DEFAULT_24_AIO 1 298#define DEFAULT_24_AIO 1
297static int init_aio_26(void) 299static int init_aio_26(void)
298{ 300{
299 return -ENOSYS; 301 return -ENOSYS;
300} 302}
301 303
302static int submit_aio_26(enum aio_type type, int io_fd, char *buf, int len, 304static int submit_aio_26(enum aio_type type, int io_fd, char *buf, int len,
303 unsigned long long offset, struct aio_context *aio) 305 unsigned long long offset, struct aio_context *aio)
304{ 306{
305 return -ENOSYS; 307 return -ENOSYS;
306} 308}
307#endif 309#endif
308 310
@@ -310,8 +312,8 @@ static int aio_24 = DEFAULT_24_AIO;
310 312
311static int __init set_aio_24(char *name, int *add) 313static int __init set_aio_24(char *name, int *add)
312{ 314{
313 aio_24 = 1; 315 aio_24 = 1;
314 return 0; 316 return 0;
315} 317}
316 318
317__uml_setup("aio=2.4", set_aio_24, 319__uml_setup("aio=2.4", set_aio_24,
@@ -328,28 +330,27 @@ __uml_setup("aio=2.4", set_aio_24,
328 330
329static int init_aio(void) 331static int init_aio(void)
330{ 332{
331 int err; 333 int err;
332 334
333 CHOOSE_MODE(({ 335 CHOOSE_MODE(({ if(!aio_24){
334 if(!aio_24){ 336 printk("Disabling 2.6 AIO in tt mode\n");
335 printk("Disabling 2.6 AIO in tt mode\n"); 337 aio_24 = 1;
336 aio_24 = 1; 338 } }), (void) 0);
337 } }), (void) 0); 339
338 340 if(!aio_24){
339 if(!aio_24){ 341 err = init_aio_26();
340 err = init_aio_26(); 342 if(err && (errno == ENOSYS)){
341 if(err && (errno == ENOSYS)){ 343 printk("2.6 AIO not supported on the host - "
342 printk("2.6 AIO not supported on the host - " 344 "reverting to 2.4 AIO\n");
343 "reverting to 2.4 AIO\n"); 345 aio_24 = 1;
344 aio_24 = 1; 346 }
345 } 347 else return err;
346 else return err; 348 }
347 } 349
348 350 if(aio_24)
349 if(aio_24) 351 return init_aio_24();
350 return init_aio_24(); 352
351 353 return 0;
352 return 0;
353} 354}
354 355
355/* The reason for the __initcall/__uml_exitcall asymmetry is that init_aio 356/* The reason for the __initcall/__uml_exitcall asymmetry is that init_aio
@@ -362,8 +363,8 @@ __initcall(init_aio);
362 363
363static void exit_aio(void) 364static void exit_aio(void)
364{ 365{
365 if(aio_pid != -1) 366 if(aio_pid != -1)
366 os_kill_process(aio_pid, 1); 367 os_kill_process(aio_pid, 1);
367} 368}
368 369
369__uml_exitcall(exit_aio); 370__uml_exitcall(exit_aio);
@@ -371,30 +372,30 @@ __uml_exitcall(exit_aio);
371static int submit_aio_24(enum aio_type type, int io_fd, char *buf, int len, 372static int submit_aio_24(enum aio_type type, int io_fd, char *buf, int len,
372 unsigned long long offset, struct aio_context *aio) 373 unsigned long long offset, struct aio_context *aio)
373{ 374{
374 struct aio_thread_req req = { .type = type, 375 struct aio_thread_req req = { .type = type,
375 .io_fd = io_fd, 376 .io_fd = io_fd,
376 .offset = offset, 377 .offset = offset,
377 .buf = buf, 378 .buf = buf,
378 .len = len, 379 .len = len,
379 .aio = aio, 380 .aio = aio,
380 }; 381 };
381 int err; 382 int err;
382 383
383 err = os_write_file(aio_req_fd_w, &req, sizeof(req)); 384 err = os_write_file(aio_req_fd_w, &req, sizeof(req));
384 if(err == sizeof(req)) 385 if(err == sizeof(req))
385 err = 0; 386 err = 0;
386 387
387 return err; 388 return err;
388} 389}
389 390
390int submit_aio(enum aio_type type, int io_fd, char *buf, int len, 391int submit_aio(enum aio_type type, int io_fd, char *buf, int len,
391 unsigned long long offset, int reply_fd, 392 unsigned long long offset, int reply_fd,
392 struct aio_context *aio) 393 struct aio_context *aio)
393{ 394{
394 aio->reply_fd = reply_fd; 395 aio->reply_fd = reply_fd;
395 if(aio_24) 396 if(aio_24)
396 return submit_aio_24(type, io_fd, buf, len, offset, aio); 397 return submit_aio_24(type, io_fd, buf, len, offset, aio);
397 else { 398 else {
398 return submit_aio_26(type, io_fd, buf, len, offset, aio); 399 return submit_aio_26(type, io_fd, buf, len, offset, aio);
399 } 400 }
400} 401}
diff --git a/arch/um/os-Linux/helper.c b/arch/um/os-Linux/helper.c
index 36cc8475bcda..6490a4ff40ac 100644
--- a/arch/um/os-Linux/helper.c
+++ b/arch/um/os-Linux/helper.c
@@ -60,7 +60,7 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
60 60
61 if((stack_out != NULL) && (*stack_out != 0)) 61 if((stack_out != NULL) && (*stack_out != 0))
62 stack = *stack_out; 62 stack = *stack_out;
63 else stack = alloc_stack(0, um_in_interrupt()); 63 else stack = alloc_stack(0, __cant_sleep());
64 if(stack == 0) 64 if(stack == 0)
65 return(-ENOMEM); 65 return(-ENOMEM);
66 66
@@ -124,7 +124,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
124 unsigned long stack, sp; 124 unsigned long stack, sp;
125 int pid, status, err; 125 int pid, status, err;
126 126
127 stack = alloc_stack(stack_order, um_in_interrupt()); 127 stack = alloc_stack(stack_order, __cant_sleep());
128 if(stack == 0) return(-ENOMEM); 128 if(stack == 0) return(-ENOMEM);
129 129
130 sp = stack + (page_size() << stack_order) - sizeof(void *); 130 sp = stack + (page_size() << stack_order) - sizeof(void *);
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index 23da27d22569..2878e89a674f 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -16,8 +16,6 @@
16#include "user_util.h" 16#include "user_util.h"
17#include "kern_util.h" 17#include "kern_util.h"
18#include "mem_user.h" 18#include "mem_user.h"
19#include "signal_user.h"
20#include "time_user.h"
21#include "irq_user.h" 19#include "irq_user.h"
22#include "user.h" 20#include "user.h"
23#include "init.h" 21#include "init.h"
@@ -83,20 +81,8 @@ extern void scan_elf_aux( char **envp);
83int main(int argc, char **argv, char **envp) 81int main(int argc, char **argv, char **envp)
84{ 82{
85 char **new_argv; 83 char **new_argv;
86 sigset_t mask;
87 int ret, i, err; 84 int ret, i, err;
88 85
89 /* Enable all signals except SIGIO - in some environments, we can
90 * enter with some signals blocked
91 */
92
93 sigemptyset(&mask);
94 sigaddset(&mask, SIGIO);
95 if(sigprocmask(SIG_SETMASK, &mask, NULL) < 0){
96 perror("sigprocmask");
97 exit(1);
98 }
99
100#ifdef UML_CONFIG_CMDLINE_ON_HOST 86#ifdef UML_CONFIG_CMDLINE_ON_HOST
101 /* Allocate memory for thread command lines */ 87 /* Allocate memory for thread command lines */
102 if(argc < 2 || strlen(argv[1]) < THREAD_NAME_LEN - 1){ 88 if(argc < 2 || strlen(argv[1]) < THREAD_NAME_LEN - 1){
diff --git a/arch/um/os-Linux/process.c b/arch/um/os-Linux/process.c
index d9c52387c4a1..7f5e2dac2a35 100644
--- a/arch/um/os-Linux/process.c
+++ b/arch/um/os-Linux/process.c
@@ -15,10 +15,10 @@
15#include "os.h" 15#include "os.h"
16#include "user.h" 16#include "user.h"
17#include "user_util.h" 17#include "user_util.h"
18#include "signal_user.h"
19#include "process.h" 18#include "process.h"
20#include "irq_user.h" 19#include "irq_user.h"
21#include "kern_util.h" 20#include "kern_util.h"
21#include "longjmp.h"
22 22
23#define ARBITRARY_ADDR -1 23#define ARBITRARY_ADDR -1
24#define FAILURE_PID -1 24#define FAILURE_PID -1
@@ -206,24 +206,13 @@ void init_new_thread_signals(int altstack)
206 206
207int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr) 207int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr)
208{ 208{
209 sigjmp_buf buf; 209 sigjmp_buf buf;
210 int n; 210 int n, enable;
211 211
212 *jmp_ptr = &buf; 212 *jmp_ptr = &buf;
213 n = sigsetjmp(buf, 1); 213 n = UML_SIGSETJMP(&buf, enable);
214 if(n != 0) 214 if(n != 0)
215 return(n); 215 return(n);
216 (*fn)(arg); 216 (*fn)(arg);
217 return(0); 217 return(0);
218} 218}
219
220/*
221 * Overrides for Emacs so that we follow Linus's tabbing style.
222 * Emacs will notice this stuff at the end of the file and automatically
223 * adjust the settings for this buffer only. This must remain at the end
224 * of the file.
225 * ---------------------------------------------------------------------------
226 * Local variables:
227 * c-file-style: "linux"
228 * End:
229 */
diff --git a/arch/um/os-Linux/signal.c b/arch/um/os-Linux/signal.c
index c7bfd5ee3925..f11b3124a0c8 100644
--- a/arch/um/os-Linux/signal.c
+++ b/arch/um/os-Linux/signal.c
@@ -4,27 +4,74 @@
4 */ 4 */
5 5
6#include <signal.h> 6#include <signal.h>
7#include "time_user.h" 7#include <stdio.h>
8#include "mode.h" 8#include <unistd.h>
9#include <stdlib.h>
10#include <errno.h>
11#include <stdarg.h>
12#include <string.h>
13#include <sys/mman.h>
14#include "user_util.h"
15#include "user.h"
16#include "signal_kern.h"
17#include "sysdep/sigcontext.h"
9#include "sysdep/signal.h" 18#include "sysdep/signal.h"
19#include "sigcontext.h"
20#include "mode.h"
21#include "os.h"
22
23/* These are the asynchronous signals. SIGVTALRM and SIGARLM are handled
24 * together under SIGVTALRM_BIT. SIGPROF is excluded because we want to
25 * be able to profile all of UML, not just the non-critical sections. If
26 * profiling is not thread-safe, then that is not my problem. We can disable
27 * profiling when SMP is enabled in that case.
28 */
29#define SIGIO_BIT 0
30#define SIGIO_MASK (1 << SIGIO_BIT)
31
32#define SIGVTALRM_BIT 1
33#define SIGVTALRM_MASK (1 << SIGVTALRM_BIT)
34
35#define SIGALRM_BIT 2
36#define SIGALRM_MASK (1 << SIGALRM_BIT)
37
38static int signals_enabled = 1;
39static int pending = 0;
10 40
11void sig_handler(ARCH_SIGHDLR_PARAM) 41void sig_handler(ARCH_SIGHDLR_PARAM)
12{ 42{
13 struct sigcontext *sc; 43 struct sigcontext *sc;
44 int enabled;
45
46 /* Must be the first thing that this handler does - x86_64 stores
47 * the sigcontext in %rdx, and we need to save it before it has a
48 * chance to get trashed.
49 */
14 50
15 ARCH_GET_SIGCONTEXT(sc, sig); 51 ARCH_GET_SIGCONTEXT(sc, sig);
52
53 enabled = signals_enabled;
54 if(!enabled && (sig == SIGIO)){
55 pending |= SIGIO_MASK;
56 return;
57 }
58
59 block_signals();
60
16 CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas, 61 CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas,
17 sig, sc); 62 sig, sc);
63
64 set_signals(enabled);
18} 65}
19 66
20extern int timer_irq_inited; 67extern int timer_irq_inited;
21 68
22void alarm_handler(ARCH_SIGHDLR_PARAM) 69static void real_alarm_handler(int sig, struct sigcontext *sc)
23{ 70{
24 struct sigcontext *sc; 71 if(!timer_irq_inited){
25 72 signals_enabled = 1;
26 ARCH_GET_SIGCONTEXT(sc, sig); 73 return;
27 if(!timer_irq_inited) return; 74 }
28 75
29 if(sig == SIGALRM) 76 if(sig == SIGALRM)
30 switch_timers(0); 77 switch_timers(0);
@@ -34,15 +81,180 @@ void alarm_handler(ARCH_SIGHDLR_PARAM)
34 81
35 if(sig == SIGALRM) 82 if(sig == SIGALRM)
36 switch_timers(1); 83 switch_timers(1);
84
37} 85}
38 86
39/* 87void alarm_handler(ARCH_SIGHDLR_PARAM)
40 * Overrides for Emacs so that we follow Linus's tabbing style. 88{
41 * Emacs will notice this stuff at the end of the file and automatically 89 struct sigcontext *sc;
42 * adjust the settings for this buffer only. This must remain at the end 90 int enabled;
43 * of the file. 91
44 * --------------------------------------------------------------------------- 92 ARCH_GET_SIGCONTEXT(sc, sig);
45 * Local variables: 93
46 * c-file-style: "linux" 94 enabled = signals_enabled;
47 * End: 95 if(!signals_enabled){
48 */ 96 if(sig == SIGVTALRM)
97 pending |= SIGVTALRM_MASK;
98 else pending |= SIGALRM_MASK;
99
100 return;
101 }
102
103 block_signals();
104
105 real_alarm_handler(sig, sc);
106 set_signals(enabled);
107}
108
109extern void do_boot_timer_handler(struct sigcontext * sc);
110
111void boot_timer_handler(ARCH_SIGHDLR_PARAM)
112{
113 struct sigcontext *sc;
114 int enabled;
115
116 ARCH_GET_SIGCONTEXT(sc, sig);
117
118 enabled = signals_enabled;
119 if(!enabled){
120 if(sig == SIGVTALRM)
121 pending |= SIGVTALRM_MASK;
122 else pending |= SIGALRM_MASK;
123 return;
124 }
125
126 block_signals();
127
128 do_boot_timer_handler(sc);
129 set_signals(enabled);
130}
131
132void set_sigstack(void *sig_stack, int size)
133{
134 stack_t stack = ((stack_t) { .ss_flags = 0,
135 .ss_sp = (__ptr_t) sig_stack,
136 .ss_size = size - sizeof(void *) });
137
138 if(sigaltstack(&stack, NULL) != 0)
139 panic("enabling signal stack failed, errno = %d\n", errno);
140}
141
142void remove_sigstack(void)
143{
144 stack_t stack = ((stack_t) { .ss_flags = SS_DISABLE,
145 .ss_sp = NULL,
146 .ss_size = 0 });
147
148 if(sigaltstack(&stack, NULL) != 0)
149 panic("disabling signal stack failed, errno = %d\n", errno);
150}
151
152void set_handler(int sig, void (*handler)(int), int flags, ...)
153{
154 struct sigaction action;
155 va_list ap;
156 sigset_t sig_mask;
157 int mask;
158
159 va_start(ap, flags);
160 action.sa_handler = handler;
161 sigemptyset(&action.sa_mask);
162 while((mask = va_arg(ap, int)) != -1){
163 sigaddset(&action.sa_mask, mask);
164 }
165 va_end(ap);
166 action.sa_flags = flags;
167 action.sa_restorer = NULL;
168 if(sigaction(sig, &action, NULL) < 0)
169 panic("sigaction failed - errno = %d\n", errno);
170
171 sigemptyset(&sig_mask);
172 sigaddset(&sig_mask, sig);
173 if(sigprocmask(SIG_UNBLOCK, &sig_mask, NULL) < 0)
174 panic("sigprocmask failed - errno = %d\n", errno);
175}
176
177int change_sig(int signal, int on)
178{
179 sigset_t sigset, old;
180
181 sigemptyset(&sigset);
182 sigaddset(&sigset, signal);
183 sigprocmask(on ? SIG_UNBLOCK : SIG_BLOCK, &sigset, &old);
184 return(!sigismember(&old, signal));
185}
186
187void block_signals(void)
188{
189 signals_enabled = 0;
190}
191
192void unblock_signals(void)
193{
194 int save_pending;
195
196 if(signals_enabled == 1)
197 return;
198
199 /* We loop because the IRQ handler returns with interrupts off. So,
200 * interrupts may have arrived and we need to re-enable them and
201 * recheck pending.
202 */
203 while(1){
204 /* Save and reset save_pending after enabling signals. This
205 * way, pending won't be changed while we're reading it.
206 */
207 signals_enabled = 1;
208
209 save_pending = pending;
210 if(save_pending == 0)
211 return;
212
213 pending = 0;
214
215 /* We have pending interrupts, so disable signals, as the
216 * handlers expect them off when they are called. They will
217 * be enabled again above.
218 */
219
220 signals_enabled = 0;
221
222 /* Deal with SIGIO first because the alarm handler might
223 * schedule, leaving the pending SIGIO stranded until we come
224 * back here.
225 */
226 if(save_pending & SIGIO_MASK)
227 CHOOSE_MODE_PROC(sig_handler_common_tt,
228 sig_handler_common_skas, SIGIO, NULL);
229
230 if(save_pending & SIGALRM_MASK)
231 real_alarm_handler(SIGALRM, NULL);
232
233 if(save_pending & SIGVTALRM_MASK)
234 real_alarm_handler(SIGVTALRM, NULL);
235 }
236}
237
238int get_signals(void)
239{
240 return signals_enabled;
241}
242
243int set_signals(int enable)
244{
245 int ret;
246 if(signals_enabled == enable)
247 return enable;
248
249 ret = signals_enabled;
250 if(enable)
251 unblock_signals();
252 else block_signals();
253
254 return ret;
255}
256
257void os_usr1_signal(int on)
258{
259 change_sig(SIGUSR1, on);
260}
diff --git a/arch/um/os-Linux/skas/Makefile b/arch/um/os-Linux/skas/Makefile
new file mode 100644
index 000000000000..5fd8d4dad66a
--- /dev/null
+++ b/arch/um/os-Linux/skas/Makefile
@@ -0,0 +1,10 @@
1#
2# Copyright (C) 2002 - 2004 Jeff Dike (jdike@addtoit.com)
3# Licensed under the GPL
4#
5
6obj-y := mem.o process.o trap.o
7
8USER_OBJS := mem.o process.o trap.o
9
10include arch/um/scripts/Makefile.rules
diff --git a/arch/um/kernel/skas/mem_user.c b/arch/um/os-Linux/skas/mem.c
index 1d89640bd502..9890e9090f58 100644
--- a/arch/um/kernel/skas/mem_user.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -32,7 +32,7 @@ extern void wait_stub_done(int pid, int sig, char * fname);
32static inline unsigned long *check_init_stack(struct mm_id * mm_idp, 32static inline unsigned long *check_init_stack(struct mm_id * mm_idp,
33 unsigned long *stack) 33 unsigned long *stack)
34{ 34{
35 if(stack == NULL){ 35 if(stack == NULL) {
36 stack = (unsigned long *) mm_idp->stack + 2; 36 stack = (unsigned long *) mm_idp->stack + 2;
37 *stack = 0; 37 *stack = 0;
38 } 38 }
@@ -45,13 +45,14 @@ int single_count = 0;
45int multi_count = 0; 45int multi_count = 0;
46int multi_op_count = 0; 46int multi_op_count = 0;
47 47
48static long do_syscall_stub(struct mm_id *mm_idp, void **addr) 48static inline long do_syscall_stub(struct mm_id * mm_idp, void **addr)
49{ 49{
50 unsigned long regs[MAX_REG_NR]; 50 unsigned long regs[MAX_REG_NR];
51 unsigned long *data; 51 int n;
52 unsigned long *syscall;
53 long ret, offset; 52 long ret, offset;
54 int n, pid = mm_idp->u.pid; 53 unsigned long * data;
54 unsigned long * syscall;
55 int pid = mm_idp->u.pid;
55 56
56 if(proc_mm) 57 if(proc_mm)
57#warning Need to look up userspace_pid by cpu 58#warning Need to look up userspace_pid by cpu
@@ -59,10 +60,11 @@ static long do_syscall_stub(struct mm_id *mm_idp, void **addr)
59 60
60 multi_count++; 61 multi_count++;
61 62
62 get_safe_registers(regs); 63 get_safe_registers(regs);
63 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE + 64 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
64 ((unsigned long) &batch_syscall_stub - 65 ((unsigned long) &batch_syscall_stub -
65 (unsigned long) &__syscall_stub_start); 66 (unsigned long) &__syscall_stub_start);
67
66 n = ptrace_setregs(pid, regs); 68 n = ptrace_setregs(pid, regs);
67 if(n < 0) 69 if(n < 0)
68 panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n", 70 panic("do_syscall_stub : PTRACE_SETREGS failed, errno = %d\n",
@@ -80,6 +82,8 @@ static long do_syscall_stub(struct mm_id *mm_idp, void **addr)
80 if (offset) { 82 if (offset) {
81 data = (unsigned long *)(mm_idp->stack + 83 data = (unsigned long *)(mm_idp->stack +
82 offset - UML_CONFIG_STUB_DATA); 84 offset - UML_CONFIG_STUB_DATA);
85 printk("do_syscall_stub : ret = %d, offset = %d, "
86 "data = 0x%x\n", ret, offset, data);
83 syscall = (unsigned long *)((unsigned long)data + data[0]); 87 syscall = (unsigned long *)((unsigned long)data + data[0]);
84 printk("do_syscall_stub: syscall %ld failed, return value = " 88 printk("do_syscall_stub: syscall %ld failed, return value = "
85 "0x%lx, expected return value = 0x%lx\n", 89 "0x%lx, expected return value = 0x%lx\n",
@@ -107,32 +111,32 @@ static long do_syscall_stub(struct mm_id *mm_idp, void **addr)
107 111
108long run_syscall_stub(struct mm_id * mm_idp, int syscall, 112long run_syscall_stub(struct mm_id * mm_idp, int syscall,
109 unsigned long *args, long expected, void **addr, 113 unsigned long *args, long expected, void **addr,
110 int done) 114 int done)
111{ 115{
112 unsigned long *stack = check_init_stack(mm_idp, *addr); 116 unsigned long *stack = check_init_stack(mm_idp, *addr);
113 117
114 if(done && *addr == NULL) 118 if(done && *addr == NULL)
115 single_count++; 119 single_count++;
116 120
117 *stack += sizeof(long); 121 *stack += sizeof(long);
118 stack += *stack / sizeof(long); 122 stack += *stack / sizeof(long);
119 123
120 *stack++ = syscall; 124 *stack++ = syscall;
121 *stack++ = args[0]; 125 *stack++ = args[0];
122 *stack++ = args[1]; 126 *stack++ = args[1];
123 *stack++ = args[2]; 127 *stack++ = args[2];
124 *stack++ = args[3]; 128 *stack++ = args[3];
125 *stack++ = args[4]; 129 *stack++ = args[4];
126 *stack++ = args[5]; 130 *stack++ = args[5];
127 *stack++ = expected; 131 *stack++ = expected;
128 *stack = 0; 132 *stack = 0;
129 multi_op_count++; 133 multi_op_count++;
130 134
131 if(!done && ((((unsigned long) stack) & ~PAGE_MASK) < 135 if(!done && ((((unsigned long) stack) & ~PAGE_MASK) <
132 PAGE_SIZE - 10 * sizeof(long))){ 136 PAGE_SIZE - 10 * sizeof(long))){
133 *addr = stack; 137 *addr = stack;
134 return 0; 138 return 0;
135 } 139 }
136 140
137 return do_syscall_stub(mm_idp, addr); 141 return do_syscall_stub(mm_idp, addr);
138} 142}
@@ -150,7 +154,7 @@ long syscall_stub_data(struct mm_id * mm_idp,
150 if((((unsigned long) *addr) & ~PAGE_MASK) >= 154 if((((unsigned long) *addr) & ~PAGE_MASK) >=
151 PAGE_SIZE - (10 + data_count) * sizeof(long)) { 155 PAGE_SIZE - (10 + data_count) * sizeof(long)) {
152 ret = do_syscall_stub(mm_idp, addr); 156 ret = do_syscall_stub(mm_idp, addr);
153 /* in case of error, don't overwrite data on stack */ 157 /* in case of error, don't overwrite data on stack */
154 if(ret) 158 if(ret)
155 return ret; 159 return ret;
156 } 160 }
@@ -172,39 +176,39 @@ int map(struct mm_id * mm_idp, unsigned long virt, unsigned long len,
172 int r, int w, int x, int phys_fd, unsigned long long offset, 176 int r, int w, int x, int phys_fd, unsigned long long offset,
173 int done, void **data) 177 int done, void **data)
174{ 178{
175 int prot, ret; 179 int prot, ret;
176 180
177 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) | 181 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) |
178 (x ? PROT_EXEC : 0); 182 (x ? PROT_EXEC : 0);
179 183
180 if(proc_mm){ 184 if(proc_mm){
181 struct proc_mm_op map; 185 struct proc_mm_op map;
182 int fd = mm_idp->u.mm_fd; 186 int fd = mm_idp->u.mm_fd;
183 187
184 map = ((struct proc_mm_op) { .op = MM_MMAP, 188 map = ((struct proc_mm_op) { .op = MM_MMAP,
185 .u = 189 .u =
186 { .mmap = 190 { .mmap =
187 { .addr = virt, 191 { .addr = virt,
188 .len = len, 192 .len = len,
189 .prot = prot, 193 .prot = prot,
190 .flags = MAP_SHARED | 194 .flags = MAP_SHARED |
191 MAP_FIXED, 195 MAP_FIXED,
192 .fd = phys_fd, 196 .fd = phys_fd,
193 .offset= offset 197 .offset= offset
194 } } } ); 198 } } } );
195 ret = os_write_file(fd, &map, sizeof(map)); 199 ret = os_write_file(fd, &map, sizeof(map));
196 if(ret != sizeof(map)) 200 if(ret != sizeof(map))
197 printk("map : /proc/mm map failed, err = %d\n", -ret); 201 printk("map : /proc/mm map failed, err = %d\n", -ret);
198 else ret = 0; 202 else ret = 0;
199 } 203 }
200 else { 204 else {
201 unsigned long args[] = { virt, len, prot, 205 unsigned long args[] = { virt, len, prot,
202 MAP_SHARED | MAP_FIXED, phys_fd, 206 MAP_SHARED | MAP_FIXED, phys_fd,
203 MMAP_OFFSET(offset) }; 207 MMAP_OFFSET(offset) };
204 208
205 ret = run_syscall_stub(mm_idp, STUB_MMAP_NR, args, virt, 209 ret = run_syscall_stub(mm_idp, STUB_MMAP_NR, args, virt,
206 data, done); 210 data, done);
207 } 211 }
208 212
209 return ret; 213 return ret;
210} 214}
@@ -212,68 +216,66 @@ int map(struct mm_id * mm_idp, unsigned long virt, unsigned long len,
212int unmap(struct mm_id * mm_idp, void *addr, unsigned long len, int done, 216int unmap(struct mm_id * mm_idp, void *addr, unsigned long len, int done,
213 void **data) 217 void **data)
214{ 218{
215 int ret; 219 int ret;
216 220
217 if(proc_mm){ 221 if(proc_mm){
218 struct proc_mm_op unmap; 222 struct proc_mm_op unmap;
219 int fd = mm_idp->u.mm_fd; 223 int fd = mm_idp->u.mm_fd;
220 224
221 unmap = ((struct proc_mm_op) { .op = MM_MUNMAP, 225 unmap = ((struct proc_mm_op) { .op = MM_MUNMAP,
222 .u = 226 .u =
223 { .munmap = 227 { .munmap =
224 { .addr = 228 { .addr =
225 (unsigned long) addr, 229 (unsigned long) addr,
226 .len = len } } } ); 230 .len = len } } } );
227 ret = os_write_file(fd, &unmap, sizeof(unmap)); 231 ret = os_write_file(fd, &unmap, sizeof(unmap));
228 if(ret != sizeof(unmap)) 232 if(ret != sizeof(unmap))
229 printk("unmap - proc_mm write returned %d\n", ret); 233 printk("unmap - proc_mm write returned %d\n", ret);
230 else ret = 0; 234 else ret = 0;
231 } 235 }
232 else { 236 else {
233 unsigned long args[] = { (unsigned long) addr, len, 0, 0, 0, 237 unsigned long args[] = { (unsigned long) addr, len, 0, 0, 0,
234 0 }; 238 0 };
235 239
236 ret = run_syscall_stub(mm_idp, __NR_munmap, args, 0, 240 ret = run_syscall_stub(mm_idp, __NR_munmap, args, 0,
237 data, done); 241 data, done);
238 if(ret < 0) 242 }
239 printk("munmap stub failed, errno = %d\n", ret);
240 }
241 243
242 return ret; 244 return ret;
243} 245}
244 246
245int protect(struct mm_id * mm_idp, unsigned long addr, unsigned long len, 247int protect(struct mm_id * mm_idp, unsigned long addr, unsigned long len,
246 int r, int w, int x, int done, void **data) 248 int r, int w, int x, int done, void **data)
247{ 249{
248 struct proc_mm_op protect; 250 struct proc_mm_op protect;
249 int prot, ret; 251 int prot, ret;
250 252
251 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) | 253 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) |
252 (x ? PROT_EXEC : 0); 254 (x ? PROT_EXEC : 0);
253 255 if(proc_mm){
254 if(proc_mm){ 256 int fd = mm_idp->u.mm_fd;
255 int fd = mm_idp->u.mm_fd; 257
256 protect = ((struct proc_mm_op) { .op = MM_MPROTECT, 258 protect = ((struct proc_mm_op) { .op = MM_MPROTECT,
257 .u = 259 .u =
258 { .mprotect = 260 { .mprotect =
259 { .addr = 261 { .addr =
260 (unsigned long) addr, 262 (unsigned long) addr,
261 .len = len, 263 .len = len,
262 .prot = prot } } } ); 264 .prot = prot } } } );
263 265
264 ret = os_write_file(fd, &protect, sizeof(protect)); 266 ret = os_write_file(fd, &protect, sizeof(protect));
265 if(ret != sizeof(protect)) 267 if(ret != sizeof(protect))
266 printk("protect failed, err = %d", -ret); 268 printk("protect failed, err = %d", -ret);
267 else ret = 0; 269 else ret = 0;
268 } 270 }
269 else { 271 else {
270 unsigned long args[] = { addr, len, prot, 0, 0, 0 }; 272 unsigned long args[] = { addr, len, prot, 0, 0, 0 };
271 273
272 ret = run_syscall_stub(mm_idp, __NR_mprotect, args, 0, 274 ret = run_syscall_stub(mm_idp, __NR_mprotect, args, 0,
273 data, done); 275 data, done);
274 } 276 }
275 277
276 return ret; 278 return ret;
277} 279}
278 280
279void before_mem_skas(unsigned long unused) 281void before_mem_skas(unsigned long unused)
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
new file mode 100644
index 000000000000..120a21c5883f
--- /dev/null
+++ b/arch/um/os-Linux/skas/process.c
@@ -0,0 +1,566 @@
1/*
2 * Copyright (C) 2002- 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#include <stdlib.h>
7#include <string.h>
8#include <unistd.h>
9#include <errno.h>
10#include <signal.h>
11#include <setjmp.h>
12#include <sched.h>
13#include "ptrace_user.h"
14#include <sys/wait.h>
15#include <sys/mman.h>
16#include <sys/user.h>
17#include <sys/time.h>
18#include <asm/unistd.h>
19#include <asm/types.h>
20#include "user.h"
21#include "sysdep/ptrace.h"
22#include "user_util.h"
23#include "kern_util.h"
24#include "skas.h"
25#include "stub-data.h"
26#include "mm_id.h"
27#include "sysdep/sigcontext.h"
28#include "sysdep/stub.h"
29#include "os.h"
30#include "proc_mm.h"
31#include "skas_ptrace.h"
32#include "chan_user.h"
33#include "registers.h"
34#include "mem.h"
35#include "uml-config.h"
36#include "process.h"
37#include "longjmp.h"
38
39int is_skas_winch(int pid, int fd, void *data)
40{
41 if(pid != os_getpgrp())
42 return(0);
43
44 register_winch_irq(-1, fd, -1, data);
45 return(1);
46}
47
48void wait_stub_done(int pid, int sig, char * fname)
49{
50 int n, status, err;
51
52 do {
53 if ( sig != -1 ) {
54 err = ptrace(PTRACE_CONT, pid, 0, sig);
55 if(err)
56 panic("%s : continue failed, errno = %d\n",
57 fname, errno);
58 }
59 sig = 0;
60
61 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
62 } while((n >= 0) && WIFSTOPPED(status) &&
63 ((WSTOPSIG(status) == SIGVTALRM) ||
64 /* running UML inside a detached screen can cause
65 * SIGWINCHes
66 */
67 (WSTOPSIG(status) == SIGWINCH)));
68
69 if((n < 0) || !WIFSTOPPED(status) ||
70 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
71 unsigned long regs[HOST_FRAME_SIZE];
72
73 if(ptrace(PTRACE_GETREGS, pid, 0, regs) < 0)
74 printk("Failed to get registers from stub, "
75 "errno = %d\n", errno);
76 else {
77 int i;
78
79 printk("Stub registers -\n");
80 for(i = 0; i < HOST_FRAME_SIZE; i++)
81 printk("\t%d - %lx\n", i, regs[i]);
82 }
83 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
84 "pid = %d, n = %d, errno = %d, status = 0x%x\n",
85 fname, pid, n, errno, status);
86 }
87}
88
89extern unsigned long current_stub_stack(void);
90
91void get_skas_faultinfo(int pid, struct faultinfo * fi)
92{
93 int err;
94
95 if(ptrace_faultinfo){
96 err = ptrace(PTRACE_FAULTINFO, pid, 0, fi);
97 if(err)
98 panic("get_skas_faultinfo - PTRACE_FAULTINFO failed, "
99 "errno = %d\n", errno);
100
101 /* Special handling for i386, which has different structs */
102 if (sizeof(struct ptrace_faultinfo) < sizeof(struct faultinfo))
103 memset((char *)fi + sizeof(struct ptrace_faultinfo), 0,
104 sizeof(struct faultinfo) -
105 sizeof(struct ptrace_faultinfo));
106 }
107 else {
108 wait_stub_done(pid, SIGSEGV, "get_skas_faultinfo");
109
110 /* faultinfo is prepared by the stub-segv-handler at start of
111 * the stub stack page. We just have to copy it.
112 */
113 memcpy(fi, (void *)current_stub_stack(), sizeof(*fi));
114 }
115}
116
117static void handle_segv(int pid, union uml_pt_regs * regs)
118{
119 get_skas_faultinfo(pid, &regs->skas.faultinfo);
120 segv(regs->skas.faultinfo, 0, 1, NULL);
121}
122
123/*To use the same value of using_sysemu as the caller, ask it that value (in local_using_sysemu)*/
124static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu)
125{
126 int err, status;
127
128 /* Mark this as a syscall */
129 UPT_SYSCALL_NR(regs) = PT_SYSCALL_NR(regs->skas.regs);
130
131 if (!local_using_sysemu)
132 {
133 err = ptrace(PTRACE_POKEUSR, pid, PT_SYSCALL_NR_OFFSET,
134 __NR_getpid);
135 if(err < 0)
136 panic("handle_trap - nullifying syscall failed errno = %d\n",
137 errno);
138
139 err = ptrace(PTRACE_SYSCALL, pid, 0, 0);
140 if(err < 0)
141 panic("handle_trap - continuing to end of syscall failed, "
142 "errno = %d\n", errno);
143
144 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
145 if((err < 0) || !WIFSTOPPED(status) ||
146 (WSTOPSIG(status) != SIGTRAP + 0x80))
147 panic("handle_trap - failed to wait at end of syscall, "
148 "errno = %d, status = %d\n", errno, status);
149 }
150
151 handle_syscall(regs);
152}
153
154extern int __syscall_stub_start;
155
156static int userspace_tramp(void *stack)
157{
158 void *addr;
159
160 ptrace(PTRACE_TRACEME, 0, 0, 0);
161
162 init_new_thread_signals(1);
163 enable_timer();
164
165 if(!proc_mm){
166 /* This has a pte, but it can't be mapped in with the usual
167 * tlb_flush mechanism because this is part of that mechanism
168 */
169 int fd;
170 __u64 offset;
171 fd = phys_mapping(to_phys(&__syscall_stub_start), &offset);
172 addr = mmap64((void *) UML_CONFIG_STUB_CODE, page_size(),
173 PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset);
174 if(addr == MAP_FAILED){
175 printk("mapping mmap stub failed, errno = %d\n",
176 errno);
177 exit(1);
178 }
179
180 if(stack != NULL){
181 fd = phys_mapping(to_phys(stack), &offset);
182 addr = mmap((void *) UML_CONFIG_STUB_DATA, page_size(),
183 PROT_READ | PROT_WRITE,
184 MAP_FIXED | MAP_SHARED, fd, offset);
185 if(addr == MAP_FAILED){
186 printk("mapping segfault stack failed, "
187 "errno = %d\n", errno);
188 exit(1);
189 }
190 }
191 }
192 if(!ptrace_faultinfo && (stack != NULL)){
193 unsigned long v = UML_CONFIG_STUB_CODE +
194 (unsigned long) stub_segv_handler -
195 (unsigned long) &__syscall_stub_start;
196
197 set_sigstack((void *) UML_CONFIG_STUB_DATA, page_size());
198 set_handler(SIGSEGV, (void *) v, SA_ONSTACK,
199 SIGIO, SIGWINCH, SIGALRM, SIGVTALRM,
200 SIGUSR1, -1);
201 }
202
203 os_stop_process(os_getpid());
204 return(0);
205}
206
207/* Each element set once, and only accessed by a single processor anyway */
208#undef NR_CPUS
209#define NR_CPUS 1
210int userspace_pid[NR_CPUS];
211
212int start_userspace(unsigned long stub_stack)
213{
214 void *stack;
215 unsigned long sp;
216 int pid, status, n, flags;
217
218 stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,
219 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
220 if(stack == MAP_FAILED)
221 panic("start_userspace : mmap failed, errno = %d", errno);
222 sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *);
223
224 flags = CLONE_FILES | SIGCHLD;
225 if(proc_mm) flags |= CLONE_VM;
226 pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);
227 if(pid < 0)
228 panic("start_userspace : clone failed, errno = %d", errno);
229
230 do {
231 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
232 if(n < 0)
233 panic("start_userspace : wait failed, errno = %d",
234 errno);
235 } while(WIFSTOPPED(status) && (WSTOPSIG(status) == SIGVTALRM));
236
237 if(!WIFSTOPPED(status) || (WSTOPSIG(status) != SIGSTOP))
238 panic("start_userspace : expected SIGSTOP, got status = %d",
239 status);
240
241 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL, (void *)PTRACE_O_TRACESYSGOOD) < 0)
242 panic("start_userspace : PTRACE_OLDSETOPTIONS failed, errno=%d\n",
243 errno);
244
245 if(munmap(stack, PAGE_SIZE) < 0)
246 panic("start_userspace : munmap failed, errno = %d\n", errno);
247
248 return(pid);
249}
250
251void userspace(union uml_pt_regs *regs)
252{
253 int err, status, op, pid = userspace_pid[0];
254 int local_using_sysemu; /*To prevent races if using_sysemu changes under us.*/
255
256 while(1){
257 restore_registers(pid, regs);
258
259 /* Now we set local_using_sysemu to be used for one loop */
260 local_using_sysemu = get_using_sysemu();
261
262 op = SELECT_PTRACE_OPERATION(local_using_sysemu, singlestepping(NULL));
263
264 err = ptrace(op, pid, 0, 0);
265 if(err)
266 panic("userspace - could not resume userspace process, "
267 "pid=%d, ptrace operation = %d, errno = %d\n",
268 op, errno);
269
270 CATCH_EINTR(err = waitpid(pid, &status, WUNTRACED));
271 if(err < 0)
272 panic("userspace - waitpid failed, errno = %d\n",
273 errno);
274
275 regs->skas.is_user = 1;
276 save_registers(pid, regs);
277 UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */
278
279 if(WIFSTOPPED(status)){
280 switch(WSTOPSIG(status)){
281 case SIGSEGV:
282 if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo)
283 user_signal(SIGSEGV, regs, pid);
284 else handle_segv(pid, regs);
285 break;
286 case SIGTRAP + 0x80:
287 handle_trap(pid, regs, local_using_sysemu);
288 break;
289 case SIGTRAP:
290 relay_signal(SIGTRAP, regs);
291 break;
292 case SIGIO:
293 case SIGVTALRM:
294 case SIGILL:
295 case SIGBUS:
296 case SIGFPE:
297 case SIGWINCH:
298 user_signal(WSTOPSIG(status), regs, pid);
299 break;
300 default:
301 printk("userspace - child stopped with signal "
302 "%d\n", WSTOPSIG(status));
303 }
304 pid = userspace_pid[0];
305 interrupt_end();
306
307 /* Avoid -ERESTARTSYS handling in host */
308 if(PT_SYSCALL_NR_OFFSET != PT_SYSCALL_RET_OFFSET)
309 PT_SYSCALL_NR(regs->skas.regs) = -1;
310 }
311 }
312}
313#define INIT_JMP_NEW_THREAD 0
314#define INIT_JMP_REMOVE_SIGSTACK 1
315#define INIT_JMP_CALLBACK 2
316#define INIT_JMP_HALT 3
317#define INIT_JMP_REBOOT 4
318
319int copy_context_skas0(unsigned long new_stack, int pid)
320{
321 int err;
322 unsigned long regs[MAX_REG_NR];
323 unsigned long current_stack = current_stub_stack();
324 struct stub_data *data = (struct stub_data *) current_stack;
325 struct stub_data *child_data = (struct stub_data *) new_stack;
326 __u64 new_offset;
327 int new_fd = phys_mapping(to_phys((void *)new_stack), &new_offset);
328
329 /* prepare offset and fd of child's stack as argument for parent's
330 * and child's mmap2 calls
331 */
332 *data = ((struct stub_data) { .offset = MMAP_OFFSET(new_offset),
333 .fd = new_fd,
334 .timer = ((struct itimerval)
335 { { 0, 1000000 / hz() },
336 { 0, 1000000 / hz() }})});
337 get_safe_registers(regs);
338
339 /* Set parent's instruction pointer to start of clone-stub */
340 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
341 (unsigned long) stub_clone_handler -
342 (unsigned long) &__syscall_stub_start;
343 regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + PAGE_SIZE -
344 sizeof(void *);
345#ifdef __SIGNAL_FRAMESIZE
346 regs[REGS_SP_INDEX] -= __SIGNAL_FRAMESIZE;
347#endif
348 err = ptrace_setregs(pid, regs);
349 if(err < 0)
350 panic("copy_context_skas0 : PTRACE_SETREGS failed, "
351 "pid = %d, errno = %d\n", pid, errno);
352
353 /* set a well known return code for detection of child write failure */
354 child_data->err = 12345678;
355
356 /* Wait, until parent has finished its work: read child's pid from
357 * parent's stack, and check, if bad result.
358 */
359 wait_stub_done(pid, 0, "copy_context_skas0");
360
361 pid = data->err;
362 if(pid < 0)
363 panic("copy_context_skas0 - stub-parent reports error %d\n",
364 pid);
365
366 /* Wait, until child has finished too: read child's result from
367 * child's stack and check it.
368 */
369 wait_stub_done(pid, -1, "copy_context_skas0");
370 if (child_data->err != UML_CONFIG_STUB_DATA)
371 panic("copy_context_skas0 - stub-child reports error %d\n",
372 child_data->err);
373
374 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL,
375 (void *)PTRACE_O_TRACESYSGOOD) < 0)
376 panic("copy_context_skas0 : PTRACE_OLDSETOPTIONS failed, "
377 "errno = %d\n", errno);
378
379 return pid;
380}
381
382/*
383 * This is used only, if stub pages are needed, while proc_mm is
384 * availabl. Opening /proc/mm creates a new mm_context, which lacks
385 * the stub-pages. Thus, we map them using /proc/mm-fd
386 */
387void map_stub_pages(int fd, unsigned long code,
388 unsigned long data, unsigned long stack)
389{
390 struct proc_mm_op mmop;
391 int n;
392 __u64 code_offset;
393 int code_fd = phys_mapping(to_phys((void *) &__syscall_stub_start),
394 &code_offset);
395
396 mmop = ((struct proc_mm_op) { .op = MM_MMAP,
397 .u =
398 { .mmap =
399 { .addr = code,
400 .len = PAGE_SIZE,
401 .prot = PROT_EXEC,
402 .flags = MAP_FIXED | MAP_PRIVATE,
403 .fd = code_fd,
404 .offset = code_offset
405 } } });
406 n = os_write_file(fd, &mmop, sizeof(mmop));
407 if(n != sizeof(mmop))
408 panic("map_stub_pages : /proc/mm map for code failed, "
409 "err = %d\n", -n);
410
411 if ( stack ) {
412 __u64 map_offset;
413 int map_fd = phys_mapping(to_phys((void *)stack), &map_offset);
414 mmop = ((struct proc_mm_op)
415 { .op = MM_MMAP,
416 .u =
417 { .mmap =
418 { .addr = data,
419 .len = PAGE_SIZE,
420 .prot = PROT_READ | PROT_WRITE,
421 .flags = MAP_FIXED | MAP_SHARED,
422 .fd = map_fd,
423 .offset = map_offset
424 } } });
425 n = os_write_file(fd, &mmop, sizeof(mmop));
426 if(n != sizeof(mmop))
427 panic("map_stub_pages : /proc/mm map for data failed, "
428 "err = %d\n", -n);
429 }
430}
431
432void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
433 void (*handler)(int))
434{
435 unsigned long flags;
436 sigjmp_buf switch_buf, fork_buf;
437 int enable;
438
439 *switch_buf_ptr = &switch_buf;
440 *fork_buf_ptr = &fork_buf;
441
442 /* Somewhat subtle - siglongjmp restores the signal mask before doing
443 * the longjmp. This means that when jumping from one stack to another
444 * when the target stack has interrupts enabled, an interrupt may occur
445 * on the source stack. This is bad when starting up a process because
446 * it's not supposed to get timer ticks until it has been scheduled.
447 * So, we disable interrupts around the sigsetjmp to ensure that
448 * they can't happen until we get back here where they are safe.
449 */
450 flags = get_signals();
451 block_signals();
452 if(UML_SIGSETJMP(&fork_buf, enable) == 0)
453 new_thread_proc(stack, handler);
454
455 remove_sigstack();
456
457 set_signals(flags);
458}
459
460void thread_wait(void *sw, void *fb)
461{
462 sigjmp_buf buf, **switch_buf = sw, *fork_buf;
463 int enable;
464
465 *switch_buf = &buf;
466 fork_buf = fb;
467 if(UML_SIGSETJMP(&buf, enable) == 0)
468 siglongjmp(*fork_buf, INIT_JMP_REMOVE_SIGSTACK);
469}
470
471void switch_threads(void *me, void *next)
472{
473 sigjmp_buf my_buf, **me_ptr = me, *next_buf = next;
474 int enable;
475
476 *me_ptr = &my_buf;
477 if(UML_SIGSETJMP(&my_buf, enable) == 0)
478 UML_SIGLONGJMP(next_buf, 1);
479}
480
481static sigjmp_buf initial_jmpbuf;
482
483/* XXX Make these percpu */
484static void (*cb_proc)(void *arg);
485static void *cb_arg;
486static sigjmp_buf *cb_back;
487
488int start_idle_thread(void *stack, void *switch_buf_ptr, void **fork_buf_ptr)
489{
490 sigjmp_buf **switch_buf = switch_buf_ptr;
491 int n, enable;
492
493 set_handler(SIGWINCH, (__sighandler_t) sig_handler,
494 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGALRM,
495 SIGVTALRM, -1);
496
497 *fork_buf_ptr = &initial_jmpbuf;
498 n = UML_SIGSETJMP(&initial_jmpbuf, enable);
499 switch(n){
500 case INIT_JMP_NEW_THREAD:
501 new_thread_proc((void *) stack, new_thread_handler);
502 break;
503 case INIT_JMP_REMOVE_SIGSTACK:
504 remove_sigstack();
505 break;
506 case INIT_JMP_CALLBACK:
507 (*cb_proc)(cb_arg);
508 UML_SIGLONGJMP(cb_back, 1);
509 break;
510 case INIT_JMP_HALT:
511 kmalloc_ok = 0;
512 return(0);
513 case INIT_JMP_REBOOT:
514 kmalloc_ok = 0;
515 return(1);
516 default:
517 panic("Bad sigsetjmp return in start_idle_thread - %d\n", n);
518 }
519 UML_SIGLONGJMP(*switch_buf, 1);
520}
521
522void initial_thread_cb_skas(void (*proc)(void *), void *arg)
523{
524 sigjmp_buf here;
525 int enable;
526
527 cb_proc = proc;
528 cb_arg = arg;
529 cb_back = &here;
530
531 block_signals();
532 if(UML_SIGSETJMP(&here, enable) == 0)
533 UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_CALLBACK);
534 unblock_signals();
535
536 cb_proc = NULL;
537 cb_arg = NULL;
538 cb_back = NULL;
539}
540
541void halt_skas(void)
542{
543 block_signals();
544 UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_HALT);
545}
546
547void reboot_skas(void)
548{
549 block_signals();
550 UML_SIGLONGJMP(&initial_jmpbuf, INIT_JMP_REBOOT);
551}
552
553void switch_mm_skas(struct mm_id *mm_idp)
554{
555 int err;
556
557#warning need cpu pid in switch_mm_skas
558 if(proc_mm){
559 err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0,
560 mm_idp->u.mm_fd);
561 if(err)
562 panic("switch_mm_skas - PTRACE_SWITCH_MM failed, "
563 "errno = %d\n", errno);
564 }
565 else userspace_pid[0] = mm_idp->u.pid;
566}
diff --git a/arch/um/kernel/skas/trap_user.c b/arch/um/os-Linux/skas/trap.c
index 9950a6716fe5..9ad5fbec4593 100644
--- a/arch/um/kernel/skas/trap_user.c
+++ b/arch/um/os-Linux/skas/trap.c
@@ -1,11 +1,10 @@
1/* 1/*
2 * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2002 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <signal.h> 6#include <signal.h>
7#include <errno.h> 7#include <errno.h>
8#include "signal_user.h"
9#include "user_util.h" 8#include "user_util.h"
10#include "kern_util.h" 9#include "kern_util.h"
11#include "task.h" 10#include "task.h"
@@ -14,12 +13,13 @@
14#include "ptrace_user.h" 13#include "ptrace_user.h"
15#include "sysdep/ptrace.h" 14#include "sysdep/ptrace.h"
16#include "sysdep/ptrace_user.h" 15#include "sysdep/ptrace_user.h"
16#include "os.h"
17 17
18void sig_handler_common_skas(int sig, void *sc_ptr) 18void sig_handler_common_skas(int sig, void *sc_ptr)
19{ 19{
20 struct sigcontext *sc = sc_ptr; 20 struct sigcontext *sc = sc_ptr;
21 struct skas_regs *r; 21 struct skas_regs *r;
22 struct signal_info *info; 22 void (*handler)(int, union uml_pt_regs *);
23 int save_errno = errno; 23 int save_errno = errno;
24 int save_user; 24 int save_user;
25 25
@@ -34,17 +34,22 @@ void sig_handler_common_skas(int sig, void *sc_ptr)
34 r = &TASK_REGS(get_current())->skas; 34 r = &TASK_REGS(get_current())->skas;
35 save_user = r->is_user; 35 save_user = r->is_user;
36 r->is_user = 0; 36 r->is_user = 0;
37 if ( sig == SIGFPE || sig == SIGSEGV || 37 if ( sig == SIGFPE || sig == SIGSEGV ||
38 sig == SIGBUS || sig == SIGILL || 38 sig == SIGBUS || sig == SIGILL ||
39 sig == SIGTRAP ) { 39 sig == SIGTRAP ) {
40 GET_FAULTINFO_FROM_SC(r->faultinfo, sc); 40 GET_FAULTINFO_FROM_SC(r->faultinfo, sc);
41 } 41 }
42 42
43 change_sig(SIGUSR1, 1); 43 change_sig(SIGUSR1, 1);
44 info = &sig_info[sig];
45 if(!info->is_irq) unblock_signals();
46 44
47 (*info->handler)(sig, (union uml_pt_regs *) r); 45 handler = sig_info[sig];
46
47 /* unblock SIGALRM, SIGVTALRM, SIGIO if sig isn't IRQ signal */
48 if (sig != SIGIO && sig != SIGWINCH &&
49 sig != SIGVTALRM && sig != SIGALRM)
50 unblock_signals();
51
52 handler(sig, (union uml_pt_regs *) r);
48 53
49 errno = save_errno; 54 errno = save_errno;
50 r->is_user = save_user; 55 r->is_user = save_user;
@@ -54,25 +59,15 @@ extern int ptrace_faultinfo;
54 59
55void user_signal(int sig, union uml_pt_regs *regs, int pid) 60void user_signal(int sig, union uml_pt_regs *regs, int pid)
56{ 61{
57 struct signal_info *info; 62 void (*handler)(int, union uml_pt_regs *);
58 int segv = ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) || 63 int segv = ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) ||
59 (sig == SIGILL) || (sig == SIGTRAP)); 64 (sig == SIGILL) || (sig == SIGTRAP));
60 65
61 if (segv) 66 if (segv)
62 get_skas_faultinfo(pid, &regs->skas.faultinfo); 67 get_skas_faultinfo(pid, &regs->skas.faultinfo);
63 info = &sig_info[sig]; 68
64 (*info->handler)(sig, regs); 69 handler = sig_info[sig];
70 handler(sig, (union uml_pt_regs *) regs);
65 71
66 unblock_signals(); 72 unblock_signals();
67} 73}
68
69/*
70 * Overrides for Emacs so that we follow Linus's tabbing style.
71 * Emacs will notice this stuff at the end of the file and automatically
72 * adjust the settings for this buffer only. This must remain at the end
73 * of the file.
74 * ---------------------------------------------------------------------------
75 * Local variables:
76 * c-file-style: "linux"
77 * End:
78 */
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 37517d49c4ae..6c5b17ed59e1 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -24,13 +24,11 @@
24#include "kern_util.h" 24#include "kern_util.h"
25#include "user.h" 25#include "user.h"
26#include "signal_kern.h" 26#include "signal_kern.h"
27#include "signal_user.h"
28#include "sysdep/ptrace.h" 27#include "sysdep/ptrace.h"
29#include "sysdep/sigcontext.h" 28#include "sysdep/sigcontext.h"
30#include "irq_user.h" 29#include "irq_user.h"
31#include "ptrace_user.h" 30#include "ptrace_user.h"
32#include "mem_user.h" 31#include "mem_user.h"
33#include "time_user.h"
34#include "init.h" 32#include "init.h"
35#include "os.h" 33#include "os.h"
36#include "uml-config.h" 34#include "uml-config.h"
@@ -116,16 +114,16 @@ static int stop_ptraced_child(int pid, void *stack, int exitcode,
116 if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { 114 if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) {
117 int exit_with = WEXITSTATUS(status); 115 int exit_with = WEXITSTATUS(status);
118 if (exit_with == 2) 116 if (exit_with == 2)
119 printk("check_ptrace : child exited with status 2. " 117 printf("check_ptrace : child exited with status 2. "
120 "Serious trouble happening! Try updating your " 118 "Serious trouble happening! Try updating your "
121 "host skas patch!\nDisabling SYSEMU support."); 119 "host skas patch!\nDisabling SYSEMU support.");
122 printk("check_ptrace : child exited with exitcode %d, while " 120 printf("check_ptrace : child exited with exitcode %d, while "
123 "expecting %d; status 0x%x", exit_with, 121 "expecting %d; status 0x%x", exit_with,
124 exitcode, status); 122 exitcode, status);
125 if (mustpanic) 123 if (mustpanic)
126 panic("\n"); 124 panic("\n");
127 else 125 else
128 printk("\n"); 126 printf("\n");
129 ret = -1; 127 ret = -1;
130 } 128 }
131 129
@@ -183,7 +181,7 @@ static void __init check_sysemu(void)
183 void *stack; 181 void *stack;
184 int pid, n, status, count=0; 182 int pid, n, status, count=0;
185 183
186 printk("Checking syscall emulation patch for ptrace..."); 184 printf("Checking syscall emulation patch for ptrace...");
187 sysemu_supported = 0; 185 sysemu_supported = 0;
188 pid = start_ptraced_child(&stack); 186 pid = start_ptraced_child(&stack);
189 187
@@ -207,10 +205,10 @@ static void __init check_sysemu(void)
207 goto fail_stopped; 205 goto fail_stopped;
208 206
209 sysemu_supported = 1; 207 sysemu_supported = 1;
210 printk("OK\n"); 208 printf("OK\n");
211 set_using_sysemu(!force_sysemu_disabled); 209 set_using_sysemu(!force_sysemu_disabled);
212 210
213 printk("Checking advanced syscall emulation patch for ptrace..."); 211 printf("Checking advanced syscall emulation patch for ptrace...");
214 pid = start_ptraced_child(&stack); 212 pid = start_ptraced_child(&stack);
215 213
216 if(ptrace(PTRACE_OLDSETOPTIONS, pid, 0, 214 if(ptrace(PTRACE_OLDSETOPTIONS, pid, 0,
@@ -246,7 +244,7 @@ static void __init check_sysemu(void)
246 goto fail_stopped; 244 goto fail_stopped;
247 245
248 sysemu_supported = 2; 246 sysemu_supported = 2;
249 printk("OK\n"); 247 printf("OK\n");
250 248
251 if ( !force_sysemu_disabled ) 249 if ( !force_sysemu_disabled )
252 set_using_sysemu(sysemu_supported); 250 set_using_sysemu(sysemu_supported);
@@ -255,7 +253,7 @@ static void __init check_sysemu(void)
255fail: 253fail:
256 stop_ptraced_child(pid, stack, 1, 0); 254 stop_ptraced_child(pid, stack, 1, 0);
257fail_stopped: 255fail_stopped:
258 printk("missing\n"); 256 printf("missing\n");
259} 257}
260 258
261static void __init check_ptrace(void) 259static void __init check_ptrace(void)
@@ -263,7 +261,7 @@ static void __init check_ptrace(void)
263 void *stack; 261 void *stack;
264 int pid, syscall, n, status; 262 int pid, syscall, n, status;
265 263
266 printk("Checking that ptrace can change system call numbers..."); 264 printf("Checking that ptrace can change system call numbers...");
267 pid = start_ptraced_child(&stack); 265 pid = start_ptraced_child(&stack);
268 266
269 if(ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0) 267 if(ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0)
@@ -292,7 +290,7 @@ static void __init check_ptrace(void)
292 } 290 }
293 } 291 }
294 stop_ptraced_child(pid, stack, 0, 1); 292 stop_ptraced_child(pid, stack, 0, 1);
295 printk("OK\n"); 293 printf("OK\n");
296 check_sysemu(); 294 check_sysemu();
297} 295}
298 296
@@ -472,6 +470,8 @@ int can_do_skas(void)
472 470
473int have_devanon = 0; 471int have_devanon = 0;
474 472
473/* Runs on boot kernel stack - already safe to use printk. */
474
475void check_devanon(void) 475void check_devanon(void)
476{ 476{
477 int fd; 477 int fd;
diff --git a/arch/um/os-Linux/time.c b/arch/um/os-Linux/time.c
index cf30a39bc484..6f7626775acb 100644
--- a/arch/um/os-Linux/time.c
+++ b/arch/um/os-Linux/time.c
@@ -1,21 +1,128 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdio.h>
1#include <stdlib.h> 7#include <stdlib.h>
8#include <unistd.h>
9#include <time.h>
2#include <sys/time.h> 10#include <sys/time.h>
11#include <signal.h>
12#include <errno.h>
13#include "user_util.h"
14#include "kern_util.h"
15#include "user.h"
16#include "process.h"
17#include "kern_constants.h"
18#include "os.h"
19
20/* XXX This really needs to be declared and initialized in a kernel file since
21 * it's in <linux/time.h>
22 */
23extern struct timespec wall_to_monotonic;
24
25static void set_interval(int timer_type)
26{
27 int usec = 1000000/hz();
28 struct itimerval interval = ((struct itimerval) { { 0, usec },
29 { 0, usec } });
30
31 if(setitimer(timer_type, &interval, NULL) == -1)
32 panic("setitimer failed - errno = %d\n", errno);
33}
34
35void enable_timer(void)
36{
37 set_interval(ITIMER_VIRTUAL);
38}
39
40void disable_timer(void)
41{
42 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }});
43 if((setitimer(ITIMER_VIRTUAL, &disable, NULL) < 0) ||
44 (setitimer(ITIMER_REAL, &disable, NULL) < 0))
45 printk("disnable_timer - setitimer failed, errno = %d\n",
46 errno);
47 /* If there are signals already queued, after unblocking ignore them */
48 set_handler(SIGALRM, SIG_IGN, 0, -1);
49 set_handler(SIGVTALRM, SIG_IGN, 0, -1);
50}
51
52void switch_timers(int to_real)
53{
54 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }});
55 struct itimerval enable = ((struct itimerval) { { 0, 1000000/hz() },
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}
3 73
4unsigned long long os_usecs(void) 74void uml_idle_timer(void)
75{
76 if(signal(SIGVTALRM, SIG_IGN) == SIG_ERR)
77 panic("Couldn't unset SIGVTALRM handler");
78
79 set_handler(SIGALRM, (__sighandler_t) alarm_handler,
80 SA_RESTART, SIGUSR1, SIGIO, SIGWINCH, SIGVTALRM, -1);
81 set_interval(ITIMER_REAL);
82}
83
84extern void ktime_get_ts(struct timespec *ts);
85#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
86
87void time_init(void)
88{
89 struct timespec now;
90
91 if(signal(SIGVTALRM, boot_timer_handler) == SIG_ERR)
92 panic("Couldn't set SIGVTALRM handler");
93 set_interval(ITIMER_VIRTUAL);
94
95 do_posix_clock_monotonic_gettime(&now);
96 wall_to_monotonic.tv_sec = -now.tv_sec;
97 wall_to_monotonic.tv_nsec = -now.tv_nsec;
98}
99
100unsigned long long os_nsecs(void)
5{ 101{
6 struct timeval tv; 102 struct timeval tv;
7 103
8 gettimeofday(&tv, NULL); 104 gettimeofday(&tv, NULL);
9 return((unsigned long long) tv.tv_sec * 1000000 + tv.tv_usec); 105 return((unsigned long long) tv.tv_sec * BILLION + tv.tv_usec * 1000);
10} 106}
11 107
12/* 108void idle_sleep(int secs)
13 * Overrides for Emacs so that we follow Linus's tabbing style. 109{
14 * Emacs will notice this stuff at the end of the file and automatically 110 struct timespec ts;
15 * adjust the settings for this buffer only. This must remain at the end 111
16 * of the file. 112 ts.tv_sec = secs;
17 * --------------------------------------------------------------------------- 113 ts.tv_nsec = 0;
18 * Local variables: 114 nanosleep(&ts, NULL);
19 * c-file-style: "linux" 115}
20 * End: 116
21 */ 117/* XXX This partly duplicates init_irq_signals */
118
119void user_time_init(void)
120{
121 set_handler(SIGVTALRM, (__sighandler_t) alarm_handler,
122 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH,
123 SIGALRM, SIGUSR2, -1);
124 set_handler(SIGALRM, (__sighandler_t) alarm_handler,
125 SA_ONSTACK | SA_RESTART, SIGUSR1, SIGIO, SIGWINCH,
126 SIGVTALRM, SIGUSR2, -1);
127 set_interval(ITIMER_VIRTUAL);
128}
diff --git a/arch/um/os-Linux/trap.c b/arch/um/os-Linux/trap.c
new file mode 100644
index 000000000000..a9f6b26f9828
--- /dev/null
+++ b/arch/um/os-Linux/trap.c
@@ -0,0 +1,41 @@
1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdlib.h>
7#include <signal.h>
8#include <setjmp.h>
9#include "kern_util.h"
10#include "user_util.h"
11#include "os.h"
12#include "mode.h"
13#include "longjmp.h"
14
15void usr2_handler(int sig, union uml_pt_regs *regs)
16{
17 CHOOSE_MODE(syscall_handler_tt(sig, regs), (void) 0);
18}
19
20void (*sig_info[NSIG])(int, union uml_pt_regs *);
21
22void os_fill_handlinfo(struct kern_handlers h)
23{
24 sig_info[SIGTRAP] = h.relay_signal;
25 sig_info[SIGFPE] = h.relay_signal;
26 sig_info[SIGILL] = h.relay_signal;
27 sig_info[SIGWINCH] = h.winch;
28 sig_info[SIGBUS] = h.bus_handler;
29 sig_info[SIGSEGV] = h.page_fault;
30 sig_info[SIGIO] = h.sigio_handler;
31 sig_info[SIGVTALRM] = h.timer_handler;
32 sig_info[SIGALRM] = h.timer_handler;
33 sig_info[SIGUSR2] = usr2_handler;
34}
35
36void do_longjmp(void *b, int val)
37{
38 sigjmp_buf *buf = b;
39
40 UML_SIGLONGJMP(buf, val);
41}
diff --git a/arch/um/os-Linux/tt.c b/arch/um/os-Linux/tt.c
index a6db8877931a..919d19f11537 100644
--- a/arch/um/os-Linux/tt.c
+++ b/arch/um/os-Linux/tt.c
@@ -23,12 +23,10 @@
23#include "kern_util.h" 23#include "kern_util.h"
24#include "user.h" 24#include "user.h"
25#include "signal_kern.h" 25#include "signal_kern.h"
26#include "signal_user.h"
27#include "sysdep/ptrace.h" 26#include "sysdep/ptrace.h"
28#include "sysdep/sigcontext.h" 27#include "sysdep/sigcontext.h"
29#include "irq_user.h" 28#include "irq_user.h"
30#include "ptrace_user.h" 29#include "ptrace_user.h"
31#include "time_user.h"
32#include "init.h" 30#include "init.h"
33#include "os.h" 31#include "os.h"
34#include "uml-config.h" 32#include "uml-config.h"
@@ -50,6 +48,68 @@ int protect_memory(unsigned long addr, unsigned long len, int r, int w, int x,
50 return(0); 48 return(0);
51} 49}
52 50
51void kill_child_dead(int pid)
52{
53 kill(pid, SIGKILL);
54 kill(pid, SIGCONT);
55 do {
56 int n;
57 CATCH_EINTR(n = waitpid(pid, NULL, 0));
58 if (n > 0)
59 kill(pid, SIGCONT);
60 else
61 break;
62 } while(1);
63}
64
65void stop(void)
66{
67 while(1) sleep(1000000);
68}
69
70int wait_for_stop(int pid, int sig, int cont_type, void *relay)
71{
72 sigset_t *relay_signals = relay;
73 int status, ret;
74
75 while(1){
76 CATCH_EINTR(ret = waitpid(pid, &status, WUNTRACED));
77 if((ret < 0) ||
78 !WIFSTOPPED(status) || (WSTOPSIG(status) != sig)){
79 if(ret < 0){
80 printk("wait failed, errno = %d\n",
81 errno);
82 }
83 else if(WIFEXITED(status))
84 printk("process %d exited with status %d\n",
85 pid, WEXITSTATUS(status));
86 else if(WIFSIGNALED(status))
87 printk("process %d exited with signal %d\n",
88 pid, WTERMSIG(status));
89 else if((WSTOPSIG(status) == SIGVTALRM) ||
90 (WSTOPSIG(status) == SIGALRM) ||
91 (WSTOPSIG(status) == SIGIO) ||
92 (WSTOPSIG(status) == SIGPROF) ||
93 (WSTOPSIG(status) == SIGCHLD) ||
94 (WSTOPSIG(status) == SIGWINCH) ||
95 (WSTOPSIG(status) == SIGINT)){
96 ptrace(cont_type, pid, 0, WSTOPSIG(status));
97 continue;
98 }
99 else if((relay_signals != NULL) &&
100 sigismember(relay_signals, WSTOPSIG(status))){
101 ptrace(cont_type, pid, 0, WSTOPSIG(status));
102 continue;
103 }
104 else printk("process %d stopped with signal %d\n",
105 pid, WSTOPSIG(status));
106 panic("wait_for_stop failed to wait for %d to stop "
107 "with %d\n", pid, sig);
108 }
109 return(status);
110 }
111}
112
53/* 113/*
54 *------------------------- 114 *-------------------------
55 * only for tt mode (will be deleted in future...) 115 * only for tt mode (will be deleted in future...)
diff --git a/arch/um/os-Linux/uaccess.c b/arch/um/os-Linux/uaccess.c
index 38d710158c3d..166fb66995df 100644
--- a/arch/um/os-Linux/uaccess.c
+++ b/arch/um/os-Linux/uaccess.c
@@ -6,6 +6,7 @@
6 6
7#include <setjmp.h> 7#include <setjmp.h>
8#include <string.h> 8#include <string.h>
9#include "longjmp.h"
9 10
10unsigned long __do_user_copy(void *to, const void *from, int n, 11unsigned long __do_user_copy(void *to, const void *from, int n,
11 void **fault_addr, void **fault_catcher, 12 void **fault_addr, void **fault_catcher,
@@ -13,10 +14,11 @@ unsigned long __do_user_copy(void *to, const void *from, int n,
13 int n), int *faulted_out) 14 int n), int *faulted_out)
14{ 15{
15 unsigned long *faddrp = (unsigned long *) fault_addr, ret; 16 unsigned long *faddrp = (unsigned long *) fault_addr, ret;
17 int enable;
16 18
17 sigjmp_buf jbuf; 19 sigjmp_buf jbuf;
18 *fault_catcher = &jbuf; 20 *fault_catcher = &jbuf;
19 if(sigsetjmp(jbuf, 1) == 0){ 21 if(UML_SIGSETJMP(&jbuf, enable) == 0){
20 (*op)(to, from, n); 22 (*op)(to, from, n);
21 ret = 0; 23 ret = 0;
22 *faulted_out = 0; 24 *faulted_out = 0;
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
new file mode 100644
index 000000000000..ecf107ae5ac8
--- /dev/null
+++ b/arch/um/os-Linux/umid.c
@@ -0,0 +1,335 @@
1#include <stdio.h>
2#include <unistd.h>
3#include <stdlib.h>
4#include <string.h>
5#include <errno.h>
6#include <signal.h>
7#include <dirent.h>
8#include <sys/fcntl.h>
9#include <sys/stat.h>
10#include <sys/param.h>
11#include "init.h"
12#include "os.h"
13#include "user.h"
14#include "mode.h"
15
16#define UML_DIR "~/.uml/"
17
18#define UMID_LEN 64
19
20/* Changed by set_umid, which is run early in boot */
21char umid[UMID_LEN] = { 0 };
22
23/* Changed by set_uml_dir and make_uml_dir, which are run early in boot */
24static char *uml_dir = UML_DIR;
25
26static int __init make_uml_dir(void)
27{
28 char dir[512] = { '\0' };
29 int len, err;
30
31 if(*uml_dir == '~'){
32 char *home = getenv("HOME");
33
34 err = -ENOENT;
35 if(home == NULL){
36 printk("make_uml_dir : no value in environment for "
37 "$HOME\n");
38 goto err;
39 }
40 strlcpy(dir, home, sizeof(dir));
41 uml_dir++;
42 }
43 strlcat(dir, uml_dir, sizeof(dir));
44 len = strlen(dir);
45 if (len > 0 && dir[len - 1] != '/')
46 strlcat(dir, "/", sizeof(dir));
47
48 err = -ENOMEM;
49 uml_dir = malloc(strlen(dir) + 1);
50 if (uml_dir == NULL) {
51 printf("make_uml_dir : malloc failed, errno = %d\n", errno);
52 goto err;
53 }
54 strcpy(uml_dir, dir);
55
56 if((mkdir(uml_dir, 0777) < 0) && (errno != EEXIST)){
57 printf("Failed to mkdir '%s': %s\n", uml_dir, strerror(errno));
58 err = -errno;
59 goto err_free;
60 }
61 return 0;
62
63err_free:
64 free(uml_dir);
65err:
66 uml_dir = NULL;
67 return err;
68}
69
70static int actually_do_remove(char *dir)
71{
72 DIR *directory;
73 struct dirent *ent;
74 int len;
75 char file[256];
76
77 directory = opendir(dir);
78 if(directory == NULL)
79 return -errno;
80
81 while((ent = readdir(directory)) != NULL){
82 if(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, ".."))
83 continue;
84 len = strlen(dir) + sizeof("/") + strlen(ent->d_name) + 1;
85 if(len > sizeof(file))
86 return -E2BIG;
87
88 sprintf(file, "%s/%s", dir, ent->d_name);
89 if(unlink(file) < 0)
90 return -errno;
91 }
92 if(rmdir(dir) < 0)
93 return -errno;
94
95 return 0;
96}
97
98/* This says that there isn't already a user of the specified directory even if
99 * there are errors during the checking. This is because if these errors
100 * happen, the directory is unusable by the pre-existing UML, so we might as
101 * well take it over. This could happen either by
102 * the existing UML somehow corrupting its umid directory
103 * something other than UML sticking stuff in the directory
104 * this boot racing with a shutdown of the other UML
105 * In any of these cases, the directory isn't useful for anything else.
106 */
107
108static int not_dead_yet(char *dir)
109{
110 char file[strlen(uml_dir) + UMID_LEN + sizeof("/pid\0")];
111 char pid[sizeof("nnnnn\0")], *end;
112 int dead, fd, p, n, err;
113
114 n = snprintf(file, sizeof(file), "%s/pid", dir);
115 if(n >= sizeof(file)){
116 printk("not_dead_yet - pid filename too long\n");
117 err = -E2BIG;
118 goto out;
119 }
120
121 dead = 0;
122 fd = open(file, O_RDONLY);
123 if(fd < 0){
124 if(fd != -ENOENT){
125 printk("not_dead_yet : couldn't open pid file '%s', "
126 "err = %d\n", file, -fd);
127 }
128 goto out;
129 }
130
131 err = 0;
132 n = read(fd, pid, sizeof(pid));
133 if(n <= 0){
134 printk("not_dead_yet : couldn't read pid file '%s', "
135 "err = %d\n", file, -n);
136 goto out_close;
137 }
138
139 p = strtoul(pid, &end, 0);
140 if(end == pid){
141 printk("not_dead_yet : couldn't parse pid file '%s', "
142 "errno = %d\n", file, errno);
143 goto out_close;
144 }
145
146 if((kill(p, 0) == 0) || (errno != ESRCH))
147 return 1;
148
149 err = actually_do_remove(dir);
150 if(err)
151 printk("not_dead_yet - actually_do_remove failed with "
152 "err = %d\n", err);
153
154 return err;
155
156 out_close:
157 close(fd);
158 out:
159 return 0;
160}
161
162static void __init create_pid_file(void)
163{
164 char file[strlen(uml_dir) + UMID_LEN + sizeof("/pid\0")];
165 char pid[sizeof("nnnnn\0")];
166 int fd, n;
167
168 if(umid_file_name("pid", file, sizeof(file)))
169 return;
170
171 fd = open(file, O_RDWR | O_CREAT | O_EXCL, 0644);
172 if(fd < 0){
173 printk("Open of machine pid file \"%s\" failed: %s\n",
174 file, strerror(-fd));
175 return;
176 }
177
178 snprintf(pid, sizeof(pid), "%d\n", getpid());
179 n = write(fd, pid, strlen(pid));
180 if(n != strlen(pid))
181 printk("Write of pid file failed - err = %d\n", -n);
182
183 close(fd);
184}
185
186int __init set_umid(char *name)
187{
188 if(strlen(name) > UMID_LEN - 1)
189 return -E2BIG;
190
191 strlcpy(umid, name, sizeof(umid));
192
193 return 0;
194}
195
196static int umid_setup = 0;
197
198int __init make_umid(void)
199{
200 int fd, err;
201 char tmp[256];
202
203 if(umid_setup)
204 return 0;
205
206 make_uml_dir();
207
208 if(*umid == '\0'){
209 strlcpy(tmp, uml_dir, sizeof(tmp));
210 strlcat(tmp, "XXXXXX", sizeof(tmp));
211 fd = mkstemp(tmp);
212 if(fd < 0){
213 printk("make_umid - mkstemp(%s) failed: %s\n",
214 tmp, strerror(errno));
215 err = -errno;
216 goto err;
217 }
218
219 close(fd);
220
221 set_umid(&tmp[strlen(uml_dir)]);
222
223 /* There's a nice tiny little race between this unlink and
224 * the mkdir below. It'd be nice if there were a mkstemp
225 * for directories.
226 */
227 if(unlink(tmp)){
228 err = -errno;
229 goto err;
230 }
231 }
232
233 snprintf(tmp, sizeof(tmp), "%s%s", uml_dir, umid);
234 err = mkdir(tmp, 0777);
235 if(err < 0){
236 err = -errno;
237 if(errno != EEXIST)
238 goto err;
239
240 if(not_dead_yet(tmp) < 0)
241 goto err;
242
243 err = mkdir(tmp, 0777);
244 }
245 if(err < 0){
246 printk("Failed to create '%s' - err = %d\n", umid, err);
247 goto err_rmdir;
248 }
249
250 umid_setup = 1;
251
252 create_pid_file();
253
254 return 0;
255
256 err_rmdir:
257 rmdir(tmp);
258 err:
259 return err;
260}
261
262static int __init make_umid_init(void)
263{
264 make_umid();
265
266 return 0;
267}
268
269__initcall(make_umid_init);
270
271int __init umid_file_name(char *name, char *buf, int len)
272{
273 int n, err;
274
275 err = make_umid();
276 if(err)
277 return err;
278
279 n = snprintf(buf, len, "%s%s/%s", uml_dir, umid, name);
280 if(n >= len){
281 printk("umid_file_name : buffer too short\n");
282 return -E2BIG;
283 }
284
285 return 0;
286}
287
288char *get_umid(void)
289{
290 return umid;
291}
292
293static int __init set_uml_dir(char *name, int *add)
294{
295 if(*name == '\0'){
296 printf("uml_dir can't be an empty string\n");
297 return 0;
298 }
299
300 if(name[strlen(name) - 1] == '/'){
301 uml_dir = name;
302 return 0;
303 }
304
305 uml_dir = malloc(strlen(name) + 2);
306 if(uml_dir == NULL){
307 printf("Failed to malloc uml_dir - error = %d\n", errno);
308
309 /* Return 0 here because do_initcalls doesn't look at
310 * the return value.
311 */
312 return 0;
313 }
314 sprintf(uml_dir, "%s/", name);
315
316 return 0;
317}
318
319__uml_setup("uml_dir=", set_uml_dir,
320"uml_dir=<directory>\n"
321" The location to place the pid and umid files.\n\n"
322);
323
324static void remove_umid_dir(void)
325{
326 char dir[strlen(uml_dir) + UMID_LEN + 1], err;
327
328 sprintf(dir, "%s%s", uml_dir, umid);
329 err = actually_do_remove(dir);
330 if(err)
331 printf("remove_umid_dir - actually_do_remove failed with "
332 "err = %d\n", err);
333}
334
335__uml_exitcall(remove_umid_dir);
diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c
index 56d3f870926b..8da6ab31152a 100644
--- a/arch/um/os-Linux/user_syms.c
+++ b/arch/um/os-Linux/user_syms.c
@@ -34,6 +34,11 @@ EXPORT_SYMBOL(strstr);
34 int sym(void); \ 34 int sym(void); \
35 EXPORT_SYMBOL(sym); 35 EXPORT_SYMBOL(sym);
36 36
37extern void readdir64(void) __attribute__((weak));
38EXPORT_SYMBOL(readdir64);
39extern void truncate64(void) __attribute__((weak));
40EXPORT_SYMBOL(truncate64);
41
37#ifdef SUBARCH_i386 42#ifdef SUBARCH_i386
38EXPORT_SYMBOL(vsyscall_ehdr); 43EXPORT_SYMBOL(vsyscall_ehdr);
39EXPORT_SYMBOL(vsyscall_end); 44EXPORT_SYMBOL(vsyscall_end);
diff --git a/arch/um/kernel/user_util.c b/arch/um/os-Linux/util.c
index 4c231161f257..e32065e2fdc8 100644
--- a/arch/um/kernel/user_util.c
+++ b/arch/um/os-Linux/util.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -29,17 +29,14 @@
29#include "init.h" 29#include "init.h"
30#include "ptrace_user.h" 30#include "ptrace_user.h"
31#include "uml-config.h" 31#include "uml-config.h"
32 32#include "os.h"
33void stop(void) 33#include "longjmp.h"
34{
35 while(1) sleep(1000000);
36}
37 34
38void stack_protections(unsigned long address) 35void stack_protections(unsigned long address)
39{ 36{
40 int prot = PROT_READ | PROT_WRITE | PROT_EXEC; 37 int prot = PROT_READ | PROT_WRITE | PROT_EXEC;
41 38
42 if(mprotect((void *) address, page_size(), prot) < 0) 39 if(mprotect((void *) address, page_size(), prot) < 0)
43 panic("protecting stack failed, errno = %d", errno); 40 panic("protecting stack failed, errno = %d", errno);
44} 41}
45 42
@@ -59,49 +56,6 @@ void task_protections(unsigned long address)
59 panic("protecting stack failed, errno = %d", errno); 56 panic("protecting stack failed, errno = %d", errno);
60} 57}
61 58
62int wait_for_stop(int pid, int sig, int cont_type, void *relay)
63{
64 sigset_t *relay_signals = relay;
65 int status, ret;
66
67 while(1){
68 CATCH_EINTR(ret = waitpid(pid, &status, WUNTRACED));
69 if((ret < 0) ||
70 !WIFSTOPPED(status) || (WSTOPSIG(status) != sig)){
71 if(ret < 0){
72 printk("wait failed, errno = %d\n",
73 errno);
74 }
75 else if(WIFEXITED(status))
76 printk("process %d exited with status %d\n",
77 pid, WEXITSTATUS(status));
78 else if(WIFSIGNALED(status))
79 printk("process %d exited with signal %d\n",
80 pid, WTERMSIG(status));
81 else if((WSTOPSIG(status) == SIGVTALRM) ||
82 (WSTOPSIG(status) == SIGALRM) ||
83 (WSTOPSIG(status) == SIGIO) ||
84 (WSTOPSIG(status) == SIGPROF) ||
85 (WSTOPSIG(status) == SIGCHLD) ||
86 (WSTOPSIG(status) == SIGWINCH) ||
87 (WSTOPSIG(status) == SIGINT)){
88 ptrace(cont_type, pid, 0, WSTOPSIG(status));
89 continue;
90 }
91 else if((relay_signals != NULL) &&
92 sigismember(relay_signals, WSTOPSIG(status))){
93 ptrace(cont_type, pid, 0, WSTOPSIG(status));
94 continue;
95 }
96 else printk("process %d stopped with signal %d\n",
97 pid, WSTOPSIG(status));
98 panic("wait_for_stop failed to wait for %d to stop "
99 "with %d\n", pid, sig);
100 }
101 return(status);
102 }
103}
104
105int raw(int fd) 59int raw(int fd)
106{ 60{
107 struct termios tt; 61 struct termios tt;
@@ -113,7 +67,7 @@ int raw(int fd)
113 67
114 cfmakeraw(&tt); 68 cfmakeraw(&tt);
115 69
116 CATCH_EINTR(err = tcsetattr(fd, TCSADRAIN, &tt)); 70 CATCH_EINTR(err = tcsetattr(fd, TCSADRAIN, &tt));
117 if(err < 0) 71 if(err < 0)
118 return -errno; 72 return -errno;
119 73
@@ -149,7 +103,7 @@ void setup_hostinfo(void)
149 103
150int setjmp_wrapper(void (*proc)(void *, void *), ...) 104int setjmp_wrapper(void (*proc)(void *, void *), ...)
151{ 105{
152 va_list args; 106 va_list args;
153 sigjmp_buf buf; 107 sigjmp_buf buf;
154 int n; 108 int n;
155 109
@@ -161,14 +115,3 @@ int setjmp_wrapper(void (*proc)(void *, void *), ...)
161 va_end(args); 115 va_end(args);
162 return(n); 116 return(n);
163} 117}
164
165/*
166 * Overrides for Emacs so that we follow Linus's tabbing style.
167 * Emacs will notice this stuff at the end of the file and automatically
168 * adjust the settings for this buffer only. This must remain at the end
169 * of the file.
170 * ---------------------------------------------------------------------------
171 * Local variables:
172 * c-file-style: "linux"
173 * End:
174 */
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules
index b3fbf125709b..2e41cabd3d93 100644
--- a/arch/um/scripts/Makefile.rules
+++ b/arch/um/scripts/Makefile.rules
@@ -21,11 +21,6 @@ define unprofile
21endef 21endef
22 22
23 23
24# The stubs and unmap.o can't try to call mcount or update basic block data
25define unprofile
26 $(patsubst -pg,,$(patsubst -fprofile-arcs -ftest-coverage,,$(1)))
27endef
28
29# cmd_make_link checks to see if the $(foo-dir) variable starts with a /. If 24# cmd_make_link checks to see if the $(foo-dir) variable starts with a /. If
30# so, it's considered to be a path relative to $(srcdir) rather than 25# so, it's considered to be a path relative to $(srcdir) rather than
31# $(srcdir)/arch/$(SUBARCH). This is because x86_64 wants to get ldt.c from 26# $(srcdir)/arch/$(SUBARCH). This is because x86_64 wants to get ldt.c from
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 150059dbee12..f5fd5b0156d0 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -1,6 +1,8 @@
1obj-y = bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ 1obj-y := bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
2 ptrace_user.o semaphore.o signal.o sigcontext.o stub.o stub_segv.o \ 2 ptrace_user.o semaphore.o signal.o sigcontext.o syscalls.o sysrq.o \
3 syscalls.o sysrq.o sys_call_table.o 3 sys_call_table.o
4
5obj-$(CONFIG_MODE_SKAS) += stub.o stub_segv.o
4 6
5obj-$(CONFIG_HIGHMEM) += highmem.o 7obj-$(CONFIG_HIGHMEM) += highmem.o
6obj-$(CONFIG_MODULES) += module.o 8obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/um/sys-i386/ldt.c b/arch/um/sys-i386/ldt.c
index 17746b4c08ff..0cdfd4481d5e 100644
--- a/arch/um/sys-i386/ldt.c
+++ b/arch/um/sys-i386/ldt.c
@@ -16,6 +16,8 @@
16#include "choose-mode.h" 16#include "choose-mode.h"
17#include "kern.h" 17#include "kern.h"
18#include "mode_kern.h" 18#include "mode_kern.h"
19#include "proc_mm.h"
20#include "os.h"
19 21
20extern int modify_ldt(int func, void *ptr, unsigned long bytecount); 22extern int modify_ldt(int func, void *ptr, unsigned long bytecount);
21 23
@@ -456,13 +458,14 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
456 int i; 458 int i;
457 long page, err=0; 459 long page, err=0;
458 void *addr = NULL; 460 void *addr = NULL;
461 struct proc_mm_op copy;
459 462
460 memset(&desc, 0, sizeof(desc));
461 463
462 if(!ptrace_ldt) 464 if(!ptrace_ldt)
463 init_MUTEX(&new_mm->ldt.semaphore); 465 init_MUTEX(&new_mm->ldt.semaphore);
464 466
465 if(!from_mm){ 467 if(!from_mm){
468 memset(&desc, 0, sizeof(desc));
466 /* 469 /*
467 * We have to initialize a clean ldt. 470 * We have to initialize a clean ldt.
468 */ 471 */
@@ -494,8 +497,26 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
494 } 497 }
495 } 498 }
496 new_mm->ldt.entry_count = 0; 499 new_mm->ldt.entry_count = 0;
500
501 goto out;
497 } 502 }
498 else if (!ptrace_ldt) { 503
504 if(proc_mm){
505 /* We have a valid from_mm, so we now have to copy the LDT of
506 * from_mm to new_mm, because using proc_mm an new mm with
507 * an empty/default LDT was created in new_mm()
508 */
509 copy = ((struct proc_mm_op) { .op = MM_COPY_SEGMENTS,
510 .u =
511 { .copy_segments =
512 from_mm->id.u.mm_fd } } );
513 i = os_write_file(new_mm->id.u.mm_fd, &copy, sizeof(copy));
514 if(i != sizeof(copy))
515 printk("new_mm : /proc/mm copy_segments failed, "
516 "err = %d\n", -i);
517 }
518
519 if(!ptrace_ldt) {
499 /* Our local LDT is used to supply the data for 520 /* Our local LDT is used to supply the data for
500 * modify_ldt(READLDT), if PTRACE_LDT isn't available, 521 * modify_ldt(READLDT), if PTRACE_LDT isn't available,
501 * i.e., we have to use the stub for modify_ldt, which 522 * i.e., we have to use the stub for modify_ldt, which
@@ -524,6 +545,7 @@ long init_new_ldt(struct mmu_context_skas * new_mm,
524 up(&from_mm->ldt.semaphore); 545 up(&from_mm->ldt.semaphore);
525 } 546 }
526 547
548 out:
527 return err; 549 return err;
528} 550}
529 551
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index 16bc19928b3c..7cd1a82dc8c2 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -10,7 +10,6 @@
10#include "asm/uaccess.h" 10#include "asm/uaccess.h"
11#include "asm/unistd.h" 11#include "asm/unistd.h"
12#include "frame_kern.h" 12#include "frame_kern.h"
13#include "signal_user.h"
14#include "sigcontext.h" 13#include "sigcontext.h"
15#include "registers.h" 14#include "registers.h"
16#include "mode.h" 15#include "mode.h"
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index 00b2025427df..a351091fbd99 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -6,8 +6,9 @@
6 6
7#XXX: why into lib-y? 7#XXX: why into lib-y?
8lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o ldt.o mem.o memcpy.o \ 8lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o ldt.o mem.o memcpy.o \
9 ptrace.o ptrace_user.o sigcontext.o signal.o stub.o \ 9 ptrace.o ptrace_user.o sigcontext.o signal.o syscalls.o \
10 stub_segv.o syscalls.o syscall_table.o sysrq.o thunk.o 10 syscall_table.o sysrq.o thunk.o
11lib-$(CONFIG_MODE_SKAS) += stub.o stub_segv.o
11 12
12obj-y := ksyms.o 13obj-y := ksyms.o
13obj-$(CONFIG_MODULES) += module.o um_module.o 14obj-$(CONFIG_MODULES) += module.o um_module.o
diff --git a/arch/v850/Kconfig b/arch/v850/Kconfig
index 310865903234..04494638b963 100644
--- a/arch/v850/Kconfig
+++ b/arch/v850/Kconfig
@@ -10,9 +10,6 @@ mainmenu "uClinux/v850 (w/o MMU) Kernel Configuration"
10config MMU 10config MMU
11 bool 11 bool
12 default n 12 default n
13config UID16
14 bool
15 default n
16config RWSEM_GENERIC_SPINLOCK 13config RWSEM_GENERIC_SPINLOCK
17 bool 14 bool
18 default y 15 default y
diff --git a/arch/v850/kernel/process.c b/arch/v850/kernel/process.c
index 39cf247cdae4..eb909937958b 100644
--- a/arch/v850/kernel/process.c
+++ b/arch/v850/kernel/process.c
@@ -114,7 +114,7 @@ int copy_thread (int nr, unsigned long clone_flags,
114 struct task_struct *p, struct pt_regs *regs) 114 struct task_struct *p, struct pt_regs *regs)
115{ 115{
116 /* Start pushing stuff from the top of the child's kernel stack. */ 116 /* Start pushing stuff from the top of the child's kernel stack. */
117 unsigned long orig_ksp = (unsigned long)p->thread_info + THREAD_SIZE; 117 unsigned long orig_ksp = task_tos(p);
118 unsigned long ksp = orig_ksp; 118 unsigned long ksp = orig_ksp;
119 /* We push two `state save' stack fames (see entry.S) on the new 119 /* We push two `state save' stack fames (see entry.S) on the new
120 kernel stack: 120 kernel stack:
@@ -164,30 +164,6 @@ int copy_thread (int nr, unsigned long clone_flags,
164} 164}
165 165
166/* 166/*
167 * fill in the user structure for a core dump..
168 */
169void dump_thread (struct pt_regs *regs, struct user *dump)
170{
171#if 0 /* Later. XXX */
172 dump->magic = CMAGIC;
173 dump->start_code = 0;
174 dump->start_stack = regs->gpr[GPR_SP];
175 dump->u_tsize = ((unsigned long) current->mm->end_code) >> PAGE_SHIFT;
176 dump->u_dsize = ((unsigned long) (current->mm->brk +
177 (PAGE_SIZE-1))) >> PAGE_SHIFT;
178 dump->u_dsize -= dump->u_tsize;
179 dump->u_ssize = 0;
180
181 if (dump->start_stack < TASK_SIZE)
182 dump->u_ssize = ((unsigned long) (TASK_SIZE - dump->start_stack)) >> PAGE_SHIFT;
183
184 dump->u_ar0 = (struct user_regs_struct *)((int)&dump->regs - (int)dump);
185 dump->regs = *regs;
186 dump->u_fpvalid = 0;
187#endif
188}
189
190/*
191 * sys_execve() executes a new program. 167 * sys_execve() executes a new program.
192 */ 168 */
193int sys_execve (char *name, char **argv, char **envp, struct pt_regs *regs) 169int sys_execve (char *name, char **argv, char **envp, struct pt_regs *regs)
diff --git a/arch/v850/kernel/ptrace.c b/arch/v850/kernel/ptrace.c
index 18492d02aaf6..67e057509664 100644
--- a/arch/v850/kernel/ptrace.c
+++ b/arch/v850/kernel/ptrace.c
@@ -58,7 +58,7 @@ static v850_reg_t *reg_save_addr (unsigned reg_offs, struct task_struct *t)
58 regs = thread_saved_regs (t); 58 regs = thread_saved_regs (t);
59 else 59 else
60 /* Register saved during kernel entry (or not available). */ 60 /* Register saved during kernel entry (or not available). */
61 regs = task_regs (t); 61 regs = task_pt_regs (t);
62 62
63 return (v850_reg_t *)((char *)regs + reg_offs); 63 return (v850_reg_t *)((char *)regs + reg_offs);
64} 64}
diff --git a/arch/v850/kernel/v850_ksyms.c b/arch/v850/kernel/v850_ksyms.c
index 0ca64900dd91..8ffc29c1c89d 100644
--- a/arch/v850/kernel/v850_ksyms.c
+++ b/arch/v850/kernel/v850_ksyms.c
@@ -21,8 +21,6 @@ extern void *trap_table;
21EXPORT_SYMBOL (trap_table); 21EXPORT_SYMBOL (trap_table);
22 22
23/* platform dependent support */ 23/* platform dependent support */
24extern void dump_thread (struct pt_regs *, struct user *);
25EXPORT_SYMBOL (dump_thread);
26EXPORT_SYMBOL (kernel_thread); 24EXPORT_SYMBOL (kernel_thread);
27EXPORT_SYMBOL (enable_irq); 25EXPORT_SYMBOL (enable_irq);
28EXPORT_SYMBOL (disable_irq); 26EXPORT_SYMBOL (disable_irq);
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 6ece645e4dbe..2f9deca31cc9 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -69,12 +69,34 @@ config ARCH_MAY_HAVE_PC_FDC
69 bool 69 bool
70 default y 70 default y
71 71
72config DMI
73 bool
74 default y
75
72source "init/Kconfig" 76source "init/Kconfig"
73 77
74 78
75menu "Processor type and features" 79menu "Processor type and features"
76 80
77choice 81choice
82 prompt "Subarchitecture Type"
83 default X86_PC
84
85config X86_PC
86 bool "PC-compatible"
87 help
88 Choose this option if your computer is a standard PC or compatible.
89
90config X86_VSMP
91 bool "Support for ScaleMP vSMP"
92 help
93 Support for ScaleMP vSMP systems. Say 'Y' here if this kernel is
94 supposed to run on these EM64T-based machines. Only choose this option
95 if you have one of these machines.
96
97endchoice
98
99choice
78 prompt "Processor family" 100 prompt "Processor family"
79 default MK8 101 default MK8
80 102
@@ -283,7 +305,11 @@ config ARCH_DISCONTIGMEM_DEFAULT
283 305
284config ARCH_SPARSEMEM_ENABLE 306config ARCH_SPARSEMEM_ENABLE
285 def_bool y 307 def_bool y
286 depends on NUMA 308 depends on (NUMA || EXPERIMENTAL)
309
310config ARCH_MEMORY_PROBE
311 def_bool y
312 depends on MEMORY_HOTPLUG
287 313
288config ARCH_FLATMEM_ENABLE 314config ARCH_FLATMEM_ENABLE
289 def_bool y 315 def_bool y
@@ -293,6 +319,7 @@ source "mm/Kconfig"
293 319
294config HAVE_ARCH_EARLY_PFN_TO_NID 320config HAVE_ARCH_EARLY_PFN_TO_NID
295 def_bool y 321 def_bool y
322 depends on NUMA
296 323
297config NR_CPUS 324config NR_CPUS
298 int "Maximum number of CPUs (2-256)" 325 int "Maximum number of CPUs (2-256)"
@@ -328,7 +355,7 @@ config HPET_TIMER
328 <http://www.intel.com/hardwaredesign/hpetspec.htm>. 355 <http://www.intel.com/hardwaredesign/hpetspec.htm>.
329 356
330config X86_PM_TIMER 357config X86_PM_TIMER
331 bool "PM timer" 358 bool "PM timer" if EMBEDDED
332 depends on ACPI 359 depends on ACPI
333 default y 360 default y
334 help 361 help
@@ -347,32 +374,24 @@ config HPET_EMULATE_RTC
347 depends on HPET_TIMER && RTC=y 374 depends on HPET_TIMER && RTC=y
348 375
349config GART_IOMMU 376config GART_IOMMU
350 bool "IOMMU support" 377 bool "K8 GART IOMMU support"
351 default y 378 default y
379 select SWIOTLB
352 depends on PCI 380 depends on PCI
353 help 381 help
354 Support the IOMMU. Needed to run systems with more than 3GB of memory 382 Support the IOMMU. Needed to run systems with more than 3GB of memory
355 properly with 32-bit PCI devices that do not support DAC (Double Address 383 properly with 32-bit PCI devices that do not support DAC (Double Address
356 Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter. 384 Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter.
357 Normally the kernel will take the right choice by itself. 385 Normally the kernel will take the right choice by itself.
358 This option includes a driver for the AMD Opteron/Athlon64 IOMMU 386 This option includes a driver for the AMD Opteron/Athlon64 northbridge IOMMU
359 and a software emulation used on some other systems. 387 and a software emulation used on other systems.
360 If unsure, say Y. 388 If unsure, say Y.
361 389
362# need this always enabled with GART_IOMMU for the VIA workaround 390# need this always enabled with GART_IOMMU for the VIA workaround
363config SWIOTLB 391config SWIOTLB
364 bool
365 depends on GART_IOMMU
366 default y
367
368config DUMMY_IOMMU
369 bool 392 bool
370 depends on !GART_IOMMU && !SWIOTLB
371 default y 393 default y
372 help 394 depends on GART_IOMMU
373 Don't use IOMMU code. This will cause problems when you have more than 4GB
374 of memory and any 32-bit devices. Don't turn on unless you know what you
375 are doing.
376 395
377config X86_MCE 396config X86_MCE
378 bool "Machine check support" if EMBEDDED 397 bool "Machine check support" if EMBEDDED
@@ -399,17 +418,6 @@ config X86_MCE_AMD
399 Additional support for AMD specific MCE features such as 418 Additional support for AMD specific MCE features such as
400 the DRAM Error Threshold. 419 the DRAM Error Threshold.
401 420
402config PHYSICAL_START
403 hex "Physical address where the kernel is loaded" if EMBEDDED
404 default "0x100000"
405 help
406 This gives the physical address where the kernel is loaded.
407 Primarily used in the case of kexec on panic where the
408 fail safe kernel needs to run at a different address than
409 the panic-ed kernel.
410
411 Don't change this unless you know what you are doing.
412
413config KEXEC 421config KEXEC
414 bool "kexec system call (EXPERIMENTAL)" 422 bool "kexec system call (EXPERIMENTAL)"
415 depends on EXPERIMENTAL 423 depends on EXPERIMENTAL
@@ -427,6 +435,31 @@ config KEXEC
427 support. As of this writing the exact hardware interface is 435 support. As of this writing the exact hardware interface is
428 strongly in flux, so no good recommendation can be made. 436 strongly in flux, so no good recommendation can be made.
429 437
438config CRASH_DUMP
439 bool "kernel crash dumps (EXPERIMENTAL)"
440 depends on EXPERIMENTAL
441 help
442 Generate crash dump after being started by kexec.
443
444config PHYSICAL_START
445 hex "Physical address where the kernel is loaded" if (EMBEDDED || CRASH_DUMP)
446 default "0x1000000" if CRASH_DUMP
447 default "0x100000"
448 help
449 This gives the physical address where the kernel is loaded. Normally
450 for regular kernels this value is 0x100000 (1MB). But in the case
451 of kexec on panic the fail safe kernel needs to run at a different
452 address than the panic-ed kernel. This option is used to set the load
453 address for kernels used to capture crash dump on being kexec'ed
454 after panic. The default value for crash dump kernels is
455 0x1000000 (16MB). This can also be set based on the "X" value as
456 specified in the "crashkernel=YM@XM" command line boot parameter
457 passed to the panic-ed kernel. Typically this parameter is set as
458 crashkernel=64M@16M. Please take a look at
459 Documentation/kdump/kdump.txt for more details about crash dumps.
460
461 Don't change this unless you know what you are doing.
462
430config SECCOMP 463config SECCOMP
431 bool "Enable seccomp to safely compute untrusted bytecode" 464 bool "Enable seccomp to safely compute untrusted bytecode"
432 depends on PROC_FS 465 depends on PROC_FS
@@ -542,11 +575,6 @@ config SYSVIPC_COMPAT
542 depends on COMPAT && SYSVIPC 575 depends on COMPAT && SYSVIPC
543 default y 576 default y
544 577
545config UID16
546 bool
547 depends on IA32_EMULATION
548 default y
549
550endmenu 578endmenu
551 579
552source "net/Kconfig" 580source "net/Kconfig"
diff --git a/arch/x86_64/Kconfig.debug b/arch/x86_64/Kconfig.debug
index e2c6e64a85ec..fcb06a50fdd2 100644
--- a/arch/x86_64/Kconfig.debug
+++ b/arch/x86_64/Kconfig.debug
@@ -9,6 +9,16 @@ config INIT_DEBUG
9 Fill __init and __initdata at the end of boot. This helps debugging 9 Fill __init and __initdata at the end of boot. This helps debugging
10 illegal uses of __init and __initdata after initialization. 10 illegal uses of __init and __initdata after initialization.
11 11
12config DEBUG_RODATA
13 bool "Write protect kernel read-only data structures"
14 depends on DEBUG_KERNEL
15 help
16 Mark the kernel read-only data as write-protected in the pagetables,
17 in order to catch accidental (and incorrect) writes to such const data.
18 This option may have a slight performance impact because a portion
19 of the kernel code won't be covered by a 2MB TLB anymore.
20 If in doubt, say "N".
21
12config IOMMU_DEBUG 22config IOMMU_DEBUG
13 depends on GART_IOMMU && DEBUG_KERNEL 23 depends on GART_IOMMU && DEBUG_KERNEL
14 bool "Enable IOMMU debugging" 24 bool "Enable IOMMU debugging"
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index a9cd42e61828..d7fd46479c55 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -31,6 +31,7 @@ cflags-$(CONFIG_MK8) += $(call cc-option,-march=k8)
31cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona) 31cflags-$(CONFIG_MPSC) += $(call cc-option,-march=nocona)
32CFLAGS += $(cflags-y) 32CFLAGS += $(cflags-y)
33 33
34CFLAGS += -m64
34CFLAGS += -mno-red-zone 35CFLAGS += -mno-red-zone
35CFLAGS += -mcmodel=kernel 36CFLAGS += -mcmodel=kernel
36CFLAGS += -pipe 37CFLAGS += -pipe
@@ -38,8 +39,10 @@ CFLAGS += -pipe
38# actually it makes the kernel smaller too. 39# actually it makes the kernel smaller too.
39CFLAGS += -fno-reorder-blocks 40CFLAGS += -fno-reorder-blocks
40CFLAGS += -Wno-sign-compare 41CFLAGS += -Wno-sign-compare
41ifneq ($(CONFIG_DEBUG_INFO),y) 42ifneq ($(CONFIG_UNWIND_INFO),y)
42CFLAGS += -fno-asynchronous-unwind-tables 43CFLAGS += -fno-asynchronous-unwind-tables
44endif
45ifneq ($(CONFIG_DEBUG_INFO),y)
43# -fweb shrinks the kernel a bit, but the difference is very small 46# -fweb shrinks the kernel a bit, but the difference is very small
44# it also messes up debugging, so don't use it for now. 47# it also messes up debugging, so don't use it for now.
45#CFLAGS += $(call cc-option,-fweb) 48#CFLAGS += $(call cc-option,-fweb)
@@ -50,6 +53,8 @@ CFLAGS += $(call cc-option,-funit-at-a-time)
50# prevent gcc from generating any FP code by mistake 53# prevent gcc from generating any FP code by mistake
51CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,) 54CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
52 55
56AFLAGS += -m64
57
53head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o 58head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
54 59
55libs-y += arch/x86_64/lib/ 60libs-y += arch/x86_64/lib/
@@ -80,9 +85,12 @@ bzlilo: vmlinux
80bzdisk: vmlinux 85bzdisk: vmlinux
81 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zdisk 86 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) zdisk
82 87
83install fdimage fdimage144 fdimage288: vmlinux 88fdimage fdimage144 fdimage288: vmlinux
84 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@ 89 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
85 90
91install:
92 $(Q)$(MAKE) $(build)=$(boot) BOOTIMAGE=$(BOOTIMAGE) $@
93
86archclean: 94archclean:
87 $(Q)$(MAKE) $(clean)=$(boot) 95 $(Q)$(MAKE) $(clean)=$(boot)
88 96
diff --git a/arch/x86_64/boot/.gitignore b/arch/x86_64/boot/.gitignore
new file mode 100644
index 000000000000..495f20c085de
--- /dev/null
+++ b/arch/x86_64/boot/.gitignore
@@ -0,0 +1,3 @@
1bootsect
2bzImage
3setup
diff --git a/arch/x86_64/boot/Makefile b/arch/x86_64/boot/Makefile
index 18c6e915d69b..29f8396ed151 100644
--- a/arch/x86_64/boot/Makefile
+++ b/arch/x86_64/boot/Makefile
@@ -98,5 +98,5 @@ zlilo: $(BOOTIMAGE)
98 cp System.map $(INSTALL_PATH)/ 98 cp System.map $(INSTALL_PATH)/
99 if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi 99 if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
100 100
101install: $(BOOTIMAGE) 101install:
102 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)" 102 sh $(srctree)/$(src)/install.sh $(KERNELRELEASE) $(BOOTIMAGE) System.map "$(INSTALL_PATH)"
diff --git a/arch/x86_64/boot/compressed/misc.c b/arch/x86_64/boot/compressed/misc.c
index 0e10fd84c7cc..cf4b88c416dc 100644
--- a/arch/x86_64/boot/compressed/misc.c
+++ b/arch/x86_64/boot/compressed/misc.c
@@ -9,7 +9,7 @@
9 * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 9 * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
10 */ 10 */
11 11
12#include "miscsetup.h" 12#include <linux/screen_info.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/page.h> 14#include <asm/page.h>
15 15
diff --git a/arch/x86_64/boot/compressed/miscsetup.h b/arch/x86_64/boot/compressed/miscsetup.h
deleted file mode 100644
index bb1620531703..000000000000
--- a/arch/x86_64/boot/compressed/miscsetup.h
+++ /dev/null
@@ -1,39 +0,0 @@
1#define NULL 0
2//typedef unsigned int size_t;
3
4
5struct screen_info {
6 unsigned char orig_x; /* 0x00 */
7 unsigned char orig_y; /* 0x01 */
8 unsigned short dontuse1; /* 0x02 -- EXT_MEM_K sits here */
9 unsigned short orig_video_page; /* 0x04 */
10 unsigned char orig_video_mode; /* 0x06 */
11 unsigned char orig_video_cols; /* 0x07 */
12 unsigned short unused2; /* 0x08 */
13 unsigned short orig_video_ega_bx; /* 0x0a */
14 unsigned short unused3; /* 0x0c */
15 unsigned char orig_video_lines; /* 0x0e */
16 unsigned char orig_video_isVGA; /* 0x0f */
17 unsigned short orig_video_points; /* 0x10 */
18
19 /* VESA graphic mode -- linear frame buffer */
20 unsigned short lfb_width; /* 0x12 */
21 unsigned short lfb_height; /* 0x14 */
22 unsigned short lfb_depth; /* 0x16 */
23 unsigned long lfb_base; /* 0x18 */
24 unsigned long lfb_size; /* 0x1c */
25 unsigned short dontuse2, dontuse3; /* 0x20 -- CL_MAGIC and CL_OFFSET here */
26 unsigned short lfb_linelength; /* 0x24 */
27 unsigned char red_size; /* 0x26 */
28 unsigned char red_pos; /* 0x27 */
29 unsigned char green_size; /* 0x28 */
30 unsigned char green_pos; /* 0x29 */
31 unsigned char blue_size; /* 0x2a */
32 unsigned char blue_pos; /* 0x2b */
33 unsigned char rsvd_size; /* 0x2c */
34 unsigned char rsvd_pos; /* 0x2d */
35 unsigned short vesapm_seg; /* 0x2e */
36 unsigned short vesapm_off; /* 0x30 */
37 unsigned short pages; /* 0x32 */
38 /* 0x34 -- 0x3f reserved for future expansion */
39};
diff --git a/arch/x86_64/boot/install.sh b/arch/x86_64/boot/install.sh
index 198af15a7758..baaa2369bdb8 100644
--- a/arch/x86_64/boot/install.sh
+++ b/arch/x86_64/boot/install.sh
@@ -1,40 +1,2 @@
1#!/bin/sh 1#!/bin/sh
2# 2. $srctree/arch/i386/boot/install.sh
3# arch/x86_64/boot/install.sh
4#
5# This file is subject to the terms and conditions of the GNU General Public
6# License. See the file "COPYING" in the main directory of this archive
7# for more details.
8#
9# Copyright (C) 1995 by Linus Torvalds
10#
11# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
12#
13# "make install" script for i386 architecture
14#
15# Arguments:
16# $1 - kernel version
17# $2 - kernel image file
18# $3 - kernel map file
19# $4 - default install path (blank if root directory)
20#
21
22# User may have a custom install script
23
24if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi
25if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi
26
27# Default install - same as make zlilo
28
29if [ -f $4/vmlinuz ]; then
30 mv $4/vmlinuz $4/vmlinuz.old
31fi
32
33if [ -f $4/System.map ]; then
34 mv $4/System.map $4/System.old
35fi
36
37cat $2 > $4/vmlinuz
38cp $3 $4/System.map
39
40if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
diff --git a/arch/x86_64/boot/tools/.gitignore b/arch/x86_64/boot/tools/.gitignore
new file mode 100644
index 000000000000..378eac25d311
--- /dev/null
+++ b/arch/x86_64/boot/tools/.gitignore
@@ -0,0 +1 @@
build
diff --git a/arch/x86_64/crypto/aes.c b/arch/x86_64/crypto/aes.c
index acfdaa28791e..fb1b961a2e2f 100644
--- a/arch/x86_64/crypto/aes.c
+++ b/arch/x86_64/crypto/aes.c
@@ -74,8 +74,6 @@ static inline u8 byte(const u32 x, const unsigned n)
74 return x >> (n << 3); 74 return x >> (n << 3);
75} 75}
76 76
77#define u32_in(x) le32_to_cpu(*(const __le32 *)(x))
78
79struct aes_ctx 77struct aes_ctx
80{ 78{
81 u32 key_length; 79 u32 key_length;
@@ -234,6 +232,7 @@ static int aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len,
234 u32 *flags) 232 u32 *flags)
235{ 233{
236 struct aes_ctx *ctx = ctx_arg; 234 struct aes_ctx *ctx = ctx_arg;
235 const __le32 *key = (const __le32 *)in_key;
237 u32 i, j, t, u, v, w; 236 u32 i, j, t, u, v, w;
238 237
239 if (key_len != 16 && key_len != 24 && key_len != 32) { 238 if (key_len != 16 && key_len != 24 && key_len != 32) {
@@ -243,10 +242,10 @@ static int aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len,
243 242
244 ctx->key_length = key_len; 243 ctx->key_length = key_len;
245 244
246 D_KEY[key_len + 24] = E_KEY[0] = u32_in(in_key); 245 D_KEY[key_len + 24] = E_KEY[0] = le32_to_cpu(key[0]);
247 D_KEY[key_len + 25] = E_KEY[1] = u32_in(in_key + 4); 246 D_KEY[key_len + 25] = E_KEY[1] = le32_to_cpu(key[1]);
248 D_KEY[key_len + 26] = E_KEY[2] = u32_in(in_key + 8); 247 D_KEY[key_len + 26] = E_KEY[2] = le32_to_cpu(key[2]);
249 D_KEY[key_len + 27] = E_KEY[3] = u32_in(in_key + 12); 248 D_KEY[key_len + 27] = E_KEY[3] = le32_to_cpu(key[3]);
250 249
251 switch (key_len) { 250 switch (key_len) {
252 case 16: 251 case 16:
@@ -256,17 +255,17 @@ static int aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len,
256 break; 255 break;
257 256
258 case 24: 257 case 24:
259 E_KEY[4] = u32_in(in_key + 16); 258 E_KEY[4] = le32_to_cpu(key[4]);
260 t = E_KEY[5] = u32_in(in_key + 20); 259 t = E_KEY[5] = le32_to_cpu(key[5]);
261 for (i = 0; i < 8; ++i) 260 for (i = 0; i < 8; ++i)
262 loop6 (i); 261 loop6 (i);
263 break; 262 break;
264 263
265 case 32: 264 case 32:
266 E_KEY[4] = u32_in(in_key + 16); 265 E_KEY[4] = le32_to_cpu(key[4]);
267 E_KEY[5] = u32_in(in_key + 20); 266 E_KEY[5] = le32_to_cpu(key[5]);
268 E_KEY[6] = u32_in(in_key + 24); 267 E_KEY[6] = le32_to_cpu(key[6]);
269 t = E_KEY[7] = u32_in(in_key + 28); 268 t = E_KEY[7] = le32_to_cpu(key[7]);
270 for (i = 0; i < 7; ++i) 269 for (i = 0; i < 7; ++i)
271 loop8(i); 270 loop8(i);
272 break; 271 break;
@@ -290,6 +289,8 @@ extern void aes_decrypt(void *ctx_arg, u8 *out, const u8 *in);
290 289
291static struct crypto_alg aes_alg = { 290static struct crypto_alg aes_alg = {
292 .cra_name = "aes", 291 .cra_name = "aes",
292 .cra_driver_name = "aes-x86_64",
293 .cra_priority = 200,
293 .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 294 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
294 .cra_blocksize = AES_BLOCK_SIZE, 295 .cra_blocksize = AES_BLOCK_SIZE,
295 .cra_ctxsize = sizeof(struct aes_ctx), 296 .cra_ctxsize = sizeof(struct aes_ctx),
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 5d56542fb68f..09a3eb743315 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/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.14-git7 3# Linux kernel version: 2.6.15-git12
4# Sat Nov 5 15:55:50 2005 4# Mon Jan 16 13:09:08 2006
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -15,6 +15,7 @@ CONFIG_EARLY_PRINTK=y
15CONFIG_GENERIC_ISA_DMA=y 15CONFIG_GENERIC_ISA_DMA=y
16CONFIG_GENERIC_IOMAP=y 16CONFIG_GENERIC_IOMAP=y
17CONFIG_ARCH_MAY_HAVE_PC_FDC=y 17CONFIG_ARCH_MAY_HAVE_PC_FDC=y
18CONFIG_DMI=y
18 19
19# 20#
20# Code maturity level options 21# Code maturity level options
@@ -35,18 +36,21 @@ CONFIG_POSIX_MQUEUE=y
35# CONFIG_BSD_PROCESS_ACCT is not set 36# CONFIG_BSD_PROCESS_ACCT is not set
36CONFIG_SYSCTL=y 37CONFIG_SYSCTL=y
37# CONFIG_AUDIT is not set 38# CONFIG_AUDIT is not set
38CONFIG_HOTPLUG=y
39CONFIG_KOBJECT_UEVENT=y
40CONFIG_IKCONFIG=y 39CONFIG_IKCONFIG=y
41CONFIG_IKCONFIG_PROC=y 40CONFIG_IKCONFIG_PROC=y
42# CONFIG_CPUSETS is not set 41# CONFIG_CPUSETS is not set
43CONFIG_INITRAMFS_SOURCE="" 42CONFIG_INITRAMFS_SOURCE=""
43CONFIG_UID16=y
44CONFIG_VM86=y
45CONFIG_CC_OPTIMIZE_FOR_SIZE=y
44# CONFIG_EMBEDDED is not set 46# CONFIG_EMBEDDED is not set
45CONFIG_KALLSYMS=y 47CONFIG_KALLSYMS=y
46CONFIG_KALLSYMS_ALL=y 48CONFIG_KALLSYMS_ALL=y
47# CONFIG_KALLSYMS_EXTRA_PASS is not set 49# CONFIG_KALLSYMS_EXTRA_PASS is not set
50CONFIG_HOTPLUG=y
48CONFIG_PRINTK=y 51CONFIG_PRINTK=y
49CONFIG_BUG=y 52CONFIG_BUG=y
53CONFIG_ELF_CORE=y
50CONFIG_BASE_FULL=y 54CONFIG_BASE_FULL=y
51CONFIG_FUTEX=y 55CONFIG_FUTEX=y
52CONFIG_EPOLL=y 56CONFIG_EPOLL=y
@@ -55,8 +59,10 @@ CONFIG_CC_ALIGN_FUNCTIONS=0
55CONFIG_CC_ALIGN_LABELS=0 59CONFIG_CC_ALIGN_LABELS=0
56CONFIG_CC_ALIGN_LOOPS=0 60CONFIG_CC_ALIGN_LOOPS=0
57CONFIG_CC_ALIGN_JUMPS=0 61CONFIG_CC_ALIGN_JUMPS=0
62CONFIG_SLAB=y
58# CONFIG_TINY_SHMEM is not set 63# CONFIG_TINY_SHMEM is not set
59CONFIG_BASE_SMALL=0 64CONFIG_BASE_SMALL=0
65# CONFIG_SLOB is not set
60 66
61# 67#
62# Loadable module support 68# Loadable module support
@@ -71,8 +77,28 @@ CONFIG_OBSOLETE_MODPARM=y
71CONFIG_STOP_MACHINE=y 77CONFIG_STOP_MACHINE=y
72 78
73# 79#
80# Block layer
81#
82CONFIG_LBD=y
83
84#
85# IO Schedulers
86#
87CONFIG_IOSCHED_NOOP=y
88# CONFIG_IOSCHED_AS is not set
89CONFIG_IOSCHED_DEADLINE=y
90CONFIG_IOSCHED_CFQ=y
91# CONFIG_DEFAULT_AS is not set
92# CONFIG_DEFAULT_DEADLINE is not set
93CONFIG_DEFAULT_CFQ=y
94# CONFIG_DEFAULT_NOOP is not set
95CONFIG_DEFAULT_IOSCHED="cfq"
96
97#
74# Processor type and features 98# Processor type and features
75# 99#
100CONFIG_X86_PC=y
101# CONFIG_X86_VSMP is not set
76# CONFIG_MK8 is not set 102# CONFIG_MK8 is not set
77# CONFIG_MPSC is not set 103# CONFIG_MPSC is not set
78CONFIG_GENERIC_CPU=y 104CONFIG_GENERIC_CPU=y
@@ -89,14 +115,14 @@ CONFIG_X86_LOCAL_APIC=y
89CONFIG_MTRR=y 115CONFIG_MTRR=y
90CONFIG_SMP=y 116CONFIG_SMP=y
91CONFIG_SCHED_SMT=y 117CONFIG_SCHED_SMT=y
92CONFIG_PREEMPT_NONE=y 118# CONFIG_PREEMPT_NONE is not set
93# CONFIG_PREEMPT_VOLUNTARY is not set 119CONFIG_PREEMPT_VOLUNTARY=y
94# CONFIG_PREEMPT is not set 120# CONFIG_PREEMPT is not set
95CONFIG_PREEMPT_BKL=y 121CONFIG_PREEMPT_BKL=y
96CONFIG_NUMA=y 122CONFIG_NUMA=y
97CONFIG_K8_NUMA=y 123CONFIG_K8_NUMA=y
98CONFIG_X86_64_ACPI_NUMA=y 124CONFIG_X86_64_ACPI_NUMA=y
99# CONFIG_NUMA_EMU is not set 125CONFIG_NUMA_EMU=y
100CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 126CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
101CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y 127CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
102CONFIG_ARCH_SPARSEMEM_ENABLE=y 128CONFIG_ARCH_SPARSEMEM_ENABLE=y
@@ -109,6 +135,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
109CONFIG_NEED_MULTIPLE_NODES=y 135CONFIG_NEED_MULTIPLE_NODES=y
110# CONFIG_SPARSEMEM_STATIC is not set 136# CONFIG_SPARSEMEM_STATIC is not set
111CONFIG_SPLIT_PTLOCK_CPUS=4 137CONFIG_SPLIT_PTLOCK_CPUS=4
138CONFIG_MIGRATION=y
112CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y 139CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
113CONFIG_NR_CPUS=32 140CONFIG_NR_CPUS=32
114CONFIG_HOTPLUG_CPU=y 141CONFIG_HOTPLUG_CPU=y
@@ -120,8 +147,9 @@ CONFIG_SWIOTLB=y
120CONFIG_X86_MCE=y 147CONFIG_X86_MCE=y
121CONFIG_X86_MCE_INTEL=y 148CONFIG_X86_MCE_INTEL=y
122CONFIG_X86_MCE_AMD=y 149CONFIG_X86_MCE_AMD=y
123CONFIG_PHYSICAL_START=0x100000
124# CONFIG_KEXEC is not set 150# CONFIG_KEXEC is not set
151# CONFIG_CRASH_DUMP is not set
152CONFIG_PHYSICAL_START=0x100000
125CONFIG_SECCOMP=y 153CONFIG_SECCOMP=y
126# CONFIG_HZ_100 is not set 154# CONFIG_HZ_100 is not set
127CONFIG_HZ_250=y 155CONFIG_HZ_250=y
@@ -136,6 +164,7 @@ CONFIG_GENERIC_PENDING_IRQ=y
136# Power management options 164# Power management options
137# 165#
138CONFIG_PM=y 166CONFIG_PM=y
167# CONFIG_PM_LEGACY is not set
139# CONFIG_PM_DEBUG is not set 168# CONFIG_PM_DEBUG is not set
140CONFIG_SOFTWARE_SUSPEND=y 169CONFIG_SOFTWARE_SUSPEND=y
141CONFIG_PM_STD_PARTITION="" 170CONFIG_PM_STD_PARTITION=""
@@ -152,7 +181,7 @@ CONFIG_ACPI_AC=y
152CONFIG_ACPI_BATTERY=y 181CONFIG_ACPI_BATTERY=y
153CONFIG_ACPI_BUTTON=y 182CONFIG_ACPI_BUTTON=y
154# CONFIG_ACPI_VIDEO is not set 183# CONFIG_ACPI_VIDEO is not set
155CONFIG_ACPI_HOTKEY=m 184# CONFIG_ACPI_HOTKEY is not set
156CONFIG_ACPI_FAN=y 185CONFIG_ACPI_FAN=y
157CONFIG_ACPI_PROCESSOR=y 186CONFIG_ACPI_PROCESSOR=y
158CONFIG_ACPI_HOTPLUG_CPU=y 187CONFIG_ACPI_HOTPLUG_CPU=y
@@ -205,7 +234,7 @@ CONFIG_PCI=y
205CONFIG_PCI_DIRECT=y 234CONFIG_PCI_DIRECT=y
206CONFIG_PCI_MMCONFIG=y 235CONFIG_PCI_MMCONFIG=y
207CONFIG_UNORDERED_IO=y 236CONFIG_UNORDERED_IO=y
208# CONFIG_PCIEPORTBUS is not set 237CONFIG_PCIEPORTBUS=y
209CONFIG_PCI_MSI=y 238CONFIG_PCI_MSI=y
210# CONFIG_PCI_LEGACY_PROC is not set 239# CONFIG_PCI_LEGACY_PROC is not set
211# CONFIG_PCI_DEBUG is not set 240# CONFIG_PCI_DEBUG is not set
@@ -229,7 +258,6 @@ CONFIG_IA32_EMULATION=y
229CONFIG_IA32_AOUT=y 258CONFIG_IA32_AOUT=y
230CONFIG_COMPAT=y 259CONFIG_COMPAT=y
231CONFIG_SYSVIPC_COMPAT=y 260CONFIG_SYSVIPC_COMPAT=y
232CONFIG_UID16=y
233 261
234# 262#
235# Networking 263# Networking
@@ -291,11 +319,19 @@ CONFIG_IPV6=y
291# CONFIG_ATALK is not set 319# CONFIG_ATALK is not set
292# CONFIG_X25 is not set 320# CONFIG_X25 is not set
293# CONFIG_LAPB is not set 321# CONFIG_LAPB is not set
322
323#
324# TIPC Configuration (EXPERIMENTAL)
325#
326# CONFIG_TIPC is not set
294# CONFIG_NET_DIVERT is not set 327# CONFIG_NET_DIVERT is not set
295# CONFIG_ECONET is not set 328# CONFIG_ECONET is not set
296# CONFIG_WAN_ROUTER is not set 329# CONFIG_WAN_ROUTER is not set
330
331#
332# QoS and/or fair queueing
333#
297# CONFIG_NET_SCHED is not set 334# CONFIG_NET_SCHED is not set
298# CONFIG_NET_CLS_ROUTE is not set
299 335
300# 336#
301# Network testing 337# Network testing
@@ -315,7 +351,7 @@ CONFIG_IPV6=y
315# 351#
316CONFIG_STANDALONE=y 352CONFIG_STANDALONE=y
317CONFIG_PREVENT_FIRMWARE_BUILD=y 353CONFIG_PREVENT_FIRMWARE_BUILD=y
318# CONFIG_FW_LOADER is not set 354CONFIG_FW_LOADER=y
319# CONFIG_DEBUG_DRIVER is not set 355# CONFIG_DEBUG_DRIVER is not set
320 356
321# 357#
@@ -356,21 +392,7 @@ CONFIG_BLK_DEV_RAM=y
356CONFIG_BLK_DEV_RAM_COUNT=16 392CONFIG_BLK_DEV_RAM_COUNT=16
357CONFIG_BLK_DEV_RAM_SIZE=4096 393CONFIG_BLK_DEV_RAM_SIZE=4096
358CONFIG_BLK_DEV_INITRD=y 394CONFIG_BLK_DEV_INITRD=y
359CONFIG_LBD=y
360# CONFIG_CDROM_PKTCDVD is not set 395# CONFIG_CDROM_PKTCDVD is not set
361
362#
363# IO Schedulers
364#
365CONFIG_IOSCHED_NOOP=y
366# CONFIG_IOSCHED_AS is not set
367CONFIG_IOSCHED_DEADLINE=y
368CONFIG_IOSCHED_CFQ=y
369# CONFIG_DEFAULT_AS is not set
370CONFIG_DEFAULT_DEADLINE=y
371# CONFIG_DEFAULT_CFQ is not set
372# CONFIG_DEFAULT_NOOP is not set
373CONFIG_DEFAULT_IOSCHED="cfq"
374# CONFIG_ATA_OVER_ETH is not set 396# CONFIG_ATA_OVER_ETH is not set
375 397
376# 398#
@@ -410,7 +432,7 @@ CONFIG_IDEDMA_PCI_AUTO=y
410# CONFIG_BLK_DEV_AEC62XX is not set 432# CONFIG_BLK_DEV_AEC62XX is not set
411# CONFIG_BLK_DEV_ALI15X3 is not set 433# CONFIG_BLK_DEV_ALI15X3 is not set
412CONFIG_BLK_DEV_AMD74XX=y 434CONFIG_BLK_DEV_AMD74XX=y
413# CONFIG_BLK_DEV_ATIIXP is not set 435CONFIG_BLK_DEV_ATIIXP=y
414# CONFIG_BLK_DEV_CMD64X is not set 436# CONFIG_BLK_DEV_CMD64X is not set
415# CONFIG_BLK_DEV_TRIFLEX is not set 437# CONFIG_BLK_DEV_TRIFLEX is not set
416# CONFIG_BLK_DEV_CY82C693 is not set 438# CONFIG_BLK_DEV_CY82C693 is not set
@@ -458,20 +480,21 @@ CONFIG_BLK_DEV_SD=y
458# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 480# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
459# 481#
460# CONFIG_SCSI_MULTI_LUN is not set 482# CONFIG_SCSI_MULTI_LUN is not set
461# CONFIG_SCSI_CONSTANTS is not set 483CONFIG_SCSI_CONSTANTS=y
462# CONFIG_SCSI_LOGGING is not set 484# CONFIG_SCSI_LOGGING is not set
463 485
464# 486#
465# SCSI Transport Attributes 487# SCSI Transport Attributes
466# 488#
467CONFIG_SCSI_SPI_ATTRS=y 489CONFIG_SCSI_SPI_ATTRS=y
468# CONFIG_SCSI_FC_ATTRS is not set 490CONFIG_SCSI_FC_ATTRS=y
469# CONFIG_SCSI_ISCSI_ATTRS is not set 491# CONFIG_SCSI_ISCSI_ATTRS is not set
470# CONFIG_SCSI_SAS_ATTRS is not set 492# CONFIG_SCSI_SAS_ATTRS is not set
471 493
472# 494#
473# SCSI low-level drivers 495# SCSI low-level drivers
474# 496#
497# CONFIG_ISCSI_TCP is not set
475# CONFIG_BLK_DEV_3W_XXXX_RAID is not set 498# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
476# CONFIG_SCSI_3W_9XXX is not set 499# CONFIG_SCSI_3W_9XXX is not set
477# CONFIG_SCSI_ACARD is not set 500# CONFIG_SCSI_ACARD is not set
@@ -485,11 +508,13 @@ CONFIG_AIC79XX_RESET_DELAY_MS=4000
485# CONFIG_AIC79XX_DEBUG_ENABLE is not set 508# CONFIG_AIC79XX_DEBUG_ENABLE is not set
486CONFIG_AIC79XX_DEBUG_MASK=0 509CONFIG_AIC79XX_DEBUG_MASK=0
487# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set 510# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
488# CONFIG_MEGARAID_NEWGEN is not set 511CONFIG_MEGARAID_NEWGEN=y
512CONFIG_MEGARAID_MM=y
513CONFIG_MEGARAID_MAILBOX=y
489# CONFIG_MEGARAID_LEGACY is not set 514# CONFIG_MEGARAID_LEGACY is not set
490# CONFIG_MEGARAID_SAS is not set 515CONFIG_MEGARAID_SAS=y
491CONFIG_SCSI_SATA=y 516CONFIG_SCSI_SATA=y
492# CONFIG_SCSI_SATA_AHCI is not set 517CONFIG_SCSI_SATA_AHCI=y
493# CONFIG_SCSI_SATA_SVW is not set 518# CONFIG_SCSI_SATA_SVW is not set
494CONFIG_SCSI_ATA_PIIX=y 519CONFIG_SCSI_ATA_PIIX=y
495# CONFIG_SCSI_SATA_MV is not set 520# CONFIG_SCSI_SATA_MV is not set
@@ -498,7 +523,7 @@ CONFIG_SCSI_SATA_NV=y
498# CONFIG_SCSI_SATA_QSTOR is not set 523# CONFIG_SCSI_SATA_QSTOR is not set
499# CONFIG_SCSI_SATA_PROMISE is not set 524# CONFIG_SCSI_SATA_PROMISE is not set
500# CONFIG_SCSI_SATA_SX4 is not set 525# CONFIG_SCSI_SATA_SX4 is not set
501# CONFIG_SCSI_SATA_SIL is not set 526CONFIG_SCSI_SATA_SIL=y
502# CONFIG_SCSI_SATA_SIL24 is not set 527# CONFIG_SCSI_SATA_SIL24 is not set
503# CONFIG_SCSI_SATA_SIS is not set 528# CONFIG_SCSI_SATA_SIS is not set
504# CONFIG_SCSI_SATA_ULI is not set 529# CONFIG_SCSI_SATA_ULI is not set
@@ -517,13 +542,7 @@ CONFIG_SCSI_SATA_INTEL_COMBINED=y
517# CONFIG_SCSI_IPR is not set 542# CONFIG_SCSI_IPR is not set
518# CONFIG_SCSI_QLOGIC_FC is not set 543# CONFIG_SCSI_QLOGIC_FC is not set
519# CONFIG_SCSI_QLOGIC_1280 is not set 544# CONFIG_SCSI_QLOGIC_1280 is not set
520CONFIG_SCSI_QLA2XXX=y 545# CONFIG_SCSI_QLA_FC is not set
521# CONFIG_SCSI_QLA21XX is not set
522# CONFIG_SCSI_QLA22XX is not set
523# CONFIG_SCSI_QLA2300 is not set
524# CONFIG_SCSI_QLA2322 is not set
525# CONFIG_SCSI_QLA6312 is not set
526# CONFIG_SCSI_QLA24XX is not set
527# CONFIG_SCSI_LPFC is not set 546# CONFIG_SCSI_LPFC is not set
528# CONFIG_SCSI_DC395x is not set 547# CONFIG_SCSI_DC395x is not set
529# CONFIG_SCSI_DC390T is not set 548# CONFIG_SCSI_DC390T is not set
@@ -627,12 +646,14 @@ CONFIG_8139TOO=y
627# CONFIG_DL2K is not set 646# CONFIG_DL2K is not set
628CONFIG_E1000=y 647CONFIG_E1000=y
629# CONFIG_E1000_NAPI is not set 648# CONFIG_E1000_NAPI is not set
649# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
630# CONFIG_NS83820 is not set 650# CONFIG_NS83820 is not set
631# CONFIG_HAMACHI is not set 651# CONFIG_HAMACHI is not set
632# CONFIG_YELLOWFIN is not set 652# CONFIG_YELLOWFIN is not set
633# CONFIG_R8169 is not set 653# CONFIG_R8169 is not set
634# CONFIG_SIS190 is not set 654# CONFIG_SIS190 is not set
635# CONFIG_SKGE is not set 655# CONFIG_SKGE is not set
656# CONFIG_SKY2 is not set
636# CONFIG_SK98LIN is not set 657# CONFIG_SK98LIN is not set
637# CONFIG_VIA_VELOCITY is not set 658# CONFIG_VIA_VELOCITY is not set
638CONFIG_TIGON3=y 659CONFIG_TIGON3=y
@@ -645,7 +666,6 @@ CONFIG_TIGON3=y
645# CONFIG_IXGB is not set 666# CONFIG_IXGB is not set
646CONFIG_S2IO=m 667CONFIG_S2IO=m
647# CONFIG_S2IO_NAPI is not set 668# CONFIG_S2IO_NAPI is not set
648# CONFIG_2BUFF_MODE is not set
649 669
650# 670#
651# Token Ring devices 671# Token Ring devices
@@ -744,6 +764,7 @@ CONFIG_SERIAL_8250=y
744CONFIG_SERIAL_8250_CONSOLE=y 764CONFIG_SERIAL_8250_CONSOLE=y
745# CONFIG_SERIAL_8250_ACPI is not set 765# CONFIG_SERIAL_8250_ACPI is not set
746CONFIG_SERIAL_8250_NR_UARTS=4 766CONFIG_SERIAL_8250_NR_UARTS=4
767CONFIG_SERIAL_8250_RUNTIME_UARTS=4
747# CONFIG_SERIAL_8250_EXTENDED is not set 768# CONFIG_SERIAL_8250_EXTENDED is not set
748 769
749# 770#
@@ -751,7 +772,6 @@ CONFIG_SERIAL_8250_NR_UARTS=4
751# 772#
752CONFIG_SERIAL_CORE=y 773CONFIG_SERIAL_CORE=y
753CONFIG_SERIAL_CORE_CONSOLE=y 774CONFIG_SERIAL_CORE_CONSOLE=y
754# CONFIG_SERIAL_JSM is not set
755CONFIG_UNIX98_PTYS=y 775CONFIG_UNIX98_PTYS=y
756CONFIG_LEGACY_PTYS=y 776CONFIG_LEGACY_PTYS=y
757CONFIG_LEGACY_PTY_COUNT=256 777CONFIG_LEGACY_PTY_COUNT=256
@@ -790,6 +810,7 @@ CONFIG_SOFT_WATCHDOG=y
790# CONFIG_W83877F_WDT is not set 810# CONFIG_W83877F_WDT is not set
791# CONFIG_W83977F_WDT is not set 811# CONFIG_W83977F_WDT is not set
792# CONFIG_MACHZ_WDT is not set 812# CONFIG_MACHZ_WDT is not set
813# CONFIG_SBC_EPX_C3_WATCHDOG is not set
793 814
794# 815#
795# PCI-based Watchdog Cards 816# PCI-based Watchdog Cards
@@ -817,10 +838,10 @@ CONFIG_AGP_INTEL=y
817# CONFIG_DRM is not set 838# CONFIG_DRM is not set
818# CONFIG_MWAVE is not set 839# CONFIG_MWAVE is not set
819CONFIG_RAW_DRIVER=y 840CONFIG_RAW_DRIVER=y
841CONFIG_MAX_RAW_DEVS=256
820CONFIG_HPET=y 842CONFIG_HPET=y
821# CONFIG_HPET_RTC_IRQ is not set 843# CONFIG_HPET_RTC_IRQ is not set
822CONFIG_HPET_MMAP=y 844CONFIG_HPET_MMAP=y
823CONFIG_MAX_RAW_DEVS=256
824# CONFIG_HANGCHECK_TIMER is not set 845# CONFIG_HANGCHECK_TIMER is not set
825 846
826# 847#
@@ -835,6 +856,12 @@ CONFIG_MAX_RAW_DEVS=256
835# CONFIG_I2C is not set 856# CONFIG_I2C is not set
836 857
837# 858#
859# SPI support
860#
861# CONFIG_SPI is not set
862# CONFIG_SPI_MASTER is not set
863
864#
838# Dallas's 1-wire bus 865# Dallas's 1-wire bus
839# 866#
840# CONFIG_W1 is not set 867# CONFIG_W1 is not set
@@ -892,6 +919,7 @@ CONFIG_SOUND=y
892# Open Sound System 919# Open Sound System
893# 920#
894CONFIG_SOUND_PRIME=y 921CONFIG_SOUND_PRIME=y
922CONFIG_OBSOLETE_OSS_DRIVER=y
895# CONFIG_SOUND_BT878 is not set 923# CONFIG_SOUND_BT878 is not set
896# CONFIG_SOUND_CMPCI is not set 924# CONFIG_SOUND_CMPCI is not set
897# CONFIG_SOUND_EMU10K1 is not set 925# CONFIG_SOUND_EMU10K1 is not set
@@ -968,13 +996,15 @@ CONFIG_USB_STORAGE=y
968# CONFIG_USB_STORAGE_SDDR09 is not set 996# CONFIG_USB_STORAGE_SDDR09 is not set
969# CONFIG_USB_STORAGE_SDDR55 is not set 997# CONFIG_USB_STORAGE_SDDR55 is not set
970# CONFIG_USB_STORAGE_JUMPSHOT is not set 998# CONFIG_USB_STORAGE_JUMPSHOT is not set
971# CONFIG_USB_STORAGE_ONETOUCH is not set 999# CONFIG_USB_STORAGE_ALAUDA is not set
1000# CONFIG_USB_LIBUSUAL is not set
972 1001
973# 1002#
974# USB Input Devices 1003# USB Input Devices
975# 1004#
976CONFIG_USB_HID=y 1005CONFIG_USB_HID=y
977CONFIG_USB_HIDINPUT=y 1006CONFIG_USB_HIDINPUT=y
1007# CONFIG_USB_HIDINPUT_POWERBOOK is not set
978# CONFIG_HID_FF is not set 1008# CONFIG_HID_FF is not set
979# CONFIG_USB_HIDDEV is not set 1009# CONFIG_USB_HIDDEV is not set
980# CONFIG_USB_AIPTEK is not set 1010# CONFIG_USB_AIPTEK is not set
@@ -988,6 +1018,7 @@ CONFIG_USB_HIDINPUT=y
988# CONFIG_USB_YEALINK is not set 1018# CONFIG_USB_YEALINK is not set
989# CONFIG_USB_XPAD is not set 1019# CONFIG_USB_XPAD is not set
990# CONFIG_USB_ATI_REMOTE is not set 1020# CONFIG_USB_ATI_REMOTE is not set
1021# CONFIG_USB_ATI_REMOTE2 is not set
991# CONFIG_USB_KEYSPAN_REMOTE is not set 1022# CONFIG_USB_KEYSPAN_REMOTE is not set
992# CONFIG_USB_APPLETOUCH is not set 1023# CONFIG_USB_APPLETOUCH is not set
993 1024
@@ -1097,6 +1128,7 @@ CONFIG_REISERFS_FS_POSIX_ACL=y
1097# CONFIG_JFS_FS is not set 1128# CONFIG_JFS_FS is not set
1098CONFIG_FS_POSIX_ACL=y 1129CONFIG_FS_POSIX_ACL=y
1099# CONFIG_XFS_FS is not set 1130# CONFIG_XFS_FS is not set
1131# CONFIG_OCFS2_FS is not set
1100# CONFIG_MINIX_FS is not set 1132# CONFIG_MINIX_FS is not set
1101# CONFIG_ROMFS_FS is not set 1133# CONFIG_ROMFS_FS is not set
1102CONFIG_INOTIFY=y 1134CONFIG_INOTIFY=y
@@ -1135,6 +1167,7 @@ CONFIG_HUGETLBFS=y
1135CONFIG_HUGETLB_PAGE=y 1167CONFIG_HUGETLB_PAGE=y
1136CONFIG_RAMFS=y 1168CONFIG_RAMFS=y
1137CONFIG_RELAYFS_FS=y 1169CONFIG_RELAYFS_FS=y
1170# CONFIG_CONFIGFS_FS is not set
1138 1171
1139# 1172#
1140# Miscellaneous filesystems 1173# Miscellaneous filesystems
@@ -1232,21 +1265,23 @@ CONFIG_NLS_ISO8859_15=y
1232CONFIG_NLS_UTF8=y 1265CONFIG_NLS_UTF8=y
1233 1266
1234# 1267#
1235# Profiling support 1268# Instrumentation Support
1236# 1269#
1237CONFIG_PROFILING=y 1270CONFIG_PROFILING=y
1238CONFIG_OPROFILE=y 1271CONFIG_OPROFILE=y
1272CONFIG_KPROBES=y
1239 1273
1240# 1274#
1241# Kernel hacking 1275# Kernel hacking
1242# 1276#
1243# CONFIG_PRINTK_TIME is not set 1277# CONFIG_PRINTK_TIME is not set
1244CONFIG_DEBUG_KERNEL=y
1245CONFIG_MAGIC_SYSRQ=y 1278CONFIG_MAGIC_SYSRQ=y
1279CONFIG_DEBUG_KERNEL=y
1246CONFIG_LOG_BUF_SHIFT=18 1280CONFIG_LOG_BUF_SHIFT=18
1247CONFIG_DETECT_SOFTLOCKUP=y 1281CONFIG_DETECT_SOFTLOCKUP=y
1248# CONFIG_SCHEDSTATS is not set 1282# CONFIG_SCHEDSTATS is not set
1249# CONFIG_DEBUG_SLAB is not set 1283# CONFIG_DEBUG_SLAB is not set
1284# CONFIG_DEBUG_MUTEXES is not set
1250# CONFIG_DEBUG_SPINLOCK is not set 1285# CONFIG_DEBUG_SPINLOCK is not set
1251# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 1286# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1252# CONFIG_DEBUG_KOBJECT is not set 1287# CONFIG_DEBUG_KOBJECT is not set
@@ -1254,10 +1289,11 @@ CONFIG_DETECT_SOFTLOCKUP=y
1254CONFIG_DEBUG_FS=y 1289CONFIG_DEBUG_FS=y
1255# CONFIG_DEBUG_VM is not set 1290# CONFIG_DEBUG_VM is not set
1256# CONFIG_FRAME_POINTER is not set 1291# CONFIG_FRAME_POINTER is not set
1292# CONFIG_FORCED_INLINING is not set
1257# CONFIG_RCU_TORTURE_TEST is not set 1293# CONFIG_RCU_TORTURE_TEST is not set
1258CONFIG_INIT_DEBUG=y 1294CONFIG_INIT_DEBUG=y
1295# CONFIG_DEBUG_RODATA is not set
1259# CONFIG_IOMMU_DEBUG is not set 1296# CONFIG_IOMMU_DEBUG is not set
1260CONFIG_KPROBES=y
1261 1297
1262# 1298#
1263# Security options 1299# Security options
diff --git a/arch/x86_64/ia32/Makefile b/arch/x86_64/ia32/Makefile
index f76217d8f579..929e6b0771f8 100644
--- a/arch/x86_64/ia32/Makefile
+++ b/arch/x86_64/ia32/Makefile
@@ -2,9 +2,9 @@
2# Makefile for the ia32 kernel emulation subsystem. 2# Makefile for the ia32 kernel emulation subsystem.
3# 3#
4 4
5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_ioctl.o \ 5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_signal.o tls32.o \
6 ia32_signal.o tls32.o \ 6 ia32_binfmt.o fpu32.o ptrace32.o syscall32.o syscall32_syscall.o \
7 ia32_binfmt.o fpu32.o ptrace32.o syscall32.o syscall32_syscall.o 7 mmap32.o
8 8
9sysv-$(CONFIG_SYSVIPC) := ipc32.o 9sysv-$(CONFIG_SYSVIPC) := ipc32.o
10obj-$(CONFIG_IA32_EMULATION) += $(sysv-y) 10obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
@@ -29,4 +29,3 @@ $(obj)/vsyscall-%.so: $(src)/vsyscall.lds $(obj)/vsyscall-%.o FORCE
29 29
30AFLAGS_vsyscall-sysenter.o = -m32 30AFLAGS_vsyscall-sysenter.o = -m32
31AFLAGS_vsyscall-syscall.o = -m32 31AFLAGS_vsyscall-syscall.o = -m32
32CFLAGS_ia32_ioctl.o += -Ifs/
diff --git a/arch/x86_64/ia32/ia32_binfmt.c b/arch/x86_64/ia32/ia32_binfmt.c
index 830feb272eca..572b3b28772d 100644
--- a/arch/x86_64/ia32/ia32_binfmt.c
+++ b/arch/x86_64/ia32/ia32_binfmt.c
@@ -197,8 +197,7 @@ static inline void elf_core_copy_regs(elf_gregset_t *elfregs, struct pt_regs *re
197 197
198static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs) 198static inline int elf_core_copy_task_regs(struct task_struct *t, elf_gregset_t* elfregs)
199{ 199{
200 struct pt_regs *pp = (struct pt_regs *)(t->thread.rsp0); 200 struct pt_regs *pp = task_pt_regs(t);
201 --pp;
202 ELF_CORE_COPY_REGS((*elfregs), pp); 201 ELF_CORE_COPY_REGS((*elfregs), pp);
203 /* fix wrong segments */ 202 /* fix wrong segments */
204 (*elfregs)[7] = t->thread.ds; 203 (*elfregs)[7] = t->thread.ds;
@@ -217,8 +216,7 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
217 if (!tsk_used_math(tsk)) 216 if (!tsk_used_math(tsk))
218 return 0; 217 return 0;
219 if (!regs) 218 if (!regs)
220 regs = (struct pt_regs *)tsk->thread.rsp0; 219 regs = task_pt_regs(tsk);
221 --regs;
222 if (tsk == current) 220 if (tsk == current)
223 unlazy_fpu(tsk); 221 unlazy_fpu(tsk);
224 set_fs(KERNEL_DS); 222 set_fs(KERNEL_DS);
@@ -234,7 +232,7 @@ elf_core_copy_task_fpregs(struct task_struct *tsk, struct pt_regs *regs, elf_fpr
234static inline int 232static inline int
235elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu) 233elf_core_copy_task_xfpregs(struct task_struct *t, elf_fpxregset_t *xfpu)
236{ 234{
237 struct pt_regs *regs = ((struct pt_regs *)(t->thread.rsp0))-1; 235 struct pt_regs *regs = task_pt_regs(t);
238 if (!tsk_used_math(t)) 236 if (!tsk_used_math(t))
239 return 0; 237 return 0;
240 if (t == current) 238 if (t == current)
@@ -295,8 +293,6 @@ int ia32_setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top, int
295} while(0) 293} while(0)
296 294
297 295
298#define elf_map elf32_map
299
300#include <linux/module.h> 296#include <linux/module.h>
301 297
302MODULE_DESCRIPTION("Binary format loader for compatibility with IA32 ELF binaries."); 298MODULE_DESCRIPTION("Binary format loader for compatibility with IA32 ELF binaries.");
@@ -392,21 +388,6 @@ int ia32_setup_arg_pages(struct linux_binprm *bprm, unsigned long stack_top,
392} 388}
393EXPORT_SYMBOL(ia32_setup_arg_pages); 389EXPORT_SYMBOL(ia32_setup_arg_pages);
394 390
395static unsigned long
396elf32_map (struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type)
397{
398 unsigned long map_addr;
399 struct task_struct *me = current;
400
401 down_write(&me->mm->mmap_sem);
402 map_addr = do_mmap(filep, ELF_PAGESTART(addr),
403 eppnt->p_filesz + ELF_PAGEOFFSET(eppnt->p_vaddr), prot,
404 type,
405 eppnt->p_offset - ELF_PAGEOFFSET(eppnt->p_vaddr));
406 up_write(&me->mm->mmap_sem);
407 return(map_addr);
408}
409
410#ifdef CONFIG_SYSCTL 391#ifdef CONFIG_SYSCTL
411/* Register vsyscall32 into the ABI table */ 392/* Register vsyscall32 into the ABI table */
412#include <linux/sysctl.h> 393#include <linux/sysctl.h>
diff --git a/arch/x86_64/ia32/ia32_ioctl.c b/arch/x86_64/ia32/ia32_ioctl.c
deleted file mode 100644
index e335bd0b637d..000000000000
--- a/arch/x86_64/ia32/ia32_ioctl.c
+++ /dev/null
@@ -1,79 +0,0 @@
1/* $Id: ia32_ioctl.c,v 1.25 2002/10/11 07:17:06 ak Exp $
2 * ioctl32.c: Conversion between 32bit and 64bit native ioctls.
3 *
4 * Copyright (C) 1997-2000 Jakub Jelinek (jakub@redhat.com)
5 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be)
6 * Copyright (C) 2001,2002 Andi Kleen, SuSE Labs
7 *
8 * These routines maintain argument size conversion between 32bit and 64bit
9 * ioctls.
10 */
11
12#define INCLUDES
13#include <linux/syscalls.h>
14#include "compat_ioctl.c"
15#include <asm/ia32.h>
16
17#define CODE
18#include "compat_ioctl.c"
19
20#define RTC_IRQP_READ32 _IOR('p', 0x0b, unsigned int) /* Read IRQ rate */
21#define RTC_IRQP_SET32 _IOW('p', 0x0c, unsigned int) /* Set IRQ rate */
22#define RTC_EPOCH_READ32 _IOR('p', 0x0d, unsigned) /* Read epoch */
23#define RTC_EPOCH_SET32 _IOW('p', 0x0e, unsigned) /* Set epoch */
24
25static int rtc32_ioctl(unsigned fd, unsigned cmd, unsigned long arg)
26{
27 unsigned long val;
28 mm_segment_t oldfs = get_fs();
29 int ret;
30
31 switch (cmd) {
32 case RTC_IRQP_READ32:
33 set_fs(KERNEL_DS);
34 ret = sys_ioctl(fd, RTC_IRQP_READ, (unsigned long)&val);
35 set_fs(oldfs);
36 if (!ret)
37 ret = put_user(val, (unsigned int __user *) arg);
38 return ret;
39
40 case RTC_IRQP_SET32:
41 cmd = RTC_IRQP_SET;
42 break;
43
44 case RTC_EPOCH_READ32:
45 set_fs(KERNEL_DS);
46 ret = sys_ioctl(fd, RTC_EPOCH_READ, (unsigned long) &val);
47 set_fs(oldfs);
48 if (!ret)
49 ret = put_user(val, (unsigned int __user *) arg);
50 return ret;
51
52 case RTC_EPOCH_SET32:
53 cmd = RTC_EPOCH_SET;
54 break;
55 }
56 return sys_ioctl(fd,cmd,arg);
57}
58
59
60#define HANDLE_IOCTL(cmd,handler) { (cmd), (ioctl_trans_handler_t)(handler) },
61#define COMPATIBLE_IOCTL(cmd) HANDLE_IOCTL(cmd,sys_ioctl)
62
63struct ioctl_trans ioctl_start[] = {
64#include <linux/compat_ioctl.h>
65#define DECLARES
66#include "compat_ioctl.c"
67
68/* And these ioctls need translation */
69/* realtime device */
70HANDLE_IOCTL(RTC_IRQP_READ, rtc32_ioctl)
71HANDLE_IOCTL(RTC_IRQP_READ32,rtc32_ioctl)
72HANDLE_IOCTL(RTC_IRQP_SET32, rtc32_ioctl)
73HANDLE_IOCTL(RTC_EPOCH_READ32, rtc32_ioctl)
74HANDLE_IOCTL(RTC_EPOCH_SET32, rtc32_ioctl)
75/* take care of sizeof(sizeof()) breakage */
76};
77
78int ioctl_table_size = ARRAY_SIZE(ioctl_start);
79
diff --git a/arch/x86_64/ia32/ia32_signal.c b/arch/x86_64/ia32/ia32_signal.c
index 0903cc1faef2..e0a92439f634 100644
--- a/arch/x86_64/ia32/ia32_signal.c
+++ b/arch/x86_64/ia32/ia32_signal.c
@@ -353,7 +353,6 @@ ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __
353 struct pt_regs *regs, unsigned int mask) 353 struct pt_regs *regs, unsigned int mask)
354{ 354{
355 int tmp, err = 0; 355 int tmp, err = 0;
356 u32 eflags;
357 356
358 tmp = 0; 357 tmp = 0;
359 __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp)); 358 __asm__("movl %%gs,%0" : "=r"(tmp): "0"(tmp));
@@ -378,10 +377,7 @@ ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, struct _fpstate_ia32 __
378 err |= __put_user(current->thread.trap_no, &sc->trapno); 377 err |= __put_user(current->thread.trap_no, &sc->trapno);
379 err |= __put_user(current->thread.error_code, &sc->err); 378 err |= __put_user(current->thread.error_code, &sc->err);
380 err |= __put_user((u32)regs->rip, &sc->eip); 379 err |= __put_user((u32)regs->rip, &sc->eip);
381 eflags = regs->eflags; 380 err |= __put_user((u32)regs->eflags, &sc->eflags);
382 if (current->ptrace & PT_PTRACED)
383 eflags &= ~TF_MASK;
384 err |= __put_user((u32)eflags, &sc->eflags);
385 err |= __put_user((u32)regs->rsp, &sc->esp_at_signal); 381 err |= __put_user((u32)regs->rsp, &sc->esp_at_signal);
386 382
387 tmp = save_i387_ia32(current, fpstate, regs, 0); 383 tmp = save_i387_ia32(current, fpstate, regs, 0);
@@ -505,13 +501,9 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
505 regs->ss = __USER32_DS; 501 regs->ss = __USER32_DS;
506 502
507 set_fs(USER_DS); 503 set_fs(USER_DS);
508 if (regs->eflags & TF_MASK) { 504 regs->eflags &= ~TF_MASK;
509 if (current->ptrace & PT_PTRACED) { 505 if (test_thread_flag(TIF_SINGLESTEP))
510 ptrace_notify(SIGTRAP); 506 ptrace_notify(SIGTRAP);
511 } else {
512 regs->eflags &= ~TF_MASK;
513 }
514 }
515 507
516#if DEBUG_SIG 508#if DEBUG_SIG
517 printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", 509 printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
@@ -605,13 +597,9 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
605 regs->ss = __USER32_DS; 597 regs->ss = __USER32_DS;
606 598
607 set_fs(USER_DS); 599 set_fs(USER_DS);
608 if (regs->eflags & TF_MASK) { 600 regs->eflags &= ~TF_MASK;
609 if (current->ptrace & PT_PTRACED) { 601 if (test_thread_flag(TIF_SINGLESTEP))
610 ptrace_notify(SIGTRAP); 602 ptrace_notify(SIGTRAP);
611 } else {
612 regs->eflags &= ~TF_MASK;
613 }
614 }
615 603
616#if DEBUG_SIG 604#if DEBUG_SIG
617 printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n", 605 printk("SIG deliver (%s:%d): sp=%p pc=%p ra=%p\n",
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index e0eb0c712fe9..f05c2a802489 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -35,6 +35,18 @@
35 movq %rax,R8(%rsp) 35 movq %rax,R8(%rsp)
36 .endm 36 .endm
37 37
38 .macro CFI_STARTPROC32 simple
39 CFI_STARTPROC \simple
40 CFI_UNDEFINED r8
41 CFI_UNDEFINED r9
42 CFI_UNDEFINED r10
43 CFI_UNDEFINED r11
44 CFI_UNDEFINED r12
45 CFI_UNDEFINED r13
46 CFI_UNDEFINED r14
47 CFI_UNDEFINED r15
48 .endm
49
38/* 50/*
39 * 32bit SYSENTER instruction entry. 51 * 32bit SYSENTER instruction entry.
40 * 52 *
@@ -55,7 +67,7 @@
55 * with the int 0x80 path. 67 * with the int 0x80 path.
56 */ 68 */
57ENTRY(ia32_sysenter_target) 69ENTRY(ia32_sysenter_target)
58 CFI_STARTPROC simple 70 CFI_STARTPROC32 simple
59 CFI_DEF_CFA rsp,0 71 CFI_DEF_CFA rsp,0
60 CFI_REGISTER rsp,rbp 72 CFI_REGISTER rsp,rbp
61 swapgs 73 swapgs
@@ -92,6 +104,7 @@ ENTRY(ia32_sysenter_target)
92 .quad 1b,ia32_badarg 104 .quad 1b,ia32_badarg
93 .previous 105 .previous
94 GET_THREAD_INFO(%r10) 106 GET_THREAD_INFO(%r10)
107 orl $TS_COMPAT,threadinfo_status(%r10)
95 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) 108 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
96 CFI_REMEMBER_STATE 109 CFI_REMEMBER_STATE
97 jnz sysenter_tracesys 110 jnz sysenter_tracesys
@@ -105,6 +118,7 @@ sysenter_do_call:
105 cli 118 cli
106 testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10) 119 testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10)
107 jnz int_ret_from_sys_call 120 jnz int_ret_from_sys_call
121 andl $~TS_COMPAT,threadinfo_status(%r10)
108 /* clear IF, that popfq doesn't enable interrupts early */ 122 /* clear IF, that popfq doesn't enable interrupts early */
109 andl $~0x200,EFLAGS-R11(%rsp) 123 andl $~0x200,EFLAGS-R11(%rsp)
110 RESTORE_ARGS 1,24,1,1,1,1 124 RESTORE_ARGS 1,24,1,1,1,1
@@ -161,7 +175,7 @@ sysenter_tracesys:
161 * with the int 0x80 path. 175 * with the int 0x80 path.
162 */ 176 */
163ENTRY(ia32_cstar_target) 177ENTRY(ia32_cstar_target)
164 CFI_STARTPROC simple 178 CFI_STARTPROC32 simple
165 CFI_DEF_CFA rsp,0 179 CFI_DEF_CFA rsp,0
166 CFI_REGISTER rip,rcx 180 CFI_REGISTER rip,rcx
167 /*CFI_REGISTER rflags,r11*/ 181 /*CFI_REGISTER rflags,r11*/
@@ -191,6 +205,7 @@ ENTRY(ia32_cstar_target)
191 .quad 1b,ia32_badarg 205 .quad 1b,ia32_badarg
192 .previous 206 .previous
193 GET_THREAD_INFO(%r10) 207 GET_THREAD_INFO(%r10)
208 orl $TS_COMPAT,threadinfo_status(%r10)
194 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) 209 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
195 CFI_REMEMBER_STATE 210 CFI_REMEMBER_STATE
196 jnz cstar_tracesys 211 jnz cstar_tracesys
@@ -204,6 +219,7 @@ cstar_do_call:
204 cli 219 cli
205 testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10) 220 testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10)
206 jnz int_ret_from_sys_call 221 jnz int_ret_from_sys_call
222 andl $~TS_COMPAT,threadinfo_status(%r10)
207 RESTORE_ARGS 1,-ARG_SKIP,1,1,1 223 RESTORE_ARGS 1,-ARG_SKIP,1,1,1
208 movl RIP-ARGOFFSET(%rsp),%ecx 224 movl RIP-ARGOFFSET(%rsp),%ecx
209 CFI_REGISTER rip,rcx 225 CFI_REGISTER rip,rcx
@@ -276,6 +292,7 @@ ENTRY(ia32_syscall)
276 this could be a problem. */ 292 this could be a problem. */
277 SAVE_ARGS 0,0,1 293 SAVE_ARGS 0,0,1
278 GET_THREAD_INFO(%r10) 294 GET_THREAD_INFO(%r10)
295 orl $TS_COMPAT,threadinfo_status(%r10)
279 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10) 296 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%r10)
280 jnz ia32_tracesys 297 jnz ia32_tracesys
281ia32_do_syscall: 298ia32_do_syscall:
@@ -318,7 +335,7 @@ quiet_ni_syscall:
318 jmp ia32_ptregs_common 335 jmp ia32_ptregs_common
319 .endm 336 .endm
320 337
321 CFI_STARTPROC 338 CFI_STARTPROC32
322 339
323 PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi 340 PTREGSCALL stub32_rt_sigreturn, sys32_rt_sigreturn, %rdi
324 PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi 341 PTREGSCALL stub32_sigreturn, sys32_sigreturn, %rdi
@@ -333,15 +350,26 @@ quiet_ni_syscall:
333 350
334ENTRY(ia32_ptregs_common) 351ENTRY(ia32_ptregs_common)
335 popq %r11 352 popq %r11
336 CFI_ADJUST_CFA_OFFSET -8 353 CFI_ENDPROC
337 CFI_REGISTER rip, r11 354 CFI_STARTPROC32 simple
355 CFI_DEF_CFA rsp,SS+8-ARGOFFSET
356 CFI_REL_OFFSET rax,RAX-ARGOFFSET
357 CFI_REL_OFFSET rcx,RCX-ARGOFFSET
358 CFI_REL_OFFSET rdx,RDX-ARGOFFSET
359 CFI_REL_OFFSET rsi,RSI-ARGOFFSET
360 CFI_REL_OFFSET rdi,RDI-ARGOFFSET
361 CFI_REL_OFFSET rip,RIP-ARGOFFSET
362/* CFI_REL_OFFSET cs,CS-ARGOFFSET*/
363/* CFI_REL_OFFSET rflags,EFLAGS-ARGOFFSET*/
364 CFI_REL_OFFSET rsp,RSP-ARGOFFSET
365/* CFI_REL_OFFSET ss,SS-ARGOFFSET*/
338 SAVE_REST 366 SAVE_REST
339 call *%rax 367 call *%rax
340 RESTORE_REST 368 RESTORE_REST
341 jmp ia32_sysret /* misbalances the return cache */ 369 jmp ia32_sysret /* misbalances the return cache */
342 CFI_ENDPROC 370 CFI_ENDPROC
343 371
344 .data 372 .section .rodata,"a"
345 .align 8 373 .align 8
346 .globl ia32_sys_call_table 374 .globl ia32_sys_call_table
347ia32_sys_call_table: 375ia32_sys_call_table:
@@ -608,7 +636,7 @@ ia32_sys_call_table:
608 .quad sys_epoll_wait 636 .quad sys_epoll_wait
609 .quad sys_remap_file_pages 637 .quad sys_remap_file_pages
610 .quad sys_set_tid_address 638 .quad sys_set_tid_address
611 .quad sys32_timer_create 639 .quad compat_sys_timer_create
612 .quad compat_sys_timer_settime /* 260 */ 640 .quad compat_sys_timer_settime /* 260 */
613 .quad compat_sys_timer_gettime 641 .quad compat_sys_timer_gettime
614 .quad sys_timer_getoverrun 642 .quad sys_timer_getoverrun
@@ -643,6 +671,20 @@ ia32_sys_call_table:
643 .quad sys_inotify_init 671 .quad sys_inotify_init
644 .quad sys_inotify_add_watch 672 .quad sys_inotify_add_watch
645 .quad sys_inotify_rm_watch 673 .quad sys_inotify_rm_watch
674 .quad sys_migrate_pages
675 .quad compat_sys_openat /* 295 */
676 .quad sys_mkdirat
677 .quad sys_mknodat
678 .quad sys_fchownat
679 .quad sys_futimesat
680 .quad compat_sys_newfstatat /* 300 */
681 .quad sys_unlinkat
682 .quad sys_renameat
683 .quad sys_linkat
684 .quad sys_symlinkat
685 .quad sys_readlinkat /* 305 */
686 .quad sys_fchmodat
687 .quad sys_faccessat
646ia32_syscall_end: 688ia32_syscall_end:
647 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8 689 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
648 .quad ni_syscall 690 .quad ni_syscall
diff --git a/arch/x86_64/ia32/mmap32.c b/arch/x86_64/ia32/mmap32.c
new file mode 100644
index 000000000000..079f4132575c
--- /dev/null
+++ b/arch/x86_64/ia32/mmap32.c
@@ -0,0 +1,78 @@
1/*
2 * linux/arch/x86_64/ia32/mm/mmap.c
3 *
4 * flexible mmap layout support
5 *
6 * Based on the i386 version which was
7 *
8 * Copyright 2003-2004 Red Hat Inc., Durham, North Carolina.
9 * All Rights Reserved.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 *
26 * Started by Ingo Molnar <mingo@elte.hu>
27 */
28
29#include <linux/personality.h>
30#include <linux/mm.h>
31#include <linux/random.h>
32
33/*
34 * Top of mmap area (just below the process stack).
35 *
36 * Leave an at least ~128 MB hole.
37 */
38#define MIN_GAP (128*1024*1024)
39#define MAX_GAP (TASK_SIZE/6*5)
40
41static inline unsigned long mmap_base(struct mm_struct *mm)
42{
43 unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
44 unsigned long random_factor = 0;
45
46 if (current->flags & PF_RANDOMIZE)
47 random_factor = get_random_int() % (1024*1024);
48
49 if (gap < MIN_GAP)
50 gap = MIN_GAP;
51 else if (gap > MAX_GAP)
52 gap = MAX_GAP;
53
54 return PAGE_ALIGN(TASK_SIZE - gap - random_factor);
55}
56
57/*
58 * This function, called very early during the creation of a new
59 * process VM image, sets up which VM layout function to use:
60 */
61void ia32_pick_mmap_layout(struct mm_struct *mm)
62{
63 /*
64 * Fall back to the standard layout if the personality
65 * bit is set, or if the expected stack growth is unlimited:
66 */
67 if (sysctl_legacy_va_layout ||
68 (current->personality & ADDR_COMPAT_LAYOUT) ||
69 current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY) {
70 mm->mmap_base = TASK_UNMAPPED_BASE;
71 mm->get_unmapped_area = arch_get_unmapped_area;
72 mm->unmap_area = arch_unmap_area;
73 } else {
74 mm->mmap_base = mmap_base(mm);
75 mm->get_unmapped_area = arch_get_unmapped_area_topdown;
76 mm->unmap_area = arch_unmap_area_topdown;
77 }
78}
diff --git a/arch/x86_64/ia32/ptrace32.c b/arch/x86_64/ia32/ptrace32.c
index 2a925e2af390..23a4515a73b4 100644
--- a/arch/x86_64/ia32/ptrace32.c
+++ b/arch/x86_64/ia32/ptrace32.c
@@ -28,9 +28,12 @@
28#include <asm/i387.h> 28#include <asm/i387.h>
29#include <asm/fpu32.h> 29#include <asm/fpu32.h>
30 30
31/* determines which flags the user has access to. */ 31/*
32/* 1 = access 0 = no access */ 32 * Determines which flags the user has access to [1 = access, 0 = no access].
33#define FLAG_MASK 0x44dd5UL 33 * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9).
34 * Also masks reserved bits (31-22, 15, 5, 3, 1).
35 */
36#define FLAG_MASK 0x54dd5UL
34 37
35#define R32(l,q) \ 38#define R32(l,q) \
36 case offsetof(struct user32, regs.l): stack[offsetof(struct pt_regs, q)/8] = val; break 39 case offsetof(struct user32, regs.l): stack[offsetof(struct pt_regs, q)/8] = val; break
@@ -38,7 +41,7 @@
38static int putreg32(struct task_struct *child, unsigned regno, u32 val) 41static int putreg32(struct task_struct *child, unsigned regno, u32 val)
39{ 42{
40 int i; 43 int i;
41 __u64 *stack = (__u64 *)(child->thread.rsp0 - sizeof(struct pt_regs)); 44 __u64 *stack = (__u64 *)task_pt_regs(child);
42 45
43 switch (regno) { 46 switch (regno) {
44 case offsetof(struct user32, regs.fs): 47 case offsetof(struct user32, regs.fs):
@@ -134,7 +137,7 @@ static int putreg32(struct task_struct *child, unsigned regno, u32 val)
134 137
135static int getreg32(struct task_struct *child, unsigned regno, u32 *val) 138static int getreg32(struct task_struct *child, unsigned regno, u32 *val)
136{ 139{
137 __u64 *stack = (__u64 *)(child->thread.rsp0 - sizeof(struct pt_regs)); 140 __u64 *stack = (__u64 *)task_pt_regs(child);
138 141
139 switch (regno) { 142 switch (regno) {
140 case offsetof(struct user32, regs.fs): 143 case offsetof(struct user32, regs.fs):
@@ -196,36 +199,6 @@ static int getreg32(struct task_struct *child, unsigned regno, u32 *val)
196 199
197#undef R32 200#undef R32
198 201
199static struct task_struct *find_target(int request, int pid, int *err)
200{
201 struct task_struct *child;
202
203 *err = -EPERM;
204 if (pid == 1)
205 return NULL;
206
207 *err = -ESRCH;
208 read_lock(&tasklist_lock);
209 child = find_task_by_pid(pid);
210 if (child)
211 get_task_struct(child);
212 read_unlock(&tasklist_lock);
213 if (child) {
214 *err = -EPERM;
215 if (child->pid == 1)
216 goto out;
217 *err = ptrace_check_attach(child, request == PTRACE_KILL);
218 if (*err < 0)
219 goto out;
220 return child;
221 }
222 out:
223 if (child)
224 put_task_struct(child);
225 return NULL;
226
227}
228
229asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data) 202asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
230{ 203{
231 struct task_struct *child; 204 struct task_struct *child;
@@ -254,11 +227,18 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
254 break; 227 break;
255 } 228 }
256 229
257 child = find_target(request, pid, &ret); 230 if (request == PTRACE_TRACEME)
258 if (!child) 231 return ptrace_traceme();
259 return ret; 232
233 child = ptrace_get_task_struct(pid);
234 if (IS_ERR(child))
235 return PTR_ERR(child);
260 236
261 childregs = (struct pt_regs *)(child->thread.rsp0 - sizeof(struct pt_regs)); 237 ret = ptrace_check_attach(child, request == PTRACE_KILL);
238 if (ret < 0)
239 goto out;
240
241 childregs = task_pt_regs(child);
262 242
263 switch (request) { 243 switch (request) {
264 case PTRACE_PEEKDATA: 244 case PTRACE_PEEKDATA:
@@ -373,6 +353,7 @@ asmlinkage long sys32_ptrace(long request, u32 pid, u32 addr, u32 data)
373 break; 353 break;
374 } 354 }
375 355
356 out:
376 put_task_struct(child); 357 put_task_struct(child);
377 return ret; 358 return ret;
378} 359}
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index 5389df610e78..54481af5344a 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -969,25 +969,6 @@ long sys32_kill(int pid, int sig)
969 return sys_kill(pid, sig); 969 return sys_kill(pid, sig);
970} 970}
971 971
972extern asmlinkage long
973sys_timer_create(clockid_t which_clock,
974 struct sigevent __user *timer_event_spec,
975 timer_t __user * created_timer_id);
976
977long
978sys32_timer_create(u32 clock, struct compat_sigevent __user *se32, timer_t __user *timer_id)
979{
980 struct sigevent __user *p = NULL;
981 if (se32) {
982 struct sigevent se;
983 p = compat_alloc_user_space(sizeof(struct sigevent));
984 if (get_compat_sigevent(&se, se32) ||
985 copy_to_user(p, &se, sizeof(se)))
986 return -EFAULT;
987 }
988 return sys_timer_create(clock, p, timer_id);
989}
990
991long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high, 972long sys32_fadvise64_64(int fd, __u32 offset_low, __u32 offset_high,
992 __u32 len_low, __u32 len_high, int advice) 973 __u32 len_low, __u32 len_high, int advice)
993{ 974{
diff --git a/arch/x86_64/ia32/vsyscall-sigreturn.S b/arch/x86_64/ia32/vsyscall-sigreturn.S
index 8b5a4b060bb5..d90321fe9bba 100644
--- a/arch/x86_64/ia32/vsyscall-sigreturn.S
+++ b/arch/x86_64/ia32/vsyscall-sigreturn.S
@@ -7,6 +7,7 @@
7 * by doing ".balign 32" must match in both versions of the page. 7 * by doing ".balign 32" must match in both versions of the page.
8 */ 8 */
9 9
10 .code32
10 .section .text.sigreturn,"ax" 11 .section .text.sigreturn,"ax"
11 .balign 32 12 .balign 32
12 .globl __kernel_sigreturn 13 .globl __kernel_sigreturn
diff --git a/arch/x86_64/ia32/vsyscall-syscall.S b/arch/x86_64/ia32/vsyscall-syscall.S
index b024965bb689..cf9ef678de3e 100644
--- a/arch/x86_64/ia32/vsyscall-syscall.S
+++ b/arch/x86_64/ia32/vsyscall-syscall.S
@@ -6,6 +6,7 @@
6#include <asm/asm-offsets.h> 6#include <asm/asm-offsets.h>
7#include <asm/segment.h> 7#include <asm/segment.h>
8 8
9 .code32
9 .text 10 .text
10 .section .text.vsyscall,"ax" 11 .section .text.vsyscall,"ax"
11 .globl __kernel_vsyscall 12 .globl __kernel_vsyscall
diff --git a/arch/x86_64/ia32/vsyscall-sysenter.S b/arch/x86_64/ia32/vsyscall-sysenter.S
index 71f3de586b56..ae056e553d13 100644
--- a/arch/x86_64/ia32/vsyscall-sysenter.S
+++ b/arch/x86_64/ia32/vsyscall-sysenter.S
@@ -5,6 +5,7 @@
5#include <asm/ia32_unistd.h> 5#include <asm/ia32_unistd.h>
6#include <asm/asm-offsets.h> 6#include <asm/asm-offsets.h>
7 7
8 .code32
8 .text 9 .text
9 .section .text.vsyscall,"ax" 10 .section .text.vsyscall,"ax"
10 .globl __kernel_vsyscall 11 .globl __kernel_vsyscall
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index fe4cbd1c4b2f..72fe60c20d39 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -7,7 +7,8 @@ EXTRA_AFLAGS := -traditional
7obj-y := process.o signal.o entry.o traps.o irq.o \ 7obj-y := process.o signal.o entry.o traps.o irq.o \
8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \ 8 ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \
9 x8664_ksyms.o i387.o syscall.o vsyscall.o \ 9 x8664_ksyms.o i387.o syscall.o vsyscall.o \
10 setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o 10 setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \
11 dmi_scan.o pci-dma.o pci-nommu.o
11 12
12obj-$(CONFIG_X86_MCE) += mce.o 13obj-$(CONFIG_X86_MCE) += mce.o
13obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o 14obj-$(CONFIG_X86_MCE_INTEL) += mce_intel.o
@@ -22,14 +23,16 @@ obj-$(CONFIG_X86_LOCAL_APIC) += apic.o nmi.o
22obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o \ 23obj-$(CONFIG_X86_IO_APIC) += io_apic.o mpparse.o \
23 genapic.o genapic_cluster.o genapic_flat.o 24 genapic.o genapic_cluster.o genapic_flat.o
24obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o 25obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o crash.o
26obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
25obj-$(CONFIG_PM) += suspend.o 27obj-$(CONFIG_PM) += suspend.o
26obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend_asm.o 28obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend_asm.o
27obj-$(CONFIG_CPU_FREQ) += cpufreq/ 29obj-$(CONFIG_CPU_FREQ) += cpufreq/
28obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 30obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
29obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o 31obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o
30obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o pci-dma.o 32obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
31obj-$(CONFIG_KPROBES) += kprobes.o 33obj-$(CONFIG_KPROBES) += kprobes.o
32obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o 34obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o
35obj-$(CONFIG_X86_VSMP) += vsmp.o
33 36
34obj-$(CONFIG_MODULES) += module.o 37obj-$(CONFIG_MODULES) += module.o
35 38
@@ -46,3 +49,5 @@ intel_cacheinfo-y += ../../i386/kernel/cpu/intel_cacheinfo.o
46quirks-y += ../../i386/kernel/quirks.o 49quirks-y += ../../i386/kernel/quirks.o
47i8237-y += ../../i386/kernel/i8237.o 50i8237-y += ../../i386/kernel/i8237.o
48msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o 51msr-$(subst m,y,$(CONFIG_X86_MSR)) += ../../i386/kernel/msr.o
52dmi_scan-y += ../../i386/kernel/dmi_scan.o
53
diff --git a/arch/x86_64/kernel/acpi/Makefile b/arch/x86_64/kernel/acpi/Makefile
index 7da9ace890bd..4fe97071f297 100644
--- a/arch/x86_64/kernel/acpi/Makefile
+++ b/arch/x86_64/kernel/acpi/Makefile
@@ -1,3 +1,8 @@
1obj-y := boot.o 1obj-y := boot.o
2boot-y := ../../../i386/kernel/acpi/boot.o 2boot-y := ../../../i386/kernel/acpi/boot.o
3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o 3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o
4
5ifneq ($(CONFIG_ACPI_PROCESSOR),)
6obj-y += processor.o
7endif
8
diff --git a/arch/x86_64/kernel/acpi/processor.c b/arch/x86_64/kernel/acpi/processor.c
new file mode 100644
index 000000000000..3bdc2baa5bb1
--- /dev/null
+++ b/arch/x86_64/kernel/acpi/processor.c
@@ -0,0 +1,72 @@
1/*
2 * arch/x86_64/kernel/acpi/processor.c
3 *
4 * Copyright (C) 2005 Intel Corporation
5 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
6 * - Added _PDC for platforms with Intel CPUs
7 */
8
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/acpi.h>
13
14#include <acpi/processor.h>
15#include <asm/acpi.h>
16
17static void init_intel_pdc(struct acpi_processor *pr, struct cpuinfo_x86 *c)
18{
19 struct acpi_object_list *obj_list;
20 union acpi_object *obj;
21 u32 *buf;
22
23 /* allocate and initialize pdc. It will be used later. */
24 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
25 if (!obj_list) {
26 printk(KERN_ERR "Memory allocation error\n");
27 return;
28 }
29
30 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
31 if (!obj) {
32 printk(KERN_ERR "Memory allocation error\n");
33 kfree(obj_list);
34 return;
35 }
36
37 buf = kmalloc(12, GFP_KERNEL);
38 if (!buf) {
39 printk(KERN_ERR "Memory allocation error\n");
40 kfree(obj);
41 kfree(obj_list);
42 return;
43 }
44
45 buf[0] = ACPI_PDC_REVISION_ID;
46 buf[1] = 1;
47 buf[2] = ACPI_PDC_EST_CAPABILITY_SMP;
48
49 obj->type = ACPI_TYPE_BUFFER;
50 obj->buffer.length = 12;
51 obj->buffer.pointer = (u8 *) buf;
52 obj_list->count = 1;
53 obj_list->pointer = obj;
54 pr->pdc = obj_list;
55
56 return;
57}
58
59/* Initialize _PDC data based on the CPU vendor */
60void arch_acpi_processor_init_pdc(struct acpi_processor *pr)
61{
62 unsigned int cpu = pr->id;
63 struct cpuinfo_x86 *c = cpu_data + cpu;
64
65 pr->pdc = NULL;
66 if (c->x86_vendor == X86_VENDOR_INTEL && cpu_has(c, X86_FEATURE_EST))
67 init_intel_pdc(pr, c);
68
69 return;
70}
71
72EXPORT_SYMBOL(arch_acpi_processor_init_pdc);
diff --git a/arch/x86_64/kernel/aperture.c b/arch/x86_64/kernel/aperture.c
index c7f4fdd20f05..e4e2b7d01f89 100644
--- a/arch/x86_64/kernel/aperture.c
+++ b/arch/x86_64/kernel/aperture.c
@@ -23,6 +23,7 @@
23#include <asm/io.h> 23#include <asm/io.h>
24#include <asm/proto.h> 24#include <asm/proto.h>
25#include <asm/pci-direct.h> 25#include <asm/pci-direct.h>
26#include <asm/dma.h>
26 27
27int iommu_aperture; 28int iommu_aperture;
28int iommu_aperture_disabled __initdata = 0; 29int iommu_aperture_disabled __initdata = 0;
@@ -247,7 +248,7 @@ void __init iommu_hole_init(void)
247 /* Got the aperture from the AGP bridge */ 248 /* Got the aperture from the AGP bridge */
248 } else if (swiotlb && !valid_agp) { 249 } else if (swiotlb && !valid_agp) {
249 /* Do nothing */ 250 /* Do nothing */
250 } else if ((!no_iommu && end_pfn >= 0xffffffff>>PAGE_SHIFT) || 251 } else if ((!no_iommu && end_pfn >= MAX_DMA32_PFN) ||
251 force_iommu || 252 force_iommu ||
252 valid_agp || 253 valid_agp ||
253 fallback_aper_force) { 254 fallback_aper_force) {
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
index 18691ce4c759..5d3c5b07b8db 100644
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -25,6 +25,7 @@
25#include <linux/mc146818rtc.h> 25#include <linux/mc146818rtc.h>
26#include <linux/kernel_stat.h> 26#include <linux/kernel_stat.h>
27#include <linux/sysdev.h> 27#include <linux/sysdev.h>
28#include <linux/module.h>
28 29
29#include <asm/atomic.h> 30#include <asm/atomic.h>
30#include <asm/smp.h> 31#include <asm/smp.h>
@@ -33,36 +34,36 @@
33#include <asm/pgalloc.h> 34#include <asm/pgalloc.h>
34#include <asm/mach_apic.h> 35#include <asm/mach_apic.h>
35#include <asm/nmi.h> 36#include <asm/nmi.h>
37#include <asm/idle.h>
36 38
37int apic_verbosity; 39int apic_verbosity;
38 40
39int disable_apic_timer __initdata; 41int disable_apic_timer __initdata;
40 42
43/*
44 * cpu_mask that denotes the CPUs that needs timer interrupt coming in as
45 * IPIs in place of local APIC timers
46 */
47static cpumask_t timer_interrupt_broadcast_ipi_mask;
48
41/* Using APIC to generate smp_local_timer_interrupt? */ 49/* Using APIC to generate smp_local_timer_interrupt? */
42int using_apic_timer = 0; 50int using_apic_timer = 0;
43 51
44static DEFINE_PER_CPU(int, prof_multiplier) = 1;
45static DEFINE_PER_CPU(int, prof_old_multiplier) = 1;
46static DEFINE_PER_CPU(int, prof_counter) = 1;
47
48static void apic_pm_activate(void); 52static void apic_pm_activate(void);
49 53
50void enable_NMI_through_LVT0 (void * dummy) 54void enable_NMI_through_LVT0 (void * dummy)
51{ 55{
52 unsigned int v, ver; 56 unsigned int v;
53 57
54 ver = apic_read(APIC_LVR);
55 ver = GET_APIC_VERSION(ver);
56 v = APIC_DM_NMI; /* unmask and set to NMI */ 58 v = APIC_DM_NMI; /* unmask and set to NMI */
57 apic_write_around(APIC_LVT0, v); 59 apic_write(APIC_LVT0, v);
58} 60}
59 61
60int get_maxlvt(void) 62int get_maxlvt(void)
61{ 63{
62 unsigned int v, ver, maxlvt; 64 unsigned int v, maxlvt;
63 65
64 v = apic_read(APIC_LVR); 66 v = apic_read(APIC_LVR);
65 ver = GET_APIC_VERSION(v);
66 maxlvt = GET_APIC_MAXLVT(v); 67 maxlvt = GET_APIC_MAXLVT(v);
67 return maxlvt; 68 return maxlvt;
68} 69}
@@ -80,33 +81,33 @@ void clear_local_APIC(void)
80 */ 81 */
81 if (maxlvt >= 3) { 82 if (maxlvt >= 3) {
82 v = ERROR_APIC_VECTOR; /* any non-zero vector will do */ 83 v = ERROR_APIC_VECTOR; /* any non-zero vector will do */
83 apic_write_around(APIC_LVTERR, v | APIC_LVT_MASKED); 84 apic_write(APIC_LVTERR, v | APIC_LVT_MASKED);
84 } 85 }
85 /* 86 /*
86 * Careful: we have to set masks only first to deassert 87 * Careful: we have to set masks only first to deassert
87 * any level-triggered sources. 88 * any level-triggered sources.
88 */ 89 */
89 v = apic_read(APIC_LVTT); 90 v = apic_read(APIC_LVTT);
90 apic_write_around(APIC_LVTT, v | APIC_LVT_MASKED); 91 apic_write(APIC_LVTT, v | APIC_LVT_MASKED);
91 v = apic_read(APIC_LVT0); 92 v = apic_read(APIC_LVT0);
92 apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED); 93 apic_write(APIC_LVT0, v | APIC_LVT_MASKED);
93 v = apic_read(APIC_LVT1); 94 v = apic_read(APIC_LVT1);
94 apic_write_around(APIC_LVT1, v | APIC_LVT_MASKED); 95 apic_write(APIC_LVT1, v | APIC_LVT_MASKED);
95 if (maxlvt >= 4) { 96 if (maxlvt >= 4) {
96 v = apic_read(APIC_LVTPC); 97 v = apic_read(APIC_LVTPC);
97 apic_write_around(APIC_LVTPC, v | APIC_LVT_MASKED); 98 apic_write(APIC_LVTPC, v | APIC_LVT_MASKED);
98 } 99 }
99 100
100 /* 101 /*
101 * Clean APIC state for other OSs: 102 * Clean APIC state for other OSs:
102 */ 103 */
103 apic_write_around(APIC_LVTT, APIC_LVT_MASKED); 104 apic_write(APIC_LVTT, APIC_LVT_MASKED);
104 apic_write_around(APIC_LVT0, APIC_LVT_MASKED); 105 apic_write(APIC_LVT0, APIC_LVT_MASKED);
105 apic_write_around(APIC_LVT1, APIC_LVT_MASKED); 106 apic_write(APIC_LVT1, APIC_LVT_MASKED);
106 if (maxlvt >= 3) 107 if (maxlvt >= 3)
107 apic_write_around(APIC_LVTERR, APIC_LVT_MASKED); 108 apic_write(APIC_LVTERR, APIC_LVT_MASKED);
108 if (maxlvt >= 4) 109 if (maxlvt >= 4)
109 apic_write_around(APIC_LVTPC, APIC_LVT_MASKED); 110 apic_write(APIC_LVTPC, APIC_LVT_MASKED);
110 v = GET_APIC_VERSION(apic_read(APIC_LVR)); 111 v = GET_APIC_VERSION(apic_read(APIC_LVR));
111 apic_write(APIC_ESR, 0); 112 apic_write(APIC_ESR, 0);
112 apic_read(APIC_ESR); 113 apic_read(APIC_ESR);
@@ -151,7 +152,7 @@ void disconnect_bsp_APIC(int virt_wire_setup)
151 value &= ~APIC_VECTOR_MASK; 152 value &= ~APIC_VECTOR_MASK;
152 value |= APIC_SPIV_APIC_ENABLED; 153 value |= APIC_SPIV_APIC_ENABLED;
153 value |= 0xf; 154 value |= 0xf;
154 apic_write_around(APIC_SPIV, value); 155 apic_write(APIC_SPIV, value);
155 156
156 if (!virt_wire_setup) { 157 if (!virt_wire_setup) {
157 /* For LVT0 make it edge triggered, active high, external and enabled */ 158 /* For LVT0 make it edge triggered, active high, external and enabled */
@@ -161,11 +162,11 @@ void disconnect_bsp_APIC(int virt_wire_setup)
161 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED ); 162 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED );
162 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; 163 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
163 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT); 164 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_EXTINT);
164 apic_write_around(APIC_LVT0, value); 165 apic_write(APIC_LVT0, value);
165 } 166 }
166 else { 167 else {
167 /* Disable LVT0 */ 168 /* Disable LVT0 */
168 apic_write_around(APIC_LVT0, APIC_LVT_MASKED); 169 apic_write(APIC_LVT0, APIC_LVT_MASKED);
169 } 170 }
170 171
171 /* For LVT1 make it edge triggered, active high, nmi and enabled */ 172 /* For LVT1 make it edge triggered, active high, nmi and enabled */
@@ -176,7 +177,7 @@ void disconnect_bsp_APIC(int virt_wire_setup)
176 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED); 177 APIC_LVT_LEVEL_TRIGGER | APIC_LVT_MASKED);
177 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING; 178 value |= APIC_LVT_REMOTE_IRR | APIC_SEND_PENDING;
178 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI); 179 value = SET_APIC_DELIVERY_MODE(value, APIC_MODE_NMI);
179 apic_write_around(APIC_LVT1, value); 180 apic_write(APIC_LVT1, value);
180 } 181 }
181} 182}
182 183
@@ -192,7 +193,7 @@ void disable_local_APIC(void)
192 */ 193 */
193 value = apic_read(APIC_SPIV); 194 value = apic_read(APIC_SPIV);
194 value &= ~APIC_SPIV_APIC_ENABLED; 195 value &= ~APIC_SPIV_APIC_ENABLED;
195 apic_write_around(APIC_SPIV, value); 196 apic_write(APIC_SPIV, value);
196} 197}
197 198
198/* 199/*
@@ -269,7 +270,7 @@ void __init sync_Arb_IDs(void)
269 apic_wait_icr_idle(); 270 apic_wait_icr_idle();
270 271
271 apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n"); 272 apic_printk(APIC_DEBUG, "Synchronizing Arb IDs.\n");
272 apic_write_around(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG 273 apic_write(APIC_ICR, APIC_DEST_ALLINC | APIC_INT_LEVELTRIG
273 | APIC_DM_INIT); 274 | APIC_DM_INIT);
274} 275}
275 276
@@ -280,7 +281,7 @@ extern void __error_in_apic_c (void);
280 */ 281 */
281void __init init_bsp_APIC(void) 282void __init init_bsp_APIC(void)
282{ 283{
283 unsigned int value, ver; 284 unsigned int value;
284 285
285 /* 286 /*
286 * Don't do the setup now if we have a SMP BIOS as the 287 * Don't do the setup now if we have a SMP BIOS as the
@@ -290,7 +291,6 @@ void __init init_bsp_APIC(void)
290 return; 291 return;
291 292
292 value = apic_read(APIC_LVR); 293 value = apic_read(APIC_LVR);
293 ver = GET_APIC_VERSION(value);
294 294
295 /* 295 /*
296 * Do not trust the local APIC being empty at bootup. 296 * Do not trust the local APIC being empty at bootup.
@@ -305,22 +305,21 @@ void __init init_bsp_APIC(void)
305 value |= APIC_SPIV_APIC_ENABLED; 305 value |= APIC_SPIV_APIC_ENABLED;
306 value |= APIC_SPIV_FOCUS_DISABLED; 306 value |= APIC_SPIV_FOCUS_DISABLED;
307 value |= SPURIOUS_APIC_VECTOR; 307 value |= SPURIOUS_APIC_VECTOR;
308 apic_write_around(APIC_SPIV, value); 308 apic_write(APIC_SPIV, value);
309 309
310 /* 310 /*
311 * Set up the virtual wire mode. 311 * Set up the virtual wire mode.
312 */ 312 */
313 apic_write_around(APIC_LVT0, APIC_DM_EXTINT); 313 apic_write(APIC_LVT0, APIC_DM_EXTINT);
314 value = APIC_DM_NMI; 314 value = APIC_DM_NMI;
315 apic_write_around(APIC_LVT1, value); 315 apic_write(APIC_LVT1, value);
316} 316}
317 317
318void __cpuinit setup_local_APIC (void) 318void __cpuinit setup_local_APIC (void)
319{ 319{
320 unsigned int value, ver, maxlvt; 320 unsigned int value, maxlvt;
321 321
322 value = apic_read(APIC_LVR); 322 value = apic_read(APIC_LVR);
323 ver = GET_APIC_VERSION(value);
324 323
325 if ((SPURIOUS_APIC_VECTOR & 0x0f) != 0x0f) 324 if ((SPURIOUS_APIC_VECTOR & 0x0f) != 0x0f)
326 __error_in_apic_c(); 325 __error_in_apic_c();
@@ -345,7 +344,7 @@ void __cpuinit setup_local_APIC (void)
345 */ 344 */
346 value = apic_read(APIC_TASKPRI); 345 value = apic_read(APIC_TASKPRI);
347 value &= ~APIC_TPRI_MASK; 346 value &= ~APIC_TPRI_MASK;
348 apic_write_around(APIC_TASKPRI, value); 347 apic_write(APIC_TASKPRI, value);
349 348
350 /* 349 /*
351 * Now that we are all set up, enable the APIC 350 * Now that we are all set up, enable the APIC
@@ -387,7 +386,7 @@ void __cpuinit setup_local_APIC (void)
387 * Set spurious IRQ vector 386 * Set spurious IRQ vector
388 */ 387 */
389 value |= SPURIOUS_APIC_VECTOR; 388 value |= SPURIOUS_APIC_VECTOR;
390 apic_write_around(APIC_SPIV, value); 389 apic_write(APIC_SPIV, value);
391 390
392 /* 391 /*
393 * Set up LVT0, LVT1: 392 * Set up LVT0, LVT1:
@@ -407,7 +406,7 @@ void __cpuinit setup_local_APIC (void)
407 value = APIC_DM_EXTINT | APIC_LVT_MASKED; 406 value = APIC_DM_EXTINT | APIC_LVT_MASKED;
408 apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", smp_processor_id()); 407 apic_printk(APIC_VERBOSE, "masked ExtINT on CPU#%d\n", smp_processor_id());
409 } 408 }
410 apic_write_around(APIC_LVT0, value); 409 apic_write(APIC_LVT0, value);
411 410
412 /* 411 /*
413 * only the BP should see the LINT1 NMI signal, obviously. 412 * only the BP should see the LINT1 NMI signal, obviously.
@@ -416,14 +415,14 @@ void __cpuinit setup_local_APIC (void)
416 value = APIC_DM_NMI; 415 value = APIC_DM_NMI;
417 else 416 else
418 value = APIC_DM_NMI | APIC_LVT_MASKED; 417 value = APIC_DM_NMI | APIC_LVT_MASKED;
419 apic_write_around(APIC_LVT1, value); 418 apic_write(APIC_LVT1, value);
420 419
421 { 420 {
422 unsigned oldvalue; 421 unsigned oldvalue;
423 maxlvt = get_maxlvt(); 422 maxlvt = get_maxlvt();
424 oldvalue = apic_read(APIC_ESR); 423 oldvalue = apic_read(APIC_ESR);
425 value = ERROR_APIC_VECTOR; // enables sending errors 424 value = ERROR_APIC_VECTOR; // enables sending errors
426 apic_write_around(APIC_LVTERR, value); 425 apic_write(APIC_LVTERR, value);
427 /* 426 /*
428 * spec says clear errors after enabling vector. 427 * spec says clear errors after enabling vector.
429 */ 428 */
@@ -500,13 +499,10 @@ static int lapic_resume(struct sys_device *dev)
500 if (!apic_pm_state.active) 499 if (!apic_pm_state.active)
501 return 0; 500 return 0;
502 501
503 /* XXX: Pavel needs this for S3 resume, but can't explain why */
504 set_fixmap_nocache(FIX_APIC_BASE, APIC_DEFAULT_PHYS_BASE);
505
506 local_irq_save(flags); 502 local_irq_save(flags);
507 rdmsr(MSR_IA32_APICBASE, l, h); 503 rdmsr(MSR_IA32_APICBASE, l, h);
508 l &= ~MSR_IA32_APICBASE_BASE; 504 l &= ~MSR_IA32_APICBASE_BASE;
509 l |= MSR_IA32_APICBASE_ENABLE | APIC_DEFAULT_PHYS_BASE; 505 l |= MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;
510 wrmsr(MSR_IA32_APICBASE, l, h); 506 wrmsr(MSR_IA32_APICBASE, l, h);
511 apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED); 507 apic_write(APIC_LVTERR, ERROR_APIC_VECTOR | APIC_LVT_MASKED);
512 apic_write(APIC_ID, apic_pm_state.apic_id); 508 apic_write(APIC_ID, apic_pm_state.apic_id);
@@ -660,20 +656,25 @@ void __init init_apic_mappings(void)
660static void __setup_APIC_LVTT(unsigned int clocks) 656static void __setup_APIC_LVTT(unsigned int clocks)
661{ 657{
662 unsigned int lvtt_value, tmp_value, ver; 658 unsigned int lvtt_value, tmp_value, ver;
659 int cpu = smp_processor_id();
663 660
664 ver = GET_APIC_VERSION(apic_read(APIC_LVR)); 661 ver = GET_APIC_VERSION(apic_read(APIC_LVR));
665 lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR; 662 lvtt_value = APIC_LVT_TIMER_PERIODIC | LOCAL_TIMER_VECTOR;
666 apic_write_around(APIC_LVTT, lvtt_value); 663
664 if (cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask))
665 lvtt_value |= APIC_LVT_MASKED;
666
667 apic_write(APIC_LVTT, lvtt_value);
667 668
668 /* 669 /*
669 * Divide PICLK by 16 670 * Divide PICLK by 16
670 */ 671 */
671 tmp_value = apic_read(APIC_TDCR); 672 tmp_value = apic_read(APIC_TDCR);
672 apic_write_around(APIC_TDCR, (tmp_value 673 apic_write(APIC_TDCR, (tmp_value
673 & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE)) 674 & ~(APIC_TDR_DIV_1 | APIC_TDR_DIV_TMBASE))
674 | APIC_TDR_DIV_16); 675 | APIC_TDR_DIV_16);
675 676
676 apic_write_around(APIC_TMICT, clocks/APIC_DIVISOR); 677 apic_write(APIC_TMICT, clocks/APIC_DIVISOR);
677} 678}
678 679
679static void setup_APIC_timer(unsigned int clocks) 680static void setup_APIC_timer(unsigned int clocks)
@@ -682,12 +683,6 @@ static void setup_APIC_timer(unsigned int clocks)
682 683
683 local_irq_save(flags); 684 local_irq_save(flags);
684 685
685 /* For some reasons this doesn't work on Simics, so fake it for now */
686 if (!strstr(boot_cpu_data.x86_model_id, "Screwdriver")) {
687 __setup_APIC_LVTT(clocks);
688 return;
689 }
690
691 /* wait for irq slice */ 686 /* wait for irq slice */
692 if (vxtime.hpet_address) { 687 if (vxtime.hpet_address) {
693 int trigger = hpet_readl(HPET_T0_CMP); 688 int trigger = hpet_readl(HPET_T0_CMP);
@@ -700,7 +695,7 @@ static void setup_APIC_timer(unsigned int clocks)
700 outb_p(0x00, 0x43); 695 outb_p(0x00, 0x43);
701 c2 = inb_p(0x40); 696 c2 = inb_p(0x40);
702 c2 |= inb_p(0x40) << 8; 697 c2 |= inb_p(0x40) << 8;
703 do { 698 do {
704 c1 = c2; 699 c1 = c2;
705 outb_p(0x00, 0x43); 700 outb_p(0x00, 0x43);
706 c2 = inb_p(0x40); 701 c2 = inb_p(0x40);
@@ -785,52 +780,68 @@ void __cpuinit setup_secondary_APIC_clock(void)
785 local_irq_enable(); 780 local_irq_enable();
786} 781}
787 782
788void __cpuinit disable_APIC_timer(void) 783void disable_APIC_timer(void)
789{ 784{
790 if (using_apic_timer) { 785 if (using_apic_timer) {
791 unsigned long v; 786 unsigned long v;
792 787
793 v = apic_read(APIC_LVTT); 788 v = apic_read(APIC_LVTT);
794 apic_write_around(APIC_LVTT, v | APIC_LVT_MASKED); 789 apic_write(APIC_LVTT, v | APIC_LVT_MASKED);
795 } 790 }
796} 791}
797 792
798void enable_APIC_timer(void) 793void enable_APIC_timer(void)
799{ 794{
800 if (using_apic_timer) { 795 int cpu = smp_processor_id();
796
797 if (using_apic_timer &&
798 !cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) {
801 unsigned long v; 799 unsigned long v;
802 800
803 v = apic_read(APIC_LVTT); 801 v = apic_read(APIC_LVTT);
804 apic_write_around(APIC_LVTT, v & ~APIC_LVT_MASKED); 802 apic_write(APIC_LVTT, v & ~APIC_LVT_MASKED);
805 } 803 }
806} 804}
807 805
808/* 806void switch_APIC_timer_to_ipi(void *cpumask)
809 * the frequency of the profiling timer can be changed
810 * by writing a multiplier value into /proc/profile.
811 */
812int setup_profiling_timer(unsigned int multiplier)
813{ 807{
814 int i; 808 cpumask_t mask = *(cpumask_t *)cpumask;
809 int cpu = smp_processor_id();
815 810
816 /* 811 if (cpu_isset(cpu, mask) &&
817 * Sanity check. [at least 500 APIC cycles should be 812 !cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) {
818 * between APIC interrupts as a rule of thumb, to avoid 813 disable_APIC_timer();
819 * irqs flooding us] 814 cpu_set(cpu, timer_interrupt_broadcast_ipi_mask);
820 */ 815 }
821 if ( (!multiplier) || (calibration_result/multiplier < 500)) 816}
822 return -EINVAL; 817EXPORT_SYMBOL(switch_APIC_timer_to_ipi);
823
824 /*
825 * Set the new multiplier for each CPU. CPUs don't start using the
826 * new values until the next timer interrupt in which they do process
827 * accounting. At that time they also adjust their APIC timers
828 * accordingly.
829 */
830 for (i = 0; i < NR_CPUS; ++i)
831 per_cpu(prof_multiplier, i) = multiplier;
832 818
833 return 0; 819void smp_send_timer_broadcast_ipi(void)
820{
821 cpumask_t mask;
822
823 cpus_and(mask, cpu_online_map, timer_interrupt_broadcast_ipi_mask);
824 if (!cpus_empty(mask)) {
825 send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
826 }
827}
828
829void switch_ipi_to_APIC_timer(void *cpumask)
830{
831 cpumask_t mask = *(cpumask_t *)cpumask;
832 int cpu = smp_processor_id();
833
834 if (cpu_isset(cpu, mask) &&
835 cpu_isset(cpu, timer_interrupt_broadcast_ipi_mask)) {
836 cpu_clear(cpu, timer_interrupt_broadcast_ipi_mask);
837 enable_APIC_timer();
838 }
839}
840EXPORT_SYMBOL(switch_ipi_to_APIC_timer);
841
842int setup_profiling_timer(unsigned int multiplier)
843{
844 return -EINVAL;
834} 845}
835 846
836#ifdef CONFIG_X86_MCE_AMD 847#ifdef CONFIG_X86_MCE_AMD
@@ -857,32 +868,10 @@ void setup_threshold_lvt(unsigned long lvt_off)
857 868
858void smp_local_timer_interrupt(struct pt_regs *regs) 869void smp_local_timer_interrupt(struct pt_regs *regs)
859{ 870{
860 int cpu = smp_processor_id();
861
862 profile_tick(CPU_PROFILING, regs); 871 profile_tick(CPU_PROFILING, regs);
863 if (--per_cpu(prof_counter, cpu) <= 0) {
864 /*
865 * The multiplier may have changed since the last time we got
866 * to this point as a result of the user writing to
867 * /proc/profile. In this case we need to adjust the APIC
868 * timer accordingly.
869 *
870 * Interrupts are already masked off at this point.
871 */
872 per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu);
873 if (per_cpu(prof_counter, cpu) !=
874 per_cpu(prof_old_multiplier, cpu)) {
875 __setup_APIC_LVTT(calibration_result/
876 per_cpu(prof_counter, cpu));
877 per_cpu(prof_old_multiplier, cpu) =
878 per_cpu(prof_counter, cpu);
879 }
880
881#ifdef CONFIG_SMP 872#ifdef CONFIG_SMP
882 update_process_times(user_mode(regs)); 873 update_process_times(user_mode(regs));
883#endif 874#endif
884 }
885
886 /* 875 /*
887 * We take the 'long' return path, and there every subsystem 876 * We take the 'long' return path, and there every subsystem
888 * grabs the appropriate locks (kernel lock/ irq lock). 877 * grabs the appropriate locks (kernel lock/ irq lock).
@@ -920,6 +909,7 @@ void smp_apic_timer_interrupt(struct pt_regs *regs)
920 * Besides, if we don't timer interrupts ignore the global 909 * Besides, if we don't timer interrupts ignore the global
921 * interrupt lock, which is the WrongThing (tm) to do. 910 * interrupt lock, which is the WrongThing (tm) to do.
922 */ 911 */
912 exit_idle();
923 irq_enter(); 913 irq_enter();
924 smp_local_timer_interrupt(regs); 914 smp_local_timer_interrupt(regs);
925 irq_exit(); 915 irq_exit();
@@ -979,6 +969,7 @@ __init int oem_force_hpet_timer(void)
979asmlinkage void smp_spurious_interrupt(void) 969asmlinkage void smp_spurious_interrupt(void)
980{ 970{
981 unsigned int v; 971 unsigned int v;
972 exit_idle();
982 irq_enter(); 973 irq_enter();
983 /* 974 /*
984 * Check if this really is a spurious interrupt and ACK it 975 * Check if this really is a spurious interrupt and ACK it
@@ -1014,6 +1005,7 @@ asmlinkage void smp_error_interrupt(void)
1014{ 1005{
1015 unsigned int v, v1; 1006 unsigned int v, v1;
1016 1007
1008 exit_idle();
1017 irq_enter(); 1009 irq_enter();
1018 /* First tickle the hardware, only then report what went on. -- REW */ 1010 /* First tickle the hardware, only then report what went on. -- REW */
1019 v = apic_read(APIC_ESR); 1011 v = apic_read(APIC_ESR);
@@ -1060,7 +1052,7 @@ int __init APIC_init_uniprocessor (void)
1060 connect_bsp_APIC(); 1052 connect_bsp_APIC();
1061 1053
1062 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id); 1054 phys_cpu_present_map = physid_mask_of_physid(boot_cpu_id);
1063 apic_write_around(APIC_ID, boot_cpu_id); 1055 apic_write(APIC_ID, SET_APIC_ID(boot_cpu_id));
1064 1056
1065 setup_local_APIC(); 1057 setup_local_APIC();
1066 1058
diff --git a/arch/x86_64/kernel/asm-offsets.c b/arch/x86_64/kernel/asm-offsets.c
index aaa6d3833517..38834bbbae11 100644
--- a/arch/x86_64/kernel/asm-offsets.c
+++ b/arch/x86_64/kernel/asm-offsets.c
@@ -33,6 +33,7 @@ int main(void)
33 ENTRY(flags); 33 ENTRY(flags);
34 ENTRY(addr_limit); 34 ENTRY(addr_limit);
35 ENTRY(preempt_count); 35 ENTRY(preempt_count);
36 ENTRY(status);
36 BLANK(); 37 BLANK();
37#undef ENTRY 38#undef ENTRY
38#define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry)) 39#define ENTRY(entry) DEFINE(pda_ ## entry, offsetof(struct x8664_pda, entry))
@@ -42,6 +43,7 @@ int main(void)
42 ENTRY(irqcount); 43 ENTRY(irqcount);
43 ENTRY(cpunumber); 44 ENTRY(cpunumber);
44 ENTRY(irqstackptr); 45 ENTRY(irqstackptr);
46 ENTRY(data_offset);
45 BLANK(); 47 BLANK();
46#undef ENTRY 48#undef ENTRY
47#ifdef CONFIG_IA32_EMULATION 49#ifdef CONFIG_IA32_EMULATION
@@ -64,5 +66,7 @@ int main(void)
64 DEFINE(pbe_address, offsetof(struct pbe, address)); 66 DEFINE(pbe_address, offsetof(struct pbe, address));
65 DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address)); 67 DEFINE(pbe_orig_address, offsetof(struct pbe, orig_address));
66 DEFINE(pbe_next, offsetof(struct pbe, next)); 68 DEFINE(pbe_next, offsetof(struct pbe, next));
69 BLANK();
70 DEFINE(TSS_ist, offsetof(struct tss_struct, ist));
67 return 0; 71 return 0;
68} 72}
diff --git a/arch/x86_64/kernel/crash.c b/arch/x86_64/kernel/crash.c
index 535e04466079..4e6c3b729e39 100644
--- a/arch/x86_64/kernel/crash.c
+++ b/arch/x86_64/kernel/crash.c
@@ -11,19 +11,156 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/smp.h> 13#include <linux/smp.h>
14#include <linux/irq.h>
14#include <linux/reboot.h> 15#include <linux/reboot.h>
15#include <linux/kexec.h> 16#include <linux/kexec.h>
17#include <linux/delay.h>
18#include <linux/elf.h>
19#include <linux/elfcore.h>
16 20
17#include <asm/processor.h> 21#include <asm/processor.h>
18#include <asm/hardirq.h> 22#include <asm/hardirq.h>
19#include <asm/nmi.h> 23#include <asm/nmi.h>
20#include <asm/hw_irq.h> 24#include <asm/hw_irq.h>
25#include <asm/mach_apic.h>
21 26
22note_buf_t crash_notes[NR_CPUS]; 27/* This keeps a track of which one is crashing cpu. */
28static int crashing_cpu;
29
30static u32 *append_elf_note(u32 *buf, char *name, unsigned type,
31 void *data, size_t data_len)
32{
33 struct elf_note note;
34
35 note.n_namesz = strlen(name) + 1;
36 note.n_descsz = data_len;
37 note.n_type = type;
38 memcpy(buf, &note, sizeof(note));
39 buf += (sizeof(note) +3)/4;
40 memcpy(buf, name, note.n_namesz);
41 buf += (note.n_namesz + 3)/4;
42 memcpy(buf, data, note.n_descsz);
43 buf += (note.n_descsz + 3)/4;
44
45 return buf;
46}
47
48static void final_note(u32 *buf)
49{
50 struct elf_note note;
51
52 note.n_namesz = 0;
53 note.n_descsz = 0;
54 note.n_type = 0;
55 memcpy(buf, &note, sizeof(note));
56}
57
58static void crash_save_this_cpu(struct pt_regs *regs, int cpu)
59{
60 struct elf_prstatus prstatus;
61 u32 *buf;
62
63 if ((cpu < 0) || (cpu >= NR_CPUS))
64 return;
65
66 /* Using ELF notes here is opportunistic.
67 * I need a well defined structure format
68 * for the data I pass, and I need tags
69 * on the data to indicate what information I have
70 * squirrelled away. ELF notes happen to provide
71 * all of that that no need to invent something new.
72 */
73
74 buf = (u32*)per_cpu_ptr(crash_notes, cpu);
75
76 if (!buf)
77 return;
78
79 memset(&prstatus, 0, sizeof(prstatus));
80 prstatus.pr_pid = current->pid;
81 elf_core_copy_regs(&prstatus.pr_reg, regs);
82 buf = append_elf_note(buf, "CORE", NT_PRSTATUS, &prstatus,
83 sizeof(prstatus));
84 final_note(buf);
85}
86
87static void crash_save_self(struct pt_regs *regs)
88{
89 int cpu;
90
91 cpu = smp_processor_id();
92 crash_save_this_cpu(regs, cpu);
93}
94
95#ifdef CONFIG_SMP
96static atomic_t waiting_for_crash_ipi;
97
98static int crash_nmi_callback(struct pt_regs *regs, int cpu)
99{
100 /*
101 * Don't do anything if this handler is invoked on crashing cpu.
102 * Otherwise, system will completely hang. Crashing cpu can get
103 * an NMI if system was initially booted with nmi_watchdog parameter.
104 */
105 if (cpu == crashing_cpu)
106 return 1;
107 local_irq_disable();
108
109 crash_save_this_cpu(regs, cpu);
110 disable_local_APIC();
111 atomic_dec(&waiting_for_crash_ipi);
112 /* Assume hlt works */
113 for(;;)
114 asm("hlt");
115
116 return 1;
117}
118
119static void smp_send_nmi_allbutself(void)
120{
121 send_IPI_allbutself(APIC_DM_NMI);
122}
123
124/*
125 * This code is a best effort heuristic to get the
126 * other cpus to stop executing. So races with
127 * cpu hotplug shouldn't matter.
128 */
129
130static void nmi_shootdown_cpus(void)
131{
132 unsigned long msecs;
133
134 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
135 set_nmi_callback(crash_nmi_callback);
136
137 /*
138 * Ensure the new callback function is set before sending
139 * out the NMI
140 */
141 wmb();
142
143 smp_send_nmi_allbutself();
144
145 msecs = 1000; /* Wait at most a second for the other cpus to stop */
146 while ((atomic_read(&waiting_for_crash_ipi) > 0) && msecs) {
147 mdelay(1);
148 msecs--;
149 }
150 /* Leave the nmi callback set */
151 disable_local_APIC();
152}
153#else
154static void nmi_shootdown_cpus(void)
155{
156 /* There are no cpus to shootdown */
157}
158#endif
23 159
24void machine_crash_shutdown(struct pt_regs *regs) 160void machine_crash_shutdown(struct pt_regs *regs)
25{ 161{
26 /* This function is only called after the system 162 /*
163 * This function is only called after the system
27 * has paniced or is otherwise in a critical state. 164 * has paniced or is otherwise in a critical state.
28 * The minimum amount of code to allow a kexec'd kernel 165 * The minimum amount of code to allow a kexec'd kernel
29 * to run successfully needs to happen here. 166 * to run successfully needs to happen here.
@@ -31,4 +168,19 @@ void machine_crash_shutdown(struct pt_regs *regs)
31 * In practice this means shooting down the other cpus in 168 * In practice this means shooting down the other cpus in
32 * an SMP system. 169 * an SMP system.
33 */ 170 */
171 /* The kernel is broken so disable interrupts */
172 local_irq_disable();
173
174 /* Make a note of crashing cpu. Will be used in NMI callback.*/
175 crashing_cpu = smp_processor_id();
176 nmi_shootdown_cpus();
177
178 if(cpu_has_apic)
179 disable_local_APIC();
180
181#if defined(CONFIG_X86_IO_APIC)
182 disable_IO_APIC();
183#endif
184
185 crash_save_self(regs);
34} 186}
diff --git a/arch/x86_64/kernel/crash_dump.c b/arch/x86_64/kernel/crash_dump.c
new file mode 100644
index 000000000000..942deac4d43a
--- /dev/null
+++ b/arch/x86_64/kernel/crash_dump.c
@@ -0,0 +1,47 @@
1/*
2 * kernel/crash_dump.c - Memory preserving reboot related code.
3 *
4 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
5 * Copyright (C) IBM Corporation, 2004. All rights reserved
6 */
7
8#include <linux/errno.h>
9#include <linux/crash_dump.h>
10
11#include <asm/uaccess.h>
12#include <asm/io.h>
13
14/**
15 * copy_oldmem_page - copy one page from "oldmem"
16 * @pfn: page frame number to be copied
17 * @buf: target memory address for the copy; this can be in kernel address
18 * space or user address space (see @userbuf)
19 * @csize: number of bytes to copy
20 * @offset: offset in bytes into the page (based on pfn) to begin the copy
21 * @userbuf: if set, @buf is in user address space, use copy_to_user(),
22 * otherwise @buf is in kernel address space, use memcpy().
23 *
24 * Copy a page from "oldmem". For this page, there is no pte mapped
25 * in the current kernel. We stitch up a pte, similar to kmap_atomic.
26 */
27ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
28 size_t csize, unsigned long offset, int userbuf)
29{
30 void *vaddr;
31
32 if (!csize)
33 return 0;
34
35 vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
36
37 if (userbuf) {
38 if (copy_to_user(buf, (vaddr + offset), csize)) {
39 iounmap(vaddr);
40 return -EFAULT;
41 }
42 } else
43 memcpy(buf, (vaddr + offset), csize);
44
45 iounmap(vaddr);
46 return csize;
47}
diff --git a/arch/x86_64/kernel/e820.c b/arch/x86_64/kernel/e820.c
index 17579a1a174b..293cd71a266a 100644
--- a/arch/x86_64/kernel/e820.c
+++ b/arch/x86_64/kernel/e820.c
@@ -559,6 +559,27 @@ void __init parse_memopt(char *p, char **from)
559 end_user_pfn >>= PAGE_SHIFT; 559 end_user_pfn >>= PAGE_SHIFT;
560} 560}
561 561
562void __init parse_memmapopt(char *p, char **from)
563{
564 unsigned long long start_at, mem_size;
565
566 mem_size = memparse(p, from);
567 p = *from;
568 if (*p == '@') {
569 start_at = memparse(p+1, from);
570 add_memory_region(start_at, mem_size, E820_RAM);
571 } else if (*p == '#') {
572 start_at = memparse(p+1, from);
573 add_memory_region(start_at, mem_size, E820_ACPI);
574 } else if (*p == '$') {
575 start_at = memparse(p+1, from);
576 add_memory_region(start_at, mem_size, E820_RESERVED);
577 } else {
578 end_user_pfn = (mem_size >> PAGE_SHIFT);
579 }
580 p = *from;
581}
582
562unsigned long pci_mem_start = 0xaeedbabe; 583unsigned long pci_mem_start = 0xaeedbabe;
563 584
564/* 585/*
diff --git a/arch/x86_64/kernel/early_printk.c b/arch/x86_64/kernel/early_printk.c
index 9cd968dd0f5a..6dffb498ccd7 100644
--- a/arch/x86_64/kernel/early_printk.c
+++ b/arch/x86_64/kernel/early_printk.c
@@ -216,7 +216,7 @@ void early_printk(const char *fmt, ...)
216 va_end(ap); 216 va_end(ap);
217} 217}
218 218
219static int keep_early; 219static int __initdata keep_early;
220 220
221int __init setup_early_printk(char *opt) 221int __init setup_early_printk(char *opt)
222{ 222{
@@ -226,8 +226,6 @@ int __init setup_early_printk(char *opt)
226 if (early_console_initialized) 226 if (early_console_initialized)
227 return -1; 227 return -1;
228 228
229 opt = strchr(opt, '=') + 1;
230
231 strlcpy(buf,opt,sizeof(buf)); 229 strlcpy(buf,opt,sizeof(buf));
232 space = strchr(buf, ' '); 230 space = strchr(buf, ' ');
233 if (space) 231 if (space)
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index 9ff42041bb6b..dbdba56e8faa 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -41,6 +41,7 @@
41#include <asm/unistd.h> 41#include <asm/unistd.h>
42#include <asm/thread_info.h> 42#include <asm/thread_info.h>
43#include <asm/hw_irq.h> 43#include <asm/hw_irq.h>
44#include <asm/page.h>
44 45
45 .code64 46 .code64
46 47
@@ -313,6 +314,7 @@ int_with_check:
313 movl threadinfo_flags(%rcx),%edx 314 movl threadinfo_flags(%rcx),%edx
314 andl %edi,%edx 315 andl %edi,%edx
315 jnz int_careful 316 jnz int_careful
317 andl $~TS_COMPAT,threadinfo_status(%rcx)
316 jmp retint_swapgs 318 jmp retint_swapgs
317 319
318 /* Either reschedule or signal or syscall exit tracking needed. */ 320 /* Either reschedule or signal or syscall exit tracking needed. */
@@ -673,7 +675,7 @@ ENTRY(spurious_interrupt)
673 675
674 /* error code is on the stack already */ 676 /* error code is on the stack already */
675 /* handle NMI like exceptions that can happen everywhere */ 677 /* handle NMI like exceptions that can happen everywhere */
676 .macro paranoidentry sym 678 .macro paranoidentry sym, ist=0
677 SAVE_ALL 679 SAVE_ALL
678 cld 680 cld
679 movl $1,%ebx 681 movl $1,%ebx
@@ -683,10 +685,20 @@ ENTRY(spurious_interrupt)
683 js 1f 685 js 1f
684 swapgs 686 swapgs
685 xorl %ebx,%ebx 687 xorl %ebx,%ebx
6861: movq %rsp,%rdi 6881:
689 .if \ist
690 movq %gs:pda_data_offset, %rbp
691 .endif
692 movq %rsp,%rdi
687 movq ORIG_RAX(%rsp),%rsi 693 movq ORIG_RAX(%rsp),%rsi
688 movq $-1,ORIG_RAX(%rsp) 694 movq $-1,ORIG_RAX(%rsp)
695 .if \ist
696 subq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
697 .endif
689 call \sym 698 call \sym
699 .if \ist
700 addq $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
701 .endif
690 cli 702 cli
691 .endm 703 .endm
692 704
@@ -754,7 +766,7 @@ error_exit:
754 jnz retint_careful 766 jnz retint_careful
755 swapgs 767 swapgs
756 RESTORE_ARGS 0,8,0 768 RESTORE_ARGS 0,8,0
757 iretq 769 jmp iret_label
758 CFI_ENDPROC 770 CFI_ENDPROC
759 771
760error_kernelspace: 772error_kernelspace:
@@ -904,7 +916,7 @@ KPROBE_ENTRY(debug)
904 INTR_FRAME 916 INTR_FRAME
905 pushq $0 917 pushq $0
906 CFI_ADJUST_CFA_OFFSET 8 918 CFI_ADJUST_CFA_OFFSET 8
907 paranoidentry do_debug 919 paranoidentry do_debug, DEBUG_STACK
908 jmp paranoid_exit 920 jmp paranoid_exit
909 CFI_ENDPROC 921 CFI_ENDPROC
910 .previous .text 922 .previous .text
@@ -959,7 +971,12 @@ paranoid_schedule:
959 CFI_ENDPROC 971 CFI_ENDPROC
960 972
961KPROBE_ENTRY(int3) 973KPROBE_ENTRY(int3)
962 zeroentry do_int3 974 INTR_FRAME
975 pushq $0
976 CFI_ADJUST_CFA_OFFSET 8
977 paranoidentry do_int3, DEBUG_STACK
978 jmp paranoid_exit
979 CFI_ENDPROC
963 .previous .text 980 .previous .text
964 981
965ENTRY(overflow) 982ENTRY(overflow)
@@ -1021,23 +1038,18 @@ ENTRY(machine_check)
1021 CFI_ENDPROC 1038 CFI_ENDPROC
1022#endif 1039#endif
1023 1040
1024ENTRY(call_debug)
1025 zeroentry do_call_debug
1026
1027ENTRY(call_softirq) 1041ENTRY(call_softirq)
1028 CFI_STARTPROC 1042 CFI_STARTPROC
1029 movq %gs:pda_irqstackptr,%rax 1043 movq %gs:pda_irqstackptr,%rax
1030 pushq %r15 1044 movq %rsp,%rdx
1031 CFI_ADJUST_CFA_OFFSET 8 1045 CFI_DEF_CFA_REGISTER rdx
1032 movq %rsp,%r15
1033 CFI_DEF_CFA_REGISTER r15
1034 incl %gs:pda_irqcount 1046 incl %gs:pda_irqcount
1035 cmove %rax,%rsp 1047 cmove %rax,%rsp
1048 pushq %rdx
1049 /*todo CFI_DEF_CFA_EXPRESSION ...*/
1036 call __do_softirq 1050 call __do_softirq
1037 movq %r15,%rsp 1051 popq %rsp
1038 CFI_DEF_CFA_REGISTER rsp 1052 CFI_DEF_CFA_REGISTER rsp
1039 decl %gs:pda_irqcount 1053 decl %gs:pda_irqcount
1040 popq %r15
1041 CFI_ADJUST_CFA_OFFSET -8
1042 ret 1054 ret
1043 CFI_ENDPROC 1055 CFI_ENDPROC
diff --git a/arch/x86_64/kernel/genapic_cluster.c b/arch/x86_64/kernel/genapic_cluster.c
index a472d62f899a..43fcf62fef0f 100644
--- a/arch/x86_64/kernel/genapic_cluster.c
+++ b/arch/x86_64/kernel/genapic_cluster.c
@@ -72,14 +72,11 @@ static void cluster_send_IPI_mask(cpumask_t mask, int vector)
72static void cluster_send_IPI_allbutself(int vector) 72static void cluster_send_IPI_allbutself(int vector)
73{ 73{
74 cpumask_t mask = cpu_online_map; 74 cpumask_t mask = cpu_online_map;
75 int me = get_cpu(); /* Ensure we are not preempted when we clear */
76 75
77 cpu_clear(me, mask); 76 cpu_clear(smp_processor_id(), mask);
78 77
79 if (!cpus_empty(mask)) 78 if (!cpus_empty(mask))
80 cluster_send_IPI_mask(mask, vector); 79 cluster_send_IPI_mask(mask, vector);
81
82 put_cpu();
83} 80}
84 81
85static void cluster_send_IPI_all(int vector) 82static void cluster_send_IPI_all(int vector)
diff --git a/arch/x86_64/kernel/genapic_flat.c b/arch/x86_64/kernel/genapic_flat.c
index 9da3edb799ea..1a2ab825be98 100644
--- a/arch/x86_64/kernel/genapic_flat.c
+++ b/arch/x86_64/kernel/genapic_flat.c
@@ -83,12 +83,11 @@ static void flat_send_IPI_allbutself(int vector)
83 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL); 83 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL);
84#else 84#else
85 cpumask_t allbutme = cpu_online_map; 85 cpumask_t allbutme = cpu_online_map;
86 int me = get_cpu(); /* Ensure we are not preempted when we clear */ 86
87 cpu_clear(me, allbutme); 87 cpu_clear(smp_processor_id(), allbutme);
88 88
89 if (!cpus_empty(allbutme)) 89 if (!cpus_empty(allbutme))
90 flat_send_IPI_mask(allbutme, vector); 90 flat_send_IPI_mask(allbutme, vector);
91 put_cpu();
92#endif 91#endif
93} 92}
94 93
@@ -149,10 +148,9 @@ static void physflat_send_IPI_mask(cpumask_t cpumask, int vector)
149static void physflat_send_IPI_allbutself(int vector) 148static void physflat_send_IPI_allbutself(int vector)
150{ 149{
151 cpumask_t allbutme = cpu_online_map; 150 cpumask_t allbutme = cpu_online_map;
152 int me = get_cpu(); 151
153 cpu_clear(me, allbutme); 152 cpu_clear(smp_processor_id(), allbutme);
154 physflat_send_IPI_mask(allbutme, vector); 153 physflat_send_IPI_mask(allbutme, vector);
155 put_cpu();
156} 154}
157 155
158static void physflat_send_IPI_all(int vector) 156static void physflat_send_IPI_all(int vector)
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index 15290968e49d..692c737feddb 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -241,104 +241,70 @@ ljumpvector:
241ENTRY(stext) 241ENTRY(stext)
242ENTRY(_stext) 242ENTRY(_stext)
243 243
244.org 0x1000 244 $page = 0
245ENTRY(init_level4_pgt) 245#define NEXT_PAGE(name) \
246 $page = $page + 1; \
247 .org $page * 0x1000; \
248 phys_/**/name = $page * 0x1000 + __PHYSICAL_START; \
249ENTRY(name)
250
251NEXT_PAGE(init_level4_pgt)
246 /* This gets initialized in x86_64_start_kernel */ 252 /* This gets initialized in x86_64_start_kernel */
247 .fill 512,8,0 253 .fill 512,8,0
248 254
249.org 0x2000 255NEXT_PAGE(level3_ident_pgt)
250ENTRY(level3_ident_pgt) 256 .quad phys_level2_ident_pgt | 0x007
251 .quad 0x0000000000004007 + __PHYSICAL_START
252 .fill 511,8,0 257 .fill 511,8,0
253 258
254.org 0x3000 259NEXT_PAGE(level3_kernel_pgt)
255ENTRY(level3_kernel_pgt)
256 .fill 510,8,0 260 .fill 510,8,0
257 /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */ 261 /* (2^48-(2*1024*1024*1024)-((2^39)*511))/(2^30) = 510 */
258 .quad 0x0000000000005007 + __PHYSICAL_START /* -> level2_kernel_pgt */ 262 .quad phys_level2_kernel_pgt | 0x007
259 .fill 1,8,0 263 .fill 1,8,0
260 264
261.org 0x4000 265NEXT_PAGE(level2_ident_pgt)
262ENTRY(level2_ident_pgt)
263 /* 40MB for bootup. */ 266 /* 40MB for bootup. */
264 .quad 0x0000000000000083 267 i = 0
265 .quad 0x0000000000200083 268 .rept 20
266 .quad 0x0000000000400083 269 .quad i << 21 | 0x083
267 .quad 0x0000000000600083 270 i = i + 1
268 .quad 0x0000000000800083 271 .endr
269 .quad 0x0000000000A00083
270 .quad 0x0000000000C00083
271 .quad 0x0000000000E00083
272 .quad 0x0000000001000083
273 .quad 0x0000000001200083
274 .quad 0x0000000001400083
275 .quad 0x0000000001600083
276 .quad 0x0000000001800083
277 .quad 0x0000000001A00083
278 .quad 0x0000000001C00083
279 .quad 0x0000000001E00083
280 .quad 0x0000000002000083
281 .quad 0x0000000002200083
282 .quad 0x0000000002400083
283 .quad 0x0000000002600083
284 /* Temporary mappings for the super early allocator in arch/x86_64/mm/init.c */ 272 /* Temporary mappings for the super early allocator in arch/x86_64/mm/init.c */
285 .globl temp_boot_pmds 273 .globl temp_boot_pmds
286temp_boot_pmds: 274temp_boot_pmds:
287 .fill 492,8,0 275 .fill 492,8,0
288 276
289.org 0x5000 277NEXT_PAGE(level2_kernel_pgt)
290ENTRY(level2_kernel_pgt)
291 /* 40MB kernel mapping. The kernel code cannot be bigger than that. 278 /* 40MB kernel mapping. The kernel code cannot be bigger than that.
292 When you change this change KERNEL_TEXT_SIZE in page.h too. */ 279 When you change this change KERNEL_TEXT_SIZE in page.h too. */
293 /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */ 280 /* (2^48-(2*1024*1024*1024)-((2^39)*511)-((2^30)*510)) = 0 */
294 .quad 0x0000000000000183 281 i = 0
295 .quad 0x0000000000200183 282 .rept 20
296 .quad 0x0000000000400183 283 .quad i << 21 | 0x183
297 .quad 0x0000000000600183 284 i = i + 1
298 .quad 0x0000000000800183 285 .endr
299 .quad 0x0000000000A00183
300 .quad 0x0000000000C00183
301 .quad 0x0000000000E00183
302 .quad 0x0000000001000183
303 .quad 0x0000000001200183
304 .quad 0x0000000001400183
305 .quad 0x0000000001600183
306 .quad 0x0000000001800183
307 .quad 0x0000000001A00183
308 .quad 0x0000000001C00183
309 .quad 0x0000000001E00183
310 .quad 0x0000000002000183
311 .quad 0x0000000002200183
312 .quad 0x0000000002400183
313 .quad 0x0000000002600183
314 /* Module mapping starts here */ 286 /* Module mapping starts here */
315 .fill 492,8,0 287 .fill 492,8,0
316 288
317.org 0x6000 289NEXT_PAGE(empty_zero_page)
318ENTRY(empty_zero_page)
319 290
320.org 0x7000 291NEXT_PAGE(level3_physmem_pgt)
321ENTRY(empty_bad_page) 292 .quad phys_level2_kernel_pgt | 0x007 /* so that __va works even before pagetable_init */
322 293 .fill 511,8,0
323.org 0x8000
324ENTRY(empty_bad_pte_table)
325 294
326.org 0x9000 295#undef NEXT_PAGE
327ENTRY(empty_bad_pmd_table)
328 296
329.org 0xa000 297 .data
330ENTRY(level3_physmem_pgt)
331 .quad 0x0000000000005007 + __PHYSICAL_START /* -> level2_kernel_pgt (so that __va works even before pagetable_init) */
332 298
333 .org 0xb000
334#ifdef CONFIG_ACPI_SLEEP 299#ifdef CONFIG_ACPI_SLEEP
300 .align PAGE_SIZE
335ENTRY(wakeup_level4_pgt) 301ENTRY(wakeup_level4_pgt)
336 .quad 0x0000000000002007 + __PHYSICAL_START /* -> level3_ident_pgt */ 302 .quad phys_level3_ident_pgt | 0x007
337 .fill 255,8,0 303 .fill 255,8,0
338 .quad 0x000000000000a007 + __PHYSICAL_START 304 .quad phys_level3_physmem_pgt | 0x007
339 .fill 254,8,0 305 .fill 254,8,0
340 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */ 306 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */
341 .quad 0x0000000000003007 + __PHYSICAL_START /* -> level3_kernel_pgt */ 307 .quad phys_level3_kernel_pgt | 0x007
342#endif 308#endif
343 309
344#ifndef CONFIG_HOTPLUG_CPU 310#ifndef CONFIG_HOTPLUG_CPU
@@ -352,12 +318,12 @@ ENTRY(wakeup_level4_pgt)
352 */ 318 */
353 .align PAGE_SIZE 319 .align PAGE_SIZE
354ENTRY(boot_level4_pgt) 320ENTRY(boot_level4_pgt)
355 .quad 0x0000000000002007 + __PHYSICAL_START /* -> level3_ident_pgt */ 321 .quad phys_level3_ident_pgt | 0x007
356 .fill 255,8,0 322 .fill 255,8,0
357 .quad 0x000000000000a007 + __PHYSICAL_START 323 .quad phys_level3_physmem_pgt | 0x007
358 .fill 254,8,0 324 .fill 254,8,0
359 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */ 325 /* (2^48-(2*1024*1024*1024))/(2^39) = 511 */
360 .quad 0x0000000000003007 + __PHYSICAL_START /* -> level3_kernel_pgt */ 326 .quad phys_level3_kernel_pgt | 0x007
361 327
362 .data 328 .data
363 329
@@ -379,14 +345,14 @@ gdt:
379 * Also sysret mandates a special GDT layout 345 * Also sysret mandates a special GDT layout
380 */ 346 */
381 347
382.align L1_CACHE_BYTES 348.align PAGE_SIZE
383 349
384/* The TLS descriptors are currently at a different place compared to i386. 350/* The TLS descriptors are currently at a different place compared to i386.
385 Hopefully nobody expects them at a fixed place (Wine?) */ 351 Hopefully nobody expects them at a fixed place (Wine?) */
386 352
387ENTRY(cpu_gdt_table) 353ENTRY(cpu_gdt_table)
388 .quad 0x0000000000000000 /* NULL descriptor */ 354 .quad 0x0000000000000000 /* NULL descriptor */
389 .quad 0x008f9a000000ffff /* __KERNEL_COMPAT32_CS */ 355 .quad 0x0 /* unused */
390 .quad 0x00af9a000000ffff /* __KERNEL_CS */ 356 .quad 0x00af9a000000ffff /* __KERNEL_CS */
391 .quad 0x00cf92000000ffff /* __KERNEL_DS */ 357 .quad 0x00cf92000000ffff /* __KERNEL_DS */
392 .quad 0x00cffa000000ffff /* __USER32_CS */ 358 .quad 0x00cffa000000ffff /* __USER32_CS */
@@ -396,15 +362,15 @@ ENTRY(cpu_gdt_table)
396 .quad 0,0 /* TSS */ 362 .quad 0,0 /* TSS */
397 .quad 0,0 /* LDT */ 363 .quad 0,0 /* LDT */
398 .quad 0,0,0 /* three TLS descriptors */ 364 .quad 0,0,0 /* three TLS descriptors */
399 .quad 0x00009a000000ffff /* __KERNEL16_CS - 16bit PM for S3 wakeup. */ 365 .quad 0 /* unused */
400 /* base must be patched for real base address. */
401gdt_end: 366gdt_end:
402 /* asm/segment.h:GDT_ENTRIES must match this */ 367 /* asm/segment.h:GDT_ENTRIES must match this */
403 /* This should be a multiple of the cache line size */ 368 /* This should be a multiple of the cache line size */
404 /* GDTs of other CPUs: */ 369 /* GDTs of other CPUs are now dynamically allocated */
405 .fill (GDT_SIZE * NR_CPUS) - (gdt_end - cpu_gdt_table) 370
371 /* zero the remaining page */
372 .fill PAGE_SIZE / 8 - GDT_ENTRIES,8,0
406 373
407 .align L1_CACHE_BYTES
408ENTRY(idt_table) 374ENTRY(idt_table)
409 .rept 256 375 .rept 256
410 .quad 0 376 .quad 0
diff --git a/arch/x86_64/kernel/head64.c b/arch/x86_64/kernel/head64.c
index b675c5add01e..cea20a66c150 100644
--- a/arch/x86_64/kernel/head64.c
+++ b/arch/x86_64/kernel/head64.c
@@ -92,6 +92,9 @@ void __init x86_64_start_kernel(char * real_mode_data)
92 memcpy(init_level4_pgt, boot_level4_pgt, PTRS_PER_PGD*sizeof(pgd_t)); 92 memcpy(init_level4_pgt, boot_level4_pgt, PTRS_PER_PGD*sizeof(pgd_t));
93 asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt))); 93 asm volatile("movq %0,%%cr3" :: "r" (__pa_symbol(&init_level4_pgt)));
94 94
95 for (i = 0; i < NR_CPUS; i++)
96 cpu_pda(i) = &boot_cpu_pda[i];
97
95 pda_init(0); 98 pda_init(0);
96 copy_bootdata(real_mode_data); 99 copy_bootdata(real_mode_data);
97#ifdef CONFIG_SMP 100#ifdef CONFIG_SMP
@@ -99,7 +102,7 @@ void __init x86_64_start_kernel(char * real_mode_data)
99#endif 102#endif
100 s = strstr(saved_command_line, "earlyprintk="); 103 s = strstr(saved_command_line, "earlyprintk=");
101 if (s != NULL) 104 if (s != NULL)
102 setup_early_printk(s); 105 setup_early_printk(strchr(s, '=') + 1);
103#ifdef CONFIG_NUMA 106#ifdef CONFIG_NUMA
104 s = strstr(saved_command_line, "numa="); 107 s = strstr(saved_command_line, "numa=");
105 if (s != NULL) 108 if (s != NULL)
diff --git a/arch/x86_64/kernel/i387.c b/arch/x86_64/kernel/i387.c
index d9b22b633e39..a5d7e16b928e 100644
--- a/arch/x86_64/kernel/i387.c
+++ b/arch/x86_64/kernel/i387.c
@@ -95,7 +95,7 @@ int save_i387(struct _fpstate __user *buf)
95 if (!used_math()) 95 if (!used_math())
96 return 0; 96 return 0;
97 clear_used_math(); /* trigger finit */ 97 clear_used_math(); /* trigger finit */
98 if (tsk->thread_info->status & TS_USEDFPU) { 98 if (task_thread_info(tsk)->status & TS_USEDFPU) {
99 err = save_i387_checking((struct i387_fxsave_struct __user *)buf); 99 err = save_i387_checking((struct i387_fxsave_struct __user *)buf);
100 if (err) return err; 100 if (err) return err;
101 stts(); 101 stts();
diff --git a/arch/x86_64/kernel/i8259.c b/arch/x86_64/kernel/i8259.c
index 6e5101ad3d1a..5ecd34ab8c2b 100644
--- a/arch/x86_64/kernel/i8259.c
+++ b/arch/x86_64/kernel/i8259.c
@@ -133,7 +133,7 @@ static void end_8259A_irq (unsigned int irq)
133{ 133{
134 if (irq > 256) { 134 if (irq > 256) {
135 char var; 135 char var;
136 printk("return %p stack %p ti %p\n", __builtin_return_address(0), &var, current->thread_info); 136 printk("return %p stack %p ti %p\n", __builtin_return_address(0), &var, task_thread_info(current));
137 137
138 BUG(); 138 BUG();
139 } 139 }
@@ -549,10 +549,9 @@ void __init init_IRQ(void)
549 int vector = FIRST_EXTERNAL_VECTOR + i; 549 int vector = FIRST_EXTERNAL_VECTOR + i;
550 if (i >= NR_IRQS) 550 if (i >= NR_IRQS)
551 break; 551 break;
552 if (vector != IA32_SYSCALL_VECTOR && vector != KDB_VECTOR) { 552 if (vector != IA32_SYSCALL_VECTOR)
553 set_intr_gate(vector, interrupt[i]); 553 set_intr_gate(vector, interrupt[i]);
554 } 554 }
555 }
556 555
557#ifdef CONFIG_SMP 556#ifdef CONFIG_SMP
558 /* 557 /*
diff --git a/arch/x86_64/kernel/init_task.c b/arch/x86_64/kernel/init_task.c
index e0ba5c1043fd..ce31d904d601 100644
--- a/arch/x86_64/kernel/init_task.c
+++ b/arch/x86_64/kernel/init_task.c
@@ -44,6 +44,6 @@ EXPORT_SYMBOL(init_task);
44 * section. Since TSS's are completely CPU-local, we want them 44 * section. Since TSS's are completely CPU-local, we want them
45 * on exact cacheline boundaries, to eliminate cacheline ping-pong. 45 * on exact cacheline boundaries, to eliminate cacheline ping-pong.
46 */ 46 */
47DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_maxaligned_in_smp = INIT_TSS; 47DEFINE_PER_CPU(struct tss_struct, init_tss) ____cacheline_internodealigned_in_smp = INIT_TSS;
48 48
49#define ALIGN_TO_4K __attribute__((section(".data.init_task"))) 49#define ALIGN_TO_4K __attribute__((section(".data.init_task")))
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 97154ab058b4..1a5060b434b8 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -37,6 +37,7 @@
37#include <asm/proto.h> 37#include <asm/proto.h>
38#include <asm/mach_apic.h> 38#include <asm/mach_apic.h>
39#include <asm/acpi.h> 39#include <asm/acpi.h>
40#include <asm/dma.h>
40 41
41#define __apicdebuginit __init 42#define __apicdebuginit __init
42 43
@@ -46,6 +47,9 @@ static int no_timer_check;
46 47
47int disable_timer_pin_1 __initdata; 48int disable_timer_pin_1 __initdata;
48 49
50/* Where if anywhere is the i8259 connect in external int mode */
51static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
52
49static DEFINE_SPINLOCK(ioapic_lock); 53static DEFINE_SPINLOCK(ioapic_lock);
50 54
51/* 55/*
@@ -260,9 +264,6 @@ __setup("apic", enable_ioapic_setup);
260void __init check_ioapic(void) 264void __init check_ioapic(void)
261{ 265{
262 int num,slot,func; 266 int num,slot,func;
263 if (ioapic_force)
264 return;
265
266 /* Poor man's PCI discovery */ 267 /* Poor man's PCI discovery */
267 for (num = 0; num < 32; num++) { 268 for (num = 0; num < 32; num++) {
268 for (slot = 0; slot < 32; slot++) { 269 for (slot = 0; slot < 32; slot++) {
@@ -284,7 +285,7 @@ void __init check_ioapic(void)
284 switch (vendor) { 285 switch (vendor) {
285 case PCI_VENDOR_ID_VIA: 286 case PCI_VENDOR_ID_VIA:
286#ifdef CONFIG_GART_IOMMU 287#ifdef CONFIG_GART_IOMMU
287 if ((end_pfn >= (0xffffffff>>PAGE_SHIFT) || 288 if ((end_pfn > MAX_DMA32_PFN ||
288 force_iommu) && 289 force_iommu) &&
289 !iommu_aperture_allowed) { 290 !iommu_aperture_allowed) {
290 printk(KERN_INFO 291 printk(KERN_INFO
@@ -363,7 +364,7 @@ static int find_irq_entry(int apic, int pin, int type)
363/* 364/*
364 * Find the pin to which IRQ[irq] (ISA) is connected 365 * Find the pin to which IRQ[irq] (ISA) is connected
365 */ 366 */
366static int find_isa_irq_pin(int irq, int type) 367static int __init find_isa_irq_pin(int irq, int type)
367{ 368{
368 int i; 369 int i;
369 370
@@ -381,6 +382,31 @@ static int find_isa_irq_pin(int irq, int type)
381 return -1; 382 return -1;
382} 383}
383 384
385static int __init find_isa_irq_apic(int irq, int type)
386{
387 int i;
388
389 for (i = 0; i < mp_irq_entries; i++) {
390 int lbus = mp_irqs[i].mpc_srcbus;
391
392 if ((mp_bus_id_to_type[lbus] == MP_BUS_ISA ||
393 mp_bus_id_to_type[lbus] == MP_BUS_EISA ||
394 mp_bus_id_to_type[lbus] == MP_BUS_MCA) &&
395 (mp_irqs[i].mpc_irqtype == type) &&
396 (mp_irqs[i].mpc_srcbusirq == irq))
397 break;
398 }
399 if (i < mp_irq_entries) {
400 int apic;
401 for(apic = 0; apic < nr_ioapics; apic++) {
402 if (mp_ioapics[apic].mpc_apicid == mp_irqs[i].mpc_dstapic)
403 return apic;
404 }
405 }
406
407 return -1;
408}
409
384/* 410/*
385 * Find a specific PCI IRQ entry. 411 * Find a specific PCI IRQ entry.
386 * Not an __init, possibly needed by modules 412 * Not an __init, possibly needed by modules
@@ -874,7 +900,7 @@ static void __init setup_IO_APIC_irqs(void)
874 * Set up the 8259A-master output pin as broadcast to all 900 * Set up the 8259A-master output pin as broadcast to all
875 * CPUs. 901 * CPUs.
876 */ 902 */
877static void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector) 903static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, int vector)
878{ 904{
879 struct IO_APIC_route_entry entry; 905 struct IO_APIC_route_entry entry;
880 unsigned long flags; 906 unsigned long flags;
@@ -884,7 +910,7 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector)
884 disable_8259A_irq(0); 910 disable_8259A_irq(0);
885 911
886 /* mask LVT0 */ 912 /* mask LVT0 */
887 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 913 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
888 914
889 /* 915 /*
890 * We use logical delivery to get the timer IRQ 916 * We use logical delivery to get the timer IRQ
@@ -908,8 +934,8 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int pin, int vector)
908 * Add it to the IO-APIC irq-routing table: 934 * Add it to the IO-APIC irq-routing table:
909 */ 935 */
910 spin_lock_irqsave(&ioapic_lock, flags); 936 spin_lock_irqsave(&ioapic_lock, flags);
911 io_apic_write(0, 0x11+2*pin, *(((int *)&entry)+1)); 937 io_apic_write(apic, 0x11+2*pin, *(((int *)&entry)+1));
912 io_apic_write(0, 0x10+2*pin, *(((int *)&entry)+0)); 938 io_apic_write(apic, 0x10+2*pin, *(((int *)&entry)+0));
913 spin_unlock_irqrestore(&ioapic_lock, flags); 939 spin_unlock_irqrestore(&ioapic_lock, flags);
914 940
915 enable_8259A_irq(0); 941 enable_8259A_irq(0);
@@ -1188,7 +1214,8 @@ void __apicdebuginit print_PIC(void)
1188static void __init enable_IO_APIC(void) 1214static void __init enable_IO_APIC(void)
1189{ 1215{
1190 union IO_APIC_reg_01 reg_01; 1216 union IO_APIC_reg_01 reg_01;
1191 int i; 1217 int i8259_apic, i8259_pin;
1218 int i, apic;
1192 unsigned long flags; 1219 unsigned long flags;
1193 1220
1194 for (i = 0; i < PIN_MAP_SIZE; i++) { 1221 for (i = 0; i < PIN_MAP_SIZE; i++) {
@@ -1202,11 +1229,48 @@ static void __init enable_IO_APIC(void)
1202 /* 1229 /*
1203 * The number of IO-APIC IRQ registers (== #pins): 1230 * The number of IO-APIC IRQ registers (== #pins):
1204 */ 1231 */
1205 for (i = 0; i < nr_ioapics; i++) { 1232 for (apic = 0; apic < nr_ioapics; apic++) {
1206 spin_lock_irqsave(&ioapic_lock, flags); 1233 spin_lock_irqsave(&ioapic_lock, flags);
1207 reg_01.raw = io_apic_read(i, 1); 1234 reg_01.raw = io_apic_read(apic, 1);
1208 spin_unlock_irqrestore(&ioapic_lock, flags); 1235 spin_unlock_irqrestore(&ioapic_lock, flags);
1209 nr_ioapic_registers[i] = reg_01.bits.entries+1; 1236 nr_ioapic_registers[apic] = reg_01.bits.entries+1;
1237 }
1238 for(apic = 0; apic < nr_ioapics; apic++) {
1239 int pin;
1240 /* See if any of the pins is in ExtINT mode */
1241 for (pin = 0; pin < nr_ioapic_registers[apic]; pin++) {
1242 struct IO_APIC_route_entry entry;
1243 spin_lock_irqsave(&ioapic_lock, flags);
1244 *(((int *)&entry) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
1245 *(((int *)&entry) + 1) = io_apic_read(apic, 0x11 + 2 * pin);
1246 spin_unlock_irqrestore(&ioapic_lock, flags);
1247
1248
1249 /* If the interrupt line is enabled and in ExtInt mode
1250 * I have found the pin where the i8259 is connected.
1251 */
1252 if ((entry.mask == 0) && (entry.delivery_mode == dest_ExtINT)) {
1253 ioapic_i8259.apic = apic;
1254 ioapic_i8259.pin = pin;
1255 goto found_i8259;
1256 }
1257 }
1258 }
1259 found_i8259:
1260 /* Look to see what if the MP table has reported the ExtINT */
1261 i8259_pin = find_isa_irq_pin(0, mp_ExtINT);
1262 i8259_apic = find_isa_irq_apic(0, mp_ExtINT);
1263 /* Trust the MP table if nothing is setup in the hardware */
1264 if ((ioapic_i8259.pin == -1) && (i8259_pin >= 0)) {
1265 printk(KERN_WARNING "ExtINT not setup in hardware but reported by MP table\n");
1266 ioapic_i8259.pin = i8259_pin;
1267 ioapic_i8259.apic = i8259_apic;
1268 }
1269 /* Complain if the MP table and the hardware disagree */
1270 if (((ioapic_i8259.apic != i8259_apic) || (ioapic_i8259.pin != i8259_pin)) &&
1271 (i8259_pin >= 0) && (ioapic_i8259.pin >= 0))
1272 {
1273 printk(KERN_WARNING "ExtINT in hardware and MP table differ\n");
1210 } 1274 }
1211 1275
1212 /* 1276 /*
@@ -1220,7 +1284,6 @@ static void __init enable_IO_APIC(void)
1220 */ 1284 */
1221void disable_IO_APIC(void) 1285void disable_IO_APIC(void)
1222{ 1286{
1223 int pin;
1224 /* 1287 /*
1225 * Clear the IO-APIC before rebooting: 1288 * Clear the IO-APIC before rebooting:
1226 */ 1289 */
@@ -1231,8 +1294,7 @@ void disable_IO_APIC(void)
1231 * Put that IOAPIC in virtual wire mode 1294 * Put that IOAPIC in virtual wire mode
1232 * so legacy interrupts can be delivered. 1295 * so legacy interrupts can be delivered.
1233 */ 1296 */
1234 pin = find_isa_irq_pin(0, mp_ExtINT); 1297 if (ioapic_i8259.pin != -1) {
1235 if (pin != -1) {
1236 struct IO_APIC_route_entry entry; 1298 struct IO_APIC_route_entry entry;
1237 unsigned long flags; 1299 unsigned long flags;
1238 1300
@@ -1243,21 +1305,23 @@ void disable_IO_APIC(void)
1243 entry.polarity = 0; /* High */ 1305 entry.polarity = 0; /* High */
1244 entry.delivery_status = 0; 1306 entry.delivery_status = 0;
1245 entry.dest_mode = 0; /* Physical */ 1307 entry.dest_mode = 0; /* Physical */
1246 entry.delivery_mode = 7; /* ExtInt */ 1308 entry.delivery_mode = dest_ExtINT; /* ExtInt */
1247 entry.vector = 0; 1309 entry.vector = 0;
1248 entry.dest.physical.physical_dest = 0; 1310 entry.dest.physical.physical_dest =
1249 1311 GET_APIC_ID(apic_read(APIC_ID));
1250 1312
1251 /* 1313 /*
1252 * Add it to the IO-APIC irq-routing table: 1314 * Add it to the IO-APIC irq-routing table:
1253 */ 1315 */
1254 spin_lock_irqsave(&ioapic_lock, flags); 1316 spin_lock_irqsave(&ioapic_lock, flags);
1255 io_apic_write(0, 0x11+2*pin, *(((int *)&entry)+1)); 1317 io_apic_write(ioapic_i8259.apic, 0x11+2*ioapic_i8259.pin,
1256 io_apic_write(0, 0x10+2*pin, *(((int *)&entry)+0)); 1318 *(((int *)&entry)+1));
1319 io_apic_write(ioapic_i8259.apic, 0x10+2*ioapic_i8259.pin,
1320 *(((int *)&entry)+0));
1257 spin_unlock_irqrestore(&ioapic_lock, flags); 1321 spin_unlock_irqrestore(&ioapic_lock, flags);
1258 } 1322 }
1259 1323
1260 disconnect_bsp_APIC(pin != -1); 1324 disconnect_bsp_APIC(ioapic_i8259.pin != -1);
1261} 1325}
1262 1326
1263/* 1327/*
@@ -1571,7 +1635,7 @@ static void enable_lapic_irq (unsigned int irq)
1571 unsigned long v; 1635 unsigned long v;
1572 1636
1573 v = apic_read(APIC_LVT0); 1637 v = apic_read(APIC_LVT0);
1574 apic_write_around(APIC_LVT0, v & ~APIC_LVT_MASKED); 1638 apic_write(APIC_LVT0, v & ~APIC_LVT_MASKED);
1575} 1639}
1576 1640
1577static void disable_lapic_irq (unsigned int irq) 1641static void disable_lapic_irq (unsigned int irq)
@@ -1579,7 +1643,7 @@ static void disable_lapic_irq (unsigned int irq)
1579 unsigned long v; 1643 unsigned long v;
1580 1644
1581 v = apic_read(APIC_LVT0); 1645 v = apic_read(APIC_LVT0);
1582 apic_write_around(APIC_LVT0, v | APIC_LVT_MASKED); 1646 apic_write(APIC_LVT0, v | APIC_LVT_MASKED);
1583} 1647}
1584 1648
1585static void ack_lapic_irq (unsigned int irq) 1649static void ack_lapic_irq (unsigned int irq)
@@ -1626,20 +1690,21 @@ static void setup_nmi (void)
1626 */ 1690 */
1627static inline void unlock_ExtINT_logic(void) 1691static inline void unlock_ExtINT_logic(void)
1628{ 1692{
1629 int pin, i; 1693 int apic, pin, i;
1630 struct IO_APIC_route_entry entry0, entry1; 1694 struct IO_APIC_route_entry entry0, entry1;
1631 unsigned char save_control, save_freq_select; 1695 unsigned char save_control, save_freq_select;
1632 unsigned long flags; 1696 unsigned long flags;
1633 1697
1634 pin = find_isa_irq_pin(8, mp_INT); 1698 pin = find_isa_irq_pin(8, mp_INT);
1699 apic = find_isa_irq_apic(8, mp_INT);
1635 if (pin == -1) 1700 if (pin == -1)
1636 return; 1701 return;
1637 1702
1638 spin_lock_irqsave(&ioapic_lock, flags); 1703 spin_lock_irqsave(&ioapic_lock, flags);
1639 *(((int *)&entry0) + 1) = io_apic_read(0, 0x11 + 2 * pin); 1704 *(((int *)&entry0) + 1) = io_apic_read(apic, 0x11 + 2 * pin);
1640 *(((int *)&entry0) + 0) = io_apic_read(0, 0x10 + 2 * pin); 1705 *(((int *)&entry0) + 0) = io_apic_read(apic, 0x10 + 2 * pin);
1641 spin_unlock_irqrestore(&ioapic_lock, flags); 1706 spin_unlock_irqrestore(&ioapic_lock, flags);
1642 clear_IO_APIC_pin(0, pin); 1707 clear_IO_APIC_pin(apic, pin);
1643 1708
1644 memset(&entry1, 0, sizeof(entry1)); 1709 memset(&entry1, 0, sizeof(entry1));
1645 1710
@@ -1652,8 +1717,8 @@ static inline void unlock_ExtINT_logic(void)
1652 entry1.vector = 0; 1717 entry1.vector = 0;
1653 1718
1654 spin_lock_irqsave(&ioapic_lock, flags); 1719 spin_lock_irqsave(&ioapic_lock, flags);
1655 io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry1) + 1)); 1720 io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry1) + 1));
1656 io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry1) + 0)); 1721 io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry1) + 0));
1657 spin_unlock_irqrestore(&ioapic_lock, flags); 1722 spin_unlock_irqrestore(&ioapic_lock, flags);
1658 1723
1659 save_control = CMOS_READ(RTC_CONTROL); 1724 save_control = CMOS_READ(RTC_CONTROL);
@@ -1671,11 +1736,11 @@ static inline void unlock_ExtINT_logic(void)
1671 1736
1672 CMOS_WRITE(save_control, RTC_CONTROL); 1737 CMOS_WRITE(save_control, RTC_CONTROL);
1673 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); 1738 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
1674 clear_IO_APIC_pin(0, pin); 1739 clear_IO_APIC_pin(apic, pin);
1675 1740
1676 spin_lock_irqsave(&ioapic_lock, flags); 1741 spin_lock_irqsave(&ioapic_lock, flags);
1677 io_apic_write(0, 0x11 + 2 * pin, *(((int *)&entry0) + 1)); 1742 io_apic_write(apic, 0x11 + 2 * pin, *(((int *)&entry0) + 1));
1678 io_apic_write(0, 0x10 + 2 * pin, *(((int *)&entry0) + 0)); 1743 io_apic_write(apic, 0x10 + 2 * pin, *(((int *)&entry0) + 0));
1679 spin_unlock_irqrestore(&ioapic_lock, flags); 1744 spin_unlock_irqrestore(&ioapic_lock, flags);
1680} 1745}
1681 1746
@@ -1687,7 +1752,7 @@ static inline void unlock_ExtINT_logic(void)
1687 */ 1752 */
1688static inline void check_timer(void) 1753static inline void check_timer(void)
1689{ 1754{
1690 int pin1, pin2; 1755 int apic1, pin1, apic2, pin2;
1691 int vector; 1756 int vector;
1692 1757
1693 /* 1758 /*
@@ -1704,14 +1769,17 @@ static inline void check_timer(void)
1704 * the 8259A which implies the virtual wire has to be 1769 * the 8259A which implies the virtual wire has to be
1705 * disabled in the local APIC. 1770 * disabled in the local APIC.
1706 */ 1771 */
1707 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT); 1772 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_EXTINT);
1708 init_8259A(1); 1773 init_8259A(1);
1709 enable_8259A_irq(0); 1774 enable_8259A_irq(0);
1710 1775
1711 pin1 = find_isa_irq_pin(0, mp_INT); 1776 pin1 = find_isa_irq_pin(0, mp_INT);
1712 pin2 = find_isa_irq_pin(0, mp_ExtINT); 1777 apic1 = find_isa_irq_apic(0, mp_INT);
1778 pin2 = ioapic_i8259.pin;
1779 apic2 = ioapic_i8259.apic;
1713 1780
1714 apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X pin1=%d pin2=%d\n", vector, pin1, pin2); 1781 apic_printk(APIC_VERBOSE,KERN_INFO "..TIMER: vector=0x%02X apic1=%d pin1=%d apic2=%d pin2=%d\n",
1782 vector, apic1, pin1, apic2, pin2);
1715 1783
1716 if (pin1 != -1) { 1784 if (pin1 != -1) {
1717 /* 1785 /*
@@ -1729,17 +1797,20 @@ static inline void check_timer(void)
1729 clear_IO_APIC_pin(0, pin1); 1797 clear_IO_APIC_pin(0, pin1);
1730 return; 1798 return;
1731 } 1799 }
1732 clear_IO_APIC_pin(0, pin1); 1800 clear_IO_APIC_pin(apic1, pin1);
1733 apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not connected to IO-APIC\n"); 1801 apic_printk(APIC_QUIET,KERN_ERR "..MP-BIOS bug: 8254 timer not "
1802 "connected to IO-APIC\n");
1734 } 1803 }
1735 1804
1736 apic_printk(APIC_VERBOSE,KERN_INFO "...trying to set up timer (IRQ0) through the 8259A ... "); 1805 apic_printk(APIC_VERBOSE,KERN_INFO "...trying to set up timer (IRQ0) "
1806 "through the 8259A ... ");
1737 if (pin2 != -1) { 1807 if (pin2 != -1) {
1738 apic_printk(APIC_VERBOSE,"\n..... (found pin %d) ...", pin2); 1808 apic_printk(APIC_VERBOSE,"\n..... (found apic %d pin %d) ...",
1809 apic2, pin2);
1739 /* 1810 /*
1740 * legacy devices should be connected to IO APIC #0 1811 * legacy devices should be connected to IO APIC #0
1741 */ 1812 */
1742 setup_ExtINT_IRQ0_pin(pin2, vector); 1813 setup_ExtINT_IRQ0_pin(apic2, pin2, vector);
1743 if (timer_irq_works()) { 1814 if (timer_irq_works()) {
1744 printk("works.\n"); 1815 printk("works.\n");
1745 nmi_watchdog_default(); 1816 nmi_watchdog_default();
@@ -1751,7 +1822,7 @@ static inline void check_timer(void)
1751 /* 1822 /*
1752 * Cleanup, just in case ... 1823 * Cleanup, just in case ...
1753 */ 1824 */
1754 clear_IO_APIC_pin(0, pin2); 1825 clear_IO_APIC_pin(apic2, pin2);
1755 } 1826 }
1756 printk(" failed.\n"); 1827 printk(" failed.\n");
1757 1828
@@ -1764,21 +1835,21 @@ static inline void check_timer(void)
1764 1835
1765 disable_8259A_irq(0); 1836 disable_8259A_irq(0);
1766 irq_desc[0].handler = &lapic_irq_type; 1837 irq_desc[0].handler = &lapic_irq_type;
1767 apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */ 1838 apic_write(APIC_LVT0, APIC_DM_FIXED | vector); /* Fixed mode */
1768 enable_8259A_irq(0); 1839 enable_8259A_irq(0);
1769 1840
1770 if (timer_irq_works()) { 1841 if (timer_irq_works()) {
1771 apic_printk(APIC_QUIET, " works.\n"); 1842 apic_printk(APIC_QUIET, " works.\n");
1772 return; 1843 return;
1773 } 1844 }
1774 apic_write_around(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector); 1845 apic_write(APIC_LVT0, APIC_LVT_MASKED | APIC_DM_FIXED | vector);
1775 apic_printk(APIC_VERBOSE," failed.\n"); 1846 apic_printk(APIC_VERBOSE," failed.\n");
1776 1847
1777 apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as ExtINT IRQ..."); 1848 apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as ExtINT IRQ...");
1778 1849
1779 init_8259A(0); 1850 init_8259A(0);
1780 make_8259A_irq(0); 1851 make_8259A_irq(0);
1781 apic_write_around(APIC_LVT0, APIC_DM_EXTINT); 1852 apic_write(APIC_LVT0, APIC_DM_EXTINT);
1782 1853
1783 unlock_ExtINT_logic(); 1854 unlock_ExtINT_logic();
1784 1855
@@ -1956,7 +2027,7 @@ int __init io_apic_get_redir_entries (int ioapic)
1956} 2027}
1957 2028
1958 2029
1959int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low) 2030int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int polarity)
1960{ 2031{
1961 struct IO_APIC_route_entry entry; 2032 struct IO_APIC_route_entry entry;
1962 unsigned long flags; 2033 unsigned long flags;
@@ -1978,8 +2049,8 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
1978 entry.delivery_mode = INT_DELIVERY_MODE; 2049 entry.delivery_mode = INT_DELIVERY_MODE;
1979 entry.dest_mode = INT_DEST_MODE; 2050 entry.dest_mode = INT_DEST_MODE;
1980 entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS); 2051 entry.dest.logical.logical_dest = cpu_mask_to_apicid(TARGET_CPUS);
1981 entry.trigger = edge_level; 2052 entry.trigger = triggering;
1982 entry.polarity = active_high_low; 2053 entry.polarity = polarity;
1983 entry.mask = 1; /* Disabled (masked) */ 2054 entry.mask = 1; /* Disabled (masked) */
1984 2055
1985 irq = gsi_irq_sharing(irq); 2056 irq = gsi_irq_sharing(irq);
@@ -1994,9 +2065,9 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
1994 apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> " 2065 apic_printk(APIC_VERBOSE,KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> "
1995 "IRQ %d Mode:%i Active:%i)\n", ioapic, 2066 "IRQ %d Mode:%i Active:%i)\n", ioapic,
1996 mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq, 2067 mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq,
1997 edge_level, active_high_low); 2068 triggering, polarity);
1998 2069
1999 ioapic_register_intr(irq, entry.vector, edge_level); 2070 ioapic_register_intr(irq, entry.vector, triggering);
2000 2071
2001 if (!ioapic && (irq < 16)) 2072 if (!ioapic && (irq < 16))
2002 disable_8259A_irq(irq); 2073 disable_8259A_irq(irq);
diff --git a/arch/x86_64/kernel/ioport.c b/arch/x86_64/kernel/ioport.c
index cde0e868efe3..b81614970ecc 100644
--- a/arch/x86_64/kernel/ioport.c
+++ b/arch/x86_64/kernel/ioport.c
@@ -7,6 +7,7 @@
7 7
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/capability.h>
10#include <linux/errno.h> 11#include <linux/errno.h>
11#include <linux/types.h> 12#include <linux/types.h>
12#include <linux/ioport.h> 13#include <linux/ioport.h>
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
index d6a04a8320a3..30d2a1e545fe 100644
--- a/arch/x86_64/kernel/irq.c
+++ b/arch/x86_64/kernel/irq.c
@@ -17,6 +17,7 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19#include <asm/io_apic.h> 19#include <asm/io_apic.h>
20#include <asm/idle.h>
20 21
21atomic_t irq_err_count; 22atomic_t irq_err_count;
22#ifdef CONFIG_X86_IO_APIC 23#ifdef CONFIG_X86_IO_APIC
@@ -69,13 +70,13 @@ skip:
69 seq_printf(p, "NMI: "); 70 seq_printf(p, "NMI: ");
70 for (j = 0; j < NR_CPUS; j++) 71 for (j = 0; j < NR_CPUS; j++)
71 if (cpu_online(j)) 72 if (cpu_online(j))
72 seq_printf(p, "%10u ", cpu_pda[j].__nmi_count); 73 seq_printf(p, "%10u ", cpu_pda(j)->__nmi_count);
73 seq_putc(p, '\n'); 74 seq_putc(p, '\n');
74#ifdef CONFIG_X86_LOCAL_APIC 75#ifdef CONFIG_X86_LOCAL_APIC
75 seq_printf(p, "LOC: "); 76 seq_printf(p, "LOC: ");
76 for (j = 0; j < NR_CPUS; j++) 77 for (j = 0; j < NR_CPUS; j++)
77 if (cpu_online(j)) 78 if (cpu_online(j))
78 seq_printf(p, "%10u ", cpu_pda[j].apic_timer_irqs); 79 seq_printf(p, "%10u ", cpu_pda(j)->apic_timer_irqs);
79 seq_putc(p, '\n'); 80 seq_putc(p, '\n');
80#endif 81#endif
81 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); 82 seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
@@ -98,6 +99,7 @@ asmlinkage unsigned int do_IRQ(struct pt_regs *regs)
98 /* high bits used in ret_from_ code */ 99 /* high bits used in ret_from_ code */
99 unsigned irq = regs->orig_rax & 0xff; 100 unsigned irq = regs->orig_rax & 0xff;
100 101
102 exit_idle();
101 irq_enter(); 103 irq_enter();
102 104
103 __do_IRQ(irq, regs); 105 __do_IRQ(irq, regs);
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c
index dddeb678b440..8b866a8572cf 100644
--- a/arch/x86_64/kernel/kprobes.c
+++ b/arch/x86_64/kernel/kprobes.c
@@ -42,8 +42,8 @@
42#include <asm/pgtable.h> 42#include <asm/pgtable.h>
43#include <asm/kdebug.h> 43#include <asm/kdebug.h>
44 44
45static DECLARE_MUTEX(kprobe_mutex);
46void jprobe_return_end(void); 45void jprobe_return_end(void);
46static void __kprobes arch_copy_kprobe(struct kprobe *p);
47 47
48DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL; 48DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
49DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk); 49DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
@@ -69,12 +69,11 @@ static inline int is_IF_modifier(kprobe_opcode_t *insn)
69int __kprobes arch_prepare_kprobe(struct kprobe *p) 69int __kprobes arch_prepare_kprobe(struct kprobe *p)
70{ 70{
71 /* insn: must be on special executable page on x86_64. */ 71 /* insn: must be on special executable page on x86_64. */
72 down(&kprobe_mutex);
73 p->ainsn.insn = get_insn_slot(); 72 p->ainsn.insn = get_insn_slot();
74 up(&kprobe_mutex);
75 if (!p->ainsn.insn) { 73 if (!p->ainsn.insn) {
76 return -ENOMEM; 74 return -ENOMEM;
77 } 75 }
76 arch_copy_kprobe(p);
78 return 0; 77 return 0;
79} 78}
80 79
@@ -181,7 +180,7 @@ static inline s32 *is_riprel(u8 *insn)
181 return NULL; 180 return NULL;
182} 181}
183 182
184void __kprobes arch_copy_kprobe(struct kprobe *p) 183static void __kprobes arch_copy_kprobe(struct kprobe *p)
185{ 184{
186 s32 *ripdisp; 185 s32 *ripdisp;
187 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE); 186 memcpy(p->ainsn.insn, p->addr, MAX_INSN_SIZE);
@@ -329,12 +328,21 @@ int __kprobes kprobe_handler(struct pt_regs *regs)
329 */ 328 */
330 save_previous_kprobe(kcb); 329 save_previous_kprobe(kcb);
331 set_current_kprobe(p, regs, kcb); 330 set_current_kprobe(p, regs, kcb);
332 p->nmissed++; 331 kprobes_inc_nmissed_count(p);
333 prepare_singlestep(p, regs); 332 prepare_singlestep(p, regs);
334 kcb->kprobe_status = KPROBE_REENTER; 333 kcb->kprobe_status = KPROBE_REENTER;
335 return 1; 334 return 1;
336 } 335 }
337 } else { 336 } else {
337 if (*addr != BREAKPOINT_INSTRUCTION) {
338 /* The breakpoint instruction was removed by
339 * another cpu right after we hit, no further
340 * handling of this interrupt is appropriate
341 */
342 regs->rip = (unsigned long)addr;
343 ret = 1;
344 goto no_kprobe;
345 }
338 p = __get_cpu_var(current_kprobe); 346 p = __get_cpu_var(current_kprobe);
339 if (p->break_handler && p->break_handler(p, regs)) { 347 if (p->break_handler && p->break_handler(p, regs)) {
340 goto ss_probe; 348 goto ss_probe;
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index 183dc6105429..13a2eada6c95 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -15,6 +15,7 @@
15#include <linux/sysdev.h> 15#include <linux/sysdev.h>
16#include <linux/miscdevice.h> 16#include <linux/miscdevice.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/capability.h>
18#include <linux/cpu.h> 19#include <linux/cpu.h>
19#include <linux/percpu.h> 20#include <linux/percpu.h>
20#include <linux/ctype.h> 21#include <linux/ctype.h>
@@ -23,9 +24,10 @@
23#include <asm/mce.h> 24#include <asm/mce.h>
24#include <asm/kdebug.h> 25#include <asm/kdebug.h>
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
27#include <asm/smp.h>
26 28
27#define MISC_MCELOG_MINOR 227 29#define MISC_MCELOG_MINOR 227
28#define NR_BANKS 5 30#define NR_BANKS 6
29 31
30static int mce_dont_init; 32static int mce_dont_init;
31 33
@@ -91,6 +93,7 @@ void mce_log(struct mce *mce)
91static void print_mce(struct mce *m) 93static void print_mce(struct mce *m)
92{ 94{
93 printk(KERN_EMERG "\n" 95 printk(KERN_EMERG "\n"
96 KERN_EMERG "HARDWARE ERROR\n"
94 KERN_EMERG 97 KERN_EMERG
95 "CPU %d: Machine Check Exception: %16Lx Bank %d: %016Lx\n", 98 "CPU %d: Machine Check Exception: %16Lx Bank %d: %016Lx\n",
96 m->cpu, m->mcgstatus, m->bank, m->status); 99 m->cpu, m->mcgstatus, m->bank, m->status);
@@ -109,6 +112,9 @@ static void print_mce(struct mce *m)
109 if (m->misc) 112 if (m->misc)
110 printk("MISC %Lx ", m->misc); 113 printk("MISC %Lx ", m->misc);
111 printk("\n"); 114 printk("\n");
115 printk(KERN_EMERG "This is not a software problem!\n");
116 printk(KERN_EMERG
117 "Run through mcelog --ascii to decode and contact your hardware vendor\n");
112} 118}
113 119
114static void mce_panic(char *msg, struct mce *backup, unsigned long start) 120static void mce_panic(char *msg, struct mce *backup, unsigned long start)
@@ -168,12 +174,12 @@ void do_machine_check(struct pt_regs * regs, long error_code)
168 int panicm_found = 0; 174 int panicm_found = 0;
169 175
170 if (regs) 176 if (regs)
171 notify_die(DIE_NMI, "machine check", regs, error_code, 255, SIGKILL); 177 notify_die(DIE_NMI, "machine check", regs, error_code, 18, SIGKILL);
172 if (!banks) 178 if (!banks)
173 return; 179 return;
174 180
175 memset(&m, 0, sizeof(struct mce)); 181 memset(&m, 0, sizeof(struct mce));
176 m.cpu = hard_smp_processor_id(); 182 m.cpu = safe_smp_processor_id();
177 rdmsrl(MSR_IA32_MCG_STATUS, m.mcgstatus); 183 rdmsrl(MSR_IA32_MCG_STATUS, m.mcgstatus);
178 if (!(m.mcgstatus & MCG_STATUS_RIPV)) 184 if (!(m.mcgstatus & MCG_STATUS_RIPV))
179 kill_it = 1; 185 kill_it = 1;
@@ -573,6 +579,10 @@ ACCESSOR(bank1ctl,bank[1],mce_restart())
573ACCESSOR(bank2ctl,bank[2],mce_restart()) 579ACCESSOR(bank2ctl,bank[2],mce_restart())
574ACCESSOR(bank3ctl,bank[3],mce_restart()) 580ACCESSOR(bank3ctl,bank[3],mce_restart())
575ACCESSOR(bank4ctl,bank[4],mce_restart()) 581ACCESSOR(bank4ctl,bank[4],mce_restart())
582ACCESSOR(bank5ctl,bank[5],mce_restart())
583static struct sysdev_attribute * bank_attributes[NR_BANKS] = {
584 &attr_bank0ctl, &attr_bank1ctl, &attr_bank2ctl,
585 &attr_bank3ctl, &attr_bank4ctl, &attr_bank5ctl};
576ACCESSOR(tolerant,tolerant,) 586ACCESSOR(tolerant,tolerant,)
577ACCESSOR(check_interval,check_interval,mce_restart()) 587ACCESSOR(check_interval,check_interval,mce_restart())
578 588
@@ -580,6 +590,7 @@ ACCESSOR(check_interval,check_interval,mce_restart())
580static __cpuinit int mce_create_device(unsigned int cpu) 590static __cpuinit int mce_create_device(unsigned int cpu)
581{ 591{
582 int err; 592 int err;
593 int i;
583 if (!mce_available(&cpu_data[cpu])) 594 if (!mce_available(&cpu_data[cpu]))
584 return -EIO; 595 return -EIO;
585 596
@@ -589,11 +600,9 @@ static __cpuinit int mce_create_device(unsigned int cpu)
589 err = sysdev_register(&per_cpu(device_mce,cpu)); 600 err = sysdev_register(&per_cpu(device_mce,cpu));
590 601
591 if (!err) { 602 if (!err) {
592 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank0ctl); 603 for (i = 0; i < banks; i++)
593 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank1ctl); 604 sysdev_create_file(&per_cpu(device_mce,cpu),
594 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank2ctl); 605 bank_attributes[i]);
595 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank3ctl);
596 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank4ctl);
597 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_tolerant); 606 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_tolerant);
598 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_check_interval); 607 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_check_interval);
599 } 608 }
@@ -603,11 +612,11 @@ static __cpuinit int mce_create_device(unsigned int cpu)
603#ifdef CONFIG_HOTPLUG_CPU 612#ifdef CONFIG_HOTPLUG_CPU
604static __cpuinit void mce_remove_device(unsigned int cpu) 613static __cpuinit void mce_remove_device(unsigned int cpu)
605{ 614{
606 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank0ctl); 615 int i;
607 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank1ctl); 616
608 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank2ctl); 617 for (i = 0; i < banks; i++)
609 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank3ctl); 618 sysdev_remove_file(&per_cpu(device_mce,cpu),
610 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank4ctl); 619 bank_attributes[i]);
611 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_tolerant); 620 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_tolerant);
612 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval); 621 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval);
613 sysdev_unregister(&per_cpu(device_mce,cpu)); 622 sysdev_unregister(&per_cpu(device_mce,cpu));
diff --git a/arch/x86_64/kernel/mce_amd.c b/arch/x86_64/kernel/mce_amd.c
index 1f76175ace02..d3ad7d81266d 100644
--- a/arch/x86_64/kernel/mce_amd.c
+++ b/arch/x86_64/kernel/mce_amd.c
@@ -27,6 +27,7 @@
27#include <asm/mce.h> 27#include <asm/mce.h>
28#include <asm/msr.h> 28#include <asm/msr.h>
29#include <asm/percpu.h> 29#include <asm/percpu.h>
30#include <asm/idle.h>
30 31
31#define PFX "mce_threshold: " 32#define PFX "mce_threshold: "
32#define VERSION "version 1.00.9" 33#define VERSION "version 1.00.9"
@@ -140,6 +141,7 @@ asmlinkage void mce_threshold_interrupt(void)
140 struct mce m; 141 struct mce m;
141 142
142 ack_APIC_irq(); 143 ack_APIC_irq();
144 exit_idle();
143 irq_enter(); 145 irq_enter();
144 146
145 memset(&m, 0, sizeof(m)); 147 memset(&m, 0, sizeof(m));
@@ -318,7 +320,7 @@ static struct kobj_type threshold_ktype = {
318static __cpuinit int threshold_create_bank(unsigned int cpu, int bank) 320static __cpuinit int threshold_create_bank(unsigned int cpu, int bank)
319{ 321{
320 int err = 0; 322 int err = 0;
321 struct threshold_bank *b = 0; 323 struct threshold_bank *b = NULL;
322 324
323#ifdef CONFIG_SMP 325#ifdef CONFIG_SMP
324 if (cpu_core_id[cpu] && shared_bank[bank]) { /* symlink */ 326 if (cpu_core_id[cpu] && shared_bank[bank]) { /* symlink */
@@ -407,7 +409,7 @@ static __cpuinit void threshold_remove_bank(unsigned int cpu, int bank)
407 if (shared_bank[bank] && atomic_read(&b->kobj.kref.refcount) > 2) { 409 if (shared_bank[bank] && atomic_read(&b->kobj.kref.refcount) > 2) {
408 sprintf(name, "bank%i", bank); 410 sprintf(name, "bank%i", bank);
409 sysfs_remove_link(&per_cpu(device_threshold, cpu).kobj, name); 411 sysfs_remove_link(&per_cpu(device_threshold, cpu).kobj, name);
410 per_cpu(threshold_banks, cpu)[bank] = 0; 412 per_cpu(threshold_banks, cpu)[bank] = NULL;
411 } else { 413 } else {
412 kobject_unregister(&b->kobj); 414 kobject_unregister(&b->kobj);
413 kfree(per_cpu(threshold_banks, cpu)[bank]); 415 kfree(per_cpu(threshold_banks, cpu)[bank]);
diff --git a/arch/x86_64/kernel/mce_intel.c b/arch/x86_64/kernel/mce_intel.c
index 0be0a7959814..8f533d2c40cb 100644
--- a/arch/x86_64/kernel/mce_intel.c
+++ b/arch/x86_64/kernel/mce_intel.c
@@ -10,6 +10,7 @@
10#include <asm/msr.h> 10#include <asm/msr.h>
11#include <asm/mce.h> 11#include <asm/mce.h>
12#include <asm/hw_irq.h> 12#include <asm/hw_irq.h>
13#include <asm/idle.h>
13 14
14static DEFINE_PER_CPU(unsigned long, next_check); 15static DEFINE_PER_CPU(unsigned long, next_check);
15 16
@@ -19,6 +20,7 @@ asmlinkage void smp_thermal_interrupt(void)
19 20
20 ack_APIC_irq(); 21 ack_APIC_irq();
21 22
23 exit_idle();
22 irq_enter(); 24 irq_enter();
23 if (time_before(jiffies, __get_cpu_var(next_check))) 25 if (time_before(jiffies, __get_cpu_var(next_check)))
24 goto done; 26 goto done;
@@ -78,7 +80,7 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
78 80
79 h = THERMAL_APIC_VECTOR; 81 h = THERMAL_APIC_VECTOR;
80 h |= (APIC_DM_FIXED | APIC_LVT_MASKED); 82 h |= (APIC_DM_FIXED | APIC_LVT_MASKED);
81 apic_write_around(APIC_LVTTHMR, h); 83 apic_write(APIC_LVTTHMR, h);
82 84
83 rdmsr(MSR_IA32_THERM_INTERRUPT, l, h); 85 rdmsr(MSR_IA32_THERM_INTERRUPT, l, h);
84 wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03, h); 86 wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03, h);
@@ -87,7 +89,7 @@ static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
87 wrmsr(MSR_IA32_MISC_ENABLE, l | (1 << 3), h); 89 wrmsr(MSR_IA32_MISC_ENABLE, l | (1 << 3), h);
88 90
89 l = apic_read(APIC_LVTTHMR); 91 l = apic_read(APIC_LVTTHMR);
90 apic_write_around(APIC_LVTTHMR, l & ~APIC_LVT_MASKED); 92 apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
91 printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n", 93 printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n",
92 cpu, tm2 ? "TM2" : "TM1"); 94 cpu, tm2 ? "TM2" : "TM1");
93 return; 95 return;
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index 1105250bf02c..dc49bfb6db0a 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -915,7 +915,7 @@ void __init mp_config_acpi_legacy_irqs (void)
915 915
916#define MAX_GSI_NUM 4096 916#define MAX_GSI_NUM 4096
917 917
918int mp_register_gsi(u32 gsi, int edge_level, int active_high_low) 918int mp_register_gsi(u32 gsi, int triggering, int polarity)
919{ 919{
920 int ioapic = -1; 920 int ioapic = -1;
921 int ioapic_pin = 0; 921 int ioapic_pin = 0;
@@ -964,7 +964,7 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
964 964
965 mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); 965 mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit);
966 966
967 if (edge_level) { 967 if (triggering == ACPI_LEVEL_SENSITIVE) {
968 /* 968 /*
969 * For PCI devices assign IRQs in order, avoiding gaps 969 * For PCI devices assign IRQs in order, avoiding gaps
970 * due to unused I/O APIC pins. 970 * due to unused I/O APIC pins.
@@ -986,8 +986,8 @@ int mp_register_gsi(u32 gsi, int edge_level, int active_high_low)
986 } 986 }
987 987
988 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, 988 io_apic_set_pci_routing(ioapic, ioapic_pin, gsi,
989 edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1, 989 triggering == ACPI_EDGE_SENSITIVE ? 0 : 1,
990 active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1); 990 polarity == ACPI_ACTIVE_HIGH ? 0 : 1);
991 return gsi; 991 return gsi;
992} 992}
993 993
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
index 39d445e16f22..5fae6f0cd994 100644
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -151,23 +151,25 @@ int __init check_nmi_watchdog (void)
151 151
152 printk(KERN_INFO "testing NMI watchdog ... "); 152 printk(KERN_INFO "testing NMI watchdog ... ");
153 153
154#ifdef CONFIG_SMP
154 if (nmi_watchdog == NMI_LOCAL_APIC) 155 if (nmi_watchdog == NMI_LOCAL_APIC)
155 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); 156 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0);
157#endif
156 158
157 for (cpu = 0; cpu < NR_CPUS; cpu++) 159 for (cpu = 0; cpu < NR_CPUS; cpu++)
158 counts[cpu] = cpu_pda[cpu].__nmi_count; 160 counts[cpu] = cpu_pda(cpu)->__nmi_count;
159 local_irq_enable(); 161 local_irq_enable();
160 mdelay((10*1000)/nmi_hz); // wait 10 ticks 162 mdelay((10*1000)/nmi_hz); // wait 10 ticks
161 163
162 for (cpu = 0; cpu < NR_CPUS; cpu++) { 164 for (cpu = 0; cpu < NR_CPUS; cpu++) {
163 if (!cpu_online(cpu)) 165 if (!cpu_online(cpu))
164 continue; 166 continue;
165 if (cpu_pda[cpu].__nmi_count - counts[cpu] <= 5) { 167 if (cpu_pda(cpu)->__nmi_count - counts[cpu] <= 5) {
166 endflag = 1; 168 endflag = 1;
167 printk("CPU#%d: NMI appears to be stuck (%d->%d)!\n", 169 printk("CPU#%d: NMI appears to be stuck (%d->%d)!\n",
168 cpu, 170 cpu,
169 counts[cpu], 171 counts[cpu],
170 cpu_pda[cpu].__nmi_count); 172 cpu_pda(cpu)->__nmi_count);
171 nmi_active = 0; 173 nmi_active = 0;
172 lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG; 174 lapic_nmi_owner &= ~LAPIC_NMI_WATCHDOG;
173 nmi_perfctr_msr = 0; 175 nmi_perfctr_msr = 0;
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c
index cab471cf3edb..2f5d8328e2b9 100644
--- a/arch/x86_64/kernel/pci-dma.c
+++ b/arch/x86_64/kernel/pci-dma.c
@@ -8,53 +8,259 @@
8#include <linux/pci.h> 8#include <linux/pci.h>
9#include <linux/module.h> 9#include <linux/module.h>
10#include <asm/io.h> 10#include <asm/io.h>
11#include <asm/proto.h>
11 12
12/* Map a set of buffers described by scatterlist in streaming 13int iommu_merge __read_mostly = 0;
13 * mode for DMA. This is the scatter-gather version of the 14EXPORT_SYMBOL(iommu_merge);
14 * above pci_map_single interface. Here the scatter gather list 15
15 * elements are each tagged with the appropriate dma address 16dma_addr_t bad_dma_address __read_mostly;
16 * and length. They are obtained via sg_dma_{address,length}(SG). 17EXPORT_SYMBOL(bad_dma_address);
17 * 18
18 * NOTE: An implementation may be able to use a smaller number of 19/* This tells the BIO block layer to assume merging. Default to off
19 * DMA address/length pairs than there are SG table elements. 20 because we cannot guarantee merging later. */
20 * (for example via virtual mapping capabilities) 21int iommu_bio_merge __read_mostly = 0;
21 * The routine returns the number of addr/length pairs actually 22EXPORT_SYMBOL(iommu_bio_merge);
22 * used, at most nents. 23
23 * 24int iommu_sac_force __read_mostly = 0;
24 * Device ownership issues as mentioned above for pci_map_single are 25EXPORT_SYMBOL(iommu_sac_force);
25 * the same here. 26
27int no_iommu __read_mostly;
28#ifdef CONFIG_IOMMU_DEBUG
29int panic_on_overflow __read_mostly = 1;
30int force_iommu __read_mostly = 1;
31#else
32int panic_on_overflow __read_mostly = 0;
33int force_iommu __read_mostly= 0;
34#endif
35
36/* Dummy device used for NULL arguments (normally ISA). Better would
37 be probably a smaller DMA mask, but this is bug-to-bug compatible
38 to i386. */
39struct device fallback_dev = {
40 .bus_id = "fallback device",
41 .coherent_dma_mask = 0xffffffff,
42 .dma_mask = &fallback_dev.coherent_dma_mask,
43};
44
45/* Allocate DMA memory on node near device */
46noinline static void *
47dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
48{
49 struct page *page;
50 int node;
51 if (dev->bus == &pci_bus_type)
52 node = pcibus_to_node(to_pci_dev(dev)->bus);
53 else
54 node = numa_node_id();
55 page = alloc_pages_node(node, gfp, order);
56 return page ? page_address(page) : NULL;
57}
58
59/*
60 * Allocate memory for a coherent mapping.
26 */ 61 */
27int dma_map_sg(struct device *hwdev, struct scatterlist *sg, 62void *
28 int nents, int direction) 63dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
64 gfp_t gfp)
29{ 65{
30 int i; 66 void *memory;
31 67 unsigned long dma_mask = 0;
32 BUG_ON(direction == DMA_NONE); 68 u64 bus;
33 for (i = 0; i < nents; i++ ) { 69
34 struct scatterlist *s = &sg[i]; 70 if (!dev)
35 BUG_ON(!s->page); 71 dev = &fallback_dev;
36 s->dma_address = virt_to_bus(page_address(s->page) +s->offset); 72 dma_mask = dev->coherent_dma_mask;
37 s->dma_length = s->length; 73 if (dma_mask == 0)
74 dma_mask = 0xffffffff;
75
76 /* Kludge to make it bug-to-bug compatible with i386. i386
77 uses the normal dma_mask for alloc_coherent. */
78 dma_mask &= *dev->dma_mask;
79
80 /* Why <=? Even when the mask is smaller than 4GB it is often
81 larger than 16MB and in this case we have a chance of
82 finding fitting memory in the next higher zone first. If
83 not retry with true GFP_DMA. -AK */
84 if (dma_mask <= 0xffffffff)
85 gfp |= GFP_DMA32;
86
87 again:
88 memory = dma_alloc_pages(dev, gfp, get_order(size));
89 if (memory == NULL)
90 return NULL;
91
92 {
93 int high, mmu;
94 bus = virt_to_bus(memory);
95 high = (bus + size) >= dma_mask;
96 mmu = high;
97 if (force_iommu && !(gfp & GFP_DMA))
98 mmu = 1;
99 else if (high) {
100 free_pages((unsigned long)memory,
101 get_order(size));
102
103 /* Don't use the 16MB ZONE_DMA unless absolutely
104 needed. It's better to use remapping first. */
105 if (dma_mask < 0xffffffff && !(gfp & GFP_DMA)) {
106 gfp = (gfp & ~GFP_DMA32) | GFP_DMA;
107 goto again;
108 }
109
110 if (dma_ops->alloc_coherent)
111 return dma_ops->alloc_coherent(dev, size,
112 dma_handle, gfp);
113 return NULL;
114 }
115
116 memset(memory, 0, size);
117 if (!mmu) {
118 *dma_handle = virt_to_bus(memory);
119 return memory;
120 }
121 }
122
123 if (dma_ops->alloc_coherent) {
124 free_pages((unsigned long)memory, get_order(size));
125 gfp &= ~(GFP_DMA|GFP_DMA32);
126 return dma_ops->alloc_coherent(dev, size, dma_handle, gfp);
127 }
128
129 if (dma_ops->map_simple) {
130 *dma_handle = dma_ops->map_simple(dev, memory,
131 size,
132 PCI_DMA_BIDIRECTIONAL);
133 if (*dma_handle != bad_dma_address)
134 return memory;
38 } 135 }
39 return nents;
40}
41 136
42EXPORT_SYMBOL(dma_map_sg); 137 if (panic_on_overflow)
138 panic("dma_alloc_coherent: IOMMU overflow by %lu bytes\n",size);
139 free_pages((unsigned long)memory, get_order(size));
140 return NULL;
141}
142EXPORT_SYMBOL(dma_alloc_coherent);
43 143
44/* Unmap a set of streaming mode DMA translations. 144/*
45 * Again, cpu read rules concerning calls here are the same as for 145 * Unmap coherent memory.
46 * pci_unmap_single() above. 146 * The caller must ensure that the device has finished accessing the mapping.
47 */ 147 */
48void dma_unmap_sg(struct device *dev, struct scatterlist *sg, 148void dma_free_coherent(struct device *dev, size_t size,
49 int nents, int dir) 149 void *vaddr, dma_addr_t bus)
150{
151 if (dma_ops->unmap_single)
152 dma_ops->unmap_single(dev, bus, size, 0);
153 free_pages((unsigned long)vaddr, get_order(size));
154}
155EXPORT_SYMBOL(dma_free_coherent);
156
157int dma_supported(struct device *dev, u64 mask)
158{
159 if (dma_ops->dma_supported)
160 return dma_ops->dma_supported(dev, mask);
161
162 /* Copied from i386. Doesn't make much sense, because it will
163 only work for pci_alloc_coherent.
164 The caller just has to use GFP_DMA in this case. */
165 if (mask < 0x00ffffff)
166 return 0;
167
168 /* Tell the device to use SAC when IOMMU force is on. This
169 allows the driver to use cheaper accesses in some cases.
170
171 Problem with this is that if we overflow the IOMMU area and
172 return DAC as fallback address the device may not handle it
173 correctly.
174
175 As a special case some controllers have a 39bit address
176 mode that is as efficient as 32bit (aic79xx). Don't force
177 SAC for these. Assume all masks <= 40 bits are of this
178 type. Normally this doesn't make any difference, but gives
179 more gentle handling of IOMMU overflow. */
180 if (iommu_sac_force && (mask >= 0xffffffffffULL)) {
181 printk(KERN_INFO "%s: Force SAC with mask %Lx\n", dev->bus_id,mask);
182 return 0;
183 }
184
185 return 1;
186}
187EXPORT_SYMBOL(dma_supported);
188
189int dma_set_mask(struct device *dev, u64 mask)
50{ 190{
51 int i; 191 if (!dev->dma_mask || !dma_supported(dev, mask))
52 for (i = 0; i < nents; i++) { 192 return -EIO;
53 struct scatterlist *s = &sg[i]; 193 *dev->dma_mask = mask;
54 BUG_ON(s->page == NULL); 194 return 0;
55 BUG_ON(s->dma_address == 0);
56 dma_unmap_single(dev, s->dma_address, s->dma_length, dir);
57 }
58} 195}
196EXPORT_SYMBOL(dma_set_mask);
197
198/* iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge]
199 [,forcesac][,fullflush][,nomerge][,biomerge]
200 size set size of iommu (in bytes)
201 noagp don't initialize the AGP driver and use full aperture.
202 off don't use the IOMMU
203 leak turn on simple iommu leak tracing (only when CONFIG_IOMMU_LEAK is on)
204 memaper[=order] allocate an own aperture over RAM with size 32MB^order.
205 noforce don't force IOMMU usage. Default.
206 force Force IOMMU.
207 merge Do lazy merging. This may improve performance on some block devices.
208 Implies force (experimental)
209 biomerge Do merging at the BIO layer. This is more efficient than merge,
210 but should be only done with very big IOMMUs. Implies merge,force.
211 nomerge Don't do SG merging.
212 forcesac For SAC mode for masks <40bits (experimental)
213 fullflush Flush IOMMU on each allocation (default)
214 nofullflush Don't use IOMMU fullflush
215 allowed overwrite iommu off workarounds for specific chipsets.
216 soft Use software bounce buffering (default for Intel machines)
217 noaperture Don't touch the aperture for AGP.
218*/
219__init int iommu_setup(char *p)
220{
221 iommu_merge = 1;
59 222
60EXPORT_SYMBOL(dma_unmap_sg); 223 while (*p) {
224 if (!strncmp(p,"off",3))
225 no_iommu = 1;
226 /* gart_parse_options has more force support */
227 if (!strncmp(p,"force",5))
228 force_iommu = 1;
229 if (!strncmp(p,"noforce",7)) {
230 iommu_merge = 0;
231 force_iommu = 0;
232 }
233
234 if (!strncmp(p, "biomerge",8)) {
235 iommu_bio_merge = 4096;
236 iommu_merge = 1;
237 force_iommu = 1;
238 }
239 if (!strncmp(p, "panic",5))
240 panic_on_overflow = 1;
241 if (!strncmp(p, "nopanic",7))
242 panic_on_overflow = 0;
243 if (!strncmp(p, "merge",5)) {
244 iommu_merge = 1;
245 force_iommu = 1;
246 }
247 if (!strncmp(p, "nomerge",7))
248 iommu_merge = 0;
249 if (!strncmp(p, "forcesac",8))
250 iommu_sac_force = 1;
251
252#ifdef CONFIG_SWIOTLB
253 if (!strncmp(p, "soft",4))
254 swiotlb = 1;
255#endif
256
257#ifdef CONFIG_GART_IOMMU
258 gart_parse_options(p);
259#endif
260
261 p += strcspn(p, ",");
262 if (*p == ',')
263 ++p;
264 }
265 return 1;
266}
diff --git a/arch/x86_64/kernel/pci-gart.c b/arch/x86_64/kernel/pci-gart.c
index 2e28e855ec3c..c37fc7726ba6 100644
--- a/arch/x86_64/kernel/pci-gart.c
+++ b/arch/x86_64/kernel/pci-gart.c
@@ -30,8 +30,8 @@
30#include <asm/proto.h> 30#include <asm/proto.h>
31#include <asm/cacheflush.h> 31#include <asm/cacheflush.h>
32#include <asm/kdebug.h> 32#include <asm/kdebug.h>
33 33#include <asm/swiotlb.h>
34dma_addr_t bad_dma_address; 34#include <asm/dma.h>
35 35
36unsigned long iommu_bus_base; /* GART remapping area (physical) */ 36unsigned long iommu_bus_base; /* GART remapping area (physical) */
37static unsigned long iommu_size; /* size of remapping area bytes */ 37static unsigned long iommu_size; /* size of remapping area bytes */
@@ -39,18 +39,6 @@ static unsigned long iommu_pages; /* .. and in pages */
39 39
40u32 *iommu_gatt_base; /* Remapping table */ 40u32 *iommu_gatt_base; /* Remapping table */
41 41
42int no_iommu;
43static int no_agp;
44#ifdef CONFIG_IOMMU_DEBUG
45int panic_on_overflow = 1;
46int force_iommu = 1;
47#else
48int panic_on_overflow = 0;
49int force_iommu = 0;
50#endif
51int iommu_merge = 1;
52int iommu_sac_force = 0;
53
54/* If this is disabled the IOMMU will use an optimized flushing strategy 42/* If this is disabled the IOMMU will use an optimized flushing strategy
55 of only flushing when an mapping is reused. With it true the GART is flushed 43 of only flushing when an mapping is reused. With it true the GART is flushed
56 for every mapping. Problem is that doing the lazy flush seems to trigger 44 for every mapping. Problem is that doing the lazy flush seems to trigger
@@ -58,10 +46,6 @@ int iommu_sac_force = 0;
58 also seen with Qlogic at least). */ 46 also seen with Qlogic at least). */
59int iommu_fullflush = 1; 47int iommu_fullflush = 1;
60 48
61/* This tells the BIO block layer to assume merging. Default to off
62 because we cannot guarantee merging later. */
63int iommu_bio_merge = 0;
64
65#define MAX_NB 8 49#define MAX_NB 8
66 50
67/* Allocation bitmap for the remapping area */ 51/* Allocation bitmap for the remapping area */
@@ -102,16 +86,6 @@ AGPEXTERN __u32 *agp_gatt_table;
102 86
103static unsigned long next_bit; /* protected by iommu_bitmap_lock */ 87static unsigned long next_bit; /* protected by iommu_bitmap_lock */
104static int need_flush; /* global flush state. set for each gart wrap */ 88static int need_flush; /* global flush state. set for each gart wrap */
105static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem,
106 size_t size, int dir, int do_panic);
107
108/* Dummy device used for NULL arguments (normally ISA). Better would
109 be probably a smaller DMA mask, but this is bug-to-bug compatible to i386. */
110static struct device fallback_dev = {
111 .bus_id = "fallback device",
112 .coherent_dma_mask = 0xffffffff,
113 .dma_mask = &fallback_dev.coherent_dma_mask,
114};
115 89
116static unsigned long alloc_iommu(int size) 90static unsigned long alloc_iommu(int size)
117{ 91{
@@ -185,114 +159,7 @@ static void flush_gart(struct device *dev)
185 spin_unlock_irqrestore(&iommu_bitmap_lock, flags); 159 spin_unlock_irqrestore(&iommu_bitmap_lock, flags);
186} 160}
187 161
188/* Allocate DMA memory on node near device */
189noinline
190static void *dma_alloc_pages(struct device *dev, gfp_t gfp, unsigned order)
191{
192 struct page *page;
193 int node;
194 if (dev->bus == &pci_bus_type)
195 node = pcibus_to_node(to_pci_dev(dev)->bus);
196 else
197 node = numa_node_id();
198 page = alloc_pages_node(node, gfp, order);
199 return page ? page_address(page) : NULL;
200}
201
202/*
203 * Allocate memory for a coherent mapping.
204 */
205void *
206dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
207 gfp_t gfp)
208{
209 void *memory;
210 unsigned long dma_mask = 0;
211 u64 bus;
212 162
213 if (!dev)
214 dev = &fallback_dev;
215 dma_mask = dev->coherent_dma_mask;
216 if (dma_mask == 0)
217 dma_mask = 0xffffffff;
218
219 /* Kludge to make it bug-to-bug compatible with i386. i386
220 uses the normal dma_mask for alloc_coherent. */
221 dma_mask &= *dev->dma_mask;
222
223 /* Why <=? Even when the mask is smaller than 4GB it is often larger
224 than 16MB and in this case we have a chance of finding fitting memory
225 in the next higher zone first. If not retry with true GFP_DMA. -AK */
226 if (dma_mask <= 0xffffffff)
227 gfp |= GFP_DMA32;
228
229 again:
230 memory = dma_alloc_pages(dev, gfp, get_order(size));
231 if (memory == NULL)
232 return NULL;
233
234 {
235 int high, mmu;
236 bus = virt_to_bus(memory);
237 high = (bus + size) >= dma_mask;
238 mmu = high;
239 if (force_iommu && !(gfp & GFP_DMA))
240 mmu = 1;
241 if (no_iommu || dma_mask < 0xffffffffUL) {
242 if (high) {
243 free_pages((unsigned long)memory,
244 get_order(size));
245
246 if (swiotlb) {
247 return
248 swiotlb_alloc_coherent(dev, size,
249 dma_handle,
250 gfp);
251 }
252
253 if (!(gfp & GFP_DMA)) {
254 gfp = (gfp & ~GFP_DMA32) | GFP_DMA;
255 goto again;
256 }
257 return NULL;
258 }
259 mmu = 0;
260 }
261 memset(memory, 0, size);
262 if (!mmu) {
263 *dma_handle = virt_to_bus(memory);
264 return memory;
265 }
266 }
267
268 *dma_handle = dma_map_area(dev, bus, size, PCI_DMA_BIDIRECTIONAL, 0);
269 if (*dma_handle == bad_dma_address)
270 goto error;
271 flush_gart(dev);
272 return memory;
273
274error:
275 if (panic_on_overflow)
276 panic("dma_alloc_coherent: IOMMU overflow by %lu bytes\n", size);
277 free_pages((unsigned long)memory, get_order(size));
278 return NULL;
279}
280
281/*
282 * Unmap coherent memory.
283 * The caller must ensure that the device has finished accessing the mapping.
284 */
285void dma_free_coherent(struct device *dev, size_t size,
286 void *vaddr, dma_addr_t bus)
287{
288 if (swiotlb) {
289 swiotlb_free_coherent(dev, size, vaddr, bus);
290 return;
291 }
292
293 dma_unmap_single(dev, bus, size, 0);
294 free_pages((unsigned long)vaddr, get_order(size));
295}
296 163
297#ifdef CONFIG_IOMMU_LEAK 164#ifdef CONFIG_IOMMU_LEAK
298 165
@@ -326,7 +193,7 @@ void dump_leak(void)
326#define CLEAR_LEAK(x) 193#define CLEAR_LEAK(x)
327#endif 194#endif
328 195
329static void iommu_full(struct device *dev, size_t size, int dir, int do_panic) 196static void iommu_full(struct device *dev, size_t size, int dir)
330{ 197{
331 /* 198 /*
332 * Ran out of IOMMU space for this operation. This is very bad. 199 * Ran out of IOMMU space for this operation. This is very bad.
@@ -342,11 +209,11 @@ static void iommu_full(struct device *dev, size_t size, int dir, int do_panic)
342 "PCI-DMA: Out of IOMMU space for %lu bytes at device %s\n", 209 "PCI-DMA: Out of IOMMU space for %lu bytes at device %s\n",
343 size, dev->bus_id); 210 size, dev->bus_id);
344 211
345 if (size > PAGE_SIZE*EMERGENCY_PAGES && do_panic) { 212 if (size > PAGE_SIZE*EMERGENCY_PAGES) {
346 if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL) 213 if (dir == PCI_DMA_FROMDEVICE || dir == PCI_DMA_BIDIRECTIONAL)
347 panic("PCI-DMA: Memory would be corrupted\n"); 214 panic("PCI-DMA: Memory would be corrupted\n");
348 if (dir == PCI_DMA_TODEVICE || dir == PCI_DMA_BIDIRECTIONAL) 215 if (dir == PCI_DMA_TODEVICE || dir == PCI_DMA_BIDIRECTIONAL)
349 panic("PCI-DMA: Random memory would be DMAed\n"); 216 panic(KERN_ERR "PCI-DMA: Random memory would be DMAed\n");
350 } 217 }
351 218
352#ifdef CONFIG_IOMMU_LEAK 219#ifdef CONFIG_IOMMU_LEAK
@@ -385,8 +252,8 @@ static inline int nonforced_iommu(struct device *dev, unsigned long addr, size_t
385/* Map a single continuous physical area into the IOMMU. 252/* Map a single continuous physical area into the IOMMU.
386 * Caller needs to check if the iommu is needed and flush. 253 * Caller needs to check if the iommu is needed and flush.
387 */ 254 */
388static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem, 255static dma_addr_t dma_map_area(struct device *dev, dma_addr_t phys_mem,
389 size_t size, int dir, int do_panic) 256 size_t size, int dir)
390{ 257{
391 unsigned long npages = to_pages(phys_mem, size); 258 unsigned long npages = to_pages(phys_mem, size);
392 unsigned long iommu_page = alloc_iommu(npages); 259 unsigned long iommu_page = alloc_iommu(npages);
@@ -396,7 +263,7 @@ static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem,
396 return phys_mem; 263 return phys_mem;
397 if (panic_on_overflow) 264 if (panic_on_overflow)
398 panic("dma_map_area overflow %lu bytes\n", size); 265 panic("dma_map_area overflow %lu bytes\n", size);
399 iommu_full(dev, size, dir, do_panic); 266 iommu_full(dev, size, dir);
400 return bad_dma_address; 267 return bad_dma_address;
401 } 268 }
402 269
@@ -408,15 +275,21 @@ static dma_addr_t dma_map_area(struct device *dev, unsigned long phys_mem,
408 return iommu_bus_base + iommu_page*PAGE_SIZE + (phys_mem & ~PAGE_MASK); 275 return iommu_bus_base + iommu_page*PAGE_SIZE + (phys_mem & ~PAGE_MASK);
409} 276}
410 277
278static dma_addr_t gart_map_simple(struct device *dev, char *buf,
279 size_t size, int dir)
280{
281 dma_addr_t map = dma_map_area(dev, virt_to_bus(buf), size, dir);
282 flush_gart(dev);
283 return map;
284}
285
411/* Map a single area into the IOMMU */ 286/* Map a single area into the IOMMU */
412dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size, int dir) 287dma_addr_t gart_map_single(struct device *dev, void *addr, size_t size, int dir)
413{ 288{
414 unsigned long phys_mem, bus; 289 unsigned long phys_mem, bus;
415 290
416 BUG_ON(dir == DMA_NONE); 291 BUG_ON(dir == DMA_NONE);
417 292
418 if (swiotlb)
419 return swiotlb_map_single(dev,addr,size,dir);
420 if (!dev) 293 if (!dev)
421 dev = &fallback_dev; 294 dev = &fallback_dev;
422 295
@@ -424,10 +297,24 @@ dma_addr_t dma_map_single(struct device *dev, void *addr, size_t size, int dir)
424 if (!need_iommu(dev, phys_mem, size)) 297 if (!need_iommu(dev, phys_mem, size))
425 return phys_mem; 298 return phys_mem;
426 299
427 bus = dma_map_area(dev, phys_mem, size, dir, 1); 300 bus = gart_map_simple(dev, addr, size, dir);
428 flush_gart(dev);
429 return bus; 301 return bus;
430} 302}
303
304/*
305 * Wrapper for pci_unmap_single working with scatterlists.
306 */
307void gart_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
308{
309 int i;
310
311 for (i = 0; i < nents; i++) {
312 struct scatterlist *s = &sg[i];
313 if (!s->dma_length || !s->length)
314 break;
315 dma_unmap_single(dev, s->dma_address, s->dma_length, dir);
316 }
317}
431 318
432/* Fallback for dma_map_sg in case of overflow */ 319/* Fallback for dma_map_sg in case of overflow */
433static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg, 320static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg,
@@ -443,10 +330,10 @@ static int dma_map_sg_nonforce(struct device *dev, struct scatterlist *sg,
443 struct scatterlist *s = &sg[i]; 330 struct scatterlist *s = &sg[i];
444 unsigned long addr = page_to_phys(s->page) + s->offset; 331 unsigned long addr = page_to_phys(s->page) + s->offset;
445 if (nonforced_iommu(dev, addr, s->length)) { 332 if (nonforced_iommu(dev, addr, s->length)) {
446 addr = dma_map_area(dev, addr, s->length, dir, 0); 333 addr = dma_map_area(dev, addr, s->length, dir);
447 if (addr == bad_dma_address) { 334 if (addr == bad_dma_address) {
448 if (i > 0) 335 if (i > 0)
449 dma_unmap_sg(dev, sg, i, dir); 336 gart_unmap_sg(dev, sg, i, dir);
450 nents = 0; 337 nents = 0;
451 sg[0].dma_length = 0; 338 sg[0].dma_length = 0;
452 break; 339 break;
@@ -515,7 +402,7 @@ static inline int dma_map_cont(struct scatterlist *sg, int start, int stopat,
515 * DMA map all entries in a scatterlist. 402 * DMA map all entries in a scatterlist.
516 * Merge chunks that have page aligned sizes into a continuous mapping. 403 * Merge chunks that have page aligned sizes into a continuous mapping.
517 */ 404 */
518int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir) 405int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
519{ 406{
520 int i; 407 int i;
521 int out; 408 int out;
@@ -527,8 +414,6 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
527 if (nents == 0) 414 if (nents == 0)
528 return 0; 415 return 0;
529 416
530 if (swiotlb)
531 return swiotlb_map_sg(dev,sg,nents,dir);
532 if (!dev) 417 if (!dev)
533 dev = &fallback_dev; 418 dev = &fallback_dev;
534 419
@@ -571,13 +456,13 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
571 456
572error: 457error:
573 flush_gart(NULL); 458 flush_gart(NULL);
574 dma_unmap_sg(dev, sg, nents, dir); 459 gart_unmap_sg(dev, sg, nents, dir);
575 /* When it was forced try again unforced */ 460 /* When it was forced try again unforced */
576 if (force_iommu) 461 if (force_iommu)
577 return dma_map_sg_nonforce(dev, sg, nents, dir); 462 return dma_map_sg_nonforce(dev, sg, nents, dir);
578 if (panic_on_overflow) 463 if (panic_on_overflow)
579 panic("dma_map_sg: overflow on %lu pages\n", pages); 464 panic("dma_map_sg: overflow on %lu pages\n", pages);
580 iommu_full(dev, pages << PAGE_SHIFT, dir, 0); 465 iommu_full(dev, pages << PAGE_SHIFT, dir);
581 for (i = 0; i < nents; i++) 466 for (i = 0; i < nents; i++)
582 sg[i].dma_address = bad_dma_address; 467 sg[i].dma_address = bad_dma_address;
583 return 0; 468 return 0;
@@ -586,18 +471,13 @@ error:
586/* 471/*
587 * Free a DMA mapping. 472 * Free a DMA mapping.
588 */ 473 */
589void dma_unmap_single(struct device *dev, dma_addr_t dma_addr, 474void gart_unmap_single(struct device *dev, dma_addr_t dma_addr,
590 size_t size, int direction) 475 size_t size, int direction)
591{ 476{
592 unsigned long iommu_page; 477 unsigned long iommu_page;
593 int npages; 478 int npages;
594 int i; 479 int i;
595 480
596 if (swiotlb) {
597 swiotlb_unmap_single(dev,dma_addr,size,direction);
598 return;
599 }
600
601 if (dma_addr < iommu_bus_base + EMERGENCY_PAGES*PAGE_SIZE || 481 if (dma_addr < iommu_bus_base + EMERGENCY_PAGES*PAGE_SIZE ||
602 dma_addr >= iommu_bus_base + iommu_size) 482 dma_addr >= iommu_bus_base + iommu_size)
603 return; 483 return;
@@ -610,68 +490,7 @@ void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
610 free_iommu(iommu_page, npages); 490 free_iommu(iommu_page, npages);
611} 491}
612 492
613/* 493static int no_agp;
614 * Wrapper for pci_unmap_single working with scatterlists.
615 */
616void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, int dir)
617{
618 int i;
619 if (swiotlb) {
620 swiotlb_unmap_sg(dev,sg,nents,dir);
621 return;
622 }
623 for (i = 0; i < nents; i++) {
624 struct scatterlist *s = &sg[i];
625 if (!s->dma_length || !s->length)
626 break;
627 dma_unmap_single(dev, s->dma_address, s->dma_length, dir);
628 }
629}
630
631int dma_supported(struct device *dev, u64 mask)
632{
633 /* Copied from i386. Doesn't make much sense, because it will
634 only work for pci_alloc_coherent.
635 The caller just has to use GFP_DMA in this case. */
636 if (mask < 0x00ffffff)
637 return 0;
638
639 /* Tell the device to use SAC when IOMMU force is on.
640 This allows the driver to use cheaper accesses in some cases.
641
642 Problem with this is that if we overflow the IOMMU area
643 and return DAC as fallback address the device may not handle it correctly.
644
645 As a special case some controllers have a 39bit address mode
646 that is as efficient as 32bit (aic79xx). Don't force SAC for these.
647 Assume all masks <= 40 bits are of this type. Normally this doesn't
648 make any difference, but gives more gentle handling of IOMMU overflow. */
649 if (iommu_sac_force && (mask >= 0xffffffffffULL)) {
650 printk(KERN_INFO "%s: Force SAC with mask %Lx\n", dev->bus_id,mask);
651 return 0;
652 }
653
654 return 1;
655}
656
657int dma_get_cache_alignment(void)
658{
659 return boot_cpu_data.x86_clflush_size;
660}
661
662EXPORT_SYMBOL(dma_unmap_sg);
663EXPORT_SYMBOL(dma_map_sg);
664EXPORT_SYMBOL(dma_map_single);
665EXPORT_SYMBOL(dma_unmap_single);
666EXPORT_SYMBOL(dma_supported);
667EXPORT_SYMBOL(no_iommu);
668EXPORT_SYMBOL(force_iommu);
669EXPORT_SYMBOL(bad_dma_address);
670EXPORT_SYMBOL(iommu_bio_merge);
671EXPORT_SYMBOL(iommu_sac_force);
672EXPORT_SYMBOL(dma_get_cache_alignment);
673EXPORT_SYMBOL(dma_alloc_coherent);
674EXPORT_SYMBOL(dma_free_coherent);
675 494
676static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size) 495static __init unsigned long check_iommu_size(unsigned long aper, u64 aper_size)
677{ 496{
@@ -772,12 +591,27 @@ static __init int init_k8_gatt(struct agp_kern_info *info)
772 nommu: 591 nommu:
773 /* Should not happen anymore */ 592 /* Should not happen anymore */
774 printk(KERN_ERR "PCI-DMA: More than 4GB of RAM and no IOMMU\n" 593 printk(KERN_ERR "PCI-DMA: More than 4GB of RAM and no IOMMU\n"
775 KERN_ERR "PCI-DMA: 32bit PCI IO may malfunction."); 594 KERN_ERR "PCI-DMA: 32bit PCI IO may malfunction.\n");
776 return -1; 595 return -1;
777} 596}
778 597
779extern int agp_amd64_init(void); 598extern int agp_amd64_init(void);
780 599
600static struct dma_mapping_ops gart_dma_ops = {
601 .mapping_error = NULL,
602 .map_single = gart_map_single,
603 .map_simple = gart_map_simple,
604 .unmap_single = gart_unmap_single,
605 .sync_single_for_cpu = NULL,
606 .sync_single_for_device = NULL,
607 .sync_single_range_for_cpu = NULL,
608 .sync_single_range_for_device = NULL,
609 .sync_sg_for_cpu = NULL,
610 .sync_sg_for_device = NULL,
611 .map_sg = gart_map_sg,
612 .unmap_sg = gart_unmap_sg,
613};
614
781static int __init pci_iommu_init(void) 615static int __init pci_iommu_init(void)
782{ 616{
783 struct agp_kern_info info; 617 struct agp_kern_info info;
@@ -799,16 +633,15 @@ static int __init pci_iommu_init(void)
799 633
800 if (swiotlb) { 634 if (swiotlb) {
801 no_iommu = 1; 635 no_iommu = 1;
802 printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
803 return -1; 636 return -1;
804 } 637 }
805 638
806 if (no_iommu || 639 if (no_iommu ||
807 (!force_iommu && end_pfn < 0xffffffff>>PAGE_SHIFT) || 640 (!force_iommu && end_pfn <= MAX_DMA32_PFN) ||
808 !iommu_aperture || 641 !iommu_aperture ||
809 (no_agp && init_k8_gatt(&info) < 0)) { 642 (no_agp && init_k8_gatt(&info) < 0)) {
810 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n");
811 no_iommu = 1; 643 no_iommu = 1;
644 no_iommu_init();
812 return -1; 645 return -1;
813 } 646 }
814 647
@@ -885,100 +718,50 @@ static int __init pci_iommu_init(void)
885 718
886 flush_gart(NULL); 719 flush_gart(NULL);
887 720
721 printk(KERN_INFO "PCI-DMA: using GART IOMMU.\n");
722 dma_ops = &gart_dma_ops;
723
888 return 0; 724 return 0;
889} 725}
890 726
891/* Must execute after PCI subsystem */ 727/* Must execute after PCI subsystem */
892fs_initcall(pci_iommu_init); 728fs_initcall(pci_iommu_init);
893 729
894/* iommu=[size][,noagp][,off][,force][,noforce][,leak][,memaper[=order]][,merge] 730void gart_parse_options(char *p)
895 [,forcesac][,fullflush][,nomerge][,biomerge] 731{
896 size set size of iommu (in bytes) 732 int arg;
897 noagp don't initialize the AGP driver and use full aperture. 733
898 off don't use the IOMMU
899 leak turn on simple iommu leak tracing (only when CONFIG_IOMMU_LEAK is on)
900 memaper[=order] allocate an own aperture over RAM with size 32MB^order.
901 noforce don't force IOMMU usage. Default.
902 force Force IOMMU.
903 merge Do lazy merging. This may improve performance on some block devices.
904 Implies force (experimental)
905 biomerge Do merging at the BIO layer. This is more efficient than merge,
906 but should be only done with very big IOMMUs. Implies merge,force.
907 nomerge Don't do SG merging.
908 forcesac For SAC mode for masks <40bits (experimental)
909 fullflush Flush IOMMU on each allocation (default)
910 nofullflush Don't use IOMMU fullflush
911 allowed overwrite iommu off workarounds for specific chipsets.
912 soft Use software bounce buffering (default for Intel machines)
913 noaperture Don't touch the aperture for AGP.
914*/
915__init int iommu_setup(char *p)
916{
917 int arg;
918
919 while (*p) {
920 if (!strncmp(p,"noagp",5))
921 no_agp = 1;
922 if (!strncmp(p,"off",3))
923 no_iommu = 1;
924 if (!strncmp(p,"force",5)) {
925 force_iommu = 1;
926 iommu_aperture_allowed = 1;
927 }
928 if (!strncmp(p,"allowed",7))
929 iommu_aperture_allowed = 1;
930 if (!strncmp(p,"noforce",7)) {
931 iommu_merge = 0;
932 force_iommu = 0;
933 }
934 if (!strncmp(p, "memaper", 7)) {
935 fallback_aper_force = 1;
936 p += 7;
937 if (*p == '=') {
938 ++p;
939 if (get_option(&p, &arg))
940 fallback_aper_order = arg;
941 }
942 }
943 if (!strncmp(p, "biomerge",8)) {
944 iommu_bio_merge = 4096;
945 iommu_merge = 1;
946 force_iommu = 1;
947 }
948 if (!strncmp(p, "panic",5))
949 panic_on_overflow = 1;
950 if (!strncmp(p, "nopanic",7))
951 panic_on_overflow = 0;
952 if (!strncmp(p, "merge",5)) {
953 iommu_merge = 1;
954 force_iommu = 1;
955 }
956 if (!strncmp(p, "nomerge",7))
957 iommu_merge = 0;
958 if (!strncmp(p, "forcesac",8))
959 iommu_sac_force = 1;
960 if (!strncmp(p, "fullflush",8))
961 iommu_fullflush = 1;
962 if (!strncmp(p, "nofullflush",11))
963 iommu_fullflush = 0;
964 if (!strncmp(p, "soft",4))
965 swiotlb = 1;
966 if (!strncmp(p, "noaperture",10))
967 fix_aperture = 0;
968#ifdef CONFIG_IOMMU_LEAK 734#ifdef CONFIG_IOMMU_LEAK
969 if (!strncmp(p,"leak",4)) { 735 if (!strncmp(p,"leak",4)) {
970 leak_trace = 1; 736 leak_trace = 1;
971 p += 4; 737 p += 4;
972 if (*p == '=') ++p; 738 if (*p == '=') ++p;
973 if (isdigit(*p) && get_option(&p, &arg)) 739 if (isdigit(*p) && get_option(&p, &arg))
974 iommu_leak_pages = arg; 740 iommu_leak_pages = arg;
975 } else 741 }
976#endif 742#endif
977 if (isdigit(*p) && get_option(&p, &arg)) 743 if (isdigit(*p) && get_option(&p, &arg))
978 iommu_size = arg; 744 iommu_size = arg;
979 p += strcspn(p, ","); 745 if (!strncmp(p, "fullflush",8))
980 if (*p == ',') 746 iommu_fullflush = 1;
981 ++p; 747 if (!strncmp(p, "nofullflush",11))
982 } 748 iommu_fullflush = 0;
983 return 1; 749 if (!strncmp(p,"noagp",5))
984} 750 no_agp = 1;
751 if (!strncmp(p, "noaperture",10))
752 fix_aperture = 0;
753 /* duplicated from pci-dma.c */
754 if (!strncmp(p,"force",5))
755 iommu_aperture_allowed = 1;
756 if (!strncmp(p,"allowed",7))
757 iommu_aperture_allowed = 1;
758 if (!strncmp(p, "memaper", 7)) {
759 fallback_aper_force = 1;
760 p += 7;
761 if (*p == '=') {
762 ++p;
763 if (get_option(&p, &arg))
764 fallback_aper_order = arg;
765 }
766 }
767}
diff --git a/arch/x86_64/kernel/pci-nommu.c b/arch/x86_64/kernel/pci-nommu.c
index 5a981dca87ff..e41564975195 100644
--- a/arch/x86_64/kernel/pci-nommu.c
+++ b/arch/x86_64/kernel/pci-nommu.c
@@ -6,89 +6,94 @@
6#include <linux/string.h> 6#include <linux/string.h>
7#include <asm/proto.h> 7#include <asm/proto.h>
8#include <asm/processor.h> 8#include <asm/processor.h>
9#include <asm/dma.h>
9 10
10int iommu_merge = 0; 11static int
11EXPORT_SYMBOL(iommu_merge); 12check_addr(char *name, struct device *hwdev, dma_addr_t bus, size_t size)
12
13dma_addr_t bad_dma_address;
14EXPORT_SYMBOL(bad_dma_address);
15
16int iommu_bio_merge = 0;
17EXPORT_SYMBOL(iommu_bio_merge);
18
19int iommu_sac_force = 0;
20EXPORT_SYMBOL(iommu_sac_force);
21
22/*
23 * Dummy IO MMU functions
24 */
25
26void *dma_alloc_coherent(struct device *hwdev, size_t size,
27 dma_addr_t *dma_handle, gfp_t gfp)
28{ 13{
29 void *ret; 14 if (hwdev && bus + size > *hwdev->dma_mask) {
30 u64 mask; 15 printk(KERN_ERR
31 int order = get_order(size); 16 "nommu_%s: overflow %Lx+%lu of device mask %Lx\n",
32 17 name, (long long)bus, size, (long long)*hwdev->dma_mask);
33 if (hwdev) 18 return 0;
34 mask = hwdev->coherent_dma_mask & *hwdev->dma_mask;
35 else
36 mask = 0xffffffff;
37 for (;;) {
38 ret = (void *)__get_free_pages(gfp, order);
39 if (ret == NULL)
40 return NULL;
41 *dma_handle = virt_to_bus(ret);
42 if ((*dma_handle & ~mask) == 0)
43 break;
44 free_pages((unsigned long)ret, order);
45 if (gfp & GFP_DMA)
46 return NULL;
47 gfp |= GFP_DMA;
48 } 19 }
20 return 1;
21}
49 22
50 memset(ret, 0, size); 23static dma_addr_t
51 return ret; 24nommu_map_single(struct device *hwdev, void *ptr, size_t size,
25 int direction)
26{
27 dma_addr_t bus = virt_to_bus(ptr);
28 if (!check_addr("map_single", hwdev, bus, size))
29 return bad_dma_address;
30 return bus;
52} 31}
53EXPORT_SYMBOL(dma_alloc_coherent);
54 32
55void dma_free_coherent(struct device *hwdev, size_t size, 33void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
56 void *vaddr, dma_addr_t dma_handle) 34 int direction)
57{ 35{
58 free_pages((unsigned long)vaddr, get_order(size));
59} 36}
60EXPORT_SYMBOL(dma_free_coherent);
61 37
62int dma_supported(struct device *hwdev, u64 mask) 38/* Map a set of buffers described by scatterlist in streaming
39 * mode for DMA. This is the scatter-gather version of the
40 * above pci_map_single interface. Here the scatter gather list
41 * elements are each tagged with the appropriate dma address
42 * and length. They are obtained via sg_dma_{address,length}(SG).
43 *
44 * NOTE: An implementation may be able to use a smaller number of
45 * DMA address/length pairs than there are SG table elements.
46 * (for example via virtual mapping capabilities)
47 * The routine returns the number of addr/length pairs actually
48 * used, at most nents.
49 *
50 * Device ownership issues as mentioned above for pci_map_single are
51 * the same here.
52 */
53int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
54 int nents, int direction)
63{ 55{
64 /* 56 int i;
65 * we fall back to GFP_DMA when the mask isn't all 1s,
66 * so we can't guarantee allocations that must be
67 * within a tighter range than GFP_DMA..
68 * RED-PEN this won't work for pci_map_single. Caller has to
69 * use GFP_DMA in the first place.
70 */
71 if (mask < 0x00ffffff)
72 return 0;
73 57
74 return 1; 58 BUG_ON(direction == DMA_NONE);
75} 59 for (i = 0; i < nents; i++ ) {
76EXPORT_SYMBOL(dma_supported); 60 struct scatterlist *s = &sg[i];
61 BUG_ON(!s->page);
62 s->dma_address = virt_to_bus(page_address(s->page) +s->offset);
63 if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
64 return 0;
65 s->dma_length = s->length;
66 }
67 return nents;
68}
77 69
78int dma_get_cache_alignment(void) 70/* Unmap a set of streaming mode DMA translations.
71 * Again, cpu read rules concerning calls here are the same as for
72 * pci_unmap_single() above.
73 */
74void nommu_unmap_sg(struct device *dev, struct scatterlist *sg,
75 int nents, int dir)
79{ 76{
80 return boot_cpu_data.x86_clflush_size;
81} 77}
82EXPORT_SYMBOL(dma_get_cache_alignment);
83 78
84static int __init check_ram(void) 79struct dma_mapping_ops nommu_dma_ops = {
85{ 80 .map_single = nommu_map_single,
86 if (end_pfn >= 0xffffffff>>PAGE_SHIFT) { 81 .unmap_single = nommu_unmap_single,
87 printk( 82 .map_sg = nommu_map_sg,
88 KERN_ERR "WARNING more than 4GB of memory but IOMMU not compiled in.\n" 83 .unmap_sg = nommu_unmap_sg,
89 KERN_ERR "WARNING 32bit PCI may malfunction.\n"); 84 .is_phys = 1,
90 } 85};
91 return 0;
92}
93__initcall(check_ram);
94 86
87void __init no_iommu_init(void)
88{
89 if (dma_ops)
90 return;
91 printk(KERN_INFO "PCI-DMA: Disabling IOMMU.\n");
92 dma_ops = &nommu_dma_ops;
93 if (end_pfn > MAX_DMA32_PFN) {
94 printk(KERN_ERR
95 "WARNING more than 4GB of memory but IOMMU not compiled in.\n"
96 KERN_ERR "WARNING 32bit PCI may malfunction.\n"
97 KERN_ERR "You might want to enable CONFIG_GART_IOMMU\n");
98 }
99}
diff --git a/arch/x86_64/kernel/pci-swiotlb.c b/arch/x86_64/kernel/pci-swiotlb.c
new file mode 100644
index 000000000000..3569a25ad7fb
--- /dev/null
+++ b/arch/x86_64/kernel/pci-swiotlb.c
@@ -0,0 +1,42 @@
1/* Glue code to lib/swiotlb.c */
2
3#include <linux/pci.h>
4#include <linux/cache.h>
5#include <linux/module.h>
6#include <asm/dma-mapping.h>
7#include <asm/proto.h>
8#include <asm/swiotlb.h>
9#include <asm/dma.h>
10
11int swiotlb __read_mostly;
12EXPORT_SYMBOL(swiotlb);
13
14struct dma_mapping_ops swiotlb_dma_ops = {
15 .mapping_error = swiotlb_dma_mapping_error,
16 .alloc_coherent = swiotlb_alloc_coherent,
17 .free_coherent = swiotlb_free_coherent,
18 .map_single = swiotlb_map_single,
19 .unmap_single = swiotlb_unmap_single,
20 .sync_single_for_cpu = swiotlb_sync_single_for_cpu,
21 .sync_single_for_device = swiotlb_sync_single_for_device,
22 .sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
23 .sync_single_range_for_device = swiotlb_sync_single_range_for_device,
24 .sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
25 .sync_sg_for_device = swiotlb_sync_sg_for_device,
26 .map_sg = swiotlb_map_sg,
27 .unmap_sg = swiotlb_unmap_sg,
28 .dma_supported = NULL,
29};
30
31void pci_swiotlb_init(void)
32{
33 /* don't initialize swiotlb if iommu=off (no_iommu=1) */
34 if (!iommu_aperture && !no_iommu &&
35 (end_pfn > MAX_DMA32_PFN || force_iommu))
36 swiotlb = 1;
37 if (swiotlb) {
38 swiotlb_init();
39 printk(KERN_INFO "PCI-DMA: Using software bounce buffering for IO (SWIOTLB)\n");
40 dma_ops = &swiotlb_dma_ops;
41 }
42}
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 7519fc520eb3..8ded407e4a94 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -36,6 +36,7 @@
36#include <linux/utsname.h> 36#include <linux/utsname.h>
37#include <linux/random.h> 37#include <linux/random.h>
38#include <linux/kprobes.h> 38#include <linux/kprobes.h>
39#include <linux/notifier.h>
39 40
40#include <asm/uaccess.h> 41#include <asm/uaccess.h>
41#include <asm/pgtable.h> 42#include <asm/pgtable.h>
@@ -50,13 +51,12 @@
50#include <asm/desc.h> 51#include <asm/desc.h>
51#include <asm/proto.h> 52#include <asm/proto.h>
52#include <asm/ia32.h> 53#include <asm/ia32.h>
54#include <asm/idle.h>
53 55
54asmlinkage extern void ret_from_fork(void); 56asmlinkage extern void ret_from_fork(void);
55 57
56unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED; 58unsigned long kernel_thread_flags = CLONE_VM | CLONE_UNTRACED;
57 59
58static atomic_t hlt_counter = ATOMIC_INIT(0);
59
60unsigned long boot_option_idle_override = 0; 60unsigned long boot_option_idle_override = 0;
61EXPORT_SYMBOL(boot_option_idle_override); 61EXPORT_SYMBOL(boot_option_idle_override);
62 62
@@ -66,19 +66,49 @@ EXPORT_SYMBOL(boot_option_idle_override);
66void (*pm_idle)(void); 66void (*pm_idle)(void);
67static DEFINE_PER_CPU(unsigned int, cpu_idle_state); 67static DEFINE_PER_CPU(unsigned int, cpu_idle_state);
68 68
69void disable_hlt(void) 69static struct notifier_block *idle_notifier;
70static DEFINE_SPINLOCK(idle_notifier_lock);
71
72void idle_notifier_register(struct notifier_block *n)
73{
74 unsigned long flags;
75 spin_lock_irqsave(&idle_notifier_lock, flags);
76 notifier_chain_register(&idle_notifier, n);
77 spin_unlock_irqrestore(&idle_notifier_lock, flags);
78}
79EXPORT_SYMBOL_GPL(idle_notifier_register);
80
81void idle_notifier_unregister(struct notifier_block *n)
70{ 82{
71 atomic_inc(&hlt_counter); 83 unsigned long flags;
84 spin_lock_irqsave(&idle_notifier_lock, flags);
85 notifier_chain_unregister(&idle_notifier, n);
86 spin_unlock_irqrestore(&idle_notifier_lock, flags);
72} 87}
88EXPORT_SYMBOL(idle_notifier_unregister);
73 89
74EXPORT_SYMBOL(disable_hlt); 90enum idle_state { CPU_IDLE, CPU_NOT_IDLE };
91static DEFINE_PER_CPU(enum idle_state, idle_state) = CPU_NOT_IDLE;
75 92
76void enable_hlt(void) 93void enter_idle(void)
77{ 94{
78 atomic_dec(&hlt_counter); 95 __get_cpu_var(idle_state) = CPU_IDLE;
96 notifier_call_chain(&idle_notifier, IDLE_START, NULL);
79} 97}
80 98
81EXPORT_SYMBOL(enable_hlt); 99static void __exit_idle(void)
100{
101 __get_cpu_var(idle_state) = CPU_NOT_IDLE;
102 notifier_call_chain(&idle_notifier, IDLE_END, NULL);
103}
104
105/* Called from interrupts to signify idle end */
106void exit_idle(void)
107{
108 if (current->pid | read_pda(irqcount))
109 return;
110 __exit_idle();
111}
82 112
83/* 113/*
84 * We use this if we don't have any better 114 * We use this if we don't have any better
@@ -88,21 +118,16 @@ void default_idle(void)
88{ 118{
89 local_irq_enable(); 119 local_irq_enable();
90 120
91 if (!atomic_read(&hlt_counter)) { 121 clear_thread_flag(TIF_POLLING_NRFLAG);
92 clear_thread_flag(TIF_POLLING_NRFLAG); 122 smp_mb__after_clear_bit();
93 smp_mb__after_clear_bit(); 123 while (!need_resched()) {
94 while (!need_resched()) { 124 local_irq_disable();
95 local_irq_disable(); 125 if (!need_resched())
96 if (!need_resched()) 126 safe_halt();
97 safe_halt(); 127 else
98 else 128 local_irq_enable();
99 local_irq_enable();
100 }
101 set_thread_flag(TIF_POLLING_NRFLAG);
102 } else {
103 while (!need_resched())
104 cpu_relax();
105 } 129 }
130 set_thread_flag(TIF_POLLING_NRFLAG);
106} 131}
107 132
108/* 133/*
@@ -157,7 +182,7 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
157DECLARE_PER_CPU(int, cpu_state); 182DECLARE_PER_CPU(int, cpu_state);
158 183
159#include <asm/nmi.h> 184#include <asm/nmi.h>
160/* We don't actually take CPU down, just spin without interrupts. */ 185/* We halt the CPU with physical CPU hotplug */
161static inline void play_dead(void) 186static inline void play_dead(void)
162{ 187{
163 idle_task_exit(); 188 idle_task_exit();
@@ -166,8 +191,9 @@ static inline void play_dead(void)
166 /* Ack it */ 191 /* Ack it */
167 __get_cpu_var(cpu_state) = CPU_DEAD; 192 __get_cpu_var(cpu_state) = CPU_DEAD;
168 193
194 local_irq_disable();
169 while (1) 195 while (1)
170 safe_halt(); 196 halt();
171} 197}
172#else 198#else
173static inline void play_dead(void) 199static inline void play_dead(void)
@@ -200,7 +226,9 @@ void cpu_idle (void)
200 idle = default_idle; 226 idle = default_idle;
201 if (cpu_is_offline(smp_processor_id())) 227 if (cpu_is_offline(smp_processor_id()))
202 play_dead(); 228 play_dead();
229 enter_idle();
203 idle(); 230 idle();
231 __exit_idle();
204 } 232 }
205 233
206 preempt_enable_no_resched(); 234 preempt_enable_no_resched();
@@ -423,7 +451,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long rsp,
423 struct task_struct *me = current; 451 struct task_struct *me = current;
424 452
425 childregs = ((struct pt_regs *) 453 childregs = ((struct pt_regs *)
426 (THREAD_SIZE + (unsigned long) p->thread_info)) - 1; 454 (THREAD_SIZE + task_stack_page(p))) - 1;
427 *childregs = *regs; 455 *childregs = *regs;
428 456
429 childregs->rax = 0; 457 childregs->rax = 0;
@@ -435,7 +463,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long rsp,
435 p->thread.rsp0 = (unsigned long) (childregs+1); 463 p->thread.rsp0 = (unsigned long) (childregs+1);
436 p->thread.userrsp = me->thread.userrsp; 464 p->thread.userrsp = me->thread.userrsp;
437 465
438 set_ti_thread_flag(p->thread_info, TIF_FORK); 466 set_tsk_thread_flag(p, TIF_FORK);
439 467
440 p->thread.fs = me->thread.fs; 468 p->thread.fs = me->thread.fs;
441 p->thread.gs = me->thread.gs; 469 p->thread.gs = me->thread.gs;
@@ -562,7 +590,7 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
562 write_pda(oldrsp, next->userrsp); 590 write_pda(oldrsp, next->userrsp);
563 write_pda(pcurrent, next_p); 591 write_pda(pcurrent, next_p);
564 write_pda(kernelstack, 592 write_pda(kernelstack,
565 (unsigned long)next_p->thread_info + THREAD_SIZE - PDA_STACKOFFSET); 593 task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET);
566 594
567 /* 595 /*
568 * Now maybe reload the debug registers 596 * Now maybe reload the debug registers
@@ -676,7 +704,7 @@ unsigned long get_wchan(struct task_struct *p)
676 704
677 if (!p || p == current || p->state==TASK_RUNNING) 705 if (!p || p == current || p->state==TASK_RUNNING)
678 return 0; 706 return 0;
679 stack = (unsigned long)p->thread_info; 707 stack = (unsigned long)task_stack_page(p);
680 if (p->thread.rsp < stack || p->thread.rsp > stack+THREAD_SIZE) 708 if (p->thread.rsp < stack || p->thread.rsp > stack+THREAD_SIZE)
681 return 0; 709 return 0;
682 fp = *(u64 *)(p->thread.rsp); 710 fp = *(u64 *)(p->thread.rsp);
@@ -794,8 +822,7 @@ int dump_task_regs(struct task_struct *tsk, elf_gregset_t *regs)
794{ 822{
795 struct pt_regs *pp, ptregs; 823 struct pt_regs *pp, ptregs;
796 824
797 pp = (struct pt_regs *)(tsk->thread.rsp0); 825 pp = task_pt_regs(tsk);
798 --pp;
799 826
800 ptregs = *pp; 827 ptregs = *pp;
801 ptregs.cs &= 0xffff; 828 ptregs.cs &= 0xffff;
diff --git a/arch/x86_64/kernel/ptrace.c b/arch/x86_64/kernel/ptrace.c
index a87b6cebe80f..53205622351c 100644
--- a/arch/x86_64/kernel/ptrace.c
+++ b/arch/x86_64/kernel/ptrace.c
@@ -36,9 +36,12 @@
36 * in exit.c or in signal.c. 36 * in exit.c or in signal.c.
37 */ 37 */
38 38
39/* determines which flags the user has access to. */ 39/*
40/* 1 = access 0 = no access */ 40 * Determines which flags the user has access to [1 = access, 0 = no access].
41#define FLAG_MASK 0x44dd5UL 41 * Prohibits changing ID(21), VIP(20), VIF(19), VM(17), IOPL(12-13), IF(9).
42 * Also masks reserved bits (63-22, 15, 5, 3, 1).
43 */
44#define FLAG_MASK 0x54dd5UL
42 45
43/* set's the trap flag. */ 46/* set's the trap flag. */
44#define TRAP_FLAG 0x100UL 47#define TRAP_FLAG 0x100UL
@@ -64,12 +67,6 @@ static inline unsigned long get_stack_long(struct task_struct *task, int offset)
64 return (*((unsigned long *)stack)); 67 return (*((unsigned long *)stack));
65} 68}
66 69
67static inline struct pt_regs *get_child_regs(struct task_struct *task)
68{
69 struct pt_regs *regs = (void *)task->thread.rsp0;
70 return regs - 1;
71}
72
73/* 70/*
74 * this routine will put a word on the processes privileged stack. 71 * this routine will put a word on the processes privileged stack.
75 * the offset is how far from the base addr as stored in the TSS. 72 * the offset is how far from the base addr as stored in the TSS.
@@ -167,7 +164,7 @@ static int is_at_popf(struct task_struct *child, struct pt_regs *regs)
167 164
168static void set_singlestep(struct task_struct *child) 165static void set_singlestep(struct task_struct *child)
169{ 166{
170 struct pt_regs *regs = get_child_regs(child); 167 struct pt_regs *regs = task_pt_regs(child);
171 168
172 /* 169 /*
173 * Always set TIF_SINGLESTEP - this guarantees that 170 * Always set TIF_SINGLESTEP - this guarantees that
@@ -205,7 +202,7 @@ static void clear_singlestep(struct task_struct *child)
205 202
206 /* But touch TF only if it was set by us.. */ 203 /* But touch TF only if it was set by us.. */
207 if (child->ptrace & PT_DTRACE) { 204 if (child->ptrace & PT_DTRACE) {
208 struct pt_regs *regs = get_child_regs(child); 205 struct pt_regs *regs = task_pt_regs(child);
209 regs->eflags &= ~TRAP_FLAG; 206 regs->eflags &= ~TRAP_FLAG;
210 child->ptrace &= ~PT_DTRACE; 207 child->ptrace &= ~PT_DTRACE;
211 } 208 }
diff --git a/arch/x86_64/kernel/reboot.c b/arch/x86_64/kernel/reboot.c
index 75235ed2b31b..57117b8beb2b 100644
--- a/arch/x86_64/kernel/reboot.c
+++ b/arch/x86_64/kernel/reboot.c
@@ -6,6 +6,7 @@
6#include <linux/kernel.h> 6#include <linux/kernel.h>
7#include <linux/ctype.h> 7#include <linux/ctype.h>
8#include <linux/string.h> 8#include <linux/string.h>
9#include <linux/pm.h>
9#include <asm/io.h> 10#include <asm/io.h>
10#include <asm/kdebug.h> 11#include <asm/kdebug.h>
11#include <asm/delay.h> 12#include <asm/delay.h>
@@ -154,10 +155,11 @@ void machine_halt(void)
154 155
155void machine_power_off(void) 156void machine_power_off(void)
156{ 157{
157 if (!reboot_force) { 158 if (pm_power_off) {
158 machine_shutdown(); 159 if (!reboot_force) {
159 } 160 machine_shutdown();
160 if (pm_power_off) 161 }
161 pm_power_off(); 162 pm_power_off();
163 }
162} 164}
163 165
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 750e01dcbdf4..28895c03cb11 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -35,6 +35,7 @@
35#include <asm/processor.h> 35#include <asm/processor.h>
36#include <linux/console.h> 36#include <linux/console.h>
37#include <linux/seq_file.h> 37#include <linux/seq_file.h>
38#include <linux/crash_dump.h>
38#include <linux/root_dev.h> 39#include <linux/root_dev.h>
39#include <linux/pci.h> 40#include <linux/pci.h>
40#include <linux/acpi.h> 41#include <linux/acpi.h>
@@ -42,6 +43,9 @@
42#include <linux/edd.h> 43#include <linux/edd.h>
43#include <linux/mmzone.h> 44#include <linux/mmzone.h>
44#include <linux/kexec.h> 45#include <linux/kexec.h>
46#include <linux/cpufreq.h>
47#include <linux/dmi.h>
48#include <linux/dma-mapping.h>
45 49
46#include <asm/mtrr.h> 50#include <asm/mtrr.h>
47#include <asm/uaccess.h> 51#include <asm/uaccess.h>
@@ -60,7 +64,9 @@
60#include <asm/setup.h> 64#include <asm/setup.h>
61#include <asm/mach_apic.h> 65#include <asm/mach_apic.h>
62#include <asm/numa.h> 66#include <asm/numa.h>
67#include <asm/swiotlb.h>
63#include <asm/sections.h> 68#include <asm/sections.h>
69#include <asm/gart-mapping.h>
64 70
65/* 71/*
66 * Machine setup.. 72 * Machine setup..
@@ -85,11 +91,6 @@ int bootloader_type;
85 91
86unsigned long saved_video_mode; 92unsigned long saved_video_mode;
87 93
88#ifdef CONFIG_SWIOTLB
89int swiotlb;
90EXPORT_SYMBOL(swiotlb);
91#endif
92
93/* 94/*
94 * Setup options 95 * Setup options
95 */ 96 */
@@ -274,10 +275,7 @@ static __init void parse_cmdline_early (char ** cmdline_p)
274{ 275{
275 char c = ' ', *to = command_line, *from = COMMAND_LINE; 276 char c = ' ', *to = command_line, *from = COMMAND_LINE;
276 int len = 0; 277 int len = 0;
277 278 int userdef = 0;
278 /* Save unparsed command line copy for /proc/cmdline */
279 memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
280 saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
281 279
282 for (;;) { 280 for (;;) {
283 if (c != ' ') 281 if (c != ' ')
@@ -345,10 +343,14 @@ static __init void parse_cmdline_early (char ** cmdline_p)
345 !memcmp(from, "disableapic", 11)) 343 !memcmp(from, "disableapic", 11))
346 disable_apic = 1; 344 disable_apic = 1;
347 345
348 if (!memcmp(from, "noapic", 6)) 346 /* Don't confuse with noapictimer */
347 if (!memcmp(from, "noapic", 6) &&
348 (from[6] == ' ' || from[6] == 0))
349 skip_ioapic_setup = 1; 349 skip_ioapic_setup = 1;
350 350
351 if (!memcmp(from, "apic", 4)) { 351 /* Make sure to not confuse with apic= */
352 if (!memcmp(from, "apic", 4) &&
353 (from[4] == ' ' || from[4] == 0)) {
352 skip_ioapic_setup = 0; 354 skip_ioapic_setup = 0;
353 ioapic_force = 1; 355 ioapic_force = 1;
354 } 356 }
@@ -356,16 +358,36 @@ static __init void parse_cmdline_early (char ** cmdline_p)
356 if (!memcmp(from, "mem=", 4)) 358 if (!memcmp(from, "mem=", 4))
357 parse_memopt(from+4, &from); 359 parse_memopt(from+4, &from);
358 360
361 if (!memcmp(from, "memmap=", 7)) {
362 /* exactmap option is for used defined memory */
363 if (!memcmp(from+7, "exactmap", 8)) {
364#ifdef CONFIG_CRASH_DUMP
365 /* If we are doing a crash dump, we
366 * still need to know the real mem
367 * size before original memory map is
368 * reset.
369 */
370 saved_max_pfn = e820_end_of_ram();
371#endif
372 from += 8+7;
373 end_pfn_map = 0;
374 e820.nr_map = 0;
375 userdef = 1;
376 }
377 else {
378 parse_memmapopt(from+7, &from);
379 userdef = 1;
380 }
381 }
382
359#ifdef CONFIG_NUMA 383#ifdef CONFIG_NUMA
360 if (!memcmp(from, "numa=", 5)) 384 if (!memcmp(from, "numa=", 5))
361 numa_setup(from+5); 385 numa_setup(from+5);
362#endif 386#endif
363 387
364#ifdef CONFIG_GART_IOMMU
365 if (!memcmp(from,"iommu=",6)) { 388 if (!memcmp(from,"iommu=",6)) {
366 iommu_setup(from+6); 389 iommu_setup(from+6);
367 } 390 }
368#endif
369 391
370 if (!memcmp(from,"oops=panic", 10)) 392 if (!memcmp(from,"oops=panic", 10))
371 panic_on_oops = 1; 393 panic_on_oops = 1;
@@ -394,6 +416,14 @@ static __init void parse_cmdline_early (char ** cmdline_p)
394 } 416 }
395#endif 417#endif
396 418
419#ifdef CONFIG_PROC_VMCORE
420 /* elfcorehdr= specifies the location of elf core header
421 * stored by the crashed kernel. This option will be passed
422 * by kexec loader to the capture kernel.
423 */
424 else if(!memcmp(from, "elfcorehdr=", 11))
425 elfcorehdr_addr = memparse(from+11, &from);
426#endif
397 next_char: 427 next_char:
398 c = *(from++); 428 c = *(from++);
399 if (!c) 429 if (!c)
@@ -402,6 +432,10 @@ static __init void parse_cmdline_early (char ** cmdline_p)
402 break; 432 break;
403 *(to++) = c; 433 *(to++) = c;
404 } 434 }
435 if (userdef) {
436 printk(KERN_INFO "user-defined physical RAM map:\n");
437 e820_print_map("user");
438 }
405 *to = '\0'; 439 *to = '\0';
406 *cmdline_p = command_line; 440 *cmdline_p = command_line;
407} 441}
@@ -442,6 +476,8 @@ static unsigned char *k8_nops[ASM_NOP_MAX+1] = {
442 k8nops + 1 + 2 + 3 + 4 + 5 + 6 + 7, 476 k8nops + 1 + 2 + 3 + 4 + 5 + 6 + 7,
443}; 477};
444 478
479extern char __vsyscall_0;
480
445/* Replace instructions with better alternatives for this CPU type. 481/* Replace instructions with better alternatives for this CPU type.
446 482
447 This runs before SMP is initialized to avoid SMP problems with 483 This runs before SMP is initialized to avoid SMP problems with
@@ -453,11 +489,17 @@ void apply_alternatives(void *start, void *end)
453 struct alt_instr *a; 489 struct alt_instr *a;
454 int diff, i, k; 490 int diff, i, k;
455 for (a = start; (void *)a < end; a++) { 491 for (a = start; (void *)a < end; a++) {
492 u8 *instr;
493
456 if (!boot_cpu_has(a->cpuid)) 494 if (!boot_cpu_has(a->cpuid))
457 continue; 495 continue;
458 496
459 BUG_ON(a->replacementlen > a->instrlen); 497 BUG_ON(a->replacementlen > a->instrlen);
460 __inline_memcpy(a->instr, a->replacement, a->replacementlen); 498 instr = a->instr;
499 /* vsyscall code is not mapped yet. resolve it manually. */
500 if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END)
501 instr = __va(instr - (u8*)VSYSCALL_START + (u8*)__pa_symbol(&__vsyscall_0));
502 __inline_memcpy(instr, a->replacement, a->replacementlen);
461 diff = a->instrlen - a->replacementlen; 503 diff = a->instrlen - a->replacementlen;
462 504
463 /* Pad the rest with nops */ 505 /* Pad the rest with nops */
@@ -465,7 +507,7 @@ void apply_alternatives(void *start, void *end)
465 k = diff; 507 k = diff;
466 if (k > ASM_NOP_MAX) 508 if (k > ASM_NOP_MAX)
467 k = ASM_NOP_MAX; 509 k = ASM_NOP_MAX;
468 __inline_memcpy(a->instr + i, k8_nops[k], k); 510 __inline_memcpy(instr + i, k8_nops[k], k);
469 } 511 }
470 } 512 }
471} 513}
@@ -669,6 +711,8 @@ void __init setup_arch(char **cmdline_p)
669 acpi_boot_init(); 711 acpi_boot_init();
670#endif 712#endif
671 713
714 init_cpu_to_node();
715
672#ifdef CONFIG_X86_LOCAL_APIC 716#ifdef CONFIG_X86_LOCAL_APIC
673 /* 717 /*
674 * get boot-time SMP configuration: 718 * get boot-time SMP configuration:
@@ -833,7 +877,6 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
833static int __init init_amd(struct cpuinfo_x86 *c) 877static int __init init_amd(struct cpuinfo_x86 *c)
834{ 878{
835 int r; 879 int r;
836 int level;
837 880
838#ifdef CONFIG_SMP 881#ifdef CONFIG_SMP
839 unsigned long value; 882 unsigned long value;
@@ -856,11 +899,6 @@ static int __init init_amd(struct cpuinfo_x86 *c)
856 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */ 899 3DNow is IDd by bit 31 in extended CPUID (1*32+31) anyway */
857 clear_bit(0*32+31, &c->x86_capability); 900 clear_bit(0*32+31, &c->x86_capability);
858 901
859 /* C-stepping K8? */
860 level = cpuid_eax(1);
861 if ((level >= 0x0f48 && level < 0x0f50) || level >= 0x0f58)
862 set_bit(X86_FEATURE_K8_C, &c->x86_capability);
863
864 r = get_model_name(c); 902 r = get_model_name(c);
865 if (!r) { 903 if (!r) {
866 switch (c->x86) { 904 switch (c->x86) {
@@ -873,6 +911,10 @@ static int __init init_amd(struct cpuinfo_x86 *c)
873 } 911 }
874 display_cacheinfo(c); 912 display_cacheinfo(c);
875 913
914 /* c->x86_power is 8000_0007 edx. Bit 8 is constant TSC */
915 if (c->x86_power & (1<<8))
916 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
917
876 if (c->extended_cpuid_level >= 0x80000008) { 918 if (c->extended_cpuid_level >= 0x80000008) {
877 c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1; 919 c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1;
878 if (c->x86_max_cores & (c->x86_max_cores - 1)) 920 if (c->x86_max_cores & (c->x86_max_cores - 1))
@@ -991,8 +1033,10 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
991 1033
992 if (c->x86 == 15) 1034 if (c->x86 == 15)
993 c->x86_cache_alignment = c->x86_clflush_size * 2; 1035 c->x86_cache_alignment = c->x86_clflush_size * 2;
994 if (c->x86 >= 15) 1036 if ((c->x86 == 0xf && c->x86_model >= 0x03) ||
1037 (c->x86 == 0x6 && c->x86_model >= 0x0e))
995 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability); 1038 set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
1039 set_bit(X86_FEATURE_SYNC_RDTSC, &c->x86_capability);
996 c->x86_max_cores = intel_num_cpu_cores(c); 1040 c->x86_max_cores = intel_num_cpu_cores(c);
997 1041
998 srat_detect_node(); 1042 srat_detect_node();
@@ -1191,7 +1235,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1191 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1235 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1192 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL, 1236 NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
1193 NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL, 1237 NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL,
1194 NULL, "fxsr_opt", NULL, NULL, NULL, "lm", "3dnowext", "3dnow", 1238 NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow",
1195 1239
1196 /* Transmeta-defined */ 1240 /* Transmeta-defined */
1197 "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL, 1241 "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
@@ -1219,7 +1263,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1219 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1263 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1220 1264
1221 /* AMD-defined (#2) */ 1265 /* AMD-defined (#2) */
1222 "lahf_lm", "cmp_legacy", NULL, NULL, NULL, NULL, NULL, NULL, 1266 "lahf_lm", "cmp_legacy", "svm", NULL, "cr8_legacy", NULL, NULL, NULL,
1223 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1267 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1224 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1268 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
1225 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1269 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@@ -1230,7 +1274,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1230 "vid", /* voltage id control */ 1274 "vid", /* voltage id control */
1231 "ttp", /* thermal trip */ 1275 "ttp", /* thermal trip */
1232 "tm", 1276 "tm",
1233 "stc" 1277 "stc",
1278 NULL,
1279 /* nothing */ /* constant_tsc - moved to flags */
1234 }; 1280 };
1235 1281
1236 1282
@@ -1256,8 +1302,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1256 seq_printf(m, "stepping\t: unknown\n"); 1302 seq_printf(m, "stepping\t: unknown\n");
1257 1303
1258 if (cpu_has(c,X86_FEATURE_TSC)) { 1304 if (cpu_has(c,X86_FEATURE_TSC)) {
1305 unsigned int freq = cpufreq_quick_get((unsigned)(c-cpu_data));
1306 if (!freq)
1307 freq = cpu_khz;
1259 seq_printf(m, "cpu MHz\t\t: %u.%03u\n", 1308 seq_printf(m, "cpu MHz\t\t: %u.%03u\n",
1260 cpu_khz / 1000, (cpu_khz % 1000)); 1309 freq / 1000, (freq % 1000));
1261 } 1310 }
1262 1311
1263 /* Cache size */ 1312 /* Cache size */
@@ -1307,8 +1356,11 @@ static int show_cpuinfo(struct seq_file *m, void *v)
1307 unsigned i; 1356 unsigned i;
1308 for (i = 0; i < 32; i++) 1357 for (i = 0; i < 32; i++)
1309 if (c->x86_power & (1 << i)) { 1358 if (c->x86_power & (1 << i)) {
1310 if (i < ARRAY_SIZE(x86_power_flags)) 1359 if (i < ARRAY_SIZE(x86_power_flags) &&
1311 seq_printf(m, " %s", x86_power_flags[i]); 1360 x86_power_flags[i])
1361 seq_printf(m, "%s%s",
1362 x86_power_flags[i][0]?" ":"",
1363 x86_power_flags[i]);
1312 else 1364 else
1313 seq_printf(m, " [%d]", i); 1365 seq_printf(m, " [%d]", i);
1314 } 1366 }
@@ -1340,3 +1392,11 @@ struct seq_operations cpuinfo_op = {
1340 .stop = c_stop, 1392 .stop = c_stop,
1341 .show = show_cpuinfo, 1393 .show = show_cpuinfo,
1342}; 1394};
1395
1396static int __init run_dmi_scan(void)
1397{
1398 dmi_scan_machine();
1399 return 0;
1400}
1401core_initcall(run_dmi_scan);
1402
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index 06dc354375c3..70f1bb808a20 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -30,14 +30,15 @@ char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
30 30
31cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE; 31cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
32 32
33struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; 33struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly;
34struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned;
34 35
35struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 36struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table };
36 37
37char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); 38char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
38 39
39unsigned long __supported_pte_mask __read_mostly = ~0UL; 40unsigned long __supported_pte_mask __read_mostly = ~0UL;
40static int do_not_nx __initdata = 0; 41static int do_not_nx __cpuinitdata = 0;
41 42
42/* noexec=on|off 43/* noexec=on|off
43Control non executable mappings for 64bit processes. 44Control non executable mappings for 64bit processes.
@@ -110,18 +111,18 @@ void __init setup_per_cpu_areas(void)
110 } 111 }
111 if (!ptr) 112 if (!ptr)
112 panic("Cannot allocate cpu data for CPU %d\n", i); 113 panic("Cannot allocate cpu data for CPU %d\n", i);
113 cpu_pda[i].data_offset = ptr - __per_cpu_start; 114 cpu_pda(i)->data_offset = ptr - __per_cpu_start;
114 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 115 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
115 } 116 }
116} 117}
117 118
118void pda_init(int cpu) 119void pda_init(int cpu)
119{ 120{
120 struct x8664_pda *pda = &cpu_pda[cpu]; 121 struct x8664_pda *pda = cpu_pda(cpu);
121 122
122 /* Setup up data that may be needed in __get_free_pages early */ 123 /* Setup up data that may be needed in __get_free_pages early */
123 asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0)); 124 asm volatile("movl %0,%%fs ; movl %0,%%gs" :: "r" (0));
124 wrmsrl(MSR_GS_BASE, cpu_pda + cpu); 125 wrmsrl(MSR_GS_BASE, pda);
125 126
126 pda->cpunumber = cpu; 127 pda->cpunumber = cpu;
127 pda->irqcount = -1; 128 pda->irqcount = -1;
@@ -145,7 +146,7 @@ void pda_init(int cpu)
145 pda->irqstackptr += IRQSTACKSIZE-64; 146 pda->irqstackptr += IRQSTACKSIZE-64;
146} 147}
147 148
148char boot_exception_stacks[N_EXCEPTION_STACKS * EXCEPTION_STKSZ] 149char boot_exception_stacks[(N_EXCEPTION_STACKS - 1) * EXCEPTION_STKSZ + DEBUG_STKSZ]
149__attribute__((section(".bss.page_aligned"))); 150__attribute__((section(".bss.page_aligned")));
150 151
151/* May not be marked __init: used by software suspend */ 152/* May not be marked __init: used by software suspend */
@@ -213,23 +214,14 @@ void __cpuinit cpu_init (void)
213 * Initialize the per-CPU GDT with the boot GDT, 214 * Initialize the per-CPU GDT with the boot GDT,
214 * and set up the GDT descriptor: 215 * and set up the GDT descriptor:
215 */ 216 */
216 if (cpu) { 217 if (cpu)
217 memcpy(cpu_gdt_table[cpu], cpu_gdt_table[0], GDT_SIZE); 218 memcpy(cpu_gdt(cpu), cpu_gdt_table, GDT_SIZE);
218 }
219 219
220 cpu_gdt_descr[cpu].size = GDT_SIZE; 220 cpu_gdt_descr[cpu].size = GDT_SIZE;
221 cpu_gdt_descr[cpu].address = (unsigned long)cpu_gdt_table[cpu];
222 asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu])); 221 asm volatile("lgdt %0" :: "m" (cpu_gdt_descr[cpu]));
223 asm volatile("lidt %0" :: "m" (idt_descr)); 222 asm volatile("lidt %0" :: "m" (idt_descr));
224 223
225 memcpy(me->thread.tls_array, cpu_gdt_table[cpu], GDT_ENTRY_TLS_ENTRIES * 8); 224 memset(me->thread.tls_array, 0, GDT_ENTRY_TLS_ENTRIES * 8);
226
227 /*
228 * Delete NT
229 */
230
231 asm volatile("pushfq ; popq %%rax ; btr $14,%%rax ; pushq %%rax ; popfq" ::: "eax");
232
233 syscall_init(); 225 syscall_init();
234 226
235 wrmsrl(MSR_FS_BASE, 0); 227 wrmsrl(MSR_FS_BASE, 0);
@@ -243,13 +235,27 @@ void __cpuinit cpu_init (void)
243 */ 235 */
244 for (v = 0; v < N_EXCEPTION_STACKS; v++) { 236 for (v = 0; v < N_EXCEPTION_STACKS; v++) {
245 if (cpu) { 237 if (cpu) {
246 estacks = (char *)__get_free_pages(GFP_ATOMIC, 238 static const unsigned int order[N_EXCEPTION_STACKS] = {
247 EXCEPTION_STACK_ORDER); 239 [0 ... N_EXCEPTION_STACKS - 1] = EXCEPTION_STACK_ORDER,
240 [DEBUG_STACK - 1] = DEBUG_STACK_ORDER
241 };
242
243 estacks = (char *)__get_free_pages(GFP_ATOMIC, order[v]);
248 if (!estacks) 244 if (!estacks)
249 panic("Cannot allocate exception stack %ld %d\n", 245 panic("Cannot allocate exception stack %ld %d\n",
250 v, cpu); 246 v, cpu);
251 } 247 }
252 estacks += EXCEPTION_STKSZ; 248 switch (v + 1) {
249#if DEBUG_STKSZ > EXCEPTION_STKSZ
250 case DEBUG_STACK:
251 cpu_pda[cpu].debugstack = (unsigned long)estacks;
252 estacks += DEBUG_STKSZ;
253 break;
254#endif
255 default:
256 estacks += EXCEPTION_STKSZ;
257 break;
258 }
253 t->ist[v] = (unsigned long)estacks; 259 t->ist[v] = (unsigned long)estacks;
254 } 260 }
255 261
diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c
index cfc3d9dccbd9..19ef012b1f17 100644
--- a/arch/x86_64/kernel/smp.c
+++ b/arch/x86_64/kernel/smp.c
@@ -27,6 +27,7 @@
27#include <asm/mmu_context.h> 27#include <asm/mmu_context.h>
28#include <asm/proto.h> 28#include <asm/proto.h>
29#include <asm/apicdef.h> 29#include <asm/apicdef.h>
30#include <asm/idle.h>
30 31
31/* 32/*
32 * Smarter SMP flushing macros. 33 * Smarter SMP flushing macros.
@@ -280,11 +281,6 @@ void flush_tlb_all(void)
280 on_each_cpu(do_flush_tlb_all, NULL, 1, 1); 281 on_each_cpu(do_flush_tlb_all, NULL, 1, 1);
281} 282}
282 283
283void smp_kdb_stop(void)
284{
285 send_IPI_allbutself(KDB_VECTOR);
286}
287
288/* 284/*
289 * this function sends a 'reschedule' IPI to another CPU. 285 * this function sends a 'reschedule' IPI to another CPU.
290 * it goes straight through and wastes no time serializing 286 * it goes straight through and wastes no time serializing
@@ -512,6 +508,7 @@ asmlinkage void smp_call_function_interrupt(void)
512 /* 508 /*
513 * At this point the info structure may be out of scope unless wait==1 509 * At this point the info structure may be out of scope unless wait==1
514 */ 510 */
511 exit_idle();
515 irq_enter(); 512 irq_enter();
516 (*func)(info); 513 (*func)(info);
517 irq_exit(); 514 irq_exit();
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 683c33f7b967..a28756ef7cef 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -335,7 +335,13 @@ static __cpuinit void sync_tsc(unsigned int master)
335 335
336static void __cpuinit tsc_sync_wait(void) 336static void __cpuinit tsc_sync_wait(void)
337{ 337{
338 if (notscsync || !cpu_has_tsc) 338 /*
339 * When the CPU has synchronized TSCs assume the BIOS
340 * or the hardware already synced. Otherwise we could
341 * mess up a possible perfect synchronization with a
342 * not-quite-perfect algorithm.
343 */
344 if (notscsync || !cpu_has_tsc || !unsynchronized_tsc())
339 return; 345 return;
340 sync_tsc(0); 346 sync_tsc(0);
341} 347}
@@ -646,6 +652,7 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta
646 send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY; 652 send_status = apic_read(APIC_ICR) & APIC_ICR_BUSY;
647 } while (send_status && (timeout++ < 1000)); 653 } while (send_status && (timeout++ < 1000));
648 654
655 mb();
649 atomic_set(&init_deasserted, 1); 656 atomic_set(&init_deasserted, 1);
650 657
651 num_starts = 2; 658 num_starts = 2;
@@ -659,7 +666,6 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta
659 666
660 for (j = 1; j <= num_starts; j++) { 667 for (j = 1; j <= num_starts; j++) {
661 Dprintk("Sending STARTUP #%d.\n",j); 668 Dprintk("Sending STARTUP #%d.\n",j);
662 apic_read_around(APIC_SPIV);
663 apic_write(APIC_ESR, 0); 669 apic_write(APIC_ESR, 0);
664 apic_read(APIC_ESR); 670 apic_read(APIC_ESR);
665 Dprintk("After apic_write.\n"); 671 Dprintk("After apic_write.\n");
@@ -698,7 +704,6 @@ static int __cpuinit wakeup_secondary_via_INIT(int phys_apicid, unsigned int sta
698 * Due to the Pentium erratum 3AP. 704 * Due to the Pentium erratum 3AP.
699 */ 705 */
700 if (maxlvt > 3) { 706 if (maxlvt > 3) {
701 apic_read_around(APIC_SPIV);
702 apic_write(APIC_ESR, 0); 707 apic_write(APIC_ESR, 0);
703 } 708 }
704 accept_status = (apic_read(APIC_ESR) & 0xEF); 709 accept_status = (apic_read(APIC_ESR) & 0xEF);
@@ -743,11 +748,35 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
743 }; 748 };
744 DECLARE_WORK(work, do_fork_idle, &c_idle); 749 DECLARE_WORK(work, do_fork_idle, &c_idle);
745 750
751 /* allocate memory for gdts of secondary cpus. Hotplug is considered */
752 if (!cpu_gdt_descr[cpu].address &&
753 !(cpu_gdt_descr[cpu].address = get_zeroed_page(GFP_KERNEL))) {
754 printk(KERN_ERR "Failed to allocate GDT for CPU %d\n", cpu);
755 return -1;
756 }
757
758 /* Allocate node local memory for AP pdas */
759 if (cpu_pda(cpu) == &boot_cpu_pda[cpu]) {
760 struct x8664_pda *newpda, *pda;
761 int node = cpu_to_node(cpu);
762 pda = cpu_pda(cpu);
763 newpda = kmalloc_node(sizeof (struct x8664_pda), GFP_ATOMIC,
764 node);
765 if (newpda) {
766 memcpy(newpda, pda, sizeof (struct x8664_pda));
767 cpu_pda(cpu) = newpda;
768 } else
769 printk(KERN_ERR
770 "Could not allocate node local PDA for CPU %d on node %d\n",
771 cpu, node);
772 }
773
774
746 c_idle.idle = get_idle_for_cpu(cpu); 775 c_idle.idle = get_idle_for_cpu(cpu);
747 776
748 if (c_idle.idle) { 777 if (c_idle.idle) {
749 c_idle.idle->thread.rsp = (unsigned long) (((struct pt_regs *) 778 c_idle.idle->thread.rsp = (unsigned long) (((struct pt_regs *)
750 (THREAD_SIZE + (unsigned long) c_idle.idle->thread_info)) - 1); 779 (THREAD_SIZE + task_stack_page(c_idle.idle))) - 1);
751 init_idle(c_idle.idle, cpu); 780 init_idle(c_idle.idle, cpu);
752 goto do_rest; 781 goto do_rest;
753 } 782 }
@@ -778,14 +807,14 @@ static int __cpuinit do_boot_cpu(int cpu, int apicid)
778 807
779do_rest: 808do_rest:
780 809
781 cpu_pda[cpu].pcurrent = c_idle.idle; 810 cpu_pda(cpu)->pcurrent = c_idle.idle;
782 811
783 start_rip = setup_trampoline(); 812 start_rip = setup_trampoline();
784 813
785 init_rsp = c_idle.idle->thread.rsp; 814 init_rsp = c_idle.idle->thread.rsp;
786 per_cpu(init_tss,cpu).rsp0 = init_rsp; 815 per_cpu(init_tss,cpu).rsp0 = init_rsp;
787 initial_code = start_secondary; 816 initial_code = start_secondary;
788 clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK); 817 clear_tsk_thread_flag(c_idle.idle, TIF_FORK);
789 818
790 printk(KERN_INFO "Booting processor %d/%d APIC 0x%x\n", cpu, 819 printk(KERN_INFO "Booting processor %d/%d APIC 0x%x\n", cpu,
791 cpus_weight(cpu_present_map), 820 cpus_weight(cpu_present_map),
@@ -811,11 +840,8 @@ do_rest:
811 /* 840 /*
812 * Be paranoid about clearing APIC errors. 841 * Be paranoid about clearing APIC errors.
813 */ 842 */
814 if (APIC_INTEGRATED(apic_version[apicid])) { 843 apic_write(APIC_ESR, 0);
815 apic_read_around(APIC_SPIV); 844 apic_read(APIC_ESR);
816 apic_write(APIC_ESR, 0);
817 apic_read(APIC_ESR);
818 }
819 845
820 /* 846 /*
821 * Status is now clean 847 * Status is now clean
@@ -927,8 +953,8 @@ int additional_cpus __initdata = -1;
927 * 953 *
928 * Three ways to find out the number of additional hotplug CPUs: 954 * Three ways to find out the number of additional hotplug CPUs:
929 * - If the BIOS specified disabled CPUs in ACPI/mptables use that. 955 * - If the BIOS specified disabled CPUs in ACPI/mptables use that.
930 * - otherwise use half of the available CPUs or 2, whatever is more.
931 * - The user can overwrite it with additional_cpus=NUM 956 * - The user can overwrite it with additional_cpus=NUM
957 * - Otherwise don't reserve additional CPUs.
932 * We do this because additional CPUs waste a lot of memory. 958 * We do this because additional CPUs waste a lot of memory.
933 * -AK 959 * -AK
934 */ 960 */
@@ -938,13 +964,10 @@ __init void prefill_possible_map(void)
938 int possible; 964 int possible;
939 965
940 if (additional_cpus == -1) { 966 if (additional_cpus == -1) {
941 if (disabled_cpus > 0) { 967 if (disabled_cpus > 0)
942 additional_cpus = disabled_cpus; 968 additional_cpus = disabled_cpus;
943 } else { 969 else
944 additional_cpus = num_processors / 2; 970 additional_cpus = 0;
945 if (additional_cpus == 0)
946 additional_cpus = 2;
947 }
948 } 971 }
949 possible = num_processors + additional_cpus; 972 possible = num_processors + additional_cpus;
950 if (possible > NR_CPUS) 973 if (possible > NR_CPUS)
@@ -996,7 +1019,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
996 /* 1019 /*
997 * If we couldn't find a local APIC, then get out of here now! 1020 * If we couldn't find a local APIC, then get out of here now!
998 */ 1021 */
999 if (APIC_INTEGRATED(apic_version[boot_cpu_id]) && !cpu_has_apic) { 1022 if (!cpu_has_apic) {
1000 printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n", 1023 printk(KERN_ERR "BIOS bug, local APIC #%d not detected!...\n",
1001 boot_cpu_id); 1024 boot_cpu_id);
1002 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n"); 1025 printk(KERN_ERR "... forcing use of dummy APIC emulation. (tell your hw vendor)\n");
@@ -1181,7 +1204,7 @@ int __cpu_disable(void)
1181 if (cpu == 0) 1204 if (cpu == 0)
1182 return -EBUSY; 1205 return -EBUSY;
1183 1206
1184 disable_APIC_timer(); 1207 clear_local_APIC();
1185 1208
1186 /* 1209 /*
1187 * HACK: 1210 * HACK:
diff --git a/arch/x86_64/kernel/suspend.c b/arch/x86_64/kernel/suspend.c
index fd2bef780882..ecbd34c1093d 100644
--- a/arch/x86_64/kernel/suspend.c
+++ b/arch/x86_64/kernel/suspend.c
@@ -120,7 +120,7 @@ void fix_processor_context(void)
120 120
121 set_tss_desc(cpu,t); /* This just modifies memory; should not be neccessary. But... This is neccessary, because 386 hardware has concept of busy TSS or some similar stupidity. */ 121 set_tss_desc(cpu,t); /* This just modifies memory; should not be neccessary. But... This is neccessary, because 386 hardware has concept of busy TSS or some similar stupidity. */
122 122
123 cpu_gdt_table[cpu][GDT_ENTRY_TSS].type = 9; 123 cpu_gdt(cpu)[GDT_ENTRY_TSS].type = 9;
124 124
125 syscall_init(); /* This sets MSR_*STAR and related */ 125 syscall_init(); /* This sets MSR_*STAR and related */
126 load_TR_desc(); /* This does ltr */ 126 load_TR_desc(); /* This does ltr */
diff --git a/arch/x86_64/kernel/syscall.c b/arch/x86_64/kernel/syscall.c
index e263685f864c..7c176b3edde0 100644
--- a/arch/x86_64/kernel/syscall.c
+++ b/arch/x86_64/kernel/syscall.c
@@ -19,7 +19,7 @@ typedef void (*sys_call_ptr_t)(void);
19 19
20extern void sys_ni_syscall(void); 20extern void sys_ni_syscall(void);
21 21
22sys_call_ptr_t sys_call_table[__NR_syscall_max+1] __cacheline_aligned = { 22const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = {
23 /* Smells like a like a compiler bug -- it doesn't work when the & below is removed. */ 23 /* Smells like a like a compiler bug -- it doesn't work when the & below is removed. */
24 [0 ... __NR_syscall_max] = &sys_ni_syscall, 24 [0 ... __NR_syscall_max] = &sys_ni_syscall,
25#include <asm-x86_64/unistd.h> 25#include <asm-x86_64/unistd.h>
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index fdaddc4e5284..f8c47c688443 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -59,7 +59,7 @@ static int notsc __initdata = 0;
59unsigned int cpu_khz; /* TSC clocks / usec, not used here */ 59unsigned int cpu_khz; /* TSC clocks / usec, not used here */
60static unsigned long hpet_period; /* fsecs / HPET clock */ 60static unsigned long hpet_period; /* fsecs / HPET clock */
61unsigned long hpet_tick; /* HPET clocks / interrupt */ 61unsigned long hpet_tick; /* HPET clocks / interrupt */
62static int hpet_use_timer; 62static int hpet_use_timer; /* Use counter of hpet for time keeping, otherwise PIT */
63unsigned long vxtime_hz = PIT_TICK_RATE; 63unsigned long vxtime_hz = PIT_TICK_RATE;
64int report_lost_ticks; /* command line option */ 64int report_lost_ticks; /* command line option */
65unsigned long long monotonic_base; 65unsigned long long monotonic_base;
@@ -71,14 +71,6 @@ unsigned long __wall_jiffies __section_wall_jiffies = INITIAL_JIFFIES;
71struct timespec __xtime __section_xtime; 71struct timespec __xtime __section_xtime;
72struct timezone __sys_tz __section_sys_tz; 72struct timezone __sys_tz __section_sys_tz;
73 73
74static inline void rdtscll_sync(unsigned long *tsc)
75{
76#ifdef CONFIG_SMP
77 sync_core();
78#endif
79 rdtscll(*tsc);
80}
81
82/* 74/*
83 * do_gettimeoffset() returns microseconds since last timer interrupt was 75 * do_gettimeoffset() returns microseconds since last timer interrupt was
84 * triggered by hardware. A memory read of HPET is slower than a register read 76 * triggered by hardware. A memory read of HPET is slower than a register read
@@ -93,7 +85,7 @@ static inline unsigned int do_gettimeoffset_tsc(void)
93{ 85{
94 unsigned long t; 86 unsigned long t;
95 unsigned long x; 87 unsigned long x;
96 rdtscll_sync(&t); 88 t = get_cycles_sync();
97 if (t < vxtime.last_tsc) t = vxtime.last_tsc; /* hack */ 89 if (t < vxtime.last_tsc) t = vxtime.last_tsc; /* hack */
98 x = ((t - vxtime.last_tsc) * vxtime.tsc_quot) >> 32; 90 x = ((t - vxtime.last_tsc) * vxtime.tsc_quot) >> 32;
99 return x; 91 return x;
@@ -259,8 +251,8 @@ static void set_rtc_mmss(unsigned long nowtime)
259#endif 251#endif
260 252
261 { 253 {
262 BIN_TO_BCD(real_seconds); 254 BIN_TO_BCD(real_seconds);
263 BIN_TO_BCD(real_minutes); 255 BIN_TO_BCD(real_minutes);
264 CMOS_WRITE(real_seconds, RTC_SECONDS); 256 CMOS_WRITE(real_seconds, RTC_SECONDS);
265 CMOS_WRITE(real_minutes, RTC_MINUTES); 257 CMOS_WRITE(real_minutes, RTC_MINUTES);
266 } 258 }
@@ -297,25 +289,21 @@ unsigned long long monotonic_clock(void)
297 last_offset = vxtime.last; 289 last_offset = vxtime.last;
298 base = monotonic_base; 290 base = monotonic_base;
299 this_offset = hpet_readl(HPET_COUNTER); 291 this_offset = hpet_readl(HPET_COUNTER);
300
301 } while (read_seqretry(&xtime_lock, seq)); 292 } while (read_seqretry(&xtime_lock, seq));
302 offset = (this_offset - last_offset); 293 offset = (this_offset - last_offset);
303 offset *=(NSEC_PER_SEC/HZ)/hpet_tick; 294 offset *=(NSEC_PER_SEC/HZ)/hpet_tick;
304 return base + offset; 295 return base + offset;
305 }else{ 296 } else {
306 do { 297 do {
307 seq = read_seqbegin(&xtime_lock); 298 seq = read_seqbegin(&xtime_lock);
308 299
309 last_offset = vxtime.last_tsc; 300 last_offset = vxtime.last_tsc;
310 base = monotonic_base; 301 base = monotonic_base;
311 } while (read_seqretry(&xtime_lock, seq)); 302 } while (read_seqretry(&xtime_lock, seq));
312 sync_core(); 303 this_offset = get_cycles_sync();
313 rdtscll(this_offset);
314 offset = (this_offset - last_offset)*1000/cpu_khz; 304 offset = (this_offset - last_offset)*1000/cpu_khz;
315 return base + offset; 305 return base + offset;
316 } 306 }
317
318
319} 307}
320EXPORT_SYMBOL(monotonic_clock); 308EXPORT_SYMBOL(monotonic_clock);
321 309
@@ -391,7 +379,7 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
391 delay = LATCH - 1 - delay; 379 delay = LATCH - 1 - delay;
392 } 380 }
393 381
394 rdtscll_sync(&tsc); 382 tsc = get_cycles_sync();
395 383
396 if (vxtime.mode == VXTIME_HPET) { 384 if (vxtime.mode == VXTIME_HPET) {
397 if (offset - vxtime.last > hpet_tick) { 385 if (offset - vxtime.last > hpet_tick) {
@@ -471,6 +459,11 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
471 459
472 write_sequnlock(&xtime_lock); 460 write_sequnlock(&xtime_lock);
473 461
462#ifdef CONFIG_X86_LOCAL_APIC
463 if (using_apic_timer)
464 smp_send_timer_broadcast_ipi();
465#endif
466
474 return IRQ_HANDLED; 467 return IRQ_HANDLED;
475} 468}
476 469
@@ -509,10 +502,10 @@ unsigned long long sched_clock(void)
509 return cycles_2_ns(a); 502 return cycles_2_ns(a);
510} 503}
511 504
512unsigned long get_cmos_time(void) 505static unsigned long get_cmos_time(void)
513{ 506{
514 unsigned int timeout, year, mon, day, hour, min, sec; 507 unsigned int timeout = 1000000, year, mon, day, hour, min, sec;
515 unsigned char last, this; 508 unsigned char uip = 0, this = 0;
516 unsigned long flags; 509 unsigned long flags;
517 510
518/* 511/*
@@ -525,45 +518,41 @@ unsigned long get_cmos_time(void)
525 518
526 spin_lock_irqsave(&rtc_lock, flags); 519 spin_lock_irqsave(&rtc_lock, flags);
527 520
528 timeout = 1000000; 521 while (timeout && (!uip || this)) {
529 last = this = 0; 522 uip |= this;
530
531 while (timeout && last && !this) {
532 last = this;
533 this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP; 523 this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP;
534 timeout--; 524 timeout--;
535 } 525 }
536 526
537/* 527 /*
538 * Here we are safe to assume the registers won't change for a whole second, so 528 * Here we are safe to assume the registers won't change for a whole
539 * we just go ahead and read them. 529 * second, so we just go ahead and read them.
540 */ 530 */
541 531 sec = CMOS_READ(RTC_SECONDS);
542 sec = CMOS_READ(RTC_SECONDS); 532 min = CMOS_READ(RTC_MINUTES);
543 min = CMOS_READ(RTC_MINUTES); 533 hour = CMOS_READ(RTC_HOURS);
544 hour = CMOS_READ(RTC_HOURS); 534 day = CMOS_READ(RTC_DAY_OF_MONTH);
545 day = CMOS_READ(RTC_DAY_OF_MONTH); 535 mon = CMOS_READ(RTC_MONTH);
546 mon = CMOS_READ(RTC_MONTH); 536 year = CMOS_READ(RTC_YEAR);
547 year = CMOS_READ(RTC_YEAR);
548 537
549 spin_unlock_irqrestore(&rtc_lock, flags); 538 spin_unlock_irqrestore(&rtc_lock, flags);
550 539
551/* 540 /*
552 * We know that x86-64 always uses BCD format, no need to check the config 541 * We know that x86-64 always uses BCD format, no need to check the
553 * register. 542 * config register.
554 */ 543 */
555 544
556 BCD_TO_BIN(sec); 545 BCD_TO_BIN(sec);
557 BCD_TO_BIN(min); 546 BCD_TO_BIN(min);
558 BCD_TO_BIN(hour); 547 BCD_TO_BIN(hour);
559 BCD_TO_BIN(day); 548 BCD_TO_BIN(day);
560 BCD_TO_BIN(mon); 549 BCD_TO_BIN(mon);
561 BCD_TO_BIN(year); 550 BCD_TO_BIN(year);
562 551
563/* 552 /*
564 * x86-64 systems only exists since 2002. 553 * x86-64 systems only exists since 2002.
565 * This will work up to Dec 31, 2100 554 * This will work up to Dec 31, 2100
566 */ 555 */
567 year += 2000; 556 year += 2000;
568 557
569 return mktime(year, mon, day, hour, min, sec); 558 return mktime(year, mon, day, hour, min, sec);
@@ -695,8 +684,7 @@ static unsigned int __init hpet_calibrate_tsc(void)
695 do { 684 do {
696 local_irq_disable(); 685 local_irq_disable();
697 hpet_now = hpet_readl(HPET_COUNTER); 686 hpet_now = hpet_readl(HPET_COUNTER);
698 sync_core(); 687 tsc_now = get_cycles_sync();
699 rdtscl(tsc_now);
700 local_irq_restore(flags); 688 local_irq_restore(flags);
701 } while ((tsc_now - tsc_start) < TICK_COUNT && 689 } while ((tsc_now - tsc_start) < TICK_COUNT &&
702 (hpet_now - hpet_start) < TICK_COUNT); 690 (hpet_now - hpet_start) < TICK_COUNT);
@@ -726,11 +714,9 @@ static unsigned int __init pit_calibrate_tsc(void)
726 outb(0xb0, 0x43); 714 outb(0xb0, 0x43);
727 outb((PIT_TICK_RATE / (1000 / 50)) & 0xff, 0x42); 715 outb((PIT_TICK_RATE / (1000 / 50)) & 0xff, 0x42);
728 outb((PIT_TICK_RATE / (1000 / 50)) >> 8, 0x42); 716 outb((PIT_TICK_RATE / (1000 / 50)) >> 8, 0x42);
729 rdtscll(start); 717 start = get_cycles_sync();
730 sync_core();
731 while ((inb(0x61) & 0x20) == 0); 718 while ((inb(0x61) & 0x20) == 0);
732 sync_core(); 719 end = get_cycles_sync();
733 rdtscll(end);
734 720
735 spin_unlock_irqrestore(&i8253_lock, flags); 721 spin_unlock_irqrestore(&i8253_lock, flags);
736 722
@@ -744,7 +730,7 @@ static __init int late_hpet_init(void)
744 unsigned int ntimer; 730 unsigned int ntimer;
745 731
746 if (!vxtime.hpet_address) 732 if (!vxtime.hpet_address)
747 return -1; 733 return -1;
748 734
749 memset(&hd, 0, sizeof (hd)); 735 memset(&hd, 0, sizeof (hd));
750 736
@@ -878,8 +864,6 @@ static struct irqaction irq0 = {
878 timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL 864 timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL
879}; 865};
880 866
881extern void __init config_acpi_tables(void);
882
883void __init time_init(void) 867void __init time_init(void)
884{ 868{
885 char *timename; 869 char *timename;
@@ -908,12 +892,14 @@ void __init time_init(void)
908 if (!hpet_init()) 892 if (!hpet_init())
909 vxtime_hz = (1000000000000000L + hpet_period / 2) / 893 vxtime_hz = (1000000000000000L + hpet_period / 2) /
910 hpet_period; 894 hpet_period;
895 else
896 vxtime.hpet_address = 0;
911 897
912 if (hpet_use_timer) { 898 if (hpet_use_timer) {
913 cpu_khz = hpet_calibrate_tsc(); 899 cpu_khz = hpet_calibrate_tsc();
914 timename = "HPET"; 900 timename = "HPET";
915#ifdef CONFIG_X86_PM_TIMER 901#ifdef CONFIG_X86_PM_TIMER
916 } else if (pmtmr_ioport) { 902 } else if (pmtmr_ioport && !vxtime.hpet_address) {
917 vxtime_hz = PM_TIMER_FREQUENCY; 903 vxtime_hz = PM_TIMER_FREQUENCY;
918 timename = "PM"; 904 timename = "PM";
919 pit_init(); 905 pit_init();
@@ -932,7 +918,7 @@ void __init time_init(void)
932 vxtime.mode = VXTIME_TSC; 918 vxtime.mode = VXTIME_TSC;
933 vxtime.quot = (1000000L << 32) / vxtime_hz; 919 vxtime.quot = (1000000L << 32) / vxtime_hz;
934 vxtime.tsc_quot = (1000L << 32) / cpu_khz; 920 vxtime.tsc_quot = (1000L << 32) / cpu_khz;
935 rdtscll_sync(&vxtime.last_tsc); 921 vxtime.last_tsc = get_cycles_sync();
936 setup_irq(0, &irq0); 922 setup_irq(0, &irq0);
937 923
938 set_cyc2ns_scale(cpu_khz); 924 set_cyc2ns_scale(cpu_khz);
@@ -946,7 +932,7 @@ void __init time_init(void)
946 * Make an educated guess if the TSC is trustworthy and synchronized 932 * Make an educated guess if the TSC is trustworthy and synchronized
947 * over all CPUs. 933 * over all CPUs.
948 */ 934 */
949static __init int unsynchronized_tsc(void) 935__init int unsynchronized_tsc(void)
950{ 936{
951#ifdef CONFIG_SMP 937#ifdef CONFIG_SMP
952 if (oem_force_hpet_timer()) 938 if (oem_force_hpet_timer())
@@ -957,7 +943,7 @@ static __init int unsynchronized_tsc(void)
957 return 0; 943 return 0;
958#endif 944#endif
959 /* Assume multi socket systems are not synchronized */ 945 /* Assume multi socket systems are not synchronized */
960 return num_online_cpus() > 1; 946 return num_present_cpus() > 1;
961} 947}
962 948
963/* 949/*
@@ -997,6 +983,10 @@ __setup("report_lost_ticks", time_setup);
997static long clock_cmos_diff; 983static long clock_cmos_diff;
998static unsigned long sleep_start; 984static unsigned long sleep_start;
999 985
986/*
987 * sysfs support for the timer.
988 */
989
1000static int timer_suspend(struct sys_device *dev, pm_message_t state) 990static int timer_suspend(struct sys_device *dev, pm_message_t state)
1001{ 991{
1002 /* 992 /*
@@ -1039,7 +1029,6 @@ static struct sysdev_class timer_sysclass = {
1039 set_kset_name("timer"), 1029 set_kset_name("timer"),
1040}; 1030};
1041 1031
1042
1043/* XXX this driverfs stuff should probably go elsewhere later -john */ 1032/* XXX this driverfs stuff should probably go elsewhere later -john */
1044static struct sys_device device_timer = { 1033static struct sys_device device_timer = {
1045 .id = 0, 1034 .id = 0,
@@ -1073,8 +1062,6 @@ device_initcall(time_init_device);
1073 */ 1062 */
1074#include <linux/rtc.h> 1063#include <linux/rtc.h>
1075 1064
1076extern irqreturn_t rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs);
1077
1078#define DEFAULT_RTC_INT_FREQ 64 1065#define DEFAULT_RTC_INT_FREQ 64
1079#define RTC_NUM_INTS 1 1066#define RTC_NUM_INTS 1
1080 1067
@@ -1283,8 +1270,6 @@ irqreturn_t hpet_rtc_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1283} 1270}
1284#endif 1271#endif
1285 1272
1286
1287
1288static int __init nohpet_setup(char *s) 1273static int __init nohpet_setup(char *s)
1289{ 1274{
1290 nohpet = 1; 1275 nohpet = 1;
@@ -1301,5 +1286,3 @@ static int __init notsc_setup(char *s)
1301} 1286}
1302 1287
1303__setup("notsc", notsc_setup); 1288__setup("notsc", notsc_setup);
1304
1305
diff --git a/arch/x86_64/kernel/trampoline.S b/arch/x86_64/kernel/trampoline.S
index 6d9c9a8e7d0e..23a03eb91fc7 100644
--- a/arch/x86_64/kernel/trampoline.S
+++ b/arch/x86_64/kernel/trampoline.S
@@ -42,8 +42,15 @@ r_base = .
42 movl $0xA5A5A5A5, trampoline_data - r_base 42 movl $0xA5A5A5A5, trampoline_data - r_base
43 # write marker for master knows we're running 43 # write marker for master knows we're running
44 44
45 lidt idt_48 - r_base # load idt with 0, 0 45 /*
46 lgdt gdt_48 - r_base # load gdt with whatever is appropriate 46 * GDT tables in non default location kernel can be beyond 16MB and
47 * lgdt will not be able to load the address as in real mode default
48 * operand size is 16bit. Use lgdtl instead to force operand size
49 * to 32 bit.
50 */
51
52 lidtl idt_48 - r_base # load idt with 0, 0
53 lgdtl gdt_48 - r_base # load gdt with whatever is appropriate
47 54
48 xor %ax, %ax 55 xor %ax, %ax
49 inc %ax # protected mode (PE) bit 56 inc %ax # protected mode (PE) bit
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index bf337f493189..8bb0aeda78b9 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -70,7 +70,6 @@ asmlinkage void reserved(void);
70asmlinkage void alignment_check(void); 70asmlinkage void alignment_check(void);
71asmlinkage void machine_check(void); 71asmlinkage void machine_check(void);
72asmlinkage void spurious_interrupt_bug(void); 72asmlinkage void spurious_interrupt_bug(void);
73asmlinkage void call_debug(void);
74 73
75struct notifier_block *die_chain; 74struct notifier_block *die_chain;
76static DEFINE_SPINLOCK(die_notifier_lock); 75static DEFINE_SPINLOCK(die_notifier_lock);
@@ -121,19 +120,31 @@ int printk_address(unsigned long address)
121static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack, 120static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
122 unsigned *usedp, const char **idp) 121 unsigned *usedp, const char **idp)
123{ 122{
124 static const char ids[N_EXCEPTION_STACKS][8] = { 123 static char ids[][8] = {
125 [DEBUG_STACK - 1] = "#DB", 124 [DEBUG_STACK - 1] = "#DB",
126 [NMI_STACK - 1] = "NMI", 125 [NMI_STACK - 1] = "NMI",
127 [DOUBLEFAULT_STACK - 1] = "#DF", 126 [DOUBLEFAULT_STACK - 1] = "#DF",
128 [STACKFAULT_STACK - 1] = "#SS", 127 [STACKFAULT_STACK - 1] = "#SS",
129 [MCE_STACK - 1] = "#MC", 128 [MCE_STACK - 1] = "#MC",
129#if DEBUG_STKSZ > EXCEPTION_STKSZ
130 [N_EXCEPTION_STACKS ... N_EXCEPTION_STACKS + DEBUG_STKSZ / EXCEPTION_STKSZ - 2] = "#DB[?]"
131#endif
130 }; 132 };
131 unsigned k; 133 unsigned k;
132 134
133 for (k = 0; k < N_EXCEPTION_STACKS; k++) { 135 for (k = 0; k < N_EXCEPTION_STACKS; k++) {
134 unsigned long end; 136 unsigned long end;
135 137
136 end = per_cpu(init_tss, cpu).ist[k]; 138 switch (k + 1) {
139#if DEBUG_STKSZ > EXCEPTION_STKSZ
140 case DEBUG_STACK:
141 end = cpu_pda(cpu)->debugstack + DEBUG_STKSZ;
142 break;
143#endif
144 default:
145 end = per_cpu(init_tss, cpu).ist[k];
146 break;
147 }
137 if (stack >= end) 148 if (stack >= end)
138 continue; 149 continue;
139 if (stack >= end - EXCEPTION_STKSZ) { 150 if (stack >= end - EXCEPTION_STKSZ) {
@@ -143,6 +154,22 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
143 *idp = ids[k]; 154 *idp = ids[k];
144 return (unsigned long *)end; 155 return (unsigned long *)end;
145 } 156 }
157#if DEBUG_STKSZ > EXCEPTION_STKSZ
158 if (k == DEBUG_STACK - 1 && stack >= end - DEBUG_STKSZ) {
159 unsigned j = N_EXCEPTION_STACKS - 1;
160
161 do {
162 ++j;
163 end -= EXCEPTION_STKSZ;
164 ids[j][4] = '1' + (j - N_EXCEPTION_STACKS);
165 } while (stack < end - EXCEPTION_STKSZ);
166 if (*usedp & (1U << j))
167 break;
168 *usedp |= 1U << j;
169 *idp = ids[j];
170 return (unsigned long *)end;
171 }
172#endif
146 } 173 }
147 return NULL; 174 return NULL;
148} 175}
@@ -156,9 +183,8 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
156 183
157void show_trace(unsigned long *stack) 184void show_trace(unsigned long *stack)
158{ 185{
159 unsigned long addr;
160 const unsigned cpu = safe_smp_processor_id(); 186 const unsigned cpu = safe_smp_processor_id();
161 unsigned long *irqstack_end = (unsigned long *)cpu_pda[cpu].irqstackptr; 187 unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
162 int i; 188 int i;
163 unsigned used = 0; 189 unsigned used = 0;
164 190
@@ -166,8 +192,14 @@ void show_trace(unsigned long *stack)
166 192
167#define HANDLE_STACK(cond) \ 193#define HANDLE_STACK(cond) \
168 do while (cond) { \ 194 do while (cond) { \
169 addr = *stack++; \ 195 unsigned long addr = *stack++; \
170 if (kernel_text_address(addr)) { \ 196 if (kernel_text_address(addr)) { \
197 if (i > 50) { \
198 printk("\n "); \
199 i = 0; \
200 } \
201 else \
202 i += printk(" "); \
171 /* \ 203 /* \
172 * If the address is either in the text segment of the \ 204 * If the address is either in the text segment of the \
173 * kernel, or in the region which contains vmalloc'ed \ 205 * kernel, or in the region which contains vmalloc'ed \
@@ -177,25 +209,19 @@ void show_trace(unsigned long *stack)
177 * out the call path that was taken. \ 209 * out the call path that was taken. \
178 */ \ 210 */ \
179 i += printk_address(addr); \ 211 i += printk_address(addr); \
180 if (i > 50) { \
181 printk("\n "); \
182 i = 0; \
183 } \
184 else \
185 i += printk(" "); \
186 } \ 212 } \
187 } while (0) 213 } while (0)
188 214
189 for(i = 0; ; ) { 215 for(i = 11; ; ) {
190 const char *id; 216 const char *id;
191 unsigned long *estack_end; 217 unsigned long *estack_end;
192 estack_end = in_exception_stack(cpu, (unsigned long)stack, 218 estack_end = in_exception_stack(cpu, (unsigned long)stack,
193 &used, &id); 219 &used, &id);
194 220
195 if (estack_end) { 221 if (estack_end) {
196 i += printk(" <%s> ", id); 222 i += printk(" <%s>", id);
197 HANDLE_STACK (stack < estack_end); 223 HANDLE_STACK (stack < estack_end);
198 i += printk(" <EOE> "); 224 i += printk(" <EOE>");
199 stack = (unsigned long *) estack_end[-2]; 225 stack = (unsigned long *) estack_end[-2];
200 continue; 226 continue;
201 } 227 }
@@ -205,11 +231,11 @@ void show_trace(unsigned long *stack)
205 (IRQSTACKSIZE - 64) / sizeof(*irqstack); 231 (IRQSTACKSIZE - 64) / sizeof(*irqstack);
206 232
207 if (stack >= irqstack && stack < irqstack_end) { 233 if (stack >= irqstack && stack < irqstack_end) {
208 i += printk(" <IRQ> "); 234 i += printk(" <IRQ>");
209 HANDLE_STACK (stack < irqstack_end); 235 HANDLE_STACK (stack < irqstack_end);
210 stack = (unsigned long *) (irqstack_end[-1]); 236 stack = (unsigned long *) (irqstack_end[-1]);
211 irqstack_end = NULL; 237 irqstack_end = NULL;
212 i += printk(" <EOI> "); 238 i += printk(" <EOI>");
213 continue; 239 continue;
214 } 240 }
215 } 241 }
@@ -226,8 +252,8 @@ void show_stack(struct task_struct *tsk, unsigned long * rsp)
226 unsigned long *stack; 252 unsigned long *stack;
227 int i; 253 int i;
228 const int cpu = safe_smp_processor_id(); 254 const int cpu = safe_smp_processor_id();
229 unsigned long *irqstack_end = (unsigned long *) (cpu_pda[cpu].irqstackptr); 255 unsigned long *irqstack_end = (unsigned long *) (cpu_pda(cpu)->irqstackptr);
230 unsigned long *irqstack = (unsigned long *) (cpu_pda[cpu].irqstackptr - IRQSTACKSIZE); 256 unsigned long *irqstack = (unsigned long *) (cpu_pda(cpu)->irqstackptr - IRQSTACKSIZE);
231 257
232 // debugging aid: "show_stack(NULL, NULL);" prints the 258 // debugging aid: "show_stack(NULL, NULL);" prints the
233 // back trace for this cpu. 259 // back trace for this cpu.
@@ -275,14 +301,14 @@ void show_registers(struct pt_regs *regs)
275 int in_kernel = !user_mode(regs); 301 int in_kernel = !user_mode(regs);
276 unsigned long rsp; 302 unsigned long rsp;
277 const int cpu = safe_smp_processor_id(); 303 const int cpu = safe_smp_processor_id();
278 struct task_struct *cur = cpu_pda[cpu].pcurrent; 304 struct task_struct *cur = cpu_pda(cpu)->pcurrent;
279 305
280 rsp = regs->rsp; 306 rsp = regs->rsp;
281 307
282 printk("CPU %d ", cpu); 308 printk("CPU %d ", cpu);
283 __show_regs(regs); 309 __show_regs(regs);
284 printk("Process %s (pid: %d, threadinfo %p, task %p)\n", 310 printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
285 cur->comm, cur->pid, cur->thread_info, cur); 311 cur->comm, cur->pid, task_thread_info(cur), cur);
286 312
287 /* 313 /*
288 * When in-kernel, we also print out the stack and code at the 314 * When in-kernel, we also print out the stack and code at the
@@ -314,20 +340,26 @@ bad:
314void handle_BUG(struct pt_regs *regs) 340void handle_BUG(struct pt_regs *regs)
315{ 341{
316 struct bug_frame f; 342 struct bug_frame f;
317 char tmp; 343 long len;
344 const char *prefix = "";
318 345
319 if (user_mode(regs)) 346 if (user_mode(regs))
320 return; 347 return;
321 if (__copy_from_user(&f, (struct bug_frame *) regs->rip, 348 if (__copy_from_user(&f, (const void __user *) regs->rip,
322 sizeof(struct bug_frame))) 349 sizeof(struct bug_frame)))
323 return; 350 return;
324 if (f.filename >= 0 || 351 if (f.filename >= 0 ||
325 f.ud2[0] != 0x0f || f.ud2[1] != 0x0b) 352 f.ud2[0] != 0x0f || f.ud2[1] != 0x0b)
326 return; 353 return;
327 if (__get_user(tmp, (char *)(long)f.filename)) 354 len = __strnlen_user((char *)(long)f.filename, PATH_MAX) - 1;
355 if (len < 0 || len >= PATH_MAX)
328 f.filename = (int)(long)"unmapped filename"; 356 f.filename = (int)(long)"unmapped filename";
357 else if (len > 50) {
358 f.filename += len - 50;
359 prefix = "...";
360 }
329 printk("----------- [cut here ] --------- [please bite here ] ---------\n"); 361 printk("----------- [cut here ] --------- [please bite here ] ---------\n");
330 printk(KERN_ALERT "Kernel BUG at %.50s:%d\n", (char *)(long)f.filename, f.line); 362 printk(KERN_ALERT "Kernel BUG at %s%.50s:%d\n", prefix, (char *)(long)f.filename, f.line);
331} 363}
332 364
333#ifdef CONFIG_BUG 365#ifdef CONFIG_BUG
@@ -382,7 +414,7 @@ void __die(const char * str, struct pt_regs * regs, long err)
382 printk("DEBUG_PAGEALLOC"); 414 printk("DEBUG_PAGEALLOC");
383#endif 415#endif
384 printk("\n"); 416 printk("\n");
385 notify_die(DIE_OOPS, (char *)str, regs, err, 255, SIGSEGV); 417 notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV);
386 show_registers(regs); 418 show_registers(regs);
387 /* Executive summary in case the oops scrolled away */ 419 /* Executive summary in case the oops scrolled away */
388 printk(KERN_ALERT "RIP "); 420 printk(KERN_ALERT "RIP ");
@@ -399,11 +431,6 @@ void die(const char * str, struct pt_regs * regs, long err)
399 oops_end(flags); 431 oops_end(flags);
400 do_exit(SIGSEGV); 432 do_exit(SIGSEGV);
401} 433}
402static inline void die_if_kernel(const char * str, struct pt_regs * regs, long err)
403{
404 if (!(regs->eflags & VM_MASK) && (regs->cs == __KERNEL_CS))
405 die(str, regs, err);
406}
407 434
408void die_nmi(char *str, struct pt_regs *regs) 435void die_nmi(char *str, struct pt_regs *regs)
409{ 436{
@@ -426,19 +453,20 @@ static void __kprobes do_trap(int trapnr, int signr, char *str,
426 struct pt_regs * regs, long error_code, 453 struct pt_regs * regs, long error_code,
427 siginfo_t *info) 454 siginfo_t *info)
428{ 455{
456 struct task_struct *tsk = current;
457
429 conditional_sti(regs); 458 conditional_sti(regs);
430 459
431 if (user_mode(regs)) { 460 tsk->thread.error_code = error_code;
432 struct task_struct *tsk = current; 461 tsk->thread.trap_no = trapnr;
433 462
463 if (user_mode(regs)) {
434 if (exception_trace && unhandled_signal(tsk, signr)) 464 if (exception_trace && unhandled_signal(tsk, signr))
435 printk(KERN_INFO 465 printk(KERN_INFO
436 "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n", 466 "%s[%d] trap %s rip:%lx rsp:%lx error:%lx\n",
437 tsk->comm, tsk->pid, str, 467 tsk->comm, tsk->pid, str,
438 regs->rip,regs->rsp,error_code); 468 regs->rip,regs->rsp,error_code);
439 469
440 tsk->thread.error_code = error_code;
441 tsk->thread.trap_no = trapnr;
442 if (info) 470 if (info)
443 force_sig_info(signr, info, tsk); 471 force_sig_info(signr, info, tsk);
444 else 472 else
@@ -485,7 +513,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
485DO_ERROR_INFO( 0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->rip) 513DO_ERROR_INFO( 0, SIGFPE, "divide error", divide_error, FPE_INTDIV, regs->rip)
486DO_ERROR( 4, SIGSEGV, "overflow", overflow) 514DO_ERROR( 4, SIGSEGV, "overflow", overflow)
487DO_ERROR( 5, SIGSEGV, "bounds", bounds) 515DO_ERROR( 5, SIGSEGV, "bounds", bounds)
488DO_ERROR_INFO( 6, SIGILL, "invalid operand", invalid_op, ILL_ILLOPN, regs->rip) 516DO_ERROR_INFO( 6, SIGILL, "invalid opcode", invalid_op, ILL_ILLOPN, regs->rip)
489DO_ERROR( 7, SIGSEGV, "device not available", device_not_available) 517DO_ERROR( 7, SIGSEGV, "device not available", device_not_available)
490DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun) 518DO_ERROR( 9, SIGFPE, "coprocessor segment overrun", coprocessor_segment_overrun)
491DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS) 519DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
@@ -493,24 +521,41 @@ DO_ERROR(11, SIGBUS, "segment not present", segment_not_present)
493DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0) 521DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
494DO_ERROR(18, SIGSEGV, "reserved", reserved) 522DO_ERROR(18, SIGSEGV, "reserved", reserved)
495DO_ERROR(12, SIGBUS, "stack segment", stack_segment) 523DO_ERROR(12, SIGBUS, "stack segment", stack_segment)
496DO_ERROR( 8, SIGSEGV, "double fault", double_fault) 524
525asmlinkage void do_double_fault(struct pt_regs * regs, long error_code)
526{
527 static const char str[] = "double fault";
528 struct task_struct *tsk = current;
529
530 /* Return not checked because double check cannot be ignored */
531 notify_die(DIE_TRAP, str, regs, error_code, 8, SIGSEGV);
532
533 tsk->thread.error_code = error_code;
534 tsk->thread.trap_no = 8;
535
536 /* This is always a kernel trap and never fixable (and thus must
537 never return). */
538 for (;;)
539 die(str, regs, error_code);
540}
497 541
498asmlinkage void __kprobes do_general_protection(struct pt_regs * regs, 542asmlinkage void __kprobes do_general_protection(struct pt_regs * regs,
499 long error_code) 543 long error_code)
500{ 544{
545 struct task_struct *tsk = current;
546
501 conditional_sti(regs); 547 conditional_sti(regs);
502 548
503 if (user_mode(regs)) { 549 tsk->thread.error_code = error_code;
504 struct task_struct *tsk = current; 550 tsk->thread.trap_no = 13;
505 551
552 if (user_mode(regs)) {
506 if (exception_trace && unhandled_signal(tsk, SIGSEGV)) 553 if (exception_trace && unhandled_signal(tsk, SIGSEGV))
507 printk(KERN_INFO 554 printk(KERN_INFO
508 "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n", 555 "%s[%d] general protection rip:%lx rsp:%lx error:%lx\n",
509 tsk->comm, tsk->pid, 556 tsk->comm, tsk->pid,
510 regs->rip,regs->rsp,error_code); 557 regs->rip,regs->rsp,error_code);
511 558
512 tsk->thread.error_code = error_code;
513 tsk->thread.trap_no = 13;
514 force_sig(SIGSEGV, tsk); 559 force_sig(SIGSEGV, tsk);
515 return; 560 return;
516 } 561 }
@@ -573,7 +618,7 @@ asmlinkage void default_do_nmi(struct pt_regs *regs)
573 reason = get_nmi_reason(); 618 reason = get_nmi_reason();
574 619
575 if (!(reason & 0xc0)) { 620 if (!(reason & 0xc0)) {
576 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT) 621 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT)
577 == NOTIFY_STOP) 622 == NOTIFY_STOP)
578 return; 623 return;
579#ifdef CONFIG_X86_LOCAL_APIC 624#ifdef CONFIG_X86_LOCAL_APIC
@@ -589,7 +634,7 @@ asmlinkage void default_do_nmi(struct pt_regs *regs)
589 unknown_nmi_error(reason, regs); 634 unknown_nmi_error(reason, regs);
590 return; 635 return;
591 } 636 }
592 if (notify_die(DIE_NMI, "nmi", regs, reason, 0, SIGINT) == NOTIFY_STOP) 637 if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT) == NOTIFY_STOP)
593 return; 638 return;
594 639
595 /* AK: following checks seem to be broken on modern chipsets. FIXME */ 640 /* AK: following checks seem to be broken on modern chipsets. FIXME */
@@ -600,6 +645,7 @@ asmlinkage void default_do_nmi(struct pt_regs *regs)
600 io_check_error(reason, regs); 645 io_check_error(reason, regs);
601} 646}
602 647
648/* runs on IST stack. */
603asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code) 649asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code)
604{ 650{
605 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) { 651 if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) {
@@ -620,7 +666,7 @@ asmlinkage struct pt_regs *sync_regs(struct pt_regs *eregs)
620 ; 666 ;
621 /* Exception from user space */ 667 /* Exception from user space */
622 else if (user_mode(eregs)) 668 else if (user_mode(eregs))
623 regs = ((struct pt_regs *)current->thread.rsp0) - 1; 669 regs = task_pt_regs(current);
624 /* Exception from kernel and interrupts are enabled. Move to 670 /* Exception from kernel and interrupts are enabled. Move to
625 kernel process stack. */ 671 kernel process stack. */
626 else if (eregs->eflags & X86_EFLAGS_IF) 672 else if (eregs->eflags & X86_EFLAGS_IF)
@@ -684,11 +730,9 @@ asmlinkage void __kprobes do_debug(struct pt_regs * regs,
684 info.si_signo = SIGTRAP; 730 info.si_signo = SIGTRAP;
685 info.si_errno = 0; 731 info.si_errno = 0;
686 info.si_code = TRAP_BRKPT; 732 info.si_code = TRAP_BRKPT;
687 if (!user_mode(regs)) 733 info.si_addr = user_mode(regs) ? (void __user *)regs->rip : NULL;
688 goto clear_dr7; 734 force_sig_info(SIGTRAP, &info, tsk);
689 735
690 info.si_addr = (void __user *)regs->rip;
691 force_sig_info(SIGTRAP, &info, tsk);
692clear_dr7: 736clear_dr7:
693 set_debugreg(0UL, 7); 737 set_debugreg(0UL, 7);
694 return; 738 return;
@@ -698,7 +742,7 @@ clear_TF_reenable:
698 regs->eflags &= ~TF_MASK; 742 regs->eflags &= ~TF_MASK;
699} 743}
700 744
701static int kernel_math_error(struct pt_regs *regs, char *str) 745static int kernel_math_error(struct pt_regs *regs, const char *str, int trapnr)
702{ 746{
703 const struct exception_table_entry *fixup; 747 const struct exception_table_entry *fixup;
704 fixup = search_exception_tables(regs->rip); 748 fixup = search_exception_tables(regs->rip);
@@ -706,8 +750,9 @@ static int kernel_math_error(struct pt_regs *regs, char *str)
706 regs->rip = fixup->fixup; 750 regs->rip = fixup->fixup;
707 return 1; 751 return 1;
708 } 752 }
709 notify_die(DIE_GPF, str, regs, 0, 16, SIGFPE); 753 notify_die(DIE_GPF, str, regs, 0, trapnr, SIGFPE);
710 /* Illegal floating point operation in the kernel */ 754 /* Illegal floating point operation in the kernel */
755 current->thread.trap_no = trapnr;
711 die(str, regs, 0); 756 die(str, regs, 0);
712 return 0; 757 return 0;
713} 758}
@@ -726,7 +771,7 @@ asmlinkage void do_coprocessor_error(struct pt_regs *regs)
726 771
727 conditional_sti(regs); 772 conditional_sti(regs);
728 if (!user_mode(regs) && 773 if (!user_mode(regs) &&
729 kernel_math_error(regs, "kernel x87 math error")) 774 kernel_math_error(regs, "kernel x87 math error", 16))
730 return; 775 return;
731 776
732 /* 777 /*
@@ -795,7 +840,7 @@ asmlinkage void do_simd_coprocessor_error(struct pt_regs *regs)
795 840
796 conditional_sti(regs); 841 conditional_sti(regs);
797 if (!user_mode(regs) && 842 if (!user_mode(regs) &&
798 kernel_math_error(regs, "kernel simd math error")) 843 kernel_math_error(regs, "kernel simd math error", 19))
799 return; 844 return;
800 845
801 /* 846 /*
@@ -867,12 +912,7 @@ asmlinkage void math_state_restore(void)
867 if (!used_math()) 912 if (!used_math())
868 init_fpu(me); 913 init_fpu(me);
869 restore_fpu_checking(&me->thread.i387.fxsave); 914 restore_fpu_checking(&me->thread.i387.fxsave);
870 me->thread_info->status |= TS_USEDFPU; 915 task_thread_info(me)->status |= TS_USEDFPU;
871}
872
873void do_call_debug(struct pt_regs *regs)
874{
875 notify_die(DIE_CALL, "debug call", regs, 0, 255, SIGINT);
876} 916}
877 917
878void __init trap_init(void) 918void __init trap_init(void)
@@ -880,9 +920,9 @@ void __init trap_init(void)
880 set_intr_gate(0,&divide_error); 920 set_intr_gate(0,&divide_error);
881 set_intr_gate_ist(1,&debug,DEBUG_STACK); 921 set_intr_gate_ist(1,&debug,DEBUG_STACK);
882 set_intr_gate_ist(2,&nmi,NMI_STACK); 922 set_intr_gate_ist(2,&nmi,NMI_STACK);
883 set_system_gate(3,&int3); 923 set_system_gate_ist(3,&int3,DEBUG_STACK); /* int3 can be called from all */
884 set_system_gate(4,&overflow); /* int4-5 can be called from all */ 924 set_system_gate(4,&overflow); /* int4 can be called from all */
885 set_system_gate(5,&bounds); 925 set_intr_gate(5,&bounds);
886 set_intr_gate(6,&invalid_op); 926 set_intr_gate(6,&invalid_op);
887 set_intr_gate(7,&device_not_available); 927 set_intr_gate(7,&device_not_available);
888 set_intr_gate_ist(8,&double_fault, DOUBLEFAULT_STACK); 928 set_intr_gate_ist(8,&double_fault, DOUBLEFAULT_STACK);
@@ -904,8 +944,6 @@ void __init trap_init(void)
904 set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall); 944 set_system_gate(IA32_SYSCALL_VECTOR, ia32_syscall);
905#endif 945#endif
906 946
907 set_intr_gate(KDB_VECTOR, call_debug);
908
909 /* 947 /*
910 * Should be a barrier for any external CPU state. 948 * Should be a barrier for any external CPU state.
911 */ 949 */
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index 58b19215b4b3..b0eed1faf740 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -8,6 +8,8 @@
8#include <asm/page.h> 8#include <asm/page.h>
9#include <linux/config.h> 9#include <linux/config.h>
10 10
11#undef i386 /* in case the preprocessor is a 32bit one */
12
11OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64") 13OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
12OUTPUT_ARCH(i386:x86-64) 14OUTPUT_ARCH(i386:x86-64)
13ENTRY(phys_startup_64) 15ENTRY(phys_startup_64)
@@ -189,7 +191,7 @@ SECTIONS
189 /* Sections to be discarded */ 191 /* Sections to be discarded */
190 /DISCARD/ : { 192 /DISCARD/ : {
191 *(.exitcall.exit) 193 *(.exitcall.exit)
192#ifndef CONFIG_DEBUG_INFO 194#ifndef CONFIG_UNWIND_INFO
193 *(.eh_frame) 195 *(.eh_frame)
194#endif 196#endif
195 } 197 }
diff --git a/arch/x86_64/kernel/vsmp.c b/arch/x86_64/kernel/vsmp.c
new file mode 100644
index 000000000000..92f70c74965f
--- /dev/null
+++ b/arch/x86_64/kernel/vsmp.c
@@ -0,0 +1,45 @@
1/*
2 * vSMPowered(tm) systems specific initialization
3 * Copyright (C) 2005 ScaleMP Inc.
4 *
5 * Use of this code is subject to the terms and conditions of the
6 * GNU general public license version 2. See "COPYING" or
7 * http://www.gnu.org/licenses/gpl.html
8 *
9 * Ravikiran Thirumalai <kiran@scalemp.com>,
10 * Shai Fultheim <shai@scalemp.com>
11 */
12
13#include <linux/init.h>
14#include <linux/pci_ids.h>
15#include <linux/pci_regs.h>
16#include <asm/pci-direct.h>
17
18static int __init vsmp_init(void)
19{
20 void *address;
21 unsigned int cap, ctl;
22
23 /* Check if we are running on a ScaleMP vSMP box */
24 if ((read_pci_config_16(0, 0x1f, 0, PCI_VENDOR_ID) != PCI_VENDOR_ID_SCALEMP) ||
25 (read_pci_config_16(0, 0x1f, 0, PCI_DEVICE_ID) != PCI_DEVICE_ID_SCALEMP_VSMP_CTL))
26 return 0;
27
28 /* set vSMP magic bits to indicate vSMP capable kernel */
29 address = ioremap(read_pci_config(0, 0x1f, 0, PCI_BASE_ADDRESS_0), 8);
30 cap = readl(address);
31 ctl = readl(address + 4);
32 printk("vSMP CTL: capabilities:0x%08x control:0x%08x\n", cap, ctl);
33 if (cap & ctl & (1 << 4)) {
34 /* Turn on vSMP IRQ fastpath handling (see system.h) */
35 ctl &= ~(1 << 4);
36 writel(ctl, address + 4);
37 ctl = readl(address + 4);
38 printk("vSMP CTL: control set to:0x%08x\n", ctl);
39 }
40
41 iounmap(address);
42 return 0;
43}
44
45core_initcall(vsmp_init);
diff --git a/arch/x86_64/kernel/vsyscall.c b/arch/x86_64/kernel/vsyscall.c
index 70a0bd16085f..9468fb20b0bc 100644
--- a/arch/x86_64/kernel/vsyscall.c
+++ b/arch/x86_64/kernel/vsyscall.c
@@ -35,14 +35,13 @@
35#include <asm/io.h> 35#include <asm/io.h>
36 36
37#define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr))) 37#define __vsyscall(nr) __attribute__ ((unused,__section__(".vsyscall_" #nr)))
38#define force_inline __attribute__((always_inline)) inline
39 38
40int __sysctl_vsyscall __section_sysctl_vsyscall = 1; 39int __sysctl_vsyscall __section_sysctl_vsyscall = 1;
41seqlock_t __xtime_lock __section_xtime_lock = SEQLOCK_UNLOCKED; 40seqlock_t __xtime_lock __section_xtime_lock = SEQLOCK_UNLOCKED;
42 41
43#include <asm/unistd.h> 42#include <asm/unistd.h>
44 43
45static force_inline void timeval_normalize(struct timeval * tv) 44static __always_inline void timeval_normalize(struct timeval * tv)
46{ 45{
47 time_t __sec; 46 time_t __sec;
48 47
@@ -53,7 +52,7 @@ static force_inline void timeval_normalize(struct timeval * tv)
53 } 52 }
54} 53}
55 54
56static force_inline void do_vgettimeofday(struct timeval * tv) 55static __always_inline void do_vgettimeofday(struct timeval * tv)
57{ 56{
58 long sequence, t; 57 long sequence, t;
59 unsigned long sec, usec; 58 unsigned long sec, usec;
@@ -66,8 +65,7 @@ static force_inline void do_vgettimeofday(struct timeval * tv)
66 (__jiffies - __wall_jiffies) * (1000000 / HZ); 65 (__jiffies - __wall_jiffies) * (1000000 / HZ);
67 66
68 if (__vxtime.mode != VXTIME_HPET) { 67 if (__vxtime.mode != VXTIME_HPET) {
69 sync_core(); 68 t = get_cycles_sync();
70 rdtscll(t);
71 if (t < __vxtime.last_tsc) 69 if (t < __vxtime.last_tsc)
72 t = __vxtime.last_tsc; 70 t = __vxtime.last_tsc;
73 usec += ((t - __vxtime.last_tsc) * 71 usec += ((t - __vxtime.last_tsc) *
@@ -84,12 +82,12 @@ static force_inline void do_vgettimeofday(struct timeval * tv)
84} 82}
85 83
86/* RED-PEN may want to readd seq locking, but then the variable should be write-once. */ 84/* RED-PEN may want to readd seq locking, but then the variable should be write-once. */
87static force_inline void do_get_tz(struct timezone * tz) 85static __always_inline void do_get_tz(struct timezone * tz)
88{ 86{
89 *tz = __sys_tz; 87 *tz = __sys_tz;
90} 88}
91 89
92static force_inline int gettimeofday(struct timeval *tv, struct timezone *tz) 90static __always_inline int gettimeofday(struct timeval *tv, struct timezone *tz)
93{ 91{
94 int ret; 92 int ret;
95 asm volatile("vsysc2: syscall" 93 asm volatile("vsysc2: syscall"
@@ -98,7 +96,7 @@ static force_inline int gettimeofday(struct timeval *tv, struct timezone *tz)
98 return ret; 96 return ret;
99} 97}
100 98
101static force_inline long time_syscall(long *t) 99static __always_inline long time_syscall(long *t)
102{ 100{
103 long secs; 101 long secs;
104 asm volatile("vsysc1: syscall" 102 asm volatile("vsysc1: syscall"
diff --git a/arch/x86_64/kernel/x8664_ksyms.c b/arch/x86_64/kernel/x8664_ksyms.c
index 4a54221e10bc..b614d54d2ae4 100644
--- a/arch/x86_64/kernel/x8664_ksyms.c
+++ b/arch/x86_64/kernel/x8664_ksyms.c
@@ -13,7 +13,6 @@
13#include <linux/string.h> 13#include <linux/string.h>
14#include <linux/syscalls.h> 14#include <linux/syscalls.h>
15#include <linux/tty.h> 15#include <linux/tty.h>
16#include <linux/ioctl32.h>
17 16
18#include <asm/semaphore.h> 17#include <asm/semaphore.h>
19#include <asm/processor.h> 18#include <asm/processor.h>
@@ -45,22 +44,15 @@ extern struct drive_info_struct drive_info;
45EXPORT_SYMBOL(drive_info); 44EXPORT_SYMBOL(drive_info);
46#endif 45#endif
47 46
48extern unsigned long get_cmos_time(void);
49
50/* platform dependent support */ 47/* platform dependent support */
51EXPORT_SYMBOL(boot_cpu_data); 48EXPORT_SYMBOL(boot_cpu_data);
52//EXPORT_SYMBOL(dump_fpu); 49//EXPORT_SYMBOL(dump_fpu);
53EXPORT_SYMBOL(__ioremap); 50EXPORT_SYMBOL(__ioremap);
54EXPORT_SYMBOL(ioremap_nocache); 51EXPORT_SYMBOL(ioremap_nocache);
55EXPORT_SYMBOL(iounmap); 52EXPORT_SYMBOL(iounmap);
56EXPORT_SYMBOL(enable_irq);
57EXPORT_SYMBOL(disable_irq);
58EXPORT_SYMBOL(disable_irq_nosync);
59EXPORT_SYMBOL(probe_irq_mask);
60EXPORT_SYMBOL(kernel_thread); 53EXPORT_SYMBOL(kernel_thread);
61EXPORT_SYMBOL(pm_idle); 54EXPORT_SYMBOL(pm_idle);
62EXPORT_SYMBOL(pm_power_off); 55EXPORT_SYMBOL(pm_power_off);
63EXPORT_SYMBOL(get_cmos_time);
64 56
65EXPORT_SYMBOL(__down_failed); 57EXPORT_SYMBOL(__down_failed);
66EXPORT_SYMBOL(__down_failed_interruptible); 58EXPORT_SYMBOL(__down_failed_interruptible);
@@ -84,9 +76,6 @@ EXPORT_SYMBOL(__put_user_2);
84EXPORT_SYMBOL(__put_user_4); 76EXPORT_SYMBOL(__put_user_4);
85EXPORT_SYMBOL(__put_user_8); 77EXPORT_SYMBOL(__put_user_8);
86 78
87EXPORT_SYMBOL(strpbrk);
88EXPORT_SYMBOL(strstr);
89
90EXPORT_SYMBOL(strncpy_from_user); 79EXPORT_SYMBOL(strncpy_from_user);
91EXPORT_SYMBOL(__strncpy_from_user); 80EXPORT_SYMBOL(__strncpy_from_user);
92EXPORT_SYMBOL(clear_user); 81EXPORT_SYMBOL(clear_user);
@@ -98,25 +87,18 @@ EXPORT_SYMBOL(copy_in_user);
98EXPORT_SYMBOL(strnlen_user); 87EXPORT_SYMBOL(strnlen_user);
99 88
100#ifdef CONFIG_PCI 89#ifdef CONFIG_PCI
101EXPORT_SYMBOL(pci_alloc_consistent);
102EXPORT_SYMBOL(pci_free_consistent);
103#endif
104
105#ifdef CONFIG_PCI
106EXPORT_SYMBOL(pci_mem_start); 90EXPORT_SYMBOL(pci_mem_start);
107#endif 91#endif
108 92
109EXPORT_SYMBOL(copy_page); 93EXPORT_SYMBOL(copy_page);
110EXPORT_SYMBOL(clear_page); 94EXPORT_SYMBOL(clear_page);
111 95
112EXPORT_SYMBOL(cpu_pda); 96EXPORT_SYMBOL(_cpu_pda);
113#ifdef CONFIG_SMP 97#ifdef CONFIG_SMP
114EXPORT_SYMBOL(cpu_data); 98EXPORT_SYMBOL(cpu_data);
115EXPORT_SYMBOL(cpu_online_map);
116EXPORT_SYMBOL(__write_lock_failed); 99EXPORT_SYMBOL(__write_lock_failed);
117EXPORT_SYMBOL(__read_lock_failed); 100EXPORT_SYMBOL(__read_lock_failed);
118 101
119EXPORT_SYMBOL(synchronize_irq);
120EXPORT_SYMBOL(smp_call_function); 102EXPORT_SYMBOL(smp_call_function);
121EXPORT_SYMBOL(cpu_callout_map); 103EXPORT_SYMBOL(cpu_callout_map);
122#endif 104#endif
@@ -137,30 +119,17 @@ EXPORT_SYMBOL_GPL(unset_nmi_callback);
137#undef memcpy 119#undef memcpy
138#undef memset 120#undef memset
139#undef memmove 121#undef memmove
140#undef memchr
141#undef strlen 122#undef strlen
142#undef strncmp
143#undef strncpy
144#undef strchr
145 123
146extern void * memset(void *,int,__kernel_size_t); 124extern void * memset(void *,int,__kernel_size_t);
147extern size_t strlen(const char *); 125extern size_t strlen(const char *);
148extern void * memmove(void * dest,const void *src,size_t count); 126extern void * memmove(void * dest,const void *src,size_t count);
149extern void *memchr(const void *s, int c, size_t n);
150extern void * memcpy(void *,const void *,__kernel_size_t); 127extern void * memcpy(void *,const void *,__kernel_size_t);
151extern void * __memcpy(void *,const void *,__kernel_size_t); 128extern void * __memcpy(void *,const void *,__kernel_size_t);
152 129
153EXPORT_SYMBOL(memset); 130EXPORT_SYMBOL(memset);
154EXPORT_SYMBOL(strlen); 131EXPORT_SYMBOL(strlen);
155EXPORT_SYMBOL(memmove); 132EXPORT_SYMBOL(memmove);
156EXPORT_SYMBOL(strncmp);
157EXPORT_SYMBOL(strncpy);
158EXPORT_SYMBOL(strchr);
159EXPORT_SYMBOL(strncat);
160EXPORT_SYMBOL(memchr);
161EXPORT_SYMBOL(strrchr);
162EXPORT_SYMBOL(strnlen);
163EXPORT_SYMBOL(memscan);
164EXPORT_SYMBOL(memcpy); 133EXPORT_SYMBOL(memcpy);
165EXPORT_SYMBOL(__memcpy); 134EXPORT_SYMBOL(__memcpy);
166 135
diff --git a/arch/x86_64/lib/copy_user.S b/arch/x86_64/lib/copy_user.S
index dfa358b05c89..79422b6559c3 100644
--- a/arch/x86_64/lib/copy_user.S
+++ b/arch/x86_64/lib/copy_user.S
@@ -4,12 +4,9 @@
4 * Functions to copy from and to user space. 4 * Functions to copy from and to user space.
5 */ 5 */
6 6
7#define FIX_ALIGNMENT 1
8
9 #include <asm/current.h> 7 #include <asm/current.h>
10 #include <asm/asm-offsets.h> 8 #include <asm/asm-offsets.h>
11 #include <asm/thread_info.h> 9 #include <asm/thread_info.h>
12 #include <asm/cpufeature.h>
13 10
14/* Standard copy_to_user with segment limit checking */ 11/* Standard copy_to_user with segment limit checking */
15 .globl copy_to_user 12 .globl copy_to_user
@@ -21,23 +18,7 @@ copy_to_user:
21 jc bad_to_user 18 jc bad_to_user
22 cmpq threadinfo_addr_limit(%rax),%rcx 19 cmpq threadinfo_addr_limit(%rax),%rcx
23 jae bad_to_user 20 jae bad_to_user
242: 21 jmp copy_user_generic
25 .byte 0xe9 /* 32bit jump */
26 .long .Lcug-1f
271:
28
29 .section .altinstr_replacement,"ax"
303: .byte 0xe9 /* replacement jmp with 8 bit immediate */
31 .long copy_user_generic_c-1b /* offset */
32 .previous
33 .section .altinstructions,"a"
34 .align 8
35 .quad 2b
36 .quad 3b
37 .byte X86_FEATURE_K8_C
38 .byte 5
39 .byte 5
40 .previous
41 22
42/* Standard copy_from_user with segment limit checking */ 23/* Standard copy_from_user with segment limit checking */
43 .globl copy_from_user 24 .globl copy_from_user
@@ -72,223 +53,44 @@ bad_to_user:
72 * rsi source 53 * rsi source
73 * rdx count 54 * rdx count
74 * 55 *
56 * Only 4GB of copy is supported. This shouldn't be a problem
57 * because the kernel normally only writes from/to page sized chunks
58 * even if user space passed a longer buffer.
59 * And more would be dangerous because both Intel and AMD have
60 * errata with rep movsq > 4GB. If someone feels the need to fix
61 * this please consider this.
62 *
75 * Output: 63 * Output:
76 * eax uncopied bytes or 0 if successful. 64 * eax uncopied bytes or 0 if successful.
77 */ 65 */
78 .globl copy_user_generic
79 .p2align 4
80copy_user_generic:
81 .byte 0x66,0x66,0x90 /* 5 byte nop for replacement jump */
82 .byte 0x66,0x90
831:
84 .section .altinstr_replacement,"ax"
852: .byte 0xe9 /* near jump with 32bit immediate */
86 .long copy_user_generic_c-1b /* offset */
87 .previous
88 .section .altinstructions,"a"
89 .align 8
90 .quad copy_user_generic
91 .quad 2b
92 .byte X86_FEATURE_K8_C
93 .byte 5
94 .byte 5
95 .previous
96.Lcug:
97 pushq %rbx
98 xorl %eax,%eax /*zero for the exception handler */
99
100#ifdef FIX_ALIGNMENT
101 /* check for bad alignment of destination */
102 movl %edi,%ecx
103 andl $7,%ecx
104 jnz .Lbad_alignment
105.Lafter_bad_alignment:
106#endif
107 66
108 movq %rdx,%rcx 67 .globl copy_user_generic
109 68copy_user_generic:
110 movl $64,%ebx
111 shrq $6,%rdx
112 decq %rdx
113 js .Lhandle_tail
114
115 .p2align 4
116.Lloop:
117.Ls1: movq (%rsi),%r11
118.Ls2: movq 1*8(%rsi),%r8
119.Ls3: movq 2*8(%rsi),%r9
120.Ls4: movq 3*8(%rsi),%r10
121.Ld1: movq %r11,(%rdi)
122.Ld2: movq %r8,1*8(%rdi)
123.Ld3: movq %r9,2*8(%rdi)
124.Ld4: movq %r10,3*8(%rdi)
125
126.Ls5: movq 4*8(%rsi),%r11
127.Ls6: movq 5*8(%rsi),%r8
128.Ls7: movq 6*8(%rsi),%r9
129.Ls8: movq 7*8(%rsi),%r10
130.Ld5: movq %r11,4*8(%rdi)
131.Ld6: movq %r8,5*8(%rdi)
132.Ld7: movq %r9,6*8(%rdi)
133.Ld8: movq %r10,7*8(%rdi)
134
135 decq %rdx
136
137 leaq 64(%rsi),%rsi
138 leaq 64(%rdi),%rdi
139
140 jns .Lloop
141
142 .p2align 4
143.Lhandle_tail:
144 movl %ecx,%edx
145 andl $63,%ecx
146 shrl $3,%ecx
147 jz .Lhandle_7
148 movl $8,%ebx
149 .p2align 4
150.Lloop_8:
151.Ls9: movq (%rsi),%r8
152.Ld9: movq %r8,(%rdi)
153 decl %ecx
154 leaq 8(%rdi),%rdi
155 leaq 8(%rsi),%rsi
156 jnz .Lloop_8
157
158.Lhandle_7:
159 movl %edx,%ecx
160 andl $7,%ecx
161 jz .Lende
162 .p2align 4
163.Lloop_1:
164.Ls10: movb (%rsi),%bl
165.Ld10: movb %bl,(%rdi)
166 incq %rdi
167 incq %rsi
168 decl %ecx
169 jnz .Lloop_1
170
171.Lende:
172 popq %rbx
173 ret
174
175#ifdef FIX_ALIGNMENT
176 /* align destination */
177 .p2align 4
178.Lbad_alignment:
179 movl $8,%r9d
180 subl %ecx,%r9d
181 movl %r9d,%ecx
182 cmpq %r9,%rdx
183 jz .Lhandle_7
184 js .Lhandle_7
185.Lalign_1:
186.Ls11: movb (%rsi),%bl
187.Ld11: movb %bl,(%rdi)
188 incq %rsi
189 incq %rdi
190 decl %ecx
191 jnz .Lalign_1
192 subq %r9,%rdx
193 jmp .Lafter_bad_alignment
194#endif
195
196 /* table sorted by exception address */
197 .section __ex_table,"a"
198 .align 8
199 .quad .Ls1,.Ls1e
200 .quad .Ls2,.Ls2e
201 .quad .Ls3,.Ls3e
202 .quad .Ls4,.Ls4e
203 .quad .Ld1,.Ls1e
204 .quad .Ld2,.Ls2e
205 .quad .Ld3,.Ls3e
206 .quad .Ld4,.Ls4e
207 .quad .Ls5,.Ls5e
208 .quad .Ls6,.Ls6e
209 .quad .Ls7,.Ls7e
210 .quad .Ls8,.Ls8e
211 .quad .Ld5,.Ls5e
212 .quad .Ld6,.Ls6e
213 .quad .Ld7,.Ls7e
214 .quad .Ld8,.Ls8e
215 .quad .Ls9,.Le_quad
216 .quad .Ld9,.Le_quad
217 .quad .Ls10,.Le_byte
218 .quad .Ld10,.Le_byte
219#ifdef FIX_ALIGNMENT
220 .quad .Ls11,.Lzero_rest
221 .quad .Ld11,.Lzero_rest
222#endif
223 .quad .Le5,.Le_zero
224 .previous
225
226 /* compute 64-offset for main loop. 8 bytes accuracy with error on the
227 pessimistic side. this is gross. it would be better to fix the
228 interface. */
229 /* eax: zero, ebx: 64 */
230.Ls1e: addl $8,%eax
231.Ls2e: addl $8,%eax
232.Ls3e: addl $8,%eax
233.Ls4e: addl $8,%eax
234.Ls5e: addl $8,%eax
235.Ls6e: addl $8,%eax
236.Ls7e: addl $8,%eax
237.Ls8e: addl $8,%eax
238 addq %rbx,%rdi /* +64 */
239 subq %rax,%rdi /* correct destination with computed offset */
240
241 shlq $6,%rdx /* loop counter * 64 (stride length) */
242 addq %rax,%rdx /* add offset to loopcnt */
243 andl $63,%ecx /* remaining bytes */
244 addq %rcx,%rdx /* add them */
245 jmp .Lzero_rest
246
247 /* exception on quad word loop in tail handling */
248 /* ecx: loopcnt/8, %edx: length, rdi: correct */
249.Le_quad:
250 shll $3,%ecx
251 andl $7,%edx
252 addl %ecx,%edx
253 /* edx: bytes to zero, rdi: dest, eax:zero */
254.Lzero_rest:
255 movq %rdx,%rcx
256.Le_byte:
257 xorl %eax,%eax
258.Le5: rep
259 stosb
260 /* when there is another exception while zeroing the rest just return */
261.Le_zero:
262 movq %rdx,%rax
263 jmp .Lende
264
265 /* C stepping K8 run faster using the string copy instructions.
266 This is also a lot simpler. Use them when possible.
267 Patch in jmps to this code instead of copying it fully
268 to avoid unwanted aliasing in the exception tables. */
269
270 /* rdi destination
271 * rsi source
272 * rdx count
273 *
274 * Output:
275 * eax uncopied bytes or 0 if successfull.
276 */
277copy_user_generic_c:
278 movl %edx,%ecx 69 movl %edx,%ecx
279 shrl $3,%ecx 70 shrl $3,%ecx
280 andl $7,%edx 71 andl $7,%edx
72 jz 5f
2811: rep 731: rep
282 movsq 74 movsq
283 movl %edx,%ecx 75 movl %edx,%ecx
76 xor %eax,%eax
2842: rep 772: rep
285 movsb 78 movsb
2864: movl %ecx,%eax
287 ret 79 ret
80 /* align here? */
815: xorl %eax,%eax
826: rep movsq
83 ret
84
85 .section .fixup,"ax"
2883: lea (%rdx,%rcx,8),%rax 863: lea (%rdx,%rcx,8),%rax
289 ret 87 ret
290 884: movl %ecx,%eax
89 ret
90 .previous
91
291 .section __ex_table,"a" 92 .section __ex_table,"a"
292 .quad 1b,3b 93 .quad 1b,3b
293 .quad 2b,4b 94 .quad 2b,4b
95 .quad 6b,4b
294 .previous 96 .previous
diff --git a/arch/x86_64/lib/delay.c b/arch/x86_64/lib/delay.c
index 841bd738a189..03c460cbdd1c 100644
--- a/arch/x86_64/lib/delay.c
+++ b/arch/x86_64/lib/delay.c
@@ -39,7 +39,7 @@ void __delay(unsigned long loops)
39 39
40inline void __const_udelay(unsigned long xloops) 40inline void __const_udelay(unsigned long xloops)
41{ 41{
42 __delay(((xloops * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32) * HZ); 42 __delay((xloops * HZ * cpu_data[raw_smp_processor_id()].loops_per_jiffy) >> 32);
43} 43}
44 44
45void __udelay(unsigned long usecs) 45void __udelay(unsigned long usecs)
diff --git a/arch/x86_64/lib/usercopy.c b/arch/x86_64/lib/usercopy.c
index db8abba1ad81..9bc2c295818e 100644
--- a/arch/x86_64/lib/usercopy.c
+++ b/arch/x86_64/lib/usercopy.c
@@ -109,14 +109,11 @@ unsigned long clear_user(void __user *to, unsigned long n)
109 * Return 0 on exception, a value greater than N if too long 109 * Return 0 on exception, a value greater than N if too long
110 */ 110 */
111 111
112long strnlen_user(const char __user *s, long n) 112long __strnlen_user(const char __user *s, long n)
113{ 113{
114 long res = 0; 114 long res = 0;
115 char c; 115 char c;
116 116
117 if (!access_ok(VERIFY_READ, s, n))
118 return 0;
119
120 while (1) { 117 while (1) {
121 if (res>n) 118 if (res>n)
122 return n+1; 119 return n+1;
@@ -129,6 +126,13 @@ long strnlen_user(const char __user *s, long n)
129 } 126 }
130} 127}
131 128
129long strnlen_user(const char __user *s, long n)
130{
131 if (!access_ok(VERIFY_READ, s, n))
132 return 0;
133 return __strnlen_user(s, n);
134}
135
132long strlen_user(const char __user *s) 136long strlen_user(const char __user *s)
133{ 137{
134 long res = 0; 138 long res = 0;
diff --git a/arch/x86_64/mm/Makefile b/arch/x86_64/mm/Makefile
index 1d232a87f113..d25ac86fe27a 100644
--- a/arch/x86_64/mm/Makefile
+++ b/arch/x86_64/mm/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux x86_64-specific parts of the memory manager. 2# Makefile for the linux x86_64-specific parts of the memory manager.
3# 3#
4 4
5obj-y := init.o fault.o ioremap.o extable.o pageattr.o 5obj-y := init.o fault.o ioremap.o extable.o pageattr.o mmap.o
6obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o 6obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
7obj-$(CONFIG_NUMA) += numa.o 7obj-$(CONFIG_NUMA) += numa.o
8obj-$(CONFIG_K8_NUMA) += k8topology.o 8obj-$(CONFIG_K8_NUMA) += k8topology.o
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index 3a63707a698b..26eac194064b 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -35,6 +35,13 @@
35#include <asm-generic/sections.h> 35#include <asm-generic/sections.h>
36#include <asm/kdebug.h> 36#include <asm/kdebug.h>
37 37
38/* Page fault error code bits */
39#define PF_PROT (1<<0) /* or no page found */
40#define PF_WRITE (1<<1)
41#define PF_USER (1<<2)
42#define PF_RSVD (1<<3)
43#define PF_INSTR (1<<4)
44
38void bust_spinlocks(int yes) 45void bust_spinlocks(int yes)
39{ 46{
40 int loglevel_save = console_loglevel; 47 int loglevel_save = console_loglevel;
@@ -68,7 +75,7 @@ static noinline int is_prefetch(struct pt_regs *regs, unsigned long addr,
68 unsigned char *max_instr; 75 unsigned char *max_instr;
69 76
70 /* If it was a exec fault ignore */ 77 /* If it was a exec fault ignore */
71 if (error_code & (1<<4)) 78 if (error_code & PF_INSTR)
72 return 0; 79 return 0;
73 80
74 instr = (unsigned char *)convert_rip_to_linear(current, regs); 81 instr = (unsigned char *)convert_rip_to_linear(current, regs);
@@ -222,17 +229,22 @@ static noinline void pgtable_bad(unsigned long address, struct pt_regs *regs,
222 unsigned long error_code) 229 unsigned long error_code)
223{ 230{
224 unsigned long flags = oops_begin(); 231 unsigned long flags = oops_begin();
232 struct task_struct *tsk;
225 233
226 printk(KERN_ALERT "%s: Corrupted page table at address %lx\n", 234 printk(KERN_ALERT "%s: Corrupted page table at address %lx\n",
227 current->comm, address); 235 current->comm, address);
228 dump_pagetable(address); 236 dump_pagetable(address);
237 tsk = current;
238 tsk->thread.cr2 = address;
239 tsk->thread.trap_no = 14;
240 tsk->thread.error_code = error_code;
229 __die("Bad pagetable", regs, error_code); 241 __die("Bad pagetable", regs, error_code);
230 oops_end(flags); 242 oops_end(flags);
231 do_exit(SIGKILL); 243 do_exit(SIGKILL);
232} 244}
233 245
234/* 246/*
235 * Handle a fault on the vmalloc or module mapping area 247 * Handle a fault on the vmalloc area
236 * 248 *
237 * This assumes no large pages in there. 249 * This assumes no large pages in there.
238 */ 250 */
@@ -278,7 +290,6 @@ static int vmalloc_fault(unsigned long address)
278 that. */ 290 that. */
279 if (!pte_present(*pte) || pte_pfn(*pte) != pte_pfn(*pte_ref)) 291 if (!pte_present(*pte) || pte_pfn(*pte) != pte_pfn(*pte_ref))
280 BUG(); 292 BUG();
281 __flush_tlb_all();
282 return 0; 293 return 0;
283} 294}
284 295
@@ -289,12 +300,6 @@ int exception_trace = 1;
289 * This routine handles page faults. It determines the address, 300 * This routine handles page faults. It determines the address,
290 * and the problem, and then passes it off to one of the appropriate 301 * and the problem, and then passes it off to one of the appropriate
291 * routines. 302 * routines.
292 *
293 * error_code:
294 * bit 0 == 0 means no page found, 1 means protection fault
295 * bit 1 == 0 means read, 1 means write
296 * bit 2 == 0 means kernel, 1 means user-mode
297 * bit 3 == 1 means fault was an instruction fetch
298 */ 303 */
299asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, 304asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
300 unsigned long error_code) 305 unsigned long error_code)
@@ -337,12 +342,16 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
337 * 342 *
338 * This verifies that the fault happens in kernel space 343 * This verifies that the fault happens in kernel space
339 * (error_code & 4) == 0, and that the fault was not a 344 * (error_code & 4) == 0, and that the fault was not a
340 * protection error (error_code & 1) == 0. 345 * protection error (error_code & 9) == 0.
341 */ 346 */
342 if (unlikely(address >= TASK_SIZE64)) { 347 if (unlikely(address >= TASK_SIZE64)) {
343 if (!(error_code & 5) && 348 /*
344 ((address >= VMALLOC_START && address < VMALLOC_END) || 349 * Don't check for the module range here: its PML4
345 (address >= MODULES_VADDR && address < MODULES_END))) { 350 * is always initialized because it's shared with the main
351 * kernel text. Only vmalloc may need PML4 syncups.
352 */
353 if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) &&
354 ((address >= VMALLOC_START && address < VMALLOC_END))) {
346 if (vmalloc_fault(address) < 0) 355 if (vmalloc_fault(address) < 0)
347 goto bad_area_nosemaphore; 356 goto bad_area_nosemaphore;
348 return; 357 return;
@@ -354,7 +363,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
354 goto bad_area_nosemaphore; 363 goto bad_area_nosemaphore;
355 } 364 }
356 365
357 if (unlikely(error_code & (1 << 3))) 366 if (unlikely(error_code & PF_RSVD))
358 pgtable_bad(address, regs, error_code); 367 pgtable_bad(address, regs, error_code);
359 368
360 /* 369 /*
@@ -381,7 +390,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
381 * thus avoiding the deadlock. 390 * thus avoiding the deadlock.
382 */ 391 */
383 if (!down_read_trylock(&mm->mmap_sem)) { 392 if (!down_read_trylock(&mm->mmap_sem)) {
384 if ((error_code & 4) == 0 && 393 if ((error_code & PF_USER) == 0 &&
385 !search_exception_tables(regs->rip)) 394 !search_exception_tables(regs->rip))
386 goto bad_area_nosemaphore; 395 goto bad_area_nosemaphore;
387 down_read(&mm->mmap_sem); 396 down_read(&mm->mmap_sem);
@@ -408,17 +417,17 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
408good_area: 417good_area:
409 info.si_code = SEGV_ACCERR; 418 info.si_code = SEGV_ACCERR;
410 write = 0; 419 write = 0;
411 switch (error_code & 3) { 420 switch (error_code & (PF_PROT|PF_WRITE)) {
412 default: /* 3: write, present */ 421 default: /* 3: write, present */
413 /* fall through */ 422 /* fall through */
414 case 2: /* write, not present */ 423 case PF_WRITE: /* write, not present */
415 if (!(vma->vm_flags & VM_WRITE)) 424 if (!(vma->vm_flags & VM_WRITE))
416 goto bad_area; 425 goto bad_area;
417 write++; 426 write++;
418 break; 427 break;
419 case 1: /* read, present */ 428 case PF_PROT: /* read, present */
420 goto bad_area; 429 goto bad_area;
421 case 0: /* read, not present */ 430 case 0: /* read, not present */
422 if (!(vma->vm_flags & (VM_READ | VM_EXEC))) 431 if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
423 goto bad_area; 432 goto bad_area;
424 } 433 }
@@ -453,7 +462,7 @@ bad_area:
453 462
454bad_area_nosemaphore: 463bad_area_nosemaphore:
455 /* User mode accesses just cause a SIGSEGV */ 464 /* User mode accesses just cause a SIGSEGV */
456 if (error_code & 4) { 465 if (error_code & PF_USER) {
457 if (is_prefetch(regs, address, error_code)) 466 if (is_prefetch(regs, address, error_code))
458 return; 467 return;
459 468
@@ -521,6 +530,9 @@ no_context:
521 printk_address(regs->rip); 530 printk_address(regs->rip);
522 printk("\n"); 531 printk("\n");
523 dump_pagetable(address); 532 dump_pagetable(address);
533 tsk->thread.cr2 = address;
534 tsk->thread.trap_no = 14;
535 tsk->thread.error_code = error_code;
524 __die("Oops", regs, error_code); 536 __die("Oops", regs, error_code);
525 /* Executive summary in case the body of the oops scrolled away */ 537 /* Executive summary in case the body of the oops scrolled away */
526 printk(KERN_EMERG "CR2: %016lx\n", address); 538 printk(KERN_EMERG "CR2: %016lx\n", address);
@@ -546,7 +558,7 @@ do_sigbus:
546 up_read(&mm->mmap_sem); 558 up_read(&mm->mmap_sem);
547 559
548 /* Kernel mode? Handle exceptions or die */ 560 /* Kernel mode? Handle exceptions or die */
549 if (!(error_code & 4)) 561 if (!(error_code & PF_USER))
550 goto no_context; 562 goto no_context;
551 563
552 tsk->thread.cr2 = address; 564 tsk->thread.cr2 = address;
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index 286f6a624c3a..7af1742aa958 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -23,6 +23,9 @@
23#include <linux/bootmem.h> 23#include <linux/bootmem.h>
24#include <linux/proc_fs.h> 24#include <linux/proc_fs.h>
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/dma-mapping.h>
27#include <linux/module.h>
28#include <linux/memory_hotplug.h>
26 29
27#include <asm/processor.h> 30#include <asm/processor.h>
28#include <asm/system.h> 31#include <asm/system.h>
@@ -38,11 +41,16 @@
38#include <asm/proto.h> 41#include <asm/proto.h>
39#include <asm/smp.h> 42#include <asm/smp.h>
40#include <asm/sections.h> 43#include <asm/sections.h>
44#include <asm/dma-mapping.h>
45#include <asm/swiotlb.h>
41 46
42#ifndef Dprintk 47#ifndef Dprintk
43#define Dprintk(x...) 48#define Dprintk(x...)
44#endif 49#endif
45 50
51struct dma_mapping_ops* dma_ops;
52EXPORT_SYMBOL(dma_ops);
53
46static unsigned long dma_reserve __initdata; 54static unsigned long dma_reserve __initdata;
47 55
48DEFINE_PER_CPU(struct mmu_gather, mmu_gathers); 56DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
@@ -174,13 +182,19 @@ static struct temp_map {
174 {} 182 {}
175}; 183};
176 184
177static __init void *alloc_low_page(int *index, unsigned long *phys) 185static __meminit void *alloc_low_page(int *index, unsigned long *phys)
178{ 186{
179 struct temp_map *ti; 187 struct temp_map *ti;
180 int i; 188 int i;
181 unsigned long pfn = table_end++, paddr; 189 unsigned long pfn = table_end++, paddr;
182 void *adr; 190 void *adr;
183 191
192 if (after_bootmem) {
193 adr = (void *)get_zeroed_page(GFP_ATOMIC);
194 *phys = __pa(adr);
195 return adr;
196 }
197
184 if (pfn >= end_pfn) 198 if (pfn >= end_pfn)
185 panic("alloc_low_page: ran out of memory"); 199 panic("alloc_low_page: ran out of memory");
186 for (i = 0; temp_mappings[i].allocated; i++) { 200 for (i = 0; temp_mappings[i].allocated; i++) {
@@ -193,55 +207,86 @@ static __init void *alloc_low_page(int *index, unsigned long *phys)
193 ti->allocated = 1; 207 ti->allocated = 1;
194 __flush_tlb(); 208 __flush_tlb();
195 adr = ti->address + ((pfn << PAGE_SHIFT) & ~PMD_MASK); 209 adr = ti->address + ((pfn << PAGE_SHIFT) & ~PMD_MASK);
210 memset(adr, 0, PAGE_SIZE);
196 *index = i; 211 *index = i;
197 *phys = pfn * PAGE_SIZE; 212 *phys = pfn * PAGE_SIZE;
198 return adr; 213 return adr;
199} 214}
200 215
201static __init void unmap_low_page(int i) 216static __meminit void unmap_low_page(int i)
202{ 217{
203 struct temp_map *ti = &temp_mappings[i]; 218 struct temp_map *ti;
219
220 if (after_bootmem)
221 return;
222
223 ti = &temp_mappings[i];
204 set_pmd(ti->pmd, __pmd(0)); 224 set_pmd(ti->pmd, __pmd(0));
205 ti->allocated = 0; 225 ti->allocated = 0;
206} 226}
207 227
208static void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned long end) 228static void __meminit
229phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end)
230{
231 int i;
232
233 for (i = 0; i < PTRS_PER_PMD; pmd++, i++, address += PMD_SIZE) {
234 unsigned long entry;
235
236 if (address > end) {
237 for (; i < PTRS_PER_PMD; i++, pmd++)
238 set_pmd(pmd, __pmd(0));
239 break;
240 }
241 entry = _PAGE_NX|_PAGE_PSE|_KERNPG_TABLE|_PAGE_GLOBAL|address;
242 entry &= __supported_pte_mask;
243 set_pmd(pmd, __pmd(entry));
244 }
245}
246
247static void __meminit
248phys_pmd_update(pud_t *pud, unsigned long address, unsigned long end)
249{
250 pmd_t *pmd = pmd_offset(pud, (unsigned long)__va(address));
251
252 if (pmd_none(*pmd)) {
253 spin_lock(&init_mm.page_table_lock);
254 phys_pmd_init(pmd, address, end);
255 spin_unlock(&init_mm.page_table_lock);
256 __flush_tlb_all();
257 }
258}
259
260static void __meminit phys_pud_init(pud_t *pud, unsigned long address, unsigned long end)
209{ 261{
210 long i, j; 262 long i = pud_index(address);
211 263
212 i = pud_index(address);
213 pud = pud + i; 264 pud = pud + i;
265
266 if (after_bootmem && pud_val(*pud)) {
267 phys_pmd_update(pud, address, end);
268 return;
269 }
270
214 for (; i < PTRS_PER_PUD; pud++, i++) { 271 for (; i < PTRS_PER_PUD; pud++, i++) {
215 int map; 272 int map;
216 unsigned long paddr, pmd_phys; 273 unsigned long paddr, pmd_phys;
217 pmd_t *pmd; 274 pmd_t *pmd;
218 275
219 paddr = address + i*PUD_SIZE; 276 paddr = (address & PGDIR_MASK) + i*PUD_SIZE;
220 if (paddr >= end) { 277 if (paddr >= end)
221 for (; i < PTRS_PER_PUD; i++, pud++)
222 set_pud(pud, __pud(0));
223 break; 278 break;
224 }
225 279
226 if (!e820_mapped(paddr, paddr+PUD_SIZE, 0)) { 280 if (!after_bootmem && !e820_mapped(paddr, paddr+PUD_SIZE, 0)) {
227 set_pud(pud, __pud(0)); 281 set_pud(pud, __pud(0));
228 continue; 282 continue;
229 } 283 }
230 284
231 pmd = alloc_low_page(&map, &pmd_phys); 285 pmd = alloc_low_page(&map, &pmd_phys);
286 spin_lock(&init_mm.page_table_lock);
232 set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE)); 287 set_pud(pud, __pud(pmd_phys | _KERNPG_TABLE));
233 for (j = 0; j < PTRS_PER_PMD; pmd++, j++, paddr += PMD_SIZE) { 288 phys_pmd_init(pmd, paddr, end);
234 unsigned long pe; 289 spin_unlock(&init_mm.page_table_lock);
235
236 if (paddr >= end) {
237 for (; j < PTRS_PER_PMD; j++, pmd++)
238 set_pmd(pmd, __pmd(0));
239 break;
240 }
241 pe = _PAGE_NX|_PAGE_PSE | _KERNPG_TABLE | _PAGE_GLOBAL | paddr;
242 pe &= __supported_pte_mask;
243 set_pmd(pmd, __pmd(pe));
244 }
245 unmap_low_page(map); 290 unmap_low_page(map);
246 } 291 }
247 __flush_tlb(); 292 __flush_tlb();
@@ -249,25 +294,32 @@ static void __init phys_pud_init(pud_t *pud, unsigned long address, unsigned lon
249 294
250static void __init find_early_table_space(unsigned long end) 295static void __init find_early_table_space(unsigned long end)
251{ 296{
252 unsigned long puds, pmds, tables; 297 unsigned long puds, pmds, tables, start;
253 298
254 puds = (end + PUD_SIZE - 1) >> PUD_SHIFT; 299 puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
255 pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT; 300 pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
256 tables = round_up(puds * sizeof(pud_t), PAGE_SIZE) + 301 tables = round_up(puds * sizeof(pud_t), PAGE_SIZE) +
257 round_up(pmds * sizeof(pmd_t), PAGE_SIZE); 302 round_up(pmds * sizeof(pmd_t), PAGE_SIZE);
258 303
259 table_start = find_e820_area(0x8000, __pa_symbol(&_text), tables); 304 /* RED-PEN putting page tables only on node 0 could
305 cause a hotspot and fill up ZONE_DMA. The page tables
306 need roughly 0.5KB per GB. */
307 start = 0x8000;
308 table_start = find_e820_area(start, end, tables);
260 if (table_start == -1UL) 309 if (table_start == -1UL)
261 panic("Cannot find space for the kernel page tables"); 310 panic("Cannot find space for the kernel page tables");
262 311
263 table_start >>= PAGE_SHIFT; 312 table_start >>= PAGE_SHIFT;
264 table_end = table_start; 313 table_end = table_start;
314
315 early_printk("kernel direct mapping tables up to %lx @ %lx-%lx\n",
316 end, table_start << PAGE_SHIFT, table_end << PAGE_SHIFT);
265} 317}
266 318
267/* Setup the direct mapping of the physical memory at PAGE_OFFSET. 319/* Setup the direct mapping of the physical memory at PAGE_OFFSET.
268 This runs before bootmem is initialized and gets pages directly from the 320 This runs before bootmem is initialized and gets pages directly from the
269 physical memory. To access them they are temporarily mapped. */ 321 physical memory. To access them they are temporarily mapped. */
270void __init init_memory_mapping(unsigned long start, unsigned long end) 322void __meminit init_memory_mapping(unsigned long start, unsigned long end)
271{ 323{
272 unsigned long next; 324 unsigned long next;
273 325
@@ -279,7 +331,8 @@ void __init init_memory_mapping(unsigned long start, unsigned long end)
279 * mapped. Unfortunately this is done currently before the nodes are 331 * mapped. Unfortunately this is done currently before the nodes are
280 * discovered. 332 * discovered.
281 */ 333 */
282 find_early_table_space(end); 334 if (!after_bootmem)
335 find_early_table_space(end);
283 336
284 start = (unsigned long)__va(start); 337 start = (unsigned long)__va(start);
285 end = (unsigned long)__va(end); 338 end = (unsigned long)__va(end);
@@ -287,20 +340,26 @@ void __init init_memory_mapping(unsigned long start, unsigned long end)
287 for (; start < end; start = next) { 340 for (; start < end; start = next) {
288 int map; 341 int map;
289 unsigned long pud_phys; 342 unsigned long pud_phys;
290 pud_t *pud = alloc_low_page(&map, &pud_phys); 343 pgd_t *pgd = pgd_offset_k(start);
344 pud_t *pud;
345
346 if (after_bootmem)
347 pud = pud_offset_k(pgd, __PAGE_OFFSET);
348 else
349 pud = alloc_low_page(&map, &pud_phys);
350
291 next = start + PGDIR_SIZE; 351 next = start + PGDIR_SIZE;
292 if (next > end) 352 if (next > end)
293 next = end; 353 next = end;
294 phys_pud_init(pud, __pa(start), __pa(next)); 354 phys_pud_init(pud, __pa(start), __pa(next));
295 set_pgd(pgd_offset_k(start), mk_kernel_pgd(pud_phys)); 355 if (!after_bootmem)
356 set_pgd(pgd_offset_k(start), mk_kernel_pgd(pud_phys));
296 unmap_low_page(map); 357 unmap_low_page(map);
297 } 358 }
298 359
299 asm volatile("movq %%cr4,%0" : "=r" (mmu_cr4_features)); 360 if (!after_bootmem)
361 asm volatile("movq %%cr4,%0" : "=r" (mmu_cr4_features));
300 __flush_tlb_all(); 362 __flush_tlb_all();
301 early_printk("kernel direct mapping tables upto %lx @ %lx-%lx\n", end,
302 table_start<<PAGE_SHIFT,
303 table_end<<PAGE_SHIFT);
304} 363}
305 364
306void __cpuinit zap_low_mappings(int cpu) 365void __cpuinit zap_low_mappings(int cpu)
@@ -348,7 +407,7 @@ size_zones(unsigned long *z, unsigned long *h,
348 } 407 }
349 408
350 /* Compute holes */ 409 /* Compute holes */
351 w = 0; 410 w = start_pfn;
352 for (i = 0; i < MAX_NR_ZONES; i++) { 411 for (i = 0; i < MAX_NR_ZONES; i++) {
353 unsigned long s = w; 412 unsigned long s = w;
354 w += z[i]; 413 w += z[i];
@@ -375,6 +434,9 @@ size_zones(unsigned long *z, unsigned long *h,
375void __init paging_init(void) 434void __init paging_init(void)
376{ 435{
377 unsigned long zones[MAX_NR_ZONES], holes[MAX_NR_ZONES]; 436 unsigned long zones[MAX_NR_ZONES], holes[MAX_NR_ZONES];
437
438 memory_present(0, 0, end_pfn);
439 sparse_init();
378 size_zones(zones, holes, 0, end_pfn); 440 size_zones(zones, holes, 0, end_pfn);
379 free_area_init_node(0, NODE_DATA(0), zones, 441 free_area_init_node(0, NODE_DATA(0), zones,
380 __pa(PAGE_OFFSET) >> PAGE_SHIFT, holes); 442 __pa(PAGE_OFFSET) >> PAGE_SHIFT, holes);
@@ -415,6 +477,50 @@ void __init clear_kernel_mapping(unsigned long address, unsigned long size)
415 __flush_tlb_all(); 477 __flush_tlb_all();
416} 478}
417 479
480/*
481 * Memory hotplug specific functions
482 * These are only for non-NUMA machines right now.
483 */
484#ifdef CONFIG_MEMORY_HOTPLUG
485
486void online_page(struct page *page)
487{
488 ClearPageReserved(page);
489 set_page_count(page, 1);
490 __free_page(page);
491 totalram_pages++;
492 num_physpages++;
493}
494
495int add_memory(u64 start, u64 size)
496{
497 struct pglist_data *pgdat = NODE_DATA(0);
498 struct zone *zone = pgdat->node_zones + MAX_NR_ZONES-2;
499 unsigned long start_pfn = start >> PAGE_SHIFT;
500 unsigned long nr_pages = size >> PAGE_SHIFT;
501 int ret;
502
503 ret = __add_pages(zone, start_pfn, nr_pages);
504 if (ret)
505 goto error;
506
507 init_memory_mapping(start, (start + size -1));
508
509 return ret;
510error:
511 printk("%s: Problem encountered in __add_pages!\n", __func__);
512 return ret;
513}
514EXPORT_SYMBOL_GPL(add_memory);
515
516int remove_memory(u64 start, u64 size)
517{
518 return -EINVAL;
519}
520EXPORT_SYMBOL_GPL(remove_memory);
521
522#endif
523
418static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules, 524static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
419 kcore_vsyscall; 525 kcore_vsyscall;
420 526
@@ -423,12 +529,9 @@ void __init mem_init(void)
423 long codesize, reservedpages, datasize, initsize; 529 long codesize, reservedpages, datasize, initsize;
424 530
425#ifdef CONFIG_SWIOTLB 531#ifdef CONFIG_SWIOTLB
426 if (!iommu_aperture && 532 pci_swiotlb_init();
427 (end_pfn >= 0xffffffff>>PAGE_SHIFT || force_iommu))
428 swiotlb = 1;
429 if (swiotlb)
430 swiotlb_init();
431#endif 533#endif
534 no_iommu_init();
432 535
433 /* How many end-of-memory variables you have, grandma! */ 536 /* How many end-of-memory variables you have, grandma! */
434 max_low_pfn = end_pfn; 537 max_low_pfn = end_pfn;
@@ -498,10 +601,33 @@ void free_initmem(void)
498 printk ("Freeing unused kernel memory: %luk freed\n", (__init_end - __init_begin) >> 10); 601 printk ("Freeing unused kernel memory: %luk freed\n", (__init_end - __init_begin) >> 10);
499} 602}
500 603
604#ifdef CONFIG_DEBUG_RODATA
605
606extern char __start_rodata, __end_rodata;
607void mark_rodata_ro(void)
608{
609 unsigned long addr = (unsigned long)&__start_rodata;
610
611 for (; addr < (unsigned long)&__end_rodata; addr += PAGE_SIZE)
612 change_page_attr_addr(addr, 1, PAGE_KERNEL_RO);
613
614 printk ("Write protecting the kernel read-only data: %luk\n",
615 (&__end_rodata - &__start_rodata) >> 10);
616
617 /*
618 * change_page_attr_addr() requires a global_flush_tlb() call after it.
619 * We do this after the printk so that if something went wrong in the
620 * change, the printk gets out at least to give a better debug hint
621 * of who is the culprit.
622 */
623 global_flush_tlb();
624}
625#endif
626
501#ifdef CONFIG_BLK_DEV_INITRD 627#ifdef CONFIG_BLK_DEV_INITRD
502void free_initrd_mem(unsigned long start, unsigned long end) 628void free_initrd_mem(unsigned long start, unsigned long end)
503{ 629{
504 if (start < (unsigned long)&_end) 630 if (start >= end)
505 return; 631 return;
506 printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10); 632 printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
507 for (; start < end; start += PAGE_SIZE) { 633 for (; start < end; start += PAGE_SIZE) {
diff --git a/arch/x86_64/mm/ioremap.c b/arch/x86_64/mm/ioremap.c
index ecf7acb5db9b..ae207064201e 100644
--- a/arch/x86_64/mm/ioremap.c
+++ b/arch/x86_64/mm/ioremap.c
@@ -247,9 +247,15 @@ void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size)
247 return __ioremap(phys_addr, size, _PAGE_PCD); 247 return __ioremap(phys_addr, size, _PAGE_PCD);
248} 248}
249 249
250/**
251 * iounmap - Free a IO remapping
252 * @addr: virtual address from ioremap_*
253 *
254 * Caller must ensure there is only one unmapping for the same pointer.
255 */
250void iounmap(volatile void __iomem *addr) 256void iounmap(volatile void __iomem *addr)
251{ 257{
252 struct vm_struct *p; 258 struct vm_struct *p, *o;
253 259
254 if (addr <= high_memory) 260 if (addr <= high_memory)
255 return; 261 return;
@@ -257,12 +263,31 @@ void iounmap(volatile void __iomem *addr)
257 addr < phys_to_virt(ISA_END_ADDRESS)) 263 addr < phys_to_virt(ISA_END_ADDRESS))
258 return; 264 return;
259 265
260 write_lock(&vmlist_lock); 266 addr = (volatile void __iomem *)(PAGE_MASK & (unsigned long __force)addr);
261 p = __remove_vm_area((void *)((unsigned long)addr & PAGE_MASK)); 267 /* Use the vm area unlocked, assuming the caller
262 if (!p) 268 ensures there isn't another iounmap for the same address
269 in parallel. Reuse of the virtual address is prevented by
270 leaving it in the global lists until we're done with it.
271 cpa takes care of the direct mappings. */
272 read_lock(&vmlist_lock);
273 for (p = vmlist; p; p = p->next) {
274 if (p->addr == addr)
275 break;
276 }
277 read_unlock(&vmlist_lock);
278
279 if (!p) {
263 printk("iounmap: bad address %p\n", addr); 280 printk("iounmap: bad address %p\n", addr);
264 else if (p->flags >> 20) 281 dump_stack();
282 return;
283 }
284
285 /* Reset the direct mapping. Can block */
286 if (p->flags >> 20)
265 ioremap_change_attr(p->phys_addr, p->size, 0); 287 ioremap_change_attr(p->phys_addr, p->size, 0);
266 write_unlock(&vmlist_lock); 288
289 /* Finally remove it */
290 o = remove_vm_area((void *)addr);
291 BUG_ON(p != o || o == NULL);
267 kfree(p); 292 kfree(p);
268} 293}
diff --git a/arch/x86_64/mm/mmap.c b/arch/x86_64/mm/mmap.c
new file mode 100644
index 000000000000..43e9b99bdf25
--- /dev/null
+++ b/arch/x86_64/mm/mmap.c
@@ -0,0 +1,30 @@
1/* Copyright 2005 Andi Kleen, SuSE Labs.
2 * Licensed under GPL, v.2
3 */
4#include <linux/config.h>
5#include <linux/mm.h>
6#include <linux/sched.h>
7#include <linux/random.h>
8#include <asm/ia32.h>
9
10/* Notebook: move the mmap code from sys_x86_64.c over here. */
11
12void arch_pick_mmap_layout(struct mm_struct *mm)
13{
14#ifdef CONFIG_IA32_EMULATION
15 if (current_thread_info()->flags & _TIF_IA32)
16 return ia32_pick_mmap_layout(mm);
17#endif
18 mm->mmap_base = TASK_UNMAPPED_BASE;
19 if (current->flags & PF_RANDOMIZE) {
20 /* Add 28bit randomness which is about 40bits of address space
21 because mmap base has to be page aligned.
22 or ~1/128 of the total user VM
23 (total user address space is 47bits) */
24 unsigned rnd = get_random_int() & 0xfffffff;
25 mm->mmap_base += ((unsigned long)rnd) << PAGE_SHIFT;
26 }
27 mm->get_unmapped_area = arch_get_unmapped_area;
28 mm->unmap_area = arch_unmap_area;
29}
30
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index a828a01739cc..6ef9f9a76235 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -46,13 +46,15 @@ int numa_off __initdata;
46 * 0 if memnodmap[] too small (of shift too small) 46 * 0 if memnodmap[] too small (of shift too small)
47 * -1 if node overlap or lost ram (shift too big) 47 * -1 if node overlap or lost ram (shift too big)
48 */ 48 */
49static int __init populate_memnodemap( 49static int __init
50 const struct node *nodes, int numnodes, int shift) 50populate_memnodemap(const struct node *nodes, int numnodes, int shift)
51{ 51{
52 int i; 52 int i;
53 int res = -1; 53 int res = -1;
54 unsigned long addr, end; 54 unsigned long addr, end;
55 55
56 if (shift >= 64)
57 return -1;
56 memset(memnodemap, 0xff, sizeof(memnodemap)); 58 memset(memnodemap, 0xff, sizeof(memnodemap));
57 for (i = 0; i < numnodes; i++) { 59 for (i = 0; i < numnodes; i++) {
58 addr = nodes[i].start; 60 addr = nodes[i].start;
@@ -65,7 +67,7 @@ static int __init populate_memnodemap(
65 if (memnodemap[addr >> shift] != 0xff) 67 if (memnodemap[addr >> shift] != 0xff)
66 return -1; 68 return -1;
67 memnodemap[addr >> shift] = i; 69 memnodemap[addr >> shift] = i;
68 addr += (1 << shift); 70 addr += (1UL << shift);
69 } while (addr < end); 71 } while (addr < end);
70 res = 1; 72 res = 1;
71 } 73 }
@@ -79,7 +81,7 @@ int __init compute_hash_shift(struct node *nodes, int numnodes)
79 while (populate_memnodemap(nodes, numnodes, shift + 1) >= 0) 81 while (populate_memnodemap(nodes, numnodes, shift + 1) >= 0)
80 shift++; 82 shift++;
81 83
82 printk(KERN_DEBUG "Using %d for the hash shift.\n", 84 printk(KERN_DEBUG "NUMA: Using %d for the hash shift.\n",
83 shift); 85 shift);
84 86
85 if (populate_memnodemap(nodes, numnodes, shift) != 1) { 87 if (populate_memnodemap(nodes, numnodes, shift) != 1) {
@@ -108,7 +110,7 @@ void __init setup_node_bootmem(int nodeid, unsigned long start, unsigned long en
108 110
109 start = round_up(start, ZONE_ALIGN); 111 start = round_up(start, ZONE_ALIGN);
110 112
111 printk("Bootmem setup node %d %016lx-%016lx\n", nodeid, start, end); 113 printk(KERN_INFO "Bootmem setup node %d %016lx-%016lx\n", nodeid, start, end);
112 114
113 start_pfn = start >> PAGE_SHIFT; 115 start_pfn = start >> PAGE_SHIFT;
114 end_pfn = end >> PAGE_SHIFT; 116 end_pfn = end >> PAGE_SHIFT;
@@ -154,7 +156,7 @@ void __init setup_node_zones(int nodeid)
154 start_pfn = node_start_pfn(nodeid); 156 start_pfn = node_start_pfn(nodeid);
155 end_pfn = node_end_pfn(nodeid); 157 end_pfn = node_end_pfn(nodeid);
156 158
157 Dprintk(KERN_INFO "setting up node %d %lx-%lx\n", 159 Dprintk(KERN_INFO "Setting up node %d %lx-%lx\n",
158 nodeid, start_pfn, end_pfn); 160 nodeid, start_pfn, end_pfn);
159 161
160 size_zones(zones, holes, start_pfn, end_pfn); 162 size_zones(zones, holes, start_pfn, end_pfn);
@@ -198,7 +200,7 @@ static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn)
198 while ((x << 1) < sz) 200 while ((x << 1) < sz)
199 x <<= 1; 201 x <<= 1;
200 if (x < sz/2) 202 if (x < sz/2)
201 printk("Numa emulation unbalanced. Complain to maintainer\n"); 203 printk(KERN_ERR "Numa emulation unbalanced. Complain to maintainer\n");
202 sz = x; 204 sz = x;
203 } 205 }
204 206
@@ -270,7 +272,7 @@ __cpuinit void numa_add_cpu(int cpu)
270 272
271void __cpuinit numa_set_node(int cpu, int node) 273void __cpuinit numa_set_node(int cpu, int node)
272{ 274{
273 cpu_pda[cpu].nodenumber = node; 275 cpu_pda(cpu)->nodenumber = node;
274 cpu_to_node[cpu] = node; 276 cpu_to_node[cpu] = node;
275} 277}
276 278
@@ -328,8 +330,69 @@ __init int numa_setup(char *opt)
328 return 1; 330 return 1;
329} 331}
330 332
333/*
334 * Setup early cpu_to_node.
335 *
336 * Populate cpu_to_node[] only if x86_cpu_to_apicid[],
337 * and apicid_to_node[] tables have valid entries for a CPU.
338 * This means we skip cpu_to_node[] initialisation for NUMA
339 * emulation and faking node case (when running a kernel compiled
340 * for NUMA on a non NUMA box), which is OK as cpu_to_node[]
341 * is already initialized in a round robin manner at numa_init_array,
342 * prior to this call, and this initialization is good enough
343 * for the fake NUMA cases.
344 */
345void __init init_cpu_to_node(void)
346{
347 int i;
348 for (i = 0; i < NR_CPUS; i++) {
349 u8 apicid = x86_cpu_to_apicid[i];
350 if (apicid == BAD_APICID)
351 continue;
352 if (apicid_to_node[apicid] == NUMA_NO_NODE)
353 continue;
354 cpu_to_node[i] = apicid_to_node[apicid];
355 }
356}
357
331EXPORT_SYMBOL(cpu_to_node); 358EXPORT_SYMBOL(cpu_to_node);
332EXPORT_SYMBOL(node_to_cpumask); 359EXPORT_SYMBOL(node_to_cpumask);
333EXPORT_SYMBOL(memnode_shift); 360EXPORT_SYMBOL(memnode_shift);
334EXPORT_SYMBOL(memnodemap); 361EXPORT_SYMBOL(memnodemap);
335EXPORT_SYMBOL(node_data); 362EXPORT_SYMBOL(node_data);
363
364#ifdef CONFIG_DISCONTIGMEM
365/*
366 * Functions to convert PFNs from/to per node page addresses.
367 * These are out of line because they are quite big.
368 * They could be all tuned by pre caching more state.
369 * Should do that.
370 */
371
372/* Requires pfn_valid(pfn) to be true */
373struct page *pfn_to_page(unsigned long pfn)
374{
375 int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT);
376 return (pfn - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map;
377}
378EXPORT_SYMBOL(pfn_to_page);
379
380unsigned long page_to_pfn(struct page *page)
381{
382 return (long)(((page) - page_zone(page)->zone_mem_map) +
383 page_zone(page)->zone_start_pfn);
384}
385EXPORT_SYMBOL(page_to_pfn);
386
387int pfn_valid(unsigned long pfn)
388{
389 unsigned nid;
390 if (pfn >= num_physpages)
391 return 0;
392 nid = pfn_to_nid(pfn);
393 if (nid == 0xff)
394 return 0;
395 return pfn >= node_start_pfn(nid) && (pfn) < node_end_pfn(nid);
396}
397EXPORT_SYMBOL(pfn_valid);
398#endif
diff --git a/arch/x86_64/mm/pageattr.c b/arch/x86_64/mm/pageattr.c
index b90e8fe9eeb0..35f1f1aab063 100644
--- a/arch/x86_64/mm/pageattr.c
+++ b/arch/x86_64/mm/pageattr.c
@@ -128,6 +128,7 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot,
128 pte_t *kpte; 128 pte_t *kpte;
129 struct page *kpte_page; 129 struct page *kpte_page;
130 unsigned kpte_flags; 130 unsigned kpte_flags;
131 pgprot_t ref_prot2;
131 kpte = lookup_address(address); 132 kpte = lookup_address(address);
132 if (!kpte) return 0; 133 if (!kpte) return 0;
133 kpte_page = virt_to_page(((unsigned long)kpte) & PAGE_MASK); 134 kpte_page = virt_to_page(((unsigned long)kpte) & PAGE_MASK);
@@ -140,10 +141,14 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot,
140 * split_large_page will take the reference for this change_page_attr 141 * split_large_page will take the reference for this change_page_attr
141 * on the split page. 142 * on the split page.
142 */ 143 */
143 struct page *split = split_large_page(address, prot, ref_prot); 144
145 struct page *split;
146 ref_prot2 = __pgprot(pgprot_val(pte_pgprot(*lookup_address(address))) & ~(1<<_PAGE_BIT_PSE));
147
148 split = split_large_page(address, prot, ref_prot2);
144 if (!split) 149 if (!split)
145 return -ENOMEM; 150 return -ENOMEM;
146 set_pte(kpte,mk_pte(split, ref_prot)); 151 set_pte(kpte,mk_pte(split, ref_prot2));
147 kpte_page = split; 152 kpte_page = split;
148 } 153 }
149 get_page(kpte_page); 154 get_page(kpte_page);
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index 33340bd1e328..8b7f85608fa8 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -17,21 +17,23 @@
17#include <linux/topology.h> 17#include <linux/topology.h>
18#include <asm/proto.h> 18#include <asm/proto.h>
19#include <asm/numa.h> 19#include <asm/numa.h>
20#include <asm/e820.h>
20 21
21static struct acpi_table_slit *acpi_slit; 22static struct acpi_table_slit *acpi_slit;
22 23
23static nodemask_t nodes_parsed __initdata; 24static nodemask_t nodes_parsed __initdata;
24static nodemask_t nodes_found __initdata; 25static nodemask_t nodes_found __initdata;
25static struct node nodes[MAX_NUMNODES] __initdata; 26static struct node nodes[MAX_NUMNODES] __initdata;
26static __u8 pxm2node[256] = { [0 ... 255] = 0xff }; 27static u8 pxm2node[256] = { [0 ... 255] = 0xff };
27 28
28static int node_to_pxm(int n); 29static int node_to_pxm(int n);
29 30
30int pxm_to_node(int pxm) 31int pxm_to_node(int pxm)
31{ 32{
32 if ((unsigned)pxm >= 256) 33 if ((unsigned)pxm >= 256)
33 return 0; 34 return -1;
34 return pxm2node[pxm]; 35 /* Extend 0xff to (int)-1 */
36 return (signed char)pxm2node[pxm];
35} 37}
36 38
37static __init int setup_node(int pxm) 39static __init int setup_node(int pxm)
@@ -91,9 +93,36 @@ static __init inline int srat_disabled(void)
91 return numa_off || acpi_numa < 0; 93 return numa_off || acpi_numa < 0;
92} 94}
93 95
96/*
97 * A lot of BIOS fill in 10 (= no distance) everywhere. This messes
98 * up the NUMA heuristics which wants the local node to have a smaller
99 * distance than the others.
100 * Do some quick checks here and only use the SLIT if it passes.
101 */
102static __init int slit_valid(struct acpi_table_slit *slit)
103{
104 int i, j;
105 int d = slit->localities;
106 for (i = 0; i < d; i++) {
107 for (j = 0; j < d; j++) {
108 u8 val = slit->entry[d*i + j];
109 if (i == j) {
110 if (val != 10)
111 return 0;
112 } else if (val <= 10)
113 return 0;
114 }
115 }
116 return 1;
117}
118
94/* Callback for SLIT parsing */ 119/* Callback for SLIT parsing */
95void __init acpi_numa_slit_init(struct acpi_table_slit *slit) 120void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
96{ 121{
122 if (!slit_valid(slit)) {
123 printk(KERN_INFO "ACPI: SLIT table looks invalid. Not used.\n");
124 return;
125 }
97 acpi_slit = slit; 126 acpi_slit = slit;
98} 127}
99 128
@@ -168,12 +197,39 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
168 nd->start, nd->end); 197 nd->start, nd->end);
169} 198}
170 199
200/* Sanity check to catch more bad SRATs (they are amazingly common).
201 Make sure the PXMs cover all memory. */
202static int nodes_cover_memory(void)
203{
204 int i;
205 unsigned long pxmram, e820ram;
206
207 pxmram = 0;
208 for_each_node_mask(i, nodes_parsed) {
209 unsigned long s = nodes[i].start >> PAGE_SHIFT;
210 unsigned long e = nodes[i].end >> PAGE_SHIFT;
211 pxmram += e - s;
212 pxmram -= e820_hole_size(s, e);
213 }
214
215 e820ram = end_pfn - e820_hole_size(0, end_pfn);
216 if (pxmram < e820ram) {
217 printk(KERN_ERR
218 "SRAT: PXMs only cover %luMB of your %luMB e820 RAM. Not used.\n",
219 (pxmram << PAGE_SHIFT) >> 20,
220 (e820ram << PAGE_SHIFT) >> 20);
221 return 0;
222 }
223 return 1;
224}
225
171void __init acpi_numa_arch_fixup(void) {} 226void __init acpi_numa_arch_fixup(void) {}
172 227
173/* Use the information discovered above to actually set up the nodes. */ 228/* Use the information discovered above to actually set up the nodes. */
174int __init acpi_scan_nodes(unsigned long start, unsigned long end) 229int __init acpi_scan_nodes(unsigned long start, unsigned long end)
175{ 230{
176 int i; 231 int i;
232
177 if (acpi_numa <= 0) 233 if (acpi_numa <= 0)
178 return -1; 234 return -1;
179 235
@@ -184,6 +240,11 @@ int __init acpi_scan_nodes(unsigned long start, unsigned long end)
184 node_clear(i, nodes_parsed); 240 node_clear(i, nodes_parsed);
185 } 241 }
186 242
243 if (!nodes_cover_memory()) {
244 bad_srat();
245 return -1;
246 }
247
187 memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed)); 248 memnode_shift = compute_hash_shift(nodes, nodes_weight(nodes_parsed));
188 if (memnode_shift < 0) { 249 if (memnode_shift < 0) {
189 printk(KERN_ERR 250 printk(KERN_ERR
diff --git a/arch/x86_64/pci/Makefile b/arch/x86_64/pci/Makefile
index bb34e5ef916c..a8f75a2a0f6f 100644
--- a/arch/x86_64/pci/Makefile
+++ b/arch/x86_64/pci/Makefile
@@ -11,7 +11,7 @@ obj-y += fixup.o
11obj-$(CONFIG_ACPI) += acpi.o 11obj-$(CONFIG_ACPI) += acpi.o
12obj-y += legacy.o irq.o common.o 12obj-y += legacy.o irq.o common.o
13# mmconfig has a 64bit special 13# mmconfig has a 64bit special
14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o 14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o direct.o
15 15
16obj-$(CONFIG_NUMA) += k8-bus.o 16obj-$(CONFIG_NUMA) += k8-bus.o
17 17
diff --git a/arch/x86_64/pci/Makefile-BUS b/arch/x86_64/pci/Makefile-BUS
deleted file mode 100644
index 4f0c05abd408..000000000000
--- a/arch/x86_64/pci/Makefile-BUS
+++ /dev/null
@@ -1,22 +0,0 @@
1#
2# Makefile for X86_64 specific PCI routines
3#
4# Reuse the i386 PCI subsystem
5#
6CFLAGS += -I arch/i386/pci
7
8obj-y := i386.o
9obj-$(CONFIG_PCI_DIRECT)+= direct.o
10obj-y += fixup.o
11obj-$(CONFIG_ACPI) += acpi.o
12obj-y += legacy.o irq.o common.o
13# mmconfig has a 64bit special
14obj-$(CONFIG_PCI_MMCONFIG) += mmconfig.o
15
16direct-y += ../../i386/pci/direct.o
17acpi-y += ../../i386/pci/acpi.o
18legacy-y += ../../i386/pci/legacy.o
19irq-y += ../../i386/pci/irq.o
20common-y += ../../i386/pci/common.o
21fixup-y += ../../i386/pci/fixup.o
22i386-y += ../../i386/pci/i386.o
diff --git a/arch/x86_64/pci/mmconfig.c b/arch/x86_64/pci/mmconfig.c
index a0838c4a94e4..f16c0d57c552 100644
--- a/arch/x86_64/pci/mmconfig.c
+++ b/arch/x86_64/pci/mmconfig.c
@@ -8,18 +8,21 @@
8#include <linux/pci.h> 8#include <linux/pci.h>
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/acpi.h> 10#include <linux/acpi.h>
11#include <linux/bitmap.h>
11#include "pci.h" 12#include "pci.h"
12 13
13#define MMCONFIG_APER_SIZE (256*1024*1024) 14#define MMCONFIG_APER_SIZE (256*1024*1024)
14 15
16static DECLARE_BITMAP(fallback_slots, 32);
17
15/* Static virtual mapping of the MMCONFIG aperture */ 18/* Static virtual mapping of the MMCONFIG aperture */
16struct mmcfg_virt { 19struct mmcfg_virt {
17 struct acpi_table_mcfg_config *cfg; 20 struct acpi_table_mcfg_config *cfg;
18 char *virt; 21 char __iomem *virt;
19}; 22};
20static struct mmcfg_virt *pci_mmcfg_virt; 23static struct mmcfg_virt *pci_mmcfg_virt;
21 24
22static char *get_virt(unsigned int seg, int bus) 25static char __iomem *get_virt(unsigned int seg, unsigned bus)
23{ 26{
24 int cfg_num = -1; 27 int cfg_num = -1;
25 struct acpi_table_mcfg_config *cfg; 28 struct acpi_table_mcfg_config *cfg;
@@ -27,10 +30,9 @@ static char *get_virt(unsigned int seg, int bus)
27 while (1) { 30 while (1) {
28 ++cfg_num; 31 ++cfg_num;
29 if (cfg_num >= pci_mmcfg_config_num) { 32 if (cfg_num >= pci_mmcfg_config_num) {
30 /* something bad is going on, no cfg table is found. */ 33 /* Not found - fall back to type 1. This happens
31 /* so we fall back to the old way we used to do this */ 34 e.g. on the internal devices of a K8 northbridge. */
32 /* and just rely on the first entry to be correct. */ 35 return NULL;
33 return pci_mmcfg_virt[0].virt;
34 } 36 }
35 cfg = pci_mmcfg_virt[cfg_num].cfg; 37 cfg = pci_mmcfg_virt[cfg_num].cfg;
36 if (cfg->pci_segment_group_number != seg) 38 if (cfg->pci_segment_group_number != seg)
@@ -41,20 +43,30 @@ static char *get_virt(unsigned int seg, int bus)
41 } 43 }
42} 44}
43 45
44static inline char *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn) 46static char __iomem *pci_dev_base(unsigned int seg, unsigned int bus, unsigned int devfn)
45{ 47{
46 48 char __iomem *addr;
47 return get_virt(seg, bus) + ((bus << 20) | (devfn << 12)); 49 if (seg == 0 && bus == 0 && test_bit(PCI_SLOT(devfn), &fallback_slots))
50 return NULL;
51 addr = get_virt(seg, bus);
52 if (!addr)
53 return NULL;
54 return addr + ((bus << 20) | (devfn << 12));
48} 55}
49 56
50static int pci_mmcfg_read(unsigned int seg, unsigned int bus, 57static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
51 unsigned int devfn, int reg, int len, u32 *value) 58 unsigned int devfn, int reg, int len, u32 *value)
52{ 59{
53 char *addr = pci_dev_base(seg, bus, devfn); 60 char __iomem *addr;
54 61
62 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */
55 if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095))) 63 if (unlikely(!value || (bus > 255) || (devfn > 255) || (reg > 4095)))
56 return -EINVAL; 64 return -EINVAL;
57 65
66 addr = pci_dev_base(seg, bus, devfn);
67 if (!addr)
68 return pci_conf1_read(seg,bus,devfn,reg,len,value);
69
58 switch (len) { 70 switch (len) {
59 case 1: 71 case 1:
60 *value = readb(addr + reg); 72 *value = readb(addr + reg);
@@ -73,11 +85,16 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
73static int pci_mmcfg_write(unsigned int seg, unsigned int bus, 85static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
74 unsigned int devfn, int reg, int len, u32 value) 86 unsigned int devfn, int reg, int len, u32 value)
75{ 87{
76 char *addr = pci_dev_base(seg, bus, devfn); 88 char __iomem *addr;
77 89
90 /* Why do we have this when nobody checks it. How about a BUG()!? -AK */
78 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095))) 91 if (unlikely((bus > 255) || (devfn > 255) || (reg > 4095)))
79 return -EINVAL; 92 return -EINVAL;
80 93
94 addr = pci_dev_base(seg, bus, devfn);
95 if (!addr)
96 return pci_conf1_write(seg,bus,devfn,reg,len,value);
97
81 switch (len) { 98 switch (len) {
82 case 1: 99 case 1:
83 writeb(value, addr + reg); 100 writeb(value, addr + reg);
@@ -98,6 +115,30 @@ static struct pci_raw_ops pci_mmcfg = {
98 .write = pci_mmcfg_write, 115 .write = pci_mmcfg_write,
99}; 116};
100 117
118/* K8 systems have some devices (typically in the builtin northbridge)
119 that are only accessible using type1
120 Normally this can be expressed in the MCFG by not listing them
121 and assigning suitable _SEGs, but this isn't implemented in some BIOS.
122 Instead try to discover all devices on bus 0 that are unreachable using MM
123 and fallback for them.
124 We only do this for bus 0/seg 0 */
125static __init void unreachable_devices(void)
126{
127 int i;
128 for (i = 0; i < 32; i++) {
129 u32 val1;
130 char __iomem *addr;
131
132 pci_conf1_read(0, 0, PCI_DEVFN(i,0), 0, 4, &val1);
133 if (val1 == 0xffffffff)
134 continue;
135 addr = pci_dev_base(0, 0, PCI_DEVFN(i, 0));
136 if (addr == NULL|| readl(addr) != val1) {
137 set_bit(i, &fallback_slots);
138 }
139 }
140}
141
101static int __init pci_mmcfg_init(void) 142static int __init pci_mmcfg_init(void)
102{ 143{
103 int i; 144 int i;
@@ -128,6 +169,8 @@ static int __init pci_mmcfg_init(void)
128 printk(KERN_INFO "PCI: Using MMCONFIG at %x\n", pci_mmcfg_config[i].base_address); 169 printk(KERN_INFO "PCI: Using MMCONFIG at %x\n", pci_mmcfg_config[i].base_address);
129 } 170 }
130 171
172 unreachable_devices();
173
131 raw_pci_ops = &pci_mmcfg; 174 raw_pci_ops = &pci_mmcfg;
132 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF; 175 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
133 176
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index 7e841aa2a4aa..7ee4a14ec3b1 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -18,10 +18,6 @@ config XTENSA
18 with reasonable minimum requirements. The Xtensa Linux project has 18 with reasonable minimum requirements. The Xtensa Linux project has
19 a home page at <http://xtensa.sourceforge.net/>. 19 a home page at <http://xtensa.sourceforge.net/>.
20 20
21config UID16
22 bool
23 default n
24
25config RWSEM_XCHGADD_ALGORITHM 21config RWSEM_XCHGADD_ALGORITHM
26 bool 22 bool
27 default y 23 default y
diff --git a/arch/xtensa/kernel/process.c b/arch/xtensa/kernel/process.c
index 6a44b54ae817..f1f596644bfc 100644
--- a/arch/xtensa/kernel/process.c
+++ b/arch/xtensa/kernel/process.c
@@ -145,7 +145,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
145 int user_mode = user_mode(regs); 145 int user_mode = user_mode(regs);
146 146
147 /* Set up new TSS. */ 147 /* Set up new TSS. */
148 tos = (unsigned long)p->thread_info + THREAD_SIZE; 148 tos = (unsigned long)task_stack_page(p) + THREAD_SIZE;
149 if (user_mode) 149 if (user_mode)
150 childregs = (struct pt_regs*)(tos - PT_USER_SIZE); 150 childregs = (struct pt_regs*)(tos - PT_USER_SIZE);
151 else 151 else
@@ -217,7 +217,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
217unsigned long get_wchan(struct task_struct *p) 217unsigned long get_wchan(struct task_struct *p)
218{ 218{
219 unsigned long sp, pc; 219 unsigned long sp, pc;
220 unsigned long stack_page = (unsigned long) p->thread_info; 220 unsigned long stack_page = (unsigned long) task_stack_page(p);
221 int count = 0; 221 int count = 0;
222 222
223 if (!p || p == current || p->state == TASK_RUNNING) 223 if (!p || p == current || p->state == TASK_RUNNING)
diff --git a/arch/xtensa/kernel/ptrace.c b/arch/xtensa/kernel/ptrace.c
index ab5c4c65b5c4..4cc85285a70a 100644
--- a/arch/xtensa/kernel/ptrace.c
+++ b/arch/xtensa/kernel/ptrace.c
@@ -72,7 +72,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
72 struct pt_regs *regs; 72 struct pt_regs *regs;
73 unsigned long tmp; 73 unsigned long tmp;
74 74
75 regs = xtensa_pt_regs(child); 75 regs = task_pt_regs(child);
76 tmp = 0; /* Default return value. */ 76 tmp = 0; /* Default return value. */
77 77
78 switch(addr) { 78 switch(addr) {
@@ -149,7 +149,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
149 case PTRACE_POKEUSR: 149 case PTRACE_POKEUSR:
150 { 150 {
151 struct pt_regs *regs; 151 struct pt_regs *regs;
152 regs = xtensa_pt_regs(child); 152 regs = task_pt_regs(child);
153 153
154 switch (addr) { 154 switch (addr) {
155 case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1: 155 case REG_AR_BASE ... REG_AR_BASE + XCHAL_NUM_AREGS - 1:
@@ -240,7 +240,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
240 * elf_gregset_t format. */ 240 * elf_gregset_t format. */
241 241
242 xtensa_gregset_t format; 242 xtensa_gregset_t format;
243 struct pt_regs *regs = xtensa_pt_regs(child); 243 struct pt_regs *regs = task_pt_regs(child);
244 244
245 do_copy_regs (&format, regs, child); 245 do_copy_regs (&format, regs, child);
246 246
@@ -257,7 +257,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
257 * values in the elf_gregset_t format. */ 257 * values in the elf_gregset_t format. */
258 258
259 xtensa_gregset_t format; 259 xtensa_gregset_t format;
260 struct pt_regs *regs = xtensa_pt_regs(child); 260 struct pt_regs *regs = task_pt_regs(child);
261 261
262 if (copy_from_user(&format,(void *)data,sizeof(elf_gregset_t))){ 262 if (copy_from_user(&format,(void *)data,sizeof(elf_gregset_t))){
263 ret = -EFAULT; 263 ret = -EFAULT;
@@ -281,7 +281,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
281 * elf_fpregset_t format. */ 281 * elf_fpregset_t format. */
282 282
283 elf_fpregset_t fpregs; 283 elf_fpregset_t fpregs;
284 struct pt_regs *regs = xtensa_pt_regs(child); 284 struct pt_regs *regs = task_pt_regs(child);
285 285
286 do_save_fpregs (&fpregs, regs, child); 286 do_save_fpregs (&fpregs, regs, child);
287 287
@@ -299,7 +299,7 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
299 * values in the elf_fpregset_t format. 299 * values in the elf_fpregset_t format.
300 */ 300 */
301 elf_fpregset_t fpregs; 301 elf_fpregset_t fpregs;
302 struct pt_regs *regs = xtensa_pt_regs(child); 302 struct pt_regs *regs = task_pt_regs(child);
303 303
304 ret = 0; 304 ret = 0;
305 if (copy_from_user(&fpregs, (void *)data, sizeof(elf_fpregset_t))) { 305 if (copy_from_user(&fpregs, (void *)data, sizeof(elf_fpregset_t))) {
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index cb6e38ed2b1d..937d81f62f43 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -201,7 +201,7 @@ again:
201 if ((signed long)(get_ccount() - next) > 0) 201 if ((signed long)(get_ccount() - next) > 0)
202 goto again; 202 goto again;
203 203
204 /* Allow platform to do something usefull (Wdog). */ 204 /* Allow platform to do something useful (Wdog). */
205 205
206 platform_heartbeat(); 206 platform_heartbeat();
207 207