aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/setup.c14
-rw-r--r--arch/alpha/kernel/time.c3
-rw-r--r--arch/alpha/mm/numa.c4
-rw-r--r--arch/arm/Kconfig14
-rw-r--r--arch/arm/Makefile2
-rw-r--r--arch/arm/boot/compressed/Makefile4
-rw-r--r--arch/arm/boot/compressed/ice-dcc.S17
-rw-r--r--arch/arm/boot/compressed/misc.c41
-rw-r--r--arch/arm/common/rtctime.c108
-rw-r--r--arch/arm/configs/ixp23xx_defconfig1302
-rw-r--r--arch/arm/lib/Makefile2
-rw-r--r--arch/arm/lib/copy_template.S2
-rw-r--r--arch/arm/mach-ep93xx/core.c68
-rw-r--r--arch/arm/mach-footbridge/time.c17
-rw-r--r--arch/arm/mach-integrator/core.c46
-rw-r--r--arch/arm/mach-integrator/time.c16
-rw-r--r--arch/arm/mach-ixp23xx/Kconfig25
-rw-r--r--arch/arm/mach-ixp23xx/Makefile11
-rw-r--r--arch/arm/mach-ixp23xx/Makefile.boot2
-rw-r--r--arch/arm/mach-ixp23xx/core.c431
-rw-r--r--arch/arm/mach-ixp23xx/espresso.c69
-rw-r--r--arch/arm/mach-ixp23xx/ixdp2351.c325
-rw-r--r--arch/arm/mach-ixp23xx/pci.c275
-rw-r--r--arch/arm/mach-ixp23xx/roadrunner.c164
-rw-r--r--arch/arm/mach-omap1/board-netstar.c2
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c2
-rw-r--r--arch/arm/mach-pxa/Kconfig5
-rw-r--r--arch/arm/mach-pxa/Makefile1
-rw-r--r--arch/arm/mach-pxa/generic.c6
-rw-r--r--arch/arm/mach-pxa/lpd270.c393
-rw-r--r--arch/arm/mach-pxa/spitz.c2
-rw-r--r--arch/arm/mach-sa1100/Kconfig2
-rw-r--r--arch/arm/mach-sa1100/cpu-sa1100.c2
-rw-r--r--arch/arm/mach-sa1100/generic.c6
-rw-r--r--arch/arm/mm/Kconfig19
-rw-r--r--arch/arm/mm/Makefile2
-rw-r--r--arch/arm/mm/copypage-xsc3.S97
-rw-r--r--arch/arm/mm/mm-armv.c3
-rw-r--r--arch/arm/mm/proc-v6.S16
-rw-r--r--arch/arm/mm/proc-xsc3.S498
-rw-r--r--arch/arm26/mm/init.c7
-rw-r--r--arch/cris/kernel/setup.c5
-rw-r--r--arch/i386/Kconfig9
-rw-r--r--arch/i386/boot/video.S2
-rw-r--r--arch/i386/kernel/cpu/common.c10
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.c7
-rw-r--r--arch/i386/kernel/cpu/cpufreq/powernow-k8.h4
-rw-r--r--arch/i386/kernel/cpu/intel_cacheinfo.c77
-rw-r--r--arch/i386/kernel/io_apic.c4
-rw-r--r--arch/i386/kernel/microcode.c17
-rw-r--r--arch/i386/kernel/nmi.c9
-rw-r--r--arch/i386/kernel/setup.c1
-rw-r--r--arch/i386/kernel/smpboot.c24
-rw-r--r--arch/i386/kernel/syscall_table.S3
-rw-r--r--arch/i386/kernel/timers/timer_pm.c104
-rw-r--r--arch/i386/kernel/traps.c17
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c2
-rw-r--r--arch/i386/mm/discontig.c12
-rw-r--r--arch/i386/mm/pgtable.c2
-rw-r--r--arch/i386/oprofile/nmi_int.c2
-rw-r--r--arch/ia64/kernel/entry.S1
-rw-r--r--arch/ia64/kernel/traps.c6
-rw-r--r--arch/ia64/mm/discontig.c33
-rw-r--r--arch/ia64/mm/init.c2
-rw-r--r--arch/ia64/sn/kernel/sn2/sn_proc_fs.c39
-rw-r--r--arch/m32r/kernel/setup.c1
-rw-r--r--arch/m32r/mm/discontig.c7
-rw-r--r--arch/m32r/mm/init.c3
-rw-r--r--arch/m68k/mvme16x/rtc.c4
-rw-r--r--arch/mips/au1000/common/setup.c2
-rw-r--r--arch/mips/ddb5xxx/common/rtc_ds1386.c4
-rw-r--r--arch/mips/dec/time.c51
-rw-r--r--arch/mips/ite-boards/generic/time.c4
-rw-r--r--arch/mips/ite-boards/ivr/init.c3
-rw-r--r--arch/mips/ite-boards/qed-4n-s01b/init.c3
-rw-r--r--arch/mips/jmr3927/common/rtc_ds1742.c4
-rw-r--r--arch/mips/kernel/irixsig.c4
-rw-r--r--arch/mips/kernel/setup.c9
-rw-r--r--arch/mips/kernel/time.c22
-rw-r--r--arch/mips/lasat/setup.c7
-rw-r--r--arch/mips/mips-boards/atlas/atlas_setup.c2
-rw-r--r--arch/mips/mips-boards/generic/memory.c7
-rw-r--r--arch/mips/mips-boards/malta/malta_setup.c2
-rw-r--r--arch/mips/mips-boards/sim/sim_mem.c7
-rw-r--r--arch/mips/mm/init.c4
-rw-r--r--arch/mips/momentum/jaguar_atx/setup.c4
-rw-r--r--arch/mips/momentum/ocelot_3/setup.c38
-rw-r--r--arch/mips/momentum/ocelot_c/setup.c4
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c4
-rw-r--r--arch/mips/sgi-ip22/ip22-reset.c2
-rw-r--r--arch/mips/sgi-ip22/ip22-time.c4
-rw-r--r--arch/mips/sgi-ip27/ip27-memory.c3
-rw-r--r--arch/mips/sgi-ip32/ip32-reset.c2
-rw-r--r--arch/mips/sgi-ip32/ip32-setup.c4
-rw-r--r--arch/mips/sibyte/swarm/setup.c8
-rw-r--r--arch/mips/sni/setup.c4
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c4
-rw-r--r--arch/mips/tx4938/common/rtc_rx5c348.c16
-rw-r--r--arch/parisc/kernel/pdc_chassis.c3
-rw-r--r--arch/powerpc/Kconfig4
-rw-r--r--arch/powerpc/Kconfig.debug5
-rw-r--r--arch/powerpc/Makefile7
-rw-r--r--arch/powerpc/configs/cell_defconfig133
-rw-r--r--arch/powerpc/configs/mpc8540_ads_defconfig43
-rw-r--r--arch/powerpc/kernel/Makefile11
-rw-r--r--arch/powerpc/kernel/asm-offsets.c2
-rw-r--r--arch/powerpc/kernel/cpu_setup_6xx.S (renamed from arch/ppc/kernel/cpu_setup_6xx.S)0
-rw-r--r--arch/powerpc/kernel/entry_32.S8
-rw-r--r--arch/powerpc/kernel/entry_64.S6
-rw-r--r--arch/powerpc/kernel/firmware.c4
-rw-r--r--arch/powerpc/kernel/head_64.S32
-rw-r--r--arch/powerpc/kernel/idle.c (renamed from arch/powerpc/kernel/idle_64.c)79
-rw-r--r--arch/powerpc/kernel/idle_6xx.S18
-rw-r--r--arch/powerpc/kernel/idle_power4.S38
-rw-r--r--arch/powerpc/kernel/irq.c2
-rw-r--r--arch/powerpc/kernel/l2cr_6xx.S (renamed from arch/ppc/kernel/l2cr.S)0
-rw-r--r--arch/powerpc/kernel/legacy_serial.c42
-rw-r--r--arch/powerpc/kernel/lparcfg.c4
-rw-r--r--arch/powerpc/kernel/module_32.c (renamed from arch/ppc/kernel/module.c)0
-rw-r--r--arch/powerpc/kernel/nvram_64.c7
-rw-r--r--arch/powerpc/kernel/paca.c21
-rw-r--r--arch/powerpc/kernel/pci_32.c4
-rw-r--r--arch/powerpc/kernel/pci_64.c1
-rw-r--r--arch/powerpc/kernel/perfmon_fsl_booke.c (renamed from arch/ppc/kernel/perfmon_fsl_booke.c)0
-rw-r--r--arch/powerpc/kernel/proc_ppc64.c3
-rw-r--r--arch/powerpc/kernel/process.c11
-rw-r--r--arch/powerpc/kernel/prom.c154
-rw-r--r--arch/powerpc/kernel/prom_init.c68
-rw-r--r--arch/powerpc/kernel/rtas-proc.c2
-rw-r--r--arch/powerpc/kernel/rtas.c8
-rw-r--r--arch/powerpc/kernel/setup-common.c70
-rw-r--r--arch/powerpc/kernel/setup_32.c75
-rw-r--r--arch/powerpc/kernel/setup_64.c81
-rw-r--r--arch/powerpc/kernel/signal_32.c1
-rw-r--r--arch/powerpc/kernel/signal_64.c3
-rw-r--r--arch/powerpc/kernel/smp.c2
-rw-r--r--arch/powerpc/kernel/swsusp_32.S (renamed from arch/ppc/kernel/swsusp.S)0
-rw-r--r--arch/powerpc/kernel/syscalls.c1
-rw-r--r--arch/powerpc/kernel/sysfs.c12
-rw-r--r--arch/powerpc/kernel/tau_6xx.c (renamed from arch/ppc/kernel/temp.c)0
-rw-r--r--arch/powerpc/kernel/time.c4
-rw-r--r--arch/powerpc/kernel/traps.c51
-rw-r--r--arch/powerpc/kernel/vdso.c9
-rw-r--r--arch/powerpc/kernel/vmlinux.lds.S381
-rw-r--r--arch/powerpc/lib/sstep.c2
-rw-r--r--arch/powerpc/math-emu/Makefile (renamed from arch/ppc/math-emu/Makefile)0
-rw-r--r--arch/powerpc/math-emu/double.h (renamed from arch/ppc/math-emu/double.h)0
-rw-r--r--arch/powerpc/math-emu/fabs.c (renamed from arch/ppc/math-emu/fabs.c)0
-rw-r--r--arch/powerpc/math-emu/fadd.c (renamed from arch/ppc/math-emu/fadd.c)0
-rw-r--r--arch/powerpc/math-emu/fadds.c (renamed from arch/ppc/math-emu/fadds.c)0
-rw-r--r--arch/powerpc/math-emu/fcmpo.c (renamed from arch/ppc/math-emu/fcmpo.c)0
-rw-r--r--arch/powerpc/math-emu/fcmpu.c (renamed from arch/ppc/math-emu/fcmpu.c)0
-rw-r--r--arch/powerpc/math-emu/fctiw.c (renamed from arch/ppc/math-emu/fctiw.c)0
-rw-r--r--arch/powerpc/math-emu/fctiwz.c (renamed from arch/ppc/math-emu/fctiwz.c)0
-rw-r--r--arch/powerpc/math-emu/fdiv.c (renamed from arch/ppc/math-emu/fdiv.c)0
-rw-r--r--arch/powerpc/math-emu/fdivs.c (renamed from arch/ppc/math-emu/fdivs.c)0
-rw-r--r--arch/powerpc/math-emu/fmadd.c (renamed from arch/ppc/math-emu/fmadd.c)0
-rw-r--r--arch/powerpc/math-emu/fmadds.c (renamed from arch/ppc/math-emu/fmadds.c)0
-rw-r--r--arch/powerpc/math-emu/fmr.c (renamed from arch/ppc/math-emu/fmr.c)0
-rw-r--r--arch/powerpc/math-emu/fmsub.c (renamed from arch/ppc/math-emu/fmsub.c)0
-rw-r--r--arch/powerpc/math-emu/fmsubs.c (renamed from arch/ppc/math-emu/fmsubs.c)0
-rw-r--r--arch/powerpc/math-emu/fmul.c (renamed from arch/ppc/math-emu/fmul.c)0
-rw-r--r--arch/powerpc/math-emu/fmuls.c (renamed from arch/ppc/math-emu/fmuls.c)0
-rw-r--r--arch/powerpc/math-emu/fnabs.c (renamed from arch/ppc/math-emu/fnabs.c)0
-rw-r--r--arch/powerpc/math-emu/fneg.c (renamed from arch/ppc/math-emu/fneg.c)0
-rw-r--r--arch/powerpc/math-emu/fnmadd.c (renamed from arch/ppc/math-emu/fnmadd.c)0
-rw-r--r--arch/powerpc/math-emu/fnmadds.c (renamed from arch/ppc/math-emu/fnmadds.c)0
-rw-r--r--arch/powerpc/math-emu/fnmsub.c (renamed from arch/ppc/math-emu/fnmsub.c)0
-rw-r--r--arch/powerpc/math-emu/fnmsubs.c (renamed from arch/ppc/math-emu/fnmsubs.c)0
-rw-r--r--arch/powerpc/math-emu/fres.c (renamed from arch/ppc/math-emu/fres.c)0
-rw-r--r--arch/powerpc/math-emu/frsp.c (renamed from arch/ppc/math-emu/frsp.c)0
-rw-r--r--arch/powerpc/math-emu/frsqrte.c (renamed from arch/ppc/math-emu/frsqrte.c)0
-rw-r--r--arch/powerpc/math-emu/fsel.c (renamed from arch/ppc/math-emu/fsel.c)0
-rw-r--r--arch/powerpc/math-emu/fsqrt.c (renamed from arch/ppc/math-emu/fsqrt.c)0
-rw-r--r--arch/powerpc/math-emu/fsqrts.c (renamed from arch/ppc/math-emu/fsqrts.c)0
-rw-r--r--arch/powerpc/math-emu/fsub.c (renamed from arch/ppc/math-emu/fsub.c)0
-rw-r--r--arch/powerpc/math-emu/fsubs.c (renamed from arch/ppc/math-emu/fsubs.c)0
-rw-r--r--arch/powerpc/math-emu/lfd.c (renamed from arch/ppc/math-emu/lfd.c)0
-rw-r--r--arch/powerpc/math-emu/lfs.c (renamed from arch/ppc/math-emu/lfs.c)0
-rw-r--r--arch/powerpc/math-emu/math.c (renamed from arch/ppc/math-emu/math.c)0
-rw-r--r--arch/powerpc/math-emu/mcrfs.c (renamed from arch/ppc/math-emu/mcrfs.c)0
-rw-r--r--arch/powerpc/math-emu/mffs.c (renamed from arch/ppc/math-emu/mffs.c)0
-rw-r--r--arch/powerpc/math-emu/mtfsb0.c (renamed from arch/ppc/math-emu/mtfsb0.c)0
-rw-r--r--arch/powerpc/math-emu/mtfsb1.c (renamed from arch/ppc/math-emu/mtfsb1.c)0
-rw-r--r--arch/powerpc/math-emu/mtfsf.c (renamed from arch/ppc/math-emu/mtfsf.c)0
-rw-r--r--arch/powerpc/math-emu/mtfsfi.c (renamed from arch/ppc/math-emu/mtfsfi.c)0
-rw-r--r--arch/powerpc/math-emu/op-1.h (renamed from arch/ppc/math-emu/op-1.h)0
-rw-r--r--arch/powerpc/math-emu/op-2.h (renamed from arch/ppc/math-emu/op-2.h)0
-rw-r--r--arch/powerpc/math-emu/op-4.h (renamed from arch/ppc/math-emu/op-4.h)0
-rw-r--r--arch/powerpc/math-emu/op-common.h (renamed from arch/ppc/math-emu/op-common.h)0
-rw-r--r--arch/powerpc/math-emu/sfp-machine.h (renamed from arch/ppc/math-emu/sfp-machine.h)0
-rw-r--r--arch/powerpc/math-emu/single.h (renamed from arch/ppc/math-emu/single.h)0
-rw-r--r--arch/powerpc/math-emu/soft-fp.h (renamed from arch/ppc/math-emu/soft-fp.h)0
-rw-r--r--arch/powerpc/math-emu/stfd.c (renamed from arch/ppc/math-emu/stfd.c)0
-rw-r--r--arch/powerpc/math-emu/stfiwx.c (renamed from arch/ppc/math-emu/stfiwx.c)0
-rw-r--r--arch/powerpc/math-emu/stfs.c (renamed from arch/ppc/math-emu/stfs.c)0
-rw-r--r--arch/powerpc/math-emu/types.c (renamed from arch/ppc/math-emu/types.c)0
-rw-r--r--arch/powerpc/math-emu/udivmodti4.c (renamed from arch/ppc/math-emu/udivmodti4.c)0
-rw-r--r--arch/powerpc/mm/fault.c30
-rw-r--r--arch/powerpc/mm/hash_utils_64.c7
-rw-r--r--arch/powerpc/mm/mem.c6
-rw-r--r--arch/powerpc/mm/numa.c2
-rw-r--r--arch/powerpc/mm/pgtable_32.c6
-rw-r--r--arch/powerpc/mm/stab.c2
-rw-r--r--arch/powerpc/oprofile/Makefile2
-rw-r--r--arch/powerpc/oprofile/backtrace.c126
-rw-r--r--arch/powerpc/oprofile/common.c9
-rw-r--r--arch/powerpc/oprofile/op_model_7450.c4
-rw-r--r--arch/powerpc/oprofile/op_model_fsl_booke.c4
-rw-r--r--arch/powerpc/oprofile/op_model_power4.c45
-rw-r--r--arch/powerpc/oprofile/op_model_rs64.c5
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig1
-rw-r--r--arch/powerpc/platforms/cell/Kconfig5
-rw-r--r--arch/powerpc/platforms/cell/Makefile10
-rw-r--r--arch/powerpc/platforms/cell/interrupt.c133
-rw-r--r--arch/powerpc/platforms/cell/interrupt.h2
-rw-r--r--arch/powerpc/platforms/cell/iommu.c16
-rw-r--r--arch/powerpc/platforms/cell/pervasive.c4
-rw-r--r--arch/powerpc/platforms/cell/setup.c11
-rw-r--r--arch/powerpc/platforms/cell/spider-pic.c108
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c17
-rw-r--r--arch/powerpc/platforms/cell/spu_callbacks.c345
-rw-r--r--arch/powerpc/platforms/cell/spufs/backing_ops.c47
-rw-r--r--arch/powerpc/platforms/cell/spufs/context.c24
-rw-r--r--arch/powerpc/platforms/cell/spufs/file.c523
-rw-r--r--arch/powerpc/platforms/cell/spufs/hw_ops.c57
-rw-r--r--arch/powerpc/platforms/cell/spufs/inode.c8
-rw-r--r--arch/powerpc/platforms/cell/spufs/run.c91
-rw-r--r--arch/powerpc/platforms/cell/spufs/sched.c2
-rw-r--r--arch/powerpc/platforms/cell/spufs/spufs.h28
-rw-r--r--arch/powerpc/platforms/cell/spufs/switch.c3
-rw-r--r--arch/powerpc/platforms/chrp/chrp.h2
-rw-r--r--arch/powerpc/platforms/chrp/setup.c77
-rw-r--r--arch/powerpc/platforms/chrp/time.c22
-rw-r--r--arch/powerpc/platforms/iseries/setup.c13
-rw-r--r--arch/powerpc/platforms/maple/setup.c10
-rw-r--r--arch/powerpc/platforms/maple/time.c24
-rw-r--r--arch/powerpc/platforms/powermac/bootx_init.c6
-rw-r--r--arch/powerpc/platforms/powermac/feature.c2
-rw-r--r--arch/powerpc/platforms/powermac/low_i2c.c3
-rw-r--r--arch/powerpc/platforms/powermac/nvram.c14
-rw-r--r--arch/powerpc/platforms/powermac/pci.c5
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_base.c2
-rw-r--r--arch/powerpc/platforms/powermac/setup.c74
-rw-r--r--arch/powerpc/platforms/powermac/time.c4
-rw-r--r--arch/powerpc/platforms/powermac/udbg_scc.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh.c2
-rw-r--r--arch/powerpc/platforms/pseries/eeh_driver.c16
-rw-r--r--arch/powerpc/platforms/pseries/firmware.c2
-rw-r--r--arch/powerpc/platforms/pseries/hvconsole.c5
-rw-r--r--arch/powerpc/platforms/pseries/pci.c2
-rw-r--r--arch/powerpc/platforms/pseries/pci_dlpar.c11
-rw-r--r--arch/powerpc/platforms/pseries/ras.c2
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c15
-rw-r--r--arch/powerpc/platforms/pseries/rtasd.c3
-rw-r--r--arch/powerpc/platforms/pseries/setup.c231
-rw-r--r--arch/powerpc/platforms/pseries/xics.c4
-rw-r--r--arch/ppc/Kconfig93
-rw-r--r--arch/ppc/Kconfig.debug7
-rw-r--r--arch/ppc/Makefile6
-rw-r--r--arch/ppc/boot/Makefile7
-rw-r--r--arch/ppc/boot/openfirmware/Makefile109
-rw-r--r--arch/ppc/boot/openfirmware/chrpmain.c101
-rw-r--r--arch/ppc/boot/openfirmware/common.c146
-rw-r--r--arch/ppc/boot/openfirmware/dummy.c4
-rw-r--r--arch/ppc/boot/openfirmware/misc.S67
-rw-r--r--arch/ppc/boot/openfirmware/start.c172
-rw-r--r--arch/ppc/boot/simple/mpc10x_memory.c4
-rw-r--r--arch/ppc/boot/simple/relocate.S2
-rw-r--r--arch/ppc/boot/utils/addnote.c175
-rw-r--r--arch/ppc/boot/utils/hack-coff.c84
-rw-r--r--arch/ppc/boot/utils/mknote.c44
-rw-r--r--arch/ppc/configs/ibmchrp_defconfig875
-rw-r--r--arch/ppc/configs/pmac_defconfig1591
-rw-r--r--arch/ppc/configs/power3_defconfig1035
-rw-r--r--arch/ppc/configs/prep_defconfig (renamed from arch/ppc/configs/common_defconfig)0
-rw-r--r--arch/ppc/kernel/Makefile28
-rw-r--r--arch/ppc/kernel/entry.S60
-rw-r--r--arch/ppc/kernel/head.S183
-rw-r--r--arch/ppc/kernel/idle.c112
-rw-r--r--arch/ppc/kernel/idle_6xx.S233
-rw-r--r--arch/ppc/kernel/idle_power4.S91
-rw-r--r--arch/ppc/kernel/pci.c396
-rw-r--r--arch/ppc/kernel/ppc_htab.c10
-rw-r--r--arch/ppc/kernel/ppc_ksyms.c26
-rw-r--r--arch/ppc/kernel/setup.c256
-rw-r--r--arch/ppc/kernel/smp.c2
-rw-r--r--arch/ppc/lib/strcase.c3
-rw-r--r--arch/ppc/mm/fault.c30
-rw-r--r--arch/ppc/mm/hashtable.S34
-rw-r--r--arch/ppc/mm/init.c13
-rw-r--r--arch/ppc/mm/mmu_context.c2
-rw-r--r--arch/ppc/mm/pgtable.c8
-rw-r--r--arch/ppc/mm/ppc_mmu.c28
-rw-r--r--arch/ppc/platforms/Makefile12
-rw-r--r--arch/ppc/platforms/chrp_nvram.c83
-rw-r--r--arch/ppc/platforms/chrp_pci.c309
-rw-r--r--arch/ppc/platforms/chrp_pegasos_eth.c211
-rw-r--r--arch/ppc/platforms/chrp_setup.c669
-rw-r--r--arch/ppc/platforms/chrp_smp.c99
-rw-r--r--arch/ppc/platforms/chrp_time.c251
-rw-r--r--arch/ppc/platforms/lite5200.c71
-rw-r--r--arch/ppc/platforms/prep_setup.c14
-rw-r--r--arch/ppc/syslib/Makefile2
-rw-r--r--arch/ppc/syslib/mpc52xx_pci.c3
-rw-r--r--arch/ppc/syslib/mpc52xx_setup.c48
-rw-r--r--arch/ppc/syslib/open_pic.c2
-rw-r--r--arch/ppc/syslib/prom.c1429
-rw-r--r--arch/ppc/syslib/prom_init.c1011
-rw-r--r--arch/ppc/xmon/start.c2
-rw-r--r--arch/s390/kernel/process.c11
-rw-r--r--arch/sh/boards/mpc1211/rtc.c50
-rw-r--r--arch/sh/boards/sh03/rtc.c13
-rw-r--r--arch/sh/kernel/cpu/rtc.c10
-rw-r--r--arch/sh/kernel/setup.c5
-rw-r--r--arch/sh64/kernel/setup.c1
-rw-r--r--arch/sh64/kernel/time.c9
-rw-r--r--arch/sparc64/defconfig39
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c10
-rw-r--r--arch/sparc64/kernel/time.c16
-rw-r--r--arch/sparc64/kernel/traps.c17
-rw-r--r--arch/sparc64/mm/fault.c4
-rw-r--r--arch/um/drivers/mconsole_kern.c3
-rw-r--r--arch/um/drivers/ubd_kern.c76
-rw-r--r--arch/um/include/irq_user.h15
-rw-r--r--arch/um/include/kern.h2
-rw-r--r--arch/um/include/misc_constants.h6
-rw-r--r--arch/um/include/os.h36
-rw-r--r--arch/um/include/sigio.h3
-rw-r--r--arch/um/include/skas/mode-skas.h1
-rw-r--r--arch/um/include/skas/skas.h1
-rw-r--r--arch/um/include/user_util.h1
-rw-r--r--arch/um/kernel/Makefile9
-rw-r--r--arch/um/kernel/exec_kern.c2
-rw-r--r--arch/um/kernel/irq.c294
-rw-r--r--arch/um/kernel/irq_user.c412
-rw-r--r--arch/um/kernel/physmem.c3
-rw-r--r--arch/um/kernel/sigio_kern.c10
-rw-r--r--arch/um/kernel/smp.c15
-rw-r--r--arch/um/kernel/um_arch.c12
-rw-r--r--arch/um/os-Linux/Makefile13
-rw-r--r--arch/um/os-Linux/irq.c162
-rw-r--r--arch/um/os-Linux/sigio.c (renamed from arch/um/kernel/sigio_user.c)233
-rw-r--r--arch/um/os-Linux/start_up.c128
-rw-r--r--arch/um/os-Linux/tt.c10
-rw-r--r--arch/um/os-Linux/tty_log.c (renamed from arch/um/kernel/tty_log.c)18
-rw-r--r--arch/um/os-Linux/umid.c33
-rw-r--r--arch/um/sys-i386/ptrace.c15
-rw-r--r--arch/um/sys-i386/signal.c59
-rw-r--r--arch/um/sys-i386/user-offsets.c10
-rw-r--r--arch/um/sys-x86_64/ptrace.c22
-rw-r--r--arch/um/sys-x86_64/signal.c56
-rw-r--r--arch/um/sys-x86_64/user-offsets.c6
-rw-r--r--arch/x86_64/Kconfig13
-rw-r--r--arch/x86_64/ia32/ia32entry.S2
-rw-r--r--arch/x86_64/kernel/process.c17
-rw-r--r--arch/x86_64/kernel/setup.c3
-rw-r--r--arch/x86_64/kernel/smpboot.c24
-rw-r--r--arch/x86_64/kernel/time.c41
-rw-r--r--arch/x86_64/kernel/traps.c18
-rw-r--r--arch/x86_64/mm/init.c2
-rw-r--r--arch/x86_64/mm/numa.c15
-rw-r--r--arch/xtensa/platform-iss/setup.c2
363 files changed, 7853 insertions, 12700 deletions
diff --git a/arch/alpha/kernel/setup.c b/arch/alpha/kernel/setup.c
index b4e5f8ff2b25..dd8769670596 100644
--- a/arch/alpha/kernel/setup.c
+++ b/arch/alpha/kernel/setup.c
@@ -34,6 +34,7 @@
34#include <linux/root_dev.h> 34#include <linux/root_dev.h>
35#include <linux/initrd.h> 35#include <linux/initrd.h>
36#include <linux/eisa.h> 36#include <linux/eisa.h>
37#include <linux/pfn.h>
37#ifdef CONFIG_MAGIC_SYSRQ 38#ifdef CONFIG_MAGIC_SYSRQ
38#include <linux/sysrq.h> 39#include <linux/sysrq.h>
39#include <linux/reboot.h> 40#include <linux/reboot.h>
@@ -42,7 +43,7 @@
42#include <asm/setup.h> 43#include <asm/setup.h>
43#include <asm/io.h> 44#include <asm/io.h>
44 45
45extern struct notifier_block *panic_notifier_list; 46extern struct atomic_notifier_head panic_notifier_list;
46static int alpha_panic_event(struct notifier_block *, unsigned long, void *); 47static int alpha_panic_event(struct notifier_block *, unsigned long, void *);
47static struct notifier_block alpha_panic_block = { 48static struct notifier_block alpha_panic_block = {
48 alpha_panic_event, 49 alpha_panic_event,
@@ -241,9 +242,6 @@ reserve_std_resources(void)
241 request_resource(io, standard_io_resources+i); 242 request_resource(io, standard_io_resources+i);
242} 243}
243 244
244#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
245#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
246#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
247#define PFN_MAX PFN_DOWN(0x80000000) 245#define PFN_MAX PFN_DOWN(0x80000000)
248#define for_each_mem_cluster(memdesc, cluster, i) \ 246#define for_each_mem_cluster(memdesc, cluster, i) \
249 for ((cluster) = (memdesc)->cluster, (i) = 0; \ 247 for ((cluster) = (memdesc)->cluster, (i) = 0; \
@@ -472,11 +470,6 @@ page_is_ram(unsigned long pfn)
472 return 0; 470 return 0;
473} 471}
474 472
475#undef PFN_UP
476#undef PFN_DOWN
477#undef PFN_PHYS
478#undef PFN_MAX
479
480void __init 473void __init
481setup_arch(char **cmdline_p) 474setup_arch(char **cmdline_p)
482{ 475{
@@ -507,7 +500,8 @@ setup_arch(char **cmdline_p)
507 } 500 }
508 501
509 /* Register a call for panic conditions. */ 502 /* Register a call for panic conditions. */
510 notifier_chain_register(&panic_notifier_list, &alpha_panic_block); 503 atomic_notifier_chain_register(&panic_notifier_list,
504 &alpha_panic_block);
511 505
512#ifdef CONFIG_ALPHA_GENERIC 506#ifdef CONFIG_ALPHA_GENERIC
513 /* Assume that we've booted from SRM if we haven't booted from MILO. 507 /* Assume that we've booted from SRM if we haven't booted from MILO.
diff --git a/arch/alpha/kernel/time.c b/arch/alpha/kernel/time.c
index 6b2921be1909..3859749810b4 100644
--- a/arch/alpha/kernel/time.c
+++ b/arch/alpha/kernel/time.c
@@ -314,10 +314,11 @@ time_init(void)
314 if (!est_cycle_freq) 314 if (!est_cycle_freq)
315 est_cycle_freq = validate_cc_value(calibrate_cc_with_pit()); 315 est_cycle_freq = validate_cc_value(calibrate_cc_with_pit());
316 316
317 cc1 = rpcc_after_update_in_progress(); 317 cc1 = rpcc();
318 318
319 /* Calibrate CPU clock -- attempt #2. */ 319 /* Calibrate CPU clock -- attempt #2. */
320 if (!est_cycle_freq) { 320 if (!est_cycle_freq) {
321 cc1 = rpcc_after_update_in_progress();
321 cc2 = rpcc_after_update_in_progress(); 322 cc2 = rpcc_after_update_in_progress();
322 est_cycle_freq = validate_cc_value(cc2 - cc1); 323 est_cycle_freq = validate_cc_value(cc2 - cc1);
323 cc1 = cc2; 324 cc1 = cc2;
diff --git a/arch/alpha/mm/numa.c b/arch/alpha/mm/numa.c
index 6d5251254f68..bf6b65c81bef 100644
--- a/arch/alpha/mm/numa.c
+++ b/arch/alpha/mm/numa.c
@@ -13,6 +13,7 @@
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <linux/swap.h> 14#include <linux/swap.h>
15#include <linux/initrd.h> 15#include <linux/initrd.h>
16#include <linux/pfn.h>
16 17
17#include <asm/hwrpb.h> 18#include <asm/hwrpb.h>
18#include <asm/pgalloc.h> 19#include <asm/pgalloc.h>
@@ -27,9 +28,6 @@ bootmem_data_t node_bdata[MAX_NUMNODES];
27#define DBGDCONT(args...) 28#define DBGDCONT(args...)
28#endif 29#endif
29 30
30#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
31#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
32#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
33#define for_each_mem_cluster(memdesc, cluster, i) \ 31#define for_each_mem_cluster(memdesc, cluster, i) \
34 for ((cluster) = (memdesc)->cluster, (i) = 0; \ 32 for ((cluster) = (memdesc)->cluster, (i) = 0; \
35 (i) < (memdesc)->numclusters; (i)++, (cluster)++) 33 (i) < (memdesc)->numclusters; (i)++, (cluster)++)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index bf2e72698d02..ba46d779ede7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -8,6 +8,7 @@ mainmenu "Linux Kernel Configuration"
8config ARM 8config ARM
9 bool 9 bool
10 default y 10 default y
11 select RTC_LIB
11 help 12 help
12 The ARM series is a line of low-power-consumption RISC chip designs 13 The ARM series is a line of low-power-consumption RISC chip designs
13 licensed by ARM Ltd and targeted at embedded applications and 14 licensed by ARM Ltd and targeted at embedded applications and
@@ -152,6 +153,12 @@ config ARCH_IXP2000
152 help 153 help
153 Support for Intel's IXP2400/2800 (XScale) family of processors. 154 Support for Intel's IXP2400/2800 (XScale) family of processors.
154 155
156config ARCH_IXP23XX
157 bool "IXP23XX-based"
158 select PCI
159 help
160 Support for Intel's IXP23xx (XScale) family of processors.
161
155config ARCH_L7200 162config ARCH_L7200
156 bool "LinkUp-L7200" 163 bool "LinkUp-L7200"
157 select FIQ 164 select FIQ
@@ -273,6 +280,8 @@ source "arch/arm/mach-ixp4xx/Kconfig"
273 280
274source "arch/arm/mach-ixp2000/Kconfig" 281source "arch/arm/mach-ixp2000/Kconfig"
275 282
283source "arch/arm/mach-ixp23xx/Kconfig"
284
276source "arch/arm/mach-pxa/Kconfig" 285source "arch/arm/mach-pxa/Kconfig"
277 286
278source "arch/arm/mach-sa1100/Kconfig" 287source "arch/arm/mach-sa1100/Kconfig"
@@ -791,7 +800,8 @@ source "drivers/acorn/block/Kconfig"
791 800
792if PCMCIA || ARCH_CLPS7500 || ARCH_IOP3XX || ARCH_IXP4XX \ 801if PCMCIA || ARCH_CLPS7500 || ARCH_IOP3XX || ARCH_IXP4XX \
793 || ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC \ 802 || ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC \
794 || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE 803 || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE \
804 || ARCH_IXP23XX
795source "drivers/ide/Kconfig" 805source "drivers/ide/Kconfig"
796endif 806endif
797 807
@@ -839,6 +849,8 @@ source "drivers/usb/Kconfig"
839 849
840source "drivers/mmc/Kconfig" 850source "drivers/mmc/Kconfig"
841 851
852source "drivers/rtc/Kconfig"
853
842endmenu 854endmenu
843 855
844source "fs/Kconfig" 856source "fs/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 99c0d323719a..ce3e804ea0f3 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -57,6 +57,7 @@ tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi
57tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110 57tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110
58tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100 58tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100
59tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale 59tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
60tune-$(CONFIG_CPU_XSC3) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
60tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm) 61tune-$(CONFIG_CPU_V6) :=$(call cc-option,-mtune=arm1136j-s,-mtune=strongarm)
61 62
62ifeq ($(CONFIG_AEABI),y) 63ifeq ($(CONFIG_AEABI),y)
@@ -97,6 +98,7 @@ endif
97 machine-$(CONFIG_ARCH_IOP3XX) := iop3xx 98 machine-$(CONFIG_ARCH_IOP3XX) := iop3xx
98 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx 99 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
99 machine-$(CONFIG_ARCH_IXP2000) := ixp2000 100 machine-$(CONFIG_ARCH_IXP2000) := ixp2000
101 machine-$(CONFIG_ARCH_IXP23XX) := ixp23xx
100 machine-$(CONFIG_ARCH_OMAP1) := omap1 102 machine-$(CONFIG_ARCH_OMAP1) := omap1
101 machine-$(CONFIG_ARCH_OMAP2) := omap2 103 machine-$(CONFIG_ARCH_OMAP2) := omap2
102 incdir-$(CONFIG_ARCH_OMAP) := omap 104 incdir-$(CONFIG_ARCH_OMAP) := omap
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 35ffe0f4ece7..2adc1527e0eb 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -50,10 +50,6 @@ ifeq ($(CONFIG_ARCH_AT91RM9200),y)
50OBJS += head-at91rm9200.o 50OBJS += head-at91rm9200.o
51endif 51endif
52 52
53ifeq ($(CONFIG_DEBUG_ICEDCC),y)
54OBJS += ice-dcc.o
55endif
56
57ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) 53ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
58OBJS += big-endian.o 54OBJS += big-endian.o
59endif 55endif
diff --git a/arch/arm/boot/compressed/ice-dcc.S b/arch/arm/boot/compressed/ice-dcc.S
deleted file mode 100644
index 104377a199bb..000000000000
--- a/arch/arm/boot/compressed/ice-dcc.S
+++ /dev/null
@@ -1,17 +0,0 @@
1
2
3 .text
4
5 .global icedcc_putc
6
7icedcc_putc:
8 mov r2, #0x4000000
91:
10 subs r2, r2, #1
11 movlt pc, r14
12 mrc p14, 0, r1, c0, c0, 0
13 tst r1, #2
14 bne 1b
15
16 mcr p14, 0, r0, c1, c0, 0
17 mov pc, r14
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index 5ab94584baee..0af3772efcb7 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -20,24 +20,45 @@ unsigned int __machine_arch_type;
20 20
21#include <linux/string.h> 21#include <linux/string.h>
22 22
23#include <asm/arch/uncompress.h>
24
25#ifdef STANDALONE_DEBUG 23#ifdef STANDALONE_DEBUG
26#define putstr printf 24#define putstr printf
27#endif 25#else
26
27static void putstr(const char *ptr);
28
29#include <linux/compiler.h>
30#include <asm/arch/uncompress.h>
28 31
29#ifdef CONFIG_DEBUG_ICEDCC 32#ifdef CONFIG_DEBUG_ICEDCC
30#define putstr icedcc_putstr 33static void icedcc_putc(int ch)
31#define putc icedcc_putc 34{
35 int status, i = 0x4000000;
32 36
33extern void icedcc_putc(int ch); 37 do {
38 if (--i < 0)
39 return;
34 40
35static void 41 asm("mrc p14, 0, %0, c0, c0, 0" : "=r" (status));
36icedcc_putstr(const char *ptr) 42 } while (status & 2);
43
44 asm("mcr p15, 0, %0, c1, c0, 0" : : "r" (ch));
45}
46
47#define putc(ch) icedcc_putc(ch)
48#define flush() do { } while (0)
49#endif
50
51static void putstr(const char *ptr)
37{ 52{
38 for (; *ptr != '\0'; ptr++) { 53 char c;
39 icedcc_putc(*ptr); 54
55 while ((c = *ptr++) != '\0') {
56 if (c == '\n')
57 putc('\r');
58 putc(c);
40 } 59 }
60
61 flush();
41} 62}
42 63
43#endif 64#endif
diff --git a/arch/arm/common/rtctime.c b/arch/arm/common/rtctime.c
index e851d86c212c..35c9a64ac14c 100644
--- a/arch/arm/common/rtctime.c
+++ b/arch/arm/common/rtctime.c
@@ -20,6 +20,7 @@
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/rtc.h>
23 24
24#include <asm/rtc.h> 25#include <asm/rtc.h>
25#include <asm/semaphore.h> 26#include <asm/semaphore.h>
@@ -42,89 +43,6 @@ static struct rtc_ops *rtc_ops;
42 43
43#define rtc_epoch 1900UL 44#define rtc_epoch 1900UL
44 45
45static const unsigned char days_in_month[] = {
46 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
47};
48
49#define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400)
50#define LEAP_YEAR(year) ((!(year % 4) && (year % 100)) || !(year % 400))
51
52static int month_days(unsigned int month, unsigned int year)
53{
54 return days_in_month[month] + (LEAP_YEAR(year) && month == 1);
55}
56
57/*
58 * Convert seconds since 01-01-1970 00:00:00 to Gregorian date.
59 */
60void rtc_time_to_tm(unsigned long time, struct rtc_time *tm)
61{
62 int days, month, year;
63
64 days = time / 86400;
65 time -= days * 86400;
66
67 tm->tm_wday = (days + 4) % 7;
68
69 year = 1970 + days / 365;
70 days -= (year - 1970) * 365
71 + LEAPS_THRU_END_OF(year - 1)
72 - LEAPS_THRU_END_OF(1970 - 1);
73 if (days < 0) {
74 year -= 1;
75 days += 365 + LEAP_YEAR(year);
76 }
77 tm->tm_year = year - 1900;
78 tm->tm_yday = days + 1;
79
80 for (month = 0; month < 11; month++) {
81 int newdays;
82
83 newdays = days - month_days(month, year);
84 if (newdays < 0)
85 break;
86 days = newdays;
87 }
88 tm->tm_mon = month;
89 tm->tm_mday = days + 1;
90
91 tm->tm_hour = time / 3600;
92 time -= tm->tm_hour * 3600;
93 tm->tm_min = time / 60;
94 tm->tm_sec = time - tm->tm_min * 60;
95}
96EXPORT_SYMBOL(rtc_time_to_tm);
97
98/*
99 * Does the rtc_time represent a valid date/time?
100 */
101int rtc_valid_tm(struct rtc_time *tm)
102{
103 if (tm->tm_year < 70 ||
104 tm->tm_mon >= 12 ||
105 tm->tm_mday < 1 ||
106 tm->tm_mday > month_days(tm->tm_mon, tm->tm_year + 1900) ||
107 tm->tm_hour >= 24 ||
108 tm->tm_min >= 60 ||
109 tm->tm_sec >= 60)
110 return -EINVAL;
111
112 return 0;
113}
114EXPORT_SYMBOL(rtc_valid_tm);
115
116/*
117 * Convert Gregorian date to seconds since 01-01-1970 00:00:00.
118 */
119int rtc_tm_to_time(struct rtc_time *tm, unsigned long *time)
120{
121 *time = mktime(tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
122 tm->tm_hour, tm->tm_min, tm->tm_sec);
123
124 return 0;
125}
126EXPORT_SYMBOL(rtc_tm_to_time);
127
128/* 46/*
129 * Calculate the next alarm time given the requested alarm time mask 47 * Calculate the next alarm time given the requested alarm time mask
130 * and the current time. 48 * and the current time.
@@ -151,13 +69,13 @@ void rtc_next_alarm_time(struct rtc_time *next, struct rtc_time *now, struct rtc
151 } 69 }
152} 70}
153 71
154static inline int rtc_read_time(struct rtc_ops *ops, struct rtc_time *tm) 72static inline int rtc_arm_read_time(struct rtc_ops *ops, struct rtc_time *tm)
155{ 73{
156 memset(tm, 0, sizeof(struct rtc_time)); 74 memset(tm, 0, sizeof(struct rtc_time));
157 return ops->read_time(tm); 75 return ops->read_time(tm);
158} 76}
159 77
160static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm) 78static inline int rtc_arm_set_time(struct rtc_ops *ops, struct rtc_time *tm)
161{ 79{
162 int ret; 80 int ret;
163 81
@@ -168,7 +86,7 @@ static inline int rtc_set_time(struct rtc_ops *ops, struct rtc_time *tm)
168 return ret; 86 return ret;
169} 87}
170 88
171static inline int rtc_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm) 89static inline int rtc_arm_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
172{ 90{
173 int ret = -EINVAL; 91 int ret = -EINVAL;
174 if (ops->read_alarm) { 92 if (ops->read_alarm) {
@@ -178,7 +96,7 @@ static inline int rtc_read_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
178 return ret; 96 return ret;
179} 97}
180 98
181static inline int rtc_set_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm) 99static inline int rtc_arm_set_alarm(struct rtc_ops *ops, struct rtc_wkalrm *alrm)
182{ 100{
183 int ret = -EINVAL; 101 int ret = -EINVAL;
184 if (ops->set_alarm) 102 if (ops->set_alarm)
@@ -266,7 +184,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
266 184
267 switch (cmd) { 185 switch (cmd) {
268 case RTC_ALM_READ: 186 case RTC_ALM_READ:
269 ret = rtc_read_alarm(ops, &alrm); 187 ret = rtc_arm_read_alarm(ops, &alrm);
270 if (ret) 188 if (ret)
271 break; 189 break;
272 ret = copy_to_user(uarg, &alrm.time, sizeof(tm)); 190 ret = copy_to_user(uarg, &alrm.time, sizeof(tm));
@@ -288,11 +206,11 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
288 alrm.time.tm_wday = -1; 206 alrm.time.tm_wday = -1;
289 alrm.time.tm_yday = -1; 207 alrm.time.tm_yday = -1;
290 alrm.time.tm_isdst = -1; 208 alrm.time.tm_isdst = -1;
291 ret = rtc_set_alarm(ops, &alrm); 209 ret = rtc_arm_set_alarm(ops, &alrm);
292 break; 210 break;
293 211
294 case RTC_RD_TIME: 212 case RTC_RD_TIME:
295 ret = rtc_read_time(ops, &tm); 213 ret = rtc_arm_read_time(ops, &tm);
296 if (ret) 214 if (ret)
297 break; 215 break;
298 ret = copy_to_user(uarg, &tm, sizeof(tm)); 216 ret = copy_to_user(uarg, &tm, sizeof(tm));
@@ -310,7 +228,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
310 ret = -EFAULT; 228 ret = -EFAULT;
311 break; 229 break;
312 } 230 }
313 ret = rtc_set_time(ops, &tm); 231 ret = rtc_arm_set_time(ops, &tm);
314 break; 232 break;
315 233
316 case RTC_EPOCH_SET: 234 case RTC_EPOCH_SET:
@@ -341,11 +259,11 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
341 ret = -EFAULT; 259 ret = -EFAULT;
342 break; 260 break;
343 } 261 }
344 ret = rtc_set_alarm(ops, &alrm); 262 ret = rtc_arm_set_alarm(ops, &alrm);
345 break; 263 break;
346 264
347 case RTC_WKALM_RD: 265 case RTC_WKALM_RD:
348 ret = rtc_read_alarm(ops, &alrm); 266 ret = rtc_arm_read_alarm(ops, &alrm);
349 if (ret) 267 if (ret)
350 break; 268 break;
351 ret = copy_to_user(uarg, &alrm, sizeof(alrm)); 269 ret = copy_to_user(uarg, &alrm, sizeof(alrm));
@@ -435,7 +353,7 @@ static int rtc_read_proc(char *page, char **start, off_t off, int count, int *eo
435 struct rtc_time tm; 353 struct rtc_time tm;
436 char *p = page; 354 char *p = page;
437 355
438 if (rtc_read_time(ops, &tm) == 0) { 356 if (rtc_arm_read_time(ops, &tm) == 0) {
439 p += sprintf(p, 357 p += sprintf(p,
440 "rtc_time\t: %02d:%02d:%02d\n" 358 "rtc_time\t: %02d:%02d:%02d\n"
441 "rtc_date\t: %04d-%02d-%02d\n" 359 "rtc_date\t: %04d-%02d-%02d\n"
@@ -445,7 +363,7 @@ static int rtc_read_proc(char *page, char **start, off_t off, int count, int *eo
445 rtc_epoch); 363 rtc_epoch);
446 } 364 }
447 365
448 if (rtc_read_alarm(ops, &alrm) == 0) { 366 if (rtc_arm_read_alarm(ops, &alrm) == 0) {
449 p += sprintf(p, "alrm_time\t: "); 367 p += sprintf(p, "alrm_time\t: ");
450 if ((unsigned int)alrm.time.tm_hour <= 24) 368 if ((unsigned int)alrm.time.tm_hour <= 24)
451 p += sprintf(p, "%02d:", alrm.time.tm_hour); 369 p += sprintf(p, "%02d:", alrm.time.tm_hour);
diff --git a/arch/arm/configs/ixp23xx_defconfig b/arch/arm/configs/ixp23xx_defconfig
new file mode 100644
index 000000000000..1a2751e9ab05
--- /dev/null
+++ b/arch/arm/configs/ixp23xx_defconfig
@@ -0,0 +1,1302 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16
4# Tue Mar 21 03:27:20 2006
5#
6CONFIG_ARM=y
7CONFIG_MMU=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_BROKEN_ON_SMP=y
16CONFIG_INIT_ENV_ARG_LIMIT=32
17
18#
19# General setup
20#
21CONFIG_LOCALVERSION=""
22CONFIG_LOCALVERSION_AUTO=y
23CONFIG_SWAP=y
24CONFIG_SYSVIPC=y
25# CONFIG_POSIX_MQUEUE is not set
26CONFIG_BSD_PROCESS_ACCT=y
27# CONFIG_BSD_PROCESS_ACCT_V3 is not set
28CONFIG_SYSCTL=y
29# CONFIG_AUDIT is not set
30# CONFIG_IKCONFIG is not set
31CONFIG_INITRAMFS_SOURCE=""
32CONFIG_UID16=y
33CONFIG_CC_OPTIMIZE_FOR_SIZE=y
34CONFIG_EMBEDDED=y
35CONFIG_KALLSYMS=y
36# CONFIG_KALLSYMS_ALL is not set
37# CONFIG_KALLSYMS_EXTRA_PASS is not set
38CONFIG_HOTPLUG=y
39CONFIG_PRINTK=y
40CONFIG_BUG=y
41CONFIG_ELF_CORE=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
50CONFIG_SLAB=y
51# CONFIG_TINY_SHMEM is not set
52CONFIG_BASE_SMALL=0
53# CONFIG_SLOB is not set
54CONFIG_OBSOLETE_INTERMODULE=y
55
56#
57# Loadable module support
58#
59CONFIG_MODULES=y
60CONFIG_MODULE_UNLOAD=y
61# CONFIG_MODULE_FORCE_UNLOAD is not set
62CONFIG_OBSOLETE_MODPARM=y
63# CONFIG_MODVERSIONS is not set
64# CONFIG_MODULE_SRCVERSION_ALL is not set
65CONFIG_KMOD=y
66
67#
68# Block layer
69#
70
71#
72# IO Schedulers
73#
74CONFIG_IOSCHED_NOOP=y
75CONFIG_IOSCHED_AS=y
76CONFIG_IOSCHED_DEADLINE=y
77CONFIG_IOSCHED_CFQ=y
78CONFIG_DEFAULT_AS=y
79# CONFIG_DEFAULT_DEADLINE is not set
80# CONFIG_DEFAULT_CFQ is not set
81# CONFIG_DEFAULT_NOOP is not set
82CONFIG_DEFAULT_IOSCHED="anticipatory"
83
84#
85# System Type
86#
87# CONFIG_ARCH_CLPS7500 is not set
88# CONFIG_ARCH_CLPS711X is not set
89# CONFIG_ARCH_CO285 is not set
90# CONFIG_ARCH_EBSA110 is not set
91# CONFIG_ARCH_EP93XX is not set
92# CONFIG_ARCH_FOOTBRIDGE is not set
93# CONFIG_ARCH_INTEGRATOR is not set
94# CONFIG_ARCH_IOP3XX is not set
95# CONFIG_ARCH_IXP4XX is not set
96# CONFIG_ARCH_IXP2000 is not set
97CONFIG_ARCH_IXP23XX=y
98# CONFIG_ARCH_L7200 is not set
99# CONFIG_ARCH_PXA is not set
100# CONFIG_ARCH_RPC is not set
101# CONFIG_ARCH_SA1100 is not set
102# CONFIG_ARCH_S3C2410 is not set
103# CONFIG_ARCH_SHARK is not set
104# CONFIG_ARCH_LH7A40X is not set
105# CONFIG_ARCH_OMAP is not set
106# CONFIG_ARCH_VERSATILE is not set
107# CONFIG_ARCH_REALVIEW is not set
108# CONFIG_ARCH_IMX is not set
109# CONFIG_ARCH_H720X is not set
110# CONFIG_ARCH_AAEC2000 is not set
111# CONFIG_ARCH_AT91RM9200 is not set
112CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y
113
114#
115# Intel IXP23xx Implementation Options
116#
117
118#
119# IXP23xx Platforms
120#
121CONFIG_MACH_ESPRESSO=y
122CONFIG_MACH_IXDP2351=y
123CONFIG_MACH_ROADRUNNER=y
124
125#
126# Processor Type
127#
128CONFIG_CPU_32=y
129CONFIG_CPU_XSC3=y
130CONFIG_CPU_32v5=y
131CONFIG_CPU_ABRT_EV5T=y
132CONFIG_CPU_CACHE_VIVT=y
133CONFIG_CPU_TLB_V4WBI=y
134CONFIG_IO_36=y
135
136#
137# Processor Features
138#
139# CONFIG_ARM_THUMB is not set
140CONFIG_CPU_BIG_ENDIAN=y
141
142#
143# Bus support
144#
145CONFIG_PCI=y
146CONFIG_PCI_LEGACY_PROC=y
147# CONFIG_PCI_DEBUG is not set
148
149#
150# PCCARD (PCMCIA/CardBus) support
151#
152# CONFIG_PCCARD is not set
153
154#
155# Kernel Features
156#
157# CONFIG_PREEMPT is not set
158# CONFIG_NO_IDLE_HZ is not set
159CONFIG_HZ=100
160# CONFIG_AEABI is not set
161# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
162CONFIG_SELECT_MEMORY_MODEL=y
163CONFIG_FLATMEM_MANUAL=y
164# CONFIG_DISCONTIGMEM_MANUAL is not set
165# CONFIG_SPARSEMEM_MANUAL is not set
166CONFIG_FLATMEM=y
167CONFIG_FLAT_NODE_MEM_MAP=y
168# CONFIG_SPARSEMEM_STATIC is not set
169CONFIG_SPLIT_PTLOCK_CPUS=4096
170CONFIG_ALIGNMENT_TRAP=y
171
172#
173# Boot options
174#
175CONFIG_ZBOOT_ROM_TEXT=0x0
176CONFIG_ZBOOT_ROM_BSS=0x0
177CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp"
178# CONFIG_XIP_KERNEL is not set
179
180#
181# Floating point emulation
182#
183
184#
185# At least one emulation must be selected
186#
187CONFIG_FPE_NWFPE=y
188CONFIG_FPE_NWFPE_XP=y
189# CONFIG_FPE_FASTFPE is not set
190
191#
192# Userspace binary formats
193#
194CONFIG_BINFMT_ELF=y
195# CONFIG_BINFMT_AOUT is not set
196# CONFIG_BINFMT_MISC is not set
197# CONFIG_ARTHUR is not set
198
199#
200# Power management options
201#
202# CONFIG_PM is not set
203# CONFIG_APM is not set
204
205#
206# Networking
207#
208CONFIG_NET=y
209
210#
211# Networking options
212#
213# CONFIG_NETDEBUG is not set
214CONFIG_PACKET=y
215CONFIG_PACKET_MMAP=y
216CONFIG_UNIX=y
217# CONFIG_NET_KEY is not set
218CONFIG_INET=y
219# CONFIG_IP_MULTICAST is not set
220# CONFIG_IP_ADVANCED_ROUTER is not set
221CONFIG_IP_FIB_HASH=y
222CONFIG_IP_PNP=y
223CONFIG_IP_PNP_DHCP=y
224CONFIG_IP_PNP_BOOTP=y
225# CONFIG_IP_PNP_RARP is not set
226# CONFIG_NET_IPIP is not set
227# CONFIG_NET_IPGRE is not set
228# CONFIG_ARPD is not set
229CONFIG_SYN_COOKIES=y
230# CONFIG_INET_AH is not set
231# CONFIG_INET_ESP is not set
232# CONFIG_INET_IPCOMP is not set
233# CONFIG_INET_TUNNEL is not set
234CONFIG_INET_DIAG=y
235CONFIG_INET_TCP_DIAG=y
236# CONFIG_TCP_CONG_ADVANCED is not set
237CONFIG_TCP_CONG_BIC=y
238# CONFIG_IPV6 is not set
239# CONFIG_NETFILTER is not set
240
241#
242# DCCP Configuration (EXPERIMENTAL)
243#
244# CONFIG_IP_DCCP is not set
245
246#
247# SCTP Configuration (EXPERIMENTAL)
248#
249# CONFIG_IP_SCTP is not set
250
251#
252# TIPC Configuration (EXPERIMENTAL)
253#
254# CONFIG_TIPC is not set
255# CONFIG_ATM is not set
256# CONFIG_BRIDGE is not set
257# CONFIG_VLAN_8021Q is not set
258# CONFIG_DECNET is not set
259# CONFIG_LLC2 is not set
260# CONFIG_IPX is not set
261# CONFIG_ATALK is not set
262# CONFIG_X25 is not set
263# CONFIG_LAPB is not set
264# CONFIG_NET_DIVERT is not set
265# CONFIG_ECONET is not set
266# CONFIG_WAN_ROUTER is not set
267
268#
269# QoS and/or fair queueing
270#
271# CONFIG_NET_SCHED is not set
272
273#
274# Network testing
275#
276# CONFIG_NET_PKTGEN is not set
277# CONFIG_HAMRADIO is not set
278# CONFIG_IRDA is not set
279# CONFIG_BT is not set
280# CONFIG_IEEE80211 is not set
281
282#
283# Device Drivers
284#
285
286#
287# Generic Driver Options
288#
289CONFIG_STANDALONE=y
290# CONFIG_PREVENT_FIRMWARE_BUILD is not set
291# CONFIG_FW_LOADER is not set
292# CONFIG_DEBUG_DRIVER is not set
293
294#
295# Connector - unified userspace <-> kernelspace linker
296#
297# CONFIG_CONNECTOR is not set
298
299#
300# Memory Technology Devices (MTD)
301#
302CONFIG_MTD=y
303# CONFIG_MTD_DEBUG is not set
304# CONFIG_MTD_CONCAT is not set
305CONFIG_MTD_PARTITIONS=y
306CONFIG_MTD_REDBOOT_PARTS=y
307CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
308CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED=y
309CONFIG_MTD_REDBOOT_PARTS_READONLY=y
310# CONFIG_MTD_CMDLINE_PARTS is not set
311# CONFIG_MTD_AFS_PARTS is not set
312
313#
314# User Modules And Translation Layers
315#
316CONFIG_MTD_CHAR=y
317CONFIG_MTD_BLOCK=y
318# CONFIG_FTL is not set
319# CONFIG_NFTL is not set
320# CONFIG_INFTL is not set
321# CONFIG_RFD_FTL is not set
322
323#
324# RAM/ROM/Flash chip drivers
325#
326CONFIG_MTD_CFI=y
327# CONFIG_MTD_JEDECPROBE is not set
328CONFIG_MTD_GEN_PROBE=y
329# CONFIG_MTD_CFI_ADV_OPTIONS is not set
330CONFIG_MTD_MAP_BANK_WIDTH_1=y
331CONFIG_MTD_MAP_BANK_WIDTH_2=y
332CONFIG_MTD_MAP_BANK_WIDTH_4=y
333# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
334# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
335# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
336CONFIG_MTD_CFI_I1=y
337CONFIG_MTD_CFI_I2=y
338# CONFIG_MTD_CFI_I4 is not set
339# CONFIG_MTD_CFI_I8 is not set
340CONFIG_MTD_CFI_INTELEXT=y
341# CONFIG_MTD_CFI_AMDSTD is not set
342# CONFIG_MTD_CFI_STAA is not set
343CONFIG_MTD_CFI_UTIL=y
344# CONFIG_MTD_RAM is not set
345# CONFIG_MTD_ROM is not set
346# CONFIG_MTD_ABSENT is not set
347# CONFIG_MTD_OBSOLETE_CHIPS is not set
348
349#
350# Mapping drivers for chip access
351#
352CONFIG_MTD_COMPLEX_MAPPINGS=y
353CONFIG_MTD_PHYSMAP=y
354CONFIG_MTD_PHYSMAP_START=0x0
355CONFIG_MTD_PHYSMAP_LEN=0x0
356CONFIG_MTD_PHYSMAP_BANKWIDTH=1
357# CONFIG_MTD_ARM_INTEGRATOR is not set
358# CONFIG_MTD_PCI is not set
359# CONFIG_MTD_PLATRAM is not set
360
361#
362# Self-contained MTD device drivers
363#
364# CONFIG_MTD_PMC551 is not set
365# CONFIG_MTD_SLRAM is not set
366# CONFIG_MTD_PHRAM is not set
367# CONFIG_MTD_MTDRAM is not set
368# CONFIG_MTD_BLKMTD is not set
369# CONFIG_MTD_BLOCK2MTD is not set
370
371#
372# Disk-On-Chip Device Drivers
373#
374# CONFIG_MTD_DOC2000 is not set
375# CONFIG_MTD_DOC2001 is not set
376# CONFIG_MTD_DOC2001PLUS is not set
377
378#
379# NAND Flash Device Drivers
380#
381# CONFIG_MTD_NAND is not set
382
383#
384# OneNAND Flash Device Drivers
385#
386# CONFIG_MTD_ONENAND is not set
387
388#
389# Parallel port support
390#
391# CONFIG_PARPORT is not set
392
393#
394# Plug and Play support
395#
396
397#
398# Block devices
399#
400# CONFIG_BLK_CPQ_DA is not set
401# CONFIG_BLK_CPQ_CISS_DA is not set
402# CONFIG_BLK_DEV_DAC960 is not set
403# CONFIG_BLK_DEV_UMEM is not set
404# CONFIG_BLK_DEV_COW_COMMON is not set
405CONFIG_BLK_DEV_LOOP=y
406# CONFIG_BLK_DEV_CRYPTOLOOP is not set
407# CONFIG_BLK_DEV_NBD is not set
408# CONFIG_BLK_DEV_SX8 is not set
409# CONFIG_BLK_DEV_UB is not set
410CONFIG_BLK_DEV_RAM=y
411CONFIG_BLK_DEV_RAM_COUNT=16
412CONFIG_BLK_DEV_RAM_SIZE=8192
413CONFIG_BLK_DEV_INITRD=y
414# CONFIG_CDROM_PKTCDVD is not set
415# CONFIG_ATA_OVER_ETH is not set
416
417#
418# ATA/ATAPI/MFM/RLL support
419#
420CONFIG_IDE=y
421CONFIG_BLK_DEV_IDE=y
422
423#
424# Please see Documentation/ide.txt for help/info on IDE drives
425#
426# CONFIG_BLK_DEV_IDE_SATA is not set
427CONFIG_BLK_DEV_IDEDISK=y
428# CONFIG_IDEDISK_MULTI_MODE is not set
429# CONFIG_BLK_DEV_IDECD is not set
430# CONFIG_BLK_DEV_IDETAPE is not set
431# CONFIG_BLK_DEV_IDEFLOPPY is not set
432# CONFIG_BLK_DEV_IDESCSI is not set
433# CONFIG_IDE_TASK_IOCTL is not set
434
435#
436# IDE chipset support/bugfixes
437#
438CONFIG_IDE_GENERIC=y
439CONFIG_BLK_DEV_IDEPCI=y
440# CONFIG_IDEPCI_SHARE_IRQ is not set
441# CONFIG_BLK_DEV_OFFBOARD is not set
442# CONFIG_BLK_DEV_GENERIC is not set
443# CONFIG_BLK_DEV_OPTI621 is not set
444# CONFIG_BLK_DEV_SL82C105 is not set
445CONFIG_BLK_DEV_IDEDMA_PCI=y
446# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
447# CONFIG_IDEDMA_PCI_AUTO is not set
448# CONFIG_BLK_DEV_AEC62XX is not set
449# CONFIG_BLK_DEV_ALI15X3 is not set
450# CONFIG_BLK_DEV_AMD74XX is not set
451# CONFIG_BLK_DEV_CMD64X is not set
452# CONFIG_BLK_DEV_TRIFLEX is not set
453# CONFIG_BLK_DEV_CY82C693 is not set
454# CONFIG_BLK_DEV_CS5520 is not set
455# CONFIG_BLK_DEV_CS5530 is not set
456# CONFIG_BLK_DEV_HPT34X is not set
457# CONFIG_BLK_DEV_HPT366 is not set
458# CONFIG_BLK_DEV_SC1200 is not set
459# CONFIG_BLK_DEV_PIIX is not set
460# CONFIG_BLK_DEV_IT821X is not set
461# CONFIG_BLK_DEV_NS87415 is not set
462# CONFIG_BLK_DEV_PDC202XX_OLD is not set
463# CONFIG_BLK_DEV_PDC202XX_NEW is not set
464# CONFIG_BLK_DEV_SVWKS is not set
465CONFIG_BLK_DEV_SIIMAGE=y
466# CONFIG_BLK_DEV_SLC90E66 is not set
467# CONFIG_BLK_DEV_TRM290 is not set
468# CONFIG_BLK_DEV_VIA82CXXX is not set
469# CONFIG_IDE_ARM is not set
470CONFIG_BLK_DEV_IDEDMA=y
471# CONFIG_IDEDMA_IVB is not set
472# CONFIG_IDEDMA_AUTO is not set
473# CONFIG_BLK_DEV_HD is not set
474
475#
476# SCSI device support
477#
478# CONFIG_RAID_ATTRS is not set
479CONFIG_SCSI=y
480CONFIG_SCSI_PROC_FS=y
481
482#
483# SCSI support type (disk, tape, CD-ROM)
484#
485CONFIG_BLK_DEV_SD=y
486# CONFIG_CHR_DEV_ST is not set
487# CONFIG_CHR_DEV_OSST is not set
488# CONFIG_BLK_DEV_SR is not set
489# CONFIG_CHR_DEV_SG is not set
490# CONFIG_CHR_DEV_SCH is not set
491
492#
493# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
494#
495# CONFIG_SCSI_MULTI_LUN is not set
496# CONFIG_SCSI_CONSTANTS is not set
497# CONFIG_SCSI_LOGGING is not set
498
499#
500# SCSI Transport Attributes
501#
502# CONFIG_SCSI_SPI_ATTRS is not set
503# CONFIG_SCSI_FC_ATTRS is not set
504# CONFIG_SCSI_ISCSI_ATTRS is not set
505# CONFIG_SCSI_SAS_ATTRS is not set
506
507#
508# SCSI low-level drivers
509#
510# CONFIG_ISCSI_TCP is not set
511# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
512# CONFIG_SCSI_3W_9XXX is not set
513# CONFIG_SCSI_ACARD is not set
514# CONFIG_SCSI_AACRAID is not set
515# CONFIG_SCSI_AIC7XXX is not set
516# CONFIG_SCSI_AIC7XXX_OLD is not set
517# CONFIG_SCSI_AIC79XX is not set
518# CONFIG_SCSI_DPT_I2O is not set
519# CONFIG_MEGARAID_NEWGEN is not set
520# CONFIG_MEGARAID_LEGACY is not set
521# CONFIG_MEGARAID_SAS is not set
522# CONFIG_SCSI_SATA is not set
523# CONFIG_SCSI_DMX3191D is not set
524# CONFIG_SCSI_FUTURE_DOMAIN is not set
525# CONFIG_SCSI_IPS is not set
526# CONFIG_SCSI_INITIO is not set
527# CONFIG_SCSI_INIA100 is not set
528# CONFIG_SCSI_SYM53C8XX_2 is not set
529# CONFIG_SCSI_IPR is not set
530# CONFIG_SCSI_QLOGIC_FC is not set
531# CONFIG_SCSI_QLOGIC_1280 is not set
532# CONFIG_SCSI_QLA_FC is not set
533# CONFIG_SCSI_LPFC is not set
534# CONFIG_SCSI_DC395x is not set
535# CONFIG_SCSI_DC390T is not set
536# CONFIG_SCSI_NSP32 is not set
537# CONFIG_SCSI_DEBUG is not set
538
539#
540# Multi-device support (RAID and LVM)
541#
542# CONFIG_MD is not set
543
544#
545# Fusion MPT device support
546#
547# CONFIG_FUSION is not set
548# CONFIG_FUSION_SPI is not set
549# CONFIG_FUSION_FC is not set
550# CONFIG_FUSION_SAS is not set
551
552#
553# IEEE 1394 (FireWire) support
554#
555# CONFIG_IEEE1394 is not set
556
557#
558# I2O device support
559#
560# CONFIG_I2O is not set
561
562#
563# Network device support
564#
565CONFIG_NETDEVICES=y
566CONFIG_DUMMY=y
567# CONFIG_BONDING is not set
568# CONFIG_EQUALIZER is not set
569# CONFIG_TUN is not set
570
571#
572# ARCnet devices
573#
574# CONFIG_ARCNET is not set
575
576#
577# PHY device support
578#
579# CONFIG_PHYLIB is not set
580
581#
582# Ethernet (10 or 100Mbit)
583#
584CONFIG_NET_ETHERNET=y
585CONFIG_MII=y
586# CONFIG_HAPPYMEAL is not set
587# CONFIG_SUNGEM is not set
588# CONFIG_CASSINI is not set
589# CONFIG_NET_VENDOR_3COM is not set
590# CONFIG_SMC91X is not set
591# CONFIG_DM9000 is not set
592
593#
594# Tulip family network device support
595#
596# CONFIG_NET_TULIP is not set
597# CONFIG_HP100 is not set
598CONFIG_NET_PCI=y
599# CONFIG_PCNET32 is not set
600# CONFIG_AMD8111_ETH is not set
601# CONFIG_ADAPTEC_STARFIRE is not set
602# CONFIG_B44 is not set
603# CONFIG_FORCEDETH is not set
604# CONFIG_CS89x0 is not set
605# CONFIG_DGRS is not set
606# CONFIG_EEPRO100 is not set
607CONFIG_E100=y
608# CONFIG_FEALNX is not set
609# CONFIG_NATSEMI is not set
610# CONFIG_NE2K_PCI is not set
611# CONFIG_8139CP is not set
612# CONFIG_8139TOO is not set
613# CONFIG_SIS900 is not set
614# CONFIG_EPIC100 is not set
615# CONFIG_SUNDANCE is not set
616# CONFIG_TLAN is not set
617# CONFIG_VIA_RHINE is not set
618
619#
620# Ethernet (1000 Mbit)
621#
622# CONFIG_ACENIC is not set
623# CONFIG_DL2K is not set
624CONFIG_E1000=y
625CONFIG_E1000_NAPI=y
626# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
627# CONFIG_NS83820 is not set
628# CONFIG_HAMACHI is not set
629# CONFIG_YELLOWFIN is not set
630# CONFIG_R8169 is not set
631# CONFIG_SIS190 is not set
632# CONFIG_SKGE is not set
633# CONFIG_SKY2 is not set
634# CONFIG_SK98LIN is not set
635# CONFIG_VIA_VELOCITY is not set
636# CONFIG_TIGON3 is not set
637# CONFIG_BNX2 is not set
638
639#
640# Ethernet (10000 Mbit)
641#
642# CONFIG_CHELSIO_T1 is not set
643# CONFIG_IXGB is not set
644# CONFIG_S2IO is not set
645
646#
647# Token Ring devices
648#
649# CONFIG_TR is not set
650
651#
652# Wireless LAN (non-hamradio)
653#
654# CONFIG_NET_RADIO is not set
655
656#
657# Wan interfaces
658#
659CONFIG_WAN=y
660# CONFIG_DSCC4 is not set
661# CONFIG_LANMEDIA is not set
662# CONFIG_SYNCLINK_SYNCPPP is not set
663CONFIG_HDLC=y
664CONFIG_HDLC_RAW=y
665# CONFIG_HDLC_RAW_ETH is not set
666CONFIG_HDLC_CISCO=y
667CONFIG_HDLC_FR=y
668CONFIG_HDLC_PPP=y
669
670#
671# X.25/LAPB support is disabled
672#
673# CONFIG_PCI200SYN is not set
674# CONFIG_WANXL is not set
675# CONFIG_PC300 is not set
676# CONFIG_FARSYNC is not set
677CONFIG_DLCI=y
678CONFIG_DLCI_COUNT=24
679CONFIG_DLCI_MAX=8
680# CONFIG_FDDI is not set
681# CONFIG_HIPPI is not set
682# CONFIG_PPP is not set
683# CONFIG_SLIP is not set
684# CONFIG_NET_FC is not set
685# CONFIG_SHAPER is not set
686# CONFIG_NETCONSOLE is not set
687# CONFIG_NETPOLL is not set
688# CONFIG_NET_POLL_CONTROLLER is not set
689
690#
691# ISDN subsystem
692#
693# CONFIG_ISDN is not set
694
695#
696# Input device support
697#
698CONFIG_INPUT=y
699
700#
701# Userland interfaces
702#
703CONFIG_INPUT_MOUSEDEV=y
704CONFIG_INPUT_MOUSEDEV_PSAUX=y
705CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
706CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
707# CONFIG_INPUT_JOYDEV is not set
708# CONFIG_INPUT_TSDEV is not set
709# CONFIG_INPUT_EVDEV is not set
710# CONFIG_INPUT_EVBUG is not set
711
712#
713# Input Device Drivers
714#
715# CONFIG_INPUT_KEYBOARD is not set
716# CONFIG_INPUT_MOUSE is not set
717# CONFIG_INPUT_JOYSTICK is not set
718# CONFIG_INPUT_TOUCHSCREEN is not set
719# CONFIG_INPUT_MISC is not set
720
721#
722# Hardware I/O ports
723#
724# CONFIG_SERIO is not set
725# CONFIG_GAMEPORT is not set
726
727#
728# Character devices
729#
730# CONFIG_VT is not set
731# CONFIG_SERIAL_NONSTANDARD is not set
732
733#
734# Serial drivers
735#
736CONFIG_SERIAL_8250=y
737CONFIG_SERIAL_8250_CONSOLE=y
738CONFIG_SERIAL_8250_NR_UARTS=4
739CONFIG_SERIAL_8250_RUNTIME_UARTS=4
740# CONFIG_SERIAL_8250_EXTENDED is not set
741
742#
743# Non-8250 serial port support
744#
745CONFIG_SERIAL_CORE=y
746CONFIG_SERIAL_CORE_CONSOLE=y
747# CONFIG_SERIAL_JSM is not set
748CONFIG_UNIX98_PTYS=y
749CONFIG_LEGACY_PTYS=y
750CONFIG_LEGACY_PTY_COUNT=256
751
752#
753# IPMI
754#
755# CONFIG_IPMI_HANDLER is not set
756
757#
758# Watchdog Cards
759#
760CONFIG_WATCHDOG=y
761# CONFIG_WATCHDOG_NOWAYOUT is not set
762
763#
764# Watchdog Device Drivers
765#
766# CONFIG_SOFT_WATCHDOG is not set
767
768#
769# PCI-based Watchdog Cards
770#
771# CONFIG_PCIPCWATCHDOG is not set
772# CONFIG_WDTPCI is not set
773
774#
775# USB-based Watchdog Cards
776#
777# CONFIG_USBPCWATCHDOG is not set
778# CONFIG_NVRAM is not set
779# CONFIG_RTC is not set
780# CONFIG_DTLK is not set
781# CONFIG_R3964 is not set
782# CONFIG_APPLICOM is not set
783
784#
785# Ftape, the floppy tape device driver
786#
787# CONFIG_DRM is not set
788# CONFIG_RAW_DRIVER is not set
789
790#
791# TPM devices
792#
793# CONFIG_TCG_TPM is not set
794# CONFIG_TELCLOCK is not set
795
796#
797# I2C support
798#
799CONFIG_I2C=y
800CONFIG_I2C_CHARDEV=y
801
802#
803# I2C Algorithms
804#
805CONFIG_I2C_ALGOBIT=y
806# CONFIG_I2C_ALGOPCF is not set
807# CONFIG_I2C_ALGOPCA is not set
808
809#
810# I2C Hardware Bus support
811#
812# CONFIG_I2C_ALI1535 is not set
813# CONFIG_I2C_ALI1563 is not set
814# CONFIG_I2C_ALI15X3 is not set
815# CONFIG_I2C_AMD756 is not set
816# CONFIG_I2C_AMD8111 is not set
817# CONFIG_I2C_I801 is not set
818# CONFIG_I2C_I810 is not set
819# CONFIG_I2C_PIIX4 is not set
820# CONFIG_I2C_NFORCE2 is not set
821# CONFIG_I2C_PARPORT_LIGHT is not set
822# CONFIG_I2C_PROSAVAGE is not set
823# CONFIG_I2C_SAVAGE4 is not set
824# CONFIG_SCx200_ACB is not set
825# CONFIG_I2C_SIS5595 is not set
826# CONFIG_I2C_SIS630 is not set
827# CONFIG_I2C_SIS96X is not set
828# CONFIG_I2C_STUB is not set
829# CONFIG_I2C_VIA is not set
830# CONFIG_I2C_VIAPRO is not set
831# CONFIG_I2C_VOODOO3 is not set
832# CONFIG_I2C_PCA_ISA is not set
833
834#
835# Miscellaneous I2C Chip support
836#
837# CONFIG_SENSORS_DS1337 is not set
838# CONFIG_SENSORS_DS1374 is not set
839CONFIG_SENSORS_EEPROM=y
840# CONFIG_SENSORS_PCF8574 is not set
841# CONFIG_SENSORS_PCA9539 is not set
842# CONFIG_SENSORS_PCF8591 is not set
843# CONFIG_SENSORS_RTC8564 is not set
844# CONFIG_SENSORS_MAX6875 is not set
845# CONFIG_RTC_X1205_I2C is not set
846# CONFIG_I2C_DEBUG_CORE is not set
847# CONFIG_I2C_DEBUG_ALGO is not set
848# CONFIG_I2C_DEBUG_BUS is not set
849# CONFIG_I2C_DEBUG_CHIP is not set
850
851#
852# SPI support
853#
854# CONFIG_SPI is not set
855# CONFIG_SPI_MASTER is not set
856
857#
858# Dallas's 1-wire bus
859#
860# CONFIG_W1 is not set
861
862#
863# Hardware Monitoring support
864#
865CONFIG_HWMON=y
866# CONFIG_HWMON_VID is not set
867# CONFIG_SENSORS_ADM1021 is not set
868# CONFIG_SENSORS_ADM1025 is not set
869# CONFIG_SENSORS_ADM1026 is not set
870# CONFIG_SENSORS_ADM1031 is not set
871# CONFIG_SENSORS_ADM9240 is not set
872# CONFIG_SENSORS_ASB100 is not set
873# CONFIG_SENSORS_ATXP1 is not set
874# CONFIG_SENSORS_DS1621 is not set
875# CONFIG_SENSORS_F71805F is not set
876# CONFIG_SENSORS_FSCHER is not set
877# CONFIG_SENSORS_FSCPOS is not set
878# CONFIG_SENSORS_GL518SM is not set
879# CONFIG_SENSORS_GL520SM is not set
880# CONFIG_SENSORS_IT87 is not set
881# CONFIG_SENSORS_LM63 is not set
882# CONFIG_SENSORS_LM75 is not set
883# CONFIG_SENSORS_LM77 is not set
884# CONFIG_SENSORS_LM78 is not set
885# CONFIG_SENSORS_LM80 is not set
886# CONFIG_SENSORS_LM83 is not set
887# CONFIG_SENSORS_LM85 is not set
888# CONFIG_SENSORS_LM87 is not set
889# CONFIG_SENSORS_LM90 is not set
890# CONFIG_SENSORS_LM92 is not set
891# CONFIG_SENSORS_MAX1619 is not set
892# CONFIG_SENSORS_PC87360 is not set
893# CONFIG_SENSORS_SIS5595 is not set
894# CONFIG_SENSORS_SMSC47M1 is not set
895# CONFIG_SENSORS_SMSC47B397 is not set
896# CONFIG_SENSORS_VIA686A is not set
897# CONFIG_SENSORS_VT8231 is not set
898# CONFIG_SENSORS_W83781D is not set
899# CONFIG_SENSORS_W83792D is not set
900# CONFIG_SENSORS_W83L785TS is not set
901# CONFIG_SENSORS_W83627HF is not set
902# CONFIG_SENSORS_W83627EHF is not set
903# CONFIG_HWMON_DEBUG_CHIP is not set
904
905#
906# Misc devices
907#
908
909#
910# Multimedia Capabilities Port drivers
911#
912
913#
914# Multimedia devices
915#
916# CONFIG_VIDEO_DEV is not set
917
918#
919# Digital Video Broadcasting Devices
920#
921# CONFIG_DVB is not set
922
923#
924# Graphics support
925#
926# CONFIG_FB is not set
927
928#
929# Sound
930#
931# CONFIG_SOUND is not set
932
933#
934# USB support
935#
936CONFIG_USB_ARCH_HAS_HCD=y
937CONFIG_USB_ARCH_HAS_OHCI=y
938CONFIG_USB=y
939# CONFIG_USB_DEBUG is not set
940
941#
942# Miscellaneous USB options
943#
944# CONFIG_USB_DEVICEFS is not set
945# CONFIG_USB_BANDWIDTH is not set
946# CONFIG_USB_DYNAMIC_MINORS is not set
947# CONFIG_USB_OTG is not set
948
949#
950# USB Host Controller Drivers
951#
952CONFIG_USB_EHCI_HCD=y
953# CONFIG_USB_EHCI_SPLIT_ISO is not set
954# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
955# CONFIG_USB_ISP116X_HCD is not set
956CONFIG_USB_OHCI_HCD=y
957# CONFIG_USB_OHCI_BIG_ENDIAN is not set
958CONFIG_USB_OHCI_LITTLE_ENDIAN=y
959CONFIG_USB_UHCI_HCD=y
960# CONFIG_USB_SL811_HCD is not set
961
962#
963# USB Device Class drivers
964#
965# CONFIG_USB_ACM is not set
966# CONFIG_USB_PRINTER is not set
967
968#
969# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
970#
971
972#
973# may also be needed; see USB_STORAGE Help for more information
974#
975CONFIG_USB_STORAGE=y
976# CONFIG_USB_STORAGE_DEBUG is not set
977# CONFIG_USB_STORAGE_DATAFAB is not set
978# CONFIG_USB_STORAGE_FREECOM is not set
979# CONFIG_USB_STORAGE_ISD200 is not set
980# CONFIG_USB_STORAGE_DPCM is not set
981# CONFIG_USB_STORAGE_USBAT is not set
982# CONFIG_USB_STORAGE_SDDR09 is not set
983# CONFIG_USB_STORAGE_SDDR55 is not set
984# CONFIG_USB_STORAGE_JUMPSHOT is not set
985# CONFIG_USB_STORAGE_ALAUDA is not set
986# CONFIG_USB_LIBUSUAL is not set
987
988#
989# USB Input Devices
990#
991# CONFIG_USB_HID is not set
992
993#
994# USB HID Boot Protocol drivers
995#
996# CONFIG_USB_KBD is not set
997# CONFIG_USB_MOUSE is not set
998# CONFIG_USB_AIPTEK is not set
999# CONFIG_USB_WACOM is not set
1000# CONFIG_USB_ACECAD is not set
1001# CONFIG_USB_KBTAB is not set
1002# CONFIG_USB_POWERMATE is not set
1003# CONFIG_USB_MTOUCH is not set
1004# CONFIG_USB_ITMTOUCH is not set
1005# CONFIG_USB_EGALAX is not set
1006# CONFIG_USB_YEALINK is not set
1007# CONFIG_USB_XPAD is not set
1008# CONFIG_USB_ATI_REMOTE is not set
1009# CONFIG_USB_ATI_REMOTE2 is not set
1010# CONFIG_USB_KEYSPAN_REMOTE is not set
1011# CONFIG_USB_APPLETOUCH is not set
1012
1013#
1014# USB Imaging devices
1015#
1016# CONFIG_USB_MDC800 is not set
1017# CONFIG_USB_MICROTEK is not set
1018
1019#
1020# USB Multimedia devices
1021#
1022# CONFIG_USB_DABUSB is not set
1023
1024#
1025# Video4Linux support is needed for USB Multimedia device support
1026#
1027
1028#
1029# USB Network Adapters
1030#
1031# CONFIG_USB_CATC is not set
1032# CONFIG_USB_KAWETH is not set
1033# CONFIG_USB_PEGASUS is not set
1034# CONFIG_USB_RTL8150 is not set
1035# CONFIG_USB_USBNET is not set
1036CONFIG_USB_MON=y
1037
1038#
1039# USB port drivers
1040#
1041
1042#
1043# USB Serial Converter support
1044#
1045# CONFIG_USB_SERIAL is not set
1046
1047#
1048# USB Miscellaneous drivers
1049#
1050# CONFIG_USB_EMI62 is not set
1051# CONFIG_USB_EMI26 is not set
1052# CONFIG_USB_AUERSWALD is not set
1053# CONFIG_USB_RIO500 is not set
1054# CONFIG_USB_LEGOTOWER is not set
1055# CONFIG_USB_LCD is not set
1056# CONFIG_USB_LED is not set
1057# CONFIG_USB_CYTHERM is not set
1058# CONFIG_USB_PHIDGETKIT is not set
1059# CONFIG_USB_PHIDGETSERVO is not set
1060# CONFIG_USB_IDMOUSE is not set
1061# CONFIG_USB_SISUSBVGA is not set
1062# CONFIG_USB_LD is not set
1063
1064#
1065# USB DSL modem support
1066#
1067
1068#
1069# USB Gadget Support
1070#
1071# CONFIG_USB_GADGET is not set
1072
1073#
1074# MMC/SD Card support
1075#
1076# CONFIG_MMC is not set
1077
1078#
1079# File systems
1080#
1081CONFIG_EXT2_FS=y
1082CONFIG_EXT2_FS_XATTR=y
1083CONFIG_EXT2_FS_POSIX_ACL=y
1084# CONFIG_EXT2_FS_SECURITY is not set
1085# CONFIG_EXT2_FS_XIP is not set
1086CONFIG_EXT3_FS=y
1087CONFIG_EXT3_FS_XATTR=y
1088CONFIG_EXT3_FS_POSIX_ACL=y
1089# CONFIG_EXT3_FS_SECURITY is not set
1090CONFIG_JBD=y
1091# CONFIG_JBD_DEBUG is not set
1092CONFIG_FS_MBCACHE=y
1093# CONFIG_REISERFS_FS is not set
1094# CONFIG_JFS_FS is not set
1095CONFIG_FS_POSIX_ACL=y
1096# CONFIG_XFS_FS is not set
1097# CONFIG_OCFS2_FS is not set
1098# CONFIG_MINIX_FS is not set
1099# CONFIG_ROMFS_FS is not set
1100CONFIG_INOTIFY=y
1101# CONFIG_QUOTA is not set
1102CONFIG_DNOTIFY=y
1103# CONFIG_AUTOFS_FS is not set
1104# CONFIG_AUTOFS4_FS is not set
1105# CONFIG_FUSE_FS is not set
1106
1107#
1108# CD-ROM/DVD Filesystems
1109#
1110# CONFIG_ISO9660_FS is not set
1111# CONFIG_UDF_FS is not set
1112
1113#
1114# DOS/FAT/NT Filesystems
1115#
1116CONFIG_FAT_FS=y
1117CONFIG_MSDOS_FS=y
1118# CONFIG_VFAT_FS is not set
1119CONFIG_FAT_DEFAULT_CODEPAGE=437
1120# CONFIG_NTFS_FS is not set
1121
1122#
1123# Pseudo filesystems
1124#
1125CONFIG_PROC_FS=y
1126CONFIG_SYSFS=y
1127CONFIG_TMPFS=y
1128# CONFIG_HUGETLB_PAGE is not set
1129CONFIG_RAMFS=y
1130# CONFIG_RELAYFS_FS is not set
1131# CONFIG_CONFIGFS_FS is not set
1132
1133#
1134# Miscellaneous filesystems
1135#
1136# CONFIG_ADFS_FS is not set
1137# CONFIG_AFFS_FS is not set
1138# CONFIG_HFS_FS is not set
1139# CONFIG_HFSPLUS_FS is not set
1140# CONFIG_BEFS_FS is not set
1141# CONFIG_BFS_FS is not set
1142# CONFIG_EFS_FS is not set
1143# CONFIG_JFFS_FS is not set
1144CONFIG_JFFS2_FS=y
1145CONFIG_JFFS2_FS_DEBUG=0
1146CONFIG_JFFS2_FS_WRITEBUFFER=y
1147# CONFIG_JFFS2_SUMMARY is not set
1148# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
1149CONFIG_JFFS2_ZLIB=y
1150CONFIG_JFFS2_RTIME=y
1151# CONFIG_JFFS2_RUBIN is not set
1152# CONFIG_CRAMFS is not set
1153# CONFIG_VXFS_FS is not set
1154# CONFIG_HPFS_FS is not set
1155# CONFIG_QNX4FS_FS is not set
1156# CONFIG_SYSV_FS is not set
1157# CONFIG_UFS_FS is not set
1158
1159#
1160# Network File Systems
1161#
1162CONFIG_NFS_FS=y
1163CONFIG_NFS_V3=y
1164# CONFIG_NFS_V3_ACL is not set
1165# CONFIG_NFS_V4 is not set
1166# CONFIG_NFS_DIRECTIO is not set
1167# CONFIG_NFSD is not set
1168CONFIG_ROOT_NFS=y
1169CONFIG_LOCKD=y
1170CONFIG_LOCKD_V4=y
1171CONFIG_NFS_COMMON=y
1172CONFIG_SUNRPC=y
1173# CONFIG_RPCSEC_GSS_KRB5 is not set
1174# CONFIG_RPCSEC_GSS_SPKM3 is not set
1175# CONFIG_SMB_FS is not set
1176# CONFIG_CIFS is not set
1177# CONFIG_NCP_FS is not set
1178# CONFIG_CODA_FS is not set
1179# CONFIG_AFS_FS is not set
1180# CONFIG_9P_FS is not set
1181
1182#
1183# Partition Types
1184#
1185CONFIG_PARTITION_ADVANCED=y
1186# CONFIG_ACORN_PARTITION is not set
1187# CONFIG_OSF_PARTITION is not set
1188# CONFIG_AMIGA_PARTITION is not set
1189# CONFIG_ATARI_PARTITION is not set
1190# CONFIG_MAC_PARTITION is not set
1191CONFIG_MSDOS_PARTITION=y
1192# CONFIG_BSD_DISKLABEL is not set
1193# CONFIG_MINIX_SUBPARTITION is not set
1194# CONFIG_SOLARIS_X86_PARTITION is not set
1195# CONFIG_UNIXWARE_DISKLABEL is not set
1196# CONFIG_LDM_PARTITION is not set
1197# CONFIG_SGI_PARTITION is not set
1198# CONFIG_ULTRIX_PARTITION is not set
1199# CONFIG_SUN_PARTITION is not set
1200# CONFIG_KARMA_PARTITION is not set
1201# CONFIG_EFI_PARTITION is not set
1202
1203#
1204# Native Language Support
1205#
1206CONFIG_NLS=y
1207CONFIG_NLS_DEFAULT="iso8859-1"
1208CONFIG_NLS_CODEPAGE_437=y
1209# CONFIG_NLS_CODEPAGE_737 is not set
1210# CONFIG_NLS_CODEPAGE_775 is not set
1211# CONFIG_NLS_CODEPAGE_850 is not set
1212# CONFIG_NLS_CODEPAGE_852 is not set
1213# CONFIG_NLS_CODEPAGE_855 is not set
1214# CONFIG_NLS_CODEPAGE_857 is not set
1215# CONFIG_NLS_CODEPAGE_860 is not set
1216# CONFIG_NLS_CODEPAGE_861 is not set
1217# CONFIG_NLS_CODEPAGE_862 is not set
1218# CONFIG_NLS_CODEPAGE_863 is not set
1219# CONFIG_NLS_CODEPAGE_864 is not set
1220# CONFIG_NLS_CODEPAGE_865 is not set
1221# CONFIG_NLS_CODEPAGE_866 is not set
1222# CONFIG_NLS_CODEPAGE_869 is not set
1223# CONFIG_NLS_CODEPAGE_936 is not set
1224# CONFIG_NLS_CODEPAGE_950 is not set
1225# CONFIG_NLS_CODEPAGE_932 is not set
1226# CONFIG_NLS_CODEPAGE_949 is not set
1227# CONFIG_NLS_CODEPAGE_874 is not set
1228# CONFIG_NLS_ISO8859_8 is not set
1229# CONFIG_NLS_CODEPAGE_1250 is not set
1230# CONFIG_NLS_CODEPAGE_1251 is not set
1231# CONFIG_NLS_ASCII is not set
1232# CONFIG_NLS_ISO8859_1 is not set
1233# CONFIG_NLS_ISO8859_2 is not set
1234# CONFIG_NLS_ISO8859_3 is not set
1235# CONFIG_NLS_ISO8859_4 is not set
1236# CONFIG_NLS_ISO8859_5 is not set
1237# CONFIG_NLS_ISO8859_6 is not set
1238# CONFIG_NLS_ISO8859_7 is not set
1239# CONFIG_NLS_ISO8859_9 is not set
1240# CONFIG_NLS_ISO8859_13 is not set
1241# CONFIG_NLS_ISO8859_14 is not set
1242# CONFIG_NLS_ISO8859_15 is not set
1243# CONFIG_NLS_KOI8_R is not set
1244# CONFIG_NLS_KOI8_U is not set
1245# CONFIG_NLS_UTF8 is not set
1246
1247#
1248# Profiling support
1249#
1250# CONFIG_PROFILING is not set
1251
1252#
1253# Kernel hacking
1254#
1255# CONFIG_PRINTK_TIME is not set
1256CONFIG_MAGIC_SYSRQ=y
1257CONFIG_DEBUG_KERNEL=y
1258CONFIG_LOG_BUF_SHIFT=14
1259CONFIG_DETECT_SOFTLOCKUP=y
1260# CONFIG_SCHEDSTATS is not set
1261# CONFIG_DEBUG_SLAB is not set
1262CONFIG_DEBUG_MUTEXES=y
1263# CONFIG_DEBUG_SPINLOCK is not set
1264# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1265# CONFIG_DEBUG_KOBJECT is not set
1266CONFIG_DEBUG_BUGVERBOSE=y
1267# CONFIG_DEBUG_INFO is not set
1268# CONFIG_DEBUG_FS is not set
1269# CONFIG_DEBUG_VM is not set
1270CONFIG_FRAME_POINTER=y
1271CONFIG_FORCED_INLINING=y
1272# CONFIG_RCU_TORTURE_TEST is not set
1273CONFIG_DEBUG_USER=y
1274# CONFIG_DEBUG_WAITQ is not set
1275CONFIG_DEBUG_ERRORS=y
1276CONFIG_DEBUG_LL=y
1277# CONFIG_DEBUG_ICEDCC is not set
1278
1279#
1280# Security options
1281#
1282# CONFIG_KEYS is not set
1283# CONFIG_SECURITY is not set
1284
1285#
1286# Cryptographic options
1287#
1288# CONFIG_CRYPTO is not set
1289
1290#
1291# Hardware crypto devices
1292#
1293
1294#
1295# Library routines
1296#
1297# CONFIG_CRC_CCITT is not set
1298# CONFIG_CRC16 is not set
1299CONFIG_CRC32=y
1300# CONFIG_LIBCRC32C is not set
1301CONFIG_ZLIB_INFLATE=y
1302CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 391f3ab3ff32..7b726b627ea5 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -18,7 +18,7 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \
18 18
19# the code in uaccess.S is not preemption safe and 19# the code in uaccess.S is not preemption safe and
20# probably faster on ARMv3 only 20# probably faster on ARMv3 only
21ifeq ($CONFIG_PREEMPT,y) 21ifeq ($(CONFIG_PREEMPT),y)
22 lib-y += copy_from_user.o copy_to_user.o 22 lib-y += copy_from_user.o copy_to_user.o
23else 23else
24ifneq ($(CONFIG_CPU_32v3),y) 24ifneq ($(CONFIG_CPU_32v3),y)
diff --git a/arch/arm/lib/copy_template.S b/arch/arm/lib/copy_template.S
index 838e435e4922..cab355c0c1f7 100644
--- a/arch/arm/lib/copy_template.S
+++ b/arch/arm/lib/copy_template.S
@@ -236,7 +236,7 @@
236 236
237 237
238/* 238/*
239 * Abort preanble and completion macros. 239 * Abort preamble and completion macros.
240 * If a fixup handler is required then those macros must surround it. 240 * If a fixup handler is required then those macros must surround it.
241 * It is assumed that the fixup code will handle the private part of 241 * It is assumed that the fixup code will handle the private part of
242 * the exit macro. 242 * the exit macro.
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 865427bfad7e..2d892e4daa07 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -30,7 +30,9 @@
30#include <linux/time.h> 30#include <linux/time.h>
31#include <linux/timex.h> 31#include <linux/timex.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/termios.h>
33#include <linux/amba/bus.h> 34#include <linux/amba/bus.h>
35#include <linux/amba/serial.h>
34 36
35#include <asm/types.h> 37#include <asm/types.h>
36#include <asm/setup.h> 38#include <asm/setup.h>
@@ -360,6 +362,68 @@ void __init ep93xx_init_irq(void)
360/************************************************************************* 362/*************************************************************************
361 * EP93xx peripheral handling 363 * EP93xx peripheral handling
362 *************************************************************************/ 364 *************************************************************************/
365#define EP93XX_UART_MCR_OFFSET (0x0100)
366
367static void ep93xx_uart_set_mctrl(struct amba_device *dev,
368 void __iomem *base, unsigned int mctrl)
369{
370 unsigned int mcr;
371
372 mcr = 0;
373 if (!(mctrl & TIOCM_RTS))
374 mcr |= 2;
375 if (!(mctrl & TIOCM_DTR))
376 mcr |= 1;
377
378 __raw_writel(mcr, base + EP93XX_UART_MCR_OFFSET);
379}
380
381static struct amba_pl010_data ep93xx_uart_data = {
382 .set_mctrl = ep93xx_uart_set_mctrl,
383};
384
385static struct amba_device uart1_device = {
386 .dev = {
387 .bus_id = "apb:uart1",
388 .platform_data = &ep93xx_uart_data,
389 },
390 .res = {
391 .start = EP93XX_UART1_PHYS_BASE,
392 .end = EP93XX_UART1_PHYS_BASE + 0x0fff,
393 .flags = IORESOURCE_MEM,
394 },
395 .irq = { IRQ_EP93XX_UART1, NO_IRQ },
396 .periphid = 0x00041010,
397};
398
399static struct amba_device uart2_device = {
400 .dev = {
401 .bus_id = "apb:uart2",
402 .platform_data = &ep93xx_uart_data,
403 },
404 .res = {
405 .start = EP93XX_UART2_PHYS_BASE,
406 .end = EP93XX_UART2_PHYS_BASE + 0x0fff,
407 .flags = IORESOURCE_MEM,
408 },
409 .irq = { IRQ_EP93XX_UART2, NO_IRQ },
410 .periphid = 0x00041010,
411};
412
413static struct amba_device uart3_device = {
414 .dev = {
415 .bus_id = "apb:uart3",
416 .platform_data = &ep93xx_uart_data,
417 },
418 .res = {
419 .start = EP93XX_UART3_PHYS_BASE,
420 .end = EP93XX_UART3_PHYS_BASE + 0x0fff,
421 .flags = IORESOURCE_MEM,
422 },
423 .irq = { IRQ_EP93XX_UART3, NO_IRQ },
424 .periphid = 0x00041010,
425};
426
363void __init ep93xx_init_devices(void) 427void __init ep93xx_init_devices(void)
364{ 428{
365 unsigned int v; 429 unsigned int v;
@@ -371,4 +435,8 @@ void __init ep93xx_init_devices(void)
371 v &= ~EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE; 435 v &= ~EP93XX_SYSCON_DEVICE_CONFIG_CRUNCH_ENABLE;
372 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); 436 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK);
373 __raw_writel(v, EP93XX_SYSCON_DEVICE_CONFIG); 437 __raw_writel(v, EP93XX_SYSCON_DEVICE_CONFIG);
438
439 amba_device_register(&uart1_device, &iomem_resource);
440 amba_device_register(&uart2_device, &iomem_resource);
441 amba_device_register(&uart3_device, &iomem_resource);
374} 442}
diff --git a/arch/arm/mach-footbridge/time.c b/arch/arm/mach-footbridge/time.c
index 2c64a0b0502e..5d02e95dede3 100644
--- a/arch/arm/mach-footbridge/time.c
+++ b/arch/arm/mach-footbridge/time.c
@@ -34,27 +34,12 @@ static int rtc_base;
34static unsigned long __init get_isa_cmos_time(void) 34static unsigned long __init get_isa_cmos_time(void)
35{ 35{
36 unsigned int year, mon, day, hour, min, sec; 36 unsigned int year, mon, day, hour, min, sec;
37 int i;
38 37
39 // check to see if the RTC makes sense..... 38 // check to see if the RTC makes sense.....
40 if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0) 39 if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0)
41 return mktime(1970, 1, 1, 0, 0, 0); 40 return mktime(1970, 1, 1, 0, 0, 0);
42 41
43 /* The Linux interpretation of the CMOS clock register contents: 42 do {
44 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
45 * RTC registers show the second which has precisely just started.
46 * Let's hope other operating systems interpret the RTC the same way.
47 */
48 /* read RTC exactly on falling edge of update flag */
49 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
50 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
51 break;
52
53 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
54 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
55 break;
56
57 do { /* Isn't this overkill ? UIP above should guarantee consistency */
58 sec = CMOS_READ(RTC_SECONDS); 43 sec = CMOS_READ(RTC_SECONDS);
59 min = CMOS_READ(RTC_MINUTES); 44 min = CMOS_READ(RTC_MINUTES);
60 hour = CMOS_READ(RTC_HOURS); 45 hour = CMOS_READ(RTC_HOURS);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 20071a2767cc..576a5e979c00 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -15,7 +15,9 @@
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/termios.h>
18#include <linux/amba/bus.h> 19#include <linux/amba/bus.h>
20#include <linux/amba/serial.h>
19 21
20#include <asm/hardware.h> 22#include <asm/hardware.h>
21#include <asm/irq.h> 23#include <asm/irq.h>
@@ -28,6 +30,8 @@
28 30
29#include "common.h" 31#include "common.h"
30 32
33static struct amba_pl010_data integrator_uart_data;
34
31static struct amba_device rtc_device = { 35static struct amba_device rtc_device = {
32 .dev = { 36 .dev = {
33 .bus_id = "mb:15", 37 .bus_id = "mb:15",
@@ -44,6 +48,7 @@ static struct amba_device rtc_device = {
44static struct amba_device uart0_device = { 48static struct amba_device uart0_device = {
45 .dev = { 49 .dev = {
46 .bus_id = "mb:16", 50 .bus_id = "mb:16",
51 .platform_data = &integrator_uart_data,
47 }, 52 },
48 .res = { 53 .res = {
49 .start = INTEGRATOR_UART0_BASE, 54 .start = INTEGRATOR_UART0_BASE,
@@ -57,6 +62,7 @@ static struct amba_device uart0_device = {
57static struct amba_device uart1_device = { 62static struct amba_device uart1_device = {
58 .dev = { 63 .dev = {
59 .bus_id = "mb:17", 64 .bus_id = "mb:17",
65 .platform_data = &integrator_uart_data,
60 }, 66 },
61 .res = { 67 .res = {
62 .start = INTEGRATOR_UART1_BASE, 68 .start = INTEGRATOR_UART1_BASE,
@@ -115,6 +121,46 @@ static int __init integrator_init(void)
115 121
116arch_initcall(integrator_init); 122arch_initcall(integrator_init);
117 123
124/*
125 * On the Integrator platform, the port RTS and DTR are provided by
126 * bits in the following SC_CTRLS register bits:
127 * RTS DTR
128 * UART0 7 6
129 * UART1 5 4
130 */
131#define SC_CTRLC (IO_ADDRESS(INTEGRATOR_SC_BASE) + INTEGRATOR_SC_CTRLC_OFFSET)
132#define SC_CTRLS (IO_ADDRESS(INTEGRATOR_SC_BASE) + INTEGRATOR_SC_CTRLS_OFFSET)
133
134static void integrator_uart_set_mctrl(struct amba_device *dev, void __iomem *base, unsigned int mctrl)
135{
136 unsigned int ctrls = 0, ctrlc = 0, rts_mask, dtr_mask;
137
138 if (dev == &uart0_device) {
139 rts_mask = 1 << 4;
140 dtr_mask = 1 << 5;
141 } else {
142 rts_mask = 1 << 6;
143 dtr_mask = 1 << 7;
144 }
145
146 if (mctrl & TIOCM_RTS)
147 ctrlc |= rts_mask;
148 else
149 ctrls |= rts_mask;
150
151 if (mctrl & TIOCM_DTR)
152 ctrlc |= dtr_mask;
153 else
154 ctrls |= dtr_mask;
155
156 __raw_writel(ctrls, SC_CTRLS);
157 __raw_writel(ctrlc, SC_CTRLC);
158}
159
160static struct amba_pl010_data integrator_uart_data = {
161 .set_mctrl = integrator_uart_set_mctrl,
162};
163
118#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET 164#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_BASE) + INTEGRATOR_HDR_CTRL_OFFSET
119 165
120static DEFINE_SPINLOCK(cm_lock); 166static DEFINE_SPINLOCK(cm_lock);
diff --git a/arch/arm/mach-integrator/time.c b/arch/arm/mach-integrator/time.c
index 3c22c16b38bf..bc07f52a6fd7 100644
--- a/arch/arm/mach-integrator/time.c
+++ b/arch/arm/mach-integrator/time.c
@@ -40,13 +40,13 @@ static int integrator_set_rtc(void)
40 return 1; 40 return 1;
41} 41}
42 42
43static int rtc_read_alarm(struct rtc_wkalrm *alrm) 43static int integrator_rtc_read_alarm(struct rtc_wkalrm *alrm)
44{ 44{
45 rtc_time_to_tm(readl(rtc_base + RTC_MR), &alrm->time); 45 rtc_time_to_tm(readl(rtc_base + RTC_MR), &alrm->time);
46 return 0; 46 return 0;
47} 47}
48 48
49static inline int rtc_set_alarm(struct rtc_wkalrm *alrm) 49static inline int integrator_rtc_set_alarm(struct rtc_wkalrm *alrm)
50{ 50{
51 unsigned long time; 51 unsigned long time;
52 int ret; 52 int ret;
@@ -62,7 +62,7 @@ static inline int rtc_set_alarm(struct rtc_wkalrm *alrm)
62 return ret; 62 return ret;
63} 63}
64 64
65static int rtc_read_time(struct rtc_time *tm) 65static int integrator_rtc_read_time(struct rtc_time *tm)
66{ 66{
67 rtc_time_to_tm(readl(rtc_base + RTC_DR), tm); 67 rtc_time_to_tm(readl(rtc_base + RTC_DR), tm);
68 return 0; 68 return 0;
@@ -76,7 +76,7 @@ static int rtc_read_time(struct rtc_time *tm)
76 * edge of the 1Hz clock, we must write the time one second 76 * edge of the 1Hz clock, we must write the time one second
77 * in advance. 77 * in advance.
78 */ 78 */
79static inline int rtc_set_time(struct rtc_time *tm) 79static inline int integrator_rtc_set_time(struct rtc_time *tm)
80{ 80{
81 unsigned long time; 81 unsigned long time;
82 int ret; 82 int ret;
@@ -90,10 +90,10 @@ static inline int rtc_set_time(struct rtc_time *tm)
90 90
91static struct rtc_ops rtc_ops = { 91static struct rtc_ops rtc_ops = {
92 .owner = THIS_MODULE, 92 .owner = THIS_MODULE,
93 .read_time = rtc_read_time, 93 .read_time = integrator_rtc_read_time,
94 .set_time = rtc_set_time, 94 .set_time = integrator_rtc_set_time,
95 .read_alarm = rtc_read_alarm, 95 .read_alarm = integrator_rtc_read_alarm,
96 .set_alarm = rtc_set_alarm, 96 .set_alarm = integrator_rtc_set_alarm,
97}; 97};
98 98
99static irqreturn_t arm_rtc_interrupt(int irq, void *dev_id, 99static irqreturn_t arm_rtc_interrupt(int irq, void *dev_id,
diff --git a/arch/arm/mach-ixp23xx/Kconfig b/arch/arm/mach-ixp23xx/Kconfig
new file mode 100644
index 000000000000..982670ec3866
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/Kconfig
@@ -0,0 +1,25 @@
1if ARCH_IXP23XX
2
3config ARCH_SUPPORTS_BIG_ENDIAN
4 bool
5 default y
6
7menu "Intel IXP23xx Implementation Options"
8
9comment "IXP23xx Platforms"
10
11config MACH_ESPRESSO
12 bool "Support IP Fabrics Double Espresso platform"
13 help
14
15config MACH_IXDP2351
16 bool "Support Intel IXDP2351 platform"
17 help
18
19config MACH_ROADRUNNER
20 bool "Support ADI RoadRunner platform"
21 help
22
23endmenu
24
25endif
diff --git a/arch/arm/mach-ixp23xx/Makefile b/arch/arm/mach-ixp23xx/Makefile
new file mode 100644
index 000000000000..288b371b6d03
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/Makefile
@@ -0,0 +1,11 @@
1#
2# Makefile for the linux kernel.
3#
4obj-y := core.o pci.o
5obj-m :=
6obj-n :=
7obj- :=
8
9obj-$(CONFIG_MACH_ESPRESSO) += espresso.o
10obj-$(CONFIG_MACH_IXDP2351) += ixdp2351.o
11obj-$(CONFIG_MACH_ROADRUNNER) += roadrunner.o
diff --git a/arch/arm/mach-ixp23xx/Makefile.boot b/arch/arm/mach-ixp23xx/Makefile.boot
new file mode 100644
index 000000000000..d5561ad15bad
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/Makefile.boot
@@ -0,0 +1,2 @@
1 zreladdr-y := 0x00008000
2params_phys-y := 0x00000100
diff --git a/arch/arm/mach-ixp23xx/core.c b/arch/arm/mach-ixp23xx/core.c
new file mode 100644
index 000000000000..092ee12ced42
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/core.c
@@ -0,0 +1,431 @@
1/*
2 * arch/arm/mach-ixp23xx/core.c
3 *
4 * Core routines for IXP23xx chips
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * Based on 2.4 code Copyright 2004 (c) Intel Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#include <linux/config.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/spinlock.h>
21#include <linux/sched.h>
22#include <linux/interrupt.h>
23#include <linux/serial.h>
24#include <linux/tty.h>
25#include <linux/bitops.h>
26#include <linux/serial.h>
27#include <linux/serial_8250.h>
28#include <linux/serial_core.h>
29#include <linux/device.h>
30#include <linux/mm.h>
31#include <linux/time.h>
32#include <linux/timex.h>
33
34#include <asm/types.h>
35#include <asm/setup.h>
36#include <asm/memory.h>
37#include <asm/hardware.h>
38#include <asm/mach-types.h>
39#include <asm/irq.h>
40#include <asm/system.h>
41#include <asm/tlbflush.h>
42#include <asm/pgtable.h>
43
44#include <asm/mach/map.h>
45#include <asm/mach/time.h>
46#include <asm/mach/irq.h>
47#include <asm/mach/arch.h>
48
49
50/*************************************************************************
51 * Chip specific mappings shared by all IXP23xx systems
52 *************************************************************************/
53static struct map_desc ixp23xx_io_desc[] __initdata = {
54 { /* XSI-CPP CSRs */
55 .virtual = IXP23XX_XSI2CPP_CSR_VIRT,
56 .pfn = __phys_to_pfn(IXP23XX_XSI2CPP_CSR_PHYS),
57 .length = IXP23XX_XSI2CPP_CSR_SIZE,
58 .type = MT_DEVICE,
59 }, { /* Expansion Bus Config */
60 .virtual = IXP23XX_EXP_CFG_VIRT,
61 .pfn = __phys_to_pfn(IXP23XX_EXP_CFG_PHYS),
62 .length = IXP23XX_EXP_CFG_SIZE,
63 .type = MT_DEVICE,
64 }, { /* UART, Interrupt ctrl, GPIO, timers, NPEs, MACS,.... */
65 .virtual = IXP23XX_PERIPHERAL_VIRT,
66 .pfn = __phys_to_pfn(IXP23XX_PERIPHERAL_PHYS),
67 .length = IXP23XX_PERIPHERAL_SIZE,
68 .type = MT_DEVICE,
69 }, { /* CAP CSRs */
70 .virtual = IXP23XX_CAP_CSR_VIRT,
71 .pfn = __phys_to_pfn(IXP23XX_CAP_CSR_PHYS),
72 .length = IXP23XX_CAP_CSR_SIZE,
73 .type = MT_DEVICE,
74 }, { /* MSF CSRs */
75 .virtual = IXP23XX_MSF_CSR_VIRT,
76 .pfn = __phys_to_pfn(IXP23XX_MSF_CSR_PHYS),
77 .length = IXP23XX_MSF_CSR_SIZE,
78 .type = MT_DEVICE,
79 }, { /* PCI I/O Space */
80 .virtual = IXP23XX_PCI_IO_VIRT,
81 .pfn = __phys_to_pfn(IXP23XX_PCI_IO_PHYS),
82 .length = IXP23XX_PCI_IO_SIZE,
83 .type = MT_DEVICE,
84 }, { /* PCI Config Space */
85 .virtual = IXP23XX_PCI_CFG_VIRT,
86 .pfn = __phys_to_pfn(IXP23XX_PCI_CFG_PHYS),
87 .length = IXP23XX_PCI_CFG_SIZE,
88 .type = MT_DEVICE,
89 }, { /* PCI local CFG CSRs */
90 .virtual = IXP23XX_PCI_CREG_VIRT,
91 .pfn = __phys_to_pfn(IXP23XX_PCI_CREG_PHYS),
92 .length = IXP23XX_PCI_CREG_SIZE,
93 .type = MT_DEVICE,
94 }, { /* PCI MEM Space */
95 .virtual = IXP23XX_PCI_MEM_VIRT,
96 .pfn = __phys_to_pfn(IXP23XX_PCI_MEM_PHYS),
97 .length = IXP23XX_PCI_MEM_SIZE,
98 .type = MT_DEVICE,
99 }
100};
101
102void __init ixp23xx_map_io(void)
103{
104 iotable_init(ixp23xx_io_desc, ARRAY_SIZE(ixp23xx_io_desc));
105}
106
107
108/***************************************************************************
109 * IXP23xx Interrupt Handling
110 ***************************************************************************/
111enum ixp23xx_irq_type {
112 IXP23XX_IRQ_LEVEL, IXP23XX_IRQ_EDGE
113};
114
115static void ixp23xx_config_irq(unsigned int, enum ixp23xx_irq_type);
116
117static int ixp23xx_irq_set_type(unsigned int irq, unsigned int type)
118{
119 int line = irq - IRQ_IXP23XX_GPIO6 + 6;
120 u32 int_style;
121 enum ixp23xx_irq_type irq_type;
122 volatile u32 *int_reg;
123
124 /*
125 * Only GPIOs 6-15 are wired to interrupts on IXP23xx
126 */
127 if (line < 6 || line > 15)
128 return -EINVAL;
129
130 switch (type) {
131 case IRQT_BOTHEDGE:
132 int_style = IXP23XX_GPIO_STYLE_TRANSITIONAL;
133 irq_type = IXP23XX_IRQ_EDGE;
134 break;
135 case IRQT_RISING:
136 int_style = IXP23XX_GPIO_STYLE_RISING_EDGE;
137 irq_type = IXP23XX_IRQ_EDGE;
138 break;
139 case IRQT_FALLING:
140 int_style = IXP23XX_GPIO_STYLE_FALLING_EDGE;
141 irq_type = IXP23XX_IRQ_EDGE;
142 break;
143 case IRQT_HIGH:
144 int_style = IXP23XX_GPIO_STYLE_ACTIVE_HIGH;
145 irq_type = IXP23XX_IRQ_LEVEL;
146 break;
147 case IRQT_LOW:
148 int_style = IXP23XX_GPIO_STYLE_ACTIVE_LOW;
149 irq_type = IXP23XX_IRQ_LEVEL;
150 break;
151 default:
152 return -EINVAL;
153 }
154
155 ixp23xx_config_irq(irq, irq_type);
156
157 if (line >= 8) { /* pins 8-15 */
158 line -= 8;
159 int_reg = (volatile u32 *)IXP23XX_GPIO_GPIT2R;
160 } else { /* pins 0-7 */
161 int_reg = (volatile u32 *)IXP23XX_GPIO_GPIT1R;
162 }
163
164 /*
165 * Clear pending interrupts
166 */
167 *IXP23XX_GPIO_GPISR = (1 << line);
168
169 /* Clear the style for the appropriate pin */
170 *int_reg &= ~(IXP23XX_GPIO_STYLE_MASK <<
171 (line * IXP23XX_GPIO_STYLE_SIZE));
172
173 /* Set the new style */
174 *int_reg |= (int_style << (line * IXP23XX_GPIO_STYLE_SIZE));
175
176 return 0;
177}
178
179static void ixp23xx_irq_mask(unsigned int irq)
180{
181 volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
182
183 *intr_reg &= ~(1 << (irq % 32));
184}
185
186static void ixp23xx_irq_ack(unsigned int irq)
187{
188 int line = irq - IRQ_IXP23XX_GPIO6 + 6;
189
190 if ((line < 6) || (line > 15))
191 return;
192
193 *IXP23XX_GPIO_GPISR = (1 << line);
194}
195
196/*
197 * Level triggered interrupts on GPIO lines can only be cleared when the
198 * interrupt condition disappears.
199 */
200static void ixp23xx_irq_level_unmask(unsigned int irq)
201{
202 volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
203
204 ixp23xx_irq_ack(irq);
205
206 *intr_reg |= (1 << (irq % 32));
207}
208
209static void ixp23xx_irq_edge_unmask(unsigned int irq)
210{
211 volatile unsigned long *intr_reg = IXP23XX_INTR_EN1 + (irq / 32);
212
213 *intr_reg |= (1 << (irq % 32));
214}
215
216static struct irqchip ixp23xx_irq_level_chip = {
217 .ack = ixp23xx_irq_mask,
218 .mask = ixp23xx_irq_mask,
219 .unmask = ixp23xx_irq_level_unmask,
220 .set_type = ixp23xx_irq_set_type
221};
222
223static struct irqchip ixp23xx_irq_edge_chip = {
224 .ack = ixp23xx_irq_ack,
225 .mask = ixp23xx_irq_mask,
226 .unmask = ixp23xx_irq_edge_unmask,
227 .set_type = ixp23xx_irq_set_type
228};
229
230static void ixp23xx_pci_irq_mask(unsigned int irq)
231{
232 *IXP23XX_PCI_XSCALE_INT_ENABLE &= ~(1 << (IRQ_IXP23XX_INTA + 27 - irq));
233}
234
235static void ixp23xx_pci_irq_unmask(unsigned int irq)
236{
237 *IXP23XX_PCI_XSCALE_INT_ENABLE |= (1 << (IRQ_IXP23XX_INTA + 27 - irq));
238}
239
240/*
241 * TODO: Should this just be done at ASM level?
242 */
243static void pci_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
244{
245 u32 pci_interrupt;
246 unsigned int irqno;
247 struct irqdesc *int_desc;
248
249 pci_interrupt = *IXP23XX_PCI_XSCALE_INT_STATUS;
250
251 desc->chip->ack(irq);
252
253 /* See which PCI_INTA, or PCI_INTB interrupted */
254 if (pci_interrupt & (1 << 26)) {
255 irqno = IRQ_IXP23XX_INTB;
256 } else if (pci_interrupt & (1 << 27)) {
257 irqno = IRQ_IXP23XX_INTA;
258 } else {
259 BUG();
260 }
261
262 int_desc = irq_desc + irqno;
263 int_desc->handle(irqno, int_desc, regs);
264
265 desc->chip->unmask(irq);
266}
267
268static struct irqchip ixp23xx_pci_irq_chip = {
269 .ack = ixp23xx_pci_irq_mask,
270 .mask = ixp23xx_pci_irq_mask,
271 .unmask = ixp23xx_pci_irq_unmask
272};
273
274static void ixp23xx_config_irq(unsigned int irq, enum ixp23xx_irq_type type)
275{
276 switch (type) {
277 case IXP23XX_IRQ_LEVEL:
278 set_irq_chip(irq, &ixp23xx_irq_level_chip);
279 set_irq_handler(irq, do_level_IRQ);
280 break;
281 case IXP23XX_IRQ_EDGE:
282 set_irq_chip(irq, &ixp23xx_irq_edge_chip);
283 set_irq_handler(irq, do_edge_IRQ);
284 break;
285 }
286 set_irq_flags(irq, IRQF_VALID);
287}
288
289void __init ixp23xx_init_irq(void)
290{
291 int irq;
292
293 /* Route everything to IRQ */
294 *IXP23XX_INTR_SEL1 = 0x0;
295 *IXP23XX_INTR_SEL2 = 0x0;
296 *IXP23XX_INTR_SEL3 = 0x0;
297 *IXP23XX_INTR_SEL4 = 0x0;
298
299 /* Mask all sources */
300 *IXP23XX_INTR_EN1 = 0x0;
301 *IXP23XX_INTR_EN2 = 0x0;
302 *IXP23XX_INTR_EN3 = 0x0;
303 *IXP23XX_INTR_EN4 = 0x0;
304
305 /*
306 * Configure all IRQs for level-sensitive operation
307 */
308 for (irq = 0; irq <= NUM_IXP23XX_RAW_IRQS; irq++) {
309 ixp23xx_config_irq(irq, IXP23XX_IRQ_LEVEL);
310 }
311
312 for (irq = IRQ_IXP23XX_INTA; irq <= IRQ_IXP23XX_INTB; irq++) {
313 set_irq_chip(irq, &ixp23xx_pci_irq_chip);
314 set_irq_handler(irq, do_level_IRQ);
315 set_irq_flags(irq, IRQF_VALID);
316 }
317
318 set_irq_chained_handler(IRQ_IXP23XX_PCI_INT_RPH, pci_handler);
319}
320
321
322/*************************************************************************
323 * Timer-tick functions for IXP23xx
324 *************************************************************************/
325#define CLOCK_TICKS_PER_USEC CLOCK_TICK_RATE / (USEC_PER_SEC)
326
327static unsigned long next_jiffy_time;
328
329static unsigned long
330ixp23xx_gettimeoffset(void)
331{
332 unsigned long elapsed;
333
334 elapsed = *IXP23XX_TIMER_CONT - (next_jiffy_time - LATCH);
335
336 return elapsed / CLOCK_TICKS_PER_USEC;
337}
338
339static irqreturn_t
340ixp23xx_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
341{
342 /* Clear Pending Interrupt by writing '1' to it */
343 *IXP23XX_TIMER_STATUS = IXP23XX_TIMER1_INT_PEND;
344 while ((*IXP23XX_TIMER_CONT - next_jiffy_time) > LATCH) {
345 timer_tick(regs);
346 next_jiffy_time += LATCH;
347 }
348
349 return IRQ_HANDLED;
350}
351
352static struct irqaction ixp23xx_timer_irq = {
353 .name = "IXP23xx Timer Tick",
354 .handler = ixp23xx_timer_interrupt,
355 .flags = SA_INTERRUPT | SA_TIMER,
356};
357
358void __init ixp23xx_init_timer(void)
359{
360 /* Clear Pending Interrupt by writing '1' to it */
361 *IXP23XX_TIMER_STATUS = IXP23XX_TIMER1_INT_PEND;
362
363 /* Setup the Timer counter value */
364 *IXP23XX_TIMER1_RELOAD =
365 (LATCH & ~IXP23XX_TIMER_RELOAD_MASK) | IXP23XX_TIMER_ENABLE;
366
367 *IXP23XX_TIMER_CONT = 0;
368 next_jiffy_time = LATCH;
369
370 /* Connect the interrupt handler and enable the interrupt */
371 setup_irq(IRQ_IXP23XX_TIMER1, &ixp23xx_timer_irq);
372}
373
374struct sys_timer ixp23xx_timer = {
375 .init = ixp23xx_init_timer,
376 .offset = ixp23xx_gettimeoffset,
377};
378
379
380/*************************************************************************
381 * IXP23xx Platform Initializaion
382 *************************************************************************/
383static struct resource ixp23xx_uart_resources[] = {
384 {
385 .start = IXP23XX_UART1_PHYS,
386 .end = IXP23XX_UART1_PHYS + 0x0fff,
387 .flags = IORESOURCE_MEM
388 }, {
389 .start = IXP23XX_UART2_PHYS,
390 .end = IXP23XX_UART2_PHYS + 0x0fff,
391 .flags = IORESOURCE_MEM
392 }
393};
394
395static struct plat_serial8250_port ixp23xx_uart_data[] = {
396 {
397 .mapbase = IXP23XX_UART1_PHYS,
398 .membase = (char *)(IXP23XX_UART1_VIRT + 3),
399 .irq = IRQ_IXP23XX_UART1,
400 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
401 .iotype = UPIO_MEM,
402 .regshift = 2,
403 .uartclk = IXP23XX_UART_XTAL,
404 }, {
405 .mapbase = IXP23XX_UART2_PHYS,
406 .membase = (char *)(IXP23XX_UART2_VIRT + 3),
407 .irq = IRQ_IXP23XX_UART2,
408 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
409 .iotype = UPIO_MEM,
410 .regshift = 2,
411 .uartclk = IXP23XX_UART_XTAL,
412 },
413 { },
414};
415
416static struct platform_device ixp23xx_uart = {
417 .name = "serial8250",
418 .id = 0,
419 .dev.platform_data = ixp23xx_uart_data,
420 .num_resources = 2,
421 .resource = ixp23xx_uart_resources,
422};
423
424static struct platform_device *ixp23xx_devices[] __initdata = {
425 &ixp23xx_uart,
426};
427
428void __init ixp23xx_sys_init(void)
429{
430 platform_add_devices(ixp23xx_devices, ARRAY_SIZE(ixp23xx_devices));
431}
diff --git a/arch/arm/mach-ixp23xx/espresso.c b/arch/arm/mach-ixp23xx/espresso.c
new file mode 100644
index 000000000000..2327c9790416
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/espresso.c
@@ -0,0 +1,69 @@
1/*
2 * arch/arm/mach-ixp23xx/espresso.c
3 *
4 * Double Espresso-specific routines
5 *
6 * Author: Lennert Buytenhek <buytenh@wantstofly.org>
7 *
8 * This file is licensed under the terms of the GNU General Public
9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied.
11 */
12
13#include <linux/config.h>
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/spinlock.h>
17#include <linux/sched.h>
18#include <linux/interrupt.h>
19#include <linux/serial.h>
20#include <linux/tty.h>
21#include <linux/bitops.h>
22#include <linux/ioport.h>
23#include <linux/serial.h>
24#include <linux/serial_8250.h>
25#include <linux/serial_core.h>
26#include <linux/device.h>
27#include <linux/mm.h>
28#include <linux/pci.h>
29#include <linux/mtd/physmap.h>
30
31#include <asm/types.h>
32#include <asm/setup.h>
33#include <asm/memory.h>
34#include <asm/hardware.h>
35#include <asm/mach-types.h>
36#include <asm/irq.h>
37#include <asm/system.h>
38#include <asm/tlbflush.h>
39#include <asm/pgtable.h>
40
41#include <asm/mach/map.h>
42#include <asm/mach/irq.h>
43#include <asm/mach/arch.h>
44#include <asm/mach/irq.h>
45#include <asm/mach/pci.h>
46
47static void __init espresso_init(void)
48{
49 physmap_configure(0x90000000, 0x02000000, 2, NULL);
50
51 /*
52 * Mark flash as writeable.
53 */
54 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
55 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
56
57 ixp23xx_sys_init();
58}
59
60MACHINE_START(ESPRESSO, "IP Fabrics Double Espresso")
61 /* Maintainer: Lennert Buytenhek */
62 .phys_io = IXP23XX_PERIPHERAL_PHYS,
63 .io_pg_offst = ((IXP23XX_PERIPHERAL_VIRT >> 18)) & 0xfffc,
64 .map_io = ixp23xx_map_io,
65 .init_irq = ixp23xx_init_irq,
66 .timer = &ixp23xx_timer,
67 .boot_params = 0x00000100,
68 .init_machine = espresso_init,
69MACHINE_END
diff --git a/arch/arm/mach-ixp23xx/ixdp2351.c b/arch/arm/mach-ixp23xx/ixdp2351.c
new file mode 100644
index 000000000000..00146c35daac
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/ixdp2351.c
@@ -0,0 +1,325 @@
1/*
2 * arch/arm/mach-ixp23xx/ixdp2351.c
3 *
4 * IXDP2351 board-specific routines
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * Based on 2.4 code Copyright 2004 (c) Intel Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#include <linux/config.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/spinlock.h>
21#include <linux/sched.h>
22#include <linux/interrupt.h>
23#include <linux/serial.h>
24#include <linux/tty.h>
25#include <linux/bitops.h>
26#include <linux/ioport.h>
27#include <linux/serial.h>
28#include <linux/serial_8250.h>
29#include <linux/serial_core.h>
30#include <linux/device.h>
31#include <linux/mm.h>
32#include <linux/pci.h>
33#include <linux/mtd/physmap.h>
34
35#include <asm/types.h>
36#include <asm/setup.h>
37#include <asm/memory.h>
38#include <asm/hardware.h>
39#include <asm/mach-types.h>
40#include <asm/irq.h>
41#include <asm/system.h>
42#include <asm/tlbflush.h>
43#include <asm/pgtable.h>
44
45#include <asm/mach/map.h>
46#include <asm/mach/irq.h>
47#include <asm/mach/arch.h>
48#include <asm/mach/irq.h>
49#include <asm/mach/pci.h>
50
51/*
52 * IXDP2351 Interrupt Handling
53 */
54static void ixdp2351_inta_mask(unsigned int irq)
55{
56 *IXDP2351_CPLD_INTA_MASK_SET_REG = IXDP2351_INTA_IRQ_MASK(irq);
57}
58
59static void ixdp2351_inta_unmask(unsigned int irq)
60{
61 *IXDP2351_CPLD_INTA_MASK_CLR_REG = IXDP2351_INTA_IRQ_MASK(irq);
62}
63
64static void ixdp2351_inta_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
65{
66 u16 ex_interrupt =
67 *IXDP2351_CPLD_INTA_STAT_REG & IXDP2351_INTA_IRQ_VALID;
68 int i;
69
70 desc->chip->mask(irq);
71
72 for (i = 0; i < IXDP2351_INTA_IRQ_NUM; i++) {
73 if (ex_interrupt & (1 << i)) {
74 struct irqdesc *cpld_desc;
75 int cpld_irq =
76 IXP23XX_MACH_IRQ(IXDP2351_INTA_IRQ_BASE + i);
77 cpld_desc = irq_desc + cpld_irq;
78 cpld_desc->handle(cpld_irq, cpld_desc, regs);
79 }
80 }
81
82 desc->chip->unmask(irq);
83}
84
85static struct irqchip ixdp2351_inta_chip = {
86 .ack = ixdp2351_inta_mask,
87 .mask = ixdp2351_inta_mask,
88 .unmask = ixdp2351_inta_unmask
89};
90
91static void ixdp2351_intb_mask(unsigned int irq)
92{
93 *IXDP2351_CPLD_INTB_MASK_SET_REG = IXDP2351_INTB_IRQ_MASK(irq);
94}
95
96static void ixdp2351_intb_unmask(unsigned int irq)
97{
98 *IXDP2351_CPLD_INTB_MASK_CLR_REG = IXDP2351_INTB_IRQ_MASK(irq);
99}
100
101static void ixdp2351_intb_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
102{
103 u16 ex_interrupt =
104 *IXDP2351_CPLD_INTB_STAT_REG & IXDP2351_INTB_IRQ_VALID;
105 int i;
106
107 desc->chip->ack(irq);
108
109 for (i = 0; i < IXDP2351_INTB_IRQ_NUM; i++) {
110 if (ex_interrupt & (1 << i)) {
111 struct irqdesc *cpld_desc;
112 int cpld_irq =
113 IXP23XX_MACH_IRQ(IXDP2351_INTB_IRQ_BASE + i);
114 cpld_desc = irq_desc + cpld_irq;
115 cpld_desc->handle(cpld_irq, cpld_desc, regs);
116 }
117 }
118
119 desc->chip->unmask(irq);
120}
121
122static struct irqchip ixdp2351_intb_chip = {
123 .ack = ixdp2351_intb_mask,
124 .mask = ixdp2351_intb_mask,
125 .unmask = ixdp2351_intb_unmask
126};
127
128void ixdp2351_init_irq(void)
129{
130 int irq;
131
132 /* Mask all interrupts from CPLD, disable simulation */
133 *IXDP2351_CPLD_INTA_MASK_SET_REG = (u16) -1;
134 *IXDP2351_CPLD_INTB_MASK_SET_REG = (u16) -1;
135 *IXDP2351_CPLD_INTA_SIM_REG = 0;
136 *IXDP2351_CPLD_INTB_SIM_REG = 0;
137
138 ixp23xx_init_irq();
139
140 for (irq = IXP23XX_MACH_IRQ(IXDP2351_INTA_IRQ_BASE);
141 irq <
142 IXP23XX_MACH_IRQ(IXDP2351_INTA_IRQ_BASE + IXDP2351_INTA_IRQ_NUM);
143 irq++) {
144 if (IXDP2351_INTA_IRQ_MASK(irq) & IXDP2351_INTA_IRQ_VALID) {
145 set_irq_flags(irq, IRQF_VALID);
146 set_irq_handler(irq, do_level_IRQ);
147 set_irq_chip(irq, &ixdp2351_inta_chip);
148 }
149 }
150
151 for (irq = IXP23XX_MACH_IRQ(IXDP2351_INTB_IRQ_BASE);
152 irq <
153 IXP23XX_MACH_IRQ(IXDP2351_INTB_IRQ_BASE + IXDP2351_INTB_IRQ_NUM);
154 irq++) {
155 if (IXDP2351_INTB_IRQ_MASK(irq) & IXDP2351_INTB_IRQ_VALID) {
156 set_irq_flags(irq, IRQF_VALID);
157 set_irq_handler(irq, do_level_IRQ);
158 set_irq_chip(irq, &ixdp2351_intb_chip);
159 }
160 }
161
162 set_irq_chained_handler(IRQ_IXP23XX_INTA, &ixdp2351_inta_handler);
163 set_irq_chained_handler(IRQ_IXP23XX_INTB, &ixdp2351_intb_handler);
164}
165
166/*
167 * IXDP2351 PCI
168 */
169
170/*
171 * This board does not do normal PCI IRQ routing, or any
172 * sort of swizzling, so we just need to check where on the
173 * bus the device is and figure out what CPLD pin it is
174 * being routed to.
175 */
176#define DEVPIN(dev, pin) ((pin) | ((dev) << 3))
177
178static int __init ixdp2351_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
179{
180 u8 bus = dev->bus->number;
181 u32 devpin = DEVPIN(PCI_SLOT(dev->devfn), pin);
182 struct pci_bus *tmp_bus = dev->bus;
183
184 /* Primary bus, no interrupts here */
185 if (!bus)
186 return -1;
187
188 /* Lookup first leaf in bus tree */
189 while ((tmp_bus->parent != NULL) && (tmp_bus->parent->parent != NULL))
190 tmp_bus = tmp_bus->parent;
191
192 /* Select between known bridges */
193 switch (tmp_bus->self->devfn | (tmp_bus->self->bus->number << 8)) {
194 /* Device is located after first bridge */
195 case 0x0008:
196 if (tmp_bus == dev->bus) {
197 /* Device is located directy after first bridge */
198 switch (devpin) {
199 /* Onboard 82546 */
200 case DEVPIN(1, 1): /* Onboard 82546 ch 0 */
201 return IRQ_IXDP2351_INTA_82546;
202 case DEVPIN(1, 2): /* Onboard 82546 ch 1 */
203 return IRQ_IXDP2351_INTB_82546;
204 /* PMC SLOT */
205 case DEVPIN(0, 1): /* PMCP INTA# */
206 case DEVPIN(2, 4): /* PMCS INTD# */
207 return IRQ_IXDP2351_SPCI_PMC_INTA;
208 case DEVPIN(0, 2): /* PMCP INTB# */
209 case DEVPIN(2, 1): /* PMCS INTA# */
210 return IRQ_IXDP2351_SPCI_PMC_INTB;
211 case DEVPIN(0, 3): /* PMCP INTC# */
212 case DEVPIN(2, 2): /* PMCS INTB# */
213 return IRQ_IXDP2351_SPCI_PMC_INTC;
214 case DEVPIN(0, 4): /* PMCP INTD# */
215 case DEVPIN(2, 3): /* PMCS INTC# */
216 return IRQ_IXDP2351_SPCI_PMC_INTD;
217 }
218 } else {
219 /* Device is located indirectly after first bridge */
220 /* Not supported now */
221 return -1;
222 }
223 break;
224 case 0x0010:
225 if (tmp_bus == dev->bus) {
226 /* Device is located directy after second bridge */
227 /* Secondary bus of second bridge */
228 switch (devpin) {
229 case DEVPIN(0, 1): /* DB#0 */
230 case DEVPIN(0, 2):
231 case DEVPIN(0, 3):
232 case DEVPIN(0, 4):
233 return IRQ_IXDP2351_SPCI_DB_0;
234 case DEVPIN(1, 1): /* DB#1 */
235 case DEVPIN(1, 2):
236 case DEVPIN(1, 3):
237 case DEVPIN(1, 4):
238 return IRQ_IXDP2351_SPCI_DB_1;
239 case DEVPIN(2, 1): /* FIC1 */
240 case DEVPIN(2, 2):
241 case DEVPIN(2, 3):
242 case DEVPIN(2, 4):
243 case DEVPIN(3, 1): /* FIC2 */
244 case DEVPIN(3, 2):
245 case DEVPIN(3, 3):
246 case DEVPIN(3, 4):
247 return IRQ_IXDP2351_SPCI_FIC;
248 }
249 } else {
250 /* Device is located indirectly after second bridge */
251 /* Not supported now */
252 return -1;
253 }
254 break;
255 }
256
257 return -1;
258}
259
260struct hw_pci ixdp2351_pci __initdata = {
261 .nr_controllers = 1,
262 .preinit = ixp23xx_pci_preinit,
263 .setup = ixp23xx_pci_setup,
264 .scan = ixp23xx_pci_scan_bus,
265 .map_irq = ixdp2351_map_irq,
266};
267
268int __init ixdp2351_pci_init(void)
269{
270 if (machine_is_ixdp2351())
271 pci_common_init(&ixdp2351_pci);
272
273 return 0;
274}
275
276subsys_initcall(ixdp2351_pci_init);
277
278/*
279 * IXDP2351 Static Mapped I/O
280 */
281static struct map_desc ixdp2351_io_desc[] __initdata = {
282 {
283 .virtual = IXDP2351_NP_VIRT_BASE,
284 .pfn = __phys_to_pfn((u64)IXDP2351_NP_PHYS_BASE),
285 .length = IXDP2351_NP_PHYS_SIZE,
286 .type = MT_DEVICE
287 }, {
288 .virtual = IXDP2351_BB_BASE_VIRT,
289 .pfn = __phys_to_pfn((u64)IXDP2351_BB_BASE_PHYS),
290 .length = IXDP2351_BB_SIZE,
291 .type = MT_DEVICE
292 }
293};
294
295static void __init ixdp2351_map_io(void)
296{
297 ixp23xx_map_io();
298 iotable_init(ixdp2351_io_desc, ARRAY_SIZE(ixdp2351_io_desc));
299}
300
301static void __init ixdp2351_init(void)
302{
303 physmap_configure(0x90000000, 0x04000000, 1, NULL);
304
305 /*
306 * Mark flash as writeable
307 */
308 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
309 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
310 IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;
311 IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;
312
313 ixp23xx_sys_init();
314}
315
316MACHINE_START(IXDP2351, "Intel IXDP2351 Development Platform")
317 /* Maintainer: MontaVista Software, Inc. */
318 .phys_io = IXP23XX_PERIPHERAL_PHYS,
319 .io_pg_offst = ((IXP23XX_PERIPHERAL_VIRT >> 18)) & 0xfffc,
320 .map_io = ixdp2351_map_io,
321 .init_irq = ixdp2351_init_irq,
322 .timer = &ixp23xx_timer,
323 .boot_params = 0x00000100,
324 .init_machine = ixdp2351_init,
325MACHINE_END
diff --git a/arch/arm/mach-ixp23xx/pci.c b/arch/arm/mach-ixp23xx/pci.c
new file mode 100644
index 000000000000..5330ad78c1bb
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/pci.c
@@ -0,0 +1,275 @@
1/*
2 * arch/arm/mach-ixp23xx/pci.c
3 *
4 * PCI routines for IXP23XX based systems
5 *
6 * Copyright (c) 2005 MontaVista Software, Inc.
7 *
8 * based on original code:
9 *
10 * Author: Naeem Afzal <naeem.m.afzal@intel.com>
11 * Copyright 2002-2005 Intel Corp.
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/sched.h>
21#include <linux/kernel.h>
22#include <linux/pci.h>
23#include <linux/interrupt.h>
24#include <linux/mm.h>
25#include <linux/init.h>
26#include <linux/ioport.h>
27#include <linux/slab.h>
28#include <linux/delay.h>
29
30#include <asm/io.h>
31#include <asm/irq.h>
32#include <asm/sizes.h>
33#include <asm/system.h>
34#include <asm/mach/pci.h>
35#include <asm/mach-types.h>
36#include <asm/hardware.h>
37
38extern int (*external_fault) (unsigned long, struct pt_regs *);
39
40static int pci_master_aborts = 0;
41
42#ifdef DEBUG
43#define DBG(x...) printk(x)
44#else
45#define DBG(x...)
46#endif
47
48int clear_master_aborts(void);
49
50static u32
51*ixp23xx_pci_config_addr(unsigned int bus_nr, unsigned int devfn, int where)
52{
53 u32 *paddress;
54
55 /*
56 * Must be dword aligned
57 */
58 where &= ~3;
59
60 /*
61 * For top bus, generate type 0, else type 1
62 */
63 if (!bus_nr) {
64 if (PCI_SLOT(devfn) >= 8)
65 return 0;
66
67 paddress = (u32 *) (IXP23XX_PCI_CFG0_VIRT
68 | (1 << (PCI_SLOT(devfn) + 16))
69 | (PCI_FUNC(devfn) << 8) | where);
70 } else {
71 paddress = (u32 *) (IXP23XX_PCI_CFG1_VIRT
72 | (bus_nr << 16)
73 | (PCI_SLOT(devfn) << 11)
74 | (PCI_FUNC(devfn) << 8) | where);
75 }
76
77 return paddress;
78}
79
80/*
81 * Mask table, bits to mask for quantity of size 1, 2 or 4 bytes.
82 * 0 and 3 are not valid indexes...
83 */
84static u32 bytemask[] = {
85 /*0*/ 0,
86 /*1*/ 0xff,
87 /*2*/ 0xffff,
88 /*3*/ 0,
89 /*4*/ 0xffffffff,
90};
91
92static int ixp23xx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
93 int where, int size, u32 *value)
94{
95 u32 n;
96 u32 *addr;
97
98 n = where % 4;
99
100 DBG("In config_read(%d) %d from dev %d:%d:%d\n", size, where,
101 bus->number, PCI_SLOT(devfn), PCI_FUNC(devfn));
102
103 addr = ixp23xx_pci_config_addr(bus->number, devfn, where);
104 if (!addr)
105 return PCIBIOS_DEVICE_NOT_FOUND;
106
107 pci_master_aborts = 0;
108 *value = (*addr >> (8*n)) & bytemask[size];
109 if (pci_master_aborts) {
110 pci_master_aborts = 0;
111 *value = 0xffffffff;
112 return PCIBIOS_DEVICE_NOT_FOUND;
113 }
114
115 return PCIBIOS_SUCCESSFUL;
116}
117
118/*
119 * We don't do error checking on the address for writes.
120 * It's assumed that the user checked for the device existing first
121 * by doing a read first.
122 */
123static int ixp23xx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
124 int where, int size, u32 value)
125{
126 u32 mask;
127 u32 *addr;
128 u32 temp;
129
130 mask = ~(bytemask[size] << ((where % 0x4) * 8));
131 addr = ixp23xx_pci_config_addr(bus->number, devfn, where);
132 if (!addr)
133 return PCIBIOS_DEVICE_NOT_FOUND;
134 temp = (u32) (value) << ((where % 0x4) * 8);
135 *addr = (*addr & mask) | temp;
136
137 clear_master_aborts();
138
139 return PCIBIOS_SUCCESSFUL;
140}
141
142struct pci_ops ixp23xx_pci_ops = {
143 .read = ixp23xx_pci_read_config,
144 .write = ixp23xx_pci_write_config,
145};
146
147struct pci_bus *ixp23xx_pci_scan_bus(int nr, struct pci_sys_data *sysdata)
148{
149 return pci_scan_bus(sysdata->busnr, &ixp23xx_pci_ops, sysdata);
150}
151
152int ixp23xx_pci_abort_handler(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
153{
154 volatile unsigned long temp;
155 unsigned long flags;
156
157 pci_master_aborts = 1;
158
159 local_irq_save(flags);
160 temp = *IXP23XX_PCI_CONTROL;
161
162 /*
163 * master abort and cmd tgt err
164 */
165 if (temp & ((1 << 8) | (1 << 5)))
166 *IXP23XX_PCI_CONTROL = temp;
167
168 temp = *IXP23XX_PCI_CMDSTAT;
169
170 if (temp & (1 << 29))
171 *IXP23XX_PCI_CMDSTAT = temp;
172 local_irq_restore(flags);
173
174 /*
175 * If it was an imprecise abort, then we need to correct the
176 * return address to be _after_ the instruction.
177 */
178 if (fsr & (1 << 10))
179 regs->ARM_pc += 4;
180
181 return 0;
182}
183
184int clear_master_aborts(void)
185{
186 volatile u32 temp;
187
188 temp = *IXP23XX_PCI_CONTROL;
189
190 /*
191 * master abort and cmd tgt err
192 */
193 if (temp & ((1 << 8) | (1 << 5)))
194 *IXP23XX_PCI_CONTROL = temp;
195
196 temp = *IXP23XX_PCI_CMDSTAT;
197
198 if (temp & (1 << 29))
199 *IXP23XX_PCI_CMDSTAT = temp;
200
201 return 0;
202}
203
204void __init ixp23xx_pci_preinit(void)
205{
206#ifdef __ARMEB__
207 *IXP23XX_PCI_CONTROL |= 0x20000; /* set I/O swapping */
208#endif
209 /*
210 * ADDR_31 needs to be clear for PCI memory access to CPP memory
211 */
212 *IXP23XX_CPP2XSI_CURR_XFER_REG3 &= ~IXP23XX_CPP2XSI_ADDR_31;
213 *IXP23XX_CPP2XSI_CURR_XFER_REG3 |= IXP23XX_CPP2XSI_PSH_OFF;
214
215 /*
216 * Select correct memory for PCI inbound transactions
217 */
218 if (ixp23xx_cpp_boot()) {
219 *IXP23XX_PCI_CPP_ADDR_BITS &= ~(1 << 1);
220 } else {
221 *IXP23XX_PCI_CPP_ADDR_BITS |= (1 << 1);
222 }
223
224 hook_fault_code(16+6, ixp23xx_pci_abort_handler, SIGBUS,
225 "PCI config cycle to non-existent device");
226
227 *IXP23XX_PCI_ADDR_EXT = 0x0000e000;
228}
229
230/*
231 * Prevent PCI layer from seeing the inbound host-bridge resources
232 */
233static void __devinit pci_fixup_ixp23xx(struct pci_dev *dev)
234{
235 int i;
236
237 dev->class &= 0xff;
238 dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
239 for (i = 0; i < PCI_NUM_RESOURCES; i++) {
240 dev->resource[i].start = 0;
241 dev->resource[i].end = 0;
242 dev->resource[i].flags = 0;
243 }
244}
245DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x9002, pci_fixup_ixp23xx);
246
247/*
248 * IXP2300 systems often have large resource requirements, so we just
249 * use our own resource space.
250 */
251static struct resource ixp23xx_pci_mem_space = {
252 .start = IXP23XX_PCI_MEM_START,
253 .end = IXP23XX_PCI_MEM_START + IXP23XX_PCI_MEM_SIZE - 1,
254 .flags = IORESOURCE_MEM,
255 .name = "PCI Mem Space"
256};
257
258static struct resource ixp23xx_pci_io_space = {
259 .start = 0x00000100,
260 .end = 0x01ffffff,
261 .flags = IORESOURCE_IO,
262 .name = "PCI I/O Space"
263};
264
265int ixp23xx_pci_setup(int nr, struct pci_sys_data *sys)
266{
267 if (nr >= 1)
268 return 0;
269
270 sys->resource[0] = &ixp23xx_pci_io_space;
271 sys->resource[1] = &ixp23xx_pci_mem_space;
272 sys->resource[2] = NULL;
273
274 return 1;
275}
diff --git a/arch/arm/mach-ixp23xx/roadrunner.c b/arch/arm/mach-ixp23xx/roadrunner.c
new file mode 100644
index 000000000000..43c14e740794
--- /dev/null
+++ b/arch/arm/mach-ixp23xx/roadrunner.c
@@ -0,0 +1,164 @@
1/*
2 * arch/arm/mach-ixp23xx/roadrunner.c
3 *
4 * RoadRunner board-specific routines
5 *
6 * Author: Deepak Saxena <dsaxena@plexity.net>
7 *
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * Based on 2.4 code Copyright 2005 (c) ADI Engineering Corporation
11 *
12 * This file is licensed under the terms of the GNU General Public
13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied.
15 */
16
17#include <linux/config.h>
18#include <linux/kernel.h>
19#include <linux/init.h>
20#include <linux/spinlock.h>
21#include <linux/sched.h>
22#include <linux/interrupt.h>
23#include <linux/serial.h>
24#include <linux/tty.h>
25#include <linux/bitops.h>
26#include <linux/ioport.h>
27#include <linux/serial.h>
28#include <linux/serial_8250.h>
29#include <linux/serial_core.h>
30#include <linux/device.h>
31#include <linux/mm.h>
32#include <linux/pci.h>
33#include <linux/mtd/physmap.h>
34
35#include <asm/types.h>
36#include <asm/setup.h>
37#include <asm/memory.h>
38#include <asm/hardware.h>
39#include <asm/mach-types.h>
40#include <asm/irq.h>
41#include <asm/system.h>
42#include <asm/tlbflush.h>
43#include <asm/pgtable.h>
44
45#include <asm/mach/map.h>
46#include <asm/mach/irq.h>
47#include <asm/mach/arch.h>
48#include <asm/mach/irq.h>
49#include <asm/mach/pci.h>
50
51/*
52 * Interrupt mapping
53 */
54#define INTA IRQ_ROADRUNNER_PCI_INTA
55#define INTB IRQ_ROADRUNNER_PCI_INTB
56#define INTC IRQ_ROADRUNNER_PCI_INTC
57#define INTD IRQ_ROADRUNNER_PCI_INTD
58
59#define INTC_PIN IXP23XX_GPIO_PIN_11
60#define INTD_PIN IXP23XX_GPIO_PIN_12
61
62static int __init roadrunner_map_irq(struct pci_dev *dev, u8 idsel, u8 pin)
63{
64 static int pci_card_slot_irq[] = {INTB, INTC, INTD, INTA};
65 static int pmc_card_slot_irq[] = {INTA, INTB, INTC, INTD};
66 static int usb_irq[] = {INTB, INTC, INTD, -1};
67 static int mini_pci_1_irq[] = {INTB, INTC, -1, -1};
68 static int mini_pci_2_irq[] = {INTC, INTD, -1, -1};
69
70 switch(dev->bus->number) {
71 case 0:
72 switch(dev->devfn) {
73 case 0x0: // PCI-PCI bridge
74 break;
75 case 0x8: // PCI Card Slot
76 return pci_card_slot_irq[pin - 1];
77 case 0x10: // PMC Slot
78 return pmc_card_slot_irq[pin - 1];
79 case 0x18: // PMC Slot Secondary Agent
80 break;
81 case 0x20: // IXP Processor
82 break;
83 default:
84 return NO_IRQ;
85 }
86 break;
87
88 case 1:
89 switch(dev->devfn) {
90 case 0x0: // IDE Controller
91 return (pin == 1) ? INTC : -1;
92 case 0x8: // USB fun 0
93 case 0x9: // USB fun 1
94 case 0xa: // USB fun 2
95 return usb_irq[pin - 1];
96 case 0x10: // Mini PCI 1
97 return mini_pci_1_irq[pin-1];
98 case 0x18: // Mini PCI 2
99 return mini_pci_2_irq[pin-1];
100 case 0x20: // MEM slot
101 return (pin == 1) ? INTA : -1;
102 default:
103 return NO_IRQ;
104 }
105 break;
106
107 default:
108 return NO_IRQ;
109 }
110
111 return NO_IRQ;
112}
113
114static void roadrunner_pci_preinit(void)
115{
116 set_irq_type(IRQ_ROADRUNNER_PCI_INTC, IRQT_LOW);
117 set_irq_type(IRQ_ROADRUNNER_PCI_INTD, IRQT_LOW);
118
119 ixp23xx_pci_preinit();
120}
121
122static struct hw_pci roadrunner_pci __initdata = {
123 .nr_controllers = 1,
124 .preinit = roadrunner_pci_preinit,
125 .setup = ixp23xx_pci_setup,
126 .scan = ixp23xx_pci_scan_bus,
127 .map_irq = roadrunner_map_irq,
128};
129
130static int __init roadrunner_pci_init(void)
131{
132 if (machine_is_roadrunner())
133 pci_common_init(&roadrunner_pci);
134
135 return 0;
136};
137
138subsys_initcall(roadrunner_pci_init);
139
140static void __init roadrunner_init(void)
141{
142 physmap_configure(0x90000000, 0x04000000, 2, NULL);
143
144 /*
145 * Mark flash as writeable
146 */
147 IXP23XX_EXP_CS0[0] |= IXP23XX_FLASH_WRITABLE;
148 IXP23XX_EXP_CS0[1] |= IXP23XX_FLASH_WRITABLE;
149 IXP23XX_EXP_CS0[2] |= IXP23XX_FLASH_WRITABLE;
150 IXP23XX_EXP_CS0[3] |= IXP23XX_FLASH_WRITABLE;
151
152 ixp23xx_sys_init();
153}
154
155MACHINE_START(ROADRUNNER, "ADI Engineering RoadRunner Development Platform")
156 /* Maintainer: Deepak Saxena */
157 .phys_io = IXP23XX_PERIPHERAL_PHYS,
158 .io_pg_offst = ((IXP23XX_PERIPHERAL_VIRT >> 18)) & 0xfffc,
159 .map_io = ixp23xx_map_io,
160 .init_irq = ixp23xx_init_irq,
161 .timer = &ixp23xx_timer,
162 .boot_params = 0x00000100,
163 .init_machine = roadrunner_init,
164MACHINE_END
diff --git a/arch/arm/mach-omap1/board-netstar.c b/arch/arm/mach-omap1/board-netstar.c
index 60d5f8a3339c..7520e602d7a2 100644
--- a/arch/arm/mach-omap1/board-netstar.c
+++ b/arch/arm/mach-omap1/board-netstar.c
@@ -141,7 +141,7 @@ static int __init netstar_late_init(void)
141 /* TODO: Setup front panel switch here */ 141 /* TODO: Setup front panel switch here */
142 142
143 /* Setup panic notifier */ 143 /* Setup panic notifier */
144 notifier_chain_register(&panic_notifier_list, &panic_block); 144 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
145 145
146 return 0; 146 return 0;
147} 147}
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index bfd5fdd1a875..52e4a9d69642 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -235,7 +235,7 @@ static struct notifier_block panic_block = {
235static int __init voiceblue_setup(void) 235static int __init voiceblue_setup(void)
236{ 236{
237 /* Setup panic notifier */ 237 /* Setup panic notifier */
238 notifier_chain_register(&panic_notifier_list, &panic_block); 238 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
239 239
240 return 0; 240 return 0;
241} 241}
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index c1d77f5b3823..0104fd142e70 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -10,6 +10,11 @@ config ARCH_LUBBOCK
10 select PXA25x 10 select PXA25x
11 select SA1111 11 select SA1111
12 12
13config MACH_LOGICPD_PXA270
14 bool "LogicPD PXA270 Card Engine Development Platform"
15 select PXA27x
16 select IWMMXT
17
13config MACH_MAINSTONE 18config MACH_MAINSTONE
14 bool "Intel HCDDBBVA0 Development Platform" 19 bool "Intel HCDDBBVA0 Development Platform"
15 select PXA27x 20 select PXA27x
diff --git a/arch/arm/mach-pxa/Makefile b/arch/arm/mach-pxa/Makefile
index 382644401a4d..4e8a983e2b83 100644
--- a/arch/arm/mach-pxa/Makefile
+++ b/arch/arm/mach-pxa/Makefile
@@ -9,6 +9,7 @@ obj-$(CONFIG_PXA27x) += pxa27x.o
9 9
10# Specific board support 10# Specific board support
11obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o 11obj-$(CONFIG_ARCH_LUBBOCK) += lubbock.o
12obj-$(CONFIG_MACH_LOGICPD_PXA270) += lpd270.o
12obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o 13obj-$(CONFIG_MACH_MAINSTONE) += mainstone.o
13obj-$(CONFIG_ARCH_PXA_IDP) += idp.o 14obj-$(CONFIG_ARCH_PXA_IDP) += idp.o
14obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o 15obj-$(CONFIG_PXA_SHARP_C7xx) += corgi.o corgi_ssp.o corgi_lcd.o sharpsl_pm.o corgi_pm.o
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index 9b48a90aefce..5efa84749f37 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -319,6 +319,11 @@ void __init pxa_set_ficp_info(struct pxaficp_platform_data *info)
319 pxaficp_device.dev.platform_data = info; 319 pxaficp_device.dev.platform_data = info;
320} 320}
321 321
322static struct platform_device pxartc_device = {
323 .name = "sa1100-rtc",
324 .id = -1,
325};
326
322static struct platform_device *devices[] __initdata = { 327static struct platform_device *devices[] __initdata = {
323 &pxamci_device, 328 &pxamci_device,
324 &udc_device, 329 &udc_device,
@@ -329,6 +334,7 @@ static struct platform_device *devices[] __initdata = {
329 &pxaficp_device, 334 &pxaficp_device,
330 &i2c_device, 335 &i2c_device,
331 &i2s_device, 336 &i2s_device,
337 &pxartc_device,
332}; 338};
333 339
334static int __init pxa_init(void) 340static int __init pxa_init(void)
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
new file mode 100644
index 000000000000..ec0f43a102c7
--- /dev/null
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -0,0 +1,393 @@
1/*
2 * linux/arch/arm/mach-pxa/lpd270.c
3 *
4 * Support for the LogicPD PXA270 Card Engine.
5 * Derived from the mainstone code, which carries these notices:
6 *
7 * Author: Nicolas Pitre
8 * Created: Nov 05, 2002
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#include <linux/init.h>
17#include <linux/platform_device.h>
18#include <linux/sysdev.h>
19#include <linux/interrupt.h>
20#include <linux/sched.h>
21#include <linux/bitops.h>
22#include <linux/fb.h>
23#include <linux/ioport.h>
24#include <linux/mtd/mtd.h>
25#include <linux/mtd/partitions.h>
26
27#include <asm/types.h>
28#include <asm/setup.h>
29#include <asm/memory.h>
30#include <asm/mach-types.h>
31#include <asm/hardware.h>
32#include <asm/irq.h>
33#include <asm/sizes.h>
34
35#include <asm/mach/arch.h>
36#include <asm/mach/map.h>
37#include <asm/mach/irq.h>
38#include <asm/mach/flash.h>
39
40#include <asm/arch/pxa-regs.h>
41#include <asm/arch/lpd270.h>
42#include <asm/arch/audio.h>
43#include <asm/arch/pxafb.h>
44#include <asm/arch/mmc.h>
45#include <asm/arch/irda.h>
46#include <asm/arch/ohci.h>
47
48#include "generic.h"
49
50
51static unsigned int lpd270_irq_enabled;
52
53static void lpd270_mask_irq(unsigned int irq)
54{
55 int lpd270_irq = irq - LPD270_IRQ(0);
56
57 __raw_writew(~(1 << lpd270_irq), LPD270_INT_STATUS);
58
59 lpd270_irq_enabled &= ~(1 << lpd270_irq);
60 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK);
61}
62
63static void lpd270_unmask_irq(unsigned int irq)
64{
65 int lpd270_irq = irq - LPD270_IRQ(0);
66
67 lpd270_irq_enabled |= 1 << lpd270_irq;
68 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK);
69}
70
71static struct irqchip lpd270_irq_chip = {
72 .ack = lpd270_mask_irq,
73 .mask = lpd270_mask_irq,
74 .unmask = lpd270_unmask_irq,
75};
76
77static void lpd270_irq_handler(unsigned int irq, struct irqdesc *desc,
78 struct pt_regs *regs)
79{
80 unsigned long pending;
81
82 pending = __raw_readw(LPD270_INT_STATUS) & lpd270_irq_enabled;
83 do {
84 GEDR(0) = GPIO_bit(0); /* clear useless edge notification */
85 if (likely(pending)) {
86 irq = LPD270_IRQ(0) + __ffs(pending);
87 desc = irq_desc + irq;
88 desc_handle_irq(irq, desc, regs);
89
90 pending = __raw_readw(LPD270_INT_STATUS) &
91 lpd270_irq_enabled;
92 }
93 } while (pending);
94}
95
96static void __init lpd270_init_irq(void)
97{
98 int irq;
99
100 pxa_init_irq();
101
102 __raw_writew(0, LPD270_INT_MASK);
103 __raw_writew(0, LPD270_INT_STATUS);
104
105 /* setup extra LogicPD PXA270 irqs */
106 for (irq = LPD270_IRQ(2); irq <= LPD270_IRQ(4); irq++) {
107 set_irq_chip(irq, &lpd270_irq_chip);
108 set_irq_handler(irq, do_level_IRQ);
109 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
110 }
111 set_irq_chained_handler(IRQ_GPIO(0), lpd270_irq_handler);
112 set_irq_type(IRQ_GPIO(0), IRQT_FALLING);
113}
114
115
116#ifdef CONFIG_PM
117static int lpd270_irq_resume(struct sys_device *dev)
118{
119 __raw_writew(lpd270_irq_enabled, LPD270_INT_MASK);
120 return 0;
121}
122
123static struct sysdev_class lpd270_irq_sysclass = {
124 set_kset_name("cpld_irq"),
125 .resume = lpd270_irq_resume,
126};
127
128static struct sys_device lpd270_irq_device = {
129 .cls = &lpd270_irq_sysclass,
130};
131
132static int __init lpd270_irq_device_init(void)
133{
134 int ret = sysdev_class_register(&lpd270_irq_sysclass);
135 if (ret == 0)
136 ret = sysdev_register(&lpd270_irq_device);
137 return ret;
138}
139
140device_initcall(lpd270_irq_device_init);
141#endif
142
143
144static struct resource smc91x_resources[] = {
145 [0] = {
146 .start = LPD270_ETH_PHYS,
147 .end = (LPD270_ETH_PHYS + 0xfffff),
148 .flags = IORESOURCE_MEM,
149 },
150 [1] = {
151 .start = LPD270_ETHERNET_IRQ,
152 .end = LPD270_ETHERNET_IRQ,
153 .flags = IORESOURCE_IRQ,
154 },
155};
156
157static struct platform_device smc91x_device = {
158 .name = "smc91x",
159 .id = 0,
160 .num_resources = ARRAY_SIZE(smc91x_resources),
161 .resource = smc91x_resources,
162};
163
164static struct platform_device lpd270_audio_device = {
165 .name = "pxa2xx-ac97",
166 .id = -1,
167};
168
169static struct resource lpd270_flash_resources[] = {
170 [0] = {
171 .start = PXA_CS0_PHYS,
172 .end = PXA_CS0_PHYS + SZ_64M - 1,
173 .flags = IORESOURCE_MEM,
174 },
175 [1] = {
176 .start = PXA_CS1_PHYS,
177 .end = PXA_CS1_PHYS + SZ_64M - 1,
178 .flags = IORESOURCE_MEM,
179 },
180};
181
182static struct mtd_partition lpd270_flash0_partitions[] = {
183 {
184 .name = "Bootloader",
185 .size = 0x00040000,
186 .offset = 0,
187 .mask_flags = MTD_WRITEABLE /* force read-only */
188 }, {
189 .name = "Kernel",
190 .size = 0x00400000,
191 .offset = 0x00040000,
192 }, {
193 .name = "Filesystem",
194 .size = MTDPART_SIZ_FULL,
195 .offset = 0x00440000
196 },
197};
198
199static struct flash_platform_data lpd270_flash_data[2] = {
200 {
201 .name = "processor-flash",
202 .map_name = "cfi_probe",
203 .parts = lpd270_flash0_partitions,
204 .nr_parts = ARRAY_SIZE(lpd270_flash0_partitions),
205 }, {
206 .name = "mainboard-flash",
207 .map_name = "cfi_probe",
208 .parts = NULL,
209 .nr_parts = 0,
210 }
211};
212
213static struct platform_device lpd270_flash_device[2] = {
214 {
215 .name = "pxa2xx-flash",
216 .id = 0,
217 .dev = {
218 .platform_data = &lpd270_flash_data[0],
219 },
220 .resource = &lpd270_flash_resources[0],
221 .num_resources = 1,
222 }, {
223 .name = "pxa2xx-flash",
224 .id = 1,
225 .dev = {
226 .platform_data = &lpd270_flash_data[1],
227 },
228 .resource = &lpd270_flash_resources[1],
229 .num_resources = 1,
230 },
231};
232
233static void lpd270_backlight_power(int on)
234{
235 if (on) {
236 pxa_gpio_mode(GPIO16_PWM0_MD);
237 pxa_set_cken(CKEN0_PWM0, 1);
238 PWM_CTRL0 = 0;
239 PWM_PWDUTY0 = 0x3ff;
240 PWM_PERVAL0 = 0x3ff;
241 } else {
242 PWM_CTRL0 = 0;
243 PWM_PWDUTY0 = 0x0;
244 PWM_PERVAL0 = 0x3FF;
245 pxa_set_cken(CKEN0_PWM0, 0);
246 }
247}
248
249/* 5.7" TFT QVGA (LoLo display number 1) */
250static struct pxafb_mach_info sharp_lq057q3dc02 __initdata = {
251 .pixclock = 100000,
252 .xres = 240,
253 .yres = 320,
254 .bpp = 16,
255 .hsync_len = 64,
256 .left_margin = 0x27,
257 .right_margin = 0x09,
258 .vsync_len = 0x04,
259 .upper_margin = 0x08,
260 .lower_margin = 0x14,
261 .sync = 0,
262 .lccr0 = 0x07800080,
263 .lccr3 = 0x04400007,
264 .pxafb_backlight_power = lpd270_backlight_power,
265};
266
267/* 6.4" TFT VGA (LoLo display number 5) */
268static struct pxafb_mach_info sharp_lq64d343 __initdata = {
269 .pixclock = 20000,
270 .xres = 640,
271 .yres = 480,
272 .bpp = 16,
273 .hsync_len = 49,
274 .left_margin = 0x89,
275 .right_margin = 0x19,
276 .vsync_len = 18,
277 .upper_margin = 0x22,
278 .lower_margin = 0,
279 .sync = FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
280 .lccr0 = 0x07800080,
281 .lccr3 = 0x04400001,
282 .pxafb_backlight_power = lpd270_backlight_power,
283};
284
285/* 3.5" TFT QVGA (LoLo display number 8) */
286static struct pxafb_mach_info sharp_lq035q7db02_20 __initdata = {
287 .pixclock = 100000,
288 .xres = 240,
289 .yres = 320,
290 .bpp = 16,
291 .hsync_len = 0x34,
292 .left_margin = 0x09,
293 .right_margin = 0x09,
294 .vsync_len = 0x08,
295 .upper_margin = 0x05,
296 .lower_margin = 0x14,
297 .sync = 0,
298 .lccr0 = 0x07800080,
299 .lccr3 = 0x04400007,
300 .pxafb_backlight_power = lpd270_backlight_power,
301};
302
303static struct platform_device *platform_devices[] __initdata = {
304 &smc91x_device,
305 &lpd270_audio_device,
306 &lpd270_flash_device[0],
307 &lpd270_flash_device[1],
308};
309
310static int lpd270_ohci_init(struct device *dev)
311{
312 /* setup Port1 GPIO pin. */
313 pxa_gpio_mode(88 | GPIO_ALT_FN_1_IN); /* USBHPWR1 */
314 pxa_gpio_mode(89 | GPIO_ALT_FN_2_OUT); /* USBHPEN1 */
315
316 /* Set the Power Control Polarity Low and Power Sense
317 Polarity Low to active low. */
318 UHCHR = (UHCHR | UHCHR_PCPL | UHCHR_PSPL) &
319 ~(UHCHR_SSEP1 | UHCHR_SSEP2 | UHCHR_SSEP3 | UHCHR_SSE);
320
321 return 0;
322}
323
324static struct pxaohci_platform_data lpd270_ohci_platform_data = {
325 .port_mode = PMM_PERPORT_MODE,
326 .init = lpd270_ohci_init,
327};
328
329static void __init lpd270_init(void)
330{
331 lpd270_flash_data[0].width = (BOOT_DEF & 1) ? 2 : 4;
332 lpd270_flash_data[1].width = 4;
333
334 /*
335 * System bus arbiter setting:
336 * - Core_Park
337 * - LCD_wt:DMA_wt:CORE_Wt = 2:3:4
338 */
339 ARB_CNTRL = ARB_CORE_PARK | 0x234;
340
341 /*
342 * On LogicPD PXA270, we route AC97_SYSCLK via GPIO45.
343 */
344 pxa_gpio_mode(GPIO45_SYSCLK_AC97_MD);
345
346 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
347
348 // set_pxa_fb_info(&sharp_lq057q3dc02);
349 set_pxa_fb_info(&sharp_lq64d343);
350 // set_pxa_fb_info(&sharp_lq035q7db02_20);
351
352 pxa_set_ohci_info(&lpd270_ohci_platform_data);
353}
354
355
356static struct map_desc lpd270_io_desc[] __initdata = {
357 {
358 .virtual = LPD270_CPLD_VIRT,
359 .pfn = __phys_to_pfn(LPD270_CPLD_PHYS),
360 .length = LPD270_CPLD_SIZE,
361 .type = MT_DEVICE,
362 },
363};
364
365static void __init lpd270_map_io(void)
366{
367 pxa_map_io();
368 iotable_init(lpd270_io_desc, ARRAY_SIZE(lpd270_io_desc));
369
370 /* initialize sleep mode regs (wake-up sources, etc) */
371 PGSR0 = 0x00008800;
372 PGSR1 = 0x00000002;
373 PGSR2 = 0x0001FC00;
374 PGSR3 = 0x00001F81;
375 PWER = 0xC0000002;
376 PRER = 0x00000002;
377 PFER = 0x00000002;
378
379 /* for use I SRAM as framebuffer. */
380 PSLR |= 0x00000F04;
381 PCFR = 0x00000066;
382}
383
384MACHINE_START(LOGICPD_PXA270, "LogicPD PXA270 Card Engine")
385 /* Maintainer: Peter Barada */
386 .phys_io = 0x40000000,
387 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
388 .boot_params = 0xa0000100,
389 .map_io = lpd270_map_io,
390 .init_irq = lpd270_init_irq,
391 .timer = &pxa_timer,
392 .init_machine = lpd270_init,
393MACHINE_END
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 30ec317bbb97..0dbb079ecd25 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -467,6 +467,8 @@ struct platform_device akitaioexp_device = {
467 .id = -1, 467 .id = -1,
468}; 468};
469 469
470EXPORT_SYMBOL_GPL(akitaioexp_device);
471
470static void __init akita_init(void) 472static void __init akita_init(void)
471{ 473{
472 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode; 474 spitz_ficp_platform_data.transceiver_mode = akita_irda_transceiver_mode;
diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
index 6923316b3d0d..cd67ab1b217b 100644
--- a/arch/arm/mach-sa1100/Kconfig
+++ b/arch/arm/mach-sa1100/Kconfig
@@ -111,7 +111,7 @@ config SA1100_LART
111 bool "LART" 111 bool "LART"
112 help 112 help
113 Say Y here if you are using the Linux Advanced Radio Terminal 113 Say Y here if you are using the Linux Advanced Radio Terminal
114 (also known as the LART). See <http://www.lart.tudelft.nl/> for 114 (also known as the LART). See <http://www.lartmaker.nl/> for
115 information on the LART. 115 information on the LART.
116 116
117config SA1100_PLEB 117config SA1100_PLEB
diff --git a/arch/arm/mach-sa1100/cpu-sa1100.c b/arch/arm/mach-sa1100/cpu-sa1100.c
index 6435b2e48ffa..d68630b74d78 100644
--- a/arch/arm/mach-sa1100/cpu-sa1100.c
+++ b/arch/arm/mach-sa1100/cpu-sa1100.c
@@ -11,7 +11,7 @@
11 * linux-2.4.5-rmk1 11 * linux-2.4.5-rmk1
12 * 12 *
13 * This software has been developed while working on the LART 13 * This software has been developed while working on the LART
14 * computing board (http://www.lart.tudelft.nl/), which is 14 * computing board (http://www.lartmaker.nl/), which is
15 * sponsored by the Mobile Multi-media Communications 15 * sponsored by the Mobile Multi-media Communications
16 * (http://www.mmc.tudelft.nl/) and Ubiquitous Communications 16 * (http://www.mmc.tudelft.nl/) and Ubiquitous Communications
17 * (http://www.ubicom.tudelft.nl/) projects. 17 * (http://www.ubicom.tudelft.nl/) projects.
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index 2abdc419e984..9ea71551fc04 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -324,6 +324,11 @@ void sa11x0_set_irda_data(struct irda_platform_data *irda)
324 sa11x0ir_device.dev.platform_data = irda; 324 sa11x0ir_device.dev.platform_data = irda;
325} 325}
326 326
327static struct platform_device sa11x0rtc_device = {
328 .name = "sa1100-rtc",
329 .id = -1,
330};
331
327static struct platform_device *sa11x0_devices[] __initdata = { 332static struct platform_device *sa11x0_devices[] __initdata = {
328 &sa11x0udc_device, 333 &sa11x0udc_device,
329 &sa11x0uart1_device, 334 &sa11x0uart1_device,
@@ -333,6 +338,7 @@ static struct platform_device *sa11x0_devices[] __initdata = {
333 &sa11x0pcmcia_device, 338 &sa11x0pcmcia_device,
334 &sa11x0fb_device, 339 &sa11x0fb_device,
335 &sa11x0mtd_device, 340 &sa11x0mtd_device,
341 &sa11x0rtc_device,
336}; 342};
337 343
338static int __init sa1100_init(void) 344static int __init sa1100_init(void)
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index e680c5fd93b5..c55b739e10ba 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -239,6 +239,17 @@ config CPU_XSCALE
239 select CPU_CACHE_VIVT 239 select CPU_CACHE_VIVT
240 select CPU_TLB_V4WBI 240 select CPU_TLB_V4WBI
241 241
242# XScale Core Version 3
243config CPU_XSC3
244 bool
245 depends on ARCH_IXP23XX
246 default y
247 select CPU_32v5
248 select CPU_ABRT_EV5T
249 select CPU_CACHE_VIVT
250 select CPU_TLB_V4WBI
251 select IO_36
252
242# ARMv6 253# ARMv6
243config CPU_V6 254config CPU_V6
244 bool "Support ARM V6 processor" 255 bool "Support ARM V6 processor"
@@ -361,11 +372,17 @@ config CPU_TLB_V4WBI
361config CPU_TLB_V6 372config CPU_TLB_V6
362 bool 373 bool
363 374
375#
376# CPU supports 36-bit I/O
377#
378config IO_36
379 bool
380
364comment "Processor Features" 381comment "Processor Features"
365 382
366config ARM_THUMB 383config ARM_THUMB
367 bool "Support Thumb user binaries" 384 bool "Support Thumb user binaries"
368 depends on CPU_ARM720T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || CPU_XSCALE || CPU_V6 385 depends on CPU_ARM720T || CPU_ARM920T || CPU_ARM922T || CPU_ARM925T || CPU_ARM926T || CPU_ARM1020 || CPU_ARM1020E || CPU_ARM1022 || CPU_ARM1026 || CPU_XSCALE || CPU_XSC3 || CPU_V6
369 default y 386 default y
370 help 387 help
371 Say Y if you want to include kernel support for running user space 388 Say Y if you want to include kernel support for running user space
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index ffe73ba2bf17..07a538505784 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -30,6 +30,7 @@ obj-$(CONFIG_CPU_COPY_V4WB) += copypage-v4wb.o
30obj-$(CONFIG_CPU_COPY_V6) += copypage-v6.o mmu.o 30obj-$(CONFIG_CPU_COPY_V6) += copypage-v6.o mmu.o
31obj-$(CONFIG_CPU_SA1100) += copypage-v4mc.o 31obj-$(CONFIG_CPU_SA1100) += copypage-v4mc.o
32obj-$(CONFIG_CPU_XSCALE) += copypage-xscale.o 32obj-$(CONFIG_CPU_XSCALE) += copypage-xscale.o
33obj-$(CONFIG_CPU_XSC3) += copypage-xsc3.o
33 34
34obj-$(CONFIG_CPU_TLB_V3) += tlb-v3.o 35obj-$(CONFIG_CPU_TLB_V3) += tlb-v3.o
35obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o 36obj-$(CONFIG_CPU_TLB_V4WT) += tlb-v4.o
@@ -51,4 +52,5 @@ obj-$(CONFIG_CPU_ARM1026) += proc-arm1026.o
51obj-$(CONFIG_CPU_SA110) += proc-sa110.o 52obj-$(CONFIG_CPU_SA110) += proc-sa110.o
52obj-$(CONFIG_CPU_SA1100) += proc-sa1100.o 53obj-$(CONFIG_CPU_SA1100) += proc-sa1100.o
53obj-$(CONFIG_CPU_XSCALE) += proc-xscale.o 54obj-$(CONFIG_CPU_XSCALE) += proc-xscale.o
55obj-$(CONFIG_CPU_XSC3) += proc-xsc3.o
54obj-$(CONFIG_CPU_V6) += proc-v6.o 56obj-$(CONFIG_CPU_V6) += proc-v6.o
diff --git a/arch/arm/mm/copypage-xsc3.S b/arch/arm/mm/copypage-xsc3.S
new file mode 100644
index 000000000000..9a2cb4332b4c
--- /dev/null
+++ b/arch/arm/mm/copypage-xsc3.S
@@ -0,0 +1,97 @@
1/*
2 * linux/arch/arm/lib/copypage-xsc3.S
3 *
4 * Copyright (C) 2004 Intel Corp.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Adapted for 3rd gen XScale core, no more mini-dcache
11 * Author: Matt Gilbert (matthew.m.gilbert@intel.com)
12 */
13
14#include <linux/linkage.h>
15#include <linux/init.h>
16#include <asm/asm-offsets.h>
17
18/*
19 * General note:
20 * We don't really want write-allocate cache behaviour for these functions
21 * since that will just eat through 8K of the cache.
22 */
23
24 .text
25 .align 5
26/*
27 * XSC3 optimised copy_user_page
28 * r0 = destination
29 * r1 = source
30 * r2 = virtual user address of ultimate destination page
31 *
32 * The source page may have some clean entries in the cache already, but we
33 * can safely ignore them - break_cow() will flush them out of the cache
34 * if we eventually end up using our copied page.
35 *
36 */
37ENTRY(xsc3_mc_copy_user_page)
38 stmfd sp!, {r4, r5, lr}
39 mov lr, #PAGE_SZ/64-1
40
41 pld [r1, #0]
42 pld [r1, #32]
431: pld [r1, #64]
44 pld [r1, #96]
45
462: ldrd r2, [r1], #8
47 mov ip, r0
48 ldrd r4, [r1], #8
49 mcr p15, 0, ip, c7, c6, 1 @ invalidate
50 strd r2, [r0], #8
51 ldrd r2, [r1], #8
52 strd r4, [r0], #8
53 ldrd r4, [r1], #8
54 strd r2, [r0], #8
55 strd r4, [r0], #8
56 ldrd r2, [r1], #8
57 mov ip, r0
58 ldrd r4, [r1], #8
59 mcr p15, 0, ip, c7, c6, 1 @ invalidate
60 strd r2, [r0], #8
61 ldrd r2, [r1], #8
62 subs lr, lr, #1
63 strd r4, [r0], #8
64 ldrd r4, [r1], #8
65 strd r2, [r0], #8
66 strd r4, [r0], #8
67 bgt 1b
68 beq 2b
69
70 ldmfd sp!, {r4, r5, pc}
71
72 .align 5
73/*
74 * XScale optimised clear_user_page
75 * r0 = destination
76 * r1 = virtual user address of ultimate destination page
77 */
78ENTRY(xsc3_mc_clear_user_page)
79 mov r1, #PAGE_SZ/32
80 mov r2, #0
81 mov r3, #0
821: mcr p15, 0, r0, c7, c6, 1 @ invalidate line
83 strd r2, [r0], #8
84 strd r2, [r0], #8
85 strd r2, [r0], #8
86 strd r2, [r0], #8
87 subs r1, r1, #1
88 bne 1b
89 mov pc, lr
90
91 __INITDATA
92
93 .type xsc3_mc_user_fns, #object
94ENTRY(xsc3_mc_user_fns)
95 .long xsc3_mc_clear_user_page
96 .long xsc3_mc_copy_user_page
97 .size xsc3_mc_user_fns, . - xsc3_mc_user_fns
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
index ef8d30a185a9..5e5d05bcad50 100644
--- a/arch/arm/mm/mm-armv.c
+++ b/arch/arm/mm/mm-armv.c
@@ -557,7 +557,8 @@ void __init create_mapping(struct map_desc *md)
557 * supersections are only allocated for domain 0 regardless 557 * supersections are only allocated for domain 0 regardless
558 * of the actual domain assignments in use. 558 * of the actual domain assignments in use.
559 */ 559 */
560 if (cpu_architecture() >= CPU_ARCH_ARMv6 && domain == 0) { 560 if ((cpu_architecture() >= CPU_ARCH_ARMv6 || cpu_is_xsc3())
561 && domain == 0) {
561 /* 562 /*
562 * Align to supersection boundary if !high pages. 563 * Align to supersection boundary if !high pages.
563 * High pages have already been checked for proper 564 * High pages have already been checked for proper
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 9a7e7c096aa9..ee6f15298735 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -21,6 +21,14 @@
21 21
22#define D_CACHE_LINE_SIZE 32 22#define D_CACHE_LINE_SIZE 32
23 23
24#define TTB_C (1 << 0)
25#define TTB_S (1 << 1)
26#define TTB_IMP (1 << 2)
27#define TTB_RGN_NC (0 << 3)
28#define TTB_RGN_WBWA (1 << 3)
29#define TTB_RGN_WT (2 << 3)
30#define TTB_RGN_WB (3 << 3)
31
24 .macro cpsie, flags 32 .macro cpsie, flags
25 .ifc \flags, f 33 .ifc \flags, f
26 .long 0xf1080040 34 .long 0xf1080040
@@ -115,7 +123,7 @@ ENTRY(cpu_v6_switch_mm)
115 mov r2, #0 123 mov r2, #0
116 ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id 124 ldr r1, [r1, #MM_CONTEXT_ID] @ get mm->context.id
117#ifdef CONFIG_SMP 125#ifdef CONFIG_SMP
118 orr r0, r0, #2 @ set shared pgtable 126 orr r0, r0, #TTB_RGN_WBWA|TTB_S @ mark PTWs shared, outer cacheable
119#endif 127#endif
120 mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB 128 mcr p15, 0, r2, c7, c5, 6 @ flush BTAC/BTB
121 mcr p15, 0, r2, c7, c10, 4 @ drain write buffer 129 mcr p15, 0, r2, c7, c10, 4 @ drain write buffer
@@ -161,8 +169,8 @@ ENTRY(cpu_v6_set_pte)
161 tst r1, #L_PTE_YOUNG 169 tst r1, #L_PTE_YOUNG
162 biceq r2, r2, #PTE_EXT_APX | PTE_EXT_AP_MASK 170 biceq r2, r2, #PTE_EXT_APX | PTE_EXT_AP_MASK
163 171
164@ tst r1, #L_PTE_EXEC 172 tst r1, #L_PTE_EXEC
165@ orreq r2, r2, #PTE_EXT_XN 173 orreq r2, r2, #PTE_EXT_XN
166 174
167 tst r1, #L_PTE_PRESENT 175 tst r1, #L_PTE_PRESENT
168 moveq r2, #0 176 moveq r2, #0
@@ -221,7 +229,7 @@ __v6_setup:
221 mcr p15, 0, r0, c8, c7, 0 @ invalidate I + D TLBs 229 mcr p15, 0, r0, c8, c7, 0 @ invalidate I + D TLBs
222 mcr p15, 0, r0, c2, c0, 2 @ TTB control register 230 mcr p15, 0, r0, c2, c0, 2 @ TTB control register
223#ifdef CONFIG_SMP 231#ifdef CONFIG_SMP
224 orr r4, r4, #2 @ set shared pgtable 232 orr r4, r4, #TTB_RGN_WBWA|TTB_S @ mark PTWs shared, outer cacheable
225#endif 233#endif
226 mcr p15, 0, r4, c2, c0, 1 @ load TTB1 234 mcr p15, 0, r4, c2, c0, 1 @ load TTB1
227#ifdef CONFIG_VFP 235#ifdef CONFIG_VFP
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
new file mode 100644
index 000000000000..f90513e9af0c
--- /dev/null
+++ b/arch/arm/mm/proc-xsc3.S
@@ -0,0 +1,498 @@
1/*
2 * linux/arch/arm/mm/proc-xsc3.S
3 *
4 * Original Author: Matthew Gilbert
5 * Current Maintainer: Deepak Saxena <dsaxena@plexity.net>
6 *
7 * Copyright 2004 (C) Intel Corp.
8 * Copyright 2005 (c) MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * MMU functions for the Intel XScale3 Core (XSC3). The XSC3 core is an
15 * extension to Intel's original XScale core that adds the following
16 * features:
17 *
18 * - ARMv6 Supersections
19 * - Low Locality Reference pages (replaces mini-cache)
20 * - 36-bit addressing
21 * - L2 cache
22 * - Cache-coherency if chipset supports it
23 *
24 * Based on orignal XScale code by Nicolas Pitre
25 */
26
27#include <linux/linkage.h>
28#include <linux/init.h>
29#include <asm/assembler.h>
30#include <asm/procinfo.h>
31#include <asm/hardware.h>
32#include <asm/pgtable.h>
33#include <asm/page.h>
34#include <asm/ptrace.h>
35#include "proc-macros.S"
36
37/*
38 * This is the maximum size of an area which will be flushed. If the
39 * area is larger than this, then we flush the whole cache.
40 */
41#define MAX_AREA_SIZE 32768
42
43/*
44 * The cache line size of the I and D cache.
45 */
46#define CACHELINESIZE 32
47
48/*
49 * The size of the data cache.
50 */
51#define CACHESIZE 32768
52
53/*
54 * Run with L2 enabled.
55 */
56#define L2_CACHE_ENABLE 1
57
58/*
59 * Enable the Branch Target Buffer (can cause crashes, see erratum #42.)
60 */
61#define BTB_ENABLE 0
62
63/*
64 * This macro is used to wait for a CP15 write and is needed
65 * when we have to ensure that the last operation to the co-pro
66 * was completed before continuing with operation.
67 */
68 .macro cpwait_ret, lr, rd
69 mrc p15, 0, \rd, c2, c0, 0 @ arbitrary read of cp15
70 sub pc, \lr, \rd, LSR #32 @ wait for completion and
71 @ flush instruction pipeline
72 .endm
73
74/*
75 * This macro cleans & invalidates the entire xsc3 dcache by set & way.
76 */
77
78 .macro clean_d_cache rd, rs
79 mov \rd, #0x1f00
80 orr \rd, \rd, #0x00e0
811: mcr p15, 0, \rd, c7, c14, 2 @ clean/inv set/way
82 adds \rd, \rd, #0x40000000
83 bcc 1b
84 subs \rd, \rd, #0x20
85 bpl 1b
86 .endm
87
88 .text
89
90/*
91 * cpu_xsc3_proc_init()
92 *
93 * Nothing too exciting at the moment
94 */
95ENTRY(cpu_xsc3_proc_init)
96 mov pc, lr
97
98/*
99 * cpu_xsc3_proc_fin()
100 */
101ENTRY(cpu_xsc3_proc_fin)
102 str lr, [sp, #-4]!
103 mov r0, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
104 msr cpsr_c, r0
105 bl xsc3_flush_kern_cache_all @ clean caches
106 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
107 bic r0, r0, #0x1800 @ ...IZ...........
108 bic r0, r0, #0x0006 @ .............CA.
109 mcr p15, 0, r0, c1, c0, 0 @ disable caches
110 ldr pc, [sp], #4
111
112/*
113 * cpu_xsc3_reset(loc)
114 *
115 * Perform a soft reset of the system. Put the CPU into the
116 * same state as it would be if it had been reset, and branch
117 * to what would be the reset vector.
118 *
119 * loc: location to jump to for soft reset
120 */
121 .align 5
122ENTRY(cpu_xsc3_reset)
123 mov r1, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
124 msr cpsr_c, r1 @ reset CPSR
125 mrc p15, 0, r1, c1, c0, 0 @ ctrl register
126 bic r1, r1, #0x0086 @ ........B....CA.
127 bic r1, r1, #0x3900 @ ..VIZ..S........
128 mcr p15, 0, r1, c1, c0, 0 @ ctrl register
129 mcr p15, 0, ip, c7, c7, 0 @ invalidate I,D caches & BTB
130 bic r1, r1, #0x0001 @ ...............M
131 mcr p15, 0, r1, c1, c0, 0 @ ctrl register
132 @ CAUTION: MMU turned off from this point. We count on the pipeline
133 @ already containing those two last instructions to survive.
134 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
135 mov pc, r0
136
137/*
138 * cpu_xsc3_do_idle()
139 *
140 * Cause the processor to idle
141 *
142 * For now we do nothing but go to idle mode for every case
143 *
144 * XScale supports clock switching, but using idle mode support
145 * allows external hardware to react to system state changes.
146
147 MMG: Come back to this one.
148 */
149 .align 5
150
151ENTRY(cpu_xsc3_do_idle)
152 mov r0, #1
153 mcr p14, 0, r0, c7, c0, 0 @ Go to IDLE
154 mov pc, lr
155
156/* ================================= CACHE ================================ */
157
158/*
159 * flush_user_cache_all()
160 *
161 * Invalidate all cache entries in a particular address
162 * space.
163 */
164ENTRY(xsc3_flush_user_cache_all)
165 /* FALLTHROUGH */
166
167/*
168 * flush_kern_cache_all()
169 *
170 * Clean and invalidate the entire cache.
171 */
172ENTRY(xsc3_flush_kern_cache_all)
173 mov r2, #VM_EXEC
174 mov ip, #0
175__flush_whole_cache:
176 clean_d_cache r0, r1
177 tst r2, #VM_EXEC
178 mcrne p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB
179 mcrne p15, 0, ip, c7, c10, 4 @ Drain Write Buffer
180 mcrne p15, 0, ip, c7, c5, 4 @ Prefetch Flush
181 mov pc, lr
182
183/*
184 * flush_user_cache_range(start, end, vm_flags)
185 *
186 * Invalidate a range of cache entries in the specified
187 * address space.
188 *
189 * - start - start address (may not be aligned)
190 * - end - end address (exclusive, may not be aligned)
191 * - vma - vma_area_struct describing address space
192 */
193 .align 5
194ENTRY(xsc3_flush_user_cache_range)
195 mov ip, #0
196 sub r3, r1, r0 @ calculate total size
197 cmp r3, #MAX_AREA_SIZE
198 bhs __flush_whole_cache
199
2001: tst r2, #VM_EXEC
201 mcrne p15, 0, r0, c7, c5, 1 @ Invalidate I cache line
202 mcr p15, 0, r0, c7, c14, 1 @ Clean/invalidate D cache line
203 add r0, r0, #CACHELINESIZE
204 cmp r0, r1
205 blo 1b
206 tst r2, #VM_EXEC
207 mcrne p15, 0, ip, c7, c5, 6 @ Invalidate BTB
208 mcrne p15, 0, ip, c7, c10, 4 @ Drain Write Buffer
209 mcrne p15, 0, ip, c7, c5, 4 @ Prefetch Flush
210 mov pc, lr
211
212/*
213 * coherent_kern_range(start, end)
214 *
215 * Ensure coherency between the Icache and the Dcache in the
216 * region described by start. If you have non-snooping
217 * Harvard caches, you need to implement this function.
218 *
219 * - start - virtual start address
220 * - end - virtual end address
221 *
222 * Note: single I-cache line invalidation isn't used here since
223 * it also trashes the mini I-cache used by JTAG debuggers.
224 */
225ENTRY(xsc3_coherent_kern_range)
226/* FALLTHROUGH */
227ENTRY(xsc3_coherent_user_range)
228 bic r0, r0, #CACHELINESIZE - 1
2291: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
230 add r0, r0, #CACHELINESIZE
231 cmp r0, r1
232 blo 1b
233 mov r0, #0
234 mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
235 mcr p15, 0, r0, c7, c10, 4 @ Drain Write Buffer
236 mcr p15, 0, r0, c7, c5, 4 @ Prefetch Flush
237 mov pc, lr
238
239/*
240 * flush_kern_dcache_page(void *page)
241 *
242 * Ensure no D cache aliasing occurs, either with itself or
243 * the I cache
244 *
245 * - addr - page aligned address
246 */
247ENTRY(xsc3_flush_kern_dcache_page)
248 add r1, r0, #PAGE_SZ
2491: mcr p15, 0, r0, c7, c14, 1 @ Clean/Invalidate D Cache line
250 add r0, r0, #CACHELINESIZE
251 cmp r0, r1
252 blo 1b
253 mov r0, #0
254 mcr p15, 0, r0, c7, c5, 0 @ Invalidate I cache & BTB
255 mcr p15, 0, r0, c7, c10, 4 @ Drain Write Buffer
256 mcr p15, 0, r0, c7, c5, 4 @ Prefetch Flush
257 mov pc, lr
258
259/*
260 * dma_inv_range(start, end)
261 *
262 * Invalidate (discard) the specified virtual address range.
263 * May not write back any entries. If 'start' or 'end'
264 * are not cache line aligned, those lines must be written
265 * back.
266 *
267 * - start - virtual start address
268 * - end - virtual end address
269 */
270ENTRY(xsc3_dma_inv_range)
271 tst r0, #CACHELINESIZE - 1
272 bic r0, r0, #CACHELINESIZE - 1
273 mcrne p15, 0, r0, c7, c10, 1 @ clean L1 D entry
274 mcrne p15, 1, r0, c7, c11, 1 @ clean L2 D entry
275 tst r1, #CACHELINESIZE - 1
276 mcrne p15, 0, r1, c7, c10, 1 @ clean L1 D entry
277 mcrne p15, 1, r1, c7, c11, 1 @ clean L2 D entry
2781: mcr p15, 0, r0, c7, c6, 1 @ invalidate L1 D entry
279 mcr p15, 1, r0, c7, c7, 1 @ Invalidate L2 D cache line
280 add r0, r0, #CACHELINESIZE
281 cmp r0, r1
282 blo 1b
283 mcr p15, 0, r0, c7, c10, 4 @ Drain Write Buffer
284 mov pc, lr
285
286/*
287 * dma_clean_range(start, end)
288 *
289 * Clean the specified virtual address range.
290 *
291 * - start - virtual start address
292 * - end - virtual end address
293 */
294ENTRY(xsc3_dma_clean_range)
295 bic r0, r0, #CACHELINESIZE - 1
2961: mcr p15, 0, r0, c7, c10, 1 @ clean L1 D entry
297 mcr p15, 1, r0, c7, c11, 1 @ clean L2 D entry
298 add r0, r0, #CACHELINESIZE
299 cmp r0, r1
300 blo 1b
301 mcr p15, 0, r0, c7, c10, 4 @ Drain Write Buffer
302 mov pc, lr
303
304/*
305 * dma_flush_range(start, end)
306 *
307 * Clean and invalidate the specified virtual address range.
308 *
309 * - start - virtual start address
310 * - end - virtual end address
311 */
312ENTRY(xsc3_dma_flush_range)
313 bic r0, r0, #CACHELINESIZE - 1
3141: mcr p15, 0, r0, c7, c14, 1 @ Clean/invalidate L1 D cache line
315 mcr p15, 1, r0, c7, c11, 1 @ Clean L2 D cache line
316 mcr p15, 1, r0, c7, c7, 1 @ Invalidate L2 D cache line
317 add r0, r0, #CACHELINESIZE
318 cmp r0, r1
319 blo 1b
320 mcr p15, 0, r0, c7, c10, 4 @ Drain Write Buffer
321 mov pc, lr
322
323ENTRY(xsc3_cache_fns)
324 .long xsc3_flush_kern_cache_all
325 .long xsc3_flush_user_cache_all
326 .long xsc3_flush_user_cache_range
327 .long xsc3_coherent_kern_range
328 .long xsc3_coherent_user_range
329 .long xsc3_flush_kern_dcache_page
330 .long xsc3_dma_inv_range
331 .long xsc3_dma_clean_range
332 .long xsc3_dma_flush_range
333
334ENTRY(cpu_xsc3_dcache_clean_area)
3351: mcr p15, 0, r0, c7, c10, 1 @ clean D entry
336 add r0, r0, #CACHELINESIZE
337 subs r1, r1, #CACHELINESIZE
338 bhi 1b
339 mov pc, lr
340
341/* =============================== PageTable ============================== */
342
343/*
344 * cpu_xsc3_switch_mm(pgd)
345 *
346 * Set the translation base pointer to be as described by pgd.
347 *
348 * pgd: new page tables
349 */
350 .align 5
351ENTRY(cpu_xsc3_switch_mm)
352 clean_d_cache r1, r2
353 mcr p15, 0, ip, c7, c5, 0 @ Invalidate I cache & BTB
354 mcr p15, 0, ip, c7, c10, 4 @ Drain Write Buffer
355 mcr p15, 0, ip, c7, c5, 4 @ Prefetch Flush
356#ifdef L2_CACHE_ENABLE
357 orr r0, r0, #0x18 @ cache the page table in L2
358#endif
359 mcr p15, 0, r0, c2, c0, 0 @ load page table pointer
360 mcr p15, 0, ip, c8, c7, 0 @ invalidate I & D TLBs
361 cpwait_ret lr, ip
362
363/*
364 * cpu_xsc3_set_pte(ptep, pte)
365 *
366 * Set a PTE and flush it out
367 *
368 */
369 .align 5
370ENTRY(cpu_xsc3_set_pte)
371 str r1, [r0], #-2048 @ linux version
372
373 bic r2, r1, #0xff0
374 orr r2, r2, #PTE_TYPE_EXT @ extended page
375
376 eor r3, r1, #L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_WRITE | L_PTE_DIRTY
377
378 tst r3, #L_PTE_USER @ User?
379 orrne r2, r2, #PTE_EXT_AP_URO_SRW @ yes -> user r/o, system r/w
380
381 tst r3, #L_PTE_WRITE | L_PTE_DIRTY @ Write and Dirty?
382 orreq r2, r2, #PTE_EXT_AP_UNO_SRW @ yes -> user n/a, system r/w
383 @ combined with user -> user r/w
384
385#if L2_CACHE_ENABLE
386 @ If its cacheable it needs to be in L2 also.
387 eor ip, r1, #L_PTE_CACHEABLE
388 tst ip, #L_PTE_CACHEABLE
389 orreq r2, r2, #PTE_EXT_TEX(0x5)
390#endif
391
392 tst r3, #L_PTE_PRESENT | L_PTE_YOUNG @ Present and Young?
393 movne r2, #0 @ no -> fault
394
395 str r2, [r0] @ hardware version
396 mov ip, #0
397 mcr p15, 0, r0, c7, c10, 1 @ Clean D cache line mcr
398 mcr p15, 0, ip, c7, c10, 4 @ Drain Write Buffer
399 mov pc, lr
400
401 .ltorg
402
403 .align
404
405 __INIT
406
407 .type __xsc3_setup, #function
408__xsc3_setup:
409 mov r0, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
410 msr cpsr_c, r0
411 mcr p15, 0, ip, c7, c7, 0 @ invalidate I, D caches & BTB
412 mcr p15, 0, ip, c7, c10, 4 @ Drain Write Buffer
413 mcr p15, 0, ip, c7, c5, 4 @ Prefetch Flush
414 mcr p15, 0, ip, c8, c7, 0 @ invalidate I, D TLBs
415#if L2_CACHE_ENABLE
416 orr r4, r4, #0x18 @ cache the page table in L2
417#endif
418 mcr p15, 0, r4, c2, c0, 0 @ load page table pointer
419 mov r0, #1 @ Allow access to CP0 and CP13
420 orr r0, r0, #1 << 13 @ Its undefined whether this
421 mcr p15, 0, r0, c15, c1, 0 @ affects USR or SVC modes
422 mrc p15, 0, r0, c1, c0, 1 @ get auxiliary control reg
423 and r0, r0, #2 @ preserve bit P bit setting
424#if L2_CACHE_ENABLE
425 orr r0, r0, #(1 << 10) @ enable L2 for LLR cache
426#endif
427 mcr p15, 0, r0, c1, c0, 1 @ set auxiliary control reg
428 mrc p15, 0, r0, c1, c0, 0 @ get control register
429 bic r0, r0, #0x0200 @ .... ..R. .... ....
430 bic r0, r0, #0x0002 @ .... .... .... ..A.
431 orr r0, r0, #0x0005 @ .... .... .... .C.M
432#if BTB_ENABLE
433 orr r0, r0, #0x3900 @ ..VI Z..S .... ....
434#else
435 orr r0, r0, #0x3100 @ ..VI ...S .... ....
436#endif
437#if L2_CACHE_ENABLE
438 orr r0, r0, #0x4000000 @ L2 enable
439#endif
440 mov pc, lr
441
442 .size __xsc3_setup, . - __xsc3_setup
443
444 __INITDATA
445
446/*
447 * Purpose : Function pointers used to access above functions - all calls
448 * come through these
449 */
450
451 .type xsc3_processor_functions, #object
452ENTRY(xsc3_processor_functions)
453 .word v5t_early_abort
454 .word cpu_xsc3_proc_init
455 .word cpu_xsc3_proc_fin
456 .word cpu_xsc3_reset
457 .word cpu_xsc3_do_idle
458 .word cpu_xsc3_dcache_clean_area
459 .word cpu_xsc3_switch_mm
460 .word cpu_xsc3_set_pte
461 .size xsc3_processor_functions, . - xsc3_processor_functions
462
463 .section ".rodata"
464
465 .type cpu_arch_name, #object
466cpu_arch_name:
467 .asciz "armv5te"
468 .size cpu_arch_name, . - cpu_arch_name
469
470 .type cpu_elf_name, #object
471cpu_elf_name:
472 .asciz "v5"
473 .size cpu_elf_name, . - cpu_elf_name
474
475 .type cpu_xsc3_name, #object
476cpu_xsc3_name:
477 .asciz "XScale-Core3"
478 .size cpu_xsc3_name, . - cpu_xsc3_name
479
480 .align
481
482 .section ".proc.info.init", #alloc, #execinstr
483
484 .type __xsc3_proc_info,#object
485__xsc3_proc_info:
486 .long 0x69056000
487 .long 0xffffe000
488 .long 0x00000c0e
489 b __xsc3_setup
490 .long cpu_arch_name
491 .long cpu_elf_name
492 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP
493 .long cpu_xsc3_name
494 .long xsc3_processor_functions
495 .long v4wbi_tlb_fns
496 .long xsc3_mc_user_fns
497 .long xsc3_cache_fns
498 .size __xsc3_proc_info, . - __xsc3_proc_info
diff --git a/arch/arm26/mm/init.c b/arch/arm26/mm/init.c
index e3ecaa453747..7da8a5205678 100644
--- a/arch/arm26/mm/init.c
+++ b/arch/arm26/mm/init.c
@@ -23,6 +23,7 @@
23#include <linux/initrd.h> 23#include <linux/initrd.h>
24#include <linux/bootmem.h> 24#include <linux/bootmem.h>
25#include <linux/blkdev.h> 25#include <linux/blkdev.h>
26#include <linux/pfn.h>
26 27
27#include <asm/segment.h> 28#include <asm/segment.h>
28#include <asm/mach-types.h> 29#include <asm/mach-types.h>
@@ -101,12 +102,6 @@ struct node_info {
101 int bootmap_pages; 102 int bootmap_pages;
102}; 103};
103 104
104#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
105#define PFN_UP(x) (PAGE_ALIGN(x) >> PAGE_SHIFT)
106#define PFN_SIZE(x) ((x) >> PAGE_SHIFT)
107#define PFN_RANGE(s,e) PFN_SIZE(PAGE_ALIGN((unsigned long)(e)) - \
108 (((unsigned long)(s)) & PAGE_MASK))
109
110/* 105/*
111 * FIXME: We really want to avoid allocating the bootmap bitmap 106 * FIXME: We really want to avoid allocating the bootmap bitmap
112 * over the top of the initrd. Hopefully, this is located towards 107 * over the top of the initrd. Hopefully, this is located towards
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index 1ba57efff60d..619a6eefd893 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -18,6 +18,7 @@
18#include <linux/seq_file.h> 18#include <linux/seq_file.h>
19#include <linux/tty.h> 19#include <linux/tty.h>
20#include <linux/utsname.h> 20#include <linux/utsname.h>
21#include <linux/pfn.h>
21 22
22#include <asm/setup.h> 23#include <asm/setup.h>
23 24
@@ -88,10 +89,6 @@ setup_arch(char **cmdline_p)
88 init_mm.end_data = (unsigned long) &_edata; 89 init_mm.end_data = (unsigned long) &_edata;
89 init_mm.brk = (unsigned long) &_end; 90 init_mm.brk = (unsigned long) &_end;
90 91
91#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
92#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
93#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
94
95 /* min_low_pfn points to the start of DRAM, start_pfn points 92 /* min_low_pfn points to the start of DRAM, start_pfn points
96 * to the first DRAM pages after the kernel, and max_low_pfn 93 * to the first DRAM pages after the kernel, and max_low_pfn
97 * to the end of DRAM. 94 * to the end of DRAM.
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index f7db71d0b913..f17bd1d2707e 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -231,6 +231,15 @@ config SCHED_SMT
231 cost of slightly increased overhead in some places. If unsure say 231 cost of slightly increased overhead in some places. If unsure say
232 N here. 232 N here.
233 233
234config SCHED_MC
235 bool "Multi-core scheduler support"
236 depends on SMP
237 default y
238 help
239 Multi-core scheduler support improves the CPU scheduler's decision
240 making when dealing with multi-core CPU chips at a cost of slightly
241 increased overhead in some places. If unsure say N here.
242
234source "kernel/Kconfig.preempt" 243source "kernel/Kconfig.preempt"
235 244
236config X86_UP_APIC 245config X86_UP_APIC
diff --git a/arch/i386/boot/video.S b/arch/i386/boot/video.S
index 2ac40c8244c4..0000a2674537 100644
--- a/arch/i386/boot/video.S
+++ b/arch/i386/boot/video.S
@@ -1924,6 +1924,7 @@ skip10: movb %ah, %al
1924 ret 1924 ret
1925 1925
1926store_edid: 1926store_edid:
1927#ifdef CONFIG_FB_FIRMWARE_EDID
1927 pushw %es # just save all registers 1928 pushw %es # just save all registers
1928 pushw %ax 1929 pushw %ax
1929 pushw %bx 1930 pushw %bx
@@ -1954,6 +1955,7 @@ store_edid:
1954 popw %bx 1955 popw %bx
1955 popw %ax 1956 popw %ax
1956 popw %es 1957 popw %es
1958#endif
1957 ret 1959 ret
1958 1960
1959# VIDEO_SELECT-only variables 1961# VIDEO_SELECT-only variables
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 7e3d6b6a4e96..a06a49075f10 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -266,7 +266,7 @@ static void __init early_cpu_detect(void)
266void __cpuinit generic_identify(struct cpuinfo_x86 * c) 266void __cpuinit generic_identify(struct cpuinfo_x86 * c)
267{ 267{
268 u32 tfms, xlvl; 268 u32 tfms, xlvl;
269 int junk; 269 int ebx;
270 270
271 if (have_cpuid_p()) { 271 if (have_cpuid_p()) {
272 /* Get vendor name */ 272 /* Get vendor name */
@@ -282,7 +282,7 @@ void __cpuinit generic_identify(struct cpuinfo_x86 * c)
282 /* Intel-defined flags: level 0x00000001 */ 282 /* Intel-defined flags: level 0x00000001 */
283 if ( c->cpuid_level >= 0x00000001 ) { 283 if ( c->cpuid_level >= 0x00000001 ) {
284 u32 capability, excap; 284 u32 capability, excap;
285 cpuid(0x00000001, &tfms, &junk, &excap, &capability); 285 cpuid(0x00000001, &tfms, &ebx, &excap, &capability);
286 c->x86_capability[0] = capability; 286 c->x86_capability[0] = capability;
287 c->x86_capability[4] = excap; 287 c->x86_capability[4] = excap;
288 c->x86 = (tfms >> 8) & 15; 288 c->x86 = (tfms >> 8) & 15;
@@ -292,6 +292,11 @@ void __cpuinit generic_identify(struct cpuinfo_x86 * c)
292 if (c->x86 >= 0x6) 292 if (c->x86 >= 0x6)
293 c->x86_model += ((tfms >> 16) & 0xF) << 4; 293 c->x86_model += ((tfms >> 16) & 0xF) << 4;
294 c->x86_mask = tfms & 15; 294 c->x86_mask = tfms & 15;
295#ifdef CONFIG_SMP
296 c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0);
297#else
298 c->apicid = (ebx >> 24) & 0xFF;
299#endif
295 } else { 300 } else {
296 /* Have CPUID level 0 only - unheard of */ 301 /* Have CPUID level 0 only - unheard of */
297 c->x86 = 4; 302 c->x86 = 4;
@@ -474,7 +479,6 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
474 479
475 cpuid(1, &eax, &ebx, &ecx, &edx); 480 cpuid(1, &eax, &ebx, &ecx, &edx);
476 481
477 c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0);
478 482
479 if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) 483 if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY))
480 return; 484 return;
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
index 1e70823e1cb5..712a26bd4457 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c
@@ -1095,10 +1095,15 @@ static int __devexit powernowk8_cpu_exit (struct cpufreq_policy *pol)
1095 1095
1096static unsigned int powernowk8_get (unsigned int cpu) 1096static unsigned int powernowk8_get (unsigned int cpu)
1097{ 1097{
1098 struct powernow_k8_data *data = powernow_data[cpu]; 1098 struct powernow_k8_data *data;
1099 cpumask_t oldmask = current->cpus_allowed; 1099 cpumask_t oldmask = current->cpus_allowed;
1100 unsigned int khz = 0; 1100 unsigned int khz = 0;
1101 1101
1102 data = powernow_data[first_cpu(cpu_core_map[cpu])];
1103
1104 if (!data)
1105 return -EINVAL;
1106
1102 set_cpus_allowed(current, cpumask_of_cpu(cpu)); 1107 set_cpus_allowed(current, cpumask_of_cpu(cpu));
1103 if (smp_processor_id() != cpu) { 1108 if (smp_processor_id() != cpu) {
1104 printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu); 1109 printk(KERN_ERR PFX "limiting to CPU %d failed in powernowk8_get\n", cpu);
diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
index 00ea899c17e1..79a7c5c87edc 100644
--- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.h
@@ -182,10 +182,6 @@ static int core_frequency_transition(struct powernow_k8_data *data, u32 reqfid);
182 182
183static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index); 183static void powernow_k8_acpi_pst_values(struct powernow_k8_data *data, unsigned int index);
184 184
185#ifndef for_each_cpu_mask
186#define for_each_cpu_mask(i,mask) for (i=0;i<1;i++)
187#endif
188
189#ifdef CONFIG_SMP 185#ifdef CONFIG_SMP
190static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[]) 186static inline void define_siblings(int cpu, cpumask_t cpu_sharedcore_mask[])
191{ 187{
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c
index ce61921369e5..9df87b03612c 100644
--- a/arch/i386/kernel/cpu/intel_cacheinfo.c
+++ b/arch/i386/kernel/cpu/intel_cacheinfo.c
@@ -173,6 +173,10 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
173 unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */ 173 unsigned int trace = 0, l1i = 0, l1d = 0, l2 = 0, l3 = 0; /* Cache sizes */
174 unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */ 174 unsigned int new_l1d = 0, new_l1i = 0; /* Cache sizes from cpuid(4) */
175 unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */ 175 unsigned int new_l2 = 0, new_l3 = 0, i; /* Cache sizes from cpuid(4) */
176 unsigned int l2_id = 0, l3_id = 0, num_threads_sharing, index_msb;
177#ifdef CONFIG_SMP
178 unsigned int cpu = (c == &boot_cpu_data) ? 0 : (c - cpu_data);
179#endif
176 180
177 if (c->cpuid_level > 3) { 181 if (c->cpuid_level > 3) {
178 static int is_initialized; 182 static int is_initialized;
@@ -205,9 +209,15 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
205 break; 209 break;
206 case 2: 210 case 2:
207 new_l2 = this_leaf.size/1024; 211 new_l2 = this_leaf.size/1024;
212 num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
213 index_msb = get_count_order(num_threads_sharing);
214 l2_id = c->apicid >> index_msb;
208 break; 215 break;
209 case 3: 216 case 3:
210 new_l3 = this_leaf.size/1024; 217 new_l3 = this_leaf.size/1024;
218 num_threads_sharing = 1 + this_leaf.eax.split.num_threads_sharing;
219 index_msb = get_count_order(num_threads_sharing);
220 l3_id = c->apicid >> index_msb;
211 break; 221 break;
212 default: 222 default:
213 break; 223 break;
@@ -215,11 +225,19 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
215 } 225 }
216 } 226 }
217 } 227 }
218 if (c->cpuid_level > 1) { 228 /*
229 * Don't use cpuid2 if cpuid4 is supported. For P4, we use cpuid2 for
230 * trace cache
231 */
232 if ((num_cache_leaves == 0 || c->x86 == 15) && c->cpuid_level > 1) {
219 /* supports eax=2 call */ 233 /* supports eax=2 call */
220 int i, j, n; 234 int i, j, n;
221 int regs[4]; 235 int regs[4];
222 unsigned char *dp = (unsigned char *)regs; 236 unsigned char *dp = (unsigned char *)regs;
237 int only_trace = 0;
238
239 if (num_cache_leaves != 0 && c->x86 == 15)
240 only_trace = 1;
223 241
224 /* Number of times to iterate */ 242 /* Number of times to iterate */
225 n = cpuid_eax(2) & 0xFF; 243 n = cpuid_eax(2) & 0xFF;
@@ -241,6 +259,8 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
241 while (cache_table[k].descriptor != 0) 259 while (cache_table[k].descriptor != 0)
242 { 260 {
243 if (cache_table[k].descriptor == des) { 261 if (cache_table[k].descriptor == des) {
262 if (only_trace && cache_table[k].cache_type != LVL_TRACE)
263 break;
244 switch (cache_table[k].cache_type) { 264 switch (cache_table[k].cache_type) {
245 case LVL_1_INST: 265 case LVL_1_INST:
246 l1i += cache_table[k].size; 266 l1i += cache_table[k].size;
@@ -266,34 +286,45 @@ unsigned int __cpuinit init_intel_cacheinfo(struct cpuinfo_x86 *c)
266 } 286 }
267 } 287 }
268 } 288 }
289 }
269 290
270 if (new_l1d) 291 if (new_l1d)
271 l1d = new_l1d; 292 l1d = new_l1d;
272 293
273 if (new_l1i) 294 if (new_l1i)
274 l1i = new_l1i; 295 l1i = new_l1i;
275 296
276 if (new_l2) 297 if (new_l2) {
277 l2 = new_l2; 298 l2 = new_l2;
299#ifdef CONFIG_SMP
300 cpu_llc_id[cpu] = l2_id;
301#endif
302 }
278 303
279 if (new_l3) 304 if (new_l3) {
280 l3 = new_l3; 305 l3 = new_l3;
306#ifdef CONFIG_SMP
307 cpu_llc_id[cpu] = l3_id;
308#endif
309 }
281 310
282 if ( trace ) 311 if (trace)
283 printk (KERN_INFO "CPU: Trace cache: %dK uops", trace); 312 printk (KERN_INFO "CPU: Trace cache: %dK uops", trace);
284 else if ( l1i ) 313 else if ( l1i )
285 printk (KERN_INFO "CPU: L1 I cache: %dK", l1i); 314 printk (KERN_INFO "CPU: L1 I cache: %dK", l1i);
286 if ( l1d )
287 printk(", L1 D cache: %dK\n", l1d);
288 else
289 printk("\n");
290 if ( l2 )
291 printk(KERN_INFO "CPU: L2 cache: %dK\n", l2);
292 if ( l3 )
293 printk(KERN_INFO "CPU: L3 cache: %dK\n", l3);
294 315
295 c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d)); 316 if (l1d)
296 } 317 printk(", L1 D cache: %dK\n", l1d);
318 else
319 printk("\n");
320
321 if (l2)
322 printk(KERN_INFO "CPU: L2 cache: %dK\n", l2);
323
324 if (l3)
325 printk(KERN_INFO "CPU: L3 cache: %dK\n", l3);
326
327 c->x86_cache_size = l3 ? l3 : (l2 ? l2 : (l1i+l1d));
297 328
298 return l2; 329 return l2;
299} 330}
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 311b4e7266f1..3b329af4afc5 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -381,7 +381,7 @@ static void do_irq_balance(void)
381 unsigned long imbalance = 0; 381 unsigned long imbalance = 0;
382 cpumask_t allowed_mask, target_cpu_mask, tmp; 382 cpumask_t allowed_mask, target_cpu_mask, tmp;
383 383
384 for_each_cpu(i) { 384 for_each_possible_cpu(i) {
385 int package_index; 385 int package_index;
386 CPU_IRQ(i) = 0; 386 CPU_IRQ(i) = 0;
387 if (!cpu_online(i)) 387 if (!cpu_online(i))
@@ -632,7 +632,7 @@ static int __init balanced_irq_init(void)
632 else 632 else
633 printk(KERN_ERR "balanced_irq_init: failed to spawn balanced_irq"); 633 printk(KERN_ERR "balanced_irq_init: failed to spawn balanced_irq");
634failed: 634failed:
635 for_each_cpu(i) { 635 for_each_possible_cpu(i) {
636 kfree(irq_cpu_data[i].irq_delta); 636 kfree(irq_cpu_data[i].irq_delta);
637 irq_cpu_data[i].irq_delta = NULL; 637 irq_cpu_data[i].irq_delta = NULL;
638 kfree(irq_cpu_data[i].last_irq); 638 kfree(irq_cpu_data[i].last_irq);
diff --git a/arch/i386/kernel/microcode.c b/arch/i386/kernel/microcode.c
index dd780a00553f..e7c138f66c5a 100644
--- a/arch/i386/kernel/microcode.c
+++ b/arch/i386/kernel/microcode.c
@@ -459,26 +459,9 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
459 return ret; 459 return ret;
460} 460}
461 461
462static int microcode_ioctl (struct inode *inode, struct file *file,
463 unsigned int cmd, unsigned long arg)
464{
465 switch (cmd) {
466 /*
467 * XXX: will be removed after microcode_ctl
468 * is updated to ignore failure of this ioctl()
469 */
470 case MICROCODE_IOCFREE:
471 return 0;
472 default:
473 return -EINVAL;
474 }
475 return -EINVAL;
476}
477
478static struct file_operations microcode_fops = { 462static struct file_operations microcode_fops = {
479 .owner = THIS_MODULE, 463 .owner = THIS_MODULE,
480 .write = microcode_write, 464 .write = microcode_write,
481 .ioctl = microcode_ioctl,
482 .open = microcode_open, 465 .open = microcode_open,
483}; 466};
484 467
diff --git a/arch/i386/kernel/nmi.c b/arch/i386/kernel/nmi.c
index 9074818b9473..d43b498ec745 100644
--- a/arch/i386/kernel/nmi.c
+++ b/arch/i386/kernel/nmi.c
@@ -138,12 +138,12 @@ static int __init check_nmi_watchdog(void)
138 if (nmi_watchdog == NMI_LOCAL_APIC) 138 if (nmi_watchdog == NMI_LOCAL_APIC)
139 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0); 139 smp_call_function(nmi_cpu_busy, (void *)&endflag, 0, 0);
140 140
141 for_each_cpu(cpu) 141 for_each_possible_cpu(cpu)
142 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count; 142 prev_nmi_count[cpu] = per_cpu(irq_stat, cpu).__nmi_count;
143 local_irq_enable(); 143 local_irq_enable();
144 mdelay((10*1000)/nmi_hz); // wait 10 ticks 144 mdelay((10*1000)/nmi_hz); // wait 10 ticks
145 145
146 for_each_cpu(cpu) { 146 for_each_possible_cpu(cpu) {
147#ifdef CONFIG_SMP 147#ifdef CONFIG_SMP
148 /* Check cpu_callin_map here because that is set 148 /* Check cpu_callin_map here because that is set
149 after the timer is started. */ 149 after the timer is started. */
@@ -510,7 +510,7 @@ void touch_nmi_watchdog (void)
510 * Just reset the alert counters, (other CPUs might be 510 * Just reset the alert counters, (other CPUs might be
511 * spinning on locks we hold): 511 * spinning on locks we hold):
512 */ 512 */
513 for_each_cpu(i) 513 for_each_possible_cpu(i)
514 alert_counter[i] = 0; 514 alert_counter[i] = 0;
515 515
516 /* 516 /*
@@ -529,7 +529,8 @@ void nmi_watchdog_tick (struct pt_regs * regs)
529 * always switch the stack NMI-atomically, it's safe to use 529 * always switch the stack NMI-atomically, it's safe to use
530 * smp_processor_id(). 530 * smp_processor_id().
531 */ 531 */
532 int sum, cpu = smp_processor_id(); 532 unsigned int sum;
533 int cpu = smp_processor_id();
533 534
534 sum = per_cpu(irq_stat, cpu).apic_timer_irqs; 535 sum = per_cpu(irq_stat, cpu).apic_timer_irqs;
535 536
diff --git a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c
index 6917daa159ab..8c08660b4e5d 100644
--- a/arch/i386/kernel/setup.c
+++ b/arch/i386/kernel/setup.c
@@ -46,6 +46,7 @@
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#include <linux/dmi.h>
49#include <linux/pfn.h>
49 50
50#include <video/edid.h> 51#include <video/edid.h>
51 52
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index 82371d83bfa9..a6969903f2d6 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -72,6 +72,9 @@ int phys_proc_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID};
72/* Core ID of each logical CPU */ 72/* Core ID of each logical CPU */
73int cpu_core_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID}; 73int cpu_core_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID};
74 74
75/* Last level cache ID of each logical CPU */
76int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID};
77
75/* representing HT siblings of each logical CPU */ 78/* representing HT siblings of each logical CPU */
76cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly; 79cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly;
77EXPORT_SYMBOL(cpu_sibling_map); 80EXPORT_SYMBOL(cpu_sibling_map);
@@ -440,6 +443,18 @@ static void __devinit smp_callin(void)
440 443
441static int cpucount; 444static int cpucount;
442 445
446/* maps the cpu to the sched domain representing multi-core */
447cpumask_t cpu_coregroup_map(int cpu)
448{
449 struct cpuinfo_x86 *c = cpu_data + cpu;
450 /*
451 * For perf, we return last level cache shared map.
452 * TBD: when power saving sched policy is added, we will return
453 * cpu_core_map when power saving policy is enabled
454 */
455 return c->llc_shared_map;
456}
457
443/* representing cpus for which sibling maps can be computed */ 458/* representing cpus for which sibling maps can be computed */
444static cpumask_t cpu_sibling_setup_map; 459static cpumask_t cpu_sibling_setup_map;
445 460
@@ -459,12 +474,16 @@ set_cpu_sibling_map(int cpu)
459 cpu_set(cpu, cpu_sibling_map[i]); 474 cpu_set(cpu, cpu_sibling_map[i]);
460 cpu_set(i, cpu_core_map[cpu]); 475 cpu_set(i, cpu_core_map[cpu]);
461 cpu_set(cpu, cpu_core_map[i]); 476 cpu_set(cpu, cpu_core_map[i]);
477 cpu_set(i, c[cpu].llc_shared_map);
478 cpu_set(cpu, c[i].llc_shared_map);
462 } 479 }
463 } 480 }
464 } else { 481 } else {
465 cpu_set(cpu, cpu_sibling_map[cpu]); 482 cpu_set(cpu, cpu_sibling_map[cpu]);
466 } 483 }
467 484
485 cpu_set(cpu, c[cpu].llc_shared_map);
486
468 if (current_cpu_data.x86_max_cores == 1) { 487 if (current_cpu_data.x86_max_cores == 1) {
469 cpu_core_map[cpu] = cpu_sibling_map[cpu]; 488 cpu_core_map[cpu] = cpu_sibling_map[cpu];
470 c[cpu].booted_cores = 1; 489 c[cpu].booted_cores = 1;
@@ -472,6 +491,11 @@ set_cpu_sibling_map(int cpu)
472 } 491 }
473 492
474 for_each_cpu_mask(i, cpu_sibling_setup_map) { 493 for_each_cpu_mask(i, cpu_sibling_setup_map) {
494 if (cpu_llc_id[cpu] != BAD_APICID &&
495 cpu_llc_id[cpu] == cpu_llc_id[i]) {
496 cpu_set(i, c[cpu].llc_shared_map);
497 cpu_set(cpu, c[i].llc_shared_map);
498 }
475 if (phys_proc_id[cpu] == phys_proc_id[i]) { 499 if (phys_proc_id[cpu] == phys_proc_id[i]) {
476 cpu_set(i, cpu_core_map[cpu]); 500 cpu_set(i, cpu_core_map[cpu]);
477 cpu_set(cpu, cpu_core_map[i]); 501 cpu_set(cpu, cpu_core_map[i]);
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index ac687d00a1ce..ce3ef4fa0551 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -310,3 +310,6 @@ ENTRY(sys_call_table)
310 .long sys_pselect6 310 .long sys_pselect6
311 .long sys_ppoll 311 .long sys_ppoll
312 .long sys_unshare /* 310 */ 312 .long sys_unshare /* 310 */
313 .long sys_set_robust_list
314 .long sys_get_robust_list
315 .long sys_splice
diff --git a/arch/i386/kernel/timers/timer_pm.c b/arch/i386/kernel/timers/timer_pm.c
index 264edaaac315..144e94a04933 100644
--- a/arch/i386/kernel/timers/timer_pm.c
+++ b/arch/i386/kernel/timers/timer_pm.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/device.h> 16#include <linux/device.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/pci.h>
18#include <asm/types.h> 19#include <asm/types.h>
19#include <asm/timer.h> 20#include <asm/timer.h>
20#include <asm/smp.h> 21#include <asm/smp.h>
@@ -45,24 +46,31 @@ static seqlock_t monotonic_lock = SEQLOCK_UNLOCKED;
45 46
46#define ACPI_PM_MASK 0xFFFFFF /* limit it to 24 bits */ 47#define ACPI_PM_MASK 0xFFFFFF /* limit it to 24 bits */
47 48
49static int pmtmr_need_workaround __read_mostly = 1;
50
48/*helper function to safely read acpi pm timesource*/ 51/*helper function to safely read acpi pm timesource*/
49static inline u32 read_pmtmr(void) 52static inline u32 read_pmtmr(void)
50{ 53{
51 u32 v1=0,v2=0,v3=0; 54 if (pmtmr_need_workaround) {
52 /* It has been reported that because of various broken 55 u32 v1, v2, v3;
53 * chipsets (ICH4, PIIX4 and PIIX4E) where the ACPI PM time 56
54 * source is not latched, so you must read it multiple 57 /* It has been reported that because of various broken
55 * times to insure a safe value is read. 58 * chipsets (ICH4, PIIX4 and PIIX4E) where the ACPI PM time
56 */ 59 * source is not latched, so you must read it multiple
57 do { 60 * times to insure a safe value is read.
58 v1 = inl(pmtmr_ioport); 61 */
59 v2 = inl(pmtmr_ioport); 62 do {
60 v3 = inl(pmtmr_ioport); 63 v1 = inl(pmtmr_ioport);
61 } while ((v1 > v2 && v1 < v3) || (v2 > v3 && v2 < v1) 64 v2 = inl(pmtmr_ioport);
62 || (v3 > v1 && v3 < v2)); 65 v3 = inl(pmtmr_ioport);
63 66 } while ((v1 > v2 && v1 < v3) || (v2 > v3 && v2 < v1)
64 /* mask the output to 24 bits */ 67 || (v3 > v1 && v3 < v2));
65 return v2 & ACPI_PM_MASK; 68
69 /* mask the output to 24 bits */
70 return v2 & ACPI_PM_MASK;
71 }
72
73 return inl(pmtmr_ioport) & ACPI_PM_MASK;
66} 74}
67 75
68 76
@@ -263,6 +271,72 @@ struct init_timer_opts __initdata timer_pmtmr_init = {
263 .opts = &timer_pmtmr, 271 .opts = &timer_pmtmr,
264}; 272};
265 273
274#ifdef CONFIG_PCI
275/*
276 * PIIX4 Errata:
277 *
278 * The power management timer may return improper results when read.
279 * Although the timer value settles properly after incrementing,
280 * while incrementing there is a 3 ns window every 69.8 ns where the
281 * timer value is indeterminate (a 4.2% chance that the data will be
282 * incorrect when read). As a result, the ACPI free running count up
283 * timer specification is violated due to erroneous reads.
284 */
285static int __init pmtmr_bug_check(void)
286{
287 static struct pci_device_id gray_list[] __initdata = {
288 /* these chipsets may have bug. */
289 { PCI_DEVICE(PCI_VENDOR_ID_INTEL,
290 PCI_DEVICE_ID_INTEL_82801DB_0) },
291 { },
292 };
293 struct pci_dev *dev;
294 int pmtmr_has_bug = 0;
295 u8 rev;
296
297 if (cur_timer != &timer_pmtmr || !pmtmr_need_workaround)
298 return 0;
299
300 dev = pci_get_device(PCI_VENDOR_ID_INTEL,
301 PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
302 if (dev) {
303 pci_read_config_byte(dev, PCI_REVISION_ID, &rev);
304 /* the bug has been fixed in PIIX4M */
305 if (rev < 3) {
306 printk(KERN_WARNING "* Found PM-Timer Bug on this "
307 "chipset. Due to workarounds for a bug,\n"
308 "* this time source is slow. Consider trying "
309 "other time sources (clock=)\n");
310 pmtmr_has_bug = 1;
311 }
312 pci_dev_put(dev);
313 }
314
315 if (pci_dev_present(gray_list)) {
316 printk(KERN_WARNING "* This chipset may have PM-Timer Bug. Due"
317 " to workarounds for a bug,\n"
318 "* this time source is slow. If you are sure your timer"
319 " does not have\n"
320 "* this bug, please use \"pmtmr_good\" to disable the "
321 "workaround\n");
322 pmtmr_has_bug = 1;
323 }
324
325 if (!pmtmr_has_bug)
326 pmtmr_need_workaround = 0;
327
328 return 0;
329}
330device_initcall(pmtmr_bug_check);
331#endif
332
333static int __init pmtr_good_setup(char *__str)
334{
335 pmtmr_need_workaround = 0;
336 return 1;
337}
338__setup("pmtmr_good", pmtr_good_setup);
339
266MODULE_LICENSE("GPL"); 340MODULE_LICENSE("GPL");
267MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>"); 341MODULE_AUTHOR("Dominik Brodowski <linux@brodo.de>");
268MODULE_DESCRIPTION("Power Management Timer (PMTMR) as primary timing source for x86"); 342MODULE_DESCRIPTION("Power Management Timer (PMTMR) as primary timing source for x86");
diff --git a/arch/i386/kernel/traps.c b/arch/i386/kernel/traps.c
index 4624f8ca2459..6b63a5aa1e46 100644
--- a/arch/i386/kernel/traps.c
+++ b/arch/i386/kernel/traps.c
@@ -92,22 +92,21 @@ asmlinkage void spurious_interrupt_bug(void);
92asmlinkage void machine_check(void); 92asmlinkage void machine_check(void);
93 93
94static int kstack_depth_to_print = 24; 94static int kstack_depth_to_print = 24;
95struct notifier_block *i386die_chain; 95ATOMIC_NOTIFIER_HEAD(i386die_chain);
96static DEFINE_SPINLOCK(die_notifier_lock);
97 96
98int register_die_notifier(struct notifier_block *nb) 97int register_die_notifier(struct notifier_block *nb)
99{ 98{
100 int err = 0;
101 unsigned long flags;
102
103 vmalloc_sync_all(); 99 vmalloc_sync_all();
104 spin_lock_irqsave(&die_notifier_lock, flags); 100 return atomic_notifier_chain_register(&i386die_chain, nb);
105 err = notifier_chain_register(&i386die_chain, nb);
106 spin_unlock_irqrestore(&die_notifier_lock, flags);
107 return err;
108} 101}
109EXPORT_SYMBOL(register_die_notifier); 102EXPORT_SYMBOL(register_die_notifier);
110 103
104int unregister_die_notifier(struct notifier_block *nb)
105{
106 return atomic_notifier_chain_unregister(&i386die_chain, nb);
107}
108EXPORT_SYMBOL(unregister_die_notifier);
109
111static inline int valid_stack_ptr(struct thread_info *tinfo, void *p) 110static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
112{ 111{
113 return p > (void *)tinfo && 112 return p > (void *)tinfo &&
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 8165626a5c30..70e560a1b79a 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -1700,7 +1700,7 @@ after_handle_vic_irq(unsigned int irq)
1700 1700
1701 printk("VOYAGER SMP: CPU%d lost interrupt %d\n", 1701 printk("VOYAGER SMP: CPU%d lost interrupt %d\n",
1702 cpu, irq); 1702 cpu, irq);
1703 for_each_cpu(real_cpu, mask) { 1703 for_each_possible_cpu(real_cpu, mask) {
1704 1704
1705 outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu, 1705 outb(VIC_CPU_MASQUERADE_ENABLE | real_cpu,
1706 VIC_PROCESSOR_ID); 1706 VIC_PROCESSOR_ID);
diff --git a/arch/i386/mm/discontig.c b/arch/i386/mm/discontig.c
index c4af9638dbfa..fe6eb901326e 100644
--- a/arch/i386/mm/discontig.c
+++ b/arch/i386/mm/discontig.c
@@ -31,6 +31,7 @@
31#include <linux/nodemask.h> 31#include <linux/nodemask.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/kexec.h> 33#include <linux/kexec.h>
34#include <linux/pfn.h>
34 35
35#include <asm/e820.h> 36#include <asm/e820.h>
36#include <asm/setup.h> 37#include <asm/setup.h>
@@ -352,17 +353,6 @@ void __init zone_sizes_init(void)
352{ 353{
353 int nid; 354 int nid;
354 355
355 /*
356 * Insert nodes into pgdat_list backward so they appear in order.
357 * Clobber node 0's links and NULL out pgdat_list before starting.
358 */
359 pgdat_list = NULL;
360 for (nid = MAX_NUMNODES - 1; nid >= 0; nid--) {
361 if (!node_online(nid))
362 continue;
363 NODE_DATA(nid)->pgdat_next = pgdat_list;
364 pgdat_list = NODE_DATA(nid);
365 }
366 356
367 for_each_online_node(nid) { 357 for_each_online_node(nid) {
368 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0}; 358 unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
diff --git a/arch/i386/mm/pgtable.c b/arch/i386/mm/pgtable.c
index 9db3242103be..2889567e21a1 100644
--- a/arch/i386/mm/pgtable.c
+++ b/arch/i386/mm/pgtable.c
@@ -36,7 +36,7 @@ void show_mem(void)
36 printk(KERN_INFO "Mem-info:\n"); 36 printk(KERN_INFO "Mem-info:\n");
37 show_free_areas(); 37 show_free_areas();
38 printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 38 printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
39 for_each_pgdat(pgdat) { 39 for_each_online_pgdat(pgdat) {
40 pgdat_resize_lock(pgdat, &flags); 40 pgdat_resize_lock(pgdat, &flags);
41 for (i = 0; i < pgdat->node_spanned_pages; ++i) { 41 for (i = 0; i < pgdat->node_spanned_pages; ++i) {
42 page = pgdat_page_nr(pgdat, i); 42 page = pgdat_page_nr(pgdat, i);
diff --git a/arch/i386/oprofile/nmi_int.c b/arch/i386/oprofile/nmi_int.c
index 1accce50c2c7..1a2076ce6f6a 100644
--- a/arch/i386/oprofile/nmi_int.c
+++ b/arch/i386/oprofile/nmi_int.c
@@ -122,7 +122,7 @@ static void nmi_save_registers(void * dummy)
122static void free_msrs(void) 122static void free_msrs(void)
123{ 123{
124 int i; 124 int i;
125 for_each_cpu(i) { 125 for_each_possible_cpu(i) {
126 kfree(cpu_msrs[i].counters); 126 kfree(cpu_msrs[i].counters);
127 cpu_msrs[i].counters = NULL; 127 cpu_msrs[i].counters = NULL;
128 kfree(cpu_msrs[i].controls); 128 kfree(cpu_msrs[i].controls);
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 0e3eda99e549..750e8e7fbdc3 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1605,5 +1605,6 @@ sys_call_table:
1605 data8 sys_ni_syscall // reserved for pselect 1605 data8 sys_ni_syscall // reserved for pselect
1606 data8 sys_ni_syscall // 1295 reserved for ppoll 1606 data8 sys_ni_syscall // 1295 reserved for ppoll
1607 data8 sys_unshare 1607 data8 sys_unshare
1608 data8 sys_splice
1608 1609
1609 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1610 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index dabd6c32641e..7c1ddc8ac443 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -30,19 +30,19 @@ extern spinlock_t timerlist_lock;
30fpswa_interface_t *fpswa_interface; 30fpswa_interface_t *fpswa_interface;
31EXPORT_SYMBOL(fpswa_interface); 31EXPORT_SYMBOL(fpswa_interface);
32 32
33struct notifier_block *ia64die_chain; 33ATOMIC_NOTIFIER_HEAD(ia64die_chain);
34 34
35int 35int
36register_die_notifier(struct notifier_block *nb) 36register_die_notifier(struct notifier_block *nb)
37{ 37{
38 return notifier_chain_register(&ia64die_chain, nb); 38 return atomic_notifier_chain_register(&ia64die_chain, nb);
39} 39}
40EXPORT_SYMBOL_GPL(register_die_notifier); 40EXPORT_SYMBOL_GPL(register_die_notifier);
41 41
42int 42int
43unregister_die_notifier(struct notifier_block *nb) 43unregister_die_notifier(struct notifier_block *nb)
44{ 44{
45 return notifier_chain_unregister(&ia64die_chain, nb); 45 return atomic_notifier_chain_unregister(&ia64die_chain, nb);
46} 46}
47EXPORT_SYMBOL_GPL(unregister_die_notifier); 47EXPORT_SYMBOL_GPL(unregister_die_notifier);
48 48
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 2f5e44862e91..ec9eeb89975d 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -379,31 +379,6 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
379} 379}
380 380
381/** 381/**
382 * pgdat_insert - insert the pgdat into global pgdat_list
383 * @pgdat: the pgdat for a node.
384 */
385static void __init pgdat_insert(pg_data_t *pgdat)
386{
387 pg_data_t *prev = NULL, *next;
388
389 for_each_pgdat(next)
390 if (pgdat->node_id < next->node_id)
391 break;
392 else
393 prev = next;
394
395 if (prev) {
396 prev->pgdat_next = pgdat;
397 pgdat->pgdat_next = next;
398 } else {
399 pgdat->pgdat_next = pgdat_list;
400 pgdat_list = pgdat;
401 }
402
403 return;
404}
405
406/**
407 * memory_less_nodes - allocate and initialize CPU only nodes pernode 382 * memory_less_nodes - allocate and initialize CPU only nodes pernode
408 * information. 383 * information.
409 */ 384 */
@@ -560,7 +535,7 @@ void show_mem(void)
560 printk("Mem-info:\n"); 535 printk("Mem-info:\n");
561 show_free_areas(); 536 show_free_areas();
562 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 537 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
563 for_each_pgdat(pgdat) { 538 for_each_online_pgdat(pgdat) {
564 unsigned long present; 539 unsigned long present;
565 unsigned long flags; 540 unsigned long flags;
566 int shared = 0, cached = 0, reserved = 0; 541 int shared = 0, cached = 0, reserved = 0;
@@ -745,11 +720,5 @@ void __init paging_init(void)
745 pfn_offset, zholes_size); 720 pfn_offset, zholes_size);
746 } 721 }
747 722
748 /*
749 * Make memory less nodes become a member of the known nodes.
750 */
751 for_each_node_mask(node, memory_less_mask)
752 pgdat_insert(mem_data[node].pgdat);
753
754 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page)); 723 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
755} 724}
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 674736129b87..cafa8776a53d 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -606,7 +606,7 @@ mem_init (void)
606 kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START); 606 kclist_add(&kcore_vmem, (void *)VMALLOC_START, VMALLOC_END-VMALLOC_START);
607 kclist_add(&kcore_kernel, _stext, _end - _stext); 607 kclist_add(&kcore_kernel, _stext, _end - _stext);
608 608
609 for_each_pgdat(pgdat) 609 for_each_online_pgdat(pgdat)
610 if (pgdat->bdata->node_bootmem_map) 610 if (pgdat->bdata->node_bootmem_map)
611 totalram_pages += free_all_bootmem_node(pgdat); 611 totalram_pages += free_all_bootmem_node(pgdat);
612 612
diff --git a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
index c686d9c12f7b..5100261310f7 100644
--- a/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
+++ b/arch/ia64/sn/kernel/sn2/sn_proc_fs.c
@@ -93,19 +93,22 @@ static int coherence_id_open(struct inode *inode, struct file *file)
93static struct proc_dir_entry 93static struct proc_dir_entry
94*sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent, 94*sn_procfs_create_entry(const char *name, struct proc_dir_entry *parent,
95 int (*openfunc)(struct inode *, struct file *), 95 int (*openfunc)(struct inode *, struct file *),
96 int (*releasefunc)(struct inode *, struct file *)) 96 int (*releasefunc)(struct inode *, struct file *),
97 ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *))
97{ 98{
98 struct proc_dir_entry *e = create_proc_entry(name, 0444, parent); 99 struct proc_dir_entry *e = create_proc_entry(name, 0444, parent);
99 100
100 if (e) { 101 if (e) {
101 e->proc_fops = (struct file_operations *)kmalloc( 102 struct file_operations *f;
102 sizeof(struct file_operations), GFP_KERNEL); 103
103 if (e->proc_fops) { 104 f = kzalloc(sizeof(*f), GFP_KERNEL);
104 memset(e->proc_fops, 0, sizeof(struct file_operations)); 105 if (f) {
105 e->proc_fops->open = openfunc; 106 f->open = openfunc;
106 e->proc_fops->read = seq_read; 107 f->read = seq_read;
107 e->proc_fops->llseek = seq_lseek; 108 f->llseek = seq_lseek;
108 e->proc_fops->release = releasefunc; 109 f->release = releasefunc;
110 f->write = write;
111 e->proc_fops = f;
109 } 112 }
110 } 113 }
111 114
@@ -119,31 +122,29 @@ extern int sn_topology_release(struct inode *, struct file *);
119void register_sn_procfs(void) 122void register_sn_procfs(void)
120{ 123{
121 static struct proc_dir_entry *sgi_proc_dir = NULL; 124 static struct proc_dir_entry *sgi_proc_dir = NULL;
122 struct proc_dir_entry *e;
123 125
124 BUG_ON(sgi_proc_dir != NULL); 126 BUG_ON(sgi_proc_dir != NULL);
125 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL))) 127 if (!(sgi_proc_dir = proc_mkdir("sgi_sn", NULL)))
126 return; 128 return;
127 129
128 sn_procfs_create_entry("partition_id", sgi_proc_dir, 130 sn_procfs_create_entry("partition_id", sgi_proc_dir,
129 partition_id_open, single_release); 131 partition_id_open, single_release, NULL);
130 132
131 sn_procfs_create_entry("system_serial_number", sgi_proc_dir, 133 sn_procfs_create_entry("system_serial_number", sgi_proc_dir,
132 system_serial_number_open, single_release); 134 system_serial_number_open, single_release, NULL);
133 135
134 sn_procfs_create_entry("licenseID", sgi_proc_dir, 136 sn_procfs_create_entry("licenseID", sgi_proc_dir,
135 licenseID_open, single_release); 137 licenseID_open, single_release, NULL);
136 138
137 e = sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir, 139 sn_procfs_create_entry("sn_force_interrupt", sgi_proc_dir,
138 sn_force_interrupt_open, single_release); 140 sn_force_interrupt_open, single_release,
139 if (e) 141 sn_force_interrupt_write_proc);
140 e->proc_fops->write = sn_force_interrupt_write_proc;
141 142
142 sn_procfs_create_entry("coherence_id", sgi_proc_dir, 143 sn_procfs_create_entry("coherence_id", sgi_proc_dir,
143 coherence_id_open, single_release); 144 coherence_id_open, single_release, NULL);
144 145
145 sn_procfs_create_entry("sn_topology", sgi_proc_dir, 146 sn_procfs_create_entry("sn_topology", sgi_proc_dir,
146 sn_topology_open, sn_topology_release); 147 sn_topology_open, sn_topology_release, NULL);
147} 148}
148 149
149#endif /* CONFIG_PROC_FS */ 150#endif /* CONFIG_PROC_FS */
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index d742037a7ccb..0d78942b4c76 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -24,6 +24,7 @@
24#include <linux/tty.h> 24#include <linux/tty.h>
25#include <linux/cpu.h> 25#include <linux/cpu.h>
26#include <linux/nodemask.h> 26#include <linux/nodemask.h>
27#include <linux/pfn.h>
27 28
28#include <asm/processor.h> 29#include <asm/processor.h>
29#include <asm/pgtable.h> 30#include <asm/pgtable.h>
diff --git a/arch/m32r/mm/discontig.c b/arch/m32r/mm/discontig.c
index 08e727955555..cf610a7c5ff0 100644
--- a/arch/m32r/mm/discontig.c
+++ b/arch/m32r/mm/discontig.c
@@ -13,6 +13,7 @@
13#include <linux/initrd.h> 13#include <linux/initrd.h>
14#include <linux/nodemask.h> 14#include <linux/nodemask.h>
15#include <linux/module.h> 15#include <linux/module.h>
16#include <linux/pfn.h>
16 17
17#include <asm/setup.h> 18#include <asm/setup.h>
18 19
@@ -137,12 +138,6 @@ unsigned long __init zone_sizes_init(void)
137 int nid, i; 138 int nid, i;
138 mem_prof_t *mp; 139 mem_prof_t *mp;
139 140
140 pgdat_list = NULL;
141 for (nid = num_online_nodes() - 1 ; nid >= 0 ; nid--) {
142 NODE_DATA(nid)->pgdat_next = pgdat_list;
143 pgdat_list = NODE_DATA(nid);
144 }
145
146 for_each_online_node(nid) { 141 for_each_online_node(nid) {
147 mp = &mem_prof[nid]; 142 mp = &mem_prof[nid];
148 for (i = 0 ; i < MAX_NR_ZONES ; i++) { 143 for (i = 0 ; i < MAX_NR_ZONES ; i++) {
diff --git a/arch/m32r/mm/init.c b/arch/m32r/mm/init.c
index c9e7dad860b7..b71348fec1f4 100644
--- a/arch/m32r/mm/init.c
+++ b/arch/m32r/mm/init.c
@@ -18,6 +18,7 @@
18#include <linux/highmem.h> 18#include <linux/highmem.h>
19#include <linux/bitops.h> 19#include <linux/bitops.h>
20#include <linux/nodemask.h> 20#include <linux/nodemask.h>
21#include <linux/pfn.h>
21#include <asm/types.h> 22#include <asm/types.h>
22#include <asm/processor.h> 23#include <asm/processor.h>
23#include <asm/page.h> 24#include <asm/page.h>
@@ -47,7 +48,7 @@ void show_mem(void)
47 printk("Mem-info:\n"); 48 printk("Mem-info:\n");
48 show_free_areas(); 49 show_free_areas();
49 printk("Free swap: %6ldkB\n",nr_swap_pages<<(PAGE_SHIFT-10)); 50 printk("Free swap: %6ldkB\n",nr_swap_pages<<(PAGE_SHIFT-10));
50 for_each_pgdat(pgdat) { 51 for_each_online_pgdat(pgdat) {
51 unsigned long flags; 52 unsigned long flags;
52 pgdat_resize_lock(pgdat, &flags); 53 pgdat_resize_lock(pgdat, &flags);
53 for (i = 0; i < pgdat->node_spanned_pages; ++i) { 54 for (i = 0; i < pgdat->node_spanned_pages; ++i) {
diff --git a/arch/m68k/mvme16x/rtc.c b/arch/m68k/mvme16x/rtc.c
index a69fe3048edc..b0e4c084df8a 100644
--- a/arch/m68k/mvme16x/rtc.c
+++ b/arch/m68k/mvme16x/rtc.c
@@ -17,6 +17,7 @@
17#include <linux/poll.h> 17#include <linux/poll.h>
18#include <linux/mc146818rtc.h> /* For struct rtc_time and ioctls, etc */ 18#include <linux/mc146818rtc.h> /* For struct rtc_time and ioctls, etc */
19#include <linux/smp_lock.h> 19#include <linux/smp_lock.h>
20#include <linux/bcd.h>
20#include <asm/mvme16xhw.h> 21#include <asm/mvme16xhw.h>
21 22
22#include <asm/io.h> 23#include <asm/io.h>
@@ -31,9 +32,6 @@
31 * ioctls. 32 * ioctls.
32 */ 33 */
33 34
34#define BCD2BIN(val) (((val)&15) + ((val)>>4)*10)
35#define BIN2BCD(val) ((((val)/10)<<4) + (val)%10)
36
37static const unsigned char days_in_mo[] = 35static const unsigned char days_in_mo[] =
38{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 36{0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
39 37
diff --git a/arch/mips/au1000/common/setup.c b/arch/mips/au1000/common/setup.c
index 1080558c8100..307e98c29ddc 100644
--- a/arch/mips/au1000/common/setup.c
+++ b/arch/mips/au1000/common/setup.c
@@ -94,7 +94,7 @@ void __init plat_setup(void)
94 94
95 argptr = prom_getcmdline(); 95 argptr = prom_getcmdline();
96 96
97#if defined(CONFIG_SERIAL_AU1X00_CONSOLE) || defined(CONFIG_SERIAL_8250_CONSOLE) 97#ifdef CONFIG_SERIAL_8250_CONSOLE
98 if ((argptr = strstr(argptr, "console=")) == NULL) { 98 if ((argptr = strstr(argptr, "console=")) == NULL) {
99 argptr = prom_getcmdline(); 99 argptr = prom_getcmdline();
100 strcat(argptr, " console=ttyS0,115200"); 100 strcat(argptr, " console=ttyS0,115200");
diff --git a/arch/mips/ddb5xxx/common/rtc_ds1386.c b/arch/mips/ddb5xxx/common/rtc_ds1386.c
index 995896ac0e39..5dc34daa7150 100644
--- a/arch/mips/ddb5xxx/common/rtc_ds1386.c
+++ b/arch/mips/ddb5xxx/common/rtc_ds1386.c
@@ -165,6 +165,6 @@ rtc_ds1386_init(unsigned long base)
165 WRITE_RTC(0xB, byte); 165 WRITE_RTC(0xB, byte);
166 166
167 /* set the function pointers */ 167 /* set the function pointers */
168 rtc_get_time = rtc_ds1386_get_time; 168 rtc_mips_get_time = rtc_ds1386_get_time;
169 rtc_set_time = rtc_ds1386_set_time; 169 rtc_mips_set_time = rtc_ds1386_set_time;
170} 170}
diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c
index 174822344131..74cb055d4bf6 100644
--- a/arch/mips/dec/time.c
+++ b/arch/mips/dec/time.c
@@ -36,41 +36,13 @@
36#include <asm/dec/ioasic_addrs.h> 36#include <asm/dec/ioasic_addrs.h>
37#include <asm/dec/machtype.h> 37#include <asm/dec/machtype.h>
38 38
39
40/*
41 * Returns true if a clock update is in progress
42 */
43static inline unsigned char dec_rtc_is_updating(void)
44{
45 unsigned char uip;
46 unsigned long flags;
47
48 spin_lock_irqsave(&rtc_lock, flags);
49 uip = (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP);
50 spin_unlock_irqrestore(&rtc_lock, flags);
51 return uip;
52}
53
54static unsigned long dec_rtc_get_time(void) 39static unsigned long dec_rtc_get_time(void)
55{ 40{
56 unsigned int year, mon, day, hour, min, sec, real_year; 41 unsigned int year, mon, day, hour, min, sec, real_year;
57 int i;
58 unsigned long flags; 42 unsigned long flags;
59 43
60 /* The Linux interpretation of the DS1287 clock register contents:
61 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
62 * RTC registers show the second which has precisely just started.
63 * Let's hope other operating systems interpret the RTC the same way.
64 */
65 /* read RTC exactly on falling edge of update flag */
66 for (i = 0; i < 1000000; i++) /* may take up to 1 second... */
67 if (dec_rtc_is_updating())
68 break;
69 for (i = 0; i < 1000000; i++) /* must try at least 2.228 ms */
70 if (!dec_rtc_is_updating())
71 break;
72 spin_lock_irqsave(&rtc_lock, flags); 44 spin_lock_irqsave(&rtc_lock, flags);
73 /* Isn't this overkill? UIP above should guarantee consistency */ 45
74 do { 46 do {
75 sec = CMOS_READ(RTC_SECONDS); 47 sec = CMOS_READ(RTC_SECONDS);
76 min = CMOS_READ(RTC_MINUTES); 48 min = CMOS_READ(RTC_MINUTES);
@@ -78,7 +50,16 @@ static unsigned long dec_rtc_get_time(void)
78 day = CMOS_READ(RTC_DAY_OF_MONTH); 50 day = CMOS_READ(RTC_DAY_OF_MONTH);
79 mon = CMOS_READ(RTC_MONTH); 51 mon = CMOS_READ(RTC_MONTH);
80 year = CMOS_READ(RTC_YEAR); 52 year = CMOS_READ(RTC_YEAR);
53 /*
54 * The PROM will reset the year to either '72 or '73.
55 * Therefore we store the real year separately, in one
56 * of unused BBU RAM locations.
57 */
58 real_year = CMOS_READ(RTC_DEC_YEAR);
81 } while (sec != CMOS_READ(RTC_SECONDS)); 59 } while (sec != CMOS_READ(RTC_SECONDS));
60
61 spin_unlock_irqrestore(&rtc_lock, flags);
62
82 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 63 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
83 sec = BCD2BIN(sec); 64 sec = BCD2BIN(sec);
84 min = BCD2BIN(min); 65 min = BCD2BIN(min);
@@ -87,13 +68,7 @@ static unsigned long dec_rtc_get_time(void)
87 mon = BCD2BIN(mon); 68 mon = BCD2BIN(mon);
88 year = BCD2BIN(year); 69 year = BCD2BIN(year);
89 } 70 }
90 /* 71
91 * The PROM will reset the year to either '72 or '73.
92 * Therefore we store the real year separately, in one
93 * of unused BBU RAM locations.
94 */
95 real_year = CMOS_READ(RTC_DEC_YEAR);
96 spin_unlock_irqrestore(&rtc_lock, flags);
97 year += real_year - 72 + 2000; 72 year += real_year - 72 + 2000;
98 73
99 return mktime(year, mon, day, hour, min, sec); 74 return mktime(year, mon, day, hour, min, sec);
@@ -193,8 +168,8 @@ static void dec_ioasic_hpt_init(unsigned int count)
193 168
194void __init dec_time_init(void) 169void __init dec_time_init(void)
195{ 170{
196 rtc_get_time = dec_rtc_get_time; 171 rtc_mips_get_time = dec_rtc_get_time;
197 rtc_set_mmss = dec_rtc_set_mmss; 172 rtc_mips_set_mmss = dec_rtc_set_mmss;
198 173
199 mips_timer_state = dec_timer_state; 174 mips_timer_state = dec_timer_state;
200 mips_timer_ack = dec_timer_ack; 175 mips_timer_ack = dec_timer_ack;
diff --git a/arch/mips/ite-boards/generic/time.c b/arch/mips/ite-boards/generic/time.c
index f5d67ee21ac6..b79817bb6cce 100644
--- a/arch/mips/ite-boards/generic/time.c
+++ b/arch/mips/ite-boards/generic/time.c
@@ -227,8 +227,8 @@ void __init it8172_time_init(void)
227 227
228 local_irq_restore(flags); 228 local_irq_restore(flags);
229 229
230 rtc_get_time = it8172_rtc_get_time; 230 rtc_mips_get_time = it8172_rtc_get_time;
231 rtc_set_time = it8172_rtc_set_time; 231 rtc_mips_set_time = it8172_rtc_set_time;
232} 232}
233 233
234#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5) 234#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
diff --git a/arch/mips/ite-boards/ivr/init.c b/arch/mips/ite-boards/ivr/init.c
index ea4e1935fec5..b774db035b31 100644
--- a/arch/mips/ite-boards/ivr/init.c
+++ b/arch/mips/ite-boards/ivr/init.c
@@ -45,9 +45,6 @@ extern void __init prom_init_cmdline(void);
45extern unsigned long __init prom_get_memsize(void); 45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize); 46extern void __init it8172_init_ram_resource(unsigned long memsize);
47 47
48#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
49#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
50
51const char *get_system_type(void) 48const char *get_system_type(void)
52{ 49{
53 return "Globespan IVR"; 50 return "Globespan IVR";
diff --git a/arch/mips/ite-boards/qed-4n-s01b/init.c b/arch/mips/ite-boards/qed-4n-s01b/init.c
index 56dca7e0c21d..e8ec8be66a80 100644
--- a/arch/mips/ite-boards/qed-4n-s01b/init.c
+++ b/arch/mips/ite-boards/qed-4n-s01b/init.c
@@ -45,9 +45,6 @@ extern void __init prom_init_cmdline(void);
45extern unsigned long __init prom_get_memsize(void); 45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize); 46extern void __init it8172_init_ram_resource(unsigned long memsize);
47 47
48#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
49#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
50
51const char *get_system_type(void) 48const char *get_system_type(void)
52{ 49{
53 return "ITE QED-4N-S01B"; 50 return "ITE QED-4N-S01B";
diff --git a/arch/mips/jmr3927/common/rtc_ds1742.c b/arch/mips/jmr3927/common/rtc_ds1742.c
index 9a8bff153d80..a6bd3f4d3049 100644
--- a/arch/mips/jmr3927/common/rtc_ds1742.c
+++ b/arch/mips/jmr3927/common/rtc_ds1742.c
@@ -159,8 +159,8 @@ rtc_ds1742_init(unsigned long base)
159 db_assert((rtc_base & 0xe0000000) == KSEG1); 159 db_assert((rtc_base & 0xe0000000) == KSEG1);
160 160
161 /* set the function pointers */ 161 /* set the function pointers */
162 rtc_get_time = rtc_ds1742_get_time; 162 rtc_mips_get_time = rtc_ds1742_get_time;
163 rtc_set_time = rtc_ds1742_set_time; 163 rtc_mips_set_time = rtc_ds1742_set_time;
164 164
165 /* clear oscillator stop bit */ 165 /* clear oscillator stop bit */
166 CMOS_WRITE(RTC_READ, RTC_CONTROL); 166 CMOS_WRITE(RTC_READ, RTC_CONTROL);
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index 08273a2a501d..8150f071f80a 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -603,7 +603,7 @@ repeat:
603 /* move to end of parent's list to avoid starvation */ 603 /* move to end of parent's list to avoid starvation */
604 write_lock_irq(&tasklist_lock); 604 write_lock_irq(&tasklist_lock);
605 remove_parent(p); 605 remove_parent(p);
606 add_parent(p, p->parent); 606 add_parent(p);
607 write_unlock_irq(&tasklist_lock); 607 write_unlock_irq(&tasklist_lock);
608 retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0; 608 retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
609 if (retval) 609 if (retval)
@@ -643,7 +643,7 @@ repeat:
643 write_lock_irq(&tasklist_lock); 643 write_lock_irq(&tasklist_lock);
644 remove_parent(p); 644 remove_parent(p);
645 p->parent = p->real_parent; 645 p->parent = p->real_parent;
646 add_parent(p, p->parent); 646 add_parent(p);
647 do_notify_parent(p, SIGCHLD); 647 do_notify_parent(p, SIGCHLD);
648 write_unlock_irq(&tasklist_lock); 648 write_unlock_irq(&tasklist_lock);
649 } else 649 } else
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 0cb3b6097e0e..dcbfd27071f0 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -34,6 +34,7 @@
34#include <linux/highmem.h> 34#include <linux/highmem.h>
35#include <linux/console.h> 35#include <linux/console.h>
36#include <linux/mmzone.h> 36#include <linux/mmzone.h>
37#include <linux/pfn.h>
37 38
38#include <asm/addrspace.h> 39#include <asm/addrspace.h>
39#include <asm/bootinfo.h> 40#include <asm/bootinfo.h>
@@ -257,10 +258,6 @@ static inline int parse_rd_cmdline(unsigned long* rd_start, unsigned long* rd_en
257 return 0; 258 return 0;
258} 259}
259 260
260#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
261#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
262#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
263
264#define MAXMEM HIGHMEM_START 261#define MAXMEM HIGHMEM_START
265#define MAXMEM_PFN PFN_DOWN(MAXMEM) 262#define MAXMEM_PFN PFN_DOWN(MAXMEM)
266 263
@@ -493,10 +490,6 @@ static inline void resource_init(void)
493 } 490 }
494} 491}
495 492
496#undef PFN_UP
497#undef PFN_DOWN
498#undef PFN_PHYS
499
500#undef MAXMEM 493#undef MAXMEM
501#undef MAXMEM_PFN 494#undef MAXMEM_PFN
502 495
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 51273b7297a7..5e51a2d8f3f0 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -65,9 +65,9 @@ static int null_rtc_set_time(unsigned long sec)
65 return 0; 65 return 0;
66} 66}
67 67
68unsigned long (*rtc_get_time)(void) = null_rtc_get_time; 68unsigned long (*rtc_mips_get_time)(void) = null_rtc_get_time;
69int (*rtc_set_time)(unsigned long) = null_rtc_set_time; 69int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time;
70int (*rtc_set_mmss)(unsigned long); 70int (*rtc_mips_set_mmss)(unsigned long);
71 71
72 72
73/* usecs per counter cycle, shifted to left by 32 bits */ 73/* usecs per counter cycle, shifted to left by 32 bits */
@@ -440,14 +440,14 @@ irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
440 440
441 /* 441 /*
442 * If we have an externally synchronized Linux clock, then update 442 * If we have an externally synchronized Linux clock, then update
443 * CMOS clock accordingly every ~11 minutes. rtc_set_time() has to be 443 * CMOS clock accordingly every ~11 minutes. rtc_mips_set_time() has to be
444 * called as close as possible to 500 ms before the new second starts. 444 * called as close as possible to 500 ms before the new second starts.
445 */ 445 */
446 if (ntp_synced() && 446 if (ntp_synced() &&
447 xtime.tv_sec > last_rtc_update + 660 && 447 xtime.tv_sec > last_rtc_update + 660 &&
448 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 && 448 (xtime.tv_nsec / 1000) >= 500000 - ((unsigned) TICK_SIZE) / 2 &&
449 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) { 449 (xtime.tv_nsec / 1000) <= 500000 + ((unsigned) TICK_SIZE) / 2) {
450 if (rtc_set_mmss(xtime.tv_sec) == 0) { 450 if (rtc_mips_set_mmss(xtime.tv_sec) == 0) {
451 last_rtc_update = xtime.tv_sec; 451 last_rtc_update = xtime.tv_sec;
452 } else { 452 } else {
453 /* do it again in 60 s */ 453 /* do it again in 60 s */
@@ -565,7 +565,7 @@ asmlinkage void ll_local_timer_interrupt(int irq, struct pt_regs *regs)
565 * b) (optional) calibrate and set the mips_hpt_frequency 565 * b) (optional) calibrate and set the mips_hpt_frequency
566 * (only needed if you intended to use fixed_rate_gettimeoffset 566 * (only needed if you intended to use fixed_rate_gettimeoffset
567 * or use cpu counter as timer interrupt source) 567 * or use cpu counter as timer interrupt source)
568 * 2) setup xtime based on rtc_get_time(). 568 * 2) setup xtime based on rtc_mips_get_time().
569 * 3) choose a appropriate gettimeoffset routine. 569 * 3) choose a appropriate gettimeoffset routine.
570 * 4) calculate a couple of cached variables for later usage 570 * 4) calculate a couple of cached variables for later usage
571 * 5) board_timer_setup() - 571 * 5) board_timer_setup() -
@@ -633,10 +633,10 @@ void __init time_init(void)
633 if (board_time_init) 633 if (board_time_init)
634 board_time_init(); 634 board_time_init();
635 635
636 if (!rtc_set_mmss) 636 if (!rtc_mips_set_mmss)
637 rtc_set_mmss = rtc_set_time; 637 rtc_mips_set_mmss = rtc_mips_set_time;
638 638
639 xtime.tv_sec = rtc_get_time(); 639 xtime.tv_sec = rtc_mips_get_time();
640 xtime.tv_nsec = 0; 640 xtime.tv_nsec = 0;
641 641
642 set_normalized_timespec(&wall_to_monotonic, 642 set_normalized_timespec(&wall_to_monotonic,
@@ -772,8 +772,8 @@ void to_tm(unsigned long tim, struct rtc_time *tm)
772 772
773EXPORT_SYMBOL(rtc_lock); 773EXPORT_SYMBOL(rtc_lock);
774EXPORT_SYMBOL(to_tm); 774EXPORT_SYMBOL(to_tm);
775EXPORT_SYMBOL(rtc_set_time); 775EXPORT_SYMBOL(rtc_mips_set_time);
776EXPORT_SYMBOL(rtc_get_time); 776EXPORT_SYMBOL(rtc_mips_get_time);
777 777
778unsigned long long sched_clock(void) 778unsigned long long sched_clock(void)
779{ 779{
diff --git a/arch/mips/lasat/setup.c b/arch/mips/lasat/setup.c
index 83eb08b7a072..bb70a8240e61 100644
--- a/arch/mips/lasat/setup.c
+++ b/arch/mips/lasat/setup.c
@@ -165,7 +165,8 @@ void __init plat_setup(void)
165 165
166 /* Set up panic notifier */ 166 /* Set up panic notifier */
167 for (i = 0; i < sizeof(lasat_panic_block) / sizeof(struct notifier_block); i++) 167 for (i = 0; i < sizeof(lasat_panic_block) / sizeof(struct notifier_block); i++)
168 notifier_chain_register(&panic_notifier_list, &lasat_panic_block[i]); 168 atomic_notifier_chain_register(&panic_notifier_list,
169 &lasat_panic_block[i]);
169 170
170 lasat_reboot_setup(); 171 lasat_reboot_setup();
171 172
@@ -174,8 +175,8 @@ void __init plat_setup(void)
174 175
175#ifdef CONFIG_DS1603 176#ifdef CONFIG_DS1603
176 ds1603 = &ds_defs[mips_machtype]; 177 ds1603 = &ds_defs[mips_machtype];
177 rtc_get_time = ds1603_read; 178 rtc_mips_get_time = ds1603_read;
178 rtc_set_time = ds1603_set; 179 rtc_mips_set_time = ds1603_set;
179#endif 180#endif
180 181
181#ifdef DYNAMIC_SERIAL_INIT 182#ifdef DYNAMIC_SERIAL_INIT
diff --git a/arch/mips/mips-boards/atlas/atlas_setup.c b/arch/mips/mips-boards/atlas/atlas_setup.c
index 873cf3141a31..c20d401ecf80 100644
--- a/arch/mips/mips-boards/atlas/atlas_setup.c
+++ b/arch/mips/mips-boards/atlas/atlas_setup.c
@@ -65,7 +65,7 @@ void __init plat_setup(void)
65 65
66 board_time_init = mips_time_init; 66 board_time_init = mips_time_init;
67 board_timer_setup = mips_timer_setup; 67 board_timer_setup = mips_timer_setup;
68 rtc_get_time = mips_rtc_get_time; 68 rtc_mips_get_time = mips_rtc_get_time;
69} 69}
70 70
71static void __init serial_init(void) 71static void __init serial_init(void)
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c
index ee5e70c95cf3..32c9210373ac 100644
--- a/arch/mips/mips-boards/generic/memory.c
+++ b/arch/mips/mips-boards/generic/memory.c
@@ -49,9 +49,6 @@ static char *mtypes[3] = {
49/* References to section boundaries */ 49/* References to section boundaries */
50extern char _end; 50extern char _end;
51 51
52#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
53
54
55struct prom_pmemblock * __init prom_getmdesc(void) 52struct prom_pmemblock * __init prom_getmdesc(void)
56{ 53{
57 char *memsize_str; 54 char *memsize_str;
@@ -109,10 +106,10 @@ struct prom_pmemblock * __init prom_getmdesc(void)
109 106
110 mdesc[3].type = yamon_dontuse; 107 mdesc[3].type = yamon_dontuse;
111 mdesc[3].base = 0x00100000; 108 mdesc[3].base = 0x00100000;
112 mdesc[3].size = CPHYSADDR(PFN_ALIGN(&_end)) - mdesc[3].base; 109 mdesc[3].size = CPHYSADDR(PAGE_ALIGN(&_end)) - mdesc[3].base;
113 110
114 mdesc[4].type = yamon_free; 111 mdesc[4].type = yamon_free;
115 mdesc[4].base = CPHYSADDR(PFN_ALIGN(&_end)); 112 mdesc[4].base = CPHYSADDR(PAGE_ALIGN(&_end));
116 mdesc[4].size = memsize - mdesc[4].base; 113 mdesc[4].size = memsize - mdesc[4].base;
117 114
118 return &mdesc[0]; 115 return &mdesc[0];
diff --git a/arch/mips/mips-boards/malta/malta_setup.c b/arch/mips/mips-boards/malta/malta_setup.c
index 2209e8a9de34..b8488aab6df1 100644
--- a/arch/mips/mips-boards/malta/malta_setup.c
+++ b/arch/mips/mips-boards/malta/malta_setup.c
@@ -225,5 +225,5 @@ void __init plat_setup(void)
225 225
226 board_time_init = mips_time_init; 226 board_time_init = mips_time_init;
227 board_timer_setup = mips_timer_setup; 227 board_timer_setup = mips_timer_setup;
228 rtc_get_time = mips_rtc_get_time; 228 rtc_mips_get_time = mips_rtc_get_time;
229} 229}
diff --git a/arch/mips/mips-boards/sim/sim_mem.c b/arch/mips/mips-boards/sim/sim_mem.c
index 1ec4e75656bd..e57f737bab10 100644
--- a/arch/mips/mips-boards/sim/sim_mem.c
+++ b/arch/mips/mips-boards/sim/sim_mem.c
@@ -42,9 +42,6 @@ static char *mtypes[3] = {
42/* References to section boundaries */ 42/* References to section boundaries */
43extern char _end; 43extern char _end;
44 44
45#define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK)
46
47
48struct prom_pmemblock * __init prom_getmdesc(void) 45struct prom_pmemblock * __init prom_getmdesc(void)
49{ 46{
50 unsigned int memsize; 47 unsigned int memsize;
@@ -64,10 +61,10 @@ struct prom_pmemblock * __init prom_getmdesc(void)
64 61
65 mdesc[2].type = simmem_reserved; 62 mdesc[2].type = simmem_reserved;
66 mdesc[2].base = 0x00100000; 63 mdesc[2].base = 0x00100000;
67 mdesc[2].size = CPHYSADDR(PFN_ALIGN(&_end)) - mdesc[2].base; 64 mdesc[2].size = CPHYSADDR(PAGE_ALIGN(&_end)) - mdesc[2].base;
68 65
69 mdesc[3].type = simmem_free; 66 mdesc[3].type = simmem_free;
70 mdesc[3].base = CPHYSADDR(PFN_ALIGN(&_end)); 67 mdesc[3].base = CPHYSADDR(PAGE_ALIGN(&_end));
71 mdesc[3].size = memsize - mdesc[3].base; 68 mdesc[3].size = memsize - mdesc[3].base;
72 69
73 return &mdesc[0]; 70 return &mdesc[0];
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 52f7d59fe612..ad89c442f299 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -25,6 +25,7 @@
25#include <linux/highmem.h> 25#include <linux/highmem.h>
26#include <linux/swap.h> 26#include <linux/swap.h>
27#include <linux/proc_fs.h> 27#include <linux/proc_fs.h>
28#include <linux/pfn.h>
28 29
29#include <asm/bootinfo.h> 30#include <asm/bootinfo.h>
30#include <asm/cachectl.h> 31#include <asm/cachectl.h>
@@ -177,9 +178,6 @@ void __init paging_init(void)
177 free_area_init(zones_size); 178 free_area_init(zones_size);
178} 179}
179 180
180#define PFN_UP(x) (((x) + PAGE_SIZE - 1) >> PAGE_SHIFT)
181#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
182
183static inline int page_is_ram(unsigned long pagenr) 181static inline int page_is_ram(unsigned long pagenr)
184{ 182{
185 int i; 183 int i;
diff --git a/arch/mips/momentum/jaguar_atx/setup.c b/arch/mips/momentum/jaguar_atx/setup.c
index 3784c898db1a..91d9637143d7 100644
--- a/arch/mips/momentum/jaguar_atx/setup.c
+++ b/arch/mips/momentum/jaguar_atx/setup.c
@@ -229,8 +229,8 @@ void momenco_time_init(void)
229 mips_hpt_frequency = cpu_clock / 2; 229 mips_hpt_frequency = cpu_clock / 2;
230 board_timer_setup = momenco_timer_setup; 230 board_timer_setup = momenco_timer_setup;
231 231
232 rtc_get_time = m48t37y_get_time; 232 rtc_mips_get_time = m48t37y_get_time;
233 rtc_set_time = m48t37y_set_time; 233 rtc_mips_set_time = m48t37y_set_time;
234} 234}
235 235
236static struct resource mv_pci_io_mem0_resource = { 236static struct resource mv_pci_io_mem0_resource = {
diff --git a/arch/mips/momentum/ocelot_3/setup.c b/arch/mips/momentum/ocelot_3/setup.c
index f95677f4f06f..370e75d0e75c 100644
--- a/arch/mips/momentum/ocelot_3/setup.c
+++ b/arch/mips/momentum/ocelot_3/setup.c
@@ -58,6 +58,7 @@
58#include <linux/bootmem.h> 58#include <linux/bootmem.h>
59#include <linux/mv643xx.h> 59#include <linux/mv643xx.h>
60#include <linux/pm.h> 60#include <linux/pm.h>
61#include <linux/bcd.h>
61 62
62#include <asm/time.h> 63#include <asm/time.h>
63#include <asm/page.h> 64#include <asm/page.h>
@@ -131,9 +132,6 @@ void setup_wired_tlb_entries(void)
131 add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000), (signed)0xfc000000, PM_16M); 132 add_wired_entry(ENTRYLO(0xfc000000), ENTRYLO(0xfd000000), (signed)0xfc000000, PM_16M);
132} 133}
133 134
134#define CONV_BCD_TO_BIN(val) (((val) & 0xf) + (((val) >> 4) * 10))
135#define CONV_BIN_TO_BCD(val) (((val) % 10) + (((val) / 10) << 4))
136
137unsigned long m48t37y_get_time(void) 135unsigned long m48t37y_get_time(void)
138{ 136{
139 unsigned int year, month, day, hour, min, sec; 137 unsigned int year, month, day, hour, min, sec;
@@ -143,16 +141,16 @@ unsigned long m48t37y_get_time(void)
143 /* stop the update */ 141 /* stop the update */
144 rtc_base[0x7ff8] = 0x40; 142 rtc_base[0x7ff8] = 0x40;
145 143
146 year = CONV_BCD_TO_BIN(rtc_base[0x7fff]); 144 year = BCD2BIN(rtc_base[0x7fff]);
147 year += CONV_BCD_TO_BIN(rtc_base[0x7ff1]) * 100; 145 year += BCD2BIN(rtc_base[0x7ff1]) * 100;
148 146
149 month = CONV_BCD_TO_BIN(rtc_base[0x7ffe]); 147 month = BCD2BIN(rtc_base[0x7ffe]);
150 148
151 day = CONV_BCD_TO_BIN(rtc_base[0x7ffd]); 149 day = BCD2BIN(rtc_base[0x7ffd]);
152 150
153 hour = CONV_BCD_TO_BIN(rtc_base[0x7ffb]); 151 hour = BCD2BIN(rtc_base[0x7ffb]);
154 min = CONV_BCD_TO_BIN(rtc_base[0x7ffa]); 152 min = BCD2BIN(rtc_base[0x7ffa]);
155 sec = CONV_BCD_TO_BIN(rtc_base[0x7ff9]); 153 sec = BCD2BIN(rtc_base[0x7ff9]);
156 154
157 /* start the update */ 155 /* start the update */
158 rtc_base[0x7ff8] = 0x00; 156 rtc_base[0x7ff8] = 0x00;
@@ -175,22 +173,22 @@ int m48t37y_set_time(unsigned long sec)
175 rtc_base[0x7ff8] = 0x80; 173 rtc_base[0x7ff8] = 0x80;
176 174
177 /* year */ 175 /* year */
178 rtc_base[0x7fff] = CONV_BIN_TO_BCD(tm.tm_year % 100); 176 rtc_base[0x7fff] = BIN2BCD(tm.tm_year % 100);
179 rtc_base[0x7ff1] = CONV_BIN_TO_BCD(tm.tm_year / 100); 177 rtc_base[0x7ff1] = BIN2BCD(tm.tm_year / 100);
180 178
181 /* month */ 179 /* month */
182 rtc_base[0x7ffe] = CONV_BIN_TO_BCD(tm.tm_mon); 180 rtc_base[0x7ffe] = BIN2BCD(tm.tm_mon);
183 181
184 /* day */ 182 /* day */
185 rtc_base[0x7ffd] = CONV_BIN_TO_BCD(tm.tm_mday); 183 rtc_base[0x7ffd] = BIN2BCD(tm.tm_mday);
186 184
187 /* hour/min/sec */ 185 /* hour/min/sec */
188 rtc_base[0x7ffb] = CONV_BIN_TO_BCD(tm.tm_hour); 186 rtc_base[0x7ffb] = BIN2BCD(tm.tm_hour);
189 rtc_base[0x7ffa] = CONV_BIN_TO_BCD(tm.tm_min); 187 rtc_base[0x7ffa] = BIN2BCD(tm.tm_min);
190 rtc_base[0x7ff9] = CONV_BIN_TO_BCD(tm.tm_sec); 188 rtc_base[0x7ff9] = BIN2BCD(tm.tm_sec);
191 189
192 /* day of week -- not really used, but let's keep it up-to-date */ 190 /* day of week -- not really used, but let's keep it up-to-date */
193 rtc_base[0x7ffc] = CONV_BIN_TO_BCD(tm.tm_wday + 1); 191 rtc_base[0x7ffc] = BIN2BCD(tm.tm_wday + 1);
194 192
195 /* disable writing */ 193 /* disable writing */
196 rtc_base[0x7ff8] = 0x00; 194 rtc_base[0x7ff8] = 0x00;
@@ -215,8 +213,8 @@ void momenco_time_init(void)
215 mips_hpt_frequency = cpu_clock / 2; 213 mips_hpt_frequency = cpu_clock / 2;
216 board_timer_setup = momenco_timer_setup; 214 board_timer_setup = momenco_timer_setup;
217 215
218 rtc_get_time = m48t37y_get_time; 216 rtc_mips_get_time = m48t37y_get_time;
219 rtc_set_time = m48t37y_set_time; 217 rtc_mips_set_time = m48t37y_set_time;
220} 218}
221 219
222/* 220/*
diff --git a/arch/mips/momentum/ocelot_c/setup.c b/arch/mips/momentum/ocelot_c/setup.c
index bd02e60d037a..a3e6f5575592 100644
--- a/arch/mips/momentum/ocelot_c/setup.c
+++ b/arch/mips/momentum/ocelot_c/setup.c
@@ -227,8 +227,8 @@ void momenco_time_init(void)
227 printk("momenco_time_init cpu_clock=%d\n", cpu_clock); 227 printk("momenco_time_init cpu_clock=%d\n", cpu_clock);
228 board_timer_setup = momenco_timer_setup; 228 board_timer_setup = momenco_timer_setup;
229 229
230 rtc_get_time = m48t37y_get_time; 230 rtc_mips_get_time = m48t37y_get_time;
231 rtc_set_time = m48t37y_set_time; 231 rtc_mips_set_time = m48t37y_set_time;
232} 232}
233 233
234void __init plat_setup(void) 234void __init plat_setup(void)
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
index 8bce711575de..3f724d661bdb 100644
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -198,8 +198,8 @@ static void __init py_rtc_setup(void)
198 if (!m48t37_base) 198 if (!m48t37_base)
199 printk(KERN_ERR "Mapping the RTC failed\n"); 199 printk(KERN_ERR "Mapping the RTC failed\n");
200 200
201 rtc_get_time = m48t37y_get_time; 201 rtc_mips_get_time = m48t37y_get_time;
202 rtc_set_time = m48t37y_set_time; 202 rtc_mips_set_time = m48t37y_set_time;
203 203
204 write_seqlock(&xtime_lock); 204 write_seqlock(&xtime_lock);
205 xtime.tv_sec = m48t37y_get_time(); 205 xtime.tv_sec = m48t37y_get_time();
diff --git a/arch/mips/sgi-ip22/ip22-reset.c b/arch/mips/sgi-ip22/ip22-reset.c
index 92a3b3c15ed3..a9c58e067b53 100644
--- a/arch/mips/sgi-ip22/ip22-reset.c
+++ b/arch/mips/sgi-ip22/ip22-reset.c
@@ -238,7 +238,7 @@ static int __init reboot_setup(void)
238 request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL); 238 request_irq(SGI_PANEL_IRQ, panel_int, 0, "Front Panel", NULL);
239 init_timer(&blink_timer); 239 init_timer(&blink_timer);
240 blink_timer.function = blink_timeout; 240 blink_timer.function = blink_timeout;
241 notifier_chain_register(&panic_notifier_list, &panic_block); 241 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
242 242
243 return 0; 243 return 0;
244} 244}
diff --git a/arch/mips/sgi-ip22/ip22-time.c b/arch/mips/sgi-ip22/ip22-time.c
index b7300cc5c5ad..cca688ad64ad 100644
--- a/arch/mips/sgi-ip22/ip22-time.c
+++ b/arch/mips/sgi-ip22/ip22-time.c
@@ -212,8 +212,8 @@ static void indy_timer_setup(struct irqaction *irq)
212void __init ip22_time_init(void) 212void __init ip22_time_init(void)
213{ 213{
214 /* setup hookup functions */ 214 /* setup hookup functions */
215 rtc_get_time = indy_rtc_get_time; 215 rtc_mips_get_time = indy_rtc_get_time;
216 rtc_set_time = indy_rtc_set_time; 216 rtc_mips_set_time = indy_rtc_set_time;
217 217
218 board_time_init = indy_time_init; 218 board_time_init = indy_time_init;
219 board_timer_setup = indy_timer_setup; 219 board_timer_setup = indy_timer_setup;
diff --git a/arch/mips/sgi-ip27/ip27-memory.c b/arch/mips/sgi-ip27/ip27-memory.c
index e0d095daa5ed..6c00dce9f73f 100644
--- a/arch/mips/sgi-ip27/ip27-memory.c
+++ b/arch/mips/sgi-ip27/ip27-memory.c
@@ -19,6 +19,7 @@
19#include <linux/nodemask.h> 19#include <linux/nodemask.h>
20#include <linux/swap.h> 20#include <linux/swap.h>
21#include <linux/bootmem.h> 21#include <linux/bootmem.h>
22#include <linux/pfn.h>
22#include <asm/page.h> 23#include <asm/page.h>
23#include <asm/sections.h> 24#include <asm/sections.h>
24 25
@@ -28,8 +29,6 @@
28#include <asm/sn/sn_private.h> 29#include <asm/sn/sn_private.h>
29 30
30 31
31#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
32
33#define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT) 32#define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT)
34#define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT) 33#define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT)
35 34
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
index 0c948008b023..ab9d9cef089e 100644
--- a/arch/mips/sgi-ip32/ip32-reset.c
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -193,7 +193,7 @@ static __init int ip32_reboot_setup(void)
193 193
194 init_timer(&blink_timer); 194 init_timer(&blink_timer);
195 blink_timer.function = blink_timeout; 195 blink_timer.function = blink_timeout;
196 notifier_chain_register(&panic_notifier_list, &panic_block); 196 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
197 197
198 request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL); 198 request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL);
199 199
diff --git a/arch/mips/sgi-ip32/ip32-setup.c b/arch/mips/sgi-ip32/ip32-setup.c
index 2f50c79b7887..a2dd8ae1ea8f 100644
--- a/arch/mips/sgi-ip32/ip32-setup.c
+++ b/arch/mips/sgi-ip32/ip32-setup.c
@@ -91,8 +91,8 @@ void __init plat_setup(void)
91{ 91{
92 board_be_init = ip32_be_init; 92 board_be_init = ip32_be_init;
93 93
94 rtc_get_time = mc146818_get_cmos_time; 94 rtc_mips_get_time = mc146818_get_cmos_time;
95 rtc_set_mmss = mc146818_set_rtc_mmss; 95 rtc_mips_set_mmss = mc146818_set_rtc_mmss;
96 96
97 board_time_init = ip32_time_init; 97 board_time_init = ip32_time_init;
98 board_timer_setup = ip32_timer_setup; 98 board_timer_setup = ip32_timer_setup;
diff --git a/arch/mips/sibyte/swarm/setup.c b/arch/mips/sibyte/swarm/setup.c
index b661d2425a36..4b5f74ff3edd 100644
--- a/arch/mips/sibyte/swarm/setup.c
+++ b/arch/mips/sibyte/swarm/setup.c
@@ -121,14 +121,14 @@ void __init plat_setup(void)
121 121
122 if (xicor_probe()) { 122 if (xicor_probe()) {
123 printk("swarm setup: Xicor 1241 RTC detected.\n"); 123 printk("swarm setup: Xicor 1241 RTC detected.\n");
124 rtc_get_time = xicor_get_time; 124 rtc_mips_get_time = xicor_get_time;
125 rtc_set_time = xicor_set_time; 125 rtc_mips_set_time = xicor_set_time;
126 } 126 }
127 127
128 if (m41t81_probe()) { 128 if (m41t81_probe()) {
129 printk("swarm setup: M41T81 RTC detected.\n"); 129 printk("swarm setup: M41T81 RTC detected.\n");
130 rtc_get_time = m41t81_get_time; 130 rtc_mips_get_time = m41t81_get_time;
131 rtc_set_time = m41t81_set_time; 131 rtc_mips_set_time = m41t81_set_time;
132 } 132 }
133 133
134 printk("This kernel optimized for " 134 printk("This kernel optimized for "
diff --git a/arch/mips/sni/setup.c b/arch/mips/sni/setup.c
index 1141fcd13a59..01ba6c581e3d 100644
--- a/arch/mips/sni/setup.c
+++ b/arch/mips/sni/setup.c
@@ -164,8 +164,8 @@ static struct pci_controller sni_controller = {
164 164
165static inline void sni_pcimt_time_init(void) 165static inline void sni_pcimt_time_init(void)
166{ 166{
167 rtc_get_time = mc146818_get_cmos_time; 167 rtc_mips_get_time = mc146818_get_cmos_time;
168 rtc_set_time = mc146818_set_rtc_mmss; 168 rtc_mips_set_time = mc146818_set_rtc_mmss;
169} 169}
170 170
171void __init plat_setup(void) 171void __init plat_setup(void)
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index 2ad6401d2af4..6dcf077f61a0 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -1036,8 +1036,8 @@ toshiba_rbtx4927_time_init(void)
1036 1036
1037#ifdef CONFIG_RTC_DS1742 1037#ifdef CONFIG_RTC_DS1742
1038 1038
1039 rtc_get_time = rtc_ds1742_get_time; 1039 rtc_mips_get_time = rtc_ds1742_get_time;
1040 rtc_set_time = rtc_ds1742_set_time; 1040 rtc_mips_set_time = rtc_ds1742_set_time;
1041 1041
1042 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT, 1042 TOSHIBA_RBTX4927_SETUP_DPRINTK(TOSHIBA_RBTX4927_SETUP_TIME_INIT,
1043 ":rtc_ds1742_init()-\n"); 1043 ":rtc_ds1742_init()-\n");
diff --git a/arch/mips/tx4938/common/rtc_rx5c348.c b/arch/mips/tx4938/common/rtc_rx5c348.c
index d249edbb6af4..07f782fc0725 100644
--- a/arch/mips/tx4938/common/rtc_rx5c348.c
+++ b/arch/mips/tx4938/common/rtc_rx5c348.c
@@ -14,6 +14,7 @@
14#include <linux/string.h> 14#include <linux/string.h>
15#include <linux/rtc.h> 15#include <linux/rtc.h>
16#include <linux/time.h> 16#include <linux/time.h>
17#include <linux/bcd.h>
17#include <asm/time.h> 18#include <asm/time.h>
18#include <asm/tx4938/spi.h> 19#include <asm/tx4938/spi.h>
19 20
@@ -77,17 +78,6 @@ spi_rtc_io(unsigned char *inbuf, unsigned char *outbuf, unsigned int count)
77 inbufs, incounts, outbufs, outcounts, 0); 78 inbufs, incounts, outbufs, outcounts, 0);
78} 79}
79 80
80/*
81 * Conversion between binary and BCD.
82 */
83#ifndef BCD_TO_BIN
84#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
85#endif
86
87#ifndef BIN_TO_BCD
88#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
89#endif
90
91/* RTC-dependent code for time.c */ 81/* RTC-dependent code for time.c */
92 82
93static int 83static int
@@ -197,6 +187,6 @@ rtc_rx5c348_init(int chipid)
197 srtc_24h = 1; 187 srtc_24h = 1;
198 188
199 /* set the function pointers */ 189 /* set the function pointers */
200 rtc_get_time = rtc_rx5c348_get_time; 190 rtc_mips_get_time = rtc_rx5c348_get_time;
201 rtc_set_time = rtc_rx5c348_set_time; 191 rtc_mips_set_time = rtc_rx5c348_set_time;
202} 192}
diff --git a/arch/parisc/kernel/pdc_chassis.c b/arch/parisc/kernel/pdc_chassis.c
index 2a01fe1bdc98..0cea6958f427 100644
--- a/arch/parisc/kernel/pdc_chassis.c
+++ b/arch/parisc/kernel/pdc_chassis.c
@@ -150,7 +150,8 @@ void __init parisc_pdc_chassis_init(void)
150 150
151 if (handle) { 151 if (handle) {
152 /* initialize panic notifier chain */ 152 /* initialize panic notifier chain */
153 notifier_chain_register(&panic_notifier_list, &pdc_chassis_panic_block); 153 atomic_notifier_chain_register(&panic_notifier_list,
154 &pdc_chassis_panic_block);
154 155
155 /* initialize reboot notifier chain */ 156 /* initialize reboot notifier chain */
156 register_reboot_notifier(&pdc_chassis_reboot_block); 157 register_reboot_notifier(&pdc_chassis_reboot_block);
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index a433b7126d33..2cdc35ce8045 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -491,7 +491,7 @@ config PPC601_SYNC_FIX
491 If in doubt, say Y here. 491 If in doubt, say Y here.
492 492
493config TAU 493config TAU
494 bool "Thermal Management Support" 494 bool "On-chip CPU temperature sensor support"
495 depends on 6xx 495 depends on 6xx
496 help 496 help
497 G3 and G4 processors have an on-chip temperature sensor called the 497 G3 and G4 processors have an on-chip temperature sensor called the
@@ -500,7 +500,7 @@ config TAU
500 on-die temperature in /proc/cpuinfo if the cpu supports it. 500 on-die temperature in /proc/cpuinfo if the cpu supports it.
501 501
502 Unfortunately, on some chip revisions, this sensor is very inaccurate 502 Unfortunately, on some chip revisions, this sensor is very inaccurate
503 and in some cases, does not work at all, so don't assume the cpu 503 and in many cases, does not work at all, so don't assume the cpu
504 temp is actually what /proc/cpuinfo says it is. 504 temp is actually what /proc/cpuinfo says it is.
505 505
506config TAU_INT 506config TAU_INT
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 9254806f7032..8d48e9e7162a 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -110,11 +110,6 @@ config SERIAL_TEXT_DEBUG
110 depends on 4xx || LOPEC || MV64X60 || PPLUS || PRPMC800 || \ 110 depends on 4xx || LOPEC || MV64X60 || PPLUS || PRPMC800 || \
111 PPC_GEN550 || PPC_MPC52xx 111 PPC_GEN550 || PPC_MPC52xx
112 112
113config PPC_OCP
114 bool
115 depends on IBM_OCP || XILINX_OCP
116 default y
117
118choice 113choice
119 prompt "Early debugging (dangerous)" 114 prompt "Early debugging (dangerous)"
120 bool 115 bool
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 829e017b8a54..6ec84d37a337 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -129,13 +129,8 @@ core-y += arch/powerpc/kernel/ \
129 arch/powerpc/lib/ \ 129 arch/powerpc/lib/ \
130 arch/powerpc/sysdev/ \ 130 arch/powerpc/sysdev/ \
131 arch/powerpc/platforms/ 131 arch/powerpc/platforms/
132core-$(CONFIG_PPC32) += arch/ppc/kernel/ 132core-$(CONFIG_MATH_EMULATION) += arch/powerpc/math-emu/
133core-$(CONFIG_MATH_EMULATION) += arch/ppc/math-emu/
134core-$(CONFIG_XMON) += arch/powerpc/xmon/ 133core-$(CONFIG_XMON) += arch/powerpc/xmon/
135core-$(CONFIG_APUS) += arch/ppc/amiga/
136drivers-$(CONFIG_8xx) += arch/ppc/8xx_io/
137drivers-$(CONFIG_4xx) += arch/ppc/4xx_io/
138drivers-$(CONFIG_CPM2) += arch/ppc/8260_io/
139 134
140drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/ 135drivers-$(CONFIG_OPROFILE) += arch/powerpc/oprofile/
141 136
diff --git a/arch/powerpc/configs/cell_defconfig b/arch/powerpc/configs/cell_defconfig
index 3c2acab63736..fe22e54ab2b0 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.16-rc6 3# Linux kernel version: 2.6.16
4# Wed Mar 15 16:19:48 2006 4# Thu Mar 23 20:48:09 2006
5# 5#
6CONFIG_PPC64=y 6CONFIG_PPC64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -30,6 +30,7 @@ CONFIG_POWER4=y
30CONFIG_PPC_FPU=y 30CONFIG_PPC_FPU=y
31CONFIG_ALTIVEC=y 31CONFIG_ALTIVEC=y
32CONFIG_PPC_STD_MMU=y 32CONFIG_PPC_STD_MMU=y
33CONFIG_VIRT_CPU_ACCOUNTING=y
33CONFIG_SMP=y 34CONFIG_SMP=y
34CONFIG_NR_CPUS=4 35CONFIG_NR_CPUS=4
35 36
@@ -51,7 +52,8 @@ CONFIG_SYSVIPC=y
51# CONFIG_BSD_PROCESS_ACCT is not set 52# CONFIG_BSD_PROCESS_ACCT is not set
52CONFIG_SYSCTL=y 53CONFIG_SYSCTL=y
53# CONFIG_AUDIT is not set 54# CONFIG_AUDIT is not set
54# CONFIG_IKCONFIG is not set 55CONFIG_IKCONFIG=y
56CONFIG_IKCONFIG_PROC=y
55# CONFIG_CPUSETS is not set 57# CONFIG_CPUSETS is not set
56CONFIG_INITRAMFS_SOURCE="" 58CONFIG_INITRAMFS_SOURCE=""
57CONFIG_CC_OPTIMIZE_FOR_SIZE=y 59CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -85,7 +87,7 @@ CONFIG_MODULE_UNLOAD=y
85CONFIG_OBSOLETE_MODPARM=y 87CONFIG_OBSOLETE_MODPARM=y
86# CONFIG_MODVERSIONS is not set 88# CONFIG_MODVERSIONS is not set
87# CONFIG_MODULE_SRCVERSION_ALL is not set 89# CONFIG_MODULE_SRCVERSION_ALL is not set
88# CONFIG_KMOD is not set 90CONFIG_KMOD=y
89CONFIG_STOP_MACHINE=y 91CONFIG_STOP_MACHINE=y
90 92
91# 93#
@@ -130,7 +132,8 @@ CONFIG_CELL_IIC=y
130# 132#
131# Cell Broadband Engine options 133# Cell Broadband Engine options
132# 134#
133CONFIG_SPU_FS=y 135CONFIG_SPU_FS=m
136CONFIG_SPUFS_MMAP=y
134 137
135# 138#
136# Kernel options 139# Kernel options
@@ -144,7 +147,7 @@ CONFIG_PREEMPT_NONE=y
144# CONFIG_PREEMPT is not set 147# CONFIG_PREEMPT is not set
145CONFIG_PREEMPT_BKL=y 148CONFIG_PREEMPT_BKL=y
146CONFIG_BINFMT_ELF=y 149CONFIG_BINFMT_ELF=y
147# CONFIG_BINFMT_MISC is not set 150CONFIG_BINFMT_MISC=m
148CONFIG_FORCE_MAX_ZONEORDER=13 151CONFIG_FORCE_MAX_ZONEORDER=13
149# CONFIG_IOMMU_VMERGE is not set 152# CONFIG_IOMMU_VMERGE is not set
150CONFIG_KEXEC=y 153CONFIG_KEXEC=y
@@ -155,13 +158,16 @@ CONFIG_ARCH_SELECT_MEMORY_MODEL=y
155CONFIG_ARCH_FLATMEM_ENABLE=y 158CONFIG_ARCH_FLATMEM_ENABLE=y
156CONFIG_ARCH_SPARSEMEM_ENABLE=y 159CONFIG_ARCH_SPARSEMEM_ENABLE=y
157CONFIG_SELECT_MEMORY_MODEL=y 160CONFIG_SELECT_MEMORY_MODEL=y
158CONFIG_FLATMEM_MANUAL=y 161# CONFIG_FLATMEM_MANUAL is not set
159# CONFIG_DISCONTIGMEM_MANUAL is not set 162# CONFIG_DISCONTIGMEM_MANUAL is not set
160# CONFIG_SPARSEMEM_MANUAL is not set 163CONFIG_SPARSEMEM_MANUAL=y
161CONFIG_FLATMEM=y 164CONFIG_SPARSEMEM=y
162CONFIG_FLAT_NODE_MEM_MAP=y 165CONFIG_HAVE_MEMORY_PRESENT=y
163# CONFIG_SPARSEMEM_STATIC is not set 166# CONFIG_SPARSEMEM_STATIC is not set
167CONFIG_SPARSEMEM_EXTREME=y
168# CONFIG_MEMORY_HOTPLUG is not set
164CONFIG_SPLIT_PTLOCK_CPUS=4 169CONFIG_SPLIT_PTLOCK_CPUS=4
170CONFIG_MIGRATION=y
165# CONFIG_PPC_64K_PAGES is not set 171# CONFIG_PPC_64K_PAGES is not set
166CONFIG_SCHED_SMT=y 172CONFIG_SCHED_SMT=y
167CONFIG_PROC_DEVICETREE=y 173CONFIG_PROC_DEVICETREE=y
@@ -232,6 +238,7 @@ CONFIG_TCP_CONG_BIC=y
232# CONFIG_IP_VS is not set 238# CONFIG_IP_VS is not set
233CONFIG_IPV6=y 239CONFIG_IPV6=y
234# CONFIG_IPV6_PRIVACY is not set 240# CONFIG_IPV6_PRIVACY is not set
241# CONFIG_IPV6_ROUTER_PREF is not set
235CONFIG_INET6_AH=m 242CONFIG_INET6_AH=m
236CONFIG_INET6_ESP=m 243CONFIG_INET6_ESP=m
237CONFIG_INET6_IPCOMP=m 244CONFIG_INET6_IPCOMP=m
@@ -244,25 +251,7 @@ CONFIG_NETFILTER=y
244# Core Netfilter Configuration 251# Core Netfilter Configuration
245# 252#
246# CONFIG_NETFILTER_NETLINK is not set 253# CONFIG_NETFILTER_NETLINK is not set
247CONFIG_NETFILTER_XTABLES=m 254# CONFIG_NETFILTER_XTABLES is not set
248CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
249CONFIG_NETFILTER_XT_TARGET_MARK=m
250CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
251CONFIG_NETFILTER_XT_TARGET_NOTRACK=m
252CONFIG_NETFILTER_XT_MATCH_COMMENT=m
253CONFIG_NETFILTER_XT_MATCH_CONNTRACK=m
254# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
255CONFIG_NETFILTER_XT_MATCH_HELPER=m
256CONFIG_NETFILTER_XT_MATCH_LENGTH=m
257CONFIG_NETFILTER_XT_MATCH_LIMIT=m
258CONFIG_NETFILTER_XT_MATCH_MAC=m
259CONFIG_NETFILTER_XT_MATCH_MARK=m
260CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
261CONFIG_NETFILTER_XT_MATCH_REALM=m
262CONFIG_NETFILTER_XT_MATCH_SCTP=m
263CONFIG_NETFILTER_XT_MATCH_STATE=m
264CONFIG_NETFILTER_XT_MATCH_STRING=m
265CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
266 255
267# 256#
268# IP: Netfilter Configuration 257# IP: Netfilter Configuration
@@ -278,51 +267,13 @@ CONFIG_IP_NF_IRC=m
278CONFIG_IP_NF_TFTP=m 267CONFIG_IP_NF_TFTP=m
279CONFIG_IP_NF_AMANDA=m 268CONFIG_IP_NF_AMANDA=m
280# CONFIG_IP_NF_PPTP is not set 269# CONFIG_IP_NF_PPTP is not set
270# CONFIG_IP_NF_H323 is not set
281CONFIG_IP_NF_QUEUE=m 271CONFIG_IP_NF_QUEUE=m
282CONFIG_IP_NF_IPTABLES=m
283CONFIG_IP_NF_MATCH_IPRANGE=m
284CONFIG_IP_NF_MATCH_MULTIPORT=m
285CONFIG_IP_NF_MATCH_TOS=m
286CONFIG_IP_NF_MATCH_RECENT=m
287CONFIG_IP_NF_MATCH_ECN=m
288CONFIG_IP_NF_MATCH_DSCP=m
289CONFIG_IP_NF_MATCH_AH_ESP=m
290CONFIG_IP_NF_MATCH_TTL=m
291CONFIG_IP_NF_MATCH_OWNER=m
292CONFIG_IP_NF_MATCH_ADDRTYPE=m
293CONFIG_IP_NF_MATCH_HASHLIMIT=m
294CONFIG_IP_NF_MATCH_POLICY=m
295CONFIG_IP_NF_FILTER=m
296CONFIG_IP_NF_TARGET_REJECT=m
297CONFIG_IP_NF_TARGET_LOG=m
298CONFIG_IP_NF_TARGET_ULOG=m
299CONFIG_IP_NF_TARGET_TCPMSS=m
300CONFIG_IP_NF_NAT=m
301CONFIG_IP_NF_NAT_NEEDED=y
302CONFIG_IP_NF_TARGET_MASQUERADE=m
303CONFIG_IP_NF_TARGET_REDIRECT=m
304CONFIG_IP_NF_TARGET_NETMAP=m
305CONFIG_IP_NF_TARGET_SAME=m
306CONFIG_IP_NF_NAT_SNMP_BASIC=m
307CONFIG_IP_NF_NAT_IRC=m
308CONFIG_IP_NF_NAT_FTP=m
309CONFIG_IP_NF_NAT_TFTP=m
310CONFIG_IP_NF_NAT_AMANDA=m
311CONFIG_IP_NF_MANGLE=m
312CONFIG_IP_NF_TARGET_TOS=m
313CONFIG_IP_NF_TARGET_ECN=m
314CONFIG_IP_NF_TARGET_DSCP=m
315CONFIG_IP_NF_TARGET_TTL=m
316CONFIG_IP_NF_RAW=m
317CONFIG_IP_NF_ARPTABLES=m
318CONFIG_IP_NF_ARPFILTER=m
319CONFIG_IP_NF_ARP_MANGLE=m
320 272
321# 273#
322# IPv6: Netfilter Configuration (EXPERIMENTAL) 274# IPv6: Netfilter Configuration (EXPERIMENTAL)
323# 275#
324# CONFIG_IP6_NF_QUEUE is not set 276# CONFIG_IP6_NF_QUEUE is not set
325# CONFIG_IP6_NF_IPTABLES is not set
326 277
327# 278#
328# DCCP Configuration (EXPERIMENTAL) 279# DCCP Configuration (EXPERIMENTAL)
@@ -355,7 +306,6 @@ CONFIG_IP_NF_ARP_MANGLE=m
355# QoS and/or fair queueing 306# QoS and/or fair queueing
356# 307#
357# CONFIG_NET_SCHED is not set 308# CONFIG_NET_SCHED is not set
358CONFIG_NET_CLS_ROUTE=y
359 309
360# 310#
361# Network testing 311# Network testing
@@ -408,7 +358,7 @@ CONFIG_FW_LOADER=y
408# CONFIG_BLK_DEV_COW_COMMON is not set 358# CONFIG_BLK_DEV_COW_COMMON is not set
409CONFIG_BLK_DEV_LOOP=y 359CONFIG_BLK_DEV_LOOP=y
410# CONFIG_BLK_DEV_CRYPTOLOOP is not set 360# CONFIG_BLK_DEV_CRYPTOLOOP is not set
411CONFIG_BLK_DEV_NBD=y 361# CONFIG_BLK_DEV_NBD is not set
412# CONFIG_BLK_DEV_SX8 is not set 362# CONFIG_BLK_DEV_SX8 is not set
413CONFIG_BLK_DEV_RAM=y 363CONFIG_BLK_DEV_RAM=y
414CONFIG_BLK_DEV_RAM_COUNT=16 364CONFIG_BLK_DEV_RAM_COUNT=16
@@ -484,7 +434,23 @@ CONFIG_IDEDMA_AUTO=y
484# 434#
485# Multi-device support (RAID and LVM) 435# Multi-device support (RAID and LVM)
486# 436#
487# CONFIG_MD is not set 437CONFIG_MD=y
438CONFIG_BLK_DEV_MD=m
439CONFIG_MD_LINEAR=m
440CONFIG_MD_RAID0=m
441CONFIG_MD_RAID1=m
442# CONFIG_MD_RAID10 is not set
443# CONFIG_MD_RAID5 is not set
444# CONFIG_MD_RAID6 is not set
445# CONFIG_MD_MULTIPATH is not set
446# CONFIG_MD_FAULTY is not set
447CONFIG_BLK_DEV_DM=m
448CONFIG_DM_CRYPT=m
449CONFIG_DM_SNAPSHOT=m
450CONFIG_DM_MIRROR=m
451CONFIG_DM_ZERO=m
452CONFIG_DM_MULTIPATH=m
453# CONFIG_DM_MULTIPATH_EMC is not set
488 454
489# 455#
490# Fusion MPT device support 456# Fusion MPT device support
@@ -548,7 +514,7 @@ CONFIG_MII=y
548# CONFIG_ACENIC is not set 514# CONFIG_ACENIC is not set
549# CONFIG_DL2K is not set 515# CONFIG_DL2K is not set
550CONFIG_E1000=m 516CONFIG_E1000=m
551# CONFIG_E1000_NAPI is not set 517CONFIG_E1000_NAPI=y
552# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 518# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
553# CONFIG_NS83820 is not set 519# CONFIG_NS83820 is not set
554# CONFIG_HAMACHI is not set 520# CONFIG_HAMACHI is not set
@@ -560,7 +526,7 @@ CONFIG_SKGE=m
560# CONFIG_SK98LIN is not set 526# CONFIG_SK98LIN is not set
561# CONFIG_TIGON3 is not set 527# CONFIG_TIGON3 is not set
562# CONFIG_BNX2 is not set 528# CONFIG_BNX2 is not set
563CONFIG_SPIDER_NET=y 529CONFIG_SPIDER_NET=m
564# CONFIG_MV643XX_ETH is not set 530# CONFIG_MV643XX_ETH is not set
565 531
566# 532#
@@ -678,6 +644,8 @@ CONFIG_SERIAL_CORE_CONSOLE=y
678# CONFIG_SERIAL_JSM is not set 644# CONFIG_SERIAL_JSM is not set
679CONFIG_UNIX98_PTYS=y 645CONFIG_UNIX98_PTYS=y
680# CONFIG_LEGACY_PTYS is not set 646# CONFIG_LEGACY_PTYS is not set
647CONFIG_HVC_DRIVER=y
648CONFIG_HVC_RTAS=y
681 649
682# 650#
683# IPMI 651# IPMI
@@ -694,14 +662,13 @@ CONFIG_WATCHDOG=y
694# Watchdog Device Drivers 662# Watchdog Device Drivers
695# 663#
696# CONFIG_SOFT_WATCHDOG is not set 664# CONFIG_SOFT_WATCHDOG is not set
697# CONFIG_WATCHDOG_RTAS is not set 665CONFIG_WATCHDOG_RTAS=y
698 666
699# 667#
700# PCI-based Watchdog Cards 668# PCI-based Watchdog Cards
701# 669#
702# CONFIG_PCIPCWATCHDOG is not set 670# CONFIG_PCIPCWATCHDOG is not set
703# CONFIG_WDTPCI is not set 671# CONFIG_WDTPCI is not set
704# CONFIG_RTC is not set
705CONFIG_GEN_RTC=y 672CONFIG_GEN_RTC=y
706# CONFIG_GEN_RTC_X is not set 673# CONFIG_GEN_RTC_X is not set
707# CONFIG_DTLK is not set 674# CONFIG_DTLK is not set
@@ -833,6 +800,7 @@ CONFIG_DUMMY_CONSOLE=y
833# 800#
834CONFIG_USB_ARCH_HAS_HCD=y 801CONFIG_USB_ARCH_HAS_HCD=y
835CONFIG_USB_ARCH_HAS_OHCI=y 802CONFIG_USB_ARCH_HAS_OHCI=y
803CONFIG_USB_ARCH_HAS_EHCI=y
836# CONFIG_USB is not set 804# CONFIG_USB is not set
837 805
838# 806#
@@ -852,7 +820,14 @@ CONFIG_USB_ARCH_HAS_OHCI=y
852# 820#
853# InfiniBand support 821# InfiniBand support
854# 822#
855# CONFIG_INFINIBAND is not set 823CONFIG_INFINIBAND=y
824CONFIG_INFINIBAND_USER_MAD=m
825CONFIG_INFINIBAND_USER_ACCESS=m
826CONFIG_INFINIBAND_MTHCA=m
827CONFIG_INFINIBAND_MTHCA_DEBUG=y
828CONFIG_INFINIBAND_IPOIB=m
829CONFIG_INFINIBAND_IPOIB_DEBUG=y
830CONFIG_INFINIBAND_IPOIB_DEBUG_DATA=y
856 831
857# 832#
858# EDAC - error detection and reporting (RAS) (EXPERIMENTAL) 833# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
@@ -1037,10 +1012,6 @@ CONFIG_CRC32=y
1037# CONFIG_LIBCRC32C is not set 1012# CONFIG_LIBCRC32C is not set
1038CONFIG_ZLIB_INFLATE=m 1013CONFIG_ZLIB_INFLATE=m
1039CONFIG_ZLIB_DEFLATE=m 1014CONFIG_ZLIB_DEFLATE=m
1040CONFIG_TEXTSEARCH=y
1041CONFIG_TEXTSEARCH_KMP=m
1042CONFIG_TEXTSEARCH_BM=m
1043CONFIG_TEXTSEARCH_FSM=m
1044 1015
1045# 1016#
1046# Instrumentation Support 1017# Instrumentation Support
@@ -1058,7 +1029,7 @@ CONFIG_LOG_BUF_SHIFT=15
1058CONFIG_DETECT_SOFTLOCKUP=y 1029CONFIG_DETECT_SOFTLOCKUP=y
1059# CONFIG_SCHEDSTATS is not set 1030# CONFIG_SCHEDSTATS is not set
1060# CONFIG_DEBUG_SLAB is not set 1031# CONFIG_DEBUG_SLAB is not set
1061# CONFIG_DEBUG_MUTEXES is not set 1032CONFIG_DEBUG_MUTEXES=y
1062# CONFIG_DEBUG_SPINLOCK is not set 1033# CONFIG_DEBUG_SPINLOCK is not set
1063CONFIG_DEBUG_SPINLOCK_SLEEP=y 1034CONFIG_DEBUG_SPINLOCK_SLEEP=y
1064# CONFIG_DEBUG_KOBJECT is not set 1035# CONFIG_DEBUG_KOBJECT is not set
diff --git a/arch/powerpc/configs/mpc8540_ads_defconfig b/arch/powerpc/configs/mpc8540_ads_defconfig
index 2a8290ee15c6..7f0780f1aa39 100644
--- a/arch/powerpc/configs/mpc8540_ads_defconfig
+++ b/arch/powerpc/configs/mpc8540_ads_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: 3# Linux kernel version: 2.6.16
4# Sat Jan 14 15:57:54 2006 4# Mon Mar 27 23:37:36 2006
5# 5#
6# CONFIG_PPC64 is not set 6# CONFIG_PPC64 is not set
7CONFIG_PPC32=y 7CONFIG_PPC32=y
@@ -9,6 +9,7 @@ CONFIG_PPC_MERGE=y
9CONFIG_MMU=y 9CONFIG_MMU=y
10CONFIG_GENERIC_HARDIRQS=y 10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_RWSEM_XCHGADD_ALGORITHM=y 11CONFIG_RWSEM_XCHGADD_ALGORITHM=y
12CONFIG_GENERIC_HWEIGHT=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y 13CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_PPC=y 14CONFIG_PPC=y
14CONFIG_EARLY_PRINTK=y 15CONFIG_EARLY_PRINTK=y
@@ -18,6 +19,7 @@ CONFIG_ARCH_MAY_HAVE_PC_FDC=y
18CONFIG_PPC_OF=y 19CONFIG_PPC_OF=y
19CONFIG_PPC_UDBG_16550=y 20CONFIG_PPC_UDBG_16550=y
20# CONFIG_GENERIC_TBSYNC is not set 21# CONFIG_GENERIC_TBSYNC is not set
22CONFIG_DEFAULT_UIMAGE=y
21 23
22# 24#
23# Processor support 25# Processor support
@@ -42,7 +44,6 @@ CONFIG_SPE=y
42# Code maturity level options 44# Code maturity level options
43# 45#
44CONFIG_EXPERIMENTAL=y 46CONFIG_EXPERIMENTAL=y
45CONFIG_CLEAN_COMPILE=y
46CONFIG_BROKEN_ON_SMP=y 47CONFIG_BROKEN_ON_SMP=y
47CONFIG_INIT_ENV_ARG_LIMIT=32 48CONFIG_INIT_ENV_ARG_LIMIT=32
48 49
@@ -58,6 +59,7 @@ CONFIG_SYSVIPC=y
58CONFIG_SYSCTL=y 59CONFIG_SYSCTL=y
59# CONFIG_AUDIT is not set 60# CONFIG_AUDIT is not set
60# CONFIG_IKCONFIG is not set 61# CONFIG_IKCONFIG is not set
62# CONFIG_RELAY is not set
61CONFIG_INITRAMFS_SOURCE="" 63CONFIG_INITRAMFS_SOURCE=""
62# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 64# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
63CONFIG_EMBEDDED=y 65CONFIG_EMBEDDED=y
@@ -72,10 +74,6 @@ CONFIG_BASE_FULL=y
72CONFIG_FUTEX=y 74CONFIG_FUTEX=y
73CONFIG_EPOLL=y 75CONFIG_EPOLL=y
74CONFIG_SHMEM=y 76CONFIG_SHMEM=y
75CONFIG_CC_ALIGN_FUNCTIONS=0
76CONFIG_CC_ALIGN_LABELS=0
77CONFIG_CC_ALIGN_LOOPS=0
78CONFIG_CC_ALIGN_JUMPS=0
79CONFIG_SLAB=y 77CONFIG_SLAB=y
80# CONFIG_TINY_SHMEM is not set 78# CONFIG_TINY_SHMEM is not set
81CONFIG_BASE_SMALL=0 79CONFIG_BASE_SMALL=0
@@ -90,6 +88,8 @@ CONFIG_BASE_SMALL=0
90# Block layer 88# Block layer
91# 89#
92# CONFIG_LBD is not set 90# CONFIG_LBD is not set
91# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_LSF is not set
93 93
94# 94#
95# IO Schedulers 95# IO Schedulers
@@ -183,6 +183,7 @@ CONFIG_NET=y
183# 183#
184# Networking options 184# Networking options
185# 185#
186# CONFIG_NETDEBUG is not set
186CONFIG_PACKET=y 187CONFIG_PACKET=y
187# CONFIG_PACKET_MMAP is not set 188# CONFIG_PACKET_MMAP is not set
188CONFIG_UNIX=y 189CONFIG_UNIX=y
@@ -220,6 +221,11 @@ CONFIG_TCP_CONG_BIC=y
220# SCTP Configuration (EXPERIMENTAL) 221# SCTP Configuration (EXPERIMENTAL)
221# 222#
222# CONFIG_IP_SCTP is not set 223# CONFIG_IP_SCTP is not set
224
225#
226# TIPC Configuration (EXPERIMENTAL)
227#
228# CONFIG_TIPC is not set
223# CONFIG_ATM is not set 229# CONFIG_ATM is not set
224# CONFIG_BRIDGE is not set 230# CONFIG_BRIDGE is not set
225# CONFIG_VLAN_8021Q is not set 231# CONFIG_VLAN_8021Q is not set
@@ -229,11 +235,6 @@ CONFIG_TCP_CONG_BIC=y
229# CONFIG_ATALK is not set 235# CONFIG_ATALK is not set
230# CONFIG_X25 is not set 236# CONFIG_X25 is not set
231# CONFIG_LAPB is not set 237# CONFIG_LAPB is not set
232
233#
234# TIPC Configuration (EXPERIMENTAL)
235#
236# CONFIG_TIPC is not set
237# CONFIG_NET_DIVERT is not set 238# CONFIG_NET_DIVERT is not set
238# CONFIG_ECONET is not set 239# CONFIG_ECONET is not set
239# CONFIG_WAN_ROUTER is not set 240# CONFIG_WAN_ROUTER is not set
@@ -487,6 +488,12 @@ CONFIG_GEN_RTC=y
487# CONFIG_I2C is not set 488# CONFIG_I2C is not set
488 489
489# 490#
491# SPI support
492#
493# CONFIG_SPI is not set
494# CONFIG_SPI_MASTER is not set
495
496#
490# Dallas's 1-wire bus 497# Dallas's 1-wire bus
491# 498#
492# CONFIG_W1 is not set 499# CONFIG_W1 is not set
@@ -496,6 +503,7 @@ CONFIG_GEN_RTC=y
496# 503#
497CONFIG_HWMON=y 504CONFIG_HWMON=y
498# CONFIG_HWMON_VID is not set 505# CONFIG_HWMON_VID is not set
506# CONFIG_SENSORS_F71805F is not set
499# CONFIG_HWMON_DEBUG_CHIP is not set 507# CONFIG_HWMON_DEBUG_CHIP is not set
500 508
501# 509#
@@ -503,10 +511,6 @@ CONFIG_HWMON=y
503# 511#
504 512
505# 513#
506# Multimedia Capabilities Port drivers
507#
508
509#
510# Multimedia devices 514# Multimedia devices
511# 515#
512# CONFIG_VIDEO_DEV is not set 516# CONFIG_VIDEO_DEV is not set
@@ -531,6 +535,7 @@ CONFIG_HWMON=y
531# 535#
532# CONFIG_USB_ARCH_HAS_HCD is not set 536# CONFIG_USB_ARCH_HAS_HCD is not set
533# CONFIG_USB_ARCH_HAS_OHCI is not set 537# CONFIG_USB_ARCH_HAS_OHCI is not set
538# CONFIG_USB_ARCH_HAS_EHCI is not set
534 539
535# 540#
536# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 541# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
@@ -551,7 +556,7 @@ CONFIG_HWMON=y
551# 556#
552 557
553# 558#
554# SN Devices 559# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
555# 560#
556 561
557# 562#
@@ -603,7 +608,6 @@ CONFIG_SYSFS=y
603CONFIG_TMPFS=y 608CONFIG_TMPFS=y
604# CONFIG_HUGETLB_PAGE is not set 609# CONFIG_HUGETLB_PAGE is not set
605CONFIG_RAMFS=y 610CONFIG_RAMFS=y
606# CONFIG_RELAYFS_FS is not set
607# CONFIG_CONFIGFS_FS is not set 611# CONFIG_CONFIGFS_FS is not set
608 612
609# 613#
@@ -658,6 +662,7 @@ CONFIG_PARTITION_ADVANCED=y
658# CONFIG_SGI_PARTITION is not set 662# CONFIG_SGI_PARTITION is not set
659# CONFIG_ULTRIX_PARTITION is not set 663# CONFIG_ULTRIX_PARTITION is not set
660# CONFIG_SUN_PARTITION is not set 664# CONFIG_SUN_PARTITION is not set
665# CONFIG_KARMA_PARTITION is not set
661# CONFIG_EFI_PARTITION is not set 666# CONFIG_EFI_PARTITION is not set
662 667
663# 668#
@@ -695,6 +700,8 @@ CONFIG_DEBUG_MUTEXES=y
695# CONFIG_DEBUG_INFO is not set 700# CONFIG_DEBUG_INFO is not set
696# CONFIG_DEBUG_FS is not set 701# CONFIG_DEBUG_FS is not set
697# CONFIG_DEBUG_VM is not set 702# CONFIG_DEBUG_VM is not set
703# CONFIG_UNWIND_INFO is not set
704CONFIG_FORCED_INLINING=y
698# CONFIG_RCU_TORTURE_TEST is not set 705# CONFIG_RCU_TORTURE_TEST is not set
699# CONFIG_DEBUGGER is not set 706# CONFIG_DEBUGGER is not set
700# CONFIG_BDI_SWITCH is not set 707# CONFIG_BDI_SWITCH is not set
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 80e9fe2632b8..0cc0995b81b0 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -12,12 +12,12 @@ endif
12 12
13obj-y := semaphore.o cputable.o ptrace.o syscalls.o \ 13obj-y := semaphore.o cputable.o ptrace.o syscalls.o \
14 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 systbl.o 15 init_task.o process.o systbl.o idle.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 \ 18 signal_64.o ptrace32.o \
19 paca.o cpu_setup_power4.o \ 19 paca.o cpu_setup_power4.o \
20 firmware.o sysfs.o idle_64.o 20 firmware.o sysfs.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
@@ -34,6 +34,11 @@ obj-$(CONFIG_IBMEBUS) += ibmebus.o
34obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o 34obj-$(CONFIG_GENERIC_TBSYNC) += smp-tbsync.o
35obj64-$(CONFIG_PPC_MULTIPLATFORM) += nvram_64.o 35obj64-$(CONFIG_PPC_MULTIPLATFORM) += nvram_64.o
36obj-$(CONFIG_CRASH_DUMP) += crash_dump.o 36obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
37obj-$(CONFIG_6xx) += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
38obj-$(CONFIG_TAU) += tau_6xx.o
39obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
40obj32-$(CONFIG_MODULES) += module_32.o
41obj-$(CONFIG_E500) += perfmon_fsl_booke.o
37 42
38ifeq ($(CONFIG_PPC_MERGE),y) 43ifeq ($(CONFIG_PPC_MERGE),y)
39 44
@@ -51,7 +56,6 @@ obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o
51obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o 56obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
52obj-$(CONFIG_MODULES) += ppc_ksyms.o 57obj-$(CONFIG_MODULES) += ppc_ksyms.o
53obj-$(CONFIG_BOOTX_TEXT) += btext.o 58obj-$(CONFIG_BOOTX_TEXT) += btext.o
54obj-$(CONFIG_6xx) += idle_6xx.o
55obj-$(CONFIG_SMP) += smp.o 59obj-$(CONFIG_SMP) += smp.o
56obj-$(CONFIG_KPROBES) += kprobes.o 60obj-$(CONFIG_KPROBES) += kprobes.o
57obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o 61obj-$(CONFIG_PPC_UDBG_16550) += legacy_serial.o udbg_16550.o
@@ -77,6 +81,7 @@ smpobj-$(CONFIG_SMP) += smp.o
77 81
78endif 82endif
79 83
84obj-$(CONFIG_PPC32) += $(obj32-y)
80obj-$(CONFIG_PPC64) += $(obj64-y) 85obj-$(CONFIG_PPC64) += $(obj64-y)
81 86
82extra-$(CONFIG_PPC_FPU) += fpu.o 87extra-$(CONFIG_PPC_FPU) += fpu.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 882889b15926..54b48f330051 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -105,8 +105,6 @@ int main(void)
105 DEFINE(ICACHEL1LINESIZE, offsetof(struct ppc64_caches, iline_size)); 105 DEFINE(ICACHEL1LINESIZE, offsetof(struct ppc64_caches, iline_size));
106 DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_iline_size)); 106 DEFINE(ICACHEL1LOGLINESIZE, offsetof(struct ppc64_caches, log_iline_size));
107 DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, ilines_per_page)); 107 DEFINE(ICACHEL1LINESPERPAGE, offsetof(struct ppc64_caches, ilines_per_page));
108 DEFINE(PLATFORM_LPAR, PLATFORM_LPAR);
109
110 /* paca */ 108 /* paca */
111 DEFINE(PACA_SIZE, sizeof(struct paca_struct)); 109 DEFINE(PACA_SIZE, sizeof(struct paca_struct));
112 DEFINE(PACAPACAINDEX, offsetof(struct paca_struct, paca_index)); 110 DEFINE(PACAPACAINDEX, offsetof(struct paca_struct, paca_index));
diff --git a/arch/ppc/kernel/cpu_setup_6xx.S b/arch/powerpc/kernel/cpu_setup_6xx.S
index 55ed7716636f..55ed7716636f 100644
--- a/arch/ppc/kernel/cpu_setup_6xx.S
+++ b/arch/powerpc/kernel/cpu_setup_6xx.S
diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 4827ca1ec89b..b3a979467225 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -135,10 +135,10 @@ transfer_to_handler:
135 mfspr r11,SPRN_HID0 135 mfspr r11,SPRN_HID0
136 mtcr r11 136 mtcr r11
137BEGIN_FTR_SECTION 137BEGIN_FTR_SECTION
138 bt- 8,power_save_6xx_restore /* Check DOZE */ 138 bt- 8,4f /* Check DOZE */
139END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE) 139END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
140BEGIN_FTR_SECTION 140BEGIN_FTR_SECTION
141 bt- 9,power_save_6xx_restore /* Check NAP */ 141 bt- 9,4f /* Check NAP */
142END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP) 142END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
143#endif /* CONFIG_6xx */ 143#endif /* CONFIG_6xx */
144 .globl transfer_to_handler_cont 144 .globl transfer_to_handler_cont
@@ -157,6 +157,10 @@ transfer_to_handler_cont:
157 SYNC 157 SYNC
158 RFI /* jump to handler, enable MMU */ 158 RFI /* jump to handler, enable MMU */
159 159
160#ifdef CONFIG_6xx
1614: b power_save_6xx_restore
162#endif
163
160/* 164/*
161 * On kernel stack overflow, load up an initial stack pointer 165 * On kernel stack overflow, load up an initial stack pointer
162 * and call StackOverflow(regs), which should not return. 166 * and call StackOverflow(regs), which should not return.
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 1060155d84c3..19ad5c6b1818 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -617,6 +617,12 @@ _GLOBAL(enter_rtas)
617 mfsrr1 r10 617 mfsrr1 r10
618 std r10,_SRR1(r1) 618 std r10,_SRR1(r1)
619 619
620 /* Temporary workaround to clear CR until RTAS can be modified to
621 * ignore all bits.
622 */
623 li r0,0
624 mtcr r0
625
620 /* There is no way it is acceptable to get here with interrupts enabled, 626 /* There is no way it is acceptable to get here with interrupts enabled,
621 * check it with the asm equivalent of WARN_ON 627 * check it with the asm equivalent of WARN_ON
622 */ 628 */
diff --git a/arch/powerpc/kernel/firmware.c b/arch/powerpc/kernel/firmware.c
index 4d37a3cb80f6..0bfe9061720a 100644
--- a/arch/powerpc/kernel/firmware.c
+++ b/arch/powerpc/kernel/firmware.c
@@ -14,7 +14,9 @@
14 */ 14 */
15 15
16#include <linux/config.h> 16#include <linux/config.h>
17#include <linux/module.h>
17 18
18#include <asm/firmware.h> 19#include <asm/firmware.h>
19 20
20unsigned long ppc64_firmware_features; 21unsigned long powerpc_firmware_features;
22EXPORT_SYMBOL_GPL(powerpc_firmware_features);
diff --git a/arch/powerpc/kernel/head_64.S b/arch/powerpc/kernel/head_64.S
index 35084f3a841b..a5ae04a57c78 100644
--- a/arch/powerpc/kernel/head_64.S
+++ b/arch/powerpc/kernel/head_64.S
@@ -1544,7 +1544,11 @@ _STATIC(__boot_from_prom)
1544 mr r28,r6 1544 mr r28,r6
1545 mr r27,r7 1545 mr r27,r7
1546 1546
1547 /* Align the stack to 16-byte boundary for broken yaboot */ 1547 /*
1548 * Align the stack to 16-byte boundary
1549 * Depending on the size and layout of the ELF sections in the initial
1550 * boot binary, the stack pointer will be unalignet on PowerMac
1551 */
1548 rldicr r1,r1,0,59 1552 rldicr r1,r1,0,59
1549 1553
1550 /* Make sure we are running in 64 bits mode */ 1554 /* Make sure we are running in 64 bits mode */
@@ -1847,21 +1851,6 @@ _STATIC(start_here_multiplatform)
1847 bl .__save_cpu_setup 1851 bl .__save_cpu_setup
1848 sync 1852 sync
1849 1853
1850 /* Setup a valid physical PACA pointer in SPRG3 for early_setup
1851 * note that boot_cpuid can always be 0 nowadays since there is
1852 * nowhere it can be initialized differently before we reach this
1853 * code
1854 */
1855 LOAD_REG_IMMEDIATE(r27, boot_cpuid)
1856 add r27,r27,r26
1857 lwz r27,0(r27)
1858
1859 LOAD_REG_IMMEDIATE(r24, paca) /* Get base vaddr of paca array */
1860 mulli r13,r27,PACA_SIZE /* Calculate vaddr of right paca */
1861 add r13,r13,r24 /* for this processor. */
1862 add r13,r13,r26 /* convert to physical addr */
1863 mtspr SPRN_SPRG3,r13
1864
1865 /* Do very early kernel initializations, including initial hash table, 1854 /* Do very early kernel initializations, including initial hash table,
1866 * stab and slb setup before we turn on relocation. */ 1855 * stab and slb setup before we turn on relocation. */
1867 1856
@@ -1930,6 +1919,17 @@ _STATIC(start_here_common)
1930 /* Not reached */ 1919 /* Not reached */
1931 BUG_OPCODE 1920 BUG_OPCODE
1932 1921
1922/* Put the paca pointer into r13 and SPRG3 */
1923_GLOBAL(setup_boot_paca)
1924 LOAD_REG_IMMEDIATE(r3, boot_cpuid)
1925 lwz r3,0(r3)
1926 LOAD_REG_IMMEDIATE(r4, paca) /* Get base vaddr of paca array */
1927 mulli r3,r3,PACA_SIZE /* Calculate vaddr of right paca */
1928 add r13,r3,r4 /* for this processor. */
1929 mtspr SPRN_SPRG3,r13
1930
1931 blr
1932
1933/* 1933/*
1934 * We put a few things here that have to be page-aligned. 1934 * We put a few things here that have to be page-aligned.
1935 * This stuff goes at the beginning of the bss, which is page-aligned. 1935 * This stuff goes at the beginning of the bss, which is page-aligned.
diff --git a/arch/powerpc/kernel/idle_64.c b/arch/powerpc/kernel/idle.c
index b879d3057ef8..e9f321d74d85 100644
--- a/arch/powerpc/kernel/idle_64.c
+++ b/arch/powerpc/kernel/idle.c
@@ -2,13 +2,17 @@
2 * Idle daemon for PowerPC. Idle daemon will handle any action 2 * Idle daemon for PowerPC. Idle daemon will handle any action
3 * that needs to be taken when the system becomes idle. 3 * that needs to be taken when the system becomes idle.
4 * 4 *
5 * Originally Written by Cort Dougan (cort@cs.nmt.edu) 5 * Originally written by Cort Dougan (cort@cs.nmt.edu).
6 * Subsequent 32-bit hacking by Tom Rini, Armin Kuster,
7 * Paul Mackerras and others.
6 * 8 *
7 * iSeries supported added by Mike Corrigan <mikejc@us.ibm.com> 9 * iSeries supported added by Mike Corrigan <mikejc@us.ibm.com>
8 * 10 *
9 * Additional shared processor, SMT, and firmware support 11 * Additional shared processor, SMT, and firmware support
10 * Copyright (c) 2003 Dave Engebretsen <engebret@us.ibm.com> 12 * Copyright (c) 2003 Dave Engebretsen <engebret@us.ibm.com>
11 * 13 *
14 * 32-bit and 64-bit versions merged by Paul Mackerras <paulus@samba.org>
15 *
12 * This program is free software; you can redistribute it and/or 16 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License 17 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 18 * as published by the Free Software Foundation; either version
@@ -29,18 +33,43 @@
29#include <asm/machdep.h> 33#include <asm/machdep.h>
30#include <asm/smp.h> 34#include <asm/smp.h>
31 35
32extern void power4_idle(void); 36#ifdef CONFIG_HOTPLUG_CPU
37#define cpu_should_die() (cpu_is_offline(smp_processor_id()) && \
38 system_state == SYSTEM_RUNNING)
39#else
40#define cpu_should_die() 0
41#endif
33 42
34void default_idle(void) 43/*
44 * The body of the idle task.
45 */
46void cpu_idle(void)
35{ 47{
36 unsigned int cpu = smp_processor_id(); 48 if (ppc_md.idle_loop)
37 set_thread_flag(TIF_POLLING_NRFLAG); 49 ppc_md.idle_loop(); /* doesn't return */
38 50
51 set_thread_flag(TIF_POLLING_NRFLAG);
39 while (1) { 52 while (1) {
40 if (!need_resched()) { 53 ppc64_runlatch_off();
41 while (!need_resched() && !cpu_is_offline(cpu)) {
42 ppc64_runlatch_off();
43 54
55 while (!need_resched() && !cpu_should_die()) {
56 if (ppc_md.power_save) {
57 clear_thread_flag(TIF_POLLING_NRFLAG);
58 /*
59 * smp_mb is so clearing of TIF_POLLING_NRFLAG
60 * is ordered w.r.t. need_resched() test.
61 */
62 smp_mb();
63 local_irq_disable();
64
65 /* check again after disabling irqs */
66 if (!need_resched() && !cpu_should_die())
67 ppc_md.power_save();
68
69 local_irq_enable();
70 set_thread_flag(TIF_POLLING_NRFLAG);
71
72 } else {
44 /* 73 /*
45 * Go into low thread priority and possibly 74 * Go into low thread priority and possibly
46 * low power mode. 75 * low power mode.
@@ -48,46 +77,18 @@ void default_idle(void)
48 HMT_low(); 77 HMT_low();
49 HMT_very_low(); 78 HMT_very_low();
50 } 79 }
51
52 HMT_medium();
53 } 80 }
54 81
82 HMT_medium();
55 ppc64_runlatch_on(); 83 ppc64_runlatch_on();
84 if (cpu_should_die())
85 cpu_die();
56 preempt_enable_no_resched(); 86 preempt_enable_no_resched();
57 schedule(); 87 schedule();
58 preempt_disable(); 88 preempt_disable();
59 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
60 cpu_die();
61 } 89 }
62} 90}
63 91
64void native_idle(void)
65{
66 while (1) {
67 ppc64_runlatch_off();
68
69 if (!need_resched())
70 power4_idle();
71
72 if (need_resched()) {
73 ppc64_runlatch_on();
74 preempt_enable_no_resched();
75 schedule();
76 preempt_disable();
77 }
78
79 if (cpu_is_offline(smp_processor_id()) &&
80 system_state == SYSTEM_RUNNING)
81 cpu_die();
82 }
83}
84
85void cpu_idle(void)
86{
87 BUG_ON(NULL == ppc_md.idle_loop);
88 ppc_md.idle_loop();
89}
90
91int powersave_nap; 92int powersave_nap;
92 93
93#ifdef CONFIG_SYSCTL 94#ifdef CONFIG_SYSCTL
diff --git a/arch/powerpc/kernel/idle_6xx.S b/arch/powerpc/kernel/idle_6xx.S
index 444fdcc769f1..12a4efbaa08f 100644
--- a/arch/powerpc/kernel/idle_6xx.S
+++ b/arch/powerpc/kernel/idle_6xx.S
@@ -87,19 +87,6 @@ END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
87 cmpwi 0,r3,0 87 cmpwi 0,r3,0
88 beqlr 88 beqlr
89 89
90 /* Clear MSR:EE */
91 mfmsr r7
92 rlwinm r0,r7,0,17,15
93 mtmsr r0
94
95 /* Check current_thread_info()->flags */
96 rlwinm r4,r1,0,0,18
97 lwz r4,TI_FLAGS(r4)
98 andi. r0,r4,_TIF_NEED_RESCHED
99 beq 1f
100 mtmsr r7 /* out of line this ? */
101 blr
1021:
103 /* Some pre-nap cleanups needed on some CPUs */ 90 /* Some pre-nap cleanups needed on some CPUs */
104 andis. r0,r3,HID0_NAP@h 91 andis. r0,r3,HID0_NAP@h
105 beq 2f 92 beq 2f
@@ -157,7 +144,8 @@ BEGIN_FTR_SECTION
157 DSSALL 144 DSSALL
158 sync 145 sync
159END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 146END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
160 ori r7,r7,MSR_EE /* Could be ommited (already set) */ 147 mfmsr r7
148 ori r7,r7,MSR_EE
161 oris r7,r7,MSR_POW@h 149 oris r7,r7,MSR_POW@h
162 sync 150 sync
163 isync 151 isync
@@ -220,8 +208,6 @@ _GLOBAL(nap_save_msscr0)
220_GLOBAL(nap_save_hid1) 208_GLOBAL(nap_save_hid1)
221 .space 4*NR_CPUS 209 .space 4*NR_CPUS
222 210
223_GLOBAL(powersave_nap)
224 .long 0
225_GLOBAL(powersave_lowspeed) 211_GLOBAL(powersave_lowspeed)
226 .long 0 212 .long 0
227 213
diff --git a/arch/powerpc/kernel/idle_power4.S b/arch/powerpc/kernel/idle_power4.S
index c16b4afab582..6dad1c02496e 100644
--- a/arch/powerpc/kernel/idle_power4.S
+++ b/arch/powerpc/kernel/idle_power4.S
@@ -1,11 +1,5 @@
1/* 1/*
2 * This file contains the power_save function for 6xx & 7xxx CPUs 2 * This file contains the power_save function for 970-family CPUs.
3 * rewritten in assembler
4 *
5 * Warning ! This code assumes that if your machine has a 750fx
6 * it will have PLL 1 set to low speed mode (used during NAP/DOZE).
7 * if this is not the case some additional changes will have to
8 * be done to check a runtime var (a bit like powersave-nap)
9 * 3 *
10 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License 5 * modify it under the terms of the GNU General Public License
@@ -26,49 +20,23 @@
26 20
27 .text 21 .text
28 22
29/*
30 * Here is the power_save_6xx function. This could eventually be
31 * split into several functions & changing the function pointer
32 * depending on the various features.
33 */
34_GLOBAL(power4_idle) 23_GLOBAL(power4_idle)
35BEGIN_FTR_SECTION 24BEGIN_FTR_SECTION
36 blr 25 blr
37END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP) 26END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
38 /* We must dynamically check for the NAP feature as it
39 * can be cleared by CPU init after the fixups are done
40 */
41 LOAD_REG_ADDRBASE(r3,cur_cpu_spec)
42 ld r4,ADDROFF(cur_cpu_spec)(r3)
43 ld r4,CPU_SPEC_FEATURES(r4)
44 andi. r0,r4,CPU_FTR_CAN_NAP
45 beqlr
46 /* Now check if user or arch enabled NAP mode */ 27 /* Now check if user or arch enabled NAP mode */
47 LOAD_REG_ADDRBASE(r3,powersave_nap) 28 LOAD_REG_ADDRBASE(r3,powersave_nap)
48 lwz r4,ADDROFF(powersave_nap)(r3) 29 lwz r4,ADDROFF(powersave_nap)(r3)
49 cmpwi 0,r4,0 30 cmpwi 0,r4,0
50 beqlr 31 beqlr
51 32
52 /* Clear MSR:EE */
53 mfmsr r7
54 li r4,0
55 ori r4,r4,MSR_EE
56 andc r0,r7,r4
57 mtmsrd r0
58
59 /* Check current_thread_info()->flags */
60 clrrdi r4,r1,THREAD_SHIFT
61 ld r4,TI_FLAGS(r4)
62 andi. r0,r4,_TIF_NEED_RESCHED
63 beq 1f
64 mtmsrd r7 /* out of line this ? */
65 blr
661:
67 /* Go to NAP now */ 33 /* Go to NAP now */
68BEGIN_FTR_SECTION 34BEGIN_FTR_SECTION
69 DSSALL 35 DSSALL
70 sync 36 sync
71END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC) 37END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
38 mfmsr r7
39 ori r7,r7,MSR_EE
72 oris r7,r7,MSR_POW@h 40 oris r7,r7,MSR_POW@h
73 sync 41 sync
74 isync 42 isync
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 771a59cbd213..bb5c9501234c 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -379,7 +379,7 @@ void irq_ctx_init(void)
379 struct thread_info *tp; 379 struct thread_info *tp;
380 int i; 380 int i;
381 381
382 for_each_cpu(i) { 382 for_each_possible_cpu(i) {
383 memset((void *)softirq_ctx[i], 0, THREAD_SIZE); 383 memset((void *)softirq_ctx[i], 0, THREAD_SIZE);
384 tp = softirq_ctx[i]; 384 tp = softirq_ctx[i];
385 tp->cpu = i; 385 tp->cpu = i;
diff --git a/arch/ppc/kernel/l2cr.S b/arch/powerpc/kernel/l2cr_6xx.S
index d7f4e982b539..d7f4e982b539 100644
--- a/arch/ppc/kernel/l2cr.S
+++ b/arch/powerpc/kernel/l2cr_6xx.S
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index c7a799a09516..6e67b5b49ba1 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -37,7 +37,7 @@ static int legacy_serial_console = -1;
37static int __init add_legacy_port(struct device_node *np, int want_index, 37static int __init add_legacy_port(struct device_node *np, int want_index,
38 int iotype, phys_addr_t base, 38 int iotype, phys_addr_t base,
39 phys_addr_t taddr, unsigned long irq, 39 phys_addr_t taddr, unsigned long irq,
40 unsigned int flags) 40 upf_t flags)
41{ 41{
42 u32 *clk, *spd, clock = BASE_BAUD * 16; 42 u32 *clk, *spd, clock = BASE_BAUD * 16;
43 int index; 43 int index;
@@ -113,7 +113,7 @@ static int __init add_legacy_soc_port(struct device_node *np,
113{ 113{
114 phys_addr_t addr; 114 phys_addr_t addr;
115 u32 *addrp; 115 u32 *addrp;
116 unsigned int flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; 116 upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ;
117 117
118 /* We only support ports that have a clock frequency properly 118 /* We only support ports that have a clock frequency properly
119 * encoded in the device-tree. 119 * encoded in the device-tree.
@@ -236,6 +236,23 @@ static int __init add_legacy_pci_port(struct device_node *np,
236} 236}
237#endif 237#endif
238 238
239static void __init setup_legacy_serial_console(int console)
240{
241 struct legacy_serial_info *info =
242 &legacy_serial_infos[console];
243 void __iomem *addr;
244
245 if (info->taddr == 0)
246 return;
247 addr = ioremap(info->taddr, 0x1000);
248 if (addr == NULL)
249 return;
250 if (info->speed == 0)
251 info->speed = udbg_probe_uart_speed(addr, info->clock);
252 DBG("default console speed = %d\n", info->speed);
253 udbg_init_uart(addr, info->speed, info->clock);
254}
255
239/* 256/*
240 * This is called very early, as part of setup_system() or eventually 257 * This is called very early, as part of setup_system() or eventually
241 * setup_arch(), basically before anything else in this file. This function 258 * setup_arch(), basically before anything else in this file. This function
@@ -318,25 +335,8 @@ void __init find_legacy_serial_ports(void)
318#endif 335#endif
319 336
320 DBG("legacy_serial_console = %d\n", legacy_serial_console); 337 DBG("legacy_serial_console = %d\n", legacy_serial_console);
321 338 if (legacy_serial_console >= 0)
322 /* udbg is 64 bits only for now, that will change soon though ... */ 339 setup_legacy_serial_console(legacy_serial_console);
323 while (legacy_serial_console >= 0) {
324 struct legacy_serial_info *info =
325 &legacy_serial_infos[legacy_serial_console];
326 void __iomem *addr;
327
328 if (info->taddr == 0)
329 break;
330 addr = ioremap(info->taddr, 0x1000);
331 if (addr == NULL)
332 break;
333 if (info->speed == 0)
334 info->speed = udbg_probe_uart_speed(addr, info->clock);
335 DBG("default console speed = %d\n", info->speed);
336 udbg_init_uart(addr, info->speed, info->clock);
337 break;
338 }
339
340 DBG(" <- find_legacy_serial_port()\n"); 340 DBG(" <- find_legacy_serial_port()\n");
341} 341}
342 342
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c
index e789fef4eb8a..1b73508ecb2b 100644
--- a/arch/powerpc/kernel/lparcfg.c
+++ b/arch/powerpc/kernel/lparcfg.c
@@ -56,7 +56,7 @@ static unsigned long get_purr(void)
56 unsigned long sum_purr = 0; 56 unsigned long sum_purr = 0;
57 int cpu; 57 int cpu;
58 58
59 for_each_cpu(cpu) { 59 for_each_possible_cpu(cpu) {
60 sum_purr += lppaca[cpu].emulated_time_base; 60 sum_purr += lppaca[cpu].emulated_time_base;
61 61
62#ifdef PURR_DEBUG 62#ifdef PURR_DEBUG
@@ -222,7 +222,7 @@ static unsigned long get_purr(void)
222 int cpu; 222 int cpu;
223 struct cpu_usage *cu; 223 struct cpu_usage *cu;
224 224
225 for_each_cpu(cpu) { 225 for_each_possible_cpu(cpu) {
226 cu = &per_cpu(cpu_usage_array, cpu); 226 cu = &per_cpu(cpu_usage_array, cpu);
227 sum_purr += cu->current_tb; 227 sum_purr += cu->current_tb;
228 } 228 }
diff --git a/arch/ppc/kernel/module.c b/arch/powerpc/kernel/module_32.c
index 92f4e5f64f02..92f4e5f64f02 100644
--- a/arch/ppc/kernel/module.c
+++ b/arch/powerpc/kernel/module_32.c
diff --git a/arch/powerpc/kernel/nvram_64.c b/arch/powerpc/kernel/nvram_64.c
index fd7db8d542db..ada50aa5b600 100644
--- a/arch/powerpc/kernel/nvram_64.c
+++ b/arch/powerpc/kernel/nvram_64.c
@@ -160,7 +160,7 @@ static int dev_nvram_ioctl(struct inode *inode, struct file *file,
160 case IOC_NVRAM_GET_OFFSET: { 160 case IOC_NVRAM_GET_OFFSET: {
161 int part, offset; 161 int part, offset;
162 162
163 if (_machine != PLATFORM_POWERMAC) 163 if (!machine_is(powermac))
164 return -EINVAL; 164 return -EINVAL;
165 if (copy_from_user(&part, (void __user*)arg, sizeof(part)) != 0) 165 if (copy_from_user(&part, (void __user*)arg, sizeof(part)) != 0)
166 return -EFAULT; 166 return -EFAULT;
@@ -174,8 +174,9 @@ static int dev_nvram_ioctl(struct inode *inode, struct file *file,
174 return 0; 174 return 0;
175 } 175 }
176#endif /* CONFIG_PPC_PMAC */ 176#endif /* CONFIG_PPC_PMAC */
177 default:
178 return -EINVAL;
177 } 179 }
178 return -EINVAL;
179} 180}
180 181
181struct file_operations nvram_fops = { 182struct file_operations nvram_fops = {
@@ -443,7 +444,7 @@ static int nvram_setup_partition(void)
443 * in our nvram, as Apple defined partitions use pretty much 444 * in our nvram, as Apple defined partitions use pretty much
444 * all of the space 445 * all of the space
445 */ 446 */
446 if (_machine == PLATFORM_POWERMAC) 447 if (machine_is(powermac))
447 return -ENOSPC; 448 return -ENOSPC;
448 449
449 /* see if we have an OS partition that meets our needs. 450 /* see if we have an OS partition that meets our needs.
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 5d1b708086bd..f505a8827e3e 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -56,14 +56,11 @@ struct lppaca lppaca[] = {
56 * processors. The processor VPD array needs one entry per physical 56 * processors. The processor VPD array needs one entry per physical
57 * processor (not thread). 57 * processor (not thread).
58 */ 58 */
59#define PACA_INIT_COMMON(number, start, asrr, asrv) \ 59#define PACA_INIT_COMMON(number) \
60 .lppaca_ptr = &lppaca[number], \ 60 .lppaca_ptr = &lppaca[number], \
61 .lock_token = 0x8000, \ 61 .lock_token = 0x8000, \
62 .paca_index = (number), /* Paca Index */ \ 62 .paca_index = (number), /* Paca Index */ \
63 .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \ 63 .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \
64 .stab_real = (asrr), /* Real pointer to segment table */ \
65 .stab_addr = (asrv), /* Virt pointer to segment table */ \
66 .cpu_start = (start), /* Processor start */ \
67 .hw_cpu_id = 0xffff, 64 .hw_cpu_id = 0xffff,
68 65
69#ifdef CONFIG_PPC_ISERIES 66#ifdef CONFIG_PPC_ISERIES
@@ -72,30 +69,20 @@ struct lppaca lppaca[] = {
72 69
73#define PACA_INIT(number) \ 70#define PACA_INIT(number) \
74{ \ 71{ \
75 PACA_INIT_COMMON(number, 0, 0, 0) \ 72 PACA_INIT_COMMON(number) \
76 PACA_INIT_ISERIES(number) \
77}
78
79#define BOOTCPU_PACA_INIT(number) \
80{ \
81 PACA_INIT_COMMON(number, 1, 0, (u64)&initial_stab) \
82 PACA_INIT_ISERIES(number) \ 73 PACA_INIT_ISERIES(number) \
83} 74}
84 75
85#else 76#else
86#define PACA_INIT(number) \ 77#define PACA_INIT(number) \
87{ \ 78{ \
88 PACA_INIT_COMMON(number, 0, 0, 0) \ 79 PACA_INIT_COMMON(number) \
89} 80}
90 81
91#define BOOTCPU_PACA_INIT(number) \
92{ \
93 PACA_INIT_COMMON(number, 1, STAB0_PHYS_ADDR, (u64)&initial_stab) \
94}
95#endif 82#endif
96 83
97struct paca_struct paca[] = { 84struct paca_struct paca[] = {
98 BOOTCPU_PACA_INIT(0), 85 PACA_INIT(0),
99#if NR_CPUS > 1 86#if NR_CPUS > 1
100 PACA_INIT( 1), PACA_INIT( 2), PACA_INIT( 3), 87 PACA_INIT( 1), PACA_INIT( 2), PACA_INIT( 3),
101#if NR_CPUS > 4 88#if NR_CPUS > 4
diff --git a/arch/powerpc/kernel/pci_32.c b/arch/powerpc/kernel/pci_32.c
index 704c846b2b0f..b129d2e4b759 100644
--- a/arch/powerpc/kernel/pci_32.c
+++ b/arch/powerpc/kernel/pci_32.c
@@ -787,7 +787,7 @@ pci_busdev_to_OF_node(struct pci_bus *bus, int devfn)
787 * fix has to be done by making the remapping per-host and always 787 * fix has to be done by making the remapping per-host and always
788 * filling the pci_to_OF map. --BenH 788 * filling the pci_to_OF map. --BenH
789 */ 789 */
790 if (_machine == _MACH_Pmac && busnr >= 0xf0) 790 if (machine_is(powermac) && busnr >= 0xf0)
791 busnr -= 0xf0; 791 busnr -= 0xf0;
792 else 792 else
793#endif 793#endif
@@ -1728,7 +1728,7 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
1728 * (bus 0 is HT root), we return the AGP one instead. 1728 * (bus 0 is HT root), we return the AGP one instead.
1729 */ 1729 */
1730#ifdef CONFIG_PPC_PMAC 1730#ifdef CONFIG_PPC_PMAC
1731 if (_machine == _MACH_Pmac && machine_is_compatible("MacRISC4")) 1731 if (machine_is(powermac) && machine_is_compatible("MacRISC4"))
1732 if (bus == 0) 1732 if (bus == 0)
1733 bus = 0xf0; 1733 bus = 0xf0;
1734#endif /* CONFIG_PPC_PMAC */ 1734#endif /* CONFIG_PPC_PMAC */
diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c
index ba92bab7cc2c..4c4449be81ce 100644
--- a/arch/powerpc/kernel/pci_64.c
+++ b/arch/powerpc/kernel/pci_64.c
@@ -78,6 +78,7 @@ int global_phb_number; /* Global phb counter */
78 78
79/* Cached ISA bridge dev. */ 79/* Cached ISA bridge dev. */
80struct pci_dev *ppc64_isabridge_dev = NULL; 80struct pci_dev *ppc64_isabridge_dev = NULL;
81EXPORT_SYMBOL_GPL(ppc64_isabridge_dev);
81 82
82static void fixup_broken_pcnet32(struct pci_dev* dev) 83static void fixup_broken_pcnet32(struct pci_dev* dev)
83{ 84{
diff --git a/arch/ppc/kernel/perfmon_fsl_booke.c b/arch/powerpc/kernel/perfmon_fsl_booke.c
index 32455dfcc36b..32455dfcc36b 100644
--- a/arch/ppc/kernel/perfmon_fsl_booke.c
+++ b/arch/powerpc/kernel/perfmon_fsl_booke.c
diff --git a/arch/powerpc/kernel/proc_ppc64.c b/arch/powerpc/kernel/proc_ppc64.c
index 7ba42a405f41..3c2cf661f6d9 100644
--- a/arch/powerpc/kernel/proc_ppc64.c
+++ b/arch/powerpc/kernel/proc_ppc64.c
@@ -23,6 +23,7 @@
23#include <linux/slab.h> 23#include <linux/slab.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25 25
26#include <asm/machdep.h>
26#include <asm/vdso_datapage.h> 27#include <asm/vdso_datapage.h>
27#include <asm/rtas.h> 28#include <asm/rtas.h>
28#include <asm/uaccess.h> 29#include <asm/uaccess.h>
@@ -51,7 +52,7 @@ static int __init proc_ppc64_create(void)
51 if (!root) 52 if (!root)
52 return 1; 53 return 1;
53 54
54 if (!(platform_is_pseries() || _machine == PLATFORM_CELL)) 55 if (!machine_is(pseries) && !machine_is(cell))
55 return 0; 56 return 0;
56 57
57 if (!proc_mkdir("rtas", root)) 58 if (!proc_mkdir("rtas", root))
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index f698aa77127e..706090c99f47 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -45,6 +45,7 @@
45#include <asm/prom.h> 45#include <asm/prom.h>
46#include <asm/machdep.h> 46#include <asm/machdep.h>
47#include <asm/time.h> 47#include <asm/time.h>
48#include <asm/syscalls.h>
48#ifdef CONFIG_PPC64 49#ifdef CONFIG_PPC64
49#include <asm/firmware.h> 50#include <asm/firmware.h>
50#endif 51#endif
@@ -362,7 +363,11 @@ static void show_instructions(struct pt_regs *regs)
362 if (!(i % 8)) 363 if (!(i % 8))
363 printk("\n"); 364 printk("\n");
364 365
365 if (BAD_PC(pc) || __get_user(instr, (unsigned int *)pc)) { 366 /* We use __get_user here *only* to avoid an OOPS on a
367 * bad address because the pc *should* only be a
368 * kernel address.
369 */
370 if (BAD_PC(pc) || __get_user(instr, (unsigned int __user *)pc)) {
366 printk("XXXXXXXX "); 371 printk("XXXXXXXX ");
367 } else { 372 } else {
368 if (regs->nip == pc) 373 if (regs->nip == pc)
@@ -765,7 +770,7 @@ out:
765 return error; 770 return error;
766} 771}
767 772
768static int validate_sp(unsigned long sp, struct task_struct *p, 773int validate_sp(unsigned long sp, struct task_struct *p,
769 unsigned long nbytes) 774 unsigned long nbytes)
770{ 775{
771 unsigned long stack_page = (unsigned long)task_stack_page(p); 776 unsigned long stack_page = (unsigned long)task_stack_page(p);
@@ -803,6 +808,8 @@ static int validate_sp(unsigned long sp, struct task_struct *p,
803#define FRAME_MARKER 2 808#define FRAME_MARKER 2
804#endif 809#endif
805 810
811EXPORT_SYMBOL(validate_sp);
812
806unsigned long get_wchan(struct task_struct *p) 813unsigned long get_wchan(struct task_struct *p)
807{ 814{
808 unsigned long ip, sp; 815 unsigned long ip, sp;
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index d63cd562d9d5..4336390bcf34 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -383,14 +383,14 @@ static int __devinit finish_node_interrupts(struct device_node *np,
383 /* Apple uses bits in there in a different way, let's 383 /* Apple uses bits in there in a different way, let's
384 * only keep the real sense bit on macs 384 * only keep the real sense bit on macs
385 */ 385 */
386 if (_machine == PLATFORM_POWERMAC) 386 if (machine_is(powermac))
387 sense &= 0x1; 387 sense &= 0x1;
388 np->intrs[intrcount].sense = map_mpic_senses[sense]; 388 np->intrs[intrcount].sense = map_mpic_senses[sense];
389 } 389 }
390 390
391#ifdef CONFIG_PPC64 391#ifdef CONFIG_PPC64
392 /* We offset irq numbers for the u3 MPIC by 128 in PowerMac */ 392 /* We offset irq numbers for the u3 MPIC by 128 in PowerMac */
393 if (_machine == PLATFORM_POWERMAC && ic && ic->parent) { 393 if (machine_is(powermac) && ic && ic->parent) {
394 char *name = get_property(ic->parent, "name", NULL); 394 char *name = get_property(ic->parent, "name", NULL);
395 if (name && !strcmp(name, "u3")) 395 if (name && !strcmp(name, "u3"))
396 np->intrs[intrcount].line += 128; 396 np->intrs[intrcount].line += 128;
@@ -570,6 +570,18 @@ int __init of_scan_flat_dt(int (*it)(unsigned long node,
570 return rc; 570 return rc;
571} 571}
572 572
573unsigned long __init of_get_flat_dt_root(void)
574{
575 unsigned long p = ((unsigned long)initial_boot_params) +
576 initial_boot_params->off_dt_struct;
577
578 while(*((u32 *)p) == OF_DT_NOP)
579 p += 4;
580 BUG_ON (*((u32 *)p) != OF_DT_BEGIN_NODE);
581 p += 4;
582 return _ALIGN(p + strlen((char *)p) + 1, 4);
583}
584
573/** 585/**
574 * This function can be used within scan_flattened_dt callback to get 586 * This function can be used within scan_flattened_dt callback to get
575 * access to properties 587 * access to properties
@@ -612,6 +624,25 @@ void* __init of_get_flat_dt_prop(unsigned long node, const char *name,
612 } while(1); 624 } while(1);
613} 625}
614 626
627int __init of_flat_dt_is_compatible(unsigned long node, const char *compat)
628{
629 const char* cp;
630 unsigned long cplen, l;
631
632 cp = of_get_flat_dt_prop(node, "compatible", &cplen);
633 if (cp == NULL)
634 return 0;
635 while (cplen > 0) {
636 if (strncasecmp(cp, compat, strlen(compat)) == 0)
637 return 1;
638 l = strlen(cp) + 1;
639 cp += l;
640 cplen -= l;
641 }
642
643 return 0;
644}
645
615static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size, 646static void *__init unflatten_dt_alloc(unsigned long *mem, unsigned long size,
616 unsigned long align) 647 unsigned long align)
617{ 648{
@@ -686,7 +717,7 @@ static unsigned long __init unflatten_dt_node(unsigned long mem,
686#ifdef DEBUG 717#ifdef DEBUG
687 if ((strlen(p) + l + 1) != allocl) { 718 if ((strlen(p) + l + 1) != allocl) {
688 DBG("%s: p: %d, l: %d, a: %d\n", 719 DBG("%s: p: %d, l: %d, a: %d\n",
689 pathp, strlen(p), l, allocl); 720 pathp, (int)strlen(p), l, allocl);
690 } 721 }
691#endif 722#endif
692 p += strlen(p); 723 p += strlen(p);
@@ -854,35 +885,73 @@ void __init unflatten_device_tree(void)
854 DBG(" <- unflatten_device_tree()\n"); 885 DBG(" <- unflatten_device_tree()\n");
855} 886}
856 887
857
858static int __init early_init_dt_scan_cpus(unsigned long node, 888static int __init early_init_dt_scan_cpus(unsigned long node,
859 const char *uname, int depth, void *data) 889 const char *uname, int depth,
890 void *data)
860{ 891{
892 static int logical_cpuid = 0;
893 char *type = of_get_flat_dt_prop(node, "device_type", NULL);
894#ifdef CONFIG_ALTIVEC
861 u32 *prop; 895 u32 *prop;
862 unsigned long size; 896#endif
863 char *type = of_get_flat_dt_prop(node, "device_type", &size); 897 u32 *intserv;
898 int i, nthreads;
899 unsigned long len;
900 int found = 0;
864 901
865 /* We are scanning "cpu" nodes only */ 902 /* We are scanning "cpu" nodes only */
866 if (type == NULL || strcmp(type, "cpu") != 0) 903 if (type == NULL || strcmp(type, "cpu") != 0)
867 return 0; 904 return 0;
868 905
869 boot_cpuid = 0; 906 /* Get physical cpuid */
870 boot_cpuid_phys = 0; 907 intserv = of_get_flat_dt_prop(node, "ibm,ppc-interrupt-server#s", &len);
871 if (initial_boot_params && initial_boot_params->version >= 2) { 908 if (intserv) {
872 /* version 2 of the kexec param format adds the phys cpuid 909 nthreads = len / sizeof(int);
873 * of booted proc.
874 */
875 boot_cpuid_phys = initial_boot_params->boot_cpuid_phys;
876 } else { 910 } else {
877 /* Check if it's the boot-cpu, set it's hw index now */ 911 intserv = of_get_flat_dt_prop(node, "reg", NULL);
878 if (of_get_flat_dt_prop(node, 912 nthreads = 1;
913 }
914
915 /*
916 * Now see if any of these threads match our boot cpu.
917 * NOTE: This must match the parsing done in smp_setup_cpu_maps.
918 */
919 for (i = 0; i < nthreads; i++) {
920 /*
921 * version 2 of the kexec param format adds the phys cpuid of
922 * booted proc.
923 */
924 if (initial_boot_params && initial_boot_params->version >= 2) {
925 if (intserv[i] ==
926 initial_boot_params->boot_cpuid_phys) {
927 found = 1;
928 break;
929 }
930 } else {
931 /*
932 * Check if it's the boot-cpu, set it's hw index now,
933 * unfortunately this format did not support booting
934 * off secondary threads.
935 */
936 if (of_get_flat_dt_prop(node,
879 "linux,boot-cpu", NULL) != NULL) { 937 "linux,boot-cpu", NULL) != NULL) {
880 prop = of_get_flat_dt_prop(node, "reg", NULL); 938 found = 1;
881 if (prop != NULL) 939 break;
882 boot_cpuid_phys = *prop; 940 }
883 } 941 }
942
943#ifdef CONFIG_SMP
944 /* logical cpu id is always 0 on UP kernels */
945 logical_cpuid++;
946#endif
947 }
948
949 if (found) {
950 DBG("boot cpu: logical %d physical %d\n", logical_cpuid,
951 intserv[i]);
952 boot_cpuid = logical_cpuid;
953 set_hard_smp_processor_id(boot_cpuid, intserv[i]);
884 } 954 }
885 set_hard_smp_processor_id(0, boot_cpuid_phys);
886 955
887#ifdef CONFIG_ALTIVEC 956#ifdef CONFIG_ALTIVEC
888 /* Check if we have a VMX and eventually update CPU features */ 957 /* Check if we have a VMX and eventually update CPU features */
@@ -901,16 +970,10 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
901#endif /* CONFIG_ALTIVEC */ 970#endif /* CONFIG_ALTIVEC */
902 971
903#ifdef CONFIG_PPC_PSERIES 972#ifdef CONFIG_PPC_PSERIES
904 /* 973 if (nthreads > 1)
905 * Check for an SMT capable CPU and set the CPU feature. We do
906 * this by looking at the size of the ibm,ppc-interrupt-server#s
907 * property
908 */
909 prop = (u32 *)of_get_flat_dt_prop(node, "ibm,ppc-interrupt-server#s",
910 &size);
911 cur_cpu_spec->cpu_features &= ~CPU_FTR_SMT;
912 if (prop && ((size / sizeof(u32)) > 1))
913 cur_cpu_spec->cpu_features |= CPU_FTR_SMT; 974 cur_cpu_spec->cpu_features |= CPU_FTR_SMT;
975 else
976 cur_cpu_spec->cpu_features &= ~CPU_FTR_SMT;
914#endif 977#endif
915 978
916 return 0; 979 return 0;
@@ -919,7 +982,6 @@ static int __init early_init_dt_scan_cpus(unsigned long node,
919static int __init early_init_dt_scan_chosen(unsigned long node, 982static int __init early_init_dt_scan_chosen(unsigned long node,
920 const char *uname, int depth, void *data) 983 const char *uname, int depth, void *data)
921{ 984{
922 u32 *prop;
923 unsigned long *lprop; 985 unsigned long *lprop;
924 unsigned long l; 986 unsigned long l;
925 char *p; 987 char *p;
@@ -930,14 +992,6 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
930 (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0)) 992 (strcmp(uname, "chosen") != 0 && strcmp(uname, "chosen@0") != 0))
931 return 0; 993 return 0;
932 994
933 /* get platform type */
934 prop = (u32 *)of_get_flat_dt_prop(node, "linux,platform", NULL);
935 if (prop == NULL)
936 return 0;
937#ifdef CONFIG_PPC_MULTIPLATFORM
938 _machine = *prop;
939#endif
940
941#ifdef CONFIG_PPC64 995#ifdef CONFIG_PPC64
942 /* check if iommu is forced on or off */ 996 /* check if iommu is forced on or off */
943 if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL) 997 if (of_get_flat_dt_prop(node, "linux,iommu-off", NULL) != NULL)
@@ -964,15 +1018,15 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
964 * set of RTAS infos now if available 1018 * set of RTAS infos now if available
965 */ 1019 */
966 { 1020 {
967 u64 *basep, *entryp; 1021 u64 *basep, *entryp, *sizep;
968 1022
969 basep = of_get_flat_dt_prop(node, "linux,rtas-base", NULL); 1023 basep = of_get_flat_dt_prop(node, "linux,rtas-base", NULL);
970 entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL); 1024 entryp = of_get_flat_dt_prop(node, "linux,rtas-entry", NULL);
971 prop = of_get_flat_dt_prop(node, "linux,rtas-size", NULL); 1025 sizep = of_get_flat_dt_prop(node, "linux,rtas-size", NULL);
972 if (basep && entryp && prop) { 1026 if (basep && entryp && sizep) {
973 rtas.base = *basep; 1027 rtas.base = *basep;
974 rtas.entry = *entryp; 1028 rtas.entry = *entryp;
975 rtas.size = *prop; 1029 rtas.size = *sizep;
976 } 1030 }
977 } 1031 }
978#endif /* CONFIG_PPC_RTAS */ 1032#endif /* CONFIG_PPC_RTAS */
@@ -1001,25 +1055,13 @@ static int __init early_init_dt_scan_chosen(unsigned long node,
1001 1055
1002 if (strstr(cmd_line, "mem=")) { 1056 if (strstr(cmd_line, "mem=")) {
1003 char *p, *q; 1057 char *p, *q;
1004 unsigned long maxmem = 0;
1005 1058
1006 for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) { 1059 for (q = cmd_line; (p = strstr(q, "mem=")) != 0; ) {
1007 q = p + 4; 1060 q = p + 4;
1008 if (p > cmd_line && p[-1] != ' ') 1061 if (p > cmd_line && p[-1] != ' ')
1009 continue; 1062 continue;
1010 maxmem = simple_strtoul(q, &q, 0); 1063 memory_limit = memparse(q, &q);
1011 if (*q == 'k' || *q == 'K') {
1012 maxmem <<= 10;
1013 ++q;
1014 } else if (*q == 'm' || *q == 'M') {
1015 maxmem <<= 20;
1016 ++q;
1017 } else if (*q == 'g' || *q == 'G') {
1018 maxmem <<= 30;
1019 ++q;
1020 }
1021 } 1064 }
1022 memory_limit = maxmem;
1023 } 1065 }
1024 1066
1025 /* break now */ 1067 /* break now */
@@ -1755,7 +1797,7 @@ static int of_finish_dynamic_node(struct device_node *node)
1755 /* We don't support that function on PowerMac, at least 1797 /* We don't support that function on PowerMac, at least
1756 * not yet 1798 * not yet
1757 */ 1799 */
1758 if (_machine == PLATFORM_POWERMAC) 1800 if (machine_is(powermac))
1759 return -ENODEV; 1801 return -ENODEV;
1760 1802
1761 /* fix up new node's linux_phandle field */ 1803 /* fix up new node's linux_phandle field */
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 813c2cd194c2..d66c5e77fcff 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -180,6 +180,16 @@ static unsigned long __initdata prom_tce_alloc_start;
180static unsigned long __initdata prom_tce_alloc_end; 180static unsigned long __initdata prom_tce_alloc_end;
181#endif 181#endif
182 182
183/* Platforms codes are now obsolete in the kernel. Now only used within this
184 * file and ultimately gone too. Feel free to change them if you need, they
185 * are not shared with anything outside of this file anymore
186 */
187#define PLATFORM_PSERIES 0x0100
188#define PLATFORM_PSERIES_LPAR 0x0101
189#define PLATFORM_LPAR 0x0001
190#define PLATFORM_POWERMAC 0x0400
191#define PLATFORM_GENERIC 0x0500
192
183static int __initdata of_platform; 193static int __initdata of_platform;
184 194
185static char __initdata prom_cmd_line[COMMAND_LINE_SIZE]; 195static char __initdata prom_cmd_line[COMMAND_LINE_SIZE];
@@ -397,6 +407,11 @@ static void __init __attribute__((noreturn)) prom_panic(const char *reason)
397 reason = PTRRELOC(reason); 407 reason = PTRRELOC(reason);
398#endif 408#endif
399 prom_print(reason); 409 prom_print(reason);
410 /* Do not call exit because it clears the screen on pmac
411 * it also causes some sort of double-fault on early pmacs */
412 if (RELOC(of_platform) == PLATFORM_POWERMAC)
413 asm("trap\n");
414
400 /* ToDo: should put up an SRC here on p/iSeries */ 415 /* ToDo: should put up an SRC here on p/iSeries */
401 call_prom("exit", 0, 0); 416 call_prom("exit", 0, 0);
402 417
@@ -1487,7 +1502,10 @@ static int __init prom_find_machine_type(void)
1487 int len, i = 0; 1502 int len, i = 0;
1488#ifdef CONFIG_PPC64 1503#ifdef CONFIG_PPC64
1489 phandle rtas; 1504 phandle rtas;
1505 int x;
1490#endif 1506#endif
1507
1508 /* Look for a PowerMac */
1491 len = prom_getprop(_prom->root, "compatible", 1509 len = prom_getprop(_prom->root, "compatible",
1492 compat, sizeof(compat)-1); 1510 compat, sizeof(compat)-1);
1493 if (len > 0) { 1511 if (len > 0) {
@@ -1500,28 +1518,36 @@ static int __init prom_find_machine_type(void)
1500 if (strstr(p, RELOC("Power Macintosh")) || 1518 if (strstr(p, RELOC("Power Macintosh")) ||
1501 strstr(p, RELOC("MacRISC"))) 1519 strstr(p, RELOC("MacRISC")))
1502 return PLATFORM_POWERMAC; 1520 return PLATFORM_POWERMAC;
1503#ifdef CONFIG_PPC64
1504 if (strstr(p, RELOC("Momentum,Maple")))
1505 return PLATFORM_MAPLE;
1506 if (strstr(p, RELOC("IBM,CPB")))
1507 return PLATFORM_CELL;
1508#endif
1509 i += sl + 1; 1521 i += sl + 1;
1510 } 1522 }
1511 } 1523 }
1512#ifdef CONFIG_PPC64 1524#ifdef CONFIG_PPC64
1525 /* If not a mac, try to figure out if it's an IBM pSeries or any other
1526 * PAPR compliant platform. We assume it is if :
1527 * - /device_type is "chrp" (please, do NOT use that for future
1528 * non-IBM designs !
1529 * - it has /rtas
1530 */
1531 len = prom_getprop(_prom->root, "model",
1532 compat, sizeof(compat)-1);
1533 if (len <= 0)
1534 return PLATFORM_GENERIC;
1535 compat[len] = 0;
1536 if (strcmp(compat, "chrp"))
1537 return PLATFORM_GENERIC;
1538
1513 /* Default to pSeries. We need to know if we are running LPAR */ 1539 /* Default to pSeries. We need to know if we are running LPAR */
1514 rtas = call_prom("finddevice", 1, 1, ADDR("/rtas")); 1540 rtas = call_prom("finddevice", 1, 1, ADDR("/rtas"));
1515 if (PHANDLE_VALID(rtas)) { 1541 if (!PHANDLE_VALID(rtas))
1516 int x = prom_getproplen(rtas, "ibm,hypertas-functions"); 1542 return PLATFORM_GENERIC;
1517 if (x != PROM_ERROR) { 1543 x = prom_getproplen(rtas, "ibm,hypertas-functions");
1518 prom_printf("Hypertas detected, assuming LPAR !\n"); 1544 if (x != PROM_ERROR) {
1519 return PLATFORM_PSERIES_LPAR; 1545 prom_printf("Hypertas detected, assuming LPAR !\n");
1520 } 1546 return PLATFORM_PSERIES_LPAR;
1521 } 1547 }
1522 return PLATFORM_PSERIES; 1548 return PLATFORM_PSERIES;
1523#else 1549#else
1524 return PLATFORM_CHRP; 1550 return PLATFORM_GENERIC;
1525#endif 1551#endif
1526} 1552}
1527 1553
@@ -2029,7 +2055,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2029{ 2055{
2030 struct prom_t *_prom; 2056 struct prom_t *_prom;
2031 unsigned long hdr; 2057 unsigned long hdr;
2032 u32 getprop_rval;
2033 unsigned long offset = reloc_offset(); 2058 unsigned long offset = reloc_offset();
2034 2059
2035#ifdef CONFIG_PPC32 2060#ifdef CONFIG_PPC32
@@ -2060,6 +2085,12 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2060 */ 2085 */
2061 prom_init_stdout(); 2086 prom_init_stdout();
2062 2087
2088 /*
2089 * Get default machine type. At this point, we do not differentiate
2090 * between pSeries SMP and pSeries LPAR
2091 */
2092 RELOC(of_platform) = prom_find_machine_type();
2093
2063 /* Bail if this is a kdump kernel. */ 2094 /* Bail if this is a kdump kernel. */
2064 if (PHYSICAL_START > 0) 2095 if (PHYSICAL_START > 0)
2065 prom_panic("Error: You can't boot a kdump kernel from OF!\n"); 2096 prom_panic("Error: You can't boot a kdump kernel from OF!\n");
@@ -2069,15 +2100,6 @@ unsigned long __init prom_init(unsigned long r3, unsigned long r4,
2069 */ 2100 */
2070 prom_check_initrd(r3, r4); 2101 prom_check_initrd(r3, r4);
2071 2102
2072 /*
2073 * Get default machine type. At this point, we do not differentiate
2074 * between pSeries SMP and pSeries LPAR
2075 */
2076 RELOC(of_platform) = prom_find_machine_type();
2077 getprop_rval = RELOC(of_platform);
2078 prom_setprop(_prom->chosen, "/chosen", "linux,platform",
2079 &getprop_rval, sizeof(getprop_rval));
2080
2081#ifdef CONFIG_PPC_PSERIES 2103#ifdef CONFIG_PPC_PSERIES
2082 /* 2104 /*
2083 * On pSeries, inform the firmware about our capabilities 2105 * On pSeries, inform the firmware about our capabilities
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c
index 1f03fb28cc0a..456286cf1d14 100644
--- a/arch/powerpc/kernel/rtas-proc.c
+++ b/arch/powerpc/kernel/rtas-proc.c
@@ -257,7 +257,7 @@ static int __init proc_rtas_init(void)
257{ 257{
258 struct proc_dir_entry *entry; 258 struct proc_dir_entry *entry;
259 259
260 if (_machine != PLATFORM_PSERIES && _machine != PLATFORM_PSERIES_LPAR) 260 if (!machine_is(pseries))
261 return 1; 261 return 1;
262 262
263 rtas_node = of_find_node_by_name(NULL, "rtas"); 263 rtas_node = of_find_node_by_name(NULL, "rtas");
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index b5b2add7ad1e..06636c927a7e 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -25,6 +25,7 @@
25#include <asm/hvcall.h> 25#include <asm/hvcall.h>
26#include <asm/semaphore.h> 26#include <asm/semaphore.h>
27#include <asm/machdep.h> 27#include <asm/machdep.h>
28#include <asm/firmware.h>
28#include <asm/page.h> 29#include <asm/page.h>
29#include <asm/param.h> 30#include <asm/param.h>
30#include <asm/system.h> 31#include <asm/system.h>
@@ -32,6 +33,7 @@
32#include <asm/uaccess.h> 33#include <asm/uaccess.h>
33#include <asm/lmb.h> 34#include <asm/lmb.h>
34#include <asm/udbg.h> 35#include <asm/udbg.h>
36#include <asm/syscalls.h>
35 37
36struct rtas_t rtas = { 38struct rtas_t rtas = {
37 .lock = SPIN_LOCK_UNLOCKED 39 .lock = SPIN_LOCK_UNLOCKED
@@ -591,7 +593,7 @@ static void rtas_percpu_suspend_me(void *info)
591 data->waiting = 0; 593 data->waiting = 0;
592 data->args->args[data->args->nargs] = 594 data->args->args[data->args->nargs] =
593 rtas_call(ibm_suspend_me_token, 0, 1, NULL); 595 rtas_call(ibm_suspend_me_token, 0, 1, NULL);
594 for_each_cpu(i) 596 for_each_possible_cpu(i)
595 plpar_hcall_norets(H_PROD,i); 597 plpar_hcall_norets(H_PROD,i);
596 } else { 598 } else {
597 data->waiting = -EBUSY; 599 data->waiting = -EBUSY;
@@ -624,7 +626,7 @@ static int rtas_ibm_suspend_me(struct rtas_args *args)
624 /* Prod each CPU. This won't hurt, and will wake 626 /* Prod each CPU. This won't hurt, and will wake
625 * anyone we successfully put to sleep with H_Join 627 * anyone we successfully put to sleep with H_Join
626 */ 628 */
627 for_each_cpu(i) 629 for_each_possible_cpu(i)
628 plpar_hcall_norets(H_PROD, i); 630 plpar_hcall_norets(H_PROD, i);
629 631
630 return data.waiting; 632 return data.waiting;
@@ -767,7 +769,7 @@ void __init rtas_initialize(void)
767 * the stop-self token if any 769 * the stop-self token if any
768 */ 770 */
769#ifdef CONFIG_PPC64 771#ifdef CONFIG_PPC64
770 if (_machine == PLATFORM_PSERIES_LPAR) { 772 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR)) {
771 rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX); 773 rtas_region = min(lmb.rmo_size, RTAS_INSTANTIATE_MAX);
772 ibm_suspend_me_token = rtas_token("ibm,suspend-me"); 774 ibm_suspend_me_token = rtas_token("ibm,suspend-me");
773 } 775 }
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index c1d62bf11f29..c607f3b9ca17 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -9,6 +9,9 @@
9 * as published by the Free Software Foundation; either version 9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version. 10 * 2 of the License, or (at your option) any later version.
11 */ 11 */
12
13#undef DEBUG
14
12#include <linux/config.h> 15#include <linux/config.h>
13#include <linux/module.h> 16#include <linux/module.h>
14#include <linux/string.h> 17#include <linux/string.h>
@@ -41,6 +44,7 @@
41#include <asm/time.h> 44#include <asm/time.h>
42#include <asm/cputable.h> 45#include <asm/cputable.h>
43#include <asm/sections.h> 46#include <asm/sections.h>
47#include <asm/firmware.h>
44#include <asm/btext.h> 48#include <asm/btext.h>
45#include <asm/nvram.h> 49#include <asm/nvram.h>
46#include <asm/setup.h> 50#include <asm/setup.h>
@@ -56,8 +60,6 @@
56 60
57#include "setup.h" 61#include "setup.h"
58 62
59#undef DEBUG
60
61#ifdef DEBUG 63#ifdef DEBUG
62#include <asm/udbg.h> 64#include <asm/udbg.h>
63#define DBG(fmt...) udbg_printf(fmt) 65#define DBG(fmt...) udbg_printf(fmt)
@@ -65,10 +67,12 @@
65#define DBG(fmt...) 67#define DBG(fmt...)
66#endif 68#endif
67 69
68#ifdef CONFIG_PPC_MULTIPLATFORM 70/* The main machine-dep calls structure
69int _machine = 0; 71 */
70EXPORT_SYMBOL(_machine); 72struct machdep_calls ppc_md;
71#endif 73EXPORT_SYMBOL(ppc_md);
74struct machdep_calls *machine_id;
75EXPORT_SYMBOL(machine_id);
72 76
73unsigned long klimit = (unsigned long) _end; 77unsigned long klimit = (unsigned long) _end;
74 78
@@ -168,7 +172,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
168 bogosum/(500000/HZ), bogosum/(5000/HZ) % 100); 172 bogosum/(500000/HZ), bogosum/(5000/HZ) % 100);
169#endif /* CONFIG_SMP && CONFIG_PPC32 */ 173#endif /* CONFIG_SMP && CONFIG_PPC32 */
170 seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq); 174 seq_printf(m, "timebase\t: %lu\n", ppc_tb_freq);
171 175 if (ppc_md.name)
176 seq_printf(m, "platform\t: %s\n", ppc_md.name);
172 if (ppc_md.show_cpuinfo != NULL) 177 if (ppc_md.show_cpuinfo != NULL)
173 ppc_md.show_cpuinfo(m); 178 ppc_md.show_cpuinfo(m);
174 179
@@ -352,12 +357,13 @@ void __init check_for_initrd(void)
352 * must be called before using this. 357 * must be called before using this.
353 * 358 *
354 * While we're here, we may as well set the "physical" cpu ids in the paca. 359 * While we're here, we may as well set the "physical" cpu ids in the paca.
360 *
361 * NOTE: This must match the parsing done in early_init_dt_scan_cpus.
355 */ 362 */
356void __init smp_setup_cpu_maps(void) 363void __init smp_setup_cpu_maps(void)
357{ 364{
358 struct device_node *dn = NULL; 365 struct device_node *dn = NULL;
359 int cpu = 0; 366 int cpu = 0;
360 int swap_cpuid = 0;
361 367
362 while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { 368 while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) {
363 int *intserv; 369 int *intserv;
@@ -376,30 +382,17 @@ void __init smp_setup_cpu_maps(void)
376 for (j = 0; j < nthreads && cpu < NR_CPUS; j++) { 382 for (j = 0; j < nthreads && cpu < NR_CPUS; j++) {
377 cpu_set(cpu, cpu_present_map); 383 cpu_set(cpu, cpu_present_map);
378 set_hard_smp_processor_id(cpu, intserv[j]); 384 set_hard_smp_processor_id(cpu, intserv[j]);
379
380 if (intserv[j] == boot_cpuid_phys)
381 swap_cpuid = cpu;
382 cpu_set(cpu, cpu_possible_map); 385 cpu_set(cpu, cpu_possible_map);
383 cpu++; 386 cpu++;
384 } 387 }
385 } 388 }
386 389
387 /* Swap CPU id 0 with boot_cpuid_phys, so we can always assume that
388 * boot cpu is logical 0.
389 */
390 if (boot_cpuid_phys != get_hard_smp_processor_id(0)) {
391 u32 tmp;
392 tmp = get_hard_smp_processor_id(0);
393 set_hard_smp_processor_id(0, boot_cpuid_phys);
394 set_hard_smp_processor_id(swap_cpuid, tmp);
395 }
396
397#ifdef CONFIG_PPC64 390#ifdef CONFIG_PPC64
398 /* 391 /*
399 * On pSeries LPAR, we need to know how many cpus 392 * On pSeries LPAR, we need to know how many cpus
400 * could possibly be added to this partition. 393 * could possibly be added to this partition.
401 */ 394 */
402 if (_machine == PLATFORM_PSERIES_LPAR && 395 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) &&
403 (dn = of_find_node_by_path("/rtas"))) { 396 (dn = of_find_node_by_path("/rtas"))) {
404 int num_addr_cell, num_size_cell, maxcpus; 397 int num_addr_cell, num_size_cell, maxcpus;
405 unsigned int *ireg; 398 unsigned int *ireg;
@@ -438,7 +431,7 @@ void __init smp_setup_cpu_maps(void)
438 /* 431 /*
439 * Do the sibling map; assume only two threads per processor. 432 * Do the sibling map; assume only two threads per processor.
440 */ 433 */
441 for_each_cpu(cpu) { 434 for_each_possible_cpu(cpu) {
442 cpu_set(cpu, cpu_sibling_map[cpu]); 435 cpu_set(cpu, cpu_sibling_map[cpu]);
443 if (cpu_has_feature(CPU_FTR_SMT)) 436 if (cpu_has_feature(CPU_FTR_SMT))
444 cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]); 437 cpu_set(cpu ^ 0x1, cpu_sibling_map[cpu]);
@@ -468,3 +461,34 @@ static int __init early_xmon(char *p)
468} 461}
469early_param("xmon", early_xmon); 462early_param("xmon", early_xmon);
470#endif 463#endif
464
465void probe_machine(void)
466{
467 extern struct machdep_calls __machine_desc_start;
468 extern struct machdep_calls __machine_desc_end;
469
470 /*
471 * Iterate all ppc_md structures until we find the proper
472 * one for the current machine type
473 */
474 DBG("Probing machine type ...\n");
475
476 for (machine_id = &__machine_desc_start;
477 machine_id < &__machine_desc_end;
478 machine_id++) {
479 DBG(" %s ...", machine_id->name);
480 memcpy(&ppc_md, machine_id, sizeof(struct machdep_calls));
481 if (ppc_md.probe()) {
482 DBG(" match !\n");
483 break;
484 }
485 DBG("\n");
486 }
487 /* What can we do if we didn't find ? */
488 if (machine_id >= &__machine_desc_end) {
489 DBG("No suitable machine found !\n");
490 for (;;);
491 }
492
493 printk(KERN_INFO "Using %s machine description\n", ppc_md.name);
494}
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
index dc2770df25b3..a72bf5dceeee 100644
--- a/arch/powerpc/kernel/setup_32.c
+++ b/arch/powerpc/kernel/setup_32.c
@@ -53,9 +53,6 @@
53extern void platform_init(void); 53extern void platform_init(void);
54extern void bootx_init(unsigned long r4, unsigned long phys); 54extern void bootx_init(unsigned long r4, unsigned long phys);
55 55
56extern void ppc6xx_idle(void);
57extern void power4_idle(void);
58
59boot_infos_t *boot_infos; 56boot_infos_t *boot_infos;
60struct ide_machdep_calls ppc_ide_md; 57struct ide_machdep_calls ppc_ide_md;
61 58
@@ -70,10 +67,6 @@ unsigned int DMA_MODE_WRITE;
70int have_of = 1; 67int have_of = 1;
71 68
72#ifdef CONFIG_PPC_MULTIPLATFORM 69#ifdef CONFIG_PPC_MULTIPLATFORM
73extern void prep_init(void);
74extern void pmac_init(void);
75extern void chrp_init(void);
76
77dev_t boot_dev; 70dev_t boot_dev;
78#endif /* CONFIG_PPC_MULTIPLATFORM */ 71#endif /* CONFIG_PPC_MULTIPLATFORM */
79 72
@@ -85,9 +78,6 @@ unsigned long SYSRQ_KEY = 0x54;
85unsigned long vgacon_remap_base; 78unsigned long vgacon_remap_base;
86#endif 79#endif
87 80
88struct machdep_calls ppc_md;
89EXPORT_SYMBOL(ppc_md);
90
91/* 81/*
92 * These are used in binfmt_elf.c to put aux entries on the stack 82 * These are used in binfmt_elf.c to put aux entries on the stack
93 * for each elf executable being started. 83 * for each elf executable being started.
@@ -111,7 +101,7 @@ unsigned long __init early_init(unsigned long dt_ptr)
111 101
112 /* First zero the BSS -- use memset_io, some platforms don't have 102 /* First zero the BSS -- use memset_io, some platforms don't have
113 * caches on yet */ 103 * caches on yet */
114 memset_io(PTRRELOC(&__bss_start), 0, _end - __bss_start); 104 memset_io((void __iomem *)PTRRELOC(&__bss_start), 0, _end - __bss_start);
115 105
116 /* 106 /*
117 * Identify the CPU type and fix up code sections 107 * Identify the CPU type and fix up code sections
@@ -123,48 +113,6 @@ unsigned long __init early_init(unsigned long dt_ptr)
123 return KERNELBASE + offset; 113 return KERNELBASE + offset;
124} 114}
125 115
126#ifdef CONFIG_PPC_MULTIPLATFORM
127/*
128 * The PPC_MULTIPLATFORM version of platform_init...
129 */
130void __init platform_init(void)
131{
132 /* if we didn't get any bootinfo telling us what we are... */
133 if (_machine == 0) {
134 /* prep boot loader tells us if we're prep or not */
135 if ( *(unsigned long *)(KERNELBASE) == (0xdeadc0de) )
136 _machine = _MACH_prep;
137 }
138
139#ifdef CONFIG_PPC_PREP
140 /* not much more to do here, if prep */
141 if (_machine == _MACH_prep) {
142 prep_init();
143 return;
144 }
145#endif
146
147#ifdef CONFIG_ADB
148 if (strstr(cmd_line, "adb_sync")) {
149 extern int __adb_probe_sync;
150 __adb_probe_sync = 1;
151 }
152#endif /* CONFIG_ADB */
153
154 switch (_machine) {
155#ifdef CONFIG_PPC_PMAC
156 case _MACH_Pmac:
157 pmac_init();
158 break;
159#endif
160#ifdef CONFIG_PPC_CHRP
161 case _MACH_chrp:
162 chrp_init();
163 break;
164#endif
165 }
166}
167#endif
168 116
169/* 117/*
170 * Find out what kind of machine we're on and save any data we need 118 * Find out what kind of machine we're on and save any data we need
@@ -190,11 +138,17 @@ void __init machine_init(unsigned long dt_ptr, unsigned long phys)
190 strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line)); 138 strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
191#endif /* CONFIG_CMDLINE */ 139#endif /* CONFIG_CMDLINE */
192 140
193 /* Base init based on machine type */ 141#ifdef CONFIG_PPC_MULTIPLATFORM
142 probe_machine();
143#else
144 /* Base init based on machine type. Obsoloete, please kill ! */
194 platform_init(); 145 platform_init();
146#endif
195 147
196#ifdef CONFIG_6xx 148#ifdef CONFIG_6xx
197 ppc_md.power_save = ppc6xx_idle; 149 if (cpu_has_feature(CPU_FTR_CAN_DOZE) ||
150 cpu_has_feature(CPU_FTR_CAN_NAP))
151 ppc_md.power_save = ppc6xx_idle;
198#endif 152#endif
199 153
200 if (ppc_md.progress) 154 if (ppc_md.progress)
@@ -272,7 +226,7 @@ int __init ppc_init(void)
272 if ( ppc_md.progress ) ppc_md.progress(" ", 0xffff); 226 if ( ppc_md.progress ) ppc_md.progress(" ", 0xffff);
273 227
274 /* register CPU devices */ 228 /* register CPU devices */
275 for_each_cpu(i) 229 for_each_possible_cpu(i)
276 register_cpu(&cpu_devices[i], i, NULL); 230 register_cpu(&cpu_devices[i], i, NULL);
277 231
278 /* call platform init */ 232 /* call platform init */
@@ -352,12 +306,6 @@ void __init setup_arch(char **cmdline_p)
352 do_init_bootmem(); 306 do_init_bootmem();
353 if ( ppc_md.progress ) ppc_md.progress("setup_arch: bootmem", 0x3eab); 307 if ( ppc_md.progress ) ppc_md.progress("setup_arch: bootmem", 0x3eab);
354 308
355#ifdef CONFIG_PPC_OCP
356 /* Initialize OCP device list */
357 ocp_early_init();
358 if ( ppc_md.progress ) ppc_md.progress("ocp: exit", 0x3eab);
359#endif
360
361#ifdef CONFIG_DUMMY_CONSOLE 309#ifdef CONFIG_DUMMY_CONSOLE
362 conswitchp = &dummy_con; 310 conswitchp = &dummy_con;
363#endif 311#endif
@@ -366,7 +314,4 @@ void __init setup_arch(char **cmdline_p)
366 if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab); 314 if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
367 315
368 paging_init(); 316 paging_init();
369
370 /* this is for modules since _machine can be a define -- Cort */
371 ppc_md.ppc_machine = _machine;
372} 317}
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 2f3fdad35594..59aa92cd6fa4 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -73,7 +73,6 @@
73 73
74int have_of = 1; 74int have_of = 1;
75int boot_cpuid = 0; 75int boot_cpuid = 0;
76int boot_cpuid_phys = 0;
77dev_t boot_dev; 76dev_t boot_dev;
78u64 ppc64_pft_size; 77u64 ppc64_pft_size;
79 78
@@ -96,11 +95,6 @@ int dcache_bsize;
96int icache_bsize; 95int icache_bsize;
97int ucache_bsize; 96int ucache_bsize;
98 97
99/* The main machine-dep calls structure
100 */
101struct machdep_calls ppc_md;
102EXPORT_SYMBOL(ppc_md);
103
104#ifdef CONFIG_MAGIC_SYSRQ 98#ifdef CONFIG_MAGIC_SYSRQ
105unsigned long SYSRQ_KEY; 99unsigned long SYSRQ_KEY;
106#endif /* CONFIG_MAGIC_SYSRQ */ 100#endif /* CONFIG_MAGIC_SYSRQ */
@@ -161,32 +155,6 @@ early_param("smt-enabled", early_smt_enabled);
161#define check_smt_enabled() 155#define check_smt_enabled()
162#endif /* CONFIG_SMP */ 156#endif /* CONFIG_SMP */
163 157
164extern struct machdep_calls pSeries_md;
165extern struct machdep_calls pmac_md;
166extern struct machdep_calls maple_md;
167extern struct machdep_calls cell_md;
168extern struct machdep_calls iseries_md;
169
170/* Ultimately, stuff them in an elf section like initcalls... */
171static struct machdep_calls __initdata *machines[] = {
172#ifdef CONFIG_PPC_PSERIES
173 &pSeries_md,
174#endif /* CONFIG_PPC_PSERIES */
175#ifdef CONFIG_PPC_PMAC
176 &pmac_md,
177#endif /* CONFIG_PPC_PMAC */
178#ifdef CONFIG_PPC_MAPLE
179 &maple_md,
180#endif /* CONFIG_PPC_MAPLE */
181#ifdef CONFIG_PPC_CELL
182 &cell_md,
183#endif
184#ifdef CONFIG_PPC_ISERIES
185 &iseries_md,
186#endif
187 NULL
188};
189
190/* 158/*
191 * Early initialization entry point. This is called by head.S 159 * Early initialization entry point. This is called by head.S
192 * with MMU translation disabled. We rely on the "feature" of 160 * with MMU translation disabled. We rely on the "feature" of
@@ -208,13 +176,10 @@ static struct machdep_calls __initdata *machines[] = {
208 176
209void __init early_setup(unsigned long dt_ptr) 177void __init early_setup(unsigned long dt_ptr)
210{ 178{
211 struct paca_struct *lpaca = get_paca();
212 static struct machdep_calls **mach;
213
214 /* Enable early debugging if any specified (see udbg.h) */ 179 /* Enable early debugging if any specified (see udbg.h) */
215 udbg_early_init(); 180 udbg_early_init();
216 181
217 DBG(" -> early_setup()\n"); 182 DBG(" -> early_setup(), dt_ptr: 0x%lx\n", dt_ptr);
218 183
219 /* 184 /*
220 * Do early initializations using the flattened device 185 * Do early initializations using the flattened device
@@ -223,22 +188,16 @@ void __init early_setup(unsigned long dt_ptr)
223 */ 188 */
224 early_init_devtree(__va(dt_ptr)); 189 early_init_devtree(__va(dt_ptr));
225 190
226 /* 191 /* Now we know the logical id of our boot cpu, setup the paca. */
227 * Iterate all ppc_md structures until we find the proper 192 setup_boot_paca();
228 * one for the current machine type
229 */
230 DBG("Probing machine type for platform %x...\n", _machine);
231 193
232 for (mach = machines; *mach; mach++) { 194 /* Fix up paca fields required for the boot cpu */
233 if ((*mach)->probe(_machine)) 195 get_paca()->cpu_start = 1;
234 break; 196 get_paca()->stab_real = __pa((u64)&initial_stab);
235 } 197 get_paca()->stab_addr = (u64)&initial_stab;
236 /* What can we do if we didn't find ? */ 198
237 if (*mach == NULL) { 199 /* Probe the machine type */
238 DBG("No suitable machine found !\n"); 200 probe_machine();
239 for (;;);
240 }
241 ppc_md = **mach;
242 201
243#ifdef CONFIG_CRASH_DUMP 202#ifdef CONFIG_CRASH_DUMP
244 kdump_setup(); 203 kdump_setup();
@@ -260,7 +219,7 @@ void __init early_setup(unsigned long dt_ptr)
260 if (cpu_has_feature(CPU_FTR_SLB)) 219 if (cpu_has_feature(CPU_FTR_SLB))
261 slb_initialize(); 220 slb_initialize();
262 else 221 else
263 stab_initialize(lpaca->stab_real); 222 stab_initialize(get_paca()->stab_real);
264 } 223 }
265 224
266 DBG(" <- early_setup()\n"); 225 DBG(" <- early_setup()\n");
@@ -340,7 +299,7 @@ static void __init initialize_cache_info(void)
340 const char *dc, *ic; 299 const char *dc, *ic;
341 300
342 /* Then read cache informations */ 301 /* Then read cache informations */
343 if (_machine == PLATFORM_POWERMAC) { 302 if (machine_is(powermac)) {
344 dc = "d-cache-block-size"; 303 dc = "d-cache-block-size";
345 ic = "i-cache-block-size"; 304 ic = "i-cache-block-size";
346 } else { 305 } else {
@@ -484,7 +443,6 @@ void __init setup_system(void)
484 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size); 443 printk("ppc64_pft_size = 0x%lx\n", ppc64_pft_size);
485 printk("ppc64_interrupt_controller = 0x%ld\n", 444 printk("ppc64_interrupt_controller = 0x%ld\n",
486 ppc64_interrupt_controller); 445 ppc64_interrupt_controller);
487 printk("platform = 0x%x\n", _machine);
488 printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size()); 446 printk("physicalMemorySize = 0x%lx\n", lmb_phys_mem_size());
489 printk("ppc64_caches.dcache_line_size = 0x%x\n", 447 printk("ppc64_caches.dcache_line_size = 0x%x\n",
490 ppc64_caches.dline_size); 448 ppc64_caches.dline_size);
@@ -516,7 +474,7 @@ static void __init irqstack_early_init(void)
516 * interrupt stacks must be under 256MB, we cannot afford to take 474 * interrupt stacks must be under 256MB, we cannot afford to take
517 * SLB misses on them. 475 * SLB misses on them.
518 */ 476 */
519 for_each_cpu(i) { 477 for_each_possible_cpu(i) {
520 softirq_ctx[i] = (struct thread_info *) 478 softirq_ctx[i] = (struct thread_info *)
521 __va(lmb_alloc_base(THREAD_SIZE, 479 __va(lmb_alloc_base(THREAD_SIZE,
522 THREAD_SIZE, 0x10000000)); 480 THREAD_SIZE, 0x10000000));
@@ -549,7 +507,7 @@ static void __init emergency_stack_init(void)
549 */ 507 */
550 limit = min(0x10000000UL, lmb.rmo_size); 508 limit = min(0x10000000UL, lmb.rmo_size);
551 509
552 for_each_cpu(i) 510 for_each_possible_cpu(i)
553 paca[i].emergency_sp = 511 paca[i].emergency_sp =
554 __va(lmb_alloc_base(HW_PAGE_SIZE, 128, limit)) + HW_PAGE_SIZE; 512 __va(lmb_alloc_base(HW_PAGE_SIZE, 128, limit)) + HW_PAGE_SIZE;
555} 513}
@@ -579,7 +537,8 @@ void __init setup_arch(char **cmdline_p)
579 panic_timeout = 180; 537 panic_timeout = 180;
580 538
581 if (ppc_md.panic) 539 if (ppc_md.panic)
582 notifier_chain_register(&panic_notifier_list, &ppc64_panic_block); 540 atomic_notifier_chain_register(&panic_notifier_list,
541 &ppc64_panic_block);
583 542
584 init_mm.start_code = PAGE_OFFSET; 543 init_mm.start_code = PAGE_OFFSET;
585 init_mm.end_code = (unsigned long) _etext; 544 init_mm.end_code = (unsigned long) _etext;
@@ -601,12 +560,6 @@ void __init setup_arch(char **cmdline_p)
601 560
602 ppc_md.setup_arch(); 561 ppc_md.setup_arch();
603 562
604 /* Use the default idle loop if the platform hasn't provided one. */
605 if (NULL == ppc_md.idle_loop) {
606 ppc_md.idle_loop = default_idle;
607 printk(KERN_INFO "Using default idle loop\n");
608 }
609
610 paging_init(); 563 paging_init();
611 ppc64_boot_msg(0x15, "Setup Done"); 564 ppc64_boot_msg(0x15, "Setup Done");
612} 565}
@@ -671,7 +624,7 @@ void __init setup_per_cpu_areas(void)
671 size = PERCPU_ENOUGH_ROOM; 624 size = PERCPU_ENOUGH_ROOM;
672#endif 625#endif
673 626
674 for_each_cpu(i) { 627 for_each_possible_cpu(i) {
675 ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size); 628 ptr = alloc_bootmem_node(NODE_DATA(cpu_to_node(i)), size);
676 if (!ptr) 629 if (!ptr)
677 panic("Cannot allocate cpu data for CPU %d\n", i); 630 panic("Cannot allocate cpu data for CPU %d\n", i);
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index d7a4e814974d..01e3c08cb550 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -42,6 +42,7 @@
42 42
43#include <asm/uaccess.h> 43#include <asm/uaccess.h>
44#include <asm/cacheflush.h> 44#include <asm/cacheflush.h>
45#include <asm/syscalls.h>
45#include <asm/sigcontext.h> 46#include <asm/sigcontext.h>
46#include <asm/vdso.h> 47#include <asm/vdso.h>
47#ifdef CONFIG_PPC64 48#ifdef CONFIG_PPC64
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 47f910380a6a..27f65b95184d 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -33,6 +33,7 @@
33#include <asm/pgtable.h> 33#include <asm/pgtable.h>
34#include <asm/unistd.h> 34#include <asm/unistd.h>
35#include <asm/cacheflush.h> 35#include <asm/cacheflush.h>
36#include <asm/syscalls.h>
36#include <asm/vdso.h> 37#include <asm/vdso.h>
37 38
38#define DEBUG_SIG 0 39#define DEBUG_SIG 0
@@ -211,7 +212,7 @@ static inline void __user * get_sigframe(struct k_sigaction *ka, struct pt_regs
211 /* Default to using normal stack */ 212 /* Default to using normal stack */
212 newsp = regs->gpr[1]; 213 newsp = regs->gpr[1];
213 214
214 if (ka->sa.sa_flags & SA_ONSTACK) { 215 if ((ka->sa.sa_flags & SA_ONSTACK) && current->sas_ss_size) {
215 if (! on_sig_stack(regs->gpr[1])) 216 if (! on_sig_stack(regs->gpr[1]))
216 newsp = (current->sas_ss_sp + current->sas_ss_size); 217 newsp = (current->sas_ss_sp + current->sas_ss_size);
217 } 218 }
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 805eaedbc308..530f7dba0bd2 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -362,7 +362,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
362 362
363 smp_space_timers(max_cpus); 363 smp_space_timers(max_cpus);
364 364
365 for_each_cpu(cpu) 365 for_each_possible_cpu(cpu)
366 if (cpu != boot_cpuid) 366 if (cpu != boot_cpuid)
367 smp_create_idle(cpu); 367 smp_create_idle(cpu);
368} 368}
diff --git a/arch/ppc/kernel/swsusp.S b/arch/powerpc/kernel/swsusp_32.S
index 69773cc1a85f..69773cc1a85f 100644
--- a/arch/ppc/kernel/swsusp.S
+++ b/arch/powerpc/kernel/swsusp_32.S
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index ad895c99813b..9b69d99a9103 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -40,6 +40,7 @@
40#include <asm/uaccess.h> 40#include <asm/uaccess.h>
41#include <asm/ipc.h> 41#include <asm/ipc.h>
42#include <asm/semaphore.h> 42#include <asm/semaphore.h>
43#include <asm/syscalls.h>
43#include <asm/time.h> 44#include <asm/time.h>
44#include <asm/unistd.h> 45#include <asm/unistd.h>
45 46
diff --git a/arch/powerpc/kernel/sysfs.c b/arch/powerpc/kernel/sysfs.c
index 0f0c3a9ae2e5..73560ef6f802 100644
--- a/arch/powerpc/kernel/sysfs.c
+++ b/arch/powerpc/kernel/sysfs.c
@@ -65,20 +65,20 @@ static int __init smt_setup(void)
65 unsigned int cpu; 65 unsigned int cpu;
66 66
67 if (!cpu_has_feature(CPU_FTR_SMT)) 67 if (!cpu_has_feature(CPU_FTR_SMT))
68 return 1; 68 return -ENODEV;
69 69
70 options = find_path_device("/options"); 70 options = find_path_device("/options");
71 if (!options) 71 if (!options)
72 return 1; 72 return -ENODEV;
73 73
74 val = (unsigned int *)get_property(options, "ibm,smt-snooze-delay", 74 val = (unsigned int *)get_property(options, "ibm,smt-snooze-delay",
75 NULL); 75 NULL);
76 if (!smt_snooze_cmdline && val) { 76 if (!smt_snooze_cmdline && val) {
77 for_each_cpu(cpu) 77 for_each_possible_cpu(cpu)
78 per_cpu(smt_snooze_delay, cpu) = *val; 78 per_cpu(smt_snooze_delay, cpu) = *val;
79 } 79 }
80 80
81 return 1; 81 return 0;
82} 82}
83__initcall(smt_setup); 83__initcall(smt_setup);
84 84
@@ -93,7 +93,7 @@ static int __init setup_smt_snooze_delay(char *str)
93 smt_snooze_cmdline = 1; 93 smt_snooze_cmdline = 1;
94 94
95 if (get_option(&str, &snooze)) { 95 if (get_option(&str, &snooze)) {
96 for_each_cpu(cpu) 96 for_each_possible_cpu(cpu)
97 per_cpu(smt_snooze_delay, cpu) = snooze; 97 per_cpu(smt_snooze_delay, cpu) = snooze;
98 } 98 }
99 99
@@ -347,7 +347,7 @@ static int __init topology_init(void)
347 347
348 register_cpu_notifier(&sysfs_cpu_nb); 348 register_cpu_notifier(&sysfs_cpu_nb);
349 349
350 for_each_cpu(cpu) { 350 for_each_possible_cpu(cpu) {
351 struct cpu *c = &per_cpu(cpu_devices, cpu); 351 struct cpu *c = &per_cpu(cpu_devices, cpu);
352 352
353#ifdef CONFIG_NUMA 353#ifdef CONFIG_NUMA
diff --git a/arch/ppc/kernel/temp.c b/arch/powerpc/kernel/tau_6xx.c
index 26bd8ea35a4e..26bd8ea35a4e 100644
--- a/arch/ppc/kernel/temp.c
+++ b/arch/powerpc/kernel/tau_6xx.c
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 4a27218a086c..24e3ad756de0 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -261,7 +261,7 @@ void snapshot_timebases(void)
261 261
262 if (!cpu_has_feature(CPU_FTR_PURR)) 262 if (!cpu_has_feature(CPU_FTR_PURR))
263 return; 263 return;
264 for_each_cpu(cpu) 264 for_each_possible_cpu(cpu)
265 spin_lock_init(&per_cpu(cpu_purr_data, cpu).lock); 265 spin_lock_init(&per_cpu(cpu_purr_data, cpu).lock);
266 on_each_cpu(snapshot_tb_and_purr, NULL, 0, 1); 266 on_each_cpu(snapshot_tb_and_purr, NULL, 0, 1);
267} 267}
@@ -751,7 +751,7 @@ void __init smp_space_timers(unsigned int max_cpus)
751 * systems works better if the two threads' timebase interrupts 751 * systems works better if the two threads' timebase interrupts
752 * are staggered by half a jiffy with respect to each other. 752 * are staggered by half a jiffy with respect to each other.
753 */ 753 */
754 for_each_cpu(i) { 754 for_each_possible_cpu(i) {
755 if (i == boot_cpuid) 755 if (i == boot_cpuid)
756 continue; 756 continue;
757 if (i == (boot_cpuid ^ 1)) 757 if (i == (boot_cpuid ^ 1))
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 98660aedeeb7..4cbde211eb69 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -74,19 +74,19 @@ EXPORT_SYMBOL(__debugger_dabr_match);
74EXPORT_SYMBOL(__debugger_fault_handler); 74EXPORT_SYMBOL(__debugger_fault_handler);
75#endif 75#endif
76 76
77struct notifier_block *powerpc_die_chain; 77ATOMIC_NOTIFIER_HEAD(powerpc_die_chain);
78static DEFINE_SPINLOCK(die_notifier_lock);
79 78
80int register_die_notifier(struct notifier_block *nb) 79int register_die_notifier(struct notifier_block *nb)
81{ 80{
82 int err = 0; 81 return atomic_notifier_chain_register(&powerpc_die_chain, nb);
83 unsigned long flags; 82}
83EXPORT_SYMBOL(register_die_notifier);
84 84
85 spin_lock_irqsave(&die_notifier_lock, flags); 85int unregister_die_notifier(struct notifier_block *nb)
86 err = notifier_chain_register(&powerpc_die_chain, nb); 86{
87 spin_unlock_irqrestore(&die_notifier_lock, flags); 87 return atomic_notifier_chain_unregister(&powerpc_die_chain, nb);
88 return err;
89} 88}
89EXPORT_SYMBOL(unregister_die_notifier);
90 90
91/* 91/*
92 * Trap & Exception support 92 * Trap & Exception support
@@ -97,7 +97,6 @@ static DEFINE_SPINLOCK(die_lock);
97int die(const char *str, struct pt_regs *regs, long err) 97int die(const char *str, struct pt_regs *regs, long err)
98{ 98{
99 static int die_counter, crash_dump_start = 0; 99 static int die_counter, crash_dump_start = 0;
100 int nl = 0;
101 100
102 if (debugger(regs)) 101 if (debugger(regs))
103 return 1; 102 return 1;
@@ -106,7 +105,7 @@ int die(const char *str, struct pt_regs *regs, long err)
106 spin_lock_irq(&die_lock); 105 spin_lock_irq(&die_lock);
107 bust_spinlocks(1); 106 bust_spinlocks(1);
108#ifdef CONFIG_PMAC_BACKLIGHT 107#ifdef CONFIG_PMAC_BACKLIGHT
109 if (_machine == _MACH_Pmac) { 108 if (machine_is(powermac)) {
110 set_backlight_enable(1); 109 set_backlight_enable(1);
111 set_backlight_level(BACKLIGHT_MAX); 110 set_backlight_level(BACKLIGHT_MAX);
112 } 111 }
@@ -114,46 +113,18 @@ int die(const char *str, struct pt_regs *regs, long err)
114 printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter); 113 printk("Oops: %s, sig: %ld [#%d]\n", str, err, ++die_counter);
115#ifdef CONFIG_PREEMPT 114#ifdef CONFIG_PREEMPT
116 printk("PREEMPT "); 115 printk("PREEMPT ");
117 nl = 1;
118#endif 116#endif
119#ifdef CONFIG_SMP 117#ifdef CONFIG_SMP
120 printk("SMP NR_CPUS=%d ", NR_CPUS); 118 printk("SMP NR_CPUS=%d ", NR_CPUS);
121 nl = 1;
122#endif 119#endif
123#ifdef CONFIG_DEBUG_PAGEALLOC 120#ifdef CONFIG_DEBUG_PAGEALLOC
124 printk("DEBUG_PAGEALLOC "); 121 printk("DEBUG_PAGEALLOC ");
125 nl = 1;
126#endif 122#endif
127#ifdef CONFIG_NUMA 123#ifdef CONFIG_NUMA
128 printk("NUMA "); 124 printk("NUMA ");
129 nl = 1;
130#endif 125#endif
131#ifdef CONFIG_PPC64 126 printk("%s\n", ppc_md.name ? "" : ppc_md.name);
132 switch (_machine) { 127
133 case PLATFORM_PSERIES:
134 printk("PSERIES ");
135 nl = 1;
136 break;
137 case PLATFORM_PSERIES_LPAR:
138 printk("PSERIES LPAR ");
139 nl = 1;
140 break;
141 case PLATFORM_ISERIES_LPAR:
142 printk("ISERIES LPAR ");
143 nl = 1;
144 break;
145 case PLATFORM_POWERMAC:
146 printk("POWERMAC ");
147 nl = 1;
148 break;
149 case PLATFORM_CELL:
150 printk("CELL ");
151 nl = 1;
152 break;
153 }
154#endif
155 if (nl)
156 printk("\n");
157 print_modules(); 128 print_modules();
158 show_regs(regs); 129 show_regs(regs);
159 bust_spinlocks(0); 130 bust_spinlocks(0);
diff --git a/arch/powerpc/kernel/vdso.c b/arch/powerpc/kernel/vdso.c
index ec8370368423..573afb68d69e 100644
--- a/arch/powerpc/kernel/vdso.c
+++ b/arch/powerpc/kernel/vdso.c
@@ -33,6 +33,7 @@
33#include <asm/machdep.h> 33#include <asm/machdep.h>
34#include <asm/cputable.h> 34#include <asm/cputable.h>
35#include <asm/sections.h> 35#include <asm/sections.h>
36#include <asm/firmware.h>
36#include <asm/vdso.h> 37#include <asm/vdso.h>
37#include <asm/vdso_datapage.h> 38#include <asm/vdso_datapage.h>
38 39
@@ -667,7 +668,13 @@ void __init vdso_init(void)
667 vdso_data->version.major = SYSTEMCFG_MAJOR; 668 vdso_data->version.major = SYSTEMCFG_MAJOR;
668 vdso_data->version.minor = SYSTEMCFG_MINOR; 669 vdso_data->version.minor = SYSTEMCFG_MINOR;
669 vdso_data->processor = mfspr(SPRN_PVR); 670 vdso_data->processor = mfspr(SPRN_PVR);
670 vdso_data->platform = _machine; 671 /*
672 * Fake the old platform number for pSeries and iSeries and add
673 * in LPAR bit if necessary
674 */
675 vdso_data->platform = machine_is(iseries) ? 0x200 : 0x100;
676 if (firmware_has_feature(FW_FEATURE_LPAR))
677 vdso_data->platform |= 1;
671 vdso_data->physicalMemorySize = lmb_phys_mem_size(); 678 vdso_data->physicalMemorySize = lmb_phys_mem_size();
672 vdso_data->dcache_size = ppc64_caches.dsize; 679 vdso_data->dcache_size = ppc64_caches.dsize;
673 vdso_data->dcache_line_size = ppc64_caches.dline_size; 680 vdso_data->dcache_line_size = ppc64_caches.dline_size;
diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S
index 7fa7b15fd8e6..fe79c2584cb0 100644
--- a/arch/powerpc/kernel/vmlinux.lds.S
+++ b/arch/powerpc/kernel/vmlinux.lds.S
@@ -1,9 +1,11 @@
1#include <linux/config.h> 1#include <linux/config.h>
2#ifdef CONFIG_PPC64 2#ifdef CONFIG_PPC64
3#include <asm/page.h> 3#include <asm/page.h>
4#define PROVIDE32(x) PROVIDE(__unused__##x)
4#else 5#else
5#define PAGE_SIZE 4096 6#define PAGE_SIZE 4096
6#define KERNELBASE CONFIG_KERNEL_START 7#define KERNELBASE CONFIG_KERNEL_START
8#define PROVIDE32(x) PROVIDE(x)
7#endif 9#endif
8#include <asm-generic/vmlinux.lds.h> 10#include <asm-generic/vmlinux.lds.h>
9 11
@@ -18,43 +20,42 @@ jiffies = jiffies_64 + 4;
18#endif 20#endif
19SECTIONS 21SECTIONS
20{ 22{
21 /* Sections to be discarded. */ 23 /* Sections to be discarded. */
22 /DISCARD/ : { 24 /DISCARD/ : {
23 *(.exitcall.exit) 25 *(.exitcall.exit)
24 *(.exit.data) 26 *(.exit.data)
25 } 27 }
26
27 . = KERNELBASE;
28
29 /* Read-only sections, merged into text segment: */
30 .text : {
31 *(.text .text.*)
32 SCHED_TEXT
33 LOCK_TEXT
34 KPROBES_TEXT
35 *(.fixup)
36#ifdef CONFIG_PPC32
37 *(.got1)
38 __got2_start = .;
39 *(.got2)
40 __got2_end = .;
41#else
42 . = ALIGN(PAGE_SIZE);
43 _etext = .;
44#endif
45 }
46#ifdef CONFIG_PPC32
47 _etext = .;
48 PROVIDE (etext = .);
49 28
50 RODATA 29 . = KERNELBASE;
51 .fini : { *(.fini) } =0
52 .ctors : { *(.ctors) }
53 .dtors : { *(.dtors) }
54 30
55 .fixup : { *(.fixup) } 31/*
56#endif 32 * Text, read only data and other permanent read-only sections
33 */
34
35 /* Text and gots */
36 .text : {
37 *(.text .text.*)
38 SCHED_TEXT
39 LOCK_TEXT
40 KPROBES_TEXT
41 *(.fixup)
57 42
43#ifdef CONFIG_PPC32
44 *(.got1)
45 __got2_start = .;
46 *(.got2)
47 __got2_end = .;
48#endif /* CONFIG_PPC32 */
49
50 . = ALIGN(PAGE_SIZE);
51 _etext = .;
52 PROVIDE32 (etext = .);
53 }
54
55 /* Read-only data */
56 RODATA
57
58 /* Exception & bug tables */
58 __ex_table : { 59 __ex_table : {
59 __start___ex_table = .; 60 __start___ex_table = .;
60 *(__ex_table) 61 *(__ex_table)
@@ -67,192 +68,172 @@ SECTIONS
67 __stop___bug_table = .; 68 __stop___bug_table = .;
68 } 69 }
69 70
70#ifdef CONFIG_PPC64 71/*
72 * Init sections discarded at runtime
73 */
74 . = ALIGN(PAGE_SIZE);
75 __init_begin = .;
76
77 .init.text : {
78 _sinittext = .;
79 *(.init.text)
80 _einittext = .;
81 }
82
83 /* .exit.text is discarded at runtime, not link time,
84 * to deal with references from __bug_table
85 */
86 .exit.text : { *(.exit.text) }
87
88 .init.data : {
89 *(.init.data);
90 __vtop_table_begin = .;
91 *(.vtop_fixup);
92 __vtop_table_end = .;
93 __ptov_table_begin = .;
94 *(.ptov_fixup);
95 __ptov_table_end = .;
96 }
97
98 . = ALIGN(16);
99 .init.setup : {
100 __setup_start = .;
101 *(.init.setup)
102 __setup_end = .;
103 }
104
105 .initcall.init : {
106 __initcall_start = .;
107 *(.initcall1.init)
108 *(.initcall2.init)
109 *(.initcall3.init)
110 *(.initcall4.init)
111 *(.initcall5.init)
112 *(.initcall6.init)
113 *(.initcall7.init)
114 __initcall_end = .;
115 }
116
117 .con_initcall.init : {
118 __con_initcall_start = .;
119 *(.con_initcall.init)
120 __con_initcall_end = .;
121 }
122
123 SECURITY_INIT
124
125 . = ALIGN(8);
71 __ftr_fixup : { 126 __ftr_fixup : {
72 __start___ftr_fixup = .; 127 __start___ftr_fixup = .;
73 *(__ftr_fixup) 128 *(__ftr_fixup)
74 __stop___ftr_fixup = .; 129 __stop___ftr_fixup = .;
75 } 130 }
76 131
77 RODATA 132 . = ALIGN(PAGE_SIZE);
78#endif 133 .init.ramfs : {
134 __initramfs_start = .;
135 *(.init.ramfs)
136 __initramfs_end = .;
137 }
79 138
80#ifdef CONFIG_PPC32 139#ifdef CONFIG_PPC32
81 /* Read-write section, merged into data segment: */ 140 . = ALIGN(32);
82 . = ALIGN(PAGE_SIZE); 141#else
83 _sdata = .; 142 . = ALIGN(128);
84 .data :
85 {
86 *(.data)
87 *(.data1)
88 *(.sdata)
89 *(.sdata2)
90 *(.got.plt) *(.got)
91 *(.dynamic)
92 CONSTRUCTORS
93 }
94
95 . = ALIGN(PAGE_SIZE);
96 __nosave_begin = .;
97 .data_nosave : { *(.data.nosave) }
98 . = ALIGN(PAGE_SIZE);
99 __nosave_end = .;
100
101 . = ALIGN(32);
102 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
103
104 _edata = .;
105 PROVIDE (edata = .);
106
107 . = ALIGN(8192);
108 .data.init_task : { *(.data.init_task) }
109#endif 143#endif
144 .data.percpu : {
145 __per_cpu_start = .;
146 *(.data.percpu)
147 __per_cpu_end = .;
148 }
110 149
111 /* will be freed after init */ 150 . = ALIGN(8);
112 . = ALIGN(PAGE_SIZE); 151 .machine.desc : {
113 __init_begin = .; 152 __machine_desc_start = . ;
114 .init.text : { 153 *(.machine.desc)
115 _sinittext = .; 154 __machine_desc_end = . ;
116 *(.init.text) 155 }
117 _einittext = .; 156
118 } 157 /* freed after init ends here */
119#ifdef CONFIG_PPC32 158 . = ALIGN(PAGE_SIZE);
120 /* .exit.text is discarded at runtime, not link time, 159 __init_end = .;
121 to deal with references from __bug_table */ 160
122 .exit.text : { *(.exit.text) } 161/*
123#endif 162 * And now the various read/write data
124 .init.data : { 163 */
125 *(.init.data); 164
126 __vtop_table_begin = .; 165 . = ALIGN(PAGE_SIZE);
127 *(.vtop_fixup); 166 _sdata = .;
128 __vtop_table_end = .;
129 __ptov_table_begin = .;
130 *(.ptov_fixup);
131 __ptov_table_end = .;
132 }
133
134 . = ALIGN(16);
135 .init.setup : {
136 __setup_start = .;
137 *(.init.setup)
138 __setup_end = .;
139 }
140
141 .initcall.init : {
142 __initcall_start = .;
143 *(.initcall1.init)
144 *(.initcall2.init)
145 *(.initcall3.init)
146 *(.initcall4.init)
147 *(.initcall5.init)
148 *(.initcall6.init)
149 *(.initcall7.init)
150 __initcall_end = .;
151 }
152
153 .con_initcall.init : {
154 __con_initcall_start = .;
155 *(.con_initcall.init)
156 __con_initcall_end = .;
157 }
158
159 SECURITY_INIT
160 167
161#ifdef CONFIG_PPC32 168#ifdef CONFIG_PPC32
162 __start___ftr_fixup = .; 169 .data :
163 __ftr_fixup : { *(__ftr_fixup) } 170 {
164 __stop___ftr_fixup = .; 171 *(.data)
172 *(.sdata)
173 *(.got.plt) *(.got)
174 }
165#else 175#else
166 . = ALIGN(PAGE_SIZE); 176 .data : {
167 .init.ramfs : { 177 *(.data .data.rel* .toc1)
168 __initramfs_start = .; 178 *(.branch_lt)
169 *(.init.ramfs) 179 }
170 __initramfs_end = .;
171 }
172#endif
173 180
174#ifdef CONFIG_PPC32 181 .opd : {
175 . = ALIGN(32); 182 *(.opd)
183 }
184
185 .got : {
186 __toc_start = .;
187 *(.got)
188 *(.toc)
189 }
176#endif 190#endif
177 .data.percpu : {
178 __per_cpu_start = .;
179 *(.data.percpu)
180 __per_cpu_end = .;
181 }
182 191
183 . = ALIGN(PAGE_SIZE); 192 . = ALIGN(PAGE_SIZE);
184#ifdef CONFIG_PPC64 193 _edata = .;
185 . = ALIGN(16384); 194 PROVIDE32 (edata = .);
186 __init_end = .; 195
187 /* freed after init ends here */ 196 /* The initial task and kernel stack */
188 197#ifdef CONFIG_PPC32
189 /* Read/write sections */ 198 . = ALIGN(8192);
190 . = ALIGN(PAGE_SIZE);
191 . = ALIGN(16384);
192 _sdata = .;
193 /* The initial task and kernel stack */
194 .data.init_task : {
195 *(.data.init_task)
196 }
197
198 . = ALIGN(PAGE_SIZE);
199 .data.page_aligned : {
200 *(.data.page_aligned)
201 }
202
203 .data.cacheline_aligned : {
204 *(.data.cacheline_aligned)
205 }
206
207 .data : {
208 *(.data .data.rel* .toc1)
209 *(.branch_lt)
210 }
211
212 .opd : {
213 *(.opd)
214 }
215
216 .got : {
217 __toc_start = .;
218 *(.got)
219 *(.toc)
220 . = ALIGN(PAGE_SIZE);
221 _edata = .;
222 }
223
224 . = ALIGN(PAGE_SIZE);
225#else 199#else
226 __initramfs_start = .; 200 . = ALIGN(16384);
227 .init.ramfs : { 201#endif
228 *(.init.ramfs) 202 .data.init_task : {
229 } 203 *(.data.init_task)
230 __initramfs_end = .; 204 }
231 205
232 . = ALIGN(4096); 206 . = ALIGN(PAGE_SIZE);
233 __init_end = .; 207 .data.page_aligned : {
208 *(.data.page_aligned)
209 }
234 210
235 . = ALIGN(4096); 211 .data.cacheline_aligned : {
236 _sextratext = .; 212 *(.data.cacheline_aligned)
237 _eextratext = .; 213 }
238 214
239 __bss_start = .; 215 . = ALIGN(PAGE_SIZE);
240#endif 216 __data_nosave : {
217 __nosave_begin = .;
218 *(.data.nosave)
219 . = ALIGN(PAGE_SIZE);
220 __nosave_end = .;
221 }
241 222
242 .bss : { 223/*
243 __bss_start = .; 224 * And finally the bss
244 *(.sbss) *(.scommon) 225 */
245 *(.dynbss) 226
246 *(.bss) 227 .bss : {
247 *(COMMON) 228 __bss_start = .;
248 __bss_stop = .; 229 *(.sbss) *(.scommon)
249 } 230 *(.dynbss)
231 *(.bss)
232 *(COMMON)
233 __bss_stop = .;
234 }
250 235
251#ifdef CONFIG_PPC64 236 . = ALIGN(PAGE_SIZE);
252 . = ALIGN(PAGE_SIZE); 237 _end = . ;
253#endif 238 PROVIDE32 (end = .);
254 _end = . ;
255#ifdef CONFIG_PPC32
256 PROVIDE (end = .);
257#endif
258} 239}
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 666c2aa55016..c251d9936612 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -18,7 +18,7 @@ extern char system_call_common[];
18 18
19#ifdef CONFIG_PPC64 19#ifdef CONFIG_PPC64
20/* Bits in SRR1 that are copied from MSR */ 20/* Bits in SRR1 that are copied from MSR */
21#define MSR_MASK 0xffffffff87c0ffff 21#define MSR_MASK 0xffffffff87c0ffffUL
22#else 22#else
23#define MSR_MASK 0x87c0ffff 23#define MSR_MASK 0x87c0ffff
24#endif 24#endif
diff --git a/arch/ppc/math-emu/Makefile b/arch/powerpc/math-emu/Makefile
index 754143e8936b..754143e8936b 100644
--- a/arch/ppc/math-emu/Makefile
+++ b/arch/powerpc/math-emu/Makefile
diff --git a/arch/ppc/math-emu/double.h b/arch/powerpc/math-emu/double.h
index ffba8b67f059..ffba8b67f059 100644
--- a/arch/ppc/math-emu/double.h
+++ b/arch/powerpc/math-emu/double.h
diff --git a/arch/ppc/math-emu/fabs.c b/arch/powerpc/math-emu/fabs.c
index 41f0617f3d3a..41f0617f3d3a 100644
--- a/arch/ppc/math-emu/fabs.c
+++ b/arch/powerpc/math-emu/fabs.c
diff --git a/arch/ppc/math-emu/fadd.c b/arch/powerpc/math-emu/fadd.c
index fc8836488b64..fc8836488b64 100644
--- a/arch/ppc/math-emu/fadd.c
+++ b/arch/powerpc/math-emu/fadd.c
diff --git a/arch/ppc/math-emu/fadds.c b/arch/powerpc/math-emu/fadds.c
index 93025b6c8f3c..93025b6c8f3c 100644
--- a/arch/ppc/math-emu/fadds.c
+++ b/arch/powerpc/math-emu/fadds.c
diff --git a/arch/ppc/math-emu/fcmpo.c b/arch/powerpc/math-emu/fcmpo.c
index 4efac394b4cb..4efac394b4cb 100644
--- a/arch/ppc/math-emu/fcmpo.c
+++ b/arch/powerpc/math-emu/fcmpo.c
diff --git a/arch/ppc/math-emu/fcmpu.c b/arch/powerpc/math-emu/fcmpu.c
index b7e33176e618..b7e33176e618 100644
--- a/arch/ppc/math-emu/fcmpu.c
+++ b/arch/powerpc/math-emu/fcmpu.c
diff --git a/arch/ppc/math-emu/fctiw.c b/arch/powerpc/math-emu/fctiw.c
index 3b3c98b840cf..3b3c98b840cf 100644
--- a/arch/ppc/math-emu/fctiw.c
+++ b/arch/powerpc/math-emu/fctiw.c
diff --git a/arch/ppc/math-emu/fctiwz.c b/arch/powerpc/math-emu/fctiwz.c
index 7717eb6fcfb6..7717eb6fcfb6 100644
--- a/arch/ppc/math-emu/fctiwz.c
+++ b/arch/powerpc/math-emu/fctiwz.c
diff --git a/arch/ppc/math-emu/fdiv.c b/arch/powerpc/math-emu/fdiv.c
index f2fba825b2d0..f2fba825b2d0 100644
--- a/arch/ppc/math-emu/fdiv.c
+++ b/arch/powerpc/math-emu/fdiv.c
diff --git a/arch/ppc/math-emu/fdivs.c b/arch/powerpc/math-emu/fdivs.c
index b971196e3175..b971196e3175 100644
--- a/arch/ppc/math-emu/fdivs.c
+++ b/arch/powerpc/math-emu/fdivs.c
diff --git a/arch/ppc/math-emu/fmadd.c b/arch/powerpc/math-emu/fmadd.c
index 0a1dbce793e9..0a1dbce793e9 100644
--- a/arch/ppc/math-emu/fmadd.c
+++ b/arch/powerpc/math-emu/fmadd.c
diff --git a/arch/ppc/math-emu/fmadds.c b/arch/powerpc/math-emu/fmadds.c
index 0f70bba9445e..0f70bba9445e 100644
--- a/arch/ppc/math-emu/fmadds.c
+++ b/arch/powerpc/math-emu/fmadds.c
diff --git a/arch/ppc/math-emu/fmr.c b/arch/powerpc/math-emu/fmr.c
index 28df700c0c7e..28df700c0c7e 100644
--- a/arch/ppc/math-emu/fmr.c
+++ b/arch/powerpc/math-emu/fmr.c
diff --git a/arch/ppc/math-emu/fmsub.c b/arch/powerpc/math-emu/fmsub.c
index 203fd48a6fec..203fd48a6fec 100644
--- a/arch/ppc/math-emu/fmsub.c
+++ b/arch/powerpc/math-emu/fmsub.c
diff --git a/arch/ppc/math-emu/fmsubs.c b/arch/powerpc/math-emu/fmsubs.c
index 8ce68624c189..8ce68624c189 100644
--- a/arch/ppc/math-emu/fmsubs.c
+++ b/arch/powerpc/math-emu/fmsubs.c
diff --git a/arch/ppc/math-emu/fmul.c b/arch/powerpc/math-emu/fmul.c
index 66c7e79aae2e..66c7e79aae2e 100644
--- a/arch/ppc/math-emu/fmul.c
+++ b/arch/powerpc/math-emu/fmul.c
diff --git a/arch/ppc/math-emu/fmuls.c b/arch/powerpc/math-emu/fmuls.c
index 26bc4278271c..26bc4278271c 100644
--- a/arch/ppc/math-emu/fmuls.c
+++ b/arch/powerpc/math-emu/fmuls.c
diff --git a/arch/ppc/math-emu/fnabs.c b/arch/powerpc/math-emu/fnabs.c
index c6b913d179e0..c6b913d179e0 100644
--- a/arch/ppc/math-emu/fnabs.c
+++ b/arch/powerpc/math-emu/fnabs.c
diff --git a/arch/ppc/math-emu/fneg.c b/arch/powerpc/math-emu/fneg.c
index fe9a98deff69..fe9a98deff69 100644
--- a/arch/ppc/math-emu/fneg.c
+++ b/arch/powerpc/math-emu/fneg.c
diff --git a/arch/ppc/math-emu/fnmadd.c b/arch/powerpc/math-emu/fnmadd.c
index 7f312276d920..7f312276d920 100644
--- a/arch/ppc/math-emu/fnmadd.c
+++ b/arch/powerpc/math-emu/fnmadd.c
diff --git a/arch/ppc/math-emu/fnmadds.c b/arch/powerpc/math-emu/fnmadds.c
index 65454c9c70bc..65454c9c70bc 100644
--- a/arch/ppc/math-emu/fnmadds.c
+++ b/arch/powerpc/math-emu/fnmadds.c
diff --git a/arch/ppc/math-emu/fnmsub.c b/arch/powerpc/math-emu/fnmsub.c
index f1ca7482b5f0..f1ca7482b5f0 100644
--- a/arch/ppc/math-emu/fnmsub.c
+++ b/arch/powerpc/math-emu/fnmsub.c
diff --git a/arch/ppc/math-emu/fnmsubs.c b/arch/powerpc/math-emu/fnmsubs.c
index 5c9a09a87dc7..5c9a09a87dc7 100644
--- a/arch/ppc/math-emu/fnmsubs.c
+++ b/arch/powerpc/math-emu/fnmsubs.c
diff --git a/arch/ppc/math-emu/fres.c b/arch/powerpc/math-emu/fres.c
index ec11e46d20af..ec11e46d20af 100644
--- a/arch/ppc/math-emu/fres.c
+++ b/arch/powerpc/math-emu/fres.c
diff --git a/arch/ppc/math-emu/frsp.c b/arch/powerpc/math-emu/frsp.c
index d879b2a3d0c9..d879b2a3d0c9 100644
--- a/arch/ppc/math-emu/frsp.c
+++ b/arch/powerpc/math-emu/frsp.c
diff --git a/arch/ppc/math-emu/frsqrte.c b/arch/powerpc/math-emu/frsqrte.c
index a11ae1829850..a11ae1829850 100644
--- a/arch/ppc/math-emu/frsqrte.c
+++ b/arch/powerpc/math-emu/frsqrte.c
diff --git a/arch/ppc/math-emu/fsel.c b/arch/powerpc/math-emu/fsel.c
index e36e6e72819a..e36e6e72819a 100644
--- a/arch/ppc/math-emu/fsel.c
+++ b/arch/powerpc/math-emu/fsel.c
diff --git a/arch/ppc/math-emu/fsqrt.c b/arch/powerpc/math-emu/fsqrt.c
index 6f8319f64a8a..6f8319f64a8a 100644
--- a/arch/ppc/math-emu/fsqrt.c
+++ b/arch/powerpc/math-emu/fsqrt.c
diff --git a/arch/ppc/math-emu/fsqrts.c b/arch/powerpc/math-emu/fsqrts.c
index 3b2b1cf55c12..3b2b1cf55c12 100644
--- a/arch/ppc/math-emu/fsqrts.c
+++ b/arch/powerpc/math-emu/fsqrts.c
diff --git a/arch/ppc/math-emu/fsub.c b/arch/powerpc/math-emu/fsub.c
index 956679042bb2..956679042bb2 100644
--- a/arch/ppc/math-emu/fsub.c
+++ b/arch/powerpc/math-emu/fsub.c
diff --git a/arch/ppc/math-emu/fsubs.c b/arch/powerpc/math-emu/fsubs.c
index 3428117dfe8c..3428117dfe8c 100644
--- a/arch/ppc/math-emu/fsubs.c
+++ b/arch/powerpc/math-emu/fsubs.c
diff --git a/arch/ppc/math-emu/lfd.c b/arch/powerpc/math-emu/lfd.c
index 7d38101c329b..7d38101c329b 100644
--- a/arch/ppc/math-emu/lfd.c
+++ b/arch/powerpc/math-emu/lfd.c
diff --git a/arch/ppc/math-emu/lfs.c b/arch/powerpc/math-emu/lfs.c
index c86dee3d7655..c86dee3d7655 100644
--- a/arch/ppc/math-emu/lfs.c
+++ b/arch/powerpc/math-emu/lfs.c
diff --git a/arch/ppc/math-emu/math.c b/arch/powerpc/math-emu/math.c
index 589153472761..589153472761 100644
--- a/arch/ppc/math-emu/math.c
+++ b/arch/powerpc/math-emu/math.c
diff --git a/arch/ppc/math-emu/mcrfs.c b/arch/powerpc/math-emu/mcrfs.c
index 106dd912914b..106dd912914b 100644
--- a/arch/ppc/math-emu/mcrfs.c
+++ b/arch/powerpc/math-emu/mcrfs.c
diff --git a/arch/ppc/math-emu/mffs.c b/arch/powerpc/math-emu/mffs.c
index f477c9170e75..f477c9170e75 100644
--- a/arch/ppc/math-emu/mffs.c
+++ b/arch/powerpc/math-emu/mffs.c
diff --git a/arch/ppc/math-emu/mtfsb0.c b/arch/powerpc/math-emu/mtfsb0.c
index 99bfd80f4af3..99bfd80f4af3 100644
--- a/arch/ppc/math-emu/mtfsb0.c
+++ b/arch/powerpc/math-emu/mtfsb0.c
diff --git a/arch/ppc/math-emu/mtfsb1.c b/arch/powerpc/math-emu/mtfsb1.c
index 3d9e7ed92d2b..3d9e7ed92d2b 100644
--- a/arch/ppc/math-emu/mtfsb1.c
+++ b/arch/powerpc/math-emu/mtfsb1.c
diff --git a/arch/ppc/math-emu/mtfsf.c b/arch/powerpc/math-emu/mtfsf.c
index d70cf714994c..d70cf714994c 100644
--- a/arch/ppc/math-emu/mtfsf.c
+++ b/arch/powerpc/math-emu/mtfsf.c
diff --git a/arch/ppc/math-emu/mtfsfi.c b/arch/powerpc/math-emu/mtfsfi.c
index 71df854baa7e..71df854baa7e 100644
--- a/arch/ppc/math-emu/mtfsfi.c
+++ b/arch/powerpc/math-emu/mtfsfi.c
diff --git a/arch/ppc/math-emu/op-1.h b/arch/powerpc/math-emu/op-1.h
index c92fa95f562e..c92fa95f562e 100644
--- a/arch/ppc/math-emu/op-1.h
+++ b/arch/powerpc/math-emu/op-1.h
diff --git a/arch/ppc/math-emu/op-2.h b/arch/powerpc/math-emu/op-2.h
index b9b06b4c6ea1..b9b06b4c6ea1 100644
--- a/arch/ppc/math-emu/op-2.h
+++ b/arch/powerpc/math-emu/op-2.h
diff --git a/arch/ppc/math-emu/op-4.h b/arch/powerpc/math-emu/op-4.h
index fcdd6d064c54..fcdd6d064c54 100644
--- a/arch/ppc/math-emu/op-4.h
+++ b/arch/powerpc/math-emu/op-4.h
diff --git a/arch/ppc/math-emu/op-common.h b/arch/powerpc/math-emu/op-common.h
index afb82b6498ce..afb82b6498ce 100644
--- a/arch/ppc/math-emu/op-common.h
+++ b/arch/powerpc/math-emu/op-common.h
diff --git a/arch/ppc/math-emu/sfp-machine.h b/arch/powerpc/math-emu/sfp-machine.h
index 4b17d83cfcdd..4b17d83cfcdd 100644
--- a/arch/ppc/math-emu/sfp-machine.h
+++ b/arch/powerpc/math-emu/sfp-machine.h
diff --git a/arch/ppc/math-emu/single.h b/arch/powerpc/math-emu/single.h
index f19d99451815..f19d99451815 100644
--- a/arch/ppc/math-emu/single.h
+++ b/arch/powerpc/math-emu/single.h
diff --git a/arch/ppc/math-emu/soft-fp.h b/arch/powerpc/math-emu/soft-fp.h
index cca39598f873..cca39598f873 100644
--- a/arch/ppc/math-emu/soft-fp.h
+++ b/arch/powerpc/math-emu/soft-fp.h
diff --git a/arch/ppc/math-emu/stfd.c b/arch/powerpc/math-emu/stfd.c
index 3f8c2558a9e8..3f8c2558a9e8 100644
--- a/arch/ppc/math-emu/stfd.c
+++ b/arch/powerpc/math-emu/stfd.c
diff --git a/arch/ppc/math-emu/stfiwx.c b/arch/powerpc/math-emu/stfiwx.c
index 95caaeec6a08..95caaeec6a08 100644
--- a/arch/ppc/math-emu/stfiwx.c
+++ b/arch/powerpc/math-emu/stfiwx.c
diff --git a/arch/ppc/math-emu/stfs.c b/arch/powerpc/math-emu/stfs.c
index e87ca23c6dc3..e87ca23c6dc3 100644
--- a/arch/ppc/math-emu/stfs.c
+++ b/arch/powerpc/math-emu/stfs.c
diff --git a/arch/ppc/math-emu/types.c b/arch/powerpc/math-emu/types.c
index e1ed15d829db..e1ed15d829db 100644
--- a/arch/ppc/math-emu/types.c
+++ b/arch/powerpc/math-emu/types.c
diff --git a/arch/ppc/math-emu/udivmodti4.c b/arch/powerpc/math-emu/udivmodti4.c
index 7e112dc1e2f2..7e112dc1e2f2 100644
--- a/arch/ppc/math-emu/udivmodti4.c
+++ b/arch/powerpc/math-emu/udivmodti4.c
diff --git a/arch/powerpc/mm/fault.c b/arch/powerpc/mm/fault.c
index ec4adcb4bc28..5aea0909a5ec 100644
--- a/arch/powerpc/mm/fault.c
+++ b/arch/powerpc/mm/fault.c
@@ -267,25 +267,29 @@ good_area:
267#endif 267#endif
268#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 268#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
269 pte_t *ptep; 269 pte_t *ptep;
270 pmd_t *pmdp;
270 271
271 /* Since 4xx/Book-E supports per-page execute permission, 272 /* Since 4xx/Book-E supports per-page execute permission,
272 * we lazily flush dcache to icache. */ 273 * we lazily flush dcache to icache. */
273 ptep = NULL; 274 ptep = NULL;
274 if (get_pteptr(mm, address, &ptep) && pte_present(*ptep)) { 275 if (get_pteptr(mm, address, &ptep, &pmdp)) {
275 struct page *page = pte_page(*ptep); 276 spinlock_t *ptl = pte_lockptr(mm, pmdp);
276 277 spin_lock(ptl);
277 if (! test_bit(PG_arch_1, &page->flags)) { 278 if (pte_present(*ptep)) {
278 flush_dcache_icache_page(page); 279 struct page *page = pte_page(*ptep);
279 set_bit(PG_arch_1, &page->flags); 280
281 if (!test_bit(PG_arch_1, &page->flags)) {
282 flush_dcache_icache_page(page);
283 set_bit(PG_arch_1, &page->flags);
284 }
285 pte_update(ptep, 0, _PAGE_HWEXEC);
286 _tlbie(address);
287 pte_unmap_unlock(ptep, ptl);
288 up_read(&mm->mmap_sem);
289 return 0;
280 } 290 }
281 pte_update(ptep, 0, _PAGE_HWEXEC); 291 pte_unmap_unlock(ptep, ptl);
282 _tlbie(address);
283 pte_unmap(ptep);
284 up_read(&mm->mmap_sem);
285 return 0;
286 } 292 }
287 if (ptep != NULL)
288 pte_unmap(ptep);
289#endif 293#endif
290 /* a write */ 294 /* a write */
291 } else if (is_write) { 295 } else if (is_write) {
diff --git a/arch/powerpc/mm/hash_utils_64.c b/arch/powerpc/mm/hash_utils_64.c
index 89b35c181314..c006d9039633 100644
--- a/arch/powerpc/mm/hash_utils_64.c
+++ b/arch/powerpc/mm/hash_utils_64.c
@@ -167,7 +167,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
167 * normal insert callback here. 167 * normal insert callback here.
168 */ 168 */
169#ifdef CONFIG_PPC_ISERIES 169#ifdef CONFIG_PPC_ISERIES
170 if (_machine == PLATFORM_ISERIES_LPAR) 170 if (machine_is(iseries))
171 ret = iSeries_hpte_insert(hpteg, va, 171 ret = iSeries_hpte_insert(hpteg, va,
172 paddr, 172 paddr,
173 tmp_mode, 173 tmp_mode,
@@ -176,7 +176,7 @@ int htab_bolt_mapping(unsigned long vstart, unsigned long vend,
176 else 176 else
177#endif 177#endif
178#ifdef CONFIG_PPC_PSERIES 178#ifdef CONFIG_PPC_PSERIES
179 if (_machine & PLATFORM_LPAR) 179 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR))
180 ret = pSeries_lpar_hpte_insert(hpteg, va, 180 ret = pSeries_lpar_hpte_insert(hpteg, va,
181 paddr, 181 paddr,
182 tmp_mode, 182 tmp_mode,
@@ -295,8 +295,7 @@ static void __init htab_init_page_sizes(void)
295 * Not in the device-tree, let's fallback on known size 295 * Not in the device-tree, let's fallback on known size
296 * list for 16M capable GP & GR 296 * list for 16M capable GP & GR
297 */ 297 */
298 if ((_machine != PLATFORM_ISERIES_LPAR) && 298 if (cpu_has_feature(CPU_FTR_16M_PAGE) && !machine_is(iseries))
299 cpu_has_feature(CPU_FTR_16M_PAGE))
300 memcpy(mmu_psize_defs, mmu_psize_defaults_gp, 299 memcpy(mmu_psize_defs, mmu_psize_defaults_gp,
301 sizeof(mmu_psize_defaults_gp)); 300 sizeof(mmu_psize_defaults_gp));
302 found: 301 found:
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index badac10d700c..741dd8802d49 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -195,7 +195,7 @@ void show_mem(void)
195 printk("Mem-info:\n"); 195 printk("Mem-info:\n");
196 show_free_areas(); 196 show_free_areas();
197 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 197 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
198 for_each_pgdat(pgdat) { 198 for_each_online_pgdat(pgdat) {
199 unsigned long flags; 199 unsigned long flags;
200 pgdat_resize_lock(pgdat, &flags); 200 pgdat_resize_lock(pgdat, &flags);
201 for (i = 0; i < pgdat->node_spanned_pages; i++) { 201 for (i = 0; i < pgdat->node_spanned_pages; i++) {
@@ -342,7 +342,7 @@ void __init mem_init(void)
342#ifdef CONFIG_NEED_MULTIPLE_NODES 342#ifdef CONFIG_NEED_MULTIPLE_NODES
343 for_each_online_node(nid) { 343 for_each_online_node(nid) {
344 if (NODE_DATA(nid)->node_spanned_pages != 0) { 344 if (NODE_DATA(nid)->node_spanned_pages != 0) {
345 printk("freeing bootmem node %x\n", nid); 345 printk("freeing bootmem node %d\n", nid);
346 totalram_pages += 346 totalram_pages +=
347 free_all_bootmem_node(NODE_DATA(nid)); 347 free_all_bootmem_node(NODE_DATA(nid));
348 } 348 }
@@ -351,7 +351,7 @@ void __init mem_init(void)
351 max_mapnr = max_pfn; 351 max_mapnr = max_pfn;
352 totalram_pages += free_all_bootmem(); 352 totalram_pages += free_all_bootmem();
353#endif 353#endif
354 for_each_pgdat(pgdat) { 354 for_each_online_pgdat(pgdat) {
355 for (i = 0; i < pgdat->node_spanned_pages; i++) { 355 for (i = 0; i < pgdat->node_spanned_pages; i++) {
356 if (!pfn_valid(pgdat->node_start_pfn + i)) 356 if (!pfn_valid(pgdat->node_start_pfn + i))
357 continue; 357 continue;
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index e89b22aa539e..0a335f34974c 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -756,6 +756,7 @@ int hot_add_scn_to_nid(unsigned long scn_addr)
756 struct device_node *memory = NULL; 756 struct device_node *memory = NULL;
757 nodemask_t nodes; 757 nodemask_t nodes;
758 int default_nid = any_online_node(NODE_MASK_ALL); 758 int default_nid = any_online_node(NODE_MASK_ALL);
759 int nid;
759 760
760 if (!numa_enabled || (min_common_depth < 0)) 761 if (!numa_enabled || (min_common_depth < 0))
761 return default_nid; 762 return default_nid;
@@ -790,6 +791,7 @@ ha_new_range:
790 goto ha_new_range; 791 goto ha_new_range;
791 } 792 }
792 BUG(); /* section address should be found above */ 793 BUG(); /* section address should be found above */
794 return 0;
793 795
794 /* Temporary code to ensure that returned node is not empty */ 796 /* Temporary code to ensure that returned node is not empty */
795got_nid: 797got_nid:
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index d296eb6b4545..90628601fac7 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -372,7 +372,7 @@ void __init io_block_mapping(unsigned long virt, phys_addr_t phys,
372 * the PTE pointer is unmodified if PTE is not found. 372 * the PTE pointer is unmodified if PTE is not found.
373 */ 373 */
374int 374int
375get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep) 375get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep, pmd_t **pmdp)
376{ 376{
377 pgd_t *pgd; 377 pgd_t *pgd;
378 pmd_t *pmd; 378 pmd_t *pmd;
@@ -387,6 +387,8 @@ get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep)
387 if (pte) { 387 if (pte) {
388 retval = 1; 388 retval = 1;
389 *ptep = pte; 389 *ptep = pte;
390 if (pmdp)
391 *pmdp = pmd;
390 /* XXX caller needs to do pte_unmap, yuck */ 392 /* XXX caller needs to do pte_unmap, yuck */
391 } 393 }
392 } 394 }
@@ -424,7 +426,7 @@ unsigned long iopa(unsigned long addr)
424 mm = &init_mm; 426 mm = &init_mm;
425 427
426 pa = 0; 428 pa = 0;
427 if (get_pteptr(mm, addr, &pte)) { 429 if (get_pteptr(mm, addr, &pte, NULL)) {
428 pa = (pte_val(*pte) & PAGE_MASK) | (addr & ~PAGE_MASK); 430 pa = (pte_val(*pte) & PAGE_MASK) | (addr & ~PAGE_MASK);
429 pte_unmap(pte); 431 pte_unmap(pte);
430 } 432 }
diff --git a/arch/powerpc/mm/stab.c b/arch/powerpc/mm/stab.c
index 91d25fb27f89..4a9291d9fef8 100644
--- a/arch/powerpc/mm/stab.c
+++ b/arch/powerpc/mm/stab.c
@@ -239,7 +239,7 @@ void stabs_alloc(void)
239 if (cpu_has_feature(CPU_FTR_SLB)) 239 if (cpu_has_feature(CPU_FTR_SLB))
240 return; 240 return;
241 241
242 for_each_cpu(cpu) { 242 for_each_possible_cpu(cpu) {
243 unsigned long newstab; 243 unsigned long newstab;
244 244
245 if (cpu == 0) 245 if (cpu == 0)
diff --git a/arch/powerpc/oprofile/Makefile b/arch/powerpc/oprofile/Makefile
index 554cd7c75321..f5f9859a8338 100644
--- a/arch/powerpc/oprofile/Makefile
+++ b/arch/powerpc/oprofile/Makefile
@@ -6,7 +6,7 @@ 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) common.o 9oprofile-y := $(DRIVER_OBJS) common.o backtrace.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 12oprofile-$(CONFIG_PPC32) += op_model_7450.o
diff --git a/arch/powerpc/oprofile/backtrace.c b/arch/powerpc/oprofile/backtrace.c
new file mode 100644
index 000000000000..75f57bc96b40
--- /dev/null
+++ b/arch/powerpc/oprofile/backtrace.c
@@ -0,0 +1,126 @@
1/**
2 * Copyright (C) 2005 Brian Rogan <bcr6@cornell.edu>, IBM
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
10#include <linux/oprofile.h>
11#include <linux/sched.h>
12#include <asm/processor.h>
13#include <asm/uaccess.h>
14
15#define STACK_SP(STACK) *(STACK)
16
17#define STACK_LR64(STACK) *((unsigned long *)(STACK) + 2)
18#define STACK_LR32(STACK) *((unsigned int *)(STACK) + 1)
19
20#ifdef CONFIG_PPC64
21#define STACK_LR(STACK) STACK_LR64(STACK)
22#else
23#define STACK_LR(STACK) STACK_LR32(STACK)
24#endif
25
26static unsigned int user_getsp32(unsigned int sp, int is_first)
27{
28 unsigned int stack_frame[2];
29
30 if (!access_ok(VERIFY_READ, sp, sizeof(stack_frame)))
31 return 0;
32
33 /*
34 * The most likely reason for this is that we returned -EFAULT,
35 * which means that we've done all that we can do from
36 * interrupt context.
37 */
38 if (__copy_from_user_inatomic(stack_frame, (void *)(long)sp,
39 sizeof(stack_frame)))
40 return 0;
41
42 if (!is_first)
43 oprofile_add_trace(STACK_LR32(stack_frame));
44
45 /*
46 * We do not enforce increasing stack addresses here because
47 * we may transition to a different stack, eg a signal handler.
48 */
49 return STACK_SP(stack_frame);
50}
51
52#ifdef CONFIG_PPC64
53static unsigned long user_getsp64(unsigned long sp, int is_first)
54{
55 unsigned long stack_frame[3];
56
57 if (!access_ok(VERIFY_READ, sp, sizeof(stack_frame)))
58 return 0;
59
60 if (__copy_from_user_inatomic(stack_frame, (void *)sp,
61 sizeof(stack_frame)))
62 return 0;
63
64 if (!is_first)
65 oprofile_add_trace(STACK_LR64(stack_frame));
66
67 return STACK_SP(stack_frame);
68}
69#endif
70
71static unsigned long kernel_getsp(unsigned long sp, int is_first)
72{
73 unsigned long *stack_frame = (unsigned long *)sp;
74
75 if (!validate_sp(sp, current, STACK_FRAME_OVERHEAD))
76 return 0;
77
78 if (!is_first)
79 oprofile_add_trace(STACK_LR(stack_frame));
80
81 /*
82 * We do not enforce increasing stack addresses here because
83 * we might be transitioning from an interrupt stack to a kernel
84 * stack. validate_sp() is designed to understand this, so just
85 * use it.
86 */
87 return STACK_SP(stack_frame);
88}
89
90void op_powerpc_backtrace(struct pt_regs * const regs, unsigned int depth)
91{
92 unsigned long sp = regs->gpr[1];
93 int first_frame = 1;
94
95 /* We ditch the top stackframe so need to loop through an extra time */
96 depth += 1;
97
98 if (!user_mode(regs)) {
99 while (depth--) {
100 sp = kernel_getsp(sp, first_frame);
101 if (!sp)
102 break;
103 first_frame = 0;
104 }
105 } else {
106#ifdef CONFIG_PPC64
107 if (!test_thread_flag(TIF_32BIT)) {
108 while (depth--) {
109 sp = user_getsp64(sp, first_frame);
110 if (!sp)
111 break;
112 first_frame = 0;
113 }
114
115 return;
116 }
117#endif
118
119 while (depth--) {
120 sp = user_getsp32(sp, first_frame);
121 if (!sp)
122 break;
123 first_frame = 0;
124 }
125 }
126}
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index cc2535be3a73..5b1de7e8041e 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -117,18 +117,10 @@ static int op_powerpc_create_files(struct super_block *sb, struct dentry *root)
117 117
118 oprofilefs_create_ulong(sb, root, "enable_kernel", &sys.enable_kernel); 118 oprofilefs_create_ulong(sb, root, "enable_kernel", &sys.enable_kernel);
119 oprofilefs_create_ulong(sb, root, "enable_user", &sys.enable_user); 119 oprofilefs_create_ulong(sb, root, "enable_user", &sys.enable_user);
120#ifdef CONFIG_PPC64
121 oprofilefs_create_ulong(sb, root, "backtrace_spinlocks",
122 &sys.backtrace_spinlocks);
123#endif
124 120
125 /* Default to tracing both kernel and user */ 121 /* Default to tracing both kernel and user */
126 sys.enable_kernel = 1; 122 sys.enable_kernel = 1;
127 sys.enable_user = 1; 123 sys.enable_user = 1;
128#ifdef CONFIG_PPC64
129 /* Turn on backtracing through spinlocks by default */
130 sys.backtrace_spinlocks = 1;
131#endif
132 124
133 return 0; 125 return 0;
134} 126}
@@ -168,6 +160,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
168 ops->shutdown = op_powerpc_shutdown; 160 ops->shutdown = op_powerpc_shutdown;
169 ops->start = op_powerpc_start; 161 ops->start = op_powerpc_start;
170 ops->stop = op_powerpc_stop; 162 ops->stop = op_powerpc_stop;
163 ops->backtrace = op_powerpc_backtrace;
171 164
172 printk(KERN_INFO "oprofile: using %s performance monitoring.\n", 165 printk(KERN_INFO "oprofile: using %s performance monitoring.\n",
173 ops->cpu_type); 166 ops->cpu_type);
diff --git a/arch/powerpc/oprofile/op_model_7450.c b/arch/powerpc/oprofile/op_model_7450.c
index 32abfdbb0eb1..e0491c3c71f1 100644
--- a/arch/powerpc/oprofile/op_model_7450.c
+++ b/arch/powerpc/oprofile/op_model_7450.c
@@ -176,13 +176,13 @@ static void fsl7450_handle_interrupt(struct pt_regs *regs,
176 mtmsr(mfmsr() | MSR_PMM); 176 mtmsr(mfmsr() | MSR_PMM);
177 177
178 pc = mfspr(SPRN_SIAR); 178 pc = mfspr(SPRN_SIAR);
179 is_kernel = (pc >= KERNELBASE); 179 is_kernel = is_kernel_addr(pc);
180 180
181 for (i = 0; i < NUM_CTRS; ++i) { 181 for (i = 0; i < NUM_CTRS; ++i) {
182 val = ctr_read(i); 182 val = ctr_read(i);
183 if (val < 0) { 183 if (val < 0) {
184 if (oprofile_running && ctr[i].enabled) { 184 if (oprofile_running && ctr[i].enabled) {
185 oprofile_add_pc(pc, is_kernel, i); 185 oprofile_add_ext_sample(pc, regs, i, is_kernel);
186 ctr_write(i, reset_value[i]); 186 ctr_write(i, reset_value[i]);
187 } else { 187 } else {
188 ctr_write(i, 0); 188 ctr_write(i, 0);
diff --git a/arch/powerpc/oprofile/op_model_fsl_booke.c b/arch/powerpc/oprofile/op_model_fsl_booke.c
index 26539cda6023..93d63e62662f 100644
--- a/arch/powerpc/oprofile/op_model_fsl_booke.c
+++ b/arch/powerpc/oprofile/op_model_fsl_booke.c
@@ -154,13 +154,13 @@ static void fsl_booke_handle_interrupt(struct pt_regs *regs,
154 mtmsr(mfmsr() | MSR_PMM); 154 mtmsr(mfmsr() | MSR_PMM);
155 155
156 pc = regs->nip; 156 pc = regs->nip;
157 is_kernel = (pc >= KERNELBASE); 157 is_kernel = is_kernel_addr(pc);
158 158
159 for (i = 0; i < num_counters; ++i) { 159 for (i = 0; i < num_counters; ++i) {
160 val = ctr_read(i); 160 val = ctr_read(i);
161 if (val < 0) { 161 if (val < 0) {
162 if (oprofile_running && ctr[i].enabled) { 162 if (oprofile_running && ctr[i].enabled) {
163 oprofile_add_pc(pc, is_kernel, i); 163 oprofile_add_ext_sample(pc, regs, i, is_kernel);
164 ctr_write(i, reset_value[i]); 164 ctr_write(i, reset_value[i]);
165 } else { 165 } else {
166 ctr_write(i, 0); 166 ctr_write(i, 0);
diff --git a/arch/powerpc/oprofile/op_model_power4.c b/arch/powerpc/oprofile/op_model_power4.c
index 4b06e53eb9b4..4c2beab1fdc1 100644
--- a/arch/powerpc/oprofile/op_model_power4.c
+++ b/arch/powerpc/oprofile/op_model_power4.c
@@ -25,18 +25,14 @@ static unsigned long reset_value[OP_MAX_COUNTER];
25 25
26static int oprofile_running; 26static int oprofile_running;
27static int mmcra_has_sihv; 27static int mmcra_has_sihv;
28/* Unfortunately these bits vary between CPUs */
29static unsigned long mmcra_sihv = MMCRA_SIHV;
30static unsigned long mmcra_sipr = MMCRA_SIPR;
28 31
29/* mmcr values are set in power4_reg_setup, used in power4_cpu_setup */ 32/* mmcr values are set in power4_reg_setup, used in power4_cpu_setup */
30static u32 mmcr0_val; 33static u32 mmcr0_val;
31static u64 mmcr1_val; 34static u64 mmcr1_val;
32static u32 mmcra_val; 35static u64 mmcra_val;
33
34/*
35 * Since we do not have an NMI, backtracing through spinlocks is
36 * only a best guess. In light of this, allow it to be disabled at
37 * runtime.
38 */
39static int backtrace_spinlocks;
40 36
41static void power4_reg_setup(struct op_counter_config *ctr, 37static void power4_reg_setup(struct op_counter_config *ctr,
42 struct op_system_config *sys, 38 struct op_system_config *sys,
@@ -63,8 +59,6 @@ static void power4_reg_setup(struct op_counter_config *ctr,
63 mmcr1_val = sys->mmcr1; 59 mmcr1_val = sys->mmcr1;
64 mmcra_val = sys->mmcra; 60 mmcra_val = sys->mmcra;
65 61
66 backtrace_spinlocks = sys->backtrace_spinlocks;
67
68 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i) 62 for (i = 0; i < cur_cpu_spec->num_pmcs; ++i)
69 reset_value[i] = 0x80000000UL - ctr[i].count; 63 reset_value[i] = 0x80000000UL - ctr[i].count;
70 64
@@ -197,25 +191,6 @@ static void __attribute_used__ kernel_unknown_bucket(void)
197{ 191{
198} 192}
199 193
200static unsigned long check_spinlock_pc(struct pt_regs *regs,
201 unsigned long profile_pc)
202{
203 unsigned long pc = instruction_pointer(regs);
204
205 /*
206 * If both the SIAR (sampled instruction) and the perfmon exception
207 * occurred in a spinlock region then we account the sample to the
208 * calling function. This isnt 100% correct, we really need soft
209 * IRQ disable so we always get the perfmon exception at the
210 * point at which the SIAR is set.
211 */
212 if (backtrace_spinlocks && in_lock_functions(pc) &&
213 in_lock_functions(profile_pc))
214 return regs->link;
215 else
216 return profile_pc;
217}
218
219/* 194/*
220 * On GQ and newer the MMCRA stores the HV and PR bits at the time 195 * On GQ and newer the MMCRA stores the HV and PR bits at the time
221 * the SIAR was sampled. We use that to work out if the SIAR was sampled in 196 * the SIAR was sampled. We use that to work out if the SIAR was sampled in
@@ -228,17 +203,17 @@ static unsigned long get_pc(struct pt_regs *regs)
228 203
229 /* Cant do much about it */ 204 /* Cant do much about it */
230 if (!mmcra_has_sihv) 205 if (!mmcra_has_sihv)
231 return check_spinlock_pc(regs, pc); 206 return pc;
232 207
233 mmcra = mfspr(SPRN_MMCRA); 208 mmcra = mfspr(SPRN_MMCRA);
234 209
235 /* Were we in the hypervisor? */ 210 /* Were we in the hypervisor? */
236 if (firmware_has_feature(FW_FEATURE_LPAR) && (mmcra & MMCRA_SIHV)) 211 if (firmware_has_feature(FW_FEATURE_LPAR) && (mmcra & mmcra_sihv))
237 /* function descriptor madness */ 212 /* function descriptor madness */
238 return *((unsigned long *)hypervisor_bucket); 213 return *((unsigned long *)hypervisor_bucket);
239 214
240 /* We were in userspace, nothing to do */ 215 /* We were in userspace, nothing to do */
241 if (mmcra & MMCRA_SIPR) 216 if (mmcra & mmcra_sipr)
242 return pc; 217 return pc;
243 218
244#ifdef CONFIG_PPC_RTAS 219#ifdef CONFIG_PPC_RTAS
@@ -257,7 +232,7 @@ static unsigned long get_pc(struct pt_regs *regs)
257 /* function descriptor madness */ 232 /* function descriptor madness */
258 return *((unsigned long *)kernel_unknown_bucket); 233 return *((unsigned long *)kernel_unknown_bucket);
259 234
260 return check_spinlock_pc(regs, pc); 235 return pc;
261} 236}
262 237
263static int get_kernel(unsigned long pc) 238static int get_kernel(unsigned long pc)
@@ -268,7 +243,7 @@ static int get_kernel(unsigned long pc)
268 is_kernel = is_kernel_addr(pc); 243 is_kernel = is_kernel_addr(pc);
269 } else { 244 } else {
270 unsigned long mmcra = mfspr(SPRN_MMCRA); 245 unsigned long mmcra = mfspr(SPRN_MMCRA);
271 is_kernel = ((mmcra & MMCRA_SIPR) == 0); 246 is_kernel = ((mmcra & mmcra_sipr) == 0);
272 } 247 }
273 248
274 return is_kernel; 249 return is_kernel;
@@ -293,7 +268,7 @@ static void power4_handle_interrupt(struct pt_regs *regs,
293 val = ctr_read(i); 268 val = ctr_read(i);
294 if (val < 0) { 269 if (val < 0) {
295 if (oprofile_running && ctr[i].enabled) { 270 if (oprofile_running && ctr[i].enabled) {
296 oprofile_add_pc(pc, is_kernel, i); 271 oprofile_add_ext_sample(pc, regs, i, is_kernel);
297 ctr_write(i, reset_value[i]); 272 ctr_write(i, reset_value[i]);
298 } else { 273 } else {
299 ctr_write(i, 0); 274 ctr_write(i, 0);
diff --git a/arch/powerpc/oprofile/op_model_rs64.c b/arch/powerpc/oprofile/op_model_rs64.c
index 5c909ee609fe..042f8f4867ad 100644
--- a/arch/powerpc/oprofile/op_model_rs64.c
+++ b/arch/powerpc/oprofile/op_model_rs64.c
@@ -175,10 +175,13 @@ static void rs64_handle_interrupt(struct pt_regs *regs,
175 struct op_counter_config *ctr) 175 struct op_counter_config *ctr)
176{ 176{
177 unsigned int mmcr0; 177 unsigned int mmcr0;
178 int is_kernel;
178 int val; 179 int val;
179 int i; 180 int i;
180 unsigned long pc = mfspr(SPRN_SIAR); 181 unsigned long pc = mfspr(SPRN_SIAR);
181 182
183 is_kernel = is_kernel_addr(pc);
184
182 /* set the PMM bit (see comment below) */ 185 /* set the PMM bit (see comment below) */
183 mtmsrd(mfmsr() | MSR_PMM); 186 mtmsrd(mfmsr() | MSR_PMM);
184 187
@@ -186,7 +189,7 @@ static void rs64_handle_interrupt(struct pt_regs *regs,
186 val = ctr_read(i); 189 val = ctr_read(i);
187 if (val < 0) { 190 if (val < 0) {
188 if (ctr[i].enabled) { 191 if (ctr[i].enabled) {
189 oprofile_add_pc(pc, is_kernel_addr(pc), i); 192 oprofile_add_ext_sample(pc, regs, i, is_kernel);
190 ctr_write(i, reset_value[i]); 193 ctr_write(i, reset_value[i]);
191 } else { 194 } else {
192 ctr_write(i, 0); 195 ctr_write(i, 0);
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index d3d0ff745e84..06e371282f57 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -7,6 +7,7 @@ choice
7 7
8config MPC8540_ADS 8config MPC8540_ADS
9 bool "Freescale MPC8540 ADS" 9 bool "Freescale MPC8540 ADS"
10 select DEFAULT_UIMAGE
10 help 11 help
11 This option enables support for the MPC 8540 ADS board 12 This option enables support for the MPC 8540 ADS board
12 13
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index 3157071e241c..c2a3db8edb0c 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -10,4 +10,9 @@ config SPU_FS
10 Units on machines implementing the Broadband Processor 10 Units on machines implementing the Broadband Processor
11 Architecture. 11 Architecture.
12 12
13config SPUFS_MMAP
14 bool
15 depends on SPU_FS && SPARSEMEM && !PPC_64K_PAGES
16 default y
17
13endmenu 18endmenu
diff --git a/arch/powerpc/platforms/cell/Makefile b/arch/powerpc/platforms/cell/Makefile
index 3b998a393e3f..e570bad06394 100644
--- a/arch/powerpc/platforms/cell/Makefile
+++ b/arch/powerpc/platforms/cell/Makefile
@@ -6,5 +6,11 @@ obj-$(CONFIG_SPU_FS) += spu-base.o spufs/
6 6
7spu-base-y += spu_base.o spu_priv1.o 7spu-base-y += spu_base.o spu_priv1.o
8 8
9builtin-spufs-$(CONFIG_SPU_FS) += spu_syscalls.o 9# needed only when building loadable spufs.ko
10obj-y += $(builtin-spufs-m) 10spufs-modular-$(CONFIG_SPU_FS) += spu_syscalls.o
11obj-y += $(spufs-modular-m)
12
13# always needed in kernel
14spufs-builtin-$(CONFIG_SPU_FS) += spu_callbacks.o
15obj-y += $(spufs-builtin-y) $(spufs-builtin-m)
16
diff --git a/arch/powerpc/platforms/cell/interrupt.c b/arch/powerpc/platforms/cell/interrupt.c
index 63aa52acf441..978be1c30c1b 100644
--- a/arch/powerpc/platforms/cell/interrupt.c
+++ b/arch/powerpc/platforms/cell/interrupt.c
@@ -63,7 +63,24 @@ static DEFINE_PER_CPU(struct iic, iic);
63 63
64void iic_local_enable(void) 64void iic_local_enable(void)
65{ 65{
66 out_be64(&__get_cpu_var(iic).regs->prio, 0xff); 66 struct iic *iic = &__get_cpu_var(iic);
67 u64 tmp;
68
69 /*
70 * There seems to be a bug that is present in DD2.x CPUs
71 * and still only partially fixed in DD3.1.
72 * This bug causes a value written to the priority register
73 * not to make it there, resulting in a system hang unless we
74 * write it again.
75 * Masking with 0xf0 is done because the Cell BE does not
76 * implement the lower four bits of the interrupt priority,
77 * they always read back as zeroes, although future CPUs
78 * might implement different bits.
79 */
80 do {
81 out_be64(&iic->regs->prio, 0xff);
82 tmp = in_be64(&iic->regs->prio);
83 } while ((tmp & 0xf0) != 0xf0);
67} 84}
68 85
69void iic_local_disable(void) 86void iic_local_disable(void)
@@ -123,7 +140,7 @@ static int iic_external_get_irq(struct iic_pending_bits pending)
123 pending.class != 2) 140 pending.class != 2)
124 break; 141 break;
125 irq = IIC_EXT_OFFSET 142 irq = IIC_EXT_OFFSET
126 + spider_get_irq(pending.prio + node * IIC_NODE_STRIDE) 143 + spider_get_irq(node)
127 + node * IIC_NODE_STRIDE; 144 + node * IIC_NODE_STRIDE;
128 break; 145 break;
129 case 0x01 ... 0x04: 146 case 0x01 ... 0x04:
@@ -174,38 +191,98 @@ int iic_get_irq(struct pt_regs *regs)
174 return irq; 191 return irq;
175} 192}
176 193
177static int setup_iic(int cpu, struct iic *iic) 194/* hardcoded part to be compatible with older firmware */
195
196static int setup_iic_hardcoded(void)
178{ 197{
179 struct device_node *np; 198 struct device_node *np;
180 int nodeid = cpu / 2; 199 int nodeid, cpu;
181 unsigned long regs; 200 unsigned long regs;
201 struct iic *iic;
182 202
183 for (np = of_find_node_by_type(NULL, "cpu"); 203 for_each_cpu(cpu) {
184 np; 204 iic = &per_cpu(iic, cpu);
185 np = of_find_node_by_type(np, "cpu")) { 205 nodeid = cpu/2;
186 if (nodeid == *(int *)get_property(np, "node-id", NULL)) 206
187 break; 207 for (np = of_find_node_by_type(NULL, "cpu");
208 np;
209 np = of_find_node_by_type(np, "cpu")) {
210 if (nodeid == *(int *)get_property(np, "node-id", NULL))
211 break;
212 }
213
214 if (!np) {
215 printk(KERN_WARNING "IIC: CPU %d not found\n", cpu);
216 iic->regs = NULL;
217 iic->target_id = 0xff;
218 return -ENODEV;
219 }
220
221 regs = *(long *)get_property(np, "iic", NULL);
222
223 /* hack until we have decided on the devtree info */
224 regs += 0x400;
225 if (cpu & 1)
226 regs += 0x20;
227
228 printk(KERN_INFO "IIC for CPU %d at %lx\n", cpu, regs);
229 iic->regs = ioremap(regs, sizeof(struct iic_regs));
230 iic->target_id = (nodeid << 4) + ((cpu & 1) ? 0xf : 0xe);
188 } 231 }
189 232
190 if (!np) { 233 return 0;
191 printk(KERN_WARNING "IIC: CPU %d not found\n", cpu); 234}
192 iic->regs = NULL;
193 iic->target_id = 0xff;
194 return -ENODEV;
195 }
196 235
197 regs = *(long *)get_property(np, "iic", NULL); 236static int setup_iic(void)
237{
238 struct device_node *dn;
239 unsigned long *regs;
240 char *compatible;
241 unsigned *np, found = 0;
242 struct iic *iic = NULL;
243
244 for (dn = NULL; (dn = of_find_node_by_name(dn, "interrupt-controller"));) {
245 compatible = (char *)get_property(dn, "compatible", NULL);
246
247 if (!compatible) {
248 printk(KERN_WARNING "no compatible property found !\n");
249 continue;
250 }
198 251
199 /* hack until we have decided on the devtree info */ 252 if (strstr(compatible, "IBM,CBEA-Internal-Interrupt-Controller"))
200 regs += 0x400; 253 regs = (unsigned long *)get_property(dn,"reg", NULL);
201 if (cpu & 1) 254 else
202 regs += 0x20; 255 continue;
203 256
204 printk(KERN_DEBUG "IIC for CPU %d at %lx\n", cpu, regs); 257 if (!regs)
205 iic->regs = __ioremap(regs, sizeof(struct iic_regs), 258 printk(KERN_WARNING "IIC: no reg property\n");
206 _PAGE_NO_CACHE); 259
207 iic->target_id = (nodeid << 4) + ((cpu & 1) ? 0xf : 0xe); 260 np = (unsigned int *)get_property(dn, "ibm,interrupt-server-ranges", NULL);
208 return 0; 261
262 if (!np) {
263 printk(KERN_WARNING "IIC: CPU association not found\n");
264 iic->regs = NULL;
265 iic->target_id = 0xff;
266 return -ENODEV;
267 }
268
269 iic = &per_cpu(iic, np[0]);
270 iic->regs = ioremap(regs[0], sizeof(struct iic_regs));
271 iic->target_id = ((np[0] & 2) << 3) + ((np[0] & 1) ? 0xf : 0xe);
272 printk("IIC for CPU %d at %lx mapped to %p\n", np[0], regs[0], iic->regs);
273
274 iic = &per_cpu(iic, np[1]);
275 iic->regs = ioremap(regs[2], sizeof(struct iic_regs));
276 iic->target_id = ((np[1] & 2) << 3) + ((np[1] & 1) ? 0xf : 0xe);
277 printk("IIC for CPU %d at %lx mapped to %p\n", np[1], regs[2], iic->regs);
278
279 found++;
280 }
281
282 if (found)
283 return 0;
284 else
285 return -ENODEV;
209} 286}
210 287
211#ifdef CONFIG_SMP 288#ifdef CONFIG_SMP
@@ -283,10 +360,12 @@ void iic_init_IRQ(void)
283 int cpu, irq_offset; 360 int cpu, irq_offset;
284 struct iic *iic; 361 struct iic *iic;
285 362
363 if (setup_iic() < 0)
364 setup_iic_hardcoded();
365
286 irq_offset = 0; 366 irq_offset = 0;
287 for_each_cpu(cpu) { 367 for_each_possible_cpu(cpu) {
288 iic = &per_cpu(iic, cpu); 368 iic = &per_cpu(iic, cpu);
289 setup_iic(cpu, iic);
290 if (iic->regs) 369 if (iic->regs)
291 out_be64(&iic->regs->prio, 0xff); 370 out_be64(&iic->regs->prio, 0xff);
292 } 371 }
diff --git a/arch/powerpc/platforms/cell/interrupt.h b/arch/powerpc/platforms/cell/interrupt.h
index a14bd38791c0..799f77d98f96 100644
--- a/arch/powerpc/platforms/cell/interrupt.h
+++ b/arch/powerpc/platforms/cell/interrupt.h
@@ -57,7 +57,7 @@ extern void iic_local_disable(void);
57extern u8 iic_get_target_id(int cpu); 57extern u8 iic_get_target_id(int cpu);
58 58
59extern void spider_init_IRQ(void); 59extern void spider_init_IRQ(void);
60extern int spider_get_irq(unsigned long int_pending); 60extern int spider_get_irq(int node);
61 61
62#endif 62#endif
63#endif /* ASM_CELL_PIC_H */ 63#endif /* ASM_CELL_PIC_H */
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 46e7cb9c3e64..a49ceb799a8e 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -289,7 +289,7 @@ static void cell_do_map_iommu(struct cell_iommu *iommu,
289 ioc_base = iommu->mapped_base; 289 ioc_base = iommu->mapped_base;
290 ioc_mmio_base = iommu->mapped_mmio_base; 290 ioc_mmio_base = iommu->mapped_mmio_base;
291 291
292 for (real_address = 0, io_address = 0; 292 for (real_address = 0, io_address = map_start;
293 io_address <= map_start + map_size; 293 io_address <= map_start + map_size;
294 real_address += io_page_size, io_address += io_page_size) { 294 real_address += io_page_size, io_address += io_page_size) {
295 ioste = get_iost_entry(fake_iopt, io_address, io_page_size); 295 ioste = get_iost_entry(fake_iopt, io_address, io_page_size);
@@ -302,7 +302,7 @@ static void cell_do_map_iommu(struct cell_iommu *iommu,
302 set_iopt_cache(ioc_mmio_base, 302 set_iopt_cache(ioc_mmio_base,
303 get_ioc_hash_1way(ioste, io_address), 303 get_ioc_hash_1way(ioste, io_address),
304 get_ioc_tag(ioste, io_address), 304 get_ioc_tag(ioste, io_address),
305 get_iopt_entry(real_address-map_start, ioid, IOPT_PROT_RW)); 305 get_iopt_entry(real_address, ioid, IOPT_PROT_RW));
306 } 306 }
307} 307}
308 308
@@ -344,8 +344,8 @@ static int cell_map_iommu_hardcoded(int num_nodes)
344 344
345 /* node 0 */ 345 /* node 0 */
346 iommu = &cell_iommus[0]; 346 iommu = &cell_iommus[0];
347 iommu->mapped_base = __ioremap(0x20000511000, 0x1000, _PAGE_NO_CACHE); 347 iommu->mapped_base = ioremap(0x20000511000, 0x1000);
348 iommu->mapped_mmio_base = __ioremap(0x20000510000, 0x1000, _PAGE_NO_CACHE); 348 iommu->mapped_mmio_base = ioremap(0x20000510000, 0x1000);
349 349
350 enable_mapping(iommu->mapped_base, iommu->mapped_mmio_base); 350 enable_mapping(iommu->mapped_base, iommu->mapped_mmio_base);
351 351
@@ -357,8 +357,8 @@ static int cell_map_iommu_hardcoded(int num_nodes)
357 357
358 /* node 1 */ 358 /* node 1 */
359 iommu = &cell_iommus[1]; 359 iommu = &cell_iommus[1];
360 iommu->mapped_base = __ioremap(0x30000511000, 0x1000, _PAGE_NO_CACHE); 360 iommu->mapped_base = ioremap(0x30000511000, 0x1000);
361 iommu->mapped_mmio_base = __ioremap(0x30000510000, 0x1000, _PAGE_NO_CACHE); 361 iommu->mapped_mmio_base = ioremap(0x30000510000, 0x1000);
362 362
363 enable_mapping(iommu->mapped_base, iommu->mapped_mmio_base); 363 enable_mapping(iommu->mapped_base, iommu->mapped_mmio_base);
364 364
@@ -407,8 +407,8 @@ static int cell_map_iommu(void)
407 iommu->base = *base; 407 iommu->base = *base;
408 iommu->mmio_base = *mmio_base; 408 iommu->mmio_base = *mmio_base;
409 409
410 iommu->mapped_base = __ioremap(*base, 0x1000, _PAGE_NO_CACHE); 410 iommu->mapped_base = ioremap(*base, 0x1000);
411 iommu->mapped_mmio_base = __ioremap(*mmio_base, 0x1000, _PAGE_NO_CACHE); 411 iommu->mapped_mmio_base = ioremap(*mmio_base, 0x1000);
412 412
413 enable_mapping(iommu->mapped_base, 413 enable_mapping(iommu->mapped_base,
414 iommu->mapped_mmio_base); 414 iommu->mapped_mmio_base);
diff --git a/arch/powerpc/platforms/cell/pervasive.c b/arch/powerpc/platforms/cell/pervasive.c
index e0e051c675dd..7eed8c624517 100644
--- a/arch/powerpc/platforms/cell/pervasive.c
+++ b/arch/powerpc/platforms/cell/pervasive.c
@@ -203,7 +203,7 @@ found:
203 203
204 pr_debug("pervasive area for CPU %d at %lx, size %x\n", 204 pr_debug("pervasive area for CPU %d at %lx, size %x\n",
205 cpu, real_address, size); 205 cpu, real_address, size);
206 p->regs = __ioremap(real_address, size, _PAGE_NO_CACHE); 206 p->regs = ioremap(real_address, size);
207 p->thread = thread; 207 p->thread = thread;
208 return 0; 208 return 0;
209} 209}
@@ -217,7 +217,7 @@ void __init cell_pervasive_init(void)
217 if (!cpu_has_feature(CPU_FTR_PAUSE_ZERO)) 217 if (!cpu_has_feature(CPU_FTR_PAUSE_ZERO))
218 return; 218 return;
219 219
220 for_each_cpu(cpu) { 220 for_each_possible_cpu(cpu) {
221 p = &cbe_pervasive[cpu]; 221 p = &cbe_pervasive[cpu];
222 ret = cbe_find_pmd_mmio(cpu, p); 222 ret = cbe_find_pmd_mmio(cpu, p);
223 if (ret) 223 if (ret)
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index fec8e65b36ea..dac5d0365fde 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -195,9 +195,13 @@ static void __init cell_init_early(void)
195} 195}
196 196
197 197
198static int __init cell_probe(int platform) 198static int __init cell_probe(void)
199{ 199{
200 if (platform != PLATFORM_CELL) 200 /* XXX This is temporary, the Cell maintainer will come up with
201 * more appropriate detection logic
202 */
203 unsigned long root = of_get_flat_dt_root();
204 if (!of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
201 return 0; 205 return 0;
202 206
203 return 1; 207 return 1;
@@ -212,7 +216,8 @@ static int cell_check_legacy_ioport(unsigned int baseport)
212 return -ENODEV; 216 return -ENODEV;
213} 217}
214 218
215struct machdep_calls __initdata cell_md = { 219define_machine(cell) {
220 .name = "Cell",
216 .probe = cell_probe, 221 .probe = cell_probe,
217 .setup_arch = cell_setup_arch, 222 .setup_arch = cell_setup_arch,
218 .init_early = cell_init_early, 223 .init_early = cell_init_early,
diff --git a/arch/powerpc/platforms/cell/spider-pic.c b/arch/powerpc/platforms/cell/spider-pic.c
index e74132188bdf..55cbdd77a62d 100644
--- a/arch/powerpc/platforms/cell/spider-pic.c
+++ b/arch/powerpc/platforms/cell/spider-pic.c
@@ -84,10 +84,11 @@ static void __iomem *spider_get_irq_config(int irq)
84 84
85static void spider_enable_irq(unsigned int irq) 85static void spider_enable_irq(unsigned int irq)
86{ 86{
87 int nodeid = (irq / IIC_NODE_STRIDE) * 0x10;
87 void __iomem *cfg = spider_get_irq_config(irq); 88 void __iomem *cfg = spider_get_irq_config(irq);
88 irq = spider_get_nr(irq); 89 irq = spider_get_nr(irq);
89 90
90 out_be32(cfg, in_be32(cfg) | 0x3107000eu); 91 out_be32(cfg, (in_be32(cfg) & ~0xf0)| 0x3107000eu | nodeid);
91 out_be32(cfg + 4, in_be32(cfg + 4) | 0x00020000u | irq); 92 out_be32(cfg + 4, in_be32(cfg + 4) | 0x00020000u | irq);
92} 93}
93 94
@@ -131,61 +132,108 @@ static struct hw_interrupt_type spider_pic = {
131 .end = spider_end_irq, 132 .end = spider_end_irq,
132}; 133};
133 134
134 135int spider_get_irq(int node)
135int spider_get_irq(unsigned long int_pending)
136{ 136{
137 void __iomem *regs = spider_get_pic(int_pending);
138 unsigned long cs; 137 unsigned long cs;
139 int irq; 138 void __iomem *regs = spider_pics[node];
140
141 cs = in_be32(regs + TIR_CS);
142 139
143 irq = cs >> 24; 140 cs = in_be32(regs + TIR_CS) >> 24;
144 if (irq != 63)
145 return irq;
146 141
147 return -1; 142 if (cs == 63)
143 return -1;
144 else
145 return cs;
148} 146}
149 147
150void spider_init_IRQ(void) 148/* hardcoded part to be compatible with older firmware */
149
150void spider_init_IRQ_hardcoded(void)
151{ 151{
152 int node; 152 int node;
153 struct device_node *dn;
154 unsigned int *property;
155 long spiderpic; 153 long spiderpic;
154 long pics[] = { 0x24000008000, 0x34000008000 };
156 int n; 155 int n;
157 156
158/* FIXME: detect multiple PICs as soon as the device tree has them */ 157 pr_debug("%s(%d): Using hardcoded defaults\n", __FUNCTION__, __LINE__);
159 for (node = 0; node < 1; node++) {
160 dn = of_find_node_by_path("/");
161 n = prom_n_addr_cells(dn);
162 property = (unsigned int *) get_property(dn,
163 "platform-spider-pic", NULL);
164 158
165 if (!property) 159 for (node = 0; node < num_present_cpus()/2; node++) {
166 continue; 160 spiderpic = pics[node];
167 for (spiderpic = 0; n > 0; --n)
168 spiderpic = (spiderpic << 32) + *property++;
169 printk(KERN_DEBUG "SPIDER addr: %lx\n", spiderpic); 161 printk(KERN_DEBUG "SPIDER addr: %lx\n", spiderpic);
170 spider_pics[node] = __ioremap(spiderpic, 0x800, _PAGE_NO_CACHE); 162 spider_pics[node] = ioremap(spiderpic, 0x800);
171 for (n = 0; n < IIC_NUM_EXT; n++) { 163 for (n = 0; n < IIC_NUM_EXT; n++) {
172 int irq = n + IIC_EXT_OFFSET + node * IIC_NODE_STRIDE; 164 int irq = n + IIC_EXT_OFFSET + node * IIC_NODE_STRIDE;
173 get_irq_desc(irq)->handler = &spider_pic; 165 get_irq_desc(irq)->handler = &spider_pic;
166 }
174 167
175 /* do not mask any interrupts because of level */ 168 /* do not mask any interrupts because of level */
176 out_be32(spider_pics[node] + TIR_MSK, 0x0); 169 out_be32(spider_pics[node] + TIR_MSK, 0x0);
177 170
178 /* disable edge detection clear */ 171 /* disable edge detection clear */
179 /* out_be32(spider_pics[node] + TIR_EDC, 0x0); */ 172 /* out_be32(spider_pics[node] + TIR_EDC, 0x0); */
180 173
181 /* enable interrupt packets to be output */ 174 /* enable interrupt packets to be output */
182 out_be32(spider_pics[node] + TIR_PIEN, 175 out_be32(spider_pics[node] + TIR_PIEN,
183 in_be32(spider_pics[node] + TIR_PIEN) | 0x1); 176 in_be32(spider_pics[node] + TIR_PIEN) | 0x1);
184 177
185 /* Enable the interrupt detection enable bit. Do this last! */ 178 /* Enable the interrupt detection enable bit. Do this last! */
186 out_be32(spider_pics[node] + TIR_DEN, 179 out_be32(spider_pics[node] + TIR_DEN,
187 in_be32(spider_pics[node] +TIR_DEN) | 0x1); 180 in_be32(spider_pics[node] + TIR_DEN) | 0x1);
181 }
182}
183
184void spider_init_IRQ(void)
185{
186 long spider_reg;
187 struct device_node *dn;
188 char *compatible;
189 int n, node = 0;
190
191 for (dn = NULL; (dn = of_find_node_by_name(dn, "interrupt-controller"));) {
192 compatible = (char *)get_property(dn, "compatible", NULL);
188 193
194 if (!compatible)
195 continue;
196
197 if (strstr(compatible, "CBEA,platform-spider-pic"))
198 spider_reg = *(long *)get_property(dn,"reg", NULL);
199 else if (strstr(compatible, "sti,platform-spider-pic")) {
200 spider_init_IRQ_hardcoded();
201 return;
202 } else
203 continue;
204
205 if (!spider_reg)
206 printk("interrupt controller does not have reg property !\n");
207
208 n = prom_n_addr_cells(dn);
209
210 if ( n != 2)
211 printk("reg property with invalid number of elements \n");
212
213 spider_pics[node] = ioremap(spider_reg, 0x800);
214
215 printk("SPIDER addr: %lx with %i addr_cells mapped to %p\n",
216 spider_reg, n, spider_pics[node]);
217
218 for (n = 0; n < IIC_NUM_EXT; n++) {
219 int irq = n + IIC_EXT_OFFSET + node * IIC_NODE_STRIDE;
220 get_irq_desc(irq)->handler = &spider_pic;
189 } 221 }
222
223 /* do not mask any interrupts because of level */
224 out_be32(spider_pics[node] + TIR_MSK, 0x0);
225
226 /* disable edge detection clear */
227 /* out_be32(spider_pics[node] + TIR_EDC, 0x0); */
228
229 /* enable interrupt packets to be output */
230 out_be32(spider_pics[node] + TIR_PIEN,
231 in_be32(spider_pics[node] + TIR_PIEN) | 0x1);
232
233 /* Enable the interrupt detection enable bit. Do this last! */
234 out_be32(spider_pics[node] + TIR_DEN,
235 in_be32(spider_pics[node] + TIR_DEN) | 0x1);
236
237 node++;
190 } 238 }
191} 239}
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index a8fa1eeeb174..269dda4fd0b4 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -111,7 +111,7 @@ static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
111extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap); //XXX 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) 112static int __spu_trap_data_map(struct spu *spu, unsigned long ea, u64 dsisr)
113{ 113{
114 pr_debug("%s\n", __FUNCTION__); 114 pr_debug("%s, %lx, %lx\n", __FUNCTION__, dsisr, ea);
115 115
116 /* Handle kernel space hash faults immediately. 116 /* Handle kernel space hash faults immediately.
117 User hash faults need to be deferred to process context. */ 117 User hash faults need to be deferred to process context. */
@@ -168,7 +168,7 @@ static int __spu_trap_halt(struct spu *spu)
168static int __spu_trap_tag_group(struct spu *spu) 168static int __spu_trap_tag_group(struct spu *spu)
169{ 169{
170 pr_debug("%s\n", __FUNCTION__); 170 pr_debug("%s\n", __FUNCTION__);
171 /* wake_up(&spu->dma_wq); */ 171 spu->mfc_callback(spu);
172 return 0; 172 return 0;
173} 173}
174 174
@@ -242,6 +242,8 @@ spu_irq_class_1(int irq, void *data, struct pt_regs *regs)
242 spu_mfc_dsisr_set(spu, 0ul); 242 spu_mfc_dsisr_set(spu, 0ul);
243 spu_int_stat_clear(spu, 1, stat); 243 spu_int_stat_clear(spu, 1, stat);
244 spin_unlock(&spu->register_lock); 244 spin_unlock(&spu->register_lock);
245 pr_debug("%s: %lx %lx %lx %lx\n", __FUNCTION__, mask, stat,
246 dar, dsisr);
245 247
246 if (stat & 1) /* segment fault */ 248 if (stat & 1) /* segment fault */
247 __spu_trap_data_seg(spu, dar); 249 __spu_trap_data_seg(spu, dar);
@@ -484,14 +486,13 @@ int spu_irq_class_1_bottom(struct spu *spu)
484 486
485 ea = spu->dar; 487 ea = spu->dar;
486 dsisr = spu->dsisr; 488 dsisr = spu->dsisr;
487 if (dsisr & MFC_DSISR_PTE_NOT_FOUND) { 489 if (dsisr & (MFC_DSISR_PTE_NOT_FOUND | MFC_DSISR_ACCESS_DENIED)) {
488 access = (_PAGE_PRESENT | _PAGE_USER); 490 access = (_PAGE_PRESENT | _PAGE_USER);
489 access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL; 491 access |= (dsisr & MFC_DSISR_ACCESS_PUT) ? _PAGE_RW : 0UL;
490 if (hash_page(ea, access, 0x300) != 0) 492 if (hash_page(ea, access, 0x300) != 0)
491 error |= CLASS1_ENABLE_STORAGE_FAULT_INTR; 493 error |= CLASS1_ENABLE_STORAGE_FAULT_INTR;
492 } 494 }
493 if ((error & CLASS1_ENABLE_STORAGE_FAULT_INTR) || 495 if (error & CLASS1_ENABLE_STORAGE_FAULT_INTR) {
494 (dsisr & MFC_DSISR_ACCESS_DENIED)) {
495 if ((ret = spu_handle_mm_fault(spu)) != 0) 496 if ((ret = spu_handle_mm_fault(spu)) != 0)
496 error |= CLASS1_ENABLE_STORAGE_FAULT_INTR; 497 error |= CLASS1_ENABLE_STORAGE_FAULT_INTR;
497 else 498 else
@@ -568,6 +569,11 @@ static int __init spu_map_device(struct spu *spu, struct device_node *spe)
568 if (!spu->local_store) 569 if (!spu->local_store)
569 goto out; 570 goto out;
570 571
572 prop = get_property(spe, "problem", NULL);
573 if (!prop)
574 goto out_unmap;
575 spu->problem_phys = *(unsigned long *)prop;
576
571 spu->problem= map_spe_prop(spe, "problem"); 577 spu->problem= map_spe_prop(spe, "problem");
572 if (!spu->problem) 578 if (!spu->problem)
573 goto out_unmap; 579 goto out_unmap;
@@ -632,6 +638,7 @@ static int __init create_spu(struct device_node *spe)
632 spu->ibox_callback = NULL; 638 spu->ibox_callback = NULL;
633 spu->wbox_callback = NULL; 639 spu->wbox_callback = NULL;
634 spu->stop_callback = NULL; 640 spu->stop_callback = NULL;
641 spu->mfc_callback = NULL;
635 642
636 mutex_lock(&spu_mutex); 643 mutex_lock(&spu_mutex);
637 spu->number = number++; 644 spu->number = number++;
diff --git a/arch/powerpc/platforms/cell/spu_callbacks.c b/arch/powerpc/platforms/cell/spu_callbacks.c
new file mode 100644
index 000000000000..3a4245c926ad
--- /dev/null
+++ b/arch/powerpc/platforms/cell/spu_callbacks.c
@@ -0,0 +1,345 @@
1/*
2 * System call callback functions for SPUs
3 */
4
5#define DEBUG
6
7#include <linux/kallsyms.h>
8#include <linux/module.h>
9#include <linux/syscalls.h>
10
11#include <asm/spu.h>
12#include <asm/syscalls.h>
13#include <asm/unistd.h>
14
15/*
16 * This table defines the system calls that an SPU can call.
17 * It is currently a subset of the 64 bit powerpc system calls,
18 * with the exact semantics.
19 *
20 * The reasons for disabling some of the system calls are:
21 * 1. They interact with the way SPU syscalls are handled
22 * and we can't let them execute ever:
23 * restart_syscall, exit, for, execve, ptrace, ...
24 * 2. They are deprecated and replaced by other means:
25 * uselib, pciconfig_*, sysfs, ...
26 * 3. They are somewhat interacting with the system in a way
27 * we don't want an SPU to:
28 * reboot, init_module, mount, kexec_load
29 * 4. They are optional and we can't rely on them being
30 * linked into the kernel. Unfortunately, the cond_syscall
31 * helper does not work here as it does not add the necessary
32 * opd symbols:
33 * mbind, mq_open, ipc, ...
34 */
35
36void *spu_syscall_table[] = {
37 [__NR_restart_syscall] sys_ni_syscall, /* sys_restart_syscall */
38 [__NR_exit] sys_ni_syscall, /* sys_exit */
39 [__NR_fork] sys_ni_syscall, /* ppc_fork */
40 [__NR_read] sys_read,
41 [__NR_write] sys_write,
42 [__NR_open] sys_open,
43 [__NR_close] sys_close,
44 [__NR_waitpid] sys_waitpid,
45 [__NR_creat] sys_creat,
46 [__NR_link] sys_link,
47 [__NR_unlink] sys_unlink,
48 [__NR_execve] sys_ni_syscall, /* sys_execve */
49 [__NR_chdir] sys_chdir,
50 [__NR_time] sys_time,
51 [__NR_mknod] sys_mknod,
52 [__NR_chmod] sys_chmod,
53 [__NR_lchown] sys_lchown,
54 [__NR_break] sys_ni_syscall,
55 [__NR_oldstat] sys_ni_syscall,
56 [__NR_lseek] sys_lseek,
57 [__NR_getpid] sys_getpid,
58 [__NR_mount] sys_ni_syscall, /* sys_mount */
59 [__NR_umount] sys_ni_syscall,
60 [__NR_setuid] sys_setuid,
61 [__NR_getuid] sys_getuid,
62 [__NR_stime] sys_stime,
63 [__NR_ptrace] sys_ni_syscall, /* sys_ptrace */
64 [__NR_alarm] sys_alarm,
65 [__NR_oldfstat] sys_ni_syscall,
66 [__NR_pause] sys_ni_syscall, /* sys_pause */
67 [__NR_utime] sys_ni_syscall, /* sys_utime */
68 [__NR_stty] sys_ni_syscall,
69 [__NR_gtty] sys_ni_syscall,
70 [__NR_access] sys_access,
71 [__NR_nice] sys_nice,
72 [__NR_ftime] sys_ni_syscall,
73 [__NR_sync] sys_sync,
74 [__NR_kill] sys_kill,
75 [__NR_rename] sys_rename,
76 [__NR_mkdir] sys_mkdir,
77 [__NR_rmdir] sys_rmdir,
78 [__NR_dup] sys_dup,
79 [__NR_pipe] sys_pipe,
80 [__NR_times] sys_times,
81 [__NR_prof] sys_ni_syscall,
82 [__NR_brk] sys_brk,
83 [__NR_setgid] sys_setgid,
84 [__NR_getgid] sys_getgid,
85 [__NR_signal] sys_ni_syscall, /* sys_signal */
86 [__NR_geteuid] sys_geteuid,
87 [__NR_getegid] sys_getegid,
88 [__NR_acct] sys_ni_syscall, /* sys_acct */
89 [__NR_umount2] sys_ni_syscall, /* sys_umount */
90 [__NR_lock] sys_ni_syscall,
91 [__NR_ioctl] sys_ioctl,
92 [__NR_fcntl] sys_fcntl,
93 [__NR_mpx] sys_ni_syscall,
94 [__NR_setpgid] sys_setpgid,
95 [__NR_ulimit] sys_ni_syscall,
96 [__NR_oldolduname] sys_ni_syscall,
97 [__NR_umask] sys_umask,
98 [__NR_chroot] sys_chroot,
99 [__NR_ustat] sys_ni_syscall, /* sys_ustat */
100 [__NR_dup2] sys_dup2,
101 [__NR_getppid] sys_getppid,
102 [__NR_getpgrp] sys_getpgrp,
103 [__NR_setsid] sys_setsid,
104 [__NR_sigaction] sys_ni_syscall,
105 [__NR_sgetmask] sys_sgetmask,
106 [__NR_ssetmask] sys_ssetmask,
107 [__NR_setreuid] sys_setreuid,
108 [__NR_setregid] sys_setregid,
109 [__NR_sigsuspend] sys_ni_syscall,
110 [__NR_sigpending] sys_ni_syscall,
111 [__NR_sethostname] sys_sethostname,
112 [__NR_setrlimit] sys_setrlimit,
113 [__NR_getrlimit] sys_ni_syscall,
114 [__NR_getrusage] sys_getrusage,
115 [__NR_gettimeofday] sys_gettimeofday,
116 [__NR_settimeofday] sys_settimeofday,
117 [__NR_getgroups] sys_getgroups,
118 [__NR_setgroups] sys_setgroups,
119 [__NR_select] sys_ni_syscall,
120 [__NR_symlink] sys_symlink,
121 [__NR_oldlstat] sys_ni_syscall,
122 [__NR_readlink] sys_readlink,
123 [__NR_uselib] sys_ni_syscall, /* sys_uselib */
124 [__NR_swapon] sys_ni_syscall, /* sys_swapon */
125 [__NR_reboot] sys_ni_syscall, /* sys_reboot */
126 [__NR_readdir] sys_ni_syscall,
127 [__NR_mmap] sys_mmap,
128 [__NR_munmap] sys_munmap,
129 [__NR_truncate] sys_truncate,
130 [__NR_ftruncate] sys_ftruncate,
131 [__NR_fchmod] sys_fchmod,
132 [__NR_fchown] sys_fchown,
133 [__NR_getpriority] sys_getpriority,
134 [__NR_setpriority] sys_setpriority,
135 [__NR_profil] sys_ni_syscall,
136 [__NR_statfs] sys_ni_syscall, /* sys_statfs */
137 [__NR_fstatfs] sys_ni_syscall, /* sys_fstatfs */
138 [__NR_ioperm] sys_ni_syscall,
139 [__NR_socketcall] sys_socketcall,
140 [__NR_syslog] sys_syslog,
141 [__NR_setitimer] sys_setitimer,
142 [__NR_getitimer] sys_getitimer,
143 [__NR_stat] sys_newstat,
144 [__NR_lstat] sys_newlstat,
145 [__NR_fstat] sys_newfstat,
146 [__NR_olduname] sys_ni_syscall,
147 [__NR_iopl] sys_ni_syscall,
148 [__NR_vhangup] sys_vhangup,
149 [__NR_idle] sys_ni_syscall,
150 [__NR_vm86] sys_ni_syscall,
151 [__NR_wait4] sys_wait4,
152 [__NR_swapoff] sys_ni_syscall, /* sys_swapoff */
153 [__NR_sysinfo] sys_sysinfo,
154 [__NR_ipc] sys_ni_syscall, /* sys_ipc */
155 [__NR_fsync] sys_fsync,
156 [__NR_sigreturn] sys_ni_syscall,
157 [__NR_clone] sys_ni_syscall, /* ppc_clone */
158 [__NR_setdomainname] sys_setdomainname,
159 [__NR_uname] ppc_newuname,
160 [__NR_modify_ldt] sys_ni_syscall,
161 [__NR_adjtimex] sys_adjtimex,
162 [__NR_mprotect] sys_mprotect,
163 [__NR_sigprocmask] sys_ni_syscall,
164 [__NR_create_module] sys_ni_syscall,
165 [__NR_init_module] sys_ni_syscall, /* sys_init_module */
166 [__NR_delete_module] sys_ni_syscall, /* sys_delete_module */
167 [__NR_get_kernel_syms] sys_ni_syscall,
168 [__NR_quotactl] sys_ni_syscall, /* sys_quotactl */
169 [__NR_getpgid] sys_getpgid,
170 [__NR_fchdir] sys_fchdir,
171 [__NR_bdflush] sys_bdflush,
172 [__NR_sysfs] sys_ni_syscall, /* sys_sysfs */
173 [__NR_personality] ppc64_personality,
174 [__NR_afs_syscall] sys_ni_syscall,
175 [__NR_setfsuid] sys_setfsuid,
176 [__NR_setfsgid] sys_setfsgid,
177 [__NR__llseek] sys_llseek,
178 [__NR_getdents] sys_getdents,
179 [__NR__newselect] sys_select,
180 [__NR_flock] sys_flock,
181 [__NR_msync] sys_msync,
182 [__NR_readv] sys_readv,
183 [__NR_writev] sys_writev,
184 [__NR_getsid] sys_getsid,
185 [__NR_fdatasync] sys_fdatasync,
186 [__NR__sysctl] sys_ni_syscall, /* sys_sysctl */
187 [__NR_mlock] sys_mlock,
188 [__NR_munlock] sys_munlock,
189 [__NR_mlockall] sys_mlockall,
190 [__NR_munlockall] sys_munlockall,
191 [__NR_sched_setparam] sys_sched_setparam,
192 [__NR_sched_getparam] sys_sched_getparam,
193 [__NR_sched_setscheduler] sys_sched_setscheduler,
194 [__NR_sched_getscheduler] sys_sched_getscheduler,
195 [__NR_sched_yield] sys_sched_yield,
196 [__NR_sched_get_priority_max] sys_sched_get_priority_max,
197 [__NR_sched_get_priority_min] sys_sched_get_priority_min,
198 [__NR_sched_rr_get_interval] sys_sched_rr_get_interval,
199 [__NR_nanosleep] sys_nanosleep,
200 [__NR_mremap] sys_mremap,
201 [__NR_setresuid] sys_setresuid,
202 [__NR_getresuid] sys_getresuid,
203 [__NR_query_module] sys_ni_syscall,
204 [__NR_poll] sys_poll,
205 [__NR_nfsservctl] sys_ni_syscall, /* sys_nfsservctl */
206 [__NR_setresgid] sys_setresgid,
207 [__NR_getresgid] sys_getresgid,
208 [__NR_prctl] sys_prctl,
209 [__NR_rt_sigreturn] sys_ni_syscall, /* ppc64_rt_sigreturn */
210 [__NR_rt_sigaction] sys_ni_syscall, /* sys_rt_sigaction */
211 [__NR_rt_sigprocmask] sys_ni_syscall, /* sys_rt_sigprocmask */
212 [__NR_rt_sigpending] sys_ni_syscall, /* sys_rt_sigpending */
213 [__NR_rt_sigtimedwait] sys_ni_syscall, /* sys_rt_sigtimedwait */
214 [__NR_rt_sigqueueinfo] sys_ni_syscall, /* sys_rt_sigqueueinfo */
215 [__NR_rt_sigsuspend] sys_ni_syscall, /* sys_rt_sigsuspend */
216 [__NR_pread64] sys_pread64,
217 [__NR_pwrite64] sys_pwrite64,
218 [__NR_chown] sys_chown,
219 [__NR_getcwd] sys_getcwd,
220 [__NR_capget] sys_capget,
221 [__NR_capset] sys_capset,
222 [__NR_sigaltstack] sys_ni_syscall, /* sys_sigaltstack */
223 [__NR_sendfile] sys_sendfile64,
224 [__NR_getpmsg] sys_ni_syscall,
225 [__NR_putpmsg] sys_ni_syscall,
226 [__NR_vfork] sys_ni_syscall, /* ppc_vfork */
227 [__NR_ugetrlimit] sys_getrlimit,
228 [__NR_readahead] sys_readahead,
229 [192] sys_ni_syscall,
230 [193] sys_ni_syscall,
231 [194] sys_ni_syscall,
232 [195] sys_ni_syscall,
233 [196] sys_ni_syscall,
234 [197] sys_ni_syscall,
235 [__NR_pciconfig_read] sys_ni_syscall, /* sys_pciconfig_read */
236 [__NR_pciconfig_write] sys_ni_syscall, /* sys_pciconfig_write */
237 [__NR_pciconfig_iobase] sys_ni_syscall, /* sys_pciconfig_iobase */
238 [__NR_multiplexer] sys_ni_syscall,
239 [__NR_getdents64] sys_getdents64,
240 [__NR_pivot_root] sys_pivot_root,
241 [204] sys_ni_syscall,
242 [__NR_madvise] sys_madvise,
243 [__NR_mincore] sys_mincore,
244 [__NR_gettid] sys_gettid,
245 [__NR_tkill] sys_tkill,
246 [__NR_setxattr] sys_setxattr,
247 [__NR_lsetxattr] sys_lsetxattr,
248 [__NR_fsetxattr] sys_fsetxattr,
249 [__NR_getxattr] sys_getxattr,
250 [__NR_lgetxattr] sys_lgetxattr,
251 [__NR_fgetxattr] sys_fgetxattr,
252 [__NR_listxattr] sys_listxattr,
253 [__NR_llistxattr] sys_llistxattr,
254 [__NR_flistxattr] sys_flistxattr,
255 [__NR_removexattr] sys_removexattr,
256 [__NR_lremovexattr] sys_lremovexattr,
257 [__NR_fremovexattr] sys_fremovexattr,
258 [__NR_futex] sys_futex,
259 [__NR_sched_setaffinity] sys_sched_setaffinity,
260 [__NR_sched_getaffinity] sys_sched_getaffinity,
261 [__NR_tuxcall] sys_ni_syscall,
262 [226] sys_ni_syscall,
263 [__NR_io_setup] sys_io_setup,
264 [__NR_io_destroy] sys_io_destroy,
265 [__NR_io_getevents] sys_io_getevents,
266 [__NR_io_submit] sys_io_submit,
267 [__NR_io_cancel] sys_io_cancel,
268 [__NR_set_tid_address] sys_ni_syscall, /* sys_set_tid_address */
269 [__NR_fadvise64] sys_fadvise64,
270 [__NR_exit_group] sys_ni_syscall, /* sys_exit_group */
271 [__NR_lookup_dcookie] sys_ni_syscall, /* sys_lookup_dcookie */
272 [__NR_epoll_create] sys_epoll_create,
273 [__NR_epoll_ctl] sys_epoll_ctl,
274 [__NR_epoll_wait] sys_epoll_wait,
275 [__NR_remap_file_pages] sys_remap_file_pages,
276 [__NR_timer_create] sys_timer_create,
277 [__NR_timer_settime] sys_timer_settime,
278 [__NR_timer_gettime] sys_timer_gettime,
279 [__NR_timer_getoverrun] sys_timer_getoverrun,
280 [__NR_timer_delete] sys_timer_delete,
281 [__NR_clock_settime] sys_clock_settime,
282 [__NR_clock_gettime] sys_clock_gettime,
283 [__NR_clock_getres] sys_clock_getres,
284 [__NR_clock_nanosleep] sys_clock_nanosleep,
285 [__NR_swapcontext] sys_ni_syscall, /* ppc64_swapcontext */
286 [__NR_tgkill] sys_tgkill,
287 [__NR_utimes] sys_utimes,
288 [__NR_statfs64] sys_statfs64,
289 [__NR_fstatfs64] sys_fstatfs64,
290 [254] sys_ni_syscall,
291 [__NR_rtas] ppc_rtas,
292 [256] sys_ni_syscall,
293 [257] sys_ni_syscall,
294 [258] sys_ni_syscall,
295 [__NR_mbind] sys_ni_syscall, /* sys_mbind */
296 [__NR_get_mempolicy] sys_ni_syscall, /* sys_get_mempolicy */
297 [__NR_set_mempolicy] sys_ni_syscall, /* sys_set_mempolicy */
298 [__NR_mq_open] sys_ni_syscall, /* sys_mq_open */
299 [__NR_mq_unlink] sys_ni_syscall, /* sys_mq_unlink */
300 [__NR_mq_timedsend] sys_ni_syscall, /* sys_mq_timedsend */
301 [__NR_mq_timedreceive] sys_ni_syscall, /* sys_mq_timedreceive */
302 [__NR_mq_notify] sys_ni_syscall, /* sys_mq_notify */
303 [__NR_mq_getsetattr] sys_ni_syscall, /* sys_mq_getsetattr */
304 [__NR_kexec_load] sys_ni_syscall, /* sys_kexec_load */
305 [__NR_add_key] sys_ni_syscall, /* sys_add_key */
306 [__NR_request_key] sys_ni_syscall, /* sys_request_key */
307 [__NR_keyctl] sys_ni_syscall, /* sys_keyctl */
308 [__NR_waitid] sys_ni_syscall, /* sys_waitid */
309 [__NR_ioprio_set] sys_ni_syscall, /* sys_ioprio_set */
310 [__NR_ioprio_get] sys_ni_syscall, /* sys_ioprio_get */
311 [__NR_inotify_init] sys_ni_syscall, /* sys_inotify_init */
312 [__NR_inotify_add_watch] sys_ni_syscall, /* sys_inotify_add_watch */
313 [__NR_inotify_rm_watch] sys_ni_syscall, /* sys_inotify_rm_watch */
314 [__NR_spu_run] sys_ni_syscall, /* sys_spu_run */
315 [__NR_spu_create] sys_ni_syscall, /* sys_spu_create */
316 [__NR_pselect6] sys_ni_syscall, /* sys_pselect */
317 [__NR_ppoll] sys_ni_syscall, /* sys_ppoll */
318 [__NR_unshare] sys_unshare,
319};
320
321long spu_sys_callback(struct spu_syscall_block *s)
322{
323 long (*syscall)(u64 a1, u64 a2, u64 a3, u64 a4, u64 a5, u64 a6);
324
325 BUILD_BUG_ON(ARRAY_SIZE(spu_syscall_table) != __NR_syscalls);
326
327 syscall = spu_syscall_table[s->nr_ret];
328
329 if (s->nr_ret >= __NR_syscalls) {
330 pr_debug("%s: invalid syscall #%ld", __FUNCTION__, s->nr_ret);
331 return -ENOSYS;
332 }
333
334#ifdef DEBUG
335 print_symbol(KERN_DEBUG "SPU-syscall %s:", (unsigned long)syscall);
336 printk("syscall%ld(%lx, %lx, %lx, %lx, %lx, %lx)\n",
337 s->nr_ret,
338 s->parm[0], s->parm[1], s->parm[2],
339 s->parm[3], s->parm[4], s->parm[5]);
340#endif
341
342 return syscall(s->parm[0], s->parm[1], s->parm[2],
343 s->parm[3], s->parm[4], s->parm[5]);
344}
345EXPORT_SYMBOL_GPL(spu_sys_callback);
diff --git a/arch/powerpc/platforms/cell/spufs/backing_ops.c b/arch/powerpc/platforms/cell/spufs/backing_ops.c
index a5c489a53c61..f1d35ddc9df3 100644
--- a/arch/powerpc/platforms/cell/spufs/backing_ops.c
+++ b/arch/powerpc/platforms/cell/spufs/backing_ops.c
@@ -285,6 +285,49 @@ static void spu_backing_runcntl_stop(struct spu_context *ctx)
285 spu_backing_runcntl_write(ctx, SPU_RUNCNTL_STOP); 285 spu_backing_runcntl_write(ctx, SPU_RUNCNTL_STOP);
286} 286}
287 287
288static int spu_backing_set_mfc_query(struct spu_context * ctx, u32 mask,
289 u32 mode)
290{
291 struct spu_problem_collapsed *prob = &ctx->csa.prob;
292 int ret;
293
294 spin_lock(&ctx->csa.register_lock);
295 ret = -EAGAIN;
296 if (prob->dma_querytype_RW)
297 goto out;
298 ret = 0;
299 /* FIXME: what are the side-effects of this? */
300 prob->dma_querymask_RW = mask;
301 prob->dma_querytype_RW = mode;
302out:
303 spin_unlock(&ctx->csa.register_lock);
304
305 return ret;
306}
307
308static u32 spu_backing_read_mfc_tagstatus(struct spu_context * ctx)
309{
310 return ctx->csa.prob.dma_tagstatus_R;
311}
312
313static u32 spu_backing_get_mfc_free_elements(struct spu_context *ctx)
314{
315 return ctx->csa.prob.dma_qstatus_R;
316}
317
318static int spu_backing_send_mfc_command(struct spu_context *ctx,
319 struct mfc_dma_command *cmd)
320{
321 int ret;
322
323 spin_lock(&ctx->csa.register_lock);
324 ret = -EAGAIN;
325 /* FIXME: set up priv2->puq */
326 spin_unlock(&ctx->csa.register_lock);
327
328 return ret;
329}
330
288struct spu_context_ops spu_backing_ops = { 331struct spu_context_ops spu_backing_ops = {
289 .mbox_read = spu_backing_mbox_read, 332 .mbox_read = spu_backing_mbox_read,
290 .mbox_stat_read = spu_backing_mbox_stat_read, 333 .mbox_stat_read = spu_backing_mbox_stat_read,
@@ -305,4 +348,8 @@ struct spu_context_ops spu_backing_ops = {
305 .get_ls = spu_backing_get_ls, 348 .get_ls = spu_backing_get_ls,
306 .runcntl_write = spu_backing_runcntl_write, 349 .runcntl_write = spu_backing_runcntl_write,
307 .runcntl_stop = spu_backing_runcntl_stop, 350 .runcntl_stop = spu_backing_runcntl_stop,
351 .set_mfc_query = spu_backing_set_mfc_query,
352 .read_mfc_tagstatus = spu_backing_read_mfc_tagstatus,
353 .get_mfc_free_elements = spu_backing_get_mfc_free_elements,
354 .send_mfc_command = spu_backing_send_mfc_command,
308}; 355};
diff --git a/arch/powerpc/platforms/cell/spufs/context.c b/arch/powerpc/platforms/cell/spufs/context.c
index 336f238102fd..8bb33abfad17 100644
--- a/arch/powerpc/platforms/cell/spufs/context.c
+++ b/arch/powerpc/platforms/cell/spufs/context.c
@@ -27,7 +27,7 @@
27#include <asm/spu_csa.h> 27#include <asm/spu_csa.h>
28#include "spufs.h" 28#include "spufs.h"
29 29
30struct spu_context *alloc_spu_context(struct address_space *local_store) 30struct spu_context *alloc_spu_context(void)
31{ 31{
32 struct spu_context *ctx; 32 struct spu_context *ctx;
33 ctx = kmalloc(sizeof *ctx, GFP_KERNEL); 33 ctx = kmalloc(sizeof *ctx, GFP_KERNEL);
@@ -47,10 +47,17 @@ struct spu_context *alloc_spu_context(struct address_space *local_store)
47 init_waitqueue_head(&ctx->ibox_wq); 47 init_waitqueue_head(&ctx->ibox_wq);
48 init_waitqueue_head(&ctx->wbox_wq); 48 init_waitqueue_head(&ctx->wbox_wq);
49 init_waitqueue_head(&ctx->stop_wq); 49 init_waitqueue_head(&ctx->stop_wq);
50 init_waitqueue_head(&ctx->mfc_wq);
50 ctx->ibox_fasync = NULL; 51 ctx->ibox_fasync = NULL;
51 ctx->wbox_fasync = NULL; 52 ctx->wbox_fasync = NULL;
53 ctx->mfc_fasync = NULL;
54 ctx->mfc = NULL;
55 ctx->tagwait = 0;
52 ctx->state = SPU_STATE_SAVED; 56 ctx->state = SPU_STATE_SAVED;
53 ctx->local_store = local_store; 57 ctx->local_store = NULL;
58 ctx->cntl = NULL;
59 ctx->signal1 = NULL;
60 ctx->signal2 = NULL;
54 ctx->spu = NULL; 61 ctx->spu = NULL;
55 ctx->ops = &spu_backing_ops; 62 ctx->ops = &spu_backing_ops;
56 ctx->owner = get_task_mm(current); 63 ctx->owner = get_task_mm(current);
@@ -68,8 +75,6 @@ void destroy_spu_context(struct kref *kref)
68 ctx = container_of(kref, struct spu_context, kref); 75 ctx = container_of(kref, struct spu_context, kref);
69 down_write(&ctx->state_sema); 76 down_write(&ctx->state_sema);
70 spu_deactivate(ctx); 77 spu_deactivate(ctx);
71 ctx->ibox_fasync = NULL;
72 ctx->wbox_fasync = NULL;
73 up_write(&ctx->state_sema); 78 up_write(&ctx->state_sema);
74 spu_fini_csa(&ctx->csa); 79 spu_fini_csa(&ctx->csa);
75 kfree(ctx); 80 kfree(ctx);
@@ -109,7 +114,16 @@ void spu_release(struct spu_context *ctx)
109 114
110void spu_unmap_mappings(struct spu_context *ctx) 115void spu_unmap_mappings(struct spu_context *ctx)
111{ 116{
112 unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1); 117 if (ctx->local_store)
118 unmap_mapping_range(ctx->local_store, 0, LS_SIZE, 1);
119 if (ctx->mfc)
120 unmap_mapping_range(ctx->mfc, 0, 0x4000, 1);
121 if (ctx->cntl)
122 unmap_mapping_range(ctx->cntl, 0, 0x4000, 1);
123 if (ctx->signal1)
124 unmap_mapping_range(ctx->signal1, 0, 0x4000, 1);
125 if (ctx->signal2)
126 unmap_mapping_range(ctx->signal2, 0, 0x4000, 1);
113} 127}
114 128
115int spu_acquire_runnable(struct spu_context *ctx) 129int spu_acquire_runnable(struct spu_context *ctx)
diff --git a/arch/powerpc/platforms/cell/spufs/file.c b/arch/powerpc/platforms/cell/spufs/file.c
index dfa649c9b956..366185e92667 100644
--- a/arch/powerpc/platforms/cell/spufs/file.c
+++ b/arch/powerpc/platforms/cell/spufs/file.c
@@ -20,6 +20,8 @@
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */ 21 */
22 22
23#undef DEBUG
24
23#include <linux/fs.h> 25#include <linux/fs.h>
24#include <linux/ioctl.h> 26#include <linux/ioctl.h>
25#include <linux/module.h> 27#include <linux/module.h>
@@ -39,8 +41,10 @@ static int
39spufs_mem_open(struct inode *inode, struct file *file) 41spufs_mem_open(struct inode *inode, struct file *file)
40{ 42{
41 struct spufs_inode_info *i = SPUFS_I(inode); 43 struct spufs_inode_info *i = SPUFS_I(inode);
42 file->private_data = i->i_ctx; 44 struct spu_context *ctx = i->i_ctx;
43 file->f_mapping = i->i_ctx->local_store; 45 file->private_data = ctx;
46 file->f_mapping = inode->i_mapping;
47 ctx->local_store = inode->i_mapping;
44 return 0; 48 return 0;
45} 49}
46 50
@@ -84,7 +88,7 @@ spufs_mem_write(struct file *file, const char __user *buffer,
84 return ret; 88 return ret;
85} 89}
86 90
87#ifdef CONFIG_SPARSEMEM 91#ifdef CONFIG_SPUFS_MMAP
88static struct page * 92static struct page *
89spufs_mem_mmap_nopage(struct vm_area_struct *vma, 93spufs_mem_mmap_nopage(struct vm_area_struct *vma,
90 unsigned long address, int *type) 94 unsigned long address, int *type)
@@ -136,11 +140,113 @@ static struct file_operations spufs_mem_fops = {
136 .read = spufs_mem_read, 140 .read = spufs_mem_read,
137 .write = spufs_mem_write, 141 .write = spufs_mem_write,
138 .llseek = generic_file_llseek, 142 .llseek = generic_file_llseek,
139#ifdef CONFIG_SPARSEMEM 143#ifdef CONFIG_SPUFS_MMAP
140 .mmap = spufs_mem_mmap, 144 .mmap = spufs_mem_mmap,
141#endif 145#endif
142}; 146};
143 147
148#ifdef CONFIG_SPUFS_MMAP
149static struct page *spufs_ps_nopage(struct vm_area_struct *vma,
150 unsigned long address,
151 int *type, unsigned long ps_offs)
152{
153 struct page *page = NOPAGE_SIGBUS;
154 int fault_type = VM_FAULT_SIGBUS;
155 struct spu_context *ctx = vma->vm_file->private_data;
156 unsigned long offset = address - vma->vm_start;
157 unsigned long area;
158 int ret;
159
160 offset += vma->vm_pgoff << PAGE_SHIFT;
161 if (offset >= 0x4000)
162 goto out;
163
164 ret = spu_acquire_runnable(ctx);
165 if (ret)
166 goto out;
167
168 area = ctx->spu->problem_phys + ps_offs;
169 page = pfn_to_page((area + offset) >> PAGE_SHIFT);
170 fault_type = VM_FAULT_MINOR;
171 page_cache_get(page);
172
173 spu_release(ctx);
174
175 out:
176 if (type)
177 *type = fault_type;
178
179 return page;
180}
181
182static struct page *spufs_cntl_mmap_nopage(struct vm_area_struct *vma,
183 unsigned long address, int *type)
184{
185 return spufs_ps_nopage(vma, address, type, 0x4000);
186}
187
188static struct vm_operations_struct spufs_cntl_mmap_vmops = {
189 .nopage = spufs_cntl_mmap_nopage,
190};
191
192/*
193 * mmap support for problem state control area [0x4000 - 0x4fff].
194 * Mapping this area requires that the application have CAP_SYS_RAWIO,
195 * as these registers require special care when read/writing.
196 */
197static int spufs_cntl_mmap(struct file *file, struct vm_area_struct *vma)
198{
199 if (!(vma->vm_flags & VM_SHARED))
200 return -EINVAL;
201
202 if (!capable(CAP_SYS_RAWIO))
203 return -EPERM;
204
205 vma->vm_flags |= VM_RESERVED;
206 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
207 | _PAGE_NO_CACHE);
208
209 vma->vm_ops = &spufs_cntl_mmap_vmops;
210 return 0;
211}
212#endif
213
214static int spufs_cntl_open(struct inode *inode, struct file *file)
215{
216 struct spufs_inode_info *i = SPUFS_I(inode);
217 struct spu_context *ctx = i->i_ctx;
218
219 file->private_data = ctx;
220 file->f_mapping = inode->i_mapping;
221 ctx->cntl = inode->i_mapping;
222 return 0;
223}
224
225static ssize_t
226spufs_cntl_read(struct file *file, char __user *buffer,
227 size_t size, loff_t *pos)
228{
229 /* FIXME: read from spu status */
230 return -EINVAL;
231}
232
233static ssize_t
234spufs_cntl_write(struct file *file, const char __user *buffer,
235 size_t size, loff_t *pos)
236{
237 /* FIXME: write to runctl bit */
238 return -EINVAL;
239}
240
241static struct file_operations spufs_cntl_fops = {
242 .open = spufs_cntl_open,
243 .read = spufs_cntl_read,
244 .write = spufs_cntl_write,
245#ifdef CONFIG_SPUFS_MMAP
246 .mmap = spufs_cntl_mmap,
247#endif
248};
249
144static int 250static int
145spufs_regs_open(struct inode *inode, struct file *file) 251spufs_regs_open(struct inode *inode, struct file *file)
146{ 252{
@@ -501,6 +607,16 @@ static struct file_operations spufs_wbox_stat_fops = {
501 .read = spufs_wbox_stat_read, 607 .read = spufs_wbox_stat_read,
502}; 608};
503 609
610static int spufs_signal1_open(struct inode *inode, struct file *file)
611{
612 struct spufs_inode_info *i = SPUFS_I(inode);
613 struct spu_context *ctx = i->i_ctx;
614 file->private_data = ctx;
615 file->f_mapping = inode->i_mapping;
616 ctx->signal1 = inode->i_mapping;
617 return nonseekable_open(inode, file);
618}
619
504static ssize_t spufs_signal1_read(struct file *file, char __user *buf, 620static ssize_t spufs_signal1_read(struct file *file, char __user *buf,
505 size_t len, loff_t *pos) 621 size_t len, loff_t *pos)
506{ 622{
@@ -541,12 +657,50 @@ static ssize_t spufs_signal1_write(struct file *file, const char __user *buf,
541 return 4; 657 return 4;
542} 658}
543 659
660#ifdef CONFIG_SPUFS_MMAP
661static struct page *spufs_signal1_mmap_nopage(struct vm_area_struct *vma,
662 unsigned long address, int *type)
663{
664 return spufs_ps_nopage(vma, address, type, 0x14000);
665}
666
667static struct vm_operations_struct spufs_signal1_mmap_vmops = {
668 .nopage = spufs_signal1_mmap_nopage,
669};
670
671static int spufs_signal1_mmap(struct file *file, struct vm_area_struct *vma)
672{
673 if (!(vma->vm_flags & VM_SHARED))
674 return -EINVAL;
675
676 vma->vm_flags |= VM_RESERVED;
677 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
678 | _PAGE_NO_CACHE);
679
680 vma->vm_ops = &spufs_signal1_mmap_vmops;
681 return 0;
682}
683#endif
684
544static struct file_operations spufs_signal1_fops = { 685static struct file_operations spufs_signal1_fops = {
545 .open = spufs_pipe_open, 686 .open = spufs_signal1_open,
546 .read = spufs_signal1_read, 687 .read = spufs_signal1_read,
547 .write = spufs_signal1_write, 688 .write = spufs_signal1_write,
689#ifdef CONFIG_SPUFS_MMAP
690 .mmap = spufs_signal1_mmap,
691#endif
548}; 692};
549 693
694static int spufs_signal2_open(struct inode *inode, struct file *file)
695{
696 struct spufs_inode_info *i = SPUFS_I(inode);
697 struct spu_context *ctx = i->i_ctx;
698 file->private_data = ctx;
699 file->f_mapping = inode->i_mapping;
700 ctx->signal2 = inode->i_mapping;
701 return nonseekable_open(inode, file);
702}
703
550static ssize_t spufs_signal2_read(struct file *file, char __user *buf, 704static ssize_t spufs_signal2_read(struct file *file, char __user *buf,
551 size_t len, loff_t *pos) 705 size_t len, loff_t *pos)
552{ 706{
@@ -589,10 +743,39 @@ static ssize_t spufs_signal2_write(struct file *file, const char __user *buf,
589 return 4; 743 return 4;
590} 744}
591 745
746#ifdef CONFIG_SPUFS_MMAP
747static struct page *spufs_signal2_mmap_nopage(struct vm_area_struct *vma,
748 unsigned long address, int *type)
749{
750 return spufs_ps_nopage(vma, address, type, 0x1c000);
751}
752
753static struct vm_operations_struct spufs_signal2_mmap_vmops = {
754 .nopage = spufs_signal2_mmap_nopage,
755};
756
757static int spufs_signal2_mmap(struct file *file, struct vm_area_struct *vma)
758{
759 if (!(vma->vm_flags & VM_SHARED))
760 return -EINVAL;
761
762 /* FIXME: */
763 vma->vm_flags |= VM_RESERVED;
764 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
765 | _PAGE_NO_CACHE);
766
767 vma->vm_ops = &spufs_signal2_mmap_vmops;
768 return 0;
769}
770#endif
771
592static struct file_operations spufs_signal2_fops = { 772static struct file_operations spufs_signal2_fops = {
593 .open = spufs_pipe_open, 773 .open = spufs_signal2_open,
594 .read = spufs_signal2_read, 774 .read = spufs_signal2_read,
595 .write = spufs_signal2_write, 775 .write = spufs_signal2_write,
776#ifdef CONFIG_SPUFS_MMAP
777 .mmap = spufs_signal2_mmap,
778#endif
596}; 779};
597 780
598static void spufs_signal1_type_set(void *data, u64 val) 781static void spufs_signal1_type_set(void *data, u64 val)
@@ -641,6 +824,332 @@ static u64 spufs_signal2_type_get(void *data)
641DEFINE_SIMPLE_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get, 824DEFINE_SIMPLE_ATTRIBUTE(spufs_signal2_type, spufs_signal2_type_get,
642 spufs_signal2_type_set, "%llu"); 825 spufs_signal2_type_set, "%llu");
643 826
827#ifdef CONFIG_SPUFS_MMAP
828static struct page *spufs_mfc_mmap_nopage(struct vm_area_struct *vma,
829 unsigned long address, int *type)
830{
831 return spufs_ps_nopage(vma, address, type, 0x3000);
832}
833
834static struct vm_operations_struct spufs_mfc_mmap_vmops = {
835 .nopage = spufs_mfc_mmap_nopage,
836};
837
838/*
839 * mmap support for problem state MFC DMA area [0x0000 - 0x0fff].
840 * Mapping this area requires that the application have CAP_SYS_RAWIO,
841 * as these registers require special care when read/writing.
842 */
843static int spufs_mfc_mmap(struct file *file, struct vm_area_struct *vma)
844{
845 if (!(vma->vm_flags & VM_SHARED))
846 return -EINVAL;
847
848 if (!capable(CAP_SYS_RAWIO))
849 return -EPERM;
850
851 vma->vm_flags |= VM_RESERVED;
852 vma->vm_page_prot = __pgprot(pgprot_val(vma->vm_page_prot)
853 | _PAGE_NO_CACHE);
854
855 vma->vm_ops = &spufs_mfc_mmap_vmops;
856 return 0;
857}
858#endif
859
860static int spufs_mfc_open(struct inode *inode, struct file *file)
861{
862 struct spufs_inode_info *i = SPUFS_I(inode);
863 struct spu_context *ctx = i->i_ctx;
864
865 /* we don't want to deal with DMA into other processes */
866 if (ctx->owner != current->mm)
867 return -EINVAL;
868
869 if (atomic_read(&inode->i_count) != 1)
870 return -EBUSY;
871
872 file->private_data = ctx;
873 return nonseekable_open(inode, file);
874}
875
876/* interrupt-level mfc callback function. */
877void spufs_mfc_callback(struct spu *spu)
878{
879 struct spu_context *ctx = spu->ctx;
880
881 wake_up_all(&ctx->mfc_wq);
882
883 pr_debug("%s %s\n", __FUNCTION__, spu->name);
884 if (ctx->mfc_fasync) {
885 u32 free_elements, tagstatus;
886 unsigned int mask;
887
888 /* no need for spu_acquire in interrupt context */
889 free_elements = ctx->ops->get_mfc_free_elements(ctx);
890 tagstatus = ctx->ops->read_mfc_tagstatus(ctx);
891
892 mask = 0;
893 if (free_elements & 0xffff)
894 mask |= POLLOUT;
895 if (tagstatus & ctx->tagwait)
896 mask |= POLLIN;
897
898 kill_fasync(&ctx->mfc_fasync, SIGIO, mask);
899 }
900}
901
902static int spufs_read_mfc_tagstatus(struct spu_context *ctx, u32 *status)
903{
904 /* See if there is one tag group is complete */
905 /* FIXME we need locking around tagwait */
906 *status = ctx->ops->read_mfc_tagstatus(ctx) & ctx->tagwait;
907 ctx->tagwait &= ~*status;
908 if (*status)
909 return 1;
910
911 /* enable interrupt waiting for any tag group,
912 may silently fail if interrupts are already enabled */
913 ctx->ops->set_mfc_query(ctx, ctx->tagwait, 1);
914 return 0;
915}
916
917static ssize_t spufs_mfc_read(struct file *file, char __user *buffer,
918 size_t size, loff_t *pos)
919{
920 struct spu_context *ctx = file->private_data;
921 int ret = -EINVAL;
922 u32 status;
923
924 if (size != 4)
925 goto out;
926
927 spu_acquire(ctx);
928 if (file->f_flags & O_NONBLOCK) {
929 status = ctx->ops->read_mfc_tagstatus(ctx);
930 if (!(status & ctx->tagwait))
931 ret = -EAGAIN;
932 else
933 ctx->tagwait &= ~status;
934 } else {
935 ret = spufs_wait(ctx->mfc_wq,
936 spufs_read_mfc_tagstatus(ctx, &status));
937 }
938 spu_release(ctx);
939
940 if (ret)
941 goto out;
942
943 ret = 4;
944 if (copy_to_user(buffer, &status, 4))
945 ret = -EFAULT;
946
947out:
948 return ret;
949}
950
951static int spufs_check_valid_dma(struct mfc_dma_command *cmd)
952{
953 pr_debug("queueing DMA %x %lx %x %x %x\n", cmd->lsa,
954 cmd->ea, cmd->size, cmd->tag, cmd->cmd);
955
956 switch (cmd->cmd) {
957 case MFC_PUT_CMD:
958 case MFC_PUTF_CMD:
959 case MFC_PUTB_CMD:
960 case MFC_GET_CMD:
961 case MFC_GETF_CMD:
962 case MFC_GETB_CMD:
963 break;
964 default:
965 pr_debug("invalid DMA opcode %x\n", cmd->cmd);
966 return -EIO;
967 }
968
969 if ((cmd->lsa & 0xf) != (cmd->ea &0xf)) {
970 pr_debug("invalid DMA alignment, ea %lx lsa %x\n",
971 cmd->ea, cmd->lsa);
972 return -EIO;
973 }
974
975 switch (cmd->size & 0xf) {
976 case 1:
977 break;
978 case 2:
979 if (cmd->lsa & 1)
980 goto error;
981 break;
982 case 4:
983 if (cmd->lsa & 3)
984 goto error;
985 break;
986 case 8:
987 if (cmd->lsa & 7)
988 goto error;
989 break;
990 case 0:
991 if (cmd->lsa & 15)
992 goto error;
993 break;
994 error:
995 default:
996 pr_debug("invalid DMA alignment %x for size %x\n",
997 cmd->lsa & 0xf, cmd->size);
998 return -EIO;
999 }
1000
1001 if (cmd->size > 16 * 1024) {
1002 pr_debug("invalid DMA size %x\n", cmd->size);
1003 return -EIO;
1004 }
1005
1006 if (cmd->tag & 0xfff0) {
1007 /* we reserve the higher tag numbers for kernel use */
1008 pr_debug("invalid DMA tag\n");
1009 return -EIO;
1010 }
1011
1012 if (cmd->class) {
1013 /* not supported in this version */
1014 pr_debug("invalid DMA class\n");
1015 return -EIO;
1016 }
1017
1018 return 0;
1019}
1020
1021static int spu_send_mfc_command(struct spu_context *ctx,
1022 struct mfc_dma_command cmd,
1023 int *error)
1024{
1025 *error = ctx->ops->send_mfc_command(ctx, &cmd);
1026 if (*error == -EAGAIN) {
1027 /* wait for any tag group to complete
1028 so we have space for the new command */
1029 ctx->ops->set_mfc_query(ctx, ctx->tagwait, 1);
1030 /* try again, because the queue might be
1031 empty again */
1032 *error = ctx->ops->send_mfc_command(ctx, &cmd);
1033 if (*error == -EAGAIN)
1034 return 0;
1035 }
1036 return 1;
1037}
1038
1039static ssize_t spufs_mfc_write(struct file *file, const char __user *buffer,
1040 size_t size, loff_t *pos)
1041{
1042 struct spu_context *ctx = file->private_data;
1043 struct mfc_dma_command cmd;
1044 int ret = -EINVAL;
1045
1046 if (size != sizeof cmd)
1047 goto out;
1048
1049 ret = -EFAULT;
1050 if (copy_from_user(&cmd, buffer, sizeof cmd))
1051 goto out;
1052
1053 ret = spufs_check_valid_dma(&cmd);
1054 if (ret)
1055 goto out;
1056
1057 spu_acquire_runnable(ctx);
1058 if (file->f_flags & O_NONBLOCK) {
1059 ret = ctx->ops->send_mfc_command(ctx, &cmd);
1060 } else {
1061 int status;
1062 ret = spufs_wait(ctx->mfc_wq,
1063 spu_send_mfc_command(ctx, cmd, &status));
1064 if (status)
1065 ret = status;
1066 }
1067 spu_release(ctx);
1068
1069 if (ret)
1070 goto out;
1071
1072 ctx->tagwait |= 1 << cmd.tag;
1073
1074out:
1075 return ret;
1076}
1077
1078static unsigned int spufs_mfc_poll(struct file *file,poll_table *wait)
1079{
1080 struct spu_context *ctx = file->private_data;
1081 u32 free_elements, tagstatus;
1082 unsigned int mask;
1083
1084 spu_acquire(ctx);
1085 ctx->ops->set_mfc_query(ctx, ctx->tagwait, 2);
1086 free_elements = ctx->ops->get_mfc_free_elements(ctx);
1087 tagstatus = ctx->ops->read_mfc_tagstatus(ctx);
1088 spu_release(ctx);
1089
1090 poll_wait(file, &ctx->mfc_wq, wait);
1091
1092 mask = 0;
1093 if (free_elements & 0xffff)
1094 mask |= POLLOUT | POLLWRNORM;
1095 if (tagstatus & ctx->tagwait)
1096 mask |= POLLIN | POLLRDNORM;
1097
1098 pr_debug("%s: free %d tagstatus %d tagwait %d\n", __FUNCTION__,
1099 free_elements, tagstatus, ctx->tagwait);
1100
1101 return mask;
1102}
1103
1104static int spufs_mfc_flush(struct file *file)
1105{
1106 struct spu_context *ctx = file->private_data;
1107 int ret;
1108
1109 spu_acquire(ctx);
1110#if 0
1111/* this currently hangs */
1112 ret = spufs_wait(ctx->mfc_wq,
1113 ctx->ops->set_mfc_query(ctx, ctx->tagwait, 2));
1114 if (ret)
1115 goto out;
1116 ret = spufs_wait(ctx->mfc_wq,
1117 ctx->ops->read_mfc_tagstatus(ctx) == ctx->tagwait);
1118out:
1119#else
1120 ret = 0;
1121#endif
1122 spu_release(ctx);
1123
1124 return ret;
1125}
1126
1127static int spufs_mfc_fsync(struct file *file, struct dentry *dentry,
1128 int datasync)
1129{
1130 return spufs_mfc_flush(file);
1131}
1132
1133static int spufs_mfc_fasync(int fd, struct file *file, int on)
1134{
1135 struct spu_context *ctx = file->private_data;
1136
1137 return fasync_helper(fd, file, on, &ctx->mfc_fasync);
1138}
1139
1140static struct file_operations spufs_mfc_fops = {
1141 .open = spufs_mfc_open,
1142 .read = spufs_mfc_read,
1143 .write = spufs_mfc_write,
1144 .poll = spufs_mfc_poll,
1145 .flush = spufs_mfc_flush,
1146 .fsync = spufs_mfc_fsync,
1147 .fasync = spufs_mfc_fasync,
1148#ifdef CONFIG_SPUFS_MMAP
1149 .mmap = spufs_mfc_mmap,
1150#endif
1151};
1152
644static void spufs_npc_set(void *data, u64 val) 1153static void spufs_npc_set(void *data, u64 val)
645{ 1154{
646 struct spu_context *ctx = data; 1155 struct spu_context *ctx = data;
@@ -783,6 +1292,8 @@ struct tree_descr spufs_dir_contents[] = {
783 { "signal2", &spufs_signal2_fops, 0666, }, 1292 { "signal2", &spufs_signal2_fops, 0666, },
784 { "signal1_type", &spufs_signal1_type, 0666, }, 1293 { "signal1_type", &spufs_signal1_type, 0666, },
785 { "signal2_type", &spufs_signal2_type, 0666, }, 1294 { "signal2_type", &spufs_signal2_type, 0666, },
1295 { "mfc", &spufs_mfc_fops, 0666, },
1296 { "cntl", &spufs_cntl_fops, 0666, },
786 { "npc", &spufs_npc_ops, 0666, }, 1297 { "npc", &spufs_npc_ops, 0666, },
787 { "fpcr", &spufs_fpcr_fops, 0666, }, 1298 { "fpcr", &spufs_fpcr_fops, 0666, },
788 { "decr", &spufs_decr_ops, 0666, }, 1299 { "decr", &spufs_decr_ops, 0666, },
diff --git a/arch/powerpc/platforms/cell/spufs/hw_ops.c b/arch/powerpc/platforms/cell/spufs/hw_ops.c
index 5445719bff79..a13a8b5a014d 100644
--- a/arch/powerpc/platforms/cell/spufs/hw_ops.c
+++ b/arch/powerpc/platforms/cell/spufs/hw_ops.c
@@ -232,6 +232,59 @@ static void spu_hw_runcntl_stop(struct spu_context *ctx)
232 spin_unlock_irq(&ctx->spu->register_lock); 232 spin_unlock_irq(&ctx->spu->register_lock);
233} 233}
234 234
235static int spu_hw_set_mfc_query(struct spu_context * ctx, u32 mask, u32 mode)
236{
237 struct spu_problem *prob = ctx->spu->problem;
238 int ret;
239
240 spin_lock_irq(&ctx->spu->register_lock);
241 ret = -EAGAIN;
242 if (in_be32(&prob->dma_querytype_RW))
243 goto out;
244 ret = 0;
245 out_be32(&prob->dma_querymask_RW, mask);
246 out_be32(&prob->dma_querytype_RW, mode);
247out:
248 spin_unlock_irq(&ctx->spu->register_lock);
249 return ret;
250}
251
252static u32 spu_hw_read_mfc_tagstatus(struct spu_context * ctx)
253{
254 return in_be32(&ctx->spu->problem->dma_tagstatus_R);
255}
256
257static u32 spu_hw_get_mfc_free_elements(struct spu_context *ctx)
258{
259 return in_be32(&ctx->spu->problem->dma_qstatus_R);
260}
261
262static int spu_hw_send_mfc_command(struct spu_context *ctx,
263 struct mfc_dma_command *cmd)
264{
265 u32 status;
266 struct spu_problem *prob = ctx->spu->problem;
267
268 spin_lock_irq(&ctx->spu->register_lock);
269 out_be32(&prob->mfc_lsa_W, cmd->lsa);
270 out_be64(&prob->mfc_ea_W, cmd->ea);
271 out_be32(&prob->mfc_union_W.by32.mfc_size_tag32,
272 cmd->size << 16 | cmd->tag);
273 out_be32(&prob->mfc_union_W.by32.mfc_class_cmd32,
274 cmd->class << 16 | cmd->cmd);
275 status = in_be32(&prob->mfc_union_W.by32.mfc_class_cmd32);
276 spin_unlock_irq(&ctx->spu->register_lock);
277
278 switch (status & 0xffff) {
279 case 0:
280 return 0;
281 case 2:
282 return -EAGAIN;
283 default:
284 return -EINVAL;
285 }
286}
287
235struct spu_context_ops spu_hw_ops = { 288struct spu_context_ops spu_hw_ops = {
236 .mbox_read = spu_hw_mbox_read, 289 .mbox_read = spu_hw_mbox_read,
237 .mbox_stat_read = spu_hw_mbox_stat_read, 290 .mbox_stat_read = spu_hw_mbox_stat_read,
@@ -252,4 +305,8 @@ struct spu_context_ops spu_hw_ops = {
252 .get_ls = spu_hw_get_ls, 305 .get_ls = spu_hw_get_ls,
253 .runcntl_write = spu_hw_runcntl_write, 306 .runcntl_write = spu_hw_runcntl_write,
254 .runcntl_stop = spu_hw_runcntl_stop, 307 .runcntl_stop = spu_hw_runcntl_stop,
308 .set_mfc_query = spu_hw_set_mfc_query,
309 .read_mfc_tagstatus = spu_hw_read_mfc_tagstatus,
310 .get_mfc_free_elements = spu_hw_get_mfc_free_elements,
311 .send_mfc_command = spu_hw_send_mfc_command,
255}; 312};
diff --git a/arch/powerpc/platforms/cell/spufs/inode.c b/arch/powerpc/platforms/cell/spufs/inode.c
index b3962c3a0348..d9554199afa7 100644
--- a/arch/powerpc/platforms/cell/spufs/inode.c
+++ b/arch/powerpc/platforms/cell/spufs/inode.c
@@ -103,7 +103,7 @@ spufs_setattr(struct dentry *dentry, struct iattr *attr)
103 103
104static int 104static int
105spufs_new_file(struct super_block *sb, struct dentry *dentry, 105spufs_new_file(struct super_block *sb, struct dentry *dentry,
106 struct file_operations *fops, int mode, 106 const struct file_operations *fops, int mode,
107 struct spu_context *ctx) 107 struct spu_context *ctx)
108{ 108{
109 static struct inode_operations spufs_file_iops = { 109 static struct inode_operations spufs_file_iops = {
@@ -241,7 +241,7 @@ spufs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
241 inode->i_gid = dir->i_gid; 241 inode->i_gid = dir->i_gid;
242 inode->i_mode &= S_ISGID; 242 inode->i_mode &= S_ISGID;
243 } 243 }
244 ctx = alloc_spu_context(inode->i_mapping); 244 ctx = alloc_spu_context();
245 SPUFS_I(inode)->i_ctx = ctx; 245 SPUFS_I(inode)->i_ctx = ctx;
246 if (!ctx) 246 if (!ctx)
247 goto out_iput; 247 goto out_iput;
@@ -442,7 +442,7 @@ static struct file_system_type spufs_type = {
442 .kill_sb = kill_litter_super, 442 .kill_sb = kill_litter_super,
443}; 443};
444 444
445static int spufs_init(void) 445static int __init spufs_init(void)
446{ 446{
447 int ret; 447 int ret;
448 ret = -ENOMEM; 448 ret = -ENOMEM;
@@ -472,7 +472,7 @@ out:
472} 472}
473module_init(spufs_init); 473module_init(spufs_init);
474 474
475static void spufs_exit(void) 475static void __exit spufs_exit(void)
476{ 476{
477 spu_sched_exit(); 477 spu_sched_exit();
478 unregister_spu_syscalls(&spufs_calls); 478 unregister_spu_syscalls(&spufs_calls);
diff --git a/arch/powerpc/platforms/cell/spufs/run.c b/arch/powerpc/platforms/cell/spufs/run.c
index 18ea8866c61a..c04e078c0fe5 100644
--- a/arch/powerpc/platforms/cell/spufs/run.c
+++ b/arch/powerpc/platforms/cell/spufs/run.c
@@ -76,6 +76,90 @@ static inline int spu_reacquire_runnable(struct spu_context *ctx, u32 *npc,
76 return 0; 76 return 0;
77} 77}
78 78
79/*
80 * SPU syscall restarting is tricky because we violate the basic
81 * assumption that the signal handler is running on the interrupted
82 * thread. Here instead, the handler runs on PowerPC user space code,
83 * while the syscall was called from the SPU.
84 * This means we can only do a very rough approximation of POSIX
85 * signal semantics.
86 */
87int spu_handle_restartsys(struct spu_context *ctx, long *spu_ret,
88 unsigned int *npc)
89{
90 int ret;
91
92 switch (*spu_ret) {
93 case -ERESTARTSYS:
94 case -ERESTARTNOINTR:
95 /*
96 * Enter the regular syscall restarting for
97 * sys_spu_run, then restart the SPU syscall
98 * callback.
99 */
100 *npc -= 8;
101 ret = -ERESTARTSYS;
102 break;
103 case -ERESTARTNOHAND:
104 case -ERESTART_RESTARTBLOCK:
105 /*
106 * Restart block is too hard for now, just return -EINTR
107 * to the SPU.
108 * ERESTARTNOHAND comes from sys_pause, we also return
109 * -EINTR from there.
110 * Assume that we need to be restarted ourselves though.
111 */
112 *spu_ret = -EINTR;
113 ret = -ERESTARTSYS;
114 break;
115 default:
116 printk(KERN_WARNING "%s: unexpected return code %ld\n",
117 __FUNCTION__, *spu_ret);
118 ret = 0;
119 }
120 return ret;
121}
122
123int spu_process_callback(struct spu_context *ctx)
124{
125 struct spu_syscall_block s;
126 u32 ls_pointer, npc;
127 char *ls;
128 long spu_ret;
129 int ret;
130
131 /* get syscall block from local store */
132 npc = ctx->ops->npc_read(ctx);
133 ls = ctx->ops->get_ls(ctx);
134 ls_pointer = *(u32*)(ls + npc);
135 if (ls_pointer > (LS_SIZE - sizeof(s)))
136 return -EFAULT;
137 memcpy(&s, ls + ls_pointer, sizeof (s));
138
139 /* do actual syscall without pinning the spu */
140 ret = 0;
141 spu_ret = -ENOSYS;
142 npc += 4;
143
144 if (s.nr_ret < __NR_syscalls) {
145 spu_release(ctx);
146 /* do actual system call from here */
147 spu_ret = spu_sys_callback(&s);
148 if (spu_ret <= -ERESTARTSYS) {
149 ret = spu_handle_restartsys(ctx, &spu_ret, &npc);
150 }
151 spu_acquire(ctx);
152 if (ret == -ERESTARTSYS)
153 return ret;
154 }
155
156 /* write result, jump over indirect pointer */
157 memcpy(ls + ls_pointer, &spu_ret, sizeof (spu_ret));
158 ctx->ops->npc_write(ctx, npc);
159 ctx->ops->runcntl_write(ctx, SPU_RUNCNTL_RUNNABLE);
160 return ret;
161}
162
79static inline int spu_process_events(struct spu_context *ctx) 163static inline int spu_process_events(struct spu_context *ctx)
80{ 164{
81 struct spu *spu = ctx->spu; 165 struct spu *spu = ctx->spu;
@@ -107,6 +191,13 @@ long spufs_run_spu(struct file *file, struct spu_context *ctx,
107 ret = spufs_wait(ctx->stop_wq, spu_stopped(ctx, status)); 191 ret = spufs_wait(ctx->stop_wq, spu_stopped(ctx, status));
108 if (unlikely(ret)) 192 if (unlikely(ret))
109 break; 193 break;
194 if ((*status & SPU_STATUS_STOPPED_BY_STOP) &&
195 (*status >> SPU_STOP_STATUS_SHIFT == 0x2104)) {
196 ret = spu_process_callback(ctx);
197 if (ret)
198 break;
199 *status &= ~SPU_STATUS_STOPPED_BY_STOP;
200 }
110 if (unlikely(ctx->state != SPU_STATE_RUNNABLE)) { 201 if (unlikely(ctx->state != SPU_STATE_RUNNABLE)) {
111 ret = spu_reacquire_runnable(ctx, npc, status); 202 ret = spu_reacquire_runnable(ctx, npc, status);
112 if (ret) 203 if (ret)
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c
index 963182fbd1aa..bf652cd77000 100644
--- a/arch/powerpc/platforms/cell/spufs/sched.c
+++ b/arch/powerpc/platforms/cell/spufs/sched.c
@@ -180,6 +180,7 @@ static inline void bind_context(struct spu *spu, struct spu_context *ctx)
180 spu->ibox_callback = spufs_ibox_callback; 180 spu->ibox_callback = spufs_ibox_callback;
181 spu->wbox_callback = spufs_wbox_callback; 181 spu->wbox_callback = spufs_wbox_callback;
182 spu->stop_callback = spufs_stop_callback; 182 spu->stop_callback = spufs_stop_callback;
183 spu->mfc_callback = spufs_mfc_callback;
183 mb(); 184 mb();
184 spu_unmap_mappings(ctx); 185 spu_unmap_mappings(ctx);
185 spu_restore(&ctx->csa, spu); 186 spu_restore(&ctx->csa, spu);
@@ -197,6 +198,7 @@ static inline void unbind_context(struct spu *spu, struct spu_context *ctx)
197 spu->ibox_callback = NULL; 198 spu->ibox_callback = NULL;
198 spu->wbox_callback = NULL; 199 spu->wbox_callback = NULL;
199 spu->stop_callback = NULL; 200 spu->stop_callback = NULL;
201 spu->mfc_callback = NULL;
200 spu->mm = NULL; 202 spu->mm = NULL;
201 spu->pid = 0; 203 spu->pid = 0;
202 spu->prio = MAX_PRIO; 204 spu->prio = MAX_PRIO;
diff --git a/arch/powerpc/platforms/cell/spufs/spufs.h b/arch/powerpc/platforms/cell/spufs/spufs.h
index db2601f0abd5..4485738e2102 100644
--- a/arch/powerpc/platforms/cell/spufs/spufs.h
+++ b/arch/powerpc/platforms/cell/spufs/spufs.h
@@ -43,7 +43,11 @@ struct spu_context {
43 struct spu *spu; /* pointer to a physical SPU */ 43 struct spu *spu; /* pointer to a physical SPU */
44 struct spu_state csa; /* SPU context save area. */ 44 struct spu_state csa; /* SPU context save area. */
45 spinlock_t mmio_lock; /* protects mmio access */ 45 spinlock_t mmio_lock; /* protects mmio access */
46 struct address_space *local_store;/* local store backing store */ 46 struct address_space *local_store; /* local store mapping. */
47 struct address_space *mfc; /* 'mfc' area mappings. */
48 struct address_space *cntl; /* 'control' area mappings. */
49 struct address_space *signal1; /* 'signal1' area mappings. */
50 struct address_space *signal2; /* 'signal2' area mappings. */
47 51
48 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state; 52 enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
49 struct rw_semaphore state_sema; 53 struct rw_semaphore state_sema;
@@ -55,13 +59,27 @@ struct spu_context {
55 wait_queue_head_t ibox_wq; 59 wait_queue_head_t ibox_wq;
56 wait_queue_head_t wbox_wq; 60 wait_queue_head_t wbox_wq;
57 wait_queue_head_t stop_wq; 61 wait_queue_head_t stop_wq;
62 wait_queue_head_t mfc_wq;
58 struct fasync_struct *ibox_fasync; 63 struct fasync_struct *ibox_fasync;
59 struct fasync_struct *wbox_fasync; 64 struct fasync_struct *wbox_fasync;
65 struct fasync_struct *mfc_fasync;
66 u32 tagwait;
60 struct spu_context_ops *ops; 67 struct spu_context_ops *ops;
61 struct work_struct reap_work; 68 struct work_struct reap_work;
62 u64 flags; 69 u64 flags;
63}; 70};
64 71
72struct mfc_dma_command {
73 int32_t pad; /* reserved */
74 uint32_t lsa; /* local storage address */
75 uint64_t ea; /* effective address */
76 uint16_t size; /* transfer size */
77 uint16_t tag; /* command tag */
78 uint16_t class; /* class ID */
79 uint16_t cmd; /* command opcode */
80};
81
82
65/* SPU context query/set operations. */ 83/* SPU context query/set operations. */
66struct spu_context_ops { 84struct spu_context_ops {
67 int (*mbox_read) (struct spu_context * ctx, u32 * data); 85 int (*mbox_read) (struct spu_context * ctx, u32 * data);
@@ -84,6 +102,11 @@ struct spu_context_ops {
84 char*(*get_ls) (struct spu_context * ctx); 102 char*(*get_ls) (struct spu_context * ctx);
85 void (*runcntl_write) (struct spu_context * ctx, u32 data); 103 void (*runcntl_write) (struct spu_context * ctx, u32 data);
86 void (*runcntl_stop) (struct spu_context * ctx); 104 void (*runcntl_stop) (struct spu_context * ctx);
105 int (*set_mfc_query)(struct spu_context * ctx, u32 mask, u32 mode);
106 u32 (*read_mfc_tagstatus)(struct spu_context * ctx);
107 u32 (*get_mfc_free_elements)(struct spu_context *ctx);
108 int (*send_mfc_command)(struct spu_context *ctx,
109 struct mfc_dma_command *cmd);
87}; 110};
88 111
89extern struct spu_context_ops spu_hw_ops; 112extern struct spu_context_ops spu_hw_ops;
@@ -106,7 +129,7 @@ long spufs_create_thread(struct nameidata *nd,
106extern struct file_operations spufs_context_fops; 129extern struct file_operations spufs_context_fops;
107 130
108/* context management */ 131/* context management */
109struct spu_context * alloc_spu_context(struct address_space *local_store); 132struct spu_context * alloc_spu_context(void);
110void destroy_spu_context(struct kref *kref); 133void destroy_spu_context(struct kref *kref);
111struct spu_context * get_spu_context(struct spu_context *ctx); 134struct spu_context * get_spu_context(struct spu_context *ctx);
112int put_spu_context(struct spu_context *ctx); 135int put_spu_context(struct spu_context *ctx);
@@ -159,5 +182,6 @@ size_t spu_ibox_read(struct spu_context *ctx, u32 *data);
159void spufs_ibox_callback(struct spu *spu); 182void spufs_ibox_callback(struct spu *spu);
160void spufs_wbox_callback(struct spu *spu); 183void spufs_wbox_callback(struct spu *spu);
161void spufs_stop_callback(struct spu *spu); 184void spufs_stop_callback(struct spu *spu);
185void spufs_mfc_callback(struct spu *spu);
162 186
163#endif 187#endif
diff --git a/arch/powerpc/platforms/cell/spufs/switch.c b/arch/powerpc/platforms/cell/spufs/switch.c
index 212db28531fa..97898d5d34e5 100644
--- a/arch/powerpc/platforms/cell/spufs/switch.c
+++ b/arch/powerpc/platforms/cell/spufs/switch.c
@@ -2145,7 +2145,8 @@ static void init_priv1(struct spu_state *csa)
2145 csa->priv1.int_mask_class1_RW = CLASS1_ENABLE_SEGMENT_FAULT_INTR | 2145 csa->priv1.int_mask_class1_RW = CLASS1_ENABLE_SEGMENT_FAULT_INTR |
2146 CLASS1_ENABLE_STORAGE_FAULT_INTR; 2146 CLASS1_ENABLE_STORAGE_FAULT_INTR;
2147 csa->priv1.int_mask_class2_RW = CLASS2_ENABLE_SPU_STOP_INTR | 2147 csa->priv1.int_mask_class2_RW = CLASS2_ENABLE_SPU_STOP_INTR |
2148 CLASS2_ENABLE_SPU_HALT_INTR; 2148 CLASS2_ENABLE_SPU_HALT_INTR |
2149 CLASS2_ENABLE_SPU_DMA_TAG_GROUP_COMPLETE_INTR;
2149} 2150}
2150 2151
2151static void init_priv2(struct spu_state *csa) 2152static void init_priv2(struct spu_state *csa)
diff --git a/arch/powerpc/platforms/chrp/chrp.h b/arch/powerpc/platforms/chrp/chrp.h
index 814f54742e0f..63f0aee4c158 100644
--- a/arch/powerpc/platforms/chrp/chrp.h
+++ b/arch/powerpc/platforms/chrp/chrp.h
@@ -8,4 +8,4 @@ extern int chrp_set_rtc_time(struct rtc_time *);
8extern long chrp_time_init(void); 8extern long chrp_time_init(void);
9 9
10extern void chrp_find_bridges(void); 10extern void chrp_find_bridges(void);
11extern void chrp_event_scan(void); 11extern void chrp_event_scan(unsigned long);
diff --git a/arch/powerpc/platforms/chrp/setup.c b/arch/powerpc/platforms/chrp/setup.c
index 8bf4307e323d..23a201718704 100644
--- a/arch/powerpc/platforms/chrp/setup.c
+++ b/arch/powerpc/platforms/chrp/setup.c
@@ -35,6 +35,7 @@
35#include <linux/root_dev.h> 35#include <linux/root_dev.h>
36#include <linux/initrd.h> 36#include <linux/initrd.h>
37#include <linux/module.h> 37#include <linux/module.h>
38#include <linux/timer.h>
38 39
39#include <asm/io.h> 40#include <asm/io.h>
40#include <asm/pgtable.h> 41#include <asm/pgtable.h>
@@ -61,6 +62,10 @@ EXPORT_SYMBOL(_chrp_type);
61 62
62struct mpic *chrp_mpic; 63struct mpic *chrp_mpic;
63 64
65/* Used for doing CHRP event-scans */
66DEFINE_PER_CPU(struct timer_list, heartbeat_timer);
67unsigned long event_scan_interval;
68
64/* 69/*
65 * XXX this should be in xmon.h, but putting it there means xmon.h 70 * XXX this should be in xmon.h, but putting it there means xmon.h
66 * has to include <linux/interrupt.h> (to get irqreturn_t), which 71 * has to include <linux/interrupt.h> (to get irqreturn_t), which
@@ -229,8 +234,6 @@ void __init chrp_setup_arch(void)
229{ 234{
230 struct device_node *root = find_path_device ("/"); 235 struct device_node *root = find_path_device ("/");
231 char *machine = NULL; 236 char *machine = NULL;
232 struct device_node *device;
233 unsigned int *p = NULL;
234 237
235 /* init to some ~sane value until calibrate_delay() runs */ 238 /* init to some ~sane value until calibrate_delay() runs */
236 loops_per_jiffy = 50000000/HZ; 239 loops_per_jiffy = 50000000/HZ;
@@ -287,23 +290,12 @@ void __init chrp_setup_arch(void)
287 */ 290 */
288 sio_init(); 291 sio_init();
289 292
290 /* Get the event scan rate for the rtas so we know how
291 * often it expects a heartbeat. -- Cort
292 */
293 device = find_devices("rtas");
294 if (device)
295 p = (unsigned int *) get_property
296 (device, "rtas-event-scan-rate", NULL);
297 if (p && *p) {
298 ppc_md.heartbeat = chrp_event_scan;
299 ppc_md.heartbeat_reset = HZ / (*p * 30) - 1;
300 ppc_md.heartbeat_count = 1;
301 printk("RTAS Event Scan Rate: %u (%lu jiffies)\n",
302 *p, ppc_md.heartbeat_reset);
303 }
304
305 pci_create_OF_bus_map(); 293 pci_create_OF_bus_map();
306 294
295#ifdef CONFIG_SMP
296 smp_ops = &chrp_smp_ops;
297#endif /* CONFIG_SMP */
298
307 /* 299 /*
308 * Print the banner, then scroll down so boot progress 300 * Print the banner, then scroll down so boot progress
309 * can be printed. -- Cort 301 * can be printed. -- Cort
@@ -312,7 +304,7 @@ void __init chrp_setup_arch(void)
312} 304}
313 305
314void 306void
315chrp_event_scan(void) 307chrp_event_scan(unsigned long unused)
316{ 308{
317 unsigned char log[1024]; 309 unsigned char log[1024];
318 int ret = 0; 310 int ret = 0;
@@ -320,7 +312,8 @@ chrp_event_scan(void)
320 /* XXX: we should loop until the hardware says no more error logs -- Cort */ 312 /* XXX: we should loop until the hardware says no more error logs -- Cort */
321 rtas_call(rtas_token("event-scan"), 4, 1, &ret, 0xffffffff, 0, 313 rtas_call(rtas_token("event-scan"), 4, 1, &ret, 0xffffffff, 0,
322 __pa(log), 1024); 314 __pa(log), 1024);
323 ppc_md.heartbeat_count = ppc_md.heartbeat_reset; 315 mod_timer(&__get_cpu_var(heartbeat_timer),
316 jiffies + event_scan_interval);
324} 317}
325 318
326/* 319/*
@@ -465,6 +458,9 @@ void __init chrp_init_IRQ(void)
465void __init 458void __init
466chrp_init2(void) 459chrp_init2(void)
467{ 460{
461 struct device_node *device;
462 unsigned int *p = NULL;
463
468#ifdef CONFIG_NVRAM 464#ifdef CONFIG_NVRAM
469 chrp_nvram_init(); 465 chrp_nvram_init();
470#endif 466#endif
@@ -476,12 +472,53 @@ chrp_init2(void)
476 request_region(0x80,0x10,"dma page reg"); 472 request_region(0x80,0x10,"dma page reg");
477 request_region(0xc0,0x20,"dma2"); 473 request_region(0xc0,0x20,"dma2");
478 474
475 /* Get the event scan rate for the rtas so we know how
476 * often it expects a heartbeat. -- Cort
477 */
478 device = find_devices("rtas");
479 if (device)
480 p = (unsigned int *) get_property
481 (device, "rtas-event-scan-rate", NULL);
482 if (p && *p) {
483 /*
484 * Arrange to call chrp_event_scan at least *p times
485 * per minute. We use 59 rather than 60 here so that
486 * the rate will be slightly higher than the minimum.
487 * This all assumes we don't do hotplug CPU on any
488 * machine that needs the event scans done.
489 */
490 unsigned long interval, offset;
491 int cpu, ncpus;
492 struct timer_list *timer;
493
494 interval = HZ * 59 / *p;
495 offset = HZ;
496 ncpus = num_online_cpus();
497 event_scan_interval = ncpus * interval;
498 for (cpu = 0; cpu < ncpus; ++cpu) {
499 timer = &per_cpu(heartbeat_timer, cpu);
500 setup_timer(timer, chrp_event_scan, 0);
501 timer->expires = jiffies + offset;
502 add_timer_on(timer, cpu);
503 offset += interval;
504 }
505 printk("RTAS Event Scan Rate: %u (%lu jiffies)\n",
506 *p, interval);
507 }
508
479 if (ppc_md.progress) 509 if (ppc_md.progress)
480 ppc_md.progress(" Have fun! ", 0x7777); 510 ppc_md.progress(" Have fun! ", 0x7777);
481} 511}
482 512
483void __init chrp_init(void) 513static int __init chrp_probe(void)
484{ 514{
515 char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
516 "device_type", NULL);
517 if (dtype == NULL)
518 return 0;
519 if (strcmp(dtype, "chrp"))
520 return 0;
521
485 ISA_DMA_THRESHOLD = ~0L; 522 ISA_DMA_THRESHOLD = ~0L;
486 DMA_MODE_READ = 0x44; 523 DMA_MODE_READ = 0x44;
487 DMA_MODE_WRITE = 0x48; 524 DMA_MODE_WRITE = 0x48;
diff --git a/arch/powerpc/platforms/chrp/time.c b/arch/powerpc/platforms/chrp/time.c
index 12c6f689b1aa..7d7889026936 100644
--- a/arch/powerpc/platforms/chrp/time.c
+++ b/arch/powerpc/platforms/chrp/time.c
@@ -120,33 +120,15 @@ int chrp_set_rtc_time(struct rtc_time *tmarg)
120void chrp_get_rtc_time(struct rtc_time *tm) 120void chrp_get_rtc_time(struct rtc_time *tm)
121{ 121{
122 unsigned int year, mon, day, hour, min, sec; 122 unsigned int year, mon, day, hour, min, sec;
123 int uip, i;
124 123
125 /* The Linux interpretation of the CMOS clock register contents: 124 do {
126 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
127 * RTC registers show the second which has precisely just started.
128 * Let's hope other operating systems interpret the RTC the same way.
129 */
130
131 /* Since the UIP flag is set for about 2.2 ms and the clock
132 * is typically written with a precision of 1 jiffy, trying
133 * to obtain a precision better than a few milliseconds is
134 * an illusion. Only consistency is interesting, this also
135 * allows to use the routine for /dev/rtc without a potential
136 * 1 second kernel busy loop triggered by any reader of /dev/rtc.
137 */
138
139 for ( i = 0; i<1000000; i++) {
140 uip = chrp_cmos_clock_read(RTC_FREQ_SELECT);
141 sec = chrp_cmos_clock_read(RTC_SECONDS); 125 sec = chrp_cmos_clock_read(RTC_SECONDS);
142 min = chrp_cmos_clock_read(RTC_MINUTES); 126 min = chrp_cmos_clock_read(RTC_MINUTES);
143 hour = chrp_cmos_clock_read(RTC_HOURS); 127 hour = chrp_cmos_clock_read(RTC_HOURS);
144 day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH); 128 day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH);
145 mon = chrp_cmos_clock_read(RTC_MONTH); 129 mon = chrp_cmos_clock_read(RTC_MONTH);
146 year = chrp_cmos_clock_read(RTC_YEAR); 130 year = chrp_cmos_clock_read(RTC_YEAR);
147 uip |= chrp_cmos_clock_read(RTC_FREQ_SELECT); 131 } while (sec != chrp_cmos_clock_read(RTC_SECONDS));
148 if ((uip & RTC_UIP)==0) break;
149 }
150 132
151 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 133 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
152 BCD_TO_BIN(sec); 134 BCD_TO_BIN(sec);
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index fa4550611c11..6ce8a404ba6b 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -675,18 +675,20 @@ static void iseries_dedicated_idle(void)
675void __init iSeries_init_IRQ(void) { } 675void __init iSeries_init_IRQ(void) { }
676#endif 676#endif
677 677
678static int __init iseries_probe(int platform) 678static int __init iseries_probe(void)
679{ 679{
680 if (PLATFORM_ISERIES_LPAR != platform) 680 unsigned long root = of_get_flat_dt_root();
681 if (!of_flat_dt_is_compatible(root, "IBM,iSeries"))
681 return 0; 682 return 0;
682 683
683 ppc64_firmware_features |= FW_FEATURE_ISERIES; 684 powerpc_firmware_features |= FW_FEATURE_ISERIES;
684 ppc64_firmware_features |= FW_FEATURE_LPAR; 685 powerpc_firmware_features |= FW_FEATURE_LPAR;
685 686
686 return 1; 687 return 1;
687} 688}
688 689
689struct machdep_calls __initdata iseries_md = { 690define_machine(iseries) {
691 .name = "iSeries",
690 .setup_arch = iSeries_setup_arch, 692 .setup_arch = iSeries_setup_arch,
691 .show_cpuinfo = iSeries_show_cpuinfo, 693 .show_cpuinfo = iSeries_show_cpuinfo,
692 .init_IRQ = iSeries_init_IRQ, 694 .init_IRQ = iSeries_init_IRQ,
@@ -930,7 +932,6 @@ void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
930 932
931 /* /chosen */ 933 /* /chosen */
932 dt_start_node(dt, "chosen"); 934 dt_start_node(dt, "chosen");
933 dt_prop_u32(dt, "linux,platform", PLATFORM_ISERIES_LPAR);
934 dt_prop_str(dt, "bootargs", cmd_line); 935 dt_prop_str(dt, "bootargs", cmd_line);
935 if (cmd_mem_limit) 936 if (cmd_mem_limit)
936 dt_prop_u64(dt, "linux,memory-limit", cmd_mem_limit); 937 dt_prop_u64(dt, "linux,memory-limit", cmd_mem_limit);
diff --git a/arch/powerpc/platforms/maple/setup.c b/arch/powerpc/platforms/maple/setup.c
index ec5c1e10c407..24c0aef4ea39 100644
--- a/arch/powerpc/platforms/maple/setup.c
+++ b/arch/powerpc/platforms/maple/setup.c
@@ -259,9 +259,10 @@ static void __init maple_progress(char *s, unsigned short hex)
259/* 259/*
260 * Called very early, MMU is off, device-tree isn't unflattened 260 * Called very early, MMU is off, device-tree isn't unflattened
261 */ 261 */
262static int __init maple_probe(int platform) 262static int __init maple_probe(void)
263{ 263{
264 if (platform != PLATFORM_MAPLE) 264 unsigned long root = of_get_flat_dt_root();
265 if (!of_flat_dt_is_compatible(root, "Momentum,Maple"))
265 return 0; 266 return 0;
266 /* 267 /*
267 * On U3, the DART (iommu) must be allocated now since it 268 * On U3, the DART (iommu) must be allocated now since it
@@ -274,7 +275,8 @@ static int __init maple_probe(int platform)
274 return 1; 275 return 1;
275} 276}
276 277
277struct machdep_calls __initdata maple_md = { 278define_machine(maple_md) {
279 .name = "Maple",
278 .probe = maple_probe, 280 .probe = maple_probe,
279 .setup_arch = maple_setup_arch, 281 .setup_arch = maple_setup_arch,
280 .init_early = maple_init_early, 282 .init_early = maple_init_early,
@@ -290,7 +292,7 @@ struct machdep_calls __initdata maple_md = {
290 .get_rtc_time = maple_get_rtc_time, 292 .get_rtc_time = maple_get_rtc_time,
291 .calibrate_decr = generic_calibrate_decr, 293 .calibrate_decr = generic_calibrate_decr,
292 .progress = maple_progress, 294 .progress = maple_progress,
293 .idle_loop = native_idle, 295 .power_save = power4_idle,
294#ifdef CONFIG_KEXEC 296#ifdef CONFIG_KEXEC
295 .machine_kexec = default_machine_kexec, 297 .machine_kexec = default_machine_kexec,
296 .machine_kexec_prepare = default_machine_kexec_prepare, 298 .machine_kexec_prepare = default_machine_kexec_prepare,
diff --git a/arch/powerpc/platforms/maple/time.c b/arch/powerpc/platforms/maple/time.c
index 5e6981d17379..b9a2b3d4bf33 100644
--- a/arch/powerpc/platforms/maple/time.c
+++ b/arch/powerpc/platforms/maple/time.c
@@ -60,34 +60,14 @@ static void maple_clock_write(unsigned long val, int addr)
60 60
61void maple_get_rtc_time(struct rtc_time *tm) 61void maple_get_rtc_time(struct rtc_time *tm)
62{ 62{
63 int uip, i; 63 do {
64
65 /* The Linux interpretation of the CMOS clock register contents:
66 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
67 * RTC registers show the second which has precisely just started.
68 * Let's hope other operating systems interpret the RTC the same way.
69 */
70
71 /* Since the UIP flag is set for about 2.2 ms and the clock
72 * is typically written with a precision of 1 jiffy, trying
73 * to obtain a precision better than a few milliseconds is
74 * an illusion. Only consistency is interesting, this also
75 * allows to use the routine for /dev/rtc without a potential
76 * 1 second kernel busy loop triggered by any reader of /dev/rtc.
77 */
78
79 for (i = 0; i<1000000; i++) {
80 uip = maple_clock_read(RTC_FREQ_SELECT);
81 tm->tm_sec = maple_clock_read(RTC_SECONDS); 64 tm->tm_sec = maple_clock_read(RTC_SECONDS);
82 tm->tm_min = maple_clock_read(RTC_MINUTES); 65 tm->tm_min = maple_clock_read(RTC_MINUTES);
83 tm->tm_hour = maple_clock_read(RTC_HOURS); 66 tm->tm_hour = maple_clock_read(RTC_HOURS);
84 tm->tm_mday = maple_clock_read(RTC_DAY_OF_MONTH); 67 tm->tm_mday = maple_clock_read(RTC_DAY_OF_MONTH);
85 tm->tm_mon = maple_clock_read(RTC_MONTH); 68 tm->tm_mon = maple_clock_read(RTC_MONTH);
86 tm->tm_year = maple_clock_read(RTC_YEAR); 69 tm->tm_year = maple_clock_read(RTC_YEAR);
87 uip |= maple_clock_read(RTC_FREQ_SELECT); 70 } while (tm->tm_sec != maple_clock_read(RTC_SECONDS));
88 if ((uip & RTC_UIP)==0)
89 break;
90 }
91 71
92 if (!(maple_clock_read(RTC_CONTROL) & RTC_DM_BINARY) 72 if (!(maple_clock_read(RTC_CONTROL) & RTC_DM_BINARY)
93 || RTC_ALWAYS_BCD) { 73 || RTC_ALWAYS_BCD) {
diff --git a/arch/powerpc/platforms/powermac/bootx_init.c b/arch/powerpc/platforms/powermac/bootx_init.c
index fa8b4d7b5ded..eacbfd9beabc 100644
--- a/arch/powerpc/platforms/powermac/bootx_init.c
+++ b/arch/powerpc/platforms/powermac/bootx_init.c
@@ -161,9 +161,7 @@ static void __init bootx_dt_add_prop(char *name, void *data, int size,
161static void __init bootx_add_chosen_props(unsigned long base, 161static void __init bootx_add_chosen_props(unsigned long base,
162 unsigned long *mem_end) 162 unsigned long *mem_end)
163{ 163{
164 u32 val = _MACH_Pmac; 164 u32 val;
165
166 bootx_dt_add_prop("linux,platform", &val, 4, mem_end);
167 165
168 if (bootx_info->kernelParamsOffset) { 166 if (bootx_info->kernelParamsOffset) {
169 char *args = (char *)((unsigned long)bootx_info) + 167 char *args = (char *)((unsigned long)bootx_info) +
@@ -493,7 +491,7 @@ void __init bootx_init(unsigned long r3, unsigned long r4)
493 && (strcmp(model, "iMac,1") == 0 491 && (strcmp(model, "iMac,1") == 0
494 || strcmp(model, "PowerMac1,1") == 0)) { 492 || strcmp(model, "PowerMac1,1") == 0)) {
495 bootx_printf("iMac,1 detected, shutting down USB \n"); 493 bootx_printf("iMac,1 detected, shutting down USB \n");
496 out_le32((unsigned *)0x80880008, 1); /* XXX */ 494 out_le32((unsigned __iomem *)0x80880008, 1); /* XXX */
497 } 495 }
498 } 496 }
499 497
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index e49eddd5042d..a5063cd675c5 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -2951,7 +2951,7 @@ static void *pmac_early_vresume_data;
2951 2951
2952void pmac_set_early_video_resume(void (*proc)(void *data), void *data) 2952void pmac_set_early_video_resume(void (*proc)(void *data), void *data)
2953{ 2953{
2954 if (_machine != _MACH_Pmac) 2954 if (!machine_is(powermac))
2955 return; 2955 return;
2956 preempt_disable(); 2956 preempt_disable();
2957 pmac_early_vresume_proc = proc; 2957 pmac_early_vresume_proc = proc;
diff --git a/arch/powerpc/platforms/powermac/low_i2c.c b/arch/powerpc/platforms/powermac/low_i2c.c
index 87eb6bb7f0e7..e14f9ac55cf4 100644
--- a/arch/powerpc/platforms/powermac/low_i2c.c
+++ b/arch/powerpc/platforms/powermac/low_i2c.c
@@ -1457,6 +1457,9 @@ int __init pmac_i2c_init(void)
1457 return 0; 1457 return 0;
1458 i2c_inited = 1; 1458 i2c_inited = 1;
1459 1459
1460 if (!machine_is(powermac))
1461 return 0;
1462
1460 /* Probe keywest-i2c busses */ 1463 /* Probe keywest-i2c busses */
1461 kw_i2c_probe(); 1464 kw_i2c_probe();
1462 1465
diff --git a/arch/powerpc/platforms/powermac/nvram.c b/arch/powerpc/platforms/powermac/nvram.c
index 5fd28995c74c..262f967b880a 100644
--- a/arch/powerpc/platforms/powermac/nvram.c
+++ b/arch/powerpc/platforms/powermac/nvram.c
@@ -74,7 +74,7 @@ struct core99_header {
74 * Read and write the non-volatile RAM on PowerMacs and CHRP machines. 74 * Read and write the non-volatile RAM on PowerMacs and CHRP machines.
75 */ 75 */
76static int nvram_naddrs; 76static int nvram_naddrs;
77static volatile unsigned char *nvram_data; 77static volatile unsigned char __iomem *nvram_data;
78static int is_core_99; 78static int is_core_99;
79static int core99_bank = 0; 79static int core99_bank = 0;
80static int nvram_partitions[3]; 80static int nvram_partitions[3];
@@ -148,7 +148,7 @@ static ssize_t core99_nvram_size(void)
148} 148}
149 149
150#ifdef CONFIG_PPC32 150#ifdef CONFIG_PPC32
151static volatile unsigned char *nvram_addr; 151static volatile unsigned char __iomem *nvram_addr;
152static int nvram_mult; 152static int nvram_mult;
153 153
154static unsigned char direct_nvram_read_byte(int addr) 154static unsigned char direct_nvram_read_byte(int addr)
@@ -285,7 +285,7 @@ static int sm_erase_bank(int bank)
285 int stat, i; 285 int stat, i;
286 unsigned long timeout; 286 unsigned long timeout;
287 287
288 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE; 288 u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
289 289
290 DBG("nvram: Sharp/Micron Erasing bank %d...\n", bank); 290 DBG("nvram: Sharp/Micron Erasing bank %d...\n", bank);
291 291
@@ -317,7 +317,7 @@ static int sm_write_bank(int bank, u8* datas)
317 int i, stat = 0; 317 int i, stat = 0;
318 unsigned long timeout; 318 unsigned long timeout;
319 319
320 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE; 320 u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
321 321
322 DBG("nvram: Sharp/Micron Writing bank %d...\n", bank); 322 DBG("nvram: Sharp/Micron Writing bank %d...\n", bank);
323 323
@@ -352,7 +352,7 @@ static int amd_erase_bank(int bank)
352 int i, stat = 0; 352 int i, stat = 0;
353 unsigned long timeout; 353 unsigned long timeout;
354 354
355 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE; 355 u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
356 356
357 DBG("nvram: AMD Erasing bank %d...\n", bank); 357 DBG("nvram: AMD Erasing bank %d...\n", bank);
358 358
@@ -399,7 +399,7 @@ static int amd_write_bank(int bank, u8* datas)
399 int i, stat = 0; 399 int i, stat = 0;
400 unsigned long timeout; 400 unsigned long timeout;
401 401
402 u8* base = (u8 *)nvram_data + core99_bank*NVRAM_SIZE; 402 u8 __iomem *base = (u8 __iomem *)nvram_data + core99_bank*NVRAM_SIZE;
403 403
404 DBG("nvram: AMD Writing bank %d...\n", bank); 404 DBG("nvram: AMD Writing bank %d...\n", bank);
405 405
@@ -597,7 +597,7 @@ int __init pmac_nvram_init(void)
597 } 597 }
598 598
599#ifdef CONFIG_PPC32 599#ifdef CONFIG_PPC32
600 if (_machine == _MACH_chrp && nvram_naddrs == 1) { 600 if (machine_is(chrp) && nvram_naddrs == 1) {
601 nvram_data = ioremap(r1.start, s1); 601 nvram_data = ioremap(r1.start, s1);
602 nvram_mult = 1; 602 nvram_mult = 1;
603 ppc_md.nvram_read_val = direct_nvram_read_byte; 603 ppc_md.nvram_read_val = direct_nvram_read_byte;
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index de3f30e6b333..f5d8d15d74fa 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -1201,7 +1201,7 @@ void __init pmac_pcibios_after_init(void)
1201#ifdef CONFIG_PPC32 1201#ifdef CONFIG_PPC32
1202void pmac_pci_fixup_cardbus(struct pci_dev* dev) 1202void pmac_pci_fixup_cardbus(struct pci_dev* dev)
1203{ 1203{
1204 if (_machine != _MACH_Pmac) 1204 if (!machine_is(powermac))
1205 return; 1205 return;
1206 /* 1206 /*
1207 * Fix the interrupt routing on the various cardbus bridges 1207 * Fix the interrupt routing on the various cardbus bridges
@@ -1244,8 +1244,9 @@ void pmac_pci_fixup_pciata(struct pci_dev* dev)
1244 * On PowerMacs, we try to switch any PCI ATA controller to 1244 * On PowerMacs, we try to switch any PCI ATA controller to
1245 * fully native mode 1245 * fully native mode
1246 */ 1246 */
1247 if (_machine != _MACH_Pmac) 1247 if (!machine_is(powermac))
1248 return; 1248 return;
1249
1249 /* Some controllers don't have the class IDE */ 1250 /* Some controllers don't have the class IDE */
1250 if (dev->vendor == PCI_VENDOR_ID_PROMISE) 1251 if (dev->vendor == PCI_VENDOR_ID_PROMISE)
1251 switch(dev->device) { 1252 switch(dev->device) {
diff --git a/arch/powerpc/platforms/powermac/pfunc_base.c b/arch/powerpc/platforms/powermac/pfunc_base.c
index 9b7150f10414..a3bd3e728fa3 100644
--- a/arch/powerpc/platforms/powermac/pfunc_base.c
+++ b/arch/powerpc/platforms/powermac/pfunc_base.c
@@ -336,6 +336,8 @@ int __init pmac_pfunc_base_install(void)
336 return 0; 336 return 0;
337 pfbase_inited = 1; 337 pfbase_inited = 1;
338 338
339 if (!machine_is(powermac))
340 return 0;
339 341
340 DBG("Installing base platform functions...\n"); 342 DBG("Installing base platform functions...\n");
341 343
diff --git a/arch/powerpc/platforms/powermac/setup.c b/arch/powerpc/platforms/powermac/setup.c
index 385aab90c4d2..4d15e396655c 100644
--- a/arch/powerpc/platforms/powermac/setup.c
+++ b/arch/powerpc/platforms/powermac/setup.c
@@ -350,6 +350,13 @@ static void __init pmac_setup_arch(void)
350 smp_ops = &psurge_smp_ops; 350 smp_ops = &psurge_smp_ops;
351#endif 351#endif
352#endif /* CONFIG_SMP */ 352#endif /* CONFIG_SMP */
353
354#ifdef CONFIG_ADB
355 if (strstr(cmd_line, "adb_sync")) {
356 extern int __adb_probe_sync;
357 __adb_probe_sync = 1;
358 }
359#endif /* CONFIG_ADB */
353} 360}
354 361
355char *bootpath; 362char *bootpath;
@@ -576,30 +583,6 @@ pmac_halt(void)
576 pmac_power_off(); 583 pmac_power_off();
577} 584}
578 585
579#ifdef CONFIG_PPC32
580void __init pmac_init(void)
581{
582 /* isa_io_base gets set in pmac_pci_init */
583 isa_mem_base = PMAC_ISA_MEM_BASE;
584 pci_dram_offset = PMAC_PCI_DRAM_OFFSET;
585 ISA_DMA_THRESHOLD = ~0L;
586 DMA_MODE_READ = 1;
587 DMA_MODE_WRITE = 2;
588
589 ppc_md = pmac_md;
590
591#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
592#ifdef CONFIG_BLK_DEV_IDE_PMAC
593 ppc_ide_md.ide_init_hwif = pmac_ide_init_hwif_ports;
594 ppc_ide_md.default_io_base = pmac_ide_get_base;
595#endif /* CONFIG_BLK_DEV_IDE_PMAC */
596#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
597
598 if (ppc_md.progress) ppc_md.progress("pmac_init(): exit", 0);
599
600}
601#endif
602
603/* 586/*
604 * Early initialization. 587 * Early initialization.
605 */ 588 */
@@ -646,6 +629,12 @@ static int __init pmac_declare_of_platform_devices(void)
646{ 629{
647 struct device_node *np; 630 struct device_node *np;
648 631
632 if (machine_is(chrp))
633 return -1;
634
635 if (!machine_is(powermac))
636 return 0;
637
649 np = of_find_node_by_name(NULL, "valkyrie"); 638 np = of_find_node_by_name(NULL, "valkyrie");
650 if (np) 639 if (np)
651 of_platform_device_create(np, "valkyrie", NULL); 640 of_platform_device_create(np, "valkyrie", NULL);
@@ -666,12 +655,15 @@ device_initcall(pmac_declare_of_platform_devices);
666/* 655/*
667 * Called very early, MMU is off, device-tree isn't unflattened 656 * Called very early, MMU is off, device-tree isn't unflattened
668 */ 657 */
669static int __init pmac_probe(int platform) 658static int __init pmac_probe(void)
670{ 659{
671#ifdef CONFIG_PPC64 660 unsigned long root = of_get_flat_dt_root();
672 if (platform != PLATFORM_POWERMAC) 661
662 if (!of_flat_dt_is_compatible(root, "Power Macintosh") &&
663 !of_flat_dt_is_compatible(root, "MacRISC"))
673 return 0; 664 return 0;
674 665
666#ifdef CONFIG_PPC64
675 /* 667 /*
676 * On U3, the DART (iommu) must be allocated now since it 668 * On U3, the DART (iommu) must be allocated now since it
677 * has an impact on htab_initialize (due to the large page it 669 * has an impact on htab_initialize (due to the large page it
@@ -681,6 +673,23 @@ static int __init pmac_probe(int platform)
681 alloc_dart_table(); 673 alloc_dart_table();
682#endif 674#endif
683 675
676#ifdef CONFIG_PPC32
677 /* isa_io_base gets set in pmac_pci_init */
678 isa_mem_base = PMAC_ISA_MEM_BASE;
679 pci_dram_offset = PMAC_PCI_DRAM_OFFSET;
680 ISA_DMA_THRESHOLD = ~0L;
681 DMA_MODE_READ = 1;
682 DMA_MODE_WRITE = 2;
683
684#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
685#ifdef CONFIG_BLK_DEV_IDE_PMAC
686 ppc_ide_md.ide_init_hwif = pmac_ide_init_hwif_ports;
687 ppc_ide_md.default_io_base = pmac_ide_get_base;
688#endif /* CONFIG_BLK_DEV_IDE_PMAC */
689#endif /* defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE) */
690
691#endif /* CONFIG_PPC32 */
692
684#ifdef CONFIG_PMAC_SMU 693#ifdef CONFIG_PMAC_SMU
685 /* 694 /*
686 * SMU based G5s need some memory below 2Gb, at least the current 695 * SMU based G5s need some memory below 2Gb, at least the current
@@ -709,10 +718,8 @@ static int pmac_pci_probe_mode(struct pci_bus *bus)
709} 718}
710#endif 719#endif
711 720
712struct machdep_calls __initdata pmac_md = { 721define_machine(powermac) {
713#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64) 722 .name = "PowerMac",
714 .cpu_die = generic_mach_cpu_die,
715#endif
716 .probe = pmac_probe, 723 .probe = pmac_probe,
717 .setup_arch = pmac_setup_arch, 724 .setup_arch = pmac_setup_arch,
718 .init_early = pmac_init_early, 725 .init_early = pmac_init_early,
@@ -733,7 +740,7 @@ struct machdep_calls __initdata pmac_md = {
733 .progress = udbg_progress, 740 .progress = udbg_progress,
734#ifdef CONFIG_PPC64 741#ifdef CONFIG_PPC64
735 .pci_probe_mode = pmac_pci_probe_mode, 742 .pci_probe_mode = pmac_pci_probe_mode,
736 .idle_loop = native_idle, 743 .power_save = power4_idle,
737 .enable_pmcs = power4_enable_pmcs, 744 .enable_pmcs = power4_enable_pmcs,
738#ifdef CONFIG_KEXEC 745#ifdef CONFIG_KEXEC
739 .machine_kexec = default_machine_kexec, 746 .machine_kexec = default_machine_kexec,
@@ -746,4 +753,7 @@ struct machdep_calls __initdata pmac_md = {
746 .pcibios_after_init = pmac_pcibios_after_init, 753 .pcibios_after_init = pmac_pcibios_after_init,
747 .phys_mem_access_prot = pci_phys_mem_access_prot, 754 .phys_mem_access_prot = pci_phys_mem_access_prot,
748#endif 755#endif
756#if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PPC64)
757 .cpu_die = generic_mach_cpu_die,
758#endif
749}; 759};
diff --git a/arch/powerpc/platforms/powermac/time.c b/arch/powerpc/platforms/powermac/time.c
index 5d9afa1fa02d..890758aa9667 100644
--- a/arch/powerpc/platforms/powermac/time.c
+++ b/arch/powerpc/platforms/powermac/time.c
@@ -336,10 +336,10 @@ static struct pmu_sleep_notifier time_sleep_notifier = {
336 */ 336 */
337void __init pmac_calibrate_decr(void) 337void __init pmac_calibrate_decr(void)
338{ 338{
339#ifdef CONFIG_PM 339#if defined(CONFIG_PM) && defined(CONFIG_ADB_PMU)
340 /* XXX why here? */ 340 /* XXX why here? */
341 pmu_register_sleep_notifier(&time_sleep_notifier); 341 pmu_register_sleep_notifier(&time_sleep_notifier);
342#endif /* CONFIG_PM */ 342#endif
343 343
344 generic_calibrate_decr(); 344 generic_calibrate_decr();
345 345
diff --git a/arch/powerpc/platforms/powermac/udbg_scc.c b/arch/powerpc/platforms/powermac/udbg_scc.c
index c4352a8db644..b4fa9f03b461 100644
--- a/arch/powerpc/platforms/powermac/udbg_scc.c
+++ b/arch/powerpc/platforms/powermac/udbg_scc.c
@@ -116,7 +116,7 @@ void udbg_scc_init(int force_scc)
116 /* Setup for 57600 8N1 */ 116 /* Setup for 57600 8N1 */
117 if (ch == ch_a) 117 if (ch == ch_a)
118 addr += 0x20; 118 addr += 0x20;
119 sccc = (volatile u8 * __iomem) ioremap(addr & PAGE_MASK, PAGE_SIZE) ; 119 sccc = ioremap(addr & PAGE_MASK, PAGE_SIZE) ;
120 sccc += addr & ~PAGE_MASK; 120 sccc += addr & ~PAGE_MASK;
121 sccd = sccc + 0x10; 121 sccd = sccc + 0x10;
122 122
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
index 2ab9dcdfb415..9b2b1cb117b3 100644
--- a/arch/powerpc/platforms/pseries/eeh.c
+++ b/arch/powerpc/platforms/pseries/eeh.c
@@ -1018,7 +1018,7 @@ static int __init eeh_init_proc(void)
1018{ 1018{
1019 struct proc_dir_entry *e; 1019 struct proc_dir_entry *e;
1020 1020
1021 if (platform_is_pseries()) { 1021 if (machine_is(pseries)) {
1022 e = create_proc_entry("ppc64/eeh", 0, NULL); 1022 e = create_proc_entry("ppc64/eeh", 0, NULL);
1023 if (e) 1023 if (e)
1024 e->proc_fops = &proc_eeh_operations; 1024 e->proc_fops = &proc_eeh_operations;
diff --git a/arch/powerpc/platforms/pseries/eeh_driver.c b/arch/powerpc/platforms/pseries/eeh_driver.c
index b811d5ff92fe..cc2495a0cdd5 100644
--- a/arch/powerpc/platforms/pseries/eeh_driver.c
+++ b/arch/powerpc/platforms/pseries/eeh_driver.c
@@ -257,6 +257,7 @@ void handle_eeh_events (struct eeh_event *event)
257 struct pci_bus *frozen_bus; 257 struct pci_bus *frozen_bus;
258 int rc = 0; 258 int rc = 0;
259 enum pci_ers_result result = PCI_ERS_RESULT_NONE; 259 enum pci_ers_result result = PCI_ERS_RESULT_NONE;
260 const char *pci_str, *drv_str;
260 261
261 frozen_dn = find_device_pe(event->dn); 262 frozen_dn = find_device_pe(event->dn);
262 frozen_bus = pcibios_find_pci_bus(frozen_dn); 263 frozen_bus = pcibios_find_pci_bus(frozen_dn);
@@ -291,6 +292,13 @@ void handle_eeh_events (struct eeh_event *event)
291 292
292 frozen_pdn = PCI_DN(frozen_dn); 293 frozen_pdn = PCI_DN(frozen_dn);
293 frozen_pdn->eeh_freeze_count++; 294 frozen_pdn->eeh_freeze_count++;
295
296 pci_str = pci_name (frozen_pdn->pcidev);
297 drv_str = pcid_name (frozen_pdn->pcidev);
298 if (!pci_str) {
299 pci_str = pci_name (event->dev);
300 drv_str = pcid_name (event->dev);
301 }
294 302
295 if (frozen_pdn->eeh_freeze_count > EEH_MAX_ALLOWED_FREEZES) 303 if (frozen_pdn->eeh_freeze_count > EEH_MAX_ALLOWED_FREEZES)
296 goto hard_fail; 304 goto hard_fail;
@@ -306,9 +314,7 @@ void handle_eeh_events (struct eeh_event *event)
306 eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */); 314 eeh_slot_error_detail(frozen_pdn, 1 /* Temporary Error */);
307 printk(KERN_WARNING 315 printk(KERN_WARNING
308 "EEH: This PCI device has failed %d times since last reboot: %s - %s\n", 316 "EEH: This PCI device has failed %d times since last reboot: %s - %s\n",
309 frozen_pdn->eeh_freeze_count, 317 frozen_pdn->eeh_freeze_count, drv_str, pci_str);
310 pci_name (frozen_pdn->pcidev),
311 pcid_name(frozen_pdn->pcidev));
312 318
313 /* Walk the various device drivers attached to this slot through 319 /* Walk the various device drivers attached to this slot through
314 * a reset sequence, giving each an opportunity to do what it needs 320 * a reset sequence, giving each an opportunity to do what it needs
@@ -360,9 +366,7 @@ hard_fail:
360 "EEH: PCI device %s - %s has failed %d times \n" 366 "EEH: PCI device %s - %s has failed %d times \n"
361 "and has been permanently disabled. Please try reseating\n" 367 "and has been permanently disabled. Please try reseating\n"
362 "this device or replacing it.\n", 368 "this device or replacing it.\n",
363 pci_name (frozen_pdn->pcidev), 369 drv_str, pci_str, frozen_pdn->eeh_freeze_count);
364 pcid_name(frozen_pdn->pcidev),
365 frozen_pdn->eeh_freeze_count);
366 370
367 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */); 371 eeh_slot_error_detail(frozen_pdn, 2 /* Permanent Error */);
368 372
diff --git a/arch/powerpc/platforms/pseries/firmware.c b/arch/powerpc/platforms/pseries/firmware.c
index 989f4bc136cb..c01d8f0cbe6d 100644
--- a/arch/powerpc/platforms/pseries/firmware.c
+++ b/arch/powerpc/platforms/pseries/firmware.c
@@ -91,7 +91,7 @@ void __init fw_feature_init(void)
91 continue; 91 continue;
92 92
93 /* we have a match */ 93 /* we have a match */
94 ppc64_firmware_features |= 94 powerpc_firmware_features |=
95 firmware_features_table[i].val; 95 firmware_features_table[i].val;
96 break; 96 break;
97 } 97 }
diff --git a/arch/powerpc/platforms/pseries/hvconsole.c b/arch/powerpc/platforms/pseries/hvconsole.c
index 138e128a3886..ba6befd96636 100644
--- a/arch/powerpc/platforms/pseries/hvconsole.c
+++ b/arch/powerpc/platforms/pseries/hvconsole.c
@@ -62,6 +62,11 @@ int hvc_put_chars(uint32_t vtermno, const char *buf, int count)
62 unsigned long *lbuf = (unsigned long *) buf; 62 unsigned long *lbuf = (unsigned long *) buf;
63 long ret; 63 long ret;
64 64
65
66 /* hcall will ret H_PARAMETER if 'count' exceeds firmware max.*/
67 if (count > MAX_VIO_PUT_CHARS)
68 count = MAX_VIO_PUT_CHARS;
69
65 ret = plpar_hcall_norets(H_PUT_TERM_CHAR, vtermno, count, lbuf[0], 70 ret = plpar_hcall_norets(H_PUT_TERM_CHAR, vtermno, count, lbuf[0],
66 lbuf[1]); 71 lbuf[1]);
67 if (ret == H_Success) 72 if (ret == H_Success)
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 946ad59e3352..e97e67f5e079 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -120,7 +120,7 @@ static void fixup_winbond_82c105(struct pci_dev* dev)
120 int i; 120 int i;
121 unsigned int reg; 121 unsigned int reg;
122 122
123 if (!platform_is_pseries()) 123 if (!machine_is(pseries))
124 return; 124 return;
125 125
126 printk("Using INTC for W82c105 IDE controller.\n"); 126 printk("Using INTC for W82c105 IDE controller.\n");
diff --git a/arch/powerpc/platforms/pseries/pci_dlpar.c b/arch/powerpc/platforms/pseries/pci_dlpar.c
index 44abdeb9ca03..6bfacc217085 100644
--- a/arch/powerpc/platforms/pseries/pci_dlpar.c
+++ b/arch/powerpc/platforms/pseries/pci_dlpar.c
@@ -28,6 +28,7 @@
28#include <linux/pci.h> 28#include <linux/pci.h>
29#include <asm/pci-bridge.h> 29#include <asm/pci-bridge.h>
30#include <asm/ppc-pci.h> 30#include <asm/ppc-pci.h>
31#include <asm/firmware.h>
31 32
32static struct pci_bus * 33static struct pci_bus *
33find_bus_among_children(struct pci_bus *bus, 34find_bus_among_children(struct pci_bus *bus,
@@ -152,20 +153,24 @@ pcibios_pci_config_bridge(struct pci_dev *dev)
152void 153void
153pcibios_add_pci_devices(struct pci_bus * bus) 154pcibios_add_pci_devices(struct pci_bus * bus)
154{ 155{
155 int slotno, num; 156 int slotno, num, mode;
156 struct pci_dev *dev; 157 struct pci_dev *dev;
157 struct device_node *dn = pci_bus_to_OF_node(bus); 158 struct device_node *dn = pci_bus_to_OF_node(bus);
158 159
159 eeh_add_device_tree_early(dn); 160 eeh_add_device_tree_early(dn);
160 161
161 if (_machine == PLATFORM_PSERIES_LPAR) { 162 mode = PCI_PROBE_NORMAL;
163 if (ppc_md.pci_probe_mode)
164 mode = ppc_md.pci_probe_mode(bus);
165
166 if (mode == PCI_PROBE_DEVTREE) {
162 /* use ofdt-based probe */ 167 /* use ofdt-based probe */
163 of_scan_bus(dn, bus); 168 of_scan_bus(dn, bus);
164 if (!list_empty(&bus->devices)) { 169 if (!list_empty(&bus->devices)) {
165 pcibios_fixup_new_pci_devices(bus, 0); 170 pcibios_fixup_new_pci_devices(bus, 0);
166 pci_bus_add_devices(bus); 171 pci_bus_add_devices(bus);
167 } 172 }
168 } else { 173 } else if (mode == PCI_PROBE_NORMAL) {
169 /* use legacy probe */ 174 /* use legacy probe */
170 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn); 175 slotno = PCI_SLOT(PCI_DN(dn->child)->devfn);
171 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0)); 176 num = pci_scan_slot(bus, PCI_DEVFN(slotno, 0));
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index b046bcf7443d..9639c66b453d 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -132,7 +132,7 @@ static int __init init_ras_IRQ(void)
132 of_node_put(np); 132 of_node_put(np);
133 } 133 }
134 134
135 return 1; 135 return 0;
136} 136}
137__initcall(init_ras_IRQ); 137__initcall(init_ras_IRQ);
138 138
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 86cfa6ecdcf3..1773103354be 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -17,8 +17,9 @@
17#include <linux/proc_fs.h> 17#include <linux/proc_fs.h>
18 18
19#include <asm/prom.h> 19#include <asm/prom.h>
20#include <asm/pSeries_reconfig.h> 20#include <asm/machdep.h>
21#include <asm/uaccess.h> 21#include <asm/uaccess.h>
22#include <asm/pSeries_reconfig.h>
22 23
23 24
24 25
@@ -94,16 +95,16 @@ static struct device_node *derive_parent(const char *path)
94 return parent; 95 return parent;
95} 96}
96 97
97static struct notifier_block *pSeries_reconfig_chain; 98static BLOCKING_NOTIFIER_HEAD(pSeries_reconfig_chain);
98 99
99int pSeries_reconfig_notifier_register(struct notifier_block *nb) 100int pSeries_reconfig_notifier_register(struct notifier_block *nb)
100{ 101{
101 return notifier_chain_register(&pSeries_reconfig_chain, nb); 102 return blocking_notifier_chain_register(&pSeries_reconfig_chain, nb);
102} 103}
103 104
104void pSeries_reconfig_notifier_unregister(struct notifier_block *nb) 105void pSeries_reconfig_notifier_unregister(struct notifier_block *nb)
105{ 106{
106 notifier_chain_unregister(&pSeries_reconfig_chain, nb); 107 blocking_notifier_chain_unregister(&pSeries_reconfig_chain, nb);
107} 108}
108 109
109static int pSeries_reconfig_add_node(const char *path, struct property *proplist) 110static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
@@ -131,7 +132,7 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
131 goto out_err; 132 goto out_err;
132 } 133 }
133 134
134 err = notifier_call_chain(&pSeries_reconfig_chain, 135 err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
135 PSERIES_RECONFIG_ADD, np); 136 PSERIES_RECONFIG_ADD, np);
136 if (err == NOTIFY_BAD) { 137 if (err == NOTIFY_BAD) {
137 printk(KERN_ERR "Failed to add device node %s\n", path); 138 printk(KERN_ERR "Failed to add device node %s\n", path);
@@ -171,7 +172,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
171 172
172 remove_node_proc_entries(np); 173 remove_node_proc_entries(np);
173 174
174 notifier_call_chain(&pSeries_reconfig_chain, 175 blocking_notifier_call_chain(&pSeries_reconfig_chain,
175 PSERIES_RECONFIG_REMOVE, np); 176 PSERIES_RECONFIG_REMOVE, np);
176 of_detach_node(np); 177 of_detach_node(np);
177 178
@@ -508,7 +509,7 @@ static int proc_ppc64_create_ofdt(void)
508{ 509{
509 struct proc_dir_entry *ent; 510 struct proc_dir_entry *ent;
510 511
511 if (!platform_is_pseries()) 512 if (!machine_is(pseries))
512 return 0; 513 return 0;
513 514
514 ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL); 515 ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL);
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c
index a6f628d4c9dc..fcc4d561a236 100644
--- a/arch/powerpc/platforms/pseries/rtasd.c
+++ b/arch/powerpc/platforms/pseries/rtasd.c
@@ -27,6 +27,7 @@
27#include <asm/prom.h> 27#include <asm/prom.h>
28#include <asm/nvram.h> 28#include <asm/nvram.h>
29#include <asm/atomic.h> 29#include <asm/atomic.h>
30#include <asm/machdep.h>
30 31
31#if 0 32#if 0
32#define DEBUG(A...) printk(KERN_ERR A) 33#define DEBUG(A...) printk(KERN_ERR A)
@@ -481,7 +482,7 @@ static int __init rtas_init(void)
481{ 482{
482 struct proc_dir_entry *entry; 483 struct proc_dir_entry *entry;
483 484
484 if (!platform_is_pseries()) 485 if (!machine_is(pseries))
485 return 0; 486 return 0;
486 487
487 /* No RTAS */ 488 /* No RTAS */
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 44d5c7fdcd97..b2fbf8ba8fbb 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -81,8 +81,8 @@ extern void find_udbg_vterm(void);
81 81
82int fwnmi_active; /* TRUE if an FWNMI handler is present */ 82int fwnmi_active; /* TRUE if an FWNMI handler is present */
83 83
84static void pseries_shared_idle(void); 84static void pseries_shared_idle_sleep(void);
85static void pseries_dedicated_idle(void); 85static void pseries_dedicated_idle_sleep(void);
86 86
87struct mpic *pSeries_mpic; 87struct mpic *pSeries_mpic;
88 88
@@ -236,14 +236,13 @@ static void __init pSeries_setup_arch(void)
236 vpa_init(boot_cpuid); 236 vpa_init(boot_cpuid);
237 if (get_lppaca()->shared_proc) { 237 if (get_lppaca()->shared_proc) {
238 printk(KERN_INFO "Using shared processor idle loop\n"); 238 printk(KERN_INFO "Using shared processor idle loop\n");
239 ppc_md.idle_loop = pseries_shared_idle; 239 ppc_md.power_save = pseries_shared_idle_sleep;
240 } else { 240 } else {
241 printk(KERN_INFO "Using dedicated idle loop\n"); 241 printk(KERN_INFO "Using dedicated idle loop\n");
242 ppc_md.idle_loop = pseries_dedicated_idle; 242 ppc_md.power_save = pseries_dedicated_idle_sleep;
243 } 243 }
244 } else { 244 } else {
245 printk(KERN_INFO "Using default idle loop\n"); 245 printk(KERN_INFO "Using default idle loop\n");
246 ppc_md.idle_loop = default_idle;
247 } 246 }
248 247
249 if (firmware_has_feature(FW_FEATURE_LPAR)) 248 if (firmware_has_feature(FW_FEATURE_LPAR))
@@ -373,156 +372,123 @@ static int pSeries_check_legacy_ioport(unsigned int baseport)
373/* 372/*
374 * Called very early, MMU is off, device-tree isn't unflattened 373 * Called very early, MMU is off, device-tree isn't unflattened
375 */ 374 */
376extern struct machdep_calls pSeries_md;
377 375
378static int __init pSeries_probe(int platform) 376static int __init pSeries_probe_hypertas(unsigned long node,
377 const char *uname, int depth,
378 void *data)
379{ 379{
380 if (platform != PLATFORM_PSERIES && 380 if (depth != 1 ||
381 platform != PLATFORM_PSERIES_LPAR) 381 (strcmp(uname, "rtas") != 0 && strcmp(uname, "rtas@0") != 0))
382 return 0; 382 return 0;
383
384 /* if we have some ppc_md fixups for LPAR to do, do
385 * it here ...
386 */
387 383
388 if (platform == PLATFORM_PSERIES_LPAR) 384 if (of_get_flat_dt_prop(node, "ibm,hypertas-functions", NULL) != NULL)
389 ppc64_firmware_features |= FW_FEATURE_LPAR; 385 powerpc_firmware_features |= FW_FEATURE_LPAR;
390 386
391 return 1; 387 return 1;
392} 388}
393 389
394DECLARE_PER_CPU(unsigned long, smt_snooze_delay); 390static int __init pSeries_probe(void)
395
396static inline void dedicated_idle_sleep(unsigned int cpu)
397{ 391{
398 struct lppaca *plppaca = &lppaca[cpu ^ 1]; 392 char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
393 "device_type", NULL);
394 if (dtype == NULL)
395 return 0;
396 if (strcmp(dtype, "chrp"))
397 return 0;
399 398
400 /* Only sleep if the other thread is not idle */ 399 DBG("pSeries detected, looking for LPAR capability...\n");
401 if (!(plppaca->idle)) {
402 local_irq_disable();
403 400
404 /* 401 /* Now try to figure out if we are running on LPAR */
405 * We are about to sleep the thread and so wont be polling any 402 of_scan_flat_dt(pSeries_probe_hypertas, NULL);
406 * more. 403
407 */ 404 DBG("Machine is%s LPAR !\n",
408 clear_thread_flag(TIF_POLLING_NRFLAG); 405 (powerpc_firmware_features & FW_FEATURE_LPAR) ? "" : " not");
409 smp_mb__after_clear_bit(); 406
410 407 return 1;
411 /*
412 * SMT dynamic mode. Cede will result in this thread going
413 * dormant, if the partner thread is still doing work. Thread
414 * wakes up if partner goes idle, an interrupt is presented, or
415 * a prod occurs. Returning from the cede enables external
416 * interrupts.
417 */
418 if (!need_resched())
419 cede_processor();
420 else
421 local_irq_enable();
422 set_thread_flag(TIF_POLLING_NRFLAG);
423 } else {
424 /*
425 * Give the HV an opportunity at the processor, since we are
426 * not doing any work.
427 */
428 poll_pending();
429 }
430} 408}
431 409
432static void pseries_dedicated_idle(void) 410
411DECLARE_PER_CPU(unsigned long, smt_snooze_delay);
412
413static void pseries_dedicated_idle_sleep(void)
433{ 414{
434 unsigned int cpu = smp_processor_id(); 415 unsigned int cpu = smp_processor_id();
435 unsigned long start_snooze; 416 unsigned long start_snooze;
436 unsigned long *smt_snooze_delay = &__get_cpu_var(smt_snooze_delay); 417 unsigned long *smt_snooze_delay = &__get_cpu_var(smt_snooze_delay);
437 set_thread_flag(TIF_POLLING_NRFLAG);
438
439 while (1) {
440 /*
441 * Indicate to the HV that we are idle. Now would be
442 * a good time to find other work to dispatch.
443 */
444 get_lppaca()->idle = 1;
445
446 if (!need_resched()) {
447 start_snooze = get_tb() +
448 *smt_snooze_delay * tb_ticks_per_usec;
449
450 while (!need_resched() && !cpu_is_offline(cpu)) {
451 ppc64_runlatch_off();
452
453 /*
454 * Go into low thread priority and possibly
455 * low power mode.
456 */
457 HMT_low();
458 HMT_very_low();
459
460 if (*smt_snooze_delay != 0 &&
461 get_tb() > start_snooze) {
462 HMT_medium();
463 dedicated_idle_sleep(cpu);
464 }
465
466 }
467
468 HMT_medium();
469 }
470
471 get_lppaca()->idle = 0;
472 ppc64_runlatch_on();
473 418
474 preempt_enable_no_resched(); 419 /*
475 schedule(); 420 * Indicate to the HV that we are idle. Now would be
476 preempt_disable(); 421 * a good time to find other work to dispatch.
422 */
423 get_lppaca()->idle = 1;
477 424
478 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) 425 /*
479 cpu_die(); 426 * We come in with interrupts disabled, and need_resched()
480 } 427 * has been checked recently. If we should poll for a little
481} 428 * while, do so.
429 */
430 if (*smt_snooze_delay) {
431 start_snooze = get_tb() +
432 *smt_snooze_delay * tb_ticks_per_usec;
433 local_irq_enable();
434 set_thread_flag(TIF_POLLING_NRFLAG);
482 435
483static void pseries_shared_idle(void) 436 while (get_tb() < start_snooze) {
484{ 437 if (need_resched() || cpu_is_offline(cpu))
485 unsigned int cpu = smp_processor_id(); 438 goto out;
439 ppc64_runlatch_off();
440 HMT_low();
441 HMT_very_low();
442 }
486 443
487 while (1) { 444 HMT_medium();
488 /* 445 clear_thread_flag(TIF_POLLING_NRFLAG);
489 * Indicate to the HV that we are idle. Now would be 446 smp_mb();
490 * a good time to find other work to dispatch. 447 local_irq_disable();
491 */ 448 if (need_resched() || cpu_is_offline(cpu))
492 get_lppaca()->idle = 1; 449 goto out;
450 }
493 451
494 while (!need_resched() && !cpu_is_offline(cpu)) { 452 /*
495 local_irq_disable(); 453 * Cede if the other thread is not idle, so that it can
496 ppc64_runlatch_off(); 454 * go single-threaded. If the other thread is idle,
455 * we ask the hypervisor if it has pending work it
456 * wants to do and cede if it does. Otherwise we keep
457 * polling in order to reduce interrupt latency.
458 *
459 * Doing the cede when the other thread is active will
460 * result in this thread going dormant, meaning the other
461 * thread gets to run in single-threaded (ST) mode, which
462 * is slightly faster than SMT mode with this thread at
463 * very low priority. The cede enables interrupts, which
464 * doesn't matter here.
465 */
466 if (!lppaca[cpu ^ 1].idle || poll_pending() == H_Pending)
467 cede_processor();
497 468
498 /* 469out:
499 * Yield the processor to the hypervisor. We return if 470 HMT_medium();
500 * an external interrupt occurs (which are driven prior 471 get_lppaca()->idle = 0;
501 * to returning here) or if a prod occurs from another 472}
502 * processor. When returning here, external interrupts
503 * are enabled.
504 *
505 * Check need_resched() again with interrupts disabled
506 * to avoid a race.
507 */
508 if (!need_resched())
509 cede_processor();
510 else
511 local_irq_enable();
512
513 HMT_medium();
514 }
515 473
516 get_lppaca()->idle = 0; 474static void pseries_shared_idle_sleep(void)
517 ppc64_runlatch_on(); 475{
476 /*
477 * Indicate to the HV that we are idle. Now would be
478 * a good time to find other work to dispatch.
479 */
480 get_lppaca()->idle = 1;
518 481
519 preempt_enable_no_resched(); 482 /*
520 schedule(); 483 * Yield the processor to the hypervisor. We return if
521 preempt_disable(); 484 * an external interrupt occurs (which are driven prior
485 * to returning here) or if a prod occurs from another
486 * processor. When returning here, external interrupts
487 * are enabled.
488 */
489 cede_processor();
522 490
523 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) 491 get_lppaca()->idle = 0;
524 cpu_die();
525 }
526} 492}
527 493
528static int pSeries_pci_probe_mode(struct pci_bus *bus) 494static int pSeries_pci_probe_mode(struct pci_bus *bus)
@@ -553,7 +519,8 @@ static void pseries_kexec_cpu_down(int crash_shutdown, int secondary)
553} 519}
554#endif 520#endif
555 521
556struct machdep_calls __initdata pSeries_md = { 522define_machine(pseries) {
523 .name = "pSeries",
557 .probe = pSeries_probe, 524 .probe = pSeries_probe,
558 .setup_arch = pSeries_setup_arch, 525 .setup_arch = pSeries_setup_arch,
559 .init_early = pSeries_init_early, 526 .init_early = pSeries_init_early,
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index eb86cdb9b802..4864cb32be25 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -500,7 +500,7 @@ nextnode:
500 np; 500 np;
501 np = of_find_node_by_type(np, "cpu")) { 501 np = of_find_node_by_type(np, "cpu")) {
502 ireg = (uint *)get_property(np, "reg", &ilen); 502 ireg = (uint *)get_property(np, "reg", &ilen);
503 if (ireg && ireg[0] == boot_cpuid_phys) { 503 if (ireg && ireg[0] == get_hard_smp_processor_id(boot_cpuid)) {
504 ireg = (uint *)get_property(np, "ibm,ppc-interrupt-gserver#s", 504 ireg = (uint *)get_property(np, "ibm,ppc-interrupt-gserver#s",
505 &ilen); 505 &ilen);
506 i = ilen / sizeof(int); 506 i = ilen / sizeof(int);
@@ -541,7 +541,7 @@ nextnode:
541 ops = &pSeriesLP_ops; 541 ops = &pSeriesLP_ops;
542 else { 542 else {
543#ifdef CONFIG_SMP 543#ifdef CONFIG_SMP
544 for_each_cpu(i) { 544 for_each_possible_cpu(i) {
545 int hard_id; 545 int hard_id;
546 546
547 /* FIXME: Do this dynamically! --RR */ 547 /* FIXME: Do this dynamically! --RR */
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index 3a3e302b4ea2..e9a8f5d1dfcd 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -61,15 +61,15 @@ config 6xx
61 select PPC_FPU 61 select PPC_FPU
62 help 62 help
63 There are four types of PowerPC chips supported. The more common 63 There are four types of PowerPC chips supported. The more common
64 types (601, 603, 604, 740, 750, 7400), the Motorola embedded 64 types (601, 603, 604, 740, 750, 7400), the older Freescale
65 versions (821, 823, 850, 855, 860, 52xx, 82xx, 83xx), the IBM 65 (formerly Motorola) embedded versions (821, 823, 850, 855, 860,
66 embedded versions (403 and 405) and the POWER3 processor. 66 52xx, 82xx, 83xx), the IBM embedded versions (403 and 405) and
67 (For support for more recent 64-bit processors, set ARCH=powerpc.) 67 the Book E embedded processors from IBM (44x) and Freescale (85xx).
68 For support for 64-bit processors, set ARCH=powerpc.
68 Unless you are building a kernel for one of the embedded processor 69 Unless you are building a kernel for one of the embedded processor
69 systems or a POWER3-based IBM RS/6000, choose 6xx. 70 systems, choose 6xx.
70 Note that the kernel runs in 32-bit mode even on 64-bit chips. 71 Also note that because the 52xx, 82xx, & 83xx family have a 603e
71 Also note that because the 52xx, 82xx, & 83xx family has a 603e core, 72 core, specific support for that chipset is asked later on.
72 specific support for that chipset is asked later on.
73 73
74config 40x 74config 40x
75 bool "40x" 75 bool "40x"
@@ -77,10 +77,6 @@ config 40x
77config 44x 77config 44x
78 bool "44x" 78 bool "44x"
79 79
80config POWER3
81 select PPC_FPU
82 bool "POWER3"
83
84config 8xx 80config 8xx
85 bool "8xx" 81 bool "8xx"
86 82
@@ -252,14 +248,9 @@ config PPC601_SYNC_FIX
252source arch/ppc/platforms/4xx/Kconfig 248source arch/ppc/platforms/4xx/Kconfig
253source arch/ppc/platforms/85xx/Kconfig 249source arch/ppc/platforms/85xx/Kconfig
254 250
255config PPC64BRIDGE
256 bool
257 depends on POWER3
258 default y
259
260config PPC_STD_MMU 251config PPC_STD_MMU
261 bool 252 bool
262 depends on 6xx || POWER3 253 depends on 6xx
263 default y 254 default y
264 255
265config NOT_COHERENT_CACHE 256config NOT_COHERENT_CACHE
@@ -534,8 +525,8 @@ endmenu
534 525
535choice 526choice
536 prompt "Machine Type" 527 prompt "Machine Type"
537 depends on 6xx || POWER3 528 depends on 6xx
538 default PPC_MULTIPLATFORM 529 default PPC_PREP
539 ---help--- 530 ---help---
540 Linux currently supports several different kinds of PowerPC-based 531 Linux currently supports several different kinds of PowerPC-based
541 machines: Apple Power Macintoshes and clones (such as the Motorola 532 machines: Apple Power Macintoshes and clones (such as the Motorola
@@ -545,15 +536,14 @@ choice
545 Platform) machines (including all of the recent IBM RS/6000 and 536 Platform) machines (including all of the recent IBM RS/6000 and
546 pSeries machines), and several embedded PowerPC systems containing 537 pSeries machines), and several embedded PowerPC systems containing
547 4xx, 6xx, 7xx, 8xx, 74xx, and 82xx processors. Currently, the 538 4xx, 6xx, 7xx, 8xx, 74xx, and 82xx processors. Currently, the
548 default option is to build a kernel which works on PReP and CHRP. 539 default option is to build a kernel which works on PReP.
549 540
550 Note that support for Apple machines is now only available with 541 Note that support for Apple and CHRP machines is now only available
551 ARCH=powerpc, and has been removed from this menu. If you wish 542 with ARCH=powerpc, and has been removed from this menu. If you
552 to build a kernel for an Apple machine, exit this configuration 543 wish to build a kernel for an Apple or CHRP machine, exit this
553 process and re-run it with ARCH=powerpc. 544 configuration process and re-run it with ARCH=powerpc.
554 545
555 Select CHRP/PReP if configuring for an IBM RS/6000 or 546 Select PReP if configuring for a PReP machine.
556 pSeries machine, or a PReP machine.
557 547
558 Select Gemini if configuring for a Synergy Microsystems' Gemini 548 Select Gemini if configuring for a Synergy Microsystems' Gemini
559 series Single Board Computer. More information is available at: 549 series Single Board Computer. More information is available at:
@@ -562,8 +552,8 @@ choice
562 Select APUS if configuring for a PowerUP Amiga. More information is 552 Select APUS if configuring for a PowerUP Amiga. More information is
563 available at: <http://linux-apus.sourceforge.net/>. 553 available at: <http://linux-apus.sourceforge.net/>.
564 554
565config PPC_MULTIPLATFORM 555config PPC_PREP
566 bool "CHRP/PReP" 556 bool "PReP"
567 557
568config APUS 558config APUS
569 bool "Amiga-APUS" 559 bool "Amiga-APUS"
@@ -715,6 +705,13 @@ config LITE5200
715 much but it's only been tested on this board version. I think this 705 much but it's only been tested on this board version. I think this
716 board is also known as IceCube. 706 board is also known as IceCube.
717 707
708config LITE5200B
709 bool "Freescale LITE5200B"
710 depends LITE5200
711 help
712 Support for the LITE5200B dev board for the MPC5200 from Freescale.
713 This is the new board with 2 PCI slots.
714
718config MPC834x_SYS 715config MPC834x_SYS
719 bool "Freescale MPC834x SYS" 716 bool "Freescale MPC834x SYS"
720 help 717 help
@@ -800,25 +797,6 @@ config CPM2
800 you wish to build a kernel for a machine with a CPM2 coprocessor 797 you wish to build a kernel for a machine with a CPM2 coprocessor
801 on it (826x, 827x, 8560). 798 on it (826x, 827x, 8560).
802 799
803config PPC_CHRP
804 bool "Support for CHRP (Common Hardware Reference Platform) machines"
805 depends on PPC_MULTIPLATFORM
806 select PPC_I8259
807 select PPC_INDIRECT_PCI
808 default y
809
810config PPC_PREP
811 bool "Support for PReP (PowerPC Reference Platform) machines"
812 depends on PPC_MULTIPLATFORM
813 select PPC_I8259
814 select PPC_INDIRECT_PCI
815 default y
816
817config PPC_OF
818 bool
819 depends on PPC_CHRP
820 default y
821
822config PPC_GEN550 800config PPC_GEN550
823 bool 801 bool
824 depends on SANDPOINT || SPRUCE || PPLUS || \ 802 depends on SANDPOINT || SPRUCE || PPLUS || \
@@ -977,14 +955,6 @@ source "mm/Kconfig"
977 955
978source "fs/Kconfig.binfmt" 956source "fs/Kconfig.binfmt"
979 957
980config PROC_DEVICETREE
981 bool "Support for Open Firmware device tree in /proc"
982 depends on PPC_OF && PROC_FS
983 help
984 This option adds a device-tree directory under /proc which contains
985 an image of the device tree that the kernel copies from Open
986 Firmware. If unsure, say Y here.
987
988config PREP_RESIDUAL 958config PREP_RESIDUAL
989 bool "Support for PReP Residual Data" 959 bool "Support for PReP Residual Data"
990 depends on PPC_PREP 960 depends on PPC_PREP
@@ -1177,8 +1147,7 @@ menu "Bus options"
1177 1147
1178config ISA 1148config ISA
1179 bool "Support for ISA-bus hardware" 1149 bool "Support for ISA-bus hardware"
1180 depends on PPC_PREP || PPC_CHRP 1150 depends on PPC_PREP
1181 select PPC_I8259
1182 help 1151 help
1183 Find out whether you have ISA slots on your motherboard. ISA is the 1152 Find out whether you have ISA slots on your motherboard. ISA is the
1184 name of a bus system, i.e. the way the CPU talks to the other stuff 1153 name of a bus system, i.e. the way the CPU talks to the other stuff
@@ -1188,18 +1157,18 @@ config ISA
1188 1157
1189config GENERIC_ISA_DMA 1158config GENERIC_ISA_DMA
1190 bool 1159 bool
1191 depends on POWER3 || 6xx && !CPM2 1160 depends on 6xx && !CPM2
1192 default y 1161 default y
1193 1162
1194config PPC_I8259 1163config PPC_I8259
1195 bool 1164 bool
1196 default y if 85xx 1165 default y if 85xx || PPC_PREP
1197 default n 1166 default n
1198 1167
1199config PPC_INDIRECT_PCI 1168config PPC_INDIRECT_PCI
1200 bool 1169 bool
1201 depends on PCI 1170 depends on PCI
1202 default y if 40x || 44x || 85xx || 83xx 1171 default y if 40x || 44x || 85xx || 83xx || PPC_PREP
1203 default n 1172 default n
1204 1173
1205config EISA 1174config EISA
@@ -1390,7 +1359,7 @@ config CONSISTENT_SIZE
1390 1359
1391config BOOT_LOAD_BOOL 1360config BOOT_LOAD_BOOL
1392 bool "Set the boot link/load address" 1361 bool "Set the boot link/load address"
1393 depends on ADVANCED_OPTIONS && !PPC_MULTIPLATFORM 1362 depends on ADVANCED_OPTIONS && !PPC_PREP
1394 help 1363 help
1395 This option allows you to set the initial load address of the zImage 1364 This option allows you to set the initial load address of the zImage
1396 or zImage.initrd file. This can be useful if you are on a board 1365 or zImage.initrd file. This can be useful if you are on a board
diff --git a/arch/ppc/Kconfig.debug b/arch/ppc/Kconfig.debug
index 8cc75abf3d83..f94b87740973 100644
--- a/arch/ppc/Kconfig.debug
+++ b/arch/ppc/Kconfig.debug
@@ -53,13 +53,6 @@ config BDI_SWITCH
53 Unless you are intending to debug the kernel with one of these 53 Unless you are intending to debug the kernel with one of these
54 machines, say N here. 54 machines, say N here.
55 55
56config BOOTX_TEXT
57 bool "Support for early boot text console (BootX or OpenFirmware only)"
58 depends PPC_OF
59 help
60 Say Y here to see progress messages from the boot firmware in text
61 mode. Requires either BootX or Open Firmware.
62
63config SERIAL_TEXT_DEBUG 56config SERIAL_TEXT_DEBUG
64 bool "Support for early boot texts over serial port" 57 bool "Support for early boot texts over serial port"
65 depends on 4xx || LOPEC || MV64X60 || PPLUS || PRPMC800 || \ 58 depends on 4xx || LOPEC || MV64X60 || PPLUS || PRPMC800 || \
diff --git a/arch/ppc/Makefile b/arch/ppc/Makefile
index 9fbdf54ba2be..0db66dcf0723 100644
--- a/arch/ppc/Makefile
+++ b/arch/ppc/Makefile
@@ -40,10 +40,8 @@ ifndef CONFIG_FSL_BOOKE
40CFLAGS += -mstring 40CFLAGS += -mstring
41endif 41endif
42 42
43cpu-as-$(CONFIG_PPC64BRIDGE) += -Wa,-mppc64bridge
44cpu-as-$(CONFIG_4xx) += -Wa,-m405 43cpu-as-$(CONFIG_4xx) += -Wa,-m405
45cpu-as-$(CONFIG_6xx) += -Wa,-maltivec 44cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
46cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec
47cpu-as-$(CONFIG_E500) += -Wa,-me500 45cpu-as-$(CONFIG_E500) += -Wa,-me500
48cpu-as-$(CONFIG_E200) += -Wa,-me200 46cpu-as-$(CONFIG_E200) += -Wa,-me200
49 47
@@ -59,8 +57,6 @@ head-$(CONFIG_4xx) := arch/ppc/kernel/head_4xx.o
59head-$(CONFIG_44x) := arch/ppc/kernel/head_44x.o 57head-$(CONFIG_44x) := arch/ppc/kernel/head_44x.o
60head-$(CONFIG_FSL_BOOKE) := arch/ppc/kernel/head_fsl_booke.o 58head-$(CONFIG_FSL_BOOKE) := arch/ppc/kernel/head_fsl_booke.o
61 59
62head-$(CONFIG_6xx) += arch/ppc/kernel/idle_6xx.o
63head-$(CONFIG_POWER4) += arch/ppc/kernel/idle_power4.o
64head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o 60head-$(CONFIG_PPC_FPU) += arch/powerpc/kernel/fpu.o
65 61
66core-y += arch/ppc/kernel/ arch/powerpc/kernel/ \ 62core-y += arch/ppc/kernel/ arch/powerpc/kernel/ \
@@ -71,7 +67,7 @@ core-y += arch/ppc/kernel/ arch/powerpc/kernel/ \
71core-$(CONFIG_4xx) += arch/ppc/platforms/4xx/ 67core-$(CONFIG_4xx) += arch/ppc/platforms/4xx/
72core-$(CONFIG_83xx) += arch/ppc/platforms/83xx/ 68core-$(CONFIG_83xx) += arch/ppc/platforms/83xx/
73core-$(CONFIG_85xx) += arch/ppc/platforms/85xx/ 69core-$(CONFIG_85xx) += arch/ppc/platforms/85xx/
74core-$(CONFIG_MATH_EMULATION) += arch/ppc/math-emu/ 70core-$(CONFIG_MATH_EMULATION) += arch/powerpc/math-emu/
75core-$(CONFIG_XMON) += arch/ppc/xmon/ 71core-$(CONFIG_XMON) += arch/ppc/xmon/
76core-$(CONFIG_APUS) += arch/ppc/amiga/ 72core-$(CONFIG_APUS) += arch/ppc/amiga/
77drivers-$(CONFIG_8xx) += arch/ppc/8xx_io/ 73drivers-$(CONFIG_8xx) += arch/ppc/8xx_io/
diff --git a/arch/ppc/boot/Makefile b/arch/ppc/boot/Makefile
index 84eec0bef93c..b739e25d4728 100644
--- a/arch/ppc/boot/Makefile
+++ b/arch/ppc/boot/Makefile
@@ -19,14 +19,13 @@ HOSTCFLAGS += -Iarch/$(ARCH)/boot/include
19BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd 19BOOT_TARGETS = zImage zImage.initrd znetboot znetboot.initrd
20 20
21bootdir-y := simple 21bootdir-y := simple
22bootdir-$(CONFIG_PPC_OF) += openfirmware
23subdir-y := lib common images 22subdir-y := lib common images
24subdir-$(CONFIG_PPC_MULTIPLATFORM) += of1275 23subdir-$(CONFIG_PPC_PREP) += of1275
25 24
26# for cleaning 25# for cleaning
27subdir- += simple openfirmware 26subdir- += simple
28 27
29hostprogs-y := $(addprefix utils/, addnote mknote hack-coff mkprep mkbugboot mktree) 28hostprogs-y := $(addprefix utils/, mkprep mkbugboot mktree)
30 29
31PHONY += $(BOOT_TARGETS) $(bootdir-y) 30PHONY += $(BOOT_TARGETS) $(bootdir-y)
32 31
diff --git a/arch/ppc/boot/openfirmware/Makefile b/arch/ppc/boot/openfirmware/Makefile
deleted file mode 100644
index 66b739743759..000000000000
--- a/arch/ppc/boot/openfirmware/Makefile
+++ /dev/null
@@ -1,109 +0,0 @@
1# Makefile for making bootable images on various OpenFirmware machines.
2#
3# This file is included by the global makefile so that you can add your own
4# architecture-specific flags and dependencies.
5#
6# Paul Mackerras January 1997
7# XCOFF bootable images for PowerMacs
8# Geert Uytterhoeven September 1997
9# ELF bootable iamges for CHRP machines.
10# Tom Rini January 2001
11# Cleaned up, moved into arch/ppc/boot/pmac
12# Tom Rini July/August 2002
13# Merged 'chrp' and 'pmac' into 'openfirmware', and cleaned up the
14# rules.
15
16zImage.initrd znetboot.initrd: del-ramdisk-sec := -R .ramdisk
17zImage.initrd znetboot.initrd: initrd := .initrd
18
19
20boot := arch/ppc/boot
21common := $(boot)/common
22utils := $(boot)/utils
23bootlib := $(boot)/lib
24of1275 := $(boot)/of1275
25images := $(boot)/images
26
27CHRP_LD_ARGS := -T $(srctree)/$(boot)/ld.script -e _start -Ttext 0x00800000
28
29COMMONOBJS := start.o misc.o common.o
30CHRPOBJS := crt0.o $(COMMONOBJS) chrpmain.o
31
32targets := $(CHRPOBJS) dummy.o
33CHRPOBJS := $(addprefix $(obj)/, $(CHRPOBJS))
34
35LIBS := lib/lib.a $(bootlib)/lib.a $(of1275)/lib.a $(common)/lib.a
36
37ifdef CONFIG_SMP
38END := .smp
39endif
40ifdef CONFIG_PPC64BRIDGE
41END += .64
42endif
43
44
45$(images)/ramdisk.image.gz:
46 @echo ' MISSING $@'
47 @echo ' RAM disk image must be provided separately'
48 @/bin/false
49
50quiet_cmd_genimage = GEN $@
51 cmd_genimage = $(OBJCOPY) -R .comment \
52 --add-section=.image=$(images)/vmlinux.gz \
53 --set-section-flags=.image=contents,alloc,load,readonly,data $< $@
54
55targets += image.o
56$(obj)/image.o: $(obj)/dummy.o $(images)/vmlinux.gz FORCE
57 $(call if_changed,genimage)
58
59# Place the ramdisk in the initrd image.
60quiet_cmd_genimage-initrd = GEN $@
61 cmd_genimage-initrd = $(OBJCOPY) $< $@ \
62 --add-section=.ramdisk=$(images)/ramdisk.image.gz \
63 --set-section-flags=.ramdisk=contents,alloc,load,readonly,data
64targets += image.initrd.o
65$(obj)/image.initrd.o: $(obj)/image.o $(images)/ramdisk.image.gz FORCE
66 $(call if_changed,genimage-initrd)
67
68
69targets += crt0.o
70$(obj)/crt0.o: $(common)/crt0.S FORCE
71 $(call if_changed_dep,as_o_S)
72
73quiet_cmd_gen-chrp = CHRP $@
74 cmd_gen-chrp = $(LD) $(CHRP_LD_ARGS) -o $@ $(CHRPOBJS) $< $(LIBS) && \
75 $(OBJCOPY) $@ $@ -R .comment $(del-ramdisk-sec)
76
77$(images)/zImage.chrp: $(obj)/image.o $(CHRPOBJS) $(LIBS) \
78 $(srctree)/$(boot)/ld.script
79 $(call cmd,gen-chrp)
80$(images)/zImage.initrd.chrp: $(obj)/image.initrd.o $(CHRPOBJS) $(LIBS) \
81 $(srctree)/$(boot)/ld.script
82 $(call cmd,gen-chrp)
83
84quiet_cmd_addnote = ADDNOTE $@
85 cmd_addnote = cat $< > $@ && $(utils)/addnote $@
86$(images)/zImage.chrp-rs6k $(images)/zImage.initrd.chrp-rs6k: \
87 %-rs6k: %
88 $(call cmd,addnote)
89
90# The targets used on the make command-line
91
92PHONY += zImage zImage.initrd
93zImage: $(images)/zImage.chrp \
94 $(images)/zImage.chrp-rs6k
95 @echo ' kernel: $@ is ready ($<)'
96zImage.initrd: $(images)/zImage.initrd.chrp \
97 $(images)/zImage.initrd.chrp-rs6k
98 @echo ' kernel: $@ is ready ($<)'
99
100TFTPIMAGE := /tftpboot/zImage
101
102PHONY += znetboot znetboot.initrd
103znetboot: $(images)/zImage.chrp
104 cp $(images)/zImage.chrp $(TFTPIMAGE).chrp$(END)
105 @echo ' kernel: $@ is ready ($<)'
106znetboot.initrd:$(images)/zImage.initrd.chrp
107 cp $(images)/zImage.initrd.chrp $(TFTPIMAGE).chrp$(END)
108 @echo ' kernel: $@ is ready ($<)'
109
diff --git a/arch/ppc/boot/openfirmware/chrpmain.c b/arch/ppc/boot/openfirmware/chrpmain.c
deleted file mode 100644
index 245dbd9fc120..000000000000
--- a/arch/ppc/boot/openfirmware/chrpmain.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 "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 *, unsigned long);
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#define RAM_START 0x00000000
31#define RAM_END (64<<20)
32
33#define BOOT_START ((unsigned long)_start)
34#define BOOT_END ((unsigned long)(_end + 0xFFF) & ~0xFFF)
35
36#define RAM_FREE ((unsigned long)(_end+0x1000)&~0xFFF)
37#define PROG_START 0x00010000
38#define PROG_SIZE 0x007f0000 /* 8MB */
39
40#define SCRATCH_SIZE (128 << 10)
41
42static char scratch[SCRATCH_SIZE]; /* 128k of scratch space for gunzip */
43
44typedef void (*kernel_start_t)(int, int, void *, unsigned int, unsigned int);
45
46void
47boot(int a1, int a2, void *prom)
48{
49 unsigned sa, len;
50 void *dst;
51 unsigned char *im;
52 unsigned int initrd_size, initrd_start;
53
54 printf("chrpboot starting: loaded at 0x%p\n\r", &_start);
55
56 initrd_size = &__ramdisk_end - &__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, &__ramdisk_begin, initrd_size);
64 memcpy((char *)initrd_start, &__ramdisk_begin, initrd_size);
65 } else {
66 initrd_start = 0;
67 initrd_size = 0;
68 a2 = 0xdeadbeef;
69 }
70
71 im = &__image_begin;
72 len = &__image_end - &__image_begin;
73 /* claim 4MB starting at PROG_START */
74 claim(PROG_START, PROG_SIZE - PROG_START, 0);
75 dst = (void *) PROG_START;
76 if (im[0] == 0x1f && im[1] == 0x8b) {
77 avail_ram = scratch;
78 begin_avail = avail_high = avail_ram;
79 end_avail = scratch + sizeof(scratch);
80 printf("gunzipping (0x%p <- 0x%p:0x%p)...", dst, im, im+len);
81 gunzip(dst, PROG_SIZE - PROG_START, im, &len);
82 printf("done %u bytes\n\r", len);
83 printf("%u bytes of heap consumed, max in use %u\n\r",
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), "chrpboot", _MACH_chrp,
91 (PROG_START + PROG_SIZE));
92
93 sa = PROG_START;
94 printf("start address = 0x%x\n\r", sa);
95
96 (*(kernel_start_t)sa)(a1, a2, prom, initrd_start, initrd_size);
97
98 printf("returned?\n\r");
99
100 pause();
101}
diff --git a/arch/ppc/boot/openfirmware/common.c b/arch/ppc/boot/openfirmware/common.c
deleted file mode 100644
index 0f46756a903e..000000000000
--- a/arch/ppc/boot/openfirmware/common.c
+++ /dev/null
@@ -1,146 +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
10#include "nonstdio.h"
11#include "of1275.h"
12#include <linux/string.h>
13#include <linux/zlib.h>
14#include <asm/bootinfo.h>
15#include <asm/page.h>
16
17/* Information from the linker */
18
19extern int strcmp(const char *s1, const char *s2);
20extern char *avail_ram, *avail_high;
21extern char *end_avail;
22
23unsigned int heap_use, heap_max;
24
25struct memchunk {
26 unsigned int size;
27 struct memchunk *next;
28};
29
30static struct memchunk *freechunks;
31
32static void *zalloc(unsigned size)
33{
34 void *p;
35 struct memchunk **mpp, *mp;
36
37 size = (size + 7) & -8;
38 heap_use += size;
39 if (heap_use > heap_max)
40 heap_max = heap_use;
41 for (mpp = &freechunks; (mp = *mpp) != 0; mpp = &mp->next) {
42 if (mp->size == size) {
43 *mpp = mp->next;
44 return mp;
45 }
46 }
47 p = avail_ram;
48 avail_ram += size;
49 if (avail_ram > avail_high)
50 avail_high = avail_ram;
51 if (avail_ram > end_avail) {
52 printf("oops... out of memory\n\r");
53 pause();
54 }
55 return p;
56}
57
58#define HEAD_CRC 2
59#define EXTRA_FIELD 4
60#define ORIG_NAME 8
61#define COMMENT 0x10
62#define RESERVED 0xe0
63
64void gunzip(void *dst, int dstlen, unsigned char *src, int *lenp)
65{
66 z_stream s;
67 int r, i, flags;
68
69 /* skip header */
70 i = 10;
71 flags = src[3];
72 if (src[2] != Z_DEFLATED || (flags & RESERVED) != 0) {
73 printf("bad gzipped data\n\r");
74 exit();
75 }
76 if ((flags & EXTRA_FIELD) != 0)
77 i = 12 + src[10] + (src[11] << 8);
78 if ((flags & ORIG_NAME) != 0)
79 while (src[i++] != 0)
80 ;
81 if ((flags & COMMENT) != 0)
82 while (src[i++] != 0)
83 ;
84 if ((flags & HEAD_CRC) != 0)
85 i += 2;
86 if (i >= *lenp) {
87 printf("gunzip: ran out of data in header\n\r");
88 exit();
89 }
90
91 /* Initialize ourself. */
92 s.workspace = zalloc(zlib_inflate_workspacesize());
93 r = zlib_inflateInit2(&s, -MAX_WBITS);
94 if (r != Z_OK) {
95 printf("zlib_inflateInit2 returned %d\n\r", r);
96 exit();
97 }
98 s.next_in = src + i;
99 s.avail_in = *lenp - i;
100 s.next_out = dst;
101 s.avail_out = dstlen;
102 r = zlib_inflate(&s, Z_FINISH);
103 if (r != Z_OK && r != Z_STREAM_END) {
104 printf("inflate returned %d msg: %s\n\r", r, s.msg);
105 exit();
106 }
107 *lenp = s.next_out - (unsigned char *) dst;
108 zlib_inflateEnd(&s);
109}
110
111/* Make a bi_rec in OF. We need to be passed a name for BI_BOOTLOADER_ID,
112 * a machine type for BI_MACHTYPE, and the location where the end of the
113 * bootloader is (PROG_START + PROG_SIZE)
114 */
115void make_bi_recs(unsigned long addr, char *name, unsigned int mach,
116 unsigned long progend)
117{
118 struct bi_record *rec;
119
120
121 /* leave a 1MB gap then align to the next 1MB boundary */
122 addr = _ALIGN(addr+ (1<<20) - 1, (1<<20));
123 /* oldworld machine seem very unhappy about this. -- Tom */
124 if (addr >= progend)
125 claim(addr, 0x1000, 0);
126
127 rec = (struct bi_record *)addr;
128 rec->tag = BI_FIRST;
129 rec->size = sizeof(struct bi_record);
130 rec = (struct bi_record *)((unsigned long)rec + rec->size);
131
132 rec->tag = BI_BOOTLOADER_ID;
133 sprintf( (char *)rec->data, name);
134 rec->size = sizeof(struct bi_record) + strlen(name) + 1;
135 rec = (struct bi_record *)((unsigned long)rec + rec->size);
136
137 rec->tag = BI_MACHTYPE;
138 rec->data[0] = mach;
139 rec->data[1] = 1;
140 rec->size = sizeof(struct bi_record) + 2 * sizeof(unsigned long);
141 rec = (struct bi_record *)((unsigned long)rec + rec->size);
142
143 rec->tag = BI_LAST;
144 rec->size = sizeof(struct bi_record);
145 rec = (struct bi_record *)((unsigned long)rec + rec->size);
146}
diff --git a/arch/ppc/boot/openfirmware/dummy.c b/arch/ppc/boot/openfirmware/dummy.c
deleted file mode 100644
index 31dbf45bf99c..000000000000
--- a/arch/ppc/boot/openfirmware/dummy.c
+++ /dev/null
@@ -1,4 +0,0 @@
1int main(void)
2{
3 return 0;
4}
diff --git a/arch/ppc/boot/openfirmware/misc.S b/arch/ppc/boot/openfirmware/misc.S
deleted file mode 100644
index ab9e897cadd0..000000000000
--- a/arch/ppc/boot/openfirmware/misc.S
+++ /dev/null
@@ -1,67 +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 .text
10
11/*
12 * Use the BAT2 & 3 registers to map the 1st 16MB of RAM to
13 * the address given as the 1st argument.
14 */
15 .globl setup_bats
16setup_bats:
17 mfpvr 5
18 rlwinm 5,5,16,16,31 /* r3 = 1 for 601, 4 for 604 */
19 cmpwi 0,5,1
20 li 0,0
21 bne 4f
22 mtibatl 3,0 /* invalidate BAT first */
23 ori 3,3,4 /* set up BAT registers for 601 */
24 li 4,0x7f
25 mtibatu 2,3
26 mtibatl 2,4
27 oris 3,3,0x80
28 oris 4,4,0x80
29 mtibatu 3,3
30 mtibatl 3,4
31 b 5f
324: mtdbatu 3,0 /* invalidate BATs first */
33 mtibatu 3,0
34 ori 3,3,0xff /* set up BAT registers for 604 */
35 li 4,2
36 mtdbatl 2,4
37 mtdbatu 2,3
38 mtibatl 2,4
39 mtibatu 2,3
40 oris 3,3,0x80
41 oris 4,4,0x80
42 mtdbatl 3,4
43 mtdbatu 3,3
44 mtibatl 3,4
45 mtibatu 3,3
465: sync
47 isync
48 blr
49
50/*
51 * Flush the dcache and invalidate the icache for a range of addresses.
52 *
53 * flush_cache(addr, len)
54 */
55 .global flush_cache
56flush_cache:
57 addi 4,4,0x1f /* len = (len + 0x1f) / 0x20 */
58 rlwinm. 4,4,27,5,31
59 mtctr 4
60 beqlr
611: dcbf 0,3
62 icbi 0,3
63 addi 3,3,0x20
64 bdnz 1b
65 sync
66 isync
67 blr
diff --git a/arch/ppc/boot/openfirmware/start.c b/arch/ppc/boot/openfirmware/start.c
deleted file mode 100644
index 1617a26956bf..000000000000
--- a/arch/ppc/boot/openfirmware/start.c
+++ /dev/null
@@ -1,172 +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 <stdarg.h>
10#include "of1275.h"
11
12extern int strlen(const char *s);
13extern void boot(int a1, int a2, void *prom);
14
15phandle stdin;
16phandle stdout;
17phandle stderr;
18
19void printk(char *fmt, ...);
20
21void
22start(int a1, int a2, void *promptr)
23{
24 ofinit(promptr);
25 if (ofstdio(&stdin, &stdout, &stderr))
26 exit();
27
28 boot(a1, a2, promptr);
29 for (;;)
30 exit();
31}
32
33int writestring(void *f, char *ptr, int nb)
34{
35 int w = 0, i;
36 char *ret = "\r";
37
38 for (i = 0; i < nb; ++i) {
39 if (ptr[i] == '\n') {
40 if (i > w) {
41 write(f, ptr + w, i - w);
42 w = i;
43 }
44 write(f, ret, 1);
45 }
46 }
47 if (w < nb)
48 write(f, ptr + w, nb - w);
49 return nb;
50}
51
52int
53putc(int c, void *f)
54{
55 char ch = c;
56
57 return writestring(f, &ch, 1) == 1? c: -1;
58}
59
60int
61putchar(int c)
62{
63 return putc(c, stdout);
64}
65
66int
67fputs(char *str, void *f)
68{
69 int n = strlen(str);
70
71 return writestring(f, str, n) == n? 0: -1;
72}
73
74int
75readchar(void)
76{
77 char ch;
78
79 for (;;) {
80 switch (read(stdin, &ch, 1)) {
81 case 1:
82 return ch;
83 case -1:
84 printk("read(stdin) returned -1\n");
85 return -1;
86 }
87 }
88}
89
90static char line[256];
91static char *lineptr;
92static int lineleft;
93
94int
95getchar(void)
96{
97 int c;
98
99 if (lineleft == 0) {
100 lineptr = line;
101 for (;;) {
102 c = readchar();
103 if (c == -1 || c == 4)
104 break;
105 if (c == '\r' || c == '\n') {
106 *lineptr++ = '\n';
107 putchar('\n');
108 break;
109 }
110 switch (c) {
111 case 0177:
112 case '\b':
113 if (lineptr > line) {
114 putchar('\b');
115 putchar(' ');
116 putchar('\b');
117 --lineptr;
118 }
119 break;
120 case 'U' & 0x1F:
121 while (lineptr > line) {
122 putchar('\b');
123 putchar(' ');
124 putchar('\b');
125 --lineptr;
126 }
127 break;
128 default:
129 if (lineptr >= &line[sizeof(line) - 1])
130 putchar('\a');
131 else {
132 putchar(c);
133 *lineptr++ = c;
134 }
135 }
136 }
137 lineleft = lineptr - line;
138 lineptr = line;
139 }
140 if (lineleft == 0)
141 return -1;
142 --lineleft;
143 return *lineptr++;
144}
145
146extern int vsprintf(char *buf, const char *fmt, va_list args);
147static char sprint_buf[1024];
148
149void
150printk(char *fmt, ...)
151{
152 va_list args;
153 int n;
154
155 va_start(args, fmt);
156 n = vsprintf(sprint_buf, fmt, args);
157 va_end(args);
158 writestring(stdout, sprint_buf, n);
159}
160
161int
162printf(char *fmt, ...)
163{
164 va_list args;
165 int n;
166
167 va_start(args, fmt);
168 n = vsprintf(sprint_buf, fmt, args);
169 va_end(args);
170 writestring(stdout, sprint_buf, n);
171 return n;
172}
diff --git a/arch/ppc/boot/simple/mpc10x_memory.c b/arch/ppc/boot/simple/mpc10x_memory.c
index c24290823f7f..8da8f576031d 100644
--- a/arch/ppc/boot/simple/mpc10x_memory.c
+++ b/arch/ppc/boot/simple/mpc10x_memory.c
@@ -50,10 +50,10 @@ MPC10X_PCI_OP(read, dword, u32 *, in_le32, 0)
50 * the system. This assumes that the firmware has correctly set up the memory 50 * the system. This assumes that the firmware has correctly set up the memory
51 * controller registers. On CONFIG_PPC_PREP, we know we are being called 51 * controller registers. On CONFIG_PPC_PREP, we know we are being called
52 * under a PReP memory map. On all other machines, we assume we are under 52 * under a PReP memory map. On all other machines, we assume we are under
53 * a CHRP memory map. Further, on CONFIG_PPC_MULTIPLATFORM we must rename 53 * a CHRP memory map. Further, on CONFIG_PPC_PREP we must rename
54 * this function. 54 * this function.
55 */ 55 */
56#ifdef CONFIG_PPC_MULTIPLATFORM 56#ifdef CONFIG_PPC_PREP
57#define get_mem_size mpc10x_get_mem_size 57#define get_mem_size mpc10x_get_mem_size
58#endif 58#endif
59unsigned long 59unsigned long
diff --git a/arch/ppc/boot/simple/relocate.S b/arch/ppc/boot/simple/relocate.S
index 7efddc507564..2533113c1cc5 100644
--- a/arch/ppc/boot/simple/relocate.S
+++ b/arch/ppc/boot/simple/relocate.S
@@ -194,7 +194,7 @@ start_ldr:
194 /* 194 /*
195 * Start at the begining. 195 * Start at the begining.
196 */ 196 */
197#ifdef CONFIG_PPC_MULTIPLATFORM 197#ifdef CONFIG_PPC_PREP
198 li r9,0xc 198 li r9,0xc
199 mtlr r9 199 mtlr r9
200 /* tell kernel we're prep, by putting 0xdeadc0de at KERNELLOAD, 200 /* tell kernel we're prep, by putting 0xdeadc0de at KERNELLOAD,
diff --git a/arch/ppc/boot/utils/addnote.c b/arch/ppc/boot/utils/addnote.c
deleted file mode 100644
index 6c52b18f2d04..000000000000
--- a/arch/ppc/boot/utils/addnote.c
+++ /dev/null
@@ -1,175 +0,0 @@
1/*
2 * Program to hack in a PT_NOTE program header entry in an ELF file.
3 * This is needed for OF on RS/6000s to load an image correctly.
4 * Note that OF needs a program header entry for the note, not an
5 * ELF section.
6 *
7 * Copyright 2000 Paul Mackerras.
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 * Usage: addnote zImage
15 */
16#include <stdio.h>
17#include <stdlib.h>
18#include <fcntl.h>
19#include <unistd.h>
20#include <string.h>
21
22char arch[] = "PowerPC";
23
24#define N_DESCR 6
25unsigned int descr[N_DESCR] = {
26#if 1
27 /* values for IBM RS/6000 machines */
28 0xffffffff, /* real-mode = true */
29 0x00c00000, /* real-base, i.e. where we expect OF to be */
30 0xffffffff, /* real-size */
31 0xffffffff, /* virt-base */
32 0xffffffff, /* virt-size */
33 0x4000, /* load-base */
34#else
35 /* values for longtrail CHRP */
36 0, /* real-mode = false */
37 0xffffffff, /* real-base */
38 0xffffffff, /* real-size */
39 0xffffffff, /* virt-base */
40 0xffffffff, /* virt-size */
41 0x00600000, /* load-base */
42#endif
43};
44
45unsigned char buf[512];
46
47#define GET_16BE(off) ((buf[off] << 8) + (buf[(off)+1]))
48#define GET_32BE(off) ((GET_16BE(off) << 16) + GET_16BE((off)+2))
49
50#define PUT_16BE(off, v) (buf[off] = ((v) >> 8) & 0xff, \
51 buf[(off) + 1] = (v) & 0xff)
52#define PUT_32BE(off, v) (PUT_16BE((off), (v) >> 16), \
53 PUT_16BE((off) + 2, (v)))
54
55/* Structure of an ELF file */
56#define E_IDENT 0 /* ELF header */
57#define E_PHOFF 28
58#define E_PHENTSIZE 42
59#define E_PHNUM 44
60#define E_HSIZE 52 /* size of ELF header */
61
62#define EI_MAGIC 0 /* offsets in E_IDENT area */
63#define EI_CLASS 4
64#define EI_DATA 5
65
66#define PH_TYPE 0 /* ELF program header */
67#define PH_OFFSET 4
68#define PH_FILESZ 16
69#define PH_HSIZE 32 /* size of program header */
70
71#define PT_NOTE 4 /* Program header type = note */
72
73#define ELFCLASS32 1
74#define ELFDATA2MSB 2
75
76unsigned char elf_magic[4] = { 0x7f, 'E', 'L', 'F' };
77
78int main(int ac, char **av)
79{
80 int fd, n, i;
81 int ph, ps, np;
82 int nnote, ns;
83
84 if (ac != 2) {
85 fprintf(stderr, "Usage: %s elf-file\n", av[0]);
86 exit(1);
87 }
88 fd = open(av[1], O_RDWR);
89 if (fd < 0) {
90 perror(av[1]);
91 exit(1);
92 }
93
94 nnote = strlen(arch) + 1 + (N_DESCR + 3) * 4;
95
96 n = read(fd, buf, sizeof(buf));
97 if (n < 0) {
98 perror("read");
99 exit(1);
100 }
101
102 if (n < E_HSIZE || memcmp(&buf[E_IDENT+EI_MAGIC], elf_magic, 4) != 0)
103 goto notelf;
104
105 if (buf[E_IDENT+EI_CLASS] != ELFCLASS32
106 || buf[E_IDENT+EI_DATA] != ELFDATA2MSB) {
107 fprintf(stderr, "%s is not a big-endian 32-bit ELF image\n",
108 av[1]);
109 exit(1);
110 }
111
112 ph = GET_32BE(E_PHOFF);
113 ps = GET_16BE(E_PHENTSIZE);
114 np = GET_16BE(E_PHNUM);
115 if (ph < E_HSIZE || ps < PH_HSIZE || np < 1)
116 goto notelf;
117 if (ph + (np + 1) * ps + nnote > n)
118 goto nospace;
119
120 for (i = 0; i < np; ++i) {
121 if (GET_32BE(ph + PH_TYPE) == PT_NOTE) {
122 fprintf(stderr, "%s already has a note entry\n",
123 av[1]);
124 exit(0);
125 }
126 ph += ps;
127 }
128
129 /* XXX check that the area we want to use is all zeroes */
130 for (i = 0; i < ps + nnote; ++i)
131 if (buf[ph + i] != 0)
132 goto nospace;
133
134 /* fill in the program header entry */
135 ns = ph + ps;
136 PUT_32BE(ph + PH_TYPE, PT_NOTE);
137 PUT_32BE(ph + PH_OFFSET, ns);
138 PUT_32BE(ph + PH_FILESZ, nnote);
139
140 /* fill in the note area we point to */
141 /* XXX we should probably make this a proper section */
142 PUT_32BE(ns, strlen(arch) + 1);
143 PUT_32BE(ns + 4, N_DESCR * 4);
144 PUT_32BE(ns + 8, 0x1275);
145 strcpy(&buf[ns + 12], arch);
146 ns += 12 + strlen(arch) + 1;
147 for (i = 0; i < N_DESCR; ++i)
148 PUT_32BE(ns + i * 4, descr[i]);
149
150 /* Update the number of program headers */
151 PUT_16BE(E_PHNUM, np + 1);
152
153 /* write back */
154 lseek(fd, (long) 0, SEEK_SET);
155 i = write(fd, buf, n);
156 if (i < 0) {
157 perror("write");
158 exit(1);
159 }
160 if (i < n) {
161 fprintf(stderr, "%s: write truncated\n", av[1]);
162 exit(1);
163 }
164
165 exit(0);
166
167 notelf:
168 fprintf(stderr, "%s does not appear to be an ELF file\n", av[0]);
169 exit(1);
170
171 nospace:
172 fprintf(stderr, "sorry, I can't find space in %s to put the note\n",
173 av[0]);
174 exit(1);
175}
diff --git a/arch/ppc/boot/utils/hack-coff.c b/arch/ppc/boot/utils/hack-coff.c
deleted file mode 100644
index 5e5a6573a1ef..000000000000
--- a/arch/ppc/boot/utils/hack-coff.c
+++ /dev/null
@@ -1,84 +0,0 @@
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/ppc/boot/utils/mknote.c b/arch/ppc/boot/utils/mknote.c
deleted file mode 100644
index b9fbb2cbfc8f..000000000000
--- a/arch/ppc/boot/utils/mknote.c
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * Copyright (C) Cort Dougan 1999.
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 * Generate a note section as per the CHRP specification.
10 *
11 */
12
13#include <stdio.h>
14#include <string.h>
15
16#define PL(x) printf("%c%c%c%c", ((x)>>24)&0xff, ((x)>>16)&0xff, ((x)>>8)&0xff, (x)&0xff );
17
18int main(void)
19{
20/* header */
21 /* namesz */
22 PL(strlen("PowerPC")+1);
23 /* descrsz */
24 PL(6*4);
25 /* type */
26 PL(0x1275);
27 /* name */
28 printf("PowerPC"); printf("%c", 0);
29
30/* descriptor */
31 /* real-mode */
32 PL(0xffffffff);
33 /* real-base */
34 PL(0x00c00000);
35 /* real-size */
36 PL(0xffffffff);
37 /* virt-base */
38 PL(0xffffffff);
39 /* virt-size */
40 PL(0xffffffff);
41 /* load-base */
42 PL(0x4000);
43 return 0;
44}
diff --git a/arch/ppc/configs/ibmchrp_defconfig b/arch/ppc/configs/ibmchrp_defconfig
deleted file mode 100644
index 27f3e69c1f96..000000000000
--- a/arch/ppc/configs/ibmchrp_defconfig
+++ /dev/null
@@ -1,875 +0,0 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17CONFIG_BROKEN_ON_SMP=y
18
19#
20# General setup
21#
22CONFIG_SWAP=y
23CONFIG_SYSVIPC=y
24CONFIG_POSIX_MQUEUE=y
25# CONFIG_BSD_PROCESS_ACCT is not set
26CONFIG_SYSCTL=y
27# CONFIG_AUDIT is not set
28CONFIG_LOG_BUF_SHIFT=14
29# CONFIG_HOTPLUG is not set
30CONFIG_IKCONFIG=y
31CONFIG_IKCONFIG_PROC=y
32# CONFIG_EMBEDDED is not set
33CONFIG_KALLSYMS=y
34CONFIG_FUTEX=y
35CONFIG_EPOLL=y
36CONFIG_IOSCHED_NOOP=y
37CONFIG_IOSCHED_AS=y
38CONFIG_IOSCHED_DEADLINE=y
39CONFIG_IOSCHED_CFQ=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
41
42#
43# Loadable module support
44#
45CONFIG_MODULES=y
46CONFIG_MODULE_UNLOAD=y
47CONFIG_MODULE_FORCE_UNLOAD=y
48CONFIG_OBSOLETE_MODPARM=y
49# CONFIG_MODVERSIONS is not set
50CONFIG_KMOD=y
51
52#
53# Processor
54#
55CONFIG_6xx=y
56# CONFIG_40x is not set
57# CONFIG_44x is not set
58# CONFIG_POWER3 is not set
59# CONFIG_POWER4 is not set
60# CONFIG_8xx is not set
61# CONFIG_ALTIVEC is not set
62# CONFIG_TAU is not set
63# CONFIG_CPU_FREQ is not set
64# CONFIG_PPC601_SYNC_FIX is not set
65CONFIG_PPC_STD_MMU=y
66
67#
68# Platform options
69#
70CONFIG_PPC_MULTIPLATFORM=y
71# CONFIG_APUS is not set
72# CONFIG_WILLOW is not set
73# CONFIG_PCORE is not set
74# CONFIG_POWERPMC250 is not set
75# CONFIG_EV64260 is not set
76# CONFIG_SPRUCE is not set
77# CONFIG_LOPEC is not set
78# CONFIG_MCPN765 is not set
79# CONFIG_MVME5100 is not set
80# CONFIG_PPLUS is not set
81# CONFIG_PRPMC750 is not set
82# CONFIG_PRPMC800 is not set
83# CONFIG_SANDPOINT is not set
84# CONFIG_ADIR is not set
85# CONFIG_K2 is not set
86# CONFIG_PAL4 is not set
87# CONFIG_GEMINI is not set
88# CONFIG_EST8260 is not set
89# CONFIG_SBS8260 is not set
90# CONFIG_RPX6 is not set
91# CONFIG_TQM8260 is not set
92CONFIG_PPC_CHRP=y
93CONFIG_PPC_PMAC=y
94CONFIG_PPC_PREP=y
95CONFIG_PPC_OF=y
96CONFIG_PPCBUG_NVRAM=y
97# CONFIG_SMP is not set
98# CONFIG_PREEMPT is not set
99CONFIG_HIGHMEM=y
100CONFIG_KERNEL_ELF=y
101CONFIG_BINFMT_ELF=y
102CONFIG_BINFMT_MISC=y
103CONFIG_PROC_DEVICETREE=y
104CONFIG_PPC_RTAS=y
105# CONFIG_PREP_RESIDUAL is not set
106# CONFIG_CMDLINE_BOOL is not set
107
108#
109# Bus options
110#
111CONFIG_ISA=y
112CONFIG_GENERIC_ISA_DMA=y
113CONFIG_PCI=y
114CONFIG_PCI_DOMAINS=y
115CONFIG_PCI_LEGACY_PROC=y
116CONFIG_PCI_NAMES=y
117
118#
119# Advanced setup
120#
121# CONFIG_ADVANCED_OPTIONS is not set
122
123#
124# Default settings for advanced configuration options are used
125#
126CONFIG_HIGHMEM_START=0xfe000000
127CONFIG_LOWMEM_SIZE=0x30000000
128CONFIG_KERNEL_START=0xc0000000
129CONFIG_TASK_SIZE=0x80000000
130CONFIG_BOOT_LOAD=0x00800000
131
132#
133# Device Drivers
134#
135
136#
137# Generic Driver Options
138#
139
140#
141# Memory Technology Devices (MTD)
142#
143# CONFIG_MTD is not set
144
145#
146# Parallel port support
147#
148# CONFIG_PARPORT is not set
149
150#
151# Plug and Play support
152#
153# CONFIG_PNP is not set
154
155#
156# Block devices
157#
158CONFIG_BLK_DEV_FD=y
159# CONFIG_BLK_DEV_XD is not set
160# CONFIG_BLK_CPQ_DA is not set
161# CONFIG_BLK_CPQ_CISS_DA is not set
162# CONFIG_BLK_DEV_DAC960 is not set
163# CONFIG_BLK_DEV_UMEM is not set
164CONFIG_BLK_DEV_LOOP=y
165# CONFIG_BLK_DEV_CRYPTOLOOP is not set
166# CONFIG_BLK_DEV_NBD is not set
167# CONFIG_BLK_DEV_CARMEL is not set
168CONFIG_BLK_DEV_RAM=y
169CONFIG_BLK_DEV_RAM_SIZE=4096
170CONFIG_BLK_DEV_INITRD=y
171CONFIG_LBD=y
172
173#
174# ATA/ATAPI/MFM/RLL support
175#
176# CONFIG_IDE is not set
177
178#
179# SCSI device support
180#
181CONFIG_SCSI=y
182CONFIG_SCSI_PROC_FS=y
183
184#
185# SCSI support type (disk, tape, CD-ROM)
186#
187CONFIG_BLK_DEV_SD=y
188CONFIG_CHR_DEV_ST=y
189# CONFIG_CHR_DEV_OSST is not set
190CONFIG_BLK_DEV_SR=y
191CONFIG_BLK_DEV_SR_VENDOR=y
192CONFIG_CHR_DEV_SG=y
193
194#
195# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
196#
197# CONFIG_SCSI_MULTI_LUN is not set
198# CONFIG_SCSI_REPORT_LUNS is not set
199CONFIG_SCSI_CONSTANTS=y
200# CONFIG_SCSI_LOGGING is not set
201
202#
203# SCSI Transport Attributes
204#
205CONFIG_SCSI_SPI_ATTRS=y
206# CONFIG_SCSI_FC_ATTRS is not set
207
208#
209# SCSI low-level drivers
210#
211# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
212# CONFIG_SCSI_7000FASST is not set
213# CONFIG_SCSI_ACARD is not set
214# CONFIG_SCSI_AHA152X is not set
215# CONFIG_SCSI_AHA1542 is not set
216# CONFIG_SCSI_AACRAID is not set
217# CONFIG_SCSI_AIC7XXX is not set
218# CONFIG_SCSI_AIC7XXX_OLD is not set
219# CONFIG_SCSI_AIC79XX is not set
220# CONFIG_SCSI_ADVANSYS is not set
221# CONFIG_SCSI_IN2000 is not set
222# CONFIG_SCSI_MEGARAID is not set
223# CONFIG_SCSI_SATA is not set
224# CONFIG_SCSI_BUSLOGIC is not set
225# CONFIG_SCSI_CPQFCTS is not set
226# CONFIG_SCSI_DMX3191D is not set
227# CONFIG_SCSI_DTC3280 is not set
228# CONFIG_SCSI_EATA is not set
229# CONFIG_SCSI_EATA_PIO is not set
230# CONFIG_SCSI_FUTURE_DOMAIN is not set
231# CONFIG_SCSI_GDTH is not set
232# CONFIG_SCSI_GENERIC_NCR5380 is not set
233# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
234# CONFIG_SCSI_IPS is not set
235# CONFIG_SCSI_INIA100 is not set
236# CONFIG_SCSI_NCR53C406A is not set
237CONFIG_SCSI_SYM53C8XX_2=y
238CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
239CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
240CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
241# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
242# CONFIG_SCSI_IPR is not set
243# CONFIG_SCSI_PAS16 is not set
244# CONFIG_SCSI_PSI240I is not set
245# CONFIG_SCSI_QLOGIC_FAS is not set
246# CONFIG_SCSI_QLOGIC_ISP is not set
247# CONFIG_SCSI_QLOGIC_FC is not set
248# CONFIG_SCSI_QLOGIC_1280 is not set
249CONFIG_SCSI_QLA2XXX=y
250# CONFIG_SCSI_QLA21XX is not set
251# CONFIG_SCSI_QLA22XX is not set
252# CONFIG_SCSI_QLA2300 is not set
253# CONFIG_SCSI_QLA2322 is not set
254# CONFIG_SCSI_QLA6312 is not set
255# CONFIG_SCSI_QLA6322 is not set
256# CONFIG_SCSI_SYM53C416 is not set
257# CONFIG_SCSI_DC395x is not set
258# CONFIG_SCSI_DC390T is not set
259# CONFIG_SCSI_T128 is not set
260# CONFIG_SCSI_U14_34F is not set
261# CONFIG_SCSI_NSP32 is not set
262# CONFIG_SCSI_DEBUG is not set
263# CONFIG_SCSI_MESH is not set
264# CONFIG_SCSI_MAC53C94 is not set
265
266#
267# Old CD-ROM drivers (not SCSI, not IDE)
268#
269# CONFIG_CD_NO_IDESCSI is not set
270
271#
272# Multi-device support (RAID and LVM)
273#
274# CONFIG_MD is not set
275
276#
277# Fusion MPT device support
278#
279# CONFIG_FUSION is not set
280
281#
282# IEEE 1394 (FireWire) support
283#
284# CONFIG_IEEE1394 is not set
285
286#
287# I2O device support
288#
289# CONFIG_I2O is not set
290
291#
292# Macintosh device drivers
293#
294# CONFIG_ADB is not set
295# CONFIG_ADB_CUDA is not set
296# CONFIG_ADB_PMU is not set
297# CONFIG_MAC_FLOPPY is not set
298# CONFIG_MAC_SERIAL is not set
299
300#
301# Networking support
302#
303CONFIG_NET=y
304
305#
306# Networking options
307#
308CONFIG_PACKET=y
309# CONFIG_PACKET_MMAP is not set
310# CONFIG_NETLINK_DEV is not set
311CONFIG_UNIX=y
312# CONFIG_NET_KEY is not set
313CONFIG_INET=y
314CONFIG_IP_MULTICAST=y
315# CONFIG_IP_ADVANCED_ROUTER is not set
316# CONFIG_IP_PNP is not set
317# CONFIG_NET_IPIP is not set
318# CONFIG_NET_IPGRE is not set
319# CONFIG_IP_MROUTE is not set
320# CONFIG_ARPD is not set
321CONFIG_SYN_COOKIES=y
322# CONFIG_INET_AH is not set
323# CONFIG_INET_ESP is not set
324# CONFIG_INET_IPCOMP is not set
325
326#
327# IP: Virtual Server Configuration
328#
329# CONFIG_IP_VS is not set
330# CONFIG_IPV6 is not set
331CONFIG_NETFILTER=y
332# CONFIG_NETFILTER_DEBUG is not set
333
334#
335# IP: Netfilter Configuration
336#
337CONFIG_IP_NF_CONNTRACK=m
338CONFIG_IP_NF_FTP=m
339CONFIG_IP_NF_IRC=m
340CONFIG_IP_NF_TFTP=m
341CONFIG_IP_NF_AMANDA=m
342# CONFIG_IP_NF_QUEUE is not set
343CONFIG_IP_NF_IPTABLES=m
344CONFIG_IP_NF_MATCH_LIMIT=m
345CONFIG_IP_NF_MATCH_IPRANGE=m
346CONFIG_IP_NF_MATCH_MAC=m
347# CONFIG_IP_NF_MATCH_PKTTYPE is not set
348CONFIG_IP_NF_MATCH_MARK=m
349CONFIG_IP_NF_MATCH_MULTIPORT=m
350CONFIG_IP_NF_MATCH_TOS=m
351CONFIG_IP_NF_MATCH_RECENT=m
352CONFIG_IP_NF_MATCH_ECN=m
353CONFIG_IP_NF_MATCH_DSCP=m
354CONFIG_IP_NF_MATCH_AH_ESP=m
355CONFIG_IP_NF_MATCH_LENGTH=m
356CONFIG_IP_NF_MATCH_TTL=m
357CONFIG_IP_NF_MATCH_TCPMSS=m
358CONFIG_IP_NF_MATCH_HELPER=m
359CONFIG_IP_NF_MATCH_STATE=m
360CONFIG_IP_NF_MATCH_CONNTRACK=m
361CONFIG_IP_NF_MATCH_OWNER=m
362CONFIG_IP_NF_FILTER=m
363CONFIG_IP_NF_TARGET_REJECT=m
364CONFIG_IP_NF_NAT=m
365CONFIG_IP_NF_NAT_NEEDED=y
366CONFIG_IP_NF_TARGET_MASQUERADE=m
367CONFIG_IP_NF_TARGET_REDIRECT=m
368CONFIG_IP_NF_TARGET_NETMAP=m
369CONFIG_IP_NF_TARGET_SAME=m
370CONFIG_IP_NF_NAT_SNMP_BASIC=m
371CONFIG_IP_NF_NAT_IRC=m
372CONFIG_IP_NF_NAT_FTP=m
373CONFIG_IP_NF_NAT_TFTP=m
374CONFIG_IP_NF_NAT_AMANDA=m
375# CONFIG_IP_NF_MANGLE is not set
376# CONFIG_IP_NF_TARGET_LOG is not set
377CONFIG_IP_NF_TARGET_ULOG=m
378CONFIG_IP_NF_TARGET_TCPMSS=m
379CONFIG_IP_NF_ARPTABLES=m
380CONFIG_IP_NF_ARPFILTER=m
381CONFIG_IP_NF_ARP_MANGLE=m
382CONFIG_IP_NF_COMPAT_IPCHAINS=m
383# CONFIG_IP_NF_COMPAT_IPFWADM is not set
384CONFIG_IP_NF_TARGET_NOTRACK=m
385CONFIG_IP_NF_RAW=m
386
387#
388# SCTP Configuration (EXPERIMENTAL)
389#
390# CONFIG_IP_SCTP is not set
391# CONFIG_ATM is not set
392# CONFIG_BRIDGE is not set
393# CONFIG_VLAN_8021Q is not set
394# CONFIG_DECNET is not set
395# CONFIG_LLC2 is not set
396# CONFIG_IPX is not set
397# CONFIG_ATALK is not set
398# CONFIG_X25 is not set
399# CONFIG_LAPB is not set
400# CONFIG_NET_DIVERT is not set
401# CONFIG_ECONET is not set
402# CONFIG_WAN_ROUTER is not set
403# CONFIG_NET_HW_FLOWCONTROL is not set
404
405#
406# QoS and/or fair queueing
407#
408# CONFIG_NET_SCHED is not set
409
410#
411# Network testing
412#
413# CONFIG_NET_PKTGEN is not set
414# CONFIG_NETPOLL is not set
415# CONFIG_NET_POLL_CONTROLLER is not set
416# CONFIG_HAMRADIO is not set
417# CONFIG_IRDA is not set
418# CONFIG_BT is not set
419CONFIG_NETDEVICES=y
420# CONFIG_DUMMY is not set
421# CONFIG_BONDING is not set
422# CONFIG_EQUALIZER is not set
423# CONFIG_TUN is not set
424
425#
426# ARCnet devices
427#
428# CONFIG_ARCNET is not set
429
430#
431# Ethernet (10 or 100Mbit)
432#
433CONFIG_NET_ETHERNET=y
434CONFIG_MII=y
435# CONFIG_MACE is not set
436# CONFIG_BMAC is not set
437# CONFIG_OAKNET is not set
438# CONFIG_HAPPYMEAL is not set
439# CONFIG_SUNGEM is not set
440# CONFIG_NET_VENDOR_3COM is not set
441# CONFIG_LANCE is not set
442# CONFIG_NET_VENDOR_SMC is not set
443# CONFIG_NET_VENDOR_RACAL is not set
444
445#
446# Tulip family network device support
447#
448# CONFIG_NET_TULIP is not set
449# CONFIG_AT1700 is not set
450# CONFIG_DEPCA is not set
451# CONFIG_HP100 is not set
452# CONFIG_NET_ISA is not set
453CONFIG_NET_PCI=y
454CONFIG_PCNET32=y
455# CONFIG_AMD8111_ETH is not set
456# CONFIG_ADAPTEC_STARFIRE is not set
457# CONFIG_AC3200 is not set
458# CONFIG_APRICOT is not set
459# CONFIG_B44 is not set
460# CONFIG_FORCEDETH is not set
461# CONFIG_CS89x0 is not set
462# CONFIG_DGRS is not set
463# CONFIG_EEPRO100 is not set
464# CONFIG_E100 is not set
465# CONFIG_FEALNX is not set
466# CONFIG_NATSEMI is not set
467# CONFIG_NE2K_PCI is not set
468# CONFIG_8139CP is not set
469# CONFIG_8139TOO is not set
470# CONFIG_SIS900 is not set
471# CONFIG_EPIC100 is not set
472# CONFIG_SUNDANCE is not set
473# CONFIG_TLAN is not set
474# CONFIG_VIA_RHINE is not set
475# CONFIG_NET_POCKET is not set
476
477#
478# Ethernet (1000 Mbit)
479#
480# CONFIG_ACENIC is not set
481# CONFIG_DL2K is not set
482# CONFIG_E1000 is not set
483# CONFIG_NS83820 is not set
484# CONFIG_HAMACHI is not set
485# CONFIG_YELLOWFIN is not set
486# CONFIG_R8169 is not set
487# CONFIG_SK98LIN is not set
488# CONFIG_TIGON3 is not set
489
490#
491# Ethernet (10000 Mbit)
492#
493# CONFIG_IXGB is not set
494# CONFIG_S2IO is not set
495
496#
497# Token Ring devices
498#
499# CONFIG_TR is not set
500
501#
502# Wireless LAN (non-hamradio)
503#
504# CONFIG_NET_RADIO is not set
505
506#
507# Wan interfaces
508#
509# CONFIG_WAN is not set
510# CONFIG_FDDI is not set
511# CONFIG_HIPPI is not set
512# CONFIG_PPP is not set
513# CONFIG_SLIP is not set
514# CONFIG_NET_FC is not set
515# CONFIG_RCPCI is not set
516# CONFIG_SHAPER is not set
517# CONFIG_NETCONSOLE is not set
518
519#
520# ISDN subsystem
521#
522# CONFIG_ISDN is not set
523
524#
525# Telephony Support
526#
527# CONFIG_PHONE is not set
528
529#
530# Input device support
531#
532CONFIG_INPUT=y
533
534#
535# Userland interfaces
536#
537CONFIG_INPUT_MOUSEDEV=y
538CONFIG_INPUT_MOUSEDEV_PSAUX=y
539CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
540CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
541# CONFIG_INPUT_JOYDEV is not set
542# CONFIG_INPUT_TSDEV is not set
543CONFIG_INPUT_EVDEV=y
544# CONFIG_INPUT_EVBUG is not set
545
546#
547# Input I/O drivers
548#
549# CONFIG_GAMEPORT is not set
550CONFIG_SOUND_GAMEPORT=y
551CONFIG_SERIO=y
552CONFIG_SERIO_I8042=y
553CONFIG_SERIO_SERPORT=y
554# CONFIG_SERIO_CT82C710 is not set
555# CONFIG_SERIO_PCIPS2 is not set
556
557#
558# Input Device Drivers
559#
560CONFIG_INPUT_KEYBOARD=y
561CONFIG_KEYBOARD_ATKBD=y
562# CONFIG_KEYBOARD_SUNKBD is not set
563# CONFIG_KEYBOARD_LKKBD is not set
564# CONFIG_KEYBOARD_XTKBD is not set
565# CONFIG_KEYBOARD_NEWTON is not set
566CONFIG_INPUT_MOUSE=y
567CONFIG_MOUSE_PS2=y
568# CONFIG_MOUSE_SERIAL is not set
569# CONFIG_MOUSE_INPORT is not set
570# CONFIG_MOUSE_LOGIBM is not set
571# CONFIG_MOUSE_PC110PAD is not set
572# CONFIG_MOUSE_VSXXXAA is not set
573# CONFIG_INPUT_JOYSTICK is not set
574# CONFIG_INPUT_TOUCHSCREEN is not set
575CONFIG_INPUT_MISC=y
576CONFIG_INPUT_UINPUT=y
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#
589CONFIG_SERIAL_8250=y
590# CONFIG_SERIAL_8250_CONSOLE is not set
591CONFIG_SERIAL_8250_NR_UARTS=4
592# CONFIG_SERIAL_8250_EXTENDED is not set
593
594#
595# Non-8250 serial port support
596#
597CONFIG_SERIAL_CORE=y
598# CONFIG_SERIAL_PMACZILOG is not set
599CONFIG_UNIX98_PTYS=y
600CONFIG_LEGACY_PTYS=y
601CONFIG_LEGACY_PTY_COUNT=256
602# CONFIG_QIC02_TAPE is not set
603
604#
605# IPMI
606#
607# CONFIG_IPMI_HANDLER is not set
608
609#
610# Watchdog Cards
611#
612# CONFIG_WATCHDOG is not set
613CONFIG_NVRAM=y
614CONFIG_GEN_RTC=y
615# CONFIG_GEN_RTC_X is not set
616# CONFIG_DTLK is not set
617# CONFIG_R3964 is not set
618# CONFIG_APPLICOM is not set
619
620#
621# Ftape, the floppy tape device driver
622#
623# CONFIG_FTAPE is not set
624# CONFIG_AGP is not set
625# CONFIG_DRM is not set
626# CONFIG_RAW_DRIVER is not set
627
628#
629# I2C support
630#
631# CONFIG_I2C is not set
632
633#
634# Misc devices
635#
636
637#
638# Multimedia devices
639#
640# CONFIG_VIDEO_DEV is not set
641
642#
643# Digital Video Broadcasting Devices
644#
645# CONFIG_DVB is not set
646
647#
648# Graphics support
649#
650CONFIG_FB=y
651# CONFIG_FB_PM2 is not set
652# CONFIG_FB_CYBER2000 is not set
653CONFIG_FB_OF=y
654# CONFIG_FB_CONTROL is not set
655# CONFIG_FB_PLATINUM is not set
656# CONFIG_FB_VALKYRIE is not set
657# CONFIG_FB_CT65550 is not set
658# CONFIG_FB_IMSTT is not set
659# CONFIG_FB_S3TRIO is not set
660# CONFIG_FB_VGA16 is not set
661# CONFIG_FB_RIVA is not set
662CONFIG_FB_MATROX=y
663CONFIG_FB_MATROX_MILLENIUM=y
664CONFIG_FB_MATROX_MYSTIQUE=y
665# CONFIG_FB_MATROX_G450 is not set
666CONFIG_FB_MATROX_G100A=y
667CONFIG_FB_MATROX_G100=y
668# CONFIG_FB_MATROX_MULTIHEAD is not set
669# CONFIG_FB_RADEON_OLD is not set
670# CONFIG_FB_RADEON is not set
671# CONFIG_FB_ATY128 is not set
672# CONFIG_FB_ATY is not set
673# CONFIG_FB_SIS is not set
674# CONFIG_FB_NEOMAGIC is not set
675# CONFIG_FB_KYRO is not set
676CONFIG_FB_3DFX=y
677# CONFIG_FB_VOODOO1 is not set
678# CONFIG_FB_TRIDENT is not set
679# CONFIG_FB_VIRTUAL is not set
680
681#
682# Console display driver support
683#
684CONFIG_VGA_CONSOLE=y
685# CONFIG_MDA_CONSOLE is not set
686CONFIG_DUMMY_CONSOLE=y
687CONFIG_FRAMEBUFFER_CONSOLE=y
688CONFIG_PCI_CONSOLE=y
689# CONFIG_FONTS is not set
690CONFIG_FONT_8x8=y
691CONFIG_FONT_8x16=y
692
693#
694# Logo configuration
695#
696CONFIG_LOGO=y
697CONFIG_LOGO_LINUX_MONO=y
698CONFIG_LOGO_LINUX_VGA16=y
699CONFIG_LOGO_LINUX_CLUT224=y
700
701#
702# Sound
703#
704# CONFIG_SOUND is not set
705
706#
707# USB support
708#
709# CONFIG_USB is not set
710
711#
712# USB Gadget Support
713#
714# CONFIG_USB_GADGET is not set
715
716#
717# File systems
718#
719CONFIG_EXT2_FS=y
720# CONFIG_EXT2_FS_XATTR is not set
721# CONFIG_EXT3_FS is not set
722# CONFIG_JBD is not set
723# CONFIG_REISERFS_FS is not set
724# CONFIG_JFS_FS is not set
725# CONFIG_XFS_FS is not set
726# CONFIG_MINIX_FS is not set
727# CONFIG_ROMFS_FS is not set
728# CONFIG_QUOTA is not set
729# CONFIG_AUTOFS_FS is not set
730# CONFIG_AUTOFS4_FS is not set
731
732#
733# CD-ROM/DVD Filesystems
734#
735CONFIG_ISO9660_FS=y
736# CONFIG_JOLIET is not set
737# CONFIG_ZISOFS is not set
738# CONFIG_UDF_FS is not set
739
740#
741# DOS/FAT/NT Filesystems
742#
743CONFIG_FAT_FS=m
744CONFIG_MSDOS_FS=m
745CONFIG_VFAT_FS=m
746# CONFIG_NTFS_FS is not set
747
748#
749# Pseudo filesystems
750#
751CONFIG_PROC_FS=y
752CONFIG_PROC_KCORE=y
753CONFIG_SYSFS=y
754CONFIG_DEVFS_FS=y
755# CONFIG_DEVFS_MOUNT is not set
756# CONFIG_DEVFS_DEBUG is not set
757# CONFIG_DEVPTS_FS_XATTR is not set
758CONFIG_TMPFS=y
759# CONFIG_HUGETLB_PAGE is not set
760CONFIG_RAMFS=y
761
762#
763# Miscellaneous filesystems
764#
765# CONFIG_ADFS_FS is not set
766# CONFIG_AFFS_FS is not set
767# CONFIG_HFS_FS is not set
768# CONFIG_HFSPLUS_FS is not set
769# CONFIG_BEFS_FS is not set
770# CONFIG_BFS_FS is not set
771# CONFIG_EFS_FS is not set
772# CONFIG_CRAMFS is not set
773# CONFIG_VXFS_FS is not set
774# CONFIG_HPFS_FS is not set
775# CONFIG_QNX4FS_FS is not set
776# CONFIG_SYSV_FS is not set
777# CONFIG_UFS_FS is not set
778
779#
780# Network File Systems
781#
782# CONFIG_NFS_FS is not set
783# CONFIG_NFSD is not set
784# CONFIG_EXPORTFS is not set
785# CONFIG_SMB_FS is not set
786# CONFIG_CIFS is not set
787# CONFIG_NCP_FS is not set
788# CONFIG_CODA_FS is not set
789# CONFIG_AFS_FS is not set
790
791#
792# Partition Types
793#
794CONFIG_PARTITION_ADVANCED=y
795# CONFIG_ACORN_PARTITION is not set
796# CONFIG_OSF_PARTITION is not set
797# CONFIG_AMIGA_PARTITION is not set
798# CONFIG_ATARI_PARTITION is not set
799CONFIG_MAC_PARTITION=y
800CONFIG_MSDOS_PARTITION=y
801# CONFIG_BSD_DISKLABEL is not set
802# CONFIG_MINIX_SUBPARTITION is not set
803# CONFIG_SOLARIS_X86_PARTITION is not set
804# CONFIG_UNIXWARE_DISKLABEL is not set
805# CONFIG_LDM_PARTITION is not set
806# CONFIG_NEC98_PARTITION is not set
807# CONFIG_SGI_PARTITION is not set
808# CONFIG_ULTRIX_PARTITION is not set
809# CONFIG_SUN_PARTITION is not set
810# CONFIG_EFI_PARTITION is not set
811
812#
813# Native Language Support
814#
815CONFIG_NLS=y
816CONFIG_NLS_DEFAULT="iso8859-1"
817# CONFIG_NLS_CODEPAGE_437 is not set
818# CONFIG_NLS_CODEPAGE_737 is not set
819# CONFIG_NLS_CODEPAGE_775 is not set
820# CONFIG_NLS_CODEPAGE_850 is not set
821# CONFIG_NLS_CODEPAGE_852 is not set
822# CONFIG_NLS_CODEPAGE_855 is not set
823# CONFIG_NLS_CODEPAGE_857 is not set
824# CONFIG_NLS_CODEPAGE_860 is not set
825# CONFIG_NLS_CODEPAGE_861 is not set
826# CONFIG_NLS_CODEPAGE_862 is not set
827# CONFIG_NLS_CODEPAGE_863 is not set
828# CONFIG_NLS_CODEPAGE_864 is not set
829# CONFIG_NLS_CODEPAGE_865 is not set
830# CONFIG_NLS_CODEPAGE_866 is not set
831# CONFIG_NLS_CODEPAGE_869 is not set
832# CONFIG_NLS_CODEPAGE_936 is not set
833# CONFIG_NLS_CODEPAGE_950 is not set
834# CONFIG_NLS_CODEPAGE_932 is not set
835# CONFIG_NLS_CODEPAGE_949 is not set
836# CONFIG_NLS_CODEPAGE_874 is not set
837# CONFIG_NLS_ISO8859_8 is not set
838# CONFIG_NLS_CODEPAGE_1250 is not set
839# CONFIG_NLS_CODEPAGE_1251 is not set
840CONFIG_NLS_ISO8859_1=m
841# CONFIG_NLS_ISO8859_2 is not set
842# CONFIG_NLS_ISO8859_3 is not set
843# CONFIG_NLS_ISO8859_4 is not set
844# CONFIG_NLS_ISO8859_5 is not set
845# CONFIG_NLS_ISO8859_6 is not set
846# CONFIG_NLS_ISO8859_7 is not set
847# CONFIG_NLS_ISO8859_9 is not set
848# CONFIG_NLS_ISO8859_13 is not set
849# CONFIG_NLS_ISO8859_14 is not set
850# CONFIG_NLS_ISO8859_15 is not set
851# CONFIG_NLS_KOI8_R is not set
852# CONFIG_NLS_KOI8_U is not set
853# CONFIG_NLS_UTF8 is not set
854
855#
856# Library routines
857#
858CONFIG_CRC32=y
859# CONFIG_LIBCRC32C is not set
860
861#
862# Kernel hacking
863#
864# CONFIG_DEBUG_KERNEL is not set
865# CONFIG_BOOTX_TEXT is not set
866
867#
868# Security options
869#
870# CONFIG_SECURITY is not set
871
872#
873# Cryptographic options
874#
875# CONFIG_CRYPTO is not set
diff --git a/arch/ppc/configs/pmac_defconfig b/arch/ppc/configs/pmac_defconfig
deleted file mode 100644
index a2db8b541c9b..000000000000
--- a/arch/ppc/configs/pmac_defconfig
+++ /dev/null
@@ -1,1591 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.13-rc3
4# Wed Jul 13 14:13:13 2005
5#
6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
10CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y
12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y
14CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=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_SWAP=y
29CONFIG_SYSVIPC=y
30CONFIG_POSIX_MQUEUE=y
31# CONFIG_BSD_PROCESS_ACCT is not set
32CONFIG_SYSCTL=y
33# CONFIG_AUDIT is not set
34CONFIG_HOTPLUG=y
35CONFIG_KOBJECT_UEVENT=y
36CONFIG_IKCONFIG=y
37CONFIG_IKCONFIG_PROC=y
38# CONFIG_EMBEDDED is not set
39CONFIG_KALLSYMS=y
40# CONFIG_KALLSYMS_ALL is not set
41# CONFIG_KALLSYMS_EXTRA_PASS is not set
42CONFIG_PRINTK=y
43CONFIG_BUG=y
44CONFIG_BASE_FULL=y
45CONFIG_FUTEX=y
46CONFIG_EPOLL=y
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#
58CONFIG_MODULES=y
59CONFIG_MODULE_UNLOAD=y
60# CONFIG_MODULE_FORCE_UNLOAD is not set
61CONFIG_OBSOLETE_MODPARM=y
62CONFIG_MODVERSIONS=y
63CONFIG_MODULE_SRCVERSION_ALL=y
64CONFIG_KMOD=y
65
66#
67# Processor
68#
69CONFIG_6xx=y
70# CONFIG_40x is not set
71# CONFIG_44x is not set
72# CONFIG_POWER3 is not set
73# CONFIG_POWER4 is not set
74# CONFIG_8xx is not set
75# CONFIG_E200 is not set
76# CONFIG_E500 is not set
77CONFIG_PPC_FPU=y
78CONFIG_ALTIVEC=y
79CONFIG_TAU=y
80# CONFIG_TAU_INT is not set
81# CONFIG_TAU_AVERAGE is not set
82# CONFIG_KEXEC is not set
83CONFIG_CPU_FREQ=y
84CONFIG_CPU_FREQ_TABLE=y
85# CONFIG_CPU_FREQ_DEBUG is not set
86CONFIG_CPU_FREQ_STAT=m
87CONFIG_CPU_FREQ_STAT_DETAILS=y
88CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
89# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
90CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
91CONFIG_CPU_FREQ_GOV_POWERSAVE=m
92CONFIG_CPU_FREQ_GOV_USERSPACE=m
93CONFIG_CPU_FREQ_GOV_ONDEMAND=m
94CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
95CONFIG_CPU_FREQ_PMAC=y
96CONFIG_PPC601_SYNC_FIX=y
97CONFIG_PM=y
98CONFIG_PPC_STD_MMU=y
99
100#
101# Platform options
102#
103CONFIG_PPC_MULTIPLATFORM=y
104# CONFIG_APUS is not set
105# CONFIG_KATANA is not set
106# CONFIG_WILLOW is not set
107# CONFIG_CPCI690 is not set
108# CONFIG_PCORE is not set
109# CONFIG_POWERPMC250 is not set
110# CONFIG_CHESTNUT is not set
111# CONFIG_SPRUCE is not set
112# CONFIG_HDPU is not set
113# CONFIG_EV64260 is not set
114# CONFIG_LOPEC is not set
115# CONFIG_MCPN765 is not set
116# CONFIG_MVME5100 is not set
117# CONFIG_PPLUS is not set
118# CONFIG_PRPMC750 is not set
119# CONFIG_PRPMC800 is not set
120# CONFIG_SANDPOINT is not set
121# CONFIG_RADSTONE_PPC7D is not set
122# CONFIG_ADIR is not set
123# CONFIG_K2 is not set
124# CONFIG_PAL4 is not set
125# CONFIG_GEMINI is not set
126# CONFIG_EST8260 is not set
127# CONFIG_SBC82xx is not set
128# CONFIG_SBS8260 is not set
129# CONFIG_RPX8260 is not set
130# CONFIG_TQM8260 is not set
131# CONFIG_ADS8272 is not set
132# CONFIG_PQ2FADS is not set
133# CONFIG_LITE5200 is not set
134# CONFIG_MPC834x_SYS is not set
135CONFIG_PPC_CHRP=y
136CONFIG_PPC_PMAC=y
137CONFIG_PPC_PREP=y
138CONFIG_PPC_OF=y
139CONFIG_PPCBUG_NVRAM=y
140# CONFIG_SMP is not set
141# CONFIG_HIGHMEM is not set
142# CONFIG_HZ_100 is not set
143CONFIG_HZ_250=y
144# CONFIG_HZ_1000 is not set
145CONFIG_HZ=250
146CONFIG_PREEMPT_NONE=y
147# CONFIG_PREEMPT_VOLUNTARY is not set
148# CONFIG_PREEMPT is not set
149CONFIG_SELECT_MEMORY_MODEL=y
150CONFIG_FLATMEM_MANUAL=y
151# CONFIG_DISCONTIGMEM_MANUAL is not set
152# CONFIG_SPARSEMEM_MANUAL is not set
153CONFIG_FLATMEM=y
154CONFIG_FLAT_NODE_MEM_MAP=y
155CONFIG_BINFMT_ELF=y
156CONFIG_BINFMT_MISC=m
157CONFIG_PROC_DEVICETREE=y
158# CONFIG_PREP_RESIDUAL is not set
159# CONFIG_CMDLINE_BOOL is not set
160# CONFIG_PM_DEBUG is not set
161CONFIG_SOFTWARE_SUSPEND=y
162CONFIG_PM_STD_PARTITION=""
163# CONFIG_SECCOMP is not set
164CONFIG_ISA_DMA_API=y
165
166#
167# Bus options
168#
169# CONFIG_ISA is not set
170CONFIG_GENERIC_ISA_DMA=y
171CONFIG_PCI=y
172CONFIG_PCI_DOMAINS=y
173CONFIG_PCI_LEGACY_PROC=y
174CONFIG_PCI_NAMES=y
175# CONFIG_PCI_DEBUG is not set
176
177#
178# PCCARD (PCMCIA/CardBus) support
179#
180CONFIG_PCCARD=m
181# CONFIG_PCMCIA_DEBUG is not set
182CONFIG_PCMCIA=m
183# CONFIG_PCMCIA_LOAD_CIS is not set
184# CONFIG_PCMCIA_IOCTL is not set
185CONFIG_CARDBUS=y
186
187#
188# PC-card bridges
189#
190CONFIG_YENTA=m
191# CONFIG_PD6729 is not set
192# CONFIG_I82092 is not set
193# CONFIG_TCIC is not set
194CONFIG_PCCARD_NONSTATIC=m
195
196#
197# Advanced setup
198#
199CONFIG_ADVANCED_OPTIONS=y
200CONFIG_HIGHMEM_START=0xfe000000
201# CONFIG_LOWMEM_SIZE_BOOL is not set
202CONFIG_LOWMEM_SIZE=0x30000000
203# CONFIG_KERNEL_START_BOOL is not set
204CONFIG_KERNEL_START=0xc0000000
205CONFIG_TASK_SIZE_BOOL=y
206CONFIG_TASK_SIZE=0xc0000000
207CONFIG_BOOT_LOAD=0x00800000
208
209#
210# Networking
211#
212CONFIG_NET=y
213
214#
215# Networking options
216#
217CONFIG_PACKET=y
218# CONFIG_PACKET_MMAP is not set
219CONFIG_UNIX=y
220# CONFIG_NET_KEY is not set
221CONFIG_INET=y
222CONFIG_IP_MULTICAST=y
223# CONFIG_IP_ADVANCED_ROUTER is not set
224CONFIG_IP_FIB_HASH=y
225# CONFIG_IP_PNP is not set
226# CONFIG_NET_IPIP is not set
227# CONFIG_NET_IPGRE is not set
228# CONFIG_IP_MROUTE is not set
229# CONFIG_ARPD is not set
230CONFIG_SYN_COOKIES=y
231# CONFIG_INET_AH is not set
232# CONFIG_INET_ESP is not set
233# CONFIG_INET_IPCOMP is not set
234# CONFIG_INET_TUNNEL is not set
235CONFIG_IP_TCPDIAG=y
236# CONFIG_IP_TCPDIAG_IPV6 is not set
237# CONFIG_TCP_CONG_ADVANCED is not set
238CONFIG_TCP_CONG_BIC=y
239
240#
241# IP: Virtual Server Configuration
242#
243# CONFIG_IP_VS is not set
244# CONFIG_IPV6 is not set
245CONFIG_NETFILTER=y
246# CONFIG_NETFILTER_DEBUG is not set
247
248#
249# IP: Netfilter Configuration
250#
251CONFIG_IP_NF_CONNTRACK=m
252CONFIG_IP_NF_CT_ACCT=y
253CONFIG_IP_NF_CONNTRACK_MARK=y
254CONFIG_IP_NF_CT_PROTO_SCTP=m
255CONFIG_IP_NF_FTP=m
256CONFIG_IP_NF_IRC=m
257CONFIG_IP_NF_TFTP=m
258CONFIG_IP_NF_AMANDA=m
259CONFIG_IP_NF_QUEUE=m
260CONFIG_IP_NF_IPTABLES=m
261CONFIG_IP_NF_MATCH_LIMIT=m
262CONFIG_IP_NF_MATCH_IPRANGE=m
263CONFIG_IP_NF_MATCH_MAC=m
264CONFIG_IP_NF_MATCH_PKTTYPE=m
265CONFIG_IP_NF_MATCH_MARK=m
266CONFIG_IP_NF_MATCH_MULTIPORT=m
267CONFIG_IP_NF_MATCH_TOS=m
268CONFIG_IP_NF_MATCH_RECENT=m
269CONFIG_IP_NF_MATCH_ECN=m
270CONFIG_IP_NF_MATCH_DSCP=m
271CONFIG_IP_NF_MATCH_AH_ESP=m
272CONFIG_IP_NF_MATCH_LENGTH=m
273CONFIG_IP_NF_MATCH_TTL=m
274CONFIG_IP_NF_MATCH_TCPMSS=m
275CONFIG_IP_NF_MATCH_HELPER=m
276CONFIG_IP_NF_MATCH_STATE=m
277CONFIG_IP_NF_MATCH_CONNTRACK=m
278CONFIG_IP_NF_MATCH_OWNER=m
279CONFIG_IP_NF_MATCH_ADDRTYPE=m
280CONFIG_IP_NF_MATCH_REALM=m
281CONFIG_IP_NF_MATCH_SCTP=m
282CONFIG_IP_NF_MATCH_COMMENT=m
283CONFIG_IP_NF_MATCH_CONNMARK=m
284CONFIG_IP_NF_MATCH_HASHLIMIT=m
285CONFIG_IP_NF_FILTER=m
286CONFIG_IP_NF_TARGET_REJECT=m
287CONFIG_IP_NF_TARGET_LOG=m
288CONFIG_IP_NF_TARGET_ULOG=m
289CONFIG_IP_NF_TARGET_TCPMSS=m
290CONFIG_IP_NF_NAT=m
291CONFIG_IP_NF_NAT_NEEDED=y
292CONFIG_IP_NF_TARGET_MASQUERADE=m
293CONFIG_IP_NF_TARGET_REDIRECT=m
294CONFIG_IP_NF_TARGET_NETMAP=m
295CONFIG_IP_NF_TARGET_SAME=m
296CONFIG_IP_NF_NAT_SNMP_BASIC=m
297CONFIG_IP_NF_NAT_IRC=m
298CONFIG_IP_NF_NAT_FTP=m
299CONFIG_IP_NF_NAT_TFTP=m
300CONFIG_IP_NF_NAT_AMANDA=m
301CONFIG_IP_NF_MANGLE=m
302CONFIG_IP_NF_TARGET_TOS=m
303CONFIG_IP_NF_TARGET_ECN=m
304CONFIG_IP_NF_TARGET_DSCP=m
305CONFIG_IP_NF_TARGET_MARK=m
306CONFIG_IP_NF_TARGET_CLASSIFY=m
307CONFIG_IP_NF_TARGET_CONNMARK=m
308CONFIG_IP_NF_TARGET_CLUSTERIP=m
309CONFIG_IP_NF_RAW=m
310CONFIG_IP_NF_TARGET_NOTRACK=m
311CONFIG_IP_NF_ARPTABLES=m
312CONFIG_IP_NF_ARPFILTER=m
313CONFIG_IP_NF_ARP_MANGLE=m
314
315#
316# SCTP Configuration (EXPERIMENTAL)
317#
318# CONFIG_IP_SCTP is not set
319# CONFIG_ATM is not set
320# CONFIG_BRIDGE is not set
321# CONFIG_VLAN_8021Q is not set
322# CONFIG_DECNET is not set
323# CONFIG_LLC2 is not set
324# CONFIG_IPX is not set
325# CONFIG_ATALK is not set
326# CONFIG_X25 is not set
327# CONFIG_LAPB is not set
328# CONFIG_NET_DIVERT is not set
329# CONFIG_ECONET is not set
330# CONFIG_WAN_ROUTER is not set
331# CONFIG_NET_SCHED is not set
332CONFIG_NET_CLS_ROUTE=y
333
334#
335# Network testing
336#
337# CONFIG_NET_PKTGEN is not set
338CONFIG_NETPOLL=y
339# CONFIG_NETPOLL_RX is not set
340# CONFIG_NETPOLL_TRAP is not set
341CONFIG_NET_POLL_CONTROLLER=y
342# CONFIG_HAMRADIO is not set
343CONFIG_IRDA=m
344
345#
346# IrDA protocols
347#
348CONFIG_IRLAN=m
349CONFIG_IRNET=m
350CONFIG_IRCOMM=m
351# CONFIG_IRDA_ULTRA is not set
352
353#
354# IrDA options
355#
356CONFIG_IRDA_CACHE_LAST_LSAP=y
357CONFIG_IRDA_FAST_RR=y
358# CONFIG_IRDA_DEBUG is not set
359
360#
361# Infrared-port device drivers
362#
363
364#
365# SIR device drivers
366#
367CONFIG_IRTTY_SIR=m
368
369#
370# Dongle support
371#
372# CONFIG_DONGLE is not set
373
374#
375# Old SIR device drivers
376#
377# CONFIG_IRPORT_SIR is not set
378
379#
380# Old Serial dongle support
381#
382
383#
384# FIR device drivers
385#
386# CONFIG_USB_IRDA is not set
387# CONFIG_SIGMATEL_FIR is not set
388# CONFIG_NSC_FIR is not set
389# CONFIG_WINBOND_FIR is not set
390# CONFIG_TOSHIBA_FIR is not set
391# CONFIG_SMC_IRCC_FIR is not set
392# CONFIG_ALI_FIR is not set
393# CONFIG_VLSI_FIR is not set
394# CONFIG_VIA_FIR is not set
395# CONFIG_BT is not set
396
397#
398# Device Drivers
399#
400
401#
402# Generic Driver Options
403#
404# CONFIG_STANDALONE is not set
405CONFIG_PREVENT_FIRMWARE_BUILD=y
406CONFIG_FW_LOADER=m
407# CONFIG_DEBUG_DRIVER is not set
408
409#
410# Memory Technology Devices (MTD)
411#
412# CONFIG_MTD is not set
413
414#
415# Parallel port support
416#
417# CONFIG_PARPORT is not set
418
419#
420# Plug and Play support
421#
422
423#
424# Block devices
425#
426# CONFIG_BLK_DEV_FD is not set
427CONFIG_MAC_FLOPPY=m
428# CONFIG_BLK_CPQ_DA is not set
429# CONFIG_BLK_CPQ_CISS_DA is not set
430# CONFIG_BLK_DEV_DAC960 is not set
431# CONFIG_BLK_DEV_UMEM is not set
432# CONFIG_BLK_DEV_COW_COMMON is not set
433CONFIG_BLK_DEV_LOOP=y
434# CONFIG_BLK_DEV_CRYPTOLOOP is not set
435# CONFIG_BLK_DEV_NBD is not set
436# CONFIG_BLK_DEV_SX8 is not set
437# CONFIG_BLK_DEV_UB is not set
438CONFIG_BLK_DEV_RAM=y
439CONFIG_BLK_DEV_RAM_COUNT=16
440CONFIG_BLK_DEV_RAM_SIZE=4096
441CONFIG_BLK_DEV_INITRD=y
442CONFIG_INITRAMFS_SOURCE=""
443CONFIG_LBD=y
444CONFIG_CDROM_PKTCDVD=m
445CONFIG_CDROM_PKTCDVD_BUFFERS=8
446# CONFIG_CDROM_PKTCDVD_WCACHE is not set
447
448#
449# IO Schedulers
450#
451CONFIG_IOSCHED_NOOP=y
452CONFIG_IOSCHED_AS=y
453CONFIG_IOSCHED_DEADLINE=y
454CONFIG_IOSCHED_CFQ=y
455# CONFIG_ATA_OVER_ETH is not set
456
457#
458# ATA/ATAPI/MFM/RLL support
459#
460CONFIG_IDE=y
461CONFIG_BLK_DEV_IDE=y
462
463#
464# Please see Documentation/ide.txt for help/info on IDE drives
465#
466# CONFIG_BLK_DEV_IDE_SATA is not set
467CONFIG_BLK_DEV_IDEDISK=y
468# CONFIG_IDEDISK_MULTI_MODE is not set
469# CONFIG_BLK_DEV_IDECS is not set
470CONFIG_BLK_DEV_IDECD=y
471# CONFIG_BLK_DEV_IDETAPE is not set
472CONFIG_BLK_DEV_IDEFLOPPY=y
473CONFIG_BLK_DEV_IDESCSI=y
474# CONFIG_IDE_TASK_IOCTL is not set
475
476#
477# IDE chipset support/bugfixes
478#
479# CONFIG_IDE_GENERIC is not set
480CONFIG_BLK_DEV_IDEPCI=y
481CONFIG_IDEPCI_SHARE_IRQ=y
482# CONFIG_BLK_DEV_OFFBOARD is not set
483CONFIG_BLK_DEV_GENERIC=y
484# CONFIG_BLK_DEV_OPTI621 is not set
485# CONFIG_BLK_DEV_SL82C105 is not set
486CONFIG_BLK_DEV_IDEDMA_PCI=y
487# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
488CONFIG_IDEDMA_PCI_AUTO=y
489# CONFIG_IDEDMA_ONLYDISK is not set
490# CONFIG_BLK_DEV_AEC62XX is not set
491# CONFIG_BLK_DEV_ALI15X3 is not set
492# CONFIG_BLK_DEV_AMD74XX is not set
493CONFIG_BLK_DEV_CMD64X=y
494# CONFIG_BLK_DEV_TRIFLEX is not set
495# CONFIG_BLK_DEV_CY82C693 is not set
496# CONFIG_BLK_DEV_CS5520 is not set
497# CONFIG_BLK_DEV_CS5530 is not set
498# CONFIG_BLK_DEV_HPT34X is not set
499# CONFIG_BLK_DEV_HPT366 is not set
500# CONFIG_BLK_DEV_SC1200 is not set
501# CONFIG_BLK_DEV_PIIX is not set
502# CONFIG_BLK_DEV_IT821X is not set
503# CONFIG_BLK_DEV_NS87415 is not set
504# CONFIG_BLK_DEV_PDC202XX_OLD is not set
505CONFIG_BLK_DEV_PDC202XX_NEW=y
506# CONFIG_PDC202XX_FORCE is not set
507# CONFIG_BLK_DEV_SVWKS is not set
508# CONFIG_BLK_DEV_SIIMAGE is not set
509# CONFIG_BLK_DEV_SLC90E66 is not set
510# CONFIG_BLK_DEV_TRM290 is not set
511# CONFIG_BLK_DEV_VIA82CXXX is not set
512CONFIG_BLK_DEV_IDE_PMAC=y
513CONFIG_BLK_DEV_IDE_PMAC_ATA100FIRST=y
514CONFIG_BLK_DEV_IDEDMA_PMAC=y
515CONFIG_BLK_DEV_IDE_PMAC_BLINK=y
516# CONFIG_IDE_ARM is not set
517CONFIG_BLK_DEV_IDEDMA=y
518# CONFIG_IDEDMA_IVB is not set
519CONFIG_IDEDMA_AUTO=y
520# CONFIG_BLK_DEV_HD is not set
521
522#
523# SCSI device support
524#
525CONFIG_SCSI=y
526CONFIG_SCSI_PROC_FS=y
527
528#
529# SCSI support type (disk, tape, CD-ROM)
530#
531CONFIG_BLK_DEV_SD=y
532CONFIG_CHR_DEV_ST=y
533# CONFIG_CHR_DEV_OSST is not set
534CONFIG_BLK_DEV_SR=y
535CONFIG_BLK_DEV_SR_VENDOR=y
536CONFIG_CHR_DEV_SG=y
537# CONFIG_CHR_DEV_SCH is not set
538
539#
540# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
541#
542# CONFIG_SCSI_MULTI_LUN is not set
543CONFIG_SCSI_CONSTANTS=y
544# CONFIG_SCSI_LOGGING is not set
545
546#
547# SCSI Transport Attributes
548#
549CONFIG_SCSI_SPI_ATTRS=y
550# CONFIG_SCSI_FC_ATTRS is not set
551# CONFIG_SCSI_ISCSI_ATTRS is not set
552
553#
554# SCSI low-level drivers
555#
556# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
557# CONFIG_SCSI_3W_9XXX is not set
558# CONFIG_SCSI_ACARD is not set
559# CONFIG_SCSI_AACRAID is not set
560CONFIG_SCSI_AIC7XXX=m
561CONFIG_AIC7XXX_CMDS_PER_DEVICE=253
562CONFIG_AIC7XXX_RESET_DELAY_MS=15000
563CONFIG_AIC7XXX_DEBUG_ENABLE=y
564CONFIG_AIC7XXX_DEBUG_MASK=0
565CONFIG_AIC7XXX_REG_PRETTY_PRINT=y
566CONFIG_SCSI_AIC7XXX_OLD=m
567# CONFIG_SCSI_AIC79XX is not set
568# CONFIG_SCSI_DPT_I2O is not set
569# CONFIG_MEGARAID_NEWGEN is not set
570# CONFIG_MEGARAID_LEGACY is not set
571# CONFIG_SCSI_SATA is not set
572# CONFIG_SCSI_BUSLOGIC is not set
573# CONFIG_SCSI_DMX3191D is not set
574# CONFIG_SCSI_EATA is not set
575# CONFIG_SCSI_FUTURE_DOMAIN is not set
576# CONFIG_SCSI_GDTH is not set
577# CONFIG_SCSI_IPS is not set
578# CONFIG_SCSI_INITIO is not set
579# CONFIG_SCSI_INIA100 is not set
580CONFIG_SCSI_SYM53C8XX_2=y
581CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
582CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
583CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
584# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
585# CONFIG_SCSI_IPR is not set
586# CONFIG_SCSI_QLOGIC_FC is not set
587# CONFIG_SCSI_QLOGIC_1280 is not set
588CONFIG_SCSI_QLA2XXX=y
589# CONFIG_SCSI_QLA21XX is not set
590# CONFIG_SCSI_QLA22XX is not set
591# CONFIG_SCSI_QLA2300 is not set
592# CONFIG_SCSI_QLA2322 is not set
593# CONFIG_SCSI_QLA6312 is not set
594# CONFIG_SCSI_LPFC is not set
595# CONFIG_SCSI_DC395x is not set
596# CONFIG_SCSI_DC390T is not set
597# CONFIG_SCSI_NSP32 is not set
598# CONFIG_SCSI_DEBUG is not set
599CONFIG_SCSI_MESH=y
600CONFIG_SCSI_MESH_SYNC_RATE=5
601CONFIG_SCSI_MESH_RESET_DELAY_MS=1000
602CONFIG_SCSI_MAC53C94=y
603
604#
605# PCMCIA SCSI adapter support
606#
607# CONFIG_PCMCIA_AHA152X is not set
608# CONFIG_PCMCIA_FDOMAIN is not set
609# CONFIG_PCMCIA_NINJA_SCSI is not set
610# CONFIG_PCMCIA_QLOGIC is not set
611# CONFIG_PCMCIA_SYM53C500 is not set
612
613#
614# Multi-device support (RAID and LVM)
615#
616# CONFIG_MD is not set
617
618#
619# Fusion MPT device support
620#
621# CONFIG_FUSION is not set
622# CONFIG_FUSION_SPI is not set
623# CONFIG_FUSION_FC is not set
624
625#
626# IEEE 1394 (FireWire) support
627#
628CONFIG_IEEE1394=m
629
630#
631# Subsystem Options
632#
633# CONFIG_IEEE1394_VERBOSEDEBUG is not set
634# CONFIG_IEEE1394_OUI_DB is not set
635CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
636CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
637# CONFIG_IEEE1394_EXPORT_FULL_API is not set
638
639#
640# Device Drivers
641#
642# CONFIG_IEEE1394_PCILYNX is not set
643CONFIG_IEEE1394_OHCI1394=m
644
645#
646# Protocol Drivers
647#
648CONFIG_IEEE1394_VIDEO1394=m
649CONFIG_IEEE1394_SBP2=m
650# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
651CONFIG_IEEE1394_ETH1394=m
652CONFIG_IEEE1394_DV1394=m
653CONFIG_IEEE1394_RAWIO=m
654CONFIG_IEEE1394_CMP=m
655CONFIG_IEEE1394_AMDTP=m
656
657#
658# I2O device support
659#
660# CONFIG_I2O is not set
661
662#
663# Macintosh device drivers
664#
665CONFIG_ADB=y
666CONFIG_ADB_CUDA=y
667CONFIG_ADB_PMU=y
668CONFIG_PMAC_APM_EMU=y
669CONFIG_PMAC_MEDIABAY=y
670CONFIG_PMAC_BACKLIGHT=y
671CONFIG_ADB_MACIO=y
672CONFIG_INPUT_ADBHID=y
673CONFIG_MAC_EMUMOUSEBTN=y
674CONFIG_THERM_WINDTUNNEL=m
675CONFIG_THERM_ADT746X=m
676# CONFIG_ANSLCD is not set
677
678#
679# Network device support
680#
681CONFIG_NETDEVICES=y
682# CONFIG_DUMMY is not set
683# CONFIG_BONDING is not set
684# CONFIG_EQUALIZER is not set
685CONFIG_TUN=m
686
687#
688# ARCnet devices
689#
690# CONFIG_ARCNET is not set
691
692#
693# Ethernet (10 or 100Mbit)
694#
695CONFIG_NET_ETHERNET=y
696CONFIG_MII=y
697CONFIG_MACE=y
698# CONFIG_MACE_AAUI_PORT is not set
699CONFIG_BMAC=y
700# CONFIG_HAPPYMEAL is not set
701CONFIG_SUNGEM=y
702# CONFIG_NET_VENDOR_3COM is not set
703
704#
705# Tulip family network device support
706#
707# CONFIG_NET_TULIP is not set
708# CONFIG_HP100 is not set
709CONFIG_NET_PCI=y
710CONFIG_PCNET32=y
711# CONFIG_AMD8111_ETH is not set
712# CONFIG_ADAPTEC_STARFIRE is not set
713# CONFIG_B44 is not set
714# CONFIG_FORCEDETH is not set
715# CONFIG_DGRS is not set
716# CONFIG_EEPRO100 is not set
717# CONFIG_E100 is not set
718# CONFIG_FEALNX is not set
719# CONFIG_NATSEMI is not set
720# CONFIG_NE2K_PCI is not set
721# CONFIG_8139CP is not set
722# CONFIG_8139TOO is not set
723# CONFIG_SIS900 is not set
724# CONFIG_EPIC100 is not set
725# CONFIG_SUNDANCE is not set
726# CONFIG_TLAN is not set
727# CONFIG_VIA_RHINE is not set
728
729#
730# Ethernet (1000 Mbit)
731#
732# CONFIG_ACENIC is not set
733# CONFIG_DL2K is not set
734# CONFIG_E1000 is not set
735# CONFIG_NS83820 is not set
736# CONFIG_HAMACHI is not set
737# CONFIG_YELLOWFIN is not set
738# CONFIG_R8169 is not set
739# CONFIG_SKGE is not set
740# CONFIG_SK98LIN is not set
741# CONFIG_VIA_VELOCITY is not set
742# CONFIG_TIGON3 is not set
743# CONFIG_BNX2 is not set
744# CONFIG_MV643XX_ETH is not set
745
746#
747# Ethernet (10000 Mbit)
748#
749# CONFIG_IXGB is not set
750# CONFIG_S2IO is not set
751
752#
753# Token Ring devices
754#
755# CONFIG_TR is not set
756
757#
758# Wireless LAN (non-hamradio)
759#
760CONFIG_NET_RADIO=y
761
762#
763# Obsolete Wireless cards support (pre-802.11)
764#
765# CONFIG_STRIP is not set
766# CONFIG_PCMCIA_WAVELAN is not set
767# CONFIG_PCMCIA_NETWAVE is not set
768
769#
770# Wireless 802.11 Frequency Hopping cards support
771#
772# CONFIG_PCMCIA_RAYCS is not set
773
774#
775# Wireless 802.11b ISA/PCI cards support
776#
777CONFIG_HERMES=m
778CONFIG_APPLE_AIRPORT=m
779# CONFIG_PLX_HERMES is not set
780# CONFIG_TMD_HERMES is not set
781# CONFIG_PCI_HERMES is not set
782# CONFIG_ATMEL is not set
783
784#
785# Wireless 802.11b Pcmcia/Cardbus cards support
786#
787CONFIG_PCMCIA_HERMES=m
788# CONFIG_AIRO_CS is not set
789# CONFIG_PCMCIA_WL3501 is not set
790
791#
792# Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
793#
794# CONFIG_PRISM54 is not set
795CONFIG_NET_WIRELESS=y
796
797#
798# PCMCIA network device support
799#
800# CONFIG_NET_PCMCIA is not set
801
802#
803# Wan interfaces
804#
805# CONFIG_WAN is not set
806# CONFIG_FDDI is not set
807# CONFIG_HIPPI is not set
808CONFIG_PPP=y
809CONFIG_PPP_MULTILINK=y
810# CONFIG_PPP_FILTER is not set
811CONFIG_PPP_ASYNC=y
812CONFIG_PPP_SYNC_TTY=m
813CONFIG_PPP_DEFLATE=y
814CONFIG_PPP_BSDCOMP=m
815CONFIG_PPPOE=m
816# CONFIG_SLIP is not set
817# CONFIG_NET_FC is not set
818# CONFIG_SHAPER is not set
819CONFIG_NETCONSOLE=m
820
821#
822# ISDN subsystem
823#
824# CONFIG_ISDN is not set
825
826#
827# Telephony Support
828#
829# CONFIG_PHONE is not set
830
831#
832# Input device support
833#
834CONFIG_INPUT=y
835
836#
837# Userland interfaces
838#
839CONFIG_INPUT_MOUSEDEV=y
840# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
841CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
842CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
843# CONFIG_INPUT_JOYDEV is not set
844# CONFIG_INPUT_TSDEV is not set
845CONFIG_INPUT_EVDEV=y
846# CONFIG_INPUT_EVBUG is not set
847
848#
849# Input Device Drivers
850#
851CONFIG_INPUT_KEYBOARD=y
852# CONFIG_KEYBOARD_ATKBD is not set
853# CONFIG_KEYBOARD_SUNKBD is not set
854# CONFIG_KEYBOARD_LKKBD is not set
855# CONFIG_KEYBOARD_XTKBD is not set
856# CONFIG_KEYBOARD_NEWTON is not set
857CONFIG_INPUT_MOUSE=y
858# CONFIG_MOUSE_PS2 is not set
859# CONFIG_MOUSE_SERIAL is not set
860# CONFIG_MOUSE_VSXXXAA is not set
861# CONFIG_INPUT_JOYSTICK is not set
862# CONFIG_INPUT_TOUCHSCREEN is not set
863# CONFIG_INPUT_MISC is not set
864
865#
866# Hardware I/O ports
867#
868# CONFIG_SERIO is not set
869# CONFIG_GAMEPORT is not set
870
871#
872# Character devices
873#
874CONFIG_VT=y
875CONFIG_VT_CONSOLE=y
876CONFIG_HW_CONSOLE=y
877# CONFIG_SERIAL_NONSTANDARD is not set
878
879#
880# Serial drivers
881#
882CONFIG_SERIAL_8250=m
883CONFIG_SERIAL_8250_CS=m
884CONFIG_SERIAL_8250_NR_UARTS=4
885# CONFIG_SERIAL_8250_EXTENDED is not set
886
887#
888# Non-8250 serial port support
889#
890CONFIG_SERIAL_CORE=y
891CONFIG_SERIAL_CORE_CONSOLE=y
892CONFIG_SERIAL_PMACZILOG=y
893CONFIG_SERIAL_PMACZILOG_CONSOLE=y
894# CONFIG_SERIAL_JSM is not set
895CONFIG_UNIX98_PTYS=y
896CONFIG_LEGACY_PTYS=y
897CONFIG_LEGACY_PTY_COUNT=256
898
899#
900# IPMI
901#
902# CONFIG_IPMI_HANDLER is not set
903
904#
905# Watchdog Cards
906#
907# CONFIG_WATCHDOG is not set
908CONFIG_NVRAM=y
909CONFIG_GEN_RTC=y
910# CONFIG_GEN_RTC_X is not set
911# CONFIG_DTLK is not set
912# CONFIG_R3964 is not set
913# CONFIG_APPLICOM is not set
914
915#
916# Ftape, the floppy tape device driver
917#
918CONFIG_AGP=m
919CONFIG_AGP_UNINORTH=m
920CONFIG_DRM=m
921# CONFIG_DRM_TDFX is not set
922CONFIG_DRM_R128=m
923CONFIG_DRM_RADEON=m
924# CONFIG_DRM_MGA is not set
925# CONFIG_DRM_SIS is not set
926# CONFIG_DRM_VIA is not set
927
928#
929# PCMCIA character devices
930#
931# CONFIG_SYNCLINK_CS is not set
932# CONFIG_RAW_DRIVER is not set
933
934#
935# TPM devices
936#
937# CONFIG_TCG_TPM is not set
938
939#
940# I2C support
941#
942CONFIG_I2C=y
943CONFIG_I2C_CHARDEV=m
944
945#
946# I2C Algorithms
947#
948CONFIG_I2C_ALGOBIT=y
949# CONFIG_I2C_ALGOPCF is not set
950# CONFIG_I2C_ALGOPCA is not set
951
952#
953# I2C Hardware Bus support
954#
955# CONFIG_I2C_ALI1535 is not set
956# CONFIG_I2C_ALI1563 is not set
957# CONFIG_I2C_ALI15X3 is not set
958# CONFIG_I2C_AMD756 is not set
959# CONFIG_I2C_AMD8111 is not set
960# CONFIG_I2C_HYDRA is not set
961# CONFIG_I2C_I801 is not set
962# CONFIG_I2C_I810 is not set
963# CONFIG_I2C_PIIX4 is not set
964# CONFIG_I2C_ISA is not set
965CONFIG_I2C_KEYWEST=m
966# CONFIG_I2C_MPC is not set
967# CONFIG_I2C_NFORCE2 is not set
968# CONFIG_I2C_PARPORT_LIGHT is not set
969# CONFIG_I2C_PROSAVAGE is not set
970# CONFIG_I2C_SAVAGE4 is not set
971# CONFIG_SCx200_ACB is not set
972# CONFIG_I2C_SIS5595 is not set
973# CONFIG_I2C_SIS630 is not set
974# CONFIG_I2C_SIS96X is not set
975# CONFIG_I2C_STUB is not set
976# CONFIG_I2C_VIA is not set
977# CONFIG_I2C_VIAPRO is not set
978# CONFIG_I2C_VOODOO3 is not set
979# CONFIG_I2C_PCA_ISA is not set
980# CONFIG_I2C_SENSOR is not set
981
982#
983# Miscellaneous I2C Chip support
984#
985# CONFIG_SENSORS_DS1337 is not set
986# CONFIG_SENSORS_DS1374 is not set
987# CONFIG_SENSORS_EEPROM is not set
988# CONFIG_SENSORS_PCF8574 is not set
989# CONFIG_SENSORS_PCA9539 is not set
990# CONFIG_SENSORS_PCF8591 is not set
991# CONFIG_SENSORS_RTC8564 is not set
992# CONFIG_SENSORS_M41T00 is not set
993# CONFIG_SENSORS_MAX6875 is not set
994# CONFIG_I2C_DEBUG_CORE is not set
995# CONFIG_I2C_DEBUG_ALGO is not set
996# CONFIG_I2C_DEBUG_BUS is not set
997# CONFIG_I2C_DEBUG_CHIP is not set
998
999#
1000# Dallas's 1-wire bus
1001#
1002# CONFIG_W1 is not set
1003
1004#
1005# Hardware Monitoring support
1006#
1007# CONFIG_HWMON is not set
1008
1009#
1010# Misc devices
1011#
1012
1013#
1014# Multimedia devices
1015#
1016# CONFIG_VIDEO_DEV is not set
1017
1018#
1019# Digital Video Broadcasting Devices
1020#
1021# CONFIG_DVB is not set
1022
1023#
1024# Graphics support
1025#
1026CONFIG_FB=y
1027CONFIG_FB_CFB_FILLRECT=y
1028CONFIG_FB_CFB_COPYAREA=y
1029CONFIG_FB_CFB_IMAGEBLIT=y
1030CONFIG_FB_SOFT_CURSOR=y
1031CONFIG_FB_MACMODES=y
1032CONFIG_FB_MODE_HELPERS=y
1033CONFIG_FB_TILEBLITTING=y
1034# CONFIG_FB_CIRRUS is not set
1035# CONFIG_FB_PM2 is not set
1036# CONFIG_FB_CYBER2000 is not set
1037CONFIG_FB_OF=y
1038CONFIG_FB_CONTROL=y
1039CONFIG_FB_PLATINUM=y
1040CONFIG_FB_VALKYRIE=y
1041CONFIG_FB_CT65550=y
1042# CONFIG_FB_ASILIANT is not set
1043CONFIG_FB_IMSTT=y
1044# CONFIG_FB_VGA16 is not set
1045# CONFIG_FB_NVIDIA is not set
1046# CONFIG_FB_RIVA is not set
1047CONFIG_FB_MATROX=y
1048CONFIG_FB_MATROX_MILLENIUM=y
1049CONFIG_FB_MATROX_MYSTIQUE=y
1050CONFIG_FB_MATROX_G=y
1051# CONFIG_FB_MATROX_I2C is not set
1052# CONFIG_FB_MATROX_MULTIHEAD is not set
1053# CONFIG_FB_RADEON_OLD is not set
1054CONFIG_FB_RADEON=y
1055CONFIG_FB_RADEON_I2C=y
1056# CONFIG_FB_RADEON_DEBUG is not set
1057CONFIG_FB_ATY128=y
1058CONFIG_FB_ATY=y
1059CONFIG_FB_ATY_CT=y
1060CONFIG_FB_ATY_GENERIC_LCD=y
1061# CONFIG_FB_ATY_XL_INIT is not set
1062CONFIG_FB_ATY_GX=y
1063# CONFIG_FB_SAVAGE is not set
1064# CONFIG_FB_SIS is not set
1065# CONFIG_FB_NEOMAGIC is not set
1066# CONFIG_FB_KYRO is not set
1067CONFIG_FB_3DFX=y
1068CONFIG_FB_3DFX_ACCEL=y
1069# CONFIG_FB_VOODOO1 is not set
1070# CONFIG_FB_TRIDENT is not set
1071# CONFIG_FB_S1D13XXX is not set
1072# CONFIG_FB_VIRTUAL is not set
1073
1074#
1075# Console display driver support
1076#
1077# CONFIG_VGA_CONSOLE is not set
1078CONFIG_DUMMY_CONSOLE=y
1079CONFIG_FRAMEBUFFER_CONSOLE=y
1080# CONFIG_FONTS is not set
1081CONFIG_FONT_8x8=y
1082CONFIG_FONT_8x16=y
1083
1084#
1085# Logo configuration
1086#
1087CONFIG_LOGO=y
1088CONFIG_LOGO_LINUX_MONO=y
1089CONFIG_LOGO_LINUX_VGA16=y
1090CONFIG_LOGO_LINUX_CLUT224=y
1091CONFIG_BACKLIGHT_LCD_SUPPORT=y
1092CONFIG_BACKLIGHT_CLASS_DEVICE=y
1093CONFIG_BACKLIGHT_DEVICE=y
1094CONFIG_LCD_CLASS_DEVICE=y
1095CONFIG_LCD_DEVICE=y
1096
1097#
1098# Sound
1099#
1100CONFIG_SOUND=m
1101CONFIG_DMASOUND_PMAC=m
1102CONFIG_DMASOUND=m
1103
1104#
1105# Advanced Linux Sound Architecture
1106#
1107CONFIG_SND=m
1108CONFIG_SND_TIMER=m
1109CONFIG_SND_PCM=m
1110CONFIG_SND_HWDEP=m
1111CONFIG_SND_RAWMIDI=m
1112CONFIG_SND_SEQUENCER=m
1113CONFIG_SND_SEQ_DUMMY=m
1114CONFIG_SND_OSSEMUL=y
1115CONFIG_SND_MIXER_OSS=m
1116CONFIG_SND_PCM_OSS=m
1117CONFIG_SND_SEQUENCER_OSS=y
1118# CONFIG_SND_VERBOSE_PRINTK is not set
1119# CONFIG_SND_DEBUG is not set
1120
1121#
1122# Generic devices
1123#
1124CONFIG_SND_DUMMY=m
1125# CONFIG_SND_VIRMIDI is not set
1126# CONFIG_SND_MTPAV is not set
1127# CONFIG_SND_SERIAL_U16550 is not set
1128# CONFIG_SND_MPU401 is not set
1129
1130#
1131# PCI devices
1132#
1133# CONFIG_SND_ALI5451 is not set
1134# CONFIG_SND_ATIIXP is not set
1135# CONFIG_SND_ATIIXP_MODEM is not set
1136# CONFIG_SND_AU8810 is not set
1137# CONFIG_SND_AU8820 is not set
1138# CONFIG_SND_AU8830 is not set
1139# CONFIG_SND_AZT3328 is not set
1140# CONFIG_SND_BT87X is not set
1141# CONFIG_SND_CS46XX is not set
1142# CONFIG_SND_CS4281 is not set
1143# CONFIG_SND_EMU10K1 is not set
1144# CONFIG_SND_EMU10K1X is not set
1145# CONFIG_SND_CA0106 is not set
1146# CONFIG_SND_KORG1212 is not set
1147# CONFIG_SND_MIXART is not set
1148# CONFIG_SND_NM256 is not set
1149# CONFIG_SND_RME32 is not set
1150# CONFIG_SND_RME96 is not set
1151# CONFIG_SND_RME9652 is not set
1152# CONFIG_SND_HDSP is not set
1153# CONFIG_SND_HDSPM is not set
1154# CONFIG_SND_TRIDENT is not set
1155# CONFIG_SND_YMFPCI is not set
1156# CONFIG_SND_ALS4000 is not set
1157# CONFIG_SND_CMIPCI is not set
1158# CONFIG_SND_ENS1370 is not set
1159# CONFIG_SND_ENS1371 is not set
1160# CONFIG_SND_ES1938 is not set
1161# CONFIG_SND_ES1968 is not set
1162# CONFIG_SND_MAESTRO3 is not set
1163# CONFIG_SND_FM801 is not set
1164# CONFIG_SND_ICE1712 is not set
1165# CONFIG_SND_ICE1724 is not set
1166# CONFIG_SND_INTEL8X0 is not set
1167# CONFIG_SND_INTEL8X0M is not set
1168# CONFIG_SND_SONICVIBES is not set
1169# CONFIG_SND_VIA82XX is not set
1170# CONFIG_SND_VIA82XX_MODEM is not set
1171# CONFIG_SND_VX222 is not set
1172# CONFIG_SND_HDA_INTEL is not set
1173
1174#
1175# ALSA PowerMac devices
1176#
1177CONFIG_SND_POWERMAC=m
1178
1179#
1180# USB devices
1181#
1182CONFIG_SND_USB_AUDIO=m
1183CONFIG_SND_USB_USX2Y=m
1184
1185#
1186# PCMCIA devices
1187#
1188
1189#
1190# Open Sound System
1191#
1192# CONFIG_SOUND_PRIME is not set
1193
1194#
1195# USB support
1196#
1197CONFIG_USB_ARCH_HAS_HCD=y
1198CONFIG_USB_ARCH_HAS_OHCI=y
1199CONFIG_USB=y
1200# CONFIG_USB_DEBUG is not set
1201
1202#
1203# Miscellaneous USB options
1204#
1205CONFIG_USB_DEVICEFS=y
1206# CONFIG_USB_BANDWIDTH is not set
1207CONFIG_USB_DYNAMIC_MINORS=y
1208CONFIG_USB_SUSPEND=y
1209# CONFIG_USB_OTG is not set
1210
1211#
1212# USB Host Controller Drivers
1213#
1214# CONFIG_USB_EHCI_HCD is not set
1215# CONFIG_USB_ISP116X_HCD is not set
1216CONFIG_USB_OHCI_HCD=y
1217# CONFIG_USB_OHCI_BIG_ENDIAN is not set
1218CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1219# CONFIG_USB_UHCI_HCD is not set
1220# CONFIG_USB_SL811_HCD is not set
1221
1222#
1223# USB Device Class drivers
1224#
1225# CONFIG_USB_AUDIO is not set
1226# CONFIG_USB_BLUETOOTH_TTY is not set
1227# CONFIG_USB_MIDI is not set
1228CONFIG_USB_ACM=m
1229CONFIG_USB_PRINTER=m
1230
1231#
1232# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
1233#
1234# CONFIG_USB_STORAGE is not set
1235
1236#
1237# USB Input Devices
1238#
1239CONFIG_USB_HID=y
1240CONFIG_USB_HIDINPUT=y
1241# CONFIG_HID_FF is not set
1242CONFIG_USB_HIDDEV=y
1243# CONFIG_USB_AIPTEK is not set
1244# CONFIG_USB_WACOM is not set
1245# CONFIG_USB_ACECAD is not set
1246# CONFIG_USB_KBTAB is not set
1247# CONFIG_USB_POWERMATE is not set
1248# CONFIG_USB_MTOUCH is not set
1249# CONFIG_USB_ITMTOUCH is not set
1250# CONFIG_USB_EGALAX is not set
1251# CONFIG_USB_XPAD is not set
1252# CONFIG_USB_ATI_REMOTE is not set
1253# CONFIG_USB_KEYSPAN_REMOTE is not set
1254
1255#
1256# USB Imaging devices
1257#
1258# CONFIG_USB_MDC800 is not set
1259# CONFIG_USB_MICROTEK is not set
1260
1261#
1262# USB Multimedia devices
1263#
1264# CONFIG_USB_DABUSB is not set
1265
1266#
1267# Video4Linux support is needed for USB Multimedia device support
1268#
1269
1270#
1271# USB Network Adapters
1272#
1273# CONFIG_USB_CATC is not set
1274# CONFIG_USB_KAWETH is not set
1275CONFIG_USB_PEGASUS=m
1276# CONFIG_USB_RTL8150 is not set
1277# CONFIG_USB_USBNET is not set
1278# CONFIG_USB_ZD1201 is not set
1279# CONFIG_USB_MON is not set
1280
1281#
1282# USB port drivers
1283#
1284
1285#
1286# USB Serial Converter support
1287#
1288CONFIG_USB_SERIAL=m
1289# CONFIG_USB_SERIAL_GENERIC is not set
1290# CONFIG_USB_SERIAL_AIRPRIME is not set
1291# CONFIG_USB_SERIAL_BELKIN is not set
1292# CONFIG_USB_SERIAL_WHITEHEAT is not set
1293# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1294# CONFIG_USB_SERIAL_CP2101 is not set
1295# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1296# CONFIG_USB_SERIAL_EMPEG is not set
1297# CONFIG_USB_SERIAL_FTDI_SIO is not set
1298CONFIG_USB_SERIAL_VISOR=m
1299# CONFIG_USB_SERIAL_IPAQ is not set
1300# CONFIG_USB_SERIAL_IR is not set
1301# CONFIG_USB_SERIAL_EDGEPORT is not set
1302# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1303# CONFIG_USB_SERIAL_GARMIN is not set
1304# CONFIG_USB_SERIAL_IPW is not set
1305# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1306CONFIG_USB_SERIAL_KEYSPAN=m
1307CONFIG_USB_SERIAL_KEYSPAN_MPR=y
1308CONFIG_USB_SERIAL_KEYSPAN_USA28=y
1309CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
1310CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
1311CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
1312CONFIG_USB_SERIAL_KEYSPAN_USA19=y
1313CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
1314CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
1315CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
1316CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
1317CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
1318CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1319# CONFIG_USB_SERIAL_KLSI is not set
1320# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1321# CONFIG_USB_SERIAL_MCT_U232 is not set
1322# CONFIG_USB_SERIAL_PL2303 is not set
1323# CONFIG_USB_SERIAL_HP4X is not set
1324# CONFIG_USB_SERIAL_SAFE is not set
1325# CONFIG_USB_SERIAL_TI is not set
1326# CONFIG_USB_SERIAL_CYBERJACK is not set
1327# CONFIG_USB_SERIAL_XIRCOM is not set
1328# CONFIG_USB_SERIAL_OPTION is not set
1329# CONFIG_USB_SERIAL_OMNINET is not set
1330CONFIG_USB_EZUSB=y
1331
1332#
1333# USB Miscellaneous drivers
1334#
1335# CONFIG_USB_EMI62 is not set
1336# CONFIG_USB_EMI26 is not set
1337# CONFIG_USB_AUERSWALD is not set
1338# CONFIG_USB_RIO500 is not set
1339# CONFIG_USB_LEGOTOWER is not set
1340# CONFIG_USB_LCD is not set
1341# CONFIG_USB_LED is not set
1342# CONFIG_USB_CYTHERM is not set
1343# CONFIG_USB_PHIDGETKIT is not set
1344# CONFIG_USB_PHIDGETSERVO is not set
1345# CONFIG_USB_IDMOUSE is not set
1346# CONFIG_USB_LD is not set
1347# CONFIG_USB_TEST is not set
1348
1349#
1350# USB DSL modem support
1351#
1352
1353#
1354# USB Gadget Support
1355#
1356# CONFIG_USB_GADGET is not set
1357
1358#
1359# MMC/SD Card support
1360#
1361# CONFIG_MMC is not set
1362
1363#
1364# InfiniBand support
1365#
1366# CONFIG_INFINIBAND is not set
1367
1368#
1369# SN Devices
1370#
1371
1372#
1373# File systems
1374#
1375CONFIG_EXT2_FS=y
1376CONFIG_EXT2_FS_XATTR=y
1377# CONFIG_EXT2_FS_POSIX_ACL is not set
1378# CONFIG_EXT2_FS_SECURITY is not set
1379# CONFIG_EXT2_FS_XIP is not set
1380CONFIG_EXT3_FS=y
1381CONFIG_EXT3_FS_XATTR=y
1382# CONFIG_EXT3_FS_POSIX_ACL is not set
1383# CONFIG_EXT3_FS_SECURITY is not set
1384CONFIG_JBD=y
1385# CONFIG_JBD_DEBUG is not set
1386CONFIG_FS_MBCACHE=y
1387# CONFIG_REISERFS_FS is not set
1388# CONFIG_JFS_FS is not set
1389CONFIG_FS_POSIX_ACL=y
1390
1391#
1392# XFS support
1393#
1394# CONFIG_XFS_FS is not set
1395# CONFIG_MINIX_FS is not set
1396# CONFIG_ROMFS_FS is not set
1397CONFIG_INOTIFY=y
1398# CONFIG_QUOTA is not set
1399CONFIG_DNOTIFY=y
1400# CONFIG_AUTOFS_FS is not set
1401# CONFIG_AUTOFS4_FS is not set
1402
1403#
1404# CD-ROM/DVD Filesystems
1405#
1406CONFIG_ISO9660_FS=y
1407# CONFIG_JOLIET is not set
1408# CONFIG_ZISOFS is not set
1409CONFIG_UDF_FS=m
1410CONFIG_UDF_NLS=y
1411
1412#
1413# DOS/FAT/NT Filesystems
1414#
1415CONFIG_FAT_FS=m
1416CONFIG_MSDOS_FS=m
1417CONFIG_VFAT_FS=m
1418CONFIG_FAT_DEFAULT_CODEPAGE=437
1419CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1420# CONFIG_NTFS_FS is not set
1421
1422#
1423# Pseudo filesystems
1424#
1425CONFIG_PROC_FS=y
1426CONFIG_PROC_KCORE=y
1427CONFIG_SYSFS=y
1428CONFIG_DEVPTS_FS_XATTR=y
1429CONFIG_DEVPTS_FS_SECURITY=y
1430CONFIG_TMPFS=y
1431CONFIG_TMPFS_XATTR=y
1432CONFIG_TMPFS_SECURITY=y
1433# CONFIG_HUGETLB_PAGE is not set
1434CONFIG_RAMFS=y
1435
1436#
1437# Miscellaneous filesystems
1438#
1439# CONFIG_ADFS_FS is not set
1440# CONFIG_AFFS_FS is not set
1441CONFIG_HFS_FS=m
1442CONFIG_HFSPLUS_FS=m
1443# CONFIG_BEFS_FS is not set
1444# CONFIG_BFS_FS is not set
1445# CONFIG_EFS_FS is not set
1446CONFIG_CRAMFS=m
1447# CONFIG_VXFS_FS is not set
1448# CONFIG_HPFS_FS is not set
1449# CONFIG_QNX4FS_FS is not set
1450# CONFIG_SYSV_FS is not set
1451# CONFIG_UFS_FS is not set
1452
1453#
1454# Network File Systems
1455#
1456CONFIG_NFS_FS=y
1457CONFIG_NFS_V3=y
1458CONFIG_NFS_V3_ACL=y
1459# CONFIG_NFS_V4 is not set
1460# CONFIG_NFS_DIRECTIO is not set
1461CONFIG_NFSD=y
1462CONFIG_NFSD_V2_ACL=y
1463CONFIG_NFSD_V3=y
1464CONFIG_NFSD_V3_ACL=y
1465# CONFIG_NFSD_V4 is not set
1466CONFIG_NFSD_TCP=y
1467CONFIG_LOCKD=y
1468CONFIG_LOCKD_V4=y
1469CONFIG_EXPORTFS=y
1470CONFIG_NFS_ACL_SUPPORT=y
1471CONFIG_NFS_COMMON=y
1472CONFIG_SUNRPC=y
1473# CONFIG_RPCSEC_GSS_KRB5 is not set
1474# CONFIG_RPCSEC_GSS_SPKM3 is not set
1475CONFIG_SMB_FS=m
1476# CONFIG_SMB_NLS_DEFAULT is not set
1477# CONFIG_CIFS is not set
1478# CONFIG_NCP_FS is not set
1479# CONFIG_CODA_FS is not set
1480# CONFIG_AFS_FS is not set
1481
1482#
1483# Partition Types
1484#
1485CONFIG_PARTITION_ADVANCED=y
1486# CONFIG_ACORN_PARTITION is not set
1487# CONFIG_OSF_PARTITION is not set
1488# CONFIG_AMIGA_PARTITION is not set
1489# CONFIG_ATARI_PARTITION is not set
1490CONFIG_MAC_PARTITION=y
1491CONFIG_MSDOS_PARTITION=y
1492# CONFIG_BSD_DISKLABEL is not set
1493# CONFIG_MINIX_SUBPARTITION is not set
1494# CONFIG_SOLARIS_X86_PARTITION is not set
1495# CONFIG_UNIXWARE_DISKLABEL is not set
1496# CONFIG_LDM_PARTITION is not set
1497# CONFIG_SGI_PARTITION is not set
1498# CONFIG_ULTRIX_PARTITION is not set
1499# CONFIG_SUN_PARTITION is not set
1500# CONFIG_EFI_PARTITION is not set
1501
1502#
1503# Native Language Support
1504#
1505CONFIG_NLS=y
1506CONFIG_NLS_DEFAULT="iso8859-1"
1507# CONFIG_NLS_CODEPAGE_437 is not set
1508# CONFIG_NLS_CODEPAGE_737 is not set
1509# CONFIG_NLS_CODEPAGE_775 is not set
1510# CONFIG_NLS_CODEPAGE_850 is not set
1511# CONFIG_NLS_CODEPAGE_852 is not set
1512# CONFIG_NLS_CODEPAGE_855 is not set
1513# CONFIG_NLS_CODEPAGE_857 is not set
1514# CONFIG_NLS_CODEPAGE_860 is not set
1515# CONFIG_NLS_CODEPAGE_861 is not set
1516# CONFIG_NLS_CODEPAGE_862 is not set
1517# CONFIG_NLS_CODEPAGE_863 is not set
1518# CONFIG_NLS_CODEPAGE_864 is not set
1519# CONFIG_NLS_CODEPAGE_865 is not set
1520# CONFIG_NLS_CODEPAGE_866 is not set
1521# CONFIG_NLS_CODEPAGE_869 is not set
1522# CONFIG_NLS_CODEPAGE_936 is not set
1523# CONFIG_NLS_CODEPAGE_950 is not set
1524# CONFIG_NLS_CODEPAGE_932 is not set
1525# CONFIG_NLS_CODEPAGE_949 is not set
1526# CONFIG_NLS_CODEPAGE_874 is not set
1527# CONFIG_NLS_ISO8859_8 is not set
1528CONFIG_NLS_CODEPAGE_1250=m
1529CONFIG_NLS_CODEPAGE_1251=m
1530CONFIG_NLS_ASCII=m
1531CONFIG_NLS_ISO8859_1=m
1532# CONFIG_NLS_ISO8859_2 is not set
1533# CONFIG_NLS_ISO8859_3 is not set
1534# CONFIG_NLS_ISO8859_4 is not set
1535# CONFIG_NLS_ISO8859_5 is not set
1536# CONFIG_NLS_ISO8859_6 is not set
1537# CONFIG_NLS_ISO8859_7 is not set
1538# CONFIG_NLS_ISO8859_9 is not set
1539# CONFIG_NLS_ISO8859_13 is not set
1540# CONFIG_NLS_ISO8859_14 is not set
1541CONFIG_NLS_ISO8859_15=m
1542# CONFIG_NLS_KOI8_R is not set
1543# CONFIG_NLS_KOI8_U is not set
1544CONFIG_NLS_UTF8=m
1545
1546#
1547# Library routines
1548#
1549CONFIG_CRC_CCITT=y
1550CONFIG_CRC32=y
1551# CONFIG_LIBCRC32C is not set
1552CONFIG_ZLIB_INFLATE=y
1553CONFIG_ZLIB_DEFLATE=y
1554
1555#
1556# Profiling support
1557#
1558# CONFIG_PROFILING is not set
1559
1560#
1561# Kernel hacking
1562#
1563# CONFIG_PRINTK_TIME is not set
1564CONFIG_DEBUG_KERNEL=y
1565CONFIG_MAGIC_SYSRQ=y
1566CONFIG_LOG_BUF_SHIFT=16
1567# CONFIG_SCHEDSTATS is not set
1568# CONFIG_DEBUG_SLAB is not set
1569# CONFIG_DEBUG_SPINLOCK is not set
1570# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1571# CONFIG_DEBUG_KOBJECT is not set
1572# CONFIG_DEBUG_INFO is not set
1573# CONFIG_DEBUG_FS is not set
1574# CONFIG_XMON is not set
1575# CONFIG_BDI_SWITCH is not set
1576CONFIG_BOOTX_TEXT=y
1577
1578#
1579# Security options
1580#
1581# CONFIG_KEYS is not set
1582# CONFIG_SECURITY is not set
1583
1584#
1585# Cryptographic options
1586#
1587# CONFIG_CRYPTO is not set
1588
1589#
1590# Hardware crypto devices
1591#
diff --git a/arch/ppc/configs/power3_defconfig b/arch/ppc/configs/power3_defconfig
deleted file mode 100644
index a1ef929bca59..000000000000
--- a/arch/ppc/configs/power3_defconfig
+++ /dev/null
@@ -1,1035 +0,0 @@
1#
2# Automatically generated make config: don't edit
3#
4CONFIG_MMU=y
5CONFIG_RWSEM_XCHGADD_ALGORITHM=y
6CONFIG_HAVE_DEC_LOCK=y
7CONFIG_PPC=y
8CONFIG_PPC32=y
9CONFIG_GENERIC_NVRAM=y
10
11#
12# Code maturity level options
13#
14CONFIG_EXPERIMENTAL=y
15CONFIG_CLEAN_COMPILE=y
16# CONFIG_STANDALONE is not set
17
18#
19# General setup
20#
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_LOG_BUF_SHIFT=15
28# CONFIG_HOTPLUG is not set
29CONFIG_IKCONFIG=y
30CONFIG_IKCONFIG_PROC=y
31# CONFIG_EMBEDDED is not set
32CONFIG_KALLSYMS=y
33CONFIG_FUTEX=y
34CONFIG_EPOLL=y
35CONFIG_IOSCHED_NOOP=y
36CONFIG_IOSCHED_AS=y
37CONFIG_IOSCHED_DEADLINE=y
38CONFIG_IOSCHED_CFQ=y
39# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
40
41#
42# Loadable module support
43#
44CONFIG_MODULES=y
45CONFIG_MODULE_UNLOAD=y
46CONFIG_MODULE_FORCE_UNLOAD=y
47CONFIG_OBSOLETE_MODPARM=y
48# CONFIG_MODVERSIONS is not set
49CONFIG_KMOD=y
50CONFIG_STOP_MACHINE=y
51
52#
53# Processor
54#
55# CONFIG_6xx is not set
56# CONFIG_40x is not set
57# CONFIG_44x is not set
58CONFIG_POWER3=y
59# CONFIG_POWER4 is not set
60# CONFIG_8xx is not set
61# CONFIG_CPU_FREQ is not set
62CONFIG_PPC64BRIDGE=y
63CONFIG_PPC_STD_MMU=y
64
65#
66# Platform options
67#
68CONFIG_PPC_MULTIPLATFORM=y
69# CONFIG_APUS is not set
70# CONFIG_WILLOW is not set
71# CONFIG_PCORE is not set
72# CONFIG_POWERPMC250 is not set
73# CONFIG_EV64260 is not set
74# CONFIG_SPRUCE is not set
75# CONFIG_LOPEC is not set
76# CONFIG_MCPN765 is not set
77# CONFIG_MVME5100 is not set
78# CONFIG_PPLUS is not set
79# CONFIG_PRPMC750 is not set
80# CONFIG_PRPMC800 is not set
81# CONFIG_SANDPOINT is not set
82# CONFIG_ADIR is not set
83# CONFIG_K2 is not set
84# CONFIG_PAL4 is not set
85# CONFIG_GEMINI is not set
86# CONFIG_EST8260 is not set
87# CONFIG_SBS8260 is not set
88# CONFIG_RPX6 is not set
89# CONFIG_TQM8260 is not set
90CONFIG_PPC_CHRP=y
91CONFIG_PPC_PMAC=y
92CONFIG_PPC_PREP=y
93CONFIG_PPC_OF=y
94CONFIG_PPCBUG_NVRAM=y
95CONFIG_SMP=y
96# CONFIG_IRQ_ALL_CPUS is not set
97CONFIG_NR_CPUS=32
98# CONFIG_PREEMPT is not set
99CONFIG_HIGHMEM=y
100CONFIG_KERNEL_ELF=y
101CONFIG_BINFMT_ELF=y
102CONFIG_BINFMT_MISC=y
103CONFIG_PROC_DEVICETREE=y
104CONFIG_PPC_RTAS=y
105# CONFIG_PREP_RESIDUAL is not set
106# CONFIG_CMDLINE_BOOL is not set
107
108#
109# Bus options
110#
111CONFIG_ISA=y
112CONFIG_GENERIC_ISA_DMA=y
113CONFIG_PCI=y
114CONFIG_PCI_DOMAINS=y
115CONFIG_PCI_LEGACY_PROC=y
116CONFIG_PCI_NAMES=y
117
118#
119# Advanced setup
120#
121CONFIG_ADVANCED_OPTIONS=y
122# CONFIG_HIGHMEM_START_BOOL is not set
123CONFIG_HIGHMEM_START=0xfe000000
124# CONFIG_LOWMEM_SIZE_BOOL is not set
125CONFIG_LOWMEM_SIZE=0x30000000
126# CONFIG_KERNEL_START_BOOL is not set
127CONFIG_KERNEL_START=0xc0000000
128CONFIG_TASK_SIZE_BOOL=y
129CONFIG_TASK_SIZE=0xc0000000
130CONFIG_BOOT_LOAD=0x00800000
131
132#
133# Device Drivers
134#
135
136#
137# Generic Driver Options
138#
139
140#
141# Memory Technology Devices (MTD)
142#
143# CONFIG_MTD is not set
144
145#
146# Parallel port support
147#
148CONFIG_PARPORT=m
149CONFIG_PARPORT_PC=m
150CONFIG_PARPORT_PC_CML1=m
151# CONFIG_PARPORT_SERIAL is not set
152CONFIG_PARPORT_PC_FIFO=y
153# CONFIG_PARPORT_PC_SUPERIO is not set
154# CONFIG_PARPORT_OTHER is not set
155# CONFIG_PARPORT_1284 is not set
156
157#
158# Plug and Play support
159#
160# CONFIG_PNP is not set
161
162#
163# Block devices
164#
165CONFIG_BLK_DEV_FD=y
166# CONFIG_BLK_DEV_XD is not set
167# CONFIG_PARIDE is not set
168# CONFIG_BLK_CPQ_DA is not set
169# CONFIG_BLK_CPQ_CISS_DA is not set
170# CONFIG_BLK_DEV_DAC960 is not set
171# CONFIG_BLK_DEV_UMEM is not set
172CONFIG_BLK_DEV_LOOP=y
173# CONFIG_BLK_DEV_CRYPTOLOOP is not set
174# CONFIG_BLK_DEV_NBD is not set
175# CONFIG_BLK_DEV_CARMEL is not set
176CONFIG_BLK_DEV_RAM=y
177CONFIG_BLK_DEV_RAM_SIZE=4096
178CONFIG_BLK_DEV_INITRD=y
179CONFIG_LBD=y
180
181#
182# ATA/ATAPI/MFM/RLL support
183#
184# CONFIG_IDE is not set
185
186#
187# SCSI device support
188#
189CONFIG_SCSI=y
190CONFIG_SCSI_PROC_FS=y
191
192#
193# SCSI support type (disk, tape, CD-ROM)
194#
195CONFIG_BLK_DEV_SD=y
196CONFIG_CHR_DEV_ST=y
197# CONFIG_CHR_DEV_OSST is not set
198CONFIG_BLK_DEV_SR=y
199CONFIG_BLK_DEV_SR_VENDOR=y
200CONFIG_CHR_DEV_SG=y
201
202#
203# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
204#
205# CONFIG_SCSI_MULTI_LUN is not set
206# CONFIG_SCSI_REPORT_LUNS is not set
207CONFIG_SCSI_CONSTANTS=y
208CONFIG_SCSI_LOGGING=y
209
210#
211# SCSI Transport Attributes
212#
213CONFIG_SCSI_SPI_ATTRS=y
214# CONFIG_SCSI_FC_ATTRS is not set
215
216#
217# SCSI low-level drivers
218#
219# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
220# CONFIG_SCSI_7000FASST is not set
221# CONFIG_SCSI_ACARD is not set
222# CONFIG_SCSI_AHA152X is not set
223# CONFIG_SCSI_AHA1542 is not set
224# CONFIG_SCSI_AACRAID is not set
225# CONFIG_SCSI_AIC7XXX is not set
226# CONFIG_SCSI_AIC7XXX_OLD is not set
227# CONFIG_SCSI_AIC79XX is not set
228# CONFIG_SCSI_ADVANSYS is not set
229# CONFIG_SCSI_IN2000 is not set
230# CONFIG_SCSI_MEGARAID is not set
231# CONFIG_SCSI_SATA is not set
232# CONFIG_SCSI_BUSLOGIC is not set
233# CONFIG_SCSI_CPQFCTS is not set
234# CONFIG_SCSI_DMX3191D is not set
235# CONFIG_SCSI_DTC3280 is not set
236# CONFIG_SCSI_EATA is not set
237# CONFIG_SCSI_EATA_PIO is not set
238# CONFIG_SCSI_FUTURE_DOMAIN is not set
239# CONFIG_SCSI_GDTH is not set
240# CONFIG_SCSI_GENERIC_NCR5380 is not set
241# CONFIG_SCSI_GENERIC_NCR5380_MMIO is not set
242# CONFIG_SCSI_IPS is not set
243# CONFIG_SCSI_INIA100 is not set
244# CONFIG_SCSI_PPA is not set
245# CONFIG_SCSI_IMM is not set
246# CONFIG_SCSI_NCR53C406A is not set
247CONFIG_SCSI_SYM53C8XX_2=y
248CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
249CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
250CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
251# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
252# CONFIG_SCSI_IPR is not set
253# CONFIG_SCSI_PAS16 is not set
254# CONFIG_SCSI_PSI240I is not set
255# CONFIG_SCSI_QLOGIC_FAS is not set
256# CONFIG_SCSI_QLOGIC_ISP is not set
257# CONFIG_SCSI_QLOGIC_FC is not set
258# CONFIG_SCSI_QLOGIC_1280 is not set
259CONFIG_SCSI_QLA2XXX=y
260# CONFIG_SCSI_QLA21XX is not set
261# CONFIG_SCSI_QLA22XX is not set
262# CONFIG_SCSI_QLA2300 is not set
263# CONFIG_SCSI_QLA2322 is not set
264# CONFIG_SCSI_QLA6312 is not set
265# CONFIG_SCSI_QLA6322 is not set
266# CONFIG_SCSI_SYM53C416 is not set
267# CONFIG_SCSI_DC395x is not set
268# CONFIG_SCSI_DC390T is not set
269# CONFIG_SCSI_T128 is not set
270# CONFIG_SCSI_U14_34F is not set
271# CONFIG_SCSI_NSP32 is not set
272# CONFIG_SCSI_DEBUG is not set
273# CONFIG_SCSI_MESH is not set
274# CONFIG_SCSI_MAC53C94 is not set
275
276#
277# Old CD-ROM drivers (not SCSI, not IDE)
278#
279# CONFIG_CD_NO_IDESCSI is not set
280
281#
282# Multi-device support (RAID and LVM)
283#
284CONFIG_MD=y
285CONFIG_BLK_DEV_MD=y
286CONFIG_MD_LINEAR=y
287CONFIG_MD_RAID0=y
288CONFIG_MD_RAID1=y
289CONFIG_MD_RAID5=y
290CONFIG_MD_RAID6=y
291# CONFIG_MD_MULTIPATH is not set
292CONFIG_BLK_DEV_DM=y
293CONFIG_DM_CRYPT=y
294
295#
296# Fusion MPT device support
297#
298# CONFIG_FUSION is not set
299
300#
301# IEEE 1394 (FireWire) support
302#
303# CONFIG_IEEE1394 is not set
304
305#
306# I2O device support
307#
308# CONFIG_I2O is not set
309
310#
311# Macintosh device drivers
312#
313# CONFIG_ADB is not set
314# CONFIG_ADB_CUDA is not set
315# CONFIG_ADB_PMU is not set
316# CONFIG_MAC_FLOPPY is not set
317# CONFIG_MAC_SERIAL is not set
318
319#
320# Networking support
321#
322CONFIG_NET=y
323
324#
325# Networking options
326#
327CONFIG_PACKET=y
328# CONFIG_PACKET_MMAP is not set
329# CONFIG_NETLINK_DEV is not set
330CONFIG_UNIX=y
331# CONFIG_NET_KEY is not set
332CONFIG_INET=y
333CONFIG_IP_MULTICAST=y
334# CONFIG_IP_ADVANCED_ROUTER is not set
335# CONFIG_IP_PNP is not set
336# CONFIG_NET_IPIP is not set
337# CONFIG_NET_IPGRE is not set
338# CONFIG_IP_MROUTE is not set
339# CONFIG_ARPD is not set
340CONFIG_SYN_COOKIES=y
341# CONFIG_INET_AH is not set
342# CONFIG_INET_ESP is not set
343# CONFIG_INET_IPCOMP is not set
344# CONFIG_IPV6 is not set
345# CONFIG_NETFILTER is not set
346
347#
348# SCTP Configuration (EXPERIMENTAL)
349#
350# CONFIG_IP_SCTP is not set
351# CONFIG_ATM is not set
352# CONFIG_BRIDGE is not set
353# CONFIG_VLAN_8021Q is not set
354# CONFIG_DECNET is not set
355# CONFIG_LLC2 is not set
356# CONFIG_IPX is not set
357# CONFIG_ATALK is not set
358# CONFIG_X25 is not set
359# CONFIG_LAPB is not set
360# CONFIG_NET_DIVERT is not set
361# CONFIG_ECONET is not set
362# CONFIG_WAN_ROUTER is not set
363# CONFIG_NET_HW_FLOWCONTROL is not set
364
365#
366# QoS and/or fair queueing
367#
368# CONFIG_NET_SCHED is not set
369
370#
371# Network testing
372#
373# CONFIG_NET_PKTGEN is not set
374# CONFIG_NETPOLL is not set
375# CONFIG_NET_POLL_CONTROLLER is not set
376# CONFIG_HAMRADIO is not set
377# CONFIG_IRDA is not set
378# CONFIG_BT is not set
379CONFIG_NETDEVICES=y
380# CONFIG_DUMMY is not set
381# CONFIG_BONDING is not set
382# CONFIG_EQUALIZER is not set
383# CONFIG_TUN is not set
384
385#
386# ARCnet devices
387#
388# CONFIG_ARCNET is not set
389
390#
391# Ethernet (10 or 100Mbit)
392#
393CONFIG_NET_ETHERNET=y
394CONFIG_MII=y
395# CONFIG_MACE is not set
396# CONFIG_BMAC is not set
397# CONFIG_OAKNET is not set
398# CONFIG_HAPPYMEAL is not set
399# CONFIG_SUNGEM is not set
400# CONFIG_NET_VENDOR_3COM is not set
401# CONFIG_LANCE is not set
402# CONFIG_NET_VENDOR_SMC is not set
403# CONFIG_NET_VENDOR_RACAL is not set
404
405#
406# Tulip family network device support
407#
408# CONFIG_NET_TULIP is not set
409# CONFIG_AT1700 is not set
410# CONFIG_DEPCA is not set
411# CONFIG_HP100 is not set
412# CONFIG_NET_ISA is not set
413CONFIG_NET_PCI=y
414CONFIG_PCNET32=y
415# CONFIG_AMD8111_ETH is not set
416# CONFIG_ADAPTEC_STARFIRE is not set
417# CONFIG_AC3200 is not set
418# CONFIG_APRICOT is not set
419# CONFIG_B44 is not set
420# CONFIG_FORCEDETH is not set
421# CONFIG_CS89x0 is not set
422# CONFIG_DGRS is not set
423# CONFIG_EEPRO100 is not set
424CONFIG_E100=y
425# CONFIG_E100_NAPI is not set
426# CONFIG_FEALNX is not set
427# CONFIG_NATSEMI is not set
428# CONFIG_NE2K_PCI is not set
429# CONFIG_8139CP is not set
430# CONFIG_8139TOO is not set
431# CONFIG_SIS900 is not set
432# CONFIG_EPIC100 is not set
433# CONFIG_SUNDANCE is not set
434# CONFIG_TLAN is not set
435# CONFIG_VIA_RHINE is not set
436# CONFIG_NET_POCKET is not set
437
438#
439# Ethernet (1000 Mbit)
440#
441# CONFIG_ACENIC is not set
442# CONFIG_DL2K is not set
443CONFIG_E1000=y
444# CONFIG_E1000_NAPI is not set
445# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
446# CONFIG_NS83820 is not set
447# CONFIG_HAMACHI is not set
448# CONFIG_YELLOWFIN is not set
449# CONFIG_R8169 is not set
450# CONFIG_SK98LIN is not set
451# CONFIG_TIGON3 is not set
452
453#
454# Ethernet (10000 Mbit)
455#
456# CONFIG_IXGB is not set
457# CONFIG_S2IO is not set
458
459#
460# Token Ring devices
461#
462# CONFIG_TR is not set
463
464#
465# Wireless LAN (non-hamradio)
466#
467# CONFIG_NET_RADIO is not set
468
469#
470# Wan interfaces
471#
472# CONFIG_WAN is not set
473# CONFIG_FDDI is not set
474# CONFIG_HIPPI is not set
475# CONFIG_PLIP is not set
476# CONFIG_PPP is not set
477# CONFIG_SLIP is not set
478# CONFIG_NET_FC is not set
479# CONFIG_RCPCI is not set
480# CONFIG_SHAPER is not set
481# CONFIG_NETCONSOLE is not set
482
483#
484# ISDN subsystem
485#
486# CONFIG_ISDN is not set
487
488#
489# Telephony Support
490#
491# CONFIG_PHONE is not set
492
493#
494# Input device support
495#
496CONFIG_INPUT=y
497
498#
499# Userland interfaces
500#
501CONFIG_INPUT_MOUSEDEV=y
502CONFIG_INPUT_MOUSEDEV_PSAUX=y
503CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
504CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
505# CONFIG_INPUT_JOYDEV is not set
506# CONFIG_INPUT_TSDEV is not set
507CONFIG_INPUT_EVDEV=y
508# CONFIG_INPUT_EVBUG is not set
509
510#
511# Input I/O drivers
512#
513CONFIG_GAMEPORT=m
514CONFIG_SOUND_GAMEPORT=m
515# CONFIG_GAMEPORT_NS558 is not set
516# CONFIG_GAMEPORT_L4 is not set
517# CONFIG_GAMEPORT_EMU10K1 is not set
518# CONFIG_GAMEPORT_VORTEX is not set
519# CONFIG_GAMEPORT_FM801 is not set
520# CONFIG_GAMEPORT_CS461x is not set
521CONFIG_SERIO=y
522CONFIG_SERIO_I8042=y
523CONFIG_SERIO_SERPORT=y
524# CONFIG_SERIO_CT82C710 is not set
525# CONFIG_SERIO_PARKBD is not set
526# CONFIG_SERIO_PCIPS2 is not set
527
528#
529# Input Device Drivers
530#
531CONFIG_INPUT_KEYBOARD=y
532CONFIG_KEYBOARD_ATKBD=y
533# CONFIG_KEYBOARD_SUNKBD is not set
534# CONFIG_KEYBOARD_LKKBD is not set
535# CONFIG_KEYBOARD_XTKBD is not set
536# CONFIG_KEYBOARD_NEWTON is not set
537CONFIG_INPUT_MOUSE=y
538CONFIG_MOUSE_PS2=y
539# CONFIG_MOUSE_SERIAL is not set
540# CONFIG_MOUSE_INPORT is not set
541# CONFIG_MOUSE_LOGIBM is not set
542# CONFIG_MOUSE_PC110PAD is not set
543# CONFIG_MOUSE_VSXXXAA is not set
544# CONFIG_INPUT_JOYSTICK is not set
545# CONFIG_INPUT_TOUCHSCREEN is not set
546CONFIG_INPUT_MISC=y
547CONFIG_INPUT_UINPUT=y
548
549#
550# Character devices
551#
552CONFIG_VT=y
553CONFIG_VT_CONSOLE=y
554CONFIG_HW_CONSOLE=y
555# CONFIG_SERIAL_NONSTANDARD is not set
556
557#
558# Serial drivers
559#
560CONFIG_SERIAL_8250=y
561CONFIG_SERIAL_8250_CONSOLE=y
562CONFIG_SERIAL_8250_NR_UARTS=4
563# CONFIG_SERIAL_8250_EXTENDED is not set
564
565#
566# Non-8250 serial port support
567#
568CONFIG_SERIAL_CORE=y
569CONFIG_SERIAL_CORE_CONSOLE=y
570# CONFIG_SERIAL_PMACZILOG is not set
571CONFIG_UNIX98_PTYS=y
572CONFIG_LEGACY_PTYS=y
573CONFIG_LEGACY_PTY_COUNT=256
574CONFIG_PRINTER=m
575# CONFIG_LP_CONSOLE is not set
576# CONFIG_PPDEV is not set
577# CONFIG_TIPAR is not set
578# CONFIG_QIC02_TAPE is not set
579
580#
581# IPMI
582#
583# CONFIG_IPMI_HANDLER is not set
584
585#
586# Watchdog Cards
587#
588# CONFIG_WATCHDOG is not set
589CONFIG_NVRAM=y
590CONFIG_GEN_RTC=y
591# CONFIG_GEN_RTC_X is not set
592# CONFIG_DTLK is not set
593# CONFIG_R3964 is not set
594# CONFIG_APPLICOM is not set
595
596#
597# Ftape, the floppy tape device driver
598#
599# CONFIG_AGP is not set
600# CONFIG_DRM is not set
601# CONFIG_RAW_DRIVER is not set
602
603#
604# I2C support
605#
606CONFIG_I2C=y
607CONFIG_I2C_CHARDEV=y
608
609#
610# I2C Algorithms
611#
612CONFIG_I2C_ALGOBIT=y
613CONFIG_I2C_ALGOPCF=y
614
615#
616# I2C Hardware Bus support
617#
618# CONFIG_I2C_ALI1535 is not set
619# CONFIG_I2C_ALI1563 is not set
620# CONFIG_I2C_ALI15X3 is not set
621# CONFIG_I2C_AMD756 is not set
622# CONFIG_I2C_AMD8111 is not set
623# CONFIG_I2C_HYDRA is not set
624# CONFIG_I2C_I801 is not set
625# CONFIG_I2C_I810 is not set
626# CONFIG_I2C_ISA is not set
627# CONFIG_I2C_KEYWEST is not set
628# CONFIG_I2C_NFORCE2 is not set
629# CONFIG_I2C_PARPORT is not set
630# CONFIG_I2C_PARPORT_LIGHT is not set
631# CONFIG_I2C_PIIX4 is not set
632# CONFIG_I2C_PROSAVAGE is not set
633# CONFIG_I2C_SAVAGE4 is not set
634# CONFIG_SCx200_ACB is not set
635# CONFIG_I2C_SIS5595 is not set
636# CONFIG_I2C_SIS630 is not set
637# CONFIG_I2C_SIS96X is not set
638# CONFIG_I2C_VIA is not set
639# CONFIG_I2C_VIAPRO is not set
640# CONFIG_I2C_VOODOO3 is not set
641
642#
643# Hardware Sensors Chip support
644#
645# CONFIG_I2C_SENSOR is not set
646# CONFIG_SENSORS_ADM1021 is not set
647# CONFIG_SENSORS_ASB100 is not set
648# CONFIG_SENSORS_DS1621 is not set
649# CONFIG_SENSORS_FSCHER is not set
650# CONFIG_SENSORS_GL518SM is not set
651# CONFIG_SENSORS_IT87 is not set
652# CONFIG_SENSORS_LM75 is not set
653# CONFIG_SENSORS_LM78 is not set
654# CONFIG_SENSORS_LM80 is not set
655# CONFIG_SENSORS_LM83 is not set
656# CONFIG_SENSORS_LM85 is not set
657# CONFIG_SENSORS_LM90 is not set
658# CONFIG_SENSORS_VIA686A is not set
659# CONFIG_SENSORS_W83781D is not set
660# CONFIG_SENSORS_W83L785TS is not set
661# CONFIG_SENSORS_W83627HF is not set
662
663#
664# Other I2C Chip support
665#
666# CONFIG_SENSORS_EEPROM is not set
667# CONFIG_SENSORS_PCF8574 is not set
668# CONFIG_SENSORS_PCF8591 is not set
669# CONFIG_I2C_DEBUG_CORE is not set
670# CONFIG_I2C_DEBUG_ALGO is not set
671# CONFIG_I2C_DEBUG_BUS is not set
672# CONFIG_I2C_DEBUG_CHIP is not set
673
674#
675# Misc devices
676#
677
678#
679# Multimedia devices
680#
681# CONFIG_VIDEO_DEV is not set
682
683#
684# Digital Video Broadcasting Devices
685#
686# CONFIG_DVB is not set
687
688#
689# Graphics support
690#
691CONFIG_FB=y
692# CONFIG_FB_PM2 is not set
693# CONFIG_FB_CYBER2000 is not set
694CONFIG_FB_OF=y
695# CONFIG_FB_CONTROL is not set
696# CONFIG_FB_PLATINUM is not set
697# CONFIG_FB_VALKYRIE is not set
698# CONFIG_FB_CT65550 is not set
699# CONFIG_FB_IMSTT is not set
700# CONFIG_FB_S3TRIO is not set
701# CONFIG_FB_VGA16 is not set
702# CONFIG_FB_RIVA is not set
703CONFIG_FB_MATROX=y
704CONFIG_FB_MATROX_MILLENIUM=y
705CONFIG_FB_MATROX_MYSTIQUE=y
706# CONFIG_FB_MATROX_G450 is not set
707CONFIG_FB_MATROX_G100A=y
708CONFIG_FB_MATROX_G100=y
709CONFIG_FB_MATROX_I2C=y
710# CONFIG_FB_MATROX_MAVEN is not set
711CONFIG_FB_MATROX_MULTIHEAD=y
712# CONFIG_FB_RADEON_OLD is not set
713# CONFIG_FB_RADEON is not set
714# CONFIG_FB_ATY128 is not set
715# CONFIG_FB_ATY is not set
716# CONFIG_FB_SIS is not set
717# CONFIG_FB_NEOMAGIC is not set
718# CONFIG_FB_KYRO is not set
719# CONFIG_FB_3DFX is not set
720# CONFIG_FB_VOODOO1 is not set
721# CONFIG_FB_TRIDENT is not set
722# CONFIG_FB_VIRTUAL is not set
723
724#
725# Console display driver support
726#
727# CONFIG_VGA_CONSOLE is not set
728# CONFIG_MDA_CONSOLE is not set
729CONFIG_DUMMY_CONSOLE=y
730CONFIG_FRAMEBUFFER_CONSOLE=y
731CONFIG_PCI_CONSOLE=y
732# CONFIG_FONTS is not set
733CONFIG_FONT_8x8=y
734CONFIG_FONT_8x16=y
735
736#
737# Logo configuration
738#
739CONFIG_LOGO=y
740CONFIG_LOGO_LINUX_MONO=y
741CONFIG_LOGO_LINUX_VGA16=y
742CONFIG_LOGO_LINUX_CLUT224=y
743
744#
745# Sound
746#
747CONFIG_SOUND=y
748# CONFIG_DMASOUND_PMAC is not set
749
750#
751# Advanced Linux Sound Architecture
752#
753CONFIG_SND=m
754CONFIG_SND_TIMER=m
755CONFIG_SND_PCM=m
756CONFIG_SND_HWDEP=m
757CONFIG_SND_RAWMIDI=m
758CONFIG_SND_SEQUENCER=m
759CONFIG_SND_SEQ_DUMMY=m
760CONFIG_SND_OSSEMUL=y
761CONFIG_SND_MIXER_OSS=m
762CONFIG_SND_PCM_OSS=m
763CONFIG_SND_SEQUENCER_OSS=y
764# CONFIG_SND_VERBOSE_PRINTK is not set
765# CONFIG_SND_DEBUG is not set
766
767#
768# Generic devices
769#
770CONFIG_SND_MPU401_UART=m
771CONFIG_SND_OPL3_LIB=m
772CONFIG_SND_DUMMY=m
773# CONFIG_SND_VIRMIDI is not set
774# CONFIG_SND_MTPAV is not set
775# CONFIG_SND_SERIAL_U16550 is not set
776# CONFIG_SND_MPU401 is not set
777
778#
779# ISA devices
780#
781# CONFIG_SND_AD1848 is not set
782# CONFIG_SND_CS4231 is not set
783CONFIG_SND_CS4232=m
784# CONFIG_SND_CS4236 is not set
785# CONFIG_SND_ES1688 is not set
786# CONFIG_SND_ES18XX is not set
787# CONFIG_SND_GUSCLASSIC is not set
788# CONFIG_SND_GUSEXTREME is not set
789# CONFIG_SND_GUSMAX is not set
790# CONFIG_SND_INTERWAVE is not set
791# CONFIG_SND_INTERWAVE_STB is not set
792# CONFIG_SND_OPTI92X_AD1848 is not set
793# CONFIG_SND_OPTI92X_CS4231 is not set
794# CONFIG_SND_OPTI93X is not set
795# CONFIG_SND_SB8 is not set
796# CONFIG_SND_SB16 is not set
797# CONFIG_SND_SBAWE is not set
798# CONFIG_SND_WAVEFRONT is not set
799# CONFIG_SND_CMI8330 is not set
800# CONFIG_SND_OPL3SA2 is not set
801# CONFIG_SND_SGALAXY is not set
802# CONFIG_SND_SSCAPE is not set
803
804#
805# PCI devices
806#
807CONFIG_SND_AC97_CODEC=m
808# CONFIG_SND_ALI5451 is not set
809# CONFIG_SND_ATIIXP is not set
810# CONFIG_SND_AU8810 is not set
811# CONFIG_SND_AU8820 is not set
812# CONFIG_SND_AU8830 is not set
813# CONFIG_SND_AZT3328 is not set
814# CONFIG_SND_BT87X is not set
815CONFIG_SND_CS46XX=m
816# CONFIG_SND_CS46XX_NEW_DSP is not set
817CONFIG_SND_CS4281=m
818# CONFIG_SND_EMU10K1 is not set
819# CONFIG_SND_KORG1212 is not set
820# CONFIG_SND_MIXART is not set
821# CONFIG_SND_NM256 is not set
822# CONFIG_SND_RME32 is not set
823# CONFIG_SND_RME96 is not set
824# CONFIG_SND_RME9652 is not set
825# CONFIG_SND_HDSP is not set
826# CONFIG_SND_TRIDENT is not set
827# CONFIG_SND_YMFPCI is not set
828# CONFIG_SND_ALS4000 is not set
829# CONFIG_SND_CMIPCI is not set
830# CONFIG_SND_ENS1370 is not set
831# CONFIG_SND_ENS1371 is not set
832# CONFIG_SND_ES1938 is not set
833# CONFIG_SND_ES1968 is not set
834# CONFIG_SND_MAESTRO3 is not set
835# CONFIG_SND_FM801 is not set
836# CONFIG_SND_ICE1712 is not set
837# CONFIG_SND_ICE1724 is not set
838# CONFIG_SND_INTEL8X0 is not set
839# CONFIG_SND_INTEL8X0M is not set
840# CONFIG_SND_SONICVIBES is not set
841# CONFIG_SND_VIA82XX is not set
842# CONFIG_SND_VX222 is not set
843
844#
845# ALSA PowerMac devices
846#
847# CONFIG_SND_POWERMAC is not set
848
849#
850# Open Sound System
851#
852# CONFIG_SOUND_PRIME is not set
853
854#
855# USB support
856#
857# CONFIG_USB is not set
858
859#
860# USB Gadget Support
861#
862# CONFIG_USB_GADGET is not set
863
864#
865# File systems
866#
867CONFIG_EXT2_FS=y
868# CONFIG_EXT2_FS_XATTR is not set
869# CONFIG_EXT3_FS is not set
870# CONFIG_JBD is not set
871# CONFIG_REISERFS_FS is not set
872# CONFIG_JFS_FS is not set
873# CONFIG_XFS_FS is not set
874# CONFIG_MINIX_FS is not set
875# CONFIG_ROMFS_FS is not set
876# CONFIG_QUOTA is not set
877# CONFIG_AUTOFS_FS is not set
878# CONFIG_AUTOFS4_FS is not set
879
880#
881# CD-ROM/DVD Filesystems
882#
883CONFIG_ISO9660_FS=y
884CONFIG_JOLIET=y
885# CONFIG_ZISOFS is not set
886# CONFIG_UDF_FS is not set
887
888#
889# DOS/FAT/NT Filesystems
890#
891CONFIG_FAT_FS=y
892CONFIG_MSDOS_FS=y
893CONFIG_VFAT_FS=y
894# CONFIG_NTFS_FS is not set
895
896#
897# Pseudo filesystems
898#
899CONFIG_PROC_FS=y
900CONFIG_PROC_KCORE=y
901CONFIG_SYSFS=y
902# CONFIG_DEVFS_FS is not set
903# CONFIG_DEVPTS_FS_XATTR is not set
904CONFIG_TMPFS=y
905# CONFIG_HUGETLB_PAGE is not set
906CONFIG_RAMFS=y
907
908#
909# Miscellaneous filesystems
910#
911# CONFIG_ADFS_FS is not set
912# CONFIG_AFFS_FS is not set
913# CONFIG_HFS_FS is not set
914# CONFIG_HFSPLUS_FS is not set
915# CONFIG_BEFS_FS is not set
916# CONFIG_BFS_FS is not set
917# CONFIG_EFS_FS is not set
918# CONFIG_CRAMFS is not set
919# CONFIG_VXFS_FS is not set
920# CONFIG_HPFS_FS is not set
921# CONFIG_QNX4FS_FS is not set
922# CONFIG_SYSV_FS is not set
923# CONFIG_UFS_FS is not set
924
925#
926# Network File Systems
927#
928CONFIG_NFS_FS=y
929# CONFIG_NFS_V3 is not set
930# CONFIG_NFS_V4 is not set
931# CONFIG_NFS_DIRECTIO is not set
932CONFIG_NFSD=y
933# CONFIG_NFSD_V3 is not set
934# CONFIG_NFSD_TCP is not set
935CONFIG_LOCKD=y
936CONFIG_EXPORTFS=y
937CONFIG_SUNRPC=y
938# CONFIG_RPCSEC_GSS_KRB5 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
945#
946# Partition Types
947#
948# CONFIG_PARTITION_ADVANCED is not set
949CONFIG_MSDOS_PARTITION=y
950
951#
952# Native Language Support
953#
954CONFIG_NLS=y
955CONFIG_NLS_DEFAULT="iso8859-1"
956CONFIG_NLS_CODEPAGE_437=y
957# CONFIG_NLS_CODEPAGE_737 is not set
958# CONFIG_NLS_CODEPAGE_775 is not set
959# CONFIG_NLS_CODEPAGE_850 is not set
960# CONFIG_NLS_CODEPAGE_852 is not set
961# CONFIG_NLS_CODEPAGE_855 is not set
962# CONFIG_NLS_CODEPAGE_857 is not set
963# CONFIG_NLS_CODEPAGE_860 is not set
964# CONFIG_NLS_CODEPAGE_861 is not set
965# CONFIG_NLS_CODEPAGE_862 is not set
966# CONFIG_NLS_CODEPAGE_863 is not set
967# CONFIG_NLS_CODEPAGE_864 is not set
968# CONFIG_NLS_CODEPAGE_865 is not set
969# CONFIG_NLS_CODEPAGE_866 is not set
970# CONFIG_NLS_CODEPAGE_869 is not set
971# CONFIG_NLS_CODEPAGE_936 is not set
972# CONFIG_NLS_CODEPAGE_950 is not set
973# CONFIG_NLS_CODEPAGE_932 is not set
974# CONFIG_NLS_CODEPAGE_949 is not set
975# CONFIG_NLS_CODEPAGE_874 is not set
976# CONFIG_NLS_ISO8859_8 is not set
977# CONFIG_NLS_CODEPAGE_1250 is not set
978# CONFIG_NLS_CODEPAGE_1251 is not set
979CONFIG_NLS_ISO8859_1=y
980# CONFIG_NLS_ISO8859_2 is not set
981# CONFIG_NLS_ISO8859_3 is not set
982# CONFIG_NLS_ISO8859_4 is not set
983# CONFIG_NLS_ISO8859_5 is not set
984# CONFIG_NLS_ISO8859_6 is not set
985# CONFIG_NLS_ISO8859_7 is not set
986# CONFIG_NLS_ISO8859_9 is not set
987# CONFIG_NLS_ISO8859_13 is not set
988# CONFIG_NLS_ISO8859_14 is not set
989# CONFIG_NLS_ISO8859_15 is not set
990# CONFIG_NLS_KOI8_R is not set
991# CONFIG_NLS_KOI8_U is not set
992# CONFIG_NLS_UTF8 is not set
993
994#
995# Library routines
996#
997CONFIG_CRC32=y
998# CONFIG_LIBCRC32C is not set
999CONFIG_ZLIB_INFLATE=m
1000CONFIG_ZLIB_DEFLATE=m
1001
1002#
1003# Kernel hacking
1004#
1005# CONFIG_DEBUG_KERNEL is not set
1006CONFIG_BOOTX_TEXT=y
1007
1008#
1009# Security options
1010#
1011# CONFIG_SECURITY is not set
1012
1013#
1014# Cryptographic options
1015#
1016CONFIG_CRYPTO=y
1017CONFIG_CRYPTO_HMAC=y
1018CONFIG_CRYPTO_NULL=y
1019CONFIG_CRYPTO_MD4=m
1020CONFIG_CRYPTO_MD5=m
1021CONFIG_CRYPTO_SHA1=m
1022CONFIG_CRYPTO_SHA256=m
1023CONFIG_CRYPTO_SHA512=m
1024CONFIG_CRYPTO_DES=m
1025CONFIG_CRYPTO_BLOWFISH=m
1026CONFIG_CRYPTO_TWOFISH=m
1027# CONFIG_CRYPTO_SERPENT is not set
1028CONFIG_CRYPTO_AES=m
1029CONFIG_CRYPTO_CAST5=m
1030CONFIG_CRYPTO_CAST6=m
1031CONFIG_CRYPTO_ARC4=m
1032CONFIG_CRYPTO_DEFLATE=m
1033CONFIG_CRYPTO_MICHAEL_MIC=m
1034# CONFIG_CRYPTO_CRC32C is not set
1035# CONFIG_CRYPTO_TEST is not set
diff --git a/arch/ppc/configs/common_defconfig b/arch/ppc/configs/prep_defconfig
index 4d33bee23a89..4d33bee23a89 100644
--- a/arch/ppc/configs/common_defconfig
+++ b/arch/ppc/configs/prep_defconfig
diff --git a/arch/ppc/kernel/Makefile b/arch/ppc/kernel/Makefile
index e399bbb969a4..466437f4bcbb 100644
--- a/arch/ppc/kernel/Makefile
+++ b/arch/ppc/kernel/Makefile
@@ -1,48 +1,24 @@
1# 1#
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4ifneq ($(CONFIG_PPC_MERGE),y)
5
6extra-$(CONFIG_PPC_STD_MMU) := head.o 4extra-$(CONFIG_PPC_STD_MMU) := head.o
7extra-$(CONFIG_40x) := head_4xx.o 5extra-$(CONFIG_40x) := head_4xx.o
8extra-$(CONFIG_44x) := head_44x.o 6extra-$(CONFIG_44x) := head_44x.o
9extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o 7extra-$(CONFIG_FSL_BOOKE) := head_fsl_booke.o
10extra-$(CONFIG_8xx) := head_8xx.o 8extra-$(CONFIG_8xx) := head_8xx.o
11extra-$(CONFIG_6xx) += idle_6xx.o
12extra-y += vmlinux.lds 9extra-y += vmlinux.lds
13 10
14obj-y := entry.o traps.o idle.o time.o misc.o \ 11obj-y := entry.o traps.o time.o misc.o \
15 setup.o \ 12 setup.o \
16 ppc_htab.o 13 ppc_htab.o
17obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o 14obj-$(CONFIG_MODULES) += ppc_ksyms.o
18obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o
19obj-$(CONFIG_MODULES) += module.o ppc_ksyms.o
20obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o 15obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o
21obj-$(CONFIG_PCI) += pci.o 16obj-$(CONFIG_PCI) += pci.o
22obj-$(CONFIG_RAPIDIO) += rio.o 17obj-$(CONFIG_RAPIDIO) += rio.o
23obj-$(CONFIG_KGDB) += ppc-stub.o 18obj-$(CONFIG_KGDB) += ppc-stub.o
24obj-$(CONFIG_SMP) += smp.o smp-tbsync.o 19obj-$(CONFIG_SMP) += smp.o smp-tbsync.o
25obj-$(CONFIG_TAU) += temp.o
26ifndef CONFIG_E200
27obj-$(CONFIG_FSL_BOOKE) += perfmon_fsl_booke.o
28endif
29obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o 20obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
30 21
31ifndef CONFIG_MATH_EMULATION 22ifndef CONFIG_MATH_EMULATION
32obj-$(CONFIG_8xx) += softemu8xx.o 23obj-$(CONFIG_8xx) += softemu8xx.o
33endif 24endif
34
35# These are here while we do the architecture merge
36
37else
38obj-y := idle.o
39obj-$(CONFIG_6xx) += l2cr.o cpu_setup_6xx.o
40obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o
41obj-$(CONFIG_MODULES) += module.o
42obj-$(CONFIG_NOT_COHERENT_CACHE) += dma-mapping.o
43obj-$(CONFIG_KGDB) += ppc-stub.o
44obj-$(CONFIG_TAU) += temp.o
45ifndef CONFIG_E200
46obj-$(CONFIG_FSL_BOOKE) += perfmon_fsl_booke.o
47endif
48endif
diff --git a/arch/ppc/kernel/entry.S b/arch/ppc/kernel/entry.S
index 3a2815978488..5891ecbdc703 100644
--- a/arch/ppc/kernel/entry.S
+++ b/arch/ppc/kernel/entry.S
@@ -135,10 +135,10 @@ transfer_to_handler:
135 mfspr r11,SPRN_HID0 135 mfspr r11,SPRN_HID0
136 mtcr r11 136 mtcr r11
137BEGIN_FTR_SECTION 137BEGIN_FTR_SECTION
138 bt- 8,power_save_6xx_restore /* Check DOZE */ 138 bt- 8,4f /* Check DOZE */
139END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE) 139END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
140BEGIN_FTR_SECTION 140BEGIN_FTR_SECTION
141 bt- 9,power_save_6xx_restore /* Check NAP */ 141 bt- 9,4f /* Check NAP */
142END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP) 142END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
143#endif /* CONFIG_6xx */ 143#endif /* CONFIG_6xx */
144 .globl transfer_to_handler_cont 144 .globl transfer_to_handler_cont
@@ -157,6 +157,10 @@ transfer_to_handler_cont:
157 SYNC 157 SYNC
158 RFI /* jump to handler, enable MMU */ 158 RFI /* jump to handler, enable MMU */
159 159
160#ifdef CONFIG_6xx
1614: b power_save_6xx_restore
162#endif
163
160/* 164/*
161 * On kernel stack overflow, load up an initial stack pointer 165 * On kernel stack overflow, load up an initial stack pointer
162 * and call StackOverflow(regs), which should not return. 166 * and call StackOverflow(regs), which should not return.
@@ -926,55 +930,3 @@ END_FTR_SECTION_IFSET(CPU_FTR_601)
926 b 4b 930 b 4b
927 931
928 .comm ee_restarts,4 932 .comm ee_restarts,4
929
930/*
931 * PROM code for specific machines follows. Put it
932 * here so it's easy to add arch-specific sections later.
933 * -- Cort
934 */
935#ifdef CONFIG_PPC_OF
936/*
937 * On CHRP, the Run-Time Abstraction Services (RTAS) have to be
938 * called with the MMU off.
939 */
940_GLOBAL(enter_rtas)
941 stwu r1,-INT_FRAME_SIZE(r1)
942 mflr r0
943 stw r0,INT_FRAME_SIZE+4(r1)
944 lis r4,rtas_data@ha
945 lwz r4,rtas_data@l(r4)
946 lis r6,1f@ha /* physical return address for rtas */
947 addi r6,r6,1f@l
948 tophys(r6,r6)
949 tophys(r7,r1)
950 lis r8,rtas_entry@ha
951 lwz r8,rtas_entry@l(r8)
952 mfmsr r9
953 stw r9,8(r1)
954 LOAD_MSR_KERNEL(r0,MSR_KERNEL)
955 SYNC /* disable interrupts so SRR0/1 */
956 MTMSRD(r0) /* don't get trashed */
957 li r9,MSR_KERNEL & ~(MSR_IR|MSR_DR)
958 mtlr r6
959 CLR_TOP32(r7)
960 mtspr SPRN_SPRG2,r7
961 mtspr SPRN_SRR0,r8
962 mtspr SPRN_SRR1,r9
963 RFI
9641: tophys(r9,r1)
965 lwz r8,INT_FRAME_SIZE+4(r9) /* get return address */
966 lwz r9,8(r9) /* original msr value */
967 FIX_SRR1(r9,r0)
968 addi r1,r1,INT_FRAME_SIZE
969 li r0,0
970 mtspr SPRN_SPRG2,r0
971 mtspr SPRN_SRR0,r8
972 mtspr SPRN_SRR1,r9
973 RFI /* return to caller */
974
975 .globl machine_check_in_rtas
976machine_check_in_rtas:
977 twi 31,0,0
978 /* XXX load up BATs and panic */
979
980#endif /* CONFIG_PPC_OF */
diff --git a/arch/ppc/kernel/head.S b/arch/ppc/kernel/head.S
index 53ea845fb911..01303efeddad 100644
--- a/arch/ppc/kernel/head.S
+++ b/arch/ppc/kernel/head.S
@@ -37,19 +37,6 @@
37#include <asm/amigappc.h> 37#include <asm/amigappc.h>
38#endif 38#endif
39 39
40#ifdef CONFIG_PPC64BRIDGE
41#define LOAD_BAT(n, reg, RA, RB) \
42 ld RA,(n*32)+0(reg); \
43 ld RB,(n*32)+8(reg); \
44 mtspr SPRN_IBAT##n##U,RA; \
45 mtspr SPRN_IBAT##n##L,RB; \
46 ld RA,(n*32)+16(reg); \
47 ld RB,(n*32)+24(reg); \
48 mtspr SPRN_DBAT##n##U,RA; \
49 mtspr SPRN_DBAT##n##L,RB; \
50
51#else /* CONFIG_PPC64BRIDGE */
52
53/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */ 40/* 601 only have IBAT; cr0.eq is set on 601 when using this macro */
54#define LOAD_BAT(n, reg, RA, RB) \ 41#define LOAD_BAT(n, reg, RA, RB) \
55 /* see the comment for clear_bats() -- Cort */ \ 42 /* see the comment for clear_bats() -- Cort */ \
@@ -66,7 +53,6 @@
66 mtspr SPRN_DBAT##n##U,RA; \ 53 mtspr SPRN_DBAT##n##U,RA; \
67 mtspr SPRN_DBAT##n##L,RB; \ 54 mtspr SPRN_DBAT##n##L,RB; \
681: 551:
69#endif /* CONFIG_PPC64BRIDGE */
70 56
71 .text 57 .text
72 .stabs "arch/ppc/kernel/",N_SO,0,0,0f 58 .stabs "arch/ppc/kernel/",N_SO,0,0,0f
@@ -129,11 +115,6 @@ _start:
129 115
130 .globl __start 116 .globl __start
131__start: 117__start:
132/*
133 * We have to do any OF calls before we map ourselves to KERNELBASE,
134 * because OF may have I/O devices mapped into that area
135 * (particularly on CHRP).
136 */
137 mr r31,r3 /* save parameters */ 118 mr r31,r3 /* save parameters */
138 mr r30,r4 119 mr r30,r4
139 mr r29,r5 120 mr r29,r5
@@ -148,14 +129,6 @@ __start:
148 */ 129 */
149 bl early_init 130 bl early_init
150 131
151/*
152 * On POWER4, we first need to tweak some CPU configuration registers
153 * like real mode cache inhibit or exception base
154 */
155#ifdef CONFIG_POWER4
156 bl __970_cpu_preinit
157#endif /* CONFIG_POWER4 */
158
159#ifdef CONFIG_APUS 132#ifdef CONFIG_APUS
160/* On APUS the __va/__pa constants need to be set to the correct 133/* On APUS the __va/__pa constants need to be set to the correct
161 * values before continuing. 134 * values before continuing.
@@ -169,7 +142,6 @@ __start:
169 */ 142 */
170 bl mmu_off 143 bl mmu_off
171__after_mmu_off: 144__after_mmu_off:
172#ifndef CONFIG_POWER4
173 bl clear_bats 145 bl clear_bats
174 bl flush_tlbs 146 bl flush_tlbs
175 147
@@ -177,10 +149,6 @@ __after_mmu_off:
177#if !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT) 149#if !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT)
178 bl setup_disp_bat 150 bl setup_disp_bat
179#endif 151#endif
180#else /* CONFIG_POWER4 */
181 bl reloc_offset
182 bl initial_mm_power4
183#endif /* CONFIG_POWER4 */
184 152
185/* 153/*
186 * Call setup_cpu for CPU 0 and initialize 6xx Idle 154 * Call setup_cpu for CPU 0 and initialize 6xx Idle
@@ -192,18 +160,11 @@ __after_mmu_off:
192 bl reloc_offset 160 bl reloc_offset
193 bl init_idle_6xx 161 bl init_idle_6xx
194#endif /* CONFIG_6xx */ 162#endif /* CONFIG_6xx */
195#ifdef CONFIG_POWER4
196 bl reloc_offset
197 bl init_idle_power4
198#endif /* CONFIG_POWER4 */
199 163
200 164
201#ifndef CONFIG_APUS 165#ifndef CONFIG_APUS
202/* 166/*
203 * We need to run with _start at physical address 0. 167 * We need to run with _start at physical address 0.
204 * On CHRP, we are loaded at 0x10000 since OF on CHRP uses
205 * the exception vectors at 0 (and therefore this copy
206 * overwrites OF's exception vectors with our own).
207 * If the MMU is already turned on, we copy stuff to KERNELBASE, 168 * If the MMU is already turned on, we copy stuff to KERNELBASE,
208 * otherwise we copy it to 0. 169 * otherwise we copy it to 0.
209 */ 170 */
@@ -358,51 +319,19 @@ i##n: \
358#endif 319#endif
359 320
360/* Machine check */ 321/* Machine check */
361/*
362 * On CHRP, this is complicated by the fact that we could get a
363 * machine check inside RTAS, and we have no guarantee that certain
364 * critical registers will have the values we expect. The set of
365 * registers that might have bad values includes all the GPRs
366 * and all the BATs. We indicate that we are in RTAS by putting
367 * a non-zero value, the address of the exception frame to use,
368 * in SPRG2. The machine check handler checks SPRG2 and uses its
369 * value if it is non-zero. If we ever needed to free up SPRG2,
370 * we could use a field in the thread_info or thread_struct instead.
371 * (Other exception handlers assume that r1 is a valid kernel stack
372 * pointer when we take an exception from supervisor mode.)
373 * -- paulus.
374 */
375 . = 0x200 322 . = 0x200
376 mtspr SPRN_SPRG0,r10 323 mtspr SPRN_SPRG0,r10
377 mtspr SPRN_SPRG1,r11 324 mtspr SPRN_SPRG1,r11
378 mfcr r10 325 mfcr r10
379#ifdef CONFIG_PPC_CHRP
380 mfspr r11,SPRN_SPRG2
381 cmpwi 0,r11,0
382 bne 7f
383#endif /* CONFIG_PPC_CHRP */
384 EXCEPTION_PROLOG_1 326 EXCEPTION_PROLOG_1
3857: EXCEPTION_PROLOG_2 3277: EXCEPTION_PROLOG_2
386 addi r3,r1,STACK_FRAME_OVERHEAD 328 addi r3,r1,STACK_FRAME_OVERHEAD
387#ifdef CONFIG_PPC_CHRP
388 mfspr r4,SPRN_SPRG2
389 cmpwi cr1,r4,0
390 bne cr1,1f
391#endif
392 EXC_XFER_STD(0x200, machine_check_exception) 329 EXC_XFER_STD(0x200, machine_check_exception)
393#ifdef CONFIG_PPC_CHRP
3941: b machine_check_in_rtas
395#endif
396 330
397/* Data access exception. */ 331/* Data access exception. */
398 . = 0x300 332 . = 0x300
399#ifdef CONFIG_PPC64BRIDGE
400 b DataAccess
401DataAccessCont:
402#else
403DataAccess: 333DataAccess:
404 EXCEPTION_PROLOG 334 EXCEPTION_PROLOG
405#endif /* CONFIG_PPC64BRIDGE */
406 mfspr r10,SPRN_DSISR 335 mfspr r10,SPRN_DSISR
407 andis. r0,r10,0xa470 /* weird error? */ 336 andis. r0,r10,0xa470 /* weird error? */
408 bne 1f /* if not, try to put a PTE */ 337 bne 1f /* if not, try to put a PTE */
@@ -414,21 +343,10 @@ DataAccess:
414 mfspr r4,SPRN_DAR 343 mfspr r4,SPRN_DAR
415 EXC_XFER_EE_LITE(0x300, handle_page_fault) 344 EXC_XFER_EE_LITE(0x300, handle_page_fault)
416 345
417#ifdef CONFIG_PPC64BRIDGE
418/* SLB fault on data access. */
419 . = 0x380
420 b DataSegment
421#endif /* CONFIG_PPC64BRIDGE */
422
423/* Instruction access exception. */ 346/* Instruction access exception. */
424 . = 0x400 347 . = 0x400
425#ifdef CONFIG_PPC64BRIDGE
426 b InstructionAccess
427InstructionAccessCont:
428#else
429InstructionAccess: 348InstructionAccess:
430 EXCEPTION_PROLOG 349 EXCEPTION_PROLOG
431#endif /* CONFIG_PPC64BRIDGE */
432 andis. r0,r9,0x4000 /* no pte found? */ 350 andis. r0,r9,0x4000 /* no pte found? */
433 beq 1f /* if so, try to put a PTE */ 351 beq 1f /* if so, try to put a PTE */
434 li r3,0 /* into the hash table */ 352 li r3,0 /* into the hash table */
@@ -438,12 +356,6 @@ InstructionAccess:
438 mr r5,r9 356 mr r5,r9
439 EXC_XFER_EE_LITE(0x400, handle_page_fault) 357 EXC_XFER_EE_LITE(0x400, handle_page_fault)
440 358
441#ifdef CONFIG_PPC64BRIDGE
442/* SLB fault on instruction access. */
443 . = 0x480
444 b InstructionSegment
445#endif /* CONFIG_PPC64BRIDGE */
446
447/* External interrupt */ 359/* External interrupt */
448 EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE) 360 EXCEPTION(0x500, HardwareInterrupt, do_IRQ, EXC_XFER_LITE)
449 361
@@ -708,15 +620,9 @@ DataStoreTLBMiss:
708 EXCEPTION(0x1300, Trap_13, instruction_breakpoint_exception, EXC_XFER_EE) 620 EXCEPTION(0x1300, Trap_13, instruction_breakpoint_exception, EXC_XFER_EE)
709 EXCEPTION(0x1400, SMI, SMIException, EXC_XFER_EE) 621 EXCEPTION(0x1400, SMI, SMIException, EXC_XFER_EE)
710 EXCEPTION(0x1500, Trap_15, unknown_exception, EXC_XFER_EE) 622 EXCEPTION(0x1500, Trap_15, unknown_exception, EXC_XFER_EE)
711#ifdef CONFIG_POWER4
712 EXCEPTION(0x1600, Trap_16, unknown_exception, EXC_XFER_EE)
713 EXCEPTION(0x1700, Trap_17, altivec_assist_exception, EXC_XFER_EE)
714 EXCEPTION(0x1800, Trap_18, TAUException, EXC_XFER_STD)
715#else /* !CONFIG_POWER4 */
716 EXCEPTION(0x1600, Trap_16, altivec_assist_exception, EXC_XFER_EE) 623 EXCEPTION(0x1600, Trap_16, altivec_assist_exception, EXC_XFER_EE)
717 EXCEPTION(0x1700, Trap_17, TAUException, EXC_XFER_STD) 624 EXCEPTION(0x1700, Trap_17, TAUException, EXC_XFER_STD)
718 EXCEPTION(0x1800, Trap_18, unknown_exception, EXC_XFER_EE) 625 EXCEPTION(0x1800, Trap_18, unknown_exception, EXC_XFER_EE)
719#endif /* CONFIG_POWER4 */
720 EXCEPTION(0x1900, Trap_19, unknown_exception, EXC_XFER_EE) 626 EXCEPTION(0x1900, Trap_19, unknown_exception, EXC_XFER_EE)
721 EXCEPTION(0x1a00, Trap_1a, unknown_exception, EXC_XFER_EE) 627 EXCEPTION(0x1a00, Trap_1a, unknown_exception, EXC_XFER_EE)
722 EXCEPTION(0x1b00, Trap_1b, unknown_exception, EXC_XFER_EE) 628 EXCEPTION(0x1b00, Trap_1b, unknown_exception, EXC_XFER_EE)
@@ -754,28 +660,6 @@ AltiVecUnavailable:
754 addi r3,r1,STACK_FRAME_OVERHEAD 660 addi r3,r1,STACK_FRAME_OVERHEAD
755 EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception) 661 EXC_XFER_EE_LITE(0xf20, altivec_unavailable_exception)
756 662
757#ifdef CONFIG_PPC64BRIDGE
758DataAccess:
759 EXCEPTION_PROLOG
760 b DataAccessCont
761
762InstructionAccess:
763 EXCEPTION_PROLOG
764 b InstructionAccessCont
765
766DataSegment:
767 EXCEPTION_PROLOG
768 addi r3,r1,STACK_FRAME_OVERHEAD
769 mfspr r4,SPRN_DAR
770 stw r4,_DAR(r11)
771 EXC_XFER_STD(0x380, unknown_exception)
772
773InstructionSegment:
774 EXCEPTION_PROLOG
775 addi r3,r1,STACK_FRAME_OVERHEAD
776 EXC_XFER_STD(0x480, unknown_exception)
777#endif /* CONFIG_PPC64BRIDGE */
778
779#ifdef CONFIG_ALTIVEC 663#ifdef CONFIG_ALTIVEC
780/* Note that the AltiVec support is closely modeled after the FP 664/* Note that the AltiVec support is closely modeled after the FP
781 * support. Changes to one are likely to be applicable to the 665 * support. Changes to one are likely to be applicable to the
@@ -1048,13 +932,6 @@ __secondary_start_pmac_0:
1048 932
1049 .globl __secondary_start 933 .globl __secondary_start
1050__secondary_start: 934__secondary_start:
1051#ifdef CONFIG_PPC64BRIDGE
1052 mfmsr r0
1053 clrldi r0,r0,1 /* make sure it's in 32-bit mode */
1054 SYNC
1055 MTMSRD(r0)
1056 isync
1057#endif
1058 /* Copy some CPU settings from CPU 0 */ 935 /* Copy some CPU settings from CPU 0 */
1059 bl __restore_cpu_setup 936 bl __restore_cpu_setup
1060 937
@@ -1065,10 +942,6 @@ __secondary_start:
1065 lis r3,-KERNELBASE@h 942 lis r3,-KERNELBASE@h
1066 bl init_idle_6xx 943 bl init_idle_6xx
1067#endif /* CONFIG_6xx */ 944#endif /* CONFIG_6xx */
1068#ifdef CONFIG_POWER4
1069 lis r3,-KERNELBASE@h
1070 bl init_idle_power4
1071#endif /* CONFIG_POWER4 */
1072 945
1073 /* get current_thread_info and current */ 946 /* get current_thread_info and current */
1074 lis r1,secondary_ti@ha 947 lis r1,secondary_ti@ha
@@ -1109,12 +982,12 @@ __secondary_start:
1109 * Those generic dummy functions are kept for CPUs not 982 * Those generic dummy functions are kept for CPUs not
1110 * included in CONFIG_6xx 983 * included in CONFIG_6xx
1111 */ 984 */
1112#if !defined(CONFIG_6xx) && !defined(CONFIG_POWER4) 985#if !defined(CONFIG_6xx)
1113_GLOBAL(__save_cpu_setup) 986_GLOBAL(__save_cpu_setup)
1114 blr 987 blr
1115_GLOBAL(__restore_cpu_setup) 988_GLOBAL(__restore_cpu_setup)
1116 blr 989 blr
1117#endif /* !defined(CONFIG_6xx) && !defined(CONFIG_POWER4) */ 990#endif /* !defined(CONFIG_6xx) */
1118 991
1119 992
1120/* 993/*
@@ -1132,11 +1005,6 @@ load_up_mmu:
1132 tophys(r6,r6) 1005 tophys(r6,r6)
1133 lwz r6,_SDR1@l(r6) 1006 lwz r6,_SDR1@l(r6)
1134 mtspr SPRN_SDR1,r6 1007 mtspr SPRN_SDR1,r6
1135#ifdef CONFIG_PPC64BRIDGE
1136 /* clear the ASR so we only use the pseudo-segment registers. */
1137 li r6,0
1138 mtasr r6
1139#endif /* CONFIG_PPC64BRIDGE */
1140 li r0,16 /* load up segment register values */ 1008 li r0,16 /* load up segment register values */
1141 mtctr r0 /* for context 0 */ 1009 mtctr r0 /* for context 0 */
1142 lis r3,0x2000 /* Ku = 1, VSID = 0 */ 1010 lis r3,0x2000 /* Ku = 1, VSID = 0 */
@@ -1145,7 +1013,7 @@ load_up_mmu:
1145 addi r3,r3,0x111 /* increment VSID */ 1013 addi r3,r3,0x111 /* increment VSID */
1146 addis r4,r4,0x1000 /* address of next segment */ 1014 addis r4,r4,0x1000 /* address of next segment */
1147 bdnz 3b 1015 bdnz 3b
1148#ifndef CONFIG_POWER4 1016
1149/* Load the BAT registers with the values set up by MMU_init. 1017/* Load the BAT registers with the values set up by MMU_init.
1150 MMU_init takes care of whether we're on a 601 or not. */ 1018 MMU_init takes care of whether we're on a 601 or not. */
1151 mfpvr r3 1019 mfpvr r3
@@ -1158,7 +1026,7 @@ load_up_mmu:
1158 LOAD_BAT(1,r3,r4,r5) 1026 LOAD_BAT(1,r3,r4,r5)
1159 LOAD_BAT(2,r3,r4,r5) 1027 LOAD_BAT(2,r3,r4,r5)
1160 LOAD_BAT(3,r3,r4,r5) 1028 LOAD_BAT(3,r3,r4,r5)
1161#endif /* CONFIG_POWER4 */ 1029
1162 blr 1030 blr
1163 1031
1164/* 1032/*
@@ -1269,9 +1137,6 @@ _GLOBAL(set_context)
1269 li r4,0 1137 li r4,0
1270 isync 1138 isync
12713: 11393:
1272#ifdef CONFIG_PPC64BRIDGE
1273 slbie r4
1274#endif /* CONFIG_PPC64BRIDGE */
1275 mtsrin r3,r4 1140 mtsrin r3,r4
1276 addi r3,r3,0x111 /* next VSID */ 1141 addi r3,r3,0x111 /* next VSID */
1277 rlwinm r3,r3,0,8,3 /* clear out any overflow from VSID field */ 1142 rlwinm r3,r3,0,8,3 /* clear out any overflow from VSID field */
@@ -1358,7 +1223,6 @@ mmu_off:
1358 sync 1223 sync
1359 RFI 1224 RFI
1360 1225
1361#ifndef CONFIG_POWER4
1362/* 1226/*
1363 * Use the first pair of BAT registers to map the 1st 16MB 1227 * Use the first pair of BAT registers to map the 1st 16MB
1364 * of RAM to KERNELBASE. From this point on we can't safely 1228 * of RAM to KERNELBASE. From this point on we can't safely
@@ -1366,7 +1230,6 @@ mmu_off:
1366 */ 1230 */
1367initial_bats: 1231initial_bats:
1368 lis r11,KERNELBASE@h 1232 lis r11,KERNELBASE@h
1369#ifndef CONFIG_PPC64BRIDGE
1370 mfspr r9,SPRN_PVR 1233 mfspr r9,SPRN_PVR
1371 rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */ 1234 rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */
1372 cmpwi 0,r9,1 1235 cmpwi 0,r9,1
@@ -1381,7 +1244,6 @@ initial_bats:
1381 mtspr SPRN_IBAT1L,r10 1244 mtspr SPRN_IBAT1L,r10
1382 isync 1245 isync
1383 blr 1246 blr
1384#endif /* CONFIG_PPC64BRIDGE */
1385 1247
13864: tophys(r8,r11) 12484: tophys(r8,r11)
1387#ifdef CONFIG_SMP 1249#ifdef CONFIG_SMP
@@ -1395,11 +1257,6 @@ initial_bats:
1395 ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */ 1257 ori r11,r11,BL_256M<<2|0x2 /* set up BAT registers for 604 */
1396#endif /* CONFIG_APUS */ 1258#endif /* CONFIG_APUS */
1397 1259
1398#ifdef CONFIG_PPC64BRIDGE
1399 /* clear out the high 32 bits in the BAT */
1400 clrldi r11,r11,32
1401 clrldi r8,r8,32
1402#endif /* CONFIG_PPC64BRIDGE */
1403 mtspr SPRN_DBAT0L,r8 /* N.B. 6xx (not 601) have valid */ 1260 mtspr SPRN_DBAT0L,r8 /* N.B. 6xx (not 601) have valid */
1404 mtspr SPRN_DBAT0U,r11 /* bit in upper BAT register */ 1261 mtspr SPRN_DBAT0U,r11 /* bit in upper BAT register */
1405 mtspr SPRN_IBAT0L,r8 1262 mtspr SPRN_IBAT0L,r8
@@ -1432,38 +1289,6 @@ setup_disp_bat:
1432 1289
1433#endif /* !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT) */ 1290#endif /* !defined(CONFIG_APUS) && defined(CONFIG_BOOTX_TEXT) */
1434 1291
1435#else /* CONFIG_POWER4 */
1436/*
1437 * Load up the SDR1 and segment register values now
1438 * since we don't have the BATs.
1439 * Also make sure we are running in 32-bit mode.
1440 */
1441
1442initial_mm_power4:
1443 addis r14,r3,_SDR1@ha /* get the value from _SDR1 */
1444 lwz r14,_SDR1@l(r14) /* assume hash table below 4GB */
1445 mtspr SPRN_SDR1,r14
1446 slbia
1447 lis r4,0x2000 /* set pseudo-segment reg 12 */
1448 ori r5,r4,0x0ccc
1449 mtsr 12,r5
1450#if 0
1451 ori r5,r4,0x0888 /* set pseudo-segment reg 8 */
1452 mtsr 8,r5 /* (for access to serial port) */
1453#endif
1454#ifdef CONFIG_BOOTX_TEXT
1455 ori r5,r4,0x0999 /* set pseudo-segment reg 9 */
1456 mtsr 9,r5 /* (for access to screen) */
1457#endif
1458 mfmsr r0
1459 clrldi r0,r0,1
1460 sync
1461 mtmsr r0
1462 isync
1463 blr
1464
1465#endif /* CONFIG_POWER4 */
1466
1467#ifdef CONFIG_8260 1292#ifdef CONFIG_8260
1468/* Jump into the system reset for the rom. 1293/* Jump into the system reset for the rom.
1469 * We first disable the MMU, and then jump to the ROM reset address. 1294 * We first disable the MMU, and then jump to the ROM reset address.
diff --git a/arch/ppc/kernel/idle.c b/arch/ppc/kernel/idle.c
deleted file mode 100644
index 1be3ca5bae40..000000000000
--- a/arch/ppc/kernel/idle.c
+++ /dev/null
@@ -1,112 +0,0 @@
1/*
2 * Idle daemon for PowerPC. Idle daemon will handle any action
3 * that needs to be taken when the system becomes idle.
4 *
5 * Written by Cort Dougan (cort@cs.nmt.edu). Subsequently hacked
6 * on by Tom Rini, Armin Kuster, Paul Mackerras and others.
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 <linux/config.h>
14#include <linux/errno.h>
15#include <linux/sched.h>
16#include <linux/kernel.h>
17#include <linux/mm.h>
18#include <linux/smp.h>
19#include <linux/smp_lock.h>
20#include <linux/stddef.h>
21#include <linux/unistd.h>
22#include <linux/ptrace.h>
23#include <linux/slab.h>
24#include <linux/sysctl.h>
25#include <linux/cpu.h>
26
27#include <asm/pgtable.h>
28#include <asm/uaccess.h>
29#include <asm/system.h>
30#include <asm/io.h>
31#include <asm/mmu.h>
32#include <asm/cache.h>
33#include <asm/cputable.h>
34#include <asm/machdep.h>
35#include <asm/smp.h>
36
37void default_idle(void)
38{
39 void (*powersave)(void);
40
41 powersave = ppc_md.power_save;
42
43 if (!need_resched()) {
44 if (powersave != NULL)
45 powersave();
46#ifdef CONFIG_SMP
47 else {
48 set_thread_flag(TIF_POLLING_NRFLAG);
49 while (!need_resched() &&
50 !cpu_is_offline(smp_processor_id()))
51 barrier();
52 clear_thread_flag(TIF_POLLING_NRFLAG);
53 }
54#endif
55 }
56}
57
58/*
59 * The body of the idle task.
60 */
61void cpu_idle(void)
62{
63 int cpu = smp_processor_id();
64
65 for (;;) {
66 while (!need_resched()) {
67 if (ppc_md.idle != NULL)
68 ppc_md.idle();
69 else
70 default_idle();
71 }
72
73 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
74 cpu_die();
75 preempt_enable_no_resched();
76 schedule();
77 preempt_disable();
78 }
79}
80
81#if defined(CONFIG_SYSCTL) && defined(CONFIG_6xx)
82/*
83 * Register the sysctl to set/clear powersave_nap.
84 */
85extern int powersave_nap;
86
87static ctl_table powersave_nap_ctl_table[]={
88 {
89 .ctl_name = KERN_PPC_POWERSAVE_NAP,
90 .procname = "powersave-nap",
91 .data = &powersave_nap,
92 .maxlen = sizeof(int),
93 .mode = 0644,
94 .proc_handler = &proc_dointvec,
95 },
96 { 0, },
97};
98static ctl_table powersave_nap_sysctl_root[] = {
99 { 1, "kernel", NULL, 0, 0755, powersave_nap_ctl_table, },
100 { 0,},
101};
102
103static int __init
104register_powersave_nap_sysctl(void)
105{
106 register_sysctl_table(powersave_nap_sysctl_root, 0);
107
108 return 0;
109}
110
111__initcall(register_powersave_nap_sysctl);
112#endif
diff --git a/arch/ppc/kernel/idle_6xx.S b/arch/ppc/kernel/idle_6xx.S
deleted file mode 100644
index 1a2194cf6828..000000000000
--- a/arch/ppc/kernel/idle_6xx.S
+++ /dev/null
@@ -1,233 +0,0 @@
1/*
2 * This file contains the power_save function for 6xx & 7xxx CPUs
3 * rewritten in assembler
4 *
5 * Warning ! This code assumes that if your machine has a 750fx
6 * it will have PLL 1 set to low speed mode (used during NAP/DOZE).
7 * if this is not the case some additional changes will have to
8 * be done to check a runtime var (a bit like powersave-nap)
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#include <linux/config.h>
17#include <linux/threads.h>
18#include <asm/processor.h>
19#include <asm/page.h>
20#include <asm/cputable.h>
21#include <asm/thread_info.h>
22#include <asm/ppc_asm.h>
23#include <asm/asm-offsets.h>
24
25#undef DEBUG
26
27 .text
28
29/*
30 * Init idle, called at early CPU setup time from head.S for each CPU
31 * Make sure no rest of NAP mode remains in HID0, save default
32 * values for some CPU specific registers. Called with r24
33 * containing CPU number and r3 reloc offset
34 */
35_GLOBAL(init_idle_6xx)
36BEGIN_FTR_SECTION
37 mfspr r4,SPRN_HID0
38 rlwinm r4,r4,0,10,8 /* Clear NAP */
39 mtspr SPRN_HID0, r4
40 b 1f
41END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
42 blr
431:
44 slwi r5,r24,2
45 add r5,r5,r3
46BEGIN_FTR_SECTION
47 mfspr r4,SPRN_MSSCR0
48 addis r6,r5, nap_save_msscr0@ha
49 stw r4,nap_save_msscr0@l(r6)
50END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
51BEGIN_FTR_SECTION
52 mfspr r4,SPRN_HID1
53 addis r6,r5,nap_save_hid1@ha
54 stw r4,nap_save_hid1@l(r6)
55END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
56 blr
57
58/*
59 * Here is the power_save_6xx function. This could eventually be
60 * split into several functions & changing the function pointer
61 * depending on the various features.
62 */
63_GLOBAL(ppc6xx_idle)
64 /* Check if we can nap or doze, put HID0 mask in r3
65 */
66 lis r3, 0
67BEGIN_FTR_SECTION
68 lis r3,HID0_DOZE@h
69END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
70BEGIN_FTR_SECTION
71 /* We must dynamically check for the NAP feature as it
72 * can be cleared by CPU init after the fixups are done
73 */
74 lis r4,cur_cpu_spec@ha
75 lwz r4,cur_cpu_spec@l(r4)
76 lwz r4,CPU_SPEC_FEATURES(r4)
77 andi. r0,r4,CPU_FTR_CAN_NAP
78 beq 1f
79 /* Now check if user or arch enabled NAP mode */
80 lis r4,powersave_nap@ha
81 lwz r4,powersave_nap@l(r4)
82 cmpwi 0,r4,0
83 beq 1f
84 lis r3,HID0_NAP@h
851:
86END_FTR_SECTION_IFSET(CPU_FTR_CAN_NAP)
87 cmpwi 0,r3,0
88 beqlr
89
90 /* Clear MSR:EE */
91 mfmsr r7
92 rlwinm r0,r7,0,17,15
93 mtmsr r0
94
95 /* Check current_thread_info()->flags */
96 rlwinm r4,r1,0,0,18
97 lwz r4,TI_FLAGS(r4)
98 andi. r0,r4,_TIF_NEED_RESCHED
99 beq 1f
100 mtmsr r7 /* out of line this ? */
101 blr
1021:
103 /* Some pre-nap cleanups needed on some CPUs */
104 andis. r0,r3,HID0_NAP@h
105 beq 2f
106BEGIN_FTR_SECTION
107 /* Disable L2 prefetch on some 745x and try to ensure
108 * L2 prefetch engines are idle. As explained by errata
109 * text, we can't be sure they are, we just hope very hard
110 * that well be enough (sic !). At least I noticed Apple
111 * doesn't even bother doing the dcbf's here...
112 */
113 mfspr r4,SPRN_MSSCR0
114 rlwinm r4,r4,0,0,29
115 sync
116 mtspr SPRN_MSSCR0,r4
117 sync
118 isync
119 lis r4,KERNELBASE@h
120 dcbf 0,r4
121 dcbf 0,r4
122 dcbf 0,r4
123 dcbf 0,r4
124END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
125#ifdef DEBUG
126 lis r6,nap_enter_count@ha
127 lwz r4,nap_enter_count@l(r6)
128 addi r4,r4,1
129 stw r4,nap_enter_count@l(r6)
130#endif
1312:
132BEGIN_FTR_SECTION
133 /* Go to low speed mode on some 750FX */
134 lis r4,powersave_lowspeed@ha
135 lwz r4,powersave_lowspeed@l(r4)
136 cmpwi 0,r4,0
137 beq 1f
138 mfspr r4,SPRN_HID1
139 oris r4,r4,0x0001
140 mtspr SPRN_HID1,r4
1411:
142END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
143
144 /* Go to NAP or DOZE now */
145 mfspr r4,SPRN_HID0
146 lis r5,(HID0_NAP|HID0_SLEEP)@h
147BEGIN_FTR_SECTION
148 oris r5,r5,HID0_DOZE@h
149END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
150 andc r4,r4,r5
151 or r4,r4,r3
152BEGIN_FTR_SECTION
153 oris r4,r4,HID0_DPM@h /* that should be done once for all */
154END_FTR_SECTION_IFCLR(CPU_FTR_NO_DPM)
155 mtspr SPRN_HID0,r4
156BEGIN_FTR_SECTION
157 DSSALL
158 sync
159END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
160 ori r7,r7,MSR_EE /* Could be ommited (already set) */
161 oris r7,r7,MSR_POW@h
162 sync
163 isync
164 mtmsr r7
165 isync
166 sync
167 blr
168
169/*
170 * Return from NAP/DOZE mode, restore some CPU specific registers,
171 * we are called with DR/IR still off and r2 containing physical
172 * address of current.
173 */
174_GLOBAL(power_save_6xx_restore)
175 mfspr r11,SPRN_HID0
176 rlwinm. r11,r11,0,10,8 /* Clear NAP & copy NAP bit !state to cr1 EQ */
177 cror 4*cr1+eq,4*cr0+eq,4*cr0+eq
178BEGIN_FTR_SECTION
179 rlwinm r11,r11,0,9,7 /* Clear DOZE */
180END_FTR_SECTION_IFSET(CPU_FTR_CAN_DOZE)
181 mtspr SPRN_HID0, r11
182
183#ifdef DEBUG
184 beq cr1,1f
185 lis r11,(nap_return_count-KERNELBASE)@ha
186 lwz r9,nap_return_count@l(r11)
187 addi r9,r9,1
188 stw r9,nap_return_count@l(r11)
1891:
190#endif
191
192 rlwinm r9,r1,0,0,18
193 tophys(r9,r9)
194 lwz r11,TI_CPU(r9)
195 slwi r11,r11,2
196 /* Todo make sure all these are in the same page
197 * and load r22 (@ha part + CPU offset) only once
198 */
199BEGIN_FTR_SECTION
200 beq cr1,1f
201 addis r9,r11,(nap_save_msscr0-KERNELBASE)@ha
202 lwz r9,nap_save_msscr0@l(r9)
203 mtspr SPRN_MSSCR0, r9
204 sync
205 isync
2061:
207END_FTR_SECTION_IFSET(CPU_FTR_NAP_DISABLE_L2_PR)
208BEGIN_FTR_SECTION
209 addis r9,r11,(nap_save_hid1-KERNELBASE)@ha
210 lwz r9,nap_save_hid1@l(r9)
211 mtspr SPRN_HID1, r9
212END_FTR_SECTION_IFSET(CPU_FTR_DUAL_PLL_750FX)
213 b transfer_to_handler_cont
214
215 .data
216
217_GLOBAL(nap_save_msscr0)
218 .space 4*NR_CPUS
219
220_GLOBAL(nap_save_hid1)
221 .space 4*NR_CPUS
222
223_GLOBAL(powersave_nap)
224 .long 0
225_GLOBAL(powersave_lowspeed)
226 .long 0
227
228#ifdef DEBUG
229_GLOBAL(nap_enter_count)
230 .space 4
231_GLOBAL(nap_return_count)
232 .space 4
233#endif
diff --git a/arch/ppc/kernel/idle_power4.S b/arch/ppc/kernel/idle_power4.S
deleted file mode 100644
index cc0d535365cd..000000000000
--- a/arch/ppc/kernel/idle_power4.S
+++ /dev/null
@@ -1,91 +0,0 @@
1/*
2 * This file contains the power_save function for 6xx & 7xxx CPUs
3 * rewritten in assembler
4 *
5 * Warning ! This code assumes that if your machine has a 750fx
6 * it will have PLL 1 set to low speed mode (used during NAP/DOZE).
7 * if this is not the case some additional changes will have to
8 * be done to check a runtime var (a bit like powersave-nap)
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#include <linux/config.h>
17#include <linux/threads.h>
18#include <asm/processor.h>
19#include <asm/page.h>
20#include <asm/cputable.h>
21#include <asm/thread_info.h>
22#include <asm/ppc_asm.h>
23#include <asm/asm-offsets.h>
24
25#undef DEBUG
26
27 .text
28
29/*
30 * Init idle, called at early CPU setup time from head.S for each CPU
31 * So nothing for now. Called with r24 containing CPU number and r3
32 * reloc offset
33 */
34 .globl init_idle_power4
35init_idle_power4:
36 blr
37
38/*
39 * Here is the power_save_6xx function. This could eventually be
40 * split into several functions & changing the function pointer
41 * depending on the various features.
42 */
43 .globl power4_idle
44power4_idle:
45BEGIN_FTR_SECTION
46 blr
47END_FTR_SECTION_IFCLR(CPU_FTR_CAN_NAP)
48 /* We must dynamically check for the NAP feature as it
49 * can be cleared by CPU init after the fixups are done
50 */
51 lis r4,cur_cpu_spec@ha
52 lwz r4,cur_cpu_spec@l(r4)
53 lwz r4,CPU_SPEC_FEATURES(r4)
54 andi. r0,r4,CPU_FTR_CAN_NAP
55 beqlr
56 /* Now check if user or arch enabled NAP mode */
57 lis r4,powersave_nap@ha
58 lwz r4,powersave_nap@l(r4)
59 cmpwi 0,r4,0
60 beqlr
61
62 /* Clear MSR:EE */
63 mfmsr r7
64 rlwinm r0,r7,0,17,15
65 mtmsr r0
66
67 /* Check current_thread_info()->flags */
68 rlwinm r4,r1,0,0,18
69 lwz r4,TI_FLAGS(r4)
70 andi. r0,r4,_TIF_NEED_RESCHED
71 beq 1f
72 mtmsr r7 /* out of line this ? */
73 blr
741:
75 /* Go to NAP now */
76BEGIN_FTR_SECTION
77 DSSALL
78 sync
79END_FTR_SECTION_IFSET(CPU_FTR_ALTIVEC)
80 ori r7,r7,MSR_EE /* Could be ommited (already set) */
81 oris r7,r7,MSR_POW@h
82 sync
83 isync
84 mtmsr r7
85 isync
86 sync
87 blr
88
89 .globl powersave_nap
90powersave_nap:
91 .long 0
diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c
index 04d04c5bfdd0..809673a36f7a 100644
--- a/arch/ppc/kernel/pci.c
+++ b/arch/ppc/kernel/pci.c
@@ -46,9 +46,6 @@ static void pcibios_fixup_resources(struct pci_dev* dev);
46static void fixup_broken_pcnet32(struct pci_dev* dev); 46static void fixup_broken_pcnet32(struct pci_dev* dev);
47static int reparent_resources(struct resource *parent, struct resource *res); 47static int reparent_resources(struct resource *parent, struct resource *res);
48static void fixup_cpc710_pci64(struct pci_dev* dev); 48static void fixup_cpc710_pci64(struct pci_dev* dev);
49#ifdef CONFIG_PPC_OF
50static u8* pci_to_OF_bus_map;
51#endif
52 49
53/* By default, we don't re-assign bus numbers. 50/* By default, we don't re-assign bus numbers.
54 */ 51 */
@@ -625,406 +622,13 @@ pcibios_alloc_controller(void)
625 return hose; 622 return hose;
626} 623}
627 624
628#ifdef CONFIG_PPC_OF
629/*
630 * Functions below are used on OpenFirmware machines.
631 */
632static void
633make_one_node_map(struct device_node* node, u8 pci_bus)
634{
635 int *bus_range;
636 int len;
637
638 if (pci_bus >= pci_bus_count)
639 return;
640 bus_range = (int *) get_property(node, "bus-range", &len);
641 if (bus_range == NULL || len < 2 * sizeof(int)) {
642 printk(KERN_WARNING "Can't get bus-range for %s, "
643 "assuming it starts at 0\n", node->full_name);
644 pci_to_OF_bus_map[pci_bus] = 0;
645 } else
646 pci_to_OF_bus_map[pci_bus] = bus_range[0];
647
648 for (node=node->child; node != 0;node = node->sibling) {
649 struct pci_dev* dev;
650 unsigned int *class_code, *reg;
651
652 class_code = (unsigned int *) get_property(node, "class-code", NULL);
653 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
654 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS))
655 continue;
656 reg = (unsigned int *)get_property(node, "reg", NULL);
657 if (!reg)
658 continue;
659 dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff));
660 if (!dev || !dev->subordinate)
661 continue;
662 make_one_node_map(node, dev->subordinate->number);
663 }
664}
665
666void
667pcibios_make_OF_bus_map(void)
668{
669 int i;
670 struct pci_controller* hose;
671 u8* of_prop_map;
672
673 pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL);
674 if (!pci_to_OF_bus_map) {
675 printk(KERN_ERR "Can't allocate OF bus map !\n");
676 return;
677 }
678
679 /* We fill the bus map with invalid values, that helps
680 * debugging.
681 */
682 for (i=0; i<pci_bus_count; i++)
683 pci_to_OF_bus_map[i] = 0xff;
684
685 /* For each hose, we begin searching bridges */
686 for(hose=hose_head; hose; hose=hose->next) {
687 struct device_node* node;
688 node = (struct device_node *)hose->arch_data;
689 if (!node)
690 continue;
691 make_one_node_map(node, hose->first_busno);
692 }
693 of_prop_map = get_property(find_path_device("/"), "pci-OF-bus-map", NULL);
694 if (of_prop_map)
695 memcpy(of_prop_map, pci_to_OF_bus_map, pci_bus_count);
696#ifdef DEBUG
697 printk("PCI->OF bus map:\n");
698 for (i=0; i<pci_bus_count; i++) {
699 if (pci_to_OF_bus_map[i] == 0xff)
700 continue;
701 printk("%d -> %d\n", i, pci_to_OF_bus_map[i]);
702 }
703#endif
704}
705
706typedef int (*pci_OF_scan_iterator)(struct device_node* node, void* data);
707
708static struct device_node*
709scan_OF_pci_childs(struct device_node* node, pci_OF_scan_iterator filter, void* data)
710{
711 struct device_node* sub_node;
712
713 for (; node != 0;node = node->sibling) {
714 unsigned int *class_code;
715
716 if (filter(node, data))
717 return node;
718
719 /* For PCI<->PCI bridges or CardBus bridges, we go down
720 * Note: some OFs create a parent node "multifunc-device" as
721 * a fake root for all functions of a multi-function device,
722 * we go down them as well.
723 */
724 class_code = (unsigned int *) get_property(node, "class-code", NULL);
725 if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI &&
726 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) &&
727 strcmp(node->name, "multifunc-device"))
728 continue;
729 sub_node = scan_OF_pci_childs(node->child, filter, data);
730 if (sub_node)
731 return sub_node;
732 }
733 return NULL;
734}
735
736static int
737scan_OF_pci_childs_iterator(struct device_node* node, void* data)
738{
739 unsigned int *reg;
740 u8* fdata = (u8*)data;
741
742 reg = (unsigned int *) get_property(node, "reg", NULL);
743 if (reg && ((reg[0] >> 8) & 0xff) == fdata[1]
744 && ((reg[0] >> 16) & 0xff) == fdata[0])
745 return 1;
746 return 0;
747}
748
749static struct device_node*
750scan_OF_childs_for_device(struct device_node* node, u8 bus, u8 dev_fn)
751{
752 u8 filter_data[2] = {bus, dev_fn};
753
754 return scan_OF_pci_childs(node, scan_OF_pci_childs_iterator, filter_data);
755}
756
757/*
758 * Scans the OF tree for a device node matching a PCI device
759 */
760struct device_node *
761pci_busdev_to_OF_node(struct pci_bus *bus, int devfn)
762{
763 struct pci_controller *hose;
764 struct device_node *node;
765 int busnr;
766
767 if (!have_of)
768 return NULL;
769
770 /* Lookup the hose */
771 busnr = bus->number;
772 hose = pci_bus_to_hose(busnr);
773 if (!hose)
774 return NULL;
775
776 /* Check it has an OF node associated */
777 node = (struct device_node *) hose->arch_data;
778 if (!node)
779 return NULL;
780
781 /* Fixup bus number according to what OF think it is. */
782 if (pci_to_OF_bus_map)
783 busnr = pci_to_OF_bus_map[busnr];
784 if (busnr == 0xff)
785 return NULL;
786
787 /* Now, lookup childs of the hose */
788 return scan_OF_childs_for_device(node->child, busnr, devfn);
789}
790EXPORT_SYMBOL(pci_busdev_to_OF_node);
791
792struct device_node*
793pci_device_to_OF_node(struct pci_dev *dev)
794{
795 return pci_busdev_to_OF_node(dev->bus, dev->devfn);
796}
797EXPORT_SYMBOL(pci_device_to_OF_node);
798
799/* This routine is meant to be used early during boot, when the
800 * PCI bus numbers have not yet been assigned, and you need to
801 * issue PCI config cycles to an OF device.
802 * It could also be used to "fix" RTAS config cycles if you want
803 * to set pci_assign_all_buses to 1 and still use RTAS for PCI
804 * config cycles.
805 */
806struct pci_controller* pci_find_hose_for_OF_device(struct device_node* node)
807{
808 if (!have_of)
809 return NULL;
810 while(node) {
811 struct pci_controller* hose;
812 for (hose=hose_head;hose;hose=hose->next)
813 if (hose->arch_data == node)
814 return hose;
815 node=node->parent;
816 }
817 return NULL;
818}
819
820static int
821find_OF_pci_device_filter(struct device_node* node, void* data)
822{
823 return ((void *)node == data);
824}
825
826/*
827 * Returns the PCI device matching a given OF node
828 */
829int
830pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn)
831{
832 unsigned int *reg;
833 struct pci_controller* hose;
834 struct pci_dev* dev = NULL;
835
836 if (!have_of)
837 return -ENODEV;
838 /* Make sure it's really a PCI device */
839 hose = pci_find_hose_for_OF_device(node);
840 if (!hose || !hose->arch_data)
841 return -ENODEV;
842 if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child,
843 find_OF_pci_device_filter, (void *)node))
844 return -ENODEV;
845 reg = (unsigned int *) get_property(node, "reg", NULL);
846 if (!reg)
847 return -ENODEV;
848 *bus = (reg[0] >> 16) & 0xff;
849 *devfn = ((reg[0] >> 8) & 0xff);
850
851 /* Ok, here we need some tweak. If we have already renumbered
852 * all busses, we can't rely on the OF bus number any more.
853 * the pci_to_OF_bus_map is not enough as several PCI busses
854 * may match the same OF bus number.
855 */
856 if (!pci_to_OF_bus_map)
857 return 0;
858
859 for_each_pci_dev(dev)
860 if (pci_to_OF_bus_map[dev->bus->number] == *bus &&
861 dev->devfn == *devfn) {
862 *bus = dev->bus->number;
863 pci_dev_put(dev);
864 return 0;
865 }
866
867 return -ENODEV;
868}
869EXPORT_SYMBOL(pci_device_from_OF_node);
870
871void __init
872pci_process_bridge_OF_ranges(struct pci_controller *hose,
873 struct device_node *dev, int primary)
874{
875 static unsigned int static_lc_ranges[256] __initdata;
876 unsigned int *dt_ranges, *lc_ranges, *ranges, *prev;
877 unsigned int size;
878 int rlen = 0, orig_rlen;
879 int memno = 0;
880 struct resource *res;
881 int np, na = prom_n_addr_cells(dev);
882 np = na + 5;
883
884 /* First we try to merge ranges to fix a problem with some pmacs
885 * that can have more than 3 ranges, fortunately using contiguous
886 * addresses -- BenH
887 */
888 dt_ranges = (unsigned int *) get_property(dev, "ranges", &rlen);
889 if (!dt_ranges)
890 return;
891 /* Sanity check, though hopefully that never happens */
892 if (rlen > sizeof(static_lc_ranges)) {
893 printk(KERN_WARNING "OF ranges property too large !\n");
894 rlen = sizeof(static_lc_ranges);
895 }
896 lc_ranges = static_lc_ranges;
897 memcpy(lc_ranges, dt_ranges, rlen);
898 orig_rlen = rlen;
899
900 /* Let's work on a copy of the "ranges" property instead of damaging
901 * the device-tree image in memory
902 */
903 ranges = lc_ranges;
904 prev = NULL;
905 while ((rlen -= np * sizeof(unsigned int)) >= 0) {
906 if (prev) {
907 if (prev[0] == ranges[0] && prev[1] == ranges[1] &&
908 (prev[2] + prev[na+4]) == ranges[2] &&
909 (prev[na+2] + prev[na+4]) == ranges[na+2]) {
910 prev[na+4] += ranges[na+4];
911 ranges[0] = 0;
912 ranges += np;
913 continue;
914 }
915 }
916 prev = ranges;
917 ranges += np;
918 }
919
920 /*
921 * The ranges property is laid out as an array of elements,
922 * each of which comprises:
923 * cells 0 - 2: a PCI address
924 * cells 3 or 3+4: a CPU physical address
925 * (size depending on dev->n_addr_cells)
926 * cells 4+5 or 5+6: the size of the range
927 */
928 ranges = lc_ranges;
929 rlen = orig_rlen;
930 while (ranges && (rlen -= np * sizeof(unsigned int)) >= 0) {
931 res = NULL;
932 size = ranges[na+4];
933 switch ((ranges[0] >> 24) & 0x3) {
934 case 1: /* I/O space */
935 if (ranges[2] != 0)
936 break;
937 hose->io_base_phys = ranges[na+2];
938 /* limit I/O space to 16MB */
939 if (size > 0x01000000)
940 size = 0x01000000;
941 hose->io_base_virt = ioremap(ranges[na+2], size);
942 if (primary)
943 isa_io_base = (unsigned long) hose->io_base_virt;
944 res = &hose->io_resource;
945 res->flags = IORESOURCE_IO;
946 res->start = ranges[2];
947 DBG("PCI: IO 0x%lx -> 0x%lx\n",
948 res->start, res->start + size - 1);
949 break;
950 case 2: /* memory space */
951 memno = 0;
952 if (ranges[1] == 0 && ranges[2] == 0
953 && ranges[na+4] <= (16 << 20)) {
954 /* 1st 16MB, i.e. ISA memory area */
955 if (primary)
956 isa_mem_base = ranges[na+2];
957 memno = 1;
958 }
959 while (memno < 3 && hose->mem_resources[memno].flags)
960 ++memno;
961 if (memno == 0)
962 hose->pci_mem_offset = ranges[na+2] - ranges[2];
963 if (memno < 3) {
964 res = &hose->mem_resources[memno];
965 res->flags = IORESOURCE_MEM;
966 if(ranges[0] & 0x40000000)
967 res->flags |= IORESOURCE_PREFETCH;
968 res->start = ranges[na+2];
969 DBG("PCI: MEM[%d] 0x%lx -> 0x%lx\n", memno,
970 res->start, res->start + size - 1);
971 }
972 break;
973 }
974 if (res != NULL) {
975 res->name = dev->full_name;
976 res->end = res->start + size - 1;
977 res->parent = NULL;
978 res->sibling = NULL;
979 res->child = NULL;
980 }
981 ranges += np;
982 }
983}
984
985/* We create the "pci-OF-bus-map" property now so it appears in the
986 * /proc device tree
987 */
988void __init
989pci_create_OF_bus_map(void)
990{
991 struct property* of_prop;
992
993 of_prop = (struct property*) alloc_bootmem(sizeof(struct property) + 256);
994 if (of_prop && find_path_device("/")) {
995 memset(of_prop, -1, sizeof(struct property) + 256);
996 of_prop->name = "pci-OF-bus-map";
997 of_prop->length = 256;
998 of_prop->value = (unsigned char *)&of_prop[1];
999 prom_add_property(find_path_device("/"), of_prop);
1000 }
1001}
1002
1003static ssize_t pci_show_devspec(struct device *dev, struct device_attribute *attr, char *buf)
1004{
1005 struct pci_dev *pdev;
1006 struct device_node *np;
1007
1008 pdev = to_pci_dev (dev);
1009 np = pci_device_to_OF_node(pdev);
1010 if (np == NULL || np->full_name == NULL)
1011 return 0;
1012 return sprintf(buf, "%s", np->full_name);
1013}
1014static DEVICE_ATTR(devspec, S_IRUGO, pci_show_devspec, NULL);
1015
1016#else /* CONFIG_PPC_OF */
1017void pcibios_make_OF_bus_map(void) 625void pcibios_make_OF_bus_map(void)
1018{ 626{
1019} 627}
1020#endif /* CONFIG_PPC_OF */
1021 628
1022/* Add sysfs properties */ 629/* Add sysfs properties */
1023void pcibios_add_platform_entries(struct pci_dev *pdev) 630void pcibios_add_platform_entries(struct pci_dev *pdev)
1024{ 631{
1025#ifdef CONFIG_PPC_OF
1026 device_create_file(&pdev->dev, &dev_attr_devspec);
1027#endif /* CONFIG_PPC_OF */
1028} 632}
1029 633
1030 634
diff --git a/arch/ppc/kernel/ppc_htab.c b/arch/ppc/kernel/ppc_htab.c
index 2f5c7650274f..75c645043746 100644
--- a/arch/ppc/kernel/ppc_htab.c
+++ b/arch/ppc/kernel/ppc_htab.c
@@ -52,7 +52,7 @@ static int ppc_htab_open(struct inode *inode, struct file *file)
52 return single_open(file, ppc_htab_show, NULL); 52 return single_open(file, ppc_htab_show, NULL);
53} 53}
54 54
55struct file_operations ppc_htab_operations = { 55const struct file_operations ppc_htab_operations = {
56 .open = ppc_htab_open, 56 .open = ppc_htab_open,
57 .read = seq_read, 57 .read = seq_read,
58 .llseek = seq_lseek, 58 .llseek = seq_lseek,
@@ -104,7 +104,7 @@ static char *pmc2_lookup(unsigned long mmcr0)
104static int ppc_htab_show(struct seq_file *m, void *v) 104static int ppc_htab_show(struct seq_file *m, void *v)
105{ 105{
106 unsigned long mmcr0 = 0, pmc1 = 0, pmc2 = 0; 106 unsigned long mmcr0 = 0, pmc1 = 0, pmc2 = 0;
107#if defined(CONFIG_PPC_STD_MMU) && !defined(CONFIG_PPC64BRIDGE) 107#if defined(CONFIG_PPC_STD_MMU)
108 unsigned int kptes = 0, uptes = 0; 108 unsigned int kptes = 0, uptes = 0;
109 PTE *ptr; 109 PTE *ptr;
110#endif /* CONFIG_PPC_STD_MMU */ 110#endif /* CONFIG_PPC_STD_MMU */
@@ -133,7 +133,6 @@ static int ppc_htab_show(struct seq_file *m, void *v)
133 return 0; 133 return 0;
134 } 134 }
135 135
136#ifndef CONFIG_PPC64BRIDGE
137 for (ptr = Hash; ptr < Hash_end; ptr++) { 136 for (ptr = Hash; ptr < Hash_end; ptr++) {
138 unsigned int mctx, vsid; 137 unsigned int mctx, vsid;
139 138
@@ -147,7 +146,6 @@ static int ppc_htab_show(struct seq_file *m, void *v)
147 else 146 else
148 uptes++; 147 uptes++;
149 } 148 }
150#endif
151 149
152 seq_printf(m, 150 seq_printf(m,
153 "PTE Hash Table Information\n" 151 "PTE Hash Table Information\n"
@@ -155,20 +153,16 @@ static int ppc_htab_show(struct seq_file *m, void *v)
155 "Buckets\t\t: %lu\n" 153 "Buckets\t\t: %lu\n"
156 "Address\t\t: %08lx\n" 154 "Address\t\t: %08lx\n"
157 "Entries\t\t: %lu\n" 155 "Entries\t\t: %lu\n"
158#ifndef CONFIG_PPC64BRIDGE
159 "User ptes\t: %u\n" 156 "User ptes\t: %u\n"
160 "Kernel ptes\t: %u\n" 157 "Kernel ptes\t: %u\n"
161 "Percent full\t: %lu%%\n" 158 "Percent full\t: %lu%%\n"
162#endif
163 , (unsigned long)(Hash_size>>10), 159 , (unsigned long)(Hash_size>>10),
164 (Hash_size/(sizeof(PTE)*8)), 160 (Hash_size/(sizeof(PTE)*8)),
165 (unsigned long)Hash, 161 (unsigned long)Hash,
166 Hash_size/sizeof(PTE) 162 Hash_size/sizeof(PTE)
167#ifndef CONFIG_PPC64BRIDGE
168 , uptes, 163 , uptes,
169 kptes, 164 kptes,
170 ((kptes+uptes)*100) / (Hash_size/sizeof(PTE)) 165 ((kptes+uptes)*100) / (Hash_size/sizeof(PTE))
171#endif
172 ); 166 );
173 167
174 seq_printf(m, 168 seq_printf(m,
diff --git a/arch/ppc/kernel/ppc_ksyms.c b/arch/ppc/kernel/ppc_ksyms.c
index 82adb4601348..865ba74991a9 100644
--- a/arch/ppc/kernel/ppc_ksyms.c
+++ b/arch/ppc/kernel/ppc_ksyms.c
@@ -18,7 +18,6 @@
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19 19
20#include <asm/page.h> 20#include <asm/page.h>
21#include <asm/semaphore.h>
22#include <asm/processor.h> 21#include <asm/processor.h>
23#include <asm/uaccess.h> 22#include <asm/uaccess.h>
24#include <asm/io.h> 23#include <asm/io.h>
@@ -30,7 +29,6 @@
30#include <linux/adb.h> 29#include <linux/adb.h>
31#include <linux/cuda.h> 30#include <linux/cuda.h>
32#include <linux/pmu.h> 31#include <linux/pmu.h>
33#include <asm/prom.h>
34#include <asm/system.h> 32#include <asm/system.h>
35#include <asm/pci-bridge.h> 33#include <asm/pci-bridge.h>
36#include <asm/irq.h> 34#include <asm/irq.h>
@@ -208,27 +206,6 @@ EXPORT_SYMBOL(adb_try_handler_change);
208EXPORT_SYMBOL(cuda_request); 206EXPORT_SYMBOL(cuda_request);
209EXPORT_SYMBOL(cuda_poll); 207EXPORT_SYMBOL(cuda_poll);
210#endif /* CONFIG_ADB_CUDA */ 208#endif /* CONFIG_ADB_CUDA */
211#ifdef CONFIG_PPC_OF
212EXPORT_SYMBOL(find_devices);
213EXPORT_SYMBOL(find_type_devices);
214EXPORT_SYMBOL(find_compatible_devices);
215EXPORT_SYMBOL(find_path_device);
216EXPORT_SYMBOL(device_is_compatible);
217EXPORT_SYMBOL(machine_is_compatible);
218EXPORT_SYMBOL(find_all_nodes);
219EXPORT_SYMBOL(get_property);
220EXPORT_SYMBOL(request_OF_resource);
221EXPORT_SYMBOL(release_OF_resource);
222EXPORT_SYMBOL(of_find_node_by_name);
223EXPORT_SYMBOL(of_find_node_by_type);
224EXPORT_SYMBOL(of_find_compatible_node);
225EXPORT_SYMBOL(of_find_node_by_path);
226EXPORT_SYMBOL(of_find_all_nodes);
227EXPORT_SYMBOL(of_get_parent);
228EXPORT_SYMBOL(of_get_next_child);
229EXPORT_SYMBOL(of_node_get);
230EXPORT_SYMBOL(of_node_put);
231#endif /* CONFIG_PPC_OF */
232#if defined(CONFIG_BOOTX_TEXT) 209#if defined(CONFIG_BOOTX_TEXT)
233EXPORT_SYMBOL(btext_update_display); 210EXPORT_SYMBOL(btext_update_display);
234#endif 211#endif
@@ -262,9 +239,6 @@ EXPORT_SYMBOL(console_drivers);
262EXPORT_SYMBOL(xmon); 239EXPORT_SYMBOL(xmon);
263EXPORT_SYMBOL(xmon_printf); 240EXPORT_SYMBOL(xmon_printf);
264#endif 241#endif
265EXPORT_SYMBOL(__up);
266EXPORT_SYMBOL(__down);
267EXPORT_SYMBOL(__down_interruptible);
268 242
269#if defined(CONFIG_KGDB) || defined(CONFIG_XMON) 243#if defined(CONFIG_KGDB) || defined(CONFIG_XMON)
270extern void (*debugger)(struct pt_regs *regs); 244extern void (*debugger)(struct pt_regs *regs);
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
index 53e9deacee82..1f79e84ab464 100644
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Common prep/chrp boot and setup code. 2 * Common prep boot and setup code.
3 */ 3 */
4 4
5#include <linux/config.h> 5#include <linux/config.h>
@@ -72,17 +72,12 @@ unsigned long ISA_DMA_THRESHOLD;
72unsigned int DMA_MODE_READ; 72unsigned int DMA_MODE_READ;
73unsigned int DMA_MODE_WRITE; 73unsigned int DMA_MODE_WRITE;
74 74
75#ifdef CONFIG_PPC_MULTIPLATFORM 75#ifdef CONFIG_PPC_PREP
76int _machine = 0;
77EXPORT_SYMBOL(_machine);
78
79extern void prep_init(unsigned long r3, unsigned long r4, 76extern void prep_init(unsigned long r3, unsigned long r4,
80 unsigned long r5, unsigned long r6, unsigned long r7); 77 unsigned long r5, unsigned long r6, unsigned long r7);
81extern void chrp_init(unsigned long r3, unsigned long r4,
82 unsigned long r5, unsigned long r6, unsigned long r7);
83 78
84dev_t boot_dev; 79dev_t boot_dev;
85#endif /* CONFIG_PPC_MULTIPLATFORM */ 80#endif /* CONFIG_PPC_PREP */
86 81
87int have_of; 82int have_of;
88EXPORT_SYMBOL(have_of); 83EXPORT_SYMBOL(have_of);
@@ -319,72 +314,12 @@ early_init(int r3, int r4, int r5)
319 identify_cpu(offset, 0); 314 identify_cpu(offset, 0);
320 do_cpu_ftr_fixups(offset); 315 do_cpu_ftr_fixups(offset);
321 316
322#if defined(CONFIG_PPC_OF)
323 reloc_got2(offset);
324
325 /*
326 * don't do anything on prep
327 * for now, don't use bootinfo because it breaks yaboot 0.5
328 * and assume that if we didn't find a magic number, we have OF
329 */
330 if (*(unsigned long *)(0) != 0xdeadc0de)
331 phys = prom_init(r3, r4, (prom_entry)r5);
332
333 reloc_got2(-offset);
334#endif
335
336 return phys; 317 return phys;
337} 318}
338 319
339#ifdef CONFIG_PPC_OF 320#ifdef CONFIG_PPC_PREP
340/*
341 * Assume here that all clock rates are the same in a
342 * smp system. -- Cort
343 */
344int
345of_show_percpuinfo(struct seq_file *m, int i)
346{
347 struct device_node *cpu_node;
348 u32 *fp;
349 int s;
350
351 cpu_node = find_type_devices("cpu");
352 if (!cpu_node)
353 return 0;
354 for (s = 0; s < i && cpu_node->next; s++)
355 cpu_node = cpu_node->next;
356 fp = (u32 *)get_property(cpu_node, "clock-frequency", NULL);
357 if (fp)
358 seq_printf(m, "clock\t\t: %dMHz\n", *fp / 1000000);
359 return 0;
360}
361
362void __init
363intuit_machine_type(void)
364{
365 char *model;
366 struct device_node *root;
367
368 /* ask the OF info if we're a chrp or pmac */
369 root = find_path_device("/");
370 if (root != 0) {
371 /* assume pmac unless proven to be chrp -- Cort */
372 _machine = _MACH_Pmac;
373 model = get_property(root, "device_type", NULL);
374 if (model && !strncmp("chrp", model, 4))
375 _machine = _MACH_chrp;
376 else {
377 model = get_property(root, "model", NULL);
378 if (model && !strncmp(model, "IBM", 3))
379 _machine = _MACH_chrp;
380 }
381 }
382}
383#endif
384
385#ifdef CONFIG_PPC_MULTIPLATFORM
386/* 321/*
387 * The PPC_MULTIPLATFORM version of platform_init... 322 * The PPC_PREP version of platform_init...
388 */ 323 */
389void __init 324void __init
390platform_init(unsigned long r3, unsigned long r4, unsigned long r5, 325platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
@@ -399,161 +334,9 @@ platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
399 334
400 parse_bootinfo(find_bootinfo()); 335 parse_bootinfo(find_bootinfo());
401 336
402 /* if we didn't get any bootinfo telling us what we are... */ 337 prep_init(r3, r4, r5, r6, r7);
403 if (_machine == 0) {
404 /* prep boot loader tells us if we're prep or not */
405 if ( *(unsigned long *)(KERNELBASE) == (0xdeadc0de) )
406 _machine = _MACH_prep;
407 }
408
409#ifdef CONFIG_PPC_PREP
410 /* not much more to do here, if prep */
411 if (_machine == _MACH_prep) {
412 prep_init(r3, r4, r5, r6, r7);
413 return;
414 }
415#endif
416
417#ifdef CONFIG_PPC_OF
418 have_of = 1;
419
420 /* prom_init has already been called from __start */
421 if (boot_infos)
422 relocate_nodes();
423
424 /* If we aren't PReP, we can find out if we're Pmac
425 * or CHRP with this. */
426 if (_machine == 0)
427 intuit_machine_type();
428
429 /* finish_device_tree may need _machine defined. */
430 finish_device_tree();
431
432 /*
433 * If we were booted via quik, r3 points to the physical
434 * address of the command-line parameters.
435 * If we were booted from an xcoff image (i.e. netbooted or
436 * booted from floppy), we get the command line from the
437 * bootargs property of the /chosen node.
438 * If an initial ramdisk is present, r3 and r4
439 * are used for initrd_start and initrd_size,
440 * otherwise they contain 0xdeadbeef.
441 */
442 if (r3 >= 0x4000 && r3 < 0x800000 && r4 == 0) {
443 strlcpy(cmd_line, (char *)r3 + KERNELBASE,
444 sizeof(cmd_line));
445 } else if (boot_infos != 0) {
446 /* booted by BootX - check for ramdisk */
447 if (boot_infos->kernelParamsOffset != 0)
448 strlcpy(cmd_line, (char *) boot_infos
449 + boot_infos->kernelParamsOffset,
450 sizeof(cmd_line));
451#ifdef CONFIG_BLK_DEV_INITRD
452 if (boot_infos->ramDisk) {
453 initrd_start = (unsigned long) boot_infos
454 + boot_infos->ramDisk;
455 initrd_end = initrd_start + boot_infos->ramDiskSize;
456 initrd_below_start_ok = 1;
457 }
458#endif
459 } else {
460 struct device_node *chosen;
461 char *p;
462
463#ifdef CONFIG_BLK_DEV_INITRD
464 if (r3 && r4 && r4 != 0xdeadbeef) {
465 if (r3 < KERNELBASE)
466 r3 += KERNELBASE;
467 initrd_start = r3;
468 initrd_end = r3 + r4;
469 ROOT_DEV = Root_RAM0;
470 initrd_below_start_ok = 1;
471 }
472#endif
473 chosen = find_devices("chosen");
474 if (chosen != NULL) {
475 p = get_property(chosen, "bootargs", NULL);
476 if (p && *p) {
477 strlcpy(cmd_line, p, sizeof(cmd_line));
478 }
479 }
480 }
481#ifdef CONFIG_ADB
482 if (strstr(cmd_line, "adb_sync")) {
483 extern int __adb_probe_sync;
484 __adb_probe_sync = 1;
485 }
486#endif /* CONFIG_ADB */
487
488 switch (_machine) {
489#ifdef CONFIG_PPC_CHRP
490 case _MACH_chrp:
491 chrp_init(r3, r4, r5, r6, r7);
492 break;
493#endif
494 }
495#endif /* CONFIG_PPC_OF */
496} 338}
497#endif /* CONFIG_PPC_MULTIPLATFORM */ 339#endif /* CONFIG_PPC_PREP */
498
499#ifdef CONFIG_PPC_OF
500#ifdef CONFIG_SERIAL_CORE_CONSOLE
501extern char *of_stdout_device;
502
503static int __init set_preferred_console(void)
504{
505 struct device_node *prom_stdout;
506 char *name;
507 int offset = 0;
508
509 if (of_stdout_device == NULL)
510 return -ENODEV;
511
512 /* The user has requested a console so this is already set up. */
513 if (strstr(saved_command_line, "console="))
514 return -EBUSY;
515
516 prom_stdout = find_path_device(of_stdout_device);
517 if (!prom_stdout)
518 return -ENODEV;
519
520 name = (char *)get_property(prom_stdout, "name", NULL);
521 if (!name)
522 return -ENODEV;
523
524 if (strcmp(name, "serial") == 0) {
525 int i;
526 u32 *reg = (u32 *)get_property(prom_stdout, "reg", &i);
527 if (i > 8) {
528 switch (reg[1]) {
529 case 0x3f8:
530 offset = 0;
531 break;
532 case 0x2f8:
533 offset = 1;
534 break;
535 case 0x898:
536 offset = 2;
537 break;
538 case 0x890:
539 offset = 3;
540 break;
541 default:
542 /* We dont recognise the serial port */
543 return -ENODEV;
544 }
545 }
546 } else if (strcmp(name, "ch-a") == 0)
547 offset = 0;
548 else if (strcmp(name, "ch-b") == 0)
549 offset = 1;
550 else
551 return -ENODEV;
552 return add_preferred_console("ttyS", offset, NULL);
553}
554console_initcall(set_preferred_console);
555#endif /* CONFIG_SERIAL_CORE_CONSOLE */
556#endif /* CONFIG_PPC_OF */
557 340
558struct bi_record *find_bootinfo(void) 341struct bi_record *find_bootinfo(void)
559{ 342{
@@ -589,23 +372,6 @@ void parse_bootinfo(struct bi_record *rec)
589 initrd_end = data[0] + data[1] + KERNELBASE; 372 initrd_end = data[0] + data[1] + KERNELBASE;
590 break; 373 break;
591#endif /* CONFIG_BLK_DEV_INITRD */ 374#endif /* CONFIG_BLK_DEV_INITRD */
592#ifdef CONFIG_PPC_MULTIPLATFORM
593 case BI_MACHTYPE:
594 /* Machine types changed with the merge. Since the
595 * bootinfo are now deprecated, we can just hard code
596 * the appropriate conversion here for when we are
597 * called with yaboot which passes us a machine type
598 * this way.
599 */
600 switch(data[0]) {
601 case 1: _machine = _MACH_prep; break;
602 case 2: _machine = _MACH_Pmac; break;
603 case 4: _machine = _MACH_chrp; break;
604 default:
605 _machine = data[0];
606 }
607 break;
608#endif
609 case BI_MEMSIZE: 375 case BI_MEMSIZE:
610 boot_mem_size = data[0]; 376 boot_mem_size = data[0];
611 break; 377 break;
@@ -631,9 +397,6 @@ machine_init(unsigned long r3, unsigned long r4, unsigned long r5,
631#ifdef CONFIG_6xx 397#ifdef CONFIG_6xx
632 ppc_md.power_save = ppc6xx_idle; 398 ppc_md.power_save = ppc6xx_idle;
633#endif 399#endif
634#ifdef CONFIG_POWER4
635 ppc_md.power_save = power4_idle;
636#endif
637 400
638 platform_init(r3, r4, r5, r6, r7); 401 platform_init(r3, r4, r5, r6, r7);
639 402
@@ -711,7 +474,7 @@ int __init ppc_init(void)
711 if ( ppc_md.progress ) ppc_md.progress(" ", 0xffff); 474 if ( ppc_md.progress ) ppc_md.progress(" ", 0xffff);
712 475
713 /* register CPU devices */ 476 /* register CPU devices */
714 for_each_cpu(i) 477 for_each_possible_cpu(i)
715 register_cpu(&cpu_devices[i], i, NULL); 478 register_cpu(&cpu_devices[i], i, NULL);
716 479
717 /* call platform init */ 480 /* call platform init */
@@ -799,7 +562,4 @@ void __init setup_arch(char **cmdline_p)
799 if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab); 562 if ( ppc_md.progress ) ppc_md.progress("arch: exit", 0x3eab);
800 563
801 paging_init(); 564 paging_init();
802
803 /* this is for modules since _machine can be a define -- Cort */
804 ppc_md.ppc_machine = _machine;
805} 565}
diff --git a/arch/ppc/kernel/smp.c b/arch/ppc/kernel/smp.c
index e55cdda6149a..f77795a64dae 100644
--- a/arch/ppc/kernel/smp.c
+++ b/arch/ppc/kernel/smp.c
@@ -311,7 +311,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
311 /* Backup CPU 0 state */ 311 /* Backup CPU 0 state */
312 __save_cpu_setup(); 312 __save_cpu_setup();
313 313
314 for_each_cpu(cpu) { 314 for_each_possible_cpu(cpu) {
315 if (cpu == smp_processor_id()) 315 if (cpu == smp_processor_id())
316 continue; 316 continue;
317 /* create a process for the processor */ 317 /* create a process for the processor */
diff --git a/arch/ppc/lib/strcase.c b/arch/ppc/lib/strcase.c
index 36b521091bbc..3b0094cc2b52 100644
--- a/arch/ppc/lib/strcase.c
+++ b/arch/ppc/lib/strcase.c
@@ -1,4 +1,5 @@
1#include <linux/ctype.h> 1#include <linux/ctype.h>
2#include <linux/types.h>
2 3
3int strcasecmp(const char *s1, const char *s2) 4int strcasecmp(const char *s1, const char *s2)
4{ 5{
@@ -11,7 +12,7 @@ int strcasecmp(const char *s1, const char *s2)
11 return c1 - c2; 12 return c1 - c2;
12} 13}
13 14
14int strncasecmp(const char *s1, const char *s2, int n) 15int strncasecmp(const char *s1, const char *s2, size_t n)
15{ 16{
16 int c1, c2; 17 int c1, c2;
17 18
diff --git a/arch/ppc/mm/fault.c b/arch/ppc/mm/fault.c
index 0217188ef465..8e08ca32531a 100644
--- a/arch/ppc/mm/fault.c
+++ b/arch/ppc/mm/fault.c
@@ -202,6 +202,7 @@ good_area:
202 /* an exec - 4xx/Book-E allows for per-page execute permission */ 202 /* an exec - 4xx/Book-E allows for per-page execute permission */
203 } else if (TRAP(regs) == 0x400) { 203 } else if (TRAP(regs) == 0x400) {
204 pte_t *ptep; 204 pte_t *ptep;
205 pmd_t *pmdp;
205 206
206#if 0 207#if 0
207 /* It would be nice to actually enforce the VM execute 208 /* It would be nice to actually enforce the VM execute
@@ -215,21 +216,24 @@ good_area:
215 /* Since 4xx/Book-E supports per-page execute permission, 216 /* Since 4xx/Book-E supports per-page execute permission,
216 * we lazily flush dcache to icache. */ 217 * we lazily flush dcache to icache. */
217 ptep = NULL; 218 ptep = NULL;
218 if (get_pteptr(mm, address, &ptep) && pte_present(*ptep)) { 219 if (get_pteptr(mm, address, &ptep, &pmdp)) {
219 struct page *page = pte_page(*ptep); 220 spinlock_t *ptl = pte_lockptr(mm, pmdp);
220 221 spin_lock(ptl);
221 if (! test_bit(PG_arch_1, &page->flags)) { 222 if (pte_present(*ptep)) {
222 flush_dcache_icache_page(page); 223 struct page *page = pte_page(*ptep);
223 set_bit(PG_arch_1, &page->flags); 224
225 if (!test_bit(PG_arch_1, &page->flags)) {
226 flush_dcache_icache_page(page);
227 set_bit(PG_arch_1, &page->flags);
228 }
229 pte_update(ptep, 0, _PAGE_HWEXEC);
230 _tlbie(address);
231 pte_unmap_unlock(ptep, ptl);
232 up_read(&mm->mmap_sem);
233 return 0;
224 } 234 }
225 pte_update(ptep, 0, _PAGE_HWEXEC); 235 pte_unmap_unlock(ptep, ptl);
226 _tlbie(address);
227 pte_unmap(ptep);
228 up_read(&mm->mmap_sem);
229 return 0;
230 } 236 }
231 if (ptep != NULL)
232 pte_unmap(ptep);
233#endif 237#endif
234 /* a read */ 238 /* a read */
235 } else { 239 } else {
diff --git a/arch/ppc/mm/hashtable.S b/arch/ppc/mm/hashtable.S
index f09fa88db35a..31d0a924317c 100644
--- a/arch/ppc/mm/hashtable.S
+++ b/arch/ppc/mm/hashtable.S
@@ -74,12 +74,6 @@ _GLOBAL(hash_page_sync)
74 */ 74 */
75 .text 75 .text
76_GLOBAL(hash_page) 76_GLOBAL(hash_page)
77#ifdef CONFIG_PPC64BRIDGE
78 mfmsr r0
79 clrldi r0,r0,1 /* make sure it's in 32-bit mode */
80 MTMSRD(r0)
81 isync
82#endif
83 tophys(r7,0) /* gets -KERNELBASE into r7 */ 77 tophys(r7,0) /* gets -KERNELBASE into r7 */
84#ifdef CONFIG_SMP 78#ifdef CONFIG_SMP
85 addis r8,r7,mmu_hash_lock@h 79 addis r8,r7,mmu_hash_lock@h
@@ -303,7 +297,6 @@ Hash_base = 0xc0180000
303Hash_bits = 12 /* e.g. 256kB hash table */ 297Hash_bits = 12 /* e.g. 256kB hash table */
304Hash_msk = (((1 << Hash_bits) - 1) * 64) 298Hash_msk = (((1 << Hash_bits) - 1) * 64)
305 299
306#ifndef CONFIG_PPC64BRIDGE
307/* defines for the PTE format for 32-bit PPCs */ 300/* defines for the PTE format for 32-bit PPCs */
308#define PTE_SIZE 8 301#define PTE_SIZE 8
309#define PTEG_SIZE 64 302#define PTEG_SIZE 64
@@ -317,21 +310,6 @@ Hash_msk = (((1 << Hash_bits) - 1) * 64)
317#define SET_V(r) oris r,r,PTE_V@h 310#define SET_V(r) oris r,r,PTE_V@h
318#define CLR_V(r,t) rlwinm r,r,0,1,31 311#define CLR_V(r,t) rlwinm r,r,0,1,31
319 312
320#else
321/* defines for the PTE format for 64-bit PPCs */
322#define PTE_SIZE 16
323#define PTEG_SIZE 128
324#define LG_PTEG_SIZE 7
325#define LDPTEu ldu
326#define STPTE std
327#define CMPPTE cmpd
328#define PTE_H 2
329#define PTE_V 1
330#define TST_V(r) andi. r,r,PTE_V
331#define SET_V(r) ori r,r,PTE_V
332#define CLR_V(r,t) li t,PTE_V; andc r,r,t
333#endif /* CONFIG_PPC64BRIDGE */
334
335#define HASH_LEFT 31-(LG_PTEG_SIZE+Hash_bits-1) 313#define HASH_LEFT 31-(LG_PTEG_SIZE+Hash_bits-1)
336#define HASH_RIGHT 31-LG_PTEG_SIZE 314#define HASH_RIGHT 31-LG_PTEG_SIZE
337 315
@@ -349,14 +327,8 @@ BEGIN_FTR_SECTION
349END_FTR_SECTION_IFSET(CPU_FTR_NEED_COHERENT) 327END_FTR_SECTION_IFSET(CPU_FTR_NEED_COHERENT)
350 328
351 /* Construct the high word of the PPC-style PTE (r5) */ 329 /* Construct the high word of the PPC-style PTE (r5) */
352#ifndef CONFIG_PPC64BRIDGE
353 rlwinm r5,r3,7,1,24 /* put VSID in 0x7fffff80 bits */ 330 rlwinm r5,r3,7,1,24 /* put VSID in 0x7fffff80 bits */
354 rlwimi r5,r4,10,26,31 /* put in API (abbrev page index) */ 331 rlwimi r5,r4,10,26,31 /* put in API (abbrev page index) */
355#else /* CONFIG_PPC64BRIDGE */
356 clrlwi r3,r3,8 /* reduce vsid to 24 bits */
357 sldi r5,r3,12 /* shift vsid into position */
358 rlwimi r5,r4,16,20,24 /* put in API (abbrev page index) */
359#endif /* CONFIG_PPC64BRIDGE */
360 SET_V(r5) /* set V (valid) bit */ 332 SET_V(r5) /* set V (valid) bit */
361 333
362 /* Get the address of the primary PTE group in the hash table (r3) */ 334 /* Get the address of the primary PTE group in the hash table (r3) */
@@ -540,14 +512,8 @@ _GLOBAL(flush_hash_pages)
540 add r3,r3,r0 /* note code below trims to 24 bits */ 512 add r3,r3,r0 /* note code below trims to 24 bits */
541 513
542 /* Construct the high word of the PPC-style PTE (r11) */ 514 /* Construct the high word of the PPC-style PTE (r11) */
543#ifndef CONFIG_PPC64BRIDGE
544 rlwinm r11,r3,7,1,24 /* put VSID in 0x7fffff80 bits */ 515 rlwinm r11,r3,7,1,24 /* put VSID in 0x7fffff80 bits */
545 rlwimi r11,r4,10,26,31 /* put in API (abbrev page index) */ 516 rlwimi r11,r4,10,26,31 /* put in API (abbrev page index) */
546#else /* CONFIG_PPC64BRIDGE */
547 clrlwi r3,r3,8 /* reduce vsid to 24 bits */
548 sldi r11,r3,12 /* shift vsid into position */
549 rlwimi r11,r4,16,20,24 /* put in API (abbrev page index) */
550#endif /* CONFIG_PPC64BRIDGE */
551 SET_V(r11) /* set V (valid) bit */ 517 SET_V(r11) /* set V (valid) bit */
552 518
553#ifdef CONFIG_SMP 519#ifdef CONFIG_SMP
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
index cb1c294fb932..386e000bcb73 100644
--- a/arch/ppc/mm/init.c
+++ b/arch/ppc/mm/init.c
@@ -412,14 +412,6 @@ void __init mem_init(void)
412 } 412 }
413#endif /* CONFIG_BLK_DEV_INITRD */ 413#endif /* CONFIG_BLK_DEV_INITRD */
414 414
415#ifdef CONFIG_PPC_OF
416 /* mark the RTAS pages as reserved */
417 if ( rtas_data )
418 for (addr = (ulong)__va(rtas_data);
419 addr < PAGE_ALIGN((ulong)__va(rtas_data)+rtas_size) ;
420 addr += PAGE_SIZE)
421 SetPageReserved(virt_to_page(addr));
422#endif
423 for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory; 415 for (addr = PAGE_OFFSET; addr < (unsigned long)high_memory;
424 addr += PAGE_SIZE) { 416 addr += PAGE_SIZE) {
425 if (!PageReserved(virt_to_page(addr))) 417 if (!PageReserved(virt_to_page(addr)))
@@ -494,11 +486,6 @@ set_phys_avail(unsigned long total_memory)
494 initrd_end - initrd_start, 1); 486 initrd_end - initrd_start, 1);
495 } 487 }
496#endif /* CONFIG_BLK_DEV_INITRD */ 488#endif /* CONFIG_BLK_DEV_INITRD */
497#ifdef CONFIG_PPC_OF
498 /* remove the RTAS pages from the available memory */
499 if (rtas_data)
500 mem_pieces_remove(&phys_avail, rtas_data, rtas_size, 1);
501#endif
502} 489}
503 490
504/* Mark some memory as reserved by removing it from phys_avail. */ 491/* Mark some memory as reserved by removing it from phys_avail. */
diff --git a/arch/ppc/mm/mmu_context.c b/arch/ppc/mm/mmu_context.c
index a8816e0f6a86..b4a4b3f02a1c 100644
--- a/arch/ppc/mm/mmu_context.c
+++ b/arch/ppc/mm/mmu_context.c
@@ -2,7 +2,7 @@
2 * This file contains the routines for handling the MMU on those 2 * This file contains the routines for handling the MMU on those
3 * PowerPC implementations where the MMU substantially follows the 3 * PowerPC implementations where the MMU substantially follows the
4 * architecture specification. This includes the 6xx, 7xx, 7xxx, 4 * architecture specification. This includes the 6xx, 7xx, 7xxx,
5 * 8260, and POWER3 implementations but excludes the 8xx and 4xx. 5 * 8260, and 83xx implementations but excludes the 8xx and 4xx.
6 * -- paulus 6 * -- paulus
7 * 7 *
8 * Derived from arch/ppc/mm/init.c: 8 * Derived from arch/ppc/mm/init.c:
diff --git a/arch/ppc/mm/pgtable.c b/arch/ppc/mm/pgtable.c
index 6ea9185fd120..706bca8eb144 100644
--- a/arch/ppc/mm/pgtable.c
+++ b/arch/ppc/mm/pgtable.c
@@ -39,7 +39,7 @@ unsigned long ioremap_base;
39unsigned long ioremap_bot; 39unsigned long ioremap_bot;
40int io_bat_index; 40int io_bat_index;
41 41
42#if defined(CONFIG_6xx) || defined(CONFIG_POWER3) 42#if defined(CONFIG_6xx)
43#define HAVE_BATS 1 43#define HAVE_BATS 1
44#endif 44#endif
45 45
@@ -368,7 +368,7 @@ void __init io_block_mapping(unsigned long virt, phys_addr_t phys,
368 * the PTE pointer is unmodified if PTE is not found. 368 * the PTE pointer is unmodified if PTE is not found.
369 */ 369 */
370int 370int
371get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep) 371get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep, pmd_t **pmdp)
372{ 372{
373 pgd_t *pgd; 373 pgd_t *pgd;
374 pmd_t *pmd; 374 pmd_t *pmd;
@@ -383,6 +383,8 @@ get_pteptr(struct mm_struct *mm, unsigned long addr, pte_t **ptep)
383 if (pte) { 383 if (pte) {
384 retval = 1; 384 retval = 1;
385 *ptep = pte; 385 *ptep = pte;
386 if (pmdp)
387 *pmdp = pmd;
386 /* XXX caller needs to do pte_unmap, yuck */ 388 /* XXX caller needs to do pte_unmap, yuck */
387 } 389 }
388 } 390 }
@@ -420,7 +422,7 @@ unsigned long iopa(unsigned long addr)
420 mm = &init_mm; 422 mm = &init_mm;
421 423
422 pa = 0; 424 pa = 0;
423 if (get_pteptr(mm, addr, &pte)) { 425 if (get_pteptr(mm, addr, &pte, NULL)) {
424 pa = (pte_val(*pte) & PAGE_MASK) | (addr & ~PAGE_MASK); 426 pa = (pte_val(*pte) & PAGE_MASK) | (addr & ~PAGE_MASK);
425 pte_unmap(pte); 427 pte_unmap(pte);
426 } 428 }
diff --git a/arch/ppc/mm/ppc_mmu.c b/arch/ppc/mm/ppc_mmu.c
index 9a381ed5eb21..25bb6f3347c1 100644
--- a/arch/ppc/mm/ppc_mmu.c
+++ b/arch/ppc/mm/ppc_mmu.c
@@ -2,7 +2,7 @@
2 * This file contains the routines for handling the MMU on those 2 * This file contains the routines for handling the MMU on those
3 * PowerPC implementations where the MMU substantially follows the 3 * PowerPC implementations where the MMU substantially follows the
4 * architecture specification. This includes the 6xx, 7xx, 7xxx, 4 * architecture specification. This includes the 6xx, 7xx, 7xxx,
5 * 8260, and POWER3 implementations but excludes the 8xx and 4xx. 5 * 8260, and 83xx implementations but excludes the 8xx and 4xx.
6 * -- paulus 6 * -- paulus
7 * 7 *
8 * Derived from arch/ppc/mm/init.c: 8 * Derived from arch/ppc/mm/init.c:
@@ -42,11 +42,7 @@ unsigned long _SDR1;
42 42
43union ubat { /* BAT register values to be loaded */ 43union ubat { /* BAT register values to be loaded */
44 BAT bat; 44 BAT bat;
45#ifdef CONFIG_PPC64BRIDGE
46 u64 word[2];
47#else
48 u32 word[2]; 45 u32 word[2];
49#endif
50} BATS[4][2]; /* 4 pairs of IBAT, DBAT */ 46} BATS[4][2]; /* 4 pairs of IBAT, DBAT */
51 47
52struct batrange { /* stores address ranges mapped by BATs */ 48struct batrange { /* stores address ranges mapped by BATs */
@@ -83,9 +79,6 @@ unsigned long p_mapped_by_bats(unsigned long pa)
83 79
84unsigned long __init mmu_mapin_ram(void) 80unsigned long __init mmu_mapin_ram(void)
85{ 81{
86#ifdef CONFIG_POWER4
87 return 0;
88#else
89 unsigned long tot, bl, done; 82 unsigned long tot, bl, done;
90 unsigned long max_size = (256<<20); 83 unsigned long max_size = (256<<20);
91 unsigned long align; 84 unsigned long align;
@@ -122,7 +115,6 @@ unsigned long __init mmu_mapin_ram(void)
122 } 115 }
123 116
124 return done; 117 return done;
125#endif
126} 118}
127 119
128/* 120/*
@@ -205,27 +197,10 @@ void __init MMU_init_hw(void)
205 197
206 if ( ppc_md.progress ) ppc_md.progress("hash:enter", 0x105); 198 if ( ppc_md.progress ) ppc_md.progress("hash:enter", 0x105);
207 199
208#ifdef CONFIG_PPC64BRIDGE
209#define LG_HPTEG_SIZE 7 /* 128 bytes per HPTEG */
210#define SDR1_LOW_BITS (lg_n_hpteg - 11)
211#define MIN_N_HPTEG 2048 /* min 256kB hash table */
212#else
213#define LG_HPTEG_SIZE 6 /* 64 bytes per HPTEG */ 200#define LG_HPTEG_SIZE 6 /* 64 bytes per HPTEG */
214#define SDR1_LOW_BITS ((n_hpteg - 1) >> 10) 201#define SDR1_LOW_BITS ((n_hpteg - 1) >> 10)
215#define MIN_N_HPTEG 1024 /* min 64kB hash table */ 202#define MIN_N_HPTEG 1024 /* min 64kB hash table */
216#endif
217
218#ifdef CONFIG_POWER4
219 /* The hash table has already been allocated and initialized
220 in prom.c */
221 n_hpteg = Hash_size >> LG_HPTEG_SIZE;
222 lg_n_hpteg = __ilog2(n_hpteg);
223
224 /* Remove the hash table from the available memory */
225 if (Hash)
226 reserve_phys_mem(__pa(Hash), Hash_size);
227 203
228#else /* CONFIG_POWER4 */
229 /* 204 /*
230 * Allow 1 HPTE (1/8 HPTEG) for each page of memory. 205 * Allow 1 HPTE (1/8 HPTEG) for each page of memory.
231 * This is less than the recommended amount, but then 206 * This is less than the recommended amount, but then
@@ -248,7 +223,6 @@ void __init MMU_init_hw(void)
248 Hash = mem_pieces_find(Hash_size, Hash_size); 223 Hash = mem_pieces_find(Hash_size, Hash_size);
249 cacheable_memzero(Hash, Hash_size); 224 cacheable_memzero(Hash, Hash_size);
250 _SDR1 = __pa(Hash) | SDR1_LOW_BITS; 225 _SDR1 = __pa(Hash) | SDR1_LOW_BITS;
251#endif /* CONFIG_POWER4 */
252 226
253 Hash_end = (PTE *) ((unsigned long)Hash + Hash_size); 227 Hash_end = (PTE *) ((unsigned long)Hash + Hash_size);
254 228
diff --git a/arch/ppc/platforms/Makefile b/arch/ppc/platforms/Makefile
index e8b91a33ce91..90c622294423 100644
--- a/arch/ppc/platforms/Makefile
+++ b/arch/ppc/platforms/Makefile
@@ -2,18 +2,10 @@
2# Makefile for the linux kernel. 2# Makefile for the linux kernel.
3# 3#
4 4
5# Extra CFLAGS so we don't have to do relative includes
6CFLAGS_chrp_setup.o += -Iarch/$(ARCH)/mm
7
8obj-$(CONFIG_APUS) += apus_setup.o 5obj-$(CONFIG_APUS) += apus_setup.o
9ifeq ($(CONFIG_APUS),y) 6ifeq ($(CONFIG_APUS),y)
10obj-$(CONFIG_PCI) += apus_pci.o 7obj-$(CONFIG_PCI) += apus_pci.o
11endif 8endif
12obj-$(CONFIG_PPC_CHRP) += chrp_setup.o chrp_time.o chrp_pci.o \
13 chrp_pegasos_eth.o
14ifeq ($(CONFIG_PPC_CHRP),y)
15obj-$(CONFIG_NVRAM) += chrp_nvram.o
16endif
17obj-$(CONFIG_PPC_PREP) += prep_pci.o prep_setup.o 9obj-$(CONFIG_PPC_PREP) += prep_pci.o prep_setup.o
18obj-$(CONFIG_PREP_RESIDUAL) += residual.o 10obj-$(CONFIG_PREP_RESIDUAL) += residual.o
19obj-$(CONFIG_PQ2ADS) += pq2ads.o 11obj-$(CONFIG_PQ2ADS) += pq2ads.o
@@ -40,7 +32,3 @@ obj-$(CONFIG_EV64360) += ev64360.o
40obj-$(CONFIG_MPC86XADS) += mpc866ads_setup.o 32obj-$(CONFIG_MPC86XADS) += mpc866ads_setup.o
41obj-$(CONFIG_MPC885ADS) += mpc885ads_setup.o 33obj-$(CONFIG_MPC885ADS) += mpc885ads_setup.o
42obj-$(CONFIG_ADS8272) += mpc8272ads_setup.o 34obj-$(CONFIG_ADS8272) += mpc8272ads_setup.o
43
44ifeq ($(CONFIG_SMP),y)
45obj-$(CONFIG_PPC_CHRP) += chrp_smp.o
46endif
diff --git a/arch/ppc/platforms/chrp_nvram.c b/arch/ppc/platforms/chrp_nvram.c
deleted file mode 100644
index 465ba9b090ef..000000000000
--- a/arch/ppc/platforms/chrp_nvram.c
+++ /dev/null
@@ -1,83 +0,0 @@
1/*
2 * c 2001 PPC 64 Team, IBM Corp
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 * /dev/nvram driver for PPC
10 *
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/slab.h>
16#include <linux/spinlock.h>
17#include <asm/uaccess.h>
18#include <asm/prom.h>
19#include <asm/machdep.h>
20
21static unsigned int nvram_size;
22static unsigned char nvram_buf[4];
23static DEFINE_SPINLOCK(nvram_lock);
24
25static unsigned char chrp_nvram_read(int addr)
26{
27 unsigned long done, flags;
28 unsigned char ret;
29
30 if (addr >= nvram_size) {
31 printk(KERN_DEBUG "%s: read addr %d > nvram_size %u\n",
32 current->comm, addr, nvram_size);
33 return 0xff;
34 }
35 spin_lock_irqsave(&nvram_lock, flags);
36 if ((call_rtas("nvram-fetch", 3, 2, &done, addr, __pa(nvram_buf), 1) != 0) || 1 != done)
37 ret = 0xff;
38 else
39 ret = nvram_buf[0];
40 spin_unlock_irqrestore(&nvram_lock, flags);
41
42 return ret;
43}
44
45static void chrp_nvram_write(int addr, unsigned char val)
46{
47 unsigned long done, flags;
48
49 if (addr >= nvram_size) {
50 printk(KERN_DEBUG "%s: write addr %d > nvram_size %u\n",
51 current->comm, addr, nvram_size);
52 return;
53 }
54 spin_lock_irqsave(&nvram_lock, flags);
55 nvram_buf[0] = val;
56 if ((call_rtas("nvram-store", 3, 2, &done, addr, __pa(nvram_buf), 1) != 0) || 1 != done)
57 printk(KERN_DEBUG "rtas IO error storing 0x%02x at %d", val, addr);
58 spin_unlock_irqrestore(&nvram_lock, flags);
59}
60
61void __init chrp_nvram_init(void)
62{
63 struct device_node *nvram;
64 unsigned int *nbytes_p, proplen;
65
66 nvram = of_find_node_by_type(NULL, "nvram");
67 if (nvram == NULL)
68 return;
69
70 nbytes_p = (unsigned int *)get_property(nvram, "#bytes", &proplen);
71 if (nbytes_p == NULL || proplen != sizeof(unsigned int))
72 return;
73
74 nvram_size = *nbytes_p;
75
76 printk(KERN_INFO "CHRP nvram contains %u bytes\n", nvram_size);
77 of_node_put(nvram);
78
79 ppc_md.nvram_read_val = chrp_nvram_read;
80 ppc_md.nvram_write_val = chrp_nvram_write;
81
82 return;
83}
diff --git a/arch/ppc/platforms/chrp_pci.c b/arch/ppc/platforms/chrp_pci.c
deleted file mode 100644
index c7fe6182bb77..000000000000
--- a/arch/ppc/platforms/chrp_pci.c
+++ /dev/null
@@ -1,309 +0,0 @@
1/*
2 * CHRP pci routines.
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/ide.h>
12
13#include <asm/io.h>
14#include <asm/pgtable.h>
15#include <asm/irq.h>
16#include <asm/hydra.h>
17#include <asm/prom.h>
18#include <asm/gg2.h>
19#include <asm/machdep.h>
20#include <asm/sections.h>
21#include <asm/pci-bridge.h>
22#include <asm/open_pic.h>
23
24/* LongTrail */
25void __iomem *gg2_pci_config_base;
26
27/*
28 * The VLSI Golden Gate II has only 512K of PCI configuration space, so we
29 * limit the bus number to 3 bits
30 */
31
32int gg2_read_config(struct pci_bus *bus, unsigned int devfn, int off,
33 int len, u32 *val)
34{
35 volatile void __iomem *cfg_data;
36 struct pci_controller *hose = bus->sysdata;
37
38 if (bus->number > 7)
39 return PCIBIOS_DEVICE_NOT_FOUND;
40 /*
41 * Note: the caller has already checked that off is
42 * suitably aligned and that len is 1, 2 or 4.
43 */
44 cfg_data = hose->cfg_data + ((bus->number<<16) | (devfn<<8) | off);
45 switch (len) {
46 case 1:
47 *val = in_8(cfg_data);
48 break;
49 case 2:
50 *val = in_le16(cfg_data);
51 break;
52 default:
53 *val = in_le32(cfg_data);
54 break;
55 }
56 return PCIBIOS_SUCCESSFUL;
57}
58
59int gg2_write_config(struct pci_bus *bus, unsigned int devfn, int off,
60 int len, u32 val)
61{
62 volatile void __iomem *cfg_data;
63 struct pci_controller *hose = bus->sysdata;
64
65 if (bus->number > 7)
66 return PCIBIOS_DEVICE_NOT_FOUND;
67 /*
68 * Note: the caller has already checked that off is
69 * suitably aligned and that len is 1, 2 or 4.
70 */
71 cfg_data = hose->cfg_data + ((bus->number<<16) | (devfn<<8) | off);
72 switch (len) {
73 case 1:
74 out_8(cfg_data, val);
75 break;
76 case 2:
77 out_le16(cfg_data, val);
78 break;
79 default:
80 out_le32(cfg_data, val);
81 break;
82 }
83 return PCIBIOS_SUCCESSFUL;
84}
85
86static struct pci_ops gg2_pci_ops =
87{
88 gg2_read_config,
89 gg2_write_config
90};
91
92/*
93 * Access functions for PCI config space using RTAS calls.
94 */
95int
96rtas_read_config(struct pci_bus *bus, unsigned int devfn, int offset,
97 int len, u32 *val)
98{
99 struct pci_controller *hose = bus->sysdata;
100 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
101 | (((bus->number - hose->first_busno) & 0xff) << 16)
102 | (hose->index << 24);
103 unsigned long ret = ~0UL;
104 int rval;
105
106 rval = call_rtas("read-pci-config", 2, 2, &ret, addr, len);
107 *val = ret;
108 return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
109}
110
111int
112rtas_write_config(struct pci_bus *bus, unsigned int devfn, int offset,
113 int len, u32 val)
114{
115 struct pci_controller *hose = bus->sysdata;
116 unsigned long addr = (offset & 0xff) | ((devfn & 0xff) << 8)
117 | (((bus->number - hose->first_busno) & 0xff) << 16)
118 | (hose->index << 24);
119 int rval;
120
121 rval = call_rtas("write-pci-config", 3, 1, NULL, addr, len, val);
122 return rval? PCIBIOS_DEVICE_NOT_FOUND: PCIBIOS_SUCCESSFUL;
123}
124
125static struct pci_ops rtas_pci_ops =
126{
127 rtas_read_config,
128 rtas_write_config
129};
130
131volatile struct Hydra __iomem *Hydra = NULL;
132
133int __init
134hydra_init(void)
135{
136 struct device_node *np;
137
138 np = find_devices("mac-io");
139 if (np == NULL || np->n_addrs == 0)
140 return 0;
141 Hydra = ioremap(np->addrs[0].address, np->addrs[0].size);
142 printk("Hydra Mac I/O at %x\n", np->addrs[0].address);
143 printk("Hydra Feature_Control was %x",
144 in_le32(&Hydra->Feature_Control));
145 out_le32(&Hydra->Feature_Control, (HYDRA_FC_SCC_CELL_EN |
146 HYDRA_FC_SCSI_CELL_EN |
147 HYDRA_FC_SCCA_ENABLE |
148 HYDRA_FC_SCCB_ENABLE |
149 HYDRA_FC_ARB_BYPASS |
150 HYDRA_FC_MPIC_ENABLE |
151 HYDRA_FC_SLOW_SCC_PCLK |
152 HYDRA_FC_MPIC_IS_MASTER));
153 printk(", now %x\n", in_le32(&Hydra->Feature_Control));
154 return 1;
155}
156
157void __init
158chrp_pcibios_fixup(void)
159{
160 struct pci_dev *dev = NULL;
161 struct device_node *np;
162
163 /* PCI interrupts are controlled by the OpenPIC */
164 for_each_pci_dev(dev) {
165 np = pci_device_to_OF_node(dev);
166 if ((np != 0) && (np->n_intrs > 0) && (np->intrs[0].line != 0))
167 dev->irq = np->intrs[0].line;
168 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, dev->irq);
169 }
170}
171
172#define PRG_CL_RESET_VALID 0x00010000
173
174static void __init
175setup_python(struct pci_controller *hose, struct device_node *dev)
176{
177 u32 __iomem *reg;
178 u32 val;
179 unsigned long addr = dev->addrs[0].address;
180
181 setup_indirect_pci(hose, addr + 0xf8000, addr + 0xf8010);
182
183 /* Clear the magic go-slow bit */
184 reg = ioremap(dev->addrs[0].address + 0xf6000, 0x40);
185 val = in_be32(&reg[12]);
186 if (val & PRG_CL_RESET_VALID) {
187 out_be32(&reg[12], val & ~PRG_CL_RESET_VALID);
188 in_be32(&reg[12]);
189 }
190 iounmap(reg);
191}
192
193/* Marvell Discovery II based Pegasos 2 */
194static void __init setup_peg2(struct pci_controller *hose, struct device_node *dev)
195{
196 struct device_node *root = find_path_device("/");
197 struct device_node *rtas;
198
199 rtas = of_find_node_by_name (root, "rtas");
200 if (rtas) {
201 hose->ops = &rtas_pci_ops;
202 } else {
203 printk ("RTAS supporting Pegasos OF not found, please upgrade"
204 " your firmware\n");
205 }
206 pci_assign_all_buses = 1;
207}
208
209void __init
210chrp_find_bridges(void)
211{
212 struct device_node *dev;
213 int *bus_range;
214 int len, index = -1;
215 struct pci_controller *hose;
216 unsigned int *dma;
217 char *model, *machine;
218 int is_longtrail = 0, is_mot = 0, is_pegasos = 0;
219 struct device_node *root = find_path_device("/");
220
221 /*
222 * The PCI host bridge nodes on some machines don't have
223 * properties to adequately identify them, so we have to
224 * look at what sort of machine this is as well.
225 */
226 machine = get_property(root, "model", NULL);
227 if (machine != NULL) {
228 is_longtrail = strncmp(machine, "IBM,LongTrail", 13) == 0;
229 is_mot = strncmp(machine, "MOT", 3) == 0;
230 if (strncmp(machine, "Pegasos2", 8) == 0)
231 is_pegasos = 2;
232 else if (strncmp(machine, "Pegasos", 7) == 0)
233 is_pegasos = 1;
234 }
235 for (dev = root->child; dev != NULL; dev = dev->sibling) {
236 if (dev->type == NULL || strcmp(dev->type, "pci") != 0)
237 continue;
238 ++index;
239 /* The GG2 bridge on the LongTrail doesn't have an address */
240 if (dev->n_addrs < 1 && !is_longtrail) {
241 printk(KERN_WARNING "Can't use %s: no address\n",
242 dev->full_name);
243 continue;
244 }
245 bus_range = (int *) get_property(dev, "bus-range", &len);
246 if (bus_range == NULL || len < 2 * sizeof(int)) {
247 printk(KERN_WARNING "Can't get bus-range for %s\n",
248 dev->full_name);
249 continue;
250 }
251 if (bus_range[1] == bus_range[0])
252 printk(KERN_INFO "PCI bus %d", bus_range[0]);
253 else
254 printk(KERN_INFO "PCI buses %d..%d",
255 bus_range[0], bus_range[1]);
256 printk(" controlled by %s", dev->type);
257 if (dev->n_addrs > 0)
258 printk(" at %x", dev->addrs[0].address);
259 printk("\n");
260
261 hose = pcibios_alloc_controller();
262 if (!hose) {
263 printk("Can't allocate PCI controller structure for %s\n",
264 dev->full_name);
265 continue;
266 }
267 hose->arch_data = dev;
268 hose->first_busno = bus_range[0];
269 hose->last_busno = bus_range[1];
270
271 model = get_property(dev, "model", NULL);
272 if (model == NULL)
273 model = "<none>";
274 if (device_is_compatible(dev, "IBM,python")) {
275 setup_python(hose, dev);
276 } else if (is_mot
277 || strncmp(model, "Motorola, Grackle", 17) == 0) {
278 setup_indirect_pci(hose, 0xfec00000, 0xfee00000);
279 } else if (is_longtrail) {
280 void __iomem *p = ioremap(GG2_PCI_CONFIG_BASE, 0x80000);
281 hose->ops = &gg2_pci_ops;
282 hose->cfg_data = p;
283 gg2_pci_config_base = p;
284 } else if (is_pegasos == 1) {
285 setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc);
286 } else if (is_pegasos == 2) {
287 setup_peg2(hose, dev);
288 } else {
289 printk("No methods for %s (model %s), using RTAS\n",
290 dev->full_name, model);
291 hose->ops = &rtas_pci_ops;
292 }
293
294 pci_process_bridge_OF_ranges(hose, dev, index == 0);
295
296 /* check the first bridge for a property that we can
297 use to set pci_dram_offset */
298 dma = (unsigned int *)
299 get_property(dev, "ibm,dma-ranges", &len);
300 if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) {
301 pci_dram_offset = dma[2] - dma[3];
302 printk("pci_dram_offset = %lx\n", pci_dram_offset);
303 }
304 }
305
306 /* Do not fixup interrupts from OF tree on pegasos */
307 if (is_pegasos == 0)
308 ppc_md.pcibios_fixup = chrp_pcibios_fixup;
309}
diff --git a/arch/ppc/platforms/chrp_pegasos_eth.c b/arch/ppc/platforms/chrp_pegasos_eth.c
deleted file mode 100644
index 9305c8aa1373..000000000000
--- a/arch/ppc/platforms/chrp_pegasos_eth.c
+++ /dev/null
@@ -1,211 +0,0 @@
1/*
2 * Copyright (C) 2005 Sven Luther <sl@bplan-gmbh.de>
3 * Thanks to :
4 * Dale Farnsworth <dale@farnsworth.org>
5 * Mark A. Greer <mgreer@mvista.com>
6 * Nicolas DET <nd@bplan-gmbh.de>
7 * Benjamin Herrenschmidt <benh@kernel.crashing.org>
8 * And anyone else who helped me on this.
9 */
10
11#include <linux/types.h>
12#include <linux/init.h>
13#include <linux/ioport.h>
14#include <linux/platform_device.h>
15#include <linux/mv643xx.h>
16#include <linux/pci.h>
17
18#define PEGASOS2_MARVELL_REGBASE (0xf1000000)
19#define PEGASOS2_MARVELL_REGSIZE (0x00004000)
20#define PEGASOS2_SRAM_BASE (0xf2000000)
21#define PEGASOS2_SRAM_SIZE (256*1024)
22
23#define PEGASOS2_SRAM_BASE_ETH0 (PEGASOS2_SRAM_BASE)
24#define PEGASOS2_SRAM_BASE_ETH1 (PEGASOS2_SRAM_BASE_ETH0 + (PEGASOS2_SRAM_SIZE / 2) )
25
26
27#define PEGASOS2_SRAM_RXRING_SIZE (PEGASOS2_SRAM_SIZE/4)
28#define PEGASOS2_SRAM_TXRING_SIZE (PEGASOS2_SRAM_SIZE/4)
29
30#undef BE_VERBOSE
31
32static struct resource mv643xx_eth_shared_resources[] = {
33 [0] = {
34 .name = "ethernet shared base",
35 .start = 0xf1000000 + MV643XX_ETH_SHARED_REGS,
36 .end = 0xf1000000 + MV643XX_ETH_SHARED_REGS +
37 MV643XX_ETH_SHARED_REGS_SIZE - 1,
38 .flags = IORESOURCE_MEM,
39 },
40};
41
42static struct platform_device mv643xx_eth_shared_device = {
43 .name = MV643XX_ETH_SHARED_NAME,
44 .id = 0,
45 .num_resources = ARRAY_SIZE(mv643xx_eth_shared_resources),
46 .resource = mv643xx_eth_shared_resources,
47};
48
49static struct resource mv643xx_eth0_resources[] = {
50 [0] = {
51 .name = "eth0 irq",
52 .start = 9,
53 .end = 9,
54 .flags = IORESOURCE_IRQ,
55 },
56};
57
58
59static struct mv643xx_eth_platform_data eth0_pd = {
60 .tx_sram_addr = PEGASOS2_SRAM_BASE_ETH0,
61 .tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE,
62 .tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16,
63
64 .rx_sram_addr = PEGASOS2_SRAM_BASE_ETH0 + PEGASOS2_SRAM_TXRING_SIZE,
65 .rx_sram_size = PEGASOS2_SRAM_RXRING_SIZE,
66 .rx_queue_size = PEGASOS2_SRAM_RXRING_SIZE/16,
67};
68
69static struct platform_device eth0_device = {
70 .name = MV643XX_ETH_NAME,
71 .id = 0,
72 .num_resources = ARRAY_SIZE(mv643xx_eth0_resources),
73 .resource = mv643xx_eth0_resources,
74 .dev = {
75 .platform_data = &eth0_pd,
76 },
77};
78
79static struct resource mv643xx_eth1_resources[] = {
80 [0] = {
81 .name = "eth1 irq",
82 .start = 9,
83 .end = 9,
84 .flags = IORESOURCE_IRQ,
85 },
86};
87
88static struct mv643xx_eth_platform_data eth1_pd = {
89 .tx_sram_addr = PEGASOS2_SRAM_BASE_ETH1,
90 .tx_sram_size = PEGASOS2_SRAM_TXRING_SIZE,
91 .tx_queue_size = PEGASOS2_SRAM_TXRING_SIZE/16,
92
93 .rx_sram_addr = PEGASOS2_SRAM_BASE_ETH1 + PEGASOS2_SRAM_TXRING_SIZE,
94 .rx_sram_size = PEGASOS2_SRAM_RXRING_SIZE,
95 .rx_queue_size = PEGASOS2_SRAM_RXRING_SIZE/16,
96};
97
98static struct platform_device eth1_device = {
99 .name = MV643XX_ETH_NAME,
100 .id = 1,
101 .num_resources = ARRAY_SIZE(mv643xx_eth1_resources),
102 .resource = mv643xx_eth1_resources,
103 .dev = {
104 .platform_data = &eth1_pd,
105 },
106};
107
108static struct platform_device *mv643xx_eth_pd_devs[] __initdata = {
109 &mv643xx_eth_shared_device,
110 &eth0_device,
111 &eth1_device,
112};
113
114/***********/
115/***********/
116#define MV_READ(offset,val) { val = readl(mv643xx_reg_base + offset); }
117#define MV_WRITE(offset,data) writel(data, mv643xx_reg_base + offset)
118
119static void __iomem *mv643xx_reg_base;
120
121static int Enable_SRAM(void)
122{
123 u32 ALong;
124
125 if (mv643xx_reg_base == NULL)
126 mv643xx_reg_base = ioremap(PEGASOS2_MARVELL_REGBASE,
127 PEGASOS2_MARVELL_REGSIZE);
128
129 if (mv643xx_reg_base == NULL)
130 return -ENOMEM;
131
132#ifdef BE_VERBOSE
133 printk("Pegasos II/Marvell MV64361: register remapped from %p to %p\n",
134 (void *)PEGASOS2_MARVELL_REGBASE, (void *)mv643xx_reg_base);
135#endif
136
137 MV_WRITE(MV64340_SRAM_CONFIG, 0);
138
139 MV_WRITE(MV64340_INTEGRATED_SRAM_BASE_ADDR, PEGASOS2_SRAM_BASE >> 16);
140
141 MV_READ(MV64340_BASE_ADDR_ENABLE, ALong);
142 ALong &= ~(1 << 19);
143 MV_WRITE(MV64340_BASE_ADDR_ENABLE, ALong);
144
145 ALong = 0x02;
146 ALong |= PEGASOS2_SRAM_BASE & 0xffff0000;
147 MV_WRITE(MV643XX_ETH_BAR_4, ALong);
148
149 MV_WRITE(MV643XX_ETH_SIZE_REG_4, (PEGASOS2_SRAM_SIZE-1) & 0xffff0000);
150
151 MV_READ(MV643XX_ETH_BASE_ADDR_ENABLE_REG, ALong);
152 ALong &= ~(1 << 4);
153 MV_WRITE(MV643XX_ETH_BASE_ADDR_ENABLE_REG, ALong);
154
155#ifdef BE_VERBOSE
156 printk("Pegasos II/Marvell MV64361: register unmapped\n");
157 printk("Pegasos II/Marvell MV64361: SRAM at %p, size=%x\n", (void*) PEGASOS2_SRAM_BASE, PEGASOS2_SRAM_SIZE);
158#endif
159
160 iounmap(mv643xx_reg_base);
161 mv643xx_reg_base = NULL;
162
163 return 1;
164}
165
166
167/***********/
168/***********/
169int mv643xx_eth_add_pds(void)
170{
171 int ret = 0;
172 static struct pci_device_id pci_marvell_mv64360[] = {
173 { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, PCI_DEVICE_ID_MARVELL_MV64360) },
174 { }
175 };
176
177#ifdef BE_VERBOSE
178 printk("Pegasos II/Marvell MV64361: init\n");
179#endif
180
181 if (pci_dev_present(pci_marvell_mv64360)) {
182 ret = platform_add_devices(mv643xx_eth_pd_devs,
183 ARRAY_SIZE(mv643xx_eth_pd_devs));
184
185 if ( Enable_SRAM() < 0)
186 {
187 eth0_pd.tx_sram_addr = 0;
188 eth0_pd.tx_sram_size = 0;
189 eth0_pd.rx_sram_addr = 0;
190 eth0_pd.rx_sram_size = 0;
191
192 eth1_pd.tx_sram_addr = 0;
193 eth1_pd.tx_sram_size = 0;
194 eth1_pd.rx_sram_addr = 0;
195 eth1_pd.rx_sram_size = 0;
196
197#ifdef BE_VERBOSE
198 printk("Pegasos II/Marvell MV64361: Can't enable the "
199 "SRAM\n");
200#endif
201 }
202 }
203
204#ifdef BE_VERBOSE
205 printk("Pegasos II/Marvell MV64361: init is over\n");
206#endif
207
208 return ret;
209}
210
211device_initcall(mv643xx_eth_add_pds);
diff --git a/arch/ppc/platforms/chrp_setup.c b/arch/ppc/platforms/chrp_setup.c
deleted file mode 100644
index f9fd3f4f8e2e..000000000000
--- a/arch/ppc/platforms/chrp_setup.c
+++ /dev/null
@@ -1,669 +0,0 @@
1/*
2 * Copyright (C) 1995 Linus Torvalds
3 * Adapted from 'alpha' version by Gary Thomas
4 * Modified by Cort Dougan (cort@cs.nmt.edu)
5 */
6
7/*
8 * bootup setup stuff..
9 */
10
11#include <linux/config.h>
12#include <linux/errno.h>
13#include <linux/sched.h>
14#include <linux/kernel.h>
15#include <linux/mm.h>
16#include <linux/stddef.h>
17#include <linux/unistd.h>
18#include <linux/ptrace.h>
19#include <linux/slab.h>
20#include <linux/user.h>
21#include <linux/a.out.h>
22#include <linux/tty.h>
23#include <linux/major.h>
24#include <linux/interrupt.h>
25#include <linux/reboot.h>
26#include <linux/init.h>
27#include <linux/pci.h>
28#include <linux/version.h>
29#include <linux/adb.h>
30#include <linux/module.h>
31#include <linux/delay.h>
32#include <linux/ide.h>
33#include <linux/console.h>
34#include <linux/seq_file.h>
35#include <linux/root_dev.h>
36#include <linux/initrd.h>
37#include <linux/module.h>
38
39#include <asm/io.h>
40#include <asm/pgtable.h>
41#include <asm/prom.h>
42#include <asm/gg2.h>
43#include <asm/pci-bridge.h>
44#include <asm/dma.h>
45#include <asm/machdep.h>
46#include <asm/irq.h>
47#include <asm/hydra.h>
48#include <asm/sections.h>
49#include <asm/time.h>
50#include <asm/btext.h>
51#include <asm/i8259.h>
52#include <asm/open_pic.h>
53#include <asm/xmon.h>
54#include "mem_pieces.h"
55
56unsigned long chrp_get_rtc_time(void);
57int chrp_set_rtc_time(unsigned long nowtime);
58void chrp_calibrate_decr(void);
59long chrp_time_init(void);
60
61void chrp_find_bridges(void);
62void chrp_event_scan(void);
63void rtas_display_progress(char *, unsigned short);
64void rtas_indicator_progress(char *, unsigned short);
65void btext_progress(char *, unsigned short);
66
67extern int of_show_percpuinfo(struct seq_file *, int);
68
69int _chrp_type;
70EXPORT_SYMBOL(_chrp_type);
71
72/*
73 * XXX this should be in xmon.h, but putting it there means xmon.h
74 * has to include <linux/interrupt.h> (to get irqreturn_t), which
75 * causes all sorts of problems. -- paulus
76 */
77extern irqreturn_t xmon_irq(int, void *, struct pt_regs *);
78
79extern dev_t boot_dev;
80
81extern PTE *Hash, *Hash_end;
82extern unsigned long Hash_size, Hash_mask;
83extern int probingmem;
84extern unsigned long loops_per_jiffy;
85static int max_width;
86
87#ifdef CONFIG_SMP
88extern struct smp_ops_t chrp_smp_ops;
89#endif
90
91static const char *gg2_memtypes[4] = {
92 "FPM", "SDRAM", "EDO", "BEDO"
93};
94static const char *gg2_cachesizes[4] = {
95 "256 KB", "512 KB", "1 MB", "Reserved"
96};
97static const char *gg2_cachetypes[4] = {
98 "Asynchronous", "Reserved", "Flow-Through Synchronous",
99 "Pipelined Synchronous"
100};
101static const char *gg2_cachemodes[4] = {
102 "Disabled", "Write-Through", "Copy-Back", "Transparent Mode"
103};
104
105int
106chrp_show_cpuinfo(struct seq_file *m)
107{
108 int i, sdramen;
109 unsigned int t;
110 struct device_node *root;
111 const char *model = "";
112
113 root = find_path_device("/");
114 if (root)
115 model = get_property(root, "model", NULL);
116 seq_printf(m, "machine\t\t: CHRP %s\n", model);
117
118 /* longtrail (goldengate) stuff */
119 if (!strncmp(model, "IBM,LongTrail", 13)) {
120 /* VLSI VAS96011/12 `Golden Gate 2' */
121 /* Memory banks */
122 sdramen = (in_le32(gg2_pci_config_base + GG2_PCI_DRAM_CTRL)
123 >>31) & 1;
124 for (i = 0; i < (sdramen ? 4 : 6); i++) {
125 t = in_le32(gg2_pci_config_base+
126 GG2_PCI_DRAM_BANK0+
127 i*4);
128 if (!(t & 1))
129 continue;
130 switch ((t>>8) & 0x1f) {
131 case 0x1f:
132 model = "4 MB";
133 break;
134 case 0x1e:
135 model = "8 MB";
136 break;
137 case 0x1c:
138 model = "16 MB";
139 break;
140 case 0x18:
141 model = "32 MB";
142 break;
143 case 0x10:
144 model = "64 MB";
145 break;
146 case 0x00:
147 model = "128 MB";
148 break;
149 default:
150 model = "Reserved";
151 break;
152 }
153 seq_printf(m, "memory bank %d\t: %s %s\n", i, model,
154 gg2_memtypes[sdramen ? 1 : ((t>>1) & 3)]);
155 }
156 /* L2 cache */
157 t = in_le32(gg2_pci_config_base+GG2_PCI_CC_CTRL);
158 seq_printf(m, "board l2\t: %s %s (%s)\n",
159 gg2_cachesizes[(t>>7) & 3],
160 gg2_cachetypes[(t>>2) & 3],
161 gg2_cachemodes[t & 3]);
162 }
163 return 0;
164}
165
166/*
167 * Fixes for the National Semiconductor PC78308VUL SuperI/O
168 *
169 * Some versions of Open Firmware incorrectly initialize the IRQ settings
170 * for keyboard and mouse
171 */
172static inline void __init sio_write(u8 val, u8 index)
173{
174 outb(index, 0x15c);
175 outb(val, 0x15d);
176}
177
178static inline u8 __init sio_read(u8 index)
179{
180 outb(index, 0x15c);
181 return inb(0x15d);
182}
183
184static void __init sio_fixup_irq(const char *name, u8 device, u8 level,
185 u8 type)
186{
187 u8 level0, type0, active;
188
189 /* select logical device */
190 sio_write(device, 0x07);
191 active = sio_read(0x30);
192 level0 = sio_read(0x70);
193 type0 = sio_read(0x71);
194 if (level0 != level || type0 != type || !active) {
195 printk(KERN_WARNING "sio: %s irq level %d, type %d, %sactive: "
196 "remapping to level %d, type %d, active\n",
197 name, level0, type0, !active ? "in" : "", level, type);
198 sio_write(0x01, 0x30);
199 sio_write(level, 0x70);
200 sio_write(type, 0x71);
201 }
202}
203
204static void __init sio_init(void)
205{
206 struct device_node *root;
207
208 if ((root = find_path_device("/")) &&
209 !strncmp(get_property(root, "model", NULL), "IBM,LongTrail", 13)) {
210 /* logical device 0 (KBC/Keyboard) */
211 sio_fixup_irq("keyboard", 0, 1, 2);
212 /* select logical device 1 (KBC/Mouse) */
213 sio_fixup_irq("mouse", 1, 12, 2);
214 }
215}
216
217
218static void __init pegasos_set_l2cr(void)
219{
220 struct device_node *np;
221
222 /* On Pegasos, enable the l2 cache if needed, as the OF forgets it */
223 if (_chrp_type != _CHRP_Pegasos)
224 return;
225
226 /* Enable L2 cache if needed */
227 np = find_type_devices("cpu");
228 if (np != NULL) {
229 unsigned int *l2cr = (unsigned int *)
230 get_property (np, "l2cr", NULL);
231 if (l2cr == NULL) {
232 printk ("Pegasos l2cr : no cpu l2cr property found\n");
233 return;
234 }
235 if (!((*l2cr) & 0x80000000)) {
236 printk ("Pegasos l2cr : L2 cache was not active, "
237 "activating\n");
238 _set_L2CR(0);
239 _set_L2CR((*l2cr) | 0x80000000);
240 }
241 }
242}
243
244void __init chrp_setup_arch(void)
245{
246 struct device_node *device;
247
248 /* init to some ~sane value until calibrate_delay() runs */
249 loops_per_jiffy = 50000000/HZ;
250
251#ifdef CONFIG_BLK_DEV_INITRD
252 /* this is fine for chrp */
253 initrd_below_start_ok = 1;
254
255 if (initrd_start)
256 ROOT_DEV = Root_RAM0;
257 else
258#endif
259 ROOT_DEV = Root_SDA2; /* sda2 (sda1 is for the kernel) */
260
261 /* On pegasos, enable the L2 cache if not already done by OF */
262 pegasos_set_l2cr();
263
264 /* Lookup PCI host bridges */
265 chrp_find_bridges();
266
267#ifndef CONFIG_PPC64BRIDGE
268 /*
269 * Temporary fixes for PCI devices.
270 * -- Geert
271 */
272 hydra_init(); /* Mac I/O */
273
274#endif /* CONFIG_PPC64BRIDGE */
275
276 /*
277 * Fix the Super I/O configuration
278 */
279 sio_init();
280
281 /* Get the event scan rate for the rtas so we know how
282 * often it expects a heartbeat. -- Cort
283 */
284 if ( rtas_data ) {
285 struct property *p;
286 device = find_devices("rtas");
287 for ( p = device->properties;
288 p && strncmp(p->name, "rtas-event-scan-rate", 20);
289 p = p->next )
290 /* nothing */ ;
291 if ( p && *(unsigned long *)p->value ) {
292 ppc_md.heartbeat = chrp_event_scan;
293 ppc_md.heartbeat_reset = (HZ/(*(unsigned long *)p->value)*30)-1;
294 ppc_md.heartbeat_count = 1;
295 printk("RTAS Event Scan Rate: %lu (%lu jiffies)\n",
296 *(unsigned long *)p->value, ppc_md.heartbeat_reset );
297 }
298 }
299
300 pci_create_OF_bus_map();
301}
302
303void
304chrp_event_scan(void)
305{
306 unsigned char log[1024];
307 unsigned long ret = 0;
308 /* XXX: we should loop until the hardware says no more error logs -- Cort */
309 call_rtas( "event-scan", 4, 1, &ret, 0xffffffff, 0,
310 __pa(log), 1024 );
311 ppc_md.heartbeat_count = ppc_md.heartbeat_reset;
312}
313
314void
315chrp_restart(char *cmd)
316{
317 printk("RTAS system-reboot returned %d\n",
318 call_rtas("system-reboot", 0, 1, NULL));
319 for (;;);
320}
321
322void
323chrp_power_off(void)
324{
325 /* allow power on only with power button press */
326 printk("RTAS power-off returned %d\n",
327 call_rtas("power-off", 2, 1, NULL,0xffffffff,0xffffffff));
328 for (;;);
329}
330
331void
332chrp_halt(void)
333{
334 chrp_power_off();
335}
336
337/*
338 * Finds the open-pic node and sets OpenPIC_Addr based on its reg property.
339 * Then checks if it has an interrupt-ranges property. If it does then
340 * we have a distributed open-pic, so call openpic_set_sources to tell
341 * the openpic code where to find the interrupt source registers.
342 */
343static void __init chrp_find_openpic(void)
344{
345 struct device_node *np;
346 int len, i;
347 unsigned int *iranges;
348 void __iomem *isu;
349
350 np = find_type_devices("open-pic");
351 if (np == NULL || np->n_addrs == 0)
352 return;
353 printk(KERN_INFO "OpenPIC at %x (size %x)\n",
354 np->addrs[0].address, np->addrs[0].size);
355 OpenPIC_Addr = ioremap(np->addrs[0].address, 0x40000);
356 if (OpenPIC_Addr == NULL) {
357 printk(KERN_ERR "Failed to map OpenPIC!\n");
358 return;
359 }
360
361 iranges = (unsigned int *) get_property(np, "interrupt-ranges", &len);
362 if (iranges == NULL || len < 2 * sizeof(unsigned int))
363 return; /* not distributed */
364
365 /*
366 * The first pair of cells in interrupt-ranges refers to the
367 * IDU; subsequent pairs refer to the ISUs.
368 */
369 len /= 2 * sizeof(unsigned int);
370 if (np->n_addrs < len) {
371 printk(KERN_ERR "Insufficient addresses for distributed"
372 " OpenPIC (%d < %d)\n", np->n_addrs, len);
373 return;
374 }
375 if (iranges[1] != 0) {
376 printk(KERN_INFO "OpenPIC irqs %d..%d in IDU\n",
377 iranges[0], iranges[0] + iranges[1] - 1);
378 openpic_set_sources(iranges[0], iranges[1], NULL);
379 }
380 for (i = 1; i < len; ++i) {
381 iranges += 2;
382 printk(KERN_INFO "OpenPIC irqs %d..%d in ISU at %x (%x)\n",
383 iranges[0], iranges[0] + iranges[1] - 1,
384 np->addrs[i].address, np->addrs[i].size);
385 isu = ioremap(np->addrs[i].address, np->addrs[i].size);
386 if (isu != NULL)
387 openpic_set_sources(iranges[0], iranges[1], isu);
388 else
389 printk(KERN_ERR "Failed to map OpenPIC ISU at %x!\n",
390 np->addrs[i].address);
391 }
392}
393
394#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
395static struct irqaction xmon_irqaction = {
396 .handler = xmon_irq,
397 .mask = CPU_MASK_NONE,
398 .name = "XMON break",
399};
400#endif
401
402void __init chrp_init_IRQ(void)
403{
404 struct device_node *np;
405 unsigned long chrp_int_ack = 0;
406 unsigned char init_senses[NR_IRQS - NUM_8259_INTERRUPTS];
407#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
408 struct device_node *kbd;
409#endif
410
411 for (np = find_devices("pci"); np != NULL; np = np->next) {
412 unsigned int *addrp = (unsigned int *)
413 get_property(np, "8259-interrupt-acknowledge", NULL);
414
415 if (addrp == NULL)
416 continue;
417 chrp_int_ack = addrp[prom_n_addr_cells(np)-1];
418 break;
419 }
420 if (np == NULL)
421 printk(KERN_ERR "Cannot find PCI interrupt acknowledge address\n");
422
423 chrp_find_openpic();
424
425 if (OpenPIC_Addr) {
426 prom_get_irq_senses(init_senses, NUM_8259_INTERRUPTS, NR_IRQS);
427 OpenPIC_InitSenses = init_senses;
428 OpenPIC_NumInitSenses = NR_IRQS - NUM_8259_INTERRUPTS;
429
430 openpic_init(NUM_8259_INTERRUPTS);
431 /* We have a cascade on OpenPIC IRQ 0, Linux IRQ 16 */
432 openpic_hookup_cascade(NUM_8259_INTERRUPTS, "82c59 cascade",
433 i8259_irq);
434
435 }
436 i8259_init(chrp_int_ack, 0);
437
438#if defined(CONFIG_VT) && defined(CONFIG_INPUT_ADBHID) && defined(XMON)
439 /* see if there is a keyboard in the device tree
440 with a parent of type "adb" */
441 for (kbd = find_devices("keyboard"); kbd; kbd = kbd->next)
442 if (kbd->parent && kbd->parent->type
443 && strcmp(kbd->parent->type, "adb") == 0)
444 break;
445 if (kbd)
446 setup_irq(HYDRA_INT_ADB_NMI, &xmon_irqaction);
447#endif
448}
449
450void __init
451chrp_init2(void)
452{
453#ifdef CONFIG_NVRAM
454 chrp_nvram_init();
455#endif
456
457 request_region(0x20,0x20,"pic1");
458 request_region(0xa0,0x20,"pic2");
459 request_region(0x00,0x20,"dma1");
460 request_region(0x40,0x20,"timer");
461 request_region(0x80,0x10,"dma page reg");
462 request_region(0xc0,0x20,"dma2");
463
464 if (ppc_md.progress)
465 ppc_md.progress(" Have fun! ", 0x7777);
466}
467
468static struct device_node *memory_node;
469
470static int __init get_mem_prop(char *name, struct mem_pieces *mp)
471{
472 struct reg_property *rp;
473 int i, s;
474 unsigned int *ip;
475 int nac = prom_n_addr_cells(memory_node);
476 int nsc = prom_n_size_cells(memory_node);
477
478 ip = (unsigned int *) get_property(memory_node, name, &s);
479 if (ip == NULL) {
480 printk(KERN_ERR "error: couldn't get %s property on /memory\n",
481 name);
482 return 0;
483 }
484 s /= (nsc + nac) * 4;
485 rp = mp->regions;
486 for (i = 0; i < s; ++i, ip += nac+nsc) {
487 if (nac >= 2 && ip[nac-2] != 0)
488 continue;
489 rp->address = ip[nac-1];
490 if (nsc >= 2 && ip[nac+nsc-2] != 0)
491 rp->size = ~0U;
492 else
493 rp->size = ip[nac+nsc-1];
494 ++rp;
495 }
496 mp->n_regions = rp - mp->regions;
497
498 /* Make sure the pieces are sorted. */
499 mem_pieces_sort(mp);
500 mem_pieces_coalesce(mp);
501 return 1;
502}
503
504static unsigned long __init chrp_find_end_of_memory(void)
505{
506 unsigned long a, total;
507 struct mem_pieces phys_mem;
508
509 /*
510 * Find out where physical memory is, and check that it
511 * starts at 0 and is contiguous. It seems that RAM is
512 * always physically contiguous on Power Macintoshes.
513 *
514 * Supporting discontiguous physical memory isn't hard,
515 * it just makes the virtual <-> physical mapping functions
516 * more complicated (or else you end up wasting space
517 * in mem_map).
518 */
519 memory_node = find_devices("memory");
520 if (memory_node == NULL || !get_mem_prop("reg", &phys_mem)
521 || phys_mem.n_regions == 0)
522 panic("No RAM??");
523 a = phys_mem.regions[0].address;
524 if (a != 0)
525 panic("RAM doesn't start at physical address 0");
526 total = phys_mem.regions[0].size;
527
528 if (phys_mem.n_regions > 1) {
529 printk("RAM starting at 0x%x is not contiguous\n",
530 phys_mem.regions[1].address);
531 printk("Using RAM from 0 to 0x%lx\n", total-1);
532 }
533
534 return total;
535}
536
537void __init
538chrp_init(unsigned long r3, unsigned long r4, unsigned long r5,
539 unsigned long r6, unsigned long r7)
540{
541 struct device_node *root = find_path_device ("/");
542 char *machine = NULL;
543
544#ifdef CONFIG_BLK_DEV_INITRD
545 /* take care of initrd if we have one */
546 if ( r6 )
547 {
548 initrd_start = r6 + KERNELBASE;
549 initrd_end = r6 + r7 + KERNELBASE;
550 }
551#endif /* CONFIG_BLK_DEV_INITRD */
552
553 ISA_DMA_THRESHOLD = ~0L;
554 DMA_MODE_READ = 0x44;
555 DMA_MODE_WRITE = 0x48;
556 isa_io_base = CHRP_ISA_IO_BASE; /* default value */
557 ppc_do_canonicalize_irqs = 1;
558
559 if (root)
560 machine = get_property(root, "model", NULL);
561 if (machine && strncmp(machine, "Pegasos", 7) == 0) {
562 _chrp_type = _CHRP_Pegasos;
563 } else if (machine && strncmp(machine, "IBM", 3) == 0) {
564 _chrp_type = _CHRP_IBM;
565 } else if (machine && strncmp(machine, "MOT", 3) == 0) {
566 _chrp_type = _CHRP_Motorola;
567 } else {
568 /* Let's assume it is an IBM chrp if all else fails */
569 _chrp_type = _CHRP_IBM;
570 }
571
572 ppc_md.setup_arch = chrp_setup_arch;
573 ppc_md.show_percpuinfo = of_show_percpuinfo;
574 ppc_md.show_cpuinfo = chrp_show_cpuinfo;
575
576 ppc_md.init_IRQ = chrp_init_IRQ;
577 if (_chrp_type == _CHRP_Pegasos)
578 ppc_md.get_irq = i8259_irq;
579 else
580 ppc_md.get_irq = openpic_get_irq;
581
582 ppc_md.init = chrp_init2;
583
584 ppc_md.phys_mem_access_prot = pci_phys_mem_access_prot;
585
586 ppc_md.restart = chrp_restart;
587 ppc_md.power_off = chrp_power_off;
588 ppc_md.halt = chrp_halt;
589
590 ppc_md.time_init = chrp_time_init;
591 ppc_md.set_rtc_time = chrp_set_rtc_time;
592 ppc_md.get_rtc_time = chrp_get_rtc_time;
593 ppc_md.calibrate_decr = chrp_calibrate_decr;
594
595 ppc_md.find_end_of_memory = chrp_find_end_of_memory;
596
597 if (rtas_data) {
598 struct device_node *rtas;
599 unsigned int *p;
600
601 rtas = find_devices("rtas");
602 if (rtas != NULL) {
603 if (get_property(rtas, "display-character", NULL)) {
604 ppc_md.progress = rtas_display_progress;
605 p = (unsigned int *) get_property
606 (rtas, "ibm,display-line-length", NULL);
607 if (p)
608 max_width = *p;
609 } else if (get_property(rtas, "set-indicator", NULL))
610 ppc_md.progress = rtas_indicator_progress;
611 }
612 }
613#ifdef CONFIG_BOOTX_TEXT
614 if (ppc_md.progress == NULL && boot_text_mapped)
615 ppc_md.progress = btext_progress;
616#endif
617
618#ifdef CONFIG_SMP
619 smp_ops = &chrp_smp_ops;
620#endif /* CONFIG_SMP */
621
622 /*
623 * Print the banner, then scroll down so boot progress
624 * can be printed. -- Cort
625 */
626 if (ppc_md.progress) ppc_md.progress("Linux/PPC "UTS_RELEASE"\n", 0x0);
627}
628
629void
630rtas_display_progress(char *s, unsigned short hex)
631{
632 int width;
633 char *os = s;
634
635 if ( call_rtas( "display-character", 1, 1, NULL, '\r' ) )
636 return;
637
638 width = max_width;
639 while ( *os )
640 {
641 if ( (*os == '\n') || (*os == '\r') )
642 width = max_width;
643 else
644 width--;
645 call_rtas( "display-character", 1, 1, NULL, *os++ );
646 /* if we overwrite the screen length */
647 if ( width == 0 )
648 while ( (*os != 0) && (*os != '\n') && (*os != '\r') )
649 os++;
650 }
651
652 /*while ( width-- > 0 )*/
653 call_rtas( "display-character", 1, 1, NULL, ' ' );
654}
655
656void
657rtas_indicator_progress(char *s, unsigned short hex)
658{
659 call_rtas("set-indicator", 3, 1, NULL, 6, 0, hex);
660}
661
662#ifdef CONFIG_BOOTX_TEXT
663void
664btext_progress(char *s, unsigned short hex)
665{
666 prom_print(s);
667 prom_print("\n");
668}
669#endif /* CONFIG_BOOTX_TEXT */
diff --git a/arch/ppc/platforms/chrp_smp.c b/arch/ppc/platforms/chrp_smp.c
deleted file mode 100644
index 97e539557ecb..000000000000
--- a/arch/ppc/platforms/chrp_smp.c
+++ /dev/null
@@ -1,99 +0,0 @@
1/*
2 * Smp support for CHRP machines.
3 *
4 * Written by Cort Dougan (cort@cs.nmt.edu) borrowing a great
5 * deal of code from the sparc and intel versions.
6 *
7 * Copyright (C) 1999 Cort Dougan <cort@cs.nmt.edu>
8 *
9 */
10
11#include <linux/config.h>
12#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/smp.h>
15#include <linux/smp_lock.h>
16#include <linux/interrupt.h>
17#include <linux/kernel_stat.h>
18#include <linux/delay.h>
19#include <linux/init.h>
20#include <linux/spinlock.h>
21
22#include <asm/ptrace.h>
23#include <asm/atomic.h>
24#include <asm/irq.h>
25#include <asm/page.h>
26#include <asm/pgtable.h>
27#include <asm/sections.h>
28#include <asm/io.h>
29#include <asm/prom.h>
30#include <asm/smp.h>
31#include <asm/residual.h>
32#include <asm/time.h>
33#include <asm/open_pic.h>
34#include <asm/machdep.h>
35
36extern unsigned long smp_chrp_cpu_nr;
37
38static int __init
39smp_chrp_probe(void)
40{
41 if (smp_chrp_cpu_nr > 1)
42 openpic_request_IPIs();
43
44 return smp_chrp_cpu_nr;
45}
46
47static void __devinit
48smp_chrp_kick_cpu(int nr)
49{
50 *(unsigned long *)KERNELBASE = nr;
51 asm volatile("dcbf 0,%0"::"r"(KERNELBASE):"memory");
52}
53
54static void __devinit
55smp_chrp_setup_cpu(int cpu_nr)
56{
57 if (OpenPIC_Addr)
58 do_openpic_setup_cpu();
59}
60
61static DEFINE_SPINLOCK(timebase_lock);
62static unsigned int timebase_upper = 0, timebase_lower = 0;
63
64void __devinit
65smp_chrp_give_timebase(void)
66{
67 spin_lock(&timebase_lock);
68 call_rtas("freeze-time-base", 0, 1, NULL);
69 timebase_upper = get_tbu();
70 timebase_lower = get_tbl();
71 spin_unlock(&timebase_lock);
72
73 while (timebase_upper || timebase_lower)
74 barrier();
75 call_rtas("thaw-time-base", 0, 1, NULL);
76}
77
78void __devinit
79smp_chrp_take_timebase(void)
80{
81 while (!(timebase_upper || timebase_lower))
82 barrier();
83 spin_lock(&timebase_lock);
84 set_tb(timebase_upper, timebase_lower);
85 timebase_upper = 0;
86 timebase_lower = 0;
87 spin_unlock(&timebase_lock);
88 printk("CPU %i taken timebase\n", smp_processor_id());
89}
90
91/* CHRP with openpic */
92struct smp_ops_t chrp_smp_ops = {
93 .message_pass = smp_openpic_message_pass,
94 .probe = smp_chrp_probe,
95 .kick_cpu = smp_chrp_kick_cpu,
96 .setup_cpu = smp_chrp_setup_cpu,
97 .give_timebase = smp_chrp_give_timebase,
98 .take_timebase = smp_chrp_take_timebase,
99};
diff --git a/arch/ppc/platforms/chrp_time.c b/arch/ppc/platforms/chrp_time.c
deleted file mode 100644
index c8627770af13..000000000000
--- a/arch/ppc/platforms/chrp_time.c
+++ /dev/null
@@ -1,251 +0,0 @@
1/*
2 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
3 *
4 * Adapted for PowerPC (PReP) by Gary Thomas
5 * Modified by Cort Dougan (cort@cs.nmt.edu).
6 * Copied and modified from arch/i386/kernel/time.c
7 *
8 */
9#include <linux/errno.h>
10#include <linux/sched.h>
11#include <linux/kernel.h>
12#include <linux/param.h>
13#include <linux/string.h>
14#include <linux/mm.h>
15#include <linux/interrupt.h>
16#include <linux/time.h>
17#include <linux/timex.h>
18#include <linux/kernel_stat.h>
19#include <linux/mc146818rtc.h>
20#include <linux/init.h>
21#include <linux/bcd.h>
22
23#include <asm/io.h>
24#include <asm/nvram.h>
25#include <asm/prom.h>
26#include <asm/sections.h>
27#include <asm/time.h>
28
29extern spinlock_t rtc_lock;
30
31static int nvram_as1 = NVRAM_AS1;
32static int nvram_as0 = NVRAM_AS0;
33static int nvram_data = NVRAM_DATA;
34
35long __init chrp_time_init(void)
36{
37 struct device_node *rtcs;
38 int base;
39
40 rtcs = find_compatible_devices("rtc", "pnpPNP,b00");
41 if (rtcs == NULL)
42 rtcs = find_compatible_devices("rtc", "ds1385-rtc");
43 if (rtcs == NULL || rtcs->addrs == NULL)
44 return 0;
45 base = rtcs->addrs[0].address;
46 nvram_as1 = 0;
47 nvram_as0 = base;
48 nvram_data = base + 1;
49
50 return 0;
51}
52
53int chrp_cmos_clock_read(int addr)
54{
55 if (nvram_as1 != 0)
56 outb(addr>>8, nvram_as1);
57 outb(addr, nvram_as0);
58 return (inb(nvram_data));
59}
60
61void chrp_cmos_clock_write(unsigned long val, int addr)
62{
63 if (nvram_as1 != 0)
64 outb(addr>>8, nvram_as1);
65 outb(addr, nvram_as0);
66 outb(val, nvram_data);
67 return;
68}
69
70/*
71 * Set the hardware clock. -- Cort
72 */
73int chrp_set_rtc_time(unsigned long nowtime)
74{
75 unsigned char save_control, save_freq_select;
76 struct rtc_time tm;
77
78 spin_lock(&rtc_lock);
79 to_tm(nowtime, &tm);
80
81 save_control = chrp_cmos_clock_read(RTC_CONTROL); /* tell the clock it's being set */
82
83 chrp_cmos_clock_write((save_control|RTC_SET), RTC_CONTROL);
84
85 save_freq_select = chrp_cmos_clock_read(RTC_FREQ_SELECT); /* stop and reset prescaler */
86
87 chrp_cmos_clock_write((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
88
89 tm.tm_year -= 1900;
90 if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
91 BIN_TO_BCD(tm.tm_sec);
92 BIN_TO_BCD(tm.tm_min);
93 BIN_TO_BCD(tm.tm_hour);
94 BIN_TO_BCD(tm.tm_mon);
95 BIN_TO_BCD(tm.tm_mday);
96 BIN_TO_BCD(tm.tm_year);
97 }
98 chrp_cmos_clock_write(tm.tm_sec,RTC_SECONDS);
99 chrp_cmos_clock_write(tm.tm_min,RTC_MINUTES);
100 chrp_cmos_clock_write(tm.tm_hour,RTC_HOURS);
101 chrp_cmos_clock_write(tm.tm_mon,RTC_MONTH);
102 chrp_cmos_clock_write(tm.tm_mday,RTC_DAY_OF_MONTH);
103 chrp_cmos_clock_write(tm.tm_year,RTC_YEAR);
104
105 /* The following flags have to be released exactly in this order,
106 * otherwise the DS12887 (popular MC146818A clone with integrated
107 * battery and quartz) will not reset the oscillator and will not
108 * update precisely 500 ms later. You won't find this mentioned in
109 * the Dallas Semiconductor data sheets, but who believes data
110 * sheets anyway ... -- Markus Kuhn
111 */
112 chrp_cmos_clock_write(save_control, RTC_CONTROL);
113 chrp_cmos_clock_write(save_freq_select, RTC_FREQ_SELECT);
114
115 spin_unlock(&rtc_lock);
116 return 0;
117}
118
119unsigned long chrp_get_rtc_time(void)
120{
121 unsigned int year, mon, day, hour, min, sec;
122 int uip, i;
123
124 /* The Linux interpretation of the CMOS clock register contents:
125 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
126 * RTC registers show the second which has precisely just started.
127 * Let's hope other operating systems interpret the RTC the same way.
128 */
129
130 /* Since the UIP flag is set for about 2.2 ms and the clock
131 * is typically written with a precision of 1 jiffy, trying
132 * to obtain a precision better than a few milliseconds is
133 * an illusion. Only consistency is interesting, this also
134 * allows to use the routine for /dev/rtc without a potential
135 * 1 second kernel busy loop triggered by any reader of /dev/rtc.
136 */
137
138 for ( i = 0; i<1000000; i++) {
139 uip = chrp_cmos_clock_read(RTC_FREQ_SELECT);
140 sec = chrp_cmos_clock_read(RTC_SECONDS);
141 min = chrp_cmos_clock_read(RTC_MINUTES);
142 hour = chrp_cmos_clock_read(RTC_HOURS);
143 day = chrp_cmos_clock_read(RTC_DAY_OF_MONTH);
144 mon = chrp_cmos_clock_read(RTC_MONTH);
145 year = chrp_cmos_clock_read(RTC_YEAR);
146 uip |= chrp_cmos_clock_read(RTC_FREQ_SELECT);
147 if ((uip & RTC_UIP)==0) break;
148 }
149
150 if (!(chrp_cmos_clock_read(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
151 {
152 BCD_TO_BIN(sec);
153 BCD_TO_BIN(min);
154 BCD_TO_BIN(hour);
155 BCD_TO_BIN(day);
156 BCD_TO_BIN(mon);
157 BCD_TO_BIN(year);
158 }
159 if ((year += 1900) < 1970)
160 year += 100;
161 return mktime(year, mon, day, hour, min, sec);
162}
163
164/*
165 * Calibrate the decrementer frequency with the VIA timer 1.
166 */
167#define VIA_TIMER_FREQ_6 4700000 /* time 1 frequency * 6 */
168
169/* VIA registers */
170#define RS 0x200 /* skip between registers */
171#define T1CL (4*RS) /* Timer 1 ctr/latch (low 8 bits) */
172#define T1CH (5*RS) /* Timer 1 counter (high 8 bits) */
173#define T1LL (6*RS) /* Timer 1 latch (low 8 bits) */
174#define T1LH (7*RS) /* Timer 1 latch (high 8 bits) */
175#define ACR (11*RS) /* Auxiliary control register */
176#define IFR (13*RS) /* Interrupt flag register */
177
178/* Bits in ACR */
179#define T1MODE 0xc0 /* Timer 1 mode */
180#define T1MODE_CONT 0x40 /* continuous interrupts */
181
182/* Bits in IFR and IER */
183#define T1_INT 0x40 /* Timer 1 interrupt */
184
185static int __init chrp_via_calibrate_decr(void)
186{
187 struct device_node *vias;
188 volatile unsigned char __iomem *via;
189 int count = VIA_TIMER_FREQ_6 / 100;
190 unsigned int dstart, dend;
191
192 vias = find_devices("via-cuda");
193 if (vias == 0)
194 vias = find_devices("via");
195 if (vias == 0 || vias->n_addrs == 0)
196 return 0;
197 via = ioremap(vias->addrs[0].address, vias->addrs[0].size);
198
199 /* set timer 1 for continuous interrupts */
200 out_8(&via[ACR], (via[ACR] & ~T1MODE) | T1MODE_CONT);
201 /* set the counter to a small value */
202 out_8(&via[T1CH], 2);
203 /* set the latch to `count' */
204 out_8(&via[T1LL], count);
205 out_8(&via[T1LH], count >> 8);
206 /* wait until it hits 0 */
207 while ((in_8(&via[IFR]) & T1_INT) == 0)
208 ;
209 dstart = get_dec();
210 /* clear the interrupt & wait until it hits 0 again */
211 in_8(&via[T1CL]);
212 while ((in_8(&via[IFR]) & T1_INT) == 0)
213 ;
214 dend = get_dec();
215
216 tb_ticks_per_jiffy = (dstart - dend) / ((6 * HZ)/100);
217 tb_to_us = mulhwu_scale_factor(dstart - dend, 60000);
218
219 printk(KERN_INFO "via_calibrate_decr: ticks per jiffy = %u (%u ticks)\n",
220 tb_ticks_per_jiffy, dstart - dend);
221
222 iounmap(via);
223
224 return 1;
225}
226
227void __init chrp_calibrate_decr(void)
228{
229 struct device_node *cpu;
230 unsigned int freq, *fp;
231
232 if (chrp_via_calibrate_decr())
233 return;
234
235 /*
236 * The cpu node should have a timebase-frequency property
237 * to tell us the rate at which the decrementer counts.
238 */
239 freq = 16666000; /* hardcoded default */
240 cpu = find_type_devices("cpu");
241 if (cpu != 0) {
242 fp = (unsigned int *)
243 get_property(cpu, "timebase-frequency", NULL);
244 if (fp != 0)
245 freq = *fp;
246 }
247 printk("time_init: decrementer frequency = %u.%.6u MHz\n",
248 freq/1000000, freq%1000000);
249 tb_ticks_per_jiffy = freq / HZ;
250 tb_to_us = mulhwu_scale_factor(freq, 1000000);
251}
diff --git a/arch/ppc/platforms/lite5200.c b/arch/ppc/platforms/lite5200.c
index 5171b53bccb5..fecbe9adc9e0 100644
--- a/arch/ppc/platforms/lite5200.c
+++ b/arch/ppc/platforms/lite5200.c
@@ -34,8 +34,7 @@
34#include <asm/mpc52xx.h> 34#include <asm/mpc52xx.h>
35#include <asm/ppc_sys.h> 35#include <asm/ppc_sys.h>
36#include <asm/machdep.h> 36#include <asm/machdep.h>
37 37#include <asm/pci-bridge.h>
38#include <syslib/mpc52xx_pci.h>
39 38
40 39
41extern int powersave_nap; 40extern int powersave_nap;
@@ -68,44 +67,53 @@ lite5200_show_cpuinfo(struct seq_file *m)
68} 67}
69 68
70#ifdef CONFIG_PCI 69#ifdef CONFIG_PCI
70#ifdef CONFIG_LITE5200B
71static int
72lite5200_map_irq(struct pci_dev *dev, unsigned char idsel,
73 unsigned char pin)
74{
75 static char pci_irq_table[][4] =
76 /*
77 * PCI IDSEL/INTPIN->INTLINE
78 * A B C D
79 */
80 {
81 {MPC52xx_IRQ0, MPC52xx_IRQ1, MPC52xx_IRQ2, MPC52xx_IRQ3},
82 {MPC52xx_IRQ1, MPC52xx_IRQ2, MPC52xx_IRQ3, MPC52xx_IRQ0},
83 };
84
85 const long min_idsel = 24, max_idsel = 25, irqs_per_slot = 4;
86 return PCI_IRQ_TABLE_LOOKUP;
87}
88#else /* Original Lite */
71static int 89static int
72lite5200_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin) 90lite5200_map_irq(struct pci_dev *dev, unsigned char idsel, unsigned char pin)
73{ 91{
74 return (pin == 1) && (idsel==24) ? MPC52xx_IRQ0 : -1; 92 return (pin == 1) && (idsel==24) ? MPC52xx_IRQ0 : -1;
75} 93}
76#endif 94#endif
95#endif
77 96
78static void __init 97static void __init
79lite5200_setup_cpu(void) 98lite5200_setup_cpu(void)
80{ 99{
81 struct mpc52xx_cdm __iomem *cdm;
82 struct mpc52xx_gpio __iomem *gpio; 100 struct mpc52xx_gpio __iomem *gpio;
83 struct mpc52xx_intr __iomem *intr; 101 struct mpc52xx_intr __iomem *intr;
84 struct mpc52xx_xlb __iomem *xlb;
85 102
86 u32 port_config; 103 u32 port_config;
87 u32 intr_ctrl; 104 u32 intr_ctrl;
88 105
89 /* Map zones */ 106 /* Map zones */
90 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
91 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE); 107 gpio = ioremap(MPC52xx_PA(MPC52xx_GPIO_OFFSET), MPC52xx_GPIO_SIZE);
92 xlb = ioremap(MPC52xx_PA(MPC52xx_XLB_OFFSET), MPC52xx_XLB_SIZE);
93 intr = ioremap(MPC52xx_PA(MPC52xx_INTR_OFFSET), MPC52xx_INTR_SIZE); 108 intr = ioremap(MPC52xx_PA(MPC52xx_INTR_OFFSET), MPC52xx_INTR_SIZE);
94 109
95 if (!cdm || !gpio || !xlb || !intr) { 110 if (!gpio || !intr) {
96 printk("lite5200.c: Error while mapping CDM/GPIO/XLB/INTR during" 111 printk(KERN_ERR __FILE__ ": "
97 "lite5200_setup_cpu\n"); 112 "Error while mapping GPIO/INTR during "
113 "lite5200_setup_cpu\n");
98 goto unmap_regs; 114 goto unmap_regs;
99 } 115 }
100 116
101 /* Use internal 48 Mhz */
102 out_8(&cdm->ext_48mhz_en, 0x00);
103 out_8(&cdm->fd_enable, 0x01);
104 if (in_be32(&cdm->rstcfg) & 0x40) /* Assumes 33Mhz clock */
105 out_be16(&cdm->fd_counters, 0x0001);
106 else
107 out_be16(&cdm->fd_counters, 0x5555);
108
109 /* Get port mux config */ 117 /* Get port mux config */
110 port_config = in_be32(&gpio->port_config); 118 port_config = in_be32(&gpio->port_config);
111 119
@@ -116,29 +124,29 @@ lite5200_setup_cpu(void)
116 port_config &= ~0x00007000; /* Differential mode - USB1 only */ 124 port_config &= ~0x00007000; /* Differential mode - USB1 only */
117 port_config |= 0x00001000; 125 port_config |= 0x00001000;
118 126
127 /* ATA CS is on csb_4/5 */
128 port_config &= ~0x03000000;
129 port_config |= 0x01000000;
130
119 /* Commit port config */ 131 /* Commit port config */
120 out_be32(&gpio->port_config, port_config); 132 out_be32(&gpio->port_config, port_config);
121 133
122 /* Configure the XLB Arbiter */ 134 /* IRQ[0-3] setup */
123 out_be32(&xlb->master_pri_enable, 0xff);
124 out_be32(&xlb->master_priority, 0x11111111);
125
126 /* Enable ram snooping for 1GB window */
127 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_SNOOP);
128 out_be32(&xlb->snoop_window, MPC52xx_PCI_TARGET_MEM | 0x1d);
129
130 /* IRQ[0-3] setup : IRQ0 - Level Active Low */
131 /* IRQ[1-3] - Level Active High */
132 intr_ctrl = in_be32(&intr->ctrl); 135 intr_ctrl = in_be32(&intr->ctrl);
133 intr_ctrl &= ~0x00ff0000; 136 intr_ctrl &= ~0x00ff0000;
134 intr_ctrl |= 0x00c00000; 137#ifdef CONFIG_LITE5200B
138 /* IRQ[0-3] Level Active Low */
139 intr_ctrl |= 0x00ff0000;
140#else
141 /* IRQ0 Level Active Low
142 * IRQ[1-3] Level Active High */
143 intr_ctrl |= 0x00c00000;
144#endif
135 out_be32(&intr->ctrl, intr_ctrl); 145 out_be32(&intr->ctrl, intr_ctrl);
136 146
137 /* Unmap reg zone */ 147 /* Unmap reg zone */
138unmap_regs: 148unmap_regs:
139 if (cdm) iounmap(cdm);
140 if (gpio) iounmap(gpio); 149 if (gpio) iounmap(gpio);
141 if (xlb) iounmap(xlb);
142 if (intr) iounmap(intr); 150 if (intr) iounmap(intr);
143} 151}
144 152
@@ -146,7 +154,8 @@ static void __init
146lite5200_setup_arch(void) 154lite5200_setup_arch(void)
147{ 155{
148 /* CPU & Port mux setup */ 156 /* CPU & Port mux setup */
149 lite5200_setup_cpu(); 157 mpc52xx_setup_cpu(); /* Generic */
158 lite5200_setup_cpu(); /* Platform specific */
150 159
151#ifdef CONFIG_PCI 160#ifdef CONFIG_PCI
152 /* PCI Bridge setup */ 161 /* PCI Bridge setup */
diff --git a/arch/ppc/platforms/prep_setup.c b/arch/ppc/platforms/prep_setup.c
index a0fc628ffb1e..e86f6156d589 100644
--- a/arch/ppc/platforms/prep_setup.c
+++ b/arch/ppc/platforms/prep_setup.c
@@ -736,7 +736,7 @@ ibm_statusled_progress(char *s, unsigned short hex)
736 hex = 0xfff; 736 hex = 0xfff;
737 if (!notifier_installed) { 737 if (!notifier_installed) {
738 ++notifier_installed; 738 ++notifier_installed;
739 notifier_chain_register(&panic_notifier_list, 739 atomic_notifier_chain_register(&panic_notifier_list,
740 &ibm_statusled_block); 740 &ibm_statusled_block);
741 } 741 }
742 } 742 }
@@ -1067,15 +1067,13 @@ prep_map_io(void)
1067static int __init 1067static int __init
1068prep_request_io(void) 1068prep_request_io(void)
1069{ 1069{
1070 if (_machine == _MACH_prep) {
1071#ifdef CONFIG_NVRAM 1070#ifdef CONFIG_NVRAM
1072 request_region(PREP_NVRAM_AS0, 0x8, "nvram"); 1071 request_region(PREP_NVRAM_AS0, 0x8, "nvram");
1073#endif 1072#endif
1074 request_region(0x00,0x20,"dma1"); 1073 request_region(0x00,0x20,"dma1");
1075 request_region(0x40,0x20,"timer"); 1074 request_region(0x40,0x20,"timer");
1076 request_region(0x80,0x10,"dma page reg"); 1075 request_region(0x80,0x10,"dma page reg");
1077 request_region(0xc0,0x20,"dma2"); 1076 request_region(0xc0,0x20,"dma2");
1078 }
1079 1077
1080 return 0; 1078 return 0;
1081} 1079}
diff --git a/arch/ppc/syslib/Makefile b/arch/ppc/syslib/Makefile
index 5cb62c6a51c8..490749ca88f9 100644
--- a/arch/ppc/syslib/Makefile
+++ b/arch/ppc/syslib/Makefile
@@ -38,8 +38,6 @@ endif
38obj-$(CONFIG_8xx) += m8xx_setup.o ppc8xx_pic.o $(wdt-mpc8xx-y) \ 38obj-$(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
42obj-$(CONFIG_PPC_CHRP) += open_pic.o
43obj-$(CONFIG_PPC_PREP) += open_pic.o todc_time.o 41obj-$(CONFIG_PPC_PREP) += open_pic.o todc_time.o
44obj-$(CONFIG_BAMBOO) += pci_auto.o todc_time.o 42obj-$(CONFIG_BAMBOO) += pci_auto.o todc_time.o
45obj-$(CONFIG_CPCI690) += todc_time.o pci_auto.o 43obj-$(CONFIG_CPCI690) += todc_time.o pci_auto.o
diff --git a/arch/ppc/syslib/mpc52xx_pci.c b/arch/ppc/syslib/mpc52xx_pci.c
index 9ec525f9fe98..5a5a7a9cd248 100644
--- a/arch/ppc/syslib/mpc52xx_pci.c
+++ b/arch/ppc/syslib/mpc52xx_pci.c
@@ -225,7 +225,8 @@ mpc52xx_pci_fixup_resources(struct pci_dev *dev)
225 /* The PCI Host bridge of MPC52xx has a prefetch memory resource 225 /* The PCI Host bridge of MPC52xx has a prefetch memory resource
226 fixed to 1Gb. Doesn't fit in the resource system so we remove it */ 226 fixed to 1Gb. Doesn't fit in the resource system so we remove it */
227 if ( (dev->vendor == PCI_VENDOR_ID_MOTOROLA) && 227 if ( (dev->vendor == PCI_VENDOR_ID_MOTOROLA) &&
228 (dev->device == PCI_DEVICE_ID_MOTOROLA_MPC5200) ) { 228 ( dev->device == PCI_DEVICE_ID_MOTOROLA_MPC5200
229 || dev->device == PCI_DEVICE_ID_MOTOROLA_MPC5200B) ) {
229 struct resource *res = &dev->resource[1]; 230 struct resource *res = &dev->resource[1];
230 res->start = res->end = res->flags = 0; 231 res->start = res->end = res->flags = 0;
231 } 232 }
diff --git a/arch/ppc/syslib/mpc52xx_setup.c b/arch/ppc/syslib/mpc52xx_setup.c
index 2ee48ce0a517..ee6379bb415e 100644
--- a/arch/ppc/syslib/mpc52xx_setup.c
+++ b/arch/ppc/syslib/mpc52xx_setup.c
@@ -24,6 +24,8 @@
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
25#include <asm/ppcboot.h> 25#include <asm/ppcboot.h>
26 26
27#include <syslib/mpc52xx_pci.h>
28
27extern bd_t __res; 29extern bd_t __res;
28 30
29static int core_mult[] = { /* CPU Frequency multiplier, taken */ 31static int core_mult[] = { /* CPU Frequency multiplier, taken */
@@ -216,6 +218,52 @@ mpc52xx_calibrate_decr(void)
216 tb_to_us = mulhwu_scale_factor(xlbfreq / divisor, 1000000); 218 tb_to_us = mulhwu_scale_factor(xlbfreq / divisor, 1000000);
217} 219}
218 220
221
222void __init
223mpc52xx_setup_cpu(void)
224{
225 struct mpc52xx_cdm __iomem *cdm;
226 struct mpc52xx_xlb __iomem *xlb;
227
228 /* Map zones */
229 cdm = ioremap(MPC52xx_PA(MPC52xx_CDM_OFFSET), MPC52xx_CDM_SIZE);
230 xlb = ioremap(MPC52xx_PA(MPC52xx_XLB_OFFSET), MPC52xx_XLB_SIZE);
231
232 if (!cdm || !xlb) {
233 printk(KERN_ERR __FILE__ ": "
234 "Error while mapping CDM/XLB during "
235 "mpc52xx_setup_cpu\n");
236 goto unmap_regs;
237 }
238
239 /* Use internal 48 Mhz */
240 out_8(&cdm->ext_48mhz_en, 0x00);
241 out_8(&cdm->fd_enable, 0x01);
242 if (in_be32(&cdm->rstcfg) & 0x40) /* Assumes 33Mhz clock */
243 out_be16(&cdm->fd_counters, 0x0001);
244 else
245 out_be16(&cdm->fd_counters, 0x5555);
246
247 /* Configure the XLB Arbiter priorities */
248 out_be32(&xlb->master_pri_enable, 0xff);
249 out_be32(&xlb->master_priority, 0x11111111);
250
251 /* Enable ram snooping for 1GB window */
252 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_SNOOP);
253 out_be32(&xlb->snoop_window, MPC52xx_PCI_TARGET_MEM | 0x1d);
254
255 /* Disable XLB pipelining */
256 /* (cfr errate 292. We could do this only just before ATA PIO
257 transaction and re-enable it after ...) */
258 out_be32(&xlb->config, in_be32(&xlb->config) | MPC52xx_XLB_CFG_PLDIS);
259
260 /* Unmap reg zone */
261unmap_regs:
262 if (cdm) iounmap(cdm);
263 if (xlb) iounmap(xlb);
264}
265
266
219int mpc52xx_match_psc_function(int psc_idx, const char *func) 267int mpc52xx_match_psc_function(int psc_idx, const char *func)
220{ 268{
221 struct mpc52xx_psc_func *cf = mpc52xx_psc_functions; 269 struct mpc52xx_psc_func *cf = mpc52xx_psc_functions;
diff --git a/arch/ppc/syslib/open_pic.c b/arch/ppc/syslib/open_pic.c
index 38e5b93fbe41..70456c8f998c 100644
--- a/arch/ppc/syslib/open_pic.c
+++ b/arch/ppc/syslib/open_pic.c
@@ -216,7 +216,7 @@ static void openpic_safe_writefield(volatile u_int __iomem *addr, u_int mask,
216u_int openpic_read_IPI(volatile u_int __iomem * addr) 216u_int openpic_read_IPI(volatile u_int __iomem * addr)
217{ 217{
218 u_int val = 0; 218 u_int val = 0;
219#if defined(OPENPIC_BIG_ENDIAN) || defined(CONFIG_POWER3) 219#if defined(OPENPIC_BIG_ENDIAN)
220 val = in_be32(addr); 220 val = in_be32(addr);
221#else 221#else
222 val = in_le32(addr); 222 val = in_le32(addr);
diff --git a/arch/ppc/syslib/prom.c b/arch/ppc/syslib/prom.c
deleted file mode 100644
index 482f837fd373..000000000000
--- a/arch/ppc/syslib/prom.c
+++ /dev/null
@@ -1,1429 +0,0 @@
1/*
2 * Procedures for interfacing to the Open Firmware PROM on
3 * Power Macintosh computers.
4 *
5 * In particular, we are interested in the device tree
6 * and in using some of its services (exit, write to stdout).
7 *
8 * Paul Mackerras August 1996.
9 * Copyright (C) 1996 Paul Mackerras.
10 */
11#include <stdarg.h>
12#include <linux/config.h>
13#include <linux/kernel.h>
14#include <linux/string.h>
15#include <linux/init.h>
16#include <linux/threads.h>
17#include <linux/spinlock.h>
18#include <linux/ioport.h>
19#include <linux/pci.h>
20#include <linux/slab.h>
21#include <linux/bitops.h>
22
23#include <asm/sections.h>
24#include <asm/prom.h>
25#include <asm/page.h>
26#include <asm/processor.h>
27#include <asm/irq.h>
28#include <asm/io.h>
29#include <asm/smp.h>
30#include <asm/bootx.h>
31#include <asm/system.h>
32#include <asm/mmu.h>
33#include <asm/pgtable.h>
34#include <asm/bootinfo.h>
35#include <asm/btext.h>
36#include <asm/pci-bridge.h>
37#include <asm/open_pic.h>
38
39
40struct pci_address {
41 unsigned a_hi;
42 unsigned a_mid;
43 unsigned a_lo;
44};
45
46struct pci_reg_property {
47 struct pci_address addr;
48 unsigned size_hi;
49 unsigned size_lo;
50};
51
52struct isa_reg_property {
53 unsigned space;
54 unsigned address;
55 unsigned size;
56};
57
58typedef unsigned long interpret_func(struct device_node *, unsigned long,
59 int, int);
60static interpret_func interpret_pci_props;
61static interpret_func interpret_dbdma_props;
62static interpret_func interpret_isa_props;
63static interpret_func interpret_macio_props;
64static interpret_func interpret_root_props;
65
66extern char *klimit;
67
68/* Set for a newworld or CHRP machine */
69int use_of_interrupt_tree;
70struct device_node *dflt_interrupt_controller;
71int num_interrupt_controllers;
72
73extern unsigned int rtas_entry; /* physical pointer */
74
75extern struct device_node *allnodes;
76
77static unsigned long finish_node(struct device_node *, unsigned long,
78 interpret_func *, int, int);
79static unsigned long finish_node_interrupts(struct device_node *, unsigned long);
80static struct device_node *find_phandle(phandle);
81
82extern void enter_rtas(void *);
83void phys_call_rtas(int, int, int, ...);
84
85extern char cmd_line[512]; /* XXX */
86extern boot_infos_t *boot_infos;
87unsigned long dev_tree_size;
88
89void
90phys_call_rtas(int service, int nargs, int nret, ...)
91{
92 va_list list;
93 union {
94 unsigned long words[16];
95 double align;
96 } u;
97 void (*rtas)(void *, unsigned long);
98 int i;
99
100 u.words[0] = service;
101 u.words[1] = nargs;
102 u.words[2] = nret;
103 va_start(list, nret);
104 for (i = 0; i < nargs; ++i)
105 u.words[i+3] = va_arg(list, unsigned long);
106 va_end(list);
107
108 rtas = (void (*)(void *, unsigned long)) rtas_entry;
109 rtas(&u, rtas_data);
110}
111
112/*
113 * finish_device_tree is called once things are running normally
114 * (i.e. with text and data mapped to the address they were linked at).
115 * It traverses the device tree and fills in the name, type,
116 * {n_}addrs and {n_}intrs fields of each node.
117 */
118void __init
119finish_device_tree(void)
120{
121 unsigned long mem = (unsigned long) klimit;
122 struct device_node *np;
123
124 /* All CHRPs now use the interrupt tree */
125 for (np = allnodes; np != NULL; np = np->allnext) {
126 if (get_property(np, "interrupt-parent", NULL)) {
127 use_of_interrupt_tree = 1;
128 break;
129 }
130 }
131
132 if (use_of_interrupt_tree) {
133 /*
134 * We want to find out here how many interrupt-controller
135 * nodes there are, and if we are booted from BootX,
136 * we need a pointer to the first (and hopefully only)
137 * such node. But we can't use find_devices here since
138 * np->name has not been set yet. -- paulus
139 */
140 int n = 0;
141 char *name, *ic;
142 int iclen;
143
144 for (np = allnodes; np != NULL; np = np->allnext) {
145 ic = get_property(np, "interrupt-controller", &iclen);
146 name = get_property(np, "name", NULL);
147 /* checking iclen makes sure we don't get a false
148 match on /chosen.interrupt_controller */
149 if ((name != NULL
150 && strcmp(name, "interrupt-controller") == 0)
151 || (ic != NULL && iclen == 0 && strcmp(name, "AppleKiwi"))) {
152 if (n == 0)
153 dflt_interrupt_controller = np;
154 ++n;
155 }
156 }
157 num_interrupt_controllers = n;
158 }
159
160 mem = finish_node(allnodes, mem, NULL, 1, 1);
161 dev_tree_size = mem - (unsigned long) allnodes;
162 klimit = (char *) mem;
163}
164
165static unsigned long __init
166finish_node(struct device_node *np, unsigned long mem_start,
167 interpret_func *ifunc, int naddrc, int nsizec)
168{
169 struct device_node *child;
170 int *ip;
171
172 np->name = get_property(np, "name", NULL);
173 np->type = get_property(np, "device_type", NULL);
174
175 if (!np->name)
176 np->name = "<NULL>";
177 if (!np->type)
178 np->type = "<NULL>";
179
180 /* get the device addresses and interrupts */
181 if (ifunc != NULL)
182 mem_start = ifunc(np, mem_start, naddrc, nsizec);
183
184 if (use_of_interrupt_tree)
185 mem_start = finish_node_interrupts(np, mem_start);
186
187 /* Look for #address-cells and #size-cells properties. */
188 ip = (int *) get_property(np, "#address-cells", NULL);
189 if (ip != NULL)
190 naddrc = *ip;
191 ip = (int *) get_property(np, "#size-cells", NULL);
192 if (ip != NULL)
193 nsizec = *ip;
194
195 if (np->parent == NULL)
196 ifunc = interpret_root_props;
197 else if (np->type == 0)
198 ifunc = NULL;
199 else if (!strcmp(np->type, "pci") || !strcmp(np->type, "vci"))
200 ifunc = interpret_pci_props;
201 else if (!strcmp(np->type, "dbdma"))
202 ifunc = interpret_dbdma_props;
203 else if (!strcmp(np->type, "mac-io")
204 || ifunc == interpret_macio_props)
205 ifunc = interpret_macio_props;
206 else if (!strcmp(np->type, "isa"))
207 ifunc = interpret_isa_props;
208 else if (!strcmp(np->name, "uni-n") || !strcmp(np->name, "u3"))
209 ifunc = interpret_root_props;
210 else if (!((ifunc == interpret_dbdma_props
211 || ifunc == interpret_macio_props)
212 && (!strcmp(np->type, "escc")
213 || !strcmp(np->type, "media-bay"))))
214 ifunc = NULL;
215
216 /* if we were booted from BootX, convert the full name */
217 if (boot_infos
218 && strncmp(np->full_name, "Devices:device-tree", 19) == 0) {
219 if (np->full_name[19] == 0) {
220 strcpy(np->full_name, "/");
221 } else if (np->full_name[19] == ':') {
222 char *p = np->full_name + 19;
223 np->full_name = p;
224 for (; *p; ++p)
225 if (*p == ':')
226 *p = '/';
227 }
228 }
229
230 for (child = np->child; child != NULL; child = child->sibling)
231 mem_start = finish_node(child, mem_start, ifunc,
232 naddrc, nsizec);
233
234 return mem_start;
235}
236
237/*
238 * Find the interrupt parent of a node.
239 */
240static struct device_node * __init
241intr_parent(struct device_node *p)
242{
243 phandle *parp;
244
245 parp = (phandle *) get_property(p, "interrupt-parent", NULL);
246 if (parp == NULL)
247 return p->parent;
248 p = find_phandle(*parp);
249 if (p != NULL)
250 return p;
251 /*
252 * On a powermac booted with BootX, we don't get to know the
253 * phandles for any nodes, so find_phandle will return NULL.
254 * Fortunately these machines only have one interrupt controller
255 * so there isn't in fact any ambiguity. -- paulus
256 */
257 if (num_interrupt_controllers == 1)
258 p = dflt_interrupt_controller;
259 return p;
260}
261
262/*
263 * Find out the size of each entry of the interrupts property
264 * for a node.
265 */
266static int __init
267prom_n_intr_cells(struct device_node *np)
268{
269 struct device_node *p;
270 unsigned int *icp;
271
272 for (p = np; (p = intr_parent(p)) != NULL; ) {
273 icp = (unsigned int *)
274 get_property(p, "#interrupt-cells", NULL);
275 if (icp != NULL)
276 return *icp;
277 if (get_property(p, "interrupt-controller", NULL) != NULL
278 || get_property(p, "interrupt-map", NULL) != NULL) {
279 printk("oops, node %s doesn't have #interrupt-cells\n",
280 p->full_name);
281 return 1;
282 }
283 }
284 printk("prom_n_intr_cells failed for %s\n", np->full_name);
285 return 1;
286}
287
288/*
289 * Map an interrupt from a device up to the platform interrupt
290 * descriptor.
291 */
292static int __init
293map_interrupt(unsigned int **irq, struct device_node **ictrler,
294 struct device_node *np, unsigned int *ints, int nintrc)
295{
296 struct device_node *p, *ipar;
297 unsigned int *imap, *imask, *ip;
298 int i, imaplen, match;
299 int newintrc = 1, newaddrc = 1;
300 unsigned int *reg;
301 int naddrc;
302
303 reg = (unsigned int *) get_property(np, "reg", NULL);
304 naddrc = prom_n_addr_cells(np);
305 p = intr_parent(np);
306 while (p != NULL) {
307 if (get_property(p, "interrupt-controller", NULL) != NULL)
308 /* this node is an interrupt controller, stop here */
309 break;
310 imap = (unsigned int *)
311 get_property(p, "interrupt-map", &imaplen);
312 if (imap == NULL) {
313 p = intr_parent(p);
314 continue;
315 }
316 imask = (unsigned int *)
317 get_property(p, "interrupt-map-mask", NULL);
318 if (imask == NULL) {
319 printk("oops, %s has interrupt-map but no mask\n",
320 p->full_name);
321 return 0;
322 }
323 imaplen /= sizeof(unsigned int);
324 match = 0;
325 ipar = NULL;
326 while (imaplen > 0 && !match) {
327 /* check the child-interrupt field */
328 match = 1;
329 for (i = 0; i < naddrc && match; ++i)
330 match = ((reg[i] ^ imap[i]) & imask[i]) == 0;
331 for (; i < naddrc + nintrc && match; ++i)
332 match = ((ints[i-naddrc] ^ imap[i]) & imask[i]) == 0;
333 imap += naddrc + nintrc;
334 imaplen -= naddrc + nintrc;
335 /* grab the interrupt parent */
336 ipar = find_phandle((phandle) *imap++);
337 --imaplen;
338 if (ipar == NULL && num_interrupt_controllers == 1)
339 /* cope with BootX not giving us phandles */
340 ipar = dflt_interrupt_controller;
341 if (ipar == NULL) {
342 printk("oops, no int parent %x in map of %s\n",
343 imap[-1], p->full_name);
344 return 0;
345 }
346 /* find the parent's # addr and intr cells */
347 ip = (unsigned int *)
348 get_property(ipar, "#interrupt-cells", NULL);
349 if (ip == NULL) {
350 printk("oops, no #interrupt-cells on %s\n",
351 ipar->full_name);
352 return 0;
353 }
354 newintrc = *ip;
355 ip = (unsigned int *)
356 get_property(ipar, "#address-cells", NULL);
357 newaddrc = (ip == NULL)? 0: *ip;
358 imap += newaddrc + newintrc;
359 imaplen -= newaddrc + newintrc;
360 }
361 if (imaplen < 0) {
362 printk("oops, error decoding int-map on %s, len=%d\n",
363 p->full_name, imaplen);
364 return 0;
365 }
366 if (!match) {
367 printk("oops, no match in %s int-map for %s\n",
368 p->full_name, np->full_name);
369 return 0;
370 }
371 p = ipar;
372 naddrc = newaddrc;
373 nintrc = newintrc;
374 ints = imap - nintrc;
375 reg = ints - naddrc;
376 }
377 if (p == NULL)
378 printk("hmmm, int tree for %s doesn't have ctrler\n",
379 np->full_name);
380 *irq = ints;
381 *ictrler = p;
382 return nintrc;
383}
384
385/*
386 * New version of finish_node_interrupts.
387 */
388static unsigned long __init
389finish_node_interrupts(struct device_node *np, unsigned long mem_start)
390{
391 unsigned int *ints;
392 int intlen, intrcells;
393 int i, j, n, offset;
394 unsigned int *irq;
395 struct device_node *ic;
396
397 ints = (unsigned int *) get_property(np, "interrupts", &intlen);
398 if (ints == NULL)
399 return mem_start;
400 intrcells = prom_n_intr_cells(np);
401 intlen /= intrcells * sizeof(unsigned int);
402 np->n_intrs = intlen;
403 np->intrs = (struct interrupt_info *) mem_start;
404 mem_start += intlen * sizeof(struct interrupt_info);
405
406 for (i = 0; i < intlen; ++i) {
407 np->intrs[i].line = 0;
408 np->intrs[i].sense = 1;
409 n = map_interrupt(&irq, &ic, np, ints, intrcells);
410 if (n <= 0)
411 continue;
412 offset = 0;
413 /*
414 * On a CHRP we have an 8259 which is subordinate to
415 * the openpic in the interrupt tree, but we want the
416 * openpic's interrupt numbers offsetted, not the 8259's.
417 * So we apply the offset if the controller is at the
418 * root of the interrupt tree, i.e. has no interrupt-parent.
419 * This doesn't cope with the general case of multiple
420 * cascaded interrupt controllers, but then neither will
421 * irq.c at the moment either. -- paulus
422 * The G5 triggers that code, I add a machine test. On
423 * those machines, we want to offset interrupts from the
424 * second openpic by 128 -- BenH
425 */
426 if (num_interrupt_controllers > 1
427 && ic != NULL
428 && get_property(ic, "interrupt-parent", NULL) == NULL)
429 offset = 16;
430
431 np->intrs[i].line = irq[0] + offset;
432 if (n > 1)
433 np->intrs[i].sense = irq[1];
434 if (n > 2) {
435 printk("hmmm, got %d intr cells for %s:", n,
436 np->full_name);
437 for (j = 0; j < n; ++j)
438 printk(" %d", irq[j]);
439 printk("\n");
440 }
441 ints += intrcells;
442 }
443
444 return mem_start;
445}
446
447/*
448 * When BootX makes a copy of the device tree from the MacOS
449 * Name Registry, it is in the format we use but all of the pointers
450 * are offsets from the start of the tree.
451 * This procedure updates the pointers.
452 */
453void __init
454relocate_nodes(void)
455{
456 unsigned long base;
457 struct device_node *np;
458 struct property *pp;
459
460#define ADDBASE(x) (x = (typeof (x))((x)? ((unsigned long)(x) + base): 0))
461
462 base = (unsigned long) boot_infos + boot_infos->deviceTreeOffset;
463 allnodes = (struct device_node *)(base + 4);
464 for (np = allnodes; np != 0; np = np->allnext) {
465 ADDBASE(np->full_name);
466 ADDBASE(np->properties);
467 ADDBASE(np->parent);
468 ADDBASE(np->child);
469 ADDBASE(np->sibling);
470 ADDBASE(np->allnext);
471 for (pp = np->properties; pp != 0; pp = pp->next) {
472 ADDBASE(pp->name);
473 ADDBASE(pp->value);
474 ADDBASE(pp->next);
475 }
476 }
477}
478
479int
480prom_n_addr_cells(struct device_node* np)
481{
482 int* ip;
483 do {
484 if (np->parent)
485 np = np->parent;
486 ip = (int *) get_property(np, "#address-cells", NULL);
487 if (ip != NULL)
488 return *ip;
489 } while (np->parent);
490 /* No #address-cells property for the root node, default to 1 */
491 return 1;
492}
493
494int
495prom_n_size_cells(struct device_node* np)
496{
497 int* ip;
498 do {
499 if (np->parent)
500 np = np->parent;
501 ip = (int *) get_property(np, "#size-cells", NULL);
502 if (ip != NULL)
503 return *ip;
504 } while (np->parent);
505 /* No #size-cells property for the root node, default to 1 */
506 return 1;
507}
508
509static unsigned long __init
510map_addr(struct device_node *np, unsigned long space, unsigned long addr)
511{
512 int na;
513 unsigned int *ranges;
514 int rlen = 0;
515 unsigned int type;
516
517 type = (space >> 24) & 3;
518 if (type == 0)
519 return addr;
520
521 while ((np = np->parent) != NULL) {
522 if (strcmp(np->type, "pci") != 0)
523 continue;
524 /* PCI bridge: map the address through the ranges property */
525 na = prom_n_addr_cells(np);
526 ranges = (unsigned int *) get_property(np, "ranges", &rlen);
527 while ((rlen -= (na + 5) * sizeof(unsigned int)) >= 0) {
528 if (((ranges[0] >> 24) & 3) == type
529 && ranges[2] <= addr
530 && addr - ranges[2] < ranges[na+4]) {
531 /* ok, this matches, translate it */
532 addr += ranges[na+2] - ranges[2];
533 break;
534 }
535 ranges += na + 5;
536 }
537 }
538 return addr;
539}
540
541static unsigned long __init
542interpret_pci_props(struct device_node *np, unsigned long mem_start,
543 int naddrc, int nsizec)
544{
545 struct address_range *adr;
546 struct pci_reg_property *pci_addrs;
547 int i, l, *ip;
548
549 pci_addrs = (struct pci_reg_property *)
550 get_property(np, "assigned-addresses", &l);
551 if (pci_addrs != 0 && l >= sizeof(struct pci_reg_property)) {
552 i = 0;
553 adr = (struct address_range *) mem_start;
554 while ((l -= sizeof(struct pci_reg_property)) >= 0) {
555 adr[i].space = pci_addrs[i].addr.a_hi;
556 adr[i].address = map_addr(np, pci_addrs[i].addr.a_hi,
557 pci_addrs[i].addr.a_lo);
558 adr[i].size = pci_addrs[i].size_lo;
559 ++i;
560 }
561 np->addrs = adr;
562 np->n_addrs = i;
563 mem_start += i * sizeof(struct address_range);
564 }
565
566 if (use_of_interrupt_tree)
567 return mem_start;
568
569 ip = (int *) get_property(np, "AAPL,interrupts", &l);
570 if (ip == 0 && np->parent)
571 ip = (int *) get_property(np->parent, "AAPL,interrupts", &l);
572 if (ip == 0)
573 ip = (int *) get_property(np, "interrupts", &l);
574 if (ip != 0) {
575 np->intrs = (struct interrupt_info *) mem_start;
576 np->n_intrs = l / sizeof(int);
577 mem_start += np->n_intrs * sizeof(struct interrupt_info);
578 for (i = 0; i < np->n_intrs; ++i) {
579 np->intrs[i].line = *ip++;
580 np->intrs[i].sense = 1;
581 }
582 }
583
584 return mem_start;
585}
586
587static unsigned long __init
588interpret_dbdma_props(struct device_node *np, unsigned long mem_start,
589 int naddrc, int nsizec)
590{
591 struct reg_property *rp;
592 struct address_range *adr;
593 unsigned long base_address;
594 int i, l, *ip;
595 struct device_node *db;
596
597 base_address = 0;
598 for (db = np->parent; db != NULL; db = db->parent) {
599 if (!strcmp(db->type, "dbdma") && db->n_addrs != 0) {
600 base_address = db->addrs[0].address;
601 break;
602 }
603 }
604
605 rp = (struct reg_property *) get_property(np, "reg", &l);
606 if (rp != 0 && l >= sizeof(struct reg_property)) {
607 i = 0;
608 adr = (struct address_range *) mem_start;
609 while ((l -= sizeof(struct reg_property)) >= 0) {
610 adr[i].space = 2;
611 adr[i].address = rp[i].address + base_address;
612 adr[i].size = rp[i].size;
613 ++i;
614 }
615 np->addrs = adr;
616 np->n_addrs = i;
617 mem_start += i * sizeof(struct address_range);
618 }
619
620 if (use_of_interrupt_tree)
621 return mem_start;
622
623 ip = (int *) get_property(np, "AAPL,interrupts", &l);
624 if (ip == 0)
625 ip = (int *) get_property(np, "interrupts", &l);
626 if (ip != 0) {
627 np->intrs = (struct interrupt_info *) mem_start;
628 np->n_intrs = l / sizeof(int);
629 mem_start += np->n_intrs * sizeof(struct interrupt_info);
630 for (i = 0; i < np->n_intrs; ++i) {
631 np->intrs[i].line = *ip++;
632 np->intrs[i].sense = 1;
633 }
634 }
635
636 return mem_start;
637}
638
639static unsigned long __init
640interpret_macio_props(struct device_node *np, unsigned long mem_start,
641 int naddrc, int nsizec)
642{
643 struct reg_property *rp;
644 struct address_range *adr;
645 unsigned long base_address;
646 int i, l, *ip;
647 struct device_node *db;
648
649 base_address = 0;
650 for (db = np->parent; db != NULL; db = db->parent) {
651 if (!strcmp(db->type, "mac-io") && db->n_addrs != 0) {
652 base_address = db->addrs[0].address;
653 break;
654 }
655 }
656
657 rp = (struct reg_property *) get_property(np, "reg", &l);
658 if (rp != 0 && l >= sizeof(struct reg_property)) {
659 i = 0;
660 adr = (struct address_range *) mem_start;
661 while ((l -= sizeof(struct reg_property)) >= 0) {
662 adr[i].space = 2;
663 adr[i].address = rp[i].address + base_address;
664 adr[i].size = rp[i].size;
665 ++i;
666 }
667 np->addrs = adr;
668 np->n_addrs = i;
669 mem_start += i * sizeof(struct address_range);
670 }
671
672 if (use_of_interrupt_tree)
673 return mem_start;
674
675 ip = (int *) get_property(np, "interrupts", &l);
676 if (ip == 0)
677 ip = (int *) get_property(np, "AAPL,interrupts", &l);
678 if (ip != 0) {
679 np->intrs = (struct interrupt_info *) mem_start;
680 np->n_intrs = l / sizeof(int);
681 for (i = 0; i < np->n_intrs; ++i) {
682 np->intrs[i].line = *ip++;
683 np->intrs[i].sense = 1;
684 }
685 mem_start += np->n_intrs * sizeof(struct interrupt_info);
686 }
687
688 return mem_start;
689}
690
691static unsigned long __init
692interpret_isa_props(struct device_node *np, unsigned long mem_start,
693 int naddrc, int nsizec)
694{
695 struct isa_reg_property *rp;
696 struct address_range *adr;
697 int i, l, *ip;
698
699 rp = (struct isa_reg_property *) get_property(np, "reg", &l);
700 if (rp != 0 && l >= sizeof(struct isa_reg_property)) {
701 i = 0;
702 adr = (struct address_range *) mem_start;
703 while ((l -= sizeof(struct reg_property)) >= 0) {
704 adr[i].space = rp[i].space;
705 adr[i].address = rp[i].address
706 + (adr[i].space? 0: _ISA_MEM_BASE);
707 adr[i].size = rp[i].size;
708 ++i;
709 }
710 np->addrs = adr;
711 np->n_addrs = i;
712 mem_start += i * sizeof(struct address_range);
713 }
714
715 if (use_of_interrupt_tree)
716 return mem_start;
717
718 ip = (int *) get_property(np, "interrupts", &l);
719 if (ip != 0) {
720 np->intrs = (struct interrupt_info *) mem_start;
721 np->n_intrs = l / (2 * sizeof(int));
722 mem_start += np->n_intrs * sizeof(struct interrupt_info);
723 for (i = 0; i < np->n_intrs; ++i) {
724 np->intrs[i].line = *ip++;
725 np->intrs[i].sense = *ip++;
726 }
727 }
728
729 return mem_start;
730}
731
732static unsigned long __init
733interpret_root_props(struct device_node *np, unsigned long mem_start,
734 int naddrc, int nsizec)
735{
736 struct address_range *adr;
737 int i, l, *ip;
738 unsigned int *rp;
739 int rpsize = (naddrc + nsizec) * sizeof(unsigned int);
740
741 rp = (unsigned int *) get_property(np, "reg", &l);
742 if (rp != 0 && l >= rpsize) {
743 i = 0;
744 adr = (struct address_range *) mem_start;
745 while ((l -= rpsize) >= 0) {
746 adr[i].space = (naddrc >= 2? rp[naddrc-2]: 2);
747 adr[i].address = rp[naddrc - 1];
748 adr[i].size = rp[naddrc + nsizec - 1];
749 ++i;
750 rp += naddrc + nsizec;
751 }
752 np->addrs = adr;
753 np->n_addrs = i;
754 mem_start += i * sizeof(struct address_range);
755 }
756
757 if (use_of_interrupt_tree)
758 return mem_start;
759
760 ip = (int *) get_property(np, "AAPL,interrupts", &l);
761 if (ip == 0)
762 ip = (int *) get_property(np, "interrupts", &l);
763 if (ip != 0) {
764 np->intrs = (struct interrupt_info *) mem_start;
765 np->n_intrs = l / sizeof(int);
766 mem_start += np->n_intrs * sizeof(struct interrupt_info);
767 for (i = 0; i < np->n_intrs; ++i) {
768 np->intrs[i].line = *ip++;
769 np->intrs[i].sense = 1;
770 }
771 }
772
773 return mem_start;
774}
775
776/*
777 * Work out the sense (active-low level / active-high edge)
778 * of each interrupt from the device tree.
779 */
780void __init
781prom_get_irq_senses(unsigned char *senses, int off, int max)
782{
783 struct device_node *np;
784 int i, j;
785
786 /* default to level-triggered */
787 memset(senses, 1, max - off);
788 if (!use_of_interrupt_tree)
789 return;
790
791 for (np = allnodes; np != 0; np = np->allnext) {
792 for (j = 0; j < np->n_intrs; j++) {
793 i = np->intrs[j].line;
794 if (i >= off && i < max) {
795 if (np->intrs[j].sense == 1)
796 senses[i-off] = (IRQ_SENSE_LEVEL
797 | IRQ_POLARITY_NEGATIVE);
798 else
799 senses[i-off] = (IRQ_SENSE_EDGE
800 | IRQ_POLARITY_POSITIVE);
801 }
802 }
803 }
804}
805
806/*
807 * Construct and return a list of the device_nodes with a given name.
808 */
809struct device_node *
810find_devices(const char *name)
811{
812 struct device_node *head, **prevp, *np;
813
814 prevp = &head;
815 for (np = allnodes; np != 0; np = np->allnext) {
816 if (np->name != 0 && strcasecmp(np->name, name) == 0) {
817 *prevp = np;
818 prevp = &np->next;
819 }
820 }
821 *prevp = NULL;
822 return head;
823}
824
825/*
826 * Construct and return a list of the device_nodes with a given type.
827 */
828struct device_node *
829find_type_devices(const char *type)
830{
831 struct device_node *head, **prevp, *np;
832
833 prevp = &head;
834 for (np = allnodes; np != 0; np = np->allnext) {
835 if (np->type != 0 && strcasecmp(np->type, type) == 0) {
836 *prevp = np;
837 prevp = &np->next;
838 }
839 }
840 *prevp = NULL;
841 return head;
842}
843
844/*
845 * Returns all nodes linked together
846 */
847struct device_node *
848find_all_nodes(void)
849{
850 struct device_node *head, **prevp, *np;
851
852 prevp = &head;
853 for (np = allnodes; np != 0; np = np->allnext) {
854 *prevp = np;
855 prevp = &np->next;
856 }
857 *prevp = NULL;
858 return head;
859}
860
861/* Checks if the given "compat" string matches one of the strings in
862 * the device's "compatible" property
863 */
864int
865device_is_compatible(struct device_node *device, const char *compat)
866{
867 const char* cp;
868 int cplen, l;
869
870 cp = (char *) get_property(device, "compatible", &cplen);
871 if (cp == NULL)
872 return 0;
873 while (cplen > 0) {
874 if (strncasecmp(cp, compat, strlen(compat)) == 0)
875 return 1;
876 l = strlen(cp) + 1;
877 cp += l;
878 cplen -= l;
879 }
880
881 return 0;
882}
883
884
885/*
886 * Indicates whether the root node has a given value in its
887 * compatible property.
888 */
889int
890machine_is_compatible(const char *compat)
891{
892 struct device_node *root;
893
894 root = find_path_device("/");
895 if (root == 0)
896 return 0;
897 return device_is_compatible(root, compat);
898}
899
900/*
901 * Construct and return a list of the device_nodes with a given type
902 * and compatible property.
903 */
904struct device_node *
905find_compatible_devices(const char *type, const char *compat)
906{
907 struct device_node *head, **prevp, *np;
908
909 prevp = &head;
910 for (np = allnodes; np != 0; np = np->allnext) {
911 if (type != NULL
912 && !(np->type != 0 && strcasecmp(np->type, type) == 0))
913 continue;
914 if (device_is_compatible(np, compat)) {
915 *prevp = np;
916 prevp = &np->next;
917 }
918 }
919 *prevp = NULL;
920 return head;
921}
922
923/*
924 * Find the device_node with a given full_name.
925 */
926struct device_node *
927find_path_device(const char *path)
928{
929 struct device_node *np;
930
931 for (np = allnodes; np != 0; np = np->allnext)
932 if (np->full_name != 0 && strcasecmp(np->full_name, path) == 0)
933 return np;
934 return NULL;
935}
936
937/*******
938 *
939 * New implementation of the OF "find" APIs, return a refcounted
940 * object, call of_node_put() when done. Currently, still lacks
941 * locking as old implementation, this is beeing done for ppc64.
942 *
943 * Note that property management will need some locking as well,
944 * this isn't dealt with yet
945 *
946 *******/
947
948/**
949 * of_find_node_by_name - Find a node by it's "name" property
950 * @from: The node to start searching from or NULL, the node
951 * you pass will not be searched, only the next one
952 * will; typically, you pass what the previous call
953 * returned. of_node_put() will be called on it
954 * @name: The name string to match against
955 *
956 * Returns a node pointer with refcount incremented, use
957 * of_node_put() on it when done.
958 */
959struct device_node *of_find_node_by_name(struct device_node *from,
960 const char *name)
961{
962 struct device_node *np = from ? from->allnext : allnodes;
963
964 for (; np != 0; np = np->allnext)
965 if (np->name != 0 && strcasecmp(np->name, name) == 0)
966 break;
967 if (from)
968 of_node_put(from);
969 return of_node_get(np);
970}
971
972/**
973 * of_find_node_by_type - Find a node by it's "device_type" property
974 * @from: The node to start searching from or NULL, the node
975 * you pass will not be searched, only the next one
976 * will; typically, you pass what the previous call
977 * returned. of_node_put() will be called on it
978 * @name: The type string to match against
979 *
980 * Returns a node pointer with refcount incremented, use
981 * of_node_put() on it when done.
982 */
983struct device_node *of_find_node_by_type(struct device_node *from,
984 const char *type)
985{
986 struct device_node *np = from ? from->allnext : allnodes;
987
988 for (; np != 0; np = np->allnext)
989 if (np->type != 0 && strcasecmp(np->type, type) == 0)
990 break;
991 if (from)
992 of_node_put(from);
993 return of_node_get(np);
994}
995
996/**
997 * of_find_compatible_node - Find a node based on type and one of the
998 * tokens in it's "compatible" property
999 * @from: The node to start searching from or NULL, the node
1000 * you pass will not be searched, only the next one
1001 * will; typically, you pass what the previous call
1002 * returned. of_node_put() will be called on it
1003 * @type: The type string to match "device_type" or NULL to ignore
1004 * @compatible: The string to match to one of the tokens in the device
1005 * "compatible" list.
1006 *
1007 * Returns a node pointer with refcount incremented, use
1008 * of_node_put() on it when done.
1009 */
1010struct device_node *of_find_compatible_node(struct device_node *from,
1011 const char *type, const char *compatible)
1012{
1013 struct device_node *np = from ? from->allnext : allnodes;
1014
1015 for (; np != 0; np = np->allnext) {
1016 if (type != NULL
1017 && !(np->type != 0 && strcasecmp(np->type, type) == 0))
1018 continue;
1019 if (device_is_compatible(np, compatible))
1020 break;
1021 }
1022 if (from)
1023 of_node_put(from);
1024 return of_node_get(np);
1025}
1026
1027/**
1028 * of_find_node_by_path - Find a node matching a full OF path
1029 * @path: The full path to match
1030 *
1031 * Returns a node pointer with refcount incremented, use
1032 * of_node_put() on it when done.
1033 */
1034struct device_node *of_find_node_by_path(const char *path)
1035{
1036 struct device_node *np = allnodes;
1037
1038 for (; np != 0; np = np->allnext)
1039 if (np->full_name != 0 && strcasecmp(np->full_name, path) == 0)
1040 break;
1041 return of_node_get(np);
1042}
1043
1044/**
1045 * of_find_all_nodes - Get next node in global list
1046 * @prev: Previous node or NULL to start iteration
1047 * of_node_put() will be called on it
1048 *
1049 * Returns a node pointer with refcount incremented, use
1050 * of_node_put() on it when done.
1051 */
1052struct device_node *of_find_all_nodes(struct device_node *prev)
1053{
1054 return of_node_get(prev ? prev->allnext : allnodes);
1055}
1056
1057/**
1058 * of_get_parent - Get a node's parent if any
1059 * @node: Node to get parent
1060 *
1061 * Returns a node pointer with refcount incremented, use
1062 * of_node_put() on it when done.
1063 */
1064struct device_node *of_get_parent(const struct device_node *node)
1065{
1066 return node ? of_node_get(node->parent) : NULL;
1067}
1068
1069/**
1070 * of_get_next_child - Iterate a node childs
1071 * @node: parent node
1072 * @prev: previous child of the parent node, or NULL to get first
1073 *
1074 * Returns a node pointer with refcount incremented, use
1075 * of_node_put() on it when done.
1076 */
1077struct device_node *of_get_next_child(const struct device_node *node,
1078 struct device_node *prev)
1079{
1080 struct device_node *next = prev ? prev->sibling : node->child;
1081
1082 for (; next != 0; next = next->sibling)
1083 if (of_node_get(next))
1084 break;
1085 if (prev)
1086 of_node_put(prev);
1087 return next;
1088}
1089
1090/**
1091 * of_node_get - Increment refcount of a node
1092 * @node: Node to inc refcount, NULL is supported to
1093 * simplify writing of callers
1094 *
1095 * Returns the node itself or NULL if gone. Current implementation
1096 * does nothing as we don't yet do dynamic node allocation on ppc32
1097 */
1098struct device_node *of_node_get(struct device_node *node)
1099{
1100 return node;
1101}
1102
1103/**
1104 * of_node_put - Decrement refcount of a node
1105 * @node: Node to dec refcount, NULL is supported to
1106 * simplify writing of callers
1107 *
1108 * Current implementation does nothing as we don't yet do dynamic node
1109 * allocation on ppc32
1110 */
1111void of_node_put(struct device_node *node)
1112{
1113}
1114
1115/*
1116 * Find the device_node with a given phandle.
1117 */
1118static struct device_node * __init
1119find_phandle(phandle ph)
1120{
1121 struct device_node *np;
1122
1123 for (np = allnodes; np != 0; np = np->allnext)
1124 if (np->node == ph)
1125 return np;
1126 return NULL;
1127}
1128
1129/*
1130 * Find a property with a given name for a given node
1131 * and return the value.
1132 */
1133unsigned char *
1134get_property(struct device_node *np, const char *name, int *lenp)
1135{
1136 struct property *pp;
1137
1138 for (pp = np->properties; pp != 0; pp = pp->next)
1139 if (pp->name != NULL && strcmp(pp->name, name) == 0) {
1140 if (lenp != 0)
1141 *lenp = pp->length;
1142 return pp->value;
1143 }
1144 return NULL;
1145}
1146
1147/*
1148 * Add a property to a node
1149 */
1150int
1151prom_add_property(struct device_node* np, struct property* prop)
1152{
1153 struct property **next = &np->properties;
1154
1155 prop->next = NULL;
1156 while (*next)
1157 next = &(*next)->next;
1158 *next = prop;
1159
1160 return 0;
1161}
1162
1163/* I quickly hacked that one, check against spec ! */
1164static inline unsigned long
1165bus_space_to_resource_flags(unsigned int bus_space)
1166{
1167 u8 space = (bus_space >> 24) & 0xf;
1168 if (space == 0)
1169 space = 0x02;
1170 if (space == 0x02)
1171 return IORESOURCE_MEM;
1172 else if (space == 0x01)
1173 return IORESOURCE_IO;
1174 else {
1175 printk(KERN_WARNING "prom.c: bus_space_to_resource_flags(), space: %x\n",
1176 bus_space);
1177 return 0;
1178 }
1179}
1180
1181static struct resource*
1182find_parent_pci_resource(struct pci_dev* pdev, struct address_range *range)
1183{
1184 unsigned long mask;
1185 int i;
1186
1187 /* Check this one */
1188 mask = bus_space_to_resource_flags(range->space);
1189 for (i=0; i<DEVICE_COUNT_RESOURCE; i++) {
1190 if ((pdev->resource[i].flags & mask) == mask &&
1191 pdev->resource[i].start <= range->address &&
1192 pdev->resource[i].end > range->address) {
1193 if ((range->address + range->size - 1) > pdev->resource[i].end) {
1194 /* Add better message */
1195 printk(KERN_WARNING "PCI/OF resource overlap !\n");
1196 return NULL;
1197 }
1198 break;
1199 }
1200 }
1201 if (i == DEVICE_COUNT_RESOURCE)
1202 return NULL;
1203 return &pdev->resource[i];
1204}
1205
1206/*
1207 * Request an OF device resource. Currently handles child of PCI devices,
1208 * or other nodes attached to the root node. Ultimately, put some
1209 * link to resources in the OF node.
1210 */
1211struct resource*
1212request_OF_resource(struct device_node* node, int index, const char* name_postfix)
1213{
1214 struct pci_dev* pcidev;
1215 u8 pci_bus, pci_devfn;
1216 unsigned long iomask;
1217 struct device_node* nd;
1218 struct resource* parent;
1219 struct resource *res = NULL;
1220 int nlen, plen;
1221
1222 if (index >= node->n_addrs)
1223 goto fail;
1224
1225 /* Sanity check on bus space */
1226 iomask = bus_space_to_resource_flags(node->addrs[index].space);
1227 if (iomask & IORESOURCE_MEM)
1228 parent = &iomem_resource;
1229 else if (iomask & IORESOURCE_IO)
1230 parent = &ioport_resource;
1231 else
1232 goto fail;
1233
1234 /* Find a PCI parent if any */
1235 nd = node;
1236 pcidev = NULL;
1237 while(nd) {
1238 if (!pci_device_from_OF_node(nd, &pci_bus, &pci_devfn))
1239 pcidev = pci_find_slot(pci_bus, pci_devfn);
1240 if (pcidev) break;
1241 nd = nd->parent;
1242 }
1243 if (pcidev)
1244 parent = find_parent_pci_resource(pcidev, &node->addrs[index]);
1245 if (!parent) {
1246 printk(KERN_WARNING "request_OF_resource(%s), parent not found\n",
1247 node->name);
1248 goto fail;
1249 }
1250
1251 res = __request_region(parent, node->addrs[index].address, node->addrs[index].size, NULL);
1252 if (!res)
1253 goto fail;
1254 nlen = strlen(node->name);
1255 plen = name_postfix ? strlen(name_postfix) : 0;
1256 res->name = (const char *)kmalloc(nlen+plen+1, GFP_KERNEL);
1257 if (res->name) {
1258 strcpy((char *)res->name, node->name);
1259 if (plen)
1260 strcpy((char *)res->name+nlen, name_postfix);
1261 }
1262 return res;
1263fail:
1264 return NULL;
1265}
1266
1267int
1268release_OF_resource(struct device_node* node, int index)
1269{
1270 struct pci_dev* pcidev;
1271 u8 pci_bus, pci_devfn;
1272 unsigned long iomask, start, end;
1273 struct device_node* nd;
1274 struct resource* parent;
1275 struct resource *res = NULL;
1276
1277 if (index >= node->n_addrs)
1278 return -EINVAL;
1279
1280 /* Sanity check on bus space */
1281 iomask = bus_space_to_resource_flags(node->addrs[index].space);
1282 if (iomask & IORESOURCE_MEM)
1283 parent = &iomem_resource;
1284 else if (iomask & IORESOURCE_IO)
1285 parent = &ioport_resource;
1286 else
1287 return -EINVAL;
1288
1289 /* Find a PCI parent if any */
1290 nd = node;
1291 pcidev = NULL;
1292 while(nd) {
1293 if (!pci_device_from_OF_node(nd, &pci_bus, &pci_devfn))
1294 pcidev = pci_find_slot(pci_bus, pci_devfn);
1295 if (pcidev) break;
1296 nd = nd->parent;
1297 }
1298 if (pcidev)
1299 parent = find_parent_pci_resource(pcidev, &node->addrs[index]);
1300 if (!parent) {
1301 printk(KERN_WARNING "release_OF_resource(%s), parent not found\n",
1302 node->name);
1303 return -ENODEV;
1304 }
1305
1306 /* Find us in the parent and its childs */
1307 res = parent->child;
1308 start = node->addrs[index].address;
1309 end = start + node->addrs[index].size - 1;
1310 while (res) {
1311 if (res->start == start && res->end == end &&
1312 (res->flags & IORESOURCE_BUSY))
1313 break;
1314 if (res->start <= start && res->end >= end)
1315 res = res->child;
1316 else
1317 res = res->sibling;
1318 }
1319 if (!res)
1320 return -ENODEV;
1321
1322 kfree(res->name);
1323 res->name = NULL;
1324 release_resource(res);
1325 kfree(res);
1326
1327 return 0;
1328}
1329
1330#if 0
1331void
1332print_properties(struct device_node *np)
1333{
1334 struct property *pp;
1335 char *cp;
1336 int i, n;
1337
1338 for (pp = np->properties; pp != 0; pp = pp->next) {
1339 printk(KERN_INFO "%s", pp->name);
1340 for (i = strlen(pp->name); i < 16; ++i)
1341 printk(" ");
1342 cp = (char *) pp->value;
1343 for (i = pp->length; i > 0; --i, ++cp)
1344 if ((i > 1 && (*cp < 0x20 || *cp > 0x7e))
1345 || (i == 1 && *cp != 0))
1346 break;
1347 if (i == 0 && pp->length > 1) {
1348 /* looks like a string */
1349 printk(" %s\n", (char *) pp->value);
1350 } else {
1351 /* dump it in hex */
1352 n = pp->length;
1353 if (n > 64)
1354 n = 64;
1355 if (pp->length % 4 == 0) {
1356 unsigned int *p = (unsigned int *) pp->value;
1357
1358 n /= 4;
1359 for (i = 0; i < n; ++i) {
1360 if (i != 0 && (i % 4) == 0)
1361 printk("\n ");
1362 printk(" %08x", *p++);
1363 }
1364 } else {
1365 unsigned char *bp = pp->value;
1366
1367 for (i = 0; i < n; ++i) {
1368 if (i != 0 && (i % 16) == 0)
1369 printk("\n ");
1370 printk(" %02x", *bp++);
1371 }
1372 }
1373 printk("\n");
1374 if (pp->length > 64)
1375 printk(" ... (length = %d)\n",
1376 pp->length);
1377 }
1378 }
1379}
1380#endif
1381
1382static DEFINE_SPINLOCK(rtas_lock);
1383
1384/* this can be called after setup -- Cort */
1385int
1386call_rtas(const char *service, int nargs, int nret,
1387 unsigned long *outputs, ...)
1388{
1389 va_list list;
1390 int i;
1391 unsigned long s;
1392 struct device_node *rtas;
1393 int *tokp;
1394 union {
1395 unsigned long words[16];
1396 double align;
1397 } u;
1398
1399 rtas = find_devices("rtas");
1400 if (rtas == NULL)
1401 return -1;
1402 tokp = (int *) get_property(rtas, service, NULL);
1403 if (tokp == NULL) {
1404 printk(KERN_ERR "No RTAS service called %s\n", service);
1405 return -1;
1406 }
1407 u.words[0] = *tokp;
1408 u.words[1] = nargs;
1409 u.words[2] = nret;
1410 va_start(list, outputs);
1411 for (i = 0; i < nargs; ++i)
1412 u.words[i+3] = va_arg(list, unsigned long);
1413 va_end(list);
1414
1415 /*
1416 * RTAS doesn't use floating point.
1417 * Or at least, according to the CHRP spec we enter RTAS
1418 * with FP disabled, and it doesn't change the FP registers.
1419 * -- paulus.
1420 */
1421 spin_lock_irqsave(&rtas_lock, s);
1422 enter_rtas((void *)__pa(&u));
1423 spin_unlock_irqrestore(&rtas_lock, s);
1424
1425 if (nret > 1 && outputs != NULL)
1426 for (i = 0; i < nret-1; ++i)
1427 outputs[i] = u.words[i+nargs+4];
1428 return u.words[nargs+3];
1429}
diff --git a/arch/ppc/syslib/prom_init.c b/arch/ppc/syslib/prom_init.c
deleted file mode 100644
index df14422ae1c6..000000000000
--- a/arch/ppc/syslib/prom_init.c
+++ /dev/null
@@ -1,1011 +0,0 @@
1/*
2 * Note that prom_init() and anything called from prom_init()
3 * may be running at an address that is different from the address
4 * that it was linked at. References to static data items are
5 * handled by compiling this file with -mrelocatable-lib.
6 */
7
8#include <linux/config.h>
9#include <linux/kernel.h>
10#include <linux/string.h>
11#include <linux/init.h>
12#include <linux/threads.h>
13#include <linux/spinlock.h>
14#include <linux/ioport.h>
15#include <linux/pci.h>
16#include <linux/slab.h>
17#include <linux/bitops.h>
18
19#include <asm/sections.h>
20#include <asm/prom.h>
21#include <asm/page.h>
22#include <asm/irq.h>
23#include <asm/io.h>
24#include <asm/smp.h>
25#include <asm/bootx.h>
26#include <asm/system.h>
27#include <asm/mmu.h>
28#include <asm/pgtable.h>
29#include <asm/bootinfo.h>
30#include <asm/btext.h>
31#include <asm/pci-bridge.h>
32#include <asm/open_pic.h>
33#include <asm/cacheflush.h>
34
35#ifdef CONFIG_LOGO_LINUX_CLUT224
36#include <linux/linux_logo.h>
37extern const struct linux_logo logo_linux_clut224;
38#endif
39
40/*
41 * Properties whose value is longer than this get excluded from our
42 * copy of the device tree. This way we don't waste space storing
43 * things like "driver,AAPL,MacOS,PowerPC" properties. But this value
44 * does need to be big enough to ensure that we don't lose things
45 * like the interrupt-map property on a PCI-PCI bridge.
46 */
47#define MAX_PROPERTY_LENGTH 4096
48
49#ifndef FB_MAX /* avoid pulling in all of the fb stuff */
50#define FB_MAX 8
51#endif
52
53#define ALIGNUL(x) (((x) + sizeof(unsigned long)-1) & -sizeof(unsigned long))
54
55typedef u32 prom_arg_t;
56
57struct prom_args {
58 const char *service;
59 int nargs;
60 int nret;
61 prom_arg_t args[10];
62};
63
64struct pci_address {
65 unsigned a_hi;
66 unsigned a_mid;
67 unsigned a_lo;
68};
69
70struct pci_reg_property {
71 struct pci_address addr;
72 unsigned size_hi;
73 unsigned size_lo;
74};
75
76struct pci_range {
77 struct pci_address addr;
78 unsigned phys;
79 unsigned size_hi;
80 unsigned size_lo;
81};
82
83struct isa_reg_property {
84 unsigned space;
85 unsigned address;
86 unsigned size;
87};
88
89struct pci_intr_map {
90 struct pci_address addr;
91 unsigned dunno;
92 phandle int_ctrler;
93 unsigned intr;
94};
95
96static void prom_exit(void);
97static int call_prom(const char *service, int nargs, int nret, ...);
98static int call_prom_ret(const char *service, int nargs, int nret,
99 prom_arg_t *rets, ...);
100static void prom_print_hex(unsigned int v);
101static int prom_set_color(ihandle ih, int i, int r, int g, int b);
102static int prom_next_node(phandle *nodep);
103static unsigned long check_display(unsigned long mem);
104static void setup_disp_fake_bi(ihandle dp);
105static unsigned long copy_device_tree(unsigned long mem_start,
106 unsigned long mem_end);
107static unsigned long inspect_node(phandle node, struct device_node *dad,
108 unsigned long mem_start, unsigned long mem_end,
109 struct device_node ***allnextpp);
110static void prom_hold_cpus(unsigned long mem);
111static void prom_instantiate_rtas(void);
112static void * early_get_property(unsigned long base, unsigned long node,
113 char *prop);
114
115prom_entry prom __initdata;
116ihandle prom_chosen __initdata;
117ihandle prom_stdout __initdata;
118
119static char *prom_display_paths[FB_MAX] __initdata;
120static phandle prom_display_nodes[FB_MAX] __initdata;
121static unsigned int prom_num_displays __initdata;
122static ihandle prom_disp_node __initdata;
123char *of_stdout_device __initdata;
124
125unsigned int rtas_data; /* physical pointer */
126unsigned int rtas_entry; /* physical pointer */
127unsigned int rtas_size;
128unsigned int old_rtas;
129
130boot_infos_t *boot_infos;
131char *bootpath;
132char *bootdevice;
133struct device_node *allnodes;
134
135extern char *klimit;
136
137static void __init
138prom_exit(void)
139{
140 struct prom_args args;
141
142 args.service = "exit";
143 args.nargs = 0;
144 args.nret = 0;
145 prom(&args);
146 for (;;) /* should never get here */
147 ;
148}
149
150static int __init
151call_prom(const char *service, int nargs, int nret, ...)
152{
153 va_list list;
154 int i;
155 struct prom_args prom_args;
156
157 prom_args.service = service;
158 prom_args.nargs = nargs;
159 prom_args.nret = nret;
160 va_start(list, nret);
161 for (i = 0; i < nargs; ++i)
162 prom_args.args[i] = va_arg(list, prom_arg_t);
163 va_end(list);
164 for (i = 0; i < nret; ++i)
165 prom_args.args[i + nargs] = 0;
166 prom(&prom_args);
167 return prom_args.args[nargs];
168}
169
170static int __init
171call_prom_ret(const char *service, int nargs, int nret, prom_arg_t *rets, ...)
172{
173 va_list list;
174 int i;
175 struct prom_args prom_args;
176
177 prom_args.service = service;
178 prom_args.nargs = nargs;
179 prom_args.nret = nret;
180 va_start(list, rets);
181 for (i = 0; i < nargs; ++i)
182 prom_args.args[i] = va_arg(list, int);
183 va_end(list);
184 for (i = 0; i < nret; ++i)
185 prom_args.args[i + nargs] = 0;
186 prom(&prom_args);
187 for (i = 1; i < nret; ++i)
188 rets[i-1] = prom_args.args[nargs + i];
189 return prom_args.args[nargs];
190}
191
192void __init
193prom_print(const char *msg)
194{
195 const char *p, *q;
196
197 if (prom_stdout == 0)
198 return;
199
200 for (p = msg; *p != 0; p = q) {
201 for (q = p; *q != 0 && *q != '\n'; ++q)
202 ;
203 if (q > p)
204 call_prom("write", 3, 1, prom_stdout, p, q - p);
205 if (*q != 0) {
206 ++q;
207 call_prom("write", 3, 1, prom_stdout, "\r\n", 2);
208 }
209 }
210}
211
212static void __init
213prom_print_hex(unsigned int v)
214{
215 char buf[16];
216 int i, c;
217
218 for (i = 0; i < 8; ++i) {
219 c = (v >> ((7-i)*4)) & 0xf;
220 c += (c >= 10)? ('a' - 10): '0';
221 buf[i] = c;
222 }
223 buf[i] = ' ';
224 buf[i+1] = 0;
225 prom_print(buf);
226}
227
228static int __init
229prom_set_color(ihandle ih, int i, int r, int g, int b)
230{
231 return call_prom("call-method", 6, 1, "color!", ih, i, b, g, r);
232}
233
234static int __init
235prom_next_node(phandle *nodep)
236{
237 phandle node;
238
239 if ((node = *nodep) != 0
240 && (*nodep = call_prom("child", 1, 1, node)) != 0)
241 return 1;
242 if ((*nodep = call_prom("peer", 1, 1, node)) != 0)
243 return 1;
244 for (;;) {
245 if ((node = call_prom("parent", 1, 1, node)) == 0)
246 return 0;
247 if ((*nodep = call_prom("peer", 1, 1, node)) != 0)
248 return 1;
249 }
250}
251
252#ifdef CONFIG_POWER4
253/*
254 * Set up a hash table with a set of entries in it to map the
255 * first 64MB of RAM. This is used on 64-bit machines since
256 * some of them don't have BATs.
257 */
258
259static inline void make_pte(unsigned long htab, unsigned int hsize,
260 unsigned int va, unsigned int pa, int mode)
261{
262 unsigned int *pteg;
263 unsigned int hash, i, vsid;
264
265 vsid = ((va >> 28) * 0x111) << 12;
266 hash = ((va ^ vsid) >> 5) & 0x7fff80;
267 pteg = (unsigned int *)(htab + (hash & (hsize - 1)));
268 for (i = 0; i < 8; ++i, pteg += 4) {
269 if ((pteg[1] & 1) == 0) {
270 pteg[1] = vsid | ((va >> 16) & 0xf80) | 1;
271 pteg[3] = pa | mode;
272 break;
273 }
274 }
275}
276
277extern unsigned long _SDR1;
278extern PTE *Hash;
279extern unsigned long Hash_size;
280
281static void __init
282prom_alloc_htab(void)
283{
284 unsigned int hsize;
285 unsigned long htab;
286 unsigned int addr;
287
288 /*
289 * Because of OF bugs we can't use the "claim" client
290 * interface to allocate memory for the hash table.
291 * This code is only used on 64-bit PPCs, and the only
292 * 64-bit PPCs at the moment are RS/6000s, and their
293 * OF is based at 0xc00000 (the 12M point), so we just
294 * arbitrarily use the 0x800000 - 0xc00000 region for the
295 * hash table.
296 * -- paulus.
297 */
298 hsize = 4 << 20; /* POWER4 has no BATs */
299 htab = (8 << 20);
300 call_prom("claim", 3, 1, htab, hsize, 0);
301 Hash = (void *)(htab + KERNELBASE);
302 Hash_size = hsize;
303 _SDR1 = htab + __ilog2(hsize) - 18;
304
305 /*
306 * Put in PTEs for the first 64MB of RAM
307 */
308 memset((void *)htab, 0, hsize);
309 for (addr = 0; addr < 0x4000000; addr += 0x1000)
310 make_pte(htab, hsize, addr + KERNELBASE, addr,
311 _PAGE_ACCESSED | _PAGE_COHERENT | PP_RWXX);
312#if 0 /* DEBUG stuff mapping the SCC */
313 make_pte(htab, hsize, 0x80013000, 0x80013000,
314 _PAGE_ACCESSED | _PAGE_NO_CACHE | _PAGE_GUARDED | PP_RWXX);
315#endif
316}
317#endif /* CONFIG_POWER4 */
318
319
320/*
321 * If we have a display that we don't know how to drive,
322 * we will want to try to execute OF's open method for it
323 * later. However, OF will probably fall over if we do that
324 * we've taken over the MMU.
325 * So we check whether we will need to open the display,
326 * and if so, open it now.
327 */
328static unsigned long __init
329check_display(unsigned long mem)
330{
331 phandle node;
332 ihandle ih;
333 int i, j;
334 char type[16], *path;
335 static unsigned char default_colors[] = {
336 0x00, 0x00, 0x00,
337 0x00, 0x00, 0xaa,
338 0x00, 0xaa, 0x00,
339 0x00, 0xaa, 0xaa,
340 0xaa, 0x00, 0x00,
341 0xaa, 0x00, 0xaa,
342 0xaa, 0xaa, 0x00,
343 0xaa, 0xaa, 0xaa,
344 0x55, 0x55, 0x55,
345 0x55, 0x55, 0xff,
346 0x55, 0xff, 0x55,
347 0x55, 0xff, 0xff,
348 0xff, 0x55, 0x55,
349 0xff, 0x55, 0xff,
350 0xff, 0xff, 0x55,
351 0xff, 0xff, 0xff
352 };
353 const unsigned char *clut;
354
355 prom_disp_node = 0;
356
357 for (node = 0; prom_next_node(&node); ) {
358 type[0] = 0;
359 call_prom("getprop", 4, 1, node, "device_type",
360 type, sizeof(type));
361 if (strcmp(type, "display") != 0)
362 continue;
363 /* It seems OF doesn't null-terminate the path :-( */
364 path = (char *) mem;
365 memset(path, 0, 256);
366 if (call_prom("package-to-path", 3, 1, node, path, 255) < 0)
367 continue;
368
369 /*
370 * If this display is the device that OF is using for stdout,
371 * move it to the front of the list.
372 */
373 mem += strlen(path) + 1;
374 i = prom_num_displays++;
375 if (of_stdout_device != 0 && i > 0
376 && strcmp(of_stdout_device, path) == 0) {
377 for (; i > 0; --i) {
378 prom_display_paths[i]
379 = prom_display_paths[i-1];
380 prom_display_nodes[i]
381 = prom_display_nodes[i-1];
382 }
383 }
384 prom_display_paths[i] = path;
385 prom_display_nodes[i] = node;
386 if (i == 0)
387 prom_disp_node = node;
388 if (prom_num_displays >= FB_MAX)
389 break;
390 }
391
392 for (j=0; j<prom_num_displays; j++) {
393 path = prom_display_paths[j];
394 node = prom_display_nodes[j];
395 prom_print("opening display ");
396 prom_print(path);
397 ih = call_prom("open", 1, 1, path);
398 if (ih == 0 || ih == (ihandle) -1) {
399 prom_print("... failed\n");
400 for (i=j+1; i<prom_num_displays; i++) {
401 prom_display_paths[i-1] = prom_display_paths[i];
402 prom_display_nodes[i-1] = prom_display_nodes[i];
403 }
404 if (--prom_num_displays > 0) {
405 prom_disp_node = prom_display_nodes[j];
406 j--;
407 } else
408 prom_disp_node = 0;
409 continue;
410 } else {
411 prom_print("... ok\n");
412 call_prom("setprop", 4, 1, node, "linux,opened", 0, 0);
413
414 /*
415 * Setup a usable color table when the appropriate
416 * method is available.
417 * Should update this to use set-colors.
418 */
419 clut = default_colors;
420 for (i = 0; i < 32; i++, clut += 3)
421 if (prom_set_color(ih, i, clut[0], clut[1],
422 clut[2]) != 0)
423 break;
424
425#ifdef CONFIG_LOGO_LINUX_CLUT224
426 clut = PTRRELOC(logo_linux_clut224.clut);
427 for (i = 0; i < logo_linux_clut224.clutsize;
428 i++, clut += 3)
429 if (prom_set_color(ih, i + 32, clut[0],
430 clut[1], clut[2]) != 0)
431 break;
432#endif /* CONFIG_LOGO_LINUX_CLUT224 */
433 }
434 }
435
436 if (prom_stdout) {
437 phandle p;
438 p = call_prom("instance-to-package", 1, 1, prom_stdout);
439 if (p && p != -1) {
440 type[0] = 0;
441 call_prom("getprop", 4, 1, p, "device_type",
442 type, sizeof(type));
443 if (strcmp(type, "display") == 0)
444 call_prom("setprop", 4, 1, p, "linux,boot-display",
445 0, 0);
446 }
447 }
448
449 return ALIGNUL(mem);
450}
451
452/* This function will enable the early boot text when doing OF booting. This
453 * way, xmon output should work too
454 */
455static void __init
456setup_disp_fake_bi(ihandle dp)
457{
458#ifdef CONFIG_BOOTX_TEXT
459 int width = 640, height = 480, depth = 8, pitch;
460 unsigned address;
461 struct pci_reg_property addrs[8];
462 int i, naddrs;
463 char name[32];
464 char *getprop = "getprop";
465
466 prom_print("Initializing fake screen: ");
467
468 memset(name, 0, sizeof(name));
469 call_prom(getprop, 4, 1, dp, "name", name, sizeof(name));
470 name[sizeof(name)-1] = 0;
471 prom_print(name);
472 prom_print("\n");
473 call_prom(getprop, 4, 1, dp, "width", &width, sizeof(width));
474 call_prom(getprop, 4, 1, dp, "height", &height, sizeof(height));
475 call_prom(getprop, 4, 1, dp, "depth", &depth, sizeof(depth));
476 pitch = width * ((depth + 7) / 8);
477 call_prom(getprop, 4, 1, dp, "linebytes",
478 &pitch, sizeof(pitch));
479 if (pitch == 1)
480 pitch = 0x1000; /* for strange IBM display */
481 address = 0;
482 call_prom(getprop, 4, 1, dp, "address",
483 &address, sizeof(address));
484 if (address == 0) {
485 /* look for an assigned address with a size of >= 1MB */
486 naddrs = call_prom(getprop, 4, 1, dp, "assigned-addresses",
487 addrs, sizeof(addrs));
488 naddrs /= sizeof(struct pci_reg_property);
489 for (i = 0; i < naddrs; ++i) {
490 if (addrs[i].size_lo >= (1 << 20)) {
491 address = addrs[i].addr.a_lo;
492 /* use the BE aperture if possible */
493 if (addrs[i].size_lo >= (16 << 20))
494 address += (8 << 20);
495 break;
496 }
497 }
498 if (address == 0) {
499 prom_print("Failed to get address\n");
500 return;
501 }
502 }
503 /* kludge for valkyrie */
504 if (strcmp(name, "valkyrie") == 0)
505 address += 0x1000;
506
507#ifdef CONFIG_POWER4
508#if CONFIG_TASK_SIZE > 0x80000000
509#error CONFIG_TASK_SIZE cannot be above 0x80000000 with BOOTX_TEXT on G5
510#endif
511 {
512 extern boot_infos_t disp_bi;
513 unsigned long va, pa, i, offset;
514 va = 0x90000000;
515 pa = address & 0xfffff000ul;
516 offset = address & 0x00000fff;
517
518 for (i=0; i<0x4000; i++) {
519 make_pte((unsigned long)Hash - KERNELBASE, Hash_size, va, pa,
520 _PAGE_ACCESSED | _PAGE_NO_CACHE |
521 _PAGE_GUARDED | PP_RWXX);
522 va += 0x1000;
523 pa += 0x1000;
524 }
525 btext_setup_display(width, height, depth, pitch, 0x90000000 | offset);
526 disp_bi.dispDeviceBase = (u8 *)address;
527 }
528#else /* CONFIG_POWER4 */
529 btext_setup_display(width, height, depth, pitch, address);
530 btext_prepare_BAT();
531#endif /* CONFIG_POWER4 */
532#endif /* CONFIG_BOOTX_TEXT */
533}
534
535/*
536 * Make a copy of the device tree from the PROM.
537 */
538static unsigned long __init
539copy_device_tree(unsigned long mem_start, unsigned long mem_end)
540{
541 phandle root;
542 unsigned long new_start;
543 struct device_node **allnextp;
544
545 root = call_prom("peer", 1, 1, (phandle)0);
546 if (root == (phandle)0) {
547 prom_print("couldn't get device tree root\n");
548 prom_exit();
549 }
550 allnextp = &allnodes;
551 mem_start = ALIGNUL(mem_start);
552 new_start = inspect_node(root, NULL, mem_start, mem_end, &allnextp);
553 *allnextp = NULL;
554 return new_start;
555}
556
557static unsigned long __init
558inspect_node(phandle node, struct device_node *dad,
559 unsigned long mem_start, unsigned long mem_end,
560 struct device_node ***allnextpp)
561{
562 int l;
563 phandle child;
564 struct device_node *np;
565 struct property *pp, **prev_propp;
566 char *prev_name, *namep;
567 unsigned char *valp;
568
569 np = (struct device_node *) mem_start;
570 mem_start += sizeof(struct device_node);
571 memset(np, 0, sizeof(*np));
572 np->node = node;
573 **allnextpp = PTRUNRELOC(np);
574 *allnextpp = &np->allnext;
575 if (dad != 0) {
576 np->parent = PTRUNRELOC(dad);
577 /* we temporarily use the `next' field as `last_child'. */
578 if (dad->next == 0)
579 dad->child = PTRUNRELOC(np);
580 else
581 dad->next->sibling = PTRUNRELOC(np);
582 dad->next = np;
583 }
584
585 /* get and store all properties */
586 prev_propp = &np->properties;
587 prev_name = "";
588 for (;;) {
589 pp = (struct property *) mem_start;
590 namep = (char *) (pp + 1);
591 pp->name = PTRUNRELOC(namep);
592 if (call_prom("nextprop", 3, 1, node, prev_name, namep) <= 0)
593 break;
594 mem_start = ALIGNUL((unsigned long)namep + strlen(namep) + 1);
595 prev_name = namep;
596 valp = (unsigned char *) mem_start;
597 pp->value = PTRUNRELOC(valp);
598 pp->length = call_prom("getprop", 4, 1, node, namep,
599 valp, mem_end - mem_start);
600 if (pp->length < 0)
601 continue;
602#ifdef MAX_PROPERTY_LENGTH
603 if (pp->length > MAX_PROPERTY_LENGTH)
604 continue; /* ignore this property */
605#endif
606 mem_start = ALIGNUL(mem_start + pp->length);
607 *prev_propp = PTRUNRELOC(pp);
608 prev_propp = &pp->next;
609 }
610 if (np->node != 0) {
611 /* Add a "linux,phandle" property" */
612 pp = (struct property *) mem_start;
613 *prev_propp = PTRUNRELOC(pp);
614 prev_propp = &pp->next;
615 namep = (char *) (pp + 1);
616 pp->name = PTRUNRELOC(namep);
617 strcpy(namep, "linux,phandle");
618 mem_start = ALIGNUL((unsigned long)namep + strlen(namep) + 1);
619 pp->value = (unsigned char *) PTRUNRELOC(&np->node);
620 pp->length = sizeof(np->node);
621 }
622 *prev_propp = NULL;
623
624 /* get the node's full name */
625 l = call_prom("package-to-path", 3, 1, node,
626 mem_start, mem_end - mem_start);
627 if (l >= 0) {
628 char *p, *ep;
629
630 np->full_name = PTRUNRELOC((char *) mem_start);
631 *(char *)(mem_start + l) = 0;
632 /* Fixup an Apple bug where they have bogus \0 chars in the
633 * middle of the path in some properties
634 */
635 for (p = (char *)mem_start, ep = p + l; p < ep; p++)
636 if ((*p) == '\0') {
637 memmove(p, p+1, ep - p);
638 ep--;
639 }
640 mem_start = ALIGNUL(mem_start + l + 1);
641 }
642
643 /* do all our children */
644 child = call_prom("child", 1, 1, node);
645 while (child != 0) {
646 mem_start = inspect_node(child, np, mem_start, mem_end,
647 allnextpp);
648 child = call_prom("peer", 1, 1, child);
649 }
650
651 return mem_start;
652}
653
654unsigned long smp_chrp_cpu_nr __initdata = 0;
655
656/*
657 * With CHRP SMP we need to use the OF to start the other
658 * processors so we can't wait until smp_boot_cpus (the OF is
659 * trashed by then) so we have to put the processors into
660 * a holding pattern controlled by the kernel (not OF) before
661 * we destroy the OF.
662 *
663 * This uses a chunk of high memory, puts some holding pattern
664 * code there and sends the other processors off to there until
665 * smp_boot_cpus tells them to do something. We do that by using
666 * physical address 0x0. The holding pattern checks that address
667 * until its cpu # is there, when it is that cpu jumps to
668 * __secondary_start(). smp_boot_cpus() takes care of setting those
669 * values.
670 *
671 * We also use physical address 0x4 here to tell when a cpu
672 * is in its holding pattern code.
673 *
674 * -- Cort
675 *
676 * Note that we have to do this if we have more than one CPU,
677 * even if this is a UP kernel. Otherwise when we trash OF
678 * the other CPUs will start executing some random instructions
679 * and crash the system. -- paulus
680 */
681static void __init
682prom_hold_cpus(unsigned long mem)
683{
684 extern void __secondary_hold(void);
685 unsigned long i;
686 int cpu;
687 phandle node;
688 char type[16], *path;
689 unsigned int reg;
690
691 /*
692 * XXX: hack to make sure we're chrp, assume that if we're
693 * chrp we have a device_type property -- Cort
694 */
695 node = call_prom("finddevice", 1, 1, "/");
696 if (call_prom("getprop", 4, 1, node,
697 "device_type", type, sizeof(type)) <= 0)
698 return;
699
700 /* copy the holding pattern code to someplace safe (0) */
701 /* the holding pattern is now within the first 0x100
702 bytes of the kernel image -- paulus */
703 memcpy((void *)0, _stext, 0x100);
704 flush_icache_range(0, 0x100);
705
706 /* look for cpus */
707 *(unsigned long *)(0x0) = 0;
708 asm volatile("dcbf 0,%0": : "r" (0) : "memory");
709 for (node = 0; prom_next_node(&node); ) {
710 type[0] = 0;
711 call_prom("getprop", 4, 1, node, "device_type",
712 type, sizeof(type));
713 if (strcmp(type, "cpu") != 0)
714 continue;
715 path = (char *) mem;
716 memset(path, 0, 256);
717 if (call_prom("package-to-path", 3, 1, node, path, 255) < 0)
718 continue;
719 reg = -1;
720 call_prom("getprop", 4, 1, node, "reg", &reg, sizeof(reg));
721 cpu = smp_chrp_cpu_nr++;
722#ifdef CONFIG_SMP
723 smp_hw_index[cpu] = reg;
724#endif /* CONFIG_SMP */
725 /* XXX: hack - don't start cpu 0, this cpu -- Cort */
726 if (cpu == 0)
727 continue;
728 prom_print("starting cpu ");
729 prom_print(path);
730 *(ulong *)(0x4) = 0;
731 call_prom("start-cpu", 3, 0, node,
732 (char *)__secondary_hold - _stext, cpu);
733 prom_print("...");
734 for ( i = 0 ; (i < 10000) && (*(ulong *)(0x4) == 0); i++ )
735 ;
736 if (*(ulong *)(0x4) == cpu)
737 prom_print("ok\n");
738 else {
739 prom_print("failed: ");
740 prom_print_hex(*(ulong *)0x4);
741 prom_print("\n");
742 }
743 }
744}
745
746static void __init
747prom_instantiate_rtas(void)
748{
749 ihandle prom_rtas;
750 prom_arg_t result;
751
752 prom_rtas = call_prom("finddevice", 1, 1, "/rtas");
753 if (prom_rtas == -1)
754 return;
755
756 rtas_size = 0;
757 call_prom("getprop", 4, 1, prom_rtas,
758 "rtas-size", &rtas_size, sizeof(rtas_size));
759 prom_print("instantiating rtas");
760 if (rtas_size == 0) {
761 rtas_data = 0;
762 } else {
763 /*
764 * Ask OF for some space for RTAS.
765 * Actually OF has bugs so we just arbitrarily
766 * use memory at the 6MB point.
767 */
768 rtas_data = 6 << 20;
769 prom_print(" at ");
770 prom_print_hex(rtas_data);
771 }
772
773 prom_rtas = call_prom("open", 1, 1, "/rtas");
774 prom_print("...");
775 rtas_entry = 0;
776 if (call_prom_ret("call-method", 3, 2, &result,
777 "instantiate-rtas", prom_rtas, rtas_data) == 0)
778 rtas_entry = result;
779 if ((rtas_entry == -1) || (rtas_entry == 0))
780 prom_print(" failed\n");
781 else
782 prom_print(" done\n");
783}
784
785/*
786 * We enter here early on, when the Open Firmware prom is still
787 * handling exceptions and the MMU hash table for us.
788 */
789unsigned long __init
790prom_init(int r3, int r4, prom_entry pp)
791{
792 unsigned long mem;
793 ihandle prom_mmu;
794 unsigned long offset = reloc_offset();
795 int i, l;
796 char *p, *d;
797 unsigned long phys;
798 prom_arg_t result[3];
799 char model[32];
800 phandle node;
801 int rc;
802
803 /* Default */
804 phys = (unsigned long) &_stext;
805
806 /* First get a handle for the stdout device */
807 prom = pp;
808 prom_chosen = call_prom("finddevice", 1, 1, "/chosen");
809 if (prom_chosen == -1)
810 prom_exit();
811 if (call_prom("getprop", 4, 1, prom_chosen, "stdout",
812 &prom_stdout, sizeof(prom_stdout)) <= 0)
813 prom_exit();
814
815 /* Get the full OF pathname of the stdout device */
816 mem = (unsigned long) klimit + offset;
817 p = (char *) mem;
818 memset(p, 0, 256);
819 call_prom("instance-to-path", 3, 1, prom_stdout, p, 255);
820 of_stdout_device = p;
821 mem += strlen(p) + 1;
822
823 /* Get the boot device and translate it to a full OF pathname. */
824 p = (char *) mem;
825 l = call_prom("getprop", 4, 1, prom_chosen, "bootpath", p, 1<<20);
826 if (l > 0) {
827 p[l] = 0; /* should already be null-terminated */
828 bootpath = PTRUNRELOC(p);
829 mem += l + 1;
830 d = (char *) mem;
831 *d = 0;
832 call_prom("canon", 3, 1, p, d, 1<<20);
833 bootdevice = PTRUNRELOC(d);
834 mem = ALIGNUL(mem + strlen(d) + 1);
835 }
836
837 prom_instantiate_rtas();
838
839#ifdef CONFIG_POWER4
840 /*
841 * Find out how much memory we have and allocate a
842 * suitably-sized hash table.
843 */
844 prom_alloc_htab();
845#endif
846 mem = check_display(mem);
847
848 prom_print("copying OF device tree...");
849 mem = copy_device_tree(mem, mem + (1<<20));
850 prom_print("done\n");
851
852 prom_hold_cpus(mem);
853
854 klimit = (char *) (mem - offset);
855
856 node = call_prom("finddevice", 1, 1, "/");
857 rc = call_prom("getprop", 4, 1, node, "model", model, sizeof(model));
858 if (rc > 0 && !strncmp (model, "Pegasos", 7)
859 && strncmp (model, "Pegasos2", 8)) {
860 /* Pegasos 1 has a broken translate method in the OF,
861 * and furthermore the BATs are mapped 1:1 so the phys
862 * address calculated above is correct, so let's use
863 * it directly.
864 */
865 } else if (offset == 0) {
866 /* If we are already running at 0xc0000000, we assume we were
867 * loaded by an OF bootloader which did set a BAT for us.
868 * This breaks OF translate so we force phys to be 0.
869 */
870 prom_print("(already at 0xc0000000) phys=0\n");
871 phys = 0;
872 } else if (call_prom("getprop", 4, 1, prom_chosen, "mmu",
873 &prom_mmu, sizeof(prom_mmu)) <= 0) {
874 prom_print(" no MMU found\n");
875 } else if (call_prom_ret("call-method", 4, 4, result, "translate",
876 prom_mmu, &_stext, 1) != 0) {
877 prom_print(" (translate failed)\n");
878 } else {
879 /* We assume the phys. address size is 3 cells */
880 phys = result[2];
881 }
882
883 if (prom_disp_node != 0)
884 setup_disp_fake_bi(prom_disp_node);
885
886 /* Use quiesce call to get OF to shut down any devices it's using */
887 prom_print("Calling quiesce ...\n");
888 call_prom("quiesce", 0, 0);
889
890 /* Relocate various pointers which will be used once the
891 kernel is running at the address it was linked at. */
892 for (i = 0; i < prom_num_displays; ++i)
893 prom_display_paths[i] = PTRUNRELOC(prom_display_paths[i]);
894
895#ifdef CONFIG_SERIAL_CORE_CONSOLE
896 /* Relocate the of stdout for console autodetection */
897 of_stdout_device = PTRUNRELOC(of_stdout_device);
898#endif
899
900 prom_print("returning 0x");
901 prom_print_hex(phys);
902 prom_print("from prom_init\n");
903 prom_stdout = 0;
904
905 return phys;
906}
907
908/*
909 * early_get_property is used to access the device tree image prepared
910 * by BootX very early on, before the pointers in it have been relocated.
911 */
912static void * __init
913early_get_property(unsigned long base, unsigned long node, char *prop)
914{
915 struct device_node *np = (struct device_node *)(base + node);
916 struct property *pp;
917
918 for (pp = np->properties; pp != 0; pp = pp->next) {
919 pp = (struct property *) (base + (unsigned long)pp);
920 if (strcmp((char *)((unsigned long)pp->name + base),
921 prop) == 0) {
922 return (void *)((unsigned long)pp->value + base);
923 }
924 }
925 return NULL;
926}
927
928/* Is boot-info compatible ? */
929#define BOOT_INFO_IS_COMPATIBLE(bi) ((bi)->compatible_version <= BOOT_INFO_VERSION)
930#define BOOT_INFO_IS_V2_COMPATIBLE(bi) ((bi)->version >= 2)
931#define BOOT_INFO_IS_V4_COMPATIBLE(bi) ((bi)->version >= 4)
932
933void __init
934bootx_init(unsigned long r4, unsigned long phys)
935{
936 boot_infos_t *bi = (boot_infos_t *) r4;
937 unsigned long space;
938 unsigned long ptr, x;
939 char *model;
940
941 boot_infos = PTRUNRELOC(bi);
942 if (!BOOT_INFO_IS_V2_COMPATIBLE(bi))
943 bi->logicalDisplayBase = NULL;
944
945#ifdef CONFIG_BOOTX_TEXT
946 btext_init(bi);
947
948 /*
949 * Test if boot-info is compatible. Done only in config
950 * CONFIG_BOOTX_TEXT since there is nothing much we can do
951 * with an incompatible version, except display a message
952 * and eventually hang the processor...
953 *
954 * I'll try to keep enough of boot-info compatible in the
955 * future to always allow display of this message;
956 */
957 if (!BOOT_INFO_IS_COMPATIBLE(bi)) {
958 btext_drawstring(" !!! WARNING - Incompatible version of BootX !!!\n\n\n");
959 btext_flushscreen();
960 }
961#endif /* CONFIG_BOOTX_TEXT */
962
963 /* New BootX enters kernel with MMU off, i/os are not allowed
964 here. This hack will have been done by the boostrap anyway.
965 */
966 if (bi->version < 4) {
967 /*
968 * XXX If this is an iMac, turn off the USB controller.
969 */
970 model = (char *) early_get_property
971 (r4 + bi->deviceTreeOffset, 4, "model");
972 if (model
973 && (strcmp(model, "iMac,1") == 0
974 || strcmp(model, "PowerMac1,1") == 0)) {
975 out_le32((unsigned *)0x80880008, 1); /* XXX */
976 }
977 }
978
979 /* Move klimit to enclose device tree, args, ramdisk, etc... */
980 if (bi->version < 5) {
981 space = bi->deviceTreeOffset + bi->deviceTreeSize;
982 if (bi->ramDisk)
983 space = bi->ramDisk + bi->ramDiskSize;
984 } else
985 space = bi->totalParamsSize;
986 klimit = PTRUNRELOC((char *) bi + space);
987
988 /* New BootX will have flushed all TLBs and enters kernel with
989 MMU switched OFF, so this should not be useful anymore.
990 */
991 if (bi->version < 4) {
992 /*
993 * Touch each page to make sure the PTEs for them
994 * are in the hash table - the aim is to try to avoid
995 * getting DSI exceptions while copying the kernel image.
996 */
997 for (ptr = ((unsigned long) &_stext) & PAGE_MASK;
998 ptr < (unsigned long)bi + space; ptr += PAGE_SIZE)
999 x = *(volatile unsigned long *)ptr;
1000 }
1001
1002#ifdef CONFIG_BOOTX_TEXT
1003 /*
1004 * Note that after we call btext_prepare_BAT, we can't do
1005 * prom_draw*, flushscreen or clearscreen until we turn the MMU
1006 * on, since btext_prepare_BAT sets disp_bi.logicalDisplayBase
1007 * to a virtual address.
1008 */
1009 btext_prepare_BAT();
1010#endif
1011}
diff --git a/arch/ppc/xmon/start.c b/arch/ppc/xmon/start.c
index ff86b2d814cb..cfc2d6ad464d 100644
--- a/arch/ppc/xmon/start.c
+++ b/arch/ppc/xmon/start.c
@@ -58,7 +58,7 @@ static struct sysrq_key_op sysrq_xmon_op =
58void 58void
59xmon_map_scc(void) 59xmon_map_scc(void)
60{ 60{
61#ifdef CONFIG_PPC_MULTIPLATFORM 61#ifdef CONFIG_PPC_PREP
62 volatile unsigned char *base; 62 volatile unsigned char *base;
63 63
64#elif defined(CONFIG_GEMINI) 64#elif defined(CONFIG_GEMINI)
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c
index 99182a415fe7..4a0f5a1551ea 100644
--- a/arch/s390/kernel/process.c
+++ b/arch/s390/kernel/process.c
@@ -76,17 +76,17 @@ unsigned long thread_saved_pc(struct task_struct *tsk)
76/* 76/*
77 * Need to know about CPUs going idle? 77 * Need to know about CPUs going idle?
78 */ 78 */
79static struct notifier_block *idle_chain; 79static ATOMIC_NOTIFIER_HEAD(idle_chain);
80 80
81int register_idle_notifier(struct notifier_block *nb) 81int register_idle_notifier(struct notifier_block *nb)
82{ 82{
83 return notifier_chain_register(&idle_chain, nb); 83 return atomic_notifier_chain_register(&idle_chain, nb);
84} 84}
85EXPORT_SYMBOL(register_idle_notifier); 85EXPORT_SYMBOL(register_idle_notifier);
86 86
87int unregister_idle_notifier(struct notifier_block *nb) 87int unregister_idle_notifier(struct notifier_block *nb)
88{ 88{
89 return notifier_chain_unregister(&idle_chain, nb); 89 return atomic_notifier_chain_unregister(&idle_chain, nb);
90} 90}
91EXPORT_SYMBOL(unregister_idle_notifier); 91EXPORT_SYMBOL(unregister_idle_notifier);
92 92
@@ -95,7 +95,7 @@ void do_monitor_call(struct pt_regs *regs, long interruption_code)
95 /* disable monitor call class 0 */ 95 /* disable monitor call class 0 */
96 __ctl_clear_bit(8, 15); 96 __ctl_clear_bit(8, 15);
97 97
98 notifier_call_chain(&idle_chain, CPU_NOT_IDLE, 98 atomic_notifier_call_chain(&idle_chain, CPU_NOT_IDLE,
99 (void *)(long) smp_processor_id()); 99 (void *)(long) smp_processor_id());
100} 100}
101 101
@@ -116,7 +116,8 @@ static void default_idle(void)
116 return; 116 return;
117 } 117 }
118 118
119 rc = notifier_call_chain(&idle_chain, CPU_IDLE, (void *)(long) cpu); 119 rc = atomic_notifier_call_chain(&idle_chain,
120 CPU_IDLE, (void *)(long) cpu);
120 if (rc != NOTIFY_OK && rc != NOTIFY_DONE) 121 if (rc != NOTIFY_OK && rc != NOTIFY_DONE)
121 BUG(); 122 BUG();
122 if (rc != NOTIFY_OK) { 123 if (rc != NOTIFY_OK) {
diff --git a/arch/sh/boards/mpc1211/rtc.c b/arch/sh/boards/mpc1211/rtc.c
index 4d100f048072..a76c655dceee 100644
--- a/arch/sh/boards/mpc1211/rtc.c
+++ b/arch/sh/boards/mpc1211/rtc.c
@@ -9,36 +9,16 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/time.h> 11#include <linux/time.h>
12#include <linux/bcd.h>
12#include <linux/mc146818rtc.h> 13#include <linux/mc146818rtc.h>
13 14
14#ifndef BCD_TO_BIN
15#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
16#endif
17
18#ifndef BIN_TO_BCD
19#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
20#endif
21
22/* arc/i386/kernel/time.c */
23unsigned long get_cmos_time(void) 15unsigned long get_cmos_time(void)
24{ 16{
25 unsigned int year, mon, day, hour, min, sec; 17 unsigned int year, mon, day, hour, min, sec;
26 int i;
27 18
28 spin_lock(&rtc_lock); 19 spin_lock(&rtc_lock);
29 /* The Linux interpretation of the CMOS clock register contents: 20
30 * When the Update-In-Progress (UIP) flag goes from 1 to 0, the 21 do {
31 * RTC registers show the second which has precisely just started.
32 * Let's hope other operating systems interpret the RTC the same way.
33 */
34 /* read RTC exactly on falling edge of update flag */
35 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
36 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
37 break;
38 for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
39 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
40 break;
41 do { /* Isn't this overkill ? UIP above should guarantee consistency */
42 sec = CMOS_READ(RTC_SECONDS); 22 sec = CMOS_READ(RTC_SECONDS);
43 min = CMOS_READ(RTC_MINUTES); 23 min = CMOS_READ(RTC_MINUTES);
44 hour = CMOS_READ(RTC_HOURS); 24 hour = CMOS_READ(RTC_HOURS);
@@ -46,18 +26,22 @@ unsigned long get_cmos_time(void)
46 mon = CMOS_READ(RTC_MONTH); 26 mon = CMOS_READ(RTC_MONTH);
47 year = CMOS_READ(RTC_YEAR); 27 year = CMOS_READ(RTC_YEAR);
48 } while (sec != CMOS_READ(RTC_SECONDS)); 28 } while (sec != CMOS_READ(RTC_SECONDS));
49 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) 29
50 { 30 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
51 BCD_TO_BIN(sec); 31 BCD_TO_BIN(sec);
52 BCD_TO_BIN(min); 32 BCD_TO_BIN(min);
53 BCD_TO_BIN(hour); 33 BCD_TO_BIN(hour);
54 BCD_TO_BIN(day); 34 BCD_TO_BIN(day);
55 BCD_TO_BIN(mon); 35 BCD_TO_BIN(mon);
56 BCD_TO_BIN(year); 36 BCD_TO_BIN(year);
57 } 37 }
38
58 spin_unlock(&rtc_lock); 39 spin_unlock(&rtc_lock);
59 if ((year += 1900) < 1970) 40
41 year += 1900;
42 if (year < 1970)
60 year += 100; 43 year += 100;
44
61 return mktime(year, mon, day, hour, min, sec); 45 return mktime(year, mon, day, hour, min, sec);
62} 46}
63 47
diff --git a/arch/sh/boards/sh03/rtc.c b/arch/sh/boards/sh03/rtc.c
index cbeca7037ba5..d609863cfe53 100644
--- a/arch/sh/boards/sh03/rtc.c
+++ b/arch/sh/boards/sh03/rtc.c
@@ -9,6 +9,7 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/time.h> 11#include <linux/time.h>
12#include <linux/bcd.h>
12#include <asm/io.h> 13#include <asm/io.h>
13#include <linux/rtc.h> 14#include <linux/rtc.h>
14#include <linux/spinlock.h> 15#include <linux/spinlock.h>
@@ -33,14 +34,6 @@
33#define RTC_BUSY 1 34#define RTC_BUSY 1
34#define RTC_STOP 2 35#define RTC_STOP 2
35 36
36#ifndef BCD_TO_BIN
37#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
38#endif
39
40#ifndef BIN_TO_BCD
41#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
42#endif
43
44extern void (*rtc_get_time)(struct timespec *); 37extern void (*rtc_get_time)(struct timespec *);
45extern int (*rtc_set_time)(const time_t); 38extern int (*rtc_set_time)(const time_t);
46extern spinlock_t rtc_lock; 39extern spinlock_t rtc_lock;
@@ -48,13 +41,9 @@ extern spinlock_t rtc_lock;
48unsigned long get_cmos_time(void) 41unsigned long get_cmos_time(void)
49{ 42{
50 unsigned int year, mon, day, hour, min, sec; 43 unsigned int year, mon, day, hour, min, sec;
51 int i;
52 44
53 spin_lock(&rtc_lock); 45 spin_lock(&rtc_lock);
54 again: 46 again:
55 for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
56 if (!(ctrl_inb(RTC_CTL) & RTC_BUSY))
57 break;
58 do { 47 do {
59 sec = (ctrl_inb(RTC_SEC1) & 0xf) + (ctrl_inb(RTC_SEC10) & 0x7) * 10; 48 sec = (ctrl_inb(RTC_SEC1) & 0xf) + (ctrl_inb(RTC_SEC10) & 0x7) * 10;
60 min = (ctrl_inb(RTC_MIN1) & 0xf) + (ctrl_inb(RTC_MIN10) & 0xf) * 10; 49 min = (ctrl_inb(RTC_MIN1) & 0xf) + (ctrl_inb(RTC_MIN10) & 0xf) * 10;
diff --git a/arch/sh/kernel/cpu/rtc.c b/arch/sh/kernel/cpu/rtc.c
index f8361f5e788b..4304cf75cfa2 100644
--- a/arch/sh/kernel/cpu/rtc.c
+++ b/arch/sh/kernel/cpu/rtc.c
@@ -9,18 +9,10 @@
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <linux/time.h> 11#include <linux/time.h>
12 12#include <linux/bcd.h>
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/rtc.h> 14#include <asm/rtc.h>
15 15
16#ifndef BCD_TO_BIN
17#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
18#endif
19
20#ifndef BIN_TO_BCD
21#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
22#endif
23
24void sh_rtc_gettimeofday(struct timespec *ts) 16void sh_rtc_gettimeofday(struct timespec *ts)
25{ 17{
26 unsigned int sec128, sec, sec2, min, hr, wk, day, mon, yr, yr100, cf_bit; 18 unsigned int sec128, sec, sec2, min, hr, wk, day, mon, yr, yr100, cf_bit;
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index c0e79843f580..7ee4ca203616 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -20,6 +20,7 @@
20#include <linux/root_dev.h> 20#include <linux/root_dev.h>
21#include <linux/utsname.h> 21#include <linux/utsname.h>
22#include <linux/cpu.h> 22#include <linux/cpu.h>
23#include <linux/pfn.h>
23#include <asm/uaccess.h> 24#include <asm/uaccess.h>
24#include <asm/io.h> 25#include <asm/io.h>
25#include <asm/sections.h> 26#include <asm/sections.h>
@@ -275,10 +276,6 @@ void __init setup_arch(char **cmdline_p)
275 276
276 sh_mv_setup(cmdline_p); 277 sh_mv_setup(cmdline_p);
277 278
278#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
279#define PFN_DOWN(x) ((x) >> PAGE_SHIFT)
280#define PFN_PHYS(x) ((x) << PAGE_SHIFT)
281
282 /* 279 /*
283 * Find the highest page frame number we have available 280 * Find the highest page frame number we have available
284 */ 281 */
diff --git a/arch/sh64/kernel/setup.c b/arch/sh64/kernel/setup.c
index c7a7b816a30f..d2711c9c9d13 100644
--- a/arch/sh64/kernel/setup.c
+++ b/arch/sh64/kernel/setup.c
@@ -48,6 +48,7 @@
48#include <linux/root_dev.h> 48#include <linux/root_dev.h>
49#include <linux/cpu.h> 49#include <linux/cpu.h>
50#include <linux/initrd.h> 50#include <linux/initrd.h>
51#include <linux/pfn.h>
51#include <asm/processor.h> 52#include <asm/processor.h>
52#include <asm/page.h> 53#include <asm/page.h>
53#include <asm/pgtable.h> 54#include <asm/pgtable.h>
diff --git a/arch/sh64/kernel/time.c b/arch/sh64/kernel/time.c
index 0773c9f389f3..6b8f4d22abc6 100644
--- a/arch/sh64/kernel/time.c
+++ b/arch/sh64/kernel/time.c
@@ -30,6 +30,7 @@
30#include <linux/profile.h> 30#include <linux/profile.h>
31#include <linux/smp.h> 31#include <linux/smp.h>
32#include <linux/module.h> 32#include <linux/module.h>
33#include <linux/bcd.h>
33 34
34#include <asm/registers.h> /* required by inline __asm__ stmt. */ 35#include <asm/registers.h> /* required by inline __asm__ stmt. */
35 36
@@ -105,14 +106,6 @@
105#define RCR1 rtc_base+0x38 106#define RCR1 rtc_base+0x38
106#define RCR2 rtc_base+0x3c 107#define RCR2 rtc_base+0x3c
107 108
108#ifndef BCD_TO_BIN
109#define BCD_TO_BIN(val) ((val)=((val)&15) + ((val)>>4)*10)
110#endif
111
112#ifndef BIN_TO_BCD
113#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
114#endif
115
116#define TICK_SIZE (tick_nsec / 1000) 109#define TICK_SIZE (tick_nsec / 1000)
117 110
118extern unsigned long wall_jiffies; 111extern unsigned long wall_jiffies;
diff --git a/arch/sparc64/defconfig b/arch/sparc64/defconfig
index f819a9663a8d..900fb0b940d8 100644
--- a/arch/sparc64/defconfig
+++ b/arch/sparc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16 3# Linux kernel version: 2.6.16
4# Mon Mar 20 01:23:21 2006 4# Sun Mar 26 14:58:11 2006
5# 5#
6CONFIG_SPARC=y 6CONFIG_SPARC=y
7CONFIG_SPARC64=y 7CONFIG_SPARC64=y
@@ -38,6 +38,7 @@ CONFIG_POSIX_MQUEUE=y
38CONFIG_SYSCTL=y 38CONFIG_SYSCTL=y
39# CONFIG_AUDIT is not set 39# CONFIG_AUDIT is not set
40# CONFIG_IKCONFIG is not set 40# CONFIG_IKCONFIG is not set
41CONFIG_RELAY=y
41CONFIG_INITRAMFS_SOURCE="" 42CONFIG_INITRAMFS_SOURCE=""
42CONFIG_UID16=y 43CONFIG_UID16=y
43CONFIG_CC_OPTIMIZE_FOR_SIZE=y 44CONFIG_CC_OPTIMIZE_FOR_SIZE=y
@@ -53,10 +54,6 @@ CONFIG_BASE_FULL=y
53CONFIG_FUTEX=y 54CONFIG_FUTEX=y
54CONFIG_EPOLL=y 55CONFIG_EPOLL=y
55CONFIG_SHMEM=y 56CONFIG_SHMEM=y
56CONFIG_CC_ALIGN_FUNCTIONS=0
57CONFIG_CC_ALIGN_LABELS=0
58CONFIG_CC_ALIGN_LOOPS=0
59CONFIG_CC_ALIGN_JUMPS=0
60CONFIG_SLAB=y 57CONFIG_SLAB=y
61# CONFIG_TINY_SHMEM is not set 58# CONFIG_TINY_SHMEM is not set
62CONFIG_BASE_SMALL=0 59CONFIG_BASE_SMALL=0
@@ -68,7 +65,6 @@ CONFIG_BASE_SMALL=0
68CONFIG_MODULES=y 65CONFIG_MODULES=y
69CONFIG_MODULE_UNLOAD=y 66CONFIG_MODULE_UNLOAD=y
70CONFIG_MODULE_FORCE_UNLOAD=y 67CONFIG_MODULE_FORCE_UNLOAD=y
71CONFIG_OBSOLETE_MODPARM=y
72CONFIG_MODVERSIONS=y 68CONFIG_MODVERSIONS=y
73CONFIG_MODULE_SRCVERSION_ALL=y 69CONFIG_MODULE_SRCVERSION_ALL=y
74CONFIG_KMOD=y 70CONFIG_KMOD=y
@@ -76,6 +72,7 @@ CONFIG_KMOD=y
76# 72#
77# Block layer 73# Block layer
78# 74#
75CONFIG_BLK_DEV_IO_TRACE=y
79 76
80# 77#
81# IO Schedulers 78# IO Schedulers
@@ -111,6 +108,8 @@ CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
111CONFIG_US3_FREQ=m 108CONFIG_US3_FREQ=m
112CONFIG_US2E_FREQ=m 109CONFIG_US2E_FREQ=m
113CONFIG_RWSEM_XCHGADD_ALGORITHM=y 110CONFIG_RWSEM_XCHGADD_ALGORITHM=y
111CONFIG_GENERIC_FIND_NEXT_BIT=y
112CONFIG_GENERIC_HWEIGHT=y
114CONFIG_GENERIC_CALIBRATE_DELAY=y 113CONFIG_GENERIC_CALIBRATE_DELAY=y
115CONFIG_HUGETLB_PAGE_SIZE_4MB=y 114CONFIG_HUGETLB_PAGE_SIZE_4MB=y
116# CONFIG_HUGETLB_PAGE_SIZE_512K is not set 115# CONFIG_HUGETLB_PAGE_SIZE_512K is not set
@@ -128,7 +127,6 @@ CONFIG_HAVE_MEMORY_PRESENT=y
128CONFIG_SPARSEMEM_EXTREME=y 127CONFIG_SPARSEMEM_EXTREME=y
129CONFIG_MEMORY_HOTPLUG=y 128CONFIG_MEMORY_HOTPLUG=y
130CONFIG_SPLIT_PTLOCK_CPUS=4 129CONFIG_SPLIT_PTLOCK_CPUS=4
131CONFIG_MIGRATION=y
132CONFIG_GENERIC_ISA_DMA=y 130CONFIG_GENERIC_ISA_DMA=y
133CONFIG_SBUS=y 131CONFIG_SBUS=y
134CONFIG_SBUSCHAR=y 132CONFIG_SBUSCHAR=y
@@ -136,7 +134,6 @@ CONFIG_SUN_AUXIO=y
136CONFIG_SUN_IO=y 134CONFIG_SUN_IO=y
137CONFIG_PCI=y 135CONFIG_PCI=y
138CONFIG_PCI_DOMAINS=y 136CONFIG_PCI_DOMAINS=y
139# CONFIG_PCI_LEGACY_PROC is not set
140# CONFIG_PCI_DEBUG is not set 137# CONFIG_PCI_DEBUG is not set
141CONFIG_SUN_OPENPROMFS=m 138CONFIG_SUN_OPENPROMFS=m
142CONFIG_SPARC32_COMPAT=y 139CONFIG_SPARC32_COMPAT=y
@@ -201,6 +198,8 @@ CONFIG_TCP_CONG_VEGAS=m
201CONFIG_TCP_CONG_SCALABLE=m 198CONFIG_TCP_CONG_SCALABLE=m
202CONFIG_IPV6=m 199CONFIG_IPV6=m
203CONFIG_IPV6_PRIVACY=y 200CONFIG_IPV6_PRIVACY=y
201CONFIG_IPV6_ROUTER_PREF=y
202CONFIG_IPV6_ROUTE_INFO=y
204CONFIG_INET6_AH=m 203CONFIG_INET6_AH=m
205CONFIG_INET6_ESP=m 204CONFIG_INET6_ESP=m
206CONFIG_INET6_IPCOMP=m 205CONFIG_INET6_IPCOMP=m
@@ -213,10 +212,12 @@ CONFIG_IPV6_TUNNEL=m
213# 212#
214CONFIG_IP_DCCP=m 213CONFIG_IP_DCCP=m
215CONFIG_INET_DCCP_DIAG=m 214CONFIG_INET_DCCP_DIAG=m
215CONFIG_IP_DCCP_ACKVEC=y
216 216
217# 217#
218# DCCP CCIDs Configuration (EXPERIMENTAL) 218# DCCP CCIDs Configuration (EXPERIMENTAL)
219# 219#
220CONFIG_IP_DCCP_CCID2=m
220CONFIG_IP_DCCP_CCID3=m 221CONFIG_IP_DCCP_CCID3=m
221CONFIG_IP_DCCP_TFRC_LIB=m 222CONFIG_IP_DCCP_TFRC_LIB=m
222 223
@@ -224,7 +225,6 @@ CONFIG_IP_DCCP_TFRC_LIB=m
224# DCCP Kernel Hacking 225# DCCP Kernel Hacking
225# 226#
226# CONFIG_IP_DCCP_DEBUG is not set 227# CONFIG_IP_DCCP_DEBUG is not set
227# CONFIG_IP_DCCP_UNLOAD_HACK is not set
228 228
229# 229#
230# SCTP Configuration (EXPERIMENTAL) 230# SCTP Configuration (EXPERIMENTAL)
@@ -309,6 +309,7 @@ CONFIG_BLK_DEV_NBD=m
309CONFIG_BLK_DEV_UB=m 309CONFIG_BLK_DEV_UB=m
310# CONFIG_BLK_DEV_RAM is not set 310# CONFIG_BLK_DEV_RAM is not set
311CONFIG_BLK_DEV_RAM_COUNT=16 311CONFIG_BLK_DEV_RAM_COUNT=16
312# CONFIG_BLK_DEV_INITRD is not set
312CONFIG_CDROM_PKTCDVD=m 313CONFIG_CDROM_PKTCDVD=m
313CONFIG_CDROM_PKTCDVD_BUFFERS=8 314CONFIG_CDROM_PKTCDVD_BUFFERS=8
314CONFIG_CDROM_PKTCDVD_WCACHE=y 315CONFIG_CDROM_PKTCDVD_WCACHE=y
@@ -722,7 +723,6 @@ CONFIG_I2C_ALGOBIT=y
722# CONFIG_I2C_PARPORT_LIGHT is not set 723# CONFIG_I2C_PARPORT_LIGHT is not set
723# CONFIG_I2C_PROSAVAGE is not set 724# CONFIG_I2C_PROSAVAGE is not set
724# CONFIG_I2C_SAVAGE4 is not set 725# CONFIG_I2C_SAVAGE4 is not set
725# CONFIG_SCx200_ACB is not set
726# CONFIG_I2C_SIS5595 is not set 726# CONFIG_I2C_SIS5595 is not set
727# CONFIG_I2C_SIS630 is not set 727# CONFIG_I2C_SIS630 is not set
728# CONFIG_I2C_SIS96X is not set 728# CONFIG_I2C_SIS96X is not set
@@ -808,10 +808,6 @@ CONFIG_HWMON=y
808# 808#
809 809
810# 810#
811# Multimedia Capabilities Port drivers
812#
813
814#
815# Multimedia devices 811# Multimedia devices
816# 812#
817# CONFIG_VIDEO_DEV is not set 813# CONFIG_VIDEO_DEV is not set
@@ -820,6 +816,7 @@ CONFIG_HWMON=y
820# Digital Video Broadcasting Devices 816# Digital Video Broadcasting Devices
821# 817#
822# CONFIG_DVB is not set 818# CONFIG_DVB is not set
819# CONFIG_USB_DABUSB is not set
823 820
824# 821#
825# Graphics support 822# Graphics support
@@ -901,10 +898,12 @@ CONFIG_SND_SEQ_DUMMY=m
901CONFIG_SND_OSSEMUL=y 898CONFIG_SND_OSSEMUL=y
902CONFIG_SND_MIXER_OSS=m 899CONFIG_SND_MIXER_OSS=m
903CONFIG_SND_PCM_OSS=m 900CONFIG_SND_PCM_OSS=m
901CONFIG_SND_PCM_OSS_PLUGINS=y
904CONFIG_SND_SEQUENCER_OSS=y 902CONFIG_SND_SEQUENCER_OSS=y
905# CONFIG_SND_RTCTIMER is not set 903# CONFIG_SND_RTCTIMER is not set
906# CONFIG_SND_DYNAMIC_MINORS is not set 904# CONFIG_SND_DYNAMIC_MINORS is not set
907CONFIG_SND_SUPPORT_OLD_API=y 905CONFIG_SND_SUPPORT_OLD_API=y
906CONFIG_SND_VERBOSE_PROCFS=y
908# CONFIG_SND_VERBOSE_PRINTK is not set 907# CONFIG_SND_VERBOSE_PRINTK is not set
909# CONFIG_SND_DEBUG is not set 908# CONFIG_SND_DEBUG is not set
910 909
@@ -987,6 +986,7 @@ CONFIG_SND_SUN_CS4231=m
987# 986#
988CONFIG_USB_ARCH_HAS_HCD=y 987CONFIG_USB_ARCH_HAS_HCD=y
989CONFIG_USB_ARCH_HAS_OHCI=y 988CONFIG_USB_ARCH_HAS_OHCI=y
989CONFIG_USB_ARCH_HAS_EHCI=y
990CONFIG_USB=y 990CONFIG_USB=y
991# CONFIG_USB_DEBUG is not set 991# CONFIG_USB_DEBUG is not set
992 992
@@ -1014,7 +1014,6 @@ CONFIG_USB_UHCI_HCD=m
1014# 1014#
1015# USB Device Class drivers 1015# USB Device Class drivers
1016# 1016#
1017# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
1018# CONFIG_USB_ACM is not set 1017# CONFIG_USB_ACM is not set
1019# CONFIG_USB_PRINTER is not set 1018# CONFIG_USB_PRINTER is not set
1020 1019
@@ -1058,15 +1057,6 @@ CONFIG_USB_HIDDEV=y
1058# CONFIG_USB_MICROTEK is not set 1057# CONFIG_USB_MICROTEK is not set
1059 1058
1060# 1059#
1061# USB Multimedia devices
1062#
1063# CONFIG_USB_DABUSB is not set
1064
1065#
1066# Video4Linux support is needed for USB Multimedia device support
1067#
1068
1069#
1070# USB Network Adapters 1060# USB Network Adapters
1071# 1061#
1072# CONFIG_USB_CATC is not set 1062# CONFIG_USB_CATC is not set
@@ -1194,7 +1184,6 @@ CONFIG_TMPFS=y
1194CONFIG_HUGETLBFS=y 1184CONFIG_HUGETLBFS=y
1195CONFIG_HUGETLB_PAGE=y 1185CONFIG_HUGETLB_PAGE=y
1196CONFIG_RAMFS=y 1186CONFIG_RAMFS=y
1197CONFIG_RELAYFS_FS=m
1198# CONFIG_CONFIGFS_FS is not set 1187# CONFIG_CONFIGFS_FS is not set
1199 1188
1200# 1189#
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index c7fbbcfce824..f5e8db1de76b 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -274,18 +274,9 @@ EXPORT_SYMBOL(__prom_getsibling);
274 274
275/* sparc library symbols */ 275/* sparc library symbols */
276EXPORT_SYMBOL(strlen); 276EXPORT_SYMBOL(strlen);
277EXPORT_SYMBOL(strnlen);
278EXPORT_SYMBOL(__strlen_user); 277EXPORT_SYMBOL(__strlen_user);
279EXPORT_SYMBOL(__strnlen_user); 278EXPORT_SYMBOL(__strnlen_user);
280EXPORT_SYMBOL(strcpy);
281EXPORT_SYMBOL(strncpy);
282EXPORT_SYMBOL(strcat);
283EXPORT_SYMBOL(strncat);
284EXPORT_SYMBOL(strcmp);
285EXPORT_SYMBOL(strchr);
286EXPORT_SYMBOL(strrchr);
287EXPORT_SYMBOL(strpbrk); 279EXPORT_SYMBOL(strpbrk);
288EXPORT_SYMBOL(strstr);
289 280
290#ifdef CONFIG_SOLARIS_EMUL_MODULE 281#ifdef CONFIG_SOLARIS_EMUL_MODULE
291EXPORT_SYMBOL(linux_sparc_syscall); 282EXPORT_SYMBOL(linux_sparc_syscall);
@@ -319,7 +310,6 @@ EXPORT_SYMBOL(__memscan_zero);
319EXPORT_SYMBOL(__memscan_generic); 310EXPORT_SYMBOL(__memscan_generic);
320EXPORT_SYMBOL(__memcmp); 311EXPORT_SYMBOL(__memcmp);
321EXPORT_SYMBOL(__memset); 312EXPORT_SYMBOL(__memset);
322EXPORT_SYMBOL(memchr);
323 313
324EXPORT_SYMBOL(csum_partial); 314EXPORT_SYMBOL(csum_partial);
325EXPORT_SYMBOL(csum_partial_copy_nocheck); 315EXPORT_SYMBOL(csum_partial_copy_nocheck);
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 7d61f1bfd3d3..e55b5c6ece02 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -641,23 +641,8 @@ static void __init set_system_time(void)
641 mon = MSTK_REG_MONTH(mregs); 641 mon = MSTK_REG_MONTH(mregs);
642 year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) ); 642 year = MSTK_CVT_YEAR( MSTK_REG_YEAR(mregs) );
643 } else { 643 } else {
644 int i;
645
646 /* Dallas 12887 RTC chip. */ 644 /* Dallas 12887 RTC chip. */
647 645
648 /* Stolen from arch/i386/kernel/time.c, see there for
649 * credits and descriptive comments.
650 */
651 for (i = 0; i < 1000000; i++) {
652 if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
653 break;
654 udelay(10);
655 }
656 for (i = 0; i < 1000000; i++) {
657 if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
658 break;
659 udelay(10);
660 }
661 do { 646 do {
662 sec = CMOS_READ(RTC_SECONDS); 647 sec = CMOS_READ(RTC_SECONDS);
663 min = CMOS_READ(RTC_MINUTES); 648 min = CMOS_READ(RTC_MINUTES);
@@ -666,6 +651,7 @@ static void __init set_system_time(void)
666 mon = CMOS_READ(RTC_MONTH); 651 mon = CMOS_READ(RTC_MONTH);
667 year = CMOS_READ(RTC_YEAR); 652 year = CMOS_READ(RTC_YEAR);
668 } while (sec != CMOS_READ(RTC_SECONDS)); 653 } while (sec != CMOS_READ(RTC_SECONDS));
654
669 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) { 655 if (!(CMOS_READ(RTC_CONTROL) & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
670 BCD_TO_BIN(sec); 656 BCD_TO_BIN(sec);
671 BCD_TO_BIN(min); 657 BCD_TO_BIN(min);
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index df612e4f75f9..ff090bb9734b 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -43,18 +43,19 @@
43#include <linux/kmod.h> 43#include <linux/kmod.h>
44#endif 44#endif
45 45
46struct notifier_block *sparc64die_chain; 46ATOMIC_NOTIFIER_HEAD(sparc64die_chain);
47static DEFINE_SPINLOCK(die_notifier_lock);
48 47
49int register_die_notifier(struct notifier_block *nb) 48int register_die_notifier(struct notifier_block *nb)
50{ 49{
51 int err = 0; 50 return atomic_notifier_chain_register(&sparc64die_chain, nb);
52 unsigned long flags;
53 spin_lock_irqsave(&die_notifier_lock, flags);
54 err = notifier_chain_register(&sparc64die_chain, nb);
55 spin_unlock_irqrestore(&die_notifier_lock, flags);
56 return err;
57} 51}
52EXPORT_SYMBOL(register_die_notifier);
53
54int unregister_die_notifier(struct notifier_block *nb)
55{
56 return atomic_notifier_chain_unregister(&sparc64die_chain, nb);
57}
58EXPORT_SYMBOL(unregister_die_notifier);
58 59
59/* When an irrecoverable trap occurs at tl > 0, the trap entry 60/* When an irrecoverable trap occurs at tl > 0, the trap entry
60 * code logs the trap state registers at every level in the trap 61 * code logs the trap state registers at every level in the trap
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c
index d21ff3230c02..0db2f7d9fab5 100644
--- a/arch/sparc64/mm/fault.c
+++ b/arch/sparc64/mm/fault.c
@@ -413,12 +413,12 @@ good_area:
413#ifdef CONFIG_HUGETLB_PAGE 413#ifdef CONFIG_HUGETLB_PAGE
414 mm_rss -= (mm->context.huge_pte_count * (HPAGE_SIZE / PAGE_SIZE)); 414 mm_rss -= (mm->context.huge_pte_count * (HPAGE_SIZE / PAGE_SIZE));
415#endif 415#endif
416 if (unlikely(mm_rss >= 416 if (unlikely(mm_rss >
417 mm->context.tsb_block[MM_TSB_BASE].tsb_rss_limit)) 417 mm->context.tsb_block[MM_TSB_BASE].tsb_rss_limit))
418 tsb_grow(mm, MM_TSB_BASE, mm_rss); 418 tsb_grow(mm, MM_TSB_BASE, mm_rss);
419#ifdef CONFIG_HUGETLB_PAGE 419#ifdef CONFIG_HUGETLB_PAGE
420 mm_rss = mm->context.huge_pte_count; 420 mm_rss = mm->context.huge_pte_count;
421 if (unlikely(mm_rss >= 421 if (unlikely(mm_rss >
422 mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit)) 422 mm->context.tsb_block[MM_TSB_HUGE].tsb_rss_limit))
423 tsb_grow(mm, MM_TSB_HUGE, mm_rss); 423 tsb_grow(mm, MM_TSB_HUGE, mm_rss);
424#endif 424#endif
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 54388d10bcf9..1488816588ea 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -762,7 +762,8 @@ static struct notifier_block panic_exit_notifier = {
762 762
763static int add_notifier(void) 763static int add_notifier(void)
764{ 764{
765 notifier_chain_register(&panic_notifier_list, &panic_exit_notifier); 765 atomic_notifier_chain_register(&panic_notifier_list,
766 &panic_exit_notifier);
766 return(0); 767 return(0);
767} 768}
768 769
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index fa617e0719ab..0336575d2448 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_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 */
@@ -71,7 +71,7 @@ struct io_thread_req {
71 int error; 71 int error;
72}; 72};
73 73
74extern int open_ubd_file(char *file, struct openflags *openflags, 74extern int open_ubd_file(char *file, struct openflags *openflags, int shared,
75 char **backing_file_out, int *bitmap_offset_out, 75 char **backing_file_out, int *bitmap_offset_out,
76 unsigned long *bitmap_len_out, int *data_offset_out, 76 unsigned long *bitmap_len_out, int *data_offset_out,
77 int *create_cow_out); 77 int *create_cow_out);
@@ -137,7 +137,7 @@ static int fake_major = MAJOR_NR;
137 137
138static struct gendisk *ubd_gendisk[MAX_DEV]; 138static struct gendisk *ubd_gendisk[MAX_DEV];
139static struct gendisk *fake_gendisk[MAX_DEV]; 139static struct gendisk *fake_gendisk[MAX_DEV];
140 140
141#ifdef CONFIG_BLK_DEV_UBD_SYNC 141#ifdef CONFIG_BLK_DEV_UBD_SYNC
142#define OPEN_FLAGS ((struct openflags) { .r = 1, .w = 1, .s = 1, .c = 0, \ 142#define OPEN_FLAGS ((struct openflags) { .r = 1, .w = 1, .s = 1, .c = 0, \
143 .cl = 1 }) 143 .cl = 1 })
@@ -168,6 +168,7 @@ struct ubd {
168 __u64 size; 168 __u64 size;
169 struct openflags boot_openflags; 169 struct openflags boot_openflags;
170 struct openflags openflags; 170 struct openflags openflags;
171 int shared;
171 int no_cow; 172 int no_cow;
172 struct cow cow; 173 struct cow cow;
173 struct platform_device pdev; 174 struct platform_device pdev;
@@ -189,6 +190,7 @@ struct ubd {
189 .boot_openflags = OPEN_FLAGS, \ 190 .boot_openflags = OPEN_FLAGS, \
190 .openflags = OPEN_FLAGS, \ 191 .openflags = OPEN_FLAGS, \
191 .no_cow = 0, \ 192 .no_cow = 0, \
193 .shared = 0, \
192 .cow = DEFAULT_COW, \ 194 .cow = DEFAULT_COW, \
193} 195}
194 196
@@ -305,7 +307,7 @@ static int ubd_setup_common(char *str, int *index_out)
305 } 307 }
306 major = simple_strtoul(str, &end, 0); 308 major = simple_strtoul(str, &end, 0);
307 if((*end != '\0') || (end == str)){ 309 if((*end != '\0') || (end == str)){
308 printk(KERN_ERR 310 printk(KERN_ERR
309 "ubd_setup : didn't parse major number\n"); 311 "ubd_setup : didn't parse major number\n");
310 return(1); 312 return(1);
311 } 313 }
@@ -316,7 +318,7 @@ static int ubd_setup_common(char *str, int *index_out)
316 printk(KERN_ERR "Can't assign a fake major twice\n"); 318 printk(KERN_ERR "Can't assign a fake major twice\n");
317 goto out1; 319 goto out1;
318 } 320 }
319 321
320 fake_major = major; 322 fake_major = major;
321 323
322 printk(KERN_INFO "Setting extra ubd major number to %d\n", 324 printk(KERN_INFO "Setting extra ubd major number to %d\n",
@@ -351,7 +353,7 @@ static int ubd_setup_common(char *str, int *index_out)
351 if (index_out) 353 if (index_out)
352 *index_out = n; 354 *index_out = n;
353 355
354 for (i = 0; i < 4; i++) { 356 for (i = 0; i < sizeof("rscd="); i++) {
355 switch (*str) { 357 switch (*str) {
356 case 'r': 358 case 'r':
357 flags.w = 0; 359 flags.w = 0;
@@ -362,11 +364,14 @@ static int ubd_setup_common(char *str, int *index_out)
362 case 'd': 364 case 'd':
363 dev->no_cow = 1; 365 dev->no_cow = 1;
364 break; 366 break;
367 case 'c':
368 dev->shared = 1;
369 break;
365 case '=': 370 case '=':
366 str++; 371 str++;
367 goto break_loop; 372 goto break_loop;
368 default: 373 default:
369 printk(KERN_ERR "ubd_setup : Expected '=' or flag letter (r,s or d)\n"); 374 printk(KERN_ERR "ubd_setup : Expected '=' or flag letter (r, s, c, or d)\n");
370 goto out; 375 goto out;
371 } 376 }
372 str++; 377 str++;
@@ -515,7 +520,7 @@ static void ubd_handler(void)
515 spin_unlock(&ubd_io_lock); 520 spin_unlock(&ubd_io_lock);
516 return; 521 return;
517 } 522 }
518 523
519 ubd_finish(rq, req.error); 524 ubd_finish(rq, req.error);
520 reactivate_fd(thread_fd, UBD_IRQ); 525 reactivate_fd(thread_fd, UBD_IRQ);
521 do_ubd_request(ubd_queue); 526 do_ubd_request(ubd_queue);
@@ -532,7 +537,7 @@ static int io_pid = -1;
532 537
533void kill_io_thread(void) 538void kill_io_thread(void)
534{ 539{
535 if(io_pid != -1) 540 if(io_pid != -1)
536 os_kill_process(io_pid, 1); 541 os_kill_process(io_pid, 1);
537} 542}
538 543
@@ -567,14 +572,15 @@ static int ubd_open_dev(struct ubd *dev)
567 create_cow = 0; 572 create_cow = 0;
568 create_ptr = (dev->cow.file != NULL) ? &create_cow : NULL; 573 create_ptr = (dev->cow.file != NULL) ? &create_cow : NULL;
569 back_ptr = dev->no_cow ? NULL : &dev->cow.file; 574 back_ptr = dev->no_cow ? NULL : &dev->cow.file;
570 dev->fd = open_ubd_file(dev->file, &dev->openflags, back_ptr, 575 dev->fd = open_ubd_file(dev->file, &dev->openflags, dev->shared,
571 &dev->cow.bitmap_offset, &dev->cow.bitmap_len, 576 back_ptr, &dev->cow.bitmap_offset,
572 &dev->cow.data_offset, create_ptr); 577 &dev->cow.bitmap_len, &dev->cow.data_offset,
578 create_ptr);
573 579
574 if((dev->fd == -ENOENT) && create_cow){ 580 if((dev->fd == -ENOENT) && create_cow){
575 dev->fd = create_cow_file(dev->file, dev->cow.file, 581 dev->fd = create_cow_file(dev->file, dev->cow.file,
576 dev->openflags, 1 << 9, PAGE_SIZE, 582 dev->openflags, 1 << 9, PAGE_SIZE,
577 &dev->cow.bitmap_offset, 583 &dev->cow.bitmap_offset,
578 &dev->cow.bitmap_len, 584 &dev->cow.bitmap_len,
579 &dev->cow.data_offset); 585 &dev->cow.data_offset);
580 if(dev->fd >= 0){ 586 if(dev->fd >= 0){
@@ -598,16 +604,16 @@ static int ubd_open_dev(struct ubd *dev)
598 } 604 }
599 flush_tlb_kernel_vm(); 605 flush_tlb_kernel_vm();
600 606
601 err = read_cow_bitmap(dev->fd, dev->cow.bitmap, 607 err = read_cow_bitmap(dev->fd, dev->cow.bitmap,
602 dev->cow.bitmap_offset, 608 dev->cow.bitmap_offset,
603 dev->cow.bitmap_len); 609 dev->cow.bitmap_len);
604 if(err < 0) 610 if(err < 0)
605 goto error; 611 goto error;
606 612
607 flags = dev->openflags; 613 flags = dev->openflags;
608 flags.w = 0; 614 flags.w = 0;
609 err = open_ubd_file(dev->cow.file, &flags, NULL, NULL, NULL, 615 err = open_ubd_file(dev->cow.file, &flags, dev->shared, NULL,
610 NULL, NULL); 616 NULL, NULL, NULL, NULL);
611 if(err < 0) goto error; 617 if(err < 0) goto error;
612 dev->cow.fd = err; 618 dev->cow.fd = err;
613 } 619 }
@@ -685,11 +691,11 @@ static int ubd_add(int n)
685 dev->size = ROUND_BLOCK(dev->size); 691 dev->size = ROUND_BLOCK(dev->size);
686 692
687 err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]); 693 err = ubd_new_disk(MAJOR_NR, dev->size, n, &ubd_gendisk[n]);
688 if(err) 694 if(err)
689 goto out_close; 695 goto out_close;
690 696
691 if(fake_major != MAJOR_NR) 697 if(fake_major != MAJOR_NR)
692 ubd_new_disk(fake_major, dev->size, n, 698 ubd_new_disk(fake_major, dev->size, n,
693 &fake_gendisk[n]); 699 &fake_gendisk[n]);
694 700
695 /* perhaps this should also be under the "if (fake_major)" above */ 701 /* perhaps this should also be under the "if (fake_major)" above */
@@ -854,7 +860,7 @@ int ubd_init(void)
854 return -1; 860 return -1;
855 } 861 }
856 platform_driver_register(&ubd_driver); 862 platform_driver_register(&ubd_driver);
857 for (i = 0; i < MAX_DEV; i++) 863 for (i = 0; i < MAX_DEV; i++)
858 ubd_add(i); 864 ubd_add(i);
859 return 0; 865 return 0;
860} 866}
@@ -872,16 +878,16 @@ int ubd_driver_init(void){
872 * enough. So use anyway the io thread. */ 878 * enough. So use anyway the io thread. */
873 } 879 }
874 stack = alloc_stack(0, 0); 880 stack = alloc_stack(0, 0);
875 io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *), 881 io_pid = start_io_thread(stack + PAGE_SIZE - sizeof(void *),
876 &thread_fd); 882 &thread_fd);
877 if(io_pid < 0){ 883 if(io_pid < 0){
878 printk(KERN_ERR 884 printk(KERN_ERR
879 "ubd : Failed to start I/O thread (errno = %d) - " 885 "ubd : Failed to start I/O thread (errno = %d) - "
880 "falling back to synchronous I/O\n", -io_pid); 886 "falling back to synchronous I/O\n", -io_pid);
881 io_pid = -1; 887 io_pid = -1;
882 return(0); 888 return(0);
883 } 889 }
884 err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr, 890 err = um_request_irq(UBD_IRQ, thread_fd, IRQ_READ, ubd_intr,
885 SA_INTERRUPT, "ubd", ubd_dev); 891 SA_INTERRUPT, "ubd", ubd_dev);
886 if(err != 0) 892 if(err != 0)
887 printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err); 893 printk(KERN_ERR "um_request_irq failed - errno = %d\n", -err);
@@ -978,7 +984,7 @@ static void cowify_req(struct io_thread_req *req, unsigned long *bitmap,
978 if(req->op == UBD_READ) { 984 if(req->op == UBD_READ) {
979 for(i = 0; i < req->length >> 9; i++){ 985 for(i = 0; i < req->length >> 9; i++){
980 if(ubd_test_bit(sector + i, (unsigned char *) bitmap)) 986 if(ubd_test_bit(sector + i, (unsigned char *) bitmap))
981 ubd_set_bit(i, (unsigned char *) 987 ubd_set_bit(i, (unsigned char *)
982 &req->sector_mask); 988 &req->sector_mask);
983 } 989 }
984 } 990 }
@@ -999,7 +1005,7 @@ static int prepare_request(struct request *req, struct io_thread_req *io_req)
999 1005
1000 /* This should be impossible now */ 1006 /* This should be impossible now */
1001 if((rq_data_dir(req) == WRITE) && !dev->openflags.w){ 1007 if((rq_data_dir(req) == WRITE) && !dev->openflags.w){
1002 printk("Write attempted on readonly ubd device %s\n", 1008 printk("Write attempted on readonly ubd device %s\n",
1003 disk->disk_name); 1009 disk->disk_name);
1004 end_request(req, 0); 1010 end_request(req, 0);
1005 return(1); 1011 return(1);
@@ -1182,7 +1188,7 @@ int read_cow_bitmap(int fd, void *buf, int offset, int len)
1182 return(0); 1188 return(0);
1183} 1189}
1184 1190
1185int open_ubd_file(char *file, struct openflags *openflags, 1191int open_ubd_file(char *file, struct openflags *openflags, int shared,
1186 char **backing_file_out, int *bitmap_offset_out, 1192 char **backing_file_out, int *bitmap_offset_out,
1187 unsigned long *bitmap_len_out, int *data_offset_out, 1193 unsigned long *bitmap_len_out, int *data_offset_out,
1188 int *create_cow_out) 1194 int *create_cow_out)
@@ -1206,10 +1212,14 @@ int open_ubd_file(char *file, struct openflags *openflags,
1206 return fd; 1212 return fd;
1207 } 1213 }
1208 1214
1209 err = os_lock_file(fd, openflags->w); 1215 if(shared)
1210 if(err < 0){ 1216 printk("Not locking \"%s\" on the host\n", file);
1211 printk("Failed to lock '%s', err = %d\n", file, -err); 1217 else {
1212 goto out_close; 1218 err = os_lock_file(fd, openflags->w);
1219 if(err < 0){
1220 printk("Failed to lock '%s', err = %d\n", file, -err);
1221 goto out_close;
1222 }
1213 } 1223 }
1214 1224
1215 /* Succesful return case! */ 1225 /* Succesful return case! */
@@ -1260,7 +1270,7 @@ int create_cow_file(char *cow_file, char *backing_file, struct openflags flags,
1260 int err, fd; 1270 int err, fd;
1261 1271
1262 flags.c = 1; 1272 flags.c = 1;
1263 fd = open_ubd_file(cow_file, &flags, NULL, NULL, NULL, NULL, NULL); 1273 fd = open_ubd_file(cow_file, &flags, 0, NULL, NULL, NULL, NULL, NULL);
1264 if(fd < 0){ 1274 if(fd < 0){
1265 err = fd; 1275 err = fd;
1266 printk("Open of COW file '%s' failed, errno = %d\n", cow_file, 1276 printk("Open of COW file '%s' failed, errno = %d\n", cow_file,
diff --git a/arch/um/include/irq_user.h b/arch/um/include/irq_user.h
index b61deb8b362a..69a93c804f0e 100644
--- a/arch/um/include/irq_user.h
+++ b/arch/um/include/irq_user.h
@@ -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 */
@@ -6,6 +6,17 @@
6#ifndef __IRQ_USER_H__ 6#ifndef __IRQ_USER_H__
7#define __IRQ_USER_H__ 7#define __IRQ_USER_H__
8 8
9struct irq_fd {
10 struct irq_fd *next;
11 void *id;
12 int fd;
13 int type;
14 int irq;
15 int pid;
16 int events;
17 int current_events;
18};
19
9enum { IRQ_READ, IRQ_WRITE }; 20enum { IRQ_READ, IRQ_WRITE };
10 21
11extern void sigio_handler(int sig, union uml_pt_regs *regs); 22extern void sigio_handler(int sig, union uml_pt_regs *regs);
@@ -16,8 +27,6 @@ extern void reactivate_fd(int fd, int irqnum);
16extern void deactivate_fd(int fd, int irqnum); 27extern void deactivate_fd(int fd, int irqnum);
17extern int deactivate_all_fds(void); 28extern int deactivate_all_fds(void);
18extern void forward_interrupts(int pid); 29extern void forward_interrupts(int pid);
19extern void init_irq_signals(int on_sigstack);
20extern void forward_ipi(int fd, int pid);
21extern int activate_ipi(int fd, int pid); 30extern int activate_ipi(int fd, int pid);
22extern unsigned long irq_lock(void); 31extern unsigned long irq_lock(void);
23extern void irq_unlock(unsigned long flags); 32extern void irq_unlock(unsigned long flags);
diff --git a/arch/um/include/kern.h b/arch/um/include/kern.h
index 7d223beccbc0..4ce3fc650e57 100644
--- a/arch/um/include/kern.h
+++ b/arch/um/include/kern.h
@@ -29,7 +29,7 @@ extern int getuid(void);
29extern int getgid(void); 29extern int getgid(void);
30extern int pause(void); 30extern int pause(void);
31extern int write(int, const void *, int); 31extern int write(int, const void *, int);
32extern int exit(int); 32extern void exit(int);
33extern int close(int); 33extern int close(int);
34extern int read(unsigned int, char *, int); 34extern int read(unsigned int, char *, int);
35extern int pipe(int *); 35extern int pipe(int *);
diff --git a/arch/um/include/misc_constants.h b/arch/um/include/misc_constants.h
new file mode 100644
index 000000000000..989bc08de36e
--- /dev/null
+++ b/arch/um/include/misc_constants.h
@@ -0,0 +1,6 @@
1#ifndef __MISC_CONSTANT_H_
2#define __MISC_CONSTANT_H_
3
4#include <user_constants.h>
5
6#endif
diff --git a/arch/um/include/os.h b/arch/um/include/os.h
index 2a1c64d8d0bf..d3d1bc6074ef 100644
--- a/arch/um/include/os.h
+++ b/arch/um/include/os.h
@@ -12,6 +12,7 @@
12#include "sysdep/ptrace.h" 12#include "sysdep/ptrace.h"
13#include "kern_util.h" 13#include "kern_util.h"
14#include "skas/mm_id.h" 14#include "skas/mm_id.h"
15#include "irq_user.h"
15 16
16#define OS_TYPE_FILE 1 17#define OS_TYPE_FILE 1
17#define OS_TYPE_DIR 2 18#define OS_TYPE_DIR 2
@@ -121,6 +122,7 @@ static inline struct openflags of_cloexec(struct openflags flags)
121 return(flags); 122 return(flags);
122} 123}
123 124
125/* file.c */
124extern int os_stat_file(const char *file_name, struct uml_stat *buf); 126extern int os_stat_file(const char *file_name, struct uml_stat *buf);
125extern int os_stat_fd(const int fd, struct uml_stat *buf); 127extern int os_stat_fd(const int fd, struct uml_stat *buf);
126extern int os_access(const char *file, int mode); 128extern int os_access(const char *file, int mode);
@@ -156,10 +158,20 @@ extern int os_connect_socket(char *name);
156extern int os_file_type(char *file); 158extern int os_file_type(char *file);
157extern int os_file_mode(char *file, struct openflags *mode_out); 159extern int os_file_mode(char *file, struct openflags *mode_out);
158extern int os_lock_file(int fd, int excl); 160extern int os_lock_file(int fd, int excl);
161extern void os_flush_stdout(void);
162extern int os_stat_filesystem(char *path, long *bsize_out,
163 long long *blocks_out, long long *bfree_out,
164 long long *bavail_out, long long *files_out,
165 long long *ffree_out, void *fsid_out,
166 int fsid_size, long *namelen_out,
167 long *spare_out);
168extern int os_change_dir(char *dir);
169extern int os_fchange_dir(int fd);
159 170
160/* start_up.c */ 171/* start_up.c */
161extern void os_early_checks(void); 172extern void os_early_checks(void);
162extern int can_do_skas(void); 173extern int can_do_skas(void);
174extern void os_check_bugs(void);
163 175
164/* Make sure they are clear when running in TT mode. Required by 176/* Make sure they are clear when running in TT mode. Required by
165 * SEGV_MAYBE_FIXABLE */ 177 * SEGV_MAYBE_FIXABLE */
@@ -198,6 +210,8 @@ extern void os_flush_stdout(void);
198/* tt.c 210/* tt.c
199 * for tt mode only (will be deleted in future...) 211 * for tt mode only (will be deleted in future...)
200 */ 212 */
213extern void forward_ipi(int fd, int pid);
214extern void kill_child_dead(int pid);
201extern void stop(void); 215extern void stop(void);
202extern int wait_for_stop(int pid, int sig, int cont_type, void *relay); 216extern int wait_for_stop(int pid, int sig, int cont_type, void *relay);
203extern int protect_memory(unsigned long addr, unsigned long len, 217extern int protect_memory(unsigned long addr, unsigned long len,
@@ -294,4 +308,26 @@ extern void initial_thread_cb_skas(void (*proc)(void *),
294extern void halt_skas(void); 308extern void halt_skas(void);
295extern void reboot_skas(void); 309extern void reboot_skas(void);
296 310
311/* irq.c */
312extern int os_waiting_for_events(struct irq_fd *active_fds);
313extern int os_isatty(int fd);
314extern int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds);
315extern void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg,
316 struct irq_fd *active_fds, struct irq_fd ***last_irq_ptr2);
317extern void os_free_irq_later(struct irq_fd *active_fds,
318 int irq, void *dev_id);
319extern int os_get_pollfd(int i);
320extern void os_set_pollfd(int i, int fd);
321extern void os_set_ioignore(void);
322extern void init_irq_signals(int on_sigstack);
323
324/* sigio.c */
325extern void write_sigio_workaround(void);
326extern int add_sigio_fd(int fd, int read);
327extern int ignore_sigio_fd(int fd);
328
329/* skas/trap */
330extern void sig_handler_common_skas(int sig, void *sc_ptr);
331extern void user_signal(int sig, union uml_pt_regs *regs, int pid);
332
297#endif 333#endif
diff --git a/arch/um/include/sigio.h b/arch/um/include/sigio.h
index 37d76e29a147..fe99ea163c2e 100644
--- a/arch/um/include/sigio.h
+++ b/arch/um/include/sigio.h
@@ -8,9 +8,6 @@
8 8
9extern int write_sigio_irq(int fd); 9extern int write_sigio_irq(int fd);
10extern int register_sigio_fd(int fd); 10extern int register_sigio_fd(int fd);
11extern int read_sigio_fd(int fd);
12extern int add_sigio_fd(int fd, int read);
13extern int ignore_sigio_fd(int fd);
14extern void sigio_lock(void); 11extern void sigio_lock(void);
15extern void sigio_unlock(void); 12extern void sigio_unlock(void);
16 13
diff --git a/arch/um/include/skas/mode-skas.h b/arch/um/include/skas/mode-skas.h
index 260065cfeef1..8bc6916bbbb1 100644
--- a/arch/um/include/skas/mode-skas.h
+++ b/arch/um/include/skas/mode-skas.h
@@ -13,7 +13,6 @@ extern unsigned long exec_fp_regs[];
13extern unsigned long exec_fpx_regs[]; 13extern unsigned long exec_fpx_regs[];
14extern int have_fpx_regs; 14extern int have_fpx_regs;
15 15
16extern void sig_handler_common_skas(int sig, void *sc_ptr);
17extern void kill_off_processes_skas(void); 16extern void kill_off_processes_skas(void);
18 17
19#endif 18#endif
diff --git a/arch/um/include/skas/skas.h b/arch/um/include/skas/skas.h
index 86357282d681..853b26f148c5 100644
--- a/arch/um/include/skas/skas.h
+++ b/arch/um/include/skas/skas.h
@@ -17,7 +17,6 @@ extern int user_thread(unsigned long stack, int flags);
17extern void new_thread_proc(void *stack, void (*handler)(int sig)); 17extern void new_thread_proc(void *stack, void (*handler)(int sig));
18extern void new_thread_handler(int sig); 18extern void new_thread_handler(int sig);
19extern void handle_syscall(union uml_pt_regs *regs); 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); 20extern int new_mm(unsigned long stack);
22extern void get_skas_faultinfo(int pid, struct faultinfo * fi); 21extern void get_skas_faultinfo(int pid, struct faultinfo * fi);
23extern long execute_syscall_skas(void *r); 22extern long execute_syscall_skas(void *r);
diff --git a/arch/um/include/user_util.h b/arch/um/include/user_util.h
index a6f1f176cf84..992a7e1e0fca 100644
--- a/arch/um/include/user_util.h
+++ b/arch/um/include/user_util.h
@@ -58,7 +58,6 @@ extern int attach(int pid);
58extern void kill_child_dead(int pid); 58extern void kill_child_dead(int pid);
59extern int cont(int pid); 59extern int cont(int pid);
60extern void check_sigio(void); 60extern void check_sigio(void);
61extern void write_sigio_workaround(void);
62extern void arch_check_bugs(void); 61extern void arch_check_bugs(void);
63extern int cpu_feature(char *what, char *buf, int len); 62extern int cpu_feature(char *what, char *buf, int len);
64extern int arch_handle_signal(int sig, union uml_pt_regs *regs); 63extern int arch_handle_signal(int sig, union uml_pt_regs *regs);
diff --git a/arch/um/kernel/Makefile b/arch/um/kernel/Makefile
index 693018ba80f1..fe08971b64cf 100644
--- a/arch/um/kernel/Makefile
+++ b/arch/um/kernel/Makefile
@@ -7,23 +7,20 @@ extra-y := vmlinux.lds
7clean-files := 7clean-files :=
8 8
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 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_kern.o \
12 signal_kern.o smp.o syscall_kern.o sysrq.o \ 12 signal_kern.o smp.o syscall_kern.o sysrq.o \
13 time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o 13 time_kern.o tlb.o trap_kern.o uaccess.o um_arch.o umid.o
14 14
15obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o 15obj-$(CONFIG_BLK_DEV_INITRD) += initrd.o
16obj-$(CONFIG_GPROF) += gprof_syms.o 16obj-$(CONFIG_GPROF) += gprof_syms.o
17obj-$(CONFIG_GCOV) += gmon_syms.o 17obj-$(CONFIG_GCOV) += gmon_syms.o
18obj-$(CONFIG_TTY_LOG) += tty_log.o
19obj-$(CONFIG_SYSCALL_DEBUG) += syscall.o 18obj-$(CONFIG_SYSCALL_DEBUG) += syscall.o
20 19
21obj-$(CONFIG_MODE_TT) += tt/ 20obj-$(CONFIG_MODE_TT) += tt/
22obj-$(CONFIG_MODE_SKAS) += skas/ 21obj-$(CONFIG_MODE_SKAS) += skas/
23 22
24user-objs-$(CONFIG_TTY_LOG) += tty_log.o 23USER_OBJS := config.o
25
26USER_OBJS := $(user-objs-y) config.o tty_log.o
27 24
28include arch/um/scripts/Makefile.rules 25include arch/um/scripts/Makefile.rules
29 26
diff --git a/arch/um/kernel/exec_kern.c b/arch/um/kernel/exec_kern.c
index c264e1c05ab3..1ca84319317d 100644
--- a/arch/um/kernel/exec_kern.c
+++ b/arch/um/kernel/exec_kern.c
@@ -30,8 +30,6 @@ void start_thread(struct pt_regs *regs, unsigned long eip, unsigned long esp)
30 CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp); 30 CHOOSE_MODE_PROC(start_thread_tt, start_thread_skas, regs, eip, esp);
31} 31}
32 32
33extern void log_exec(char **argv, void *tty);
34
35static long execve1(char *file, char __user * __user *argv, 33static long execve1(char *file, char __user * __user *argv,
36 char __user *__user *env) 34 char __user *__user *env)
37{ 35{
diff --git a/arch/um/kernel/irq.c b/arch/um/kernel/irq.c
index bbf94bf2921e..c39ea3abeda4 100644
--- a/arch/um/kernel/irq.c
+++ b/arch/um/kernel/irq.c
@@ -31,6 +31,8 @@
31#include "irq_user.h" 31#include "irq_user.h"
32#include "irq_kern.h" 32#include "irq_kern.h"
33#include "os.h" 33#include "os.h"
34#include "sigio.h"
35#include "misc_constants.h"
34 36
35/* 37/*
36 * Generic, controller-independent functions: 38 * Generic, controller-independent functions:
@@ -77,6 +79,298 @@ skip:
77 return 0; 79 return 0;
78} 80}
79 81
82struct irq_fd *active_fds = NULL;
83static struct irq_fd **last_irq_ptr = &active_fds;
84
85extern void free_irqs(void);
86
87void sigio_handler(int sig, union uml_pt_regs *regs)
88{
89 struct irq_fd *irq_fd;
90 int n;
91
92 if(smp_sigio_handler()) return;
93 while(1){
94 n = os_waiting_for_events(active_fds);
95 if (n <= 0) {
96 if(n == -EINTR) continue;
97 else break;
98 }
99
100 for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
101 if(irq_fd->current_events != 0){
102 irq_fd->current_events = 0;
103 do_IRQ(irq_fd->irq, regs);
104 }
105 }
106 }
107
108 free_irqs();
109}
110
111static void maybe_sigio_broken(int fd, int type)
112{
113 if(os_isatty(fd)){
114 if((type == IRQ_WRITE) && !pty_output_sigio){
115 write_sigio_workaround();
116 add_sigio_fd(fd, 0);
117 }
118 else if((type == IRQ_READ) && !pty_close_sigio){
119 write_sigio_workaround();
120 add_sigio_fd(fd, 1);
121 }
122 }
123}
124
125
126int activate_fd(int irq, int fd, int type, void *dev_id)
127{
128 struct pollfd *tmp_pfd;
129 struct irq_fd *new_fd, *irq_fd;
130 unsigned long flags;
131 int pid, events, err, n;
132
133 pid = os_getpid();
134 err = os_set_fd_async(fd, pid);
135 if(err < 0)
136 goto out;
137
138 new_fd = um_kmalloc(sizeof(*new_fd));
139 err = -ENOMEM;
140 if(new_fd == NULL)
141 goto out;
142
143 if(type == IRQ_READ) events = UM_POLLIN | UM_POLLPRI;
144 else events = UM_POLLOUT;
145 *new_fd = ((struct irq_fd) { .next = NULL,
146 .id = dev_id,
147 .fd = fd,
148 .type = type,
149 .irq = irq,
150 .pid = pid,
151 .events = events,
152 .current_events = 0 } );
153
154 /* Critical section - locked by a spinlock because this stuff can
155 * be changed from interrupt handlers. The stuff above is done
156 * outside the lock because it allocates memory.
157 */
158
159 /* Actually, it only looks like it can be called from interrupt
160 * context. The culprit is reactivate_fd, which calls
161 * maybe_sigio_broken, which calls write_sigio_workaround,
162 * which calls activate_fd. However, write_sigio_workaround should
163 * only be called once, at boot time. That would make it clear that
164 * this is called only from process context, and can be locked with
165 * a semaphore.
166 */
167 flags = irq_lock();
168 for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
169 if((irq_fd->fd == fd) && (irq_fd->type == type)){
170 printk("Registering fd %d twice\n", fd);
171 printk("Irqs : %d, %d\n", irq_fd->irq, irq);
172 printk("Ids : 0x%p, 0x%p\n", irq_fd->id, dev_id);
173 goto out_unlock;
174 }
175 }
176
177 /*-------------*/
178 if(type == IRQ_WRITE)
179 fd = -1;
180
181 tmp_pfd = NULL;
182 n = 0;
183
184 while(1){
185 n = os_create_pollfd(fd, events, tmp_pfd, n);
186 if (n == 0)
187 break;
188
189 /* n > 0
190 * It means we couldn't put new pollfd to current pollfds
191 * and tmp_fds is NULL or too small for new pollfds array.
192 * Needed size is equal to n as minimum.
193 *
194 * Here we have to drop the lock in order to call
195 * kmalloc, which might sleep.
196 * If something else came in and changed the pollfds array
197 * so we will not be able to put new pollfd struct to pollfds
198 * then we free the buffer tmp_fds and try again.
199 */
200 irq_unlock(flags);
201 if (tmp_pfd != NULL) {
202 kfree(tmp_pfd);
203 tmp_pfd = NULL;
204 }
205
206 tmp_pfd = um_kmalloc(n);
207 if (tmp_pfd == NULL)
208 goto out_kfree;
209
210 flags = irq_lock();
211 }
212 /*-------------*/
213
214 *last_irq_ptr = new_fd;
215 last_irq_ptr = &new_fd->next;
216
217 irq_unlock(flags);
218
219 /* This calls activate_fd, so it has to be outside the critical
220 * section.
221 */
222 maybe_sigio_broken(fd, type);
223
224 return(0);
225
226 out_unlock:
227 irq_unlock(flags);
228 out_kfree:
229 kfree(new_fd);
230 out:
231 return(err);
232}
233
234static void free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg)
235{
236 unsigned long flags;
237
238 flags = irq_lock();
239 os_free_irq_by_cb(test, arg, active_fds, &last_irq_ptr);
240 irq_unlock(flags);
241}
242
243struct irq_and_dev {
244 int irq;
245 void *dev;
246};
247
248static int same_irq_and_dev(struct irq_fd *irq, void *d)
249{
250 struct irq_and_dev *data = d;
251
252 return((irq->irq == data->irq) && (irq->id == data->dev));
253}
254
255void free_irq_by_irq_and_dev(unsigned int irq, void *dev)
256{
257 struct irq_and_dev data = ((struct irq_and_dev) { .irq = irq,
258 .dev = dev });
259
260 free_irq_by_cb(same_irq_and_dev, &data);
261}
262
263static int same_fd(struct irq_fd *irq, void *fd)
264{
265 return(irq->fd == *((int *) fd));
266}
267
268void free_irq_by_fd(int fd)
269{
270 free_irq_by_cb(same_fd, &fd);
271}
272
273static struct irq_fd *find_irq_by_fd(int fd, int irqnum, int *index_out)
274{
275 struct irq_fd *irq;
276 int i = 0;
277 int fdi;
278
279 for(irq=active_fds; irq != NULL; irq = irq->next){
280 if((irq->fd == fd) && (irq->irq == irqnum)) break;
281 i++;
282 }
283 if(irq == NULL){
284 printk("find_irq_by_fd doesn't have descriptor %d\n", fd);
285 goto out;
286 }
287 fdi = os_get_pollfd(i);
288 if((fdi != -1) && (fdi != fd)){
289 printk("find_irq_by_fd - mismatch between active_fds and "
290 "pollfds, fd %d vs %d, need %d\n", irq->fd,
291 fdi, fd);
292 irq = NULL;
293 goto out;
294 }
295 *index_out = i;
296 out:
297 return(irq);
298}
299
300void reactivate_fd(int fd, int irqnum)
301{
302 struct irq_fd *irq;
303 unsigned long flags;
304 int i;
305
306 flags = irq_lock();
307 irq = find_irq_by_fd(fd, irqnum, &i);
308 if(irq == NULL){
309 irq_unlock(flags);
310 return;
311 }
312 os_set_pollfd(i, irq->fd);
313 irq_unlock(flags);
314
315 /* This calls activate_fd, so it has to be outside the critical
316 * section.
317 */
318 maybe_sigio_broken(fd, irq->type);
319}
320
321void deactivate_fd(int fd, int irqnum)
322{
323 struct irq_fd *irq;
324 unsigned long flags;
325 int i;
326
327 flags = irq_lock();
328 irq = find_irq_by_fd(fd, irqnum, &i);
329 if(irq == NULL)
330 goto out;
331 os_set_pollfd(i, -1);
332 out:
333 irq_unlock(flags);
334}
335
336int deactivate_all_fds(void)
337{
338 struct irq_fd *irq;
339 int err;
340
341 for(irq=active_fds;irq != NULL;irq = irq->next){
342 err = os_clear_fd_async(irq->fd);
343 if(err)
344 return(err);
345 }
346 /* If there is a signal already queued, after unblocking ignore it */
347 os_set_ioignore();
348
349 return(0);
350}
351
352void forward_interrupts(int pid)
353{
354 struct irq_fd *irq;
355 unsigned long flags;
356 int err;
357
358 flags = irq_lock();
359 for(irq=active_fds;irq != NULL;irq = irq->next){
360 err = os_set_owner(irq->fd, pid);
361 if(err < 0){
362 /* XXX Just remove the irq rather than
363 * print out an infinite stream of these
364 */
365 printk("Failed to forward %d to pid %d, err = %d\n",
366 irq->fd, pid, -err);
367 }
368
369 irq->pid = pid;
370 }
371 irq_unlock(flags);
372}
373
80/* 374/*
81 * do_IRQ handles all normal device IRQ's (the special 375 * do_IRQ handles all normal device IRQ's (the special
82 * SMP cross-CPU interrupts have their own specific 376 * SMP cross-CPU interrupts have their own specific
diff --git a/arch/um/kernel/irq_user.c b/arch/um/kernel/irq_user.c
deleted file mode 100644
index 0e32f5f4a887..000000000000
--- a/arch/um/kernel/irq_user.c
+++ /dev/null
@@ -1,412 +0,0 @@
1/*
2 * Copyright (C) 2000 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#include <stdlib.h>
7#include <unistd.h>
8#include <errno.h>
9#include <signal.h>
10#include <string.h>
11#include <sys/poll.h>
12#include <sys/types.h>
13#include <sys/time.h>
14#include "user_util.h"
15#include "kern_util.h"
16#include "user.h"
17#include "process.h"
18#include "sigio.h"
19#include "irq_user.h"
20#include "os.h"
21
22struct irq_fd {
23 struct irq_fd *next;
24 void *id;
25 int fd;
26 int type;
27 int irq;
28 int pid;
29 int events;
30 int current_events;
31};
32
33static struct irq_fd *active_fds = NULL;
34static struct irq_fd **last_irq_ptr = &active_fds;
35
36static struct pollfd *pollfds = NULL;
37static int pollfds_num = 0;
38static int pollfds_size = 0;
39
40extern int io_count, intr_count;
41
42extern void free_irqs(void);
43
44void sigio_handler(int sig, union uml_pt_regs *regs)
45{
46 struct irq_fd *irq_fd;
47 int i, n;
48
49 if(smp_sigio_handler()) return;
50 while(1){
51 n = poll(pollfds, pollfds_num, 0);
52 if(n < 0){
53 if(errno == EINTR) continue;
54 printk("sigio_handler : poll returned %d, "
55 "errno = %d\n", n, errno);
56 break;
57 }
58 if(n == 0) break;
59
60 irq_fd = active_fds;
61 for(i = 0; i < pollfds_num; i++){
62 if(pollfds[i].revents != 0){
63 irq_fd->current_events = pollfds[i].revents;
64 pollfds[i].fd = -1;
65 }
66 irq_fd = irq_fd->next;
67 }
68
69 for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
70 if(irq_fd->current_events != 0){
71 irq_fd->current_events = 0;
72 do_IRQ(irq_fd->irq, regs);
73 }
74 }
75 }
76
77 free_irqs();
78}
79
80int activate_ipi(int fd, int pid)
81{
82 return(os_set_fd_async(fd, pid));
83}
84
85static void maybe_sigio_broken(int fd, int type)
86{
87 if(isatty(fd)){
88 if((type == IRQ_WRITE) && !pty_output_sigio){
89 write_sigio_workaround();
90 add_sigio_fd(fd, 0);
91 }
92 else if((type == IRQ_READ) && !pty_close_sigio){
93 write_sigio_workaround();
94 add_sigio_fd(fd, 1);
95 }
96 }
97}
98
99int activate_fd(int irq, int fd, int type, void *dev_id)
100{
101 struct pollfd *tmp_pfd;
102 struct irq_fd *new_fd, *irq_fd;
103 unsigned long flags;
104 int pid, events, err, n, size;
105
106 pid = os_getpid();
107 err = os_set_fd_async(fd, pid);
108 if(err < 0)
109 goto out;
110
111 new_fd = um_kmalloc(sizeof(*new_fd));
112 err = -ENOMEM;
113 if(new_fd == NULL)
114 goto out;
115
116 if(type == IRQ_READ) events = POLLIN | POLLPRI;
117 else events = POLLOUT;
118 *new_fd = ((struct irq_fd) { .next = NULL,
119 .id = dev_id,
120 .fd = fd,
121 .type = type,
122 .irq = irq,
123 .pid = pid,
124 .events = events,
125 .current_events = 0 } );
126
127 /* Critical section - locked by a spinlock because this stuff can
128 * be changed from interrupt handlers. The stuff above is done
129 * outside the lock because it allocates memory.
130 */
131
132 /* Actually, it only looks like it can be called from interrupt
133 * context. The culprit is reactivate_fd, which calls
134 * maybe_sigio_broken, which calls write_sigio_workaround,
135 * which calls activate_fd. However, write_sigio_workaround should
136 * only be called once, at boot time. That would make it clear that
137 * this is called only from process context, and can be locked with
138 * a semaphore.
139 */
140 flags = irq_lock();
141 for(irq_fd = active_fds; irq_fd != NULL; irq_fd = irq_fd->next){
142 if((irq_fd->fd == fd) && (irq_fd->type == type)){
143 printk("Registering fd %d twice\n", fd);
144 printk("Irqs : %d, %d\n", irq_fd->irq, irq);
145 printk("Ids : 0x%x, 0x%x\n", irq_fd->id, dev_id);
146 goto out_unlock;
147 }
148 }
149
150 n = pollfds_num;
151 if(n == pollfds_size){
152 while(1){
153 /* Here we have to drop the lock in order to call
154 * kmalloc, which might sleep. If something else
155 * came in and changed the pollfds array, we free
156 * the buffer and try again.
157 */
158 irq_unlock(flags);
159 size = (pollfds_num + 1) * sizeof(pollfds[0]);
160 tmp_pfd = um_kmalloc(size);
161 flags = irq_lock();
162 if(tmp_pfd == NULL)
163 goto out_unlock;
164 if(n == pollfds_size)
165 break;
166 kfree(tmp_pfd);
167 }
168 if(pollfds != NULL){
169 memcpy(tmp_pfd, pollfds,
170 sizeof(pollfds[0]) * pollfds_size);
171 kfree(pollfds);
172 }
173 pollfds = tmp_pfd;
174 pollfds_size++;
175 }
176
177 if(type == IRQ_WRITE)
178 fd = -1;
179
180 pollfds[pollfds_num] = ((struct pollfd) { .fd = fd,
181 .events = events,
182 .revents = 0 });
183 pollfds_num++;
184
185 *last_irq_ptr = new_fd;
186 last_irq_ptr = &new_fd->next;
187
188 irq_unlock(flags);
189
190 /* This calls activate_fd, so it has to be outside the critical
191 * section.
192 */
193 maybe_sigio_broken(fd, type);
194
195 return(0);
196
197 out_unlock:
198 irq_unlock(flags);
199 kfree(new_fd);
200 out:
201 return(err);
202}
203
204static void free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg)
205{
206 struct irq_fd **prev;
207 unsigned long flags;
208 int i = 0;
209
210 flags = irq_lock();
211 prev = &active_fds;
212 while(*prev != NULL){
213 if((*test)(*prev, arg)){
214 struct irq_fd *old_fd = *prev;
215 if((pollfds[i].fd != -1) &&
216 (pollfds[i].fd != (*prev)->fd)){
217 printk("free_irq_by_cb - mismatch between "
218 "active_fds and pollfds, fd %d vs %d\n",
219 (*prev)->fd, pollfds[i].fd);
220 goto out;
221 }
222
223 pollfds_num--;
224
225 /* This moves the *whole* array after pollfds[i] (though
226 * it doesn't spot as such)! */
227
228 memmove(&pollfds[i], &pollfds[i + 1],
229 (pollfds_num - i) * sizeof(pollfds[0]));
230
231 if(last_irq_ptr == &old_fd->next)
232 last_irq_ptr = prev;
233 *prev = (*prev)->next;
234 if(old_fd->type == IRQ_WRITE)
235 ignore_sigio_fd(old_fd->fd);
236 kfree(old_fd);
237 continue;
238 }
239 prev = &(*prev)->next;
240 i++;
241 }
242 out:
243 irq_unlock(flags);
244}
245
246struct irq_and_dev {
247 int irq;
248 void *dev;
249};
250
251static int same_irq_and_dev(struct irq_fd *irq, void *d)
252{
253 struct irq_and_dev *data = d;
254
255 return((irq->irq == data->irq) && (irq->id == data->dev));
256}
257
258void free_irq_by_irq_and_dev(unsigned int irq, void *dev)
259{
260 struct irq_and_dev data = ((struct irq_and_dev) { .irq = irq,
261 .dev = dev });
262
263 free_irq_by_cb(same_irq_and_dev, &data);
264}
265
266static int same_fd(struct irq_fd *irq, void *fd)
267{
268 return(irq->fd == *((int *) fd));
269}
270
271void free_irq_by_fd(int fd)
272{
273 free_irq_by_cb(same_fd, &fd);
274}
275
276static struct irq_fd *find_irq_by_fd(int fd, int irqnum, int *index_out)
277{
278 struct irq_fd *irq;
279 int i = 0;
280
281 for(irq=active_fds; irq != NULL; irq = irq->next){
282 if((irq->fd == fd) && (irq->irq == irqnum)) break;
283 i++;
284 }
285 if(irq == NULL){
286 printk("find_irq_by_fd doesn't have descriptor %d\n", fd);
287 goto out;
288 }
289 if((pollfds[i].fd != -1) && (pollfds[i].fd != fd)){
290 printk("find_irq_by_fd - mismatch between active_fds and "
291 "pollfds, fd %d vs %d, need %d\n", irq->fd,
292 pollfds[i].fd, fd);
293 irq = NULL;
294 goto out;
295 }
296 *index_out = i;
297 out:
298 return(irq);
299}
300
301void reactivate_fd(int fd, int irqnum)
302{
303 struct irq_fd *irq;
304 unsigned long flags;
305 int i;
306
307 flags = irq_lock();
308 irq = find_irq_by_fd(fd, irqnum, &i);
309 if(irq == NULL){
310 irq_unlock(flags);
311 return;
312 }
313
314 pollfds[i].fd = irq->fd;
315
316 irq_unlock(flags);
317
318 /* This calls activate_fd, so it has to be outside the critical
319 * section.
320 */
321 maybe_sigio_broken(fd, irq->type);
322}
323
324void deactivate_fd(int fd, int irqnum)
325{
326 struct irq_fd *irq;
327 unsigned long flags;
328 int i;
329
330 flags = irq_lock();
331 irq = find_irq_by_fd(fd, irqnum, &i);
332 if(irq == NULL)
333 goto out;
334 pollfds[i].fd = -1;
335 out:
336 irq_unlock(flags);
337}
338
339int deactivate_all_fds(void)
340{
341 struct irq_fd *irq;
342 int err;
343
344 for(irq=active_fds;irq != NULL;irq = irq->next){
345 err = os_clear_fd_async(irq->fd);
346 if(err)
347 return(err);
348 }
349 /* If there is a signal already queued, after unblocking ignore it */
350 set_handler(SIGIO, SIG_IGN, 0, -1);
351
352 return(0);
353}
354
355void forward_ipi(int fd, int pid)
356{
357 int err;
358
359 err = os_set_owner(fd, pid);
360 if(err < 0)
361 printk("forward_ipi: set_owner failed, fd = %d, me = %d, "
362 "target = %d, err = %d\n", fd, os_getpid(), pid, -err);
363}
364
365void forward_interrupts(int pid)
366{
367 struct irq_fd *irq;
368 unsigned long flags;
369 int err;
370
371 flags = irq_lock();
372 for(irq=active_fds;irq != NULL;irq = irq->next){
373 err = os_set_owner(irq->fd, pid);
374 if(err < 0){
375 /* XXX Just remove the irq rather than
376 * print out an infinite stream of these
377 */
378 printk("Failed to forward %d to pid %d, err = %d\n",
379 irq->fd, pid, -err);
380 }
381
382 irq->pid = pid;
383 }
384 irq_unlock(flags);
385}
386
387void init_irq_signals(int on_sigstack)
388{
389 __sighandler_t h;
390 int flags;
391
392 flags = on_sigstack ? SA_ONSTACK : 0;
393 if(timer_irq_inited) h = (__sighandler_t) alarm_handler;
394 else h = boot_timer_handler;
395
396 set_handler(SIGVTALRM, h, flags | SA_RESTART,
397 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, -1);
398 set_handler(SIGIO, (__sighandler_t) sig_handler, flags | SA_RESTART,
399 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
400 signal(SIGWINCH, SIG_IGN);
401}
402
403/*
404 * Overrides for Emacs so that we follow Linus's tabbing style.
405 * Emacs will notice this stuff at the end of the file and automatically
406 * adjust the settings for this buffer only. This must remain at the end
407 * of the file.
408 * ---------------------------------------------------------------------------
409 * Local variables:
410 * c-file-style: "linux"
411 * End:
412 */
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index 0e65340eee33..0500800df1c1 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -9,6 +9,7 @@
9#include "linux/vmalloc.h" 9#include "linux/vmalloc.h"
10#include "linux/bootmem.h" 10#include "linux/bootmem.h"
11#include "linux/module.h" 11#include "linux/module.h"
12#include "linux/pfn.h"
12#include "asm/types.h" 13#include "asm/types.h"
13#include "asm/pgtable.h" 14#include "asm/pgtable.h"
14#include "kern_util.h" 15#include "kern_util.h"
@@ -316,8 +317,6 @@ void map_memory(unsigned long virt, unsigned long phys, unsigned long len,
316 } 317 }
317} 318}
318 319
319#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
320
321extern int __syscall_stub_start, __binary_start; 320extern int __syscall_stub_start, __binary_start;
322 321
323void setup_physmem(unsigned long start, unsigned long reserve_end, 322void setup_physmem(unsigned long start, unsigned long reserve_end,
diff --git a/arch/um/kernel/sigio_kern.c b/arch/um/kernel/sigio_kern.c
index 229988463c4c..1c1300fb1e95 100644
--- a/arch/um/kernel/sigio_kern.c
+++ b/arch/um/kernel/sigio_kern.c
@@ -1,4 +1,4 @@
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 */
@@ -12,13 +12,16 @@
12#include "sigio.h" 12#include "sigio.h"
13#include "irq_user.h" 13#include "irq_user.h"
14#include "irq_kern.h" 14#include "irq_kern.h"
15#include "os.h"
15 16
16/* Protected by sigio_lock() called from write_sigio_workaround */ 17/* Protected by sigio_lock() called from write_sigio_workaround */
17static int sigio_irq_fd = -1; 18static int sigio_irq_fd = -1;
18 19
19static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused) 20static irqreturn_t sigio_interrupt(int irq, void *data, struct pt_regs *unused)
20{ 21{
21 read_sigio_fd(sigio_irq_fd); 22 char c;
23
24 os_read_file(sigio_irq_fd, &c, sizeof(c));
22 reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ); 25 reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ);
23 return(IRQ_HANDLED); 26 return(IRQ_HANDLED);
24} 27}
@@ -51,6 +54,9 @@ void sigio_unlock(void)
51 spin_unlock(&sigio_spinlock); 54 spin_unlock(&sigio_spinlock);
52} 55}
53 56
57extern void sigio_cleanup(void);
58__uml_exitcall(sigio_cleanup);
59
54/* 60/*
55 * Overrides for Emacs so that we follow Linus's tabbing style. 61 * Overrides for Emacs so that we follow Linus's tabbing style.
56 * Emacs will notice this stuff at the end of the file and automatically 62 * Emacs will notice this stuff at the end of the file and automatically
diff --git a/arch/um/kernel/smp.c b/arch/um/kernel/smp.c
index 72113b0a96e7..511116aebaf7 100644
--- a/arch/um/kernel/smp.c
+++ b/arch/um/kernel/smp.c
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com) 2 * Copyright (C) 2000 - 2003 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
@@ -77,9 +77,9 @@ static int idle_proc(void *cpup)
77 if(err < 0) 77 if(err < 0)
78 panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err); 78 panic("CPU#%d failed to create IPI pipe, err = %d", cpu, -err);
79 79
80 activate_ipi(cpu_data[cpu].ipi_pipe[0], 80 os_set_fd_async(cpu_data[cpu].ipi_pipe[0],
81 current->thread.mode.tt.extern_pid); 81 current->thread.mode.tt.extern_pid);
82 82
83 wmb(); 83 wmb();
84 if (cpu_test_and_set(cpu, cpu_callin_map)) { 84 if (cpu_test_and_set(cpu, cpu_callin_map)) {
85 printk("huh, CPU#%d already present??\n", cpu); 85 printk("huh, CPU#%d already present??\n", cpu);
@@ -106,7 +106,7 @@ static struct task_struct *idle_thread(int cpu)
106 panic("copy_process failed in idle_thread, error = %ld", 106 panic("copy_process failed in idle_thread, error = %ld",
107 PTR_ERR(new_task)); 107 PTR_ERR(new_task));
108 108
109 cpu_tasks[cpu] = ((struct cpu_task) 109 cpu_tasks[cpu] = ((struct cpu_task)
110 { .pid = new_task->thread.mode.tt.extern_pid, 110 { .pid = new_task->thread.mode.tt.extern_pid,
111 .task = new_task } ); 111 .task = new_task } );
112 idle_threads[cpu] = new_task; 112 idle_threads[cpu] = new_task;
@@ -134,16 +134,15 @@ void smp_prepare_cpus(unsigned int maxcpus)
134 if(err < 0) 134 if(err < 0)
135 panic("CPU#0 failed to create IPI pipe, errno = %d", -err); 135 panic("CPU#0 failed to create IPI pipe, errno = %d", -err);
136 136
137 activate_ipi(cpu_data[me].ipi_pipe[0], 137 os_set_fd_async(cpu_data[me].ipi_pipe[0],
138 current->thread.mode.tt.extern_pid); 138 current->thread.mode.tt.extern_pid);
139 139
140 for(cpu = 1; cpu < ncpus; cpu++){ 140 for(cpu = 1; cpu < ncpus; cpu++){
141 printk("Booting processor %d...\n", cpu); 141 printk("Booting processor %d...\n", cpu);
142 142
143 idle = idle_thread(cpu); 143 idle = idle_thread(cpu);
144 144
145 init_idle(idle, cpu); 145 init_idle(idle, cpu);
146 unhash_process(idle);
147 146
148 waittime = 200000000; 147 waittime = 200000000;
149 while (waittime-- && !cpu_isset(cpu, cpu_callin_map)) 148 while (waittime-- && !cpu_isset(cpu, cpu_callin_map))
@@ -223,7 +222,7 @@ void smp_call_function_slave(int cpu)
223 atomic_inc(&scf_finished); 222 atomic_inc(&scf_finished);
224} 223}
225 224
226int smp_call_function(void (*_func)(void *info), void *_info, int nonatomic, 225int smp_call_function(void (*_func)(void *info), void *_info, int nonatomic,
227 int wait) 226 int wait)
228{ 227{
229 int cpus = num_online_cpus() - 1; 228 int cpus = num_online_cpus() - 1;
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 80c9c18aae94..7d51dd7201c3 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -421,7 +421,7 @@ int linux_main(int argc, char **argv)
421#ifndef CONFIG_HIGHMEM 421#ifndef CONFIG_HIGHMEM
422 highmem = 0; 422 highmem = 0;
423 printf("CONFIG_HIGHMEM not enabled - physical memory shrunk " 423 printf("CONFIG_HIGHMEM not enabled - physical memory shrunk "
424 "to %lu bytes\n", physmem_size); 424 "to %Lu bytes\n", physmem_size);
425#endif 425#endif
426 } 426 }
427 427
@@ -433,8 +433,8 @@ int linux_main(int argc, char **argv)
433 433
434 setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem); 434 setup_physmem(uml_physmem, uml_reserved, physmem_size, highmem);
435 if(init_maps(physmem_size, iomem_size, highmem)){ 435 if(init_maps(physmem_size, iomem_size, highmem)){
436 printf("Failed to allocate mem_map for %lu bytes of physical " 436 printf("Failed to allocate mem_map for %Lu bytes of physical "
437 "memory and %lu bytes of highmem\n", physmem_size, 437 "memory and %Lu bytes of highmem\n", physmem_size,
438 highmem); 438 highmem);
439 exit(1); 439 exit(1);
440 } 440 }
@@ -477,7 +477,8 @@ static struct notifier_block panic_exit_notifier = {
477 477
478void __init setup_arch(char **cmdline_p) 478void __init setup_arch(char **cmdline_p)
479{ 479{
480 notifier_chain_register(&panic_notifier_list, &panic_exit_notifier); 480 atomic_notifier_chain_register(&panic_notifier_list,
481 &panic_exit_notifier);
481 paging_init(); 482 paging_init();
482 strlcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); 483 strlcpy(saved_command_line, command_line, COMMAND_LINE_SIZE);
483 *cmdline_p = command_line; 484 *cmdline_p = command_line;
@@ -487,8 +488,7 @@ void __init setup_arch(char **cmdline_p)
487void __init check_bugs(void) 488void __init check_bugs(void)
488{ 489{
489 arch_check_bugs(); 490 arch_check_bugs();
490 check_sigio(); 491 os_check_bugs();
491 check_devanon();
492} 492}
493 493
494void apply_alternatives(struct alt_instr *start, struct alt_instr *end) 494void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
diff --git a/arch/um/os-Linux/Makefile b/arch/um/os-Linux/Makefile
index 08a4e628b24c..1659386b42bb 100644
--- a/arch/um/os-Linux/Makefile
+++ b/arch/um/os-Linux/Makefile
@@ -3,14 +3,17 @@
3# Licensed under the GPL 3# Licensed under the GPL
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 irq.o main.o mem.o process.o sigio.o \
7 start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o user_syms.o \ 7 signal.o start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o \
8 util.o drivers/ sys-$(SUBARCH)/ 8 user_syms.o util.o drivers/ sys-$(SUBARCH)/
9 9
10obj-$(CONFIG_MODE_SKAS) += skas/ 10obj-$(CONFIG_MODE_SKAS) += skas/
11obj-$(CONFIG_TTY_LOG) += tty_log.o
12user-objs-$(CONFIG_TTY_LOG) += tty_log.o
11 13
12USER_OBJS := aio.o elf_aux.o file.o helper.o main.o mem.o process.o signal.o \ 14USER_OBJS := $(user-objs-y) aio.o elf_aux.o file.o helper.o irq.o main.o mem.o \
13 start_up.o time.o trap.o tt.o tty.o uaccess.o umid.o util.o 15 process.o sigio.o signal.o start_up.o time.o trap.o tt.o tty.o \
16 uaccess.o umid.o util.o
14 17
15elf_aux.o: $(ARCH_DIR)/kernel-offsets.h 18elf_aux.o: $(ARCH_DIR)/kernel-offsets.h
16CFLAGS_elf_aux.o += -I$(objtree)/arch/um 19CFLAGS_elf_aux.o += -I$(objtree)/arch/um
diff --git a/arch/um/os-Linux/irq.c b/arch/um/os-Linux/irq.c
new file mode 100644
index 000000000000..e599be423da1
--- /dev/null
+++ b/arch/um/os-Linux/irq.c
@@ -0,0 +1,162 @@
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 <unistd.h>
8#include <errno.h>
9#include <signal.h>
10#include <string.h>
11#include <sys/poll.h>
12#include <sys/types.h>
13#include <sys/time.h>
14#include "user_util.h"
15#include "kern_util.h"
16#include "user.h"
17#include "process.h"
18#include "sigio.h"
19#include "irq_user.h"
20#include "os.h"
21
22static struct pollfd *pollfds = NULL;
23static int pollfds_num = 0;
24static int pollfds_size = 0;
25
26int os_waiting_for_events(struct irq_fd *active_fds)
27{
28 struct irq_fd *irq_fd;
29 int i, n, err;
30
31 n = poll(pollfds, pollfds_num, 0);
32 if(n < 0){
33 err = -errno;
34 if(errno != EINTR)
35 printk("sigio_handler: os_waiting_for_events:"
36 " poll returned %d, errno = %d\n", n, errno);
37 return err;
38 }
39
40 if(n == 0)
41 return 0;
42
43 irq_fd = active_fds;
44
45 for(i = 0; i < pollfds_num; i++){
46 if(pollfds[i].revents != 0){
47 irq_fd->current_events = pollfds[i].revents;
48 pollfds[i].fd = -1;
49 }
50 irq_fd = irq_fd->next;
51 }
52 return n;
53}
54
55int os_isatty(int fd)
56{
57 return(isatty(fd));
58}
59
60int os_create_pollfd(int fd, int events, void *tmp_pfd, int size_tmpfds)
61{
62 if (pollfds_num == pollfds_size) {
63 if (size_tmpfds <= pollfds_size * sizeof(pollfds[0])) {
64 /* return min size needed for new pollfds area */
65 return((pollfds_size + 1) * sizeof(pollfds[0]));
66 }
67
68 if(pollfds != NULL){
69 memcpy(tmp_pfd, pollfds,
70 sizeof(pollfds[0]) * pollfds_size);
71 /* remove old pollfds */
72 kfree(pollfds);
73 }
74 pollfds = tmp_pfd;
75 pollfds_size++;
76 } else {
77 /* remove not used tmp_pfd */
78 if (tmp_pfd != NULL)
79 kfree(tmp_pfd);
80 }
81
82 pollfds[pollfds_num] = ((struct pollfd) { .fd = fd,
83 .events = events,
84 .revents = 0 });
85 pollfds_num++;
86
87 return(0);
88}
89
90void os_free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg,
91 struct irq_fd *active_fds, struct irq_fd ***last_irq_ptr2)
92{
93 struct irq_fd **prev;
94 int i = 0;
95
96 prev = &active_fds;
97 while(*prev != NULL){
98 if((*test)(*prev, arg)){
99 struct irq_fd *old_fd = *prev;
100 if((pollfds[i].fd != -1) &&
101 (pollfds[i].fd != (*prev)->fd)){
102 printk("os_free_irq_by_cb - mismatch between "
103 "active_fds and pollfds, fd %d vs %d\n",
104 (*prev)->fd, pollfds[i].fd);
105 goto out;
106 }
107
108 pollfds_num--;
109
110 /* This moves the *whole* array after pollfds[i]
111 * (though it doesn't spot as such)!
112 */
113
114 memmove(&pollfds[i], &pollfds[i + 1],
115 (pollfds_num - i) * sizeof(pollfds[0]));
116 if(*last_irq_ptr2 == &old_fd->next)
117 *last_irq_ptr2 = prev;
118
119 *prev = (*prev)->next;
120 if(old_fd->type == IRQ_WRITE)
121 ignore_sigio_fd(old_fd->fd);
122 kfree(old_fd);
123 continue;
124 }
125 prev = &(*prev)->next;
126 i++;
127 }
128 out:
129 return;
130}
131
132
133int os_get_pollfd(int i)
134{
135 return(pollfds[i].fd);
136}
137
138void os_set_pollfd(int i, int fd)
139{
140 pollfds[i].fd = fd;
141}
142
143void os_set_ioignore(void)
144{
145 set_handler(SIGIO, SIG_IGN, 0, -1);
146}
147
148void init_irq_signals(int on_sigstack)
149{
150 __sighandler_t h;
151 int flags;
152
153 flags = on_sigstack ? SA_ONSTACK : 0;
154 if(timer_irq_inited) h = (__sighandler_t) alarm_handler;
155 else h = boot_timer_handler;
156
157 set_handler(SIGVTALRM, h, flags | SA_RESTART,
158 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, -1);
159 set_handler(SIGIO, (__sighandler_t) sig_handler, flags | SA_RESTART,
160 SIGUSR1, SIGIO, SIGWINCH, SIGALRM, SIGVTALRM, -1);
161 signal(SIGWINCH, SIG_IGN);
162}
diff --git a/arch/um/kernel/sigio_user.c b/arch/um/os-Linux/sigio.c
index f7b18e157d35..9ba942947146 100644
--- a/arch/um/kernel/sigio_user.c
+++ b/arch/um/os-Linux/sigio.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 */
@@ -20,128 +20,7 @@
20#include "sigio.h" 20#include "sigio.h"
21#include "os.h" 21#include "os.h"
22 22
23/* Changed during early boot */ 23/* Protected by sigio_lock(), also used by sigio_cleanup, which is an
24int pty_output_sigio = 0;
25int pty_close_sigio = 0;
26
27/* Used as a flag during SIGIO testing early in boot */
28static volatile int got_sigio = 0;
29
30void __init handler(int sig)
31{
32 got_sigio = 1;
33}
34
35struct openpty_arg {
36 int master;
37 int slave;
38 int err;
39};
40
41static void openpty_cb(void *arg)
42{
43 struct openpty_arg *info = arg;
44
45 info->err = 0;
46 if(openpty(&info->master, &info->slave, NULL, NULL, NULL))
47 info->err = -errno;
48}
49
50void __init check_one_sigio(void (*proc)(int, int))
51{
52 struct sigaction old, new;
53 struct openpty_arg pty = { .master = -1, .slave = -1 };
54 int master, slave, err;
55
56 initial_thread_cb(openpty_cb, &pty);
57 if(pty.err){
58 printk("openpty failed, errno = %d\n", -pty.err);
59 return;
60 }
61
62 master = pty.master;
63 slave = pty.slave;
64
65 if((master == -1) || (slave == -1)){
66 printk("openpty failed to allocate a pty\n");
67 return;
68 }
69
70 /* Not now, but complain so we now where we failed. */
71 err = raw(master);
72 if (err < 0)
73 panic("check_sigio : __raw failed, errno = %d\n", -err);
74
75 err = os_sigio_async(master, slave);
76 if(err < 0)
77 panic("tty_fds : sigio_async failed, err = %d\n", -err);
78
79 if(sigaction(SIGIO, NULL, &old) < 0)
80 panic("check_sigio : sigaction 1 failed, errno = %d\n", errno);
81 new = old;
82 new.sa_handler = handler;
83 if(sigaction(SIGIO, &new, NULL) < 0)
84 panic("check_sigio : sigaction 2 failed, errno = %d\n", errno);
85
86 got_sigio = 0;
87 (*proc)(master, slave);
88
89 os_close_file(master);
90 os_close_file(slave);
91
92 if(sigaction(SIGIO, &old, NULL) < 0)
93 panic("check_sigio : sigaction 3 failed, errno = %d\n", errno);
94}
95
96static void tty_output(int master, int slave)
97{
98 int n;
99 char buf[512];
100
101 printk("Checking that host ptys support output SIGIO...");
102
103 memset(buf, 0, sizeof(buf));
104
105 while(os_write_file(master, buf, sizeof(buf)) > 0) ;
106 if(errno != EAGAIN)
107 panic("check_sigio : write failed, errno = %d\n", errno);
108 while(((n = os_read_file(slave, buf, sizeof(buf))) > 0) && !got_sigio) ;
109
110 if (got_sigio) {
111 printk("Yes\n");
112 pty_output_sigio = 1;
113 } else if (n == -EAGAIN) {
114 printk("No, enabling workaround\n");
115 } else {
116 panic("check_sigio : read failed, err = %d\n", n);
117 }
118}
119
120static void tty_close(int master, int slave)
121{
122 printk("Checking that host ptys support SIGIO on close...");
123
124 os_close_file(slave);
125 if(got_sigio){
126 printk("Yes\n");
127 pty_close_sigio = 1;
128 }
129 else printk("No, enabling workaround\n");
130}
131
132void __init check_sigio(void)
133{
134 if((os_access("/dev/ptmx", OS_ACC_R_OK) < 0) &&
135 (os_access("/dev/ptyp0", OS_ACC_R_OK) < 0)){
136 printk("No pseudo-terminals available - skipping pty SIGIO "
137 "check\n");
138 return;
139 }
140 check_one_sigio(tty_output);
141 check_one_sigio(tty_close);
142}
143
144/* Protected by sigio_lock(), also used by sigio_cleanup, which is an
145 * exitcall. 24 * exitcall.
146 */ 25 */
147static int write_sigio_pid = -1; 26static int write_sigio_pid = -1;
@@ -150,8 +29,10 @@ static int write_sigio_pid = -1;
150 * the descriptors closed after it is killed. So, it can't see them change. 29 * the descriptors closed after it is killed. So, it can't see them change.
151 * On the UML side, they are changed under the sigio_lock. 30 * On the UML side, they are changed under the sigio_lock.
152 */ 31 */
153static int write_sigio_fds[2] = { -1, -1 }; 32#define SIGIO_FDS_INIT {-1, -1}
154static int sigio_private[2] = { -1, -1 }; 33
34static int write_sigio_fds[2] = SIGIO_FDS_INIT;
35static int sigio_private[2] = SIGIO_FDS_INIT;
155 36
156struct pollfds { 37struct pollfds {
157 struct pollfd *poll; 38 struct pollfd *poll;
@@ -264,13 +145,13 @@ static void update_thread(void)
264 return; 145 return;
265 fail: 146 fail:
266 /* Critical section start */ 147 /* Critical section start */
267 if(write_sigio_pid != -1) 148 if(write_sigio_pid != -1)
268 os_kill_process(write_sigio_pid, 1); 149 os_kill_process(write_sigio_pid, 1);
269 write_sigio_pid = -1; 150 write_sigio_pid = -1;
270 os_close_file(sigio_private[0]); 151 close(sigio_private[0]);
271 os_close_file(sigio_private[1]); 152 close(sigio_private[1]);
272 os_close_file(write_sigio_fds[0]); 153 close(write_sigio_fds[0]);
273 os_close_file(write_sigio_fds[1]); 154 close(write_sigio_fds[1]);
274 /* Critical section end */ 155 /* Critical section end */
275 set_signals(flags); 156 set_signals(flags);
276} 157}
@@ -281,13 +162,13 @@ int add_sigio_fd(int fd, int read)
281 162
282 sigio_lock(); 163 sigio_lock();
283 for(i = 0; i < current_poll.used; i++){ 164 for(i = 0; i < current_poll.used; i++){
284 if(current_poll.poll[i].fd == fd) 165 if(current_poll.poll[i].fd == fd)
285 goto out; 166 goto out;
286 } 167 }
287 168
288 n = current_poll.used + 1; 169 n = current_poll.used + 1;
289 err = need_poll(n); 170 err = need_poll(n);
290 if(err) 171 if(err)
291 goto out; 172 goto out;
292 173
293 for(i = 0; i < current_poll.used; i++) 174 for(i = 0; i < current_poll.used; i++)
@@ -316,7 +197,7 @@ int ignore_sigio_fd(int fd)
316 } 197 }
317 if(i == current_poll.used) 198 if(i == current_poll.used)
318 goto out; 199 goto out;
319 200
320 err = need_poll(current_poll.used - 1); 201 err = need_poll(current_poll.used - 1);
321 if(err) 202 if(err)
322 goto out; 203 goto out;
@@ -337,7 +218,7 @@ int ignore_sigio_fd(int fd)
337 return(err); 218 return(err);
338} 219}
339 220
340static struct pollfd* setup_initial_poll(int fd) 221static struct pollfd *setup_initial_poll(int fd)
341{ 222{
342 struct pollfd *p; 223 struct pollfd *p;
343 224
@@ -377,7 +258,7 @@ void write_sigio_workaround(void)
377 } 258 }
378 err = os_pipe(l_sigio_private, 1, 1); 259 err = os_pipe(l_sigio_private, 1, 1);
379 if(err < 0){ 260 if(err < 0){
380 printk("write_sigio_workaround - os_pipe 1 failed, " 261 printk("write_sigio_workaround - os_pipe 2 failed, "
381 "err = %d\n", -err); 262 "err = %d\n", -err);
382 goto out_close1; 263 goto out_close1;
383 } 264 }
@@ -391,76 +272,52 @@ void write_sigio_workaround(void)
391 /* Did we race? Don't try to optimize this, please, it's not so likely 272 /* 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. */ 273 * to happen, and no more than once at the boot. */
393 if(write_sigio_pid != -1) 274 if(write_sigio_pid != -1)
394 goto out_unlock; 275 goto out_free;
395 276
396 write_sigio_pid = run_helper_thread(write_sigio_thread, NULL, 277 current_poll = ((struct pollfds) { .poll = p,
397 CLONE_FILES | CLONE_VM, &stack, 0); 278 .used = 1,
398 279 .size = 1 });
399 if (write_sigio_pid < 0)
400 goto out_clear;
401 280
402 if (write_sigio_irq(l_write_sigio_fds[0])) 281 if (write_sigio_irq(l_write_sigio_fds[0]))
403 goto out_kill; 282 goto out_clear_poll;
404 283
405 /* Success, finally. */
406 memcpy(write_sigio_fds, l_write_sigio_fds, sizeof(l_write_sigio_fds)); 284 memcpy(write_sigio_fds, l_write_sigio_fds, sizeof(l_write_sigio_fds));
407 memcpy(sigio_private, l_sigio_private, sizeof(l_sigio_private)); 285 memcpy(sigio_private, l_sigio_private, sizeof(l_sigio_private));
408 286
409 current_poll = ((struct pollfds) { .poll = p, 287 write_sigio_pid = run_helper_thread(write_sigio_thread, NULL,
410 .used = 1, 288 CLONE_FILES | CLONE_VM, &stack, 0);
411 .size = 1 });
412 289
413 sigio_unlock(); 290 if (write_sigio_pid < 0)
414 return; 291 goto out_clear;
415 292
416 out_kill:
417 l_write_sigio_pid = write_sigio_pid;
418 write_sigio_pid = -1;
419 sigio_unlock(); 293 sigio_unlock();
420 /* Going to call waitpid, avoid holding the lock. */ 294 return;
421 os_kill_process(l_write_sigio_pid, 1);
422 goto out_free;
423 295
424 out_clear: 296out_clear:
425 write_sigio_pid = -1; 297 write_sigio_pid = -1;
426 out_unlock: 298 write_sigio_fds[0] = -1;
427 sigio_unlock(); 299 write_sigio_fds[1] = -1;
428 out_free: 300 sigio_private[0] = -1;
301 sigio_private[1] = -1;
302out_clear_poll:
303 current_poll = ((struct pollfds) { .poll = NULL,
304 .size = 0,
305 .used = 0 });
306out_free:
429 kfree(p); 307 kfree(p);
430 out_close2: 308 sigio_unlock();
431 os_close_file(l_sigio_private[0]); 309out_close2:
432 os_close_file(l_sigio_private[1]); 310 close(l_sigio_private[0]);
433 out_close1: 311 close(l_sigio_private[1]);
434 os_close_file(l_write_sigio_fds[0]); 312out_close1:
435 os_close_file(l_write_sigio_fds[1]); 313 close(l_write_sigio_fds[0]);
436 return; 314 close(l_write_sigio_fds[1]);
437}
438
439int read_sigio_fd(int fd)
440{
441 int n;
442 char c;
443
444 n = os_read_file(fd, &c, sizeof(c));
445 if(n != sizeof(c)){
446 if(n < 0) {
447 printk("read_sigio_fd - read failed, err = %d\n", -n);
448 return(n);
449 }
450 else {
451 printk("read_sigio_fd - short read, bytes = %d\n", n);
452 return(-EIO);
453 }
454 }
455 return(n);
456} 315}
457 316
458static void sigio_cleanup(void) 317void sigio_cleanup(void)
459{ 318{
460 if (write_sigio_pid != -1) { 319 if(write_sigio_pid != -1){
461 os_kill_process(write_sigio_pid, 1); 320 os_kill_process(write_sigio_pid, 1);
462 write_sigio_pid = -1; 321 write_sigio_pid = -1;
463 } 322 }
464} 323}
465
466__uml_exitcall(sigio_cleanup);
diff --git a/arch/um/os-Linux/start_up.c b/arch/um/os-Linux/start_up.c
index 829d6b0d8b02..32753131f8d8 100644
--- a/arch/um/os-Linux/start_up.c
+++ b/arch/um/os-Linux/start_up.c
@@ -3,6 +3,7 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <pty.h>
6#include <stdio.h> 7#include <stdio.h>
7#include <stddef.h> 8#include <stddef.h>
8#include <stdarg.h> 9#include <stdarg.h>
@@ -539,3 +540,130 @@ int __init parse_iomem(char *str, int *add)
539 return(1); 540 return(1);
540} 541}
541 542
543
544/* Changed during early boot */
545int pty_output_sigio = 0;
546int pty_close_sigio = 0;
547
548/* Used as a flag during SIGIO testing early in boot */
549static volatile int got_sigio = 0;
550
551static void __init handler(int sig)
552{
553 got_sigio = 1;
554}
555
556struct openpty_arg {
557 int master;
558 int slave;
559 int err;
560};
561
562static void openpty_cb(void *arg)
563{
564 struct openpty_arg *info = arg;
565
566 info->err = 0;
567 if(openpty(&info->master, &info->slave, NULL, NULL, NULL))
568 info->err = -errno;
569}
570
571static void __init check_one_sigio(void (*proc)(int, int))
572{
573 struct sigaction old, new;
574 struct openpty_arg pty = { .master = -1, .slave = -1 };
575 int master, slave, err;
576
577 initial_thread_cb(openpty_cb, &pty);
578 if(pty.err){
579 printk("openpty failed, errno = %d\n", -pty.err);
580 return;
581 }
582
583 master = pty.master;
584 slave = pty.slave;
585
586 if((master == -1) || (slave == -1)){
587 printk("openpty failed to allocate a pty\n");
588 return;
589 }
590
591 /* Not now, but complain so we now where we failed. */
592 err = raw(master);
593 if (err < 0)
594 panic("check_sigio : __raw failed, errno = %d\n", -err);
595
596 err = os_sigio_async(master, slave);
597 if(err < 0)
598 panic("tty_fds : sigio_async failed, err = %d\n", -err);
599
600 if(sigaction(SIGIO, NULL, &old) < 0)
601 panic("check_sigio : sigaction 1 failed, errno = %d\n", errno);
602 new = old;
603 new.sa_handler = handler;
604 if(sigaction(SIGIO, &new, NULL) < 0)
605 panic("check_sigio : sigaction 2 failed, errno = %d\n", errno);
606
607 got_sigio = 0;
608 (*proc)(master, slave);
609
610 close(master);
611 close(slave);
612
613 if(sigaction(SIGIO, &old, NULL) < 0)
614 panic("check_sigio : sigaction 3 failed, errno = %d\n", errno);
615}
616
617static void tty_output(int master, int slave)
618{
619 int n;
620 char buf[512];
621
622 printk("Checking that host ptys support output SIGIO...");
623
624 memset(buf, 0, sizeof(buf));
625
626 while(os_write_file(master, buf, sizeof(buf)) > 0) ;
627 if(errno != EAGAIN)
628 panic("check_sigio : write failed, errno = %d\n", errno);
629 while(((n = os_read_file(slave, buf, sizeof(buf))) > 0) && !got_sigio) ;
630
631 if(got_sigio){
632 printk("Yes\n");
633 pty_output_sigio = 1;
634 }
635 else if(n == -EAGAIN) printk("No, enabling workaround\n");
636 else panic("check_sigio : read failed, err = %d\n", n);
637}
638
639static void tty_close(int master, int slave)
640{
641 printk("Checking that host ptys support SIGIO on close...");
642
643 close(slave);
644 if(got_sigio){
645 printk("Yes\n");
646 pty_close_sigio = 1;
647 }
648 else printk("No, enabling workaround\n");
649}
650
651void __init check_sigio(void)
652{
653 if((os_access("/dev/ptmx", OS_ACC_R_OK) < 0) &&
654 (os_access("/dev/ptyp0", OS_ACC_R_OK) < 0)){
655 printk("No pseudo-terminals available - skipping pty SIGIO "
656 "check\n");
657 return;
658 }
659 check_one_sigio(tty_output);
660 check_one_sigio(tty_close);
661}
662
663void os_check_bugs(void)
664{
665 check_ptrace();
666 check_sigio();
667 check_devanon();
668}
669
diff --git a/arch/um/os-Linux/tt.c b/arch/um/os-Linux/tt.c
index 919d19f11537..5461a065bbb9 100644
--- a/arch/um/os-Linux/tt.c
+++ b/arch/um/os-Linux/tt.c
@@ -110,6 +110,16 @@ int wait_for_stop(int pid, int sig, int cont_type, void *relay)
110 } 110 }
111} 111}
112 112
113void forward_ipi(int fd, int pid)
114{
115 int err;
116
117 err = os_set_owner(fd, pid);
118 if(err < 0)
119 printk("forward_ipi: set_owner failed, fd = %d, me = %d, "
120 "target = %d, err = %d\n", fd, os_getpid(), pid, -err);
121}
122
113/* 123/*
114 *------------------------- 124 *-------------------------
115 * only for tt mode (will be deleted in future...) 125 * only for tt mode (will be deleted in future...)
diff --git a/arch/um/kernel/tty_log.c b/arch/um/os-Linux/tty_log.c
index 9ada656f68ce..c6ba56c1560f 100644
--- a/arch/um/kernel/tty_log.c
+++ b/arch/um/os-Linux/tty_log.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) and 2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) and
3 * geoffrey hing <ghing@net.ohio-state.edu> 3 * geoffrey hing <ghing@net.ohio-state.edu>
4 * Licensed under the GPL 4 * Licensed under the GPL
5 */ 5 */
@@ -58,7 +58,7 @@ int open_tty_log(void *tty, void *current_tty)
58 return(tty_log_fd); 58 return(tty_log_fd);
59 } 59 }
60 60
61 sprintf(buf, "%s/%0u-%0u", tty_log_dir, (unsigned int) tv.tv_sec, 61 sprintf(buf, "%s/%0u-%0u", tty_log_dir, (unsigned int) tv.tv_sec,
62 (unsigned int) tv.tv_usec); 62 (unsigned int) tv.tv_usec);
63 63
64 fd = os_open_file(buf, of_append(of_create(of_rdwr(OPENFLAGS()))), 64 fd = os_open_file(buf, of_append(of_create(of_rdwr(OPENFLAGS()))),
@@ -216,15 +216,3 @@ __uml_setup("tty_log_fd=", set_tty_log_fd,
216" tty data will be written. Preconfigure the descriptor with something\n" 216" tty data will be written. Preconfigure the descriptor with something\n"
217" like '10>tty_log tty_log_fd=10'.\n\n" 217" like '10>tty_log tty_log_fd=10'.\n\n"
218); 218);
219
220
221/*
222 * Overrides for Emacs so that we follow Linus's tabbing style.
223 * Emacs will notice this stuff at the end of the file and automatically
224 * adjust the settings for this buffer only. This must remain at the end
225 * of the file.
226 * ---------------------------------------------------------------------------
227 * Local variables:
228 * c-file-style: "linux"
229 * End:
230 */
diff --git a/arch/um/os-Linux/umid.c b/arch/um/os-Linux/umid.c
index ecf107ae5ac8..198e59163288 100644
--- a/arch/um/os-Linux/umid.c
+++ b/arch/um/os-Linux/umid.c
@@ -143,8 +143,10 @@ static int not_dead_yet(char *dir)
143 goto out_close; 143 goto out_close;
144 } 144 }
145 145
146 if((kill(p, 0) == 0) || (errno != ESRCH)) 146 if((kill(p, 0) == 0) || (errno != ESRCH)){
147 printk("umid \"%s\" is already in use by pid %d\n", umid, p);
147 return 1; 148 return 1;
149 }
148 150
149 err = actually_do_remove(dir); 151 err = actually_do_remove(dir);
150 if(err) 152 if(err)
@@ -234,33 +236,44 @@ int __init make_umid(void)
234 err = mkdir(tmp, 0777); 236 err = mkdir(tmp, 0777);
235 if(err < 0){ 237 if(err < 0){
236 err = -errno; 238 err = -errno;
237 if(errno != EEXIST) 239 if(err != -EEXIST)
238 goto err; 240 goto err;
239 241
240 if(not_dead_yet(tmp) < 0) 242 /* 1 -> this umid is already in use
243 * < 0 -> we couldn't remove the umid directory
244 * In either case, we can't use this umid, so return -EEXIST.
245 */
246 if(not_dead_yet(tmp) != 0)
241 goto err; 247 goto err;
242 248
243 err = mkdir(tmp, 0777); 249 err = mkdir(tmp, 0777);
244 } 250 }
245 if(err < 0){ 251 if(err){
246 printk("Failed to create '%s' - err = %d\n", umid, err); 252 err = -errno;
247 goto err_rmdir; 253 printk("Failed to create '%s' - err = %d\n", umid, -errno);
254 goto err;
248 } 255 }
249 256
250 umid_setup = 1; 257 umid_setup = 1;
251 258
252 create_pid_file(); 259 create_pid_file();
253 260
254 return 0; 261 err = 0;
255
256 err_rmdir:
257 rmdir(tmp);
258 err: 262 err:
259 return err; 263 return err;
260} 264}
261 265
262static int __init make_umid_init(void) 266static int __init make_umid_init(void)
263{ 267{
268 if(!make_umid())
269 return 0;
270
271 /* If initializing with the given umid failed, then try again with
272 * a random one.
273 */
274 printk("Failed to initialize umid \"%s\", trying with a random umid\n",
275 umid);
276 *umid = '\0';
264 make_umid(); 277 make_umid();
265 278
266 return 0; 279 return 0;
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index e839ce65ad28..8032a105949a 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -6,6 +6,7 @@
6#include <linux/config.h> 6#include <linux/config.h>
7#include <linux/compiler.h> 7#include <linux/compiler.h>
8#include "linux/sched.h" 8#include "linux/sched.h"
9#include "linux/mm.h"
9#include "asm/elf.h" 10#include "asm/elf.h"
10#include "asm/ptrace.h" 11#include "asm/ptrace.h"
11#include "asm/uaccess.h" 12#include "asm/uaccess.h"
@@ -26,9 +27,17 @@ int is_syscall(unsigned long addr)
26 27
27 n = copy_from_user(&instr, (void __user *) addr, sizeof(instr)); 28 n = copy_from_user(&instr, (void __user *) addr, sizeof(instr));
28 if(n){ 29 if(n){
29 printk("is_syscall : failed to read instruction from 0x%lx\n", 30 /* access_process_vm() grants access to vsyscall and stub,
30 addr); 31 * while copy_from_user doesn't. Maybe access_process_vm is
31 return(0); 32 * slow, but that doesn't matter, since it will be called only
33 * in case of singlestepping, if copy_from_user failed.
34 */
35 n = access_process_vm(current, addr, &instr, sizeof(instr), 0);
36 if(n != sizeof(instr)) {
37 printk("is_syscall : failed to read instruction from "
38 "0x%lx\n", addr);
39 return(1);
40 }
32 } 41 }
33 /* int 0x80 or sysenter */ 42 /* int 0x80 or sysenter */
34 return((instr == 0x80cd) || (instr == 0x340f)); 43 return((instr == 0x80cd) || (instr == 0x340f));
diff --git a/arch/um/sys-i386/signal.c b/arch/um/sys-i386/signal.c
index 7cd1a82dc8c2..33a40f5ef0d2 100644
--- a/arch/um/sys-i386/signal.c
+++ b/arch/um/sys-i386/signal.c
@@ -58,7 +58,7 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
58} 58}
59 59
60int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, 60int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
61 struct pt_regs *regs) 61 struct pt_regs *regs, unsigned long sp)
62{ 62{
63 struct sigcontext sc; 63 struct sigcontext sc;
64 unsigned long fpregs[HOST_FP_SIZE]; 64 unsigned long fpregs[HOST_FP_SIZE];
@@ -72,7 +72,7 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
72 sc.edi = REGS_EDI(regs->regs.skas.regs); 72 sc.edi = REGS_EDI(regs->regs.skas.regs);
73 sc.esi = REGS_ESI(regs->regs.skas.regs); 73 sc.esi = REGS_ESI(regs->regs.skas.regs);
74 sc.ebp = REGS_EBP(regs->regs.skas.regs); 74 sc.ebp = REGS_EBP(regs->regs.skas.regs);
75 sc.esp = REGS_SP(regs->regs.skas.regs); 75 sc.esp = sp;
76 sc.ebx = REGS_EBX(regs->regs.skas.regs); 76 sc.ebx = REGS_EBX(regs->regs.skas.regs);
77 sc.edx = REGS_EDX(regs->regs.skas.regs); 77 sc.edx = REGS_EDX(regs->regs.skas.regs);
78 sc.ecx = REGS_ECX(regs->regs.skas.regs); 78 sc.ecx = REGS_ECX(regs->regs.skas.regs);
@@ -132,7 +132,7 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
132} 132}
133 133
134int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, 134int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
135 struct sigcontext *from, int fpsize) 135 struct sigcontext *from, int fpsize, unsigned long sp)
136{ 136{
137 struct _fpstate *to_fp, *from_fp; 137 struct _fpstate *to_fp, *from_fp;
138 int err; 138 int err;
@@ -140,11 +140,18 @@ int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
140 to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); 140 to_fp = (fp ? fp : (struct _fpstate *) (to + 1));
141 from_fp = from->fpstate; 141 from_fp = from->fpstate;
142 err = copy_to_user(to, from, sizeof(*to)); 142 err = copy_to_user(to, from, sizeof(*to));
143
144 /* The SP in the sigcontext is the updated one for the signal
145 * delivery. The sp passed in is the original, and this needs
146 * to be restored, so we stick it in separately.
147 */
148 err |= copy_to_user(&SC_SP(to), sp, sizeof(sp));
149
143 if(from_fp != NULL){ 150 if(from_fp != NULL){
144 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); 151 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate));
145 err |= copy_to_user(to_fp, from_fp, fpsize); 152 err |= copy_to_user(to_fp, from_fp, fpsize);
146 } 153 }
147 return(err); 154 return err;
148} 155}
149#endif 156#endif
150 157
@@ -159,11 +166,11 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
159} 166}
160 167
161static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, 168static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
162 struct pt_regs *from) 169 struct pt_regs *from, unsigned long sp)
163{ 170{
164 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), 171 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
165 sizeof(*fp)), 172 sizeof(*fp), sp),
166 copy_sc_to_user_skas(to, fp, from))); 173 copy_sc_to_user_skas(to, fp, from, sp)));
167} 174}
168 175
169static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp, 176static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp,
@@ -174,7 +181,7 @@ static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp,
174 err |= put_user(current->sas_ss_sp, &uc->uc_stack.ss_sp); 181 err |= put_user(current->sas_ss_sp, &uc->uc_stack.ss_sp);
175 err |= put_user(sas_ss_flags(sp), &uc->uc_stack.ss_flags); 182 err |= put_user(sas_ss_flags(sp), &uc->uc_stack.ss_flags);
176 err |= put_user(current->sas_ss_size, &uc->uc_stack.ss_size); 183 err |= put_user(current->sas_ss_size, &uc->uc_stack.ss_size);
177 err |= copy_sc_to_user(&uc->uc_mcontext, fp, &current->thread.regs); 184 err |= copy_sc_to_user(&uc->uc_mcontext, fp, &current->thread.regs, sp);
178 err |= copy_to_user(&uc->uc_sigmask, set, sizeof(*set)); 185 err |= copy_to_user(&uc->uc_sigmask, set, sizeof(*set));
179 return(err); 186 return(err);
180} 187}
@@ -207,6 +214,7 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
207{ 214{
208 struct sigframe __user *frame; 215 struct sigframe __user *frame;
209 void *restorer; 216 void *restorer;
217 unsigned long save_sp = PT_REGS_SP(regs);
210 int err = 0; 218 int err = 0;
211 219
212 stack_top &= -8UL; 220 stack_top &= -8UL;
@@ -218,9 +226,19 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
218 if(ka->sa.sa_flags & SA_RESTORER) 226 if(ka->sa.sa_flags & SA_RESTORER)
219 restorer = ka->sa.sa_restorer; 227 restorer = ka->sa.sa_restorer;
220 228
229 /* Update SP now because the page fault handler refuses to extend
230 * the stack if the faulting address is too far below the current
231 * SP, which frame now certainly is. If there's an error, the original
232 * value is restored on the way out.
233 * When writing the sigcontext to the stack, we have to write the
234 * original value, so that's passed to copy_sc_to_user, which does
235 * the right thing with it.
236 */
237 PT_REGS_SP(regs) = (unsigned long) frame;
238
221 err |= __put_user(restorer, &frame->pretcode); 239 err |= __put_user(restorer, &frame->pretcode);
222 err |= __put_user(sig, &frame->sig); 240 err |= __put_user(sig, &frame->sig);
223 err |= copy_sc_to_user(&frame->sc, NULL, regs); 241 err |= copy_sc_to_user(&frame->sc, NULL, regs, save_sp);
224 err |= __put_user(mask->sig[0], &frame->sc.oldmask); 242 err |= __put_user(mask->sig[0], &frame->sc.oldmask);
225 if (_NSIG_WORDS > 1) 243 if (_NSIG_WORDS > 1)
226 err |= __copy_to_user(&frame->extramask, &mask->sig[1], 244 err |= __copy_to_user(&frame->extramask, &mask->sig[1],
@@ -238,7 +256,7 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
238 err |= __put_user(0x80cd, (short __user *)(frame->retcode+6)); 256 err |= __put_user(0x80cd, (short __user *)(frame->retcode+6));
239 257
240 if(err) 258 if(err)
241 return(err); 259 goto err;
242 260
243 PT_REGS_SP(regs) = (unsigned long) frame; 261 PT_REGS_SP(regs) = (unsigned long) frame;
244 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 262 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
@@ -248,7 +266,11 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
248 266
249 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) 267 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
250 ptrace_notify(SIGTRAP); 268 ptrace_notify(SIGTRAP);
251 return(0); 269 return 0;
270
271err:
272 PT_REGS_SP(regs) = save_sp;
273 return err;
252} 274}
253 275
254int setup_signal_stack_si(unsigned long stack_top, int sig, 276int setup_signal_stack_si(unsigned long stack_top, int sig,
@@ -257,6 +279,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
257{ 279{
258 struct rt_sigframe __user *frame; 280 struct rt_sigframe __user *frame;
259 void *restorer; 281 void *restorer;
282 unsigned long save_sp = PT_REGS_SP(regs);
260 int err = 0; 283 int err = 0;
261 284
262 stack_top &= -8UL; 285 stack_top &= -8UL;
@@ -268,13 +291,16 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
268 if(ka->sa.sa_flags & SA_RESTORER) 291 if(ka->sa.sa_flags & SA_RESTORER)
269 restorer = ka->sa.sa_restorer; 292 restorer = ka->sa.sa_restorer;
270 293
294 /* See comment above about why this is here */
295 PT_REGS_SP(regs) = (unsigned long) frame;
296
271 err |= __put_user(restorer, &frame->pretcode); 297 err |= __put_user(restorer, &frame->pretcode);
272 err |= __put_user(sig, &frame->sig); 298 err |= __put_user(sig, &frame->sig);
273 err |= __put_user(&frame->info, &frame->pinfo); 299 err |= __put_user(&frame->info, &frame->pinfo);
274 err |= __put_user(&frame->uc, &frame->puc); 300 err |= __put_user(&frame->uc, &frame->puc);
275 err |= copy_siginfo_to_user(&frame->info, info); 301 err |= copy_siginfo_to_user(&frame->info, info);
276 err |= copy_ucontext_to_user(&frame->uc, &frame->fpstate, mask, 302 err |= copy_ucontext_to_user(&frame->uc, &frame->fpstate, mask,
277 PT_REGS_SP(regs)); 303 save_sp);
278 304
279 /* 305 /*
280 * This is movl $,%eax ; int $0x80 306 * This is movl $,%eax ; int $0x80
@@ -288,9 +314,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
288 err |= __put_user(0x80cd, (short __user *)(frame->retcode+5)); 314 err |= __put_user(0x80cd, (short __user *)(frame->retcode+5));
289 315
290 if(err) 316 if(err)
291 return(err); 317 goto err;
292 318
293 PT_REGS_SP(regs) = (unsigned long) frame;
294 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler; 319 PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
295 PT_REGS_EAX(regs) = (unsigned long) sig; 320 PT_REGS_EAX(regs) = (unsigned long) sig;
296 PT_REGS_EDX(regs) = (unsigned long) &frame->info; 321 PT_REGS_EDX(regs) = (unsigned long) &frame->info;
@@ -298,7 +323,11 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
298 323
299 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED)) 324 if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
300 ptrace_notify(SIGTRAP); 325 ptrace_notify(SIGTRAP);
301 return(0); 326 return 0;
327
328err:
329 PT_REGS_SP(regs) = save_sp;
330 return err;
302} 331}
303 332
304long sys_sigreturn(struct pt_regs regs) 333long sys_sigreturn(struct pt_regs regs)
diff --git a/arch/um/sys-i386/user-offsets.c b/arch/um/sys-i386/user-offsets.c
index 26b68675053d..6f4ef2b7fa4a 100644
--- a/arch/um/sys-i386/user-offsets.c
+++ b/arch/um/sys-i386/user-offsets.c
@@ -3,12 +3,13 @@
3#include <asm/ptrace.h> 3#include <asm/ptrace.h>
4#include <asm/user.h> 4#include <asm/user.h>
5#include <linux/stddef.h> 5#include <linux/stddef.h>
6#include <sys/poll.h>
6 7
7#define DEFINE(sym, val) \ 8#define DEFINE(sym, val) \
8 asm volatile("\n->" #sym " %0 " #val : : "i" (val)) 9 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
9 10
10#define DEFINE_LONGS(sym, val) \ 11#define DEFINE_LONGS(sym, val) \
11 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long))) 12 asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
12 13
13#define OFFSET(sym, str, mem) \ 14#define OFFSET(sym, str, mem) \
14 DEFINE(sym, offsetof(struct str, mem)); 15 DEFINE(sym, offsetof(struct str, mem));
@@ -67,4 +68,9 @@ void foo(void)
67 DEFINE(HOST_ES, ES); 68 DEFINE(HOST_ES, ES);
68 DEFINE(HOST_GS, GS); 69 DEFINE(HOST_GS, GS);
69 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct)); 70 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
71
72 /* XXX Duplicated between i386 and x86_64 */
73 DEFINE(UM_POLLIN, POLLIN);
74 DEFINE(UM_POLLPRI, POLLPRI);
75 DEFINE(UM_POLLOUT, POLLOUT);
70} 76}
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c
index 74eee5c7c6dd..147bbf05cbc2 100644
--- a/arch/um/sys-x86_64/ptrace.c
+++ b/arch/um/sys-x86_64/ptrace.c
@@ -8,6 +8,7 @@
8#include <asm/ptrace.h> 8#include <asm/ptrace.h>
9#include <linux/sched.h> 9#include <linux/sched.h>
10#include <linux/errno.h> 10#include <linux/errno.h>
11#include <linux/mm.h>
11#include <asm/uaccess.h> 12#include <asm/uaccess.h>
12#include <asm/elf.h> 13#include <asm/elf.h>
13 14
@@ -136,9 +137,28 @@ void arch_switch(void)
136*/ 137*/
137} 138}
138 139
140/* XXX Mostly copied from sys-i386 */
139int is_syscall(unsigned long addr) 141int is_syscall(unsigned long addr)
140{ 142{
141 panic("is_syscall"); 143 unsigned short instr;
144 int n;
145
146 n = copy_from_user(&instr, (void __user *) addr, sizeof(instr));
147 if(n){
148 /* access_process_vm() grants access to vsyscall and stub,
149 * while copy_from_user doesn't. Maybe access_process_vm is
150 * slow, but that doesn't matter, since it will be called only
151 * in case of singlestepping, if copy_from_user failed.
152 */
153 n = access_process_vm(current, addr, &instr, sizeof(instr), 0);
154 if(n != sizeof(instr)) {
155 printk("is_syscall : failed to read instruction from "
156 "0x%lx\n", addr);
157 return(1);
158 }
159 }
160 /* sysenter */
161 return(instr == 0x050f);
142} 162}
143 163
144int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu ) 164int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu )
diff --git a/arch/um/sys-x86_64/signal.c b/arch/um/sys-x86_64/signal.c
index fe1d065332b1..e75c4e1838b0 100644
--- a/arch/um/sys-x86_64/signal.c
+++ b/arch/um/sys-x86_64/signal.c
@@ -55,7 +55,8 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
55} 55}
56 56
57int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp, 57int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
58 struct pt_regs *regs, unsigned long mask) 58 struct pt_regs *regs, unsigned long mask,
59 unsigned long sp)
59{ 60{
60 struct faultinfo * fi = &current->thread.arch.faultinfo; 61 struct faultinfo * fi = &current->thread.arch.faultinfo;
61 int err = 0; 62 int err = 0;
@@ -70,7 +71,11 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
70 err |= PUTREG(regs, RDI, to, rdi); 71 err |= PUTREG(regs, RDI, to, rdi);
71 err |= PUTREG(regs, RSI, to, rsi); 72 err |= PUTREG(regs, RSI, to, rsi);
72 err |= PUTREG(regs, RBP, to, rbp); 73 err |= PUTREG(regs, RBP, to, rbp);
73 err |= PUTREG(regs, RSP, to, rsp); 74 /* Must use orignal RSP, which is passed in, rather than what's in
75 * the pt_regs, because that's already been updated to point at the
76 * signal frame.
77 */
78 err |= __put_user(sp, &to->rsp);
74 err |= PUTREG(regs, RBX, to, rbx); 79 err |= PUTREG(regs, RBX, to, rbx);
75 err |= PUTREG(regs, RDX, to, rdx); 80 err |= PUTREG(regs, RDX, to, rdx);
76 err |= PUTREG(regs, RCX, to, rcx); 81 err |= PUTREG(regs, RCX, to, rcx);
@@ -102,7 +107,7 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
102 107
103#ifdef CONFIG_MODE_TT 108#ifdef CONFIG_MODE_TT
104int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from, 109int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
105 int fpsize) 110 int fpsize)
106{ 111{
107 struct _fpstate *to_fp, *from_fp; 112 struct _fpstate *to_fp, *from_fp;
108 unsigned long sigs; 113 unsigned long sigs;
@@ -120,7 +125,7 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
120} 125}
121 126
122int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp, 127int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
123 struct sigcontext *from, int fpsize) 128 struct sigcontext *from, int fpsize, unsigned long sp)
124{ 129{
125 struct _fpstate *to_fp, *from_fp; 130 struct _fpstate *to_fp, *from_fp;
126 int err; 131 int err;
@@ -128,11 +133,17 @@ int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
128 to_fp = (fp ? fp : (struct _fpstate *) (to + 1)); 133 to_fp = (fp ? fp : (struct _fpstate *) (to + 1));
129 from_fp = from->fpstate; 134 from_fp = from->fpstate;
130 err = copy_to_user(to, from, sizeof(*to)); 135 err = copy_to_user(to, from, sizeof(*to));
136 /* The SP in the sigcontext is the updated one for the signal
137 * delivery. The sp passed in is the original, and this needs
138 * to be restored, so we stick it in separately.
139 */
140 err |= copy_to_user(&SC_SP(to), sp, sizeof(sp));
141
131 if(from_fp != NULL){ 142 if(from_fp != NULL){
132 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate)); 143 err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate));
133 err |= copy_to_user(to_fp, from_fp, fpsize); 144 err |= copy_to_user(to_fp, from_fp, fpsize);
134 } 145 }
135 return(err); 146 return err;
136} 147}
137 148
138#endif 149#endif
@@ -148,11 +159,12 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
148} 159}
149 160
150static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp, 161static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
151 struct pt_regs *from, unsigned long mask) 162 struct pt_regs *from, unsigned long mask,
163 unsigned long sp)
152{ 164{
153 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs), 165 return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
154 sizeof(*fp)), 166 sizeof(*fp), sp),
155 copy_sc_to_user_skas(to, fp, from, mask))); 167 copy_sc_to_user_skas(to, fp, from, mask, sp)));
156} 168}
157 169
158struct rt_sigframe 170struct rt_sigframe
@@ -170,6 +182,7 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
170{ 182{
171 struct rt_sigframe __user *frame; 183 struct rt_sigframe __user *frame;
172 struct _fpstate __user *fp = NULL; 184 struct _fpstate __user *fp = NULL;
185 unsigned long save_sp = PT_REGS_RSP(regs);
173 int err = 0; 186 int err = 0;
174 struct task_struct *me = current; 187 struct task_struct *me = current;
175 188
@@ -193,14 +206,25 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
193 goto out; 206 goto out;
194 } 207 }
195 208
209 /* Update SP now because the page fault handler refuses to extend
210 * the stack if the faulting address is too far below the current
211 * SP, which frame now certainly is. If there's an error, the original
212 * value is restored on the way out.
213 * When writing the sigcontext to the stack, we have to write the
214 * original value, so that's passed to copy_sc_to_user, which does
215 * the right thing with it.
216 */
217 PT_REGS_RSP(regs) = (unsigned long) frame;
218
196 /* Create the ucontext. */ 219 /* Create the ucontext. */
197 err |= __put_user(0, &frame->uc.uc_flags); 220 err |= __put_user(0, &frame->uc.uc_flags);
198 err |= __put_user(0, &frame->uc.uc_link); 221 err |= __put_user(0, &frame->uc.uc_link);
199 err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp); 222 err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
200 err |= __put_user(sas_ss_flags(PT_REGS_SP(regs)), 223 err |= __put_user(sas_ss_flags(save_sp),
201 &frame->uc.uc_stack.ss_flags); 224 &frame->uc.uc_stack.ss_flags);
202 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size); 225 err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
203 err |= copy_sc_to_user(&frame->uc.uc_mcontext, fp, regs, set->sig[0]); 226 err |= copy_sc_to_user(&frame->uc.uc_mcontext, fp, regs, set->sig[0],
227 save_sp);
204 err |= __put_user(fp, &frame->uc.uc_mcontext.fpstate); 228 err |= __put_user(fp, &frame->uc.uc_mcontext.fpstate);
205 if (sizeof(*set) == 16) { 229 if (sizeof(*set) == 16) {
206 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]); 230 __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
@@ -217,10 +241,10 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
217 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode); 241 err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
218 else 242 else
219 /* could use a vstub here */ 243 /* could use a vstub here */
220 goto out; 244 goto restore_sp;
221 245
222 if (err) 246 if (err)
223 goto out; 247 goto restore_sp;
224 248
225 /* Set up registers for signal handler */ 249 /* Set up registers for signal handler */
226 { 250 {
@@ -238,10 +262,12 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
238 PT_REGS_RSI(regs) = (unsigned long) &frame->info; 262 PT_REGS_RSI(regs) = (unsigned long) &frame->info;
239 PT_REGS_RDX(regs) = (unsigned long) &frame->uc; 263 PT_REGS_RDX(regs) = (unsigned long) &frame->uc;
240 PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler; 264 PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler;
241
242 PT_REGS_RSP(regs) = (unsigned long) frame;
243 out: 265 out:
244 return(err); 266 return err;
267
268restore_sp:
269 PT_REGS_RSP(regs) = save_sp;
270 return err;
245} 271}
246 272
247long sys_rt_sigreturn(struct pt_regs *regs) 273long sys_rt_sigreturn(struct pt_regs *regs)
diff --git a/arch/um/sys-x86_64/user-offsets.c b/arch/um/sys-x86_64/user-offsets.c
index 7bd54a921cf7..899cebb57c3f 100644
--- a/arch/um/sys-x86_64/user-offsets.c
+++ b/arch/um/sys-x86_64/user-offsets.c
@@ -1,6 +1,7 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stddef.h> 2#include <stddef.h>
3#include <signal.h> 3#include <signal.h>
4#include <sys/poll.h>
4#define __FRAME_OFFSETS 5#define __FRAME_OFFSETS
5#include <asm/ptrace.h> 6#include <asm/ptrace.h>
6#include <asm/types.h> 7#include <asm/types.h>
@@ -88,4 +89,9 @@ void foo(void)
88 DEFINE_LONGS(HOST_IP, RIP); 89 DEFINE_LONGS(HOST_IP, RIP);
89 DEFINE_LONGS(HOST_SP, RSP); 90 DEFINE_LONGS(HOST_SP, RSP);
90 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct)); 91 DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
92
93 /* XXX Duplicated between i386 and x86_64 */
94 DEFINE(UM_POLLIN, POLLIN);
95 DEFINE(UM_POLLPRI, POLLPRI);
96 DEFINE(UM_POLLOUT, POLLOUT);
91} 97}
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 45efe0ca88f8..4310b4a311a5 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -250,6 +250,15 @@ config SCHED_SMT
250 cost of slightly increased overhead in some places. If unsure say 250 cost of slightly increased overhead in some places. If unsure say
251 N here. 251 N here.
252 252
253config SCHED_MC
254 bool "Multi-core scheduler support"
255 depends on SMP
256 default y
257 help
258 Multi-core scheduler support improves the CPU scheduler's decision
259 making when dealing with multi-core CPU chips at a cost of slightly
260 increased overhead in some places. If unsure say N here.
261
253source "kernel/Kconfig.preempt" 262source "kernel/Kconfig.preempt"
254 263
255config NUMA 264config NUMA
@@ -325,6 +334,10 @@ config HAVE_ARCH_EARLY_PFN_TO_NID
325 def_bool y 334 def_bool y
326 depends on NUMA 335 depends on NUMA
327 336
337config OUT_OF_LINE_PFN_TO_PAGE
338 def_bool y
339 depends on DISCONTIGMEM
340
328config NR_CPUS 341config NR_CPUS
329 int "Maximum number of CPUs (2-256)" 342 int "Maximum number of CPUs (2-256)"
330 range 2 255 343 range 2 255
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index 7549a4389fbf..35b2faccdc6c 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -688,6 +688,8 @@ ia32_sys_call_table:
688 .quad sys_ni_syscall /* pselect6 for now */ 688 .quad sys_ni_syscall /* pselect6 for now */
689 .quad sys_ni_syscall /* ppoll for now */ 689 .quad sys_ni_syscall /* ppoll for now */
690 .quad sys_unshare /* 310 */ 690 .quad sys_unshare /* 310 */
691 .quad compat_sys_set_robust_list
692 .quad compat_sys_get_robust_list
691ia32_syscall_end: 693ia32_syscall_end:
692 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8 694 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
693 .quad ni_syscall 695 .quad ni_syscall
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index 0370720515f1..70dd8e5c6889 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -66,24 +66,17 @@ 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
69static struct notifier_block *idle_notifier; 69static ATOMIC_NOTIFIER_HEAD(idle_notifier);
70static DEFINE_SPINLOCK(idle_notifier_lock);
71 70
72void idle_notifier_register(struct notifier_block *n) 71void idle_notifier_register(struct notifier_block *n)
73{ 72{
74 unsigned long flags; 73 atomic_notifier_chain_register(&idle_notifier, n);
75 spin_lock_irqsave(&idle_notifier_lock, flags);
76 notifier_chain_register(&idle_notifier, n);
77 spin_unlock_irqrestore(&idle_notifier_lock, flags);
78} 74}
79EXPORT_SYMBOL_GPL(idle_notifier_register); 75EXPORT_SYMBOL_GPL(idle_notifier_register);
80 76
81void idle_notifier_unregister(struct notifier_block *n) 77void idle_notifier_unregister(struct notifier_block *n)
82{ 78{
83 unsigned long flags; 79 atomic_notifier_chain_unregister(&idle_notifier, n);
84 spin_lock_irqsave(&idle_notifier_lock, flags);
85 notifier_chain_unregister(&idle_notifier, n);
86 spin_unlock_irqrestore(&idle_notifier_lock, flags);
87} 80}
88EXPORT_SYMBOL(idle_notifier_unregister); 81EXPORT_SYMBOL(idle_notifier_unregister);
89 82
@@ -93,13 +86,13 @@ static DEFINE_PER_CPU(enum idle_state, idle_state) = CPU_NOT_IDLE;
93void enter_idle(void) 86void enter_idle(void)
94{ 87{
95 __get_cpu_var(idle_state) = CPU_IDLE; 88 __get_cpu_var(idle_state) = CPU_IDLE;
96 notifier_call_chain(&idle_notifier, IDLE_START, NULL); 89 atomic_notifier_call_chain(&idle_notifier, IDLE_START, NULL);
97} 90}
98 91
99static void __exit_idle(void) 92static void __exit_idle(void)
100{ 93{
101 __get_cpu_var(idle_state) = CPU_NOT_IDLE; 94 __get_cpu_var(idle_state) = CPU_NOT_IDLE;
102 notifier_call_chain(&idle_notifier, IDLE_END, NULL); 95 atomic_notifier_call_chain(&idle_notifier, IDLE_END, NULL);
103} 96}
104 97
105/* Called from interrupts to signify idle end */ 98/* Called from interrupts to signify idle end */
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index a57eec8311a7..d1f3e9272c05 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -962,7 +962,6 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
962 962
963 cpuid(1, &eax, &ebx, &ecx, &edx); 963 cpuid(1, &eax, &ebx, &ecx, &edx);
964 964
965 c->apicid = phys_pkg_id(0);
966 965
967 if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY)) 966 if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY))
968 return; 967 return;
@@ -1171,6 +1170,8 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
1171 c->x86_capability[2] = cpuid_edx(0x80860001); 1170 c->x86_capability[2] = cpuid_edx(0x80860001);
1172 } 1171 }
1173 1172
1173 c->apicid = phys_pkg_id(0);
1174
1174 /* 1175 /*
1175 * Vendor-specific initialization. In this section we 1176 * Vendor-specific initialization. In this section we
1176 * canonicalize the feature flags, meaning if there are 1177 * canonicalize the feature flags, meaning if there are
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index 66e98659d077..ea48fa638070 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -68,6 +68,9 @@ u8 phys_proc_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID };
68/* core ID of each logical CPU */ 68/* core ID of each logical CPU */
69u8 cpu_core_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID }; 69u8 cpu_core_id[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID };
70 70
71/* Last level cache ID of each logical CPU */
72u8 cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID};
73
71/* Bitmask of currently online CPUs */ 74/* Bitmask of currently online CPUs */
72cpumask_t cpu_online_map __read_mostly; 75cpumask_t cpu_online_map __read_mostly;
73 76
@@ -445,6 +448,18 @@ void __cpuinit smp_callin(void)
445 cpu_set(cpuid, cpu_callin_map); 448 cpu_set(cpuid, cpu_callin_map);
446} 449}
447 450
451/* maps the cpu to the sched domain representing multi-core */
452cpumask_t cpu_coregroup_map(int cpu)
453{
454 struct cpuinfo_x86 *c = cpu_data + cpu;
455 /*
456 * For perf, we return last level cache shared map.
457 * TBD: when power saving sched policy is added, we will return
458 * cpu_core_map when power saving policy is enabled
459 */
460 return c->llc_shared_map;
461}
462
448/* representing cpus for which sibling maps can be computed */ 463/* representing cpus for which sibling maps can be computed */
449static cpumask_t cpu_sibling_setup_map; 464static cpumask_t cpu_sibling_setup_map;
450 465
@@ -463,12 +478,16 @@ static inline void set_cpu_sibling_map(int cpu)
463 cpu_set(cpu, cpu_sibling_map[i]); 478 cpu_set(cpu, cpu_sibling_map[i]);
464 cpu_set(i, cpu_core_map[cpu]); 479 cpu_set(i, cpu_core_map[cpu]);
465 cpu_set(cpu, cpu_core_map[i]); 480 cpu_set(cpu, cpu_core_map[i]);
481 cpu_set(i, c[cpu].llc_shared_map);
482 cpu_set(cpu, c[i].llc_shared_map);
466 } 483 }
467 } 484 }
468 } else { 485 } else {
469 cpu_set(cpu, cpu_sibling_map[cpu]); 486 cpu_set(cpu, cpu_sibling_map[cpu]);
470 } 487 }
471 488
489 cpu_set(cpu, c[cpu].llc_shared_map);
490
472 if (current_cpu_data.x86_max_cores == 1) { 491 if (current_cpu_data.x86_max_cores == 1) {
473 cpu_core_map[cpu] = cpu_sibling_map[cpu]; 492 cpu_core_map[cpu] = cpu_sibling_map[cpu];
474 c[cpu].booted_cores = 1; 493 c[cpu].booted_cores = 1;
@@ -476,6 +495,11 @@ static inline void set_cpu_sibling_map(int cpu)
476 } 495 }
477 496
478 for_each_cpu_mask(i, cpu_sibling_setup_map) { 497 for_each_cpu_mask(i, cpu_sibling_setup_map) {
498 if (cpu_llc_id[cpu] != BAD_APICID &&
499 cpu_llc_id[cpu] == cpu_llc_id[i]) {
500 cpu_set(i, c[cpu].llc_shared_map);
501 cpu_set(cpu, c[i].llc_shared_map);
502 }
479 if (phys_proc_id[cpu] == phys_proc_id[i]) { 503 if (phys_proc_id[cpu] == phys_proc_id[i]) {
480 cpu_set(i, cpu_core_map[cpu]); 504 cpu_set(i, cpu_core_map[cpu]);
481 cpu_set(cpu, cpu_core_map[i]); 505 cpu_set(cpu, cpu_core_map[i]);
diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c
index 7f58fa682491..473b514b66e4 100644
--- a/arch/x86_64/kernel/time.c
+++ b/arch/x86_64/kernel/time.c
@@ -504,42 +504,25 @@ unsigned long long sched_clock(void)
504 504
505static unsigned long get_cmos_time(void) 505static unsigned long get_cmos_time(void)
506{ 506{
507 unsigned int timeout = 1000000, year, mon, day, hour, min, sec; 507 unsigned int year, mon, day, hour, min, sec;
508 unsigned char uip = 0, this = 0;
509 unsigned long flags; 508 unsigned long flags;
510 unsigned extyear = 0; 509 unsigned extyear = 0;
511 510
512/*
513 * The Linux interpretation of the CMOS clock register contents: When the
514 * Update-In-Progress (UIP) flag goes from 1 to 0, the RTC registers show the
515 * second which has precisely just started. Waiting for this can take up to 1
516 * second, we timeout approximately after 2.4 seconds on a machine with
517 * standard 8.3 MHz ISA bus.
518 */
519
520 spin_lock_irqsave(&rtc_lock, flags); 511 spin_lock_irqsave(&rtc_lock, flags);
521 512
522 while (timeout && (!uip || this)) { 513 do {
523 uip |= this; 514 sec = CMOS_READ(RTC_SECONDS);
524 this = CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP; 515 min = CMOS_READ(RTC_MINUTES);
525 timeout--; 516 hour = CMOS_READ(RTC_HOURS);
526 } 517 day = CMOS_READ(RTC_DAY_OF_MONTH);
527 518 mon = CMOS_READ(RTC_MONTH);
528 /* 519 year = CMOS_READ(RTC_YEAR);
529 * Here we are safe to assume the registers won't change for a whole
530 * second, so we just go ahead and read them.
531 */
532 sec = CMOS_READ(RTC_SECONDS);
533 min = CMOS_READ(RTC_MINUTES);
534 hour = CMOS_READ(RTC_HOURS);
535 day = CMOS_READ(RTC_DAY_OF_MONTH);
536 mon = CMOS_READ(RTC_MONTH);
537 year = CMOS_READ(RTC_YEAR);
538
539#ifdef CONFIG_ACPI 520#ifdef CONFIG_ACPI
540 if (acpi_fadt.revision >= FADT2_REVISION_ID && acpi_fadt.century) 521 if (acpi_fadt.revision >= FADT2_REVISION_ID &&
541 extyear = CMOS_READ(acpi_fadt.century); 522 acpi_fadt.century)
523 extyear = CMOS_READ(acpi_fadt.century);
542#endif 524#endif
525 } while (sec != CMOS_READ(RTC_SECONDS));
543 526
544 spin_unlock_irqrestore(&rtc_lock, flags); 527 spin_unlock_irqrestore(&rtc_lock, flags);
545 528
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 7b148309c529..edaa9fe654dc 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -69,20 +69,20 @@ asmlinkage void alignment_check(void);
69asmlinkage void machine_check(void); 69asmlinkage void machine_check(void);
70asmlinkage void spurious_interrupt_bug(void); 70asmlinkage void spurious_interrupt_bug(void);
71 71
72struct notifier_block *die_chain; 72ATOMIC_NOTIFIER_HEAD(die_chain);
73static DEFINE_SPINLOCK(die_notifier_lock);
74 73
75int register_die_notifier(struct notifier_block *nb) 74int register_die_notifier(struct notifier_block *nb)
76{ 75{
77 int err = 0;
78 unsigned long flags;
79
80 vmalloc_sync_all(); 76 vmalloc_sync_all();
81 spin_lock_irqsave(&die_notifier_lock, flags); 77 return atomic_notifier_chain_register(&die_chain, nb);
82 err = notifier_chain_register(&die_chain, nb); 78}
83 spin_unlock_irqrestore(&die_notifier_lock, flags); 79EXPORT_SYMBOL(register_die_notifier);
84 return err; 80
81int unregister_die_notifier(struct notifier_block *nb)
82{
83 return atomic_notifier_chain_unregister(&die_chain, nb);
85} 84}
85EXPORT_SYMBOL(unregister_die_notifier);
86 86
87static inline void conditional_sti(struct pt_regs *regs) 87static inline void conditional_sti(struct pt_regs *regs)
88{ 88{
diff --git a/arch/x86_64/mm/init.c b/arch/x86_64/mm/init.c
index b04415625442..e5f7f1c34462 100644
--- a/arch/x86_64/mm/init.c
+++ b/arch/x86_64/mm/init.c
@@ -72,7 +72,7 @@ void show_mem(void)
72 show_free_areas(); 72 show_free_areas();
73 printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10)); 73 printk(KERN_INFO "Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
74 74
75 for_each_pgdat(pgdat) { 75 for_each_online_pgdat(pgdat) {
76 for (i = 0; i < pgdat->node_spanned_pages; ++i) { 76 for (i = 0; i < pgdat->node_spanned_pages; ++i) {
77 page = pfn_to_page(pgdat->node_start_pfn + i); 77 page = pfn_to_page(pgdat->node_start_pfn + i);
78 total++; 78 total++;
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index 63c72641b737..4be82d6e2b48 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -377,21 +377,6 @@ EXPORT_SYMBOL(node_data);
377 * Should do that. 377 * Should do that.
378 */ 378 */
379 379
380/* Requires pfn_valid(pfn) to be true */
381struct page *pfn_to_page(unsigned long pfn)
382{
383 int nid = phys_to_nid(((unsigned long)(pfn)) << PAGE_SHIFT);
384 return (pfn - node_start_pfn(nid)) + NODE_DATA(nid)->node_mem_map;
385}
386EXPORT_SYMBOL(pfn_to_page);
387
388unsigned long page_to_pfn(struct page *page)
389{
390 return (long)(((page) - page_zone(page)->zone_mem_map) +
391 page_zone(page)->zone_start_pfn);
392}
393EXPORT_SYMBOL(page_to_pfn);
394
395int pfn_valid(unsigned long pfn) 380int pfn_valid(unsigned long pfn)
396{ 381{
397 unsigned nid; 382 unsigned nid;
diff --git a/arch/xtensa/platform-iss/setup.c b/arch/xtensa/platform-iss/setup.c
index 2e6dcbf0cc04..23790a5610e2 100644
--- a/arch/xtensa/platform-iss/setup.c
+++ b/arch/xtensa/platform-iss/setup.c
@@ -108,5 +108,5 @@ static struct notifier_block iss_panic_block = {
108 108
109void __init platform_setup(char **p_cmdline) 109void __init platform_setup(char **p_cmdline)
110{ 110{
111 notifier_chain_register(&panic_notifier_list, &iss_panic_block); 111 atomic_notifier_chain_register(&panic_notifier_list, &iss_panic_block);
112} 112}