aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAnton Altaparmakov <aia21@cantab.net>2005-07-13 18:09:23 -0400
committerAnton Altaparmakov <aia21@cantab.net>2005-07-13 18:09:23 -0400
commitc514720716c7b109ff980f8b3cb93f9af872c91c (patch)
tree490a9578995705de69712893a190b67651bddc56 /arch
parent07929dcb963786512c760dd3ecd148d89295e7e5 (diff)
parent1e279dd855d15b72364b4103f872d67d8592647e (diff)
Automatic merge with /usr/src/ntfs-2.6.git.
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig2
-rw-r--r--arch/arm/Kconfig12
-rw-r--r--arch/arm/Makefile6
-rw-r--r--arch/arm/configs/enp2611_defconfig20
-rw-r--r--arch/arm/configs/ixdp2400_defconfig20
-rw-r--r--arch/arm/configs/ixdp2401_defconfig20
-rw-r--r--arch/arm/configs/ixdp2800_defconfig20
-rw-r--r--arch/arm/configs/ixdp2801_defconfig20
-rw-r--r--arch/arm/configs/omap_h2_1610_defconfig117
-rw-r--r--arch/arm/kernel/armksyms.c3
-rw-r--r--arch/arm/kernel/setup.c4
-rw-r--r--arch/arm/kernel/smp.c7
-rw-r--r--arch/arm/mach-integrator/platsmp.c8
-rw-r--r--arch/arm/mach-ixp2000/core.c55
-rw-r--r--arch/arm/mach-ixp2000/enp2611.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x00.c1
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x01.c1
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c4
-rw-r--r--arch/arm/mach-ixp4xx/coyote-setup.c27
-rw-r--r--arch/arm/mach-ixp4xx/ixdp425-setup.c3
-rw-r--r--arch/arm/mach-omap/Kconfig221
-rw-r--r--arch/arm/mach-omap/Makefile40
-rw-r--r--arch/arm/mach-omap/common.c549
-rw-r--r--arch/arm/mach-omap/common.h36
-rw-r--r--arch/arm/mach-omap1/Kconfig144
-rw-r--r--arch/arm/mach-omap1/Makefile30
-rw-r--r--arch/arm/mach-omap1/Makefile.boot (renamed from arch/arm/mach-omap/Makefile.boot)1
-rw-r--r--arch/arm/mach-omap1/board-generic.c (renamed from arch/arm/mach-omap/board-generic.c)7
-rw-r--r--arch/arm/mach-omap1/board-h2.c (renamed from arch/arm/mach-omap/board-h2.c)7
-rw-r--r--arch/arm/mach-omap1/board-h3.c (renamed from arch/arm/mach-omap/board-h3.c)7
-rw-r--r--arch/arm/mach-omap1/board-innovator.c (renamed from arch/arm/mach-omap/board-innovator.c)7
-rw-r--r--arch/arm/mach-omap1/board-netstar.c (renamed from arch/arm/mach-omap/board-netstar.c)5
-rw-r--r--arch/arm/mach-omap1/board-osk.c (renamed from arch/arm/mach-omap/board-osk.c)7
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c (renamed from arch/arm/mach-omap/board-perseus2.c)7
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c (renamed from arch/arm/mach-omap/board-voiceblue.c)7
-rw-r--r--arch/arm/mach-omap1/fpga.c (renamed from arch/arm/mach-omap/fpga.c)0
-rw-r--r--arch/arm/mach-omap1/id.c188
-rw-r--r--arch/arm/mach-omap1/io.c115
-rw-r--r--arch/arm/mach-omap1/irq.c (renamed from arch/arm/mach-omap/irq.c)17
-rw-r--r--arch/arm/mach-omap1/leds-h2p2-debug.c (renamed from arch/arm/mach-omap/leds-h2p2-debug.c)1
-rw-r--r--arch/arm/mach-omap1/leds-innovator.c (renamed from arch/arm/mach-omap/leds-innovator.c)0
-rw-r--r--arch/arm/mach-omap1/leds-osk.c (renamed from arch/arm/mach-omap/leds-osk.c)4
-rw-r--r--arch/arm/mach-omap1/leds.c (renamed from arch/arm/mach-omap/leds.c)0
-rw-r--r--arch/arm/mach-omap1/leds.h (renamed from arch/arm/mach-omap/leds.h)0
-rw-r--r--arch/arm/mach-omap1/serial.c200
-rw-r--r--arch/arm/mach-omap1/time.c (renamed from arch/arm/mach-omap/time.c)32
-rw-r--r--arch/arm/mach-pxa/corgi.c6
-rw-r--r--arch/arm/mach-pxa/idp.c2
-rw-r--r--arch/arm/mach-pxa/lubbock.c2
-rw-r--r--arch/arm/mach-pxa/mainstone.c2
-rw-r--r--arch/arm/mach-pxa/poodle.c2
-rw-r--r--arch/arm/mm/Kconfig2
-rw-r--r--arch/arm/mm/mm-armv.c4
-rw-r--r--arch/arm/mm/proc-v6.S2
-rw-r--r--arch/arm/nwfpe/fpmodule.c1
-rw-r--r--arch/arm/plat-omap/Kconfig112
-rw-r--r--arch/arm/plat-omap/Makefile17
-rw-r--r--arch/arm/plat-omap/clock.c (renamed from arch/arm/mach-omap/clock.c)371
-rw-r--r--arch/arm/plat-omap/clock.h (renamed from arch/arm/mach-omap/clock.h)12
-rw-r--r--arch/arm/plat-omap/common.c135
-rw-r--r--arch/arm/plat-omap/cpu-omap.c128
-rw-r--r--arch/arm/plat-omap/dma.c (renamed from arch/arm/mach-omap/dma.c)46
-rw-r--r--arch/arm/plat-omap/gpio.c (renamed from arch/arm/mach-omap/gpio.c)2
-rw-r--r--arch/arm/plat-omap/mcbsp.c (renamed from arch/arm/mach-omap/mcbsp.c)99
-rw-r--r--arch/arm/plat-omap/mux.c (renamed from arch/arm/mach-omap/mux.c)19
-rw-r--r--arch/arm/plat-omap/ocpi.c (renamed from arch/arm/mach-omap/ocpi.c)3
-rw-r--r--arch/arm/plat-omap/pm.c (renamed from arch/arm/mach-omap/pm.c)2
-rw-r--r--arch/arm/plat-omap/sleep.S (renamed from arch/arm/mach-omap/sleep.S)2
-rw-r--r--arch/arm/plat-omap/usb.c (renamed from arch/arm/mach-omap/usb.c)4
-rw-r--r--arch/arm26/Kconfig4
-rw-r--r--arch/cris/Kconfig4
-rw-r--r--arch/frv/Kconfig2
-rw-r--r--arch/frv/defconfig627
-rw-r--r--arch/frv/mb93090-mb00/pci-irq.c2
-rw-r--r--arch/h8300/Kconfig6
-rw-r--r--arch/i386/Kconfig2
-rw-r--r--arch/i386/kernel/acpi/Makefile4
-rw-r--r--arch/i386/kernel/acpi/cstate.c103
-rw-r--r--arch/i386/kernel/acpi/wakeup.S5
-rw-r--r--arch/i386/kernel/cpu/common.c5
-rw-r--r--arch/i386/kernel/cpu/cpufreq/gx-suspmod.c2
-rw-r--r--arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c2
-rw-r--r--arch/i386/kernel/cpu/intel.c2
-rw-r--r--arch/i386/kernel/cpu/mtrr/generic.c22
-rw-r--r--arch/i386/kernel/cpu/mtrr/main.c76
-rw-r--r--arch/i386/kernel/cpu/mtrr/mtrr.h1
-rw-r--r--arch/i386/kernel/kprobes.c2
-rw-r--r--arch/i386/kernel/smpboot.c18
-rw-r--r--arch/i386/kernel/syscall_table.S3
-rw-r--r--arch/i386/kernel/time.c2
-rw-r--r--arch/i386/kernel/timers/timer_hpet.c4
-rw-r--r--arch/i386/kernel/vmlinux.lds.S3
-rw-r--r--arch/i386/mach-voyager/voyager_basic.c1
-rw-r--r--arch/i386/mach-voyager/voyager_smp.c6
-rw-r--r--arch/i386/mm/ioremap.c6
-rw-r--r--arch/i386/pci/common.c1
-rw-r--r--arch/i386/pci/i386.c11
-rw-r--r--arch/i386/pci/irq.c16
-rw-r--r--arch/i386/pci/visws.c2
-rw-r--r--arch/i386/power/cpu.c1
-rw-r--r--arch/ia64/Kconfig2
-rw-r--r--arch/ia64/hp/sim/simeth.c6
-rw-r--r--arch/ia64/hp/sim/simserial.c7
-rw-r--r--arch/ia64/kernel/Makefile1
-rw-r--r--arch/ia64/kernel/acpi.c58
-rw-r--r--arch/ia64/kernel/entry.S2
-rw-r--r--arch/ia64/kernel/iosapic.c13
-rw-r--r--arch/ia64/kernel/irq_ia64.c15
-rw-r--r--arch/ia64/kernel/kprobes.c2
-rw-r--r--arch/ia64/kernel/mca.c2
-rw-r--r--arch/ia64/kernel/numa.c57
-rw-r--r--arch/ia64/kernel/perfmon.c1
-rw-r--r--arch/ia64/kernel/process.c1
-rw-r--r--arch/ia64/kernel/setup.c3
-rw-r--r--arch/ia64/kernel/signal.c2
-rw-r--r--arch/ia64/kernel/smpboot.c41
-rw-r--r--arch/ia64/kernel/topology.c7
-rw-r--r--arch/ia64/kernel/traps.c6
-rw-r--r--arch/ia64/mm/discontig.c432
-rw-r--r--arch/ia64/mm/init.c3
-rw-r--r--arch/ia64/sn/include/pci/pcibr_provider.h151
-rw-r--r--arch/ia64/sn/include/pci/pic.h261
-rw-r--r--arch/ia64/sn/include/pci/tiocp.h256
-rw-r--r--arch/ia64/sn/include/xtalk/hubdev.h2
-rw-r--r--arch/ia64/sn/kernel/io_init.c185
-rw-r--r--arch/ia64/sn/kernel/irq.c255
-rw-r--r--arch/ia64/sn/kernel/setup.c13
-rw-r--r--arch/ia64/sn/kernel/tiocx.c5
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c16
-rw-r--r--arch/ia64/sn/pci/pci_dma.c3
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_ate.c2
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_dma.c15
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_provider.c48
-rw-r--r--arch/ia64/sn/pci/pcibr/pcibr_reg.c8
-rw-r--r--arch/ia64/sn/pci/tioca_provider.c3
-rw-r--r--arch/m32r/Kconfig2
-rw-r--r--arch/m32r/kernel/setup_m32700ut.c55
-rw-r--r--arch/m32r/kernel/setup_mappi.c51
-rw-r--r--arch/m32r/kernel/setup_mappi2.c4
-rw-r--r--arch/m32r/kernel/setup_mappi3.c52
-rw-r--r--arch/m32r/kernel/setup_oaks32r.c5
-rw-r--r--arch/m32r/kernel/setup_opsput.c53
-rw-r--r--arch/m68k/Kconfig2
-rw-r--r--arch/m68knommu/Kconfig2
-rw-r--r--arch/mips/Kconfig2
-rw-r--r--arch/parisc/Kconfig2
-rw-r--r--arch/ppc/8xx_io/enet.c52
-rw-r--r--arch/ppc/Kconfig24
-rw-r--r--arch/ppc/boot/images/Makefile7
-rw-r--r--arch/ppc/configs/mpc86x_ads_defconfig633
-rw-r--r--arch/ppc/configs/mpc885ads_defconfig622
-rw-r--r--arch/ppc/kernel/machine_kexec.c6
-rw-r--r--arch/ppc/kernel/time.c13
-rw-r--r--arch/ppc/platforms/fads.h109
-rw-r--r--arch/ppc/platforms/mpc885ads.h92
-rw-r--r--arch/ppc/platforms/pmac_cpufreq.c2
-rw-r--r--arch/ppc/syslib/of_device.c15
-rw-r--r--arch/ppc/syslib/ppc4xx_pic.c4
-rw-r--r--arch/ppc64/Kconfig2
-rw-r--r--arch/ppc64/kernel/cpu_setup_power4.S38
-rw-r--r--arch/ppc64/kernel/cputable.c380
-rw-r--r--arch/ppc64/kernel/head.S10
-rw-r--r--arch/ppc64/kernel/hvconsole.c51
-rw-r--r--arch/ppc64/kernel/iSeries_htab.c51
-rw-r--r--arch/ppc64/kernel/iSeries_setup.c112
-rw-r--r--arch/ppc64/kernel/idle.c283
-rw-r--r--arch/ppc64/kernel/kprobes.c2
-rw-r--r--arch/ppc64/kernel/maple_setup.c3
-rw-r--r--arch/ppc64/kernel/misc.S6
-rw-r--r--arch/ppc64/kernel/of_device.c15
-rw-r--r--arch/ppc64/kernel/pSeries_lpar.c47
-rw-r--r--arch/ppc64/kernel/pSeries_setup.c156
-rw-r--r--arch/ppc64/kernel/pmac_setup.c5
-rw-r--r--arch/ppc64/kernel/setup.c8
-rw-r--r--arch/ppc64/kernel/sys_ppc32.c54
-rw-r--r--arch/ppc64/kernel/sysfs.c14
-rw-r--r--arch/ppc64/kernel/vdso32/vdso32.lds.S4
-rw-r--r--arch/ppc64/mm/hash_low.S8
-rw-r--r--arch/ppc64/mm/hash_native.c129
-rw-r--r--arch/ppc64/mm/hash_utils.c16
-rw-r--r--arch/ppc64/mm/hugetlbpage.c16
-rw-r--r--arch/ppc64/mm/init.c7
-rw-r--r--arch/s390/Kconfig4
-rw-r--r--arch/s390/kernel/compat_linux.c38
-rw-r--r--arch/s390/kernel/compat_wrapper.S4
-rw-r--r--arch/sh/Kconfig2
-rw-r--r--arch/sh64/Kconfig2
-rw-r--r--arch/sparc/Kconfig2
-rw-r--r--arch/sparc/kernel/systbls.S4
-rw-r--r--arch/sparc64/Kconfig43
-rw-r--r--arch/sparc64/kernel/dtlb_backend.S2
-rw-r--r--arch/sparc64/kernel/entry.S63
-rw-r--r--arch/sparc64/kernel/irq.c588
-rw-r--r--arch/sparc64/kernel/kprobes.c5
-rw-r--r--arch/sparc64/kernel/pci_psycho.c3
-rw-r--r--arch/sparc64/kernel/pci_sabre.c46
-rw-r--r--arch/sparc64/kernel/pci_schizo.c78
-rw-r--r--arch/sparc64/kernel/power.c3
-rw-r--r--arch/sparc64/kernel/ptrace.c46
-rw-r--r--arch/sparc64/kernel/smp.c10
-rw-r--r--arch/sparc64/kernel/sparc64_ksyms.c2
-rw-r--r--arch/sparc64/kernel/sys32.S2
-rw-r--r--arch/sparc64/kernel/systbls.S8
-rw-r--r--arch/sparc64/kernel/time.c26
-rw-r--r--arch/sparc64/kernel/vmlinux.lds.S2
-rw-r--r--arch/sparc64/mm/fault.c16
-rw-r--r--arch/sparc64/mm/ultra.S5
-rw-r--r--arch/sparc64/solaris/entry64.S7
-rw-r--r--arch/um/Kconfig10
-rw-r--r--arch/um/Kconfig_i38612
-rw-r--r--arch/um/Kconfig_x86_6412
-rw-r--r--arch/um/Makefile3
-rw-r--r--arch/um/Makefile-i3862
-rw-r--r--arch/um/Makefile-x86_642
-rw-r--r--arch/um/defconfig58
-rw-r--r--arch/um/drivers/line.c37
-rw-r--r--arch/um/include/mem.h1
-rw-r--r--arch/um/include/registers.h1
-rw-r--r--arch/um/include/sysdep-i386/ptrace_user.h13
-rw-r--r--arch/um/include/sysdep-i386/stub.h65
-rw-r--r--arch/um/include/sysdep-x86_64/ptrace_user.h14
-rw-r--r--arch/um/include/sysdep-x86_64/stub.h58
-rw-r--r--arch/um/include/time_user.h1
-rw-r--r--arch/um/include/tlb.h30
-rw-r--r--arch/um/kernel/dyn.lds.S6
-rw-r--r--arch/um/kernel/physmem.c8
-rw-r--r--arch/um/kernel/process.c28
-rw-r--r--arch/um/kernel/skas/Makefile7
-rw-r--r--arch/um/kernel/skas/clone.c44
-rw-r--r--arch/um/kernel/skas/exec_kern.c2
-rw-r--r--arch/um/kernel/skas/include/mm_id.h17
-rw-r--r--arch/um/kernel/skas/include/mmu-skas.h7
-rw-r--r--arch/um/kernel/skas/include/skas.h16
-rw-r--r--arch/um/kernel/skas/include/stub-data.h18
-rw-r--r--arch/um/kernel/skas/mem.c6
-rw-r--r--arch/um/kernel/skas/mem_user.c225
-rw-r--r--arch/um/kernel/skas/mmu.c141
-rw-r--r--arch/um/kernel/skas/process.c216
-rw-r--r--arch/um/kernel/skas/process_kern.c33
-rw-r--r--arch/um/kernel/skas/tlb.c29
-rw-r--r--arch/um/kernel/time.c7
-rw-r--r--arch/um/kernel/tlb.c132
-rw-r--r--arch/um/kernel/tt/tlb.c4
-rw-r--r--arch/um/kernel/uml.lds.S7
-rw-r--r--arch/um/os-Linux/sys-i386/registers.c5
-rw-r--r--arch/um/os-Linux/sys-x86_64/registers.c5
-rw-r--r--arch/um/scripts/Makefile.rules5
-rw-r--r--arch/um/sys-i386/Makefile12
-rw-r--r--arch/um/sys-i386/stub.S8
-rw-r--r--arch/um/sys-i386/stub_segv.c30
-rw-r--r--arch/um/sys-x86_64/Makefile12
-rw-r--r--arch/um/sys-x86_64/stub.S15
-rw-r--r--arch/um/sys-x86_64/stub_segv.c31
-rw-r--r--arch/v850/Kconfig4
-rw-r--r--arch/v850/kernel/vmlinux.lds.S5
-rw-r--r--arch/v850/lib/checksum.c3
-rw-r--r--arch/x86_64/Kconfig2
-rw-r--r--arch/x86_64/Makefile4
-rw-r--r--arch/x86_64/crypto/Makefile9
-rw-r--r--arch/x86_64/crypto/aes-x86_64-asm.S186
-rw-r--r--arch/x86_64/crypto/aes.c324
-rw-r--r--arch/x86_64/kernel/kprobes.c2
-rw-r--r--arch/x86_64/kernel/setup.c4
-rw-r--r--arch/x86_64/kernel/suspend.c1
-rw-r--r--arch/x86_64/kernel/vmlinux.lds.S8
-rw-r--r--arch/xtensa/Kconfig2
-rw-r--r--arch/xtensa/kernel/asm-offsets.c1
-rw-r--r--arch/xtensa/kernel/syscalls.c153
-rw-r--r--arch/xtensa/kernel/syscalls.h63
-rw-r--r--arch/xtensa/kernel/traps.c4
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S6
271 files changed, 7987 insertions, 4213 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index c5739d6309..083c5df42d 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -596,6 +596,8 @@ source "fs/Kconfig.binfmt"
596 596
597endmenu 597endmenu
598 598
599source "net/Kconfig"
600
599source "drivers/Kconfig" 601source "drivers/Kconfig"
600 602
601source "fs/Kconfig" 603source "fs/Kconfig"
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 620f2ca94e..7bc4a583f4 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -223,7 +223,9 @@ source "arch/arm/mach-pxa/Kconfig"
223 223
224source "arch/arm/mach-sa1100/Kconfig" 224source "arch/arm/mach-sa1100/Kconfig"
225 225
226source "arch/arm/mach-omap/Kconfig" 226source "arch/arm/plat-omap/Kconfig"
227
228source "arch/arm/mach-omap1/Kconfig"
227 229
228source "arch/arm/mach-s3c2410/Kconfig" 230source "arch/arm/mach-s3c2410/Kconfig"
229 231
@@ -514,7 +516,7 @@ config XIP_PHYS_ADDR
514 516
515endmenu 517endmenu
516 518
517if (ARCH_SA1100 || ARCH_INTEGRATOR) 519if (ARCH_SA1100 || ARCH_INTEGRATOR || ARCH_OMAP1)
518 520
519menu "CPU Frequency scaling" 521menu "CPU Frequency scaling"
520 522
@@ -698,6 +700,8 @@ config APM
698 700
699endmenu 701endmenu
700 702
703source "net/Kconfig"
704
701menu "Device Drivers" 705menu "Device Drivers"
702 706
703source "drivers/base/Kconfig" 707source "drivers/base/Kconfig"
@@ -730,7 +734,7 @@ source "drivers/ieee1394/Kconfig"
730 734
731source "drivers/message/i2o/Kconfig" 735source "drivers/message/i2o/Kconfig"
732 736
733source "net/Kconfig" 737source "drivers/net/Kconfig"
734 738
735source "drivers/isdn/Kconfig" 739source "drivers/isdn/Kconfig"
736 740
@@ -742,6 +746,8 @@ source "drivers/char/Kconfig"
742 746
743source "drivers/i2c/Kconfig" 747source "drivers/i2c/Kconfig"
744 748
749source "drivers/hwmon/Kconfig"
750
745#source "drivers/l3/Kconfig" 751#source "drivers/l3/Kconfig"
746 752
747source "drivers/misc/Kconfig" 753source "drivers/misc/Kconfig"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index eb933dcafb..67f1453ade 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -91,7 +91,8 @@ textaddr-$(CONFIG_ARCH_FORTUNET) := 0xc0008000
91 machine-$(CONFIG_ARCH_IOP3XX) := iop3xx 91 machine-$(CONFIG_ARCH_IOP3XX) := iop3xx
92 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx 92 machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
93 machine-$(CONFIG_ARCH_IXP2000) := ixp2000 93 machine-$(CONFIG_ARCH_IXP2000) := ixp2000
94 machine-$(CONFIG_ARCH_OMAP) := omap 94 machine-$(CONFIG_ARCH_OMAP1) := omap1
95 incdir-$(CONFIG_ARCH_OMAP) := omap
95 machine-$(CONFIG_ARCH_S3C2410) := s3c2410 96 machine-$(CONFIG_ARCH_S3C2410) := s3c2410
96 machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x 97 machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x
97 machine-$(CONFIG_ARCH_VERSATILE) := versatile 98 machine-$(CONFIG_ARCH_VERSATILE) := versatile
@@ -142,6 +143,9 @@ core-$(CONFIG_FPE_NWFPE) += arch/arm/nwfpe/
142core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ) 143core-$(CONFIG_FPE_FASTFPE) += $(FASTFPE_OBJ)
143core-$(CONFIG_VFP) += arch/arm/vfp/ 144core-$(CONFIG_VFP) += arch/arm/vfp/
144 145
146# If we have a common platform directory, then include it in the build.
147core-$(CONFIG_ARCH_OMAP) += arch/arm/plat-omap/
148
145drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/ 149drivers-$(CONFIG_OPROFILE) += arch/arm/oprofile/
146drivers-$(CONFIG_ARCH_CLPS7500) += drivers/acorn/char/ 150drivers-$(CONFIG_ARCH_CLPS7500) += drivers/acorn/char/
147drivers-$(CONFIG_ARCH_L7200) += drivers/acorn/char/ 151drivers-$(CONFIG_ARCH_L7200) += drivers/acorn/char/
diff --git a/arch/arm/configs/enp2611_defconfig b/arch/arm/configs/enp2611_defconfig
index b8c51ee7f1..f67ca01b49 100644
--- a/arch/arm/configs/enp2611_defconfig
+++ b/arch/arm/configs/enp2611_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.12-git6 3# Linux kernel version: 2.6.13-rc2
4# Sat Jun 25 00:57:29 2005 4# Thu Jul 7 16:41:21 2005
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -137,6 +137,7 @@ CONFIG_PCI_NAMES=y
137# 137#
138# CONFIG_SMP is not set 138# CONFIG_SMP is not set
139# CONFIG_PREEMPT is not set 139# CONFIG_PREEMPT is not set
140# CONFIG_NO_IDLE_HZ is not set
140# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 141# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
141CONFIG_SELECT_MEMORY_MODEL=y 142CONFIG_SELECT_MEMORY_MODEL=y
142CONFIG_FLATMEM_MANUAL=y 143CONFIG_FLATMEM_MANUAL=y
@@ -345,10 +346,9 @@ CONFIG_PACKET_MMAP=y
345CONFIG_UNIX=y 346CONFIG_UNIX=y
346# CONFIG_NET_KEY is not set 347# CONFIG_NET_KEY is not set
347CONFIG_INET=y 348CONFIG_INET=y
348CONFIG_IP_FIB_HASH=y
349# CONFIG_IP_FIB_TRIE is not set
350# CONFIG_IP_MULTICAST is not set 349# CONFIG_IP_MULTICAST is not set
351# CONFIG_IP_ADVANCED_ROUTER is not set 350# CONFIG_IP_ADVANCED_ROUTER is not set
351CONFIG_IP_FIB_HASH=y
352CONFIG_IP_PNP=y 352CONFIG_IP_PNP=y
353CONFIG_IP_PNP_DHCP=y 353CONFIG_IP_PNP_DHCP=y
354CONFIG_IP_PNP_BOOTP=y 354CONFIG_IP_PNP_BOOTP=y
@@ -363,17 +363,8 @@ CONFIG_SYN_COOKIES=y
363# CONFIG_INET_TUNNEL is not set 363# CONFIG_INET_TUNNEL is not set
364# CONFIG_IP_TCPDIAG is not set 364# CONFIG_IP_TCPDIAG is not set
365# CONFIG_IP_TCPDIAG_IPV6 is not set 365# CONFIG_IP_TCPDIAG_IPV6 is not set
366 366# CONFIG_TCP_CONG_ADVANCED is not set
367#
368# TCP congestion control
369#
370CONFIG_TCP_CONG_BIC=y 367CONFIG_TCP_CONG_BIC=y
371CONFIG_TCP_CONG_WESTWOOD=m
372CONFIG_TCP_CONG_HTCP=m
373# CONFIG_TCP_CONG_HSTCP is not set
374# CONFIG_TCP_CONG_HYBLA is not set
375# CONFIG_TCP_CONG_VEGAS is not set
376# CONFIG_TCP_CONG_SCALABLE is not set
377# CONFIG_IPV6 is not set 368# CONFIG_IPV6 is not set
378# CONFIG_NETFILTER is not set 369# CONFIG_NETFILTER is not set
379 370
@@ -931,4 +922,3 @@ CONFIG_CRC32=y
931# CONFIG_LIBCRC32C is not set 922# CONFIG_LIBCRC32C is not set
932CONFIG_ZLIB_INFLATE=y 923CONFIG_ZLIB_INFLATE=y
933CONFIG_ZLIB_DEFLATE=y 924CONFIG_ZLIB_DEFLATE=y
934# CONFIG_TEXTSEARCH is not set
diff --git a/arch/arm/configs/ixdp2400_defconfig b/arch/arm/configs/ixdp2400_defconfig
index 3cfbe2ec29..5c6c928215 100644
--- a/arch/arm/configs/ixdp2400_defconfig
+++ b/arch/arm/configs/ixdp2400_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.12-git6 3# Linux kernel version: 2.6.13-rc2
4# Sat Jun 25 00:58:38 2005 4# Thu Jul 7 16:49:01 2005
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -138,6 +138,7 @@ CONFIG_PCI_NAMES=y
138# 138#
139# CONFIG_SMP is not set 139# CONFIG_SMP is not set
140# CONFIG_PREEMPT is not set 140# CONFIG_PREEMPT is not set
141# CONFIG_NO_IDLE_HZ is not set
141# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 142# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
142CONFIG_SELECT_MEMORY_MODEL=y 143CONFIG_SELECT_MEMORY_MODEL=y
143CONFIG_FLATMEM_MANUAL=y 144CONFIG_FLATMEM_MANUAL=y
@@ -346,10 +347,9 @@ CONFIG_PACKET_MMAP=y
346CONFIG_UNIX=y 347CONFIG_UNIX=y
347# CONFIG_NET_KEY is not set 348# CONFIG_NET_KEY is not set
348CONFIG_INET=y 349CONFIG_INET=y
349CONFIG_IP_FIB_HASH=y
350# CONFIG_IP_FIB_TRIE is not set
351# CONFIG_IP_MULTICAST is not set 350# CONFIG_IP_MULTICAST is not set
352# CONFIG_IP_ADVANCED_ROUTER is not set 351# CONFIG_IP_ADVANCED_ROUTER is not set
352CONFIG_IP_FIB_HASH=y
353CONFIG_IP_PNP=y 353CONFIG_IP_PNP=y
354CONFIG_IP_PNP_DHCP=y 354CONFIG_IP_PNP_DHCP=y
355CONFIG_IP_PNP_BOOTP=y 355CONFIG_IP_PNP_BOOTP=y
@@ -364,17 +364,8 @@ CONFIG_SYN_COOKIES=y
364# CONFIG_INET_TUNNEL is not set 364# CONFIG_INET_TUNNEL is not set
365# CONFIG_IP_TCPDIAG is not set 365# CONFIG_IP_TCPDIAG is not set
366# CONFIG_IP_TCPDIAG_IPV6 is not set 366# CONFIG_IP_TCPDIAG_IPV6 is not set
367 367# CONFIG_TCP_CONG_ADVANCED is not set
368#
369# TCP congestion control
370#
371CONFIG_TCP_CONG_BIC=y 368CONFIG_TCP_CONG_BIC=y
372CONFIG_TCP_CONG_WESTWOOD=m
373CONFIG_TCP_CONG_HTCP=m
374# CONFIG_TCP_CONG_HSTCP is not set
375# CONFIG_TCP_CONG_HYBLA is not set
376# CONFIG_TCP_CONG_VEGAS is not set
377# CONFIG_TCP_CONG_SCALABLE is not set
378# CONFIG_IPV6 is not set 369# CONFIG_IPV6 is not set
379# CONFIG_NETFILTER is not set 370# CONFIG_NETFILTER is not set
380 371
@@ -932,4 +923,3 @@ CONFIG_CRC32=y
932# CONFIG_LIBCRC32C is not set 923# CONFIG_LIBCRC32C is not set
933CONFIG_ZLIB_INFLATE=y 924CONFIG_ZLIB_INFLATE=y
934CONFIG_ZLIB_DEFLATE=y 925CONFIG_ZLIB_DEFLATE=y
935# CONFIG_TEXTSEARCH is not set
diff --git a/arch/arm/configs/ixdp2401_defconfig b/arch/arm/configs/ixdp2401_defconfig
index 5c87e8e696..6dc40f6be0 100644
--- a/arch/arm/configs/ixdp2401_defconfig
+++ b/arch/arm/configs/ixdp2401_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.12-git6 3# Linux kernel version: 2.6.13-rc2
4# Sat Jun 25 00:59:35 2005 4# Thu Jul 7 16:49:08 2005
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -138,6 +138,7 @@ CONFIG_PCI_NAMES=y
138# 138#
139# CONFIG_SMP is not set 139# CONFIG_SMP is not set
140# CONFIG_PREEMPT is not set 140# CONFIG_PREEMPT is not set
141# CONFIG_NO_IDLE_HZ is not set
141# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 142# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
142CONFIG_SELECT_MEMORY_MODEL=y 143CONFIG_SELECT_MEMORY_MODEL=y
143CONFIG_FLATMEM_MANUAL=y 144CONFIG_FLATMEM_MANUAL=y
@@ -346,10 +347,9 @@ CONFIG_PACKET_MMAP=y
346CONFIG_UNIX=y 347CONFIG_UNIX=y
347# CONFIG_NET_KEY is not set 348# CONFIG_NET_KEY is not set
348CONFIG_INET=y 349CONFIG_INET=y
349CONFIG_IP_FIB_HASH=y
350# CONFIG_IP_FIB_TRIE is not set
351# CONFIG_IP_MULTICAST is not set 350# CONFIG_IP_MULTICAST is not set
352# CONFIG_IP_ADVANCED_ROUTER is not set 351# CONFIG_IP_ADVANCED_ROUTER is not set
352CONFIG_IP_FIB_HASH=y
353CONFIG_IP_PNP=y 353CONFIG_IP_PNP=y
354CONFIG_IP_PNP_DHCP=y 354CONFIG_IP_PNP_DHCP=y
355CONFIG_IP_PNP_BOOTP=y 355CONFIG_IP_PNP_BOOTP=y
@@ -364,17 +364,8 @@ CONFIG_SYN_COOKIES=y
364# CONFIG_INET_TUNNEL is not set 364# CONFIG_INET_TUNNEL is not set
365CONFIG_IP_TCPDIAG=y 365CONFIG_IP_TCPDIAG=y
366# CONFIG_IP_TCPDIAG_IPV6 is not set 366# CONFIG_IP_TCPDIAG_IPV6 is not set
367 367# CONFIG_TCP_CONG_ADVANCED is not set
368#
369# TCP congestion control
370#
371CONFIG_TCP_CONG_BIC=y 368CONFIG_TCP_CONG_BIC=y
372CONFIG_TCP_CONG_WESTWOOD=m
373CONFIG_TCP_CONG_HTCP=m
374# CONFIG_TCP_CONG_HSTCP is not set
375# CONFIG_TCP_CONG_HYBLA is not set
376# CONFIG_TCP_CONG_VEGAS is not set
377# CONFIG_TCP_CONG_SCALABLE is not set
378# CONFIG_IPV6 is not set 369# CONFIG_IPV6 is not set
379# CONFIG_NETFILTER is not set 370# CONFIG_NETFILTER is not set
380 371
@@ -933,4 +924,3 @@ CONFIG_CRC32=y
933# CONFIG_LIBCRC32C is not set 924# CONFIG_LIBCRC32C is not set
934CONFIG_ZLIB_INFLATE=y 925CONFIG_ZLIB_INFLATE=y
935CONFIG_ZLIB_DEFLATE=y 926CONFIG_ZLIB_DEFLATE=y
936# CONFIG_TEXTSEARCH is not set
diff --git a/arch/arm/configs/ixdp2800_defconfig b/arch/arm/configs/ixdp2800_defconfig
index 3cb561a551..d2bb0b7153 100644
--- a/arch/arm/configs/ixdp2800_defconfig
+++ b/arch/arm/configs/ixdp2800_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.12-git6 3# Linux kernel version: 2.6.13-rc2
4# Sat Jun 25 01:00:27 2005 4# Thu Jul 7 16:49:20 2005
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -138,6 +138,7 @@ CONFIG_PCI_NAMES=y
138# 138#
139# CONFIG_SMP is not set 139# CONFIG_SMP is not set
140# CONFIG_PREEMPT is not set 140# CONFIG_PREEMPT is not set
141# CONFIG_NO_IDLE_HZ is not set
141# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 142# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
142CONFIG_SELECT_MEMORY_MODEL=y 143CONFIG_SELECT_MEMORY_MODEL=y
143CONFIG_FLATMEM_MANUAL=y 144CONFIG_FLATMEM_MANUAL=y
@@ -346,10 +347,9 @@ CONFIG_PACKET_MMAP=y
346CONFIG_UNIX=y 347CONFIG_UNIX=y
347# CONFIG_NET_KEY is not set 348# CONFIG_NET_KEY is not set
348CONFIG_INET=y 349CONFIG_INET=y
349CONFIG_IP_FIB_HASH=y
350# CONFIG_IP_FIB_TRIE is not set
351# CONFIG_IP_MULTICAST is not set 350# CONFIG_IP_MULTICAST is not set
352# CONFIG_IP_ADVANCED_ROUTER is not set 351# CONFIG_IP_ADVANCED_ROUTER is not set
352CONFIG_IP_FIB_HASH=y
353CONFIG_IP_PNP=y 353CONFIG_IP_PNP=y
354CONFIG_IP_PNP_DHCP=y 354CONFIG_IP_PNP_DHCP=y
355CONFIG_IP_PNP_BOOTP=y 355CONFIG_IP_PNP_BOOTP=y
@@ -364,17 +364,8 @@ CONFIG_SYN_COOKIES=y
364# CONFIG_INET_TUNNEL is not set 364# CONFIG_INET_TUNNEL is not set
365# CONFIG_IP_TCPDIAG is not set 365# CONFIG_IP_TCPDIAG is not set
366# CONFIG_IP_TCPDIAG_IPV6 is not set 366# CONFIG_IP_TCPDIAG_IPV6 is not set
367 367# CONFIG_TCP_CONG_ADVANCED is not set
368#
369# TCP congestion control
370#
371CONFIG_TCP_CONG_BIC=y 368CONFIG_TCP_CONG_BIC=y
372CONFIG_TCP_CONG_WESTWOOD=m
373CONFIG_TCP_CONG_HTCP=m
374# CONFIG_TCP_CONG_HSTCP is not set
375# CONFIG_TCP_CONG_HYBLA is not set
376# CONFIG_TCP_CONG_VEGAS is not set
377# CONFIG_TCP_CONG_SCALABLE is not set
378# CONFIG_IPV6 is not set 369# CONFIG_IPV6 is not set
379# CONFIG_NETFILTER is not set 370# CONFIG_NETFILTER is not set
380 371
@@ -932,4 +923,3 @@ CONFIG_CRC32=y
932# CONFIG_LIBCRC32C is not set 923# CONFIG_LIBCRC32C is not set
933CONFIG_ZLIB_INFLATE=y 924CONFIG_ZLIB_INFLATE=y
934CONFIG_ZLIB_DEFLATE=y 925CONFIG_ZLIB_DEFLATE=y
935# CONFIG_TEXTSEARCH is not set
diff --git a/arch/arm/configs/ixdp2801_defconfig b/arch/arm/configs/ixdp2801_defconfig
index b1e162f29c..2d6f960e33 100644
--- a/arch/arm/configs/ixdp2801_defconfig
+++ b/arch/arm/configs/ixdp2801_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.12-git6 3# Linux kernel version: 2.6.13-rc2
4# Sat Jun 25 01:01:18 2005 4# Thu Jul 7 16:49:13 2005
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -138,6 +138,7 @@ CONFIG_PCI_NAMES=y
138# 138#
139# CONFIG_SMP is not set 139# CONFIG_SMP is not set
140# CONFIG_PREEMPT is not set 140# CONFIG_PREEMPT is not set
141# CONFIG_NO_IDLE_HZ is not set
141# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 142# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
142CONFIG_SELECT_MEMORY_MODEL=y 143CONFIG_SELECT_MEMORY_MODEL=y
143CONFIG_FLATMEM_MANUAL=y 144CONFIG_FLATMEM_MANUAL=y
@@ -346,10 +347,9 @@ CONFIG_PACKET_MMAP=y
346CONFIG_UNIX=y 347CONFIG_UNIX=y
347# CONFIG_NET_KEY is not set 348# CONFIG_NET_KEY is not set
348CONFIG_INET=y 349CONFIG_INET=y
349CONFIG_IP_FIB_HASH=y
350# CONFIG_IP_FIB_TRIE is not set
351# CONFIG_IP_MULTICAST is not set 350# CONFIG_IP_MULTICAST is not set
352# CONFIG_IP_ADVANCED_ROUTER is not set 351# CONFIG_IP_ADVANCED_ROUTER is not set
352CONFIG_IP_FIB_HASH=y
353CONFIG_IP_PNP=y 353CONFIG_IP_PNP=y
354CONFIG_IP_PNP_DHCP=y 354CONFIG_IP_PNP_DHCP=y
355CONFIG_IP_PNP_BOOTP=y 355CONFIG_IP_PNP_BOOTP=y
@@ -364,17 +364,8 @@ CONFIG_SYN_COOKIES=y
364# CONFIG_INET_TUNNEL is not set 364# CONFIG_INET_TUNNEL is not set
365# CONFIG_IP_TCPDIAG is not set 365# CONFIG_IP_TCPDIAG is not set
366# CONFIG_IP_TCPDIAG_IPV6 is not set 366# CONFIG_IP_TCPDIAG_IPV6 is not set
367 367# CONFIG_TCP_CONG_ADVANCED is not set
368#
369# TCP congestion control
370#
371CONFIG_TCP_CONG_BIC=y 368CONFIG_TCP_CONG_BIC=y
372CONFIG_TCP_CONG_WESTWOOD=m
373CONFIG_TCP_CONG_HTCP=m
374# CONFIG_TCP_CONG_HSTCP is not set
375# CONFIG_TCP_CONG_HYBLA is not set
376# CONFIG_TCP_CONG_VEGAS is not set
377# CONFIG_TCP_CONG_SCALABLE is not set
378# CONFIG_IPV6 is not set 369# CONFIG_IPV6 is not set
379# CONFIG_NETFILTER is not set 370# CONFIG_NETFILTER is not set
380 371
@@ -933,4 +924,3 @@ CONFIG_CRC32=y
933# CONFIG_LIBCRC32C is not set 924# CONFIG_LIBCRC32C is not set
934CONFIG_ZLIB_INFLATE=y 925CONFIG_ZLIB_INFLATE=y
935CONFIG_ZLIB_DEFLATE=y 926CONFIG_ZLIB_DEFLATE=y
936# CONFIG_TEXTSEARCH is not set
diff --git a/arch/arm/configs/omap_h2_1610_defconfig b/arch/arm/configs/omap_h2_1610_defconfig
index 4e58d9341b..24955263b0 100644
--- a/arch/arm/configs/omap_h2_1610_defconfig
+++ b/arch/arm/configs/omap_h2_1610_defconfig
@@ -1,14 +1,13 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc1-bk2 3# Linux kernel version: 2.6.13-rc2
4# Sun Mar 27 17:52:41 2005 4# Fri Jul 8 04:49:34 2005
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_MMU=y 7CONFIG_MMU=y
8CONFIG_UID16=y 8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y 9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y 10CONFIG_GENERIC_CALIBRATE_DELAY=y
11CONFIG_GENERIC_IOMAP=y
12 11
13# 12#
14# Code maturity level options 13# Code maturity level options
@@ -17,6 +16,7 @@ CONFIG_EXPERIMENTAL=y
17CONFIG_CLEAN_COMPILE=y 16CONFIG_CLEAN_COMPILE=y
18CONFIG_BROKEN_ON_SMP=y 17CONFIG_BROKEN_ON_SMP=y
19CONFIG_LOCK_KERNEL=y 18CONFIG_LOCK_KERNEL=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
20 20
21# 21#
22# General setup 22# General setup
@@ -33,8 +33,9 @@ CONFIG_KOBJECT_UEVENT=y
33# CONFIG_IKCONFIG is not set 33# CONFIG_IKCONFIG is not set
34# CONFIG_EMBEDDED is not set 34# CONFIG_EMBEDDED is not set
35CONFIG_KALLSYMS=y 35CONFIG_KALLSYMS=y
36# CONFIG_KALLSYMS_ALL is not set
37# CONFIG_KALLSYMS_EXTRA_PASS is not set 36# CONFIG_KALLSYMS_EXTRA_PASS is not set
37CONFIG_PRINTK=y
38CONFIG_BUG=y
38CONFIG_BASE_FULL=y 39CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y 40CONFIG_FUTEX=y
40CONFIG_EPOLL=y 41CONFIG_EPOLL=y
@@ -82,10 +83,28 @@ CONFIG_ARCH_OMAP=y
82# CONFIG_ARCH_VERSATILE is not set 83# CONFIG_ARCH_VERSATILE is not set
83# CONFIG_ARCH_IMX is not set 84# CONFIG_ARCH_IMX is not set
84# CONFIG_ARCH_H720X is not set 85# CONFIG_ARCH_H720X is not set
86# CONFIG_ARCH_AAEC2000 is not set
85 87
86# 88#
87# TI OMAP Implementations 89# TI OMAP Implementations
88# 90#
91CONFIG_ARCH_OMAP_OTG=y
92CONFIG_ARCH_OMAP1=y
93# CONFIG_ARCH_OMAP2 is not set
94
95#
96# OMAP Feature Selections
97#
98# CONFIG_OMAP_RESET_CLOCKS is not set
99CONFIG_OMAP_MUX=y
100# CONFIG_OMAP_MUX_DEBUG is not set
101CONFIG_OMAP_MUX_WARNINGS=y
102# CONFIG_OMAP_MPU_TIMER is not set
103CONFIG_OMAP_32K_TIMER=y
104CONFIG_OMAP_32K_TIMER_HZ=128
105CONFIG_OMAP_LL_DEBUG_UART1=y
106# CONFIG_OMAP_LL_DEBUG_UART2 is not set
107# CONFIG_OMAP_LL_DEBUG_UART3 is not set
89 108
90# 109#
91# OMAP Core Type 110# OMAP Core Type
@@ -93,7 +112,6 @@ CONFIG_ARCH_OMAP=y
93# CONFIG_ARCH_OMAP730 is not set 112# CONFIG_ARCH_OMAP730 is not set
94# CONFIG_ARCH_OMAP1510 is not set 113# CONFIG_ARCH_OMAP1510 is not set
95CONFIG_ARCH_OMAP16XX=y 114CONFIG_ARCH_OMAP16XX=y
96CONFIG_ARCH_OMAP_OTG=y
97 115
98# 116#
99# OMAP Board Type 117# OMAP Board Type
@@ -101,21 +119,14 @@ CONFIG_ARCH_OMAP_OTG=y
101# CONFIG_MACH_OMAP_INNOVATOR is not set 119# CONFIG_MACH_OMAP_INNOVATOR is not set
102CONFIG_MACH_OMAP_H2=y 120CONFIG_MACH_OMAP_H2=y
103# CONFIG_MACH_OMAP_H3 is not set 121# CONFIG_MACH_OMAP_H3 is not set
104# CONFIG_MACH_OMAP_H4 is not set
105# CONFIG_MACH_OMAP_OSK is not set 122# CONFIG_MACH_OMAP_OSK is not set
106# CONFIG_MACH_OMAP_GENERIC is not set 123# CONFIG_MACH_OMAP_GENERIC is not set
107 124
108# 125#
109# OMAP Feature Selections 126# OMAP CPU Speed
110# 127#
111CONFIG_OMAP_MUX=y 128# CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER is not set
112# CONFIG_OMAP_MUX_DEBUG is not set 129# CONFIG_OMAP_ARM_216MHZ is not set
113CONFIG_OMAP_MUX_WARNINGS=y
114CONFIG_OMAP_MPU_TIMER=y
115# CONFIG_OMAP_32K_TIMER is not set
116CONFIG_OMAP_LL_DEBUG_UART1=y
117# CONFIG_OMAP_LL_DEBUG_UART2 is not set
118# CONFIG_OMAP_LL_DEBUG_UART3 is not set
119CONFIG_OMAP_ARM_192MHZ=y 130CONFIG_OMAP_ARM_192MHZ=y
120# CONFIG_OMAP_ARM_168MHZ is not set 131# CONFIG_OMAP_ARM_168MHZ is not set
121# CONFIG_OMAP_ARM_120MHZ is not set 132# CONFIG_OMAP_ARM_120MHZ is not set
@@ -145,6 +156,7 @@ CONFIG_ARM_THUMB=y
145# 156#
146# Bus support 157# Bus support
147# 158#
159CONFIG_ISA_DMA_API=y
148 160
149# 161#
150# PCCARD (PCMCIA/CardBus) support 162# PCCARD (PCMCIA/CardBus) support
@@ -154,7 +166,16 @@ CONFIG_ARM_THUMB=y
154# 166#
155# Kernel Features 167# Kernel Features
156# 168#
169# CONFIG_SMP is not set
157CONFIG_PREEMPT=y 170CONFIG_PREEMPT=y
171CONFIG_NO_IDLE_HZ=y
172# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
173CONFIG_SELECT_MEMORY_MODEL=y
174CONFIG_FLATMEM_MANUAL=y
175# CONFIG_DISCONTIGMEM_MANUAL is not set
176# CONFIG_SPARSEMEM_MANUAL is not set
177CONFIG_FLATMEM=y
178CONFIG_FLAT_NODE_MEM_MAP=y
158# CONFIG_LEDS is not set 179# CONFIG_LEDS is not set
159CONFIG_ALIGNMENT_TRAP=y 180CONFIG_ALIGNMENT_TRAP=y
160 181
@@ -167,6 +188,22 @@ CONFIG_CMDLINE="mem=32M console=ttyS0,115200n8 root=0801 ro init=/bin/sh"
167# CONFIG_XIP_KERNEL is not set 188# CONFIG_XIP_KERNEL is not set
168 189
169# 190#
191# CPU Frequency scaling
192#
193CONFIG_CPU_FREQ=y
194CONFIG_CPU_FREQ_TABLE=y
195# CONFIG_CPU_FREQ_DEBUG is not set
196CONFIG_CPU_FREQ_STAT=y
197# CONFIG_CPU_FREQ_STAT_DETAILS is not set
198# CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE is not set
199CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE=y
200# CONFIG_CPU_FREQ_GOV_PERFORMANCE is not set
201# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
202CONFIG_CPU_FREQ_GOV_USERSPACE=y
203# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set
204# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
205
206#
170# Floating point emulation 207# Floating point emulation
171# 208#
172 209
@@ -202,7 +239,6 @@ CONFIG_PM=y
202CONFIG_STANDALONE=y 239CONFIG_STANDALONE=y
203CONFIG_PREVENT_FIRMWARE_BUILD=y 240CONFIG_PREVENT_FIRMWARE_BUILD=y
204# CONFIG_FW_LOADER is not set 241# CONFIG_FW_LOADER is not set
205CONFIG_DEBUG_DRIVER=y
206 242
207# 243#
208# Memory Technology Devices (MTD) 244# Memory Technology Devices (MTD)
@@ -292,7 +328,6 @@ CONFIG_MTD_CFI_UTIL=y
292# 328#
293# Block devices 329# Block devices
294# 330#
295# CONFIG_BLK_DEV_FD is not set
296# CONFIG_BLK_DEV_COW_COMMON is not set 331# CONFIG_BLK_DEV_COW_COMMON is not set
297CONFIG_BLK_DEV_LOOP=y 332CONFIG_BLK_DEV_LOOP=y
298# CONFIG_BLK_DEV_CRYPTOLOOP is not set 333# CONFIG_BLK_DEV_CRYPTOLOOP is not set
@@ -327,6 +362,7 @@ CONFIG_SCSI_PROC_FS=y
327# CONFIG_CHR_DEV_OSST is not set 362# CONFIG_CHR_DEV_OSST is not set
328# CONFIG_BLK_DEV_SR is not set 363# CONFIG_BLK_DEV_SR is not set
329# CONFIG_CHR_DEV_SG is not set 364# CONFIG_CHR_DEV_SG is not set
365# CONFIG_CHR_DEV_SCH is not set
330 366
331# 367#
332# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 368# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -356,6 +392,7 @@ CONFIG_SCSI_PROC_FS=y
356# 392#
357# Fusion MPT device support 393# Fusion MPT device support
358# 394#
395# CONFIG_FUSION is not set
359 396
360# 397#
361# IEEE 1394 (FireWire) support 398# IEEE 1394 (FireWire) support
@@ -375,12 +412,12 @@ CONFIG_NET=y
375# 412#
376CONFIG_PACKET=y 413CONFIG_PACKET=y
377# CONFIG_PACKET_MMAP is not set 414# CONFIG_PACKET_MMAP is not set
378# CONFIG_NETLINK_DEV is not set
379CONFIG_UNIX=y 415CONFIG_UNIX=y
380# CONFIG_NET_KEY is not set 416# CONFIG_NET_KEY is not set
381CONFIG_INET=y 417CONFIG_INET=y
382# CONFIG_IP_MULTICAST is not set 418# CONFIG_IP_MULTICAST is not set
383# CONFIG_IP_ADVANCED_ROUTER is not set 419# CONFIG_IP_ADVANCED_ROUTER is not set
420CONFIG_IP_FIB_HASH=y
384CONFIG_IP_PNP=y 421CONFIG_IP_PNP=y
385CONFIG_IP_PNP_DHCP=y 422CONFIG_IP_PNP_DHCP=y
386CONFIG_IP_PNP_BOOTP=y 423CONFIG_IP_PNP_BOOTP=y
@@ -395,6 +432,8 @@ CONFIG_IP_PNP_BOOTP=y
395# CONFIG_INET_TUNNEL is not set 432# CONFIG_INET_TUNNEL is not set
396CONFIG_IP_TCPDIAG=y 433CONFIG_IP_TCPDIAG=y
397# CONFIG_IP_TCPDIAG_IPV6 is not set 434# CONFIG_IP_TCPDIAG_IPV6 is not set
435# CONFIG_TCP_CONG_ADVANCED is not set
436CONFIG_TCP_CONG_BIC=y
398# CONFIG_IPV6 is not set 437# CONFIG_IPV6 is not set
399# CONFIG_NETFILTER is not set 438# CONFIG_NETFILTER is not set
400 439
@@ -442,6 +481,7 @@ CONFIG_NETDEVICES=y
442CONFIG_NET_ETHERNET=y 481CONFIG_NET_ETHERNET=y
443CONFIG_MII=y 482CONFIG_MII=y
444CONFIG_SMC91X=y 483CONFIG_SMC91X=y
484# CONFIG_DM9000 is not set
445 485
446# 486#
447# Ethernet (1000 Mbit) 487# Ethernet (1000 Mbit)
@@ -518,7 +558,6 @@ CONFIG_SERIO=y
518CONFIG_SERIO_SERPORT=y 558CONFIG_SERIO_SERPORT=y
519# CONFIG_SERIO_RAW is not set 559# CONFIG_SERIO_RAW is not set
520# CONFIG_GAMEPORT is not set 560# CONFIG_GAMEPORT is not set
521CONFIG_SOUND_GAMEPORT=y
522 561
523# 562#
524# Character devices 563# Character devices
@@ -567,13 +606,11 @@ CONFIG_WATCHDOG_NOWAYOUT=y
567# 606#
568# Ftape, the floppy tape device driver 607# Ftape, the floppy tape device driver
569# 608#
570# CONFIG_DRM is not set
571# CONFIG_RAW_DRIVER is not set 609# CONFIG_RAW_DRIVER is not set
572 610
573# 611#
574# TPM devices 612# TPM devices
575# 613#
576# CONFIG_TCG_TPM is not set
577 614
578# 615#
579# I2C support 616# I2C support
@@ -604,7 +641,9 @@ CONFIG_I2C_CHARDEV=y
604# CONFIG_SENSORS_ADM1025 is not set 641# CONFIG_SENSORS_ADM1025 is not set
605# CONFIG_SENSORS_ADM1026 is not set 642# CONFIG_SENSORS_ADM1026 is not set
606# CONFIG_SENSORS_ADM1031 is not set 643# CONFIG_SENSORS_ADM1031 is not set
644# CONFIG_SENSORS_ADM9240 is not set
607# CONFIG_SENSORS_ASB100 is not set 645# CONFIG_SENSORS_ASB100 is not set
646# CONFIG_SENSORS_ATXP1 is not set
608# CONFIG_SENSORS_DS1621 is not set 647# CONFIG_SENSORS_DS1621 is not set
609# CONFIG_SENSORS_FSCHER is not set 648# CONFIG_SENSORS_FSCHER is not set
610# CONFIG_SENSORS_FSCPOS is not set 649# CONFIG_SENSORS_FSCPOS is not set
@@ -620,6 +659,7 @@ CONFIG_I2C_CHARDEV=y
620# CONFIG_SENSORS_LM85 is not set 659# CONFIG_SENSORS_LM85 is not set
621# CONFIG_SENSORS_LM87 is not set 660# CONFIG_SENSORS_LM87 is not set
622# CONFIG_SENSORS_LM90 is not set 661# CONFIG_SENSORS_LM90 is not set
662# CONFIG_SENSORS_LM92 is not set
623# CONFIG_SENSORS_MAX1619 is not set 663# CONFIG_SENSORS_MAX1619 is not set
624# CONFIG_SENSORS_PC87360 is not set 664# CONFIG_SENSORS_PC87360 is not set
625# CONFIG_SENSORS_SMSC47B397 is not set 665# CONFIG_SENSORS_SMSC47B397 is not set
@@ -627,15 +667,21 @@ CONFIG_I2C_CHARDEV=y
627# CONFIG_SENSORS_W83781D is not set 667# CONFIG_SENSORS_W83781D is not set
628# CONFIG_SENSORS_W83L785TS is not set 668# CONFIG_SENSORS_W83L785TS is not set
629# CONFIG_SENSORS_W83627HF is not set 669# CONFIG_SENSORS_W83627HF is not set
670# CONFIG_SENSORS_W83627EHF is not set
630 671
631# 672#
632# Other I2C Chip support 673# Other I2C Chip support
633# 674#
675# CONFIG_SENSORS_DS1337 is not set
676# CONFIG_SENSORS_DS1374 is not set
634# CONFIG_SENSORS_EEPROM is not set 677# CONFIG_SENSORS_EEPROM is not set
635# CONFIG_SENSORS_PCF8574 is not set 678# CONFIG_SENSORS_PCF8574 is not set
679# CONFIG_SENSORS_PCA9539 is not set
636# CONFIG_SENSORS_PCF8591 is not set 680# CONFIG_SENSORS_PCF8591 is not set
637# CONFIG_SENSORS_RTC8564 is not set 681# CONFIG_SENSORS_RTC8564 is not set
638CONFIG_ISP1301_OMAP=y 682CONFIG_ISP1301_OMAP=y
683CONFIG_TPS65010=y
684# CONFIG_SENSORS_MAX6875 is not set
639# CONFIG_I2C_DEBUG_CORE is not set 685# CONFIG_I2C_DEBUG_CORE is not set
640# CONFIG_I2C_DEBUG_ALGO is not set 686# CONFIG_I2C_DEBUG_ALGO is not set
641# CONFIG_I2C_DEBUG_BUS is not set 687# CONFIG_I2C_DEBUG_BUS is not set
@@ -663,8 +709,10 @@ CONFIG_FB=y
663# CONFIG_FB_CFB_COPYAREA is not set 709# CONFIG_FB_CFB_COPYAREA is not set
664# CONFIG_FB_CFB_IMAGEBLIT is not set 710# CONFIG_FB_CFB_IMAGEBLIT is not set
665# CONFIG_FB_SOFT_CURSOR is not set 711# CONFIG_FB_SOFT_CURSOR is not set
712# CONFIG_FB_MACMODES is not set
666CONFIG_FB_MODE_HELPERS=y 713CONFIG_FB_MODE_HELPERS=y
667# CONFIG_FB_TILEBLITTING is not set 714# CONFIG_FB_TILEBLITTING is not set
715# CONFIG_FB_S1D13XXX is not set
668# CONFIG_FB_VIRTUAL is not set 716# CONFIG_FB_VIRTUAL is not set
669 717
670# 718#
@@ -677,11 +725,13 @@ CONFIG_FONTS=y
677CONFIG_FONT_8x8=y 725CONFIG_FONT_8x8=y
678CONFIG_FONT_8x16=y 726CONFIG_FONT_8x16=y
679# CONFIG_FONT_6x11 is not set 727# CONFIG_FONT_6x11 is not set
728# CONFIG_FONT_7x14 is not set
680# CONFIG_FONT_PEARL_8x8 is not set 729# CONFIG_FONT_PEARL_8x8 is not set
681# CONFIG_FONT_ACORN_8x8 is not set 730# CONFIG_FONT_ACORN_8x8 is not set
682# CONFIG_FONT_MINI_4x6 is not set 731# CONFIG_FONT_MINI_4x6 is not set
683# CONFIG_FONT_SUN8x16 is not set 732# CONFIG_FONT_SUN8x16 is not set
684# CONFIG_FONT_SUN12x22 is not set 733# CONFIG_FONT_SUN12x22 is not set
734# CONFIG_FONT_10x18 is not set
685 735
686# 736#
687# Logo configuration 737# Logo configuration
@@ -729,14 +779,14 @@ CONFIG_USB_ARCH_HAS_OHCI=y
729# 779#
730CONFIG_USB_GADGET=y 780CONFIG_USB_GADGET=y
731# CONFIG_USB_GADGET_DEBUG_FILES is not set 781# CONFIG_USB_GADGET_DEBUG_FILES is not set
782CONFIG_USB_GADGET_SELECTED=y
732# CONFIG_USB_GADGET_NET2280 is not set 783# CONFIG_USB_GADGET_NET2280 is not set
733# CONFIG_USB_GADGET_PXA2XX is not set 784# CONFIG_USB_GADGET_PXA2XX is not set
734# CONFIG_USB_GADGET_GOKU is not set 785# CONFIG_USB_GADGET_GOKU is not set
735# CONFIG_USB_GADGET_SA1100 is not set
736# CONFIG_USB_GADGET_LH7A40X is not set 786# CONFIG_USB_GADGET_LH7A40X is not set
737# CONFIG_USB_GADGET_DUMMY_HCD is not set
738CONFIG_USB_GADGET_OMAP=y 787CONFIG_USB_GADGET_OMAP=y
739CONFIG_USB_OMAP=y 788CONFIG_USB_OMAP=y
789# CONFIG_USB_GADGET_DUMMY_HCD is not set
740# CONFIG_USB_GADGET_DUALSPEED is not set 790# CONFIG_USB_GADGET_DUALSPEED is not set
741# CONFIG_USB_ZERO is not set 791# CONFIG_USB_ZERO is not set
742CONFIG_USB_ETH=y 792CONFIG_USB_ETH=y
@@ -755,6 +805,7 @@ CONFIG_USB_ETH_RNDIS=y
755# 805#
756CONFIG_EXT2_FS=y 806CONFIG_EXT2_FS=y
757# CONFIG_EXT2_FS_XATTR is not set 807# CONFIG_EXT2_FS_XATTR is not set
808# CONFIG_EXT2_FS_XIP is not set
758# CONFIG_EXT3_FS is not set 809# CONFIG_EXT3_FS is not set
759# CONFIG_JBD is not set 810# CONFIG_JBD is not set
760# CONFIG_REISERFS_FS is not set 811# CONFIG_REISERFS_FS is not set
@@ -791,7 +842,6 @@ CONFIG_FAT_DEFAULT_CODEPAGE=437
791# 842#
792CONFIG_PROC_FS=y 843CONFIG_PROC_FS=y
793CONFIG_SYSFS=y 844CONFIG_SYSFS=y
794# CONFIG_DEVFS_FS is not set
795# CONFIG_DEVPTS_FS_XATTR is not set 845# CONFIG_DEVPTS_FS_XATTR is not set
796# CONFIG_TMPFS is not set 846# CONFIG_TMPFS is not set
797# CONFIG_HUGETLB_PAGE is not set 847# CONFIG_HUGETLB_PAGE is not set
@@ -828,12 +878,14 @@ CONFIG_CRAMFS=y
828# 878#
829CONFIG_NFS_FS=y 879CONFIG_NFS_FS=y
830CONFIG_NFS_V3=y 880CONFIG_NFS_V3=y
881# CONFIG_NFS_V3_ACL is not set
831CONFIG_NFS_V4=y 882CONFIG_NFS_V4=y
832# CONFIG_NFS_DIRECTIO is not set 883# CONFIG_NFS_DIRECTIO is not set
833# CONFIG_NFSD is not set 884# CONFIG_NFSD is not set
834CONFIG_ROOT_NFS=y 885CONFIG_ROOT_NFS=y
835CONFIG_LOCKD=y 886CONFIG_LOCKD=y
836CONFIG_LOCKD_V4=y 887CONFIG_LOCKD_V4=y
888CONFIG_NFS_COMMON=y
837CONFIG_SUNRPC=y 889CONFIG_SUNRPC=y
838CONFIG_SUNRPC_GSS=y 890CONFIG_SUNRPC_GSS=y
839CONFIG_RPCSEC_GSS_KRB5=y 891CONFIG_RPCSEC_GSS_KRB5=y
@@ -903,24 +955,11 @@ CONFIG_NLS_DEFAULT="iso8859-1"
903# Kernel hacking 955# Kernel hacking
904# 956#
905# CONFIG_PRINTK_TIME is not set 957# CONFIG_PRINTK_TIME is not set
906CONFIG_DEBUG_KERNEL=y 958# CONFIG_DEBUG_KERNEL is not set
907# CONFIG_MAGIC_SYSRQ is not set
908CONFIG_LOG_BUF_SHIFT=14 959CONFIG_LOG_BUF_SHIFT=14
909# CONFIG_SCHEDSTATS is not set
910# CONFIG_DEBUG_SLAB is not set
911CONFIG_DEBUG_PREEMPT=y
912# CONFIG_DEBUG_SPINLOCK is not set
913# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
914# CONFIG_DEBUG_KOBJECT is not set
915CONFIG_DEBUG_BUGVERBOSE=y 960CONFIG_DEBUG_BUGVERBOSE=y
916CONFIG_DEBUG_INFO=y
917# CONFIG_DEBUG_FS is not set
918CONFIG_FRAME_POINTER=y 961CONFIG_FRAME_POINTER=y
919CONFIG_DEBUG_USER=y 962# CONFIG_DEBUG_USER is not set
920# CONFIG_DEBUG_WAITQ is not set
921CONFIG_DEBUG_ERRORS=y
922CONFIG_DEBUG_LL=y
923# CONFIG_DEBUG_ICEDCC is not set
924 963
925# 964#
926# Security options 965# Security options
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index b713c44c6f..835d450797 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -41,7 +41,10 @@ extern void fp_enter(void);
41 * This has a special calling convention; it doesn't 41 * This has a special calling convention; it doesn't
42 * modify any of the usual registers, except for LR. 42 * modify any of the usual registers, except for LR.
43 */ 43 */
44#define EXPORT_CRC_ALIAS(sym) __CRC_SYMBOL(sym, "")
45
44#define EXPORT_SYMBOL_ALIAS(sym,orig) \ 46#define EXPORT_SYMBOL_ALIAS(sym,orig) \
47 EXPORT_CRC_ALIAS(sym) \
45 const struct kernel_symbol __ksymtab_##sym \ 48 const struct kernel_symbol __ksymtab_##sym \
46 __attribute__((section("__ksymtab"))) = \ 49 __attribute__((section("__ksymtab"))) = \
47 { (unsigned long)&orig, #sym }; 50 { (unsigned long)&orig, #sym };
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 35b7273cfd..c9b69771f9 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -737,8 +737,8 @@ void __init setup_arch(char **cmdline_p)
737 if (mdesc->soft_reboot) 737 if (mdesc->soft_reboot)
738 reboot_setup("s"); 738 reboot_setup("s");
739 739
740 if (mdesc->param_offset) 740 if (mdesc->boot_params)
741 tags = phys_to_virt(mdesc->param_offset); 741 tags = phys_to_virt(mdesc->boot_params);
742 742
743 /* 743 /*
744 * If we have the old style parameters, convert them to 744 * If we have the old style parameters, convert them to
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index a931409c8f..7ae45c3fc8 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -36,7 +36,7 @@
36 * The present bitmask indicates that the CPU is physically present. 36 * The present bitmask indicates that the CPU is physically present.
37 * The online bitmask indicates that the CPU is up and running. 37 * The online bitmask indicates that the CPU is up and running.
38 */ 38 */
39cpumask_t cpu_present_mask; 39cpumask_t cpu_possible_map;
40cpumask_t cpu_online_map; 40cpumask_t cpu_online_map;
41 41
42/* 42/*
@@ -235,7 +235,8 @@ void __init smp_prepare_boot_cpu(void)
235{ 235{
236 unsigned int cpu = smp_processor_id(); 236 unsigned int cpu = smp_processor_id();
237 237
238 cpu_set(cpu, cpu_present_mask); 238 cpu_set(cpu, cpu_possible_map);
239 cpu_set(cpu, cpu_present_map);
239 cpu_set(cpu, cpu_online_map); 240 cpu_set(cpu, cpu_online_map);
240} 241}
241 242
@@ -355,7 +356,7 @@ void show_ipi_list(struct seq_file *p)
355 356
356 seq_puts(p, "IPI:"); 357 seq_puts(p, "IPI:");
357 358
358 for_each_online_cpu(cpu) 359 for_each_present_cpu(cpu)
359 seq_printf(p, " %10lu", per_cpu(ipi_data, cpu).ipi_count); 360 seq_printf(p, " %10lu", per_cpu(ipi_data, cpu).ipi_count);
360 361
361 seq_putc(p, '\n'); 362 seq_putc(p, '\n');
diff --git a/arch/arm/mach-integrator/platsmp.c b/arch/arm/mach-integrator/platsmp.c
index ead15dfcb5..2ba0257770 100644
--- a/arch/arm/mach-integrator/platsmp.c
+++ b/arch/arm/mach-integrator/platsmp.c
@@ -174,11 +174,13 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
174 max_cpus = ncores; 174 max_cpus = ncores;
175 175
176 /* 176 /*
177 * Initialise the present mask - this tells us which CPUs should 177 * Initialise the possible/present maps.
178 * be present. 178 * cpu_possible_map describes the set of CPUs which may be present
179 * cpu_present_map describes the set of CPUs populated
179 */ 180 */
180 for (i = 0; i < max_cpus; i++) { 181 for (i = 0; i < max_cpus; i++) {
181 cpu_set(i, cpu_present_mask); 182 cpu_set(i, cpu_possible_map);
183 cpu_set(i, cpu_present_map);
182 } 184 }
183 185
184 /* 186 /*
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index 4b9d841e04..45b1865849 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -23,7 +23,7 @@
23#include <linux/serial.h> 23#include <linux/serial.h>
24#include <linux/tty.h> 24#include <linux/tty.h>
25#include <linux/bitops.h> 25#include <linux/bitops.h>
26#include <linux/serial_core.h> 26#include <linux/serial_8250.h>
27#include <linux/mm.h> 27#include <linux/mm.h>
28 28
29#include <asm/types.h> 29#include <asm/types.h>
@@ -125,19 +125,6 @@ static struct map_desc ixp2000_io_desc[] __initdata = {
125 } 125 }
126}; 126};
127 127
128static struct uart_port ixp2000_serial_port = {
129 .membase = (char *)(IXP2000_UART_VIRT_BASE + 3),
130 .mapbase = IXP2000_UART_PHYS_BASE + 3,
131 .irq = IRQ_IXP2000_UART,
132 .flags = UPF_SKIP_TEST,
133 .iotype = UPIO_MEM,
134 .regshift = 2,
135 .uartclk = 50000000,
136 .line = 0,
137 .type = PORT_XSCALE,
138 .fifosize = 16
139};
140
141void __init ixp2000_map_io(void) 128void __init ixp2000_map_io(void)
142{ 129{
143 extern unsigned int processor_id; 130 extern unsigned int processor_id;
@@ -157,12 +144,50 @@ void __init ixp2000_map_io(void)
157 } 144 }
158 145
159 iotable_init(ixp2000_io_desc, ARRAY_SIZE(ixp2000_io_desc)); 146 iotable_init(ixp2000_io_desc, ARRAY_SIZE(ixp2000_io_desc));
160 early_serial_setup(&ixp2000_serial_port);
161 147
162 /* Set slowport to 8-bit mode. */ 148 /* Set slowport to 8-bit mode. */
163 ixp2000_reg_write(IXP2000_SLOWPORT_FRM, 1); 149 ixp2000_reg_write(IXP2000_SLOWPORT_FRM, 1);
164} 150}
165 151
152
153/*************************************************************************
154 * Serial port support for IXP2000
155 *************************************************************************/
156static struct plat_serial8250_port ixp2000_serial_port[] = {
157 {
158 .mapbase = IXP2000_UART_PHYS_BASE,
159 .membase = (char *)(IXP2000_UART_VIRT_BASE + 3),
160 .irq = IRQ_IXP2000_UART,
161 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
162 .iotype = UPIO_MEM,
163 .regshift = 2,
164 .uartclk = 50000000,
165 },
166 { },
167};
168
169static struct resource ixp2000_uart_resource = {
170 .start = IXP2000_UART_PHYS_BASE,
171 .end = IXP2000_UART_PHYS_BASE + 0xffff,
172 .flags = IORESOURCE_MEM,
173};
174
175static struct platform_device ixp2000_serial_device = {
176 .name = "serial8250",
177 .id = 0,
178 .dev = {
179 .platform_data = ixp2000_serial_port,
180 },
181 .num_resources = 1,
182 .resource = &ixp2000_uart_resource,
183};
184
185void __init ixp2000_uart_init(void)
186{
187 platform_device_register(&ixp2000_serial_device);
188}
189
190
166/************************************************************************* 191/*************************************************************************
167 * Timer-tick functions for IXP2000 192 * Timer-tick functions for IXP2000
168 *************************************************************************/ 193 *************************************************************************/
diff --git a/arch/arm/mach-ixp2000/enp2611.c b/arch/arm/mach-ixp2000/enp2611.c
index b7ebf3898f..9aa54de447 100644
--- a/arch/arm/mach-ixp2000/enp2611.c
+++ b/arch/arm/mach-ixp2000/enp2611.c
@@ -219,6 +219,7 @@ static struct platform_device *enp2611_devices[] __initdata = {
219static void __init enp2611_init_machine(void) 219static void __init enp2611_init_machine(void)
220{ 220{
221 platform_add_devices(enp2611_devices, ARRAY_SIZE(enp2611_devices)); 221 platform_add_devices(enp2611_devices, ARRAY_SIZE(enp2611_devices));
222 ixp2000_uart_init();
222} 223}
223 224
224 225
diff --git a/arch/arm/mach-ixp2000/ixdp2x00.c b/arch/arm/mach-ixp2000/ixdp2x00.c
index 5e4380747b..a43369ad87 100644
--- a/arch/arm/mach-ixp2000/ixdp2x00.c
+++ b/arch/arm/mach-ixp2000/ixdp2x00.c
@@ -303,5 +303,6 @@ void __init ixdp2x00_init_machine(void)
303 gpio_line_config(IXDP2X00_GPIO_I2C_ENABLE, GPIO_OUT); 303 gpio_line_config(IXDP2X00_GPIO_I2C_ENABLE, GPIO_OUT);
304 304
305 platform_add_devices(ixdp2x00_devices, ARRAY_SIZE(ixdp2x00_devices)); 305 platform_add_devices(ixdp2x00_devices, ARRAY_SIZE(ixdp2x00_devices));
306 ixp2000_uart_init();
306} 307}
307 308
diff --git a/arch/arm/mach-ixp2000/ixdp2x01.c b/arch/arm/mach-ixp2000/ixdp2x01.c
index c73588743e..43447dad16 100644
--- a/arch/arm/mach-ixp2000/ixdp2x01.c
+++ b/arch/arm/mach-ixp2000/ixdp2x01.c
@@ -370,6 +370,7 @@ static void __init ixdp2x01_init_machine(void)
370 ((*IXDP2X01_CPLD_FLASH_REG & IXDP2X01_CPLD_FLASH_BANK_MASK) + 1); 370 ((*IXDP2X01_CPLD_FLASH_REG & IXDP2X01_CPLD_FLASH_BANK_MASK) + 1);
371 371
372 platform_add_devices(ixdp2x01_devices, ARRAY_SIZE(ixdp2x01_devices)); 372 platform_add_devices(ixdp2x01_devices, ARRAY_SIZE(ixdp2x01_devices));
373 ixp2000_uart_init();
373} 374}
374 375
375 376
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index aa92e37088..2b544363c0 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -453,8 +453,8 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys)
453 local_write_config(PCI_COMMAND, 2, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY); 453 local_write_config(PCI_COMMAND, 2, PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY);
454 454
455 res[0].name = "PCI I/O Space"; 455 res[0].name = "PCI I/O Space";
456 res[0].start = 0x00001000; 456 res[0].start = 0x00000000;
457 res[0].end = 0xffff0000; 457 res[0].end = 0x0000ffff;
458 res[0].flags = IORESOURCE_IO; 458 res[0].flags = IORESOURCE_IO;
459 459
460 res[1].name = "PCI Memory Space"; 460 res[1].name = "PCI Memory Space";
diff --git a/arch/arm/mach-ixp4xx/coyote-setup.c b/arch/arm/mach-ixp4xx/coyote-setup.c
index c6335f5190..4ff4393ef0 100644
--- a/arch/arm/mach-ixp4xx/coyote-setup.c
+++ b/arch/arm/mach-ixp4xx/coyote-setup.c
@@ -56,21 +56,24 @@ static struct resource coyote_uart_resource = {
56 .flags = IORESOURCE_MEM, 56 .flags = IORESOURCE_MEM,
57}; 57};
58 58
59static struct plat_serial8250_port coyote_uart_data = { 59static struct plat_serial8250_port coyote_uart_data[] = {
60 .mapbase = IXP4XX_UART2_BASE_PHYS, 60 {
61 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET, 61 .mapbase = IXP4XX_UART2_BASE_PHYS,
62 .irq = IRQ_IXP4XX_UART2, 62 .membase = (char *)IXP4XX_UART2_BASE_VIRT + REG_OFFSET,
63 .flags = UPF_BOOT_AUTOCONF, 63 .irq = IRQ_IXP4XX_UART2,
64 .iotype = UPIO_MEM, 64 .flags = UPF_BOOT_AUTOCONF,
65 .regshift = 2, 65 .iotype = UPIO_MEM,
66 .uartclk = IXP4XX_UART_XTAL, 66 .regshift = 2,
67 .uartclk = IXP4XX_UART_XTAL,
68 },
69 { },
67}; 70};
68 71
69static struct platform_device coyote_uart = { 72static struct platform_device coyote_uart = {
70 .name = "serial8250", 73 .name = "serial8250",
71 .id = 0, 74 .id = 0,
72 .dev = { 75 .dev = {
73 .platform_data = &coyote_uart_data, 76 .platform_data = coyote_uart_data,
74 }, 77 },
75 .num_resources = 1, 78 .num_resources = 1,
76 .resource = &coyote_uart_resource, 79 .resource = &coyote_uart_resource,
@@ -87,10 +90,10 @@ static void __init coyote_init(void)
87 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0; 90 *IXP4XX_EXP_CS1 = *IXP4XX_EXP_CS0;
88 91
89 if (machine_is_ixdpg425()) { 92 if (machine_is_ixdpg425()) {
90 coyote_uart_data.membase = 93 coyote_uart_data[0].membase =
91 (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET); 94 (char*)(IXP4XX_UART1_BASE_VIRT + REG_OFFSET);
92 coyote_uart_data.mapbase = IXP4XX_UART1_BASE_PHYS; 95 coyote_uart_data[0].mapbase = IXP4XX_UART1_BASE_PHYS;
93 coyote_uart_data.irq = IRQ_IXP4XX_UART1; 96 coyote_uart_data[0].irq = IRQ_IXP4XX_UART1;
94 } 97 }
95 98
96 99
diff --git a/arch/arm/mach-ixp4xx/ixdp425-setup.c b/arch/arm/mach-ixp4xx/ixdp425-setup.c
index f2e9c0ea05..c2ba759e99 100644
--- a/arch/arm/mach-ixp4xx/ixdp425-setup.c
+++ b/arch/arm/mach-ixp4xx/ixdp425-setup.c
@@ -95,7 +95,8 @@ static struct plat_serial8250_port ixdp425_uart_data[] = {
95 .iotype = UPIO_MEM, 95 .iotype = UPIO_MEM,
96 .regshift = 2, 96 .regshift = 2,
97 .uartclk = IXP4XX_UART_XTAL, 97 .uartclk = IXP4XX_UART_XTAL,
98 } 98 },
99 { },
99}; 100};
100 101
101static struct platform_device ixdp425_uart = { 102static struct platform_device ixdp425_uart = {
diff --git a/arch/arm/mach-omap/Kconfig b/arch/arm/mach-omap/Kconfig
deleted file mode 100644
index 9e42efa66b..0000000000
--- a/arch/arm/mach-omap/Kconfig
+++ /dev/null
@@ -1,221 +0,0 @@
1if ARCH_OMAP
2
3menu "TI OMAP Implementations"
4
5comment "OMAP Core Type"
6
7config ARCH_OMAP730
8 depends on ARCH_OMAP
9 bool "OMAP730 Based System"
10 select ARCH_OMAP_OTG
11
12config ARCH_OMAP1510
13 depends on ARCH_OMAP
14 default y
15 bool "OMAP1510 Based System"
16
17config ARCH_OMAP16XX
18 depends on ARCH_OMAP
19 bool "OMAP16XX Based System"
20 select ARCH_OMAP_OTG
21
22config ARCH_OMAP_OTG
23 bool
24
25comment "OMAP Board Type"
26
27config MACH_OMAP_INNOVATOR
28 bool "TI Innovator"
29 depends on ARCH_OMAP1510 || ARCH_OMAP16XX
30 help
31 TI OMAP 1510 or 1610 Innovator board support. Say Y here if you
32 have such a board.
33
34config MACH_OMAP_H2
35 bool "TI H2 Support"
36 depends on ARCH_OMAP16XX
37 help
38 TI OMAP 1610/1611B H2 board support. Say Y here if you have such
39 a board.
40
41config MACH_OMAP_H3
42 bool "TI H3 Support"
43 depends on ARCH_OMAP16XX
44 help
45 TI OMAP 1710 H3 board support. Say Y here if you have such
46 a board.
47
48config MACH_OMAP_H4
49 bool "TI H4 Support"
50 depends on ARCH_OMAP16XX
51 help
52 TI OMAP 1610 H4 board support. Say Y here if you have such
53 a board.
54
55config MACH_OMAP_OSK
56 bool "TI OSK Support"
57 depends on ARCH_OMAP16XX
58 help
59 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
60 if you have such a board.
61
62config MACH_OMAP_PERSEUS2
63 bool "TI Perseus2"
64 depends on ARCH_OMAP730
65 help
66 Support for TI OMAP 730 Perseus2 board. Say Y here if you have such
67 a board.
68
69config MACH_VOICEBLUE
70 bool "Voiceblue"
71 depends on ARCH_OMAP1510
72 help
73 Support for Voiceblue GSM/VoIP gateway. Say Y here if you have such
74 board.
75
76config MACH_NETSTAR
77 bool "NetStar"
78 depends on ARCH_OMAP1510
79 help
80 Support for NetStar PBX. Say Y here if you have such a board.
81
82config MACH_OMAP_GENERIC
83 bool "Generic OMAP board"
84 depends on ARCH_OMAP1510 || ARCH_OMAP16XX
85 help
86 Support for generic OMAP-1510, 1610 or 1710 board with
87 no FPGA. Can be used as template for porting Linux to
88 custom OMAP boards. Say Y here if you have a custom
89 board.
90
91comment "OMAP Feature Selections"
92
93#config OMAP_BOOT_TAG
94# bool "OMAP bootloader information passing"
95# depends on ARCH_OMAP
96# default n
97# help
98# Say Y, if you have a bootloader which passes information
99# about your board and its peripheral configuration.
100
101config OMAP_MUX
102 bool "OMAP multiplexing support"
103 depends on ARCH_OMAP
104 default y
105 help
106 Pin multiplexing support for OMAP boards. If your bootloader
107 sets the multiplexing correctly, say N. Otherwise, or if unsure,
108 say Y.
109
110config OMAP_MUX_DEBUG
111 bool "Multiplexing debug output"
112 depends on OMAP_MUX
113 default n
114 help
115 Makes the multiplexing functions print out a lot of debug info.
116 This is useful if you want to find out the correct values of the
117 multiplexing registers.
118
119config OMAP_MUX_WARNINGS
120 bool "Warn about pins the bootloader didn't set up"
121 depends on OMAP_MUX
122 default y
123 help
124 Choose Y here to warn whenever driver initialization logic needs
125 to change the pin multiplexing setup. When there are no warnings
126 printed, it's safe to deselect OMAP_MUX for your product.
127
128choice
129 prompt "System timer"
130 default OMAP_MPU_TIMER
131
132config OMAP_MPU_TIMER
133 bool "Use mpu timer"
134 help
135 Select this option if you want to use the OMAP mpu timer. This
136 timer provides more intra-tick resolution than the 32KHz timer,
137 but consumes more power.
138
139config OMAP_32K_TIMER
140 bool "Use 32KHz timer"
141 depends on ARCH_OMAP16XX
142 help
143 Select this option if you want to enable the OMAP 32KHz timer.
144 This timer saves power compared to the OMAP_MPU_TIMER, and has
145 support for no tick during idle. The 32KHz timer provides less
146 intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is
147 currently only available for OMAP-16xx.
148
149endchoice
150
151config OMAP_32K_TIMER_HZ
152 int "Kernel internal timer frequency for 32KHz timer"
153 range 32 1024
154 depends on OMAP_32K_TIMER
155 default "128"
156 help
157 Kernel internal timer frequency should be a divisor of 32768,
158 such as 64 or 128.
159
160choice
161 prompt "Low-level debug console UART"
162 depends on ARCH_OMAP
163 default OMAP_LL_DEBUG_UART1
164
165config OMAP_LL_DEBUG_UART1
166 bool "UART1"
167
168config OMAP_LL_DEBUG_UART2
169 bool "UART2"
170
171config OMAP_LL_DEBUG_UART3
172 bool "UART3"
173
174endchoice
175
176config OMAP_ARM_195MHZ
177 bool "OMAP ARM 195 MHz CPU"
178 depends on ARCH_OMAP730
179 help
180 Enable 195MHz clock for OMAP CPU. If unsure, say N.
181
182config OMAP_ARM_192MHZ
183 bool "OMAP ARM 192 MHz CPU"
184 depends on ARCH_OMAP16XX
185 help
186 Enable 192MHz clock for OMAP CPU. If unsure, say N.
187
188config OMAP_ARM_182MHZ
189 bool "OMAP ARM 182 MHz CPU"
190 depends on ARCH_OMAP730
191 help
192 Enable 182MHz clock for OMAP CPU. If unsure, say N.
193
194config OMAP_ARM_168MHZ
195 bool "OMAP ARM 168 MHz CPU"
196 depends on ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730
197 help
198 Enable 168MHz clock for OMAP CPU. If unsure, say N.
199
200config OMAP_ARM_120MHZ
201 bool "OMAP ARM 120 MHz CPU"
202 depends on ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730
203 help
204 Enable 120MHz clock for OMAP CPU. If unsure, say N.
205
206config OMAP_ARM_60MHZ
207 bool "OMAP ARM 60 MHz CPU"
208 depends on ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730
209 default y
210 help
211 Enable 60MHz clock for OMAP CPU. If unsure, say Y.
212
213config OMAP_ARM_30MHZ
214 bool "OMAP ARM 30 MHz CPU"
215 depends on ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730
216 help
217 Enable 30MHz clock for OMAP CPU. If unsure, say N.
218
219endmenu
220
221endif
diff --git a/arch/arm/mach-omap/Makefile b/arch/arm/mach-omap/Makefile
deleted file mode 100644
index 4cafb11d2c..0000000000
--- a/arch/arm/mach-omap/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Common support
6obj-y := common.o time.o irq.o dma.o clock.o mux.o gpio.o mcbsp.o usb.o
7obj-m :=
8obj-n :=
9obj- :=
10led-y := leds.o
11
12# Specific board support
13obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o
14obj-$(CONFIG_MACH_OMAP_INNOVATOR) += board-innovator.o
15obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
16obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o
17obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o
18obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o
19obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o
20obj-$(CONFIG_MACH_NETSTAR) += board-netstar.o
21
22# OCPI interconnect support for 1710, 1610 and 5912
23obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
24
25# LEDs support
26led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
27led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o
28led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o
29obj-$(CONFIG_LEDS) += $(led-y)
30
31# Power Management
32obj-$(CONFIG_PM) += pm.o sleep.o
33
34ifeq ($(CONFIG_ARCH_OMAP1510),y)
35# Innovator-1510 FPGA
36obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o
37endif
38
39# kgdb support
40obj-$(CONFIG_KGDB_SERIAL) += kgdb-serial.o
diff --git a/arch/arm/mach-omap/common.c b/arch/arm/mach-omap/common.c
deleted file mode 100644
index 265cde4858..0000000000
--- a/arch/arm/mach-omap/common.c
+++ /dev/null
@@ -1,549 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap/common.c
3 *
4 * Code common to all OMAP machines.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/config.h>
11#include <linux/module.h>
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/pm.h>
16#include <linux/console.h>
17#include <linux/serial.h>
18#include <linux/tty.h>
19#include <linux/serial_8250.h>
20#include <linux/serial_reg.h>
21
22#include <asm/hardware.h>
23#include <asm/system.h>
24#include <asm/pgtable.h>
25#include <asm/mach/map.h>
26#include <asm/hardware/clock.h>
27#include <asm/io.h>
28#include <asm/mach-types.h>
29
30#include <asm/arch/board.h>
31#include <asm/arch/mux.h>
32#include <asm/arch/fpga.h>
33
34#include "clock.h"
35
36#define DEBUG 1
37
38struct omap_id {
39 u16 jtag_id; /* Used to determine OMAP type */
40 u8 die_rev; /* Processor revision */
41 u32 omap_id; /* OMAP revision */
42 u32 type; /* Cpu id bits [31:08], cpu class bits [07:00] */
43};
44
45/* Register values to detect the OMAP version */
46static struct omap_id omap_ids[] __initdata = {
47 { .jtag_id = 0x355f, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x07300100},
48 { .jtag_id = 0xb55f, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x07300300},
49 { .jtag_id = 0xb470, .die_rev = 0x0, .omap_id = 0x03310100, .type = 0x15100000},
50 { .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x16100000},
51 { .jtag_id = 0xb576, .die_rev = 0x2, .omap_id = 0x03320100, .type = 0x16110000},
52 { .jtag_id = 0xb576, .die_rev = 0x3, .omap_id = 0x03320100, .type = 0x16100c00},
53 { .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x03320200, .type = 0x16100d00},
54 { .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 0x1610ef00},
55 { .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 0x1610ef00},
56 { .jtag_id = 0xb576, .die_rev = 0x1, .omap_id = 0x03320100, .type = 0x16110000},
57 { .jtag_id = 0xb58c, .die_rev = 0x2, .omap_id = 0x03320200, .type = 0x16110b00},
58 { .jtag_id = 0xb58c, .die_rev = 0x3, .omap_id = 0x03320200, .type = 0x16110c00},
59 { .jtag_id = 0xb65f, .die_rev = 0x0, .omap_id = 0x03320400, .type = 0x16212300},
60 { .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320400, .type = 0x16212300},
61 { .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320500, .type = 0x16212300},
62 { .jtag_id = 0xb5f7, .die_rev = 0x0, .omap_id = 0x03330000, .type = 0x17100000},
63 { .jtag_id = 0xb5f7, .die_rev = 0x1, .omap_id = 0x03330100, .type = 0x17100000},
64 { .jtag_id = 0xb5f7, .die_rev = 0x2, .omap_id = 0x03330100, .type = 0x17100000},
65};
66
67/*
68 * Get OMAP type from PROD_ID.
69 * 1710 has the PROD_ID in bits 15:00, not in 16:01 as documented in TRM.
70 * 1510 PROD_ID is empty, and 1610 PROD_ID does not make sense.
71 * Undocumented register in TEST BLOCK is used as fallback; This seems to
72 * work on 1510, 1610 & 1710. The official way hopefully will work in future
73 * processors.
74 */
75static u16 __init omap_get_jtag_id(void)
76{
77 u32 prod_id, omap_id;
78
79 prod_id = omap_readl(OMAP_PRODUCTION_ID_1);
80 omap_id = omap_readl(OMAP32_ID_1);
81
82 /* Check for unusable OMAP_PRODUCTION_ID_1 on 1611B/5912 and 730 */
83 if (((prod_id >> 20) == 0) || (prod_id == omap_id))
84 prod_id = 0;
85 else
86 prod_id &= 0xffff;
87
88 if (prod_id)
89 return prod_id;
90
91 /* Use OMAP32_ID_1 as fallback */
92 prod_id = ((omap_id >> 12) & 0xffff);
93
94 return prod_id;
95}
96
97/*
98 * Get OMAP revision from DIE_REV.
99 * Early 1710 processors may have broken OMAP_DIE_ID, it contains PROD_ID.
100 * Undocumented register in the TEST BLOCK is used as fallback.
101 * REVISIT: This does not seem to work on 1510
102 */
103static u8 __init omap_get_die_rev(void)
104{
105 u32 die_rev;
106
107 die_rev = omap_readl(OMAP_DIE_ID_1);
108
109 /* Check for broken OMAP_DIE_ID on early 1710 */
110 if (((die_rev >> 12) & 0xffff) == omap_get_jtag_id())
111 die_rev = 0;
112
113 die_rev = (die_rev >> 17) & 0xf;
114 if (die_rev)
115 return die_rev;
116
117 die_rev = (omap_readl(OMAP32_ID_1) >> 28) & 0xf;
118
119 return die_rev;
120}
121
122static void __init omap_check_revision(void)
123{
124 int i;
125 u16 jtag_id;
126 u8 die_rev;
127 u32 omap_id;
128 u8 cpu_type;
129
130 jtag_id = omap_get_jtag_id();
131 die_rev = omap_get_die_rev();
132 omap_id = omap_readl(OMAP32_ID_0);
133
134#ifdef DEBUG
135 printk("OMAP_DIE_ID_0: 0x%08x\n", omap_readl(OMAP_DIE_ID_0));
136 printk("OMAP_DIE_ID_1: 0x%08x DIE_REV: %i\n",
137 omap_readl(OMAP_DIE_ID_1),
138 (omap_readl(OMAP_DIE_ID_1) >> 17) & 0xf);
139 printk("OMAP_PRODUCTION_ID_0: 0x%08x\n", omap_readl(OMAP_PRODUCTION_ID_0));
140 printk("OMAP_PRODUCTION_ID_1: 0x%08x JTAG_ID: 0x%04x\n",
141 omap_readl(OMAP_PRODUCTION_ID_1),
142 omap_readl(OMAP_PRODUCTION_ID_1) & 0xffff);
143 printk("OMAP32_ID_0: 0x%08x\n", omap_readl(OMAP32_ID_0));
144 printk("OMAP32_ID_1: 0x%08x\n", omap_readl(OMAP32_ID_1));
145 printk("JTAG_ID: 0x%04x DIE_REV: %i\n", jtag_id, die_rev);
146#endif
147
148 system_serial_high = omap_readl(OMAP_DIE_ID_0);
149 system_serial_low = omap_readl(OMAP_DIE_ID_1);
150
151 /* First check only the major version in a safe way */
152 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
153 if (jtag_id == (omap_ids[i].jtag_id)) {
154 system_rev = omap_ids[i].type;
155 break;
156 }
157 }
158
159 /* Check if we can find the die revision */
160 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
161 if (jtag_id == omap_ids[i].jtag_id && die_rev == omap_ids[i].die_rev) {
162 system_rev = omap_ids[i].type;
163 break;
164 }
165 }
166
167 /* Finally check also the omap_id */
168 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
169 if (jtag_id == omap_ids[i].jtag_id
170 && die_rev == omap_ids[i].die_rev
171 && omap_id == omap_ids[i].omap_id) {
172 system_rev = omap_ids[i].type;
173 break;
174 }
175 }
176
177 /* Add the cpu class info (7xx, 15xx, 16xx, 24xx) */
178 cpu_type = system_rev >> 24;
179
180 switch (cpu_type) {
181 case 0x07:
182 system_rev |= 0x07;
183 break;
184 case 0x15:
185 system_rev |= 0x15;
186 break;
187 case 0x16:
188 case 0x17:
189 system_rev |= 0x16;
190 break;
191 case 0x24:
192 system_rev |= 0x24;
193 break;
194 default:
195 printk("Unknown OMAP cpu type: 0x%02x\n", cpu_type);
196 }
197
198 printk("OMAP%04x", system_rev >> 16);
199 if ((system_rev >> 8) & 0xff)
200 printk("%x", (system_rev >> 8) & 0xff);
201 printk(" revision %i handled as %02xxx id: %08x%08x\n",
202 die_rev, system_rev & 0xff, system_serial_low,
203 system_serial_high);
204}
205
206/*
207 * ----------------------------------------------------------------------------
208 * OMAP I/O mapping
209 *
210 * The machine specific code may provide the extra mapping besides the
211 * default mapping provided here.
212 * ----------------------------------------------------------------------------
213 */
214
215static struct map_desc omap_io_desc[] __initdata = {
216 { IO_VIRT, IO_PHYS, IO_SIZE, MT_DEVICE },
217};
218
219#ifdef CONFIG_ARCH_OMAP730
220static struct map_desc omap730_io_desc[] __initdata = {
221 { OMAP730_DSP_BASE, OMAP730_DSP_START, OMAP730_DSP_SIZE, MT_DEVICE },
222 { OMAP730_DSPREG_BASE, OMAP730_DSPREG_START, OMAP730_DSPREG_SIZE, MT_DEVICE },
223 { OMAP730_SRAM_BASE, OMAP730_SRAM_START, OMAP730_SRAM_SIZE, MT_DEVICE }
224};
225#endif
226
227#ifdef CONFIG_ARCH_OMAP1510
228static struct map_desc omap1510_io_desc[] __initdata = {
229 { OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE },
230 { OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE },
231 { OMAP1510_SRAM_BASE, OMAP1510_SRAM_START, OMAP1510_SRAM_SIZE, MT_DEVICE }
232};
233#endif
234
235#if defined(CONFIG_ARCH_OMAP16XX)
236static struct map_desc omap1610_io_desc[] __initdata = {
237 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
238 { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
239 { OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP1610_SRAM_SIZE, MT_DEVICE }
240};
241
242static struct map_desc omap5912_io_desc[] __initdata = {
243 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
244 { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
245/*
246 * The OMAP5912 has 250kByte internal SRAM. Because the mapping is baseed on page
247 * size (4kByte), it seems that the last 2kByte (=0x800) of the 250kByte are not mapped.
248 * Add additional 2kByte (0x800) so that the last page is mapped and the last 2kByte
249 * can be used.
250 */
251 { OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP5912_SRAM_SIZE + 0x800, MT_DEVICE }
252};
253#endif
254
255static int initialized = 0;
256
257static void __init _omap_map_io(void)
258{
259 initialized = 1;
260
261 /* We have to initialize the IO space mapping before we can run
262 * cpu_is_omapxxx() macros. */
263 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
264 omap_check_revision();
265
266#ifdef CONFIG_ARCH_OMAP730
267 if (cpu_is_omap730()) {
268 iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
269 }
270#endif
271#ifdef CONFIG_ARCH_OMAP1510
272 if (cpu_is_omap1510()) {
273 iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
274 }
275#endif
276#if defined(CONFIG_ARCH_OMAP16XX)
277 if (cpu_is_omap1610() || cpu_is_omap1710()) {
278 iotable_init(omap1610_io_desc, ARRAY_SIZE(omap1610_io_desc));
279 }
280 if (cpu_is_omap5912()) {
281 iotable_init(omap5912_io_desc, ARRAY_SIZE(omap5912_io_desc));
282 }
283#endif
284
285 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
286 * on a Posted Write in the TIPB Bridge".
287 */
288 omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
289 omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
290
291 /* Must init clocks early to assure that timer interrupt works
292 */
293 clk_init();
294}
295
296/*
297 * This should only get called from board specific init
298 */
299void omap_map_io(void)
300{
301 if (!initialized)
302 _omap_map_io();
303}
304
305static inline unsigned int omap_serial_in(struct plat_serial8250_port *up,
306 int offset)
307{
308 offset <<= up->regshift;
309 return (unsigned int)__raw_readb(up->membase + offset);
310}
311
312static inline void omap_serial_outp(struct plat_serial8250_port *p, int offset,
313 int value)
314{
315 offset <<= p->regshift;
316 __raw_writeb(value, p->membase + offset);
317}
318
319/*
320 * Internal UARTs need to be initialized for the 8250 autoconfig to work
321 * properly. Note that the TX watermark initialization may not be needed
322 * once the 8250.c watermark handling code is merged.
323 */
324static void __init omap_serial_reset(struct plat_serial8250_port *p)
325{
326 omap_serial_outp(p, UART_OMAP_MDR1, 0x07); /* disable UART */
327 omap_serial_outp(p, UART_OMAP_SCR, 0x08); /* TX watermark */
328 omap_serial_outp(p, UART_OMAP_MDR1, 0x00); /* enable UART */
329
330 if (!cpu_is_omap1510()) {
331 omap_serial_outp(p, UART_OMAP_SYSC, 0x01);
332 while (!(omap_serial_in(p, UART_OMAP_SYSC) & 0x01));
333 }
334}
335
336static struct plat_serial8250_port serial_platform_data[] = {
337 {
338 .membase = (char*)IO_ADDRESS(OMAP_UART1_BASE),
339 .mapbase = (unsigned long)OMAP_UART1_BASE,
340 .irq = INT_UART1,
341 .flags = UPF_BOOT_AUTOCONF,
342 .iotype = UPIO_MEM,
343 .regshift = 2,
344 .uartclk = OMAP16XX_BASE_BAUD * 16,
345 },
346 {
347 .membase = (char*)IO_ADDRESS(OMAP_UART2_BASE),
348 .mapbase = (unsigned long)OMAP_UART2_BASE,
349 .irq = INT_UART2,
350 .flags = UPF_BOOT_AUTOCONF,
351 .iotype = UPIO_MEM,
352 .regshift = 2,
353 .uartclk = OMAP16XX_BASE_BAUD * 16,
354 },
355 {
356 .membase = (char*)IO_ADDRESS(OMAP_UART3_BASE),
357 .mapbase = (unsigned long)OMAP_UART3_BASE,
358 .irq = INT_UART3,
359 .flags = UPF_BOOT_AUTOCONF,
360 .iotype = UPIO_MEM,
361 .regshift = 2,
362 .uartclk = OMAP16XX_BASE_BAUD * 16,
363 },
364 { },
365};
366
367static struct platform_device serial_device = {
368 .name = "serial8250",
369 .id = 0,
370 .dev = {
371 .platform_data = serial_platform_data,
372 },
373};
374
375/*
376 * Note that on Innovator-1510 UART2 pins conflict with USB2.
377 * By default UART2 does not work on Innovator-1510 if you have
378 * USB OHCI enabled. To use UART2, you must disable USB2 first.
379 */
380void __init omap_serial_init(int ports[OMAP_MAX_NR_PORTS])
381{
382 int i;
383
384 if (cpu_is_omap730()) {
385 serial_platform_data[0].regshift = 0;
386 serial_platform_data[1].regshift = 0;
387 serial_platform_data[0].irq = INT_730_UART_MODEM_1;
388 serial_platform_data[1].irq = INT_730_UART_MODEM_IRDA_2;
389 }
390
391 if (cpu_is_omap1510()) {
392 serial_platform_data[0].uartclk = OMAP1510_BASE_BAUD * 16;
393 serial_platform_data[1].uartclk = OMAP1510_BASE_BAUD * 16;
394 serial_platform_data[2].uartclk = OMAP1510_BASE_BAUD * 16;
395 }
396
397 for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
398 unsigned char reg;
399
400 if (ports[i] == 0) {
401 serial_platform_data[i].membase = 0;
402 serial_platform_data[i].mapbase = 0;
403 continue;
404 }
405
406 switch (i) {
407 case 0:
408 if (cpu_is_omap1510()) {
409 omap_cfg_reg(UART1_TX);
410 omap_cfg_reg(UART1_RTS);
411 if (machine_is_omap_innovator()) {
412 reg = fpga_read(OMAP1510_FPGA_POWER);
413 reg |= OMAP1510_FPGA_PCR_COM1_EN;
414 fpga_write(reg, OMAP1510_FPGA_POWER);
415 udelay(10);
416 }
417 }
418 break;
419 case 1:
420 if (cpu_is_omap1510()) {
421 omap_cfg_reg(UART2_TX);
422 omap_cfg_reg(UART2_RTS);
423 if (machine_is_omap_innovator()) {
424 reg = fpga_read(OMAP1510_FPGA_POWER);
425 reg |= OMAP1510_FPGA_PCR_COM2_EN;
426 fpga_write(reg, OMAP1510_FPGA_POWER);
427 udelay(10);
428 }
429 }
430 break;
431 case 2:
432 if (cpu_is_omap1510()) {
433 omap_cfg_reg(UART3_TX);
434 omap_cfg_reg(UART3_RX);
435 }
436 if (cpu_is_omap1710()) {
437 clk_enable(clk_get(0, "uart3_ck"));
438 }
439 break;
440 }
441 omap_serial_reset(&serial_platform_data[i]);
442 }
443}
444
445static int __init omap_init(void)
446{
447 return platform_device_register(&serial_device);
448}
449arch_initcall(omap_init);
450
451#define NO_LENGTH_CHECK 0xffffffff
452
453extern int omap_bootloader_tag_len;
454extern u8 omap_bootloader_tag[];
455
456struct omap_board_config_kernel *omap_board_config;
457int omap_board_config_size = 0;
458
459static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out)
460{
461 struct omap_board_config_kernel *kinfo = NULL;
462 int i;
463
464#ifdef CONFIG_OMAP_BOOT_TAG
465 struct omap_board_config_entry *info = NULL;
466
467 if (omap_bootloader_tag_len > 4)
468 info = (struct omap_board_config_entry *) omap_bootloader_tag;
469 while (info != NULL) {
470 u8 *next;
471
472 if (info->tag == tag) {
473 if (skip == 0)
474 break;
475 skip--;
476 }
477
478 if ((info->len & 0x03) != 0) {
479 /* We bail out to avoid an alignment fault */
480 printk(KERN_ERR "OMAP peripheral config: Length (%d) not word-aligned (tag %04x)\n",
481 info->len, info->tag);
482 return NULL;
483 }
484 next = (u8 *) info + sizeof(*info) + info->len;
485 if (next >= omap_bootloader_tag + omap_bootloader_tag_len)
486 info = NULL;
487 else
488 info = (struct omap_board_config_entry *) next;
489 }
490 if (info != NULL) {
491 /* Check the length as a lame attempt to check for
492 * binary inconsistancy. */
493 if (len != NO_LENGTH_CHECK) {
494 /* Word-align len */
495 if (len & 0x03)
496 len = (len + 3) & ~0x03;
497 if (info->len != len) {
498 printk(KERN_ERR "OMAP peripheral config: Length mismatch with tag %x (want %d, got %d)\n",
499 tag, len, info->len);
500 return NULL;
501 }
502 }
503 if (len_out != NULL)
504 *len_out = info->len;
505 return info->data;
506 }
507#endif
508 /* Try to find the config from the board-specific structures
509 * in the kernel. */
510 for (i = 0; i < omap_board_config_size; i++) {
511 if (omap_board_config[i].tag == tag) {
512 kinfo = &omap_board_config[i];
513 break;
514 }
515 }
516 if (kinfo == NULL)
517 return NULL;
518 return kinfo->data;
519}
520
521const void *__omap_get_config(u16 tag, size_t len, int nr)
522{
523 return get_config(tag, len, nr, NULL);
524}
525EXPORT_SYMBOL(__omap_get_config);
526
527const void *omap_get_var_config(u16 tag, size_t *len)
528{
529 return get_config(tag, NO_LENGTH_CHECK, 0, len);
530}
531EXPORT_SYMBOL(omap_get_var_config);
532
533static int __init omap_add_serial_console(void)
534{
535 const struct omap_uart_config *info;
536
537 info = omap_get_config(OMAP_TAG_UART, struct omap_uart_config);
538 if (info != NULL && info->console_uart) {
539 static char speed[11], *opt = NULL;
540
541 if (info->console_speed) {
542 snprintf(speed, sizeof(speed), "%u", info->console_speed);
543 opt = speed;
544 }
545 return add_preferred_console("ttyS", info->console_uart - 1, opt);
546 }
547 return 0;
548}
549console_initcall(omap_add_serial_console);
diff --git a/arch/arm/mach-omap/common.h b/arch/arm/mach-omap/common.h
deleted file mode 100644
index 9f62858c0d..0000000000
--- a/arch/arm/mach-omap/common.h
+++ /dev/null
@@ -1,36 +0,0 @@
1/*
2 * linux/arch/arm/mach-omap/common.h
3 *
4 * Header for code common to all OMAP machines.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 *
11 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
12 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
14 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
15 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
16 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
18 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
19 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
20 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
21 *
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 675 Mass Ave, Cambridge, MA 02139, USA.
25 */
26
27#ifndef __ARCH_ARM_MACH_OMAP_COMMON_H
28#define __ARCH_ARM_MACH_OMAP_COMMON_H
29
30struct sys_timer;
31
32extern void omap_map_io(void);
33extern struct sys_timer omap_timer;
34extern void omap_serial_init(int ports[]);
35
36#endif /* __ARCH_ARM_MACH_OMAP_COMMON_H */
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
new file mode 100644
index 0000000000..7408ac94f7
--- /dev/null
+++ b/arch/arm/mach-omap1/Kconfig
@@ -0,0 +1,144 @@
1comment "OMAP Core Type"
2 depends on ARCH_OMAP1
3
4config ARCH_OMAP730
5 depends on ARCH_OMAP1
6 bool "OMAP730 Based System"
7 select ARCH_OMAP_OTG
8
9config ARCH_OMAP1510
10 depends on ARCH_OMAP1
11 default y
12 bool "OMAP1510 Based System"
13
14config ARCH_OMAP16XX
15 depends on ARCH_OMAP1
16 bool "OMAP16xx Based System"
17 select ARCH_OMAP_OTG
18
19comment "OMAP Board Type"
20 depends on ARCH_OMAP1
21
22config MACH_OMAP_INNOVATOR
23 bool "TI Innovator"
24 depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX)
25 help
26 TI OMAP 1510 or 1610 Innovator board support. Say Y here if you
27 have such a board.
28
29config MACH_OMAP_H2
30 bool "TI H2 Support"
31 depends on ARCH_OMAP1 && ARCH_OMAP16XX
32 help
33 TI OMAP 1610/1611B H2 board support. Say Y here if you have such
34 a board.
35
36config MACH_OMAP_H3
37 bool "TI H3 Support"
38 depends on ARCH_OMAP1 && ARCH_OMAP16XX
39 help
40 TI OMAP 1710 H3 board support. Say Y here if you have such
41 a board.
42
43config MACH_OMAP_OSK
44 bool "TI OSK Support"
45 depends on ARCH_OMAP1 && ARCH_OMAP16XX
46 help
47 TI OMAP 5912 OSK (OMAP Starter Kit) board support. Say Y here
48 if you have such a board.
49
50config MACH_OMAP_PERSEUS2
51 bool "TI Perseus2"
52 depends on ARCH_OMAP1 && ARCH_OMAP730
53 help
54 Support for TI OMAP 730 Perseus2 board. Say Y here if you have such
55 a board.
56
57config MACH_VOICEBLUE
58 bool "Voiceblue"
59 depends on ARCH_OMAP1 && ARCH_OMAP1510
60 help
61 Support for Voiceblue GSM/VoIP gateway. Say Y here if you have
62 such a board.
63
64config MACH_NETSTAR
65 bool "NetStar"
66 depends on ARCH_OMAP1 && ARCH_OMAP1510
67 help
68 Support for NetStar PBX. Say Y here if you have such a board.
69
70config MACH_OMAP_GENERIC
71 bool "Generic OMAP board"
72 depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX)
73 help
74 Support for generic OMAP-1510, 1610 or 1710 board with
75 no FPGA. Can be used as template for porting Linux to
76 custom OMAP boards. Say Y here if you have a custom
77 board.
78
79comment "OMAP CPU Speed"
80 depends on ARCH_OMAP1
81
82config OMAP_CLOCKS_SET_BY_BOOTLOADER
83 bool "OMAP clocks set by bootloader"
84 depends on ARCH_OMAP1
85 help
86 Enable this option to prevent the kernel from overriding the clock
87 frequencies programmed by bootloader for MPU, DSP, MMUs, TC,
88 internal LCD controller and MPU peripherals.
89
90config OMAP_ARM_216MHZ
91 bool "OMAP ARM 216 MHz CPU (1710 only)"
92 depends on ARCH_OMAP1 && ARCH_OMAP16XX
93 help
94 Enable 216 MHz clock for OMAP1710 CPU. If unsure, say N.
95
96config OMAP_ARM_195MHZ
97 bool "OMAP ARM 195 MHz CPU"
98 depends on ARCH_OMAP1 && ARCH_OMAP730
99 help
100 Enable 195MHz clock for OMAP CPU. If unsure, say N.
101
102config OMAP_ARM_192MHZ
103 bool "OMAP ARM 192 MHz CPU"
104 depends on ARCH_OMAP1 && ARCH_OMAP16XX
105 help
106 Enable 192MHz clock for OMAP CPU. If unsure, say N.
107
108config OMAP_ARM_182MHZ
109 bool "OMAP ARM 182 MHz CPU"
110 depends on ARCH_OMAP1 && ARCH_OMAP730
111 help
112 Enable 182MHz clock for OMAP CPU. If unsure, say N.
113
114config OMAP_ARM_168MHZ
115 bool "OMAP ARM 168 MHz CPU"
116 depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730)
117 help
118 Enable 168MHz clock for OMAP CPU. If unsure, say N.
119
120config OMAP_ARM_150MHZ
121 bool "OMAP ARM 150 MHz CPU"
122 depends on ARCH_OMAP1 && ARCH_OMAP1510
123 help
124 Enable 150MHz clock for OMAP CPU. If unsure, say N.
125
126config OMAP_ARM_120MHZ
127 bool "OMAP ARM 120 MHz CPU"
128 depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730)
129 help
130 Enable 120MHz clock for OMAP CPU. If unsure, say N.
131
132config OMAP_ARM_60MHZ
133 bool "OMAP ARM 60 MHz CPU"
134 depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730)
135 default y
136 help
137 Enable 60MHz clock for OMAP CPU. If unsure, say Y.
138
139config OMAP_ARM_30MHZ
140 bool "OMAP ARM 30 MHz CPU"
141 depends on ARCH_OMAP1 && (ARCH_OMAP1510 || ARCH_OMAP16XX || ARCH_OMAP730)
142 help
143 Enable 30MHz clock for OMAP CPU. If unsure, say N.
144
diff --git a/arch/arm/mach-omap1/Makefile b/arch/arm/mach-omap1/Makefile
new file mode 100644
index 0000000000..d386fd913f
--- /dev/null
+++ b/arch/arm/mach-omap1/Makefile
@@ -0,0 +1,30 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Common support
6obj-y := io.o id.o irq.o time.o serial.o
7led-y := leds.o
8
9# Specific board support
10obj-$(CONFIG_MACH_OMAP_H2) += board-h2.o
11obj-$(CONFIG_MACH_OMAP_INNOVATOR) += board-innovator.o
12obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o
13obj-$(CONFIG_MACH_OMAP_PERSEUS2) += board-perseus2.o
14obj-$(CONFIG_MACH_OMAP_OSK) += board-osk.o
15obj-$(CONFIG_MACH_OMAP_H3) += board-h3.o
16obj-$(CONFIG_MACH_VOICEBLUE) += board-voiceblue.o
17obj-$(CONFIG_MACH_NETSTAR) += board-netstar.o
18
19ifeq ($(CONFIG_ARCH_OMAP1510),y)
20# Innovator-1510 FPGA
21obj-$(CONFIG_MACH_OMAP_INNOVATOR) += fpga.o
22endif
23
24# LEDs support
25led-$(CONFIG_MACH_OMAP_H2) += leds-h2p2-debug.o
26led-$(CONFIG_MACH_OMAP_INNOVATOR) += leds-innovator.o
27led-$(CONFIG_MACH_OMAP_PERSEUS2) += leds-h2p2-debug.o
28led-$(CONFIG_MACH_OMAP_OSK) += leds-osk.o
29obj-$(CONFIG_LEDS) += $(led-y)
30
diff --git a/arch/arm/mach-omap/Makefile.boot b/arch/arm/mach-omap1/Makefile.boot
index fee1a6a15b..292d56c5a8 100644
--- a/arch/arm/mach-omap/Makefile.boot
+++ b/arch/arm/mach-omap1/Makefile.boot
@@ -1,4 +1,3 @@
1 zreladdr-y := 0x10008000 1 zreladdr-y := 0x10008000
2params_phys-y := 0x10000100 2params_phys-y := 0x10000100
3initrd_phys-y := 0x10800000 3initrd_phys-y := 0x10800000
4
diff --git a/arch/arm/mach-omap/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 384bc7cec1..122796ebe8 100644
--- a/arch/arm/mach-omap/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/board-generic.c 2 * linux/arch/arm/mach-omap1/board-generic.c
3 * 3 *
4 * Modified from board-innovator1510.c 4 * Modified from board-innovator1510.c
5 * 5 *
@@ -26,8 +26,7 @@
26#include <asm/arch/mux.h> 26#include <asm/arch/mux.h>
27#include <asm/arch/usb.h> 27#include <asm/arch/usb.h>
28#include <asm/arch/board.h> 28#include <asm/arch/board.h>
29 29#include <asm/arch/common.h>
30#include "common.h"
31 30
32static int __initdata generic_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1}; 31static int __initdata generic_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
33 32
@@ -84,7 +83,7 @@ static void __init omap_generic_init(void)
84 83
85static void __init omap_generic_map_io(void) 84static void __init omap_generic_map_io(void)
86{ 85{
87 omap_map_io(); 86 omap_map_common_io()
88} 87}
89 88
90MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710") 89MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
diff --git a/arch/arm/mach-omap/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index f37c76a9b1..f4983ee95a 100644
--- a/arch/arm/mach-omap/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/board-h2.c 2 * linux/arch/arm/mach-omap1/board-h2.c
3 * 3 *
4 * Board specific inits for OMAP-1610 H2 4 * Board specific inits for OMAP-1610 H2
5 * 5 *
@@ -35,8 +35,7 @@
35#include <asm/arch/gpio.h> 35#include <asm/arch/gpio.h>
36#include <asm/arch/tc.h> 36#include <asm/arch/tc.h>
37#include <asm/arch/usb.h> 37#include <asm/arch/usb.h>
38 38#include <asm/arch/common.h>
39#include "common.h"
40 39
41extern int omap_gpio_init(void); 40extern int omap_gpio_init(void);
42 41
@@ -172,7 +171,7 @@ static void __init h2_init(void)
172 171
173static void __init h2_map_io(void) 172static void __init h2_map_io(void)
174{ 173{
175 omap_map_io(); 174 omap_map_common_io();
176 omap_serial_init(h2_serial_ports); 175 omap_serial_init(h2_serial_ports);
177} 176}
178 177
diff --git a/arch/arm/mach-omap/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 705e48594e..7cd419d61b 100644
--- a/arch/arm/mach-omap/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/board-h3.c 2 * linux/arch/arm/mach-omap1/board-h3.c
3 * 3 *
4 * This file contains OMAP1710 H3 specific code. 4 * This file contains OMAP1710 H3 specific code.
5 * 5 *
@@ -37,8 +37,7 @@
37#include <asm/arch/mux.h> 37#include <asm/arch/mux.h>
38#include <asm/arch/tc.h> 38#include <asm/arch/tc.h>
39#include <asm/arch/usb.h> 39#include <asm/arch/usb.h>
40 40#include <asm/arch/common.h>
41#include "common.h"
42 41
43extern int omap_gpio_init(void); 42extern int omap_gpio_init(void);
44 43
@@ -190,7 +189,7 @@ void h3_init_irq(void)
190 189
191static void __init h3_map_io(void) 190static void __init h3_map_io(void)
192{ 191{
193 omap_map_io(); 192 omap_map_common_io();
194 omap_serial_init(h3_serial_ports); 193 omap_serial_init(h3_serial_ports);
195} 194}
196 195
diff --git a/arch/arm/mach-omap/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 523363f18c..91de60a91e 100644
--- a/arch/arm/mach-omap/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/board-innovator.c 2 * linux/arch/arm/mach-omap1/board-innovator.c
3 * 3 *
4 * Board specific inits for OMAP-1510 and OMAP-1610 Innovator 4 * Board specific inits for OMAP-1510 and OMAP-1610 Innovator
5 * 5 *
@@ -33,8 +33,7 @@
33#include <asm/arch/gpio.h> 33#include <asm/arch/gpio.h>
34#include <asm/arch/tc.h> 34#include <asm/arch/tc.h>
35#include <asm/arch/usb.h> 35#include <asm/arch/usb.h>
36 36#include <asm/arch/common.h>
37#include "common.h"
38 37
39static int __initdata innovator_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1}; 38static int __initdata innovator_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
40 39
@@ -252,7 +251,7 @@ static void __init innovator_init(void)
252 251
253static void __init innovator_map_io(void) 252static void __init innovator_map_io(void)
254{ 253{
255 omap_map_io(); 254 omap_map_common_io();
256 255
257#ifdef CONFIG_ARCH_OMAP1510 256#ifdef CONFIG_ARCH_OMAP1510
258 if (cpu_is_omap1510()) { 257 if (cpu_is_omap1510()) {
diff --git a/arch/arm/mach-omap/board-netstar.c b/arch/arm/mach-omap1/board-netstar.c
index 8c653734d5..6750b20140 100644
--- a/arch/arm/mach-omap/board-netstar.c
+++ b/arch/arm/mach-omap1/board-netstar.c
@@ -26,8 +26,7 @@
26#include <asm/arch/gpio.h> 26#include <asm/arch/gpio.h>
27#include <asm/arch/mux.h> 27#include <asm/arch/mux.h>
28#include <asm/arch/usb.h> 28#include <asm/arch/usb.h>
29 29#include <asm/arch/common.h>
30#include "common.h"
31 30
32extern void __init omap_init_time(void); 31extern void __init omap_init_time(void);
33extern int omap_gpio_init(void); 32extern int omap_gpio_init(void);
@@ -100,7 +99,7 @@ static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
100 99
101static void __init netstar_map_io(void) 100static void __init netstar_map_io(void)
102{ 101{
103 omap_map_io(); 102 omap_map_common_io();
104 omap_serial_init(omap_serial_ports); 103 omap_serial_init(omap_serial_ports);
105} 104}
106 105
diff --git a/arch/arm/mach-omap/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index cb433436aa..6844e536c6 100644
--- a/arch/arm/mach-omap/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/board-osk.c 2 * linux/arch/arm/mach-omap1/board-osk.c
3 * 3 *
4 * Board specific init for OMAP5912 OSK 4 * Board specific init for OMAP5912 OSK
5 * 5 *
@@ -39,8 +39,7 @@
39#include <asm/arch/usb.h> 39#include <asm/arch/usb.h>
40#include <asm/arch/mux.h> 40#include <asm/arch/mux.h>
41#include <asm/arch/tc.h> 41#include <asm/arch/tc.h>
42 42#include <asm/arch/common.h>
43#include "common.h"
44 43
45static struct map_desc osk5912_io_desc[] __initdata = { 44static struct map_desc osk5912_io_desc[] __initdata = {
46{ OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE, 45{ OMAP_OSK_NOR_FLASH_BASE, OMAP_OSK_NOR_FLASH_START, OMAP_OSK_NOR_FLASH_SIZE,
@@ -153,7 +152,7 @@ static void __init osk_init(void)
153 152
154static void __init osk_map_io(void) 153static void __init osk_map_io(void)
155{ 154{
156 omap_map_io(); 155 omap_map_common_io();
157 iotable_init(osk5912_io_desc, ARRAY_SIZE(osk5912_io_desc)); 156 iotable_init(osk5912_io_desc, ARRAY_SIZE(osk5912_io_desc));
158 omap_serial_init(osk_serial_ports); 157 omap_serial_init(osk_serial_ports);
159} 158}
diff --git a/arch/arm/mach-omap/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index d5342043d4..213317392d 100644
--- a/arch/arm/mach-omap/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/board-perseus2.c 2 * linux/arch/arm/mach-omap1/board-perseus2.c
3 * 3 *
4 * Modified from board-generic.c 4 * Modified from board-generic.c
5 * 5 *
@@ -27,8 +27,7 @@
27#include <asm/arch/gpio.h> 27#include <asm/arch/gpio.h>
28#include <asm/arch/mux.h> 28#include <asm/arch/mux.h>
29#include <asm/arch/fpga.h> 29#include <asm/arch/fpga.h>
30 30#include <asm/arch/common.h>
31#include "common.h"
32 31
33static struct resource smc91x_resources[] = { 32static struct resource smc91x_resources[] = {
34 [0] = { 33 [0] = {
@@ -140,7 +139,7 @@ static struct map_desc omap_perseus2_io_desc[] __initdata = {
140 139
141static void __init omap_perseus2_map_io(void) 140static void __init omap_perseus2_map_io(void)
142{ 141{
143 omap_map_io(); 142 omap_map_common_io();
144 iotable_init(omap_perseus2_io_desc, 143 iotable_init(omap_perseus2_io_desc,
145 ARRAY_SIZE(omap_perseus2_io_desc)); 144 ARRAY_SIZE(omap_perseus2_io_desc));
146 145
diff --git a/arch/arm/mach-omap/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 6b0c5003d7..e422819889 100644
--- a/arch/arm/mach-omap/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/board-voiceblue.c 2 * linux/arch/arm/mach-omap1/board-voiceblue.c
3 * 3 *
4 * Modified from board-generic.c 4 * Modified from board-generic.c
5 * 5 *
@@ -31,8 +31,7 @@
31#include <asm/arch/tc.h> 31#include <asm/arch/tc.h>
32#include <asm/arch/mux.h> 32#include <asm/arch/mux.h>
33#include <asm/arch/usb.h> 33#include <asm/arch/usb.h>
34 34#include <asm/arch/common.h>
35#include "common.h"
36 35
37extern void omap_init_time(void); 36extern void omap_init_time(void);
38extern int omap_gpio_init(void); 37extern int omap_gpio_init(void);
@@ -170,7 +169,7 @@ static int __initdata omap_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
170 169
171static void __init voiceblue_map_io(void) 170static void __init voiceblue_map_io(void)
172{ 171{
173 omap_map_io(); 172 omap_map_common_io();
174 omap_serial_init(omap_serial_ports); 173 omap_serial_init(omap_serial_ports);
175} 174}
176 175
diff --git a/arch/arm/mach-omap/fpga.c b/arch/arm/mach-omap1/fpga.c
index 7c08f6c2e1..7c08f6c2e1 100644
--- a/arch/arm/mach-omap/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
diff --git a/arch/arm/mach-omap1/id.c b/arch/arm/mach-omap1/id.c
new file mode 100644
index 0000000000..986c3b7e09
--- /dev/null
+++ b/arch/arm/mach-omap1/id.c
@@ -0,0 +1,188 @@
1/*
2 * linux/arch/arm/mach-omap1/id.c
3 *
4 * OMAP1 CPU identification code
5 *
6 * Copyright (C) 2004 Nokia Corporation
7 * Written by Tony Lindgren <tony@atomide.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/config.h>
15#include <linux/module.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18
19#include <asm/io.h>
20
21struct omap_id {
22 u16 jtag_id; /* Used to determine OMAP type */
23 u8 die_rev; /* Processor revision */
24 u32 omap_id; /* OMAP revision */
25 u32 type; /* Cpu id bits [31:08], cpu class bits [07:00] */
26};
27
28/* Register values to detect the OMAP version */
29static struct omap_id omap_ids[] __initdata = {
30 { .jtag_id = 0x355f, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x07300100},
31 { .jtag_id = 0xb55f, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x07300300},
32 { .jtag_id = 0xb470, .die_rev = 0x0, .omap_id = 0x03310100, .type = 0x15100000},
33 { .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x03320000, .type = 0x16100000},
34 { .jtag_id = 0xb576, .die_rev = 0x2, .omap_id = 0x03320100, .type = 0x16110000},
35 { .jtag_id = 0xb576, .die_rev = 0x3, .omap_id = 0x03320100, .type = 0x16100c00},
36 { .jtag_id = 0xb576, .die_rev = 0x0, .omap_id = 0x03320200, .type = 0x16100d00},
37 { .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 0x1610ef00},
38 { .jtag_id = 0xb613, .die_rev = 0x0, .omap_id = 0x03320300, .type = 0x1610ef00},
39 { .jtag_id = 0xb576, .die_rev = 0x1, .omap_id = 0x03320100, .type = 0x16110000},
40 { .jtag_id = 0xb58c, .die_rev = 0x2, .omap_id = 0x03320200, .type = 0x16110b00},
41 { .jtag_id = 0xb58c, .die_rev = 0x3, .omap_id = 0x03320200, .type = 0x16110c00},
42 { .jtag_id = 0xb65f, .die_rev = 0x0, .omap_id = 0x03320400, .type = 0x16212300},
43 { .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320400, .type = 0x16212300},
44 { .jtag_id = 0xb65f, .die_rev = 0x1, .omap_id = 0x03320500, .type = 0x16212300},
45 { .jtag_id = 0xb5f7, .die_rev = 0x0, .omap_id = 0x03330000, .type = 0x17100000},
46 { .jtag_id = 0xb5f7, .die_rev = 0x1, .omap_id = 0x03330100, .type = 0x17100000},
47 { .jtag_id = 0xb5f7, .die_rev = 0x2, .omap_id = 0x03330100, .type = 0x17100000},
48};
49
50/*
51 * Get OMAP type from PROD_ID.
52 * 1710 has the PROD_ID in bits 15:00, not in 16:01 as documented in TRM.
53 * 1510 PROD_ID is empty, and 1610 PROD_ID does not make sense.
54 * Undocumented register in TEST BLOCK is used as fallback; This seems to
55 * work on 1510, 1610 & 1710. The official way hopefully will work in future
56 * processors.
57 */
58static u16 __init omap_get_jtag_id(void)
59{
60 u32 prod_id, omap_id;
61
62 prod_id = omap_readl(OMAP_PRODUCTION_ID_1);
63 omap_id = omap_readl(OMAP32_ID_1);
64
65 /* Check for unusable OMAP_PRODUCTION_ID_1 on 1611B/5912 and 730 */
66 if (((prod_id >> 20) == 0) || (prod_id == omap_id))
67 prod_id = 0;
68 else
69 prod_id &= 0xffff;
70
71 if (prod_id)
72 return prod_id;
73
74 /* Use OMAP32_ID_1 as fallback */
75 prod_id = ((omap_id >> 12) & 0xffff);
76
77 return prod_id;
78}
79
80/*
81 * Get OMAP revision from DIE_REV.
82 * Early 1710 processors may have broken OMAP_DIE_ID, it contains PROD_ID.
83 * Undocumented register in the TEST BLOCK is used as fallback.
84 * REVISIT: This does not seem to work on 1510
85 */
86static u8 __init omap_get_die_rev(void)
87{
88 u32 die_rev;
89
90 die_rev = omap_readl(OMAP_DIE_ID_1);
91
92 /* Check for broken OMAP_DIE_ID on early 1710 */
93 if (((die_rev >> 12) & 0xffff) == omap_get_jtag_id())
94 die_rev = 0;
95
96 die_rev = (die_rev >> 17) & 0xf;
97 if (die_rev)
98 return die_rev;
99
100 die_rev = (omap_readl(OMAP32_ID_1) >> 28) & 0xf;
101
102 return die_rev;
103}
104
105void __init omap_check_revision(void)
106{
107 int i;
108 u16 jtag_id;
109 u8 die_rev;
110 u32 omap_id;
111 u8 cpu_type;
112
113 jtag_id = omap_get_jtag_id();
114 die_rev = omap_get_die_rev();
115 omap_id = omap_readl(OMAP32_ID_0);
116
117#ifdef DEBUG
118 printk("OMAP_DIE_ID_0: 0x%08x\n", omap_readl(OMAP_DIE_ID_0));
119 printk("OMAP_DIE_ID_1: 0x%08x DIE_REV: %i\n",
120 omap_readl(OMAP_DIE_ID_1),
121 (omap_readl(OMAP_DIE_ID_1) >> 17) & 0xf);
122 printk("OMAP_PRODUCTION_ID_0: 0x%08x\n", omap_readl(OMAP_PRODUCTION_ID_0));
123 printk("OMAP_PRODUCTION_ID_1: 0x%08x JTAG_ID: 0x%04x\n",
124 omap_readl(OMAP_PRODUCTION_ID_1),
125 omap_readl(OMAP_PRODUCTION_ID_1) & 0xffff);
126 printk("OMAP32_ID_0: 0x%08x\n", omap_readl(OMAP32_ID_0));
127 printk("OMAP32_ID_1: 0x%08x\n", omap_readl(OMAP32_ID_1));
128 printk("JTAG_ID: 0x%04x DIE_REV: %i\n", jtag_id, die_rev);
129#endif
130
131 system_serial_high = omap_readl(OMAP_DIE_ID_0);
132 system_serial_low = omap_readl(OMAP_DIE_ID_1);
133
134 /* First check only the major version in a safe way */
135 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
136 if (jtag_id == (omap_ids[i].jtag_id)) {
137 system_rev = omap_ids[i].type;
138 break;
139 }
140 }
141
142 /* Check if we can find the die revision */
143 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
144 if (jtag_id == omap_ids[i].jtag_id && die_rev == omap_ids[i].die_rev) {
145 system_rev = omap_ids[i].type;
146 break;
147 }
148 }
149
150 /* Finally check also the omap_id */
151 for (i = 0; i < ARRAY_SIZE(omap_ids); i++) {
152 if (jtag_id == omap_ids[i].jtag_id
153 && die_rev == omap_ids[i].die_rev
154 && omap_id == omap_ids[i].omap_id) {
155 system_rev = omap_ids[i].type;
156 break;
157 }
158 }
159
160 /* Add the cpu class info (7xx, 15xx, 16xx, 24xx) */
161 cpu_type = system_rev >> 24;
162
163 switch (cpu_type) {
164 case 0x07:
165 system_rev |= 0x07;
166 break;
167 case 0x15:
168 system_rev |= 0x15;
169 break;
170 case 0x16:
171 case 0x17:
172 system_rev |= 0x16;
173 break;
174 case 0x24:
175 system_rev |= 0x24;
176 break;
177 default:
178 printk("Unknown OMAP cpu type: 0x%02x\n", cpu_type);
179 }
180
181 printk("OMAP%04x", system_rev >> 16);
182 if ((system_rev >> 8) & 0xff)
183 printk("%x", (system_rev >> 8) & 0xff);
184 printk(" revision %i handled as %02xxx id: %08x%08x\n",
185 die_rev, system_rev & 0xff, system_serial_low,
186 system_serial_high);
187}
188
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
new file mode 100644
index 0000000000..207df0fe93
--- /dev/null
+++ b/arch/arm/mach-omap1/io.c
@@ -0,0 +1,115 @@
1/*
2 * linux/arch/arm/mach-omap1/io.c
3 *
4 * OMAP1 I/O mapping code
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/config.h>
12#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15
16#include <asm/mach/map.h>
17#include <asm/io.h>
18#include <asm/arch/tc.h>
19
20extern int clk_init(void);
21extern void omap_check_revision(void);
22
23/*
24 * The machine specific code may provide the extra mapping besides the
25 * default mapping provided here.
26 */
27static struct map_desc omap_io_desc[] __initdata = {
28 { IO_VIRT, IO_PHYS, IO_SIZE, MT_DEVICE },
29};
30
31#ifdef CONFIG_ARCH_OMAP730
32static struct map_desc omap730_io_desc[] __initdata = {
33 { OMAP730_DSP_BASE, OMAP730_DSP_START, OMAP730_DSP_SIZE, MT_DEVICE },
34 { OMAP730_DSPREG_BASE, OMAP730_DSPREG_START, OMAP730_DSPREG_SIZE, MT_DEVICE },
35 { OMAP730_SRAM_BASE, OMAP730_SRAM_START, OMAP730_SRAM_SIZE, MT_DEVICE }
36};
37#endif
38
39#ifdef CONFIG_ARCH_OMAP1510
40static struct map_desc omap1510_io_desc[] __initdata = {
41 { OMAP1510_DSP_BASE, OMAP1510_DSP_START, OMAP1510_DSP_SIZE, MT_DEVICE },
42 { OMAP1510_DSPREG_BASE, OMAP1510_DSPREG_START, OMAP1510_DSPREG_SIZE, MT_DEVICE },
43 { OMAP1510_SRAM_BASE, OMAP1510_SRAM_START, OMAP1510_SRAM_SIZE, MT_DEVICE }
44};
45#endif
46
47#if defined(CONFIG_ARCH_OMAP16XX)
48static struct map_desc omap1610_io_desc[] __initdata = {
49 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
50 { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
51 { OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP1610_SRAM_SIZE, MT_DEVICE }
52};
53
54static struct map_desc omap5912_io_desc[] __initdata = {
55 { OMAP16XX_DSP_BASE, OMAP16XX_DSP_START, OMAP16XX_DSP_SIZE, MT_DEVICE },
56 { OMAP16XX_DSPREG_BASE, OMAP16XX_DSPREG_START, OMAP16XX_DSPREG_SIZE, MT_DEVICE },
57/*
58 * The OMAP5912 has 250kByte internal SRAM. Because the mapping is baseed on page
59 * size (4kByte), it seems that the last 2kByte (=0x800) of the 250kByte are not mapped.
60 * Add additional 2kByte (0x800) so that the last page is mapped and the last 2kByte
61 * can be used.
62 */
63 { OMAP16XX_SRAM_BASE, OMAP16XX_SRAM_START, OMAP5912_SRAM_SIZE + 0x800, MT_DEVICE }
64};
65#endif
66
67static int initialized = 0;
68
69static void __init _omap_map_io(void)
70{
71 initialized = 1;
72
73 /* We have to initialize the IO space mapping before we can run
74 * cpu_is_omapxxx() macros. */
75 iotable_init(omap_io_desc, ARRAY_SIZE(omap_io_desc));
76 omap_check_revision();
77
78#ifdef CONFIG_ARCH_OMAP730
79 if (cpu_is_omap730()) {
80 iotable_init(omap730_io_desc, ARRAY_SIZE(omap730_io_desc));
81 }
82#endif
83#ifdef CONFIG_ARCH_OMAP1510
84 if (cpu_is_omap1510()) {
85 iotable_init(omap1510_io_desc, ARRAY_SIZE(omap1510_io_desc));
86 }
87#endif
88#if defined(CONFIG_ARCH_OMAP16XX)
89 if (cpu_is_omap1610() || cpu_is_omap1710()) {
90 iotable_init(omap1610_io_desc, ARRAY_SIZE(omap1610_io_desc));
91 }
92 if (cpu_is_omap5912()) {
93 iotable_init(omap5912_io_desc, ARRAY_SIZE(omap5912_io_desc));
94 }
95#endif
96
97 /* REVISIT: Refer to OMAP5910 Errata, Advisory SYS_1: "Timeout Abort
98 * on a Posted Write in the TIPB Bridge".
99 */
100 omap_writew(0x0, MPU_PUBLIC_TIPB_CNTL);
101 omap_writew(0x0, MPU_PRIVATE_TIPB_CNTL);
102
103 /* Must init clocks early to assure that timer interrupt works
104 */
105 clk_init();
106}
107
108/*
109 * This should only get called from board specific init
110 */
111void omap_map_common_io(void)
112{
113 if (!initialized)
114 _omap_map_io();
115}
diff --git a/arch/arm/mach-omap/irq.c b/arch/arm/mach-omap1/irq.c
index f01c99266a..a11b6d8073 100644
--- a/arch/arm/mach-omap/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -56,6 +56,7 @@
56struct omap_irq_bank { 56struct omap_irq_bank {
57 unsigned long base_reg; 57 unsigned long base_reg;
58 unsigned long trigger_map; 58 unsigned long trigger_map;
59 unsigned long wake_enable;
59}; 60};
60 61
61static unsigned int irq_bank_count = 0; 62static unsigned int irq_bank_count = 0;
@@ -105,6 +106,19 @@ static void omap_mask_ack_irq(unsigned int irq)
105 omap_ack_irq(irq); 106 omap_ack_irq(irq);
106} 107}
107 108
109static int omap_wake_irq(unsigned int irq, unsigned int enable)
110{
111 int bank = IRQ_BANK(irq);
112
113 if (enable)
114 irq_banks[bank].wake_enable |= IRQ_BIT(irq);
115 else
116 irq_banks[bank].wake_enable &= ~IRQ_BIT(irq);
117
118 return 0;
119}
120
121
108/* 122/*
109 * Allows tuning the IRQ type and priority 123 * Allows tuning the IRQ type and priority
110 * 124 *
@@ -145,7 +159,7 @@ static struct omap_irq_bank omap1510_irq_banks[] = {
145static struct omap_irq_bank omap1610_irq_banks[] = { 159static struct omap_irq_bank omap1610_irq_banks[] = {
146 { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3fefe8f }, 160 { .base_reg = OMAP_IH1_BASE, .trigger_map = 0xb3fefe8f },
147 { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb7c1fd }, 161 { .base_reg = OMAP_IH2_BASE, .trigger_map = 0xfdb7c1fd },
148 { .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0xfffff7ff }, 162 { .base_reg = OMAP_IH2_BASE + 0x100, .trigger_map = 0xffffb7ff },
149 { .base_reg = OMAP_IH2_BASE + 0x200, .trigger_map = 0xffffffff }, 163 { .base_reg = OMAP_IH2_BASE + 0x200, .trigger_map = 0xffffffff },
150}; 164};
151#endif 165#endif
@@ -154,6 +168,7 @@ static struct irqchip omap_irq_chip = {
154 .ack = omap_mask_ack_irq, 168 .ack = omap_mask_ack_irq,
155 .mask = omap_mask_irq, 169 .mask = omap_mask_irq,
156 .unmask = omap_unmask_irq, 170 .unmask = omap_unmask_irq,
171 .wake = omap_wake_irq,
157}; 172};
158 173
159void __init omap_init_irq(void) 174void __init omap_init_irq(void)
diff --git a/arch/arm/mach-omap/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c
index 6e98290cca..ec0d8285f2 100644
--- a/arch/arm/mach-omap/leds-h2p2-debug.c
+++ b/arch/arm/mach-omap1/leds-h2p2-debug.c
@@ -13,7 +13,6 @@
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/version.h>
17 16
18#include <asm/io.h> 17#include <asm/io.h>
19#include <asm/hardware.h> 18#include <asm/hardware.h>
diff --git a/arch/arm/mach-omap/leds-innovator.c b/arch/arm/mach-omap1/leds-innovator.c
index 8043b7d0f6..8043b7d0f6 100644
--- a/arch/arm/mach-omap/leds-innovator.c
+++ b/arch/arm/mach-omap1/leds-innovator.c
diff --git a/arch/arm/mach-omap/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c
index f5177f4307..4a0e8b9d4f 100644
--- a/arch/arm/mach-omap/leds-osk.c
+++ b/arch/arm/mach-omap1/leds-osk.c
@@ -129,14 +129,11 @@ void osk_leds_event(led_event_t evt)
129 129
130#ifdef CONFIG_FB_OMAP 130#ifdef CONFIG_FB_OMAP
131 131
132#ifdef CONFIG_LEDS_TIMER
133 case led_timer: 132 case led_timer:
134 hw_led_state ^= TIMER_LED; 133 hw_led_state ^= TIMER_LED;
135 mistral_setled(); 134 mistral_setled();
136 break; 135 break;
137#endif
138 136
139#ifdef CONFIG_LEDS_CPU
140 case led_idle_start: 137 case led_idle_start:
141 hw_led_state |= IDLE_LED; 138 hw_led_state |= IDLE_LED;
142 mistral_setled(); 139 mistral_setled();
@@ -146,7 +143,6 @@ void osk_leds_event(led_event_t evt)
146 hw_led_state &= ~IDLE_LED; 143 hw_led_state &= ~IDLE_LED;
147 mistral_setled(); 144 mistral_setled();
148 break; 145 break;
149#endif
150 146
151#endif /* CONFIG_FB_OMAP */ 147#endif /* CONFIG_FB_OMAP */
152 148
diff --git a/arch/arm/mach-omap/leds.c b/arch/arm/mach-omap1/leds.c
index 8ab21fe98e..8ab21fe98e 100644
--- a/arch/arm/mach-omap/leds.c
+++ b/arch/arm/mach-omap1/leds.c
diff --git a/arch/arm/mach-omap/leds.h b/arch/arm/mach-omap1/leds.h
index a1e9fedc37..a1e9fedc37 100644
--- a/arch/arm/mach-omap/leds.h
+++ b/arch/arm/mach-omap1/leds.h
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
new file mode 100644
index 0000000000..214e5d17c8
--- /dev/null
+++ b/arch/arm/mach-omap1/serial.c
@@ -0,0 +1,200 @@
1/*
2 * linux/arch/arm/mach-omap1/id.c
3 *
4 * OMAP1 CPU identification code
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#include <linux/config.h>
12#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/delay.h>
16#include <linux/serial.h>
17#include <linux/tty.h>
18#include <linux/serial_8250.h>
19#include <linux/serial_reg.h>
20
21#include <asm/io.h>
22#include <asm/mach-types.h>
23#include <asm/hardware/clock.h>
24
25#include <asm/arch/board.h>
26#include <asm/arch/mux.h>
27#include <asm/arch/fpga.h>
28
29static struct clk * uart1_ck = NULL;
30static struct clk * uart2_ck = NULL;
31static struct clk * uart3_ck = NULL;
32
33static inline unsigned int omap_serial_in(struct plat_serial8250_port *up,
34 int offset)
35{
36 offset <<= up->regshift;
37 return (unsigned int)__raw_readb(up->membase + offset);
38}
39
40static inline void omap_serial_outp(struct plat_serial8250_port *p, int offset,
41 int value)
42{
43 offset <<= p->regshift;
44 __raw_writeb(value, p->membase + offset);
45}
46
47/*
48 * Internal UARTs need to be initialized for the 8250 autoconfig to work
49 * properly. Note that the TX watermark initialization may not be needed
50 * once the 8250.c watermark handling code is merged.
51 */
52static void __init omap_serial_reset(struct plat_serial8250_port *p)
53{
54 omap_serial_outp(p, UART_OMAP_MDR1, 0x07); /* disable UART */
55 omap_serial_outp(p, UART_OMAP_SCR, 0x08); /* TX watermark */
56 omap_serial_outp(p, UART_OMAP_MDR1, 0x00); /* enable UART */
57
58 if (!cpu_is_omap1510()) {
59 omap_serial_outp(p, UART_OMAP_SYSC, 0x01);
60 while (!(omap_serial_in(p, UART_OMAP_SYSC) & 0x01));
61 }
62}
63
64static struct plat_serial8250_port serial_platform_data[] = {
65 {
66 .membase = (char*)IO_ADDRESS(OMAP_UART1_BASE),
67 .mapbase = (unsigned long)OMAP_UART1_BASE,
68 .irq = INT_UART1,
69 .flags = UPF_BOOT_AUTOCONF,
70 .iotype = UPIO_MEM,
71 .regshift = 2,
72 .uartclk = OMAP16XX_BASE_BAUD * 16,
73 },
74 {
75 .membase = (char*)IO_ADDRESS(OMAP_UART2_BASE),
76 .mapbase = (unsigned long)OMAP_UART2_BASE,
77 .irq = INT_UART2,
78 .flags = UPF_BOOT_AUTOCONF,
79 .iotype = UPIO_MEM,
80 .regshift = 2,
81 .uartclk = OMAP16XX_BASE_BAUD * 16,
82 },
83 {
84 .membase = (char*)IO_ADDRESS(OMAP_UART3_BASE),
85 .mapbase = (unsigned long)OMAP_UART3_BASE,
86 .irq = INT_UART3,
87 .flags = UPF_BOOT_AUTOCONF,
88 .iotype = UPIO_MEM,
89 .regshift = 2,
90 .uartclk = OMAP16XX_BASE_BAUD * 16,
91 },
92 { },
93};
94
95static struct platform_device serial_device = {
96 .name = "serial8250",
97 .id = 0,
98 .dev = {
99 .platform_data = serial_platform_data,
100 },
101};
102
103/*
104 * Note that on Innovator-1510 UART2 pins conflict with USB2.
105 * By default UART2 does not work on Innovator-1510 if you have
106 * USB OHCI enabled. To use UART2, you must disable USB2 first.
107 */
108void __init omap_serial_init(int ports[OMAP_MAX_NR_PORTS])
109{
110 int i;
111
112 if (cpu_is_omap730()) {
113 serial_platform_data[0].regshift = 0;
114 serial_platform_data[1].regshift = 0;
115 serial_platform_data[0].irq = INT_730_UART_MODEM_1;
116 serial_platform_data[1].irq = INT_730_UART_MODEM_IRDA_2;
117 }
118
119 if (cpu_is_omap1510()) {
120 serial_platform_data[0].uartclk = OMAP1510_BASE_BAUD * 16;
121 serial_platform_data[1].uartclk = OMAP1510_BASE_BAUD * 16;
122 serial_platform_data[2].uartclk = OMAP1510_BASE_BAUD * 16;
123 }
124
125 for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
126 unsigned char reg;
127
128 if (ports[i] == 0) {
129 serial_platform_data[i].membase = NULL;
130 serial_platform_data[i].mapbase = 0;
131 continue;
132 }
133
134 switch (i) {
135 case 0:
136 uart1_ck = clk_get(NULL, "uart1_ck");
137 if (IS_ERR(uart1_ck))
138 printk("Could not get uart1_ck\n");
139 else {
140 clk_use(uart1_ck);
141 if (cpu_is_omap1510())
142 clk_set_rate(uart1_ck, 12000000);
143 }
144 if (cpu_is_omap1510()) {
145 omap_cfg_reg(UART1_TX);
146 omap_cfg_reg(UART1_RTS);
147 if (machine_is_omap_innovator()) {
148 reg = fpga_read(OMAP1510_FPGA_POWER);
149 reg |= OMAP1510_FPGA_PCR_COM1_EN;
150 fpga_write(reg, OMAP1510_FPGA_POWER);
151 udelay(10);
152 }
153 }
154 break;
155 case 1:
156 uart2_ck = clk_get(NULL, "uart2_ck");
157 if (IS_ERR(uart2_ck))
158 printk("Could not get uart2_ck\n");
159 else {
160 clk_use(uart2_ck);
161 if (cpu_is_omap1510())
162 clk_set_rate(uart2_ck, 12000000);
163 else
164 clk_set_rate(uart2_ck, 48000000);
165 }
166 if (cpu_is_omap1510()) {
167 omap_cfg_reg(UART2_TX);
168 omap_cfg_reg(UART2_RTS);
169 if (machine_is_omap_innovator()) {
170 reg = fpga_read(OMAP1510_FPGA_POWER);
171 reg |= OMAP1510_FPGA_PCR_COM2_EN;
172 fpga_write(reg, OMAP1510_FPGA_POWER);
173 udelay(10);
174 }
175 }
176 break;
177 case 2:
178 uart3_ck = clk_get(NULL, "uart3_ck");
179 if (IS_ERR(uart3_ck))
180 printk("Could not get uart3_ck\n");
181 else {
182 clk_use(uart3_ck);
183 if (cpu_is_omap1510())
184 clk_set_rate(uart3_ck, 12000000);
185 }
186 if (cpu_is_omap1510()) {
187 omap_cfg_reg(UART3_TX);
188 omap_cfg_reg(UART3_RX);
189 }
190 break;
191 }
192 omap_serial_reset(&serial_platform_data[i]);
193 }
194}
195
196static int __init omap_init(void)
197{
198 return platform_device_register(&serial_device);
199}
200arch_initcall(omap_init);
diff --git a/arch/arm/mach-omap/time.c b/arch/arm/mach-omap1/time.c
index dd34e9f4c4..d540539c9b 100644
--- a/arch/arm/mach-omap/time.c
+++ b/arch/arm/mach-omap1/time.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/time.c 2 * linux/arch/arm/mach-omap1/time.c
3 * 3 *
4 * OMAP Timers 4 * OMAP Timers
5 * 5 *
@@ -58,17 +58,9 @@ struct sys_timer omap_timer;
58 * MPU timer 58 * MPU timer
59 * --------------------------------------------------------------------------- 59 * ---------------------------------------------------------------------------
60 */ 60 */
61#define OMAP_MPU_TIMER1_BASE (0xfffec500)
62#define OMAP_MPU_TIMER2_BASE (0xfffec600)
63#define OMAP_MPU_TIMER3_BASE (0xfffec700)
64#define OMAP_MPU_TIMER_BASE OMAP_MPU_TIMER1_BASE 61#define OMAP_MPU_TIMER_BASE OMAP_MPU_TIMER1_BASE
65#define OMAP_MPU_TIMER_OFFSET 0x100 62#define OMAP_MPU_TIMER_OFFSET 0x100
66 63
67#define MPU_TIMER_FREE (1 << 6)
68#define MPU_TIMER_CLOCK_ENABLE (1 << 5)
69#define MPU_TIMER_AR (1 << 1)
70#define MPU_TIMER_ST (1 << 0)
71
72/* cycles to nsec conversions taken from arch/i386/kernel/timers/timer_tsc.c, 64/* cycles to nsec conversions taken from arch/i386/kernel/timers/timer_tsc.c,
73 * converted to use kHz by Kevin Hilman */ 65 * converted to use kHz by Kevin Hilman */
74/* convert from cycles(64bits) => nanoseconds (64bits) 66/* convert from cycles(64bits) => nanoseconds (64bits)
@@ -255,6 +247,13 @@ unsigned long long sched_clock(void)
255#define OMAP_32K_TIMER_TCR 0x04 247#define OMAP_32K_TIMER_TCR 0x04
256 248
257#define OMAP_32K_TICKS_PER_HZ (32768 / HZ) 249#define OMAP_32K_TICKS_PER_HZ (32768 / HZ)
250#if (32768 % HZ) != 0
251/* We cannot ignore modulo.
252 * Potential error can be as high as several percent.
253 */
254#define OMAP_32K_TICK_MODULO (32768 % HZ)
255static unsigned modulo_count = 0; /* Counts 1/HZ units */
256#endif
258 257
259/* 258/*
260 * TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1 259 * TRM says 1 / HZ = ( TVR + 1) / 32768, so TRV = (32768 / HZ) - 1
@@ -331,6 +330,19 @@ static irqreturn_t omap_32k_timer_interrupt(int irq, void *dev_id,
331 now = omap_32k_sync_timer_read(); 330 now = omap_32k_sync_timer_read();
332 331
333 while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) { 332 while (now - omap_32k_last_tick >= OMAP_32K_TICKS_PER_HZ) {
333#ifdef OMAP_32K_TICK_MODULO
334 /* Modulo addition may put omap_32k_last_tick ahead of now
335 * and cause unwanted repetition of the while loop.
336 */
337 if (unlikely(now - omap_32k_last_tick == ~0))
338 break;
339
340 modulo_count += OMAP_32K_TICK_MODULO;
341 if (modulo_count > HZ) {
342 ++omap_32k_last_tick;
343 modulo_count -= HZ;
344 }
345#endif
334 omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ; 346 omap_32k_last_tick += OMAP_32K_TICKS_PER_HZ;
335 timer_tick(regs); 347 timer_tick(regs);
336 } 348 }
@@ -407,7 +419,7 @@ static __init void omap_init_32k_timer(void)
407 * Timer initialization 419 * Timer initialization
408 * --------------------------------------------------------------------------- 420 * ---------------------------------------------------------------------------
409 */ 421 */
410void __init omap_timer_init(void) 422static void __init omap_timer_init(void)
411{ 423{
412#if defined(CONFIG_OMAP_MPU_TIMER) 424#if defined(CONFIG_OMAP_MPU_TIMER)
413 omap_init_mpu_timer(); 425 omap_init_mpu_timer();
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 276431bf1c..86b862f56e 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -289,7 +289,7 @@ static void __init corgi_map_io(void)
289MACHINE_START(CORGI, "SHARP Corgi") 289MACHINE_START(CORGI, "SHARP Corgi")
290 .phys_ram = 0xa0000000, 290 .phys_ram = 0xa0000000,
291 .phys_io = 0x40000000, 291 .phys_io = 0x40000000,
292 .io_pg_offst = ((io_p2v(0x40000000) >> 18) & 0xfffc,) 292 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
293 .fixup = fixup_corgi, 293 .fixup = fixup_corgi,
294 .map_io = corgi_map_io, 294 .map_io = corgi_map_io,
295 .init_irq = corgi_init_irq, 295 .init_irq = corgi_init_irq,
@@ -302,7 +302,7 @@ MACHINE_END
302MACHINE_START(SHEPHERD, "SHARP Shepherd") 302MACHINE_START(SHEPHERD, "SHARP Shepherd")
303 .phys_ram = 0xa0000000, 303 .phys_ram = 0xa0000000,
304 .phys_io = 0x40000000, 304 .phys_io = 0x40000000,
305 .io_pg_offst = ((io_p2v(0x40000000) >> 18) & 0xfffc,) 305 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
306 .fixup = fixup_corgi, 306 .fixup = fixup_corgi,
307 .map_io = corgi_map_io, 307 .map_io = corgi_map_io,
308 .init_irq = corgi_init_irq, 308 .init_irq = corgi_init_irq,
@@ -315,7 +315,7 @@ MACHINE_END
315MACHINE_START(HUSKY, "SHARP Husky") 315MACHINE_START(HUSKY, "SHARP Husky")
316 .phys_ram = 0xa0000000, 316 .phys_ram = 0xa0000000,
317 .phys_io = 0x40000000, 317 .phys_io = 0x40000000,
318 .io_pg_offst = ((io_p2v(0x40000000) >> 18) & 0xfffc,) 318 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
319 .fixup = fixup_corgi, 319 .fixup = fixup_corgi,
320 .map_io = corgi_map_io, 320 .map_io = corgi_map_io,
321 .init_irq = corgi_init_irq, 321 .init_irq = corgi_init_irq,
diff --git a/arch/arm/mach-pxa/idp.c b/arch/arm/mach-pxa/idp.c
index f82f5aad56..386e107b53 100644
--- a/arch/arm/mach-pxa/idp.c
+++ b/arch/arm/mach-pxa/idp.c
@@ -184,7 +184,7 @@ MACHINE_START(PXA_IDP, "Vibren PXA255 IDP")
184 /* Maintainer: Vibren Technologies */ 184 /* Maintainer: Vibren Technologies */
185 .phys_ram = 0xa0000000, 185 .phys_ram = 0xa0000000,
186 .phys_io = 0x40000000, 186 .phys_io = 0x40000000,
187 .io_pg_offst = ((io_p2v(0x40000000) >> 18) & 0xfffc,) 187 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
188 .map_io = idp_map_io, 188 .map_io = idp_map_io,
189 .init_irq = idp_init_irq, 189 .init_irq = idp_init_irq,
190 .timer = &pxa_timer, 190 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index e30b7c6227..6309853b59 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -271,7 +271,7 @@ MACHINE_START(LUBBOCK, "Intel DBPXA250 Development Platform (aka Lubbock)")
271 /* Maintainer: MontaVista Software Inc. */ 271 /* Maintainer: MontaVista Software Inc. */
272 .phys_ram = 0xa0000000, 272 .phys_ram = 0xa0000000,
273 .phys_io = 0x40000000, 273 .phys_io = 0x40000000,
274 .io_pg_offst = ((io_p2v(0x40000000) >> 18) & 0xfffc,) 274 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
275 .map_io = lubbock_map_io, 275 .map_io = lubbock_map_io,
276 .init_irq = lubbock_init_irq, 276 .init_irq = lubbock_init_irq,
277 .timer = &pxa_timer, 277 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index 5d2f76b6df..827b7b5a5b 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -348,7 +348,7 @@ MACHINE_START(MAINSTONE, "Intel HCDDBBVA0 Development Platform (aka Mainstone)")
348 /* Maintainer: MontaVista Software Inc. */ 348 /* Maintainer: MontaVista Software Inc. */
349 .phys_ram = 0xa0000000, 349 .phys_ram = 0xa0000000,
350 .phys_io = 0x40000000, 350 .phys_io = 0x40000000,
351 .io_pg_offst = ((io_p2v(0x40000000) >> 18) & 0xfffc,) 351 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
352 .map_io = mainstone_map_io, 352 .map_io = mainstone_map_io,
353 .init_irq = mainstone_init_irq, 353 .init_irq = mainstone_init_irq,
354 .timer = &pxa_timer, 354 .timer = &pxa_timer,
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index ebae969e88..0e4f6fab10 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -182,7 +182,7 @@ static void __init poodle_map_io(void)
182MACHINE_START(POODLE, "SHARP Poodle") 182MACHINE_START(POODLE, "SHARP Poodle")
183 .phys_ram = 0xa0000000, 183 .phys_ram = 0xa0000000,
184 .phys_io = 0x40000000, 184 .phys_io = 0x40000000,
185 .io_pg_offst = ((io_p2v(0x40000000) >> 18) & 0xfffc,) 185 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
186 .fixup = fixup_poodle, 186 .fixup = fixup_poodle,
187 .map_io = poodle_map_io, 187 .map_io = poodle_map_io,
188 .init_irq = pxa_init_irq, 188 .init_irq = pxa_init_irq,
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 95606b4a3b..afbbeb6f46 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -101,7 +101,7 @@ config CPU_ARM922T
101 101
102# ARM925T 102# ARM925T
103config CPU_ARM925T 103config CPU_ARM925T
104 bool "Support ARM925T processor" if ARCH_OMAP 104 bool "Support ARM925T processor" if ARCH_OMAP1
105 depends on ARCH_OMAP1510 105 depends on ARCH_OMAP1510
106 default y if ARCH_OMAP1510 106 default y if ARCH_OMAP1510
107 select CPU_32v4 107 select CPU_32v4
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
index c3bd503b43..b19f00e99a 100644
--- a/arch/arm/mm/mm-armv.c
+++ b/arch/arm/mm/mm-armv.c
@@ -399,7 +399,7 @@ static void __init build_mem_type_table(void)
399 ecc_mask = 0; 399 ecc_mask = 0;
400 } 400 }
401 401
402 if (cpu_arch <= CPU_ARCH_ARMv5) { 402 if (cpu_arch <= CPU_ARCH_ARMv5TEJ) {
403 for (i = 0; i < ARRAY_SIZE(mem_types); i++) { 403 for (i = 0; i < ARRAY_SIZE(mem_types); i++) {
404 if (mem_types[i].prot_l1) 404 if (mem_types[i].prot_l1)
405 mem_types[i].prot_l1 |= PMD_BIT4; 405 mem_types[i].prot_l1 |= PMD_BIT4;
@@ -584,7 +584,7 @@ void setup_mm_for_reboot(char mode)
584 pmdval = (i << PGDIR_SHIFT) | 584 pmdval = (i << PGDIR_SHIFT) |
585 PMD_SECT_AP_WRITE | PMD_SECT_AP_READ | 585 PMD_SECT_AP_WRITE | PMD_SECT_AP_READ |
586 PMD_TYPE_SECT; 586 PMD_TYPE_SECT;
587 if (cpu_arch <= CPU_ARCH_ARMv5) 587 if (cpu_arch <= CPU_ARCH_ARMv5TEJ)
588 pmdval |= PMD_BIT4; 588 pmdval |= PMD_BIT4;
589 pmd = pmd_off(pgd, i << PGDIR_SHIFT); 589 pmd = pmd_off(pgd, i << PGDIR_SHIFT);
590 pmd[0] = __pmd(pmdval); 590 pmd[0] = __pmd(pmdval);
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index e3d8510f43..352db98ee2 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -200,7 +200,7 @@ __v6_setup:
200 mcr p15, 0, r4, c2, c0, 1 @ load TTB1 200 mcr p15, 0, r4, c2, c0, 1 @ load TTB1
201#ifdef CONFIG_VFP 201#ifdef CONFIG_VFP
202 mrc p15, 0, r0, c1, c0, 2 202 mrc p15, 0, r0, c1, c0, 2
203 orr r0, r0, #(3 << 20) 203 orr r0, r0, #(0xf << 20)
204 mcr p15, 0, r0, c1, c0, 2 @ Enable full access to VFP 204 mcr p15, 0, r0, c1, c0, 2 @ Enable full access to VFP
205#endif 205#endif
206 mrc p15, 0, r0, c1, c0, 0 @ read control register 206 mrc p15, 0, r0, c1, c0, 0 @ read control register
diff --git a/arch/arm/nwfpe/fpmodule.c b/arch/arm/nwfpe/fpmodule.c
index a806fea5c3..a8efcf3488 100644
--- a/arch/arm/nwfpe/fpmodule.c
+++ b/arch/arm/nwfpe/fpmodule.c
@@ -24,7 +24,6 @@
24#include "fpa11.h" 24#include "fpa11.h"
25 25
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/version.h>
28#include <linux/config.h> 27#include <linux/config.h>
29 28
30/* XXX */ 29/* XXX */
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
new file mode 100644
index 0000000000..345365852f
--- /dev/null
+++ b/arch/arm/plat-omap/Kconfig
@@ -0,0 +1,112 @@
1if ARCH_OMAP
2
3menu "TI OMAP Implementations"
4
5config ARCH_OMAP_OTG
6 bool
7
8choice
9 prompt "OMAP System Type"
10 default ARCH_OMAP1
11
12config ARCH_OMAP1
13 bool "TI OMAP1"
14
15config ARCH_OMAP2
16 bool "TI OMAP2"
17
18endchoice
19
20comment "OMAP Feature Selections"
21
22config OMAP_RESET_CLOCKS
23 bool "Reset unused clocks during boot"
24 depends on ARCH_OMAP
25 default n
26 help
27 Say Y if you want to reset unused clocks during boot.
28 This option saves power, but assumes all drivers are
29 using the clock framework. Broken drivers that do not
30 yet use clock framework may not work with this option.
31 If you are booting from another operating system, you
32 probably do not want this option enabled until your
33 device drivers work properly.
34
35config OMAP_MUX
36 bool "OMAP multiplexing support"
37 depends on ARCH_OMAP
38 default y
39 help
40 Pin multiplexing support for OMAP boards. If your bootloader
41 sets the multiplexing correctly, say N. Otherwise, or if unsure,
42 say Y.
43
44config OMAP_MUX_DEBUG
45 bool "Multiplexing debug output"
46 depends on OMAP_MUX
47 default n
48 help
49 Makes the multiplexing functions print out a lot of debug info.
50 This is useful if you want to find out the correct values of the
51 multiplexing registers.
52
53config OMAP_MUX_WARNINGS
54 bool "Warn about pins the bootloader didn't set up"
55 depends on OMAP_MUX
56 default y
57 help
58 Choose Y here to warn whenever driver initialization logic needs
59 to change the pin multiplexing setup. When there are no warnings
60 printed, it's safe to deselect OMAP_MUX for your product.
61
62choice
63 prompt "System timer"
64 default OMAP_MPU_TIMER
65
66config OMAP_MPU_TIMER
67 bool "Use mpu timer"
68 help
69 Select this option if you want to use the OMAP mpu timer. This
70 timer provides more intra-tick resolution than the 32KHz timer,
71 but consumes more power.
72
73config OMAP_32K_TIMER
74 bool "Use 32KHz timer"
75 depends on ARCH_OMAP16XX
76 help
77 Select this option if you want to enable the OMAP 32KHz timer.
78 This timer saves power compared to the OMAP_MPU_TIMER, and has
79 support for no tick during idle. The 32KHz timer provides less
80 intra-tick resolution than OMAP_MPU_TIMER. The 32KHz timer is
81 currently only available for OMAP-16xx.
82
83endchoice
84
85config OMAP_32K_TIMER_HZ
86 int "Kernel internal timer frequency for 32KHz timer"
87 range 32 1024
88 depends on OMAP_32K_TIMER
89 default "128"
90 help
91 Kernel internal timer frequency should be a divisor of 32768,
92 such as 64 or 128.
93
94choice
95 prompt "Low-level debug console UART"
96 depends on ARCH_OMAP
97 default OMAP_LL_DEBUG_UART1
98
99config OMAP_LL_DEBUG_UART1
100 bool "UART1"
101
102config OMAP_LL_DEBUG_UART2
103 bool "UART2"
104
105config OMAP_LL_DEBUG_UART3
106 bool "UART3"
107
108endchoice
109
110endmenu
111
112endif
diff --git a/arch/arm/plat-omap/Makefile b/arch/arm/plat-omap/Makefile
new file mode 100644
index 0000000000..531e11af54
--- /dev/null
+++ b/arch/arm/plat-omap/Makefile
@@ -0,0 +1,17 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Common support
6obj-y := common.o dma.o clock.o mux.o gpio.o mcbsp.o usb.o
7obj-m :=
8obj-n :=
9obj- :=
10
11# OCPI interconnect support for 1710, 1610 and 5912
12obj-$(CONFIG_ARCH_OMAP16XX) += ocpi.o
13
14# Power Management
15obj-$(CONFIG_PM) += pm.o sleep.o
16
17obj-$(CONFIG_CPU_FREQ) += cpu-omap.o
diff --git a/arch/arm/mach-omap/clock.c b/arch/arm/plat-omap/clock.c
index e91186b534..59d91b3262 100644
--- a/arch/arm/mach-omap/clock.c
+++ b/arch/arm/plat-omap/clock.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/clock.c 2 * linux/arch/arm/plat-omap/clock.c
3 * 3 *
4 * Copyright (C) 2004 Nokia corporation 4 * Copyright (C) 2004 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> 5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
@@ -14,6 +14,7 @@
14#include <linux/errno.h> 14#include <linux/errno.h>
15#include <linux/err.h> 15#include <linux/err.h>
16 16
17#include <asm/io.h>
17#include <asm/semaphore.h> 18#include <asm/semaphore.h>
18#include <asm/hardware/clock.h> 19#include <asm/hardware/clock.h>
19#include <asm/arch/board.h> 20#include <asm/arch/board.h>
@@ -25,6 +26,8 @@ static LIST_HEAD(clocks);
25static DECLARE_MUTEX(clocks_sem); 26static DECLARE_MUTEX(clocks_sem);
26static DEFINE_SPINLOCK(clockfw_lock); 27static DEFINE_SPINLOCK(clockfw_lock);
27static void propagate_rate(struct clk * clk); 28static void propagate_rate(struct clk * clk);
29/* UART clock function */
30static int set_uart_rate(struct clk * clk, unsigned long rate);
28/* External clock (MCLK & BCLK) functions */ 31/* External clock (MCLK & BCLK) functions */
29static int set_ext_clk_rate(struct clk * clk, unsigned long rate); 32static int set_ext_clk_rate(struct clk * clk, unsigned long rate);
30static long round_ext_clk_rate(struct clk * clk, unsigned long rate); 33static long round_ext_clk_rate(struct clk * clk, unsigned long rate);
@@ -34,7 +37,7 @@ static int select_table_rate(struct clk * clk, unsigned long rate);
34static long round_to_table_rate(struct clk * clk, unsigned long rate); 37static long round_to_table_rate(struct clk * clk, unsigned long rate);
35void clk_setdpll(__u16, __u16); 38void clk_setdpll(__u16, __u16);
36 39
37struct mpu_rate rate_table[] = { 40static struct mpu_rate rate_table[] = {
38 /* MPU MHz, xtal MHz, dpll1 MHz, CKCTL, DPLL_CTL 41 /* MPU MHz, xtal MHz, dpll1 MHz, CKCTL, DPLL_CTL
39 * armdiv, dspdiv, dspmmu, tcdiv, perdiv, lcddiv 42 * armdiv, dspdiv, dspmmu, tcdiv, perdiv, lcddiv
40 */ 43 */
@@ -48,7 +51,7 @@ struct mpu_rate rate_table[] = {
48 { 192000000, 19200000, 192000000, 0x050f, 0x2510 }, /* 1/1/2/2/8/8 */ 51 { 192000000, 19200000, 192000000, 0x050f, 0x2510 }, /* 1/1/2/2/8/8 */
49 { 192000000, 12000000, 192000000, 0x050f, 0x2810 }, /* 1/1/2/2/8/8 */ 52 { 192000000, 12000000, 192000000, 0x050f, 0x2810 }, /* 1/1/2/2/8/8 */
50 { 96000000, 12000000, 192000000, 0x055f, 0x2810 }, /* 2/2/2/2/8/8 */ 53 { 96000000, 12000000, 192000000, 0x055f, 0x2810 }, /* 2/2/2/2/8/8 */
51 { 48000000, 12000000, 192000000, 0x0ccf, 0x2810 }, /* 4/4/4/4/8/8 */ 54 { 48000000, 12000000, 192000000, 0x0baf, 0x2810 }, /* 4/8/4/4/8/8 */
52 { 24000000, 12000000, 192000000, 0x0fff, 0x2810 }, /* 8/8/8/8/8/8 */ 55 { 24000000, 12000000, 192000000, 0x0fff, 0x2810 }, /* 8/8/8/8/8/8 */
53#endif 56#endif
54#if defined(CONFIG_OMAP_ARM_182MHZ) 57#if defined(CONFIG_OMAP_ARM_182MHZ)
@@ -58,7 +61,7 @@ struct mpu_rate rate_table[] = {
58 { 168000000, 12000000, 168000000, 0x010f, 0x2710 }, /* 1/1/1/2/8/8 */ 61 { 168000000, 12000000, 168000000, 0x010f, 0x2710 }, /* 1/1/1/2/8/8 */
59#endif 62#endif
60#if defined(CONFIG_OMAP_ARM_150MHZ) 63#if defined(CONFIG_OMAP_ARM_150MHZ)
61 { 150000000, 12000000, 150000000, 0x150a, 0x2cb0 }, /* 0/0/1/1/2/2 */ 64 { 150000000, 12000000, 150000000, 0x010a, 0x2cb0 }, /* 1/1/1/2/4/4 */
62#endif 65#endif
63#if defined(CONFIG_OMAP_ARM_120MHZ) 66#if defined(CONFIG_OMAP_ARM_120MHZ)
64 { 120000000, 12000000, 120000000, 0x010a, 0x2510 }, /* 1/1/1/2/4/4 */ 67 { 120000000, 12000000, 120000000, 0x010a, 0x2510 }, /* 1/1/1/2/4/4 */
@@ -76,19 +79,11 @@ struct mpu_rate rate_table[] = {
76}; 79};
77 80
78 81
79static void ckctl_recalc(struct clk * clk) 82static void ckctl_recalc(struct clk * clk);
80{ 83int __clk_enable(struct clk *clk);
81 int dsor; 84void __clk_disable(struct clk *clk);
82 85void __clk_unuse(struct clk *clk);
83 /* Calculate divisor encoded as 2-bit exponent */ 86int __clk_use(struct clk *clk);
84 dsor = 1 << (3 & (omap_readw(ARM_CKCTL) >> clk->rate_offset));
85 if (unlikely(clk->rate == clk->parent->rate / dsor))
86 return; /* No change, quick exit */
87 clk->rate = clk->parent->rate / dsor;
88
89 if (unlikely(clk->flags & RATE_PROPAGATES))
90 propagate_rate(clk);
91}
92 87
93 88
94static void followparent_recalc(struct clk * clk) 89static void followparent_recalc(struct clk * clk)
@@ -102,6 +97,14 @@ static void watchdog_recalc(struct clk * clk)
102 clk->rate = clk->parent->rate / 14; 97 clk->rate = clk->parent->rate / 14;
103} 98}
104 99
100static void uart_recalc(struct clk * clk)
101{
102 unsigned int val = omap_readl(clk->enable_reg);
103 if (val & clk->enable_bit)
104 clk->rate = 48000000;
105 else
106 clk->rate = 12000000;
107}
105 108
106static struct clk ck_ref = { 109static struct clk ck_ref = {
107 .name = "ck_ref", 110 .name = "ck_ref",
@@ -138,7 +141,7 @@ static struct clk arm_ck = {
138static struct clk armper_ck = { 141static struct clk armper_ck = {
139 .name = "armper_ck", 142 .name = "armper_ck",
140 .parent = &ck_dpll1, 143 .parent = &ck_dpll1,
141 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 144 .flags = CLOCK_IN_OMAP730 | CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
142 RATE_CKCTL, 145 RATE_CKCTL,
143 .enable_reg = ARM_IDLECT2, 146 .enable_reg = ARM_IDLECT2,
144 .enable_bit = EN_PERCK, 147 .enable_bit = EN_PERCK,
@@ -185,7 +188,7 @@ static struct clk armwdt_ck = {
185static struct clk arminth_ck16xx = { 188static struct clk arminth_ck16xx = {
186 .name = "arminth_ck", 189 .name = "arminth_ck",
187 .parent = &arm_ck, 190 .parent = &arm_ck,
188 .flags = CLOCK_IN_OMAP16XX, 191 .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED,
189 .recalc = &followparent_recalc, 192 .recalc = &followparent_recalc,
190 /* Note: On 16xx the frequency can be divided by 2 by programming 193 /* Note: On 16xx the frequency can be divided by 2 by programming
191 * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1 194 * ARM_CKCTL:ARM_INTHCK_SEL(14) to 1
@@ -214,6 +217,38 @@ static struct clk dspmmu_ck = {
214 .recalc = &ckctl_recalc, 217 .recalc = &ckctl_recalc,
215}; 218};
216 219
220static struct clk dspper_ck = {
221 .name = "dspper_ck",
222 .parent = &ck_dpll1,
223 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
224 RATE_CKCTL | DSP_DOMAIN_CLOCK | VIRTUAL_IO_ADDRESS,
225 .enable_reg = DSP_IDLECT2,
226 .enable_bit = EN_PERCK,
227 .rate_offset = CKCTL_PERDIV_OFFSET,
228 .recalc = &followparent_recalc,
229 //.recalc = &ckctl_recalc,
230};
231
232static struct clk dspxor_ck = {
233 .name = "dspxor_ck",
234 .parent = &ck_ref,
235 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
236 DSP_DOMAIN_CLOCK | VIRTUAL_IO_ADDRESS,
237 .enable_reg = DSP_IDLECT2,
238 .enable_bit = EN_XORPCK,
239 .recalc = &followparent_recalc,
240};
241
242static struct clk dsptim_ck = {
243 .name = "dsptim_ck",
244 .parent = &ck_ref,
245 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
246 DSP_DOMAIN_CLOCK | VIRTUAL_IO_ADDRESS,
247 .enable_reg = DSP_IDLECT2,
248 .enable_bit = EN_DSPTIMCK,
249 .recalc = &followparent_recalc,
250};
251
217static struct clk tc_ck = { 252static struct clk tc_ck = {
218 .name = "tc_ck", 253 .name = "tc_ck",
219 .parent = &ck_dpll1, 254 .parent = &ck_dpll1,
@@ -226,7 +261,7 @@ static struct clk tc_ck = {
226static struct clk arminth_ck1510 = { 261static struct clk arminth_ck1510 = {
227 .name = "arminth_ck", 262 .name = "arminth_ck",
228 .parent = &tc_ck, 263 .parent = &tc_ck,
229 .flags = CLOCK_IN_OMAP1510, 264 .flags = CLOCK_IN_OMAP1510 | ALWAYS_ENABLED,
230 .recalc = &followparent_recalc, 265 .recalc = &followparent_recalc,
231 /* Note: On 1510 the frequency follows TC_CK 266 /* Note: On 1510 the frequency follows TC_CK
232 * 267 *
@@ -237,7 +272,7 @@ static struct clk arminth_ck1510 = {
237static struct clk tipb_ck = { 272static struct clk tipb_ck = {
238 .name = "tibp_ck", 273 .name = "tibp_ck",
239 .parent = &tc_ck, 274 .parent = &tc_ck,
240 .flags = CLOCK_IN_OMAP1510, 275 .flags = CLOCK_IN_OMAP1510 | ALWAYS_ENABLED,
241 .recalc = &followparent_recalc, 276 .recalc = &followparent_recalc,
242}; 277};
243 278
@@ -271,14 +306,15 @@ static struct clk tc2_ck = {
271static struct clk dma_ck = { 306static struct clk dma_ck = {
272 .name = "dma_ck", 307 .name = "dma_ck",
273 .parent = &tc_ck, 308 .parent = &tc_ck,
274 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX, 309 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX |
310 ALWAYS_ENABLED,
275 .recalc = &followparent_recalc, 311 .recalc = &followparent_recalc,
276}; 312};
277 313
278static struct clk dma_lcdfree_ck = { 314static struct clk dma_lcdfree_ck = {
279 .name = "dma_lcdfree_ck", 315 .name = "dma_lcdfree_ck",
280 .parent = &tc_ck, 316 .parent = &tc_ck,
281 .flags = CLOCK_IN_OMAP16XX, 317 .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED,
282 .recalc = &followparent_recalc, 318 .recalc = &followparent_recalc,
283}; 319};
284 320
@@ -303,14 +339,14 @@ static struct clk lb_ck = {
303static struct clk rhea1_ck = { 339static struct clk rhea1_ck = {
304 .name = "rhea1_ck", 340 .name = "rhea1_ck",
305 .parent = &tc_ck, 341 .parent = &tc_ck,
306 .flags = CLOCK_IN_OMAP16XX, 342 .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED,
307 .recalc = &followparent_recalc, 343 .recalc = &followparent_recalc,
308}; 344};
309 345
310static struct clk rhea2_ck = { 346static struct clk rhea2_ck = {
311 .name = "rhea2_ck", 347 .name = "rhea2_ck",
312 .parent = &tc_ck, 348 .parent = &tc_ck,
313 .flags = CLOCK_IN_OMAP16XX, 349 .flags = CLOCK_IN_OMAP16XX | ALWAYS_ENABLED,
314 .recalc = &followparent_recalc, 350 .recalc = &followparent_recalc,
315}; 351};
316 352
@@ -325,43 +361,55 @@ static struct clk lcd_ck = {
325 .recalc = &ckctl_recalc, 361 .recalc = &ckctl_recalc,
326}; 362};
327 363
328static struct clk uart1_ck = { 364static struct clk uart1_1510 = {
365 .name = "uart1_ck",
366 /* Direct from ULPD, no parent */
367 .rate = 12000000,
368 .flags = CLOCK_IN_OMAP1510 | ENABLE_REG_32BIT | ALWAYS_ENABLED,
369 .enable_reg = MOD_CONF_CTRL_0,
370 .enable_bit = 29, /* Chooses between 12MHz and 48MHz */
371 .set_rate = &set_uart_rate,
372 .recalc = &uart_recalc,
373};
374
375static struct clk uart1_16xx = {
329 .name = "uart1_ck", 376 .name = "uart1_ck",
330 /* Direct from ULPD, no parent */ 377 /* Direct from ULPD, no parent */
331 .rate = 48000000, 378 .rate = 48000000,
332 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 379 .flags = CLOCK_IN_OMAP16XX | RATE_FIXED | ENABLE_REG_32BIT,
333 RATE_FIXED | ENABLE_REG_32BIT,
334 .enable_reg = MOD_CONF_CTRL_0, 380 .enable_reg = MOD_CONF_CTRL_0,
335 .enable_bit = 29, 381 .enable_bit = 29,
336 /* (Only on 1510)
337 * The "enable bit" actually chooses between 48MHz and 12MHz.
338 */
339}; 382};
340 383
341static struct clk uart2_ck = { 384static struct clk uart2_ck = {
342 .name = "uart2_ck", 385 .name = "uart2_ck",
343 /* Direct from ULPD, no parent */ 386 /* Direct from ULPD, no parent */
344 .rate = 48000000, 387 .rate = 12000000,
345 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 388 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | ENABLE_REG_32BIT,
346 RATE_FIXED | ENABLE_REG_32BIT,
347 .enable_reg = MOD_CONF_CTRL_0, 389 .enable_reg = MOD_CONF_CTRL_0,
348 .enable_bit = 30, 390 .enable_bit = 30, /* Chooses between 12MHz and 48MHz */
349 /* (for both 1510 and 16xx) 391 .set_rate = &set_uart_rate,
350 * The "enable bit" actually chooses between 48MHz and 12MHz/32kHz. 392 .recalc = &uart_recalc,
351 */
352}; 393};
353 394
354static struct clk uart3_ck = { 395static struct clk uart3_1510 = {
396 .name = "uart3_ck",
397 /* Direct from ULPD, no parent */
398 .rate = 12000000,
399 .flags = CLOCK_IN_OMAP1510 | ENABLE_REG_32BIT | ALWAYS_ENABLED,
400 .enable_reg = MOD_CONF_CTRL_0,
401 .enable_bit = 31, /* Chooses between 12MHz and 48MHz */
402 .set_rate = &set_uart_rate,
403 .recalc = &uart_recalc,
404};
405
406static struct clk uart3_16xx = {
355 .name = "uart3_ck", 407 .name = "uart3_ck",
356 /* Direct from ULPD, no parent */ 408 /* Direct from ULPD, no parent */
357 .rate = 48000000, 409 .rate = 48000000,
358 .flags = CLOCK_IN_OMAP1510 | CLOCK_IN_OMAP16XX | 410 .flags = CLOCK_IN_OMAP16XX | RATE_FIXED | ENABLE_REG_32BIT,
359 RATE_FIXED | ENABLE_REG_32BIT,
360 .enable_reg = MOD_CONF_CTRL_0, 411 .enable_reg = MOD_CONF_CTRL_0,
361 .enable_bit = 31, 412 .enable_bit = 31,
362 /* (Only on 1510)
363 * The "enable bit" actually chooses between 48MHz and 12MHz.
364 */
365}; 413};
366 414
367static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */ 415static struct clk usb_clko = { /* 6 MHz output on W4_USB_CLKO */
@@ -480,6 +528,9 @@ static struct clk * onchip_clks[] = {
480 /* CK_GEN2 clocks */ 528 /* CK_GEN2 clocks */
481 &dsp_ck, 529 &dsp_ck,
482 &dspmmu_ck, 530 &dspmmu_ck,
531 &dspper_ck,
532 &dspxor_ck,
533 &dsptim_ck,
483 /* CK_GEN3 clocks */ 534 /* CK_GEN3 clocks */
484 &tc_ck, 535 &tc_ck,
485 &tipb_ck, 536 &tipb_ck,
@@ -494,9 +545,11 @@ static struct clk * onchip_clks[] = {
494 &rhea2_ck, 545 &rhea2_ck,
495 &lcd_ck, 546 &lcd_ck,
496 /* ULPD clocks */ 547 /* ULPD clocks */
497 &uart1_ck, 548 &uart1_1510,
549 &uart1_16xx,
498 &uart2_ck, 550 &uart2_ck,
499 &uart3_ck, 551 &uart3_1510,
552 &uart3_16xx,
500 &usb_clko, 553 &usb_clko,
501 &usb_hhc_ck1510, &usb_hhc_ck16xx, 554 &usb_hhc_ck1510, &usb_hhc_ck16xx,
502 &mclk_1510, &mclk_16xx, 555 &mclk_1510, &mclk_16xx,
@@ -547,14 +600,34 @@ int __clk_enable(struct clk *clk)
547 return 0; 600 return 0;
548 } 601 }
549 602
603 if (clk->flags & DSP_DOMAIN_CLOCK) {
604 __clk_use(&api_ck);
605 }
606
550 if (clk->flags & ENABLE_REG_32BIT) { 607 if (clk->flags & ENABLE_REG_32BIT) {
551 regval32 = omap_readl(clk->enable_reg); 608 if (clk->flags & VIRTUAL_IO_ADDRESS) {
552 regval32 |= (1 << clk->enable_bit); 609 regval32 = __raw_readl(clk->enable_reg);
553 omap_writel(regval32, clk->enable_reg); 610 regval32 |= (1 << clk->enable_bit);
611 __raw_writel(regval32, clk->enable_reg);
612 } else {
613 regval32 = omap_readl(clk->enable_reg);
614 regval32 |= (1 << clk->enable_bit);
615 omap_writel(regval32, clk->enable_reg);
616 }
554 } else { 617 } else {
555 regval16 = omap_readw(clk->enable_reg); 618 if (clk->flags & VIRTUAL_IO_ADDRESS) {
556 regval16 |= (1 << clk->enable_bit); 619 regval16 = __raw_readw(clk->enable_reg);
557 omap_writew(regval16, clk->enable_reg); 620 regval16 |= (1 << clk->enable_bit);
621 __raw_writew(regval16, clk->enable_reg);
622 } else {
623 regval16 = omap_readw(clk->enable_reg);
624 regval16 |= (1 << clk->enable_bit);
625 omap_writew(regval16, clk->enable_reg);
626 }
627 }
628
629 if (clk->flags & DSP_DOMAIN_CLOCK) {
630 __clk_unuse(&api_ck);
558 } 631 }
559 632
560 return 0; 633 return 0;
@@ -569,14 +642,34 @@ void __clk_disable(struct clk *clk)
569 if (clk->enable_reg == 0) 642 if (clk->enable_reg == 0)
570 return; 643 return;
571 644
645 if (clk->flags & DSP_DOMAIN_CLOCK) {
646 __clk_use(&api_ck);
647 }
648
572 if (clk->flags & ENABLE_REG_32BIT) { 649 if (clk->flags & ENABLE_REG_32BIT) {
573 regval32 = omap_readl(clk->enable_reg); 650 if (clk->flags & VIRTUAL_IO_ADDRESS) {
574 regval32 &= ~(1 << clk->enable_bit); 651 regval32 = __raw_readl(clk->enable_reg);
575 omap_writel(regval32, clk->enable_reg); 652 regval32 &= ~(1 << clk->enable_bit);
653 __raw_writel(regval32, clk->enable_reg);
654 } else {
655 regval32 = omap_readl(clk->enable_reg);
656 regval32 &= ~(1 << clk->enable_bit);
657 omap_writel(regval32, clk->enable_reg);
658 }
576 } else { 659 } else {
577 regval16 = omap_readw(clk->enable_reg); 660 if (clk->flags & VIRTUAL_IO_ADDRESS) {
578 regval16 &= ~(1 << clk->enable_bit); 661 regval16 = __raw_readw(clk->enable_reg);
579 omap_writew(regval16, clk->enable_reg); 662 regval16 &= ~(1 << clk->enable_bit);
663 __raw_writew(regval16, clk->enable_reg);
664 } else {
665 regval16 = omap_readw(clk->enable_reg);
666 regval16 &= ~(1 << clk->enable_bit);
667 omap_writew(regval16, clk->enable_reg);
668 }
669 }
670
671 if (clk->flags & DSP_DOMAIN_CLOCK) {
672 __clk_unuse(&api_ck);
580 } 673 }
581} 674}
582 675
@@ -766,6 +859,33 @@ static int calc_dsor_exp(struct clk *clk, unsigned long rate)
766 return dsor_exp; 859 return dsor_exp;
767} 860}
768 861
862
863static void ckctl_recalc(struct clk * clk)
864{
865 int dsor;
866
867 /* Calculate divisor encoded as 2-bit exponent */
868 if (clk->flags & DSP_DOMAIN_CLOCK) {
869 /* The clock control bits are in DSP domain,
870 * so api_ck is needed for access.
871 * Note that DSP_CKCTL virt addr = phys addr, so
872 * we must use __raw_readw() instead of omap_readw().
873 */
874 __clk_use(&api_ck);
875 dsor = 1 << (3 & (__raw_readw(DSP_CKCTL) >> clk->rate_offset));
876 __clk_unuse(&api_ck);
877 } else {
878 dsor = 1 << (3 & (omap_readw(ARM_CKCTL) >> clk->rate_offset));
879 }
880 if (unlikely(clk->rate == clk->parent->rate / dsor))
881 return; /* No change, quick exit */
882 clk->rate = clk->parent->rate / dsor;
883
884 if (unlikely(clk->flags & RATE_PROPAGATES))
885 propagate_rate(clk);
886}
887
888
769long clk_round_rate(struct clk *clk, unsigned long rate) 889long clk_round_rate(struct clk *clk, unsigned long rate)
770{ 890{
771 int dsor_exp; 891 int dsor_exp;
@@ -826,6 +946,9 @@ static int select_table_rate(struct clk * clk, unsigned long rate)
826 if (!ptr->rate) 946 if (!ptr->rate)
827 return -EINVAL; 947 return -EINVAL;
828 948
949 if (!ptr->rate)
950 return -EINVAL;
951
829 if (unlikely(ck_dpll1.rate == 0)) { 952 if (unlikely(ck_dpll1.rate == 0)) {
830 omap_writew(ptr->dpllctl_val, DPLL_CTL); 953 omap_writew(ptr->dpllctl_val, DPLL_CTL);
831 ck_dpll1.rate = ptr->pll_rate; 954 ck_dpll1.rate = ptr->pll_rate;
@@ -921,6 +1044,23 @@ static unsigned calc_ext_dsor(unsigned long rate)
921 return dsor; 1044 return dsor;
922} 1045}
923 1046
1047/* Only needed on 1510 */
1048static int set_uart_rate(struct clk * clk, unsigned long rate)
1049{
1050 unsigned int val;
1051
1052 val = omap_readl(clk->enable_reg);
1053 if (rate == 12000000)
1054 val &= ~(1 << clk->enable_bit);
1055 else if (rate == 48000000)
1056 val |= (1 << clk->enable_bit);
1057 else
1058 return -EINVAL;
1059 omap_writel(val, clk->enable_reg);
1060 clk->rate = rate;
1061
1062 return 0;
1063}
924 1064
925static int set_ext_clk_rate(struct clk * clk, unsigned long rate) 1065static int set_ext_clk_rate(struct clk * clk, unsigned long rate)
926{ 1066{
@@ -985,7 +1125,18 @@ void clk_unregister(struct clk *clk)
985} 1125}
986EXPORT_SYMBOL(clk_unregister); 1126EXPORT_SYMBOL(clk_unregister);
987 1127
988 1128#ifdef CONFIG_OMAP_RESET_CLOCKS
1129/*
1130 * Resets some clocks that may be left on from bootloader,
1131 * but leaves serial clocks on. See also omap_late_clk_reset().
1132 */
1133static inline void omap_early_clk_reset(void)
1134{
1135 //omap_writel(0x3 << 29, MOD_CONF_CTRL_0);
1136}
1137#else
1138#define omap_early_clk_reset() {}
1139#endif
989 1140
990int __init clk_init(void) 1141int __init clk_init(void)
991{ 1142{
@@ -993,6 +1144,8 @@ int __init clk_init(void)
993 const struct omap_clock_config *info; 1144 const struct omap_clock_config *info;
994 int crystal_type = 0; /* Default 12 MHz */ 1145 int crystal_type = 0; /* Default 12 MHz */
995 1146
1147 omap_early_clk_reset();
1148
996 for (clkp = onchip_clks; clkp < onchip_clks+ARRAY_SIZE(onchip_clks); clkp++) { 1149 for (clkp = onchip_clks; clkp < onchip_clks+ARRAY_SIZE(onchip_clks); clkp++) {
997 if (((*clkp)->flags &CLOCK_IN_OMAP1510) && cpu_is_omap1510()) { 1150 if (((*clkp)->flags &CLOCK_IN_OMAP1510) && cpu_is_omap1510()) {
998 clk_register(*clkp); 1151 clk_register(*clkp);
@@ -1023,9 +1176,42 @@ int __init clk_init(void)
1023 ck_ref.rate = 19200000; 1176 ck_ref.rate = 19200000;
1024#endif 1177#endif
1025 1178
1179 printk("Clocks: ARM_SYSST: 0x%04x DPLL_CTL: 0x%04x ARM_CKCTL: 0x%04x\n",
1180 omap_readw(ARM_SYSST), omap_readw(DPLL_CTL),
1181 omap_readw(ARM_CKCTL));
1182
1026 /* We want to be in syncronous scalable mode */ 1183 /* We want to be in syncronous scalable mode */
1027 omap_writew(0x1000, ARM_SYSST); 1184 omap_writew(0x1000, ARM_SYSST);
1028 1185
1186#ifdef CONFIG_OMAP_CLOCKS_SET_BY_BOOTLOADER
1187 /* Use values set by bootloader. Determine PLL rate and recalculate
1188 * dependent clocks as if kernel had changed PLL or divisors.
1189 */
1190 {
1191 unsigned pll_ctl_val = omap_readw(DPLL_CTL);
1192
1193 ck_dpll1.rate = ck_ref.rate; /* Base xtal rate */
1194 if (pll_ctl_val & 0x10) {
1195 /* PLL enabled, apply multiplier and divisor */
1196 if (pll_ctl_val & 0xf80)
1197 ck_dpll1.rate *= (pll_ctl_val & 0xf80) >> 7;
1198 ck_dpll1.rate /= ((pll_ctl_val & 0x60) >> 5) + 1;
1199 } else {
1200 /* PLL disabled, apply bypass divisor */
1201 switch (pll_ctl_val & 0xc) {
1202 case 0:
1203 break;
1204 case 0x4:
1205 ck_dpll1.rate /= 2;
1206 break;
1207 default:
1208 ck_dpll1.rate /= 4;
1209 break;
1210 }
1211 }
1212 }
1213 propagate_rate(&ck_dpll1);
1214#else
1029 /* Find the highest supported frequency and enable it */ 1215 /* Find the highest supported frequency and enable it */
1030 if (select_table_rate(&virtual_ck_mpu, ~0)) { 1216 if (select_table_rate(&virtual_ck_mpu, ~0)) {
1031 printk(KERN_ERR "System frequencies not set. Check your config.\n"); 1217 printk(KERN_ERR "System frequencies not set. Check your config.\n");
@@ -1034,12 +1220,13 @@ int __init clk_init(void)
1034 omap_writew(0x1005, ARM_CKCTL); 1220 omap_writew(0x1005, ARM_CKCTL);
1035 ck_dpll1.rate = 60000000; 1221 ck_dpll1.rate = 60000000;
1036 propagate_rate(&ck_dpll1); 1222 propagate_rate(&ck_dpll1);
1037 printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): %ld/%ld/%ld\n",
1038 ck_ref.rate, ck_dpll1.rate, arm_ck.rate);
1039 } 1223 }
1040 1224#endif
1041 /* Cache rates for clocks connected to ck_ref (not dpll1) */ 1225 /* Cache rates for clocks connected to ck_ref (not dpll1) */
1042 propagate_rate(&ck_ref); 1226 propagate_rate(&ck_ref);
1227 printk(KERN_INFO "Clocking rate (xtal/DPLL1/MPU): %ld.%01ld/%ld/%ld MHz\n",
1228 ck_ref.rate / 1000000, (ck_ref.rate / 100000) % 10,
1229 ck_dpll1.rate, arm_ck.rate);
1043 1230
1044#ifdef CONFIG_MACH_OMAP_PERSEUS2 1231#ifdef CONFIG_MACH_OMAP_PERSEUS2
1045 /* Select slicer output as OMAP input clock */ 1232 /* Select slicer output as OMAP input clock */
@@ -1074,3 +1261,63 @@ int __init clk_init(void)
1074 1261
1075 return 0; 1262 return 0;
1076} 1263}
1264
1265
1266#ifdef CONFIG_OMAP_RESET_CLOCKS
1267
1268static int __init omap_late_clk_reset(void)
1269{
1270 /* Turn off all unused clocks */
1271 struct clk *p;
1272 __u32 regval32;
1273
1274 omap_writew(0, SOFT_REQ_REG);
1275 omap_writew(0, SOFT_REQ_REG2);
1276
1277 list_for_each_entry(p, &clocks, node) {
1278 if (p->usecount > 0 || (p->flags & ALWAYS_ENABLED) ||
1279 p->enable_reg == 0)
1280 continue;
1281
1282 /* Assume no DSP clocks have been activated by bootloader */
1283 if (p->flags & DSP_DOMAIN_CLOCK)
1284 continue;
1285
1286 /* Is the clock already disabled? */
1287 if (p->flags & ENABLE_REG_32BIT) {
1288 if (p->flags & VIRTUAL_IO_ADDRESS)
1289 regval32 = __raw_readl(p->enable_reg);
1290 else
1291 regval32 = omap_readl(p->enable_reg);
1292 } else {
1293 if (p->flags & VIRTUAL_IO_ADDRESS)
1294 regval32 = __raw_readw(p->enable_reg);
1295 else
1296 regval32 = omap_readw(p->enable_reg);
1297 }
1298
1299 if ((regval32 & (1 << p->enable_bit)) == 0)
1300 continue;
1301
1302 /* FIXME: This clock seems to be necessary but no-one
1303 * has asked for its activation. */
1304 if (p == &tc2_ck // FIX: pm.c (SRAM), CCP, Camera
1305 || p == &ck_dpll1out // FIX: SoSSI, SSR
1306 || p == &arm_gpio_ck // FIX: GPIO code for 1510
1307 ) {
1308 printk(KERN_INFO "FIXME: Clock \"%s\" seems unused\n",
1309 p->name);
1310 continue;
1311 }
1312
1313 printk(KERN_INFO "Disabling unused clock \"%s\"... ", p->name);
1314 __clk_disable(p);
1315 printk(" done\n");
1316 }
1317
1318 return 0;
1319}
1320
1321late_initcall(omap_late_clk_reset);
1322
1323#endif
diff --git a/arch/arm/mach-omap/clock.h b/arch/arm/plat-omap/clock.h
index 08c0ddde18..a89e1e8c25 100644
--- a/arch/arm/mach-omap/clock.h
+++ b/arch/arm/plat-omap/clock.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/clock.h 2 * linux/arch/arm/plat-omap/clock.h
3 * 3 *
4 * Copyright (C) 2004 Nokia corporation 4 * Copyright (C) 2004 Nokia corporation
5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com> 5 * Written by Tuukka Tikkanen <tuukka.tikkanen@elektrobit.com>
@@ -52,6 +52,8 @@ struct mpu_rate {
52#define CLOCK_IN_OMAP16XX 64 52#define CLOCK_IN_OMAP16XX 64
53#define CLOCK_IN_OMAP1510 128 53#define CLOCK_IN_OMAP1510 128
54#define CLOCK_IN_OMAP730 256 54#define CLOCK_IN_OMAP730 256
55#define DSP_DOMAIN_CLOCK 512
56#define VIRTUAL_IO_ADDRESS 1024
55 57
56/* ARM_CKCTL bit shifts */ 58/* ARM_CKCTL bit shifts */
57#define CKCTL_PERDIV_OFFSET 0 59#define CKCTL_PERDIV_OFFSET 0
@@ -63,6 +65,8 @@ struct mpu_rate {
63/*#define ARM_TIMXO 12*/ 65/*#define ARM_TIMXO 12*/
64#define EN_DSPCK 13 66#define EN_DSPCK 13
65/*#define ARM_INTHCK_SEL 14*/ /* Divide-by-2 for mpu inth_ck */ 67/*#define ARM_INTHCK_SEL 14*/ /* Divide-by-2 for mpu inth_ck */
68/* DSP_CKCTL bit shifts */
69#define CKCTL_DSPPERDIV_OFFSET 0
66 70
67/* ARM_IDLECT1 bit shifts */ 71/* ARM_IDLECT1 bit shifts */
68/*#define IDLWDT_ARM 0*/ 72/*#define IDLWDT_ARM 0*/
@@ -96,6 +100,9 @@ struct mpu_rate {
96#define EN_TC1_CK 2 100#define EN_TC1_CK 2
97#define EN_TC2_CK 4 101#define EN_TC2_CK 4
98 102
103/* DSP_IDLECT2 bit shifts (0,1,2 are same as for ARM_IDLECT2) */
104#define EN_DSPTIMCK 5
105
99/* Various register defines for clock controls scattered around OMAP chip */ 106/* Various register defines for clock controls scattered around OMAP chip */
100#define USB_MCLK_EN_BIT 4 /* In ULPD_CLKC_CTRL */ 107#define USB_MCLK_EN_BIT 4 /* In ULPD_CLKC_CTRL */
101#define USB_HOST_HHC_UHOST_EN 9 /* In MOD_CONF_CTRL_0 */ 108#define USB_HOST_HHC_UHOST_EN 9 /* In MOD_CONF_CTRL_0 */
@@ -103,7 +110,8 @@ struct mpu_rate {
103#define COM_ULPD_PLL_CLK_REQ 1 /* In COM_CLK_DIV_CTRL_SEL */ 110#define COM_ULPD_PLL_CLK_REQ 1 /* In COM_CLK_DIV_CTRL_SEL */
104#define SWD_CLK_DIV_CTRL_SEL 0xfffe0874 111#define SWD_CLK_DIV_CTRL_SEL 0xfffe0874
105#define COM_CLK_DIV_CTRL_SEL 0xfffe0878 112#define COM_CLK_DIV_CTRL_SEL 0xfffe0878
106 113#define SOFT_REQ_REG 0xfffe0834
114#define SOFT_REQ_REG2 0xfffe0880
107 115
108int clk_register(struct clk *clk); 116int clk_register(struct clk *clk);
109void clk_unregister(struct clk *clk); 117void clk_unregister(struct clk *clk);
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
new file mode 100644
index 0000000000..ea967a8f6c
--- /dev/null
+++ b/arch/arm/plat-omap/common.c
@@ -0,0 +1,135 @@
1/*
2 * linux/arch/arm/plat-omap/common.c
3 *
4 * Code common to all OMAP machines.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/config.h>
11#include <linux/module.h>
12#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/delay.h>
15#include <linux/pm.h>
16#include <linux/console.h>
17#include <linux/serial.h>
18#include <linux/tty.h>
19#include <linux/serial_8250.h>
20#include <linux/serial_reg.h>
21
22#include <asm/hardware.h>
23#include <asm/system.h>
24#include <asm/pgtable.h>
25#include <asm/mach/map.h>
26#include <asm/hardware/clock.h>
27#include <asm/io.h>
28#include <asm/mach-types.h>
29
30#include <asm/arch/board.h>
31#include <asm/arch/mux.h>
32#include <asm/arch/fpga.h>
33
34#include "clock.h"
35
36#define NO_LENGTH_CHECK 0xffffffff
37
38extern int omap_bootloader_tag_len;
39extern u8 omap_bootloader_tag[];
40
41struct omap_board_config_kernel *omap_board_config;
42int omap_board_config_size = 0;
43
44static const void *get_config(u16 tag, size_t len, int skip, size_t *len_out)
45{
46 struct omap_board_config_kernel *kinfo = NULL;
47 int i;
48
49#ifdef CONFIG_OMAP_BOOT_TAG
50 struct omap_board_config_entry *info = NULL;
51
52 if (omap_bootloader_tag_len > 4)
53 info = (struct omap_board_config_entry *) omap_bootloader_tag;
54 while (info != NULL) {
55 u8 *next;
56
57 if (info->tag == tag) {
58 if (skip == 0)
59 break;
60 skip--;
61 }
62
63 if ((info->len & 0x03) != 0) {
64 /* We bail out to avoid an alignment fault */
65 printk(KERN_ERR "OMAP peripheral config: Length (%d) not word-aligned (tag %04x)\n",
66 info->len, info->tag);
67 return NULL;
68 }
69 next = (u8 *) info + sizeof(*info) + info->len;
70 if (next >= omap_bootloader_tag + omap_bootloader_tag_len)
71 info = NULL;
72 else
73 info = (struct omap_board_config_entry *) next;
74 }
75 if (info != NULL) {
76 /* Check the length as a lame attempt to check for
77 * binary inconsistancy. */
78 if (len != NO_LENGTH_CHECK) {
79 /* Word-align len */
80 if (len & 0x03)
81 len = (len + 3) & ~0x03;
82 if (info->len != len) {
83 printk(KERN_ERR "OMAP peripheral config: Length mismatch with tag %x (want %d, got %d)\n",
84 tag, len, info->len);
85 return NULL;
86 }
87 }
88 if (len_out != NULL)
89 *len_out = info->len;
90 return info->data;
91 }
92#endif
93 /* Try to find the config from the board-specific structures
94 * in the kernel. */
95 for (i = 0; i < omap_board_config_size; i++) {
96 if (omap_board_config[i].tag == tag) {
97 kinfo = &omap_board_config[i];
98 break;
99 }
100 }
101 if (kinfo == NULL)
102 return NULL;
103 return kinfo->data;
104}
105
106const void *__omap_get_config(u16 tag, size_t len, int nr)
107{
108 return get_config(tag, len, nr, NULL);
109}
110EXPORT_SYMBOL(__omap_get_config);
111
112const void *omap_get_var_config(u16 tag, size_t *len)
113{
114 return get_config(tag, NO_LENGTH_CHECK, 0, len);
115}
116EXPORT_SYMBOL(omap_get_var_config);
117
118static int __init omap_add_serial_console(void)
119{
120 const struct omap_serial_console_config *info;
121
122 info = omap_get_config(OMAP_TAG_SERIAL_CONSOLE,
123 struct omap_serial_console_config);
124 if (info != NULL && info->console_uart) {
125 static char speed[11], *opt = NULL;
126
127 if (info->console_speed) {
128 snprintf(speed, sizeof(speed), "%u", info->console_speed);
129 opt = speed;
130 }
131 return add_preferred_console("ttyS", info->console_uart - 1, opt);
132 }
133 return 0;
134}
135console_initcall(omap_add_serial_console);
diff --git a/arch/arm/plat-omap/cpu-omap.c b/arch/arm/plat-omap/cpu-omap.c
new file mode 100644
index 0000000000..409aac2c4b
--- /dev/null
+++ b/arch/arm/plat-omap/cpu-omap.c
@@ -0,0 +1,128 @@
1/*
2 * linux/arch/arm/plat-omap/cpu-omap.c
3 *
4 * CPU frequency scaling for OMAP
5 *
6 * Copyright (C) 2005 Nokia Corporation
7 * Written by Tony Lindgren <tony@atomide.com>
8 *
9 * Based on cpu-sa1110.c, Copyright (C) 2001 Russell King
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#include <linux/types.h>
16#include <linux/kernel.h>
17#include <linux/sched.h>
18#include <linux/cpufreq.h>
19#include <linux/delay.h>
20#include <linux/init.h>
21#include <linux/err.h>
22
23#include <asm/hardware.h>
24#include <asm/mach-types.h>
25#include <asm/io.h>
26#include <asm/system.h>
27
28#include <asm/hardware/clock.h>
29
30/* TODO: Add support for SDRAM timing changes */
31
32int omap_verify_speed(struct cpufreq_policy *policy)
33{
34 struct clk * mpu_clk;
35
36 if (policy->cpu)
37 return -EINVAL;
38
39 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
40 policy->cpuinfo.max_freq);
41 mpu_clk = clk_get(NULL, "mpu");
42 if (IS_ERR(mpu_clk))
43 return PTR_ERR(mpu_clk);
44 policy->min = clk_round_rate(mpu_clk, policy->min * 1000) / 1000;
45 policy->max = clk_round_rate(mpu_clk, policy->max * 1000) / 1000;
46 cpufreq_verify_within_limits(policy, policy->cpuinfo.min_freq,
47 policy->cpuinfo.max_freq);
48 clk_put(mpu_clk);
49
50 return 0;
51}
52
53unsigned int omap_getspeed(unsigned int cpu)
54{
55 struct clk * mpu_clk;
56 unsigned long rate;
57
58 if (cpu)
59 return 0;
60
61 mpu_clk = clk_get(NULL, "mpu");
62 if (IS_ERR(mpu_clk))
63 return 0;
64 rate = clk_get_rate(mpu_clk) / 1000;
65 clk_put(mpu_clk);
66
67 return rate;
68}
69
70static int omap_target(struct cpufreq_policy *policy,
71 unsigned int target_freq,
72 unsigned int relation)
73{
74 struct clk * mpu_clk;
75 struct cpufreq_freqs freqs;
76 int ret = 0;
77
78 mpu_clk = clk_get(NULL, "mpu");
79 if (IS_ERR(mpu_clk))
80 return PTR_ERR(mpu_clk);
81
82 freqs.old = omap_getspeed(0);
83 freqs.new = clk_round_rate(mpu_clk, target_freq * 1000) / 1000;
84 freqs.cpu = 0;
85
86 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
87 ret = clk_set_rate(mpu_clk, target_freq * 1000);
88 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
89 clk_put(mpu_clk);
90
91 return ret;
92}
93
94static int __init omap_cpu_init(struct cpufreq_policy *policy)
95{
96 struct clk * mpu_clk;
97
98 mpu_clk = clk_get(NULL, "mpu");
99 if (IS_ERR(mpu_clk))
100 return PTR_ERR(mpu_clk);
101
102 if (policy->cpu != 0)
103 return -EINVAL;
104 policy->cur = policy->min = policy->max = omap_getspeed(0);
105 policy->governor = CPUFREQ_DEFAULT_GOVERNOR;
106 policy->cpuinfo.min_freq = clk_round_rate(mpu_clk, 0) / 1000;
107 policy->cpuinfo.max_freq = clk_round_rate(mpu_clk, 216000000) / 1000;
108 policy->cpuinfo.transition_latency = CPUFREQ_ETERNAL;
109 clk_put(mpu_clk);
110
111 return 0;
112}
113
114static struct cpufreq_driver omap_driver = {
115 .flags = CPUFREQ_STICKY,
116 .verify = omap_verify_speed,
117 .target = omap_target,
118 .get = omap_getspeed,
119 .init = omap_cpu_init,
120 .name = "omap",
121};
122
123static int __init omap_cpufreq_init(void)
124{
125 return cpufreq_register_driver(&omap_driver);
126}
127
128arch_initcall(omap_cpufreq_init);
diff --git a/arch/arm/mach-omap/dma.c b/arch/arm/plat-omap/dma.c
index 7a9ebe80d6..c0a5c2fa42 100644
--- a/arch/arm/mach-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/omap/dma.c 2 * linux/arch/arm/plat-omap/dma.c
3 * 3 *
4 * Copyright (C) 2003 Nokia Corporation 4 * Copyright (C) 2003 Nokia Corporation
5 * Author: Juha Yrjölä <juha.yrjola@nokia.com> 5 * Author: Juha Yrjölä <juha.yrjola@nokia.com>
@@ -794,10 +794,6 @@ static void set_b1_regs(void)
794 w = omap_readw(OMAP1610_DMA_LCD_CTRL); 794 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
795 /* Always set the source port as SDRAM for now*/ 795 /* Always set the source port as SDRAM for now*/
796 w &= ~(0x03 << 6); 796 w &= ~(0x03 << 6);
797 if (lcd_dma.ext_ctrl)
798 w |= 1 << 8;
799 else
800 w &= ~(1 << 8);
801 if (lcd_dma.callback != NULL) 797 if (lcd_dma.callback != NULL)
802 w |= 1 << 1; /* Block interrupt enable */ 798 w |= 1 << 1; /* Block interrupt enable */
803 else 799 else
@@ -889,9 +885,15 @@ void omap_enable_lcd_dma(void)
889 */ 885 */
890 if (enable_1510_mode || !lcd_dma.ext_ctrl) 886 if (enable_1510_mode || !lcd_dma.ext_ctrl)
891 return; 887 return;
888
889 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
890 w |= 1 << 8;
891 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
892
892 w = omap_readw(OMAP1610_DMA_LCD_CCR); 893 w = omap_readw(OMAP1610_DMA_LCD_CCR);
893 w |= 1 << 7; 894 w |= 1 << 7;
894 omap_writew(w, OMAP1610_DMA_LCD_CCR); 895 omap_writew(w, OMAP1610_DMA_LCD_CCR);
896
895 lcd_dma.active = 1; 897 lcd_dma.active = 1;
896} 898}
897 899
@@ -922,10 +924,19 @@ void omap_setup_lcd_dma(void)
922 924
923void omap_stop_lcd_dma(void) 925void omap_stop_lcd_dma(void)
924{ 926{
927 u16 w;
928
925 lcd_dma.active = 0; 929 lcd_dma.active = 0;
926 if (!enable_1510_mode && lcd_dma.ext_ctrl) 930 if (enable_1510_mode || !lcd_dma.ext_ctrl)
927 omap_writew(omap_readw(OMAP1610_DMA_LCD_CCR) & ~(1 << 7), 931 return;
928 OMAP1610_DMA_LCD_CCR); 932
933 w = omap_readw(OMAP1610_DMA_LCD_CCR);
934 w &= ~(1 << 7);
935 omap_writew(w, OMAP1610_DMA_LCD_CCR);
936
937 w = omap_readw(OMAP1610_DMA_LCD_CTRL);
938 w &= ~(1 << 8);
939 omap_writew(w, OMAP1610_DMA_LCD_CTRL);
929} 940}
930 941
931/* 942/*
@@ -972,6 +983,25 @@ dma_addr_t omap_get_dma_dst_pos(int lch)
972 (OMAP_DMA_CDSA_U(lch) << 16)); 983 (OMAP_DMA_CDSA_U(lch) << 16));
973} 984}
974 985
986int omap_dma_running(void)
987{
988 int lch;
989
990 /* Check if LCD DMA is running */
991 if (cpu_is_omap16xx())
992 if (omap_readw(OMAP1610_DMA_LCD_CCR) & OMAP_DMA_CCR_EN)
993 return 1;
994
995 for (lch = 0; lch < dma_chan_count; lch++) {
996 u16 w;
997
998 w = omap_readw(OMAP_DMA_CCR(lch));
999 if (w & OMAP_DMA_CCR_EN)
1000 return 1;
1001 }
1002 return 0;
1003}
1004
975static int __init omap_init_dma(void) 1005static int __init omap_init_dma(void)
976{ 1006{
977 int ch, r; 1007 int ch, r;
diff --git a/arch/arm/mach-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 9045dfd469..1c85b4e536 100644
--- a/arch/arm/mach-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/gpio.c 2 * linux/arch/arm/plat-omap/gpio.c
3 * 3 *
4 * Support functions for OMAP GPIO 4 * Support functions for OMAP GPIO
5 * 5 *
diff --git a/arch/arm/mach-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index 7c4ad77130..43567d5edd 100644
--- a/arch/arm/mach-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/omap/mcbsp.c 2 * linux/arch/arm/plat-omap/mcbsp.c
3 * 3 *
4 * Copyright (C) 2004 Nokia Corporation 4 * Copyright (C) 2004 Nokia Corporation
5 * Author: Samuel Ortiz <samuel.ortiz@nokia.com> 5 * Author: Samuel Ortiz <samuel.ortiz@nokia.com>
@@ -66,6 +66,7 @@ struct omap_mcbsp {
66static struct omap_mcbsp mcbsp[OMAP_MAX_MCBSP_COUNT]; 66static struct omap_mcbsp mcbsp[OMAP_MAX_MCBSP_COUNT];
67static struct clk *mcbsp_dsp_ck = 0; 67static struct clk *mcbsp_dsp_ck = 0;
68static struct clk *mcbsp_api_ck = 0; 68static struct clk *mcbsp_api_ck = 0;
69static struct clk *mcbsp_dspxor_ck = 0;
69 70
70 71
71static void omap_mcbsp_dump_reg(u8 id) 72static void omap_mcbsp_dump_reg(u8 id)
@@ -175,7 +176,7 @@ static int omap_mcbsp_check(unsigned int id)
175 return 0; 176 return 0;
176 } 177 }
177 178
178 if (cpu_is_omap1510() || cpu_is_omap1610() || cpu_is_omap1710()) { 179 if (cpu_is_omap1510() || cpu_is_omap16xx()) {
179 if (id > OMAP_MAX_MCBSP_COUNT) { 180 if (id > OMAP_MAX_MCBSP_COUNT) {
180 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1); 181 printk(KERN_ERR "OMAP-McBSP: McBSP%d doesn't exist\n", id + 1);
181 return -1; 182 return -1;
@@ -191,15 +192,12 @@ static int omap_mcbsp_check(unsigned int id)
191 192
192static void omap_mcbsp_dsp_request(void) 193static void omap_mcbsp_dsp_request(void)
193{ 194{
194 if (cpu_is_omap1510() || cpu_is_omap1610() || cpu_is_omap1710()) { 195 if (cpu_is_omap1510() || cpu_is_omap16xx()) {
195 omap_writew((omap_readw(ARM_RSTCT1) | (1 << 1) | (1 << 2)), 196 clk_use(mcbsp_dsp_ck);
196 ARM_RSTCT1); 197 clk_use(mcbsp_api_ck);
197 clk_enable(mcbsp_dsp_ck);
198 clk_enable(mcbsp_api_ck);
199 198
200 /* enable 12MHz clock to mcbsp 1 & 3 */ 199 /* enable 12MHz clock to mcbsp 1 & 3 */
201 __raw_writew(__raw_readw(DSP_IDLECT2) | (1 << EN_XORPCK), 200 clk_use(mcbsp_dspxor_ck);
202 DSP_IDLECT2);
203 __raw_writew(__raw_readw(DSP_RSTCT2) | 1 | 1 << 1, 201 __raw_writew(__raw_readw(DSP_RSTCT2) | 1 | 1 << 1,
204 DSP_RSTCT2); 202 DSP_RSTCT2);
205 } 203 }
@@ -207,10 +205,13 @@ static void omap_mcbsp_dsp_request(void)
207 205
208static void omap_mcbsp_dsp_free(void) 206static void omap_mcbsp_dsp_free(void)
209{ 207{
210 /* Useless for now */ 208 if (cpu_is_omap1510() || cpu_is_omap16xx()) {
209 clk_unuse(mcbsp_dspxor_ck);
210 clk_unuse(mcbsp_dsp_ck);
211 clk_unuse(mcbsp_api_ck);
212 }
211} 213}
212 214
213
214int omap_mcbsp_request(unsigned int id) 215int omap_mcbsp_request(unsigned int id)
215{ 216{
216 int err; 217 int err;
@@ -350,6 +351,73 @@ void omap_mcbsp_stop(unsigned int id)
350} 351}
351 352
352 353
354/* polled mcbsp i/o operations */
355int omap_mcbsp_pollwrite(unsigned int id, u16 buf)
356{
357 u32 base = mcbsp[id].io_base;
358 writew(buf, base + OMAP_MCBSP_REG_DXR1);
359 /* if frame sync error - clear the error */
360 if (readw(base + OMAP_MCBSP_REG_SPCR2) & XSYNC_ERR) {
361 /* clear error */
362 writew(readw(base + OMAP_MCBSP_REG_SPCR2) & (~XSYNC_ERR),
363 base + OMAP_MCBSP_REG_SPCR2);
364 /* resend */
365 return -1;
366 } else {
367 /* wait for transmit confirmation */
368 int attemps = 0;
369 while (!(readw(base + OMAP_MCBSP_REG_SPCR2) & XRDY)) {
370 if (attemps++ > 1000) {
371 writew(readw(base + OMAP_MCBSP_REG_SPCR2) &
372 (~XRST),
373 base + OMAP_MCBSP_REG_SPCR2);
374 udelay(10);
375 writew(readw(base + OMAP_MCBSP_REG_SPCR2) |
376 (XRST),
377 base + OMAP_MCBSP_REG_SPCR2);
378 udelay(10);
379 printk(KERN_ERR
380 " Could not write to McBSP Register\n");
381 return -2;
382 }
383 }
384 }
385 return 0;
386}
387
388int omap_mcbsp_pollread(unsigned int id, u16 * buf)
389{
390 u32 base = mcbsp[id].io_base;
391 /* if frame sync error - clear the error */
392 if (readw(base + OMAP_MCBSP_REG_SPCR1) & RSYNC_ERR) {
393 /* clear error */
394 writew(readw(base + OMAP_MCBSP_REG_SPCR1) & (~RSYNC_ERR),
395 base + OMAP_MCBSP_REG_SPCR1);
396 /* resend */
397 return -1;
398 } else {
399 /* wait for recieve confirmation */
400 int attemps = 0;
401 while (!(readw(base + OMAP_MCBSP_REG_SPCR1) & RRDY)) {
402 if (attemps++ > 1000) {
403 writew(readw(base + OMAP_MCBSP_REG_SPCR1) &
404 (~RRST),
405 base + OMAP_MCBSP_REG_SPCR1);
406 udelay(10);
407 writew(readw(base + OMAP_MCBSP_REG_SPCR1) |
408 (RRST),
409 base + OMAP_MCBSP_REG_SPCR1);
410 udelay(10);
411 printk(KERN_ERR
412 " Could not read from McBSP Register\n");
413 return -2;
414 }
415 }
416 }
417 *buf = readw(base + OMAP_MCBSP_REG_DRR1);
418 return 0;
419}
420
353/* 421/*
354 * IRQ based word transmission. 422 * IRQ based word transmission.
355 */ 423 */
@@ -625,10 +693,15 @@ static int __init omap_mcbsp_init(void)
625 return PTR_ERR(mcbsp_dsp_ck); 693 return PTR_ERR(mcbsp_dsp_ck);
626 } 694 }
627 mcbsp_api_ck = clk_get(0, "api_ck"); 695 mcbsp_api_ck = clk_get(0, "api_ck");
628 if (IS_ERR(mcbsp_dsp_ck)) { 696 if (IS_ERR(mcbsp_api_ck)) {
629 printk(KERN_ERR "mcbsp: could not acquire api_ck handle.\n"); 697 printk(KERN_ERR "mcbsp: could not acquire api_ck handle.\n");
630 return PTR_ERR(mcbsp_api_ck); 698 return PTR_ERR(mcbsp_api_ck);
631 } 699 }
700 mcbsp_dspxor_ck = clk_get(0, "dspxor_ck");
701 if (IS_ERR(mcbsp_dspxor_ck)) {
702 printk(KERN_ERR "mcbsp: could not acquire dspxor_ck handle.\n");
703 return PTR_ERR(mcbsp_dspxor_ck);
704 }
632 705
633#ifdef CONFIG_ARCH_OMAP730 706#ifdef CONFIG_ARCH_OMAP730
634 if (cpu_is_omap730()) { 707 if (cpu_is_omap730()) {
@@ -643,7 +716,7 @@ static int __init omap_mcbsp_init(void)
643 } 716 }
644#endif 717#endif
645#if defined(CONFIG_ARCH_OMAP16XX) 718#if defined(CONFIG_ARCH_OMAP16XX)
646 if (cpu_is_omap1610() || cpu_is_omap1710()) { 719 if (cpu_is_omap16xx()) {
647 mcbsp_info = mcbsp_1610; 720 mcbsp_info = mcbsp_1610;
648 mcbsp_count = ARRAY_SIZE(mcbsp_1610); 721 mcbsp_count = ARRAY_SIZE(mcbsp_1610);
649 } 722 }
diff --git a/arch/arm/mach-omap/mux.c b/arch/arm/plat-omap/mux.c
index bcf3c6e5ec..ea7b955b9c 100644
--- a/arch/arm/mach-omap/mux.c
+++ b/arch/arm/plat-omap/mux.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/mux.c 2 * linux/arch/arm/plat-omap/mux.c
3 * 3 *
4 * Utility to set the Omap MUX and PULL_DWN registers from a table in mux.h 4 * Utility to set the Omap MUX and PULL_DWN registers from a table in mux.h
5 * 5 *
@@ -53,19 +53,13 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
53 return -EINVAL; 53 return -EINVAL;
54 } 54 }
55 55
56 cfg = &reg_cfg_table[reg_cfg]; 56 cfg = (reg_cfg_set *)&reg_cfg_table[reg_cfg];
57
58 /*
59 * We do a pretty long section here with lock on, but pin muxing
60 * should only happen on driver init for each driver, so it's not time
61 * critical.
62 */
63 spin_lock_irqsave(&mux_spin_lock, flags);
64 57
65 /* Check the mux register in question */ 58 /* Check the mux register in question */
66 if (cfg->mux_reg) { 59 if (cfg->mux_reg) {
67 unsigned tmp1, tmp2; 60 unsigned tmp1, tmp2;
68 61
62 spin_lock_irqsave(&mux_spin_lock, flags);
69 reg_orig = omap_readl(cfg->mux_reg); 63 reg_orig = omap_readl(cfg->mux_reg);
70 64
71 /* The mux registers always seem to be 3 bits long */ 65 /* The mux registers always seem to be 3 bits long */
@@ -80,11 +74,13 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
80 warn = 1; 74 warn = 1;
81 75
82 omap_writel(reg, cfg->mux_reg); 76 omap_writel(reg, cfg->mux_reg);
77 spin_unlock_irqrestore(&mux_spin_lock, flags);
83 } 78 }
84 79
85 /* Check for pull up or pull down selection on 1610 */ 80 /* Check for pull up or pull down selection on 1610 */
86 if (!cpu_is_omap1510()) { 81 if (!cpu_is_omap1510()) {
87 if (cfg->pu_pd_reg && cfg->pull_val) { 82 if (cfg->pu_pd_reg && cfg->pull_val) {
83 spin_lock_irqsave(&mux_spin_lock, flags);
88 pu_pd_orig = omap_readl(cfg->pu_pd_reg); 84 pu_pd_orig = omap_readl(cfg->pu_pd_reg);
89 mask = 1 << cfg->pull_bit; 85 mask = 1 << cfg->pull_bit;
90 86
@@ -100,11 +96,13 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
100 pu_pd = pu_pd_orig & ~mask; 96 pu_pd = pu_pd_orig & ~mask;
101 } 97 }
102 omap_writel(pu_pd, cfg->pu_pd_reg); 98 omap_writel(pu_pd, cfg->pu_pd_reg);
99 spin_unlock_irqrestore(&mux_spin_lock, flags);
103 } 100 }
104 } 101 }
105 102
106 /* Check for an associated pull down register */ 103 /* Check for an associated pull down register */
107 if (cfg->pull_reg) { 104 if (cfg->pull_reg) {
105 spin_lock_irqsave(&mux_spin_lock, flags);
108 pull_orig = omap_readl(cfg->pull_reg); 106 pull_orig = omap_readl(cfg->pull_reg);
109 mask = 1 << cfg->pull_bit; 107 mask = 1 << cfg->pull_bit;
110 108
@@ -121,6 +119,7 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
121 } 119 }
122 120
123 omap_writel(pull, cfg->pull_reg); 121 omap_writel(pull, cfg->pull_reg);
122 spin_unlock_irqrestore(&mux_spin_lock, flags);
124 } 123 }
125 124
126 if (warn) { 125 if (warn) {
@@ -149,8 +148,6 @@ omap_cfg_reg(const reg_cfg_t reg_cfg)
149 } 148 }
150#endif 149#endif
151 150
152 spin_unlock_irqrestore(&mux_spin_lock, flags);
153
154#ifdef CONFIG_OMAP_MUX_ERRORS 151#ifdef CONFIG_OMAP_MUX_ERRORS
155 return warn ? -ETXTBSY : 0; 152 return warn ? -ETXTBSY : 0;
156#else 153#else
diff --git a/arch/arm/mach-omap/ocpi.c b/arch/arm/plat-omap/ocpi.c
index c9ced134a7..2ede2ee8ca 100644
--- a/arch/arm/mach-omap/ocpi.c
+++ b/arch/arm/plat-omap/ocpi.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/ocpi.c 2 * linux/arch/arm/plat-omap/ocpi.c
3 * 3 *
4 * Minimal OCP bus support for omap16xx 4 * Minimal OCP bus support for omap16xx
5 * 5 *
@@ -25,7 +25,6 @@
25 25
26#include <linux/config.h> 26#include <linux/config.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/version.h>
29#include <linux/types.h> 28#include <linux/types.h>
30#include <linux/errno.h> 29#include <linux/errno.h>
31#include <linux/kernel.h> 30#include <linux/kernel.h>
diff --git a/arch/arm/mach-omap/pm.c b/arch/arm/plat-omap/pm.c
index 6b03ccdc1e..e6536b16c3 100644
--- a/arch/arm/mach-omap/pm.c
+++ b/arch/arm/plat-omap/pm.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/pm.c 2 * linux/arch/arm/plat-omap/pm.c
3 * 3 *
4 * OMAP Power Management Routines 4 * OMAP Power Management Routines
5 * 5 *
diff --git a/arch/arm/mach-omap/sleep.S b/arch/arm/plat-omap/sleep.S
index 4d426d1058..279490ce77 100644
--- a/arch/arm/mach-omap/sleep.S
+++ b/arch/arm/plat-omap/sleep.S
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/mach-omap/sleep.S 2 * linux/arch/arm/plat-omap/sleep.S
3 * 3 *
4 * Low-level OMAP1510/1610 sleep/wakeUp support 4 * Low-level OMAP1510/1610 sleep/wakeUp support
5 * 5 *
diff --git a/arch/arm/mach-omap/usb.c b/arch/arm/plat-omap/usb.c
index fd483ff9f8..25bc4a8dd7 100644
--- a/arch/arm/mach-omap/usb.c
+++ b/arch/arm/plat-omap/usb.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-omap/usb.c -- platform level USB initialization 2 * arch/arm/plat-omap/usb.c -- platform level USB initialization
3 * 3 *
4 * Copyright (C) 2004 Texas Instruments, Inc. 4 * Copyright (C) 2004 Texas Instruments, Inc.
5 * 5 *
@@ -326,7 +326,7 @@ static u64 ohci_dmamask = ~(u32)0;
326static struct resource ohci_resources[] = { 326static struct resource ohci_resources[] = {
327 { 327 {
328 .start = OMAP_OHCI_BASE, 328 .start = OMAP_OHCI_BASE,
329 .end = OMAP_OHCI_BASE + 4096, 329 .end = OMAP_OHCI_BASE + 4096 - 1,
330 .flags = IORESOURCE_MEM, 330 .flags = IORESOURCE_MEM,
331 }, 331 },
332 { 332 {
diff --git a/arch/arm26/Kconfig b/arch/arm26/Kconfig
index dc0c193696..1f03732673 100644
--- a/arch/arm26/Kconfig
+++ b/arch/arm26/Kconfig
@@ -183,6 +183,8 @@ source "mm/Kconfig"
183 183
184endmenu 184endmenu
185 185
186source "net/Kconfig"
187
186source "drivers/base/Kconfig" 188source "drivers/base/Kconfig"
187 189
188source "drivers/parport/Kconfig" 190source "drivers/parport/Kconfig"
@@ -193,7 +195,7 @@ source "drivers/block/Kconfig"
193 195
194source "drivers/md/Kconfig" 196source "drivers/md/Kconfig"
195 197
196source "net/Kconfig" 198source "drivers/net/Kconfig"
197 199
198source "drivers/ide/Kconfig" 200source "drivers/ide/Kconfig"
199 201
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index f848e37614..e5979d68e3 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -122,6 +122,8 @@ source arch/cris/arch-v10/Kconfig
122 122
123endmenu 123endmenu
124 124
125source "net/Kconfig"
126
125# bring in ETRAX built-in drivers 127# bring in ETRAX built-in drivers
126menu "Drivers for built-in interfaces" 128menu "Drivers for built-in interfaces"
127source arch/cris/arch-v10/drivers/Kconfig 129source arch/cris/arch-v10/drivers/Kconfig
@@ -149,7 +151,7 @@ source "drivers/ieee1394/Kconfig"
149 151
150source "drivers/message/i2o/Kconfig" 152source "drivers/message/i2o/Kconfig"
151 153
152source "net/Kconfig" 154source "drivers/net/Kconfig"
153 155
154source "drivers/isdn/Kconfig" 156source "drivers/isdn/Kconfig"
155 157
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index c93f95146c..ec85c0d6c6 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -346,6 +346,8 @@ source "fs/Kconfig.binfmt"
346 346
347endmenu 347endmenu
348 348
349source "net/Kconfig"
350
349source "drivers/Kconfig" 351source "drivers/Kconfig"
350 352
351source "fs/Kconfig" 353source "fs/Kconfig"
diff --git a/arch/frv/defconfig b/arch/frv/defconfig
new file mode 100644
index 0000000000..b6e4ca5efb
--- /dev/null
+++ b/arch/frv/defconfig
@@ -0,0 +1,627 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11.8
4# Fri May 13 17:16:03 2005
5#
6CONFIG_FRV=y
7CONFIG_UID16=y
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_FIND_NEXT_BIT=y
10# CONFIG_GENERIC_CALIBRATE_DELAY is not set
11# CONFIG_GENERIC_HARDIRQS is not set
12
13#
14# Code maturity level options
15#
16CONFIG_EXPERIMENTAL=y
17CONFIG_CLEAN_COMPILE=y
18CONFIG_BROKEN_ON_SMP=y
19CONFIG_INIT_ENV_ARG_LIMIT=32
20
21#
22# General setup
23#
24CONFIG_LOCALVERSION=""
25CONFIG_SWAP=y
26CONFIG_SYSVIPC=y
27CONFIG_POSIX_MQUEUE=y
28# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set
31# CONFIG_HOTPLUG is not set
32# CONFIG_KOBJECT_UEVENT is not set
33# CONFIG_IKCONFIG is not set
34CONFIG_EMBEDDED=y
35CONFIG_KALLSYMS=y
36# CONFIG_KALLSYMS_ALL is not set
37# CONFIG_KALLSYMS_EXTRA_PASS is not set
38CONFIG_PRINTK=y
39CONFIG_BUG=y
40CONFIG_BASE_FULL=y
41CONFIG_FUTEX=y
42CONFIG_EPOLL=y
43# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
44CONFIG_SHMEM=y
45CONFIG_CC_ALIGN_FUNCTIONS=0
46CONFIG_CC_ALIGN_LABELS=0
47CONFIG_CC_ALIGN_LOOPS=0
48CONFIG_CC_ALIGN_JUMPS=0
49# CONFIG_TINY_SHMEM is not set
50CONFIG_BASE_SMALL=0
51
52#
53# Loadable module support
54#
55# CONFIG_MODULES is not set
56
57#
58# Fujitsu FR-V system setup
59#
60CONFIG_MMU=y
61CONFIG_FRV_OUTOFLINE_ATOMIC_OPS=y
62CONFIG_HIGHMEM=y
63CONFIG_HIGHPTE=y
64CONFIG_SELECT_MEMORY_MODEL=y
65CONFIG_FLATMEM_MANUAL=y
66# CONFIG_DISCONTIGMEM_MANUAL is not set
67# CONFIG_SPARSEMEM_MANUAL is not set
68CONFIG_FLATMEM=y
69CONFIG_FLAT_NODE_MEM_MAP=y
70# CONFIG_FRV_DEFL_CACHE_WBACK is not set
71# CONFIG_FRV_DEFL_CACHE_WBEHIND is not set
72CONFIG_FRV_DEFL_CACHE_WTHRU=y
73# CONFIG_FRV_DEFL_CACHE_DISABLED is not set
74
75#
76# CPU core support
77#
78CONFIG_CPU_FR451=y
79CONFIG_CPU_FR451_COMPILE=y
80CONFIG_FRV_L1_CACHE_SHIFT=5
81CONFIG_MB93091_VDK=y
82# CONFIG_MB93093_PDK is not set
83CONFIG_MB93090_MB00=y
84# CONFIG_MB93091_NO_MB is not set
85# CONFIG_GPREL_DATA_8 is not set
86CONFIG_GPREL_DATA_4=y
87# CONFIG_GPREL_DATA_NONE is not set
88CONFIG_PCI=y
89# CONFIG_PCI_LEGACY_PROC is not set
90# CONFIG_PCI_NAMES is not set
91# CONFIG_PCI_DEBUG is not set
92# CONFIG_PCMCIA is not set
93
94#
95# Power management options
96#
97# CONFIG_PM is not set
98
99#
100# Executable formats
101#
102# CONFIG_BINFMT_ELF is not set
103CONFIG_BINFMT_ELF_FDPIC=y
104# CONFIG_BINFMT_MISC is not set
105
106#
107# Device Drivers
108#
109
110#
111# Generic Driver Options
112#
113# CONFIG_STANDALONE is not set
114# CONFIG_PREVENT_FIRMWARE_BUILD is not set
115# CONFIG_FW_LOADER is not set
116# CONFIG_DEBUG_DRIVER is not set
117
118#
119# Connector - unified userspace <-> kernelspace linker
120#
121# CONFIG_CONNECTOR is not set
122# CONFIG_FORK_CONNECTOR is not set
123
124#
125# Memory Technology Devices (MTD)
126#
127# CONFIG_MTD is not set
128
129#
130# Parallel port support
131#
132# CONFIG_PARPORT is not set
133
134#
135# Plug and Play support
136#
137
138#
139# Block devices
140#
141# CONFIG_BLK_DEV_FD is not set
142# CONFIG_BLK_CPQ_DA is not set
143# CONFIG_BLK_CPQ_CISS_DA is not set
144# CONFIG_BLK_DEV_DAC960 is not set
145# CONFIG_BLK_DEV_UMEM is not set
146# CONFIG_BLK_DEV_COW_COMMON is not set
147# CONFIG_BLK_DEV_LOOP is not set
148# CONFIG_BLK_DEV_NBD is not set
149# CONFIG_BLK_DEV_SX8 is not set
150# CONFIG_BLK_DEV_RAM is not set
151CONFIG_BLK_DEV_RAM_COUNT=16
152CONFIG_INITRAMFS_SOURCE=""
153# CONFIG_CDROM_PKTCDVD is not set
154
155#
156# IO Schedulers
157#
158CONFIG_IOSCHED_NOOP=y
159CONFIG_IOSCHED_AS=y
160CONFIG_IOSCHED_DEADLINE=y
161CONFIG_IOSCHED_CFQ=y
162# CONFIG_ATA_OVER_ETH is not set
163
164#
165# ATA/ATAPI/MFM/RLL support
166#
167# CONFIG_IDE is not set
168
169#
170# SCSI device support
171#
172# CONFIG_SCSI is not set
173
174#
175# Multi-device support (RAID and LVM)
176#
177# CONFIG_MD is not set
178
179#
180# Fusion MPT device support
181#
182# CONFIG_FUSION is not set
183
184#
185# IEEE 1394 (FireWire) support
186#
187# CONFIG_IEEE1394 is not set
188
189#
190# I2O device support
191#
192# CONFIG_I2O is not set
193
194#
195# Networking support
196#
197CONFIG_NET=y
198
199#
200# Networking options
201#
202CONFIG_PACKET=y
203# CONFIG_PACKET_MMAP is not set
204CONFIG_UNIX=y
205# CONFIG_NET_KEY is not set
206CONFIG_INET=y
207# CONFIG_IP_MULTICAST is not set
208# CONFIG_IP_ADVANCED_ROUTER is not set
209CONFIG_IP_PNP=y
210# CONFIG_IP_PNP_DHCP is not set
211# CONFIG_IP_PNP_BOOTP is not set
212# CONFIG_IP_PNP_RARP is not set
213# CONFIG_NET_IPIP is not set
214# CONFIG_NET_IPGRE is not set
215# CONFIG_ARPD is not set
216# CONFIG_SYN_COOKIES is not set
217# CONFIG_INET_AH is not set
218# CONFIG_INET_ESP is not set
219# CONFIG_INET_IPCOMP is not set
220# CONFIG_INET_TUNNEL is not set
221# CONFIG_IP_TCPDIAG is not set
222# CONFIG_IP_TCPDIAG_IPV6 is not set
223# CONFIG_IPV6 is not set
224# CONFIG_NETFILTER is not set
225
226#
227# SCTP Configuration (EXPERIMENTAL)
228#
229# CONFIG_IP_SCTP is not set
230# CONFIG_ATM is not set
231# CONFIG_BRIDGE is not set
232# CONFIG_VLAN_8021Q is not set
233# CONFIG_DECNET is not set
234# CONFIG_LLC2 is not set
235# CONFIG_IPX is not set
236# CONFIG_ATALK is not set
237# CONFIG_X25 is not set
238# CONFIG_LAPB is not set
239# CONFIG_NET_DIVERT is not set
240# CONFIG_ECONET is not set
241# CONFIG_WAN_ROUTER is not set
242
243#
244# QoS and/or fair queueing
245#
246# CONFIG_NET_SCHED is not set
247# CONFIG_NET_CLS_ROUTE is not set
248
249#
250# Network testing
251#
252# CONFIG_NET_PKTGEN is not set
253# CONFIG_KGDBOE is not set
254# CONFIG_NETPOLL is not set
255# CONFIG_NETPOLL_RX is not set
256# CONFIG_NETPOLL_TRAP is not set
257# CONFIG_NET_POLL_CONTROLLER is not set
258# CONFIG_HAMRADIO is not set
259# CONFIG_IRDA is not set
260# CONFIG_BT is not set
261# CONFIG_IEEE80211 is not set
262CONFIG_NETDEVICES=y
263# CONFIG_DUMMY is not set
264# CONFIG_BONDING is not set
265# CONFIG_EQUALIZER is not set
266# CONFIG_TUN is not set
267
268#
269# ARCnet devices
270#
271# CONFIG_ARCNET is not set
272
273#
274# Ethernet (10 or 100Mbit)
275#
276CONFIG_NET_ETHERNET=y
277CONFIG_MII=y
278# CONFIG_HAPPYMEAL is not set
279# CONFIG_SUNGEM is not set
280# CONFIG_NET_VENDOR_3COM is not set
281
282#
283# Tulip family network device support
284#
285# CONFIG_NET_TULIP is not set
286# CONFIG_HP100 is not set
287CONFIG_NET_PCI=y
288# CONFIG_PCNET32 is not set
289# CONFIG_AMD8111_ETH is not set
290# CONFIG_ADAPTEC_STARFIRE is not set
291# CONFIG_B44 is not set
292# CONFIG_FORCEDETH is not set
293# CONFIG_DGRS is not set
294# CONFIG_EEPRO100 is not set
295# CONFIG_E100 is not set
296# CONFIG_FEALNX is not set
297# CONFIG_NATSEMI is not set
298CONFIG_NE2K_PCI=y
299# CONFIG_8139CP is not set
300# CONFIG_8139TOO is not set
301# CONFIG_SIS900 is not set
302# CONFIG_EPIC100 is not set
303# CONFIG_SUNDANCE is not set
304# CONFIG_TLAN is not set
305# CONFIG_VIA_RHINE is not set
306
307#
308# Ethernet (1000 Mbit)
309#
310# CONFIG_ACENIC is not set
311# CONFIG_DL2K is not set
312# CONFIG_E1000 is not set
313# CONFIG_NS83820 is not set
314# CONFIG_HAMACHI is not set
315# CONFIG_YELLOWFIN is not set
316# CONFIG_R8169 is not set
317# CONFIG_SKGE is not set
318# CONFIG_SK98LIN is not set
319# CONFIG_VIA_VELOCITY is not set
320# CONFIG_TIGON3 is not set
321
322#
323# Ethernet (10000 Mbit)
324#
325# CONFIG_CHELSIO_T1 is not set
326# CONFIG_IXGB is not set
327# CONFIG_S2IO is not set
328
329#
330# Token Ring devices
331#
332# CONFIG_TR is not set
333
334#
335# Wireless LAN (non-hamradio)
336#
337# CONFIG_NET_RADIO is not set
338
339#
340# Wan interfaces
341#
342# CONFIG_WAN is not set
343# CONFIG_FDDI is not set
344# CONFIG_HIPPI is not set
345# CONFIG_PPP is not set
346# CONFIG_SLIP is not set
347# CONFIG_SHAPER is not set
348# CONFIG_NETCONSOLE is not set
349
350#
351# ISDN subsystem
352#
353# CONFIG_ISDN is not set
354
355#
356# Telephony Support
357#
358# CONFIG_PHONE is not set
359
360#
361# Input device support
362#
363# CONFIG_INPUT is not set
364
365#
366# Hardware I/O ports
367#
368# CONFIG_SERIO is not set
369# CONFIG_GAMEPORT is not set
370
371#
372# Character devices
373#
374# CONFIG_VT is not set
375# CONFIG_SERIAL_NONSTANDARD is not set
376
377#
378# Serial drivers
379#
380CONFIG_SERIAL_8250=y
381CONFIG_SERIAL_8250_CONSOLE=y
382CONFIG_SERIAL_8250_NR_UARTS=1
383CONFIG_SERIAL_8250_EXTENDED=y
384# CONFIG_SERIAL_8250_MANY_PORTS is not set
385CONFIG_SERIAL_8250_SHARE_IRQ=y
386# CONFIG_SERIAL_8250_DETECT_IRQ is not set
387# CONFIG_SERIAL_8250_MULTIPORT is not set
388# CONFIG_SERIAL_8250_RSA is not set
389
390#
391# Non-8250 serial port support
392#
393CONFIG_SERIAL_CORE=y
394CONFIG_SERIAL_CORE_CONSOLE=y
395# CONFIG_SERIAL_JSM is not set
396CONFIG_UNIX98_PTYS=y
397# CONFIG_LEGACY_PTYS is not set
398
399#
400# IPMI
401#
402# CONFIG_IPMI_HANDLER is not set
403
404#
405# Watchdog Cards
406#
407# CONFIG_WATCHDOG is not set
408# CONFIG_RTC is not set
409# CONFIG_GEN_RTC is not set
410# CONFIG_DTLK is not set
411# CONFIG_R3964 is not set
412# CONFIG_APPLICOM is not set
413
414#
415# Ftape, the floppy tape device driver
416#
417# CONFIG_DRM is not set
418# CONFIG_RAW_DRIVER is not set
419
420#
421# TPM devices
422#
423# CONFIG_TCG_TPM is not set
424
425#
426# I2C support
427#
428# CONFIG_I2C is not set
429
430#
431# Dallas's 1-wire bus
432#
433# CONFIG_W1 is not set
434
435#
436# Misc devices
437#
438
439#
440# Multimedia devices
441#
442# CONFIG_VIDEO_DEV is not set
443
444#
445# Digital Video Broadcasting Devices
446#
447# CONFIG_DVB is not set
448
449#
450# Graphics support
451#
452# CONFIG_FB is not set
453
454#
455# Sound
456#
457# CONFIG_SOUND is not set
458
459#
460# USB support
461#
462CONFIG_USB_ARCH_HAS_HCD=y
463CONFIG_USB_ARCH_HAS_OHCI=y
464# CONFIG_USB is not set
465
466#
467# USB Gadget Support
468#
469# CONFIG_USB_GADGET is not set
470
471#
472# MMC/SD Card support
473#
474# CONFIG_MMC is not set
475
476#
477# InfiniBand support
478#
479# CONFIG_INFINIBAND is not set
480
481#
482# File systems
483#
484# CONFIG_EXT2_FS is not set
485# CONFIG_EXT3_FS is not set
486# CONFIG_JBD is not set
487# CONFIG_REISER4_FS is not set
488# CONFIG_REISERFS_FS is not set
489# CONFIG_JFS_FS is not set
490
491#
492# XFS support
493#
494# CONFIG_XFS_FS is not set
495# CONFIG_MINIX_FS is not set
496# CONFIG_ROMFS_FS is not set
497CONFIG_INOTIFY=y
498# CONFIG_QUOTA is not set
499CONFIG_DNOTIFY=y
500# CONFIG_AUTOFS_FS is not set
501# CONFIG_AUTOFS4_FS is not set
502
503#
504# Caches
505#
506# CONFIG_FSCACHE is not set
507# CONFIG_FUSE_FS is not set
508
509#
510# CD-ROM/DVD Filesystems
511#
512# CONFIG_ISO9660_FS is not set
513# CONFIG_UDF_FS is not set
514
515#
516# DOS/FAT/NT Filesystems
517#
518# CONFIG_MSDOS_FS is not set
519# CONFIG_VFAT_FS is not set
520# CONFIG_NTFS_FS is not set
521
522#
523# Pseudo filesystems
524#
525CONFIG_PROC_FS=y
526# CONFIG_PROC_KCORE is not set
527CONFIG_SYSFS=y
528# CONFIG_DEVFS_FS is not set
529# CONFIG_DEVPTS_FS_XATTR is not set
530CONFIG_TMPFS=y
531# CONFIG_TMPFS_XATTR is not set
532# CONFIG_HUGETLB_PAGE is not set
533CONFIG_RAMFS=y
534# CONFIG_RELAYFS_FS is not set
535
536#
537# Miscellaneous filesystems
538#
539# CONFIG_ADFS_FS is not set
540# CONFIG_AFFS_FS is not set
541# CONFIG_HFS_FS is not set
542# CONFIG_HFSPLUS_FS is not set
543# CONFIG_BEFS_FS is not set
544# CONFIG_BFS_FS is not set
545# CONFIG_EFS_FS is not set
546# CONFIG_CRAMFS is not set
547# CONFIG_VXFS_FS is not set
548# CONFIG_HPFS_FS is not set
549# CONFIG_QNX4FS_FS is not set
550# CONFIG_SYSV_FS is not set
551# CONFIG_UFS_FS is not set
552
553#
554# Network File Systems
555#
556CONFIG_NFS_FS=y
557# CONFIG_NFS_V3 is not set
558# CONFIG_NFS_V4 is not set
559# CONFIG_NFS_DIRECTIO is not set
560# CONFIG_NFSD is not set
561CONFIG_ROOT_NFS=y
562CONFIG_LOCKD=y
563CONFIG_NFS_COMMON=y
564CONFIG_SUNRPC=y
565# CONFIG_RPCSEC_GSS_KRB5 is not set
566# CONFIG_RPCSEC_GSS_SPKM3 is not set
567# CONFIG_SMB_FS is not set
568# CONFIG_CIFS is not set
569# CONFIG_NCP_FS is not set
570# CONFIG_CODA_FS is not set
571# CONFIG_AFS_FS is not set
572
573#
574# Partition Types
575#
576# CONFIG_PARTITION_ADVANCED is not set
577CONFIG_MSDOS_PARTITION=y
578
579#
580# Native Language Support
581#
582# CONFIG_NLS is not set
583
584#
585# Kernel hacking
586#
587# CONFIG_PRINTK_TIME is not set
588CONFIG_DEBUG_KERNEL=y
589# CONFIG_MAGIC_SYSRQ is not set
590CONFIG_LOG_BUF_SHIFT=14
591CONFIG_DETECT_SOFTLOCKUP=y
592# CONFIG_SCHEDSTATS is not set
593# CONFIG_DEBUG_SLAB is not set
594# CONFIG_DEBUG_SPINLOCK is not set
595# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
596# CONFIG_DEBUG_KOBJECT is not set
597# CONFIG_DEBUG_HIGHMEM is not set
598# CONFIG_DEBUG_BUGVERBOSE is not set
599# CONFIG_DEBUG_INFO is not set
600# CONFIG_DEBUG_FS is not set
601# CONFIG_FRAME_POINTER is not set
602# CONFIG_EARLY_PRINTK is not set
603CONFIG_DEBUG_STACKOVERFLOW=y
604# CONFIG_DEBUG_PAGEALLOC is not set
605# CONFIG_GDBSTUB is not set
606
607#
608# Security options
609#
610# CONFIG_KEYS is not set
611# CONFIG_SECURITY is not set
612
613#
614# Cryptographic options
615#
616# CONFIG_CRYPTO is not set
617
618#
619# Hardware crypto devices
620#
621
622#
623# Library routines
624#
625# CONFIG_CRC_CCITT is not set
626CONFIG_CRC32=y
627# CONFIG_LIBCRC32C is not set
diff --git a/arch/frv/mb93090-mb00/pci-irq.c b/arch/frv/mb93090-mb00/pci-irq.c
index 24622d89b1..af981bda01 100644
--- a/arch/frv/mb93090-mb00/pci-irq.c
+++ b/arch/frv/mb93090-mb00/pci-irq.c
@@ -60,7 +60,7 @@ void __init pcibios_fixup_irqs(void)
60 } 60 }
61} 61}
62 62
63void __init pcibios_penalize_isa_irq(int irq) 63void __init pcibios_penalize_isa_irq(int irq, int active)
64{ 64{
65} 65}
66 66
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 62a89e812e..26698a49f1 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -55,6 +55,8 @@ source "fs/Kconfig.binfmt"
55 55
56endmenu 56endmenu
57 57
58source "net/Kconfig"
59
58source "drivers/base/Kconfig" 60source "drivers/base/Kconfig"
59 61
60source "drivers/mtd/Kconfig" 62source "drivers/mtd/Kconfig"
@@ -65,7 +67,7 @@ source "drivers/ide/Kconfig"
65 67
66source "arch/h8300/Kconfig.ide" 68source "arch/h8300/Kconfig.ide"
67 69
68source "net/Kconfig" 70source "drivers/net/Kconfig"
69 71
70# 72#
71# input - input/joystick depends on it. As does USB. 73# input - input/joystick depends on it. As does USB.
@@ -179,6 +181,8 @@ source "drivers/serial/Kconfig"
179 181
180source "drivers/i2c/Kconfig" 182source "drivers/i2c/Kconfig"
181 183
184source "drivers/hwmon/Kconfig"
185
182source "drivers/usb/Kconfig" 186source "drivers/usb/Kconfig"
183 187
184endmenu 188endmenu
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 6c02336fe2..a801d9d486 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -1285,6 +1285,8 @@ source "fs/Kconfig.binfmt"
1285 1285
1286endmenu 1286endmenu
1287 1287
1288source "net/Kconfig"
1289
1288source "drivers/Kconfig" 1290source "drivers/Kconfig"
1289 1291
1290source "fs/Kconfig" 1292source "fs/Kconfig"
diff --git a/arch/i386/kernel/acpi/Makefile b/arch/i386/kernel/acpi/Makefile
index ee75cb286c..5e291a20c0 100644
--- a/arch/i386/kernel/acpi/Makefile
+++ b/arch/i386/kernel/acpi/Makefile
@@ -2,3 +2,7 @@ obj-$(CONFIG_ACPI_BOOT) := boot.o
2obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o 2obj-$(CONFIG_X86_IO_APIC) += earlyquirk.o
3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o 3obj-$(CONFIG_ACPI_SLEEP) += sleep.o wakeup.o
4 4
5ifneq ($(CONFIG_ACPI_PROCESSOR),)
6obj-y += cstate.o
7endif
8
diff --git a/arch/i386/kernel/acpi/cstate.c b/arch/i386/kernel/acpi/cstate.c
new file mode 100644
index 0000000000..4c3036ba65
--- /dev/null
+++ b/arch/i386/kernel/acpi/cstate.c
@@ -0,0 +1,103 @@
1/*
2 * arch/i386/kernel/acpi/cstate.c
3 *
4 * Copyright (C) 2005 Intel Corporation
5 * Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
6 * - Added _PDC for SMP C-states on Intel CPUs
7 */
8
9#include <linux/kernel.h>
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/acpi.h>
13
14#include <acpi/processor.h>
15#include <asm/acpi.h>
16
17static void acpi_processor_power_init_intel_pdc(struct acpi_processor_power
18 *pow)
19{
20 struct acpi_object_list *obj_list;
21 union acpi_object *obj;
22 u32 *buf;
23
24 /* allocate and initialize pdc. It will be used later. */
25 obj_list = kmalloc(sizeof(struct acpi_object_list), GFP_KERNEL);
26 if (!obj_list) {
27 printk(KERN_ERR "Memory allocation error\n");
28 return;
29 }
30
31 obj = kmalloc(sizeof(union acpi_object), GFP_KERNEL);
32 if (!obj) {
33 printk(KERN_ERR "Memory allocation error\n");
34 kfree(obj_list);
35 return;
36 }
37
38 buf = kmalloc(12, GFP_KERNEL);
39 if (!buf) {
40 printk(KERN_ERR "Memory allocation error\n");
41 kfree(obj);
42 kfree(obj_list);
43 return;
44 }
45
46 buf[0] = ACPI_PDC_REVISION_ID;
47 buf[1] = 1;
48 buf[2] = ACPI_PDC_C_CAPABILITY_SMP;
49
50 obj->type = ACPI_TYPE_BUFFER;
51 obj->buffer.length = 12;
52 obj->buffer.pointer = (u8 *) buf;
53 obj_list->count = 1;
54 obj_list->pointer = obj;
55 pow->pdc = obj_list;
56
57 return;
58}
59
60/* Initialize _PDC data based on the CPU vendor */
61void acpi_processor_power_init_pdc(struct acpi_processor_power *pow,
62 unsigned int cpu)
63{
64 struct cpuinfo_x86 *c = cpu_data + cpu;
65
66 pow->pdc = NULL;
67 if (c->x86_vendor == X86_VENDOR_INTEL)
68 acpi_processor_power_init_intel_pdc(pow);
69
70 return;
71}
72
73EXPORT_SYMBOL(acpi_processor_power_init_pdc);
74
75/*
76 * Initialize bm_flags based on the CPU cache properties
77 * On SMP it depends on cache configuration
78 * - When cache is not shared among all CPUs, we flush cache
79 * before entering C3.
80 * - When cache is shared among all CPUs, we use bm_check
81 * mechanism as in UP case
82 *
83 * This routine is called only after all the CPUs are online
84 */
85void acpi_processor_power_init_bm_check(struct acpi_processor_flags *flags,
86 unsigned int cpu)
87{
88 struct cpuinfo_x86 *c = cpu_data + cpu;
89
90 flags->bm_check = 0;
91 if (num_online_cpus() == 1)
92 flags->bm_check = 1;
93 else if (c->x86_vendor == X86_VENDOR_INTEL) {
94 /*
95 * Today all CPUs that support C3 share cache.
96 * TBD: This needs to look at cache shared map, once
97 * multi-core detection patch makes to the base.
98 */
99 flags->bm_check = 1;
100 }
101}
102
103EXPORT_SYMBOL(acpi_processor_power_init_bm_check);
diff --git a/arch/i386/kernel/acpi/wakeup.S b/arch/i386/kernel/acpi/wakeup.S
index 39d32484f6..44d886c745 100644
--- a/arch/i386/kernel/acpi/wakeup.S
+++ b/arch/i386/kernel/acpi/wakeup.S
@@ -74,8 +74,9 @@ wakeup_code:
74 movw %ax,%fs 74 movw %ax,%fs
75 movw $0x0e00 + 'i', %fs:(0x12) 75 movw $0x0e00 + 'i', %fs:(0x12)
76 76
77 # need a gdt 77 # need a gdt -- use lgdtl to force 32-bit operands, in case
78 lgdt real_save_gdt - wakeup_code 78 # the GDT is located past 16 megabytes.
79 lgdtl real_save_gdt - wakeup_code
79 80
80 movl real_save_cr0 - wakeup_code, %eax 81 movl real_save_cr0 - wakeup_code, %eax
81 movl %eax, %cr0 82 movl %eax, %cr0
diff --git a/arch/i386/kernel/cpu/common.c b/arch/i386/kernel/cpu/common.c
index 2203a9d202..4553ffd94b 100644
--- a/arch/i386/kernel/cpu/common.c
+++ b/arch/i386/kernel/cpu/common.c
@@ -435,6 +435,11 @@ void __devinit identify_cpu(struct cpuinfo_x86 *c)
435 if (c == &boot_cpu_data) 435 if (c == &boot_cpu_data)
436 sysenter_setup(); 436 sysenter_setup();
437 enable_sep_cpu(); 437 enable_sep_cpu();
438
439 if (c == &boot_cpu_data)
440 mtrr_bp_init();
441 else
442 mtrr_ap_init();
438} 443}
439 444
440#ifdef CONFIG_X86_HT 445#ifdef CONFIG_X86_HT
diff --git a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
index 1a49adb1f4..e86ea486c3 100644
--- a/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
+++ b/arch/i386/kernel/cpu/cpufreq/gx-suspmod.c
@@ -190,7 +190,7 @@ static __init struct pci_dev *gx_detect_chipset(void)
190 190
191 /* detect which companion chip is used */ 191 /* detect which companion chip is used */
192 while ((gx_pci = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, gx_pci)) != NULL) { 192 while ((gx_pci = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, gx_pci)) != NULL) {
193 if ((pci_match_device (gx_chipset_tbl, gx_pci)) != NULL) { 193 if ((pci_match_id(gx_chipset_tbl, gx_pci)) != NULL) {
194 return gx_pci; 194 return gx_pci;
195 } 195 }
196 } 196 }
diff --git a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
index 7dcbf70fc1..327a55d4d1 100644
--- a/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/i386/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -375,7 +375,7 @@ static int centrino_cpu_init_acpi(struct cpufreq_policy *policy)
375 arg0.buffer.pointer = (u8 *) arg0_buf; 375 arg0.buffer.pointer = (u8 *) arg0_buf;
376 arg0_buf[0] = ACPI_PDC_REVISION_ID; 376 arg0_buf[0] = ACPI_PDC_REVISION_ID;
377 arg0_buf[1] = 1; 377 arg0_buf[1] = 1;
378 arg0_buf[2] = ACPI_PDC_EST_CAPABILITY_SMP | ACPI_PDC_EST_CAPABILITY_MSR; 378 arg0_buf[2] = ACPI_PDC_EST_CAPABILITY_SMP_MSR;
379 379
380 p.pdc = &arg_list; 380 p.pdc = &arg_list;
381 381
diff --git a/arch/i386/kernel/cpu/intel.c b/arch/i386/kernel/cpu/intel.c
index 96a75d0458..a2c33c1a46 100644
--- a/arch/i386/kernel/cpu/intel.c
+++ b/arch/i386/kernel/cpu/intel.c
@@ -25,7 +25,7 @@ extern int trap_init_f00f_bug(void);
25/* 25/*
26 * Alignment at which movsl is preferred for bulk memory copies. 26 * Alignment at which movsl is preferred for bulk memory copies.
27 */ 27 */
28struct movsl_mask movsl_mask; 28struct movsl_mask movsl_mask __read_mostly;
29#endif 29#endif
30 30
31void __devinit early_intel_workaround(struct cpuinfo_x86 *c) 31void __devinit early_intel_workaround(struct cpuinfo_x86 *c)
diff --git a/arch/i386/kernel/cpu/mtrr/generic.c b/arch/i386/kernel/cpu/mtrr/generic.c
index 64d91f73a0..169ac8e0db 100644
--- a/arch/i386/kernel/cpu/mtrr/generic.c
+++ b/arch/i386/kernel/cpu/mtrr/generic.c
@@ -67,13 +67,6 @@ void __init get_mtrr_state(void)
67 mtrr_state.enabled = (lo & 0xc00) >> 10; 67 mtrr_state.enabled = (lo & 0xc00) >> 10;
68} 68}
69 69
70/* Free resources associated with a struct mtrr_state */
71void __init finalize_mtrr_state(void)
72{
73 kfree(mtrr_state.var_ranges);
74 mtrr_state.var_ranges = NULL;
75}
76
77/* Some BIOS's are fucked and don't set all MTRRs the same! */ 70/* Some BIOS's are fucked and don't set all MTRRs the same! */
78void __init mtrr_state_warn(void) 71void __init mtrr_state_warn(void)
79{ 72{
@@ -334,6 +327,9 @@ static void generic_set_mtrr(unsigned int reg, unsigned long base,
334*/ 327*/
335{ 328{
336 unsigned long flags; 329 unsigned long flags;
330 struct mtrr_var_range *vr;
331
332 vr = &mtrr_state.var_ranges[reg];
337 333
338 local_irq_save(flags); 334 local_irq_save(flags);
339 prepare_set(); 335 prepare_set();
@@ -342,11 +338,15 @@ static void generic_set_mtrr(unsigned int reg, unsigned long base,
342 /* The invalid bit is kept in the mask, so we simply clear the 338 /* The invalid bit is kept in the mask, so we simply clear the
343 relevant mask register to disable a range. */ 339 relevant mask register to disable a range. */
344 mtrr_wrmsr(MTRRphysMask_MSR(reg), 0, 0); 340 mtrr_wrmsr(MTRRphysMask_MSR(reg), 0, 0);
341 memset(vr, 0, sizeof(struct mtrr_var_range));
345 } else { 342 } else {
346 mtrr_wrmsr(MTRRphysBase_MSR(reg), base << PAGE_SHIFT | type, 343 vr->base_lo = base << PAGE_SHIFT | type;
347 (base & size_and_mask) >> (32 - PAGE_SHIFT)); 344 vr->base_hi = (base & size_and_mask) >> (32 - PAGE_SHIFT);
348 mtrr_wrmsr(MTRRphysMask_MSR(reg), -size << PAGE_SHIFT | 0x800, 345 vr->mask_lo = -size << PAGE_SHIFT | 0x800;
349 (-size & size_and_mask) >> (32 - PAGE_SHIFT)); 346 vr->mask_hi = (-size & size_and_mask) >> (32 - PAGE_SHIFT);
347
348 mtrr_wrmsr(MTRRphysBase_MSR(reg), vr->base_lo, vr->base_hi);
349 mtrr_wrmsr(MTRRphysMask_MSR(reg), vr->mask_lo, vr->mask_hi);
350 } 350 }
351 351
352 post_set(); 352 post_set();
diff --git a/arch/i386/kernel/cpu/mtrr/main.c b/arch/i386/kernel/cpu/mtrr/main.c
index d66b09e0c8..764cac64e2 100644
--- a/arch/i386/kernel/cpu/mtrr/main.c
+++ b/arch/i386/kernel/cpu/mtrr/main.c
@@ -332,6 +332,8 @@ int mtrr_add_page(unsigned long base, unsigned long size,
332 332
333 error = -EINVAL; 333 error = -EINVAL;
334 334
335 /* No CPU hotplug when we change MTRR entries */
336 lock_cpu_hotplug();
335 /* Search for existing MTRR */ 337 /* Search for existing MTRR */
336 down(&main_lock); 338 down(&main_lock);
337 for (i = 0; i < num_var_ranges; ++i) { 339 for (i = 0; i < num_var_ranges; ++i) {
@@ -372,6 +374,7 @@ int mtrr_add_page(unsigned long base, unsigned long size,
372 error = i; 374 error = i;
373 out: 375 out:
374 up(&main_lock); 376 up(&main_lock);
377 unlock_cpu_hotplug();
375 return error; 378 return error;
376} 379}
377 380
@@ -461,6 +464,8 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
461 return -ENXIO; 464 return -ENXIO;
462 465
463 max = num_var_ranges; 466 max = num_var_ranges;
467 /* No CPU hotplug when we change MTRR entries */
468 lock_cpu_hotplug();
464 down(&main_lock); 469 down(&main_lock);
465 if (reg < 0) { 470 if (reg < 0) {
466 /* Search for existing MTRR */ 471 /* Search for existing MTRR */
@@ -501,6 +506,7 @@ int mtrr_del_page(int reg, unsigned long base, unsigned long size)
501 error = reg; 506 error = reg;
502 out: 507 out:
503 up(&main_lock); 508 up(&main_lock);
509 unlock_cpu_hotplug();
504 return error; 510 return error;
505} 511}
506/** 512/**
@@ -544,21 +550,9 @@ static void __init init_ifs(void)
544 centaur_init_mtrr(); 550 centaur_init_mtrr();
545} 551}
546 552
547static void __init init_other_cpus(void) 553/* The suspend/resume methods are only for CPU without MTRR. CPU using generic
548{ 554 * MTRR driver doesn't require this
549 if (use_intel()) 555 */
550 get_mtrr_state();
551
552 /* bring up the other processors */
553 set_mtrr(~0U,0,0,0);
554
555 if (use_intel()) {
556 finalize_mtrr_state();
557 mtrr_state_warn();
558 }
559}
560
561
562struct mtrr_value { 556struct mtrr_value {
563 mtrr_type ltype; 557 mtrr_type ltype;
564 unsigned long lbase; 558 unsigned long lbase;
@@ -611,13 +605,13 @@ static struct sysdev_driver mtrr_sysdev_driver = {
611 605
612 606
613/** 607/**
614 * mtrr_init - initialize mtrrs on the boot CPU 608 * mtrr_bp_init - initialize mtrrs on the boot CPU
615 * 609 *
616 * This needs to be called early; before any of the other CPUs are 610 * This needs to be called early; before any of the other CPUs are
617 * initialized (i.e. before smp_init()). 611 * initialized (i.e. before smp_init()).
618 * 612 *
619 */ 613 */
620static int __init mtrr_init(void) 614void __init mtrr_bp_init(void)
621{ 615{
622 init_ifs(); 616 init_ifs();
623 617
@@ -674,12 +668,48 @@ static int __init mtrr_init(void)
674 if (mtrr_if) { 668 if (mtrr_if) {
675 set_num_var_ranges(); 669 set_num_var_ranges();
676 init_table(); 670 init_table();
677 init_other_cpus(); 671 if (use_intel())
678 672 get_mtrr_state();
679 return sysdev_driver_register(&cpu_sysdev_class,
680 &mtrr_sysdev_driver);
681 } 673 }
682 return -ENXIO;
683} 674}
684 675
685subsys_initcall(mtrr_init); 676void mtrr_ap_init(void)
677{
678 unsigned long flags;
679
680 if (!mtrr_if || !use_intel())
681 return;
682 /*
683 * Ideally we should hold main_lock here to avoid mtrr entries changed,
684 * but this routine will be called in cpu boot time, holding the lock
685 * breaks it. This routine is called in two cases: 1.very earily time
686 * of software resume, when there absolutely isn't mtrr entry changes;
687 * 2.cpu hotadd time. We let mtrr_add/del_page hold cpuhotplug lock to
688 * prevent mtrr entry changes
689 */
690 local_irq_save(flags);
691
692 mtrr_if->set_all();
693
694 local_irq_restore(flags);
695}
696
697static int __init mtrr_init_finialize(void)
698{
699 if (!mtrr_if)
700 return 0;
701 if (use_intel())
702 mtrr_state_warn();
703 else {
704 /* The CPUs haven't MTRR and seemes not support SMP. They have
705 * specific drivers, we use a tricky method to support
706 * suspend/resume for them.
707 * TBD: is there any system with such CPU which supports
708 * suspend/resume? if no, we should remove the code.
709 */
710 sysdev_driver_register(&cpu_sysdev_class,
711 &mtrr_sysdev_driver);
712 }
713 return 0;
714}
715subsys_initcall(mtrr_init_finialize);
diff --git a/arch/i386/kernel/cpu/mtrr/mtrr.h b/arch/i386/kernel/cpu/mtrr/mtrr.h
index de13512455..99c9f26820 100644
--- a/arch/i386/kernel/cpu/mtrr/mtrr.h
+++ b/arch/i386/kernel/cpu/mtrr/mtrr.h
@@ -91,7 +91,6 @@ extern struct mtrr_ops * mtrr_if;
91 91
92extern unsigned int num_var_ranges; 92extern unsigned int num_var_ranges;
93 93
94void finalize_mtrr_state(void);
95void mtrr_state_warn(void); 94void mtrr_state_warn(void);
96char *mtrr_attrib_to_str(int x); 95char *mtrr_attrib_to_str(int x);
97void mtrr_wrmsr(unsigned, unsigned, unsigned); 96void mtrr_wrmsr(unsigned, unsigned, unsigned);
diff --git a/arch/i386/kernel/kprobes.c b/arch/i386/kernel/kprobes.c
index fc8b175217..a6d8c45961 100644
--- a/arch/i386/kernel/kprobes.c
+++ b/arch/i386/kernel/kprobes.c
@@ -537,7 +537,7 @@ static struct kprobe trampoline_p = {
537 .pre_handler = trampoline_probe_handler 537 .pre_handler = trampoline_probe_handler
538}; 538};
539 539
540int __init arch_init(void) 540int __init arch_init_kprobes(void)
541{ 541{
542 return register_kprobe(&trampoline_p); 542 return register_kprobe(&trampoline_p);
543} 543}
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c
index d66bf489a2..8ac8e9fd56 100644
--- a/arch/i386/kernel/smpboot.c
+++ b/arch/i386/kernel/smpboot.c
@@ -68,21 +68,21 @@ EXPORT_SYMBOL(smp_num_siblings);
68#endif 68#endif
69 69
70/* Package ID of each logical CPU */ 70/* Package ID of each logical CPU */
71int phys_proc_id[NR_CPUS] = {[0 ... NR_CPUS-1] = BAD_APICID}; 71int phys_proc_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID};
72EXPORT_SYMBOL(phys_proc_id); 72EXPORT_SYMBOL(phys_proc_id);
73 73
74/* Core ID of each logical CPU */ 74/* Core ID of each logical CPU */
75int cpu_core_id[NR_CPUS] = {[0 ... NR_CPUS-1] = BAD_APICID}; 75int cpu_core_id[NR_CPUS] __read_mostly = {[0 ... NR_CPUS-1] = BAD_APICID};
76EXPORT_SYMBOL(cpu_core_id); 76EXPORT_SYMBOL(cpu_core_id);
77 77
78cpumask_t cpu_sibling_map[NR_CPUS]; 78cpumask_t cpu_sibling_map[NR_CPUS] __read_mostly;
79EXPORT_SYMBOL(cpu_sibling_map); 79EXPORT_SYMBOL(cpu_sibling_map);
80 80
81cpumask_t cpu_core_map[NR_CPUS]; 81cpumask_t cpu_core_map[NR_CPUS] __read_mostly;
82EXPORT_SYMBOL(cpu_core_map); 82EXPORT_SYMBOL(cpu_core_map);
83 83
84/* bitmap of online cpus */ 84/* bitmap of online cpus */
85cpumask_t cpu_online_map; 85cpumask_t cpu_online_map __read_mostly;
86EXPORT_SYMBOL(cpu_online_map); 86EXPORT_SYMBOL(cpu_online_map);
87 87
88cpumask_t cpu_callin_map; 88cpumask_t cpu_callin_map;
@@ -100,7 +100,7 @@ static int __devinitdata tsc_sync_disabled;
100struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; 100struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
101EXPORT_SYMBOL(cpu_data); 101EXPORT_SYMBOL(cpu_data);
102 102
103u8 x86_cpu_to_apicid[NR_CPUS] = 103u8 x86_cpu_to_apicid[NR_CPUS] __read_mostly =
104 { [0 ... NR_CPUS-1] = 0xff }; 104 { [0 ... NR_CPUS-1] = 0xff };
105EXPORT_SYMBOL(x86_cpu_to_apicid); 105EXPORT_SYMBOL(x86_cpu_to_apicid);
106 106
@@ -550,10 +550,10 @@ extern struct {
550#ifdef CONFIG_NUMA 550#ifdef CONFIG_NUMA
551 551
552/* which logical CPUs are on which nodes */ 552/* which logical CPUs are on which nodes */
553cpumask_t node_2_cpu_mask[MAX_NUMNODES] = 553cpumask_t node_2_cpu_mask[MAX_NUMNODES] __read_mostly =
554 { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE }; 554 { [0 ... MAX_NUMNODES-1] = CPU_MASK_NONE };
555/* which node each logical CPU is on */ 555/* which node each logical CPU is on */
556int cpu_2_node[NR_CPUS] = { [0 ... NR_CPUS-1] = 0 }; 556int cpu_2_node[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = 0 };
557EXPORT_SYMBOL(cpu_2_node); 557EXPORT_SYMBOL(cpu_2_node);
558 558
559/* set up a mapping between cpu and node. */ 559/* set up a mapping between cpu and node. */
@@ -581,7 +581,7 @@ static inline void unmap_cpu_to_node(int cpu)
581 581
582#endif /* CONFIG_NUMA */ 582#endif /* CONFIG_NUMA */
583 583
584u8 cpu_2_logical_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID }; 584u8 cpu_2_logical_apicid[NR_CPUS] __read_mostly = { [0 ... NR_CPUS-1] = BAD_APICID };
585 585
586static void map_cpu_to_logical_apicid(void) 586static void map_cpu_to_logical_apicid(void)
587{ 587{
diff --git a/arch/i386/kernel/syscall_table.S b/arch/i386/kernel/syscall_table.S
index 3db9a04aec..468500a7e8 100644
--- a/arch/i386/kernel/syscall_table.S
+++ b/arch/i386/kernel/syscall_table.S
@@ -291,3 +291,6 @@ ENTRY(sys_call_table)
291 .long sys_keyctl 291 .long sys_keyctl
292 .long sys_ioprio_set 292 .long sys_ioprio_set
293 .long sys_ioprio_get /* 290 */ 293 .long sys_ioprio_get /* 290 */
294 .long sys_inotify_init
295 .long sys_inotify_add_watch
296 .long sys_inotify_rm_watch
diff --git a/arch/i386/kernel/time.c b/arch/i386/kernel/time.c
index 2854c35737..0ee9dee8af 100644
--- a/arch/i386/kernel/time.c
+++ b/arch/i386/kernel/time.c
@@ -91,7 +91,7 @@ EXPORT_SYMBOL(rtc_lock);
91DEFINE_SPINLOCK(i8253_lock); 91DEFINE_SPINLOCK(i8253_lock);
92EXPORT_SYMBOL(i8253_lock); 92EXPORT_SYMBOL(i8253_lock);
93 93
94struct timer_opts *cur_timer = &timer_none; 94struct timer_opts *cur_timer __read_mostly = &timer_none;
95 95
96/* 96/*
97 * This is a special lock that is owned by the CPU and holds the index 97 * This is a special lock that is owned by the CPU and holds the index
diff --git a/arch/i386/kernel/timers/timer_hpet.c b/arch/i386/kernel/timers/timer_hpet.c
index d766e0963a..ef8dac5dd3 100644
--- a/arch/i386/kernel/timers/timer_hpet.c
+++ b/arch/i386/kernel/timers/timer_hpet.c
@@ -18,7 +18,7 @@
18#include "mach_timer.h" 18#include "mach_timer.h"
19#include <asm/hpet.h> 19#include <asm/hpet.h>
20 20
21static unsigned long hpet_usec_quotient; /* convert hpet clks to usec */ 21static unsigned long __read_mostly hpet_usec_quotient; /* convert hpet clks to usec */
22static unsigned long tsc_hpet_quotient; /* convert tsc to hpet clks */ 22static unsigned long tsc_hpet_quotient; /* convert tsc to hpet clks */
23static unsigned long hpet_last; /* hpet counter value at last tick*/ 23static unsigned long hpet_last; /* hpet counter value at last tick*/
24static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */ 24static unsigned long last_tsc_low; /* lsb 32 bits of Time Stamp Counter */
@@ -180,7 +180,7 @@ static int __init init_hpet(char* override)
180/************************************************************/ 180/************************************************************/
181 181
182/* tsc timer_opts struct */ 182/* tsc timer_opts struct */
183static struct timer_opts timer_hpet = { 183static struct timer_opts timer_hpet __read_mostly = {
184 .name = "hpet", 184 .name = "hpet",
185 .mark_offset = mark_offset_hpet, 185 .mark_offset = mark_offset_hpet,
186 .get_offset = get_offset_hpet, 186 .get_offset = get_offset_hpet,
diff --git a/arch/i386/kernel/vmlinux.lds.S b/arch/i386/kernel/vmlinux.lds.S
index 7e01a528a8..761972f8cb 100644
--- a/arch/i386/kernel/vmlinux.lds.S
+++ b/arch/i386/kernel/vmlinux.lds.S
@@ -57,6 +57,9 @@ SECTIONS
57 *(.data.cacheline_aligned) 57 *(.data.cacheline_aligned)
58 } 58 }
59 59
60 /* rarely changed data like cpu maps */
61 . = ALIGN(32);
62 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) { *(.data.read_mostly) }
60 _edata = .; /* End of data section */ 63 _edata = .; /* End of data section */
61 64
62 . = ALIGN(THREAD_SIZE); /* init_task */ 65 . = ALIGN(THREAD_SIZE); /* init_task */
diff --git a/arch/i386/mach-voyager/voyager_basic.c b/arch/i386/mach-voyager/voyager_basic.c
index 3e439ce5e1..8680080a6a 100644
--- a/arch/i386/mach-voyager/voyager_basic.c
+++ b/arch/i386/mach-voyager/voyager_basic.c
@@ -36,6 +36,7 @@
36 * Power off function, if any 36 * Power off function, if any
37 */ 37 */
38void (*pm_power_off)(void); 38void (*pm_power_off)(void);
39EXPORT_SYMBOL(pm_power_off);
39 40
40int voyager_level = 0; 41int voyager_level = 0;
41 42
diff --git a/arch/i386/mach-voyager/voyager_smp.c b/arch/i386/mach-voyager/voyager_smp.c
index 8c8527593d..0e1f4208b0 100644
--- a/arch/i386/mach-voyager/voyager_smp.c
+++ b/arch/i386/mach-voyager/voyager_smp.c
@@ -10,6 +10,7 @@
10 * the voyager hal to provide the functionality 10 * the voyager hal to provide the functionality
11 */ 11 */
12#include <linux/config.h> 12#include <linux/config.h>
13#include <linux/module.h>
13#include <linux/mm.h> 14#include <linux/mm.h>
14#include <linux/kernel_stat.h> 15#include <linux/kernel_stat.h>
15#include <linux/delay.h> 16#include <linux/delay.h>
@@ -40,6 +41,7 @@ static unsigned long cpu_irq_affinity[NR_CPUS] __cacheline_aligned = { [0 ... NR
40/* per CPU data structure (for /proc/cpuinfo et al), visible externally 41/* per CPU data structure (for /proc/cpuinfo et al), visible externally
41 * indexed physically */ 42 * indexed physically */
42struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned; 43struct cpuinfo_x86 cpu_data[NR_CPUS] __cacheline_aligned;
44EXPORT_SYMBOL(cpu_data);
43 45
44/* physical ID of the CPU used to boot the system */ 46/* physical ID of the CPU used to boot the system */
45unsigned char boot_cpu_id; 47unsigned char boot_cpu_id;
@@ -72,6 +74,7 @@ static volatile unsigned long smp_invalidate_needed;
72/* Bitmask of currently online CPUs - used by setup.c for 74/* Bitmask of currently online CPUs - used by setup.c for
73 /proc/cpuinfo, visible externally but still physical */ 75 /proc/cpuinfo, visible externally but still physical */
74cpumask_t cpu_online_map = CPU_MASK_NONE; 76cpumask_t cpu_online_map = CPU_MASK_NONE;
77EXPORT_SYMBOL(cpu_online_map);
75 78
76/* Bitmask of CPUs present in the system - exported by i386_syms.c, used 79/* Bitmask of CPUs present in the system - exported by i386_syms.c, used
77 * by scheduler but indexed physically */ 80 * by scheduler but indexed physically */
@@ -238,6 +241,7 @@ static cpumask_t smp_commenced_mask = CPU_MASK_NONE;
238/* This is for the new dynamic CPU boot code */ 241/* This is for the new dynamic CPU boot code */
239cpumask_t cpu_callin_map = CPU_MASK_NONE; 242cpumask_t cpu_callin_map = CPU_MASK_NONE;
240cpumask_t cpu_callout_map = CPU_MASK_NONE; 243cpumask_t cpu_callout_map = CPU_MASK_NONE;
244EXPORT_SYMBOL(cpu_callout_map);
241 245
242/* The per processor IRQ masks (these are usually kept in sync) */ 246/* The per processor IRQ masks (these are usually kept in sync) */
243static __u16 vic_irq_mask[NR_CPUS] __cacheline_aligned; 247static __u16 vic_irq_mask[NR_CPUS] __cacheline_aligned;
@@ -978,6 +982,7 @@ void flush_tlb_page(struct vm_area_struct * vma, unsigned long va)
978 982
979 preempt_enable(); 983 preempt_enable();
980} 984}
985EXPORT_SYMBOL(flush_tlb_page);
981 986
982/* enable the requested IRQs */ 987/* enable the requested IRQs */
983static void 988static void
@@ -1109,6 +1114,7 @@ smp_call_function (void (*func) (void *info), void *info, int retry,
1109 1114
1110 return 0; 1115 return 0;
1111} 1116}
1117EXPORT_SYMBOL(smp_call_function);
1112 1118
1113/* Sorry about the name. In an APIC based system, the APICs 1119/* Sorry about the name. In an APIC based system, the APICs
1114 * themselves are programmed to send a timer interrupt. This is used 1120 * themselves are programmed to send a timer interrupt. This is used
diff --git a/arch/i386/mm/ioremap.c b/arch/i386/mm/ioremap.c
index 6b25afc933..f379b8d675 100644
--- a/arch/i386/mm/ioremap.c
+++ b/arch/i386/mm/ioremap.c
@@ -228,7 +228,8 @@ EXPORT_SYMBOL(ioremap_nocache);
228void iounmap(volatile void __iomem *addr) 228void iounmap(volatile void __iomem *addr)
229{ 229{
230 struct vm_struct *p; 230 struct vm_struct *p;
231 if ((void __force *) addr <= high_memory) 231
232 if ((void __force *)addr <= high_memory)
232 return; 233 return;
233 234
234 /* 235 /*
@@ -241,9 +242,10 @@ void iounmap(volatile void __iomem *addr)
241 return; 242 return;
242 243
243 write_lock(&vmlist_lock); 244 write_lock(&vmlist_lock);
244 p = __remove_vm_area((void *) (PAGE_MASK & (unsigned long __force) addr)); 245 p = __remove_vm_area((void *)(PAGE_MASK & (unsigned long __force)addr));
245 if (!p) { 246 if (!p) {
246 printk(KERN_WARNING "iounmap: bad address %p\n", addr); 247 printk(KERN_WARNING "iounmap: bad address %p\n", addr);
248 dump_stack();
247 goto out_unlock; 249 goto out_unlock;
248 } 250 }
249 251
diff --git a/arch/i386/pci/common.c b/arch/i386/pci/common.c
index 87325263cd..70bcd53451 100644
--- a/arch/i386/pci/common.c
+++ b/arch/i386/pci/common.c
@@ -165,6 +165,7 @@ static int __init pcibios_init(void)
165 if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT)) 165 if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT))
166 pcibios_sort(); 166 pcibios_sort();
167#endif 167#endif
168 pci_assign_unassigned_resources();
168 return 0; 169 return 0;
169} 170}
170 171
diff --git a/arch/i386/pci/i386.c b/arch/i386/pci/i386.c
index c205ea7e23..93a364c821 100644
--- a/arch/i386/pci/i386.c
+++ b/arch/i386/pci/i386.c
@@ -106,11 +106,16 @@ static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
106 if ((dev = bus->self)) { 106 if ((dev = bus->self)) {
107 for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) { 107 for (idx = PCI_BRIDGE_RESOURCES; idx < PCI_NUM_RESOURCES; idx++) {
108 r = &dev->resource[idx]; 108 r = &dev->resource[idx];
109 if (!r->start) 109 if (!r->flags)
110 continue; 110 continue;
111 pr = pci_find_parent_resource(dev, r); 111 pr = pci_find_parent_resource(dev, r);
112 if (!pr || request_resource(pr, r) < 0) 112 if (!r->start || !pr || request_resource(pr, r) < 0) {
113 printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, pci_name(dev)); 113 printk(KERN_ERR "PCI: Cannot allocate resource region %d of bridge %s\n", idx, pci_name(dev));
114 /* Something is wrong with the region.
115 Invalidate the resource to prevent child
116 resource allocations in this range. */
117 r->flags = 0;
118 }
114 } 119 }
115 } 120 }
116 pcibios_allocate_bus_resources(&bus->children); 121 pcibios_allocate_bus_resources(&bus->children);
@@ -227,7 +232,7 @@ int pcibios_enable_resources(struct pci_dev *dev, int mask)
227 232
228 pci_read_config_word(dev, PCI_COMMAND, &cmd); 233 pci_read_config_word(dev, PCI_COMMAND, &cmd);
229 old_cmd = cmd; 234 old_cmd = cmd;
230 for(idx=0; idx<6; idx++) { 235 for(idx = 0; idx < PCI_NUM_RESOURCES; idx++) {
231 /* Only set up the requested stuff */ 236 /* Only set up the requested stuff */
232 if (!(mask & (1<<idx))) 237 if (!(mask & (1<<idx)))
233 continue; 238 continue;
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index 78ca1ecbb9..766b104ac1 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -1051,24 +1051,28 @@ static int __init pcibios_irq_init(void)
1051subsys_initcall(pcibios_irq_init); 1051subsys_initcall(pcibios_irq_init);
1052 1052
1053 1053
1054static void pirq_penalize_isa_irq(int irq) 1054static void pirq_penalize_isa_irq(int irq, int active)
1055{ 1055{
1056 /* 1056 /*
1057 * If any ISAPnP device reports an IRQ in its list of possible 1057 * If any ISAPnP device reports an IRQ in its list of possible
1058 * IRQ's, we try to avoid assigning it to PCI devices. 1058 * IRQ's, we try to avoid assigning it to PCI devices.
1059 */ 1059 */
1060 if (irq < 16) 1060 if (irq < 16) {
1061 pirq_penalty[irq] += 100; 1061 if (active)
1062 pirq_penalty[irq] += 1000;
1063 else
1064 pirq_penalty[irq] += 100;
1065 }
1062} 1066}
1063 1067
1064void pcibios_penalize_isa_irq(int irq) 1068void pcibios_penalize_isa_irq(int irq, int active)
1065{ 1069{
1066#ifdef CONFIG_ACPI_PCI 1070#ifdef CONFIG_ACPI_PCI
1067 if (!acpi_noirq) 1071 if (!acpi_noirq)
1068 acpi_penalize_isa_irq(irq); 1072 acpi_penalize_isa_irq(irq, active);
1069 else 1073 else
1070#endif 1074#endif
1071 pirq_penalize_isa_irq(irq); 1075 pirq_penalize_isa_irq(irq, active);
1072} 1076}
1073 1077
1074static int pirq_enable_irq(struct pci_dev *dev) 1078static int pirq_enable_irq(struct pci_dev *dev)
diff --git a/arch/i386/pci/visws.c b/arch/i386/pci/visws.c
index 6a92487844..314c933b6b 100644
--- a/arch/i386/pci/visws.c
+++ b/arch/i386/pci/visws.c
@@ -21,7 +21,7 @@ static int pci_visws_enable_irq(struct pci_dev *dev) { return 0; }
21 21
22int (*pcibios_enable_irq)(struct pci_dev *dev) = &pci_visws_enable_irq; 22int (*pcibios_enable_irq)(struct pci_dev *dev) = &pci_visws_enable_irq;
23 23
24void __init pcibios_penalize_isa_irq(int irq) {} 24void __init pcibios_penalize_isa_irq(int irq, int active) {}
25 25
26 26
27unsigned int pci_bus0, pci_bus1; 27unsigned int pci_bus0, pci_bus1;
diff --git a/arch/i386/power/cpu.c b/arch/i386/power/cpu.c
index 0e6b45b612..c547c1af6f 100644
--- a/arch/i386/power/cpu.c
+++ b/arch/i386/power/cpu.c
@@ -137,6 +137,7 @@ void __restore_processor_state(struct saved_context *ctxt)
137 137
138 fix_processor_context(); 138 fix_processor_context();
139 do_fpu_end(); 139 do_fpu_end();
140 mtrr_ap_init();
140} 141}
141 142
142void restore_processor_state(void) 143void restore_processor_state(void)
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 01b78e7f99..2e08942339 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -423,6 +423,8 @@ endmenu
423 423
424endif 424endif
425 425
426source "net/Kconfig"
427
426source "drivers/Kconfig" 428source "drivers/Kconfig"
427 429
428source "fs/Kconfig" 430source "fs/Kconfig"
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c
index ae84a1018a..0639ec0ed0 100644
--- a/arch/ia64/hp/sim/simeth.c
+++ b/arch/ia64/hp/sim/simeth.c
@@ -191,7 +191,7 @@ simeth_probe1(void)
191 unsigned char mac_addr[ETH_ALEN]; 191 unsigned char mac_addr[ETH_ALEN];
192 struct simeth_local *local; 192 struct simeth_local *local;
193 struct net_device *dev; 193 struct net_device *dev;
194 int fd, i, err; 194 int fd, i, err, rc;
195 195
196 /* 196 /*
197 * XXX Fix me 197 * XXX Fix me
@@ -228,7 +228,9 @@ simeth_probe1(void)
228 return err; 228 return err;
229 } 229 }
230 230
231 dev->irq = assign_irq_vector(AUTO_ASSIGN); 231 if ((rc = assign_irq_vector(AUTO_ASSIGN)) < 0)
232 panic("%s: out of interrupt vectors!\n", __FUNCTION__);
233 dev->irq = rc;
232 234
233 /* 235 /*
234 * attach the interrupt in the simulator, this does enable interrupts 236 * attach the interrupt in the simulator, this does enable interrupts
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index 7a8ae0f4b3..7dcb8582ae 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -982,7 +982,7 @@ static struct tty_operations hp_ops = {
982static int __init 982static int __init
983simrs_init (void) 983simrs_init (void)
984{ 984{
985 int i; 985 int i, rc;
986 struct serial_state *state; 986 struct serial_state *state;
987 987
988 if (!ia64_platform_is("hpsim")) 988 if (!ia64_platform_is("hpsim"))
@@ -1017,7 +1017,10 @@ simrs_init (void)
1017 if (state->type == PORT_UNKNOWN) continue; 1017 if (state->type == PORT_UNKNOWN) continue;
1018 1018
1019 if (!state->irq) { 1019 if (!state->irq) {
1020 state->irq = assign_irq_vector(AUTO_ASSIGN); 1020 if ((rc = assign_irq_vector(AUTO_ASSIGN)) < 0)
1021 panic("%s: out of interrupt vectors!\n",
1022 __FUNCTION__);
1023 state->irq = rc;
1021 ia64_ssc_connect_irq(KEYBOARD_INTR, state->irq); 1024 ia64_ssc_connect_irq(KEYBOARD_INTR, state->irq);
1022 } 1025 }
1023 1026
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index b2e2f6509e..e1fb68ddec 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_IA64_PALINFO) += palinfo.o
17obj-$(CONFIG_IOSAPIC) += iosapic.o 17obj-$(CONFIG_IOSAPIC) += iosapic.o
18obj-$(CONFIG_MODULES) += module.o 18obj-$(CONFIG_MODULES) += module.o
19obj-$(CONFIG_SMP) += smp.o smpboot.o domain.o 19obj-$(CONFIG_SMP) += smp.o smpboot.o domain.o
20obj-$(CONFIG_NUMA) += numa.o
20obj-$(CONFIG_PERFMON) += perfmon_default_smpl.o 21obj-$(CONFIG_PERFMON) += perfmon_default_smpl.o
21obj-$(CONFIG_IA64_CYCLONE) += cyclone.o 22obj-$(CONFIG_IA64_CYCLONE) += cyclone.o
22obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o 23obj-$(CONFIG_IA64_MCA_RECOVERY) += mca_recovery.o
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index cda06f88c6..9609f243e5 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -11,6 +11,7 @@
11 * Copyright (C) 2001 Jenna Hall <jenna.s.hall@intel.com> 11 * Copyright (C) 2001 Jenna Hall <jenna.s.hall@intel.com>
12 * Copyright (C) 2001 Takayoshi Kochi <t-kochi@bq.jp.nec.com> 12 * Copyright (C) 2001 Takayoshi Kochi <t-kochi@bq.jp.nec.com>
13 * Copyright (C) 2002 Erich Focht <efocht@ess.nec.de> 13 * Copyright (C) 2002 Erich Focht <efocht@ess.nec.de>
14 * Copyright (C) 2004 Ashok Raj <ashok.raj@intel.com>
14 * 15 *
15 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16 * 17 *
@@ -67,6 +68,11 @@ EXPORT_SYMBOL(pm_power_off);
67unsigned char acpi_kbd_controller_present = 1; 68unsigned char acpi_kbd_controller_present = 1;
68unsigned char acpi_legacy_devices; 69unsigned char acpi_legacy_devices;
69 70
71static unsigned int __initdata acpi_madt_rev;
72
73unsigned int acpi_cpei_override;
74unsigned int acpi_cpei_phys_cpuid;
75
70#define MAX_SAPICS 256 76#define MAX_SAPICS 256
71u16 ia64_acpiid_to_sapicid[MAX_SAPICS] = 77u16 ia64_acpiid_to_sapicid[MAX_SAPICS] =
72 { [0 ... MAX_SAPICS - 1] = -1 }; 78 { [0 ... MAX_SAPICS - 1] = -1 };
@@ -265,10 +271,56 @@ acpi_parse_plat_int_src (
265 (plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); 271 (plintsrc->flags.trigger == 1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL);
266 272
267 platform_intr_list[plintsrc->type] = vector; 273 platform_intr_list[plintsrc->type] = vector;
274 if (acpi_madt_rev > 1) {
275 acpi_cpei_override = plintsrc->plint_flags.cpei_override_flag;
276 }
277
278 /*
279 * Save the physical id, so we can check when its being removed
280 */
281 acpi_cpei_phys_cpuid = ((plintsrc->id << 8) | (plintsrc->eid)) & 0xffff;
282
268 return 0; 283 return 0;
269} 284}
270 285
271 286
287unsigned int can_cpei_retarget(void)
288{
289 extern int cpe_vector;
290
291 /*
292 * Only if CPEI is supported and the override flag
293 * is present, otherwise return that its re-targettable
294 * if we are in polling mode.
295 */
296 if (cpe_vector > 0 && !acpi_cpei_override)
297 return 0;
298 else
299 return 1;
300}
301
302unsigned int is_cpu_cpei_target(unsigned int cpu)
303{
304 unsigned int logical_id;
305
306 logical_id = cpu_logical_id(acpi_cpei_phys_cpuid);
307
308 if (logical_id == cpu)
309 return 1;
310 else
311 return 0;
312}
313
314void set_cpei_target_cpu(unsigned int cpu)
315{
316 acpi_cpei_phys_cpuid = cpu_physical_id(cpu);
317}
318
319unsigned int get_cpei_target_cpu(void)
320{
321 return acpi_cpei_phys_cpuid;
322}
323
272static int __init 324static int __init
273acpi_parse_int_src_ovr ( 325acpi_parse_int_src_ovr (
274 acpi_table_entry_header *header, const unsigned long end) 326 acpi_table_entry_header *header, const unsigned long end)
@@ -326,6 +378,8 @@ acpi_parse_madt (unsigned long phys_addr, unsigned long size)
326 378
327 acpi_madt = (struct acpi_table_madt *) __va(phys_addr); 379 acpi_madt = (struct acpi_table_madt *) __va(phys_addr);
328 380
381 acpi_madt_rev = acpi_madt->header.revision;
382
329 /* remember the value for reference after free_initmem() */ 383 /* remember the value for reference after free_initmem() */
330#ifdef CONFIG_ITANIUM 384#ifdef CONFIG_ITANIUM
331 has_8259 = 1; /* Firmware on old Itanium systems is broken */ 385 has_8259 = 1; /* Firmware on old Itanium systems is broken */
@@ -640,9 +694,11 @@ acpi_boot_init (void)
640 if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id()) 694 if (smp_boot_data.cpu_phys_id[cpu] != hard_smp_processor_id())
641 node_cpuid[i++].phys_id = smp_boot_data.cpu_phys_id[cpu]; 695 node_cpuid[i++].phys_id = smp_boot_data.cpu_phys_id[cpu];
642 } 696 }
643 build_cpu_to_node_map();
644# endif 697# endif
645#endif 698#endif
699#ifdef CONFIG_ACPI_NUMA
700 build_cpu_to_node_map();
701#endif
646 /* Make boot-up look pretty */ 702 /* Make boot-up look pretty */
647 printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus); 703 printk(KERN_INFO "%d CPUs available, %d CPUs total\n", available_cpus, total_cpus);
648 return 0; 704 return 0;
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index 69f88d561d..bb9a506deb 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1249,7 +1249,7 @@ ENTRY(sys_rt_sigreturn)
1249 stf.spill [r17]=f11 1249 stf.spill [r17]=f11
1250 adds out0=16,sp // out0 = &sigscratch 1250 adds out0=16,sp // out0 = &sigscratch
1251 br.call.sptk.many rp=ia64_rt_sigreturn 1251 br.call.sptk.many rp=ia64_rt_sigreturn
1252.ret19: .restore sp 0 1252.ret19: .restore sp,0
1253 adds sp=16,sp 1253 adds sp=16,sp
1254 ;; 1254 ;;
1255 ld8 r9=[sp] // load new ar.unat 1255 ld8 r9=[sp] // load new ar.unat
diff --git a/arch/ia64/kernel/iosapic.c b/arch/ia64/kernel/iosapic.c
index c170be095c..7936b62f7a 100644
--- a/arch/ia64/kernel/iosapic.c
+++ b/arch/ia64/kernel/iosapic.c
@@ -489,8 +489,6 @@ static int iosapic_find_sharable_vector (unsigned long trigger, unsigned long po
489 } 489 }
490 } 490 }
491 } 491 }
492 if (vector < 0)
493 panic("%s: out of interrupt vectors!\n", __FUNCTION__);
494 492
495 return vector; 493 return vector;
496} 494}
@@ -506,6 +504,8 @@ iosapic_reassign_vector (int vector)
506 504
507 if (!list_empty(&iosapic_intr_info[vector].rtes)) { 505 if (!list_empty(&iosapic_intr_info[vector].rtes)) {
508 new_vector = assign_irq_vector(AUTO_ASSIGN); 506 new_vector = assign_irq_vector(AUTO_ASSIGN);
507 if (new_vector < 0)
508 panic("%s: out of interrupt vectors!\n", __FUNCTION__);
509 printk(KERN_INFO "Reassigning vector %d to %d\n", vector, new_vector); 509 printk(KERN_INFO "Reassigning vector %d to %d\n", vector, new_vector);
510 memcpy(&iosapic_intr_info[new_vector], &iosapic_intr_info[vector], 510 memcpy(&iosapic_intr_info[new_vector], &iosapic_intr_info[vector],
511 sizeof(struct iosapic_intr_info)); 511 sizeof(struct iosapic_intr_info));
@@ -734,9 +734,12 @@ again:
734 spin_unlock_irqrestore(&iosapic_lock, flags); 734 spin_unlock_irqrestore(&iosapic_lock, flags);
735 735
736 /* If vector is running out, we try to find a sharable vector */ 736 /* If vector is running out, we try to find a sharable vector */
737 vector = assign_irq_vector_nopanic(AUTO_ASSIGN); 737 vector = assign_irq_vector(AUTO_ASSIGN);
738 if (vector < 0) 738 if (vector < 0) {
739 vector = iosapic_find_sharable_vector(trigger, polarity); 739 vector = iosapic_find_sharable_vector(trigger, polarity);
740 if (vector < 0)
741 panic("%s: out of interrupt vectors!\n", __FUNCTION__);
742 }
740 743
741 spin_lock_irqsave(&irq_descp(vector)->lock, flags); 744 spin_lock_irqsave(&irq_descp(vector)->lock, flags);
742 spin_lock(&iosapic_lock); 745 spin_lock(&iosapic_lock);
@@ -884,6 +887,8 @@ iosapic_register_platform_intr (u32 int_type, unsigned int gsi,
884 break; 887 break;
885 case ACPI_INTERRUPT_INIT: 888 case ACPI_INTERRUPT_INIT:
886 vector = assign_irq_vector(AUTO_ASSIGN); 889 vector = assign_irq_vector(AUTO_ASSIGN);
890 if (vector < 0)
891 panic("%s: out of interrupt vectors!\n", __FUNCTION__);
887 delivery = IOSAPIC_INIT; 892 delivery = IOSAPIC_INIT;
888 break; 893 break;
889 case ACPI_INTERRUPT_CPEI: 894 case ACPI_INTERRUPT_CPEI:
diff --git a/arch/ia64/kernel/irq_ia64.c b/arch/ia64/kernel/irq_ia64.c
index 4fe60c7a2e..6c4d59fd03 100644
--- a/arch/ia64/kernel/irq_ia64.c
+++ b/arch/ia64/kernel/irq_ia64.c
@@ -63,30 +63,19 @@ EXPORT_SYMBOL(isa_irq_to_vector_map);
63static unsigned long ia64_vector_mask[BITS_TO_LONGS(IA64_NUM_DEVICE_VECTORS)]; 63static unsigned long ia64_vector_mask[BITS_TO_LONGS(IA64_NUM_DEVICE_VECTORS)];
64 64
65int 65int
66assign_irq_vector_nopanic (int irq) 66assign_irq_vector (int irq)
67{ 67{
68 int pos, vector; 68 int pos, vector;
69 again: 69 again:
70 pos = find_first_zero_bit(ia64_vector_mask, IA64_NUM_DEVICE_VECTORS); 70 pos = find_first_zero_bit(ia64_vector_mask, IA64_NUM_DEVICE_VECTORS);
71 vector = IA64_FIRST_DEVICE_VECTOR + pos; 71 vector = IA64_FIRST_DEVICE_VECTOR + pos;
72 if (vector > IA64_LAST_DEVICE_VECTOR) 72 if (vector > IA64_LAST_DEVICE_VECTOR)
73 return -1; 73 return -ENOSPC;
74 if (test_and_set_bit(pos, ia64_vector_mask)) 74 if (test_and_set_bit(pos, ia64_vector_mask))
75 goto again; 75 goto again;
76 return vector; 76 return vector;
77} 77}
78 78
79int
80assign_irq_vector (int irq)
81{
82 int vector = assign_irq_vector_nopanic(irq);
83
84 if (vector < 0)
85 panic("assign_irq_vector: out of interrupt vectors!");
86
87 return vector;
88}
89
90void 79void
91free_irq_vector (int vector) 80free_irq_vector (int vector)
92{ 81{
diff --git a/arch/ia64/kernel/kprobes.c b/arch/ia64/kernel/kprobes.c
index 3aa3167edb..884f5cd27d 100644
--- a/arch/ia64/kernel/kprobes.c
+++ b/arch/ia64/kernel/kprobes.c
@@ -713,7 +713,7 @@ static struct kprobe trampoline_p = {
713 .pre_handler = trampoline_probe_handler 713 .pre_handler = trampoline_probe_handler
714}; 714};
715 715
716int __init arch_init(void) 716int __init arch_init_kprobes(void)
717{ 717{
718 trampoline_p.addr = 718 trampoline_p.addr =
719 (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip; 719 (kprobe_opcode_t *)((struct fnptr *)kretprobe_trampoline)->ip;
diff --git a/arch/ia64/kernel/mca.c b/arch/ia64/kernel/mca.c
index 736e328b5e..4ebbf39743 100644
--- a/arch/ia64/kernel/mca.c
+++ b/arch/ia64/kernel/mca.c
@@ -271,7 +271,7 @@ ia64_mca_log_sal_error_record(int sal_info_type)
271 271
272#ifdef CONFIG_ACPI 272#ifdef CONFIG_ACPI
273 273
274static int cpe_vector = -1; 274int cpe_vector = -1;
275 275
276static irqreturn_t 276static irqreturn_t
277ia64_mca_cpe_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs) 277ia64_mca_cpe_int_handler (int cpe_irq, void *arg, struct pt_regs *ptregs)
diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
new file mode 100644
index 0000000000..a68ce66780
--- /dev/null
+++ b/arch/ia64/kernel/numa.c
@@ -0,0 +1,57 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 *
16 * ia64 kernel NUMA specific stuff
17 *
18 * Copyright (C) 2002 Erich Focht <efocht@ess.nec.de>
19 * Copyright (C) 2004 Silicon Graphics, Inc.
20 * Jesse Barnes <jbarnes@sgi.com>
21 */
22#include <linux/config.h>
23#include <linux/topology.h>
24#include <linux/module.h>
25#include <asm/processor.h>
26#include <asm/smp.h>
27
28u8 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
29EXPORT_SYMBOL(cpu_to_node_map);
30
31cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
32
33/**
34 * build_cpu_to_node_map - setup cpu to node and node to cpumask arrays
35 *
36 * Build cpu to node mapping and initialize the per node cpu masks using
37 * info from the node_cpuid array handed to us by ACPI.
38 */
39void __init build_cpu_to_node_map(void)
40{
41 int cpu, i, node;
42
43 for(node=0; node < MAX_NUMNODES; node++)
44 cpus_clear(node_to_cpu_mask[node]);
45
46 for(cpu = 0; cpu < NR_CPUS; ++cpu) {
47 node = -1;
48 for (i = 0; i < NR_CPUS; ++i)
49 if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
50 node = node_cpuid[i].nid;
51 break;
52 }
53 cpu_to_node_map[cpu] = (node >= 0) ? node : 0;
54 if (node >= 0)
55 cpu_set(cpu, node_to_cpu_mask[node]);
56 }
57}
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index 6407bff6bf..b8ebb8e427 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -37,7 +37,6 @@
37#include <linux/vfs.h> 37#include <linux/vfs.h>
38#include <linux/pagemap.h> 38#include <linux/pagemap.h>
39#include <linux/mount.h> 39#include <linux/mount.h>
40#include <linux/version.h>
41#include <linux/bitops.h> 40#include <linux/bitops.h>
42 41
43#include <asm/errno.h> 42#include <asm/errno.h>
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index 6e35bff05d..e484910246 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -196,6 +196,7 @@ update_pal_halt_status(int status)
196void 196void
197default_idle (void) 197default_idle (void)
198{ 198{
199 local_irq_enable();
199 while (!need_resched()) 200 while (!need_resched())
200 if (can_do_pal_halt) 201 if (can_do_pal_halt)
201 safe_halt(); 202 safe_halt();
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 2693e1522d..5c7c95737b 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -40,6 +40,8 @@
40#include <linux/serial_core.h> 40#include <linux/serial_core.h>
41#include <linux/efi.h> 41#include <linux/efi.h>
42#include <linux/initrd.h> 42#include <linux/initrd.h>
43#include <linux/platform.h>
44#include <linux/pm.h>
43 45
44#include <asm/ia32.h> 46#include <asm/ia32.h>
45#include <asm/machvec.h> 47#include <asm/machvec.h>
@@ -783,6 +785,7 @@ cpu_init (void)
783 /* size of physical stacked register partition plus 8 bytes: */ 785 /* size of physical stacked register partition plus 8 bytes: */
784 __get_cpu_var(ia64_phys_stacked_size_p8) = num_phys_stacked*8 + 8; 786 __get_cpu_var(ia64_phys_stacked_size_p8) = num_phys_stacked*8 + 8;
785 platform_cpu_init(); 787 platform_cpu_init();
788 pm_idle = default_idle;
786} 789}
787 790
788void 791void
diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c
index edd9f07860..b8a0a7d257 100644
--- a/arch/ia64/kernel/signal.c
+++ b/arch/ia64/kernel/signal.c
@@ -143,6 +143,7 @@ restore_sigcontext (struct sigcontext __user *sc, struct sigscratch *scr)
143 143
144 __copy_from_user(current->thread.fph, &sc->sc_fr[32], 96*16); 144 __copy_from_user(current->thread.fph, &sc->sc_fr[32], 96*16);
145 psr->mfh = 0; /* drop signal handler's fph contents... */ 145 psr->mfh = 0; /* drop signal handler's fph contents... */
146 preempt_disable();
146 if (psr->dfh) 147 if (psr->dfh)
147 ia64_drop_fpu(current); 148 ia64_drop_fpu(current);
148 else { 149 else {
@@ -150,6 +151,7 @@ restore_sigcontext (struct sigcontext __user *sc, struct sigscratch *scr)
150 __ia64_load_fpu(current->thread.fph); 151 __ia64_load_fpu(current->thread.fph);
151 ia64_set_local_fpu_owner(current); 152 ia64_set_local_fpu_owner(current);
152 } 153 }
154 preempt_enable();
153 } 155 }
154 return err; 156 return err;
155} 157}
diff --git a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
index 623b0a5467..7d72c0d872 100644
--- a/arch/ia64/kernel/smpboot.c
+++ b/arch/ia64/kernel/smpboot.c
@@ -525,47 +525,6 @@ smp_build_cpu_map (void)
525 } 525 }
526} 526}
527 527
528#ifdef CONFIG_NUMA
529
530/* on which node is each logical CPU (one cacheline even for 64 CPUs) */
531u8 cpu_to_node_map[NR_CPUS] __cacheline_aligned;
532EXPORT_SYMBOL(cpu_to_node_map);
533/* which logical CPUs are on which nodes */
534cpumask_t node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
535
536/*
537 * Build cpu to node mapping and initialize the per node cpu masks.
538 */
539void __init
540build_cpu_to_node_map (void)
541{
542 int cpu, i, node;
543
544 for(node=0; node<MAX_NUMNODES; node++)
545 cpus_clear(node_to_cpu_mask[node]);
546 for(cpu = 0; cpu < NR_CPUS; ++cpu) {
547 /*
548 * All Itanium NUMA platforms I know use ACPI, so maybe we
549 * can drop this ifdef completely. [EF]
550 */
551#ifdef CONFIG_ACPI_NUMA
552 node = -1;
553 for (i = 0; i < NR_CPUS; ++i)
554 if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
555 node = node_cpuid[i].nid;
556 break;
557 }
558#else
559# error Fixme: Dunno how to build CPU-to-node map.
560#endif
561 cpu_to_node_map[cpu] = (node >= 0) ? node : 0;
562 if (node >= 0)
563 cpu_set(cpu, node_to_cpu_mask[node]);
564 }
565}
566
567#endif /* CONFIG_NUMA */
568
569/* 528/*
570 * Cycle through the APs sending Wakeup IPIs to boot each. 529 * Cycle through the APs sending Wakeup IPIs to boot each.
571 */ 530 */
diff --git a/arch/ia64/kernel/topology.c b/arch/ia64/kernel/topology.c
index f1aafd4c05..d8030f3bd8 100644
--- a/arch/ia64/kernel/topology.c
+++ b/arch/ia64/kernel/topology.c
@@ -36,6 +36,13 @@ int arch_register_cpu(int num)
36 parent = &sysfs_nodes[cpu_to_node(num)]; 36 parent = &sysfs_nodes[cpu_to_node(num)];
37#endif /* CONFIG_NUMA */ 37#endif /* CONFIG_NUMA */
38 38
39 /*
40 * If CPEI cannot be re-targetted, and this is
41 * CPEI target, then dont create the control file
42 */
43 if (!can_cpei_retarget() && is_cpu_cpei_target(num))
44 sysfs_cpus[num].cpu.no_control = 1;
45
39 return register_cpu(&sysfs_cpus[num].cpu, num, parent); 46 return register_cpu(&sysfs_cpus[num].cpu, num, parent);
40} 47}
41 48
diff --git a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
index e7e520d90f..4440c8343f 100644
--- a/arch/ia64/kernel/traps.c
+++ b/arch/ia64/kernel/traps.c
@@ -90,14 +90,16 @@ die (const char *str, struct pt_regs *regs, long err)
90 .lock_owner_depth = 0 90 .lock_owner_depth = 0
91 }; 91 };
92 static int die_counter; 92 static int die_counter;
93 int cpu = get_cpu();
93 94
94 if (die.lock_owner != smp_processor_id()) { 95 if (die.lock_owner != cpu) {
95 console_verbose(); 96 console_verbose();
96 spin_lock_irq(&die.lock); 97 spin_lock_irq(&die.lock);
97 die.lock_owner = smp_processor_id(); 98 die.lock_owner = cpu;
98 die.lock_owner_depth = 0; 99 die.lock_owner_depth = 0;
99 bust_spinlocks(1); 100 bust_spinlocks(1);
100 } 101 }
102 put_cpu();
101 103
102 if (++die.lock_owner_depth < 3) { 104 if (++die.lock_owner_depth < 3) {
103 printk("%s[%d]: %s %ld [%d]\n", 105 printk("%s[%d]: %s %ld [%d]\n",
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index f3fd528ead..b5c90e5481 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -44,150 +44,7 @@ struct early_node_data {
44}; 44};
45 45
46static struct early_node_data mem_data[MAX_NUMNODES] __initdata; 46static struct early_node_data mem_data[MAX_NUMNODES] __initdata;
47 47static nodemask_t memory_less_mask __initdata;
48/**
49 * reassign_cpu_only_nodes - called from find_memory to move CPU-only nodes to a memory node
50 *
51 * This function will move nodes with only CPUs (no memory)
52 * to a node with memory which is at the minimum numa_slit distance.
53 * Any reassigments will result in the compression of the nodes
54 * and renumbering the nid values where appropriate.
55 * The static declarations below are to avoid large stack size which
56 * makes the code not re-entrant.
57 */
58static void __init reassign_cpu_only_nodes(void)
59{
60 struct node_memblk_s *p;
61 int i, j, k, nnode, nid, cpu, cpunid, pxm;
62 u8 cslit, slit;
63 static DECLARE_BITMAP(nodes_with_mem, MAX_NUMNODES) __initdata;
64 static u8 numa_slit_fix[MAX_NUMNODES * MAX_NUMNODES] __initdata;
65 static int node_flip[MAX_NUMNODES] __initdata;
66 static int old_nid_map[NR_CPUS] __initdata;
67
68 for (nnode = 0, p = &node_memblk[0]; p < &node_memblk[num_node_memblks]; p++)
69 if (!test_bit(p->nid, (void *) nodes_with_mem)) {
70 set_bit(p->nid, (void *) nodes_with_mem);
71 nnode++;
72 }
73
74 /*
75 * All nids with memory.
76 */
77 if (nnode == num_online_nodes())
78 return;
79
80 /*
81 * Change nids and attempt to migrate CPU-only nodes
82 * to the best numa_slit (closest neighbor) possible.
83 * For reassigned CPU nodes a nid can't be arrived at
84 * until after this loop because the target nid's new
85 * identity might not have been established yet. So
86 * new nid values are fabricated above num_online_nodes() and
87 * mapped back later to their true value.
88 */
89 /* MCD - This code is a bit complicated, but may be unnecessary now.
90 * We can now handle much more interesting node-numbering.
91 * The old requirement that 0 <= nid <= numnodes <= MAX_NUMNODES
92 * and that there be no holes in the numbering 0..numnodes
93 * has become simply 0 <= nid <= MAX_NUMNODES.
94 */
95 nid = 0;
96 for_each_online_node(i) {
97 if (test_bit(i, (void *) nodes_with_mem)) {
98 /*
99 * Save original nid value for numa_slit
100 * fixup and node_cpuid reassignments.
101 */
102 node_flip[nid] = i;
103
104 if (i == nid) {
105 nid++;
106 continue;
107 }
108
109 for (p = &node_memblk[0]; p < &node_memblk[num_node_memblks]; p++)
110 if (p->nid == i)
111 p->nid = nid;
112
113 cpunid = nid;
114 nid++;
115 } else
116 cpunid = MAX_NUMNODES;
117
118 for (cpu = 0; cpu < NR_CPUS; cpu++)
119 if (node_cpuid[cpu].nid == i) {
120 /*
121 * For nodes not being reassigned just
122 * fix the cpu's nid and reverse pxm map
123 */
124 if (cpunid < MAX_NUMNODES) {
125 pxm = nid_to_pxm_map[i];
126 pxm_to_nid_map[pxm] =
127 node_cpuid[cpu].nid = cpunid;
128 continue;
129 }
130
131 /*
132 * For nodes being reassigned, find best node by
133 * numa_slit information and then make a temporary
134 * nid value based on current nid and num_online_nodes().
135 */
136 slit = 0xff;
137 k = 2*num_online_nodes();
138 for_each_online_node(j) {
139 if (i == j)
140 continue;
141 else if (test_bit(j, (void *) nodes_with_mem)) {
142 cslit = numa_slit[i * num_online_nodes() + j];
143 if (cslit < slit) {
144 k = num_online_nodes() + j;
145 slit = cslit;
146 }
147 }
148 }
149
150 /* save old nid map so we can update the pxm */
151 old_nid_map[cpu] = node_cpuid[cpu].nid;
152 node_cpuid[cpu].nid = k;
153 }
154 }
155
156 /*
157 * Fixup temporary nid values for CPU-only nodes.
158 */
159 for (cpu = 0; cpu < NR_CPUS; cpu++)
160 if (node_cpuid[cpu].nid == (2*num_online_nodes())) {
161 pxm = nid_to_pxm_map[old_nid_map[cpu]];
162 pxm_to_nid_map[pxm] = node_cpuid[cpu].nid = nnode - 1;
163 } else {
164 for (i = 0; i < nnode; i++) {
165 if (node_flip[i] != (node_cpuid[cpu].nid - num_online_nodes()))
166 continue;
167
168 pxm = nid_to_pxm_map[old_nid_map[cpu]];
169 pxm_to_nid_map[pxm] = node_cpuid[cpu].nid = i;
170 break;
171 }
172 }
173
174 /*
175 * Fix numa_slit by compressing from larger
176 * nid array to reduced nid array.
177 */
178 for (i = 0; i < nnode; i++)
179 for (j = 0; j < nnode; j++)
180 numa_slit_fix[i * nnode + j] =
181 numa_slit[node_flip[i] * num_online_nodes() + node_flip[j]];
182
183 memcpy(numa_slit, numa_slit_fix, sizeof (numa_slit));
184
185 nodes_clear(node_online_map);
186 for (i = 0; i < nnode; i++)
187 node_set_online(i);
188
189 return;
190}
191 48
192/* 49/*
193 * To prevent cache aliasing effects, align per-node structures so that they 50 * To prevent cache aliasing effects, align per-node structures so that they
@@ -233,44 +90,101 @@ static int __init build_node_maps(unsigned long start, unsigned long len,
233} 90}
234 91
235/** 92/**
236 * early_nr_phys_cpus_node - return number of physical cpus on a given node 93 * early_nr_cpus_node - return number of cpus on a given node
237 * @node: node to check 94 * @node: node to check
238 * 95 *
239 * Count the number of physical cpus on @node. These are cpus that actually 96 * Count the number of cpus on @node. We can't use nr_cpus_node() yet because
240 * exist. We can't use nr_cpus_node() yet because
241 * acpi_boot_init() (which builds the node_to_cpu_mask array) hasn't been 97 * acpi_boot_init() (which builds the node_to_cpu_mask array) hasn't been
242 * called yet. 98 * called yet. Note that node 0 will also count all non-existent cpus.
243 */ 99 */
244static int early_nr_phys_cpus_node(int node) 100static int __init early_nr_cpus_node(int node)
245{ 101{
246 int cpu, n = 0; 102 int cpu, n = 0;
247 103
248 for (cpu = 0; cpu < NR_CPUS; cpu++) 104 for (cpu = 0; cpu < NR_CPUS; cpu++)
249 if (node == node_cpuid[cpu].nid) 105 if (node == node_cpuid[cpu].nid)
250 if ((cpu == 0) || node_cpuid[cpu].phys_id) 106 n++;
251 n++;
252 107
253 return n; 108 return n;
254} 109}
255 110
111/**
112 * compute_pernodesize - compute size of pernode data
113 * @node: the node id.
114 */
115static unsigned long __init compute_pernodesize(int node)
116{
117 unsigned long pernodesize = 0, cpus;
118
119 cpus = early_nr_cpus_node(node);
120 pernodesize += PERCPU_PAGE_SIZE * cpus;
121 pernodesize += node * L1_CACHE_BYTES;
122 pernodesize += L1_CACHE_ALIGN(sizeof(pg_data_t));
123 pernodesize += L1_CACHE_ALIGN(sizeof(struct ia64_node_data));
124 pernodesize = PAGE_ALIGN(pernodesize);
125 return pernodesize;
126}
256 127
257/** 128/**
258 * early_nr_cpus_node - return number of cpus on a given node 129 * per_cpu_node_setup - setup per-cpu areas on each node
259 * @node: node to check 130 * @cpu_data: per-cpu area on this node
131 * @node: node to setup
260 * 132 *
261 * Count the number of cpus on @node. We can't use nr_cpus_node() yet because 133 * Copy the static per-cpu data into the region we just set aside and then
262 * acpi_boot_init() (which builds the node_to_cpu_mask array) hasn't been 134 * setup __per_cpu_offset for each CPU on this node. Return a pointer to
263 * called yet. Note that node 0 will also count all non-existent cpus. 135 * the end of the area.
264 */ 136 */
265static int early_nr_cpus_node(int node) 137static void *per_cpu_node_setup(void *cpu_data, int node)
266{ 138{
267 int cpu, n = 0; 139#ifdef CONFIG_SMP
140 int cpu;
268 141
269 for (cpu = 0; cpu < NR_CPUS; cpu++) 142 for (cpu = 0; cpu < NR_CPUS; cpu++) {
270 if (node == node_cpuid[cpu].nid) 143 if (node == node_cpuid[cpu].nid) {
271 n++; 144 memcpy(__va(cpu_data), __phys_per_cpu_start,
145 __per_cpu_end - __per_cpu_start);
146 __per_cpu_offset[cpu] = (char*)__va(cpu_data) -
147 __per_cpu_start;
148 cpu_data += PERCPU_PAGE_SIZE;
149 }
150 }
151#endif
152 return cpu_data;
153}
272 154
273 return n; 155/**
156 * fill_pernode - initialize pernode data.
157 * @node: the node id.
158 * @pernode: physical address of pernode data
159 * @pernodesize: size of the pernode data
160 */
161static void __init fill_pernode(int node, unsigned long pernode,
162 unsigned long pernodesize)
163{
164 void *cpu_data;
165 int cpus = early_nr_cpus_node(node);
166 struct bootmem_data *bdp = &mem_data[node].bootmem_data;
167
168 mem_data[node].pernode_addr = pernode;
169 mem_data[node].pernode_size = pernodesize;
170 memset(__va(pernode), 0, pernodesize);
171
172 cpu_data = (void *)pernode;
173 pernode += PERCPU_PAGE_SIZE * cpus;
174 pernode += node * L1_CACHE_BYTES;
175
176 mem_data[node].pgdat = __va(pernode);
177 pernode += L1_CACHE_ALIGN(sizeof(pg_data_t));
178
179 mem_data[node].node_data = __va(pernode);
180 pernode += L1_CACHE_ALIGN(sizeof(struct ia64_node_data));
181
182 mem_data[node].pgdat->bdata = bdp;
183 pernode += L1_CACHE_ALIGN(sizeof(pg_data_t));
184
185 cpu_data = per_cpu_node_setup(cpu_data, node);
186
187 return;
274} 188}
275 189
276/** 190/**
@@ -304,9 +218,8 @@ static int early_nr_cpus_node(int node)
304static int __init find_pernode_space(unsigned long start, unsigned long len, 218static int __init find_pernode_space(unsigned long start, unsigned long len,
305 int node) 219 int node)
306{ 220{
307 unsigned long epfn, cpu, cpus, phys_cpus; 221 unsigned long epfn;
308 unsigned long pernodesize = 0, pernode, pages, mapsize; 222 unsigned long pernodesize = 0, pernode, pages, mapsize;
309 void *cpu_data;
310 struct bootmem_data *bdp = &mem_data[node].bootmem_data; 223 struct bootmem_data *bdp = &mem_data[node].bootmem_data;
311 224
312 epfn = (start + len) >> PAGE_SHIFT; 225 epfn = (start + len) >> PAGE_SHIFT;
@@ -329,49 +242,12 @@ static int __init find_pernode_space(unsigned long start, unsigned long len,
329 * Calculate total size needed, incl. what's necessary 242 * Calculate total size needed, incl. what's necessary
330 * for good alignment and alias prevention. 243 * for good alignment and alias prevention.
331 */ 244 */
332 cpus = early_nr_cpus_node(node); 245 pernodesize = compute_pernodesize(node);
333 phys_cpus = early_nr_phys_cpus_node(node);
334 pernodesize += PERCPU_PAGE_SIZE * cpus;
335 pernodesize += node * L1_CACHE_BYTES;
336 pernodesize += L1_CACHE_ALIGN(sizeof(pg_data_t));
337 pernodesize += L1_CACHE_ALIGN(sizeof(struct ia64_node_data));
338 pernodesize = PAGE_ALIGN(pernodesize);
339 pernode = NODEDATA_ALIGN(start, node); 246 pernode = NODEDATA_ALIGN(start, node);
340 247
341 /* Is this range big enough for what we want to store here? */ 248 /* Is this range big enough for what we want to store here? */
342 if (start + len > (pernode + pernodesize + mapsize)) { 249 if (start + len > (pernode + pernodesize + mapsize))
343 mem_data[node].pernode_addr = pernode; 250 fill_pernode(node, pernode, pernodesize);
344 mem_data[node].pernode_size = pernodesize;
345 memset(__va(pernode), 0, pernodesize);
346
347 cpu_data = (void *)pernode;
348 pernode += PERCPU_PAGE_SIZE * cpus;
349 pernode += node * L1_CACHE_BYTES;
350
351 mem_data[node].pgdat = __va(pernode);
352 pernode += L1_CACHE_ALIGN(sizeof(pg_data_t));
353
354 mem_data[node].node_data = __va(pernode);
355 pernode += L1_CACHE_ALIGN(sizeof(struct ia64_node_data));
356
357 mem_data[node].pgdat->bdata = bdp;
358 pernode += L1_CACHE_ALIGN(sizeof(pg_data_t));
359
360 /*
361 * Copy the static per-cpu data into the region we
362 * just set aside and then setup __per_cpu_offset
363 * for each CPU on this node.
364 */
365 for (cpu = 0; cpu < NR_CPUS; cpu++) {
366 if (node == node_cpuid[cpu].nid) {
367 memcpy(__va(cpu_data), __phys_per_cpu_start,
368 __per_cpu_end - __per_cpu_start);
369 __per_cpu_offset[cpu] = (char*)__va(cpu_data) -
370 __per_cpu_start;
371 cpu_data += PERCPU_PAGE_SIZE;
372 }
373 }
374 }
375 251
376 return 0; 252 return 0;
377} 253}
@@ -411,6 +287,9 @@ static void __init reserve_pernode_space(void)
411 for_each_online_node(node) { 287 for_each_online_node(node) {
412 pg_data_t *pdp = mem_data[node].pgdat; 288 pg_data_t *pdp = mem_data[node].pgdat;
413 289
290 if (node_isset(node, memory_less_mask))
291 continue;
292
414 bdp = pdp->bdata; 293 bdp = pdp->bdata;
415 294
416 /* First the bootmem_map itself */ 295 /* First the bootmem_map itself */
@@ -436,8 +315,8 @@ static void __init reserve_pernode_space(void)
436 */ 315 */
437static void __init initialize_pernode_data(void) 316static void __init initialize_pernode_data(void)
438{ 317{
439 int cpu, node;
440 pg_data_t *pgdat_list[MAX_NUMNODES]; 318 pg_data_t *pgdat_list[MAX_NUMNODES];
319 int cpu, node;
441 320
442 for_each_online_node(node) 321 for_each_online_node(node)
443 pgdat_list[node] = mem_data[node].pgdat; 322 pgdat_list[node] = mem_data[node].pgdat;
@@ -447,12 +326,99 @@ static void __init initialize_pernode_data(void)
447 memcpy(mem_data[node].node_data->pg_data_ptrs, pgdat_list, 326 memcpy(mem_data[node].node_data->pg_data_ptrs, pgdat_list,
448 sizeof(pgdat_list)); 327 sizeof(pgdat_list));
449 } 328 }
450 329#ifdef CONFIG_SMP
451 /* Set the node_data pointer for each per-cpu struct */ 330 /* Set the node_data pointer for each per-cpu struct */
452 for (cpu = 0; cpu < NR_CPUS; cpu++) { 331 for (cpu = 0; cpu < NR_CPUS; cpu++) {
453 node = node_cpuid[cpu].nid; 332 node = node_cpuid[cpu].nid;
454 per_cpu(cpu_info, cpu).node_data = mem_data[node].node_data; 333 per_cpu(cpu_info, cpu).node_data = mem_data[node].node_data;
455 } 334 }
335#else
336 {
337 struct cpuinfo_ia64 *cpu0_cpu_info;
338 cpu = 0;
339 node = node_cpuid[cpu].nid;
340 cpu0_cpu_info = (struct cpuinfo_ia64 *)(__phys_per_cpu_start +
341 ((char *)&per_cpu__cpu_info - __per_cpu_start));
342 cpu0_cpu_info->node_data = mem_data[node].node_data;
343 }
344#endif /* CONFIG_SMP */
345}
346
347/**
348 * memory_less_node_alloc - * attempt to allocate memory on the best NUMA slit
349 * node but fall back to any other node when __alloc_bootmem_node fails
350 * for best.
351 * @nid: node id
352 * @pernodesize: size of this node's pernode data
353 * @align: alignment to use for this node's pernode data
354 */
355static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize,
356 unsigned long align)
357{
358 void *ptr = NULL;
359 u8 best = 0xff;
360 int bestnode = -1, node;
361
362 for_each_online_node(node) {
363 if (node_isset(node, memory_less_mask))
364 continue;
365 else if (node_distance(nid, node) < best) {
366 best = node_distance(nid, node);
367 bestnode = node;
368 }
369 }
370
371 ptr = __alloc_bootmem_node(mem_data[bestnode].pgdat,
372 pernodesize, align, __pa(MAX_DMA_ADDRESS));
373
374 if (!ptr)
375 panic("NO memory for memory less node\n");
376 return ptr;
377}
378
379/**
380 * pgdat_insert - insert the pgdat into global pgdat_list
381 * @pgdat: the pgdat for a node.
382 */
383static void __init pgdat_insert(pg_data_t *pgdat)
384{
385 pg_data_t *prev = NULL, *next;
386
387 for_each_pgdat(next)
388 if (pgdat->node_id < next->node_id)
389 break;
390 else
391 prev = next;
392
393 if (prev) {
394 prev->pgdat_next = pgdat;
395 pgdat->pgdat_next = next;
396 } else {
397 pgdat->pgdat_next = pgdat_list;
398 pgdat_list = pgdat;
399 }
400
401 return;
402}
403
404/**
405 * memory_less_nodes - allocate and initialize CPU only nodes pernode
406 * information.
407 */
408static void __init memory_less_nodes(void)
409{
410 unsigned long pernodesize;
411 void *pernode;
412 int node;
413
414 for_each_node_mask(node, memory_less_mask) {
415 pernodesize = compute_pernodesize(node);
416 pernode = memory_less_node_alloc(node, pernodesize,
417 (node) ? (node * PERCPU_PAGE_SIZE) : (1024*1024));
418 fill_pernode(node, __pa(pernode), pernodesize);
419 }
420
421 return;
456} 422}
457 423
458/** 424/**
@@ -472,16 +438,19 @@ void __init find_memory(void)
472 node_set_online(0); 438 node_set_online(0);
473 } 439 }
474 440
441 nodes_or(memory_less_mask, memory_less_mask, node_online_map);
475 min_low_pfn = -1; 442 min_low_pfn = -1;
476 max_low_pfn = 0; 443 max_low_pfn = 0;
477 444
478 if (num_online_nodes() > 1)
479 reassign_cpu_only_nodes();
480
481 /* These actually end up getting called by call_pernode_memory() */ 445 /* These actually end up getting called by call_pernode_memory() */
482 efi_memmap_walk(filter_rsvd_memory, build_node_maps); 446 efi_memmap_walk(filter_rsvd_memory, build_node_maps);
483 efi_memmap_walk(filter_rsvd_memory, find_pernode_space); 447 efi_memmap_walk(filter_rsvd_memory, find_pernode_space);
484 448
449 for_each_online_node(node)
450 if (mem_data[node].bootmem_data.node_low_pfn) {
451 node_clear(node, memory_less_mask);
452 mem_data[node].min_pfn = ~0UL;
453 }
485 /* 454 /*
486 * Initialize the boot memory maps in reverse order since that's 455 * Initialize the boot memory maps in reverse order since that's
487 * what the bootmem allocator expects 456 * what the bootmem allocator expects
@@ -492,17 +461,14 @@ void __init find_memory(void)
492 461
493 if (!node_online(node)) 462 if (!node_online(node))
494 continue; 463 continue;
464 else if (node_isset(node, memory_less_mask))
465 continue;
495 466
496 bdp = &mem_data[node].bootmem_data; 467 bdp = &mem_data[node].bootmem_data;
497 pernode = mem_data[node].pernode_addr; 468 pernode = mem_data[node].pernode_addr;
498 pernodesize = mem_data[node].pernode_size; 469 pernodesize = mem_data[node].pernode_size;
499 map = pernode + pernodesize; 470 map = pernode + pernodesize;
500 471
501 /* Sanity check... */
502 if (!pernode)
503 panic("pernode space for node %d "
504 "could not be allocated!", node);
505
506 init_bootmem_node(mem_data[node].pgdat, 472 init_bootmem_node(mem_data[node].pgdat,
507 map>>PAGE_SHIFT, 473 map>>PAGE_SHIFT,
508 bdp->node_boot_start>>PAGE_SHIFT, 474 bdp->node_boot_start>>PAGE_SHIFT,
@@ -512,6 +478,7 @@ void __init find_memory(void)
512 efi_memmap_walk(filter_rsvd_memory, free_node_bootmem); 478 efi_memmap_walk(filter_rsvd_memory, free_node_bootmem);
513 479
514 reserve_pernode_space(); 480 reserve_pernode_space();
481 memory_less_nodes();
515 initialize_pernode_data(); 482 initialize_pernode_data();
516 483
517 max_pfn = max_low_pfn; 484 max_pfn = max_low_pfn;
@@ -519,6 +486,7 @@ void __init find_memory(void)
519 find_initrd(); 486 find_initrd();
520} 487}
521 488
489#ifdef CONFIG_SMP
522/** 490/**
523 * per_cpu_init - setup per-cpu variables 491 * per_cpu_init - setup per-cpu variables
524 * 492 *
@@ -529,15 +497,15 @@ void *per_cpu_init(void)
529{ 497{
530 int cpu; 498 int cpu;
531 499
532 if (smp_processor_id() == 0) { 500 if (smp_processor_id() != 0)
533 for (cpu = 0; cpu < NR_CPUS; cpu++) { 501 return __per_cpu_start + __per_cpu_offset[smp_processor_id()];
534 per_cpu(local_per_cpu_offset, cpu) = 502
535 __per_cpu_offset[cpu]; 503 for (cpu = 0; cpu < NR_CPUS; cpu++)
536 } 504 per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu];
537 }
538 505
539 return __per_cpu_start + __per_cpu_offset[smp_processor_id()]; 506 return __per_cpu_start + __per_cpu_offset[smp_processor_id()];
540} 507}
508#endif /* CONFIG_SMP */
541 509
542/** 510/**
543 * show_mem - give short summary of memory stats 511 * show_mem - give short summary of memory stats
@@ -680,12 +648,13 @@ void __init paging_init(void)
680 648
681 max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT; 649 max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
682 650
683 /* so min() will work in count_node_pages */
684 for_each_online_node(node)
685 mem_data[node].min_pfn = ~0UL;
686
687 efi_memmap_walk(filter_rsvd_memory, count_node_pages); 651 efi_memmap_walk(filter_rsvd_memory, count_node_pages);
688 652
653 vmalloc_end -= PAGE_ALIGN(max_low_pfn * sizeof(struct page));
654 vmem_map = (struct page *) vmalloc_end;
655 efi_memmap_walk(create_mem_map_page_table, NULL);
656 printk("Virtual mem_map starts at 0x%p\n", vmem_map);
657
689 for_each_online_node(node) { 658 for_each_online_node(node) {
690 memset(zones_size, 0, sizeof(zones_size)); 659 memset(zones_size, 0, sizeof(zones_size));
691 memset(zholes_size, 0, sizeof(zholes_size)); 660 memset(zholes_size, 0, sizeof(zholes_size));
@@ -719,15 +688,6 @@ void __init paging_init(void)
719 mem_data[node].num_dma_physpages); 688 mem_data[node].num_dma_physpages);
720 } 689 }
721 690
722 if (node == 0) {
723 vmalloc_end -=
724 PAGE_ALIGN(max_low_pfn * sizeof(struct page));
725 vmem_map = (struct page *) vmalloc_end;
726
727 efi_memmap_walk(create_mem_map_page_table, NULL);
728 printk("Virtual mem_map starts at 0x%p\n", vmem_map);
729 }
730
731 pfn_offset = mem_data[node].min_pfn; 691 pfn_offset = mem_data[node].min_pfn;
732 692
733 NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset; 693 NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset;
@@ -735,5 +695,11 @@ void __init paging_init(void)
735 pfn_offset, zholes_size); 695 pfn_offset, zholes_size);
736 } 696 }
737 697
698 /*
699 * Make memory less nodes become a member of the known nodes.
700 */
701 for_each_node_mask(node, memory_less_mask)
702 pgdat_insert(mem_data[node].pgdat);
703
738 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page)); 704 zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
739} 705}
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 4eb2f52b87..65f9958db9 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -597,7 +597,8 @@ mem_init (void)
597 kclist_add(&kcore_kernel, _stext, _end - _stext); 597 kclist_add(&kcore_kernel, _stext, _end - _stext);
598 598
599 for_each_pgdat(pgdat) 599 for_each_pgdat(pgdat)
600 totalram_pages += free_all_bootmem_node(pgdat); 600 if (pgdat->bdata->node_bootmem_map)
601 totalram_pages += free_all_bootmem_node(pgdat);
601 602
602 reserved_pages = 0; 603 reserved_pages = 0;
603 efi_memmap_walk(count_reserved_pages, &reserved_pages); 604 efi_memmap_walk(count_reserved_pages, &reserved_pages);
diff --git a/arch/ia64/sn/include/pci/pcibr_provider.h b/arch/ia64/sn/include/pci/pcibr_provider.h
deleted file mode 100644
index 1cd291d8ba..0000000000
--- a/arch/ia64/sn/include/pci/pcibr_provider.h
+++ /dev/null
@@ -1,151 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992-1997,2000-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8#ifndef _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H
9#define _ASM_IA64_SN_PCI_PCIBR_PROVIDER_H
10
11/* Workarounds */
12#define PV907516 (1 << 1) /* TIOCP: Don't write the write buffer flush reg */
13
14#define BUSTYPE_MASK 0x1
15
16/* Macros given a pcibus structure */
17#define IS_PCIX(ps) ((ps)->pbi_bridge_mode & BUSTYPE_MASK)
18#define IS_PCI_BRIDGE_ASIC(asic) (asic == PCIIO_ASIC_TYPE_PIC || \
19 asic == PCIIO_ASIC_TYPE_TIOCP)
20#define IS_PIC_SOFT(ps) (ps->pbi_bridge_type == PCIBR_BRIDGETYPE_PIC)
21
22
23/*
24 * The different PCI Bridge types supported on the SGI Altix platforms
25 */
26#define PCIBR_BRIDGETYPE_UNKNOWN -1
27#define PCIBR_BRIDGETYPE_PIC 2
28#define PCIBR_BRIDGETYPE_TIOCP 3
29
30/*
31 * Bridge 64bit Direct Map Attributes
32 */
33#define PCI64_ATTR_PREF (1ull << 59)
34#define PCI64_ATTR_PREC (1ull << 58)
35#define PCI64_ATTR_VIRTUAL (1ull << 57)
36#define PCI64_ATTR_BAR (1ull << 56)
37#define PCI64_ATTR_SWAP (1ull << 55)
38#define PCI64_ATTR_VIRTUAL1 (1ull << 54)
39
40#define PCI32_LOCAL_BASE 0
41#define PCI32_MAPPED_BASE 0x40000000
42#define PCI32_DIRECT_BASE 0x80000000
43
44#define IS_PCI32_MAPPED(x) ((uint64_t)(x) < PCI32_DIRECT_BASE && \
45 (uint64_t)(x) >= PCI32_MAPPED_BASE)
46#define IS_PCI32_DIRECT(x) ((uint64_t)(x) >= PCI32_MAPPED_BASE)
47
48
49/*
50 * Bridge PMU Address Transaltion Entry Attibutes
51 */
52#define PCI32_ATE_V (0x1 << 0)
53#define PCI32_ATE_CO (0x1 << 1)
54#define PCI32_ATE_PREC (0x1 << 2)
55#define PCI32_ATE_PREF (0x1 << 3)
56#define PCI32_ATE_BAR (0x1 << 4)
57#define PCI32_ATE_ADDR_SHFT 12
58
59#define MINIMAL_ATES_REQUIRED(addr, size) \
60 (IOPG(IOPGOFF(addr) + (size) - 1) == IOPG((size) - 1))
61
62#define MINIMAL_ATE_FLAG(addr, size) \
63 (MINIMAL_ATES_REQUIRED((uint64_t)addr, size) ? 1 : 0)
64
65/* bit 29 of the pci address is the SWAP bit */
66#define ATE_SWAPSHIFT 29
67#define ATE_SWAP_ON(x) ((x) |= (1 << ATE_SWAPSHIFT))
68#define ATE_SWAP_OFF(x) ((x) &= ~(1 << ATE_SWAPSHIFT))
69
70/*
71 * I/O page size
72 */
73#if PAGE_SIZE < 16384
74#define IOPFNSHIFT 12 /* 4K per mapped page */
75#else
76#define IOPFNSHIFT 14 /* 16K per mapped page */
77#endif
78
79#define IOPGSIZE (1 << IOPFNSHIFT)
80#define IOPG(x) ((x) >> IOPFNSHIFT)
81#define IOPGOFF(x) ((x) & (IOPGSIZE-1))
82
83#define PCIBR_DEV_SWAP_DIR (1ull << 19)
84#define PCIBR_CTRL_PAGE_SIZE (0x1 << 21)
85
86/*
87 * PMU resources.
88 */
89struct ate_resource{
90 uint64_t *ate;
91 uint64_t num_ate;
92 uint64_t lowest_free_index;
93};
94
95struct pcibus_info {
96 struct pcibus_bussoft pbi_buscommon; /* common header */
97 uint32_t pbi_moduleid;
98 short pbi_bridge_type;
99 short pbi_bridge_mode;
100
101 struct ate_resource pbi_int_ate_resource;
102 uint64_t pbi_int_ate_size;
103
104 uint64_t pbi_dir_xbase;
105 char pbi_hub_xid;
106
107 uint64_t pbi_devreg[8];
108 spinlock_t pbi_lock;
109
110 uint32_t pbi_valid_devices;
111 uint32_t pbi_enabled_devices;
112};
113
114/*
115 * pcibus_info structure locking macros
116 */
117inline static unsigned long
118pcibr_lock(struct pcibus_info *pcibus_info)
119{
120 unsigned long flag;
121 spin_lock_irqsave(&pcibus_info->pbi_lock, flag);
122 return(flag);
123}
124#define pcibr_unlock(pcibus_info, flag) spin_unlock_irqrestore(&pcibus_info->pbi_lock, flag)
125
126extern int pcibr_init_provider(void);
127extern void *pcibr_bus_fixup(struct pcibus_bussoft *);
128extern dma_addr_t pcibr_dma_map(struct pci_dev *, unsigned long, size_t);
129extern dma_addr_t pcibr_dma_map_consistent(struct pci_dev *, unsigned long, size_t);
130extern void pcibr_dma_unmap(struct pci_dev *, dma_addr_t, int);
131
132/*
133 * prototypes for the bridge asic register access routines in pcibr_reg.c
134 */
135extern void pcireg_control_bit_clr(struct pcibus_info *, uint64_t);
136extern void pcireg_control_bit_set(struct pcibus_info *, uint64_t);
137extern uint64_t pcireg_tflush_get(struct pcibus_info *);
138extern uint64_t pcireg_intr_status_get(struct pcibus_info *);
139extern void pcireg_intr_enable_bit_clr(struct pcibus_info *, uint64_t);
140extern void pcireg_intr_enable_bit_set(struct pcibus_info *, uint64_t);
141extern void pcireg_intr_addr_addr_set(struct pcibus_info *, int, uint64_t);
142extern void pcireg_force_intr_set(struct pcibus_info *, int);
143extern uint64_t pcireg_wrb_flush_get(struct pcibus_info *, int);
144extern void pcireg_int_ate_set(struct pcibus_info *, int, uint64_t);
145extern uint64_t * pcireg_int_ate_addr(struct pcibus_info *, int);
146extern void pcibr_force_interrupt(struct sn_irq_info *sn_irq_info);
147extern void pcibr_change_devices_irq(struct sn_irq_info *sn_irq_info);
148extern int pcibr_ate_alloc(struct pcibus_info *, int);
149extern void pcibr_ate_free(struct pcibus_info *, int);
150extern void ate_write(struct pcibus_info *, int, int, uint64_t);
151#endif
diff --git a/arch/ia64/sn/include/pci/pic.h b/arch/ia64/sn/include/pci/pic.h
deleted file mode 100644
index fd18acecb1..0000000000
--- a/arch/ia64/sn/include/pci/pic.h
+++ /dev/null
@@ -1,261 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 1992 - 1997, 2000-2003 Silicon Graphics, Inc. All rights reserved.
7 */
8#ifndef _ASM_IA64_SN_PCI_PIC_H
9#define _ASM_IA64_SN_PCI_PIC_H
10
11/*
12 * PIC AS DEVICE ZERO
13 * ------------------
14 *
15 * PIC handles PCI/X busses. PCI/X requires that the 'bridge' (i.e. PIC)
16 * be designated as 'device 0'. That is a departure from earlier SGI
17 * PCI bridges. Because of that we use config space 1 to access the
18 * config space of the first actual PCI device on the bus.
19 * Here's what the PIC manual says:
20 *
21 * The current PCI-X bus specification now defines that the parent
22 * hosts bus bridge (PIC for example) must be device 0 on bus 0. PIC
23 * reduced the total number of devices from 8 to 4 and removed the
24 * device registers and windows, now only supporting devices 0,1,2, and
25 * 3. PIC did leave all 8 configuration space windows. The reason was
26 * there was nothing to gain by removing them. Here in lies the problem.
27 * The device numbering we do using 0 through 3 is unrelated to the device
28 * numbering which PCI-X requires in configuration space. In the past we
29 * correlated Configs pace and our device space 0 <-> 0, 1 <-> 1, etc.
30 * PCI-X requires we start a 1, not 0 and currently the PX brick
31 * does associate our:
32 *
33 * device 0 with configuration space window 1,
34 * device 1 with configuration space window 2,
35 * device 2 with configuration space window 3,
36 * device 3 with configuration space window 4.
37 *
38 * The net effect is that all config space access are off-by-one with
39 * relation to other per-slot accesses on the PIC.
40 * Here is a table that shows some of that:
41 *
42 * Internal Slot#
43 * |
44 * | 0 1 2 3
45 * ----------|---------------------------------------
46 * config | 0x21000 0x22000 0x23000 0x24000
47 * |
48 * even rrb | 0[0] n/a 1[0] n/a [] == implied even/odd
49 * |
50 * odd rrb | n/a 0[1] n/a 1[1]
51 * |
52 * int dev | 00 01 10 11
53 * |
54 * ext slot# | 1 2 3 4
55 * ----------|---------------------------------------
56 */
57
58#define PIC_ATE_TARGETID_SHFT 8
59#define PIC_HOST_INTR_ADDR 0x0000FFFFFFFFFFFFUL
60#define PIC_PCI64_ATTR_TARG_SHFT 60
61
62
63/*****************************************************************************
64 *********************** PIC MMR structure mapping ***************************
65 *****************************************************************************/
66
67/* NOTE: PIC WAR. PV#854697. PIC does not allow writes just to [31:0]
68 * of a 64-bit register. When writing PIC registers, always write the
69 * entire 64 bits.
70 */
71
72struct pic {
73
74 /* 0x000000-0x00FFFF -- Local Registers */
75
76 /* 0x000000-0x000057 -- Standard Widget Configuration */
77 uint64_t p_wid_id; /* 0x000000 */
78 uint64_t p_wid_stat; /* 0x000008 */
79 uint64_t p_wid_err_upper; /* 0x000010 */
80 uint64_t p_wid_err_lower; /* 0x000018 */
81 #define p_wid_err p_wid_err_lower
82 uint64_t p_wid_control; /* 0x000020 */
83 uint64_t p_wid_req_timeout; /* 0x000028 */
84 uint64_t p_wid_int_upper; /* 0x000030 */
85 uint64_t p_wid_int_lower; /* 0x000038 */
86 #define p_wid_int p_wid_int_lower
87 uint64_t p_wid_err_cmdword; /* 0x000040 */
88 uint64_t p_wid_llp; /* 0x000048 */
89 uint64_t p_wid_tflush; /* 0x000050 */
90
91 /* 0x000058-0x00007F -- Bridge-specific Widget Configuration */
92 uint64_t p_wid_aux_err; /* 0x000058 */
93 uint64_t p_wid_resp_upper; /* 0x000060 */
94 uint64_t p_wid_resp_lower; /* 0x000068 */
95 #define p_wid_resp p_wid_resp_lower
96 uint64_t p_wid_tst_pin_ctrl; /* 0x000070 */
97 uint64_t p_wid_addr_lkerr; /* 0x000078 */
98
99 /* 0x000080-0x00008F -- PMU & MAP */
100 uint64_t p_dir_map; /* 0x000080 */
101 uint64_t _pad_000088; /* 0x000088 */
102
103 /* 0x000090-0x00009F -- SSRAM */
104 uint64_t p_map_fault; /* 0x000090 */
105 uint64_t _pad_000098; /* 0x000098 */
106
107 /* 0x0000A0-0x0000AF -- Arbitration */
108 uint64_t p_arb; /* 0x0000A0 */
109 uint64_t _pad_0000A8; /* 0x0000A8 */
110
111 /* 0x0000B0-0x0000BF -- Number In A Can or ATE Parity Error */
112 uint64_t p_ate_parity_err; /* 0x0000B0 */
113 uint64_t _pad_0000B8; /* 0x0000B8 */
114
115 /* 0x0000C0-0x0000FF -- PCI/GIO */
116 uint64_t p_bus_timeout; /* 0x0000C0 */
117 uint64_t p_pci_cfg; /* 0x0000C8 */
118 uint64_t p_pci_err_upper; /* 0x0000D0 */
119 uint64_t p_pci_err_lower; /* 0x0000D8 */
120 #define p_pci_err p_pci_err_lower
121 uint64_t _pad_0000E0[4]; /* 0x0000{E0..F8} */
122
123 /* 0x000100-0x0001FF -- Interrupt */
124 uint64_t p_int_status; /* 0x000100 */
125 uint64_t p_int_enable; /* 0x000108 */
126 uint64_t p_int_rst_stat; /* 0x000110 */
127 uint64_t p_int_mode; /* 0x000118 */
128 uint64_t p_int_device; /* 0x000120 */
129 uint64_t p_int_host_err; /* 0x000128 */
130 uint64_t p_int_addr[8]; /* 0x0001{30,,,68} */
131 uint64_t p_err_int_view; /* 0x000170 */
132 uint64_t p_mult_int; /* 0x000178 */
133 uint64_t p_force_always[8]; /* 0x0001{80,,,B8} */
134 uint64_t p_force_pin[8]; /* 0x0001{C0,,,F8} */
135
136 /* 0x000200-0x000298 -- Device */
137 uint64_t p_device[4]; /* 0x0002{00,,,18} */
138 uint64_t _pad_000220[4]; /* 0x0002{20,,,38} */
139 uint64_t p_wr_req_buf[4]; /* 0x0002{40,,,58} */
140 uint64_t _pad_000260[4]; /* 0x0002{60,,,78} */
141 uint64_t p_rrb_map[2]; /* 0x0002{80,,,88} */
142 #define p_even_resp p_rrb_map[0] /* 0x000280 */
143 #define p_odd_resp p_rrb_map[1] /* 0x000288 */
144 uint64_t p_resp_status; /* 0x000290 */
145 uint64_t p_resp_clear; /* 0x000298 */
146
147 uint64_t _pad_0002A0[12]; /* 0x0002{A0..F8} */
148
149 /* 0x000300-0x0003F8 -- Buffer Address Match Registers */
150 struct {
151 uint64_t upper; /* 0x0003{00,,,F0} */
152 uint64_t lower; /* 0x0003{08,,,F8} */
153 } p_buf_addr_match[16];
154
155 /* 0x000400-0x0005FF -- Performance Monitor Registers (even only) */
156 struct {
157 uint64_t flush_w_touch; /* 0x000{400,,,5C0} */
158 uint64_t flush_wo_touch; /* 0x000{408,,,5C8} */
159 uint64_t inflight; /* 0x000{410,,,5D0} */
160 uint64_t prefetch; /* 0x000{418,,,5D8} */
161 uint64_t total_pci_retry; /* 0x000{420,,,5E0} */
162 uint64_t max_pci_retry; /* 0x000{428,,,5E8} */
163 uint64_t max_latency; /* 0x000{430,,,5F0} */
164 uint64_t clear_all; /* 0x000{438,,,5F8} */
165 } p_buf_count[8];
166
167
168 /* 0x000600-0x0009FF -- PCI/X registers */
169 uint64_t p_pcix_bus_err_addr; /* 0x000600 */
170 uint64_t p_pcix_bus_err_attr; /* 0x000608 */
171 uint64_t p_pcix_bus_err_data; /* 0x000610 */
172 uint64_t p_pcix_pio_split_addr; /* 0x000618 */
173 uint64_t p_pcix_pio_split_attr; /* 0x000620 */
174 uint64_t p_pcix_dma_req_err_attr; /* 0x000628 */
175 uint64_t p_pcix_dma_req_err_addr; /* 0x000630 */
176 uint64_t p_pcix_timeout; /* 0x000638 */
177
178 uint64_t _pad_000640[120]; /* 0x000{640,,,9F8} */
179
180 /* 0x000A00-0x000BFF -- PCI/X Read&Write Buffer */
181 struct {
182 uint64_t p_buf_addr; /* 0x000{A00,,,AF0} */
183 uint64_t p_buf_attr; /* 0X000{A08,,,AF8} */
184 } p_pcix_read_buf_64[16];
185
186 struct {
187 uint64_t p_buf_addr; /* 0x000{B00,,,BE0} */
188 uint64_t p_buf_attr; /* 0x000{B08,,,BE8} */
189 uint64_t p_buf_valid; /* 0x000{B10,,,BF0} */
190 uint64_t __pad1; /* 0x000{B18,,,BF8} */
191 } p_pcix_write_buf_64[8];
192
193 /* End of Local Registers -- Start of Address Map space */
194
195 char _pad_000c00[0x010000 - 0x000c00];
196
197 /* 0x010000-0x011fff -- Internal ATE RAM (Auto Parity Generation) */
198 uint64_t p_int_ate_ram[1024]; /* 0x010000-0x011fff */
199
200 /* 0x012000-0x013fff -- Internal ATE RAM (Manual Parity Generation) */
201 uint64_t p_int_ate_ram_mp[1024]; /* 0x012000-0x013fff */
202
203 char _pad_014000[0x18000 - 0x014000];
204
205 /* 0x18000-0x197F8 -- PIC Write Request Ram */
206 uint64_t p_wr_req_lower[256]; /* 0x18000 - 0x187F8 */
207 uint64_t p_wr_req_upper[256]; /* 0x18800 - 0x18FF8 */
208 uint64_t p_wr_req_parity[256]; /* 0x19000 - 0x197F8 */
209
210 char _pad_019800[0x20000 - 0x019800];
211
212 /* 0x020000-0x027FFF -- PCI Device Configuration Spaces */
213 union {
214 uint8_t c[0x1000 / 1]; /* 0x02{0000,,,7FFF} */
215 uint16_t s[0x1000 / 2]; /* 0x02{0000,,,7FFF} */
216 uint32_t l[0x1000 / 4]; /* 0x02{0000,,,7FFF} */
217 uint64_t d[0x1000 / 8]; /* 0x02{0000,,,7FFF} */
218 union {
219 uint8_t c[0x100 / 1];
220 uint16_t s[0x100 / 2];
221 uint32_t l[0x100 / 4];
222 uint64_t d[0x100 / 8];
223 } f[8];
224 } p_type0_cfg_dev[8]; /* 0x02{0000,,,7FFF} */
225
226 /* 0x028000-0x028FFF -- PCI Type 1 Configuration Space */
227 union {
228 uint8_t c[0x1000 / 1]; /* 0x028000-0x029000 */
229 uint16_t s[0x1000 / 2]; /* 0x028000-0x029000 */
230 uint32_t l[0x1000 / 4]; /* 0x028000-0x029000 */
231 uint64_t d[0x1000 / 8]; /* 0x028000-0x029000 */
232 union {
233 uint8_t c[0x100 / 1];
234 uint16_t s[0x100 / 2];
235 uint32_t l[0x100 / 4];
236 uint64_t d[0x100 / 8];
237 } f[8];
238 } p_type1_cfg; /* 0x028000-0x029000 */
239
240 char _pad_029000[0x030000-0x029000];
241
242 /* 0x030000-0x030007 -- PCI Interrupt Acknowledge Cycle */
243 union {
244 uint8_t c[8 / 1];
245 uint16_t s[8 / 2];
246 uint32_t l[8 / 4];
247 uint64_t d[8 / 8];
248 } p_pci_iack; /* 0x030000-0x030007 */
249
250 char _pad_030007[0x040000-0x030008];
251
252 /* 0x040000-0x030007 -- PCIX Special Cycle */
253 union {
254 uint8_t c[8 / 1];
255 uint16_t s[8 / 2];
256 uint32_t l[8 / 4];
257 uint64_t d[8 / 8];
258 } p_pcix_cycle; /* 0x040000-0x040007 */
259};
260
261#endif /* _ASM_IA64_SN_PCI_PIC_H */
diff --git a/arch/ia64/sn/include/pci/tiocp.h b/arch/ia64/sn/include/pci/tiocp.h
deleted file mode 100644
index f07c83b2bf..0000000000
--- a/arch/ia64/sn/include/pci/tiocp.h
+++ /dev/null
@@ -1,256 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2003-2004 Silicon Graphics, Inc. All rights reserved.
7 */
8#ifndef _ASM_IA64_SN_PCI_TIOCP_H
9#define _ASM_IA64_SN_PCI_TIOCP_H
10
11#define TIOCP_HOST_INTR_ADDR 0x003FFFFFFFFFFFFFUL
12#define TIOCP_PCI64_CMDTYPE_MEM (0x1ull << 60)
13
14
15/*****************************************************************************
16 *********************** TIOCP MMR structure mapping ***************************
17 *****************************************************************************/
18
19struct tiocp{
20
21 /* 0x000000-0x00FFFF -- Local Registers */
22
23 /* 0x000000-0x000057 -- (Legacy Widget Space) Configuration */
24 uint64_t cp_id; /* 0x000000 */
25 uint64_t cp_stat; /* 0x000008 */
26 uint64_t cp_err_upper; /* 0x000010 */
27 uint64_t cp_err_lower; /* 0x000018 */
28 #define cp_err cp_err_lower
29 uint64_t cp_control; /* 0x000020 */
30 uint64_t cp_req_timeout; /* 0x000028 */
31 uint64_t cp_intr_upper; /* 0x000030 */
32 uint64_t cp_intr_lower; /* 0x000038 */
33 #define cp_intr cp_intr_lower
34 uint64_t cp_err_cmdword; /* 0x000040 */
35 uint64_t _pad_000048; /* 0x000048 */
36 uint64_t cp_tflush; /* 0x000050 */
37
38 /* 0x000058-0x00007F -- Bridge-specific Configuration */
39 uint64_t cp_aux_err; /* 0x000058 */
40 uint64_t cp_resp_upper; /* 0x000060 */
41 uint64_t cp_resp_lower; /* 0x000068 */
42 #define cp_resp cp_resp_lower
43 uint64_t cp_tst_pin_ctrl; /* 0x000070 */
44 uint64_t cp_addr_lkerr; /* 0x000078 */
45
46 /* 0x000080-0x00008F -- PMU & MAP */
47 uint64_t cp_dir_map; /* 0x000080 */
48 uint64_t _pad_000088; /* 0x000088 */
49
50 /* 0x000090-0x00009F -- SSRAM */
51 uint64_t cp_map_fault; /* 0x000090 */
52 uint64_t _pad_000098; /* 0x000098 */
53
54 /* 0x0000A0-0x0000AF -- Arbitration */
55 uint64_t cp_arb; /* 0x0000A0 */
56 uint64_t _pad_0000A8; /* 0x0000A8 */
57
58 /* 0x0000B0-0x0000BF -- Number In A Can or ATE Parity Error */
59 uint64_t cp_ate_parity_err; /* 0x0000B0 */
60 uint64_t _pad_0000B8; /* 0x0000B8 */
61
62 /* 0x0000C0-0x0000FF -- PCI/GIO */
63 uint64_t cp_bus_timeout; /* 0x0000C0 */
64 uint64_t cp_pci_cfg; /* 0x0000C8 */
65 uint64_t cp_pci_err_upper; /* 0x0000D0 */
66 uint64_t cp_pci_err_lower; /* 0x0000D8 */
67 #define cp_pci_err cp_pci_err_lower
68 uint64_t _pad_0000E0[4]; /* 0x0000{E0..F8} */
69
70 /* 0x000100-0x0001FF -- Interrupt */
71 uint64_t cp_int_status; /* 0x000100 */
72 uint64_t cp_int_enable; /* 0x000108 */
73 uint64_t cp_int_rst_stat; /* 0x000110 */
74 uint64_t cp_int_mode; /* 0x000118 */
75 uint64_t cp_int_device; /* 0x000120 */
76 uint64_t cp_int_host_err; /* 0x000128 */
77 uint64_t cp_int_addr[8]; /* 0x0001{30,,,68} */
78 uint64_t cp_err_int_view; /* 0x000170 */
79 uint64_t cp_mult_int; /* 0x000178 */
80 uint64_t cp_force_always[8]; /* 0x0001{80,,,B8} */
81 uint64_t cp_force_pin[8]; /* 0x0001{C0,,,F8} */
82
83 /* 0x000200-0x000298 -- Device */
84 uint64_t cp_device[4]; /* 0x0002{00,,,18} */
85 uint64_t _pad_000220[4]; /* 0x0002{20,,,38} */
86 uint64_t cp_wr_req_buf[4]; /* 0x0002{40,,,58} */
87 uint64_t _pad_000260[4]; /* 0x0002{60,,,78} */
88 uint64_t cp_rrb_map[2]; /* 0x0002{80,,,88} */
89 #define cp_even_resp cp_rrb_map[0] /* 0x000280 */
90 #define cp_odd_resp cp_rrb_map[1] /* 0x000288 */
91 uint64_t cp_resp_status; /* 0x000290 */
92 uint64_t cp_resp_clear; /* 0x000298 */
93
94 uint64_t _pad_0002A0[12]; /* 0x0002{A0..F8} */
95
96 /* 0x000300-0x0003F8 -- Buffer Address Match Registers */
97 struct {
98 uint64_t upper; /* 0x0003{00,,,F0} */
99 uint64_t lower; /* 0x0003{08,,,F8} */
100 } cp_buf_addr_match[16];
101
102 /* 0x000400-0x0005FF -- Performance Monitor Registers (even only) */
103 struct {
104 uint64_t flush_w_touch; /* 0x000{400,,,5C0} */
105 uint64_t flush_wo_touch; /* 0x000{408,,,5C8} */
106 uint64_t inflight; /* 0x000{410,,,5D0} */
107 uint64_t prefetch; /* 0x000{418,,,5D8} */
108 uint64_t total_pci_retry; /* 0x000{420,,,5E0} */
109 uint64_t max_pci_retry; /* 0x000{428,,,5E8} */
110 uint64_t max_latency; /* 0x000{430,,,5F0} */
111 uint64_t clear_all; /* 0x000{438,,,5F8} */
112 } cp_buf_count[8];
113
114
115 /* 0x000600-0x0009FF -- PCI/X registers */
116 uint64_t cp_pcix_bus_err_addr; /* 0x000600 */
117 uint64_t cp_pcix_bus_err_attr; /* 0x000608 */
118 uint64_t cp_pcix_bus_err_data; /* 0x000610 */
119 uint64_t cp_pcix_pio_split_addr; /* 0x000618 */
120 uint64_t cp_pcix_pio_split_attr; /* 0x000620 */
121 uint64_t cp_pcix_dma_req_err_attr; /* 0x000628 */
122 uint64_t cp_pcix_dma_req_err_addr; /* 0x000630 */
123 uint64_t cp_pcix_timeout; /* 0x000638 */
124
125 uint64_t _pad_000640[24]; /* 0x000{640,,,6F8} */
126
127 /* 0x000700-0x000737 -- Debug Registers */
128 uint64_t cp_ct_debug_ctl; /* 0x000700 */
129 uint64_t cp_br_debug_ctl; /* 0x000708 */
130 uint64_t cp_mux3_debug_ctl; /* 0x000710 */
131 uint64_t cp_mux4_debug_ctl; /* 0x000718 */
132 uint64_t cp_mux5_debug_ctl; /* 0x000720 */
133 uint64_t cp_mux6_debug_ctl; /* 0x000728 */
134 uint64_t cp_mux7_debug_ctl; /* 0x000730 */
135
136 uint64_t _pad_000738[89]; /* 0x000{738,,,9F8} */
137
138 /* 0x000A00-0x000BFF -- PCI/X Read&Write Buffer */
139 struct {
140 uint64_t cp_buf_addr; /* 0x000{A00,,,AF0} */
141 uint64_t cp_buf_attr; /* 0X000{A08,,,AF8} */
142 } cp_pcix_read_buf_64[16];
143
144 struct {
145 uint64_t cp_buf_addr; /* 0x000{B00,,,BE0} */
146 uint64_t cp_buf_attr; /* 0x000{B08,,,BE8} */
147 uint64_t cp_buf_valid; /* 0x000{B10,,,BF0} */
148 uint64_t __pad1; /* 0x000{B18,,,BF8} */
149 } cp_pcix_write_buf_64[8];
150
151 /* End of Local Registers -- Start of Address Map space */
152
153 char _pad_000c00[0x010000 - 0x000c00];
154
155 /* 0x010000-0x011FF8 -- Internal ATE RAM (Auto Parity Generation) */
156 uint64_t cp_int_ate_ram[1024]; /* 0x010000-0x011FF8 */
157
158 char _pad_012000[0x14000 - 0x012000];
159
160 /* 0x014000-0x015FF8 -- Internal ATE RAM (Manual Parity Generation) */
161 uint64_t cp_int_ate_ram_mp[1024]; /* 0x014000-0x015FF8 */
162
163 char _pad_016000[0x18000 - 0x016000];
164
165 /* 0x18000-0x197F8 -- TIOCP Write Request Ram */
166 uint64_t cp_wr_req_lower[256]; /* 0x18000 - 0x187F8 */
167 uint64_t cp_wr_req_upper[256]; /* 0x18800 - 0x18FF8 */
168 uint64_t cp_wr_req_parity[256]; /* 0x19000 - 0x197F8 */
169
170 char _pad_019800[0x1C000 - 0x019800];
171
172 /* 0x1C000-0x1EFF8 -- TIOCP Read Response Ram */
173 uint64_t cp_rd_resp_lower[512]; /* 0x1C000 - 0x1CFF8 */
174 uint64_t cp_rd_resp_upper[512]; /* 0x1D000 - 0x1DFF8 */
175 uint64_t cp_rd_resp_parity[512]; /* 0x1E000 - 0x1EFF8 */
176
177 char _pad_01F000[0x20000 - 0x01F000];
178
179 /* 0x020000-0x021FFF -- Host Device (CP) Configuration Space (not used) */
180 char _pad_020000[0x021000 - 0x20000];
181
182 /* 0x021000-0x027FFF -- PCI Device Configuration Spaces */
183 union {
184 uint8_t c[0x1000 / 1]; /* 0x02{0000,,,7FFF} */
185 uint16_t s[0x1000 / 2]; /* 0x02{0000,,,7FFF} */
186 uint32_t l[0x1000 / 4]; /* 0x02{0000,,,7FFF} */
187 uint64_t d[0x1000 / 8]; /* 0x02{0000,,,7FFF} */
188 union {
189 uint8_t c[0x100 / 1];
190 uint16_t s[0x100 / 2];
191 uint32_t l[0x100 / 4];
192 uint64_t d[0x100 / 8];
193 } f[8];
194 } cp_type0_cfg_dev[7]; /* 0x02{1000,,,7FFF} */
195
196 /* 0x028000-0x028FFF -- PCI Type 1 Configuration Space */
197 union {
198 uint8_t c[0x1000 / 1]; /* 0x028000-0x029000 */
199 uint16_t s[0x1000 / 2]; /* 0x028000-0x029000 */
200 uint32_t l[0x1000 / 4]; /* 0x028000-0x029000 */
201 uint64_t d[0x1000 / 8]; /* 0x028000-0x029000 */
202 union {
203 uint8_t c[0x100 / 1];
204 uint16_t s[0x100 / 2];
205 uint32_t l[0x100 / 4];
206 uint64_t d[0x100 / 8];
207 } f[8];
208 } cp_type1_cfg; /* 0x028000-0x029000 */
209
210 char _pad_029000[0x030000-0x029000];
211
212 /* 0x030000-0x030007 -- PCI Interrupt Acknowledge Cycle */
213 union {
214 uint8_t c[8 / 1];
215 uint16_t s[8 / 2];
216 uint32_t l[8 / 4];
217 uint64_t d[8 / 8];
218 } cp_pci_iack; /* 0x030000-0x030007 */
219
220 char _pad_030007[0x040000-0x030008];
221
222 /* 0x040000-0x040007 -- PCIX Special Cycle */
223 union {
224 uint8_t c[8 / 1];
225 uint16_t s[8 / 2];
226 uint32_t l[8 / 4];
227 uint64_t d[8 / 8];
228 } cp_pcix_cycle; /* 0x040000-0x040007 */
229
230 char _pad_040007[0x200000-0x040008];
231
232 /* 0x200000-0x7FFFFF -- PCI/GIO Device Spaces */
233 union {
234 uint8_t c[0x100000 / 1];
235 uint16_t s[0x100000 / 2];
236 uint32_t l[0x100000 / 4];
237 uint64_t d[0x100000 / 8];
238 } cp_devio_raw[6]; /* 0x200000-0x7FFFFF */
239
240 #define cp_devio(n) cp_devio_raw[((n)<2)?(n*2):(n+2)]
241
242 char _pad_800000[0xA00000-0x800000];
243
244 /* 0xA00000-0xBFFFFF -- PCI/GIO Device Spaces w/flush */
245 union {
246 uint8_t c[0x100000 / 1];
247 uint16_t s[0x100000 / 2];
248 uint32_t l[0x100000 / 4];
249 uint64_t d[0x100000 / 8];
250 } cp_devio_raw_flush[6]; /* 0xA00000-0xBFFFFF */
251
252 #define cp_devio_flush(n) cp_devio_raw_flush[((n)<2)?(n*2):(n+2)]
253
254};
255
256#endif /* _ASM_IA64_SN_PCI_TIOCP_H */
diff --git a/arch/ia64/sn/include/xtalk/hubdev.h b/arch/ia64/sn/include/xtalk/hubdev.h
index 868e7ecae8..580a1c0403 100644
--- a/arch/ia64/sn/include/xtalk/hubdev.h
+++ b/arch/ia64/sn/include/xtalk/hubdev.h
@@ -8,6 +8,8 @@
8#ifndef _ASM_IA64_SN_XTALK_HUBDEV_H 8#ifndef _ASM_IA64_SN_XTALK_HUBDEV_H
9#define _ASM_IA64_SN_XTALK_HUBDEV_H 9#define _ASM_IA64_SN_XTALK_HUBDEV_H
10 10
11#include "xtalk/xwidgetdev.h"
12
11#define HUB_WIDGET_ID_MAX 0xf 13#define HUB_WIDGET_ID_MAX 0xf
12#define DEV_PER_WIDGET (2*2*8) 14#define DEV_PER_WIDGET (2*2*8)
13#define IIO_ITTE_WIDGET_BITS 4 /* size of widget field */ 15#define IIO_ITTE_WIDGET_BITS 4 /* size of widget field */
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index 783eb43238..a67f39e448 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -9,21 +9,28 @@
9#include <linux/bootmem.h> 9#include <linux/bootmem.h>
10#include <linux/nodemask.h> 10#include <linux/nodemask.h>
11#include <asm/sn/types.h> 11#include <asm/sn/types.h>
12#include <asm/sn/sn_sal.h>
13#include <asm/sn/addrs.h> 12#include <asm/sn/addrs.h>
14#include <asm/sn/pcibus_provider_defs.h>
15#include <asm/sn/pcidev.h>
16#include "pci/pcibr_provider.h"
17#include "xtalk/xwidgetdev.h"
18#include <asm/sn/geo.h> 13#include <asm/sn/geo.h>
19#include "xtalk/hubdev.h"
20#include <asm/sn/io.h> 14#include <asm/sn/io.h>
15#include <asm/sn/pcibr_provider.h>
16#include <asm/sn/pcibus_provider_defs.h>
17#include <asm/sn/pcidev.h>
21#include <asm/sn/simulator.h> 18#include <asm/sn/simulator.h>
19#include <asm/sn/sn_sal.h>
22#include <asm/sn/tioca_provider.h> 20#include <asm/sn/tioca_provider.h>
21#include "xtalk/hubdev.h"
22#include "xtalk/xwidgetdev.h"
23 23
24char master_baseio_wid;
25nasid_t master_nasid = INVALID_NASID; /* Partition Master */ 24nasid_t master_nasid = INVALID_NASID; /* Partition Master */
26 25
26static struct list_head sn_sysdata_list;
27
28/* sysdata list struct */
29struct sysdata_el {
30 struct list_head entry;
31 void *sysdata;
32};
33
27struct slab_info { 34struct slab_info {
28 struct hubdev_info hubdev; 35 struct hubdev_info hubdev;
29}; 36};
@@ -138,23 +145,6 @@ sal_get_pcidev_info(u64 segment, u64 bus_number, u64 devfn, u64 pci_dev,
138} 145}
139 146
140/* 147/*
141 * sn_alloc_pci_sysdata() - This routine allocates a pci controller
142 * which is expected as the pci_dev and pci_bus sysdata by the Linux
143 * PCI infrastructure.
144 */
145static inline struct pci_controller *sn_alloc_pci_sysdata(void)
146{
147 struct pci_controller *pci_sysdata;
148
149 pci_sysdata = kmalloc(sizeof(*pci_sysdata), GFP_KERNEL);
150 if (!pci_sysdata)
151 BUG();
152
153 memset(pci_sysdata, 0, sizeof(*pci_sysdata));
154 return pci_sysdata;
155}
156
157/*
158 * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for 148 * sn_fixup_ionodes() - This routine initializes the HUB data strcuture for
159 * each node in the system. 149 * each node in the system.
160 */ 150 */
@@ -221,22 +211,34 @@ static void sn_fixup_ionodes(void)
221 211
222} 212}
223 213
214void sn_pci_unfixup_slot(struct pci_dev *dev)
215{
216 struct pci_dev *host_pci_dev = SN_PCIDEV_INFO(dev)->host_pci_dev;
217
218 sn_irq_unfixup(dev);
219 pci_dev_put(host_pci_dev);
220 pci_dev_put(dev);
221}
222
224/* 223/*
225 * sn_pci_fixup_slot() - This routine sets up a slot's resources 224 * sn_pci_fixup_slot() - This routine sets up a slot's resources
226 * consistent with the Linux PCI abstraction layer. Resources acquired 225 * consistent with the Linux PCI abstraction layer. Resources acquired
227 * from our PCI provider include PIO maps to BAR space and interrupt 226 * from our PCI provider include PIO maps to BAR space and interrupt
228 * objects. 227 * objects.
229 */ 228 */
230static void sn_pci_fixup_slot(struct pci_dev *dev) 229void sn_pci_fixup_slot(struct pci_dev *dev)
231{ 230{
232 int idx; 231 int idx;
233 int segment = 0; 232 int segment = 0;
234 uint64_t size;
235 struct sn_irq_info *sn_irq_info;
236 struct pci_dev *host_pci_dev;
237 int status = 0; 233 int status = 0;
238 struct pcibus_bussoft *bs; 234 struct pcibus_bussoft *bs;
235 struct pci_bus *host_pci_bus;
236 struct pci_dev *host_pci_dev;
237 struct sn_irq_info *sn_irq_info;
238 unsigned long size;
239 unsigned int bus_no, devfn;
239 240
241 pci_dev_get(dev); /* for the sysdata pointer */
240 dev->sysdata = kmalloc(sizeof(struct pcidev_info), GFP_KERNEL); 242 dev->sysdata = kmalloc(sizeof(struct pcidev_info), GFP_KERNEL);
241 if (SN_PCIDEV_INFO(dev) <= 0) 243 if (SN_PCIDEV_INFO(dev) <= 0)
242 BUG(); /* Cannot afford to run out of memory */ 244 BUG(); /* Cannot afford to run out of memory */
@@ -253,7 +255,7 @@ static void sn_pci_fixup_slot(struct pci_dev *dev)
253 (u64) __pa(SN_PCIDEV_INFO(dev)), 255 (u64) __pa(SN_PCIDEV_INFO(dev)),
254 (u64) __pa(sn_irq_info)); 256 (u64) __pa(sn_irq_info));
255 if (status) 257 if (status)
256 BUG(); /* Cannot get platform pci device information information */ 258 BUG(); /* Cannot get platform pci device information */
257 259
258 /* Copy over PIO Mapped Addresses */ 260 /* Copy over PIO Mapped Addresses */
259 for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) { 261 for (idx = 0; idx <= PCI_ROM_RESOURCE; idx++) {
@@ -275,15 +277,21 @@ static void sn_pci_fixup_slot(struct pci_dev *dev)
275 dev->resource[idx].parent = &iomem_resource; 277 dev->resource[idx].parent = &iomem_resource;
276 } 278 }
277 279
278 /* set up host bus linkages */ 280 /*
279 bs = SN_PCIBUS_BUSSOFT(dev->bus); 281 * Using the PROMs values for the PCI host bus, get the Linux
280 host_pci_dev = 282 * PCI host_pci_dev struct and set up host bus linkages
281 pci_find_slot(SN_PCIDEV_INFO(dev)->pdi_slot_host_handle >> 32, 283 */
282 SN_PCIDEV_INFO(dev)-> 284
283 pdi_slot_host_handle & 0xffffffff); 285 bus_no = SN_PCIDEV_INFO(dev)->pdi_slot_host_handle >> 32;
286 devfn = SN_PCIDEV_INFO(dev)->pdi_slot_host_handle & 0xffffffff;
287 host_pci_bus = pci_find_bus(pci_domain_nr(dev->bus), bus_no);
288 host_pci_dev = pci_get_slot(host_pci_bus, devfn);
289
290 SN_PCIDEV_INFO(dev)->host_pci_dev = host_pci_dev;
284 SN_PCIDEV_INFO(dev)->pdi_host_pcidev_info = 291 SN_PCIDEV_INFO(dev)->pdi_host_pcidev_info =
285 SN_PCIDEV_INFO(host_pci_dev); 292 SN_PCIDEV_INFO(host_pci_dev);
286 SN_PCIDEV_INFO(dev)->pdi_linux_pcidev = dev; 293 SN_PCIDEV_INFO(dev)->pdi_linux_pcidev = dev;
294 bs = SN_PCIBUS_BUSSOFT(dev->bus);
287 SN_PCIDEV_INFO(dev)->pdi_pcibus_info = bs; 295 SN_PCIDEV_INFO(dev)->pdi_pcibus_info = bs;
288 296
289 if (bs && bs->bs_asic_type < PCIIO_ASIC_MAX_TYPES) { 297 if (bs && bs->bs_asic_type < PCIIO_ASIC_MAX_TYPES) {
@@ -297,6 +305,9 @@ static void sn_pci_fixup_slot(struct pci_dev *dev)
297 SN_PCIDEV_INFO(dev)->pdi_sn_irq_info = sn_irq_info; 305 SN_PCIDEV_INFO(dev)->pdi_sn_irq_info = sn_irq_info;
298 dev->irq = SN_PCIDEV_INFO(dev)->pdi_sn_irq_info->irq_irq; 306 dev->irq = SN_PCIDEV_INFO(dev)->pdi_sn_irq_info->irq_irq;
299 sn_irq_fixup(dev, sn_irq_info); 307 sn_irq_fixup(dev, sn_irq_info);
308 } else {
309 SN_PCIDEV_INFO(dev)->pdi_sn_irq_info = NULL;
310 kfree(sn_irq_info);
300 } 311 }
301} 312}
302 313
@@ -304,55 +315,57 @@ static void sn_pci_fixup_slot(struct pci_dev *dev)
304 * sn_pci_controller_fixup() - This routine sets up a bus's resources 315 * sn_pci_controller_fixup() - This routine sets up a bus's resources
305 * consistent with the Linux PCI abstraction layer. 316 * consistent with the Linux PCI abstraction layer.
306 */ 317 */
307static void sn_pci_controller_fixup(int segment, int busnum) 318void sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
308{ 319{
309 int status = 0; 320 int status = 0;
310 int nasid, cnode; 321 int nasid, cnode;
311 struct pci_bus *bus;
312 struct pci_controller *controller; 322 struct pci_controller *controller;
313 struct pcibus_bussoft *prom_bussoft_ptr; 323 struct pcibus_bussoft *prom_bussoft_ptr;
314 struct hubdev_info *hubdev_info; 324 struct hubdev_info *hubdev_info;
315 void *provider_soft; 325 void *provider_soft;
316 struct sn_pcibus_provider *provider; 326 struct sn_pcibus_provider *provider;
317 327
318 status = 328 status = sal_get_pcibus_info((u64) segment, (u64) busnum,
319 sal_get_pcibus_info((u64) segment, (u64) busnum, 329 (u64) ia64_tpa(&prom_bussoft_ptr));
320 (u64) ia64_tpa(&prom_bussoft_ptr)); 330 if (status > 0)
321 if (status > 0) { 331 return; /*bus # does not exist */
322 return; /* bus # does not exist */
323 }
324
325 prom_bussoft_ptr = __va(prom_bussoft_ptr); 332 prom_bussoft_ptr = __va(prom_bussoft_ptr);
326 controller = sn_alloc_pci_sysdata();
327 /* controller non-zero is BUG'd in sn_alloc_pci_sysdata */
328 333
329 bus = pci_scan_bus(busnum, &pci_root_ops, controller); 334 controller = kcalloc(1,sizeof(struct pci_controller), GFP_KERNEL);
335 if (!controller)
336 BUG();
337
330 if (bus == NULL) { 338 if (bus == NULL) {
331 return; /* error, or bus already scanned */ 339 bus = pci_scan_bus(busnum, &pci_root_ops, controller);
340 if (bus == NULL)
341 return; /* error, or bus already scanned */
342 bus->sysdata = NULL;
332 } 343 }
333 344
345 if (bus->sysdata)
346 goto error_return; /* sysdata already alloc'd */
347
334 /* 348 /*
335 * Per-provider fixup. Copies the contents from prom to local 349 * Per-provider fixup. Copies the contents from prom to local
336 * area and links SN_PCIBUS_BUSSOFT(). 350 * area and links SN_PCIBUS_BUSSOFT().
337 */ 351 */
338 352
339 if (prom_bussoft_ptr->bs_asic_type >= PCIIO_ASIC_MAX_TYPES) { 353 if (prom_bussoft_ptr->bs_asic_type >= PCIIO_ASIC_MAX_TYPES)
340 return; /* unsupported asic type */ 354 return; /* unsupported asic type */
341 } 355
356 if (prom_bussoft_ptr->bs_asic_type == PCIIO_ASIC_TYPE_PPB)
357 goto error_return; /* no further fixup necessary */
342 358
343 provider = sn_pci_provider[prom_bussoft_ptr->bs_asic_type]; 359 provider = sn_pci_provider[prom_bussoft_ptr->bs_asic_type];
344 if (provider == NULL) { 360 if (provider == NULL)
345 return; /* no provider registerd for this asic */ 361 return; /* no provider registerd for this asic */
346 }
347 362
348 provider_soft = NULL; 363 provider_soft = NULL;
349 if (provider->bus_fixup) { 364 if (provider->bus_fixup)
350 provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr); 365 provider_soft = (*provider->bus_fixup) (prom_bussoft_ptr);
351 }
352 366
353 if (provider_soft == NULL) { 367 if (provider_soft == NULL)
354 return; /* fixup failed or not applicable */ 368 return; /* fixup failed or not applicable */
355 }
356 369
357 /* 370 /*
358 * Generic bus fixup goes here. Don't reference prom_bussoft_ptr 371 * Generic bus fixup goes here. Don't reference prom_bussoft_ptr
@@ -361,12 +374,47 @@ static void sn_pci_controller_fixup(int segment, int busnum)
361 374
362 bus->sysdata = controller; 375 bus->sysdata = controller;
363 PCI_CONTROLLER(bus)->platform_data = provider_soft; 376 PCI_CONTROLLER(bus)->platform_data = provider_soft;
364
365 nasid = NASID_GET(SN_PCIBUS_BUSSOFT(bus)->bs_base); 377 nasid = NASID_GET(SN_PCIBUS_BUSSOFT(bus)->bs_base);
366 cnode = nasid_to_cnodeid(nasid); 378 cnode = nasid_to_cnodeid(nasid);
367 hubdev_info = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo); 379 hubdev_info = (struct hubdev_info *)(NODEPDA(cnode)->pdinfo);
368 SN_PCIBUS_BUSSOFT(bus)->bs_xwidget_info = 380 SN_PCIBUS_BUSSOFT(bus)->bs_xwidget_info =
369 &(hubdev_info->hdi_xwidget_info[SN_PCIBUS_BUSSOFT(bus)->bs_xid]); 381 &(hubdev_info->hdi_xwidget_info[SN_PCIBUS_BUSSOFT(bus)->bs_xid]);
382
383 return;
384
385error_return:
386
387 kfree(controller);
388 return;
389}
390
391void sn_bus_store_sysdata(struct pci_dev *dev)
392{
393 struct sysdata_el *element;
394
395 element = kcalloc(1, sizeof(struct sysdata_el), GFP_KERNEL);
396 if (!element) {
397 dev_dbg(dev, "%s: out of memory!\n", __FUNCTION__);
398 return;
399 }
400 element->sysdata = dev->sysdata;
401 list_add(&element->entry, &sn_sysdata_list);
402}
403
404void sn_bus_free_sysdata(void)
405{
406 struct sysdata_el *element;
407 struct list_head *list;
408
409sn_sysdata_free_start:
410 list_for_each(list, &sn_sysdata_list) {
411 element = list_entry(list, struct sysdata_el, entry);
412 list_del(&element->entry);
413 kfree(element->sysdata);
414 kfree(element);
415 goto sn_sysdata_free_start;
416 }
417 return;
370} 418}
371 419
372/* 420/*
@@ -403,20 +451,17 @@ static int __init sn_pci_init(void)
403 */ 451 */
404 ia64_max_iommu_merge_mask = ~PAGE_MASK; 452 ia64_max_iommu_merge_mask = ~PAGE_MASK;
405 sn_fixup_ionodes(); 453 sn_fixup_ionodes();
406 sn_irq = kmalloc(sizeof(struct sn_irq_info *) * NR_IRQS, GFP_KERNEL); 454 sn_irq_lh_init();
407 if (sn_irq <= 0) 455 INIT_LIST_HEAD(&sn_sysdata_list);
408 BUG(); /* Canno afford to run out of memory. */
409 memset(sn_irq, 0, sizeof(struct sn_irq_info *) * NR_IRQS);
410
411 sn_init_cpei_timer(); 456 sn_init_cpei_timer();
412 457
413#ifdef CONFIG_PROC_FS 458#ifdef CONFIG_PROC_FS
414 register_sn_procfs(); 459 register_sn_procfs();
415#endif 460#endif
416 461
417 for (i = 0; i < PCI_BUSES_TO_SCAN; i++) { 462 /* busses are not known yet ... */
418 sn_pci_controller_fixup(0, i); 463 for (i = 0; i < PCI_BUSES_TO_SCAN; i++)
419 } 464 sn_pci_controller_fixup(0, i, NULL);
420 465
421 /* 466 /*
422 * Generic Linux PCI Layer has created the pci_bus and pci_dev 467 * Generic Linux PCI Layer has created the pci_bus and pci_dev
@@ -425,9 +470,8 @@ static int __init sn_pci_init(void)
425 */ 470 */
426 471
427 while ((pci_dev = 472 while ((pci_dev =
428 pci_find_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) != NULL) { 473 pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pci_dev)) != NULL)
429 sn_pci_fixup_slot(pci_dev); 474 sn_pci_fixup_slot(pci_dev);
430 }
431 475
432 sn_ioif_inited = 1; /* sn I/O infrastructure now initialized */ 476 sn_ioif_inited = 1; /* sn I/O infrastructure now initialized */
433 477
@@ -469,3 +513,8 @@ cnodeid_get_geoid(cnodeid_t cnode)
469} 513}
470 514
471subsys_initcall(sn_pci_init); 515subsys_initcall(sn_pci_init);
516EXPORT_SYMBOL(sn_pci_fixup_slot);
517EXPORT_SYMBOL(sn_pci_unfixup_slot);
518EXPORT_SYMBOL(sn_pci_controller_fixup);
519EXPORT_SYMBOL(sn_bus_store_sysdata);
520EXPORT_SYMBOL(sn_bus_free_sysdata);
diff --git a/arch/ia64/sn/kernel/irq.c b/arch/ia64/sn/kernel/irq.c
index 0f4e813865..84d276a14e 100644
--- a/arch/ia64/sn/kernel/irq.c
+++ b/arch/ia64/sn/kernel/irq.c
@@ -9,13 +9,13 @@
9 */ 9 */
10 10
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <asm/sn/intr.h> 12#include <linux/spinlock.h>
13#include <asm/sn/addrs.h> 13#include <asm/sn/addrs.h>
14#include <asm/sn/arch.h> 14#include <asm/sn/arch.h>
15#include "xtalk/xwidgetdev.h" 15#include <asm/sn/intr.h>
16#include <asm/sn/pcibr_provider.h>
16#include <asm/sn/pcibus_provider_defs.h> 17#include <asm/sn/pcibus_provider_defs.h>
17#include <asm/sn/pcidev.h> 18#include <asm/sn/pcidev.h>
18#include "pci/pcibr_provider.h"
19#include <asm/sn/shub_mmr.h> 19#include <asm/sn/shub_mmr.h>
20#include <asm/sn/sn_sal.h> 20#include <asm/sn/sn_sal.h>
21 21
@@ -25,7 +25,8 @@ static void unregister_intr_pda(struct sn_irq_info *sn_irq_info);
25 25
26extern int sn_force_interrupt_flag; 26extern int sn_force_interrupt_flag;
27extern int sn_ioif_inited; 27extern int sn_ioif_inited;
28struct sn_irq_info **sn_irq; 28static struct list_head **sn_irq_lh;
29static spinlock_t sn_irq_info_lock = SPIN_LOCK_UNLOCKED; /* non-IRQ lock */
29 30
30static inline uint64_t sn_intr_alloc(nasid_t local_nasid, int local_widget, 31static inline uint64_t sn_intr_alloc(nasid_t local_nasid, int local_widget,
31 u64 sn_irq_info, 32 u64 sn_irq_info,
@@ -101,7 +102,7 @@ static void sn_end_irq(unsigned int irq)
101 nasid = get_nasid(); 102 nasid = get_nasid();
102 event_occurred = HUB_L((uint64_t *) GLOBAL_MMR_ADDR 103 event_occurred = HUB_L((uint64_t *) GLOBAL_MMR_ADDR
103 (nasid, SH_EVENT_OCCURRED)); 104 (nasid, SH_EVENT_OCCURRED));
104 /* If the UART bit is set here, we may have received an 105 /* If the UART bit is set here, we may have received an
105 * interrupt from the UART that the driver missed. To 106 * interrupt from the UART that the driver missed. To
106 * make sure, we IPI ourselves to force us to look again. 107 * make sure, we IPI ourselves to force us to look again.
107 */ 108 */
@@ -115,82 +116,84 @@ static void sn_end_irq(unsigned int irq)
115 force_interrupt(irq); 116 force_interrupt(irq);
116} 117}
117 118
119static void sn_irq_info_free(struct rcu_head *head);
120
118static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask) 121static void sn_set_affinity_irq(unsigned int irq, cpumask_t mask)
119{ 122{
120 struct sn_irq_info *sn_irq_info = sn_irq[irq]; 123 struct sn_irq_info *sn_irq_info, *sn_irq_info_safe;
121 struct sn_irq_info *tmp_sn_irq_info;
122 int cpuid, cpuphys; 124 int cpuid, cpuphys;
123 nasid_t t_nasid; /* nasid to target */
124 int t_slice; /* slice to target */
125
126 /* allocate a temp sn_irq_info struct to get new target info */
127 tmp_sn_irq_info = kmalloc(sizeof(*tmp_sn_irq_info), GFP_KERNEL);
128 if (!tmp_sn_irq_info)
129 return;
130 125
131 cpuid = first_cpu(mask); 126 cpuid = first_cpu(mask);
132 cpuphys = cpu_physical_id(cpuid); 127 cpuphys = cpu_physical_id(cpuid);
133 t_nasid = cpuid_to_nasid(cpuid);
134 t_slice = cpuid_to_slice(cpuid);
135 128
136 while (sn_irq_info) { 129 list_for_each_entry_safe(sn_irq_info, sn_irq_info_safe,
137 int status; 130 sn_irq_lh[irq], list) {
138 int local_widget; 131 uint64_t bridge;
139 uint64_t bridge = (uint64_t) sn_irq_info->irq_bridge; 132 int local_widget, status;
140 nasid_t local_nasid = NASID_GET(bridge); 133 nasid_t local_nasid;
134 struct sn_irq_info *new_irq_info;
135
136 new_irq_info = kmalloc(sizeof(struct sn_irq_info), GFP_ATOMIC);
137 if (new_irq_info == NULL)
138 break;
139 memcpy(new_irq_info, sn_irq_info, sizeof(struct sn_irq_info));
140
141 bridge = (uint64_t) new_irq_info->irq_bridge;
142 if (!bridge) {
143 kfree(new_irq_info);
144 break; /* irq is not a device interrupt */
145 }
141 146
142 if (!bridge) 147 local_nasid = NASID_GET(bridge);
143 break; /* irq is not a device interrupt */
144 148
145 if (local_nasid & 1) 149 if (local_nasid & 1)
146 local_widget = TIO_SWIN_WIDGETNUM(bridge); 150 local_widget = TIO_SWIN_WIDGETNUM(bridge);
147 else 151 else
148 local_widget = SWIN_WIDGETNUM(bridge); 152 local_widget = SWIN_WIDGETNUM(bridge);
149 153
150 /* Free the old PROM sn_irq_info structure */ 154 /* Free the old PROM new_irq_info structure */
151 sn_intr_free(local_nasid, local_widget, sn_irq_info); 155 sn_intr_free(local_nasid, local_widget, new_irq_info);
156 /* Update kernels new_irq_info with new target info */
157 unregister_intr_pda(new_irq_info);
152 158
153 /* allocate a new PROM sn_irq_info struct */ 159 /* allocate a new PROM new_irq_info struct */
154 status = sn_intr_alloc(local_nasid, local_widget, 160 status = sn_intr_alloc(local_nasid, local_widget,
155 __pa(tmp_sn_irq_info), irq, t_nasid, 161 __pa(new_irq_info), irq,
156 t_slice); 162 cpuid_to_nasid(cpuid),
157 163 cpuid_to_slice(cpuid));
158 if (status == 0) { 164
159 /* Update kernels sn_irq_info with new target info */ 165 /* SAL call failed */
160 unregister_intr_pda(sn_irq_info); 166 if (status) {
161 sn_irq_info->irq_cpuid = cpuid; 167 kfree(new_irq_info);
162 sn_irq_info->irq_nasid = t_nasid; 168 break;
163 sn_irq_info->irq_slice = t_slice; 169 }
164 sn_irq_info->irq_xtalkaddr = 170
165 tmp_sn_irq_info->irq_xtalkaddr; 171 new_irq_info->irq_cpuid = cpuid;
166 sn_irq_info->irq_cookie = tmp_sn_irq_info->irq_cookie; 172 register_intr_pda(new_irq_info);
167 register_intr_pda(sn_irq_info); 173
168 174 if (IS_PCI_BRIDGE_ASIC(new_irq_info->irq_bridge_type))
169 if (IS_PCI_BRIDGE_ASIC(sn_irq_info->irq_bridge_type)) { 175 pcibr_change_devices_irq(new_irq_info);
170 pcibr_change_devices_irq(sn_irq_info);
171 }
172 176
173 sn_irq_info = sn_irq_info->irq_next; 177 spin_lock(&sn_irq_info_lock);
178 list_replace_rcu(&sn_irq_info->list, &new_irq_info->list);
179 spin_unlock(&sn_irq_info_lock);
180 call_rcu(&sn_irq_info->rcu, sn_irq_info_free);
174 181
175#ifdef CONFIG_SMP 182#ifdef CONFIG_SMP
176 set_irq_affinity_info((irq & 0xff), cpuphys, 0); 183 set_irq_affinity_info((irq & 0xff), cpuphys, 0);
177#endif 184#endif
178 } else {
179 break; /* snp_affinity failed the intr_alloc */
180 }
181 } 185 }
182 kfree(tmp_sn_irq_info);
183} 186}
184 187
185struct hw_interrupt_type irq_type_sn = { 188struct hw_interrupt_type irq_type_sn = {
186 "SN hub", 189 .typename = "SN hub",
187 sn_startup_irq, 190 .startup = sn_startup_irq,
188 sn_shutdown_irq, 191 .shutdown = sn_shutdown_irq,
189 sn_enable_irq, 192 .enable = sn_enable_irq,
190 sn_disable_irq, 193 .disable = sn_disable_irq,
191 sn_ack_irq, 194 .ack = sn_ack_irq,
192 sn_end_irq, 195 .end = sn_end_irq,
193 sn_set_affinity_irq 196 .set_affinity = sn_set_affinity_irq
194}; 197};
195 198
196unsigned int sn_local_vector_to_irq(u8 vector) 199unsigned int sn_local_vector_to_irq(u8 vector)
@@ -231,19 +234,18 @@ static void unregister_intr_pda(struct sn_irq_info *sn_irq_info)
231 struct sn_irq_info *tmp_irq_info; 234 struct sn_irq_info *tmp_irq_info;
232 int i, foundmatch; 235 int i, foundmatch;
233 236
237 rcu_read_lock();
234 if (pdacpu(cpu)->sn_last_irq == irq) { 238 if (pdacpu(cpu)->sn_last_irq == irq) {
235 foundmatch = 0; 239 foundmatch = 0;
236 for (i = pdacpu(cpu)->sn_last_irq - 1; i; i--) { 240 for (i = pdacpu(cpu)->sn_last_irq - 1;
237 tmp_irq_info = sn_irq[i]; 241 i && !foundmatch; i--) {
238 while (tmp_irq_info) { 242 list_for_each_entry_rcu(tmp_irq_info,
243 sn_irq_lh[i],
244 list) {
239 if (tmp_irq_info->irq_cpuid == cpu) { 245 if (tmp_irq_info->irq_cpuid == cpu) {
240 foundmatch++; 246 foundmatch = 1;
241 break; 247 break;
242 } 248 }
243 tmp_irq_info = tmp_irq_info->irq_next;
244 }
245 if (foundmatch) {
246 break;
247 } 249 }
248 } 250 }
249 pdacpu(cpu)->sn_last_irq = i; 251 pdacpu(cpu)->sn_last_irq = i;
@@ -251,60 +253,27 @@ static void unregister_intr_pda(struct sn_irq_info *sn_irq_info)
251 253
252 if (pdacpu(cpu)->sn_first_irq == irq) { 254 if (pdacpu(cpu)->sn_first_irq == irq) {
253 foundmatch = 0; 255 foundmatch = 0;
254 for (i = pdacpu(cpu)->sn_first_irq + 1; i < NR_IRQS; i++) { 256 for (i = pdacpu(cpu)->sn_first_irq + 1;
255 tmp_irq_info = sn_irq[i]; 257 i < NR_IRQS && !foundmatch; i++) {
256 while (tmp_irq_info) { 258 list_for_each_entry_rcu(tmp_irq_info,
259 sn_irq_lh[i],
260 list) {
257 if (tmp_irq_info->irq_cpuid == cpu) { 261 if (tmp_irq_info->irq_cpuid == cpu) {
258 foundmatch++; 262 foundmatch = 1;
259 break; 263 break;
260 } 264 }
261 tmp_irq_info = tmp_irq_info->irq_next;
262 }
263 if (foundmatch) {
264 break;
265 } 265 }
266 } 266 }
267 pdacpu(cpu)->sn_first_irq = ((i == NR_IRQS) ? 0 : i); 267 pdacpu(cpu)->sn_first_irq = ((i == NR_IRQS) ? 0 : i);
268 } 268 }
269 rcu_read_unlock();
269} 270}
270 271
271struct sn_irq_info *sn_irq_alloc(nasid_t local_nasid, int local_widget, int irq, 272static void sn_irq_info_free(struct rcu_head *head)
272 nasid_t nasid, int slice)
273{ 273{
274 struct sn_irq_info *sn_irq_info; 274 struct sn_irq_info *sn_irq_info;
275 int status;
276
277 sn_irq_info = kmalloc(sizeof(*sn_irq_info), GFP_KERNEL);
278 if (sn_irq_info == NULL)
279 return NULL;
280
281 memset(sn_irq_info, 0x0, sizeof(*sn_irq_info));
282
283 status =
284 sn_intr_alloc(local_nasid, local_widget, __pa(sn_irq_info), irq,
285 nasid, slice);
286
287 if (status) {
288 kfree(sn_irq_info);
289 return NULL;
290 } else {
291 return sn_irq_info;
292 }
293}
294
295void sn_irq_free(struct sn_irq_info *sn_irq_info)
296{
297 uint64_t bridge = (uint64_t) sn_irq_info->irq_bridge;
298 nasid_t local_nasid = NASID_GET(bridge);
299 int local_widget;
300
301 if (local_nasid & 1) /* tio check */
302 local_widget = TIO_SWIN_WIDGETNUM(bridge);
303 else
304 local_widget = SWIN_WIDGETNUM(bridge);
305
306 sn_intr_free(local_nasid, local_widget, sn_irq_info);
307 275
276 sn_irq_info = container_of(head, struct sn_irq_info, rcu);
308 kfree(sn_irq_info); 277 kfree(sn_irq_info);
309} 278}
310 279
@@ -314,30 +283,54 @@ void sn_irq_fixup(struct pci_dev *pci_dev, struct sn_irq_info *sn_irq_info)
314 int slice = sn_irq_info->irq_slice; 283 int slice = sn_irq_info->irq_slice;
315 int cpu = nasid_slice_to_cpuid(nasid, slice); 284 int cpu = nasid_slice_to_cpuid(nasid, slice);
316 285
286 pci_dev_get(pci_dev);
317 sn_irq_info->irq_cpuid = cpu; 287 sn_irq_info->irq_cpuid = cpu;
318 sn_irq_info->irq_pciioinfo = SN_PCIDEV_INFO(pci_dev); 288 sn_irq_info->irq_pciioinfo = SN_PCIDEV_INFO(pci_dev);
319 289
320 /* link it into the sn_irq[irq] list */ 290 /* link it into the sn_irq[irq] list */
321 sn_irq_info->irq_next = sn_irq[sn_irq_info->irq_irq]; 291 spin_lock(&sn_irq_info_lock);
322 sn_irq[sn_irq_info->irq_irq] = sn_irq_info; 292 list_add_rcu(&sn_irq_info->list, sn_irq_lh[sn_irq_info->irq_irq]);
293 spin_unlock(&sn_irq_info_lock);
323 294
324 (void)register_intr_pda(sn_irq_info); 295 (void)register_intr_pda(sn_irq_info);
325} 296}
326 297
298void sn_irq_unfixup(struct pci_dev *pci_dev)
299{
300 struct sn_irq_info *sn_irq_info;
301
302 /* Only cleanup IRQ stuff if this device has a host bus context */
303 if (!SN_PCIDEV_BUSSOFT(pci_dev))
304 return;
305
306 sn_irq_info = SN_PCIDEV_INFO(pci_dev)->pdi_sn_irq_info;
307 if (!sn_irq_info || !sn_irq_info->irq_irq) {
308 kfree(sn_irq_info);
309 return;
310 }
311
312 unregister_intr_pda(sn_irq_info);
313 spin_lock(&sn_irq_info_lock);
314 list_del_rcu(&sn_irq_info->list);
315 spin_unlock(&sn_irq_info_lock);
316 call_rcu(&sn_irq_info->rcu, sn_irq_info_free);
317 pci_dev_put(pci_dev);
318}
319
327static void force_interrupt(int irq) 320static void force_interrupt(int irq)
328{ 321{
329 struct sn_irq_info *sn_irq_info; 322 struct sn_irq_info *sn_irq_info;
330 323
331 if (!sn_ioif_inited) 324 if (!sn_ioif_inited)
332 return; 325 return;
333 sn_irq_info = sn_irq[irq]; 326
334 while (sn_irq_info) { 327 rcu_read_lock();
328 list_for_each_entry_rcu(sn_irq_info, sn_irq_lh[irq], list) {
335 if (IS_PCI_BRIDGE_ASIC(sn_irq_info->irq_bridge_type) && 329 if (IS_PCI_BRIDGE_ASIC(sn_irq_info->irq_bridge_type) &&
336 (sn_irq_info->irq_bridge != NULL)) { 330 (sn_irq_info->irq_bridge != NULL))
337 pcibr_force_interrupt(sn_irq_info); 331 pcibr_force_interrupt(sn_irq_info);
338 }
339 sn_irq_info = sn_irq_info->irq_next;
340 } 332 }
333 rcu_read_unlock();
341} 334}
342 335
343/* 336/*
@@ -402,19 +395,41 @@ static void sn_check_intr(int irq, struct sn_irq_info *sn_irq_info)
402 395
403void sn_lb_int_war_check(void) 396void sn_lb_int_war_check(void)
404{ 397{
398 struct sn_irq_info *sn_irq_info;
405 int i; 399 int i;
406 400
407 if (!sn_ioif_inited || pda->sn_first_irq == 0) 401 if (!sn_ioif_inited || pda->sn_first_irq == 0)
408 return; 402 return;
403
404 rcu_read_lock();
409 for (i = pda->sn_first_irq; i <= pda->sn_last_irq; i++) { 405 for (i = pda->sn_first_irq; i <= pda->sn_last_irq; i++) {
410 struct sn_irq_info *sn_irq_info = sn_irq[i]; 406 list_for_each_entry_rcu(sn_irq_info, sn_irq_lh[i], list) {
411 while (sn_irq_info) { 407 /*
412 /* Only call for PCI bridges that are fully initialized. */ 408 * Only call for PCI bridges that are fully
409 * initialized.
410 */
413 if (IS_PCI_BRIDGE_ASIC(sn_irq_info->irq_bridge_type) && 411 if (IS_PCI_BRIDGE_ASIC(sn_irq_info->irq_bridge_type) &&
414 (sn_irq_info->irq_bridge != NULL)) { 412 (sn_irq_info->irq_bridge != NULL))
415 sn_check_intr(i, sn_irq_info); 413 sn_check_intr(i, sn_irq_info);
416 }
417 sn_irq_info = sn_irq_info->irq_next;
418 } 414 }
419 } 415 }
416 rcu_read_unlock();
417}
418
419void sn_irq_lh_init(void)
420{
421 int i;
422
423 sn_irq_lh = kmalloc(sizeof(struct list_head *) * NR_IRQS, GFP_KERNEL);
424 if (!sn_irq_lh)
425 panic("SN PCI INIT: Failed to allocate memory for PCI init\n");
426
427 for (i = 0; i < NR_IRQS; i++) {
428 sn_irq_lh[i] = kmalloc(sizeof(struct list_head), GFP_KERNEL);
429 if (!sn_irq_lh[i])
430 panic("SN PCI INIT: Failed IRQ memory allocation\n");
431
432 INIT_LIST_HEAD(sn_irq_lh[i]);
433 }
434
420} 435}
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 22e10d282c..7c7fe441d6 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -270,7 +270,7 @@ void __init sn_setup(char **cmdline_p)
270{ 270{
271 long status, ticks_per_sec, drift; 271 long status, ticks_per_sec, drift;
272 int pxm; 272 int pxm;
273 int major = sn_sal_rev_major(), minor = sn_sal_rev_minor(); 273 u32 version = sn_sal_rev();
274 extern void sn_cpu_init(void); 274 extern void sn_cpu_init(void);
275 275
276 ia64_sn_plat_set_error_handling_features(); 276 ia64_sn_plat_set_error_handling_features();
@@ -308,22 +308,21 @@ void __init sn_setup(char **cmdline_p)
308 * support here so we don't have to listen to failed keyboard probe 308 * support here so we don't have to listen to failed keyboard probe
309 * messages. 309 * messages.
310 */ 310 */
311 if ((major < 2 || (major == 2 && minor <= 9)) && 311 if (version <= 0x0209 && acpi_kbd_controller_present) {
312 acpi_kbd_controller_present) {
313 printk(KERN_INFO "Disabling legacy keyboard support as prom " 312 printk(KERN_INFO "Disabling legacy keyboard support as prom "
314 "is too old and doesn't provide FADT\n"); 313 "is too old and doesn't provide FADT\n");
315 acpi_kbd_controller_present = 0; 314 acpi_kbd_controller_present = 0;
316 } 315 }
317 316
318 printk("SGI SAL version %x.%02x\n", major, minor); 317 printk("SGI SAL version %x.%02x\n", version >> 8, version & 0x00FF);
319 318
320 /* 319 /*
321 * Confirm the SAL we're running on is recent enough... 320 * Confirm the SAL we're running on is recent enough...
322 */ 321 */
323 if ((major < SN_SAL_MIN_MAJOR) || (major == SN_SAL_MIN_MAJOR && 322 if (version < SN_SAL_MIN_VERSION) {
324 minor < SN_SAL_MIN_MINOR)) {
325 printk(KERN_ERR "This kernel needs SGI SAL version >= " 323 printk(KERN_ERR "This kernel needs SGI SAL version >= "
326 "%x.%02x\n", SN_SAL_MIN_MAJOR, SN_SAL_MIN_MINOR); 324 "%x.%02x\n", SN_SAL_MIN_VERSION >> 8,
325 SN_SAL_MIN_VERSION & 0x00FF);
327 panic("PROM version too old\n"); 326 panic("PROM version too old\n");
328 } 327 }
329 328
diff --git a/arch/ia64/sn/kernel/tiocx.c b/arch/ia64/sn/kernel/tiocx.c
index 8716f4d531..254fe15c06 100644
--- a/arch/ia64/sn/kernel/tiocx.c
+++ b/arch/ia64/sn/kernel/tiocx.c
@@ -8,12 +8,12 @@
8 8
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/kernel.h> 10#include <linux/kernel.h>
11#include <linux/version.h>
12#include <linux/slab.h> 11#include <linux/slab.h>
13#include <linux/spinlock.h> 12#include <linux/spinlock.h>
14#include <linux/proc_fs.h> 13#include <linux/proc_fs.h>
15#include <linux/device.h> 14#include <linux/device.h>
16#include <linux/delay.h> 15#include <linux/delay.h>
16#include <asm/system.h>
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18#include <asm/sn/sn_sal.h> 18#include <asm/sn/sn_sal.h>
19#include <asm/sn/addrs.h> 19#include <asm/sn/addrs.h>
@@ -481,6 +481,9 @@ static int __init tiocx_init(void)
481 cnodeid_t cnodeid; 481 cnodeid_t cnodeid;
482 int found_tiocx_device = 0; 482 int found_tiocx_device = 0;
483 483
484 if (!ia64_platform_is("sn2"))
485 return -ENODEV;
486
484 bus_register(&tiocx_bus_type); 487 bus_register(&tiocx_bus_type);
485 488
486 for (cnodeid = 0; cnodeid < MAX_COMPACT_NODES; cnodeid++) { 489 for (cnodeid = 0; cnodeid < MAX_COMPACT_NODES; cnodeid++) {
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index 177ddb748e..d580adcad9 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -53,6 +53,7 @@
53#include <linux/cache.h> 53#include <linux/cache.h>
54#include <linux/interrupt.h> 54#include <linux/interrupt.h>
55#include <linux/slab.h> 55#include <linux/slab.h>
56#include <linux/delay.h>
56#include <asm/sn/intr.h> 57#include <asm/sn/intr.h>
57#include <asm/sn/sn_sal.h> 58#include <asm/sn/sn_sal.h>
58#include <asm/uaccess.h> 59#include <asm/uaccess.h>
@@ -308,8 +309,7 @@ xpc_make_first_contact(struct xpc_partition *part)
308 "partition %d\n", XPC_PARTID(part)); 309 "partition %d\n", XPC_PARTID(part));
309 310
310 /* wait a 1/4 of a second or so */ 311 /* wait a 1/4 of a second or so */
311 set_current_state(TASK_INTERRUPTIBLE); 312 msleep_interruptible(250);
312 (void) schedule_timeout(0.25 * HZ);
313 313
314 if (part->act_state == XPC_P_DEACTIVATING) { 314 if (part->act_state == XPC_P_DEACTIVATING) {
315 return part->reason; 315 return part->reason;
@@ -841,9 +841,7 @@ xpc_do_exit(void)
841 down(&xpc_discovery_exited); 841 down(&xpc_discovery_exited);
842 842
843 843
844 set_current_state(TASK_INTERRUPTIBLE); 844 msleep_interruptible(300);
845 schedule_timeout(0.3 * HZ);
846 set_current_state(TASK_RUNNING);
847 845
848 846
849 /* wait for all partitions to become inactive */ 847 /* wait for all partitions to become inactive */
@@ -860,12 +858,8 @@ xpc_do_exit(void)
860 } 858 }
861 } 859 }
862 860
863 if (active_part_count) { 861 if (active_part_count)
864 set_current_state(TASK_INTERRUPTIBLE); 862 msleep_interruptible(300);
865 schedule_timeout(0.3 * HZ);
866 set_current_state(TASK_RUNNING);
867 }
868
869 } while (active_part_count > 0); 863 } while (active_part_count > 0);
870 864
871 865
diff --git a/arch/ia64/sn/pci/pci_dma.c b/arch/ia64/sn/pci/pci_dma.c
index 5da9bdbde7..a2f7a88aef 100644
--- a/arch/ia64/sn/pci/pci_dma.c
+++ b/arch/ia64/sn/pci/pci_dma.c
@@ -11,9 +11,10 @@
11 11
12#include <linux/module.h> 12#include <linux/module.h>
13#include <asm/dma.h> 13#include <asm/dma.h>
14#include <asm/sn/sn_sal.h> 14#include <asm/sn/pcibr_provider.h>
15#include <asm/sn/pcibus_provider_defs.h> 15#include <asm/sn/pcibus_provider_defs.h>
16#include <asm/sn/pcidev.h> 16#include <asm/sn/pcidev.h>
17#include <asm/sn/sn_sal.h>
17 18
18#define SG_ENT_VIRT_ADDRESS(sg) (page_address((sg)->page) + (sg)->offset) 19#define SG_ENT_VIRT_ADDRESS(sg) (page_address((sg)->page) + (sg)->offset)
19#define SG_ENT_PHYS_ADDRESS(SG) virt_to_phys(SG_ENT_VIRT_ADDRESS(SG)) 20#define SG_ENT_PHYS_ADDRESS(SG) virt_to_phys(SG_ENT_VIRT_ADDRESS(SG))
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_ate.c b/arch/ia64/sn/pci/pcibr/pcibr_ate.c
index 0e47bce85f..d1647b863e 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_ate.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_ate.c
@@ -8,9 +8,9 @@
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <asm/sn/sn_sal.h> 10#include <asm/sn/sn_sal.h>
11#include <asm/sn/pcibr_provider.h>
11#include <asm/sn/pcibus_provider_defs.h> 12#include <asm/sn/pcibus_provider_defs.h>
12#include <asm/sn/pcidev.h> 13#include <asm/sn/pcidev.h>
13#include "pci/pcibr_provider.h"
14 14
15int pcibr_invalidate_ate = 0; /* by default don't invalidate ATE on free */ 15int pcibr_invalidate_ate = 0; /* by default don't invalidate ATE on free */
16 16
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index 64af2b2c17..b058dc2a0b 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -8,18 +8,17 @@
8 8
9#include <linux/types.h> 9#include <linux/types.h>
10#include <linux/pci.h> 10#include <linux/pci.h>
11#include <asm/sn/sn_sal.h> 11#include <asm/sn/addrs.h>
12#include <asm/sn/geo.h> 12#include <asm/sn/geo.h>
13#include "xtalk/xwidgetdev.h" 13#include <asm/sn/pcibr_provider.h>
14#include "xtalk/hubdev.h"
15#include <asm/sn/pcibus_provider_defs.h> 14#include <asm/sn/pcibus_provider_defs.h>
16#include <asm/sn/pcidev.h> 15#include <asm/sn/pcidev.h>
17#include "pci/tiocp.h" 16#include <asm/sn/pic.h>
18#include "pci/pic.h" 17#include <asm/sn/sn_sal.h>
19#include "pci/pcibr_provider.h" 18#include <asm/sn/tiocp.h>
20#include "pci/tiocp.h"
21#include "tio.h" 19#include "tio.h"
22#include <asm/sn/addrs.h> 20#include "xtalk/xwidgetdev.h"
21#include "xtalk/hubdev.h"
23 22
24extern int sn_ioif_inited; 23extern int sn_ioif_inited;
25 24
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_provider.c b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
index 3893999d23..9813da56d3 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_provider.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_provider.c
@@ -6,18 +6,51 @@
6 * Copyright (C) 2001-2004 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 2001-2004 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8 8
9#include <linux/types.h>
10#include <linux/interrupt.h> 9#include <linux/interrupt.h>
10#include <linux/types.h>
11#include <linux/pci.h> 11#include <linux/pci.h>
12#include <asm/sn/sn_sal.h> 12#include <asm/sn/addrs.h>
13#include "xtalk/xwidgetdev.h"
14#include <asm/sn/geo.h> 13#include <asm/sn/geo.h>
15#include "xtalk/hubdev.h" 14#include <asm/sn/pcibr_provider.h>
16#include <asm/sn/pcibus_provider_defs.h> 15#include <asm/sn/pcibus_provider_defs.h>
17#include <asm/sn/pcidev.h> 16#include <asm/sn/pcidev.h>
18#include "pci/pcibr_provider.h" 17#include <asm/sn/sn_sal.h>
19#include <asm/sn/addrs.h> 18#include "xtalk/xwidgetdev.h"
19#include "xtalk/hubdev.h"
20
21int
22sal_pcibr_slot_enable(struct pcibus_info *soft, int device, void *resp)
23{
24 struct ia64_sal_retval ret_stuff;
25 uint64_t busnum;
26
27 ret_stuff.status = 0;
28 ret_stuff.v0 = 0;
20 29
30 busnum = soft->pbi_buscommon.bs_persist_busnum;
31 SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_SLOT_ENABLE, (u64) busnum,
32 (u64) device, (u64) resp, 0, 0, 0, 0);
33
34 return (int)ret_stuff.v0;
35}
36
37int
38sal_pcibr_slot_disable(struct pcibus_info *soft, int device, int action,
39 void *resp)
40{
41 struct ia64_sal_retval ret_stuff;
42 uint64_t busnum;
43
44 ret_stuff.status = 0;
45 ret_stuff.v0 = 0;
46
47 busnum = soft->pbi_buscommon.bs_persist_busnum;
48 SAL_CALL_NOLOCK(ret_stuff, (u64) SN_SAL_IOIF_SLOT_DISABLE,
49 (u64) busnum, (u64) device, (u64) action,
50 (u64) resp, 0, 0, 0);
51
52 return (int)ret_stuff.v0;
53}
21 54
22static int sal_pcibr_error_interrupt(struct pcibus_info *soft) 55static int sal_pcibr_error_interrupt(struct pcibus_info *soft)
23{ 56{
@@ -188,3 +221,6 @@ pcibr_init_provider(void)
188 221
189 return 0; 222 return 0;
190} 223}
224
225EXPORT_SYMBOL_GPL(sal_pcibr_slot_enable);
226EXPORT_SYMBOL_GPL(sal_pcibr_slot_disable);
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_reg.c b/arch/ia64/sn/pci/pcibr/pcibr_reg.c
index 865c11c3b5..21426d02fb 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_reg.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_reg.c
@@ -6,13 +6,13 @@
6 * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved. 6 * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved.
7 */ 7 */
8 8
9#include <linux/types.h>
10#include <linux/interrupt.h> 9#include <linux/interrupt.h>
10#include <linux/types.h>
11#include <asm/sn/pcibr_provider.h>
11#include <asm/sn/pcibus_provider_defs.h> 12#include <asm/sn/pcibus_provider_defs.h>
12#include <asm/sn/pcidev.h> 13#include <asm/sn/pcidev.h>
13#include "pci/tiocp.h" 14#include <asm/sn/pic.h>
14#include "pci/pic.h" 15#include <asm/sn/tiocp.h>
15#include "pci/pcibr_provider.h"
16 16
17union br_ptr { 17union br_ptr {
18 struct tiocp tio; 18 struct tiocp tio;
diff --git a/arch/ia64/sn/pci/tioca_provider.c b/arch/ia64/sn/pci/tioca_provider.c
index 05aa8c2fe9..51cc4e6309 100644
--- a/arch/ia64/sn/pci/tioca_provider.c
+++ b/arch/ia64/sn/pci/tioca_provider.c
@@ -589,8 +589,7 @@ tioca_bus_fixup(struct pcibus_bussoft *prom_bussoft)
589 589
590 /* sanity check prom rev */ 590 /* sanity check prom rev */
591 591
592 if (sn_sal_rev_major() < 4 || 592 if (sn_sal_rev() < 0x0406) {
593 (sn_sal_rev_major() == 4 && sn_sal_rev_minor() < 6)) {
594 printk 593 printk
595 (KERN_ERR "%s: SGI prom rev 4.06 or greater required " 594 (KERN_ERR "%s: SGI prom rev 4.06 or greater required "
596 "for tioca support\n", __FUNCTION__); 595 "for tioca support\n", __FUNCTION__);
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 42ca8a3979..7772951df3 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -359,6 +359,8 @@ source "fs/Kconfig.binfmt"
359 359
360endmenu 360endmenu
361 361
362source "net/Kconfig"
363
362source "drivers/Kconfig" 364source "drivers/Kconfig"
363 365
364source "fs/Kconfig" 366source "fs/Kconfig"
diff --git a/arch/m32r/kernel/setup_m32700ut.c b/arch/m32r/kernel/setup_m32700ut.c
index b014e2c1e5..a146b24a55 100644
--- a/arch/m32r/kernel/setup_m32700ut.c
+++ b/arch/m32r/kernel/setup_m32700ut.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * Setup routines for Renesas M32700UT Board 4 * Setup routines for Renesas M32700UT Board
5 * 5 *
6 * Copyright (c) 2002 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2002-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Takeo Takahashi 7 * Hitoshi Yamamoto, Takeo Takahashi
8 * 8 *
9 * This file is subject to the terms and conditions of the GNU General 9 * This file is subject to the terms and conditions of the GNU General
10 * Public License. See the file "COPYING" in the main directory of this 10 * Public License. See the file "COPYING" in the main directory of this
@@ -435,7 +435,7 @@ void __init init_IRQ(void)
435 icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; 435 icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;
436 enable_m32700ut_irq(M32R_IRQ_INT2); 436 enable_m32700ut_irq(M32R_IRQ_INT2);
437 437
438//#if defined(CONFIG_VIDEO_M32R_AR) 438#if defined(CONFIG_VIDEO_M32R_AR)
439 /* 439 /*
440 * INT3# is used for AR 440 * INT3# is used for AR
441 */ 441 */
@@ -445,9 +445,11 @@ void __init init_IRQ(void)
445 irq_desc[M32R_IRQ_INT3].depth = 1; 445 irq_desc[M32R_IRQ_INT3].depth = 1;
446 icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; 446 icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
447 disable_m32700ut_irq(M32R_IRQ_INT3); 447 disable_m32700ut_irq(M32R_IRQ_INT3);
448//#endif /* CONFIG_VIDEO_M32R_AR */ 448#endif /* CONFIG_VIDEO_M32R_AR */
449} 449}
450 450
451#if defined(CONFIG_SMC91X)
452
451#define LAN_IOSTART 0x300 453#define LAN_IOSTART 0x300
452#define LAN_IOEND 0x320 454#define LAN_IOEND 0x320
453static struct resource smc91x_resources[] = { 455static struct resource smc91x_resources[] = {
@@ -469,10 +471,55 @@ static struct platform_device smc91x_device = {
469 .num_resources = ARRAY_SIZE(smc91x_resources), 471 .num_resources = ARRAY_SIZE(smc91x_resources),
470 .resource = smc91x_resources, 472 .resource = smc91x_resources,
471}; 473};
474#endif
475
476#if defined(CONFIG_FB_S1D13XXX)
477
478#include <video/s1d13xxxfb.h>
479#include <asm/s1d13806.h>
480
481static struct s1d13xxxfb_pdata s1d13xxxfb_data = {
482 .initregs = s1d13xxxfb_initregs,
483 .initregssize = ARRAY_SIZE(s1d13xxxfb_initregs),
484 .platform_init_video = NULL,
485#ifdef CONFIG_PM
486 .platform_suspend_video = NULL,
487 .platform_resume_video = NULL,
488#endif
489};
490
491static struct resource s1d13xxxfb_resources[] = {
492 [0] = {
493 .start = 0x10600000UL,
494 .end = 0x1073FFFFUL,
495 .flags = IORESOURCE_MEM,
496 },
497 [1] = {
498 .start = 0x10400000UL,
499 .end = 0x104001FFUL,
500 .flags = IORESOURCE_MEM,
501 }
502};
503
504static struct platform_device s1d13xxxfb_device = {
505 .name = S1D_DEVICENAME,
506 .id = 0,
507 .dev = {
508 .platform_data = &s1d13xxxfb_data,
509 },
510 .num_resources = ARRAY_SIZE(s1d13xxxfb_resources),
511 .resource = s1d13xxxfb_resources,
512};
513#endif
472 514
473static int __init platform_init(void) 515static int __init platform_init(void)
474{ 516{
517#if defined(CONFIG_SMC91X)
475 platform_device_register(&smc91x_device); 518 platform_device_register(&smc91x_device);
519#endif
520#if defined(CONFIG_FB_S1D13XXX)
521 platform_device_register(&s1d13xxxfb_device);
522#endif
476 return 0; 523 return 0;
477} 524}
478arch_initcall(platform_init); 525arch_initcall(platform_init);
diff --git a/arch/m32r/kernel/setup_mappi.c b/arch/m32r/kernel/setup_mappi.c
index aaf8e569b9..4e709809ef 100644
--- a/arch/m32r/kernel/setup_mappi.c
+++ b/arch/m32r/kernel/setup_mappi.c
@@ -3,14 +3,15 @@
3 * 3 *
4 * Setup routines for Renesas MAPPI Board 4 * Setup routines for Renesas MAPPI Board
5 * 5 *
6 * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto 7 * Hitoshi Yamamoto
8 */ 8 */
9 9
10#include <linux/config.h> 10#include <linux/config.h>
11#include <linux/irq.h> 11#include <linux/irq.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/device.h>
14 15
15#include <asm/system.h> 16#include <asm/system.h>
16#include <asm/m32r.h> 17#include <asm/m32r.h>
@@ -158,3 +159,49 @@ void __init init_IRQ(void)
158 disable_mappi_irq(M32R_IRQ_INT2); 159 disable_mappi_irq(M32R_IRQ_INT2);
159#endif /* CONFIG_M32RPCC */ 160#endif /* CONFIG_M32RPCC */
160} 161}
162
163#if defined(CONFIG_FB_S1D13XXX)
164
165#include <video/s1d13xxxfb.h>
166#include <asm/s1d13806.h>
167
168static struct s1d13xxxfb_pdata s1d13xxxfb_data = {
169 .initregs = s1d13xxxfb_initregs,
170 .initregssize = ARRAY_SIZE(s1d13xxxfb_initregs),
171 .platform_init_video = NULL,
172#ifdef CONFIG_PM
173 .platform_suspend_video = NULL,
174 .platform_resume_video = NULL,
175#endif
176};
177
178static struct resource s1d13xxxfb_resources[] = {
179 [0] = {
180 .start = 0x10200000UL,
181 .end = 0x1033FFFFUL,
182 .flags = IORESOURCE_MEM,
183 },
184 [1] = {
185 .start = 0x10000000UL,
186 .end = 0x100001FFUL,
187 .flags = IORESOURCE_MEM,
188 }
189};
190
191static struct platform_device s1d13xxxfb_device = {
192 .name = S1D_DEVICENAME,
193 .id = 0,
194 .dev = {
195 .platform_data = &s1d13xxxfb_data,
196 },
197 .num_resources = ARRAY_SIZE(s1d13xxxfb_resources),
198 .resource = s1d13xxxfb_resources,
199};
200
201static int __init platform_init(void)
202{
203 platform_device_register(&s1d13xxxfb_device);
204 return 0;
205}
206arch_initcall(platform_init);
207#endif
diff --git a/arch/m32r/kernel/setup_mappi2.c b/arch/m32r/kernel/setup_mappi2.c
index 38d5e9a414..a1d801598a 100644
--- a/arch/m32r/kernel/setup_mappi2.c
+++ b/arch/m32r/kernel/setup_mappi2.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * Setup routines for Renesas MAPPI-II(M3A-ZA36) Board 4 * Setup routines for Renesas MAPPI-II(M3A-ZA36) Board
5 * 5 *
6 * Copyright (c) 2001, 2002 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Mamoru Sakugawa 7 * Hitoshi Yamamoto, Mamoru Sakugawa
8 */ 8 */
9 9
10#include <linux/config.h> 10#include <linux/config.h>
diff --git a/arch/m32r/kernel/setup_mappi3.c b/arch/m32r/kernel/setup_mappi3.c
index 3d60a85aae..a76412e883 100644
--- a/arch/m32r/kernel/setup_mappi3.c
+++ b/arch/m32r/kernel/setup_mappi3.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * Setup routines for Renesas MAPPI-III(M3A-2170) Board 4 * Setup routines for Renesas MAPPI-III(M3A-2170) Board
5 * 5 *
6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2001-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Mamoru Sakugawa 7 * Hitoshi Yamamoto, Mamoru Sakugawa
8 */ 8 */
9 9
10#include <linux/config.h> 10#include <linux/config.h>
@@ -178,6 +178,8 @@ void __init init_IRQ(void)
178#endif /* CONFIG_M32R_CFC */ 178#endif /* CONFIG_M32R_CFC */
179} 179}
180 180
181#if defined(CONFIG_SMC91X)
182
181#define LAN_IOSTART 0x300 183#define LAN_IOSTART 0x300
182#define LAN_IOEND 0x320 184#define LAN_IOEND 0x320
183static struct resource smc91x_resources[] = { 185static struct resource smc91x_resources[] = {
@@ -200,9 +202,55 @@ static struct platform_device smc91x_device = {
200 .resource = smc91x_resources, 202 .resource = smc91x_resources,
201}; 203};
202 204
205#endif
206
207#if defined(CONFIG_FB_S1D13XXX)
208
209#include <video/s1d13xxxfb.h>
210#include <asm/s1d13806.h>
211
212static struct s1d13xxxfb_pdata s1d13xxxfb_data = {
213 .initregs = s1d13xxxfb_initregs,
214 .initregssize = ARRAY_SIZE(s1d13xxxfb_initregs),
215 .platform_init_video = NULL,
216#ifdef CONFIG_PM
217 .platform_suspend_video = NULL,
218 .platform_resume_video = NULL,
219#endif
220};
221
222static struct resource s1d13xxxfb_resources[] = {
223 [0] = {
224 .start = 0x1d600000UL,
225 .end = 0x1d73FFFFUL,
226 .flags = IORESOURCE_MEM,
227 },
228 [1] = {
229 .start = 0x1d400000UL,
230 .end = 0x1d4001FFUL,
231 .flags = IORESOURCE_MEM,
232 }
233};
234
235static struct platform_device s1d13xxxfb_device = {
236 .name = S1D_DEVICENAME,
237 .id = 0,
238 .dev = {
239 .platform_data = &s1d13xxxfb_data,
240 },
241 .num_resources = ARRAY_SIZE(s1d13xxxfb_resources),
242 .resource = s1d13xxxfb_resources,
243};
244#endif
245
203static int __init platform_init(void) 246static int __init platform_init(void)
204{ 247{
248#if defined(CONFIG_SMC91X)
205 platform_device_register(&smc91x_device); 249 platform_device_register(&smc91x_device);
250#endif
251#if defined(CONFIG_FB_S1D13XXX)
252 platform_device_register(&s1d13xxxfb_device);
253#endif
206 return 0; 254 return 0;
207} 255}
208arch_initcall(platform_init); 256arch_initcall(platform_init);
diff --git a/arch/m32r/kernel/setup_oaks32r.c b/arch/m32r/kernel/setup_oaks32r.c
index d656640bad..45add5b76f 100644
--- a/arch/m32r/kernel/setup_oaks32r.c
+++ b/arch/m32r/kernel/setup_oaks32r.c
@@ -3,8 +3,8 @@
3 * 3 *
4 * Setup routines for OAKS32R Board 4 * Setup routines for OAKS32R Board
5 * 5 *
6 * Copyright (c) 2002-2004 Hiroyuki Kondo, Hirokazu Takata, 6 * Copyright (c) 2002-2005 Hiroyuki Kondo, Hirokazu Takata,
7 * Hitoshi Yamamoto, Mamoru Sakugawa 7 * Hitoshi Yamamoto, Mamoru Sakugawa
8 */ 8 */
9 9
10#include <linux/config.h> 10#include <linux/config.h>
@@ -139,5 +139,4 @@ void __init init_IRQ(void)
139 icu_data[M32R_IRQ_SIO1_S].icucr = 0; 139 icu_data[M32R_IRQ_SIO1_S].icucr = 0;
140 disable_oaks32r_irq(M32R_IRQ_SIO1_S); 140 disable_oaks32r_irq(M32R_IRQ_SIO1_S);
141#endif /* CONFIG_SERIAL_M32R_SIO */ 141#endif /* CONFIG_SERIAL_M32R_SIO */
142
143} 142}
diff --git a/arch/m32r/kernel/setup_opsput.c b/arch/m32r/kernel/setup_opsput.c
index 86f4cf2a86..f0301f58bc 100644
--- a/arch/m32r/kernel/setup_opsput.c
+++ b/arch/m32r/kernel/setup_opsput.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Setup routines for Renesas OPSPUT Board 4 * Setup routines for Renesas OPSPUT Board
5 * 5 *
6 * Copyright (c) 2002-2004 6 * Copyright (c) 2002-2005
7 * Hiroyuki Kondo, Hirokazu Takata, 7 * Hiroyuki Kondo, Hirokazu Takata,
8 * Hitoshi Yamamoto, Takeo Takahashi, Mamoru Sakugawa 8 * Hitoshi Yamamoto, Takeo Takahashi, Mamoru Sakugawa
9 * 9 *
@@ -439,7 +439,7 @@ void __init init_IRQ(void)
439 icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01; 439 icu_data[M32R_IRQ_INT2].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD01;
440 enable_opsput_irq(M32R_IRQ_INT2); 440 enable_opsput_irq(M32R_IRQ_INT2);
441 441
442//#if defined(CONFIG_VIDEO_M32R_AR) 442#if defined(CONFIG_VIDEO_M32R_AR)
443 /* 443 /*
444 * INT3# is used for AR 444 * INT3# is used for AR
445 */ 445 */
@@ -449,9 +449,11 @@ void __init init_IRQ(void)
449 irq_desc[M32R_IRQ_INT3].depth = 1; 449 irq_desc[M32R_IRQ_INT3].depth = 1;
450 icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10; 450 icu_data[M32R_IRQ_INT3].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
451 disable_opsput_irq(M32R_IRQ_INT3); 451 disable_opsput_irq(M32R_IRQ_INT3);
452//#endif /* CONFIG_VIDEO_M32R_AR */ 452#endif /* CONFIG_VIDEO_M32R_AR */
453} 453}
454 454
455#if defined(CONFIG_SMC91X)
456
455#define LAN_IOSTART 0x300 457#define LAN_IOSTART 0x300
456#define LAN_IOEND 0x320 458#define LAN_IOEND 0x320
457static struct resource smc91x_resources[] = { 459static struct resource smc91x_resources[] = {
@@ -473,10 +475,55 @@ static struct platform_device smc91x_device = {
473 .num_resources = ARRAY_SIZE(smc91x_resources), 475 .num_resources = ARRAY_SIZE(smc91x_resources),
474 .resource = smc91x_resources, 476 .resource = smc91x_resources,
475}; 477};
478#endif
479
480#if defined(CONFIG_FB_S1D13XXX)
481
482#include <video/s1d13xxxfb.h>
483#include <asm/s1d13806.h>
484
485static struct s1d13xxxfb_pdata s1d13xxxfb_data = {
486 .initregs = s1d13xxxfb_initregs,
487 .initregssize = ARRAY_SIZE(s1d13xxxfb_initregs),
488 .platform_init_video = NULL,
489#ifdef CONFIG_PM
490 .platform_suspend_video = NULL,
491 .platform_resume_video = NULL,
492#endif
493};
494
495static struct resource s1d13xxxfb_resources[] = {
496 [0] = {
497 .start = 0x10600000UL,
498 .end = 0x1073FFFFUL,
499 .flags = IORESOURCE_MEM,
500 },
501 [1] = {
502 .start = 0x10400000UL,
503 .end = 0x104001FFUL,
504 .flags = IORESOURCE_MEM,
505 }
506};
507
508static struct platform_device s1d13xxxfb_device = {
509 .name = S1D_DEVICENAME,
510 .id = 0,
511 .dev = {
512 .platform_data = &s1d13xxxfb_data,
513 },
514 .num_resources = ARRAY_SIZE(s1d13xxxfb_resources),
515 .resource = s1d13xxxfb_resources,
516};
517#endif
476 518
477static int __init platform_init(void) 519static int __init platform_init(void)
478{ 520{
521#if defined(CONFIG_SMC91X)
479 platform_device_register(&smc91x_device); 522 platform_device_register(&smc91x_device);
523#endif
524#if defined(CONFIG_FB_S1D13XXX)
525 platform_device_register(&s1d13xxxfb_device);
526#endif
480 return 0; 527 return 0;
481} 528}
482arch_initcall(platform_init); 529arch_initcall(platform_init);
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 691a2469ff..178c4a3fbb 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -450,6 +450,8 @@ source "drivers/zorro/Kconfig"
450 450
451endmenu 451endmenu
452 452
453source "net/Kconfig"
454
453source "drivers/Kconfig" 455source "drivers/Kconfig"
454 456
455menu "Character devices" 457menu "Character devices"
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index dbfcdc8e60..117f183f0b 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -575,6 +575,8 @@ config PM
575 575
576endmenu 576endmenu
577 577
578source "net/Kconfig"
579
578source "drivers/Kconfig" 580source "drivers/Kconfig"
579 581
580source "fs/Kconfig" 582source "fs/Kconfig"
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index bd9de7b00c..b578239146 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1640,6 +1640,8 @@ config PM
1640 1640
1641endmenu 1641endmenu
1642 1642
1643source "net/Kconfig"
1644
1643source "drivers/Kconfig" 1645source "drivers/Kconfig"
1644 1646
1645source "fs/Kconfig" 1647source "fs/Kconfig"
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index ce327c799b..1c2d874352 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -190,6 +190,8 @@ source "fs/Kconfig.binfmt"
190 190
191endmenu 191endmenu
192 192
193source "net/Kconfig"
194
193source "drivers/Kconfig" 195source "drivers/Kconfig"
194 196
195source "fs/Kconfig" 197source "fs/Kconfig"
diff --git a/arch/ppc/8xx_io/enet.c b/arch/ppc/8xx_io/enet.c
index 4ea7158e50..ece6a9fbe0 100644
--- a/arch/ppc/8xx_io/enet.c
+++ b/arch/ppc/8xx_io/enet.c
@@ -714,16 +714,24 @@ static int __init scc_enet_init(void)
714 immap->im_ioport.iop_pcdat &= ~PC_ENET_LBK; /* Disable Loopback */ 714 immap->im_ioport.iop_pcdat &= ~PC_ENET_LBK; /* Disable Loopback */
715#endif /* PC_ENET_LBK */ 715#endif /* PC_ENET_LBK */
716 716
717 /* Configure port C pins to enable CLSN and RENA. 717#ifdef PE_ENET_TCLK
718 /* Configure port E for TCLK and RCLK.
718 */ 719 */
719 immap->im_ioport.iop_pcpar &= ~(PC_ENET_CLSN | PC_ENET_RENA); 720 cp->cp_pepar |= (PE_ENET_TCLK | PE_ENET_RCLK);
720 immap->im_ioport.iop_pcdir &= ~(PC_ENET_CLSN | PC_ENET_RENA); 721 cp->cp_pedir &= ~(PE_ENET_TCLK | PE_ENET_RCLK);
721 immap->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA); 722 cp->cp_peso &= ~(PE_ENET_TCLK | PE_ENET_RCLK);
722 723#else
723 /* Configure port A for TCLK and RCLK. 724 /* Configure port A for TCLK and RCLK.
724 */ 725 */
725 immap->im_ioport.iop_papar |= (PA_ENET_TCLK | PA_ENET_RCLK); 726 immap->im_ioport.iop_papar |= (PA_ENET_TCLK | PA_ENET_RCLK);
726 immap->im_ioport.iop_padir &= ~(PA_ENET_TCLK | PA_ENET_RCLK); 727 immap->im_ioport.iop_padir &= ~(PA_ENET_TCLK | PA_ENET_RCLK);
728#endif
729
730 /* Configure port C pins to enable CLSN and RENA.
731 */
732 immap->im_ioport.iop_pcpar &= ~(PC_ENET_CLSN | PC_ENET_RENA);
733 immap->im_ioport.iop_pcdir &= ~(PC_ENET_CLSN | PC_ENET_RENA);
734 immap->im_ioport.iop_pcso |= (PC_ENET_CLSN | PC_ENET_RENA);
727 735
728 /* Configure Serial Interface clock routing. 736 /* Configure Serial Interface clock routing.
729 * First, clear all SCC bits to zero, then set the ones we want. 737 * First, clear all SCC bits to zero, then set the ones we want.
@@ -896,14 +904,18 @@ static int __init scc_enet_init(void)
896 /* It is now OK to enable the Ethernet transmitter. 904 /* It is now OK to enable the Ethernet transmitter.
897 * Unfortunately, there are board implementation differences here. 905 * Unfortunately, there are board implementation differences here.
898 */ 906 */
899#if (!defined (PB_ENET_TENA) && defined (PC_ENET_TENA)) 907#if (!defined (PB_ENET_TENA) && defined (PC_ENET_TENA) && !defined (PE_ENET_TENA))
900 immap->im_ioport.iop_pcpar |= PC_ENET_TENA; 908 immap->im_ioport.iop_pcpar |= PC_ENET_TENA;
901 immap->im_ioport.iop_pcdir &= ~PC_ENET_TENA; 909 immap->im_ioport.iop_pcdir &= ~PC_ENET_TENA;
902#elif ( defined (PB_ENET_TENA) && !defined (PC_ENET_TENA)) 910#elif ( defined (PB_ENET_TENA) && !defined (PC_ENET_TENA) && !defined (PE_ENET_TENA))
903 cp->cp_pbpar |= PB_ENET_TENA; 911 cp->cp_pbpar |= PB_ENET_TENA;
904 cp->cp_pbdir |= PB_ENET_TENA; 912 cp->cp_pbdir |= PB_ENET_TENA;
913#elif ( !defined (PB_ENET_TENA) && !defined (PC_ENET_TENA) && defined (PE_ENET_TENA))
914 cp->cp_pepar |= PE_ENET_TENA;
915 cp->cp_pedir &= ~PE_ENET_TENA;
916 cp->cp_peso |= PE_ENET_TENA;
905#else 917#else
906#error Configuration Error: define exactly ONE of PB_ENET_TENA, PC_ENET_TENA 918#error Configuration Error: define exactly ONE of PB_ENET_TENA, PC_ENET_TENA, PE_ENET_TENA
907#endif 919#endif
908 920
909#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC) 921#if defined(CONFIG_RPXLITE) || defined(CONFIG_RPXCLASSIC)
@@ -936,6 +948,29 @@ static int __init scc_enet_init(void)
936 *((volatile uint *)BCSR1) &= ~BCSR1_ETHEN; 948 *((volatile uint *)BCSR1) &= ~BCSR1_ETHEN;
937#endif 949#endif
938 950
951#ifdef CONFIG_MPC885ADS
952
953 /* Deassert PHY reset and enable the PHY.
954 */
955 {
956 volatile uint __iomem *bcsr = ioremap(BCSR_ADDR, BCSR_SIZE);
957 uint tmp;
958
959 tmp = in_be32(bcsr + 1 /* BCSR1 */);
960 tmp |= BCSR1_ETHEN;
961 out_be32(bcsr + 1, tmp);
962 tmp = in_be32(bcsr + 4 /* BCSR4 */);
963 tmp |= BCSR4_ETH10_RST;
964 out_be32(bcsr + 4, tmp);
965 iounmap(bcsr);
966 }
967
968 /* On MPC885ADS SCC ethernet PHY defaults to the full duplex mode
969 * upon reset. SCC is set to half duplex by default. So this
970 * inconsistency should be better fixed by the software.
971 */
972#endif
973
939 dev->base_addr = (unsigned long)ep; 974 dev->base_addr = (unsigned long)ep;
940#if 0 975#if 0
941 dev->name = "CPM_ENET"; 976 dev->name = "CPM_ENET";
@@ -969,3 +1004,4 @@ static int __init scc_enet_init(void)
969} 1004}
970 1005
971module_init(scc_enet_init); 1006module_init(scc_enet_init);
1007
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index a7835cd3f5..b833cbcd77 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -284,6 +284,9 @@ endmenu
284 284
285menu "Platform options" 285menu "Platform options"
286 286
287config FADS
288 bool
289
287choice 290choice
288 prompt "8xx Machine Type" 291 prompt "8xx Machine Type"
289 depends on 8xx 292 depends on 8xx
@@ -399,8 +402,25 @@ config BSEIP
399 26MB DRAM, 4MB flash, Ethernet, a 16K-gate FPGA, USB, an LCD/video 402 26MB DRAM, 4MB flash, Ethernet, a 16K-gate FPGA, USB, an LCD/video
400 controller, and two RS232 ports. 403 controller, and two RS232 ports.
401 404
402config FADS 405config MPC8XXFADS
403 bool "FADS" 406 bool "FADS"
407 select FADS
408
409config MPC86XADS
410 bool "MPC86XADS"
411 help
412 MPC86x Application Development System by Freescale Semiconductor.
413 The MPC86xADS is meant to serve as a platform for s/w and h/w
414 development around the MPC86X processor families.
415 select FADS
416
417config MPC885ADS
418 bool "MPC885ADS"
419 help
420 Freescale Semiconductor MPC885 Application Development System (ADS).
421 Also known as DUET.
422 The MPC885ADS is meant to serve as a platform for s/w and h/w
423 development around the MPC885 processor family.
404 424
405config TQM823L 425config TQM823L
406 bool "TQM823L" 426 bool "TQM823L"
@@ -1335,6 +1355,8 @@ config PIN_TLB
1335 depends on ADVANCED_OPTIONS && 8xx 1355 depends on ADVANCED_OPTIONS && 8xx
1336endmenu 1356endmenu
1337 1357
1358source "net/Kconfig"
1359
1338source "drivers/Kconfig" 1360source "drivers/Kconfig"
1339 1361
1340source "fs/Kconfig" 1362source "fs/Kconfig"
diff --git a/arch/ppc/boot/images/Makefile b/arch/ppc/boot/images/Makefile
index c9ac5f5fa9..532e7ef1ed 100644
--- a/arch/ppc/boot/images/Makefile
+++ b/arch/ppc/boot/images/Makefile
@@ -6,12 +6,17 @@ MKIMAGE := $(srctree)/scripts/mkuboot.sh
6 6
7extra-y := vmlinux.bin vmlinux.gz 7extra-y := vmlinux.bin vmlinux.gz
8 8
9# two make processes may write to vmlinux.gz at the same time with make -j
10quiet_cmd_mygzip = GZIP $@
11cmd_mygzip = gzip -f -9 < $< > $@.$$$$ && mv $@.$$$$ $@
12
13
9OBJCOPYFLAGS_vmlinux.bin := -O binary 14OBJCOPYFLAGS_vmlinux.bin := -O binary
10$(obj)/vmlinux.bin: vmlinux FORCE 15$(obj)/vmlinux.bin: vmlinux FORCE
11 $(call if_changed,objcopy) 16 $(call if_changed,objcopy)
12 17
13$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE 18$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
14 $(call if_changed,gzip) 19 $(call if_changed,mygzip)
15 20
16quiet_cmd_uimage = UIMAGE $@ 21quiet_cmd_uimage = UIMAGE $@
17 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A ppc -O linux -T kernel \ 22 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A ppc -O linux -T kernel \
diff --git a/arch/ppc/configs/mpc86x_ads_defconfig b/arch/ppc/configs/mpc86x_ads_defconfig
new file mode 100644
index 0000000000..f63c6f59d6
--- /dev/null
+++ b/arch/ppc/configs/mpc86x_ads_defconfig
@@ -0,0 +1,633 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc4
4# Tue Jun 14 13:36:35 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
20# CONFIG_CLEAN_COMPILE is not set
21CONFIG_BROKEN=y
22CONFIG_BROKEN_ON_SMP=y
23CONFIG_INIT_ENV_ARG_LIMIT=32
24
25#
26# General setup
27#
28CONFIG_LOCALVERSION=""
29# CONFIG_SWAP is not set
30CONFIG_SYSVIPC=y
31# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set
33CONFIG_SYSCTL=y
34# CONFIG_AUDIT is not set
35# CONFIG_HOTPLUG is not set
36CONFIG_KOBJECT_UEVENT=y
37# CONFIG_IKCONFIG is not set
38CONFIG_EMBEDDED=y
39# CONFIG_KALLSYMS is not set
40CONFIG_PRINTK=y
41CONFIG_BUG=y
42# CONFIG_BASE_FULL is not set
43CONFIG_FUTEX=y
44# CONFIG_EPOLL is not set
45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
46# CONFIG_SHMEM is not set
47CONFIG_CC_ALIGN_FUNCTIONS=0
48CONFIG_CC_ALIGN_LABELS=0
49CONFIG_CC_ALIGN_LOOPS=0
50CONFIG_CC_ALIGN_JUMPS=0
51CONFIG_TINY_SHMEM=y
52CONFIG_BASE_SMALL=1
53
54#
55# Loadable module support
56#
57CONFIG_MODULES=y
58# CONFIG_MODULE_UNLOAD is not set
59CONFIG_OBSOLETE_MODPARM=y
60# CONFIG_MODVERSIONS is not set
61# CONFIG_MODULE_SRCVERSION_ALL is not set
62# CONFIG_KMOD is not set
63
64#
65# Processor
66#
67# CONFIG_6xx is not set
68# CONFIG_40x is not set
69# CONFIG_44x is not set
70# CONFIG_POWER3 is not set
71# CONFIG_POWER4 is not set
72CONFIG_8xx=y
73# CONFIG_E500 is not set
74# CONFIG_MATH_EMULATION is not set
75# CONFIG_CPU_FREQ is not set
76CONFIG_EMBEDDEDBOOT=y
77# CONFIG_PM is not set
78CONFIG_NOT_COHERENT_CACHE=y
79
80#
81# Platform options
82#
83CONFIG_FADS=y
84# CONFIG_RPXLITE is not set
85# CONFIG_RPXCLASSIC is not set
86# CONFIG_BSEIP is not set
87# CONFIG_MPC8XXFADS is not set
88CONFIG_MPC86XADS=y
89# CONFIG_TQM823L is not set
90# CONFIG_TQM850L is not set
91# CONFIG_TQM855L is not set
92# CONFIG_TQM860L is not set
93# CONFIG_FPS850L is not set
94# CONFIG_SPD823TS is not set
95# CONFIG_IVMS8 is not set
96# CONFIG_IVML24 is not set
97# CONFIG_SM850 is not set
98# CONFIG_HERMES_PRO is not set
99# CONFIG_IP860 is not set
100# CONFIG_LWMON is not set
101# CONFIG_PCU_E is not set
102# CONFIG_CCM is not set
103# CONFIG_LANTEC is not set
104# CONFIG_MBX is not set
105# CONFIG_WINCEPT is not set
106# CONFIG_SMP is not set
107# CONFIG_PREEMPT is not set
108# CONFIG_HIGHMEM is not set
109CONFIG_BINFMT_ELF=y
110# CONFIG_BINFMT_MISC is not set
111# CONFIG_CMDLINE_BOOL is not set
112CONFIG_ISA_DMA_API=y
113
114#
115# Bus options
116#
117# CONFIG_PCI is not set
118# CONFIG_PCI_DOMAINS is not set
119# CONFIG_PCI_QSPAN is not set
120
121#
122# PCCARD (PCMCIA/CardBus) support
123#
124# CONFIG_PCCARD is not set
125
126#
127# Advanced setup
128#
129# CONFIG_ADVANCED_OPTIONS is not set
130
131#
132# Default settings for advanced configuration options are used
133#
134CONFIG_HIGHMEM_START=0xfe000000
135CONFIG_LOWMEM_SIZE=0x30000000
136CONFIG_KERNEL_START=0xc0000000
137CONFIG_TASK_SIZE=0x80000000
138CONFIG_CONSISTENT_START=0xff100000
139CONFIG_CONSISTENT_SIZE=0x00200000
140CONFIG_BOOT_LOAD=0x00400000
141
142#
143# Device Drivers
144#
145
146#
147# Generic Driver Options
148#
149# CONFIG_STANDALONE is not set
150CONFIG_PREVENT_FIRMWARE_BUILD=y
151# CONFIG_FW_LOADER is not set
152
153#
154# Memory Technology Devices (MTD)
155#
156# CONFIG_MTD is not set
157
158#
159# Parallel port support
160#
161# CONFIG_PARPORT is not set
162
163#
164# Plug and Play support
165#
166
167#
168# Block devices
169#
170# CONFIG_BLK_DEV_FD is not set
171# CONFIG_BLK_DEV_COW_COMMON 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_RAM is not set
176CONFIG_BLK_DEV_RAM_COUNT=16
177CONFIG_INITRAMFS_SOURCE=""
178# CONFIG_LBD is not set
179# CONFIG_CDROM_PKTCDVD is not set
180
181#
182# IO Schedulers
183#
184CONFIG_IOSCHED_NOOP=y
185CONFIG_IOSCHED_AS=y
186CONFIG_IOSCHED_DEADLINE=y
187CONFIG_IOSCHED_CFQ=y
188# CONFIG_ATA_OVER_ETH is not set
189
190#
191# ATA/ATAPI/MFM/RLL support
192#
193# CONFIG_IDE is not set
194
195#
196# SCSI device support
197#
198# CONFIG_SCSI is not set
199
200#
201# Multi-device support (RAID and LVM)
202#
203# CONFIG_MD is not set
204
205#
206# Fusion MPT device support
207#
208
209#
210# IEEE 1394 (FireWire) support
211#
212# CONFIG_IEEE1394 is not set
213
214#
215# I2O device support
216#
217
218#
219# Macintosh device drivers
220#
221
222#
223# Networking support
224#
225CONFIG_NET=y
226
227#
228# Networking options
229#
230CONFIG_PACKET=y
231# CONFIG_PACKET_MMAP is not set
232CONFIG_UNIX=y
233# CONFIG_NET_KEY is not set
234CONFIG_INET=y
235# CONFIG_IP_MULTICAST is not set
236# CONFIG_IP_ADVANCED_ROUTER is not set
237CONFIG_IP_PNP=y
238CONFIG_IP_PNP_DHCP=y
239# CONFIG_IP_PNP_BOOTP is not set
240# CONFIG_IP_PNP_RARP is not set
241# CONFIG_NET_IPIP is not set
242# CONFIG_NET_IPGRE is not set
243# CONFIG_ARPD is not set
244# CONFIG_SYN_COOKIES is not set
245# CONFIG_INET_AH is not set
246# CONFIG_INET_ESP is not set
247# CONFIG_INET_IPCOMP is not set
248# CONFIG_INET_TUNNEL is not set
249CONFIG_IP_TCPDIAG=y
250# CONFIG_IP_TCPDIAG_IPV6 is not set
251CONFIG_IPV6=m
252# CONFIG_IPV6_PRIVACY is not set
253# CONFIG_INET6_AH is not set
254# CONFIG_INET6_ESP is not set
255# CONFIG_INET6_IPCOMP is not set
256# CONFIG_INET6_TUNNEL is not set
257# CONFIG_IPV6_TUNNEL is not set
258# CONFIG_NETFILTER is not set
259
260#
261# SCTP Configuration (EXPERIMENTAL)
262#
263# CONFIG_IP_SCTP is not set
264# CONFIG_ATM is not set
265# CONFIG_BRIDGE is not set
266# CONFIG_VLAN_8021Q is not set
267# CONFIG_DECNET is not set
268# CONFIG_LLC2 is not set
269# CONFIG_IPX is not set
270# CONFIG_ATALK is not set
271# CONFIG_X25 is not set
272# CONFIG_LAPB is not set
273# CONFIG_NET_DIVERT is not set
274# CONFIG_ECONET is not set
275# CONFIG_WAN_ROUTER is not set
276
277#
278# QoS and/or fair queueing
279#
280# CONFIG_NET_SCHED is not set
281# CONFIG_NET_CLS_ROUTE is not set
282
283#
284# Network testing
285#
286# CONFIG_NET_PKTGEN is not set
287# CONFIG_NETPOLL is not set
288# CONFIG_NET_POLL_CONTROLLER is not set
289# CONFIG_HAMRADIO is not set
290# CONFIG_IRDA is not set
291# CONFIG_BT is not set
292CONFIG_NETDEVICES=y
293# CONFIG_DUMMY is not set
294# CONFIG_BONDING is not set
295# CONFIG_EQUALIZER is not set
296# CONFIG_TUN is not set
297
298#
299# Ethernet (10 or 100Mbit)
300#
301CONFIG_NET_ETHERNET=y
302# CONFIG_MII is not set
303# CONFIG_OAKNET is not set
304
305#
306# Ethernet (1000 Mbit)
307#
308
309#
310# Ethernet (10000 Mbit)
311#
312
313#
314# Token Ring devices
315#
316
317#
318# Wireless LAN (non-hamradio)
319#
320# CONFIG_NET_RADIO is not set
321
322#
323# Wan interfaces
324#
325# CONFIG_WAN is not set
326# CONFIG_PPP is not set
327# CONFIG_SLIP is not set
328# CONFIG_SHAPER is not set
329# CONFIG_NETCONSOLE is not set
330
331#
332# ISDN subsystem
333#
334# CONFIG_ISDN is not set
335
336#
337# Telephony Support
338#
339# CONFIG_PHONE is not set
340
341#
342# Input device support
343#
344# CONFIG_INPUT is not set
345
346#
347# Hardware I/O ports
348#
349# CONFIG_SERIO is not set
350# CONFIG_GAMEPORT is not set
351CONFIG_SOUND_GAMEPORT=y
352
353#
354# Character devices
355#
356# CONFIG_VT is not set
357# CONFIG_SERIAL_NONSTANDARD is not set
358
359#
360# Serial drivers
361#
362# CONFIG_SERIAL_8250 is not set
363
364#
365# Non-8250 serial port support
366#
367CONFIG_SERIAL_CORE=y
368CONFIG_SERIAL_CORE_CONSOLE=y
369CONFIG_SERIAL_CPM=y
370CONFIG_SERIAL_CPM_CONSOLE=y
371# CONFIG_SERIAL_CPM_SCC1 is not set
372# CONFIG_SERIAL_CPM_SCC2 is not set
373# CONFIG_SERIAL_CPM_SCC3 is not set
374# CONFIG_SERIAL_CPM_SCC4 is not set
375CONFIG_SERIAL_CPM_SMC1=y
376# CONFIG_SERIAL_CPM_SMC2 is not set
377CONFIG_UNIX98_PTYS=y
378# CONFIG_LEGACY_PTYS is not set
379
380#
381# IPMI
382#
383# CONFIG_IPMI_HANDLER is not set
384
385#
386# Watchdog Cards
387#
388# CONFIG_WATCHDOG is not set
389# CONFIG_NVRAM is not set
390# CONFIG_GEN_RTC is not set
391# CONFIG_DTLK is not set
392# CONFIG_R3964 is not set
393
394#
395# Ftape, the floppy tape device driver
396#
397# CONFIG_AGP is not set
398# CONFIG_DRM is not set
399# CONFIG_RAW_DRIVER is not set
400
401#
402# TPM devices
403#
404
405#
406# I2C support
407#
408# CONFIG_I2C is not set
409
410#
411# Dallas's 1-wire bus
412#
413# CONFIG_W1 is not set
414
415#
416# Misc devices
417#
418
419#
420# Multimedia devices
421#
422# CONFIG_VIDEO_DEV is not set
423
424#
425# Digital Video Broadcasting Devices
426#
427# CONFIG_DVB is not set
428
429#
430# Graphics support
431#
432# CONFIG_FB is not set
433
434#
435# Sound
436#
437# CONFIG_SOUND is not set
438
439#
440# USB support
441#
442# CONFIG_USB_ARCH_HAS_HCD is not set
443# CONFIG_USB_ARCH_HAS_OHCI is not set
444
445#
446# USB Gadget Support
447#
448# CONFIG_USB_GADGET is not set
449
450#
451# MMC/SD Card support
452#
453# CONFIG_MMC is not set
454
455#
456# InfiniBand support
457#
458# CONFIG_INFINIBAND is not set
459
460#
461# File systems
462#
463# CONFIG_EXT2_FS is not set
464CONFIG_EXT3_FS=y
465# CONFIG_EXT3_FS_XATTR is not set
466CONFIG_JBD=y
467# CONFIG_JBD_DEBUG is not set
468# CONFIG_REISERFS_FS is not set
469# CONFIG_JFS_FS is not set
470
471#
472# XFS support
473#
474# CONFIG_XFS_FS is not set
475# CONFIG_MINIX_FS is not set
476# CONFIG_ROMFS_FS is not set
477# CONFIG_QUOTA is not set
478# CONFIG_DNOTIFY is not set
479# CONFIG_AUTOFS_FS is not set
480# CONFIG_AUTOFS4_FS is not set
481
482#
483# CD-ROM/DVD Filesystems
484#
485# CONFIG_ISO9660_FS is not set
486# CONFIG_UDF_FS is not set
487
488#
489# DOS/FAT/NT Filesystems
490#
491# CONFIG_MSDOS_FS is not set
492# CONFIG_VFAT_FS is not set
493# CONFIG_NTFS_FS is not set
494
495#
496# Pseudo filesystems
497#
498CONFIG_PROC_FS=y
499CONFIG_PROC_KCORE=y
500CONFIG_SYSFS=y
501# CONFIG_DEVFS_FS is not set
502# CONFIG_DEVPTS_FS_XATTR is not set
503# CONFIG_TMPFS is not set
504# CONFIG_HUGETLBFS is not set
505# CONFIG_HUGETLB_PAGE is not set
506CONFIG_RAMFS=y
507
508#
509# Miscellaneous filesystems
510#
511# CONFIG_ADFS_FS is not set
512# CONFIG_AFFS_FS is not set
513# CONFIG_HFS_FS is not set
514# CONFIG_HFSPLUS_FS is not set
515# CONFIG_BEFS_FS is not set
516# CONFIG_BFS_FS is not set
517# CONFIG_EFS_FS is not set
518# CONFIG_CRAMFS is not set
519# CONFIG_VXFS_FS is not set
520# CONFIG_HPFS_FS is not set
521# CONFIG_QNX4FS_FS is not set
522# CONFIG_SYSV_FS is not set
523# CONFIG_UFS_FS is not set
524
525#
526# Network File Systems
527#
528CONFIG_NFS_FS=y
529CONFIG_NFS_V3=y
530CONFIG_NFS_V4=y
531# CONFIG_NFS_DIRECTIO is not set
532# CONFIG_NFSD is not set
533CONFIG_ROOT_NFS=y
534CONFIG_LOCKD=y
535CONFIG_LOCKD_V4=y
536CONFIG_SUNRPC=y
537CONFIG_SUNRPC_GSS=y
538CONFIG_RPCSEC_GSS_KRB5=y
539# CONFIG_RPCSEC_GSS_SPKM3 is not set
540# CONFIG_SMB_FS is not set
541# CONFIG_CIFS is not set
542# CONFIG_NCP_FS is not set
543# CONFIG_CODA_FS is not set
544# CONFIG_AFS_FS is not set
545
546#
547# Partition Types
548#
549# CONFIG_PARTITION_ADVANCED is not set
550CONFIG_MSDOS_PARTITION=y
551
552#
553# Native Language Support
554#
555# CONFIG_NLS is not set
556
557#
558# MPC8xx CPM Options
559#
560CONFIG_SCC_ENET=y
561CONFIG_SCC1_ENET=y
562# CONFIG_SCC2_ENET is not set
563# CONFIG_SCC3_ENET is not set
564# CONFIG_FEC_ENET is not set
565# CONFIG_ENET_BIG_BUFFERS is not set
566
567#
568# Generic MPC8xx Options
569#
570# CONFIG_8xx_COPYBACK is not set
571# CONFIG_8xx_CPU6 is not set
572CONFIG_NO_UCODE_PATCH=y
573# CONFIG_USB_SOF_UCODE_PATCH is not set
574# CONFIG_I2C_SPI_UCODE_PATCH is not set
575# CONFIG_I2C_SPI_SMC1_UCODE_PATCH is not set
576
577#
578# Library routines
579#
580# CONFIG_CRC_CCITT is not set
581# CONFIG_CRC32 is not set
582# CONFIG_LIBCRC32C is not set
583
584#
585# Profiling support
586#
587# CONFIG_PROFILING is not set
588
589#
590# Kernel hacking
591#
592# CONFIG_PRINTK_TIME is not set
593# CONFIG_DEBUG_KERNEL is not set
594CONFIG_LOG_BUF_SHIFT=14
595
596#
597# Security options
598#
599# CONFIG_KEYS is not set
600# CONFIG_SECURITY is not set
601
602#
603# Cryptographic options
604#
605CONFIG_CRYPTO=y
606# CONFIG_CRYPTO_HMAC is not set
607# CONFIG_CRYPTO_NULL is not set
608# CONFIG_CRYPTO_MD4 is not set
609CONFIG_CRYPTO_MD5=y
610# CONFIG_CRYPTO_SHA1 is not set
611# CONFIG_CRYPTO_SHA256 is not set
612# CONFIG_CRYPTO_SHA512 is not set
613# CONFIG_CRYPTO_WP512 is not set
614# CONFIG_CRYPTO_TGR192 is not set
615CONFIG_CRYPTO_DES=y
616# CONFIG_CRYPTO_BLOWFISH is not set
617# CONFIG_CRYPTO_TWOFISH is not set
618# CONFIG_CRYPTO_SERPENT is not set
619# CONFIG_CRYPTO_AES is not set
620# CONFIG_CRYPTO_CAST5 is not set
621# CONFIG_CRYPTO_CAST6 is not set
622# CONFIG_CRYPTO_TEA is not set
623# CONFIG_CRYPTO_ARC4 is not set
624# CONFIG_CRYPTO_KHAZAD is not set
625# CONFIG_CRYPTO_ANUBIS is not set
626# CONFIG_CRYPTO_DEFLATE is not set
627# CONFIG_CRYPTO_MICHAEL_MIC is not set
628# CONFIG_CRYPTO_CRC32C is not set
629# CONFIG_CRYPTO_TEST is not set
630
631#
632# Hardware crypto devices
633#
diff --git a/arch/ppc/configs/mpc885ads_defconfig b/arch/ppc/configs/mpc885ads_defconfig
new file mode 100644
index 0000000000..016f94d932
--- /dev/null
+++ b/arch/ppc/configs/mpc885ads_defconfig
@@ -0,0 +1,622 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc6
4# Thu Jun 9 21:17:29 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
20# CONFIG_CLEAN_COMPILE is not set
21CONFIG_BROKEN=y
22CONFIG_BROKEN_ON_SMP=y
23CONFIG_INIT_ENV_ARG_LIMIT=32
24
25#
26# General setup
27#
28CONFIG_LOCALVERSION=""
29# CONFIG_SWAP is not set
30CONFIG_SYSVIPC=y
31# CONFIG_POSIX_MQUEUE is not set
32# CONFIG_BSD_PROCESS_ACCT is not set
33CONFIG_SYSCTL=y
34# CONFIG_AUDIT is not set
35CONFIG_HOTPLUG=y
36CONFIG_KOBJECT_UEVENT=y
37# CONFIG_IKCONFIG is not set
38CONFIG_EMBEDDED=y
39# CONFIG_KALLSYMS is not set
40CONFIG_PRINTK=y
41CONFIG_BUG=y
42CONFIG_BASE_FULL=y
43CONFIG_FUTEX=y
44# CONFIG_EPOLL is not set
45# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
46CONFIG_SHMEM=y
47CONFIG_CC_ALIGN_FUNCTIONS=0
48CONFIG_CC_ALIGN_LABELS=0
49CONFIG_CC_ALIGN_LOOPS=0
50CONFIG_CC_ALIGN_JUMPS=0
51# CONFIG_TINY_SHMEM is not set
52CONFIG_BASE_SMALL=0
53
54#
55# Loadable module support
56#
57# CONFIG_MODULES is not set
58
59#
60# Processor
61#
62# CONFIG_6xx is not set
63# CONFIG_40x is not set
64# CONFIG_44x is not set
65# CONFIG_POWER3 is not set
66# CONFIG_POWER4 is not set
67CONFIG_8xx=y
68# CONFIG_E500 is not set
69# CONFIG_MATH_EMULATION is not set
70# CONFIG_CPU_FREQ is not set
71CONFIG_EMBEDDEDBOOT=y
72# CONFIG_PM is not set
73CONFIG_NOT_COHERENT_CACHE=y
74
75#
76# Platform options
77#
78# CONFIG_RPXLITE is not set
79# CONFIG_RPXCLASSIC is not set
80# CONFIG_BSEIP is not set
81# CONFIG_FADS is not set
82CONFIG_MPC885ADS=y
83# CONFIG_TQM823L is not set
84# CONFIG_TQM850L is not set
85# CONFIG_TQM855L is not set
86# CONFIG_TQM860L is not set
87# CONFIG_FPS850L is not set
88# CONFIG_SPD823TS is not set
89# CONFIG_IVMS8 is not set
90# CONFIG_IVML24 is not set
91# CONFIG_SM850 is not set
92# CONFIG_HERMES_PRO is not set
93# CONFIG_IP860 is not set
94# CONFIG_LWMON is not set
95# CONFIG_PCU_E is not set
96# CONFIG_CCM is not set
97# CONFIG_LANTEC is not set
98# CONFIG_MBX is not set
99# CONFIG_WINCEPT is not set
100# CONFIG_SMP is not set
101# CONFIG_PREEMPT is not set
102# CONFIG_HIGHMEM is not set
103CONFIG_BINFMT_ELF=y
104# CONFIG_BINFMT_MISC is not set
105# CONFIG_CMDLINE_BOOL is not set
106CONFIG_ISA_DMA_API=y
107
108#
109# Bus options
110#
111# CONFIG_PCI is not set
112# CONFIG_PCI_DOMAINS is not set
113# CONFIG_PCI_QSPAN is not set
114
115#
116# PCCARD (PCMCIA/CardBus) support
117#
118# CONFIG_PCCARD is not set
119
120#
121# Advanced setup
122#
123# CONFIG_ADVANCED_OPTIONS is not set
124
125#
126# Default settings for advanced configuration options are used
127#
128CONFIG_HIGHMEM_START=0xfe000000
129CONFIG_LOWMEM_SIZE=0x30000000
130CONFIG_KERNEL_START=0xc0000000
131CONFIG_TASK_SIZE=0x80000000
132CONFIG_CONSISTENT_START=0xff100000
133CONFIG_CONSISTENT_SIZE=0x00200000
134CONFIG_BOOT_LOAD=0x00400000
135
136#
137# Device Drivers
138#
139
140#
141# Generic Driver Options
142#
143CONFIG_STANDALONE=y
144CONFIG_PREVENT_FIRMWARE_BUILD=y
145# CONFIG_FW_LOADER is not set
146
147#
148# Memory Technology Devices (MTD)
149#
150# CONFIG_MTD is not set
151
152#
153# Parallel port support
154#
155# CONFIG_PARPORT is not set
156
157#
158# Plug and Play support
159#
160
161#
162# Block devices
163#
164# CONFIG_BLK_DEV_FD is not set
165# CONFIG_BLK_DEV_COW_COMMON is not set
166# CONFIG_BLK_DEV_LOOP is not set
167# CONFIG_BLK_DEV_NBD is not set
168# CONFIG_BLK_DEV_RAM is not set
169CONFIG_BLK_DEV_RAM_COUNT=16
170CONFIG_INITRAMFS_SOURCE=""
171# CONFIG_LBD is not set
172# CONFIG_CDROM_PKTCDVD is not set
173
174#
175# IO Schedulers
176#
177CONFIG_IOSCHED_NOOP=y
178# CONFIG_IOSCHED_AS is not set
179# CONFIG_IOSCHED_DEADLINE is not set
180# CONFIG_IOSCHED_CFQ is not set
181# CONFIG_ATA_OVER_ETH is not set
182
183#
184# ATA/ATAPI/MFM/RLL support
185#
186# CONFIG_IDE is not set
187
188#
189# SCSI device support
190#
191# CONFIG_SCSI is not set
192
193#
194# Multi-device support (RAID and LVM)
195#
196# CONFIG_MD is not set
197
198#
199# Fusion MPT device support
200#
201
202#
203# IEEE 1394 (FireWire) support
204#
205# CONFIG_IEEE1394 is not set
206
207#
208# I2O device support
209#
210
211#
212# Macintosh device drivers
213#
214
215#
216# Networking support
217#
218CONFIG_NET=y
219
220#
221# Networking options
222#
223CONFIG_PACKET=y
224# CONFIG_PACKET_MMAP is not set
225CONFIG_UNIX=y
226# CONFIG_NET_KEY is not set
227CONFIG_INET=y
228# CONFIG_IP_MULTICAST is not set
229# CONFIG_IP_ADVANCED_ROUTER is not set
230CONFIG_IP_PNP=y
231CONFIG_IP_PNP_DHCP=y
232CONFIG_IP_PNP_BOOTP=y
233# CONFIG_IP_PNP_RARP is not set
234# CONFIG_NET_IPIP is not set
235# CONFIG_NET_IPGRE is not set
236# CONFIG_ARPD is not set
237# CONFIG_SYN_COOKIES is not set
238# CONFIG_INET_AH is not set
239# CONFIG_INET_ESP is not set
240# CONFIG_INET_IPCOMP is not set
241# CONFIG_INET_TUNNEL is not set
242CONFIG_IP_TCPDIAG=y
243# CONFIG_IP_TCPDIAG_IPV6 is not set
244# CONFIG_IPV6 is not set
245# CONFIG_NETFILTER is not set
246
247#
248# SCTP Configuration (EXPERIMENTAL)
249#
250# CONFIG_IP_SCTP is not set
251# CONFIG_ATM is not set
252# CONFIG_BRIDGE is not set
253# CONFIG_VLAN_8021Q is not set
254# CONFIG_DECNET is not set
255# CONFIG_LLC2 is not set
256# CONFIG_IPX is not set
257# CONFIG_ATALK is not set
258# CONFIG_X25 is not set
259# CONFIG_LAPB is not set
260# CONFIG_NET_DIVERT is not set
261# CONFIG_ECONET is not set
262# CONFIG_WAN_ROUTER is not set
263
264#
265# QoS and/or fair queueing
266#
267# CONFIG_NET_SCHED is not set
268# CONFIG_NET_CLS_ROUTE is not set
269
270#
271# Network testing
272#
273# CONFIG_NET_PKTGEN is not set
274# CONFIG_NETPOLL is not set
275# CONFIG_NET_POLL_CONTROLLER is not set
276# CONFIG_HAMRADIO is not set
277# CONFIG_IRDA is not set
278# CONFIG_BT is not set
279CONFIG_NETDEVICES=y
280# CONFIG_DUMMY is not set
281# CONFIG_BONDING is not set
282# CONFIG_EQUALIZER is not set
283# CONFIG_TUN is not set
284
285#
286# Ethernet (10 or 100Mbit)
287#
288CONFIG_NET_ETHERNET=y
289CONFIG_MII=y
290# CONFIG_OAKNET is not set
291
292#
293# Ethernet (1000 Mbit)
294#
295
296#
297# Ethernet (10000 Mbit)
298#
299
300#
301# Token Ring devices
302#
303
304#
305# Wireless LAN (non-hamradio)
306#
307# CONFIG_NET_RADIO is not set
308
309#
310# Wan interfaces
311#
312# CONFIG_WAN is not set
313CONFIG_PPP=y
314# CONFIG_PPP_MULTILINK is not set
315# CONFIG_PPP_FILTER is not set
316CONFIG_PPP_ASYNC=y
317CONFIG_PPP_SYNC_TTY=y
318CONFIG_PPP_DEFLATE=y
319# CONFIG_PPP_BSDCOMP is not set
320# CONFIG_PPPOE is not set
321# CONFIG_SLIP is not set
322# CONFIG_SHAPER is not set
323# CONFIG_NETCONSOLE is not set
324
325#
326# ISDN subsystem
327#
328# CONFIG_ISDN is not set
329
330#
331# Telephony Support
332#
333# CONFIG_PHONE is not set
334
335#
336# Input device support
337#
338# CONFIG_INPUT is not set
339
340#
341# Hardware I/O ports
342#
343# CONFIG_SERIO is not set
344# CONFIG_GAMEPORT is not set
345
346#
347# Character devices
348#
349# CONFIG_VT is not set
350# CONFIG_SERIAL_NONSTANDARD is not set
351
352#
353# Serial drivers
354#
355# CONFIG_SERIAL_8250 is not set
356
357#
358# Non-8250 serial port support
359#
360CONFIG_SERIAL_CORE=y
361CONFIG_SERIAL_CORE_CONSOLE=y
362CONFIG_SERIAL_CPM=y
363CONFIG_SERIAL_CPM_CONSOLE=y
364# CONFIG_SERIAL_CPM_SCC1 is not set
365# CONFIG_SERIAL_CPM_SCC2 is not set
366# CONFIG_SERIAL_CPM_SCC3 is not set
367# CONFIG_SERIAL_CPM_SCC4 is not set
368CONFIG_SERIAL_CPM_SMC1=y
369CONFIG_SERIAL_CPM_SMC2=y
370CONFIG_UNIX98_PTYS=y
371# CONFIG_LEGACY_PTYS is not set
372
373#
374# IPMI
375#
376# CONFIG_IPMI_HANDLER is not set
377
378#
379# Watchdog Cards
380#
381# CONFIG_WATCHDOG is not set
382# CONFIG_NVRAM is not set
383# CONFIG_GEN_RTC is not set
384# CONFIG_DTLK is not set
385# CONFIG_R3964 is not set
386
387#
388# Ftape, the floppy tape device driver
389#
390# CONFIG_AGP is not set
391# CONFIG_DRM is not set
392# CONFIG_RAW_DRIVER is not set
393
394#
395# TPM devices
396#
397
398#
399# I2C support
400#
401# CONFIG_I2C is not set
402
403#
404# Dallas's 1-wire bus
405#
406# CONFIG_W1 is not set
407
408#
409# Misc devices
410#
411
412#
413# Multimedia devices
414#
415# CONFIG_VIDEO_DEV is not set
416
417#
418# Digital Video Broadcasting Devices
419#
420# CONFIG_DVB is not set
421
422#
423# Graphics support
424#
425# CONFIG_FB is not set
426
427#
428# Sound
429#
430# CONFIG_SOUND is not set
431
432#
433# USB support
434#
435# CONFIG_USB_ARCH_HAS_HCD is not set
436# CONFIG_USB_ARCH_HAS_OHCI is not set
437
438#
439# USB Gadget Support
440#
441# CONFIG_USB_GADGET is not set
442
443#
444# MMC/SD Card support
445#
446# CONFIG_MMC is not set
447
448#
449# InfiniBand support
450#
451# CONFIG_INFINIBAND is not set
452
453#
454# File systems
455#
456CONFIG_EXT2_FS=y
457CONFIG_EXT2_FS_XATTR=y
458# CONFIG_EXT2_FS_POSIX_ACL is not set
459# CONFIG_EXT2_FS_SECURITY is not set
460CONFIG_EXT3_FS=y
461CONFIG_EXT3_FS_XATTR=y
462# CONFIG_EXT3_FS_POSIX_ACL is not set
463# CONFIG_EXT3_FS_SECURITY is not set
464CONFIG_JBD=y
465# CONFIG_JBD_DEBUG is not set
466CONFIG_FS_MBCACHE=y
467# CONFIG_REISERFS_FS is not set
468# CONFIG_JFS_FS is not set
469
470#
471# XFS support
472#
473# CONFIG_XFS_FS is not set
474# CONFIG_MINIX_FS is not set
475# CONFIG_ROMFS_FS is not set
476# CONFIG_QUOTA is not set
477# CONFIG_DNOTIFY is not set
478# CONFIG_AUTOFS_FS is not set
479# CONFIG_AUTOFS4_FS is not set
480
481#
482# CD-ROM/DVD Filesystems
483#
484# CONFIG_ISO9660_FS is not set
485# CONFIG_UDF_FS is not set
486
487#
488# DOS/FAT/NT Filesystems
489#
490# CONFIG_MSDOS_FS is not set
491# CONFIG_VFAT_FS is not set
492# CONFIG_NTFS_FS is not set
493
494#
495# Pseudo filesystems
496#
497CONFIG_PROC_FS=y
498# CONFIG_PROC_KCORE is not set
499CONFIG_SYSFS=y
500# CONFIG_DEVFS_FS is not set
501# CONFIG_DEVPTS_FS_XATTR is not set
502# CONFIG_TMPFS is not set
503# CONFIG_HUGETLBFS is not set
504# CONFIG_HUGETLB_PAGE is not set
505CONFIG_RAMFS=y
506
507#
508# Miscellaneous filesystems
509#
510# CONFIG_ADFS_FS is not set
511# CONFIG_AFFS_FS is not set
512# CONFIG_HFS_FS is not set
513# CONFIG_HFSPLUS_FS is not set
514# CONFIG_BEFS_FS is not set
515# CONFIG_BFS_FS is not set
516# CONFIG_EFS_FS is not set
517# CONFIG_CRAMFS is not set
518# CONFIG_VXFS_FS is not set
519# CONFIG_HPFS_FS is not set
520# CONFIG_QNX4FS_FS is not set
521# CONFIG_SYSV_FS is not set
522# CONFIG_UFS_FS is not set
523
524#
525# Network File Systems
526#
527CONFIG_NFS_FS=y
528# CONFIG_NFS_V3 is not set
529# CONFIG_NFS_V4 is not set
530# CONFIG_NFS_DIRECTIO is not set
531# CONFIG_NFSD is not set
532CONFIG_ROOT_NFS=y
533CONFIG_LOCKD=y
534CONFIG_SUNRPC=y
535# CONFIG_RPCSEC_GSS_KRB5 is not set
536# CONFIG_RPCSEC_GSS_SPKM3 is not set
537# CONFIG_SMB_FS is not set
538# CONFIG_CIFS is not set
539# CONFIG_NCP_FS is not set
540# CONFIG_CODA_FS is not set
541# CONFIG_AFS_FS is not set
542
543#
544# Partition Types
545#
546CONFIG_PARTITION_ADVANCED=y
547# CONFIG_ACORN_PARTITION is not set
548# CONFIG_OSF_PARTITION is not set
549# CONFIG_AMIGA_PARTITION is not set
550# CONFIG_ATARI_PARTITION is not set
551# CONFIG_MAC_PARTITION is not set
552CONFIG_MSDOS_PARTITION=y
553# CONFIG_BSD_DISKLABEL is not set
554# CONFIG_MINIX_SUBPARTITION is not set
555# CONFIG_SOLARIS_X86_PARTITION is not set
556# CONFIG_UNIXWARE_DISKLABEL is not set
557# CONFIG_LDM_PARTITION is not set
558# CONFIG_SGI_PARTITION is not set
559# CONFIG_ULTRIX_PARTITION is not set
560# CONFIG_SUN_PARTITION is not set
561# CONFIG_EFI_PARTITION is not set
562
563#
564# Native Language Support
565#
566# CONFIG_NLS is not set
567
568#
569# MPC8xx CPM Options
570#
571CONFIG_SCC_ENET=y
572# CONFIG_SCC1_ENET is not set
573# CONFIG_SCC2_ENET is not set
574CONFIG_SCC3_ENET=y
575# CONFIG_FEC_ENET is not set
576# CONFIG_ENET_BIG_BUFFERS is not set
577
578#
579# Generic MPC8xx Options
580#
581CONFIG_8xx_COPYBACK=y
582CONFIG_8xx_CPU6=y
583CONFIG_NO_UCODE_PATCH=y
584# CONFIG_USB_SOF_UCODE_PATCH is not set
585# CONFIG_I2C_SPI_UCODE_PATCH is not set
586# CONFIG_I2C_SPI_SMC1_UCODE_PATCH is not set
587
588#
589# Library routines
590#
591CONFIG_CRC_CCITT=y
592# CONFIG_CRC32 is not set
593# CONFIG_LIBCRC32C is not set
594CONFIG_ZLIB_INFLATE=y
595CONFIG_ZLIB_DEFLATE=y
596
597#
598# Profiling support
599#
600# CONFIG_PROFILING is not set
601
602#
603# Kernel hacking
604#
605# CONFIG_PRINTK_TIME is not set
606# CONFIG_DEBUG_KERNEL is not set
607CONFIG_LOG_BUF_SHIFT=14
608
609#
610# Security options
611#
612# CONFIG_KEYS is not set
613# CONFIG_SECURITY is not set
614
615#
616# Cryptographic options
617#
618# CONFIG_CRYPTO is not set
619
620#
621# Hardware crypto devices
622#
diff --git a/arch/ppc/kernel/machine_kexec.c b/arch/ppc/kernel/machine_kexec.c
index 84d65a8719..a72787747d 100644
--- a/arch/ppc/kernel/machine_kexec.c
+++ b/arch/ppc/kernel/machine_kexec.c
@@ -28,6 +28,12 @@ typedef NORET_TYPE void (*relocate_new_kernel_t)(
28const extern unsigned char relocate_new_kernel[]; 28const extern unsigned char relocate_new_kernel[];
29const extern unsigned int relocate_new_kernel_size; 29const extern unsigned int relocate_new_kernel_size;
30 30
31/*
32 * Provide a dummy crash_notes definition while crash dump arrives to ppc.
33 * This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
34 */
35void *crash_notes = NULL;
36
31void machine_shutdown(void) 37void machine_shutdown(void)
32{ 38{
33 if (ppc_md.machine_shutdown) 39 if (ppc_md.machine_shutdown)
diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c
index 7358665591..bf4ddca5e8 100644
--- a/arch/ppc/kernel/time.c
+++ b/arch/ppc/kernel/time.c
@@ -89,6 +89,9 @@ unsigned long tb_to_ns_scale;
89 89
90extern unsigned long wall_jiffies; 90extern unsigned long wall_jiffies;
91 91
92/* used for timezone offset */
93static long timezone_offset;
94
92DEFINE_SPINLOCK(rtc_lock); 95DEFINE_SPINLOCK(rtc_lock);
93 96
94EXPORT_SYMBOL(rtc_lock); 97EXPORT_SYMBOL(rtc_lock);
@@ -170,7 +173,7 @@ void timer_interrupt(struct pt_regs * regs)
170 xtime.tv_sec - last_rtc_update >= 659 && 173 xtime.tv_sec - last_rtc_update >= 659 &&
171 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ && 174 abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ &&
172 jiffies - wall_jiffies == 1) { 175 jiffies - wall_jiffies == 1) {
173 if (ppc_md.set_rtc_time(xtime.tv_sec+1 + time_offset) == 0) 176 if (ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) == 0)
174 last_rtc_update = xtime.tv_sec+1; 177 last_rtc_update = xtime.tv_sec+1;
175 else 178 else
176 /* Try again one minute later */ 179 /* Try again one minute later */
@@ -286,7 +289,7 @@ void __init time_init(void)
286 unsigned old_stamp, stamp, elapsed; 289 unsigned old_stamp, stamp, elapsed;
287 290
288 if (ppc_md.time_init != NULL) 291 if (ppc_md.time_init != NULL)
289 time_offset = ppc_md.time_init(); 292 timezone_offset = ppc_md.time_init();
290 293
291 if (__USE_RTC()) { 294 if (__USE_RTC()) {
292 /* 601 processor: dec counts down by 128 every 128ns */ 295 /* 601 processor: dec counts down by 128 every 128ns */
@@ -331,10 +334,10 @@ void __init time_init(void)
331 set_dec(tb_ticks_per_jiffy); 334 set_dec(tb_ticks_per_jiffy);
332 335
333 /* If platform provided a timezone (pmac), we correct the time */ 336 /* If platform provided a timezone (pmac), we correct the time */
334 if (time_offset) { 337 if (timezone_offset) {
335 sys_tz.tz_minuteswest = -time_offset / 60; 338 sys_tz.tz_minuteswest = -timezone_offset / 60;
336 sys_tz.tz_dsttime = 0; 339 sys_tz.tz_dsttime = 0;
337 xtime.tv_sec -= time_offset; 340 xtime.tv_sec -= timezone_offset;
338 } 341 }
339 set_normalized_timespec(&wall_to_monotonic, 342 set_normalized_timespec(&wall_to_monotonic,
340 -xtime.tv_sec, -xtime.tv_nsec); 343 -xtime.tv_sec, -xtime.tv_nsec);
diff --git a/arch/ppc/platforms/fads.h b/arch/ppc/platforms/fads.h
index 632b8178ce..b60c56450b 100644
--- a/arch/ppc/platforms/fads.h
+++ b/arch/ppc/platforms/fads.h
@@ -3,7 +3,18 @@
3 * the Motorola 860T FADS board. Copied from the MBX stuff. 3 * the Motorola 860T FADS board. Copied from the MBX stuff.
4 * 4 *
5 * Copyright (c) 1998 Dan Malek (dmalek@jlc.net) 5 * Copyright (c) 1998 Dan Malek (dmalek@jlc.net)
6 *
7 * Added MPC86XADS support.
8 * The MPC86xADS manual says the board "is compatible with the MPC8xxFADS
9 * for SW point of view". This is 99% correct.
10 *
11 * Author: MontaVista Software, Inc.
12 * source@mvista.com
13 * 2005 (c) MontaVista Software, Inc. This file is licensed under the
14 * terms of the GNU General Public License version 2. This program is licensed
15 * "as is" without any warranty of any kind, whether express or implied.
6 */ 16 */
17
7#ifdef __KERNEL__ 18#ifdef __KERNEL__
8#ifndef __ASM_FADS_H__ 19#ifndef __ASM_FADS_H__
9#define __ASM_FADS_H__ 20#define __ASM_FADS_H__
@@ -12,18 +23,45 @@
12 23
13#include <asm/ppcboot.h> 24#include <asm/ppcboot.h>
14 25
26#if defined(CONFIG_MPC86XADS)
27
28/* U-Boot maps BCSR to 0xff080000 */
29#define BCSR_ADDR ((uint)0xff080000)
30
31/* MPC86XADS has one more CPLD and an additional BCSR.
32 */
33#define CFG_PHYDEV_ADDR ((uint)0xff0a0000)
34#define BCSR5 ((uint)(CFG_PHYDEV_ADDR + 0x300))
35
36#define BCSR5_T1_RST 0x10
37#define BCSR5_ATM155_RST 0x08
38#define BCSR5_ATM25_RST 0x04
39#define BCSR5_MII1_EN 0x02
40#define BCSR5_MII1_RST 0x01
41
42/* There is no PHY link change interrupt */
43#define PHY_INTERRUPT (-1)
44
45#else /* FADS */
46
15/* Memory map is configured by the PROM startup. 47/* Memory map is configured by the PROM startup.
16 * I tried to follow the FADS manual, although the startup PROM 48 * I tried to follow the FADS manual, although the startup PROM
17 * dictates this and we simply have to move some of the physical 49 * dictates this and we simply have to move some of the physical
18 * addresses for Linux. 50 * addresses for Linux.
19 */ 51 */
20#define BCSR_ADDR ((uint)0xff010000) 52#define BCSR_ADDR ((uint)0xff010000)
53
54/* PHY link change interrupt */
55#define PHY_INTERRUPT SIU_IRQ2
56
57#endif /* CONFIG_MPC86XADS */
58
21#define BCSR_SIZE ((uint)(64 * 1024)) 59#define BCSR_SIZE ((uint)(64 * 1024))
22#define BCSR0 ((uint)0xff010000) 60#define BCSR0 ((uint)(BCSR_ADDR + 0x00))
23#define BCSR1 ((uint)0xff010004) 61#define BCSR1 ((uint)(BCSR_ADDR + 0x04))
24#define BCSR2 ((uint)0xff010008) 62#define BCSR2 ((uint)(BCSR_ADDR + 0x08))
25#define BCSR3 ((uint)0xff01000c) 63#define BCSR3 ((uint)(BCSR_ADDR + 0x0c))
26#define BCSR4 ((uint)0xff010010) 64#define BCSR4 ((uint)(BCSR_ADDR + 0x10))
27 65
28#define IMAP_ADDR ((uint)0xff000000) 66#define IMAP_ADDR ((uint)0xff000000)
29#define IMAP_SIZE ((uint)(64 * 1024)) 67#define IMAP_SIZE ((uint)(64 * 1024))
@@ -34,8 +72,17 @@
34/* Bits of interest in the BCSRs. 72/* Bits of interest in the BCSRs.
35 */ 73 */
36#define BCSR1_ETHEN ((uint)0x20000000) 74#define BCSR1_ETHEN ((uint)0x20000000)
75#define BCSR1_IRDAEN ((uint)0x10000000)
37#define BCSR1_RS232EN_1 ((uint)0x01000000) 76#define BCSR1_RS232EN_1 ((uint)0x01000000)
77#define BCSR1_PCCEN ((uint)0x00800000)
78#define BCSR1_PCCVCC0 ((uint)0x00400000)
79#define BCSR1_PCCVPP0 ((uint)0x00200000)
80#define BCSR1_PCCVPP1 ((uint)0x00100000)
81#define BCSR1_PCCVPP_MASK (BCSR1_PCCVPP0 | BCSR1_PCCVPP1)
38#define BCSR1_RS232EN_2 ((uint)0x00040000) 82#define BCSR1_RS232EN_2 ((uint)0x00040000)
83#define BCSR1_PCCVCC1 ((uint)0x00010000)
84#define BCSR1_PCCVCC_MASK (BCSR1_PCCVCC0 | BCSR1_PCCVCC1)
85
39#define BCSR4_ETHLOOP ((uint)0x80000000) /* EEST Loopback */ 86#define BCSR4_ETHLOOP ((uint)0x80000000) /* EEST Loopback */
40#define BCSR4_EEFDX ((uint)0x40000000) /* EEST FDX enable */ 87#define BCSR4_EEFDX ((uint)0x40000000) /* EEST FDX enable */
41#define BCSR4_FETH_EN ((uint)0x08000000) /* PHY enable */ 88#define BCSR4_FETH_EN ((uint)0x08000000) /* PHY enable */
@@ -44,14 +91,64 @@
44#define BCSR4_FETHFDE ((uint)0x02000000) /* PHY FDX advertise */ 91#define BCSR4_FETHFDE ((uint)0x02000000) /* PHY FDX advertise */
45#define BCSR4_FETHRST ((uint)0x00200000) /* PHY Reset */ 92#define BCSR4_FETHRST ((uint)0x00200000) /* PHY Reset */
46 93
94/* IO_BASE definition for pcmcia.
95 */
96#define _IO_BASE 0x80000000
97#define _IO_BASE_SIZE 0x1000
98
99#ifdef CONFIG_IDE
100#define MAX_HWIFS 1
101#endif
102
47/* Interrupt level assignments. 103/* Interrupt level assignments.
48 */ 104 */
49#define FEC_INTERRUPT SIU_LEVEL1 /* FEC interrupt */ 105#define FEC_INTERRUPT SIU_LEVEL1 /* FEC interrupt */
50#define PHY_INTERRUPT SIU_IRQ2 /* PHY link change interrupt */
51 106
52/* We don't use the 8259. 107/* We don't use the 8259.
53 */ 108 */
54#define NR_8259_INTS 0 109#define NR_8259_INTS 0
55 110
111/* CPM Ethernet through SCC1 or SCC2 */
112
113#ifdef CONFIG_SCC1_ENET /* Probably 860 variant */
114/* Bits in parallel I/O port registers that have to be set/cleared
115 * to configure the pins for SCC1 use.
116 * TCLK - CLK1, RCLK - CLK2.
117 */
118#define PA_ENET_RXD ((ushort)0x0001)
119#define PA_ENET_TXD ((ushort)0x0002)
120#define PA_ENET_TCLK ((ushort)0x0100)
121#define PA_ENET_RCLK ((ushort)0x0200)
122#define PB_ENET_TENA ((uint)0x00001000)
123#define PC_ENET_CLSN ((ushort)0x0010)
124#define PC_ENET_RENA ((ushort)0x0020)
125
126/* Control bits in the SICR to route TCLK (CLK1) and RCLK (CLK2) to
127 * SCC1. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
128 */
129#define SICR_ENET_MASK ((uint)0x000000ff)
130#define SICR_ENET_CLKRT ((uint)0x0000002c)
131#endif /* CONFIG_SCC1_ENET */
132
133#ifdef CONFIG_SCC2_ENET /* Probably 823/850 variant */
134/* Bits in parallel I/O port registers that have to be set/cleared
135 * to configure the pins for SCC1 use.
136 * TCLK - CLK1, RCLK - CLK2.
137 */
138#define PA_ENET_RXD ((ushort)0x0004)
139#define PA_ENET_TXD ((ushort)0x0008)
140#define PA_ENET_TCLK ((ushort)0x0400)
141#define PA_ENET_RCLK ((ushort)0x0200)
142#define PB_ENET_TENA ((uint)0x00002000)
143#define PC_ENET_CLSN ((ushort)0x0040)
144#define PC_ENET_RENA ((ushort)0x0080)
145
146/* Control bits in the SICR to route TCLK and RCLK to
147 * SCC2. Also, make sure GR1 (bit 24) and SC1 (bit 25) are zero.
148 */
149#define SICR_ENET_MASK ((uint)0x0000ff00)
150#define SICR_ENET_CLKRT ((uint)0x00002e00)
151#endif /* CONFIG_SCC2_ENET */
152
56#endif /* __ASM_FADS_H__ */ 153#endif /* __ASM_FADS_H__ */
57#endif /* __KERNEL__ */ 154#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/mpc885ads.h b/arch/ppc/platforms/mpc885ads.h
new file mode 100644
index 0000000000..eb386635b0
--- /dev/null
+++ b/arch/ppc/platforms/mpc885ads.h
@@ -0,0 +1,92 @@
1/*
2 * A collection of structures, addresses, and values associated with
3 * the Freescale MPC885ADS board.
4 * Copied from the FADS stuff.
5 *
6 * Author: MontaVista Software, Inc.
7 * source@mvista.com
8 *
9 * 2005 (c) MontaVista Software, Inc. This file is licensed under the
10 * terms of the GNU General Public License version 2. This program is licensed
11 * "as is" without any warranty of any kind, whether express or implied.
12 */
13
14#ifdef __KERNEL__
15#ifndef __ASM_MPC885ADS_H__
16#define __ASM_MPC885ADS_H__
17
18#include <linux/config.h>
19
20#include <asm/ppcboot.h>
21
22/* U-Boot maps BCSR to 0xff080000 */
23#define BCSR_ADDR ((uint)0xff080000)
24#define BCSR_SIZE ((uint)32)
25#define BCSR0 ((uint)(BCSR_ADDR + 0x00))
26#define BCSR1 ((uint)(BCSR_ADDR + 0x04))
27#define BCSR2 ((uint)(BCSR_ADDR + 0x08))
28#define BCSR3 ((uint)(BCSR_ADDR + 0x0c))
29#define BCSR4 ((uint)(BCSR_ADDR + 0x10))
30
31#define CFG_PHYDEV_ADDR ((uint)0xff0a0000)
32#define BCSR5 ((uint)(CFG_PHYDEV_ADDR + 0x300))
33
34#define IMAP_ADDR ((uint)0xff000000)
35#define IMAP_SIZE ((uint)(64 * 1024))
36
37#define PCMCIA_MEM_ADDR ((uint)0xff020000)
38#define PCMCIA_MEM_SIZE ((uint)(64 * 1024))
39
40/* Bits of interest in the BCSRs.
41 */
42#define BCSR1_ETHEN ((uint)0x20000000)
43#define BCSR1_IRDAEN ((uint)0x10000000)
44#define BCSR1_RS232EN_1 ((uint)0x01000000)
45#define BCSR1_PCCEN ((uint)0x00800000)
46#define BCSR1_PCCVCC0 ((uint)0x00400000)
47#define BCSR1_PCCVPP0 ((uint)0x00200000)
48#define BCSR1_PCCVPP1 ((uint)0x00100000)
49#define BCSR1_PCCVPP_MASK (BCSR1_PCCVPP0 | BCSR1_PCCVPP1)
50#define BCSR1_RS232EN_2 ((uint)0x00040000)
51#define BCSR1_PCCVCC1 ((uint)0x00010000)
52#define BCSR1_PCCVCC_MASK (BCSR1_PCCVCC0 | BCSR1_PCCVCC1)
53
54#define BCSR4_ETH10_RST ((uint)0x80000000) /* 10Base-T PHY reset*/
55#define BCSR4_USB_LO_SPD ((uint)0x04000000)
56#define BCSR4_USB_VCC ((uint)0x02000000)
57#define BCSR4_USB_FULL_SPD ((uint)0x00040000)
58#define BCSR4_USB_EN ((uint)0x00020000)
59
60#define BCSR5_MII2_EN 0x40
61#define BCSR5_MII2_RST 0x20
62#define BCSR5_T1_RST 0x10
63#define BCSR5_ATM155_RST 0x08
64#define BCSR5_ATM25_RST 0x04
65#define BCSR5_MII1_EN 0x02
66#define BCSR5_MII1_RST 0x01
67
68/* Interrupt level assignments */
69#define PHY_INTERRUPT SIU_IRQ7 /* PHY link change interrupt */
70#define SIU_INT_FEC1 SIU_LEVEL1 /* FEC1 interrupt */
71#define SIU_INT_FEC2 SIU_LEVEL3 /* FEC2 interrupt */
72#define FEC_INTERRUPT SIU_INT_FEC1 /* FEC interrupt */
73
74/* We don't use the 8259 */
75#define NR_8259_INTS 0
76
77/* CPM Ethernet through SCC3 */
78#define PA_ENET_RXD ((ushort)0x0040)
79#define PA_ENET_TXD ((ushort)0x0080)
80#define PE_ENET_TCLK ((uint)0x00004000)
81#define PE_ENET_RCLK ((uint)0x00008000)
82#define PE_ENET_TENA ((uint)0x00000010)
83#define PC_ENET_CLSN ((ushort)0x0400)
84#define PC_ENET_RENA ((ushort)0x0800)
85
86/* Control bits in the SICR to route TCLK (CLK5) and RCLK (CLK6) to
87 * SCC3. Also, make sure GR3 (bit 8) and SC3 (bit 9) are zero */
88#define SICR_ENET_MASK ((uint)0x00ff0000)
89#define SICR_ENET_CLKRT ((uint)0x002c0000)
90
91#endif /* __ASM_MPC885ADS_H__ */
92#endif /* __KERNEL__ */
diff --git a/arch/ppc/platforms/pmac_cpufreq.c b/arch/ppc/platforms/pmac_cpufreq.c
index 5fdd4f607a..c0605244ed 100644
--- a/arch/ppc/platforms/pmac_cpufreq.c
+++ b/arch/ppc/platforms/pmac_cpufreq.c
@@ -452,7 +452,7 @@ static u32 __pmac read_gpio(struct device_node *np)
452 return offset; 452 return offset;
453} 453}
454 454
455static int __pmac pmac_cpufreq_suspend(struct cpufreq_policy *policy, u32 state) 455static int __pmac pmac_cpufreq_suspend(struct cpufreq_policy *policy, pm_message_t pmsg)
456{ 456{
457 /* Ok, this could be made a bit smarter, but let's be robust for now. We 457 /* Ok, this could be made a bit smarter, but let's be robust for now. We
458 * always force a speed change to high speed before sleep, to make sure 458 * always force a speed change to high speed before sleep, to make sure
diff --git a/arch/ppc/syslib/of_device.c b/arch/ppc/syslib/of_device.c
index 49c0e34e2d..1eb4f726ca 100644
--- a/arch/ppc/syslib/of_device.c
+++ b/arch/ppc/syslib/of_device.c
@@ -3,6 +3,7 @@
3#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/mod_devicetable.h>
6#include <asm/errno.h> 7#include <asm/errno.h>
7#include <asm/of_device.h> 8#include <asm/of_device.h>
8 9
@@ -15,20 +16,20 @@
15 * Used by a driver to check whether an of_device present in the 16 * Used by a driver to check whether an of_device present in the
16 * system is in its list of supported devices. 17 * system is in its list of supported devices.
17 */ 18 */
18const struct of_match * of_match_device(const struct of_match *matches, 19const struct of_device_id * of_match_device(const struct of_device_id *matches,
19 const struct of_device *dev) 20 const struct of_device *dev)
20{ 21{
21 if (!dev->node) 22 if (!dev->node)
22 return NULL; 23 return NULL;
23 while (matches->name || matches->type || matches->compatible) { 24 while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
24 int match = 1; 25 int match = 1;
25 if (matches->name && matches->name != OF_ANY_MATCH) 26 if (matches->name[0])
26 match &= dev->node->name 27 match &= dev->node->name
27 && !strcmp(matches->name, dev->node->name); 28 && !strcmp(matches->name, dev->node->name);
28 if (matches->type && matches->type != OF_ANY_MATCH) 29 if (matches->type[0])
29 match &= dev->node->type 30 match &= dev->node->type
30 && !strcmp(matches->type, dev->node->type); 31 && !strcmp(matches->type, dev->node->type);
31 if (matches->compatible && matches->compatible != OF_ANY_MATCH) 32 if (matches->compatible[0])
32 match &= device_is_compatible(dev->node, 33 match &= device_is_compatible(dev->node,
33 matches->compatible); 34 matches->compatible);
34 if (match) 35 if (match)
@@ -42,7 +43,7 @@ static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
42{ 43{
43 struct of_device * of_dev = to_of_device(dev); 44 struct of_device * of_dev = to_of_device(dev);
44 struct of_platform_driver * of_drv = to_of_platform_driver(drv); 45 struct of_platform_driver * of_drv = to_of_platform_driver(drv);
45 const struct of_match * matches = of_drv->match_table; 46 const struct of_device_id * matches = of_drv->match_table;
46 47
47 if (!matches) 48 if (!matches)
48 return 0; 49 return 0;
@@ -75,7 +76,7 @@ static int of_device_probe(struct device *dev)
75 int error = -ENODEV; 76 int error = -ENODEV;
76 struct of_platform_driver *drv; 77 struct of_platform_driver *drv;
77 struct of_device *of_dev; 78 struct of_device *of_dev;
78 const struct of_match *match; 79 const struct of_device_id *match;
79 80
80 drv = to_of_platform_driver(dev->driver); 81 drv = to_of_platform_driver(dev->driver);
81 of_dev = to_of_device(dev); 82 of_dev = to_of_device(dev);
diff --git a/arch/ppc/syslib/ppc4xx_pic.c b/arch/ppc/syslib/ppc4xx_pic.c
index 05686fa735..40086212b9 100644
--- a/arch/ppc/syslib/ppc4xx_pic.c
+++ b/arch/ppc/syslib/ppc4xx_pic.c
@@ -110,6 +110,10 @@ static int ppc4xx_pic_get_irq(struct pt_regs *regs)
110 110
111static void __init ppc4xx_pic_impl_init(void) 111static void __init ppc4xx_pic_impl_init(void)
112{ 112{
113#if defined(CONFIG_440GX)
114 /* Disable 440GP compatibility mode if it was enabled in firmware */
115 SDR_WRITE(DCRN_SDR_MFR, SDR_READ(DCRN_SDR_MFR) & ~DCRN_SDR_MFR_PCM);
116#endif
113 /* Configure Base UIC */ 117 /* Configure Base UIC */
114 mtdcr(DCRN_UIC_CR(UICB), 0); 118 mtdcr(DCRN_UIC_CR(UICB), 0);
115 mtdcr(DCRN_UIC_TR(UICB), 0); 119 mtdcr(DCRN_UIC_TR(UICB), 0);
diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
index f804f25232..fdd8afba71 100644
--- a/arch/ppc64/Kconfig
+++ b/arch/ppc64/Kconfig
@@ -429,6 +429,8 @@ config CMDLINE
429 429
430endmenu 430endmenu
431 431
432source "net/Kconfig"
433
432source "drivers/Kconfig" 434source "drivers/Kconfig"
433 435
434source "fs/Kconfig" 436source "fs/Kconfig"
diff --git a/arch/ppc64/kernel/cpu_setup_power4.S b/arch/ppc64/kernel/cpu_setup_power4.S
index 42fc08cf87..0482c063c2 100644
--- a/arch/ppc64/kernel/cpu_setup_power4.S
+++ b/arch/ppc64/kernel/cpu_setup_power4.S
@@ -31,10 +31,13 @@ _GLOBAL(__970_cpu_preinit)
31 */ 31 */
32 mfspr r0,SPRN_PVR 32 mfspr r0,SPRN_PVR
33 srwi r0,r0,16 33 srwi r0,r0,16
34 cmpwi cr0,r0,0x39 34 cmpwi r0,0x39
35 cmpwi cr1,r0,0x3c 35 beq 1f
36 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq 36 cmpwi r0,0x3c
37 beq 1f
38 cmpwi r0,0x44
37 bnelr 39 bnelr
401:
38 41
39 /* Make sure HID4:rm_ci is off before MMU is turned off, that large 42 /* Make sure HID4:rm_ci is off before MMU is turned off, that large
40 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and 43 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and
@@ -133,12 +136,14 @@ _GLOBAL(__save_cpu_setup)
133 /* We only deal with 970 for now */ 136 /* We only deal with 970 for now */
134 mfspr r0,SPRN_PVR 137 mfspr r0,SPRN_PVR
135 srwi r0,r0,16 138 srwi r0,r0,16
136 cmpwi cr0,r0,0x39 139 cmpwi r0,0x39
137 cmpwi cr1,r0,0x3c 140 beq 1f
138 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq 141 cmpwi r0,0x3c
139 bne 1f 142 beq 1f
140 143 cmpwi r0,0x44
141 /* Save HID0,1,4 and 5 */ 144 bne 2f
145
1461: /* Save HID0,1,4 and 5 */
142 mfspr r3,SPRN_HID0 147 mfspr r3,SPRN_HID0
143 std r3,CS_HID0(r5) 148 std r3,CS_HID0(r5)
144 mfspr r3,SPRN_HID1 149 mfspr r3,SPRN_HID1
@@ -148,7 +153,7 @@ _GLOBAL(__save_cpu_setup)
148 mfspr r3,SPRN_HID5 153 mfspr r3,SPRN_HID5
149 std r3,CS_HID5(r5) 154 std r3,CS_HID5(r5)
150 155
1511: 1562:
152 mtcr r7 157 mtcr r7
153 blr 158 blr
154 159
@@ -165,12 +170,14 @@ _GLOBAL(__restore_cpu_setup)
165 /* We only deal with 970 for now */ 170 /* We only deal with 970 for now */
166 mfspr r0,SPRN_PVR 171 mfspr r0,SPRN_PVR
167 srwi r0,r0,16 172 srwi r0,r0,16
168 cmpwi cr0,r0,0x39 173 cmpwi r0,0x39
169 cmpwi cr1,r0,0x3c 174 beq 1f
170 cror 4*cr0+eq,4*cr0+eq,4*cr1+eq 175 cmpwi r0,0x3c
171 bne 1f 176 beq 1f
177 cmpwi r0,0x44
178 bnelr
172 179
173 /* Before accessing memory, we make sure rm_ci is clear */ 1801: /* Before accessing memory, we make sure rm_ci is clear */
174 li r0,0 181 li r0,0
175 mfspr r3,SPRN_HID4 182 mfspr r3,SPRN_HID4
176 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */ 183 rldimi r3,r0,40,23 /* clear bit 23 (rm_ci) */
@@ -223,6 +230,5 @@ _GLOBAL(__restore_cpu_setup)
223 mtspr SPRN_HID5,r3 230 mtspr SPRN_HID5,r3
224 sync 231 sync
225 isync 232 isync
2261:
227 blr 233 blr
228 234
diff --git a/arch/ppc64/kernel/cputable.c b/arch/ppc64/kernel/cputable.c
index 1d162c7c59..77cec42f95 100644
--- a/arch/ppc64/kernel/cputable.c
+++ b/arch/ppc64/kernel/cputable.c
@@ -49,160 +49,234 @@ extern void __setup_cpu_be(unsigned long offset, struct cpu_spec* spec);
49#endif 49#endif
50 50
51struct cpu_spec cpu_specs[] = { 51struct cpu_spec cpu_specs[] = {
52 { /* Power3 */ 52 { /* Power3 */
53 0xffff0000, 0x00400000, "POWER3 (630)", 53 .pvr_mask = 0xffff0000,
54 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 54 .pvr_value = 0x00400000,
55 CPU_FTR_IABR | CPU_FTR_PMC8, 55 .cpu_name = "POWER3 (630)",
56 COMMON_USER_PPC64, 56 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
57 128, 128, 57 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
58 __setup_cpu_power3, 58 CPU_FTR_PMC8,
59 COMMON_PPC64_FW 59 .cpu_user_features = COMMON_USER_PPC64,
60 }, 60 .icache_bsize = 128,
61 { /* Power3+ */ 61 .dcache_bsize = 128,
62 0xffff0000, 0x00410000, "POWER3 (630+)", 62 .cpu_setup = __setup_cpu_power3,
63 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 63 .firmware_features = COMMON_PPC64_FW,
64 CPU_FTR_IABR | CPU_FTR_PMC8, 64 },
65 COMMON_USER_PPC64, 65 { /* Power3+ */
66 128, 128, 66 .pvr_mask = 0xffff0000,
67 __setup_cpu_power3, 67 .pvr_value = 0x00410000,
68 COMMON_PPC64_FW 68 .cpu_name = "POWER3 (630+)",
69 }, 69 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
70 { /* Northstar */ 70 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
71 0xffff0000, 0x00330000, "RS64-II (northstar)", 71 CPU_FTR_PMC8,
72 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 72 .cpu_user_features = COMMON_USER_PPC64,
73 CPU_FTR_IABR | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 73 .icache_bsize = 128,
74 COMMON_USER_PPC64, 74 .dcache_bsize = 128,
75 128, 128, 75 .cpu_setup = __setup_cpu_power3,
76 __setup_cpu_power3, 76 .firmware_features = COMMON_PPC64_FW,
77 COMMON_PPC64_FW 77 },
78 }, 78 { /* Northstar */
79 { /* Pulsar */ 79 .pvr_mask = 0xffff0000,
80 0xffff0000, 0x00340000, "RS64-III (pulsar)", 80 .pvr_value = 0x00330000,
81 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 81 .cpu_name = "RS64-II (northstar)",
82 CPU_FTR_IABR | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 82 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
83 COMMON_USER_PPC64, 83 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
84 128, 128, 84 CPU_FTR_PMC8 | CPU_FTR_MMCRA | CPU_FTR_CTRL,
85 __setup_cpu_power3, 85 .cpu_user_features = COMMON_USER_PPC64,
86 COMMON_PPC64_FW 86 .icache_bsize = 128,
87 }, 87 .dcache_bsize = 128,
88 { /* I-star */ 88 .cpu_setup = __setup_cpu_power3,
89 0xffff0000, 0x00360000, "RS64-III (icestar)", 89 .firmware_features = COMMON_PPC64_FW,
90 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 90 },
91 CPU_FTR_IABR | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 91 { /* Pulsar */
92 COMMON_USER_PPC64, 92 .pvr_mask = 0xffff0000,
93 128, 128, 93 .pvr_value = 0x00340000,
94 __setup_cpu_power3, 94 .cpu_name = "RS64-III (pulsar)",
95 COMMON_PPC64_FW 95 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
96 }, 96 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
97 { /* S-star */ 97 CPU_FTR_PMC8 | CPU_FTR_MMCRA | CPU_FTR_CTRL,
98 0xffff0000, 0x00370000, "RS64-IV (sstar)", 98 .cpu_user_features = COMMON_USER_PPC64,
99 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 99 .icache_bsize = 128,
100 CPU_FTR_IABR | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 100 .dcache_bsize = 128,
101 COMMON_USER_PPC64, 101 .cpu_setup = __setup_cpu_power3,
102 128, 128, 102 .firmware_features = COMMON_PPC64_FW,
103 __setup_cpu_power3, 103 },
104 COMMON_PPC64_FW 104 { /* I-star */
105 }, 105 .pvr_mask = 0xffff0000,
106 { /* Power4 */ 106 .pvr_value = 0x00360000,
107 0xffff0000, 0x00350000, "POWER4 (gp)", 107 .cpu_name = "RS64-III (icestar)",
108 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 108 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
109 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 109 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
110 COMMON_USER_PPC64, 110 CPU_FTR_PMC8 | CPU_FTR_MMCRA | CPU_FTR_CTRL,
111 128, 128, 111 .cpu_user_features = COMMON_USER_PPC64,
112 __setup_cpu_power4, 112 .icache_bsize = 128,
113 COMMON_PPC64_FW 113 .dcache_bsize = 128,
114 }, 114 .cpu_setup = __setup_cpu_power3,
115 { /* Power4+ */ 115 .firmware_features = COMMON_PPC64_FW,
116 0xffff0000, 0x00380000, "POWER4+ (gq)", 116 },
117 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 117 { /* S-star */
118 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 118 .pvr_mask = 0xffff0000,
119 COMMON_USER_PPC64, 119 .pvr_value = 0x00370000,
120 128, 128, 120 .cpu_name = "RS64-IV (sstar)",
121 __setup_cpu_power4, 121 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
122 COMMON_PPC64_FW 122 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_IABR |
123 }, 123 CPU_FTR_PMC8 | CPU_FTR_MMCRA | CPU_FTR_CTRL,
124 { /* PPC970 */ 124 .cpu_user_features = COMMON_USER_PPC64,
125 0xffff0000, 0x00390000, "PPC970", 125 .icache_bsize = 128,
126 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 126 .dcache_bsize = 128,
127 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP | 127 .cpu_setup = __setup_cpu_power3,
128 CPU_FTR_CAN_NAP | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 128 .firmware_features = COMMON_PPC64_FW,
129 COMMON_USER_PPC64 | PPC_FEATURE_HAS_ALTIVEC_COMP, 129 },
130 128, 128, 130 { /* Power4 */
131 __setup_cpu_ppc970, 131 .pvr_mask = 0xffff0000,
132 COMMON_PPC64_FW 132 .pvr_value = 0x00350000,
133 }, 133 .cpu_name = "POWER4 (gp)",
134 { /* PPC970FX */ 134 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
135 0xffff0000, 0x003c0000, "PPC970FX", 135 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
136 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 136 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_PMC8 | CPU_FTR_MMCRA,
137 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP | 137 .cpu_user_features = COMMON_USER_PPC64,
138 CPU_FTR_CAN_NAP | CPU_FTR_PMC8 | CPU_FTR_MMCRA, 138 .icache_bsize = 128,
139 COMMON_USER_PPC64 | PPC_FEATURE_HAS_ALTIVEC_COMP, 139 .dcache_bsize = 128,
140 128, 128, 140 .cpu_setup = __setup_cpu_power4,
141 __setup_cpu_ppc970, 141 .firmware_features = COMMON_PPC64_FW,
142 COMMON_PPC64_FW 142 },
143 }, 143 { /* Power4+ */
144 { /* Power5 */ 144 .pvr_mask = 0xffff0000,
145 0xffff0000, 0x003a0000, "POWER5 (gr)", 145 .pvr_value = 0x00380000,
146 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 146 .cpu_name = "POWER4+ (gq)",
147 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA | CPU_FTR_SMT | 147 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
148 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | 148 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
149 CPU_FTR_MMCRA_SIHV, 149 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_PMC8 | CPU_FTR_MMCRA,
150 COMMON_USER_PPC64, 150 .cpu_user_features = COMMON_USER_PPC64,
151 128, 128, 151 .icache_bsize = 128,
152 __setup_cpu_power4, 152 .dcache_bsize = 128,
153 COMMON_PPC64_FW 153 .cpu_setup = __setup_cpu_power4,
154 }, 154 .firmware_features = COMMON_PPC64_FW,
155 { /* Power5 */ 155 },
156 0xffff0000, 0x003b0000, "POWER5 (gs)", 156 { /* PPC970 */
157 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 157 .pvr_mask = 0xffff0000,
158 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA | CPU_FTR_SMT | 158 .pvr_value = 0x00390000,
159 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | 159 .cpu_name = "PPC970",
160 CPU_FTR_MMCRA_SIHV, 160 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
161 COMMON_USER_PPC64, 161 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
162 128, 128, 162 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
163 __setup_cpu_power4, 163 CPU_FTR_CAN_NAP | CPU_FTR_PMC8 | CPU_FTR_MMCRA,
164 COMMON_PPC64_FW 164 .cpu_user_features = COMMON_USER_PPC64 |
165 }, 165 PPC_FEATURE_HAS_ALTIVEC_COMP,
166 { /* BE DD1.x */ 166 .icache_bsize = 128,
167 0xffff0000, 0x00700000, "Broadband Engine", 167 .dcache_bsize = 128,
168 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 168 .cpu_setup = __setup_cpu_ppc970,
169 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP | 169 .firmware_features = COMMON_PPC64_FW,
170 CPU_FTR_SMT, 170 },
171 COMMON_USER_PPC64 | PPC_FEATURE_HAS_ALTIVEC_COMP, 171 { /* PPC970FX */
172 128, 128, 172 .pvr_mask = 0xffff0000,
173 __setup_cpu_be, 173 .pvr_value = 0x003c0000,
174 COMMON_PPC64_FW 174 .cpu_name = "PPC970FX",
175 }, 175 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
176 { /* default match */ 176 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
177 0x00000000, 0x00000000, "POWER4 (compatible)", 177 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
178 CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | 178 CPU_FTR_CAN_NAP | CPU_FTR_PMC8 | CPU_FTR_MMCRA,
179 CPU_FTR_PPCAS_ARCH_V2, 179 .cpu_user_features = COMMON_USER_PPC64 |
180 COMMON_USER_PPC64, 180 PPC_FEATURE_HAS_ALTIVEC_COMP,
181 128, 128, 181 .icache_bsize = 128,
182 __setup_cpu_power4, 182 .dcache_bsize = 128,
183 COMMON_PPC64_FW 183 .cpu_setup = __setup_cpu_ppc970,
184 } 184 .firmware_features = COMMON_PPC64_FW,
185 },
186 { /* PPC970MP */
187 .pvr_mask = 0xffff0000,
188 .pvr_value = 0x00440000,
189 .cpu_name = "PPC970MP",
190 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
191 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
192 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
193 CPU_FTR_CAN_NAP | CPU_FTR_PMC8 | CPU_FTR_MMCRA,
194 .cpu_user_features = COMMON_USER_PPC64 |
195 PPC_FEATURE_HAS_ALTIVEC_COMP,
196 .icache_bsize = 128,
197 .dcache_bsize = 128,
198 .cpu_setup = __setup_cpu_ppc970,
199 .firmware_features = COMMON_PPC64_FW,
200 },
201 { /* Power5 */
202 .pvr_mask = 0xffff0000,
203 .pvr_value = 0x003a0000,
204 .cpu_name = "POWER5 (gr)",
205 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
206 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
207 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA | CPU_FTR_SMT |
208 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE |
209 CPU_FTR_MMCRA_SIHV,
210 .cpu_user_features = COMMON_USER_PPC64,
211 .icache_bsize = 128,
212 .dcache_bsize = 128,
213 .cpu_setup = __setup_cpu_power4,
214 .firmware_features = COMMON_PPC64_FW,
215 },
216 { /* Power5 */
217 .pvr_mask = 0xffff0000,
218 .pvr_value = 0x003b0000,
219 .cpu_name = "POWER5 (gs)",
220 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
221 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
222 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA | CPU_FTR_SMT |
223 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE |
224 CPU_FTR_MMCRA_SIHV,
225 .cpu_user_features = COMMON_USER_PPC64,
226 .icache_bsize = 128,
227 .dcache_bsize = 128,
228 .cpu_setup = __setup_cpu_power4,
229 .firmware_features = COMMON_PPC64_FW,
230 },
231 { /* BE DD1.x */
232 .pvr_mask = 0xffff0000,
233 .pvr_value = 0x00700000,
234 .cpu_name = "Broadband Engine",
235 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
236 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
237 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP |
238 CPU_FTR_SMT,
239 .cpu_user_features = COMMON_USER_PPC64 |
240 PPC_FEATURE_HAS_ALTIVEC_COMP,
241 .icache_bsize = 128,
242 .dcache_bsize = 128,
243 .cpu_setup = __setup_cpu_be,
244 .firmware_features = COMMON_PPC64_FW,
245 },
246 { /* default match */
247 .pvr_mask = 0x00000000,
248 .pvr_value = 0x00000000,
249 .cpu_name = "POWER4 (compatible)",
250 .cpu_features = CPU_FTR_SPLIT_ID_CACHE |
251 CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE |
252 CPU_FTR_PPCAS_ARCH_V2,
253 .cpu_user_features = COMMON_USER_PPC64,
254 .icache_bsize = 128,
255 .dcache_bsize = 128,
256 .cpu_setup = __setup_cpu_power4,
257 .firmware_features = COMMON_PPC64_FW,
258 }
185}; 259};
186 260
187firmware_feature_t firmware_features_table[FIRMWARE_MAX_FEATURES] = { 261firmware_feature_t firmware_features_table[FIRMWARE_MAX_FEATURES] = {
188 {FW_FEATURE_PFT, "hcall-pft"}, 262 {FW_FEATURE_PFT, "hcall-pft"},
189 {FW_FEATURE_TCE, "hcall-tce"}, 263 {FW_FEATURE_TCE, "hcall-tce"},
190 {FW_FEATURE_SPRG0, "hcall-sprg0"}, 264 {FW_FEATURE_SPRG0, "hcall-sprg0"},
191 {FW_FEATURE_DABR, "hcall-dabr"}, 265 {FW_FEATURE_DABR, "hcall-dabr"},
192 {FW_FEATURE_COPY, "hcall-copy"}, 266 {FW_FEATURE_COPY, "hcall-copy"},
193 {FW_FEATURE_ASR, "hcall-asr"}, 267 {FW_FEATURE_ASR, "hcall-asr"},
194 {FW_FEATURE_DEBUG, "hcall-debug"}, 268 {FW_FEATURE_DEBUG, "hcall-debug"},
195 {FW_FEATURE_PERF, "hcall-perf"}, 269 {FW_FEATURE_PERF, "hcall-perf"},
196 {FW_FEATURE_DUMP, "hcall-dump"}, 270 {FW_FEATURE_DUMP, "hcall-dump"},
197 {FW_FEATURE_INTERRUPT, "hcall-interrupt"}, 271 {FW_FEATURE_INTERRUPT, "hcall-interrupt"},
198 {FW_FEATURE_MIGRATE, "hcall-migrate"}, 272 {FW_FEATURE_MIGRATE, "hcall-migrate"},
199 {FW_FEATURE_PERFMON, "hcall-perfmon"}, 273 {FW_FEATURE_PERFMON, "hcall-perfmon"},
200 {FW_FEATURE_CRQ, "hcall-crq"}, 274 {FW_FEATURE_CRQ, "hcall-crq"},
201 {FW_FEATURE_VIO, "hcall-vio"}, 275 {FW_FEATURE_VIO, "hcall-vio"},
202 {FW_FEATURE_RDMA, "hcall-rdma"}, 276 {FW_FEATURE_RDMA, "hcall-rdma"},
203 {FW_FEATURE_LLAN, "hcall-lLAN"}, 277 {FW_FEATURE_LLAN, "hcall-lLAN"},
204 {FW_FEATURE_BULK, "hcall-bulk"}, 278 {FW_FEATURE_BULK, "hcall-bulk"},
205 {FW_FEATURE_XDABR, "hcall-xdabr"}, 279 {FW_FEATURE_XDABR, "hcall-xdabr"},
206 {FW_FEATURE_MULTITCE, "hcall-multi-tce"}, 280 {FW_FEATURE_MULTITCE, "hcall-multi-tce"},
207 {FW_FEATURE_SPLPAR, "hcall-splpar"}, 281 {FW_FEATURE_SPLPAR, "hcall-splpar"},
208}; 282};
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
index 675c270858..93ebcac0d5 100644
--- a/arch/ppc64/kernel/head.S
+++ b/arch/ppc64/kernel/head.S
@@ -308,6 +308,7 @@ exception_marker:
308label##_pSeries: \ 308label##_pSeries: \
309 HMT_MEDIUM; \ 309 HMT_MEDIUM; \
310 mtspr SPRG1,r13; /* save r13 */ \ 310 mtspr SPRG1,r13; /* save r13 */ \
311 RUNLATCH_ON(r13); \
311 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common) 312 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, label##_common)
312 313
313#define STD_EXCEPTION_ISERIES(n, label, area) \ 314#define STD_EXCEPTION_ISERIES(n, label, area) \
@@ -315,6 +316,7 @@ label##_pSeries: \
315label##_iSeries: \ 316label##_iSeries: \
316 HMT_MEDIUM; \ 317 HMT_MEDIUM; \
317 mtspr SPRG1,r13; /* save r13 */ \ 318 mtspr SPRG1,r13; /* save r13 */ \
319 RUNLATCH_ON(r13); \
318 EXCEPTION_PROLOG_ISERIES_1(area); \ 320 EXCEPTION_PROLOG_ISERIES_1(area); \
319 EXCEPTION_PROLOG_ISERIES_2; \ 321 EXCEPTION_PROLOG_ISERIES_2; \
320 b label##_common 322 b label##_common
@@ -324,6 +326,7 @@ label##_iSeries: \
324label##_iSeries: \ 326label##_iSeries: \
325 HMT_MEDIUM; \ 327 HMT_MEDIUM; \
326 mtspr SPRG1,r13; /* save r13 */ \ 328 mtspr SPRG1,r13; /* save r13 */ \
329 RUNLATCH_ON(r13); \
327 EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \ 330 EXCEPTION_PROLOG_ISERIES_1(PACA_EXGEN); \
328 lbz r10,PACAPROCENABLED(r13); \ 331 lbz r10,PACAPROCENABLED(r13); \
329 cmpwi 0,r10,0; \ 332 cmpwi 0,r10,0; \
@@ -393,6 +396,7 @@ __start_interrupts:
393_machine_check_pSeries: 396_machine_check_pSeries:
394 HMT_MEDIUM 397 HMT_MEDIUM
395 mtspr SPRG1,r13 /* save r13 */ 398 mtspr SPRG1,r13 /* save r13 */
399 RUNLATCH_ON(r13)
396 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) 400 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
397 401
398 . = 0x300 402 . = 0x300
@@ -419,6 +423,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_SLB)
419data_access_slb_pSeries: 423data_access_slb_pSeries:
420 HMT_MEDIUM 424 HMT_MEDIUM
421 mtspr SPRG1,r13 425 mtspr SPRG1,r13
426 RUNLATCH_ON(r13)
422 mfspr r13,SPRG3 /* get paca address into r13 */ 427 mfspr r13,SPRG3 /* get paca address into r13 */
423 std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ 428 std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */
424 std r10,PACA_EXSLB+EX_R10(r13) 429 std r10,PACA_EXSLB+EX_R10(r13)
@@ -439,6 +444,7 @@ data_access_slb_pSeries:
439instruction_access_slb_pSeries: 444instruction_access_slb_pSeries:
440 HMT_MEDIUM 445 HMT_MEDIUM
441 mtspr SPRG1,r13 446 mtspr SPRG1,r13
447 RUNLATCH_ON(r13)
442 mfspr r13,SPRG3 /* get paca address into r13 */ 448 mfspr r13,SPRG3 /* get paca address into r13 */
443 std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */ 449 std r9,PACA_EXSLB+EX_R9(r13) /* save r9 - r12 */
444 std r10,PACA_EXSLB+EX_R10(r13) 450 std r10,PACA_EXSLB+EX_R10(r13)
@@ -464,6 +470,7 @@ instruction_access_slb_pSeries:
464 .globl system_call_pSeries 470 .globl system_call_pSeries
465system_call_pSeries: 471system_call_pSeries:
466 HMT_MEDIUM 472 HMT_MEDIUM
473 RUNLATCH_ON(r9)
467 mr r9,r13 474 mr r9,r13
468 mfmsr r10 475 mfmsr r10
469 mfspr r13,SPRG3 476 mfspr r13,SPRG3
@@ -707,11 +714,13 @@ fwnmi_data_area:
707system_reset_fwnmi: 714system_reset_fwnmi:
708 HMT_MEDIUM 715 HMT_MEDIUM
709 mtspr SPRG1,r13 /* save r13 */ 716 mtspr SPRG1,r13 /* save r13 */
717 RUNLATCH_ON(r13)
710 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common) 718 EXCEPTION_PROLOG_PSERIES(PACA_EXGEN, system_reset_common)
711 .globl machine_check_fwnmi 719 .globl machine_check_fwnmi
712machine_check_fwnmi: 720machine_check_fwnmi:
713 HMT_MEDIUM 721 HMT_MEDIUM
714 mtspr SPRG1,r13 /* save r13 */ 722 mtspr SPRG1,r13 /* save r13 */
723 RUNLATCH_ON(r13)
715 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common) 724 EXCEPTION_PROLOG_PSERIES(PACA_EXMC, machine_check_common)
716 725
717 /* 726 /*
@@ -848,6 +857,7 @@ unrecov_fer:
848 .align 7 857 .align 7
849 .globl data_access_common 858 .globl data_access_common
850data_access_common: 859data_access_common:
860 RUNLATCH_ON(r10) /* It wont fit in the 0x300 handler */
851 mfspr r10,DAR 861 mfspr r10,DAR
852 std r10,PACA_EXGEN+EX_DAR(r13) 862 std r10,PACA_EXGEN+EX_DAR(r13)
853 mfspr r10,DSISR 863 mfspr r10,DSISR
diff --git a/arch/ppc64/kernel/hvconsole.c b/arch/ppc64/kernel/hvconsole.c
index c72fb8ffe9..138e128a38 100644
--- a/arch/ppc64/kernel/hvconsole.c
+++ b/arch/ppc64/kernel/hvconsole.c
@@ -27,7 +27,6 @@
27#include <linux/module.h> 27#include <linux/module.h>
28#include <asm/hvcall.h> 28#include <asm/hvcall.h>
29#include <asm/hvconsole.h> 29#include <asm/hvconsole.h>
30#include <asm/prom.h>
31 30
32/** 31/**
33 * hvc_get_chars - retrieve characters from firmware for denoted vterm adatper 32 * hvc_get_chars - retrieve characters from firmware for denoted vterm adatper
@@ -42,29 +41,14 @@ int hvc_get_chars(uint32_t vtermno, char *buf, int count)
42 unsigned long got; 41 unsigned long got;
43 42
44 if (plpar_hcall(H_GET_TERM_CHAR, vtermno, 0, 0, 0, &got, 43 if (plpar_hcall(H_GET_TERM_CHAR, vtermno, 0, 0, 0, &got,
45 (unsigned long *)buf, (unsigned long *)buf+1) == H_Success) { 44 (unsigned long *)buf, (unsigned long *)buf+1) == H_Success)
46 /*
47 * Work around a HV bug where it gives us a null
48 * after every \r. -- paulus
49 */
50 if (got > 0) {
51 int i;
52 for (i = 1; i < got; ++i) {
53 if (buf[i] == 0 && buf[i-1] == '\r') {
54 --got;
55 if (i < got)
56 memmove(&buf[i], &buf[i+1],
57 got - i);
58 }
59 }
60 }
61 return got; 45 return got;
62 }
63 return 0; 46 return 0;
64} 47}
65 48
66EXPORT_SYMBOL(hvc_get_chars); 49EXPORT_SYMBOL(hvc_get_chars);
67 50
51
68/** 52/**
69 * hvc_put_chars: send characters to firmware for denoted vterm adapter 53 * hvc_put_chars: send characters to firmware for denoted vterm adapter
70 * @vtermno: The vtermno or unit_address of the adapter from which the data 54 * @vtermno: The vtermno or unit_address of the adapter from which the data
@@ -88,34 +72,3 @@ int hvc_put_chars(uint32_t vtermno, const char *buf, int count)
88} 72}
89 73
90EXPORT_SYMBOL(hvc_put_chars); 74EXPORT_SYMBOL(hvc_put_chars);
91
92/*
93 * We hope/assume that the first vty found corresponds to the first console
94 * device.
95 */
96int hvc_find_vtys(void)
97{
98 struct device_node *vty;
99 int num_found = 0;
100
101 for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL;
102 vty = of_find_node_by_name(vty, "vty")) {
103 uint32_t *vtermno;
104
105 /* We have statically defined space for only a certain number of
106 * console adapters. */
107 if (num_found >= MAX_NR_HVC_CONSOLES)
108 break;
109
110 vtermno = (uint32_t *)get_property(vty, "reg", NULL);
111 if (!vtermno)
112 continue;
113
114 if (device_is_compatible(vty, "hvterm1")) {
115 hvc_instantiate(*vtermno, num_found);
116 ++num_found;
117 }
118 }
119
120 return num_found;
121}
diff --git a/arch/ppc64/kernel/iSeries_htab.c b/arch/ppc64/kernel/iSeries_htab.c
index aa9e8fdd1a..b0250ae4a7 100644
--- a/arch/ppc64/kernel/iSeries_htab.c
+++ b/arch/ppc64/kernel/iSeries_htab.c
@@ -38,11 +38,12 @@ static inline void iSeries_hunlock(unsigned long slot)
38} 38}
39 39
40static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va, 40static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va,
41 unsigned long prpn, int secondary, 41 unsigned long prpn, unsigned long vflags,
42 unsigned long hpteflags, int bolted, int large) 42 unsigned long rflags)
43{ 43{
44 long slot; 44 long slot;
45 HPTE lhpte; 45 hpte_t lhpte;
46 int secondary = 0;
46 47
47 /* 48 /*
48 * The hypervisor tries both primary and secondary. 49 * The hypervisor tries both primary and secondary.
@@ -50,13 +51,13 @@ static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va,
50 * it means we have already tried both primary and secondary, 51 * it means we have already tried both primary and secondary,
51 * so we return failure immediately. 52 * so we return failure immediately.
52 */ 53 */
53 if (secondary) 54 if (vflags & HPTE_V_SECONDARY)
54 return -1; 55 return -1;
55 56
56 iSeries_hlock(hpte_group); 57 iSeries_hlock(hpte_group);
57 58
58 slot = HvCallHpt_findValid(&lhpte, va >> PAGE_SHIFT); 59 slot = HvCallHpt_findValid(&lhpte, va >> PAGE_SHIFT);
59 BUG_ON(lhpte.dw0.dw0.v); 60 BUG_ON(lhpte.v & HPTE_V_VALID);
60 61
61 if (slot == -1) { /* No available entry found in either group */ 62 if (slot == -1) { /* No available entry found in either group */
62 iSeries_hunlock(hpte_group); 63 iSeries_hunlock(hpte_group);
@@ -64,19 +65,13 @@ static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va,
64 } 65 }
65 66
66 if (slot < 0) { /* MSB set means secondary group */ 67 if (slot < 0) { /* MSB set means secondary group */
68 vflags |= HPTE_V_VALID;
67 secondary = 1; 69 secondary = 1;
68 slot &= 0x7fffffffffffffff; 70 slot &= 0x7fffffffffffffff;
69 } 71 }
70 72
71 lhpte.dw1.dword1 = 0; 73 lhpte.v = (va >> 23) << HPTE_V_AVPN_SHIFT | vflags | HPTE_V_VALID;
72 lhpte.dw1.dw1.rpn = physRpn_to_absRpn(prpn); 74 lhpte.r = (physRpn_to_absRpn(prpn) << HPTE_R_RPN_SHIFT) | rflags;
73 lhpte.dw1.flags.flags = hpteflags;
74
75 lhpte.dw0.dword0 = 0;
76 lhpte.dw0.dw0.avpn = va >> 23;
77 lhpte.dw0.dw0.h = secondary;
78 lhpte.dw0.dw0.bolted = bolted;
79 lhpte.dw0.dw0.v = 1;
80 75
81 /* Now fill in the actual HPTE */ 76 /* Now fill in the actual HPTE */
82 HvCallHpt_addValidate(slot, secondary, &lhpte); 77 HvCallHpt_addValidate(slot, secondary, &lhpte);
@@ -88,20 +83,17 @@ static long iSeries_hpte_insert(unsigned long hpte_group, unsigned long va,
88 83
89static unsigned long iSeries_hpte_getword0(unsigned long slot) 84static unsigned long iSeries_hpte_getword0(unsigned long slot)
90{ 85{
91 unsigned long dword0; 86 hpte_t hpte;
92 HPTE hpte;
93 87
94 HvCallHpt_get(&hpte, slot); 88 HvCallHpt_get(&hpte, slot);
95 dword0 = hpte.dw0.dword0; 89 return hpte.v;
96
97 return dword0;
98} 90}
99 91
100static long iSeries_hpte_remove(unsigned long hpte_group) 92static long iSeries_hpte_remove(unsigned long hpte_group)
101{ 93{
102 unsigned long slot_offset; 94 unsigned long slot_offset;
103 int i; 95 int i;
104 HPTE lhpte; 96 unsigned long hpte_v;
105 97
106 /* Pick a random slot to start at */ 98 /* Pick a random slot to start at */
107 slot_offset = mftb() & 0x7; 99 slot_offset = mftb() & 0x7;
@@ -109,10 +101,9 @@ static long iSeries_hpte_remove(unsigned long hpte_group)
109 iSeries_hlock(hpte_group); 101 iSeries_hlock(hpte_group);
110 102
111 for (i = 0; i < HPTES_PER_GROUP; i++) { 103 for (i = 0; i < HPTES_PER_GROUP; i++) {
112 lhpte.dw0.dword0 = 104 hpte_v = iSeries_hpte_getword0(hpte_group + slot_offset);
113 iSeries_hpte_getword0(hpte_group + slot_offset);
114 105
115 if (!lhpte.dw0.dw0.bolted) { 106 if (! (hpte_v & HPTE_V_BOLTED)) {
116 HvCallHpt_invalidateSetSwBitsGet(hpte_group + 107 HvCallHpt_invalidateSetSwBitsGet(hpte_group +
117 slot_offset, 0, 0); 108 slot_offset, 0, 0);
118 iSeries_hunlock(hpte_group); 109 iSeries_hunlock(hpte_group);
@@ -137,13 +128,13 @@ static long iSeries_hpte_remove(unsigned long hpte_group)
137static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp, 128static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp,
138 unsigned long va, int large, int local) 129 unsigned long va, int large, int local)
139{ 130{
140 HPTE hpte; 131 hpte_t hpte;
141 unsigned long avpn = va >> 23; 132 unsigned long avpn = va >> 23;
142 133
143 iSeries_hlock(slot); 134 iSeries_hlock(slot);
144 135
145 HvCallHpt_get(&hpte, slot); 136 HvCallHpt_get(&hpte, slot);
146 if ((hpte.dw0.dw0.avpn == avpn) && (hpte.dw0.dw0.v)) { 137 if ((HPTE_V_AVPN_VAL(hpte.v) == avpn) && (hpte.v & HPTE_V_VALID)) {
147 /* 138 /*
148 * Hypervisor expects bits as NPPP, which is 139 * Hypervisor expects bits as NPPP, which is
149 * different from how they are mapped in our PP. 140 * different from how they are mapped in our PP.
@@ -167,7 +158,7 @@ static long iSeries_hpte_updatepp(unsigned long slot, unsigned long newpp,
167 */ 158 */
168static long iSeries_hpte_find(unsigned long vpn) 159static long iSeries_hpte_find(unsigned long vpn)
169{ 160{
170 HPTE hpte; 161 hpte_t hpte;
171 long slot; 162 long slot;
172 163
173 /* 164 /*
@@ -177,7 +168,7 @@ static long iSeries_hpte_find(unsigned long vpn)
177 * 0x80000000xxxxxxxx : Entry found in secondary group, slot x 168 * 0x80000000xxxxxxxx : Entry found in secondary group, slot x
178 */ 169 */
179 slot = HvCallHpt_findValid(&hpte, vpn); 170 slot = HvCallHpt_findValid(&hpte, vpn);
180 if (hpte.dw0.dw0.v) { 171 if (hpte.v & HPTE_V_VALID) {
181 if (slot < 0) { 172 if (slot < 0) {
182 slot &= 0x7fffffffffffffff; 173 slot &= 0x7fffffffffffffff;
183 slot = -slot; 174 slot = -slot;
@@ -212,7 +203,7 @@ static void iSeries_hpte_updateboltedpp(unsigned long newpp, unsigned long ea)
212static void iSeries_hpte_invalidate(unsigned long slot, unsigned long va, 203static void iSeries_hpte_invalidate(unsigned long slot, unsigned long va,
213 int large, int local) 204 int large, int local)
214{ 205{
215 HPTE lhpte; 206 unsigned long hpte_v;
216 unsigned long avpn = va >> 23; 207 unsigned long avpn = va >> 23;
217 unsigned long flags; 208 unsigned long flags;
218 209
@@ -220,9 +211,9 @@ static void iSeries_hpte_invalidate(unsigned long slot, unsigned long va,
220 211
221 iSeries_hlock(slot); 212 iSeries_hlock(slot);
222 213
223 lhpte.dw0.dword0 = iSeries_hpte_getword0(slot); 214 hpte_v = iSeries_hpte_getword0(slot);
224 215
225 if ((lhpte.dw0.dw0.avpn == avpn) && lhpte.dw0.dw0.v) 216 if ((HPTE_V_AVPN_VAL(hpte_v) == avpn) && (hpte_v & HPTE_V_VALID))
226 HvCallHpt_invalidateSetSwBitsGet(slot, 0, 0); 217 HvCallHpt_invalidateSetSwBitsGet(slot, 0, 0);
227 218
228 iSeries_hunlock(slot); 219 iSeries_hunlock(slot);
diff --git a/arch/ppc64/kernel/iSeries_setup.c b/arch/ppc64/kernel/iSeries_setup.c
index b3f770f6d4..a649edbb23 100644
--- a/arch/ppc64/kernel/iSeries_setup.c
+++ b/arch/ppc64/kernel/iSeries_setup.c
@@ -503,7 +503,7 @@ static void __init build_iSeries_Memory_Map(void)
503 503
504 /* Fill in the hashed page table hash mask */ 504 /* Fill in the hashed page table hash mask */
505 num_ptegs = hptSizePages * 505 num_ptegs = hptSizePages *
506 (PAGE_SIZE / (sizeof(HPTE) * HPTES_PER_GROUP)); 506 (PAGE_SIZE / (sizeof(hpte_t) * HPTES_PER_GROUP));
507 htab_hash_mask = num_ptegs - 1; 507 htab_hash_mask = num_ptegs - 1;
508 508
509 /* 509 /*
@@ -618,25 +618,23 @@ static void __init setup_iSeries_cache_sizes(void)
618static void iSeries_make_pte(unsigned long va, unsigned long pa, 618static void iSeries_make_pte(unsigned long va, unsigned long pa,
619 int mode) 619 int mode)
620{ 620{
621 HPTE local_hpte, rhpte; 621 hpte_t local_hpte, rhpte;
622 unsigned long hash, vpn; 622 unsigned long hash, vpn;
623 long slot; 623 long slot;
624 624
625 vpn = va >> PAGE_SHIFT; 625 vpn = va >> PAGE_SHIFT;
626 hash = hpt_hash(vpn, 0); 626 hash = hpt_hash(vpn, 0);
627 627
628 local_hpte.dw1.dword1 = pa | mode; 628 local_hpte.r = pa | mode;
629 local_hpte.dw0.dword0 = 0; 629 local_hpte.v = ((va >> 23) << HPTE_V_AVPN_SHIFT)
630 local_hpte.dw0.dw0.avpn = va >> 23; 630 | HPTE_V_BOLTED | HPTE_V_VALID;
631 local_hpte.dw0.dw0.bolted = 1; /* bolted */
632 local_hpte.dw0.dw0.v = 1;
633 631
634 slot = HvCallHpt_findValid(&rhpte, vpn); 632 slot = HvCallHpt_findValid(&rhpte, vpn);
635 if (slot < 0) { 633 if (slot < 0) {
636 /* Must find space in primary group */ 634 /* Must find space in primary group */
637 panic("hash_page: hpte already exists\n"); 635 panic("hash_page: hpte already exists\n");
638 } 636 }
639 HvCallHpt_addValidate(slot, 0, (HPTE *)&local_hpte ); 637 HvCallHpt_addValidate(slot, 0, &local_hpte);
640} 638}
641 639
642/* 640/*
@@ -646,7 +644,7 @@ static void __init iSeries_bolt_kernel(unsigned long saddr, unsigned long eaddr)
646{ 644{
647 unsigned long pa; 645 unsigned long pa;
648 unsigned long mode_rw = _PAGE_ACCESSED | _PAGE_COHERENT | PP_RWXX; 646 unsigned long mode_rw = _PAGE_ACCESSED | _PAGE_COHERENT | PP_RWXX;
649 HPTE hpte; 647 hpte_t hpte;
650 648
651 for (pa = saddr; pa < eaddr ;pa += PAGE_SIZE) { 649 for (pa = saddr; pa < eaddr ;pa += PAGE_SIZE) {
652 unsigned long ea = (unsigned long)__va(pa); 650 unsigned long ea = (unsigned long)__va(pa);
@@ -659,7 +657,7 @@ static void __init iSeries_bolt_kernel(unsigned long saddr, unsigned long eaddr)
659 if (!in_kernel_text(ea)) 657 if (!in_kernel_text(ea))
660 mode_rw |= HW_NO_EXEC; 658 mode_rw |= HW_NO_EXEC;
661 659
662 if (hpte.dw0.dw0.v) { 660 if (hpte.v & HPTE_V_VALID) {
663 /* HPTE exists, so just bolt it */ 661 /* HPTE exists, so just bolt it */
664 HvCallHpt_setSwBits(slot, 0x10, 0); 662 HvCallHpt_setSwBits(slot, 0x10, 0);
665 /* And make sure the pp bits are correct */ 663 /* And make sure the pp bits are correct */
@@ -834,6 +832,92 @@ static int __init iSeries_src_init(void)
834 832
835late_initcall(iSeries_src_init); 833late_initcall(iSeries_src_init);
836 834
835static inline void process_iSeries_events(void)
836{
837 asm volatile ("li 0,0x5555; sc" : : : "r0", "r3");
838}
839
840static void yield_shared_processor(void)
841{
842 unsigned long tb;
843
844 HvCall_setEnabledInterrupts(HvCall_MaskIPI |
845 HvCall_MaskLpEvent |
846 HvCall_MaskLpProd |
847 HvCall_MaskTimeout);
848
849 tb = get_tb();
850 /* Compute future tb value when yield should expire */
851 HvCall_yieldProcessor(HvCall_YieldTimed, tb+tb_ticks_per_jiffy);
852
853 /*
854 * The decrementer stops during the yield. Force a fake decrementer
855 * here and let the timer_interrupt code sort out the actual time.
856 */
857 get_paca()->lppaca.int_dword.fields.decr_int = 1;
858 process_iSeries_events();
859}
860
861static int iseries_shared_idle(void)
862{
863 while (1) {
864 while (!need_resched() && !hvlpevent_is_pending()) {
865 local_irq_disable();
866 ppc64_runlatch_off();
867
868 /* Recheck with irqs off */
869 if (!need_resched() && !hvlpevent_is_pending())
870 yield_shared_processor();
871
872 HMT_medium();
873 local_irq_enable();
874 }
875
876 ppc64_runlatch_on();
877
878 if (hvlpevent_is_pending())
879 process_iSeries_events();
880
881 schedule();
882 }
883
884 return 0;
885}
886
887static int iseries_dedicated_idle(void)
888{
889 long oldval;
890
891 while (1) {
892 oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED);
893
894 if (!oldval) {
895 set_thread_flag(TIF_POLLING_NRFLAG);
896
897 while (!need_resched()) {
898 ppc64_runlatch_off();
899 HMT_low();
900
901 if (hvlpevent_is_pending()) {
902 HMT_medium();
903 ppc64_runlatch_on();
904 process_iSeries_events();
905 }
906 }
907
908 HMT_medium();
909 clear_thread_flag(TIF_POLLING_NRFLAG);
910 } else {
911 set_need_resched();
912 }
913
914 ppc64_runlatch_on();
915 schedule();
916 }
917
918 return 0;
919}
920
837#ifndef CONFIG_PCI 921#ifndef CONFIG_PCI
838void __init iSeries_init_IRQ(void) { } 922void __init iSeries_init_IRQ(void) { }
839#endif 923#endif
@@ -859,5 +943,13 @@ void __init iSeries_early_setup(void)
859 ppc_md.get_rtc_time = iSeries_get_rtc_time; 943 ppc_md.get_rtc_time = iSeries_get_rtc_time;
860 ppc_md.calibrate_decr = iSeries_calibrate_decr; 944 ppc_md.calibrate_decr = iSeries_calibrate_decr;
861 ppc_md.progress = iSeries_progress; 945 ppc_md.progress = iSeries_progress;
946
947 if (get_paca()->lppaca.shared_proc) {
948 ppc_md.idle_loop = iseries_shared_idle;
949 printk(KERN_INFO "Using shared processor idle loop\n");
950 } else {
951 ppc_md.idle_loop = iseries_dedicated_idle;
952 printk(KERN_INFO "Using dedicated idle loop\n");
953 }
862} 954}
863 955
diff --git a/arch/ppc64/kernel/idle.c b/arch/ppc64/kernel/idle.c
index 08952c7e62..954395d426 100644
--- a/arch/ppc64/kernel/idle.c
+++ b/arch/ppc64/kernel/idle.c
@@ -20,109 +20,18 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/smp.h> 21#include <linux/smp.h>
22#include <linux/cpu.h> 22#include <linux/cpu.h>
23#include <linux/module.h>
24#include <linux/sysctl.h> 23#include <linux/sysctl.h>
25#include <linux/smp.h>
26 24
27#include <asm/system.h> 25#include <asm/system.h>
28#include <asm/processor.h> 26#include <asm/processor.h>
29#include <asm/mmu.h>
30#include <asm/cputable.h> 27#include <asm/cputable.h>
31#include <asm/time.h> 28#include <asm/time.h>
32#include <asm/iSeries/HvCall.h>
33#include <asm/iSeries/ItLpQueue.h>
34#include <asm/plpar_wrappers.h>
35#include <asm/systemcfg.h> 29#include <asm/systemcfg.h>
30#include <asm/machdep.h>
36 31
37extern void power4_idle(void); 32extern void power4_idle(void);
38 33
39static int (*idle_loop)(void); 34int default_idle(void)
40
41#ifdef CONFIG_PPC_ISERIES
42static unsigned long maxYieldTime = 0;
43static unsigned long minYieldTime = 0xffffffffffffffffUL;
44
45static inline void process_iSeries_events(void)
46{
47 asm volatile ("li 0,0x5555; sc" : : : "r0", "r3");
48}
49
50static void yield_shared_processor(void)
51{
52 unsigned long tb;
53 unsigned long yieldTime;
54
55 HvCall_setEnabledInterrupts(HvCall_MaskIPI |
56 HvCall_MaskLpEvent |
57 HvCall_MaskLpProd |
58 HvCall_MaskTimeout);
59
60 tb = get_tb();
61 /* Compute future tb value when yield should expire */
62 HvCall_yieldProcessor(HvCall_YieldTimed, tb+tb_ticks_per_jiffy);
63
64 yieldTime = get_tb() - tb;
65 if (yieldTime > maxYieldTime)
66 maxYieldTime = yieldTime;
67
68 if (yieldTime < minYieldTime)
69 minYieldTime = yieldTime;
70
71 /*
72 * The decrementer stops during the yield. Force a fake decrementer
73 * here and let the timer_interrupt code sort out the actual time.
74 */
75 get_paca()->lppaca.int_dword.fields.decr_int = 1;
76 process_iSeries_events();
77}
78
79static int iSeries_idle(void)
80{
81 struct paca_struct *lpaca;
82 long oldval;
83
84 /* ensure iSeries run light will be out when idle */
85 ppc64_runlatch_off();
86
87 lpaca = get_paca();
88
89 while (1) {
90 if (lpaca->lppaca.shared_proc) {
91 if (hvlpevent_is_pending())
92 process_iSeries_events();
93 if (!need_resched())
94 yield_shared_processor();
95 } else {
96 oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED);
97
98 if (!oldval) {
99 set_thread_flag(TIF_POLLING_NRFLAG);
100
101 while (!need_resched()) {
102 HMT_medium();
103 if (hvlpevent_is_pending())
104 process_iSeries_events();
105 HMT_low();
106 }
107
108 HMT_medium();
109 clear_thread_flag(TIF_POLLING_NRFLAG);
110 } else {
111 set_need_resched();
112 }
113 }
114
115 ppc64_runlatch_on();
116 schedule();
117 ppc64_runlatch_off();
118 }
119
120 return 0;
121}
122
123#else
124
125static int default_idle(void)
126{ 35{
127 long oldval; 36 long oldval;
128 unsigned int cpu = smp_processor_id(); 37 unsigned int cpu = smp_processor_id();
@@ -134,7 +43,8 @@ static int default_idle(void)
134 set_thread_flag(TIF_POLLING_NRFLAG); 43 set_thread_flag(TIF_POLLING_NRFLAG);
135 44
136 while (!need_resched() && !cpu_is_offline(cpu)) { 45 while (!need_resched() && !cpu_is_offline(cpu)) {
137 barrier(); 46 ppc64_runlatch_off();
47
138 /* 48 /*
139 * Go into low thread priority and possibly 49 * Go into low thread priority and possibly
140 * low power mode. 50 * low power mode.
@@ -149,6 +59,7 @@ static int default_idle(void)
149 set_need_resched(); 59 set_need_resched();
150 } 60 }
151 61
62 ppc64_runlatch_on();
152 schedule(); 63 schedule();
153 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING) 64 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
154 cpu_die(); 65 cpu_die();
@@ -157,127 +68,19 @@ static int default_idle(void)
157 return 0; 68 return 0;
158} 69}
159 70
160#ifdef CONFIG_PPC_PSERIES 71int native_idle(void)
161
162DECLARE_PER_CPU(unsigned long, smt_snooze_delay);
163
164int dedicated_idle(void)
165{ 72{
166 long oldval;
167 struct paca_struct *lpaca = get_paca(), *ppaca;
168 unsigned long start_snooze;
169 unsigned long *smt_snooze_delay = &__get_cpu_var(smt_snooze_delay);
170 unsigned int cpu = smp_processor_id();
171
172 ppaca = &paca[cpu ^ 1];
173
174 while (1) { 73 while (1) {
175 /* 74 ppc64_runlatch_off();
176 * Indicate to the HV that we are idle. Now would be
177 * a good time to find other work to dispatch.
178 */
179 lpaca->lppaca.idle = 1;
180
181 oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED);
182 if (!oldval) {
183 set_thread_flag(TIF_POLLING_NRFLAG);
184 start_snooze = __get_tb() +
185 *smt_snooze_delay * tb_ticks_per_usec;
186 while (!need_resched() && !cpu_is_offline(cpu)) {
187 /*
188 * Go into low thread priority and possibly
189 * low power mode.
190 */
191 HMT_low();
192 HMT_very_low();
193
194 if (*smt_snooze_delay == 0 ||
195 __get_tb() < start_snooze)
196 continue;
197
198 HMT_medium();
199
200 if (!(ppaca->lppaca.idle)) {
201 local_irq_disable();
202
203 /*
204 * We are about to sleep the thread
205 * and so wont be polling any
206 * more.
207 */
208 clear_thread_flag(TIF_POLLING_NRFLAG);
209
210 /*
211 * SMT dynamic mode. Cede will result
212 * in this thread going dormant, if the
213 * partner thread is still doing work.
214 * Thread wakes up if partner goes idle,
215 * an interrupt is presented, or a prod
216 * occurs. Returning from the cede
217 * enables external interrupts.
218 */
219 if (!need_resched())
220 cede_processor();
221 else
222 local_irq_enable();
223 } else {
224 /*
225 * Give the HV an opportunity at the
226 * processor, since we are not doing
227 * any work.
228 */
229 poll_pending();
230 }
231 }
232
233 clear_thread_flag(TIF_POLLING_NRFLAG);
234 } else {
235 set_need_resched();
236 }
237
238 HMT_medium();
239 lpaca->lppaca.idle = 0;
240 schedule();
241 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
242 cpu_die();
243 }
244 return 0;
245}
246
247static int shared_idle(void)
248{
249 struct paca_struct *lpaca = get_paca();
250 unsigned int cpu = smp_processor_id();
251
252 while (1) {
253 /*
254 * Indicate to the HV that we are idle. Now would be
255 * a good time to find other work to dispatch.
256 */
257 lpaca->lppaca.idle = 1;
258 75
259 while (!need_resched() && !cpu_is_offline(cpu)) { 76 if (!need_resched())
260 local_irq_disable(); 77 power4_idle();
261 78
262 /* 79 if (need_resched()) {
263 * Yield the processor to the hypervisor. We return if 80 ppc64_runlatch_on();
264 * an external interrupt occurs (which are driven prior 81 schedule();
265 * to returning here) or if a prod occurs from another
266 * processor. When returning here, external interrupts
267 * are enabled.
268 *
269 * Check need_resched() again with interrupts disabled
270 * to avoid a race.
271 */
272 if (!need_resched())
273 cede_processor();
274 else
275 local_irq_enable();
276 } 82 }
277 83
278 HMT_medium();
279 lpaca->lppaca.idle = 0;
280 schedule();
281 if (cpu_is_offline(smp_processor_id()) && 84 if (cpu_is_offline(smp_processor_id()) &&
282 system_state == SYSTEM_RUNNING) 85 system_state == SYSTEM_RUNNING)
283 cpu_die(); 86 cpu_die();
@@ -286,29 +89,10 @@ static int shared_idle(void)
286 return 0; 89 return 0;
287} 90}
288 91
289#endif /* CONFIG_PPC_PSERIES */
290
291static int native_idle(void)
292{
293 while(1) {
294 /* check CPU type here */
295 if (!need_resched())
296 power4_idle();
297 if (need_resched())
298 schedule();
299
300 if (cpu_is_offline(raw_smp_processor_id()) &&
301 system_state == SYSTEM_RUNNING)
302 cpu_die();
303 }
304 return 0;
305}
306
307#endif /* CONFIG_PPC_ISERIES */
308
309void cpu_idle(void) 92void cpu_idle(void)
310{ 93{
311 idle_loop(); 94 BUG_ON(NULL == ppc_md.idle_loop);
95 ppc_md.idle_loop();
312} 96}
313 97
314int powersave_nap; 98int powersave_nap;
@@ -342,42 +126,3 @@ register_powersave_nap_sysctl(void)
342} 126}
343__initcall(register_powersave_nap_sysctl); 127__initcall(register_powersave_nap_sysctl);
344#endif 128#endif
345
346int idle_setup(void)
347{
348 /*
349 * Move that junk to each platform specific file, eventually define
350 * a pSeries_idle for shared processor stuff
351 */
352#ifdef CONFIG_PPC_ISERIES
353 idle_loop = iSeries_idle;
354 return 1;
355#else
356 idle_loop = default_idle;
357#endif
358#ifdef CONFIG_PPC_PSERIES
359 if (systemcfg->platform & PLATFORM_PSERIES) {
360 if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
361 if (get_paca()->lppaca.shared_proc) {
362 printk(KERN_INFO "Using shared processor idle loop\n");
363 idle_loop = shared_idle;
364 } else {
365 printk(KERN_INFO "Using dedicated idle loop\n");
366 idle_loop = dedicated_idle;
367 }
368 } else {
369 printk(KERN_INFO "Using default idle loop\n");
370 idle_loop = default_idle;
371 }
372 }
373#endif /* CONFIG_PPC_PSERIES */
374#ifndef CONFIG_PPC_ISERIES
375 if (systemcfg->platform == PLATFORM_POWERMAC ||
376 systemcfg->platform == PLATFORM_MAPLE) {
377 printk(KERN_INFO "Using native/NAP idle loop\n");
378 idle_loop = native_idle;
379 }
380#endif /* CONFIG_PPC_ISERIES */
381
382 return 1;
383}
diff --git a/arch/ppc64/kernel/kprobes.c b/arch/ppc64/kernel/kprobes.c
index 1d2ff6d6b0..a3d519518f 100644
--- a/arch/ppc64/kernel/kprobes.c
+++ b/arch/ppc64/kernel/kprobes.c
@@ -444,7 +444,7 @@ static struct kprobe trampoline_p = {
444 .pre_handler = trampoline_probe_handler 444 .pre_handler = trampoline_probe_handler
445}; 445};
446 446
447int __init arch_init(void) 447int __init arch_init_kprobes(void)
448{ 448{
449 return register_kprobe(&trampoline_p); 449 return register_kprobe(&trampoline_p);
450} 450}
diff --git a/arch/ppc64/kernel/maple_setup.c b/arch/ppc64/kernel/maple_setup.c
index da8900b51f..bb55b5a569 100644
--- a/arch/ppc64/kernel/maple_setup.c
+++ b/arch/ppc64/kernel/maple_setup.c
@@ -177,6 +177,8 @@ void __init maple_setup_arch(void)
177#ifdef CONFIG_DUMMY_CONSOLE 177#ifdef CONFIG_DUMMY_CONSOLE
178 conswitchp = &dummy_con; 178 conswitchp = &dummy_con;
179#endif 179#endif
180
181 printk(KERN_INFO "Using native/NAP idle loop\n");
180} 182}
181 183
182/* 184/*
@@ -297,4 +299,5 @@ struct machdep_calls __initdata maple_md = {
297 .get_rtc_time = maple_get_rtc_time, 299 .get_rtc_time = maple_get_rtc_time,
298 .calibrate_decr = generic_calibrate_decr, 300 .calibrate_decr = generic_calibrate_decr,
299 .progress = maple_progress, 301 .progress = maple_progress,
302 .idle_loop = native_idle,
300}; 303};
diff --git a/arch/ppc64/kernel/misc.S b/arch/ppc64/kernel/misc.S
index f3dea0c5a8..59f4f99738 100644
--- a/arch/ppc64/kernel/misc.S
+++ b/arch/ppc64/kernel/misc.S
@@ -1124,9 +1124,11 @@ _GLOBAL(sys_call_table32)
1124 .llong .compat_sys_mq_getsetattr 1124 .llong .compat_sys_mq_getsetattr
1125 .llong .compat_sys_kexec_load 1125 .llong .compat_sys_kexec_load
1126 .llong .sys32_add_key 1126 .llong .sys32_add_key
1127 .llong .sys32_request_key 1127 .llong .sys32_request_key /* 270 */
1128 .llong .compat_sys_keyctl 1128 .llong .compat_sys_keyctl
1129 .llong .compat_sys_waitid 1129 .llong .compat_sys_waitid
1130 .llong .sys32_ioprio_set
1131 .llong .sys32_ioprio_get
1130 1132
1131 .balign 8 1133 .balign 8
1132_GLOBAL(sys_call_table) 1134_GLOBAL(sys_call_table)
@@ -1403,3 +1405,5 @@ _GLOBAL(sys_call_table)
1403 .llong .sys_request_key /* 270 */ 1405 .llong .sys_request_key /* 270 */
1404 .llong .sys_keyctl 1406 .llong .sys_keyctl
1405 .llong .sys_waitid 1407 .llong .sys_waitid
1408 .llong .sys_ioprio_set
1409 .llong .sys_ioprio_get
diff --git a/arch/ppc64/kernel/of_device.c b/arch/ppc64/kernel/of_device.c
index 66bd5ab7c2..b80e81984b 100644
--- a/arch/ppc64/kernel/of_device.c
+++ b/arch/ppc64/kernel/of_device.c
@@ -3,6 +3,7 @@
3#include <linux/kernel.h> 3#include <linux/kernel.h>
4#include <linux/init.h> 4#include <linux/init.h>
5#include <linux/module.h> 5#include <linux/module.h>
6#include <linux/mod_devicetable.h>
6#include <asm/errno.h> 7#include <asm/errno.h>
7#include <asm/of_device.h> 8#include <asm/of_device.h>
8 9
@@ -15,20 +16,20 @@
15 * Used by a driver to check whether an of_device present in the 16 * Used by a driver to check whether an of_device present in the
16 * system is in its list of supported devices. 17 * system is in its list of supported devices.
17 */ 18 */
18const struct of_match * of_match_device(const struct of_match *matches, 19const struct of_device_id *of_match_device(const struct of_device_id *matches,
19 const struct of_device *dev) 20 const struct of_device *dev)
20{ 21{
21 if (!dev->node) 22 if (!dev->node)
22 return NULL; 23 return NULL;
23 while (matches->name || matches->type || matches->compatible) { 24 while (matches->name[0] || matches->type[0] || matches->compatible[0]) {
24 int match = 1; 25 int match = 1;
25 if (matches->name && matches->name != OF_ANY_MATCH) 26 if (matches->name[0])
26 match &= dev->node->name 27 match &= dev->node->name
27 && !strcmp(matches->name, dev->node->name); 28 && !strcmp(matches->name, dev->node->name);
28 if (matches->type && matches->type != OF_ANY_MATCH) 29 if (matches->type[0])
29 match &= dev->node->type 30 match &= dev->node->type
30 && !strcmp(matches->type, dev->node->type); 31 && !strcmp(matches->type, dev->node->type);
31 if (matches->compatible && matches->compatible != OF_ANY_MATCH) 32 if (matches->compatible[0])
32 match &= device_is_compatible(dev->node, 33 match &= device_is_compatible(dev->node,
33 matches->compatible); 34 matches->compatible);
34 if (match) 35 if (match)
@@ -42,7 +43,7 @@ static int of_platform_bus_match(struct device *dev, struct device_driver *drv)
42{ 43{
43 struct of_device * of_dev = to_of_device(dev); 44 struct of_device * of_dev = to_of_device(dev);
44 struct of_platform_driver * of_drv = to_of_platform_driver(drv); 45 struct of_platform_driver * of_drv = to_of_platform_driver(drv);
45 const struct of_match * matches = of_drv->match_table; 46 const struct of_device_id * matches = of_drv->match_table;
46 47
47 if (!matches) 48 if (!matches)
48 return 0; 49 return 0;
@@ -75,7 +76,7 @@ static int of_device_probe(struct device *dev)
75 int error = -ENODEV; 76 int error = -ENODEV;
76 struct of_platform_driver *drv; 77 struct of_platform_driver *drv;
77 struct of_device *of_dev; 78 struct of_device *of_dev;
78 const struct of_match *match; 79 const struct of_device_id *match;
79 80
80 drv = to_of_platform_driver(dev->driver); 81 drv = to_of_platform_driver(dev->driver);
81 of_dev = to_of_device(dev); 82 of_dev = to_of_device(dev);
diff --git a/arch/ppc64/kernel/pSeries_lpar.c b/arch/ppc64/kernel/pSeries_lpar.c
index 6534812db4..74dd144dcc 100644
--- a/arch/ppc64/kernel/pSeries_lpar.c
+++ b/arch/ppc64/kernel/pSeries_lpar.c
@@ -277,31 +277,20 @@ void vpa_init(int cpu)
277 277
278long pSeries_lpar_hpte_insert(unsigned long hpte_group, 278long pSeries_lpar_hpte_insert(unsigned long hpte_group,
279 unsigned long va, unsigned long prpn, 279 unsigned long va, unsigned long prpn,
280 int secondary, unsigned long hpteflags, 280 unsigned long vflags, unsigned long rflags)
281 int bolted, int large)
282{ 281{
283 unsigned long arpn = physRpn_to_absRpn(prpn); 282 unsigned long arpn = physRpn_to_absRpn(prpn);
284 unsigned long lpar_rc; 283 unsigned long lpar_rc;
285 unsigned long flags; 284 unsigned long flags;
286 unsigned long slot; 285 unsigned long slot;
287 HPTE lhpte; 286 unsigned long hpte_v, hpte_r;
288 unsigned long dummy0, dummy1; 287 unsigned long dummy0, dummy1;
289 288
290 /* Fill in the local HPTE with absolute rpn, avpn and flags */ 289 hpte_v = ((va >> 23) << HPTE_V_AVPN_SHIFT) | vflags | HPTE_V_VALID;
291 lhpte.dw1.dword1 = 0; 290 if (vflags & HPTE_V_LARGE)
292 lhpte.dw1.dw1.rpn = arpn; 291 hpte_v &= ~(1UL << HPTE_V_AVPN_SHIFT);
293 lhpte.dw1.flags.flags = hpteflags;
294 292
295 lhpte.dw0.dword0 = 0; 293 hpte_r = (arpn << HPTE_R_RPN_SHIFT) | rflags;
296 lhpte.dw0.dw0.avpn = va >> 23;
297 lhpte.dw0.dw0.h = secondary;
298 lhpte.dw0.dw0.bolted = bolted;
299 lhpte.dw0.dw0.v = 1;
300
301 if (large) {
302 lhpte.dw0.dw0.l = 1;
303 lhpte.dw0.dw0.avpn &= ~0x1UL;
304 }
305 294
306 /* Now fill in the actual HPTE */ 295 /* Now fill in the actual HPTE */
307 /* Set CEC cookie to 0 */ 296 /* Set CEC cookie to 0 */
@@ -312,11 +301,11 @@ long pSeries_lpar_hpte_insert(unsigned long hpte_group,
312 flags = 0; 301 flags = 0;
313 302
314 /* XXX why is this here? - Anton */ 303 /* XXX why is this here? - Anton */
315 if (hpteflags & (_PAGE_GUARDED|_PAGE_NO_CACHE)) 304 if (rflags & (_PAGE_GUARDED|_PAGE_NO_CACHE))
316 lhpte.dw1.flags.flags &= ~_PAGE_COHERENT; 305 hpte_r &= ~_PAGE_COHERENT;
317 306
318 lpar_rc = plpar_hcall(H_ENTER, flags, hpte_group, lhpte.dw0.dword0, 307 lpar_rc = plpar_hcall(H_ENTER, flags, hpte_group, hpte_v,
319 lhpte.dw1.dword1, &slot, &dummy0, &dummy1); 308 hpte_r, &slot, &dummy0, &dummy1);
320 309
321 if (unlikely(lpar_rc == H_PTEG_Full)) 310 if (unlikely(lpar_rc == H_PTEG_Full))
322 return -1; 311 return -1;
@@ -332,7 +321,7 @@ long pSeries_lpar_hpte_insert(unsigned long hpte_group,
332 /* Because of iSeries, we have to pass down the secondary 321 /* Because of iSeries, we have to pass down the secondary
333 * bucket bit here as well 322 * bucket bit here as well
334 */ 323 */
335 return (slot & 7) | (secondary << 3); 324 return (slot & 7) | (!!(vflags & HPTE_V_SECONDARY) << 3);
336} 325}
337 326
338static DEFINE_SPINLOCK(pSeries_lpar_tlbie_lock); 327static DEFINE_SPINLOCK(pSeries_lpar_tlbie_lock);
@@ -427,22 +416,18 @@ static long pSeries_lpar_hpte_find(unsigned long vpn)
427 unsigned long hash; 416 unsigned long hash;
428 unsigned long i, j; 417 unsigned long i, j;
429 long slot; 418 long slot;
430 union { 419 unsigned long hpte_v;
431 unsigned long dword0;
432 Hpte_dword0 dw0;
433 } hpte_dw0;
434 Hpte_dword0 dw0;
435 420
436 hash = hpt_hash(vpn, 0); 421 hash = hpt_hash(vpn, 0);
437 422
438 for (j = 0; j < 2; j++) { 423 for (j = 0; j < 2; j++) {
439 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 424 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
440 for (i = 0; i < HPTES_PER_GROUP; i++) { 425 for (i = 0; i < HPTES_PER_GROUP; i++) {
441 hpte_dw0.dword0 = pSeries_lpar_hpte_getword0(slot); 426 hpte_v = pSeries_lpar_hpte_getword0(slot);
442 dw0 = hpte_dw0.dw0;
443 427
444 if ((dw0.avpn == (vpn >> 11)) && dw0.v && 428 if ((HPTE_V_AVPN_VAL(hpte_v) == (vpn >> 11))
445 (dw0.h == j)) { 429 && (hpte_v & HPTE_V_VALID)
430 && (!!(hpte_v & HPTE_V_SECONDARY) == j)) {
446 /* HPTE matches */ 431 /* HPTE matches */
447 if (j) 432 if (j)
448 slot = -slot; 433 slot = -slot;
diff --git a/arch/ppc64/kernel/pSeries_setup.c b/arch/ppc64/kernel/pSeries_setup.c
index 44d9af72d2..5bec956e44 100644
--- a/arch/ppc64/kernel/pSeries_setup.c
+++ b/arch/ppc64/kernel/pSeries_setup.c
@@ -19,6 +19,7 @@
19#undef DEBUG 19#undef DEBUG
20 20
21#include <linux/config.h> 21#include <linux/config.h>
22#include <linux/cpu.h>
22#include <linux/errno.h> 23#include <linux/errno.h>
23#include <linux/sched.h> 24#include <linux/sched.h>
24#include <linux/kernel.h> 25#include <linux/kernel.h>
@@ -82,6 +83,9 @@ int fwnmi_active; /* TRUE if an FWNMI handler is present */
82extern void pSeries_system_reset_exception(struct pt_regs *regs); 83extern void pSeries_system_reset_exception(struct pt_regs *regs);
83extern int pSeries_machine_check_exception(struct pt_regs *regs); 84extern int pSeries_machine_check_exception(struct pt_regs *regs);
84 85
86static int pseries_shared_idle(void);
87static int pseries_dedicated_idle(void);
88
85static volatile void __iomem * chrp_int_ack_special; 89static volatile void __iomem * chrp_int_ack_special;
86struct mpic *pSeries_mpic; 90struct mpic *pSeries_mpic;
87 91
@@ -229,6 +233,20 @@ static void __init pSeries_setup_arch(void)
229 233
230 if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) 234 if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
231 vpa_init(boot_cpuid); 235 vpa_init(boot_cpuid);
236
237 /* Choose an idle loop */
238 if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) {
239 if (get_paca()->lppaca.shared_proc) {
240 printk(KERN_INFO "Using shared processor idle loop\n");
241 ppc_md.idle_loop = pseries_shared_idle;
242 } else {
243 printk(KERN_INFO "Using dedicated idle loop\n");
244 ppc_md.idle_loop = pseries_dedicated_idle;
245 }
246 } else {
247 printk(KERN_INFO "Using default idle loop\n");
248 ppc_md.idle_loop = default_idle;
249 }
232} 250}
233 251
234static int __init pSeries_init_panel(void) 252static int __init pSeries_init_panel(void)
@@ -418,6 +436,144 @@ static int __init pSeries_probe(int platform)
418 return 1; 436 return 1;
419} 437}
420 438
439DECLARE_PER_CPU(unsigned long, smt_snooze_delay);
440
441static inline void dedicated_idle_sleep(unsigned int cpu)
442{
443 struct paca_struct *ppaca = &paca[cpu ^ 1];
444
445 /* Only sleep if the other thread is not idle */
446 if (!(ppaca->lppaca.idle)) {
447 local_irq_disable();
448
449 /*
450 * We are about to sleep the thread and so wont be polling any
451 * more.
452 */
453 clear_thread_flag(TIF_POLLING_NRFLAG);
454
455 /*
456 * SMT dynamic mode. Cede will result in this thread going
457 * dormant, if the partner thread is still doing work. Thread
458 * wakes up if partner goes idle, an interrupt is presented, or
459 * a prod occurs. Returning from the cede enables external
460 * interrupts.
461 */
462 if (!need_resched())
463 cede_processor();
464 else
465 local_irq_enable();
466 } else {
467 /*
468 * Give the HV an opportunity at the processor, since we are
469 * not doing any work.
470 */
471 poll_pending();
472 }
473}
474
475static int pseries_dedicated_idle(void)
476{
477 long oldval;
478 struct paca_struct *lpaca = get_paca();
479 unsigned int cpu = smp_processor_id();
480 unsigned long start_snooze;
481 unsigned long *smt_snooze_delay = &__get_cpu_var(smt_snooze_delay);
482
483 while (1) {
484 /*
485 * Indicate to the HV that we are idle. Now would be
486 * a good time to find other work to dispatch.
487 */
488 lpaca->lppaca.idle = 1;
489
490 oldval = test_and_clear_thread_flag(TIF_NEED_RESCHED);
491 if (!oldval) {
492 set_thread_flag(TIF_POLLING_NRFLAG);
493
494 start_snooze = __get_tb() +
495 *smt_snooze_delay * tb_ticks_per_usec;
496
497 while (!need_resched() && !cpu_is_offline(cpu)) {
498 ppc64_runlatch_off();
499
500 /*
501 * Go into low thread priority and possibly
502 * low power mode.
503 */
504 HMT_low();
505 HMT_very_low();
506
507 if (*smt_snooze_delay != 0 &&
508 __get_tb() > start_snooze) {
509 HMT_medium();
510 dedicated_idle_sleep(cpu);
511 }
512
513 }
514
515 HMT_medium();
516 clear_thread_flag(TIF_POLLING_NRFLAG);
517 } else {
518 set_need_resched();
519 }
520
521 lpaca->lppaca.idle = 0;
522 ppc64_runlatch_on();
523
524 schedule();
525
526 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
527 cpu_die();
528 }
529}
530
531static int pseries_shared_idle(void)
532{
533 struct paca_struct *lpaca = get_paca();
534 unsigned int cpu = smp_processor_id();
535
536 while (1) {
537 /*
538 * Indicate to the HV that we are idle. Now would be
539 * a good time to find other work to dispatch.
540 */
541 lpaca->lppaca.idle = 1;
542
543 while (!need_resched() && !cpu_is_offline(cpu)) {
544 local_irq_disable();
545 ppc64_runlatch_off();
546
547 /*
548 * Yield the processor to the hypervisor. We return if
549 * an external interrupt occurs (which are driven prior
550 * to returning here) or if a prod occurs from another
551 * processor. When returning here, external interrupts
552 * are enabled.
553 *
554 * Check need_resched() again with interrupts disabled
555 * to avoid a race.
556 */
557 if (!need_resched())
558 cede_processor();
559 else
560 local_irq_enable();
561
562 HMT_medium();
563 }
564
565 lpaca->lppaca.idle = 0;
566 ppc64_runlatch_on();
567
568 schedule();
569
570 if (cpu_is_offline(cpu) && system_state == SYSTEM_RUNNING)
571 cpu_die();
572 }
573
574 return 0;
575}
576
421struct machdep_calls __initdata pSeries_md = { 577struct machdep_calls __initdata pSeries_md = {
422 .probe = pSeries_probe, 578 .probe = pSeries_probe,
423 .setup_arch = pSeries_setup_arch, 579 .setup_arch = pSeries_setup_arch,
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
index 6cf03d387b..3013cdb5f9 100644
--- a/arch/ppc64/kernel/pmac_setup.c
+++ b/arch/ppc64/kernel/pmac_setup.c
@@ -186,6 +186,8 @@ void __init pmac_setup_arch(void)
186#ifdef CONFIG_DUMMY_CONSOLE 186#ifdef CONFIG_DUMMY_CONSOLE
187 conswitchp = &dummy_con; 187 conswitchp = &dummy_con;
188#endif 188#endif
189
190 printk(KERN_INFO "Using native/NAP idle loop\n");
189} 191}
190 192
191#ifdef CONFIG_SCSI 193#ifdef CONFIG_SCSI
@@ -507,5 +509,6 @@ struct machdep_calls __initdata pmac_md = {
507 .calibrate_decr = pmac_calibrate_decr, 509 .calibrate_decr = pmac_calibrate_decr,
508 .feature_call = pmac_do_feature_call, 510 .feature_call = pmac_do_feature_call,
509 .progress = pmac_progress, 511 .progress = pmac_progress,
510 .check_legacy_ioport = pmac_check_legacy_ioport 512 .check_legacy_ioport = pmac_check_legacy_ioport,
513 .idle_loop = native_idle,
511}; 514};
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index d5e4866e9a..d1b33f0b26 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -96,7 +96,6 @@ extern void udbg_init_maple_realmode(void);
96extern unsigned long klimit; 96extern unsigned long klimit;
97 97
98extern void mm_init_ppc64(void); 98extern void mm_init_ppc64(void);
99extern int idle_setup(void);
100extern void stab_initialize(unsigned long stab); 99extern void stab_initialize(unsigned long stab);
101extern void htab_initialize(void); 100extern void htab_initialize(void);
102extern void early_init_devtree(void *flat_dt); 101extern void early_init_devtree(void *flat_dt);
@@ -1081,8 +1080,11 @@ void __init setup_arch(char **cmdline_p)
1081 1080
1082 ppc_md.setup_arch(); 1081 ppc_md.setup_arch();
1083 1082
1084 /* Select the correct idle loop for the platform. */ 1083 /* Use the default idle loop if the platform hasn't provided one. */
1085 idle_setup(); 1084 if (NULL == ppc_md.idle_loop) {
1085 ppc_md.idle_loop = default_idle;
1086 printk(KERN_INFO "Using default idle loop\n");
1087 }
1086 1088
1087 paging_init(); 1089 paging_init();
1088 ppc64_boot_msg(0x15, "Setup Done"); 1090 ppc64_boot_msg(0x15, "Setup Done");
diff --git a/arch/ppc64/kernel/sys_ppc32.c b/arch/ppc64/kernel/sys_ppc32.c
index 118436e808..206619080e 100644
--- a/arch/ppc64/kernel/sys_ppc32.c
+++ b/arch/ppc64/kernel/sys_ppc32.c
@@ -30,47 +30,26 @@
30#include <linux/sem.h> 30#include <linux/sem.h>
31#include <linux/msg.h> 31#include <linux/msg.h>
32#include <linux/shm.h> 32#include <linux/shm.h>
33#include <linux/slab.h>
34#include <linux/uio.h>
35#include <linux/aio.h>
36#include <linux/nfs_fs.h>
37#include <linux/module.h>
38#include <linux/sunrpc/svc.h>
39#include <linux/nfsd/nfsd.h>
40#include <linux/nfsd/cache.h>
41#include <linux/nfsd/xdr.h>
42#include <linux/nfsd/syscall.h>
43#include <linux/poll.h> 33#include <linux/poll.h>
44#include <linux/personality.h> 34#include <linux/personality.h>
45#include <linux/stat.h> 35#include <linux/stat.h>
46#include <linux/filter.h>
47#include <linux/highmem.h>
48#include <linux/highuid.h>
49#include <linux/mman.h> 36#include <linux/mman.h>
50#include <linux/ipv6.h>
51#include <linux/in.h> 37#include <linux/in.h>
52#include <linux/icmpv6.h>
53#include <linux/syscalls.h> 38#include <linux/syscalls.h>
54#include <linux/unistd.h> 39#include <linux/unistd.h>
55#include <linux/sysctl.h> 40#include <linux/sysctl.h>
56#include <linux/binfmts.h> 41#include <linux/binfmts.h>
57#include <linux/dnotify.h>
58#include <linux/security.h> 42#include <linux/security.h>
59#include <linux/compat.h> 43#include <linux/compat.h>
60#include <linux/ptrace.h> 44#include <linux/ptrace.h>
61#include <linux/aio_abi.h>
62#include <linux/elf.h> 45#include <linux/elf.h>
63 46
64#include <net/scm.h>
65#include <net/sock.h>
66
67#include <asm/ptrace.h> 47#include <asm/ptrace.h>
68#include <asm/types.h> 48#include <asm/types.h>
69#include <asm/ipc.h> 49#include <asm/ipc.h>
70#include <asm/uaccess.h> 50#include <asm/uaccess.h>
71#include <asm/unistd.h> 51#include <asm/unistd.h>
72#include <asm/semaphore.h> 52#include <asm/semaphore.h>
73#include <asm/ppcdebug.h>
74#include <asm/time.h> 53#include <asm/time.h>
75#include <asm/mmu_context.h> 54#include <asm/mmu_context.h>
76#include <asm/systemcfg.h> 55#include <asm/systemcfg.h>
@@ -350,8 +329,6 @@ asmlinkage long sys32_adjtimex(struct timex32 __user *utp)
350 return ret; 329 return ret;
351} 330}
352 331
353
354/* These are here just in case some old sparc32 binary calls it. */
355asmlinkage long sys32_pause(void) 332asmlinkage long sys32_pause(void)
356{ 333{
357 current->state = TASK_INTERRUPTIBLE; 334 current->state = TASK_INTERRUPTIBLE;
@@ -360,8 +337,6 @@ asmlinkage long sys32_pause(void)
360 return -ERESTARTNOHAND; 337 return -ERESTARTNOHAND;
361} 338}
362 339
363
364
365static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i) 340static inline long get_ts32(struct timespec *o, struct compat_timeval __user *i)
366{ 341{
367 long usec; 342 long usec;
@@ -847,16 +822,6 @@ asmlinkage long sys32_getpgid(u32 pid)
847} 822}
848 823
849 824
850/* Note: it is necessary to treat which and who as unsigned ints,
851 * with the corresponding cast to a signed int to insure that the
852 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
853 * and the register representation of a signed int (msr in 64-bit mode) is performed.
854 */
855asmlinkage long sys32_getpriority(u32 which, u32 who)
856{
857 return sys_getpriority((int)which, (int)who);
858}
859
860 825
861/* Note: it is necessary to treat pid as an unsigned int, 826/* Note: it is necessary to treat pid as an unsigned int,
862 * with the corresponding cast to a signed int to insure that the 827 * with the corresponding cast to a signed int to insure that the
@@ -1048,6 +1013,11 @@ asmlinkage long sys32_setpgid(u32 pid, u32 pgid)
1048 return sys_setpgid((int)pid, (int)pgid); 1013 return sys_setpgid((int)pid, (int)pgid);
1049} 1014}
1050 1015
1016long sys32_getpriority(u32 which, u32 who)
1017{
1018 /* sign extend which and who */
1019 return sys_getpriority((int)which, (int)who);
1020}
1051 1021
1052long sys32_setpriority(u32 which, u32 who, u32 niceval) 1022long sys32_setpriority(u32 which, u32 who, u32 niceval)
1053{ 1023{
@@ -1055,6 +1025,18 @@ long sys32_setpriority(u32 which, u32 who, u32 niceval)
1055 return sys_setpriority((int)which, (int)who, (int)niceval); 1025 return sys_setpriority((int)which, (int)who, (int)niceval);
1056} 1026}
1057 1027
1028long sys32_ioprio_get(u32 which, u32 who)
1029{
1030 /* sign extend which and who */
1031 return sys_ioprio_get((int)which, (int)who);
1032}
1033
1034long sys32_ioprio_set(u32 which, u32 who, u32 ioprio)
1035{
1036 /* sign extend which, who and ioprio */
1037 return sys_ioprio_set((int)which, (int)who, (int)ioprio);
1038}
1039
1058/* Note: it is necessary to treat newmask as an unsigned int, 1040/* Note: it is necessary to treat newmask as an unsigned int,
1059 * with the corresponding cast to a signed int to insure that the 1041 * with the corresponding cast to a signed int to insure that the
1060 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode) 1042 * proper conversion (sign extension) between the register representation of a signed int (msr in 32-bit mode)
@@ -1273,8 +1255,6 @@ long ppc32_fadvise64_64(int fd, int advice, u32 offset_high, u32 offset_low,
1273 (u64)len_high << 32 | len_low, advice); 1255 (u64)len_high << 32 | len_low, advice);
1274} 1256}
1275 1257
1276extern asmlinkage long sys_timer_create(clockid_t, sigevent_t __user *, timer_t __user *);
1277
1278long ppc32_timer_create(clockid_t clock, 1258long ppc32_timer_create(clockid_t clock,
1279 struct compat_sigevent __user *ev32, 1259 struct compat_sigevent __user *ev32,
1280 timer_t __user *timer_id) 1260 timer_t __user *timer_id)
diff --git a/arch/ppc64/kernel/sysfs.c b/arch/ppc64/kernel/sysfs.c
index 2f704a2caf..02b8ac4e01 100644
--- a/arch/ppc64/kernel/sysfs.c
+++ b/arch/ppc64/kernel/sysfs.c
@@ -112,7 +112,6 @@ void ppc64_enable_pmcs(void)
112 unsigned long hid0; 112 unsigned long hid0;
113#ifdef CONFIG_PPC_PSERIES 113#ifdef CONFIG_PPC_PSERIES
114 unsigned long set, reset; 114 unsigned long set, reset;
115 int ret;
116#endif /* CONFIG_PPC_PSERIES */ 115#endif /* CONFIG_PPC_PSERIES */
117 116
118 /* Only need to enable them once */ 117 /* Only need to enable them once */
@@ -145,11 +144,7 @@ void ppc64_enable_pmcs(void)
145 case PLATFORM_PSERIES_LPAR: 144 case PLATFORM_PSERIES_LPAR:
146 set = 1UL << 63; 145 set = 1UL << 63;
147 reset = 0; 146 reset = 0;
148 ret = plpar_hcall_norets(H_PERFMON, set, reset); 147 plpar_hcall_norets(H_PERFMON, set, reset);
149 if (ret)
150 printk(KERN_ERR "H_PERFMON call on cpu %u "
151 "returned %d\n",
152 smp_processor_id(), ret);
153 break; 148 break;
154#endif /* CONFIG_PPC_PSERIES */ 149#endif /* CONFIG_PPC_PSERIES */
155 150
@@ -161,13 +156,6 @@ void ppc64_enable_pmcs(void)
161 /* instruct hypervisor to maintain PMCs */ 156 /* instruct hypervisor to maintain PMCs */
162 if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR) 157 if (cur_cpu_spec->firmware_features & FW_FEATURE_SPLPAR)
163 get_paca()->lppaca.pmcregs_in_use = 1; 158 get_paca()->lppaca.pmcregs_in_use = 1;
164
165 /*
166 * On SMT machines we have to set the run latch in the ctrl register
167 * in order to make PMC6 spin.
168 */
169 if (cpu_has_feature(CPU_FTR_SMT))
170 ppc64_runlatch_on();
171#endif /* CONFIG_PPC_PSERIES */ 159#endif /* CONFIG_PPC_PSERIES */
172} 160}
173 161
diff --git a/arch/ppc64/kernel/vdso32/vdso32.lds.S b/arch/ppc64/kernel/vdso32/vdso32.lds.S
index 11290c902b..6f87a916a3 100644
--- a/arch/ppc64/kernel/vdso32/vdso32.lds.S
+++ b/arch/ppc64/kernel/vdso32/vdso32.lds.S
@@ -40,9 +40,9 @@ SECTIONS
40 .gcc_except_table : { *(.gcc_except_table) } 40 .gcc_except_table : { *(.gcc_except_table) }
41 .fixup : { *(.fixup) } 41 .fixup : { *(.fixup) }
42 42
43 .got ALIGN(4) : { *(.got.plt) *(.got) }
44
45 .dynamic : { *(.dynamic) } :text :dynamic 43 .dynamic : { *(.dynamic) } :text :dynamic
44 .got : { *(.got) }
45 .plt : { *(.plt) }
46 46
47 _end = .; 47 _end = .;
48 __end = .; 48 __end = .;
diff --git a/arch/ppc64/mm/hash_low.S b/arch/ppc64/mm/hash_low.S
index c23d46956d..fbff24827a 100644
--- a/arch/ppc64/mm/hash_low.S
+++ b/arch/ppc64/mm/hash_low.S
@@ -170,9 +170,7 @@ htab_insert_pte:
170 /* Call ppc_md.hpte_insert */ 170 /* Call ppc_md.hpte_insert */
171 ld r7,STK_PARM(r4)(r1) /* Retreive new pp bits */ 171 ld r7,STK_PARM(r4)(r1) /* Retreive new pp bits */
172 mr r4,r29 /* Retreive va */ 172 mr r4,r29 /* Retreive va */
173 li r6,0 /* primary slot */ 173 li r6,0 /* no vflags */
174 li r8,0 /* not bolted and not large */
175 li r9,0
176_GLOBAL(htab_call_hpte_insert1) 174_GLOBAL(htab_call_hpte_insert1)
177 bl . /* Will be patched by htab_finish_init() */ 175 bl . /* Will be patched by htab_finish_init() */
178 cmpdi 0,r3,0 176 cmpdi 0,r3,0
@@ -192,9 +190,7 @@ _GLOBAL(htab_call_hpte_insert1)
192 /* Call ppc_md.hpte_insert */ 190 /* Call ppc_md.hpte_insert */
193 ld r7,STK_PARM(r4)(r1) /* Retreive new pp bits */ 191 ld r7,STK_PARM(r4)(r1) /* Retreive new pp bits */
194 mr r4,r29 /* Retreive va */ 192 mr r4,r29 /* Retreive va */
195 li r6,1 /* secondary slot */ 193 li r6,HPTE_V_SECONDARY@l /* secondary slot */
196 li r8,0 /* not bolted and not large */
197 li r9,0
198_GLOBAL(htab_call_hpte_insert2) 194_GLOBAL(htab_call_hpte_insert2)
199 bl . /* Will be patched by htab_finish_init() */ 195 bl . /* Will be patched by htab_finish_init() */
200 cmpdi 0,r3,0 196 cmpdi 0,r3,0
diff --git a/arch/ppc64/mm/hash_native.c b/arch/ppc64/mm/hash_native.c
index 4fec05817d..a6abd3a979 100644
--- a/arch/ppc64/mm/hash_native.c
+++ b/arch/ppc64/mm/hash_native.c
@@ -27,9 +27,9 @@
27 27
28static DEFINE_SPINLOCK(native_tlbie_lock); 28static DEFINE_SPINLOCK(native_tlbie_lock);
29 29
30static inline void native_lock_hpte(HPTE *hptep) 30static inline void native_lock_hpte(hpte_t *hptep)
31{ 31{
32 unsigned long *word = &hptep->dw0.dword0; 32 unsigned long *word = &hptep->v;
33 33
34 while (1) { 34 while (1) {
35 if (!test_and_set_bit(HPTE_LOCK_BIT, word)) 35 if (!test_and_set_bit(HPTE_LOCK_BIT, word))
@@ -39,32 +39,28 @@ static inline void native_lock_hpte(HPTE *hptep)
39 } 39 }
40} 40}
41 41
42static inline void native_unlock_hpte(HPTE *hptep) 42static inline void native_unlock_hpte(hpte_t *hptep)
43{ 43{
44 unsigned long *word = &hptep->dw0.dword0; 44 unsigned long *word = &hptep->v;
45 45
46 asm volatile("lwsync":::"memory"); 46 asm volatile("lwsync":::"memory");
47 clear_bit(HPTE_LOCK_BIT, word); 47 clear_bit(HPTE_LOCK_BIT, word);
48} 48}
49 49
50long native_hpte_insert(unsigned long hpte_group, unsigned long va, 50long native_hpte_insert(unsigned long hpte_group, unsigned long va,
51 unsigned long prpn, int secondary, 51 unsigned long prpn, unsigned long vflags,
52 unsigned long hpteflags, int bolted, int large) 52 unsigned long rflags)
53{ 53{
54 unsigned long arpn = physRpn_to_absRpn(prpn); 54 unsigned long arpn = physRpn_to_absRpn(prpn);
55 HPTE *hptep = htab_address + hpte_group; 55 hpte_t *hptep = htab_address + hpte_group;
56 Hpte_dword0 dw0; 56 unsigned long hpte_v, hpte_r;
57 HPTE lhpte;
58 int i; 57 int i;
59 58
60 for (i = 0; i < HPTES_PER_GROUP; i++) { 59 for (i = 0; i < HPTES_PER_GROUP; i++) {
61 dw0 = hptep->dw0.dw0; 60 if (! (hptep->v & HPTE_V_VALID)) {
62
63 if (!dw0.v) {
64 /* retry with lock held */ 61 /* retry with lock held */
65 native_lock_hpte(hptep); 62 native_lock_hpte(hptep);
66 dw0 = hptep->dw0.dw0; 63 if (! (hptep->v & HPTE_V_VALID))
67 if (!dw0.v)
68 break; 64 break;
69 native_unlock_hpte(hptep); 65 native_unlock_hpte(hptep);
70 } 66 }
@@ -75,56 +71,45 @@ long native_hpte_insert(unsigned long hpte_group, unsigned long va,
75 if (i == HPTES_PER_GROUP) 71 if (i == HPTES_PER_GROUP)
76 return -1; 72 return -1;
77 73
78 lhpte.dw1.dword1 = 0; 74 hpte_v = (va >> 23) << HPTE_V_AVPN_SHIFT | vflags | HPTE_V_VALID;
79 lhpte.dw1.dw1.rpn = arpn; 75 if (vflags & HPTE_V_LARGE)
80 lhpte.dw1.flags.flags = hpteflags; 76 va &= ~(1UL << HPTE_V_AVPN_SHIFT);
81 77 hpte_r = (arpn << HPTE_R_RPN_SHIFT) | rflags;
82 lhpte.dw0.dword0 = 0;
83 lhpte.dw0.dw0.avpn = va >> 23;
84 lhpte.dw0.dw0.h = secondary;
85 lhpte.dw0.dw0.bolted = bolted;
86 lhpte.dw0.dw0.v = 1;
87
88 if (large) {
89 lhpte.dw0.dw0.l = 1;
90 lhpte.dw0.dw0.avpn &= ~0x1UL;
91 }
92
93 hptep->dw1.dword1 = lhpte.dw1.dword1;
94 78
79 hptep->r = hpte_r;
95 /* Guarantee the second dword is visible before the valid bit */ 80 /* Guarantee the second dword is visible before the valid bit */
96 __asm__ __volatile__ ("eieio" : : : "memory"); 81 __asm__ __volatile__ ("eieio" : : : "memory");
97
98 /* 82 /*
99 * Now set the first dword including the valid bit 83 * Now set the first dword including the valid bit
100 * NOTE: this also unlocks the hpte 84 * NOTE: this also unlocks the hpte
101 */ 85 */
102 hptep->dw0.dword0 = lhpte.dw0.dword0; 86 hptep->v = hpte_v;
103 87
104 __asm__ __volatile__ ("ptesync" : : : "memory"); 88 __asm__ __volatile__ ("ptesync" : : : "memory");
105 89
106 return i | (secondary << 3); 90 return i | (!!(vflags & HPTE_V_SECONDARY) << 3);
107} 91}
108 92
109static long native_hpte_remove(unsigned long hpte_group) 93static long native_hpte_remove(unsigned long hpte_group)
110{ 94{
111 HPTE *hptep; 95 hpte_t *hptep;
112 Hpte_dword0 dw0;
113 int i; 96 int i;
114 int slot_offset; 97 int slot_offset;
98 unsigned long hpte_v;
115 99
116 /* pick a random entry to start at */ 100 /* pick a random entry to start at */
117 slot_offset = mftb() & 0x7; 101 slot_offset = mftb() & 0x7;
118 102
119 for (i = 0; i < HPTES_PER_GROUP; i++) { 103 for (i = 0; i < HPTES_PER_GROUP; i++) {
120 hptep = htab_address + hpte_group + slot_offset; 104 hptep = htab_address + hpte_group + slot_offset;
121 dw0 = hptep->dw0.dw0; 105 hpte_v = hptep->v;
122 106
123 if (dw0.v && !dw0.bolted) { 107 if ((hpte_v & HPTE_V_VALID) && !(hpte_v & HPTE_V_BOLTED)) {
124 /* retry with lock held */ 108 /* retry with lock held */
125 native_lock_hpte(hptep); 109 native_lock_hpte(hptep);
126 dw0 = hptep->dw0.dw0; 110 hpte_v = hptep->v;
127 if (dw0.v && !dw0.bolted) 111 if ((hpte_v & HPTE_V_VALID)
112 && !(hpte_v & HPTE_V_BOLTED))
128 break; 113 break;
129 native_unlock_hpte(hptep); 114 native_unlock_hpte(hptep);
130 } 115 }
@@ -137,15 +122,15 @@ static long native_hpte_remove(unsigned long hpte_group)
137 return -1; 122 return -1;
138 123
139 /* Invalidate the hpte. NOTE: this also unlocks it */ 124 /* Invalidate the hpte. NOTE: this also unlocks it */
140 hptep->dw0.dword0 = 0; 125 hptep->v = 0;
141 126
142 return i; 127 return i;
143} 128}
144 129
145static inline void set_pp_bit(unsigned long pp, HPTE *addr) 130static inline void set_pp_bit(unsigned long pp, hpte_t *addr)
146{ 131{
147 unsigned long old; 132 unsigned long old;
148 unsigned long *p = &addr->dw1.dword1; 133 unsigned long *p = &addr->r;
149 134
150 __asm__ __volatile__( 135 __asm__ __volatile__(
151 "1: ldarx %0,0,%3\n\ 136 "1: ldarx %0,0,%3\n\
@@ -163,11 +148,11 @@ static inline void set_pp_bit(unsigned long pp, HPTE *addr)
163 */ 148 */
164static long native_hpte_find(unsigned long vpn) 149static long native_hpte_find(unsigned long vpn)
165{ 150{
166 HPTE *hptep; 151 hpte_t *hptep;
167 unsigned long hash; 152 unsigned long hash;
168 unsigned long i, j; 153 unsigned long i, j;
169 long slot; 154 long slot;
170 Hpte_dword0 dw0; 155 unsigned long hpte_v;
171 156
172 hash = hpt_hash(vpn, 0); 157 hash = hpt_hash(vpn, 0);
173 158
@@ -175,10 +160,11 @@ static long native_hpte_find(unsigned long vpn)
175 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 160 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
176 for (i = 0; i < HPTES_PER_GROUP; i++) { 161 for (i = 0; i < HPTES_PER_GROUP; i++) {
177 hptep = htab_address + slot; 162 hptep = htab_address + slot;
178 dw0 = hptep->dw0.dw0; 163 hpte_v = hptep->v;
179 164
180 if ((dw0.avpn == (vpn >> 11)) && dw0.v && 165 if ((HPTE_V_AVPN_VAL(hpte_v) == (vpn >> 11))
181 (dw0.h == j)) { 166 && (hpte_v & HPTE_V_VALID)
167 && ( !!(hpte_v & HPTE_V_SECONDARY) == j)) {
182 /* HPTE matches */ 168 /* HPTE matches */
183 if (j) 169 if (j)
184 slot = -slot; 170 slot = -slot;
@@ -195,20 +181,21 @@ static long native_hpte_find(unsigned long vpn)
195static long native_hpte_updatepp(unsigned long slot, unsigned long newpp, 181static long native_hpte_updatepp(unsigned long slot, unsigned long newpp,
196 unsigned long va, int large, int local) 182 unsigned long va, int large, int local)
197{ 183{
198 HPTE *hptep = htab_address + slot; 184 hpte_t *hptep = htab_address + slot;
199 Hpte_dword0 dw0; 185 unsigned long hpte_v;
200 unsigned long avpn = va >> 23; 186 unsigned long avpn = va >> 23;
201 int ret = 0; 187 int ret = 0;
202 188
203 if (large) 189 if (large)
204 avpn &= ~0x1UL; 190 avpn &= ~1;
205 191
206 native_lock_hpte(hptep); 192 native_lock_hpte(hptep);
207 193
208 dw0 = hptep->dw0.dw0; 194 hpte_v = hptep->v;
209 195
210 /* Even if we miss, we need to invalidate the TLB */ 196 /* Even if we miss, we need to invalidate the TLB */
211 if ((dw0.avpn != avpn) || !dw0.v) { 197 if ((HPTE_V_AVPN_VAL(hpte_v) != avpn)
198 || !(hpte_v & HPTE_V_VALID)) {
212 native_unlock_hpte(hptep); 199 native_unlock_hpte(hptep);
213 ret = -1; 200 ret = -1;
214 } else { 201 } else {
@@ -244,7 +231,7 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea)
244{ 231{
245 unsigned long vsid, va, vpn, flags = 0; 232 unsigned long vsid, va, vpn, flags = 0;
246 long slot; 233 long slot;
247 HPTE *hptep; 234 hpte_t *hptep;
248 int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE); 235 int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE);
249 236
250 vsid = get_kernel_vsid(ea); 237 vsid = get_kernel_vsid(ea);
@@ -269,26 +256,27 @@ static void native_hpte_updateboltedpp(unsigned long newpp, unsigned long ea)
269static void native_hpte_invalidate(unsigned long slot, unsigned long va, 256static void native_hpte_invalidate(unsigned long slot, unsigned long va,
270 int large, int local) 257 int large, int local)
271{ 258{
272 HPTE *hptep = htab_address + slot; 259 hpte_t *hptep = htab_address + slot;
273 Hpte_dword0 dw0; 260 unsigned long hpte_v;
274 unsigned long avpn = va >> 23; 261 unsigned long avpn = va >> 23;
275 unsigned long flags; 262 unsigned long flags;
276 int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE); 263 int lock_tlbie = !cpu_has_feature(CPU_FTR_LOCKLESS_TLBIE);
277 264
278 if (large) 265 if (large)
279 avpn &= ~0x1UL; 266 avpn &= ~1;
280 267
281 local_irq_save(flags); 268 local_irq_save(flags);
282 native_lock_hpte(hptep); 269 native_lock_hpte(hptep);
283 270
284 dw0 = hptep->dw0.dw0; 271 hpte_v = hptep->v;
285 272
286 /* Even if we miss, we need to invalidate the TLB */ 273 /* Even if we miss, we need to invalidate the TLB */
287 if ((dw0.avpn != avpn) || !dw0.v) { 274 if ((HPTE_V_AVPN_VAL(hpte_v) != avpn)
275 || !(hpte_v & HPTE_V_VALID)) {
288 native_unlock_hpte(hptep); 276 native_unlock_hpte(hptep);
289 } else { 277 } else {
290 /* Invalidate the hpte. NOTE: this also unlocks it */ 278 /* Invalidate the hpte. NOTE: this also unlocks it */
291 hptep->dw0.dword0 = 0; 279 hptep->v = 0;
292 } 280 }
293 281
294 /* Invalidate the tlb */ 282 /* Invalidate the tlb */
@@ -315,8 +303,8 @@ static void native_hpte_invalidate(unsigned long slot, unsigned long va,
315static void native_hpte_clear(void) 303static void native_hpte_clear(void)
316{ 304{
317 unsigned long slot, slots, flags; 305 unsigned long slot, slots, flags;
318 HPTE *hptep = htab_address; 306 hpte_t *hptep = htab_address;
319 Hpte_dword0 dw0; 307 unsigned long hpte_v;
320 unsigned long pteg_count; 308 unsigned long pteg_count;
321 309
322 pteg_count = htab_hash_mask + 1; 310 pteg_count = htab_hash_mask + 1;
@@ -336,11 +324,11 @@ static void native_hpte_clear(void)
336 * running, right? and for crash dump, we probably 324 * running, right? and for crash dump, we probably
337 * don't want to wait for a maybe bad cpu. 325 * don't want to wait for a maybe bad cpu.
338 */ 326 */
339 dw0 = hptep->dw0.dw0; 327 hpte_v = hptep->v;
340 328
341 if (dw0.v) { 329 if (hpte_v & HPTE_V_VALID) {
342 hptep->dw0.dword0 = 0; 330 hptep->v = 0;
343 tlbie(slot2va(dw0.avpn, dw0.l, dw0.h, slot), dw0.l); 331 tlbie(slot2va(hpte_v, slot), hpte_v & HPTE_V_LARGE);
344 } 332 }
345 } 333 }
346 334
@@ -353,8 +341,8 @@ static void native_flush_hash_range(unsigned long context,
353{ 341{
354 unsigned long vsid, vpn, va, hash, secondary, slot, flags, avpn; 342 unsigned long vsid, vpn, va, hash, secondary, slot, flags, avpn;
355 int i, j; 343 int i, j;
356 HPTE *hptep; 344 hpte_t *hptep;
357 Hpte_dword0 dw0; 345 unsigned long hpte_v;
358 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch); 346 struct ppc64_tlb_batch *batch = &__get_cpu_var(ppc64_tlb_batch);
359 347
360 /* XXX fix for large ptes */ 348 /* XXX fix for large ptes */
@@ -390,14 +378,15 @@ static void native_flush_hash_range(unsigned long context,
390 378
391 native_lock_hpte(hptep); 379 native_lock_hpte(hptep);
392 380
393 dw0 = hptep->dw0.dw0; 381 hpte_v = hptep->v;
394 382
395 /* Even if we miss, we need to invalidate the TLB */ 383 /* Even if we miss, we need to invalidate the TLB */
396 if ((dw0.avpn != avpn) || !dw0.v) { 384 if ((HPTE_V_AVPN_VAL(hpte_v) != avpn)
385 || !(hpte_v & HPTE_V_VALID)) {
397 native_unlock_hpte(hptep); 386 native_unlock_hpte(hptep);
398 } else { 387 } else {
399 /* Invalidate the hpte. NOTE: this also unlocks it */ 388 /* Invalidate the hpte. NOTE: this also unlocks it */
400 hptep->dw0.dword0 = 0; 389 hptep->v = 0;
401 } 390 }
402 391
403 j++; 392 j++;
diff --git a/arch/ppc64/mm/hash_utils.c b/arch/ppc64/mm/hash_utils.c
index 1647b1c6f2..623b5d130c 100644
--- a/arch/ppc64/mm/hash_utils.c
+++ b/arch/ppc64/mm/hash_utils.c
@@ -75,8 +75,8 @@
75extern unsigned long dart_tablebase; 75extern unsigned long dart_tablebase;
76#endif /* CONFIG_U3_DART */ 76#endif /* CONFIG_U3_DART */
77 77
78HPTE *htab_address; 78hpte_t *htab_address;
79unsigned long htab_hash_mask; 79unsigned long htab_hash_mask;
80 80
81extern unsigned long _SDR1; 81extern unsigned long _SDR1;
82 82
@@ -97,11 +97,15 @@ static inline void create_pte_mapping(unsigned long start, unsigned long end,
97 unsigned long addr; 97 unsigned long addr;
98 unsigned int step; 98 unsigned int step;
99 unsigned long tmp_mode; 99 unsigned long tmp_mode;
100 unsigned long vflags;
100 101
101 if (large) 102 if (large) {
102 step = 16*MB; 103 step = 16*MB;
103 else 104 vflags = HPTE_V_BOLTED | HPTE_V_LARGE;
105 } else {
104 step = 4*KB; 106 step = 4*KB;
107 vflags = HPTE_V_BOLTED;
108 }
105 109
106 for (addr = start; addr < end; addr += step) { 110 for (addr = start; addr < end; addr += step) {
107 unsigned long vpn, hash, hpteg; 111 unsigned long vpn, hash, hpteg;
@@ -129,12 +133,12 @@ static inline void create_pte_mapping(unsigned long start, unsigned long end,
129 if (systemcfg->platform & PLATFORM_LPAR) 133 if (systemcfg->platform & PLATFORM_LPAR)
130 ret = pSeries_lpar_hpte_insert(hpteg, va, 134 ret = pSeries_lpar_hpte_insert(hpteg, va,
131 virt_to_abs(addr) >> PAGE_SHIFT, 135 virt_to_abs(addr) >> PAGE_SHIFT,
132 0, tmp_mode, 1, large); 136 vflags, tmp_mode);
133 else 137 else
134#endif /* CONFIG_PPC_PSERIES */ 138#endif /* CONFIG_PPC_PSERIES */
135 ret = native_hpte_insert(hpteg, va, 139 ret = native_hpte_insert(hpteg, va,
136 virt_to_abs(addr) >> PAGE_SHIFT, 140 virt_to_abs(addr) >> PAGE_SHIFT,
137 0, tmp_mode, 1, large); 141 vflags, tmp_mode);
138 142
139 if (ret == -1) { 143 if (ret == -1) {
140 ppc64_terminate_msg(0x20, "create_pte_mapping"); 144 ppc64_terminate_msg(0x20, "create_pte_mapping");
diff --git a/arch/ppc64/mm/hugetlbpage.c b/arch/ppc64/mm/hugetlbpage.c
index fdcfe97c75..f952460281 100644
--- a/arch/ppc64/mm/hugetlbpage.c
+++ b/arch/ppc64/mm/hugetlbpage.c
@@ -583,7 +583,7 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
583 pte_t *ptep; 583 pte_t *ptep;
584 unsigned long va, vpn; 584 unsigned long va, vpn;
585 pte_t old_pte, new_pte; 585 pte_t old_pte, new_pte;
586 unsigned long hpteflags, prpn; 586 unsigned long rflags, prpn;
587 long slot; 587 long slot;
588 int err = 1; 588 int err = 1;
589 589
@@ -626,9 +626,9 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
626 old_pte = *ptep; 626 old_pte = *ptep;
627 new_pte = old_pte; 627 new_pte = old_pte;
628 628
629 hpteflags = 0x2 | (! (pte_val(new_pte) & _PAGE_RW)); 629 rflags = 0x2 | (! (pte_val(new_pte) & _PAGE_RW));
630 /* _PAGE_EXEC -> HW_NO_EXEC since it's inverted */ 630 /* _PAGE_EXEC -> HW_NO_EXEC since it's inverted */
631 hpteflags |= ((pte_val(new_pte) & _PAGE_EXEC) ? 0 : HW_NO_EXEC); 631 rflags |= ((pte_val(new_pte) & _PAGE_EXEC) ? 0 : HW_NO_EXEC);
632 632
633 /* Check if pte already has an hpte (case 2) */ 633 /* Check if pte already has an hpte (case 2) */
634 if (unlikely(pte_val(old_pte) & _PAGE_HASHPTE)) { 634 if (unlikely(pte_val(old_pte) & _PAGE_HASHPTE)) {
@@ -641,7 +641,7 @@ int hash_huge_page(struct mm_struct *mm, unsigned long access,
641 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP; 641 slot = (hash & htab_hash_mask) * HPTES_PER_GROUP;
642 slot += (pte_val(old_pte) & _PAGE_GROUP_IX) >> 12; 642 slot += (pte_val(old_pte) & _PAGE_GROUP_IX) >> 12;
643 643
644 if (ppc_md.hpte_updatepp(slot, hpteflags, va, 1, local) == -1) 644 if (ppc_md.hpte_updatepp(slot, rflags, va, 1, local) == -1)
645 pte_val(old_pte) &= ~_PAGE_HPTEFLAGS; 645 pte_val(old_pte) &= ~_PAGE_HPTEFLAGS;
646 } 646 }
647 647
@@ -661,10 +661,10 @@ repeat:
661 661
662 /* Add in WIMG bits */ 662 /* Add in WIMG bits */
663 /* XXX We should store these in the pte */ 663 /* XXX We should store these in the pte */
664 hpteflags |= _PAGE_COHERENT; 664 rflags |= _PAGE_COHERENT;
665 665
666 slot = ppc_md.hpte_insert(hpte_group, va, prpn, 0, 666 slot = ppc_md.hpte_insert(hpte_group, va, prpn,
667 hpteflags, 0, 1); 667 HPTE_V_LARGE, rflags);
668 668
669 /* Primary is full, try the secondary */ 669 /* Primary is full, try the secondary */
670 if (unlikely(slot == -1)) { 670 if (unlikely(slot == -1)) {
@@ -672,7 +672,7 @@ repeat:
672 hpte_group = ((~hash & htab_hash_mask) * 672 hpte_group = ((~hash & htab_hash_mask) *
673 HPTES_PER_GROUP) & ~0x7UL; 673 HPTES_PER_GROUP) & ~0x7UL;
674 slot = ppc_md.hpte_insert(hpte_group, va, prpn, 674 slot = ppc_md.hpte_insert(hpte_group, va, prpn,
675 1, hpteflags, 0, 1); 675 HPTE_V_LARGE, rflags);
676 if (slot == -1) { 676 if (slot == -1) {
677 if (mftb() & 0x1) 677 if (mftb() & 0x1)
678 hpte_group = ((hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL; 678 hpte_group = ((hash & htab_hash_mask) * HPTES_PER_GROUP) & ~0x7UL;
diff --git a/arch/ppc64/mm/init.c b/arch/ppc64/mm/init.c
index b50b3a446d..e58a24d428 100644
--- a/arch/ppc64/mm/init.c
+++ b/arch/ppc64/mm/init.c
@@ -180,9 +180,10 @@ static int map_io_page(unsigned long ea, unsigned long pa, int flags)
180 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP); 180 hpteg = ((hash & htab_hash_mask) * HPTES_PER_GROUP);
181 181
182 /* Panic if a pte grpup is full */ 182 /* Panic if a pte grpup is full */
183 if (ppc_md.hpte_insert(hpteg, va, pa >> PAGE_SHIFT, 0, 183 if (ppc_md.hpte_insert(hpteg, va, pa >> PAGE_SHIFT,
184 _PAGE_NO_CACHE|_PAGE_GUARDED|PP_RWXX, 184 HPTE_V_BOLTED,
185 1, 0) == -1) { 185 _PAGE_NO_CACHE|_PAGE_GUARDED|PP_RWXX)
186 == -1) {
186 panic("map_io_page: could not insert mapping"); 187 panic("map_io_page: could not insert mapping");
187 } 188 }
188 } 189 }
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index 6600ee87f8..477ac2758b 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -465,6 +465,8 @@ config KEXEC
465 465
466endmenu 466endmenu
467 467
468source "net/Kconfig"
469
468config PCMCIA 470config PCMCIA
469 bool 471 bool
470 default n 472 default n
@@ -475,7 +477,7 @@ source "drivers/scsi/Kconfig"
475 477
476source "drivers/s390/Kconfig" 478source "drivers/s390/Kconfig"
477 479
478source "net/Kconfig" 480source "drivers/net/Kconfig"
479 481
480source "fs/Kconfig" 482source "fs/Kconfig"
481 483
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c
index 6140562228..18610cea03 100644
--- a/arch/s390/kernel/compat_linux.c
+++ b/arch/s390/kernel/compat_linux.c
@@ -58,6 +58,7 @@
58#include <linux/compat.h> 58#include <linux/compat.h>
59#include <linux/vfs.h> 59#include <linux/vfs.h>
60#include <linux/ptrace.h> 60#include <linux/ptrace.h>
61#include <linux/fadvise.h>
61 62
62#include <asm/types.h> 63#include <asm/types.h>
63#include <asm/ipc.h> 64#include <asm/ipc.h>
@@ -1043,3 +1044,40 @@ sys32_timer_create(clockid_t which_clock, struct compat_sigevent *se32,
1043 1044
1044 return ret; 1045 return ret;
1045} 1046}
1047
1048/*
1049 * 31 bit emulation wrapper functions for sys_fadvise64/fadvise64_64.
1050 * These need to rewrite the advise values for POSIX_FADV_{DONTNEED,NOREUSE}
1051 * because the 31 bit values differ from the 64 bit values.
1052 */
1053
1054asmlinkage long
1055sys32_fadvise64(int fd, loff_t offset, size_t len, int advise)
1056{
1057 if (advise == 4)
1058 advise = POSIX_FADV_DONTNEED;
1059 else if (advise == 5)
1060 advise = POSIX_FADV_NOREUSE;
1061 return sys_fadvise64(fd, offset, len, advise);
1062}
1063
1064struct fadvise64_64_args {
1065 int fd;
1066 long long offset;
1067 long long len;
1068 int advice;
1069};
1070
1071asmlinkage long
1072sys32_fadvise64_64(struct fadvise64_64_args __user *args)
1073{
1074 struct fadvise64_64_args a;
1075
1076 if ( copy_from_user(&a, args, sizeof(a)) )
1077 return -EFAULT;
1078 if (a.advice == 4)
1079 a.advice = POSIX_FADV_DONTNEED;
1080 else if (a.advice == 5)
1081 a.advice = POSIX_FADV_NOREUSE;
1082 return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
1083}
diff --git a/arch/s390/kernel/compat_wrapper.S b/arch/s390/kernel/compat_wrapper.S
index bf529739c8..799a98eac9 100644
--- a/arch/s390/kernel/compat_wrapper.S
+++ b/arch/s390/kernel/compat_wrapper.S
@@ -1251,12 +1251,12 @@ sys32_fadvise64_wrapper:
1251 or %r3,%r4 # get low word of 64bit loff_t 1251 or %r3,%r4 # get low word of 64bit loff_t
1252 llgfr %r4,%r5 # size_t (unsigned long) 1252 llgfr %r4,%r5 # size_t (unsigned long)
1253 lgfr %r5,%r6 # int 1253 lgfr %r5,%r6 # int
1254 jg sys_fadvise64 1254 jg sys32_fadvise64
1255 1255
1256 .globl sys32_fadvise64_64_wrapper 1256 .globl sys32_fadvise64_64_wrapper
1257sys32_fadvise64_64_wrapper: 1257sys32_fadvise64_64_wrapper:
1258 llgtr %r2,%r2 # struct fadvise64_64_args * 1258 llgtr %r2,%r2 # struct fadvise64_64_args *
1259 jg s390_fadvise64_64 1259 jg sys32_fadvise64_64
1260 1260
1261 .globl sys32_clock_settime_wrapper 1261 .globl sys32_clock_settime_wrapper
1262sys32_clock_settime_wrapper: 1262sys32_clock_settime_wrapper:
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index a7c8bfc116..adc8109f8b 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -784,6 +784,8 @@ config EMBEDDED_RAMDISK_IMAGE
784 784
785endmenu 785endmenu
786 786
787source "net/Kconfig"
788
787source "drivers/Kconfig" 789source "drivers/Kconfig"
788 790
789source "fs/Kconfig" 791source "fs/Kconfig"
diff --git a/arch/sh64/Kconfig b/arch/sh64/Kconfig
index 708e59736a..4c3e5334ad 100644
--- a/arch/sh64/Kconfig
+++ b/arch/sh64/Kconfig
@@ -268,6 +268,8 @@ source "fs/Kconfig.binfmt"
268 268
269endmenu 269endmenu
270 270
271source "net/Kconfig"
272
271source "drivers/Kconfig" 273source "drivers/Kconfig"
272 274
273source "fs/Kconfig" 275source "fs/Kconfig"
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index 7a117ef473..aca028aa29 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -268,6 +268,8 @@ source "mm/Kconfig"
268 268
269endmenu 269endmenu
270 270
271source "net/Kconfig"
272
271source "drivers/Kconfig" 273source "drivers/Kconfig"
272 274
273if !SUN4 275if !SUN4
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index 928ffeb0fa..025f4516e6 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -57,11 +57,11 @@ sys_call_table:
57/*180*/ .long sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_sigpending, sys_ni_syscall 57/*180*/ .long sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_sigpending, sys_ni_syscall
58/*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname 58/*185*/ .long sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sys_newuname
59/*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl 59/*190*/ .long sys_init_module, sys_personality, sparc_remap_file_pages, sys_epoll_create, sys_epoll_ctl
60/*195*/ .long sys_epoll_wait, sys_nis_syscall, sys_getppid, sparc_sigaction, sys_sgetmask 60/*195*/ .long sys_epoll_wait, sys_ioprio_set, sys_getppid, sparc_sigaction, sys_sgetmask
61/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, old_readdir 61/*200*/ .long sys_ssetmask, sys_sigsuspend, sys_newlstat, sys_uselib, old_readdir
62/*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64 62/*205*/ .long sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64
63/*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo 63/*210*/ .long sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo
64/*215*/ .long sys_ipc, sys_sigreturn, sys_clone, sys_nis_syscall, sys_adjtimex 64/*215*/ .long sys_ipc, sys_sigreturn, sys_clone, sys_ioprio_get, sys_adjtimex
65/*220*/ .long sys_sigprocmask, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid 65/*220*/ .long sys_sigprocmask, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid
66/*225*/ .long sys_bdflush, sys_sysfs, sys_nis_syscall, sys_setfsuid16, sys_setfsgid16 66/*225*/ .long sys_bdflush, sys_sysfs, sys_nis_syscall, sys_setfsuid16, sys_setfsgid16
67/*230*/ .long sys_select, sys_time, sys_nis_syscall, sys_stime, sys_statfs64 67/*230*/ .long sys_select, sys_time, sys_nis_syscall, sys_stime, sys_statfs64
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index e2b050eb3b..9afd28e2c4 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -43,6 +43,25 @@ config SPARC64_PAGE_SIZE_4MB
43 43
44endchoice 44endchoice
45 45
46config SECCOMP
47 bool "Enable seccomp to safely compute untrusted bytecode"
48 depends on PROC_FS
49 default y
50 help
51 This kernel feature is useful for number crunching applications
52 that may need to compute untrusted bytecode during their
53 execution. By using pipes or other transports made available to
54 the process as file descriptors supporting the read/write
55 syscalls, it's possible to isolate those applications in
56 their own address space using seccomp. Once seccomp is
57 enabled via /proc/<pid>/seccomp, it cannot be disabled
58 and the task is only allowed to execute a few safe syscalls
59 defined by each seccomp mode.
60
61 If unsure, say Y. Only embedded should say N here.
62
63source kernel/Kconfig.hz
64
46source "init/Kconfig" 65source "init/Kconfig"
47 66
48config SYSVIPC_COMPAT 67config SYSVIPC_COMPAT
@@ -444,6 +463,24 @@ config PRINTER
444 If you have more than 8 printers, you need to increase the LP_NO 463 If you have more than 8 printers, you need to increase the LP_NO
445 macro in lp.c and the PARPORT_MAX macro in parport.h. 464 macro in lp.c and the PARPORT_MAX macro in parport.h.
446 465
466config PPDEV
467 tristate "Support for user-space parallel port device drivers"
468 depends on PARPORT
469 ---help---
470 Saying Y to this adds support for /dev/parport device nodes. This
471 is needed for programs that want portable access to the parallel
472 port, for instance deviceid (which displays Plug-and-Play device
473 IDs).
474
475 This is the parallel port equivalent of SCSI generic support (sg).
476 It is safe to say N to this -- it is not needed for normal printing
477 or parallel port CD-ROM/disk support.
478
479 To compile this driver as a module, choose M here: the
480 module will be called ppdev.
481
482 If unsure, say N.
483
447config ENVCTRL 484config ENVCTRL
448 tristate "SUNW, envctrl support" 485 tristate "SUNW, envctrl support"
449 depends on PCI 486 depends on PCI
@@ -488,6 +525,8 @@ source "mm/Kconfig"
488 525
489endmenu 526endmenu
490 527
528source "net/Kconfig"
529
491source "drivers/base/Kconfig" 530source "drivers/base/Kconfig"
492 531
493source "drivers/video/Kconfig" 532source "drivers/video/Kconfig"
@@ -514,7 +553,7 @@ endif
514 553
515source "drivers/ieee1394/Kconfig" 554source "drivers/ieee1394/Kconfig"
516 555
517source "net/Kconfig" 556source "drivers/net/Kconfig"
518 557
519source "drivers/isdn/Kconfig" 558source "drivers/isdn/Kconfig"
520 559
@@ -610,6 +649,8 @@ source "drivers/input/Kconfig"
610 649
611source "drivers/i2c/Kconfig" 650source "drivers/i2c/Kconfig"
612 651
652source "drivers/hwmon/Kconfig"
653
613source "fs/Kconfig" 654source "fs/Kconfig"
614 655
615source "drivers/media/Kconfig" 656source "drivers/media/Kconfig"
diff --git a/arch/sparc64/kernel/dtlb_backend.S b/arch/sparc64/kernel/dtlb_backend.S
index b73a3c8587..538522848a 100644
--- a/arch/sparc64/kernel/dtlb_backend.S
+++ b/arch/sparc64/kernel/dtlb_backend.S
@@ -16,7 +16,7 @@
16#elif PAGE_SHIFT == 19 16#elif PAGE_SHIFT == 19
17#define SZ_BITS _PAGE_SZ512K 17#define SZ_BITS _PAGE_SZ512K
18#elif PAGE_SHIFT == 22 18#elif PAGE_SHIFT == 22
19#define SZ_BITS _PAGE_SZ4M 19#define SZ_BITS _PAGE_SZ4MB
20#endif 20#endif
21 21
22#define VALID_SZ_BITS (_PAGE_VALID | SZ_BITS) 22#define VALID_SZ_BITS (_PAGE_VALID | SZ_BITS)
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index eee516a71c..d781f10adc 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -22,8 +22,6 @@
22#include <asm/estate.h> 22#include <asm/estate.h>
23#include <asm/auxio.h> 23#include <asm/auxio.h>
24 24
25/* #define SYSCALL_TRACING 1 */
26
27#define curptr g6 25#define curptr g6
28 26
29#define NR_SYSCALLS 284 /* Each OS is different... */ 27#define NR_SYSCALLS 284 /* Each OS is different... */
@@ -553,13 +551,11 @@ do_ivec:
553 sllx %g3, 5, %g3 551 sllx %g3, 5, %g3
554 or %g2, %lo(ivector_table), %g2 552 or %g2, %lo(ivector_table), %g2
555 add %g2, %g3, %g3 553 add %g2, %g3, %g3
556 ldx [%g3 + 0x08], %g2 /* irq_info */
557 ldub [%g3 + 0x04], %g4 /* pil */ 554 ldub [%g3 + 0x04], %g4 /* pil */
558 brz,pn %g2, do_ivec_spurious 555 mov 1, %g2
559 mov 1, %g2
560
561 sllx %g2, %g4, %g2 556 sllx %g2, %g4, %g2
562 sllx %g4, 2, %g4 557 sllx %g4, 2, %g4
558
563 lduw [%g6 + %g4], %g5 /* g5 = irq_work(cpu, pil) */ 559 lduw [%g6 + %g4], %g5 /* g5 = irq_work(cpu, pil) */
564 stw %g5, [%g3 + 0x00] /* bucket->irq_chain = g5 */ 560 stw %g5, [%g3 + 0x00] /* bucket->irq_chain = g5 */
565 stw %g3, [%g6 + %g4] /* irq_work(cpu, pil) = bucket */ 561 stw %g3, [%g6 + %g4] /* irq_work(cpu, pil) = bucket */
@@ -567,9 +563,9 @@ do_ivec:
567 retry 563 retry
568do_ivec_xcall: 564do_ivec_xcall:
569 mov 0x50, %g1 565 mov 0x50, %g1
570
571 ldxa [%g1 + %g0] ASI_INTR_R, %g1 566 ldxa [%g1 + %g0] ASI_INTR_R, %g1
572 srl %g3, 0, %g3 567 srl %g3, 0, %g3
568
573 mov 0x60, %g7 569 mov 0x60, %g7
574 ldxa [%g7 + %g0] ASI_INTR_R, %g7 570 ldxa [%g7 + %g0] ASI_INTR_R, %g7
575 stxa %g0, [%g0] ASI_INTR_RECEIVE 571 stxa %g0, [%g0] ASI_INTR_RECEIVE
@@ -581,19 +577,6 @@ do_ivec_xcall:
5811: jmpl %g3, %g0 5771: jmpl %g3, %g0
582 nop 578 nop
583 579
584do_ivec_spurious:
585 stw %g3, [%g6 + 0x00] /* irq_work(cpu, 0) = bucket */
586 rdpr %pstate, %g5
587
588 wrpr %g5, PSTATE_IG | PSTATE_AG, %pstate
589 sethi %hi(109f), %g7
590 ba,pt %xcc, etrap
591109: or %g7, %lo(109b), %g7
592 call catch_disabled_ivec
593 add %sp, PTREGS_OFF, %o0
594 ba,pt %xcc, rtrap
595 clr %l6
596
597 .globl save_alternate_globals 580 .globl save_alternate_globals
598save_alternate_globals: /* %o0 = save_area */ 581save_alternate_globals: /* %o0 = save_area */
599 rdpr %pstate, %o5 582 rdpr %pstate, %o5
@@ -1569,11 +1552,12 @@ sys_ptrace: add %sp, PTREGS_OFF, %o0
1569 nop 1552 nop
1570 .align 32 1553 .align 32
15711: ldx [%curptr + TI_FLAGS], %l5 15541: ldx [%curptr + TI_FLAGS], %l5
1572 andcc %l5, _TIF_SYSCALL_TRACE, %g0 1555 andcc %l5, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1573 be,pt %icc, rtrap 1556 be,pt %icc, rtrap
1574 clr %l6 1557 clr %l6
1558 add %sp, PTREGS_OFF, %o0
1575 call syscall_trace 1559 call syscall_trace
1576 nop 1560 mov 1, %o1
1577 1561
1578 ba,pt %xcc, rtrap 1562 ba,pt %xcc, rtrap
1579 clr %l6 1563 clr %l6
@@ -1657,18 +1641,20 @@ linux_sparc_ni_syscall:
1657 or %l7, %lo(sys_ni_syscall), %l7 1641 or %l7, %lo(sys_ni_syscall), %l7
1658 1642
1659linux_syscall_trace32: 1643linux_syscall_trace32:
1644 add %sp, PTREGS_OFF, %o0
1660 call syscall_trace 1645 call syscall_trace
1661 nop 1646 clr %o1
1662 srl %i0, 0, %o0 1647 srl %i0, 0, %o0
1663 mov %i4, %o4 1648 srl %i4, 0, %o4
1664 srl %i1, 0, %o1 1649 srl %i1, 0, %o1
1665 srl %i2, 0, %o2 1650 srl %i2, 0, %o2
1666 b,pt %xcc, 2f 1651 b,pt %xcc, 2f
1667 srl %i3, 0, %o3 1652 srl %i3, 0, %o3
1668 1653
1669linux_syscall_trace: 1654linux_syscall_trace:
1655 add %sp, PTREGS_OFF, %o0
1670 call syscall_trace 1656 call syscall_trace
1671 nop 1657 clr %o1
1672 mov %i0, %o0 1658 mov %i0, %o0
1673 mov %i1, %o1 1659 mov %i1, %o1
1674 mov %i2, %o2 1660 mov %i2, %o2
@@ -1686,11 +1672,6 @@ linux_sparc_syscall32:
1686 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI 1672 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
1687 srl %i0, 0, %o0 ! IEU0 1673 srl %i0, 0, %o0 ! IEU0
1688 sll %g1, 2, %l4 ! IEU0 Group 1674 sll %g1, 2, %l4 ! IEU0 Group
1689#ifdef SYSCALL_TRACING
1690 call syscall_trace_entry
1691 add %sp, PTREGS_OFF, %o0
1692 srl %i0, 0, %o0
1693#endif
1694 srl %i4, 0, %o4 ! IEU1 1675 srl %i4, 0, %o4 ! IEU1
1695 lduw [%l7 + %l4], %l7 ! Load 1676 lduw [%l7 + %l4], %l7 ! Load
1696 srl %i1, 0, %o1 ! IEU0 Group 1677 srl %i1, 0, %o1 ! IEU0 Group
@@ -1698,7 +1679,7 @@ linux_sparc_syscall32:
1698 1679
1699 srl %i5, 0, %o5 ! IEU1 1680 srl %i5, 0, %o5 ! IEU1
1700 srl %i2, 0, %o2 ! IEU0 Group 1681 srl %i2, 0, %o2 ! IEU0 Group
1701 andcc %l0, _TIF_SYSCALL_TRACE, %g0 ! IEU0 Group 1682 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1702 bne,pn %icc, linux_syscall_trace32 ! CTI 1683 bne,pn %icc, linux_syscall_trace32 ! CTI
1703 mov %i0, %l5 ! IEU1 1684 mov %i0, %l5 ! IEU1
1704 call %l7 ! CTI Group brk forced 1685 call %l7 ! CTI Group brk forced
@@ -1714,11 +1695,6 @@ linux_sparc_syscall:
1714 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI 1695 bgeu,pn %xcc, linux_sparc_ni_syscall ! CTI
1715 mov %i0, %o0 ! IEU0 1696 mov %i0, %o0 ! IEU0
1716 sll %g1, 2, %l4 ! IEU0 Group 1697 sll %g1, 2, %l4 ! IEU0 Group
1717#ifdef SYSCALL_TRACING
1718 call syscall_trace_entry
1719 add %sp, PTREGS_OFF, %o0
1720 mov %i0, %o0
1721#endif
1722 mov %i1, %o1 ! IEU1 1698 mov %i1, %o1 ! IEU1
1723 lduw [%l7 + %l4], %l7 ! Load 1699 lduw [%l7 + %l4], %l7 ! Load
17244: mov %i2, %o2 ! IEU0 Group 17004: mov %i2, %o2 ! IEU0 Group
@@ -1726,7 +1702,7 @@ linux_sparc_syscall:
1726 1702
1727 mov %i3, %o3 ! IEU1 1703 mov %i3, %o3 ! IEU1
1728 mov %i4, %o4 ! IEU0 Group 1704 mov %i4, %o4 ! IEU0 Group
1729 andcc %l0, _TIF_SYSCALL_TRACE, %g0 ! IEU1 Group+1 bubble 1705 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %g0
1730 bne,pn %icc, linux_syscall_trace ! CTI Group 1706 bne,pn %icc, linux_syscall_trace ! CTI Group
1731 mov %i0, %l5 ! IEU0 1707 mov %i0, %l5 ! IEU0
17322: call %l7 ! CTI Group brk forced 17082: call %l7 ! CTI Group brk forced
@@ -1735,12 +1711,6 @@ linux_sparc_syscall:
1735 1711
17363: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] 17123: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
1737ret_sys_call: 1713ret_sys_call:
1738#ifdef SYSCALL_TRACING
1739 mov %o0, %o1
1740 call syscall_trace_exit
1741 add %sp, PTREGS_OFF, %o0
1742 mov %o1, %o0
1743#endif
1744 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 1714 ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3
1745 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc 1715 ldx [%sp + PTREGS_OFF + PT_V9_TNPC], %l1 ! pc = npc
1746 sra %o0, 0, %o0 1716 sra %o0, 0, %o0
@@ -1760,7 +1730,7 @@ ret_sys_call:
17601: 17301:
1761 cmp %o0, -ERESTART_RESTARTBLOCK 1731 cmp %o0, -ERESTART_RESTARTBLOCK
1762 bgeu,pn %xcc, 1f 1732 bgeu,pn %xcc, 1f
1763 andcc %l0, _TIF_SYSCALL_TRACE, %l6 1733 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
176480: 173480:
1765 /* System call success, clear Carry condition code. */ 1735 /* System call success, clear Carry condition code. */
1766 andn %g3, %g2, %g3 1736 andn %g3, %g2, %g3
@@ -1775,7 +1745,7 @@ ret_sys_call:
1775 /* System call failure, set Carry condition code. 1745 /* System call failure, set Carry condition code.
1776 * Also, get abs(errno) to return to the process. 1746 * Also, get abs(errno) to return to the process.
1777 */ 1747 */
1778 andcc %l0, _TIF_SYSCALL_TRACE, %l6 1748 andcc %l0, (_TIF_SYSCALL_TRACE|_TIF_SECCOMP|_TIF_SYSCALL_AUDIT), %l6
1779 sub %g0, %o0, %o0 1749 sub %g0, %o0, %o0
1780 or %g3, %g2, %g3 1750 or %g3, %g2, %g3
1781 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] 1751 stx %o0, [%sp + PTREGS_OFF + PT_V9_I0]
@@ -1788,8 +1758,9 @@ ret_sys_call:
1788 b,pt %xcc, rtrap 1758 b,pt %xcc, rtrap
1789 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] 1759 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
1790linux_syscall_trace2: 1760linux_syscall_trace2:
1761 add %sp, PTREGS_OFF, %o0
1791 call syscall_trace 1762 call syscall_trace
1792 nop 1763 mov 1, %o1
1793 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC] 1764 stx %l1, [%sp + PTREGS_OFF + PT_V9_TPC]
1794 ba,pt %xcc, rtrap 1765 ba,pt %xcc, rtrap
1795 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] 1766 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC]
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index 4247125773..daa2fb9305 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -71,31 +71,7 @@ struct irq_work_struct {
71struct irq_work_struct __irq_work[NR_CPUS]; 71struct irq_work_struct __irq_work[NR_CPUS];
72#define irq_work(__cpu, __pil) &(__irq_work[(__cpu)].irq_worklists[(__pil)]) 72#define irq_work(__cpu, __pil) &(__irq_work[(__cpu)].irq_worklists[(__pil)])
73 73
74#ifdef CONFIG_PCI 74static struct irqaction *irq_action[NR_IRQS+1];
75/* This is a table of physical addresses used to deal with IBF_DMA_SYNC.
76 * It is used for PCI only to synchronize DMA transfers with IRQ delivery
77 * for devices behind busses other than APB on Sabre systems.
78 *
79 * Currently these physical addresses are just config space accesses
80 * to the command register for that device.
81 */
82unsigned long pci_dma_wsync;
83unsigned long dma_sync_reg_table[256];
84unsigned char dma_sync_reg_table_entry = 0;
85#endif
86
87/* This is based upon code in the 32-bit Sparc kernel written mostly by
88 * David Redman (djhr@tadpole.co.uk).
89 */
90#define MAX_STATIC_ALLOC 4
91static struct irqaction static_irqaction[MAX_STATIC_ALLOC];
92static int static_irq_count;
93
94/* This is exported so that fast IRQ handlers can get at it... -DaveM */
95struct irqaction *irq_action[NR_IRQS+1] = {
96 NULL, NULL, NULL, NULL, NULL, NULL , NULL, NULL,
97 NULL, NULL, NULL, NULL, NULL, NULL , NULL, NULL
98};
99 75
100/* This only synchronizes entities which modify IRQ handler 76/* This only synchronizes entities which modify IRQ handler
101 * state and some selected user-level spots that want to 77 * state and some selected user-level spots that want to
@@ -241,17 +217,22 @@ void disable_irq(unsigned int irq)
241 * the CPU %tick register and not by some normal vectored interrupt 217 * the CPU %tick register and not by some normal vectored interrupt
242 * source. To handle this special case, we use this dummy INO bucket. 218 * source. To handle this special case, we use this dummy INO bucket.
243 */ 219 */
220static struct irq_desc pil0_dummy_desc;
244static struct ino_bucket pil0_dummy_bucket = { 221static struct ino_bucket pil0_dummy_bucket = {
245 0, /* irq_chain */ 222 .irq_info = &pil0_dummy_desc,
246 0, /* pil */
247 0, /* pending */
248 0, /* flags */
249 0, /* __unused */
250 NULL, /* irq_info */
251 0UL, /* iclr */
252 0UL, /* imap */
253}; 223};
254 224
225static void build_irq_error(const char *msg, unsigned int ino, int pil, int inofixup,
226 unsigned long iclr, unsigned long imap,
227 struct ino_bucket *bucket)
228{
229 prom_printf("IRQ: INO %04x (%d:%016lx:%016lx) --> "
230 "(%d:%d:%016lx:%016lx), halting...\n",
231 ino, bucket->pil, bucket->iclr, bucket->imap,
232 pil, inofixup, iclr, imap);
233 prom_halt();
234}
235
255unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long imap) 236unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long imap)
256{ 237{
257 struct ino_bucket *bucket; 238 struct ino_bucket *bucket;
@@ -280,28 +261,35 @@ unsigned int build_irq(int pil, int inofixup, unsigned long iclr, unsigned long
280 prom_halt(); 261 prom_halt();
281 } 262 }
282 263
283 /* Ok, looks good, set it up. Don't touch the irq_chain or
284 * the pending flag.
285 */
286 bucket = &ivector_table[ino]; 264 bucket = &ivector_table[ino];
287 if ((bucket->flags & IBF_ACTIVE) || 265 if (bucket->flags & IBF_ACTIVE)
288 (bucket->irq_info != NULL)) { 266 build_irq_error("IRQ: Trying to build active INO bucket.\n",
289 /* This is a gross fatal error if it happens here. */ 267 ino, pil, inofixup, iclr, imap, bucket);
290 prom_printf("IRQ: Trying to reinit INO bucket, fatal error.\n"); 268
291 prom_printf("IRQ: Request INO %04x (%d:%d:%016lx:%016lx)\n", 269 if (bucket->irq_info) {
292 ino, pil, inofixup, iclr, imap); 270 if (bucket->imap != imap || bucket->iclr != iclr)
293 prom_printf("IRQ: Existing (%d:%016lx:%016lx)\n", 271 build_irq_error("IRQ: Trying to reinit INO bucket.\n",
294 bucket->pil, bucket->iclr, bucket->imap); 272 ino, pil, inofixup, iclr, imap, bucket);
295 prom_printf("IRQ: Cannot continue, halting...\n"); 273
274 goto out;
275 }
276
277 bucket->irq_info = kmalloc(sizeof(struct irq_desc), GFP_ATOMIC);
278 if (!bucket->irq_info) {
279 prom_printf("IRQ: Error, kmalloc(irq_desc) failed.\n");
296 prom_halt(); 280 prom_halt();
297 } 281 }
282 memset(bucket->irq_info, 0, sizeof(struct irq_desc));
283
284 /* Ok, looks good, set it up. Don't touch the irq_chain or
285 * the pending flag.
286 */
298 bucket->imap = imap; 287 bucket->imap = imap;
299 bucket->iclr = iclr; 288 bucket->iclr = iclr;
300 bucket->pil = pil; 289 bucket->pil = pil;
301 bucket->flags = 0; 290 bucket->flags = 0;
302 291
303 bucket->irq_info = NULL; 292out:
304
305 return __irq(bucket); 293 return __irq(bucket);
306} 294}
307 295
@@ -319,26 +307,65 @@ static void atomic_bucket_insert(struct ino_bucket *bucket)
319 __asm__ __volatile__("wrpr %0, 0x0, %%pstate" : : "r" (pstate)); 307 __asm__ __volatile__("wrpr %0, 0x0, %%pstate" : : "r" (pstate));
320} 308}
321 309
310static int check_irq_sharing(int pil, unsigned long irqflags)
311{
312 struct irqaction *action, *tmp;
313
314 action = *(irq_action + pil);
315 if (action) {
316 if ((action->flags & SA_SHIRQ) && (irqflags & SA_SHIRQ)) {
317 for (tmp = action; tmp->next; tmp = tmp->next)
318 ;
319 } else {
320 return -EBUSY;
321 }
322 }
323 return 0;
324}
325
326static void append_irq_action(int pil, struct irqaction *action)
327{
328 struct irqaction **pp = irq_action + pil;
329
330 while (*pp)
331 pp = &((*pp)->next);
332 *pp = action;
333}
334
335static struct irqaction *get_action_slot(struct ino_bucket *bucket)
336{
337 struct irq_desc *desc = bucket->irq_info;
338 int max_irq, i;
339
340 max_irq = 1;
341 if (bucket->flags & IBF_PCI)
342 max_irq = MAX_IRQ_DESC_ACTION;
343 for (i = 0; i < max_irq; i++) {
344 struct irqaction *p = &desc->action[i];
345 u32 mask = (1 << i);
346
347 if (desc->action_active_mask & mask)
348 continue;
349
350 desc->action_active_mask |= mask;
351 return p;
352 }
353 return NULL;
354}
355
322int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *), 356int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
323 unsigned long irqflags, const char *name, void *dev_id) 357 unsigned long irqflags, const char *name, void *dev_id)
324{ 358{
325 struct irqaction *action, *tmp = NULL; 359 struct irqaction *action;
326 struct ino_bucket *bucket = __bucket(irq); 360 struct ino_bucket *bucket = __bucket(irq);
327 unsigned long flags; 361 unsigned long flags;
328 int pending = 0; 362 int pending = 0;
329 363
330 if ((bucket != &pil0_dummy_bucket) && 364 if (unlikely(!handler))
331 (bucket < &ivector_table[0] ||
332 bucket >= &ivector_table[NUM_IVECS])) {
333 unsigned int *caller;
334
335 __asm__ __volatile__("mov %%i7, %0" : "=r" (caller));
336 printk(KERN_CRIT "request_irq: Old style IRQ registry attempt "
337 "from %p, irq %08x.\n", caller, irq);
338 return -EINVAL; 365 return -EINVAL;
339 } 366
340 if (!handler) 367 if (unlikely(!bucket->irq_info))
341 return -EINVAL; 368 return -ENODEV;
342 369
343 if ((bucket != &pil0_dummy_bucket) && (irqflags & SA_SAMPLE_RANDOM)) { 370 if ((bucket != &pil0_dummy_bucket) && (irqflags & SA_SAMPLE_RANDOM)) {
344 /* 371 /*
@@ -356,93 +383,20 @@ int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_
356 383
357 spin_lock_irqsave(&irq_action_lock, flags); 384 spin_lock_irqsave(&irq_action_lock, flags);
358 385
359 action = *(bucket->pil + irq_action); 386 if (check_irq_sharing(bucket->pil, irqflags)) {
360 if (action) { 387 spin_unlock_irqrestore(&irq_action_lock, flags);
361 if ((action->flags & SA_SHIRQ) && (irqflags & SA_SHIRQ)) 388 return -EBUSY;
362 for (tmp = action; tmp->next; tmp = tmp->next)
363 ;
364 else {
365 spin_unlock_irqrestore(&irq_action_lock, flags);
366 return -EBUSY;
367 }
368 action = NULL; /* Or else! */
369 } 389 }
370 390
371 /* If this is flagged as statically allocated then we use our 391 action = get_action_slot(bucket);
372 * private struct which is never freed.
373 */
374 if (irqflags & SA_STATIC_ALLOC) {
375 if (static_irq_count < MAX_STATIC_ALLOC)
376 action = &static_irqaction[static_irq_count++];
377 else
378 printk("Request for IRQ%d (%s) SA_STATIC_ALLOC failed "
379 "using kmalloc\n", irq, name);
380 }
381 if (action == NULL)
382 action = (struct irqaction *)kmalloc(sizeof(struct irqaction),
383 GFP_ATOMIC);
384
385 if (!action) { 392 if (!action) {
386 spin_unlock_irqrestore(&irq_action_lock, flags); 393 spin_unlock_irqrestore(&irq_action_lock, flags);
387 return -ENOMEM; 394 return -ENOMEM;
388 } 395 }
389 396
390 if (bucket == &pil0_dummy_bucket) { 397 bucket->flags |= IBF_ACTIVE;
391 bucket->irq_info = action; 398 pending = 0;
392 bucket->flags |= IBF_ACTIVE; 399 if (bucket != &pil0_dummy_bucket) {
393 } else {
394 if ((bucket->flags & IBF_ACTIVE) != 0) {
395 void *orig = bucket->irq_info;
396 void **vector = NULL;
397
398 if ((bucket->flags & IBF_PCI) == 0) {
399 printk("IRQ: Trying to share non-PCI bucket.\n");
400 goto free_and_ebusy;
401 }
402 if ((bucket->flags & IBF_MULTI) == 0) {
403 vector = kmalloc(sizeof(void *) * 4, GFP_ATOMIC);
404 if (vector == NULL)
405 goto free_and_enomem;
406
407 /* We might have slept. */
408 if ((bucket->flags & IBF_MULTI) != 0) {
409 int ent;
410
411 kfree(vector);
412 vector = (void **)bucket->irq_info;
413 for(ent = 0; ent < 4; ent++) {
414 if (vector[ent] == NULL) {
415 vector[ent] = action;
416 break;
417 }
418 }
419 if (ent == 4)
420 goto free_and_ebusy;
421 } else {
422 vector[0] = orig;
423 vector[1] = action;
424 vector[2] = NULL;
425 vector[3] = NULL;
426 bucket->irq_info = vector;
427 bucket->flags |= IBF_MULTI;
428 }
429 } else {
430 int ent;
431
432 vector = (void **)orig;
433 for (ent = 0; ent < 4; ent++) {
434 if (vector[ent] == NULL) {
435 vector[ent] = action;
436 break;
437 }
438 }
439 if (ent == 4)
440 goto free_and_ebusy;
441 }
442 } else {
443 bucket->irq_info = action;
444 bucket->flags |= IBF_ACTIVE;
445 }
446 pending = bucket->pending; 400 pending = bucket->pending;
447 if (pending) 401 if (pending)
448 bucket->pending = 0; 402 bucket->pending = 0;
@@ -456,10 +410,7 @@ int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_
456 put_ino_in_irqaction(action, irq); 410 put_ino_in_irqaction(action, irq);
457 put_smpaff_in_irqaction(action, CPU_MASK_NONE); 411 put_smpaff_in_irqaction(action, CPU_MASK_NONE);
458 412
459 if (tmp) 413 append_irq_action(bucket->pil, action);
460 tmp->next = action;
461 else
462 *(bucket->pil + irq_action) = action;
463 414
464 enable_irq(irq); 415 enable_irq(irq);
465 416
@@ -468,147 +419,103 @@ int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_
468 atomic_bucket_insert(bucket); 419 atomic_bucket_insert(bucket);
469 set_softint(1 << bucket->pil); 420 set_softint(1 << bucket->pil);
470 } 421 }
422
471 spin_unlock_irqrestore(&irq_action_lock, flags); 423 spin_unlock_irqrestore(&irq_action_lock, flags);
472 if ((bucket != &pil0_dummy_bucket) && (!(irqflags & SA_STATIC_ALLOC))) 424
425 if (bucket != &pil0_dummy_bucket)
473 register_irq_proc(__irq_ino(irq)); 426 register_irq_proc(__irq_ino(irq));
474 427
475#ifdef CONFIG_SMP 428#ifdef CONFIG_SMP
476 distribute_irqs(); 429 distribute_irqs();
477#endif 430#endif
478 return 0; 431 return 0;
479
480free_and_ebusy:
481 kfree(action);
482 spin_unlock_irqrestore(&irq_action_lock, flags);
483 return -EBUSY;
484
485free_and_enomem:
486 kfree(action);
487 spin_unlock_irqrestore(&irq_action_lock, flags);
488 return -ENOMEM;
489} 432}
490 433
491EXPORT_SYMBOL(request_irq); 434EXPORT_SYMBOL(request_irq);
492 435
493void free_irq(unsigned int irq, void *dev_id) 436static struct irqaction *unlink_irq_action(unsigned int irq, void *dev_id)
494{ 437{
495 struct irqaction *action; 438 struct ino_bucket *bucket = __bucket(irq);
496 struct irqaction *tmp = NULL; 439 struct irqaction *action, **pp;
497 unsigned long flags;
498 struct ino_bucket *bucket = __bucket(irq), *bp;
499 440
500 if ((bucket != &pil0_dummy_bucket) && 441 pp = irq_action + bucket->pil;
501 (bucket < &ivector_table[0] || 442 action = *pp;
502 bucket >= &ivector_table[NUM_IVECS])) { 443 if (unlikely(!action))
503 unsigned int *caller; 444 return NULL;
504 445
505 __asm__ __volatile__("mov %%i7, %0" : "=r" (caller)); 446 if (unlikely(!action->handler)) {
506 printk(KERN_CRIT "free_irq: Old style IRQ removal attempt "
507 "from %p, irq %08x.\n", caller, irq);
508 return;
509 }
510
511 spin_lock_irqsave(&irq_action_lock, flags);
512
513 action = *(bucket->pil + irq_action);
514 if (!action->handler) {
515 printk("Freeing free IRQ %d\n", bucket->pil); 447 printk("Freeing free IRQ %d\n", bucket->pil);
516 return; 448 return NULL;
517 }
518 if (dev_id) {
519 for ( ; action; action = action->next) {
520 if (action->dev_id == dev_id)
521 break;
522 tmp = action;
523 }
524 if (!action) {
525 printk("Trying to free free shared IRQ %d\n", bucket->pil);
526 spin_unlock_irqrestore(&irq_action_lock, flags);
527 return;
528 }
529 } else if (action->flags & SA_SHIRQ) {
530 printk("Trying to free shared IRQ %d with NULL device ID\n", bucket->pil);
531 spin_unlock_irqrestore(&irq_action_lock, flags);
532 return;
533 } 449 }
534 450
535 if (action->flags & SA_STATIC_ALLOC) { 451 while (action && action->dev_id != dev_id) {
536 printk("Attempt to free statically allocated IRQ %d (%s)\n", 452 pp = &action->next;
537 bucket->pil, action->name); 453 action = *pp;
538 spin_unlock_irqrestore(&irq_action_lock, flags);
539 return;
540 } 454 }
541 455
542 if (action && tmp) 456 if (likely(action))
543 tmp->next = action->next; 457 *pp = action->next;
544 else 458
545 *(bucket->pil + irq_action) = action->next; 459 return action;
460}
461
462void free_irq(unsigned int irq, void *dev_id)
463{
464 struct irqaction *action;
465 struct ino_bucket *bucket;
466 unsigned long flags;
467
468 spin_lock_irqsave(&irq_action_lock, flags);
469
470 action = unlink_irq_action(irq, dev_id);
546 471
547 spin_unlock_irqrestore(&irq_action_lock, flags); 472 spin_unlock_irqrestore(&irq_action_lock, flags);
548 473
474 if (unlikely(!action))
475 return;
476
549 synchronize_irq(irq); 477 synchronize_irq(irq);
550 478
551 spin_lock_irqsave(&irq_action_lock, flags); 479 spin_lock_irqsave(&irq_action_lock, flags);
552 480
481 bucket = __bucket(irq);
553 if (bucket != &pil0_dummy_bucket) { 482 if (bucket != &pil0_dummy_bucket) {
483 struct irq_desc *desc = bucket->irq_info;
554 unsigned long imap = bucket->imap; 484 unsigned long imap = bucket->imap;
555 void **vector, *orig; 485 int ent, i;
556 int ent;
557
558 orig = bucket->irq_info;
559 vector = (void **)orig;
560
561 if ((bucket->flags & IBF_MULTI) != 0) {
562 int other = 0;
563 void *orphan = NULL;
564 for (ent = 0; ent < 4; ent++) {
565 if (vector[ent] == action)
566 vector[ent] = NULL;
567 else if (vector[ent] != NULL) {
568 orphan = vector[ent];
569 other++;
570 }
571 }
572 486
573 /* Only free when no other shared irq 487 for (i = 0; i < MAX_IRQ_DESC_ACTION; i++) {
574 * uses this bucket. 488 struct irqaction *p = &desc->action[i];
575 */ 489
576 if (other) { 490 if (p == action) {
577 if (other == 1) { 491 desc->action_active_mask &= ~(1 << i);
578 /* Convert back to non-shared bucket. */ 492 break;
579 bucket->irq_info = orphan;
580 bucket->flags &= ~(IBF_MULTI);
581 kfree(vector);
582 }
583 goto out;
584 } 493 }
585 } else {
586 bucket->irq_info = NULL;
587 } 494 }
588 495
589 /* This unique interrupt source is now inactive. */ 496 if (!desc->action_active_mask) {
590 bucket->flags &= ~IBF_ACTIVE; 497 /* This unique interrupt source is now inactive. */
498 bucket->flags &= ~IBF_ACTIVE;
591 499
592 /* See if any other buckets share this bucket's IMAP 500 /* See if any other buckets share this bucket's IMAP
593 * and are still active. 501 * and are still active.
594 */ 502 */
595 for (ent = 0; ent < NUM_IVECS; ent++) { 503 for (ent = 0; ent < NUM_IVECS; ent++) {
596 bp = &ivector_table[ent]; 504 struct ino_bucket *bp = &ivector_table[ent];
597 if (bp != bucket && 505 if (bp != bucket &&
598 bp->imap == imap && 506 bp->imap == imap &&
599 (bp->flags & IBF_ACTIVE) != 0) 507 (bp->flags & IBF_ACTIVE) != 0)
600 break; 508 break;
601 } 509 }
602 510
603 /* Only disable when no other sub-irq levels of 511 /* Only disable when no other sub-irq levels of
604 * the same IMAP are active. 512 * the same IMAP are active.
605 */ 513 */
606 if (ent == NUM_IVECS) 514 if (ent == NUM_IVECS)
607 disable_irq(irq); 515 disable_irq(irq);
516 }
608 } 517 }
609 518
610out:
611 kfree(action);
612 spin_unlock_irqrestore(&irq_action_lock, flags); 519 spin_unlock_irqrestore(&irq_action_lock, flags);
613} 520}
614 521
@@ -647,99 +554,55 @@ void synchronize_irq(unsigned int irq)
647} 554}
648#endif /* CONFIG_SMP */ 555#endif /* CONFIG_SMP */
649 556
650void catch_disabled_ivec(struct pt_regs *regs) 557static void process_bucket(int irq, struct ino_bucket *bp, struct pt_regs *regs)
651{ 558{
652 int cpu = smp_processor_id(); 559 struct irq_desc *desc = bp->irq_info;
653 struct ino_bucket *bucket = __bucket(*irq_work(cpu, 0)); 560 unsigned char flags = bp->flags;
561 u32 action_mask, i;
562 int random;
654 563
655 /* We can actually see this on Ultra/PCI PCI cards, which are bridges 564 bp->flags |= IBF_INPROGRESS;
656 * to other devices. Here a single IMAP enabled potentially multiple
657 * unique interrupt sources (which each do have a unique ICLR register.
658 *
659 * So what we do is just register that the IVEC arrived, when registered
660 * for real the request_irq() code will check the bit and signal
661 * a local CPU interrupt for it.
662 */
663#if 0
664 printk("IVEC: Spurious interrupt vector (%x) received at (%016lx)\n",
665 bucket - &ivector_table[0], regs->tpc);
666#endif
667 *irq_work(cpu, 0) = 0;
668 bucket->pending = 1;
669}
670
671/* Tune this... */
672#define FORWARD_VOLUME 12
673
674#ifdef CONFIG_SMP
675
676static inline void redirect_intr(int cpu, struct ino_bucket *bp)
677{
678 /* Ok, here is what is going on:
679 * 1) Retargeting IRQs on Starfire is very
680 * expensive so just forget about it on them.
681 * 2) Moving around very high priority interrupts
682 * is a losing game.
683 * 3) If the current cpu is idle, interrupts are
684 * useful work, so keep them here. But do not
685 * pass to our neighbour if he is not very idle.
686 * 4) If sysadmin explicitly asks for directed intrs,
687 * Just Do It.
688 */
689 struct irqaction *ap = bp->irq_info;
690 cpumask_t cpu_mask;
691 unsigned int buddy, ticks;
692 565
693 cpu_mask = get_smpaff_in_irqaction(ap); 566 if (unlikely(!(flags & IBF_ACTIVE))) {
694 cpus_and(cpu_mask, cpu_mask, cpu_online_map); 567 bp->pending = 1;
695 if (cpus_empty(cpu_mask))
696 cpu_mask = cpu_online_map;
697
698 if (this_is_starfire != 0 ||
699 bp->pil >= 10 || current->pid == 0)
700 goto out; 568 goto out;
701
702 /* 'cpu' is the MID (ie. UPAID), calculate the MID
703 * of our buddy.
704 */
705 buddy = cpu + 1;
706 if (buddy >= NR_CPUS)
707 buddy = 0;
708
709 ticks = 0;
710 while (!cpu_isset(buddy, cpu_mask)) {
711 if (++buddy >= NR_CPUS)
712 buddy = 0;
713 if (++ticks > NR_CPUS) {
714 put_smpaff_in_irqaction(ap, CPU_MASK_NONE);
715 goto out;
716 }
717 } 569 }
718 570
719 if (buddy == cpu) 571 if (desc->pre_handler)
720 goto out; 572 desc->pre_handler(bp,
573 desc->pre_handler_arg1,
574 desc->pre_handler_arg2);
721 575
722 /* Voo-doo programming. */ 576 action_mask = desc->action_active_mask;
723 if (cpu_data(buddy).idle_volume < FORWARD_VOLUME) 577 random = 0;
724 goto out; 578 for (i = 0; i < MAX_IRQ_DESC_ACTION; i++) {
579 struct irqaction *p = &desc->action[i];
580 u32 mask = (1 << i);
725 581
726 /* This just so happens to be correct on Cheetah 582 if (!(action_mask & mask))
727 * at the moment. 583 continue;
728 */
729 buddy <<= 26;
730 584
731 /* Push it to our buddy. */ 585 action_mask &= ~mask;
732 upa_writel(buddy | IMAP_VALID, bp->imap);
733 586
587 if (p->handler(__irq(bp), p->dev_id, regs) == IRQ_HANDLED)
588 random |= p->flags;
589
590 if (!action_mask)
591 break;
592 }
593 if (bp->pil != 0) {
594 upa_writel(ICLR_IDLE, bp->iclr);
595 /* Test and add entropy */
596 if (random & SA_SAMPLE_RANDOM)
597 add_interrupt_randomness(irq);
598 }
734out: 599out:
735 return; 600 bp->flags &= ~IBF_INPROGRESS;
736} 601}
737 602
738#endif
739
740void handler_irq(int irq, struct pt_regs *regs) 603void handler_irq(int irq, struct pt_regs *regs)
741{ 604{
742 struct ino_bucket *bp, *nbp; 605 struct ino_bucket *bp;
743 int cpu = smp_processor_id(); 606 int cpu = smp_processor_id();
744 607
745#ifndef CONFIG_SMP 608#ifndef CONFIG_SMP
@@ -757,8 +620,6 @@ void handler_irq(int irq, struct pt_regs *regs)
757 clear_softint(clr_mask); 620 clear_softint(clr_mask);
758 } 621 }
759#else 622#else
760 int should_forward = 0;
761
762 clear_softint(1 << irq); 623 clear_softint(1 << irq);
763#endif 624#endif
764 625
@@ -773,63 +634,12 @@ void handler_irq(int irq, struct pt_regs *regs)
773#else 634#else
774 bp = __bucket(xchg32(irq_work(cpu, irq), 0)); 635 bp = __bucket(xchg32(irq_work(cpu, irq), 0));
775#endif 636#endif
776 for ( ; bp != NULL; bp = nbp) { 637 while (bp) {
777 unsigned char flags = bp->flags; 638 struct ino_bucket *nbp = __bucket(bp->irq_chain);
778 unsigned char random = 0;
779 639
780 nbp = __bucket(bp->irq_chain);
781 bp->irq_chain = 0; 640 bp->irq_chain = 0;
782 641 process_bucket(irq, bp, regs);
783 bp->flags |= IBF_INPROGRESS; 642 bp = nbp;
784
785 if ((flags & IBF_ACTIVE) != 0) {
786#ifdef CONFIG_PCI
787 if ((flags & IBF_DMA_SYNC) != 0) {
788 upa_readl(dma_sync_reg_table[bp->synctab_ent]);
789 upa_readq(pci_dma_wsync);
790 }
791#endif
792 if ((flags & IBF_MULTI) == 0) {
793 struct irqaction *ap = bp->irq_info;
794 int ret;
795
796 ret = ap->handler(__irq(bp), ap->dev_id, regs);
797 if (ret == IRQ_HANDLED)
798 random |= ap->flags;
799 } else {
800 void **vector = (void **)bp->irq_info;
801 int ent;
802 for (ent = 0; ent < 4; ent++) {
803 struct irqaction *ap = vector[ent];
804 if (ap != NULL) {
805 int ret;
806
807 ret = ap->handler(__irq(bp),
808 ap->dev_id,
809 regs);
810 if (ret == IRQ_HANDLED)
811 random |= ap->flags;
812 }
813 }
814 }
815 /* Only the dummy bucket lacks IMAP/ICLR. */
816 if (bp->pil != 0) {
817#ifdef CONFIG_SMP
818 if (should_forward) {
819 redirect_intr(cpu, bp);
820 should_forward = 0;
821 }
822#endif
823 upa_writel(ICLR_IDLE, bp->iclr);
824
825 /* Test and add entropy */
826 if (random & SA_SAMPLE_RANDOM)
827 add_interrupt_randomness(irq);
828 }
829 } else
830 bp->pending = 1;
831
832 bp->flags &= ~IBF_INPROGRESS;
833 } 643 }
834 irq_exit(); 644 irq_exit();
835} 645}
@@ -959,7 +769,10 @@ static void distribute_irqs(void)
959 */ 769 */
960 for (level = 1; level < NR_IRQS; level++) { 770 for (level = 1; level < NR_IRQS; level++) {
961 struct irqaction *p = irq_action[level]; 771 struct irqaction *p = irq_action[level];
962 if (level == 12) continue; 772
773 if (level == 12)
774 continue;
775
963 while(p) { 776 while(p) {
964 cpu = retarget_one_irq(p, cpu); 777 cpu = retarget_one_irq(p, cpu);
965 p = p->next; 778 p = p->next;
@@ -1104,7 +917,8 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off,
1104 int count, int *eof, void *data) 917 int count, int *eof, void *data)
1105{ 918{
1106 struct ino_bucket *bp = ivector_table + (long)data; 919 struct ino_bucket *bp = ivector_table + (long)data;
1107 struct irqaction *ap = bp->irq_info; 920 struct irq_desc *desc = bp->irq_info;
921 struct irqaction *ap = desc->action;
1108 cpumask_t mask; 922 cpumask_t mask;
1109 int len; 923 int len;
1110 924
@@ -1122,11 +936,13 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off,
1122static inline void set_intr_affinity(int irq, cpumask_t hw_aff) 936static inline void set_intr_affinity(int irq, cpumask_t hw_aff)
1123{ 937{
1124 struct ino_bucket *bp = ivector_table + irq; 938 struct ino_bucket *bp = ivector_table + irq;
939 struct irq_desc *desc = bp->irq_info;
940 struct irqaction *ap = desc->action;
1125 941
1126 /* Users specify affinity in terms of hw cpu ids. 942 /* Users specify affinity in terms of hw cpu ids.
1127 * As soon as we do this, handler_irq() might see and take action. 943 * As soon as we do this, handler_irq() might see and take action.
1128 */ 944 */
1129 put_smpaff_in_irqaction((struct irqaction *)bp->irq_info, hw_aff); 945 put_smpaff_in_irqaction(ap, hw_aff);
1130 946
1131 /* Migration is simply done by the next cpu to service this 947 /* Migration is simply done by the next cpu to service this
1132 * interrupt. 948 * interrupt.
diff --git a/arch/sparc64/kernel/kprobes.c b/arch/sparc64/kernel/kprobes.c
index bdac631cf0..bbf11f85da 100644
--- a/arch/sparc64/kernel/kprobes.c
+++ b/arch/sparc64/kernel/kprobes.c
@@ -433,3 +433,8 @@ int longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
433 return 0; 433 return 0;
434} 434}
435 435
436/* architecture specific initialization */
437int arch_init_kprobes(void)
438{
439 return 0;
440}
diff --git a/arch/sparc64/kernel/pci_psycho.c b/arch/sparc64/kernel/pci_psycho.c
index 534320ef0d..91ab466d6c 100644
--- a/arch/sparc64/kernel/pci_psycho.c
+++ b/arch/sparc64/kernel/pci_psycho.c
@@ -1303,8 +1303,7 @@ static void psycho_controller_hwinit(struct pci_controller_info *p)
1303{ 1303{
1304 u64 tmp; 1304 u64 tmp;
1305 1305
1306 /* PROM sets the IRQ retry value too low, increase it. */ 1306 psycho_write(p->pbm_A.controller_regs + PSYCHO_IRQ_RETRY, 5);
1307 psycho_write(p->pbm_A.controller_regs + PSYCHO_IRQ_RETRY, 0xff);
1308 1307
1309 /* Enable arbiter for all PCI slots. */ 1308 /* Enable arbiter for all PCI slots. */
1310 tmp = psycho_read(p->pbm_A.controller_regs + PSYCHO_PCIA_CTRL); 1309 tmp = psycho_read(p->pbm_A.controller_regs + PSYCHO_PCIA_CTRL);
diff --git a/arch/sparc64/kernel/pci_sabre.c b/arch/sparc64/kernel/pci_sabre.c
index 53d333b4a4..52bf3431a4 100644
--- a/arch/sparc64/kernel/pci_sabre.c
+++ b/arch/sparc64/kernel/pci_sabre.c
@@ -595,6 +595,23 @@ static int __init sabre_ino_to_pil(struct pci_dev *pdev, unsigned int ino)
595 return ret; 595 return ret;
596} 596}
597 597
598/* When a device lives behind a bridge deeper in the PCI bus topology
599 * than APB, a special sequence must run to make sure all pending DMA
600 * transfers at the time of IRQ delivery are visible in the coherency
601 * domain by the cpu. This sequence is to perform a read on the far
602 * side of the non-APB bridge, then perform a read of Sabre's DMA
603 * write-sync register.
604 */
605static void sabre_wsync_handler(struct ino_bucket *bucket, void *_arg1, void *_arg2)
606{
607 struct pci_dev *pdev = _arg1;
608 unsigned long sync_reg = (unsigned long) _arg2;
609 u16 _unused;
610
611 pci_read_config_word(pdev, PCI_VENDOR_ID, &_unused);
612 sabre_read(sync_reg);
613}
614
598static unsigned int __init sabre_irq_build(struct pci_pbm_info *pbm, 615static unsigned int __init sabre_irq_build(struct pci_pbm_info *pbm,
599 struct pci_dev *pdev, 616 struct pci_dev *pdev,
600 unsigned int ino) 617 unsigned int ino)
@@ -639,24 +656,14 @@ static unsigned int __init sabre_irq_build(struct pci_pbm_info *pbm,
639 if (pdev) { 656 if (pdev) {
640 struct pcidev_cookie *pcp = pdev->sysdata; 657 struct pcidev_cookie *pcp = pdev->sysdata;
641 658
642 /* When a device lives behind a bridge deeper in the
643 * PCI bus topology than APB, a special sequence must
644 * run to make sure all pending DMA transfers at the
645 * time of IRQ delivery are visible in the coherency
646 * domain by the cpu. This sequence is to perform
647 * a read on the far side of the non-APB bridge, then
648 * perform a read of Sabre's DMA write-sync register.
649 *
650 * Currently, the PCI_CONFIG register for the device
651 * is used for this read from the far side of the bridge.
652 */
653 if (pdev->bus->number != pcp->pbm->pci_first_busno) { 659 if (pdev->bus->number != pcp->pbm->pci_first_busno) {
654 bucket->flags |= IBF_DMA_SYNC; 660 struct pci_controller_info *p = pcp->pbm->parent;
655 bucket->synctab_ent = dma_sync_reg_table_entry++; 661 struct irq_desc *d = bucket->irq_info;
656 dma_sync_reg_table[bucket->synctab_ent] = 662
657 (unsigned long) sabre_pci_config_mkaddr( 663 d->pre_handler = sabre_wsync_handler;
658 pcp->pbm, 664 d->pre_handler_arg1 = pdev;
659 pdev->bus->number, pdev->devfn, PCI_COMMAND); 665 d->pre_handler_arg2 = (void *)
666 p->pbm_A.controller_regs + SABRE_WRSYNC;
660 } 667 }
661 } 668 }
662 return __irq(bucket); 669 return __irq(bucket);
@@ -1626,10 +1633,9 @@ void __init sabre_init(int pnode, char *model_name)
1626 */ 1633 */
1627 p->pbm_A.controller_regs = pr_regs[0].phys_addr; 1634 p->pbm_A.controller_regs = pr_regs[0].phys_addr;
1628 p->pbm_B.controller_regs = pr_regs[0].phys_addr; 1635 p->pbm_B.controller_regs = pr_regs[0].phys_addr;
1629 pci_dma_wsync = p->pbm_A.controller_regs + SABRE_WRSYNC;
1630 1636
1631 printk("PCI: Found SABRE, main regs at %016lx, wsync at %016lx\n", 1637 printk("PCI: Found SABRE, main regs at %016lx\n",
1632 p->pbm_A.controller_regs, pci_dma_wsync); 1638 p->pbm_A.controller_regs);
1633 1639
1634 /* Clear interrupts */ 1640 /* Clear interrupts */
1635 1641
diff --git a/arch/sparc64/kernel/pci_schizo.c b/arch/sparc64/kernel/pci_schizo.c
index 5753175b94..6a182bb662 100644
--- a/arch/sparc64/kernel/pci_schizo.c
+++ b/arch/sparc64/kernel/pci_schizo.c
@@ -15,6 +15,7 @@
15#include <asm/iommu.h> 15#include <asm/iommu.h>
16#include <asm/irq.h> 16#include <asm/irq.h>
17#include <asm/upa.h> 17#include <asm/upa.h>
18#include <asm/pstate.h>
18 19
19#include "pci_impl.h" 20#include "pci_impl.h"
20#include "iommu_common.h" 21#include "iommu_common.h"
@@ -326,6 +327,44 @@ static int __init schizo_ino_to_pil(struct pci_dev *pdev, unsigned int ino)
326 return ret; 327 return ret;
327} 328}
328 329
330static void tomatillo_wsync_handler(struct ino_bucket *bucket, void *_arg1, void *_arg2)
331{
332 unsigned long sync_reg = (unsigned long) _arg2;
333 u64 mask = 1 << (__irq_ino(__irq(bucket)) & IMAP_INO);
334 u64 val;
335 int limit;
336
337 schizo_write(sync_reg, mask);
338
339 limit = 100000;
340 val = 0;
341 while (--limit) {
342 val = schizo_read(sync_reg);
343 if (!(val & mask))
344 break;
345 }
346 if (limit <= 0) {
347 printk("tomatillo_wsync_handler: DMA won't sync [%lx:%lx]\n",
348 val, mask);
349 }
350
351 if (_arg1) {
352 static unsigned char cacheline[64]
353 __attribute__ ((aligned (64)));
354
355 __asm__ __volatile__("rd %%fprs, %0\n\t"
356 "or %0, %4, %1\n\t"
357 "wr %1, 0x0, %%fprs\n\t"
358 "stda %%f0, [%5] %6\n\t"
359 "wr %0, 0x0, %%fprs\n\t"
360 "membar #Sync"
361 : "=&r" (mask), "=&r" (val)
362 : "0" (mask), "1" (val),
363 "i" (FPRS_FEF), "r" (&cacheline[0]),
364 "i" (ASI_BLK_COMMIT_P));
365 }
366}
367
329static unsigned int schizo_irq_build(struct pci_pbm_info *pbm, 368static unsigned int schizo_irq_build(struct pci_pbm_info *pbm,
330 struct pci_dev *pdev, 369 struct pci_dev *pdev,
331 unsigned int ino) 370 unsigned int ino)
@@ -369,6 +408,15 @@ static unsigned int schizo_irq_build(struct pci_pbm_info *pbm,
369 bucket = __bucket(build_irq(pil, ign_fixup, iclr, imap)); 408 bucket = __bucket(build_irq(pil, ign_fixup, iclr, imap));
370 bucket->flags |= IBF_PCI; 409 bucket->flags |= IBF_PCI;
371 410
411 if (pdev && pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) {
412 struct irq_desc *p = bucket->irq_info;
413
414 p->pre_handler = tomatillo_wsync_handler;
415 p->pre_handler_arg1 = ((pbm->chip_version <= 4) ?
416 (void *) 1 : (void *) 0);
417 p->pre_handler_arg2 = (void *) pbm->sync_reg;
418 }
419
372 return __irq(bucket); 420 return __irq(bucket);
373} 421}
374 422
@@ -885,6 +933,7 @@ static irqreturn_t schizo_ce_intr(int irq, void *dev_id, struct pt_regs *regs)
885 933
886#define SCHIZO_PCI_CTRL (0x2000UL) 934#define SCHIZO_PCI_CTRL (0x2000UL)
887#define SCHIZO_PCICTRL_BUS_UNUS (1UL << 63UL) /* Safari */ 935#define SCHIZO_PCICTRL_BUS_UNUS (1UL << 63UL) /* Safari */
936#define SCHIZO_PCICTRL_DTO_INT (1UL << 61UL) /* Tomatillo */
888#define SCHIZO_PCICTRL_ARB_PRIO (0x1ff << 52UL) /* Tomatillo */ 937#define SCHIZO_PCICTRL_ARB_PRIO (0x1ff << 52UL) /* Tomatillo */
889#define SCHIZO_PCICTRL_ESLCK (1UL << 51UL) /* Safari */ 938#define SCHIZO_PCICTRL_ESLCK (1UL << 51UL) /* Safari */
890#define SCHIZO_PCICTRL_ERRSLOT (7UL << 48UL) /* Safari */ 939#define SCHIZO_PCICTRL_ERRSLOT (7UL << 48UL) /* Safari */
@@ -1887,37 +1936,27 @@ static void __init schizo_pbm_hw_init(struct pci_pbm_info *pbm)
1887{ 1936{
1888 u64 tmp; 1937 u64 tmp;
1889 1938
1890 /* Set IRQ retry to infinity. */ 1939 schizo_write(pbm->pbm_regs + SCHIZO_PCI_IRQ_RETRY, 5);
1891 schizo_write(pbm->pbm_regs + SCHIZO_PCI_IRQ_RETRY,
1892 SCHIZO_IRQ_RETRY_INF);
1893 1940
1894 /* Enable arbiter for all PCI slots. Also, disable PCI interval
1895 * timer so that DTO (Discard TimeOuts) are not reported because
1896 * some Schizo revisions report them erroneously.
1897 */
1898 tmp = schizo_read(pbm->pbm_regs + SCHIZO_PCI_CTRL); 1941 tmp = schizo_read(pbm->pbm_regs + SCHIZO_PCI_CTRL);
1899 if (pbm->chip_type == PBM_CHIP_TYPE_SCHIZO_PLUS &&
1900 pbm->chip_version == 0x5 &&
1901 pbm->chip_revision == 0x1)
1902 tmp |= 0x0f;
1903 else
1904 tmp |= 0xff;
1905 1942
1906 tmp &= ~SCHIZO_PCICTRL_PTO; 1943 /* Enable arbiter for all PCI slots. */
1944 tmp |= 0xff;
1945
1907 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO && 1946 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO &&
1908 pbm->chip_version >= 0x2) 1947 pbm->chip_version >= 0x2)
1909 tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT; 1948 tmp |= 0x3UL << SCHIZO_PCICTRL_PTO_SHIFT;
1910 else
1911 tmp |= 0x1UL << SCHIZO_PCICTRL_PTO_SHIFT;
1912 1949
1913 if (!prom_getbool(pbm->prom_node, "no-bus-parking")) 1950 if (!prom_getbool(pbm->prom_node, "no-bus-parking"))
1914 tmp |= SCHIZO_PCICTRL_PARK; 1951 tmp |= SCHIZO_PCICTRL_PARK;
1952 else
1953 tmp &= ~SCHIZO_PCICTRL_PARK;
1915 1954
1916 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO && 1955 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO &&
1917 pbm->chip_version <= 0x1) 1956 pbm->chip_version <= 0x1)
1918 tmp |= (1UL << 61); 1957 tmp |= SCHIZO_PCICTRL_DTO_INT;
1919 else 1958 else
1920 tmp &= ~(1UL << 61); 1959 tmp &= ~SCHIZO_PCICTRL_DTO_INT;
1921 1960
1922 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO) 1961 if (pbm->chip_type == PBM_CHIP_TYPE_TOMATILLO)
1923 tmp |= (SCHIZO_PCICTRL_MRM_PREF | 1962 tmp |= (SCHIZO_PCICTRL_MRM_PREF |
@@ -2015,6 +2054,9 @@ static void __init schizo_pbm_init(struct pci_controller_info *p,
2015 pbm->pbm_regs = pr_regs[0].phys_addr; 2054 pbm->pbm_regs = pr_regs[0].phys_addr;
2016 pbm->controller_regs = pr_regs[1].phys_addr - 0x10000UL; 2055 pbm->controller_regs = pr_regs[1].phys_addr - 0x10000UL;
2017 2056
2057 if (chip_type == PBM_CHIP_TYPE_TOMATILLO)
2058 pbm->sync_reg = pr_regs[3].phys_addr + 0x1a18UL;
2059
2018 sprintf(pbm->name, 2060 sprintf(pbm->name,
2019 (chip_type == PBM_CHIP_TYPE_TOMATILLO ? 2061 (chip_type == PBM_CHIP_TYPE_TOMATILLO ?
2020 "TOMATILLO%d PBM%c" : 2062 "TOMATILLO%d PBM%c" :
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
index 52f14e399b..533104c790 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc64/kernel/power.c
@@ -4,6 +4,8 @@
4 * Copyright (C) 1999 David S. Miller (davem@redhat.com) 4 * Copyright (C) 1999 David S. Miller (davem@redhat.com)
5 */ 5 */
6 6
7#define __KERNEL_SYSCALLS__
8
7#include <linux/config.h> 9#include <linux/config.h>
8#include <linux/kernel.h> 10#include <linux/kernel.h>
9#include <linux/module.h> 11#include <linux/module.h>
@@ -17,7 +19,6 @@
17#include <asm/ebus.h> 19#include <asm/ebus.h>
18#include <asm/auxio.h> 20#include <asm/auxio.h>
19 21
20#define __KERNEL_SYSCALLS__
21#include <linux/unistd.h> 22#include <linux/unistd.h>
22 23
23/* 24/*
diff --git a/arch/sparc64/kernel/ptrace.c b/arch/sparc64/kernel/ptrace.c
index 80a76e2ad7..23ad839d11 100644
--- a/arch/sparc64/kernel/ptrace.c
+++ b/arch/sparc64/kernel/ptrace.c
@@ -19,6 +19,8 @@
19#include <linux/smp.h> 19#include <linux/smp.h>
20#include <linux/smp_lock.h> 20#include <linux/smp_lock.h>
21#include <linux/security.h> 21#include <linux/security.h>
22#include <linux/seccomp.h>
23#include <linux/audit.h>
22#include <linux/signal.h> 24#include <linux/signal.h>
23 25
24#include <asm/asi.h> 26#include <asm/asi.h>
@@ -628,15 +630,27 @@ out:
628 unlock_kernel(); 630 unlock_kernel();
629} 631}
630 632
631asmlinkage void syscall_trace(void) 633asmlinkage void syscall_trace(struct pt_regs *regs, int syscall_exit_p)
632{ 634{
633#ifdef DEBUG_PTRACE 635 /* do the secure computing check first */
634 printk("%s [%d]: syscall_trace\n", current->comm, current->pid); 636 secure_computing(regs->u_regs[UREG_G1]);
635#endif 637
636 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 638 if (unlikely(current->audit_context) && syscall_exit_p) {
637 return; 639 unsigned long tstate = regs->tstate;
640 int result = AUDITSC_SUCCESS;
641
642 if (unlikely(tstate & (TSTATE_XCARRY | TSTATE_ICARRY)))
643 result = AUDITSC_FAILURE;
644
645 audit_syscall_exit(current, result, regs->u_regs[UREG_I0]);
646 }
647
638 if (!(current->ptrace & PT_PTRACED)) 648 if (!(current->ptrace & PT_PTRACED))
639 return; 649 goto out;
650
651 if (!test_thread_flag(TIF_SYSCALL_TRACE))
652 goto out;
653
640 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) 654 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
641 ? 0x80 : 0)); 655 ? 0x80 : 0));
642 656
@@ -645,12 +659,20 @@ asmlinkage void syscall_trace(void)
645 * for normal use. strace only continues with a signal if the 659 * for normal use. strace only continues with a signal if the
646 * stopping signal is not SIGTRAP. -brl 660 * stopping signal is not SIGTRAP. -brl
647 */ 661 */
648#ifdef DEBUG_PTRACE
649 printk("%s [%d]: syscall_trace exit= %x\n", current->comm,
650 current->pid, current->exit_code);
651#endif
652 if (current->exit_code) { 662 if (current->exit_code) {
653 send_sig (current->exit_code, current, 1); 663 send_sig(current->exit_code, current, 1);
654 current->exit_code = 0; 664 current->exit_code = 0;
655 } 665 }
666
667out:
668 if (unlikely(current->audit_context) && !syscall_exit_p)
669 audit_syscall_entry(current,
670 (test_thread_flag(TIF_32BIT) ?
671 AUDIT_ARCH_SPARC :
672 AUDIT_ARCH_SPARC64),
673 regs->u_regs[UREG_G1],
674 regs->u_regs[UREG_I0],
675 regs->u_regs[UREG_I1],
676 regs->u_regs[UREG_I2],
677 regs->u_regs[UREG_I3]);
656} 678}
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index e5b9c7a277..7e8e2919e1 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -45,8 +45,8 @@ extern void calibrate_delay(void);
45/* Please don't make this stuff initdata!!! --DaveM */ 45/* Please don't make this stuff initdata!!! --DaveM */
46static unsigned char boot_cpu_id; 46static unsigned char boot_cpu_id;
47 47
48cpumask_t cpu_online_map = CPU_MASK_NONE; 48cpumask_t cpu_online_map __read_mostly = CPU_MASK_NONE;
49cpumask_t phys_cpu_present_map = CPU_MASK_NONE; 49cpumask_t phys_cpu_present_map __read_mostly = CPU_MASK_NONE;
50static cpumask_t smp_commenced_mask; 50static cpumask_t smp_commenced_mask;
51static cpumask_t cpu_callout_map; 51static cpumask_t cpu_callout_map;
52 52
@@ -155,7 +155,7 @@ void cpu_panic(void)
155 panic("SMP bolixed\n"); 155 panic("SMP bolixed\n");
156} 156}
157 157
158static unsigned long current_tick_offset; 158static unsigned long current_tick_offset __read_mostly;
159 159
160/* This tick register synchronization scheme is taken entirely from 160/* This tick register synchronization scheme is taken entirely from
161 * the ia64 port, see arch/ia64/kernel/smpboot.c for details and credit. 161 * the ia64 port, see arch/ia64/kernel/smpboot.c for details and credit.
@@ -1193,8 +1193,8 @@ void smp_send_stop(void)
1193{ 1193{
1194} 1194}
1195 1195
1196unsigned long __per_cpu_base; 1196unsigned long __per_cpu_base __read_mostly;
1197unsigned long __per_cpu_shift; 1197unsigned long __per_cpu_shift __read_mostly;
1198 1198
1199EXPORT_SYMBOL(__per_cpu_base); 1199EXPORT_SYMBOL(__per_cpu_base);
1200EXPORT_SYMBOL(__per_cpu_shift); 1200EXPORT_SYMBOL(__per_cpu_shift);
diff --git a/arch/sparc64/kernel/sparc64_ksyms.c b/arch/sparc64/kernel/sparc64_ksyms.c
index 56cd96f4a5..9202d925a9 100644
--- a/arch/sparc64/kernel/sparc64_ksyms.c
+++ b/arch/sparc64/kernel/sparc64_ksyms.c
@@ -79,7 +79,7 @@ extern void linux_sparc_syscall(void);
79extern void rtrap(void); 79extern void rtrap(void);
80extern void show_regs(struct pt_regs *); 80extern void show_regs(struct pt_regs *);
81extern void solaris_syscall(void); 81extern void solaris_syscall(void);
82extern void syscall_trace(void); 82extern void syscall_trace(struct pt_regs *, int);
83extern u32 sunos_sys_table[], sys_call_table32[]; 83extern u32 sunos_sys_table[], sys_call_table32[];
84extern void tl0_solaris(void); 84extern void tl0_solaris(void);
85extern void sys_sigsuspend(void); 85extern void sys_sigsuspend(void);
diff --git a/arch/sparc64/kernel/sys32.S b/arch/sparc64/kernel/sys32.S
index 5a95e98c53..5f9e4fae61 100644
--- a/arch/sparc64/kernel/sys32.S
+++ b/arch/sparc64/kernel/sys32.S
@@ -135,6 +135,8 @@ SIGN2(sys32_shutdown, sys_shutdown, %o0, %o1)
135SIGN3(sys32_socketpair, sys_socketpair, %o0, %o1, %o2) 135SIGN3(sys32_socketpair, sys_socketpair, %o0, %o1, %o2)
136SIGN1(sys32_getpeername, sys_getpeername, %o0) 136SIGN1(sys32_getpeername, sys_getpeername, %o0)
137SIGN1(sys32_getsockname, sys_getsockname, %o0) 137SIGN1(sys32_getsockname, sys_getsockname, %o0)
138SIGN2(sys32_ioprio_get, sys_ioprio_get, %o0, %o1)
139SIGN3(sys32_ioprio_set, sys_ioprio_set, %o0, %o1, %o2)
138 140
139 .globl sys32_mmap2 141 .globl sys32_mmap2
140sys32_mmap2: 142sys32_mmap2:
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index a5e36a4c89..bceb91a8a2 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -59,11 +59,11 @@ sys_call_table32:
59/*180*/ .word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall 59/*180*/ .word sys32_flistxattr, sys_removexattr, sys_lremovexattr, compat_sys_sigpending, sys_ni_syscall
60 .word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sparc64_newuname 60 .word sys32_setpgid, sys32_fremovexattr, sys32_tkill, sys32_exit_group, sparc64_newuname
61/*190*/ .word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl 61/*190*/ .word sys32_init_module, sparc64_personality, sys_remap_file_pages, sys32_epoll_create, sys32_epoll_ctl
62 .word sys32_epoll_wait, sys_nis_syscall, sys_getppid, sys32_sigaction, sys_sgetmask 62 .word sys32_epoll_wait, sys32_ioprio_set, sys_getppid, sys32_sigaction, sys_sgetmask
63/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir 63/*200*/ .word sys32_ssetmask, sys_sigsuspend, compat_sys_newlstat, sys_uselib, compat_sys_old_readdir
64 .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64 64 .word sys32_readahead, sys32_socketcall, sys32_syslog, sys32_lookup_dcookie, sys32_fadvise64
65/*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, sys32_sysinfo 65/*210*/ .word sys32_fadvise64_64, sys32_tgkill, sys32_waitpid, sys_swapoff, sys32_sysinfo
66 .word sys32_ipc, sys32_sigreturn, sys_clone, sys_nis_syscall, sys32_adjtimex 66 .word sys32_ipc, sys32_sigreturn, sys_clone, sys32_ioprio_get, sys32_adjtimex
67/*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid 67/*220*/ .word sys32_sigprocmask, sys_ni_syscall, sys32_delete_module, sys_ni_syscall, sys32_getpgid
68 .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16 68 .word sys32_bdflush, sys32_sysfs, sys_nis_syscall, sys32_setfsuid16, sys32_setfsgid16
69/*230*/ .word sys32_select, compat_sys_time, sys_nis_syscall, compat_sys_stime, compat_sys_statfs64 69/*230*/ .word sys32_select, compat_sys_time, sys_nis_syscall, compat_sys_stime, compat_sys_statfs64
@@ -125,11 +125,11 @@ sys_call_table:
125/*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_nis_syscall, sys_ni_syscall 125/*180*/ .word sys_flistxattr, sys_removexattr, sys_lremovexattr, sys_nis_syscall, sys_ni_syscall
126 .word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sparc64_newuname 126 .word sys_setpgid, sys_fremovexattr, sys_tkill, sys_exit_group, sparc64_newuname
127/*190*/ .word sys_init_module, sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl 127/*190*/ .word sys_init_module, sparc64_personality, sys_remap_file_pages, sys_epoll_create, sys_epoll_ctl
128 .word sys_epoll_wait, sys_nis_syscall, sys_getppid, sys_nis_syscall, sys_sgetmask 128 .word sys_epoll_wait, sys_ioprio_set, sys_getppid, sys_nis_syscall, sys_sgetmask
129/*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall 129/*200*/ .word sys_ssetmask, sys_nis_syscall, sys_newlstat, sys_uselib, sys_nis_syscall
130 .word sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64 130 .word sys_readahead, sys_socketcall, sys_syslog, sys_lookup_dcookie, sys_fadvise64
131/*210*/ .word sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo 131/*210*/ .word sys_fadvise64_64, sys_tgkill, sys_waitpid, sys_swapoff, sys_sysinfo
132 .word sys_ipc, sys_nis_syscall, sys_clone, sys_nis_syscall, sys_adjtimex 132 .word sys_ipc, sys_nis_syscall, sys_clone, sys_ioprio_get, sys_adjtimex
133/*220*/ .word sys_nis_syscall, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid 133/*220*/ .word sys_nis_syscall, sys_ni_syscall, sys_delete_module, sys_ni_syscall, sys_getpgid
134 .word sys_bdflush, sys_sysfs, sys_nis_syscall, sys_setfsuid, sys_setfsgid 134 .word sys_bdflush, sys_sysfs, sys_nis_syscall, sys_setfsuid, sys_setfsgid
135/*230*/ .word sys_select, sys_nis_syscall, sys_nis_syscall, sys_stime, sys_statfs64 135/*230*/ .word sys_select, sys_nis_syscall, sys_nis_syscall, sys_stime, sys_statfs64
diff --git a/arch/sparc64/kernel/time.c b/arch/sparc64/kernel/time.c
index 71b4e38076..362b9c2687 100644
--- a/arch/sparc64/kernel/time.c
+++ b/arch/sparc64/kernel/time.c
@@ -73,7 +73,7 @@ static __initdata struct sparc64_tick_ops dummy_tick_ops = {
73 .get_tick = dummy_get_tick, 73 .get_tick = dummy_get_tick,
74}; 74};
75 75
76struct sparc64_tick_ops *tick_ops = &dummy_tick_ops; 76struct sparc64_tick_ops *tick_ops __read_mostly = &dummy_tick_ops;
77 77
78#define TICK_PRIV_BIT (1UL << 63) 78#define TICK_PRIV_BIT (1UL << 63)
79 79
@@ -195,7 +195,7 @@ static unsigned long tick_add_tick(unsigned long adj, unsigned long offset)
195 return new_tick; 195 return new_tick;
196} 196}
197 197
198static struct sparc64_tick_ops tick_operations = { 198static struct sparc64_tick_ops tick_operations __read_mostly = {
199 .init_tick = tick_init_tick, 199 .init_tick = tick_init_tick,
200 .get_tick = tick_get_tick, 200 .get_tick = tick_get_tick,
201 .get_compare = tick_get_compare, 201 .get_compare = tick_get_compare,
@@ -276,7 +276,7 @@ static unsigned long stick_add_compare(unsigned long adj)
276 return new_compare; 276 return new_compare;
277} 277}
278 278
279static struct sparc64_tick_ops stick_operations = { 279static struct sparc64_tick_ops stick_operations __read_mostly = {
280 .init_tick = stick_init_tick, 280 .init_tick = stick_init_tick,
281 .get_tick = stick_get_tick, 281 .get_tick = stick_get_tick,
282 .get_compare = stick_get_compare, 282 .get_compare = stick_get_compare,
@@ -422,7 +422,7 @@ static unsigned long hbtick_add_compare(unsigned long adj)
422 return val; 422 return val;
423} 423}
424 424
425static struct sparc64_tick_ops hbtick_operations = { 425static struct sparc64_tick_ops hbtick_operations __read_mostly = {
426 .init_tick = hbtick_init_tick, 426 .init_tick = hbtick_init_tick,
427 .get_tick = hbtick_get_tick, 427 .get_tick = hbtick_get_tick,
428 .get_compare = hbtick_get_compare, 428 .get_compare = hbtick_get_compare,
@@ -437,10 +437,9 @@ static struct sparc64_tick_ops hbtick_operations = {
437 * NOTE: On SUN5 systems the ticker interrupt comes in using 2 437 * NOTE: On SUN5 systems the ticker interrupt comes in using 2
438 * interrupts, one at level14 and one with softint bit 0. 438 * interrupts, one at level14 and one with softint bit 0.
439 */ 439 */
440unsigned long timer_tick_offset; 440unsigned long timer_tick_offset __read_mostly;
441unsigned long timer_tick_compare;
442 441
443static unsigned long timer_ticks_per_nsec_quotient; 442static unsigned long timer_ticks_per_nsec_quotient __read_mostly;
444 443
445#define TICK_SIZE (tick_nsec / 1000) 444#define TICK_SIZE (tick_nsec / 1000)
446 445
@@ -464,7 +463,7 @@ static inline void timer_check_rtc(void)
464 463
465static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs * regs) 464static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
466{ 465{
467 unsigned long ticks, pstate; 466 unsigned long ticks, compare, pstate;
468 467
469 write_seqlock(&xtime_lock); 468 write_seqlock(&xtime_lock);
470 469
@@ -483,14 +482,14 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs * regs)
483 : "=r" (pstate) 482 : "=r" (pstate)
484 : "i" (PSTATE_IE)); 483 : "i" (PSTATE_IE));
485 484
486 timer_tick_compare = tick_ops->add_compare(timer_tick_offset); 485 compare = tick_ops->add_compare(timer_tick_offset);
487 ticks = tick_ops->get_tick(); 486 ticks = tick_ops->get_tick();
488 487
489 /* Restore PSTATE_IE. */ 488 /* Restore PSTATE_IE. */
490 __asm__ __volatile__("wrpr %0, 0x0, %%pstate" 489 __asm__ __volatile__("wrpr %0, 0x0, %%pstate"
491 : /* no outputs */ 490 : /* no outputs */
492 : "r" (pstate)); 491 : "r" (pstate));
493 } while (time_after_eq(ticks, timer_tick_compare)); 492 } while (time_after_eq(ticks, compare));
494 493
495 timer_check_rtc(); 494 timer_check_rtc();
496 495
@@ -506,11 +505,6 @@ void timer_tick_interrupt(struct pt_regs *regs)
506 505
507 do_timer(regs); 506 do_timer(regs);
508 507
509 /*
510 * Only keep timer_tick_offset uptodate, but don't set TICK_CMPR.
511 */
512 timer_tick_compare = tick_ops->get_compare() + timer_tick_offset;
513
514 timer_check_rtc(); 508 timer_check_rtc();
515 509
516 write_sequnlock(&xtime_lock); 510 write_sequnlock(&xtime_lock);
@@ -973,7 +967,7 @@ static void sparc64_start_timers(irqreturn_t (*cfunc)(int, void *, struct pt_reg
973 int err; 967 int err;
974 968
975 /* Register IRQ handler. */ 969 /* Register IRQ handler. */
976 err = request_irq(build_irq(0, 0, 0UL, 0UL), cfunc, SA_STATIC_ALLOC, 970 err = request_irq(build_irq(0, 0, 0UL, 0UL), cfunc, 0,
977 "timer", NULL); 971 "timer", NULL);
978 972
979 if (err) { 973 if (err) {
diff --git a/arch/sparc64/kernel/vmlinux.lds.S b/arch/sparc64/kernel/vmlinux.lds.S
index 382fd6798b..950423da8a 100644
--- a/arch/sparc64/kernel/vmlinux.lds.S
+++ b/arch/sparc64/kernel/vmlinux.lds.S
@@ -32,6 +32,8 @@ SECTIONS
32 .data1 : { *(.data1) } 32 .data1 : { *(.data1) }
33 . = ALIGN(64); 33 . = ALIGN(64);
34 .data.cacheline_aligned : { *(.data.cacheline_aligned) } 34 .data.cacheline_aligned : { *(.data.cacheline_aligned) }
35 . = ALIGN(64);
36 .data.read_mostly : { *(.data.read_mostly) }
35 _edata = .; 37 _edata = .;
36 PROVIDE (edata = .); 38 PROVIDE (edata = .);
37 .fixup : { *(.fixup) } 39 .fixup : { *(.fixup) }
diff --git a/arch/sparc64/mm/fault.c b/arch/sparc64/mm/fault.c
index 3ffee7b51a..52e9375288 100644
--- a/arch/sparc64/mm/fault.c
+++ b/arch/sparc64/mm/fault.c
@@ -34,22 +34,6 @@
34extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS]; 34extern struct sparc_phys_banks sp_banks[SPARC_PHYS_BANKS];
35 35
36/* 36/*
37 * To debug kernel during syscall entry.
38 */
39void syscall_trace_entry(struct pt_regs *regs)
40{
41 printk("scall entry: %s[%d]/cpu%d: %d\n", current->comm, current->pid, smp_processor_id(), (int) regs->u_regs[UREG_G1]);
42}
43
44/*
45 * To debug kernel during syscall exit.
46 */
47void syscall_trace_exit(struct pt_regs *regs)
48{
49 printk("scall exit: %s[%d]/cpu%d: %d\n", current->comm, current->pid, smp_processor_id(), (int) regs->u_regs[UREG_G1]);
50}
51
52/*
53 * To debug kernel to catch accesses to certain virtual/physical addresses. 37 * To debug kernel to catch accesses to certain virtual/physical addresses.
54 * Mode = 0 selects physical watchpoints, mode = 1 selects virtual watchpoints. 38 * Mode = 0 selects physical watchpoints, mode = 1 selects virtual watchpoints.
55 * flags = VM_READ watches memread accesses, flags = VM_WRITE watches memwrite accesses. 39 * flags = VM_READ watches memread accesses, flags = VM_WRITE watches memwrite accesses.
diff --git a/arch/sparc64/mm/ultra.S b/arch/sparc64/mm/ultra.S
index 7a2431d3ab..3637708937 100644
--- a/arch/sparc64/mm/ultra.S
+++ b/arch/sparc64/mm/ultra.S
@@ -72,6 +72,7 @@ __flush_tlb_pending:
72 flush %g6 72 flush %g6
73 retl 73 retl
74 wrpr %g7, 0x0, %pstate 74 wrpr %g7, 0x0, %pstate
75 nop
75 76
76 .align 32 77 .align 32
77 .globl __flush_tlb_kernel_range 78 .globl __flush_tlb_kernel_range
@@ -249,7 +250,7 @@ __cheetah_flush_tlb_mm: /* 15 insns */
249 retl 250 retl
250 wrpr %g7, 0x0, %pstate 251 wrpr %g7, 0x0, %pstate
251 252
252__cheetah_flush_tlb_pending: /* 22 insns */ 253__cheetah_flush_tlb_pending: /* 23 insns */
253 /* %o0 = context, %o1 = nr, %o2 = vaddrs[] */ 254 /* %o0 = context, %o1 = nr, %o2 = vaddrs[] */
254 rdpr %pstate, %g7 255 rdpr %pstate, %g7
255 sllx %o1, 3, %o1 256 sllx %o1, 3, %o1
@@ -317,7 +318,7 @@ cheetah_patch_cachetlbops:
317 sethi %hi(__cheetah_flush_tlb_pending), %o1 318 sethi %hi(__cheetah_flush_tlb_pending), %o1
318 or %o1, %lo(__cheetah_flush_tlb_pending), %o1 319 or %o1, %lo(__cheetah_flush_tlb_pending), %o1
319 call cheetah_patch_one 320 call cheetah_patch_one
320 mov 22, %o2 321 mov 23, %o2
321 322
322#ifdef DCACHE_ALIASING_POSSIBLE 323#ifdef DCACHE_ALIASING_POSSIBLE
323 sethi %hi(__flush_dcache_page), %o0 324 sethi %hi(__flush_dcache_page), %o0
diff --git a/arch/sparc64/solaris/entry64.S b/arch/sparc64/solaris/entry64.S
index 0cc9dad75c..4b6ae583c0 100644
--- a/arch/sparc64/solaris/entry64.S
+++ b/arch/sparc64/solaris/entry64.S
@@ -24,8 +24,9 @@
24 24
25 .text 25 .text
26solaris_syscall_trace: 26solaris_syscall_trace:
27 add %sp, PTREGS_OFF, %o0
27 call syscall_trace 28 call syscall_trace
28 nop 29 mov 0, %o1
29 srl %i0, 0, %o0 30 srl %i0, 0, %o0
30 mov %i4, %o4 31 mov %i4, %o4
31 srl %i1, 0, %o1 32 srl %i1, 0, %o1
@@ -159,8 +160,10 @@ ret_from_solaris:
159 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] !npc = npc+4 160 stx %l2, [%sp + PTREGS_OFF + PT_V9_TNPC] !npc = npc+4
160 161
161solaris_syscall_trace2: 162solaris_syscall_trace2:
163 add %sp, PTREGS_OFF, %o0
162 call syscall_trace 164 call syscall_trace
163 add %l1, 0x4, %l2 /* npc = npc+4 */ 165 mov 1, %o1
166 add %l1, 0x4, %l2 /* npc = npc+4 */
164 andcc %l1, 1, %g0 167 andcc %l1, 1, %g0
165 bne,pn %icc, 2b 168 bne,pn %icc, 2b
166 nop 169 nop
diff --git a/arch/um/Kconfig b/arch/um/Kconfig
index 9469e77303..f945444df4 100644
--- a/arch/um/Kconfig
+++ b/arch/um/Kconfig
@@ -128,7 +128,6 @@ config HOSTFS
128 128
129config HPPFS 129config HPPFS
130 tristate "HoneyPot ProcFS (EXPERIMENTAL)" 130 tristate "HoneyPot ProcFS (EXPERIMENTAL)"
131 depends on BROKEN
132 help 131 help
133 hppfs (HoneyPot ProcFS) is a filesystem which allows UML /proc 132 hppfs (HoneyPot ProcFS) is a filesystem which allows UML /proc
134 entries to be overridden, removed, or fabricated from the host. 133 entries to be overridden, removed, or fabricated from the host.
@@ -141,8 +140,9 @@ config HPPFS
141 You only need this if you are setting up a UML honeypot. Otherwise, 140 You only need this if you are setting up a UML honeypot. Otherwise,
142 it is safe to say 'N' here. 141 it is safe to say 'N' here.
143 142
144 If you are actively using it, please ask for it to be fixed. In this 143 If you are actively using it, please report any problems, since it's
145 moment, it does not work on 2.6 (it works somehow on 2.4). 144 getting fixed. In this moment, it is experimental on 2.6 (it works on
145 2.4).
146 146
147config MCONSOLE 147config MCONSOLE
148 bool "Management console" 148 bool "Management console"
@@ -275,6 +275,8 @@ endmenu
275 275
276source "init/Kconfig" 276source "init/Kconfig"
277 277
278source "net/Kconfig"
279
278source "drivers/base/Kconfig" 280source "drivers/base/Kconfig"
279 281
280source "arch/um/Kconfig_char" 282source "arch/um/Kconfig_char"
@@ -287,7 +289,7 @@ config NETDEVICES
287 289
288source "arch/um/Kconfig_net" 290source "arch/um/Kconfig_net"
289 291
290source "net/Kconfig" 292source "drivers/net/Kconfig"
291 293
292source "fs/Kconfig" 294source "fs/Kconfig"
293 295
diff --git a/arch/um/Kconfig_i386 b/arch/um/Kconfig_i386
index e41f3748d3..27c18a8d9d 100644
--- a/arch/um/Kconfig_i386
+++ b/arch/um/Kconfig_i386
@@ -19,6 +19,18 @@ config 3_LEVEL_PGTABLES
19 memory. All the memory that can't be mapped directly will be treated 19 memory. All the memory that can't be mapped directly will be treated
20 as high memory. 20 as high memory.
21 21
22config STUB_CODE
23 hex
24 default 0xbfffe000
25
26config STUB_DATA
27 hex
28 default 0xbffff000
29
30config STUB_START
31 hex
32 default STUB_CODE
33
22config ARCH_HAS_SC_SIGNALS 34config ARCH_HAS_SC_SIGNALS
23 bool 35 bool
24 default y 36 default y
diff --git a/arch/um/Kconfig_x86_64 b/arch/um/Kconfig_x86_64
index f162f50f0b..735a047c89 100644
--- a/arch/um/Kconfig_x86_64
+++ b/arch/um/Kconfig_x86_64
@@ -14,6 +14,18 @@ config 3_LEVEL_PGTABLES
14 bool 14 bool
15 default y 15 default y
16 16
17config STUB_CODE
18 hex
19 default 0x7fbfffe000
20
21config STUB_DATA
22 hex
23 default 0x7fbffff000
24
25config STUB_START
26 hex
27 default STUB_CODE
28
17config ARCH_HAS_SC_SIGNALS 29config ARCH_HAS_SC_SIGNALS
18 bool 30 bool
19 default n 31 default n
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 3f07390235..4a375bbac1 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -140,7 +140,8 @@ endef
140#When cleaning we don't include .config, so we don't include 140#When cleaning we don't include .config, so we don't include
141#TT or skas makefiles and don't clean skas_ptregs.h. 141#TT or skas makefiles and don't clean skas_ptregs.h.
142CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \ 142CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \
143 $(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h 143 $(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h \
144 $(ARCH_DIR)/include/user_constants.h
144 145
145MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \ 146MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \
146 $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os \ 147 $(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os \
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 29e182d5a8..301059062a 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -8,7 +8,7 @@ ifeq ($(CONFIG_MODE_SKAS),y)
8 endif 8 endif
9endif 9endif
10 10
11CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH) 11CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH) $(STUB_CFLAGS)
12ARCH_USER_CFLAGS := 12ARCH_USER_CFLAGS :=
13 13
14ifneq ($(CONFIG_GPROF),y) 14ifneq ($(CONFIG_GPROF),y)
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index 32144562c2..d80bd0052e 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -4,7 +4,7 @@
4SUBARCH_LIBS := arch/um/sys-x86_64/ 4SUBARCH_LIBS := arch/um/sys-x86_64/
5START := 0x60000000 5START := 0x60000000
6 6
7CFLAGS += -U__$(SUBARCH)__ -fno-builtin 7CFLAGS += -U__$(SUBARCH)__ -fno-builtin $(STUB_CFLAGS)
8ARCH_USER_CFLAGS := -D__x86_64__ 8ARCH_USER_CFLAGS := -D__x86_64__
9 9
10ELF_ARCH := i386:x86-64 10ELF_ARCH := i386:x86-64
diff --git a/arch/um/defconfig b/arch/um/defconfig
index 4067c3aa5b..80d30d19d7 100644
--- a/arch/um/defconfig
+++ b/arch/um/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.12-rc3-skas3-v9-pre2 3# Linux kernel version: 2.6.12-rc6-mm1
4# Sun Apr 24 19:46:10 2005 4# Tue Jun 14 18:22:21 2005
5# 5#
6CONFIG_GENERIC_HARDIRQS=y 6CONFIG_GENERIC_HARDIRQS=y
7CONFIG_UML=y 7CONFIG_UML=y
@@ -13,23 +13,32 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y
13# 13#
14# UML-specific options 14# UML-specific options
15# 15#
16CONFIG_MODE_TT=y 16# CONFIG_MODE_TT is not set
17# CONFIG_STATIC_LINK is not set
17CONFIG_MODE_SKAS=y 18CONFIG_MODE_SKAS=y
18CONFIG_UML_X86=y 19CONFIG_UML_X86=y
19# CONFIG_64BIT is not set 20# CONFIG_64BIT is not set
20CONFIG_TOP_ADDR=0xc0000000 21CONFIG_TOP_ADDR=0xc0000000
21# CONFIG_3_LEVEL_PGTABLES is not set 22# CONFIG_3_LEVEL_PGTABLES is not set
23CONFIG_STUB_CODE=0xbfffe000
24CONFIG_STUB_DATA=0xbffff000
25CONFIG_STUB_START=0xbfffe000
22CONFIG_ARCH_HAS_SC_SIGNALS=y 26CONFIG_ARCH_HAS_SC_SIGNALS=y
23CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y 27CONFIG_ARCH_REUSE_HOST_VSYSCALL_AREA=y
24CONFIG_LD_SCRIPT_STATIC=y 28CONFIG_SELECT_MEMORY_MODEL=y
29CONFIG_FLATMEM_MANUAL=y
30# CONFIG_DISCONTIGMEM_MANUAL is not set
31# CONFIG_SPARSEMEM_MANUAL is not set
32CONFIG_FLATMEM=y
33CONFIG_FLAT_NODE_MEM_MAP=y
34CONFIG_LD_SCRIPT_DYN=y
25CONFIG_NET=y 35CONFIG_NET=y
26CONFIG_BINFMT_ELF=y 36CONFIG_BINFMT_ELF=y
27CONFIG_BINFMT_MISC=m 37CONFIG_BINFMT_MISC=m
28CONFIG_HOSTFS=y 38# CONFIG_HOSTFS is not set
29CONFIG_MCONSOLE=y 39CONFIG_MCONSOLE=y
30# CONFIG_MAGIC_SYSRQ is not set 40# CONFIG_MAGIC_SYSRQ is not set
31# CONFIG_HOST_2G_2G is not set 41# CONFIG_HOST_2G_2G is not set
32# CONFIG_SMP is not set
33CONFIG_NEST_LEVEL=0 42CONFIG_NEST_LEVEL=0
34CONFIG_KERNEL_HALF_GIGS=1 43CONFIG_KERNEL_HALF_GIGS=1
35# CONFIG_HIGHMEM is not set 44# CONFIG_HIGHMEM is not set
@@ -63,6 +72,8 @@ CONFIG_IKCONFIG_PROC=y
63CONFIG_KALLSYMS=y 72CONFIG_KALLSYMS=y
64# CONFIG_KALLSYMS_ALL is not set 73# CONFIG_KALLSYMS_ALL is not set
65CONFIG_KALLSYMS_EXTRA_PASS=y 74CONFIG_KALLSYMS_EXTRA_PASS=y
75CONFIG_PRINTK=y
76CONFIG_BUG=y
66CONFIG_BASE_FULL=y 77CONFIG_BASE_FULL=y
67CONFIG_FUTEX=y 78CONFIG_FUTEX=y
68CONFIG_EPOLL=y 79CONFIG_EPOLL=y
@@ -81,6 +92,7 @@ CONFIG_MODULES=y
81CONFIG_MODULE_UNLOAD=y 92CONFIG_MODULE_UNLOAD=y
82# CONFIG_MODULE_FORCE_UNLOAD is not set 93# CONFIG_MODULE_FORCE_UNLOAD is not set
83CONFIG_OBSOLETE_MODPARM=y 94CONFIG_OBSOLETE_MODPARM=y
95# CONFIG_MODVERSIONS is not set
84# CONFIG_MODULE_SRCVERSION_ALL is not set 96# CONFIG_MODULE_SRCVERSION_ALL is not set
85CONFIG_KMOD=y 97CONFIG_KMOD=y
86 98
@@ -115,6 +127,7 @@ CONFIG_UML_SOUND=m
115CONFIG_SOUND=m 127CONFIG_SOUND=m
116CONFIG_HOSTAUDIO=m 128CONFIG_HOSTAUDIO=m
117CONFIG_UML_RANDOM=y 129CONFIG_UML_RANDOM=y
130# CONFIG_MMAPPER is not set
118 131
119# 132#
120# Block devices 133# Block devices
@@ -176,6 +189,17 @@ CONFIG_INET=y
176# CONFIG_INET_TUNNEL is not set 189# CONFIG_INET_TUNNEL is not set
177CONFIG_IP_TCPDIAG=y 190CONFIG_IP_TCPDIAG=y
178# CONFIG_IP_TCPDIAG_IPV6 is not set 191# CONFIG_IP_TCPDIAG_IPV6 is not set
192
193#
194# TCP congestion control
195#
196CONFIG_TCP_CONG_BIC=y
197CONFIG_TCP_CONG_WESTWOOD=y
198CONFIG_TCP_CONG_HTCP=y
199# CONFIG_TCP_CONG_HSTCP is not set
200# CONFIG_TCP_CONG_HYBLA is not set
201# CONFIG_TCP_CONG_VEGAS is not set
202# CONFIG_TCP_CONG_SCALABLE is not set
179# CONFIG_IPV6 is not set 203# CONFIG_IPV6 is not set
180# CONFIG_NETFILTER is not set 204# CONFIG_NETFILTER is not set
181 205
@@ -206,11 +230,15 @@ CONFIG_IP_TCPDIAG=y
206# Network testing 230# Network testing
207# 231#
208# CONFIG_NET_PKTGEN is not set 232# CONFIG_NET_PKTGEN is not set
233# CONFIG_KGDBOE is not set
209# CONFIG_NETPOLL is not set 234# CONFIG_NETPOLL is not set
235# CONFIG_NETPOLL_RX is not set
236# CONFIG_NETPOLL_TRAP is not set
210# CONFIG_NET_POLL_CONTROLLER is not set 237# CONFIG_NET_POLL_CONTROLLER is not set
211# CONFIG_HAMRADIO is not set 238# CONFIG_HAMRADIO is not set
212# CONFIG_IRDA is not set 239# CONFIG_IRDA is not set
213# CONFIG_BT is not set 240# CONFIG_BT is not set
241# CONFIG_IEEE80211 is not set
214CONFIG_DUMMY=m 242CONFIG_DUMMY=m
215# CONFIG_BONDING is not set 243# CONFIG_BONDING is not set
216# CONFIG_EQUALIZER is not set 244# CONFIG_EQUALIZER is not set
@@ -227,6 +255,7 @@ CONFIG_PPP=m
227# CONFIG_PPP_SYNC_TTY is not set 255# CONFIG_PPP_SYNC_TTY is not set
228# CONFIG_PPP_DEFLATE is not set 256# CONFIG_PPP_DEFLATE is not set
229# CONFIG_PPP_BSDCOMP is not set 257# CONFIG_PPP_BSDCOMP is not set
258# CONFIG_PPP_MPPE is not set
230# CONFIG_PPPOE is not set 259# CONFIG_PPPOE is not set
231CONFIG_SLIP=m 260CONFIG_SLIP=m
232# CONFIG_SLIP_COMPRESSED is not set 261# CONFIG_SLIP_COMPRESSED is not set
@@ -240,10 +269,12 @@ CONFIG_SLIP=m
240# 269#
241CONFIG_EXT2_FS=y 270CONFIG_EXT2_FS=y
242# CONFIG_EXT2_FS_XATTR is not set 271# CONFIG_EXT2_FS_XATTR is not set
272# CONFIG_EXT2_FS_XIP is not set
243CONFIG_EXT3_FS=y 273CONFIG_EXT3_FS=y
244# CONFIG_EXT3_FS_XATTR is not set 274# CONFIG_EXT3_FS_XATTR is not set
245CONFIG_JBD=y 275CONFIG_JBD=y
246# CONFIG_JBD_DEBUG is not set 276# CONFIG_JBD_DEBUG is not set
277# CONFIG_REISER4_FS is not set
247CONFIG_REISERFS_FS=y 278CONFIG_REISERFS_FS=y
248# CONFIG_REISERFS_CHECK is not set 279# CONFIG_REISERFS_CHECK is not set
249# CONFIG_REISERFS_PROC_INFO is not set 280# CONFIG_REISERFS_PROC_INFO is not set
@@ -256,6 +287,7 @@ CONFIG_REISERFS_FS=y
256# CONFIG_XFS_FS is not set 287# CONFIG_XFS_FS is not set
257# CONFIG_MINIX_FS is not set 288# CONFIG_MINIX_FS is not set
258# CONFIG_ROMFS_FS is not set 289# CONFIG_ROMFS_FS is not set
290CONFIG_INOTIFY=y
259CONFIG_QUOTA=y 291CONFIG_QUOTA=y
260# CONFIG_QFMT_V1 is not set 292# CONFIG_QFMT_V1 is not set
261# CONFIG_QFMT_V2 is not set 293# CONFIG_QFMT_V2 is not set
@@ -265,6 +297,12 @@ CONFIG_AUTOFS_FS=m
265CONFIG_AUTOFS4_FS=m 297CONFIG_AUTOFS4_FS=m
266 298
267# 299#
300# Caches
301#
302# CONFIG_FSCACHE is not set
303# CONFIG_FUSE_FS is not set
304
305#
268# CD-ROM/DVD Filesystems 306# CD-ROM/DVD Filesystems
269# 307#
270CONFIG_ISO9660_FS=m 308CONFIG_ISO9660_FS=m
@@ -291,6 +329,8 @@ CONFIG_TMPFS=y
291# CONFIG_TMPFS_XATTR is not set 329# CONFIG_TMPFS_XATTR is not set
292# CONFIG_HUGETLB_PAGE is not set 330# CONFIG_HUGETLB_PAGE is not set
293CONFIG_RAMFS=y 331CONFIG_RAMFS=y
332# CONFIG_CONFIGFS_FS is not set
333# CONFIG_RELAYFS_FS is not set
294 334
295# 335#
296# Miscellaneous filesystems 336# Miscellaneous filesystems
@@ -319,6 +359,7 @@ CONFIG_RAMFS=y
319# CONFIG_NCP_FS is not set 359# CONFIG_NCP_FS is not set
320# CONFIG_CODA_FS is not set 360# CONFIG_CODA_FS is not set
321# CONFIG_AFS_FS is not set 361# CONFIG_AFS_FS is not set
362# CONFIG_9P_FS is not set
322 363
323# 364#
324# Partition Types 365# Partition Types
@@ -404,14 +445,15 @@ CONFIG_CRC32=m
404# CONFIG_PRINTK_TIME is not set 445# CONFIG_PRINTK_TIME is not set
405CONFIG_DEBUG_KERNEL=y 446CONFIG_DEBUG_KERNEL=y
406CONFIG_LOG_BUF_SHIFT=14 447CONFIG_LOG_BUF_SHIFT=14
448CONFIG_DETECT_SOFTLOCKUP=y
407# CONFIG_SCHEDSTATS is not set 449# CONFIG_SCHEDSTATS is not set
408# CONFIG_DEBUG_SLAB is not set 450CONFIG_DEBUG_SLAB=y
409# CONFIG_DEBUG_SPINLOCK is not set 451# CONFIG_DEBUG_SPINLOCK is not set
410# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 452# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
411# CONFIG_DEBUG_KOBJECT is not set 453# CONFIG_DEBUG_KOBJECT is not set
412CONFIG_DEBUG_INFO=y 454CONFIG_DEBUG_INFO=y
413# CONFIG_DEBUG_FS is not set 455# CONFIG_DEBUG_FS is not set
414CONFIG_FRAME_POINTER=y 456CONFIG_FRAME_POINTER=y
415CONFIG_PT_PROXY=y 457# CONFIG_GPROF is not set
416# CONFIG_GCOV is not set 458# CONFIG_GCOV is not set
417# CONFIG_SYSCALL_DEBUG is not set 459# CONFIG_SYSCALL_DEBUG is not set
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index 2bb4c4f5de..e0fdffa2d5 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -663,11 +663,15 @@ struct tty_driver *line_register_devfs(struct lines *set,
663 return driver; 663 return driver;
664} 664}
665 665
666static spinlock_t winch_handler_lock;
667LIST_HEAD(winch_handlers);
668
666void lines_init(struct line *lines, int nlines) 669void lines_init(struct line *lines, int nlines)
667{ 670{
668 struct line *line; 671 struct line *line;
669 int i; 672 int i;
670 673
674 spin_lock_init(&winch_handler_lock);
671 for(i = 0; i < nlines; i++){ 675 for(i = 0; i < nlines; i++){
672 line = &lines[i]; 676 line = &lines[i];
673 INIT_LIST_HEAD(&line->chan_list); 677 INIT_LIST_HEAD(&line->chan_list);
@@ -724,31 +728,30 @@ irqreturn_t winch_interrupt(int irq, void *data, struct pt_regs *unused)
724 return IRQ_HANDLED; 728 return IRQ_HANDLED;
725} 729}
726 730
727DECLARE_MUTEX(winch_handler_sem);
728LIST_HEAD(winch_handlers);
729
730void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty) 731void register_winch_irq(int fd, int tty_fd, int pid, struct tty_struct *tty)
731{ 732{
732 struct winch *winch; 733 struct winch *winch;
733 734
734 down(&winch_handler_sem);
735 winch = kmalloc(sizeof(*winch), GFP_KERNEL); 735 winch = kmalloc(sizeof(*winch), GFP_KERNEL);
736 if (winch == NULL) { 736 if (winch == NULL) {
737 printk("register_winch_irq - kmalloc failed\n"); 737 printk("register_winch_irq - kmalloc failed\n");
738 goto out; 738 return;
739 } 739 }
740
740 *winch = ((struct winch) { .list = LIST_HEAD_INIT(winch->list), 741 *winch = ((struct winch) { .list = LIST_HEAD_INIT(winch->list),
741 .fd = fd, 742 .fd = fd,
742 .tty_fd = tty_fd, 743 .tty_fd = tty_fd,
743 .pid = pid, 744 .pid = pid,
744 .tty = tty }); 745 .tty = tty });
746
747 spin_lock(&winch_handler_lock);
745 list_add(&winch->list, &winch_handlers); 748 list_add(&winch->list, &winch_handlers);
749 spin_unlock(&winch_handler_lock);
750
746 if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt, 751 if(um_request_irq(WINCH_IRQ, fd, IRQ_READ, winch_interrupt,
747 SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM, 752 SA_INTERRUPT | SA_SHIRQ | SA_SAMPLE_RANDOM,
748 "winch", winch) < 0) 753 "winch", winch) < 0)
749 printk("register_winch_irq - failed to register IRQ\n"); 754 printk("register_winch_irq - failed to register IRQ\n");
750 out:
751 up(&winch_handler_sem);
752} 755}
753 756
754static void unregister_winch(struct tty_struct *tty) 757static void unregister_winch(struct tty_struct *tty)
@@ -756,7 +759,7 @@ static void unregister_winch(struct tty_struct *tty)
756 struct list_head *ele; 759 struct list_head *ele;
757 struct winch *winch, *found = NULL; 760 struct winch *winch, *found = NULL;
758 761
759 down(&winch_handler_sem); 762 spin_lock(&winch_handler_lock);
760 list_for_each(ele, &winch_handlers){ 763 list_for_each(ele, &winch_handlers){
761 winch = list_entry(ele, struct winch, list); 764 winch = list_entry(ele, struct winch, list);
762 if(winch->tty == tty){ 765 if(winch->tty == tty){
@@ -764,20 +767,25 @@ static void unregister_winch(struct tty_struct *tty)
764 break; 767 break;
765 } 768 }
766 } 769 }
767
768 if(found == NULL) 770 if(found == NULL)
769 goto out; 771 goto err;
772
773 list_del(&winch->list);
774 spin_unlock(&winch_handler_lock);
770 775
771 if(winch->pid != -1) 776 if(winch->pid != -1)
772 os_kill_process(winch->pid, 1); 777 os_kill_process(winch->pid, 1);
773 778
774 free_irq(WINCH_IRQ, winch); 779 free_irq(WINCH_IRQ, winch);
775 list_del(&winch->list);
776 kfree(winch); 780 kfree(winch);
777 out: 781
778 up(&winch_handler_sem); 782 return;
783err:
784 spin_unlock(&winch_handler_lock);
779} 785}
780 786
787/* XXX: No lock as it's an exitcall... is this valid? Depending on cleanup
788 * order... are we sure that nothing else is done on the list? */
781static void winch_cleanup(void) 789static void winch_cleanup(void)
782{ 790{
783 struct list_head *ele; 791 struct list_head *ele;
@@ -786,6 +794,9 @@ static void winch_cleanup(void)
786 list_for_each(ele, &winch_handlers){ 794 list_for_each(ele, &winch_handlers){
787 winch = list_entry(ele, struct winch, list); 795 winch = list_entry(ele, struct winch, list);
788 if(winch->fd != -1){ 796 if(winch->fd != -1){
797 /* Why is this different from the above free_irq(),
798 * which deactivates SIGIO? This searches the FD
799 * somewhere else and removes it from the list... */
789 deactivate_fd(winch->fd, WINCH_IRQ); 800 deactivate_fd(winch->fd, WINCH_IRQ);
790 os_close_file(winch->fd); 801 os_close_file(winch->fd);
791 } 802 }
diff --git a/arch/um/include/mem.h b/arch/um/include/mem.h
index 10c46c3894..99d3ad4a03 100644
--- a/arch/um/include/mem.h
+++ b/arch/um/include/mem.h
@@ -13,6 +13,7 @@ extern int physmem_subst_mapping(void *virt, int fd, __u64 offset, int w);
13extern int is_remapped(void *virt); 13extern int is_remapped(void *virt);
14extern int physmem_remove_mapping(void *virt); 14extern int physmem_remove_mapping(void *virt);
15extern void physmem_forget_descriptor(int fd); 15extern void physmem_forget_descriptor(int fd);
16extern unsigned long to_phys(void *virt);
16 17
17#endif 18#endif
18 19
diff --git a/arch/um/include/registers.h b/arch/um/include/registers.h
index 8744abb522..0a35e6d0ba 100644
--- a/arch/um/include/registers.h
+++ b/arch/um/include/registers.h
@@ -14,6 +14,7 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs);
14extern void save_registers(int pid, union uml_pt_regs *regs); 14extern void save_registers(int pid, union uml_pt_regs *regs);
15extern void restore_registers(int pid, union uml_pt_regs *regs); 15extern void restore_registers(int pid, union uml_pt_regs *regs);
16extern void init_registers(int pid); 16extern void init_registers(int pid);
17extern void get_safe_registers(unsigned long * regs);
17 18
18#endif 19#endif
19 20
diff --git a/arch/um/include/sysdep-i386/ptrace_user.h b/arch/um/include/sysdep-i386/ptrace_user.h
index eca8066e7a..899aa4b2a7 100644
--- a/arch/um/include/sysdep-i386/ptrace_user.h
+++ b/arch/um/include/sysdep-i386/ptrace_user.h
@@ -20,11 +20,24 @@
20#define PT_SYSCALL_ARG3_OFFSET PT_OFFSET(EDX) 20#define PT_SYSCALL_ARG3_OFFSET PT_OFFSET(EDX)
21#define PT_SYSCALL_ARG4_OFFSET PT_OFFSET(ESI) 21#define PT_SYSCALL_ARG4_OFFSET PT_OFFSET(ESI)
22#define PT_SYSCALL_ARG5_OFFSET PT_OFFSET(EDI) 22#define PT_SYSCALL_ARG5_OFFSET PT_OFFSET(EDI)
23#define PT_SYSCALL_ARG6_OFFSET PT_OFFSET(EBP)
23 24
24#define PT_SYSCALL_RET_OFFSET PT_OFFSET(EAX) 25#define PT_SYSCALL_RET_OFFSET PT_OFFSET(EAX)
25 26
27#define REGS_SYSCALL_NR EAX /* This is used before a system call */
28#define REGS_SYSCALL_ARG1 EBX
29#define REGS_SYSCALL_ARG2 ECX
30#define REGS_SYSCALL_ARG3 EDX
31#define REGS_SYSCALL_ARG4 ESI
32#define REGS_SYSCALL_ARG5 EDI
33#define REGS_SYSCALL_ARG6 EBP
34
35#define REGS_IP_INDEX EIP
36#define REGS_SP_INDEX UESP
37
26#define PT_IP_OFFSET PT_OFFSET(EIP) 38#define PT_IP_OFFSET PT_OFFSET(EIP)
27#define PT_IP(regs) ((regs)[EIP]) 39#define PT_IP(regs) ((regs)[EIP])
40#define PT_SP_OFFSET PT_OFFSET(UESP)
28#define PT_SP(regs) ((regs)[UESP]) 41#define PT_SP(regs) ((regs)[UESP])
29 42
30#ifndef FRAME_SIZE 43#ifndef FRAME_SIZE
diff --git a/arch/um/include/sysdep-i386/stub.h b/arch/um/include/sysdep-i386/stub.h
new file mode 100644
index 0000000000..d3699fe1c6
--- /dev/null
+++ b/arch/um/include/sysdep-i386/stub.h
@@ -0,0 +1,65 @@
1/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_STUB_H
7#define __SYSDEP_STUB_H
8
9#include <asm/ptrace.h>
10#include <asm/unistd.h>
11
12extern void stub_segv_handler(int sig);
13extern void stub_clone_handler(void);
14
15#define STUB_SYSCALL_RET EAX
16#define STUB_MMAP_NR __NR_mmap2
17#define MMAP_OFFSET(o) ((o) >> PAGE_SHIFT)
18
19static inline long stub_syscall2(long syscall, long arg1, long arg2)
20{
21 long ret;
22
23 __asm__("movl %0, %%ecx; " : : "g" (arg2) : "%ecx");
24 __asm__("movl %0, %%ebx; " : : "g" (arg1) : "%ebx");
25 __asm__("movl %0, %%eax; " : : "g" (syscall) : "%eax");
26 __asm__("int $0x80;" : : : "%eax");
27 __asm__ __volatile__("movl %%eax, %0; " : "=g" (ret) :);
28 return(ret);
29}
30
31static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
32{
33 __asm__("movl %0, %%edx; " : : "g" (arg3) : "%edx");
34 return(stub_syscall2(syscall, arg1, arg2));
35}
36
37static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
38 long arg4)
39{
40 __asm__("movl %0, %%esi; " : : "g" (arg4) : "%esi");
41 return(stub_syscall3(syscall, arg1, arg2, arg3));
42}
43
44static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3,
45 long arg4, long arg5, long arg6)
46{
47 long ret;
48 __asm__("movl %0, %%eax; " : : "g" (syscall) : "%eax");
49 __asm__("movl %0, %%ebx; " : : "g" (arg1) : "%ebx");
50 __asm__("movl %0, %%ecx; " : : "g" (arg2) : "%ecx");
51 __asm__("movl %0, %%edx; " : : "g" (arg3) : "%edx");
52 __asm__("movl %0, %%esi; " : : "g" (arg4) : "%esi");
53 __asm__("movl %0, %%edi; " : : "g" (arg5) : "%edi");
54 __asm__ __volatile__("pushl %%ebp ; movl %1, %%ebp; "
55 "int $0x80; popl %%ebp ; "
56 "movl %%eax, %0; " : "=g" (ret) : "g" (arg6) : "%eax");
57 return(ret);
58}
59
60static inline void trap_myself(void)
61{
62 __asm("int3");
63}
64
65#endif
diff --git a/arch/um/include/sysdep-x86_64/ptrace_user.h b/arch/um/include/sysdep-x86_64/ptrace_user.h
index 31729973fb..128faf0273 100644
--- a/arch/um/include/sysdep-x86_64/ptrace_user.h
+++ b/arch/um/include/sysdep-x86_64/ptrace_user.h
@@ -55,6 +55,20 @@
55#define PTRACE_OLDSETOPTIONS 21 55#define PTRACE_OLDSETOPTIONS 21
56#endif 56#endif
57 57
58/* These are before the system call, so the the system call number is RAX
59 * rather than ORIG_RAX, and arg4 is R10 rather than RCX
60 */
61#define REGS_SYSCALL_NR PT_INDEX(RAX)
62#define REGS_SYSCALL_ARG1 PT_INDEX(RDI)
63#define REGS_SYSCALL_ARG2 PT_INDEX(RSI)
64#define REGS_SYSCALL_ARG3 PT_INDEX(RDX)
65#define REGS_SYSCALL_ARG4 PT_INDEX(R10)
66#define REGS_SYSCALL_ARG5 PT_INDEX(R8)
67#define REGS_SYSCALL_ARG6 PT_INDEX(R9)
68
69#define REGS_IP_INDEX PT_INDEX(RIP)
70#define REGS_SP_INDEX PT_INDEX(RSP)
71
58#endif 72#endif
59 73
60/* 74/*
diff --git a/arch/um/include/sysdep-x86_64/stub.h b/arch/um/include/sysdep-x86_64/stub.h
new file mode 100644
index 0000000000..f599058d82
--- /dev/null
+++ b/arch/um/include/sysdep-x86_64/stub.h
@@ -0,0 +1,58 @@
1/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __SYSDEP_STUB_H
7#define __SYSDEP_STUB_H
8
9#include <asm/ptrace.h>
10#include <asm/unistd.h>
11#include <sysdep/ptrace_user.h>
12
13extern void stub_segv_handler(int sig);
14extern void stub_clone_handler(void);
15
16#define STUB_SYSCALL_RET PT_INDEX(RAX)
17#define STUB_MMAP_NR __NR_mmap
18#define MMAP_OFFSET(o) (o)
19
20static inline long stub_syscall2(long syscall, long arg1, long arg2)
21{
22 long ret;
23
24 __asm__("movq %0, %%rsi; " : : "g" (arg2) : "%rsi");
25 __asm__("movq %0, %%rdi; " : : "g" (arg1) : "%rdi");
26 __asm__("movq %0, %%rax; " : : "g" (syscall) : "%rax");
27 __asm__("syscall;" : : : "%rax", "%r11", "%rcx");
28 __asm__ __volatile__("movq %%rax, %0; " : "=g" (ret) :);
29 return(ret);
30}
31
32static inline long stub_syscall3(long syscall, long arg1, long arg2, long arg3)
33{
34 __asm__("movq %0, %%rdx; " : : "g" (arg3) : "%rdx");
35 return(stub_syscall2(syscall, arg1, arg2));
36}
37
38static inline long stub_syscall4(long syscall, long arg1, long arg2, long arg3,
39 long arg4)
40{
41 __asm__("movq %0, %%r10; " : : "g" (arg4) : "%r10");
42 return(stub_syscall3(syscall, arg1, arg2, arg3));
43}
44
45static inline long stub_syscall6(long syscall, long arg1, long arg2, long arg3,
46 long arg4, long arg5, long arg6)
47{
48 __asm__("movq %0, %%r9; " : : "g" (arg6) : "%r9");
49 __asm__("movq %0, %%r8; " : : "g" (arg5) : "%r8");
50 return(stub_syscall4(syscall, arg1, arg2, arg3, arg4));
51}
52
53static inline void trap_myself(void)
54{
55 __asm("int3");
56}
57
58#endif
diff --git a/arch/um/include/time_user.h b/arch/um/include/time_user.h
index f64ef77019..17d7ef2141 100644
--- a/arch/um/include/time_user.h
+++ b/arch/um/include/time_user.h
@@ -10,6 +10,7 @@ extern void timer(void);
10extern void switch_timers(int to_real); 10extern void switch_timers(int to_real);
11extern void idle_sleep(int secs); 11extern void idle_sleep(int secs);
12extern void enable_timer(void); 12extern void enable_timer(void);
13extern void prepare_timer(void * ptr);
13extern void disable_timer(void); 14extern void disable_timer(void);
14extern unsigned long time_lock(void); 15extern unsigned long time_lock(void);
15extern void time_unlock(unsigned long); 16extern void time_unlock(unsigned long);
diff --git a/arch/um/include/tlb.h b/arch/um/include/tlb.h
index da1097285b..c6f9628f39 100644
--- a/arch/um/include/tlb.h
+++ b/arch/um/include/tlb.h
@@ -37,31 +37,25 @@ struct host_vm_op {
37extern void mprotect_kernel_vm(int w); 37extern void mprotect_kernel_vm(int w);
38extern void force_flush_all(void); 38extern void force_flush_all(void);
39extern void fix_range_common(struct mm_struct *mm, unsigned long start_addr, 39extern void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
40 unsigned long end_addr, int force, int data, 40 unsigned long end_addr, int force,
41 void (*do_ops)(int, struct host_vm_op *, int)); 41 void (*do_ops)(union mm_context *,
42 struct host_vm_op *, int));
42extern int flush_tlb_kernel_range_common(unsigned long start, 43extern int flush_tlb_kernel_range_common(unsigned long start,
43 unsigned long end); 44 unsigned long end);
44 45
45extern int add_mmap(unsigned long virt, unsigned long phys, unsigned long len, 46extern int add_mmap(unsigned long virt, unsigned long phys, unsigned long len,
46 int r, int w, int x, struct host_vm_op *ops, int index, 47 int r, int w, int x, struct host_vm_op *ops, int index,
47 int last_filled, int data, 48 int last_filled, union mm_context *mmu,
48 void (*do_ops)(int, struct host_vm_op *, int)); 49 void (*do_ops)(union mm_context *, struct host_vm_op *,
50 int));
49extern int add_munmap(unsigned long addr, unsigned long len, 51extern int add_munmap(unsigned long addr, unsigned long len,
50 struct host_vm_op *ops, int index, int last_filled, 52 struct host_vm_op *ops, int index, int last_filled,
51 int data, void (*do_ops)(int, struct host_vm_op *, int)); 53 union mm_context *mmu,
54 void (*do_ops)(union mm_context *, struct host_vm_op *,
55 int));
52extern int add_mprotect(unsigned long addr, unsigned long len, int r, int w, 56extern int add_mprotect(unsigned long addr, unsigned long len, int r, int w,
53 int x, struct host_vm_op *ops, int index, 57 int x, struct host_vm_op *ops, int index,
54 int last_filled, int data, 58 int last_filled, union mm_context *mmu,
55 void (*do_ops)(int, struct host_vm_op *, int)); 59 void (*do_ops)(union mm_context *, struct host_vm_op *,
60 int));
56#endif 61#endif
57
58/*
59 * Overrides for Emacs so that we follow Linus's tabbing style.
60 * Emacs will notice this stuff at the end of the file and automatically
61 * adjust the settings for this buffer only. This must remain at the end
62 * of the file.
63 * ---------------------------------------------------------------------------
64 * Local variables:
65 * c-file-style: "linux"
66 * End:
67 */
diff --git a/arch/um/kernel/dyn.lds.S b/arch/um/kernel/dyn.lds.S
index 715b0838a6..3942a5f245 100644
--- a/arch/um/kernel/dyn.lds.S
+++ b/arch/um/kernel/dyn.lds.S
@@ -67,6 +67,12 @@ SECTIONS
67 *(.stub .text.* .gnu.linkonce.t.*) 67 *(.stub .text.* .gnu.linkonce.t.*)
68 /* .gnu.warning sections are handled specially by elf32.em. */ 68 /* .gnu.warning sections are handled specially by elf32.em. */
69 *(.gnu.warning) 69 *(.gnu.warning)
70
71 . = ALIGN(4096);
72 __syscall_stub_start = .;
73 *(.__syscall_stub*)
74 __syscall_stub_end = .;
75 . = ALIGN(4096);
70 } =0x90909090 76 } =0x90909090
71 .fini : { 77 .fini : {
72 KEEP (*(.fini)) 78 KEEP (*(.fini))
diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c
index 420e6d51fa..a24e3b7f4b 100644
--- a/arch/um/kernel/physmem.c
+++ b/arch/um/kernel/physmem.c
@@ -353,6 +353,8 @@ void map_memory(unsigned long virt, unsigned long phys, unsigned long len,
353 353
354#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT) 354#define PFN_UP(x) (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
355 355
356extern int __syscall_stub_start, __binary_start;
357
356void setup_physmem(unsigned long start, unsigned long reserve_end, 358void setup_physmem(unsigned long start, unsigned long reserve_end,
357 unsigned long len, unsigned long highmem) 359 unsigned long len, unsigned long highmem)
358{ 360{
@@ -371,6 +373,12 @@ void setup_physmem(unsigned long start, unsigned long reserve_end,
371 exit(1); 373 exit(1);
372 } 374 }
373 375
376 /* Special kludge - This page will be mapped in to userspace processes
377 * from physmem_fd, so it needs to be written out there.
378 */
379 os_seek_file(physmem_fd, __pa(&__syscall_stub_start));
380 os_write_file(physmem_fd, &__syscall_stub_start, PAGE_SIZE);
381
374 bootmap_size = init_bootmem(pfn, pfn + delta); 382 bootmap_size = init_bootmem(pfn, pfn + delta);
375 free_bootmem(__pa(reserve_end) + bootmap_size, 383 free_bootmem(__pa(reserve_end) + bootmap_size,
376 len - bootmap_size - reserve); 384 len - bootmap_size - reserve);
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index 1b5ef3e96c..c45a60e9c9 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -32,6 +32,7 @@
32#include "uml-config.h" 32#include "uml-config.h"
33#include "choose-mode.h" 33#include "choose-mode.h"
34#include "mode.h" 34#include "mode.h"
35#include "tempfile.h"
35#ifdef UML_CONFIG_MODE_SKAS 36#ifdef UML_CONFIG_MODE_SKAS
36#include "skas.h" 37#include "skas.h"
37#include "skas_ptrace.h" 38#include "skas_ptrace.h"
@@ -358,11 +359,16 @@ void forward_pending_sigio(int target)
358 kill(target, SIGIO); 359 kill(target, SIGIO);
359} 360}
360 361
362int ptrace_faultinfo = 0;
363int proc_mm = 1;
364
365extern void *__syscall_stub_start, __syscall_stub_end;
366
361#ifdef UML_CONFIG_MODE_SKAS 367#ifdef UML_CONFIG_MODE_SKAS
362static inline int check_skas3_ptrace_support(void) 368static inline void check_skas3_ptrace_support(void)
363{ 369{
364 struct ptrace_faultinfo fi; 370 struct ptrace_faultinfo fi;
365 int pid, n, ret = 1; 371 int pid, n;
366 372
367 printf("Checking for the skas3 patch in the host..."); 373 printf("Checking for the skas3 patch in the host...");
368 pid = start_ptraced_child(); 374 pid = start_ptraced_child();
@@ -374,33 +380,31 @@ static inline int check_skas3_ptrace_support(void)
374 else { 380 else {
375 perror("not found"); 381 perror("not found");
376 } 382 }
377 ret = 0; 383 }
378 } else { 384 else {
385 ptrace_faultinfo = 1;
379 printf("found\n"); 386 printf("found\n");
380 } 387 }
381 388
382 init_registers(pid); 389 init_registers(pid);
383 stop_ptraced_child(pid, 1, 1); 390 stop_ptraced_child(pid, 1, 1);
384
385 return(ret);
386} 391}
387 392
388int can_do_skas(void) 393int can_do_skas(void)
389{ 394{
390 int ret = 1;
391
392 printf("Checking for /proc/mm..."); 395 printf("Checking for /proc/mm...");
393 if (os_access("/proc/mm", OS_ACC_W_OK) < 0) { 396 if (os_access("/proc/mm", OS_ACC_W_OK) < 0) {
397 proc_mm = 0;
394 printf("not found\n"); 398 printf("not found\n");
395 ret = 0;
396 goto out; 399 goto out;
397 } else { 400 }
401 else {
398 printf("found\n"); 402 printf("found\n");
399 } 403 }
400 404
401 ret = check_skas3_ptrace_support();
402out: 405out:
403 return ret; 406 check_skas3_ptrace_support();
407 return 1;
404} 408}
405#else 409#else
406int can_do_skas(void) 410int can_do_skas(void)
diff --git a/arch/um/kernel/skas/Makefile b/arch/um/kernel/skas/Makefile
index ff69c4b312..d296d55ade 100644
--- a/arch/um/kernel/skas/Makefile
+++ b/arch/um/kernel/skas/Makefile
@@ -3,11 +3,14 @@
3# Licensed under the GPL 3# Licensed under the GPL
4# 4#
5 5
6obj-y := exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \ 6obj-y := clone.o exec_kern.o mem.o mem_user.o mmu.o process.o process_kern.o \
7 syscall_kern.o syscall_user.o tlb.o trap_user.o uaccess.o \ 7 syscall_kern.o syscall_user.o tlb.o trap_user.o uaccess.o \
8 8
9subdir- := util 9subdir- := util
10 10
11USER_OBJS := process.o 11USER_OBJS := process.o clone.o
12 12
13include arch/um/scripts/Makefile.rules 13include arch/um/scripts/Makefile.rules
14
15# clone.o is in the stub, so it can't be built with profiling
16$(obj)/clone.o : c_flags = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS))
diff --git a/arch/um/kernel/skas/clone.c b/arch/um/kernel/skas/clone.c
new file mode 100644
index 0000000000..4dc55f10cd
--- /dev/null
+++ b/arch/um/kernel/skas/clone.c
@@ -0,0 +1,44 @@
1#include <sched.h>
2#include <signal.h>
3#include <sys/mman.h>
4#include <sys/time.h>
5#include <asm/unistd.h>
6#include <asm/page.h>
7#include "ptrace_user.h"
8#include "skas.h"
9#include "stub-data.h"
10#include "uml-config.h"
11#include "sysdep/stub.h"
12
13/* This is in a separate file because it needs to be compiled with any
14 * extraneous gcc flags (-pg, -fprofile-arcs, -ftest-coverage) disabled
15 */
16void __attribute__ ((__section__ (".__syscall_stub")))
17stub_clone_handler(void)
18{
19 long err;
20 struct stub_data *from = (struct stub_data *) UML_CONFIG_STUB_DATA;
21
22 err = stub_syscall2(__NR_clone, CLONE_PARENT | CLONE_FILES | SIGCHLD,
23 UML_CONFIG_STUB_DATA + PAGE_SIZE / 2 -
24 sizeof(void *));
25 if(err != 0)
26 goto out;
27
28 err = stub_syscall4(__NR_ptrace, PTRACE_TRACEME, 0, 0, 0);
29 if(err)
30 goto out;
31
32 err = stub_syscall3(__NR_setitimer, ITIMER_VIRTUAL,
33 (long) &from->timer, 0);
34 if(err)
35 goto out;
36
37 err = stub_syscall6(STUB_MMAP_NR, UML_CONFIG_STUB_DATA, PAGE_SIZE,
38 PROT_READ | PROT_WRITE, MAP_FIXED | MAP_SHARED,
39 from->fd, from->offset);
40 out:
41 /* save current result. Parent: pid; child: retcode of mmap */
42 from->err = err;
43 trap_myself();
44}
diff --git a/arch/um/kernel/skas/exec_kern.c b/arch/um/kernel/skas/exec_kern.c
index c6b4d5dba7..77ed7bbab2 100644
--- a/arch/um/kernel/skas/exec_kern.c
+++ b/arch/um/kernel/skas/exec_kern.c
@@ -18,7 +18,7 @@
18void flush_thread_skas(void) 18void flush_thread_skas(void)
19{ 19{
20 force_flush_all(); 20 force_flush_all();
21 switch_mm_skas(current->mm->context.skas.mm_fd); 21 switch_mm_skas(&current->mm->context.skas.id);
22} 22}
23 23
24void start_thread_skas(struct pt_regs *regs, unsigned long eip, 24void start_thread_skas(struct pt_regs *regs, unsigned long eip,
diff --git a/arch/um/kernel/skas/include/mm_id.h b/arch/um/kernel/skas/include/mm_id.h
new file mode 100644
index 0000000000..48dd0989dd
--- /dev/null
+++ b/arch/um/kernel/skas/include/mm_id.h
@@ -0,0 +1,17 @@
1/*
2 * Copyright (C) 2005 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __MM_ID_H
7#define __MM_ID_H
8
9struct mm_id {
10 union {
11 int mm_fd;
12 int pid;
13 } u;
14 unsigned long stack;
15};
16
17#endif
diff --git a/arch/um/kernel/skas/include/mmu-skas.h b/arch/um/kernel/skas/include/mmu-skas.h
index 4cd60d7213..278b72f1d9 100644
--- a/arch/um/kernel/skas/include/mmu-skas.h
+++ b/arch/um/kernel/skas/include/mmu-skas.h
@@ -6,10 +6,15 @@
6#ifndef __SKAS_MMU_H 6#ifndef __SKAS_MMU_H
7#define __SKAS_MMU_H 7#define __SKAS_MMU_H
8 8
9#include "mm_id.h"
10
9struct mmu_context_skas { 11struct mmu_context_skas {
10 int mm_fd; 12 struct mm_id id;
13 unsigned long last_page_table;
11}; 14};
12 15
16extern void switch_mm_skas(struct mm_id * mm_idp);
17
13#endif 18#endif
14 19
15/* 20/*
diff --git a/arch/um/kernel/skas/include/skas.h b/arch/um/kernel/skas/include/skas.h
index 96b51dba34..d983ea8425 100644
--- a/arch/um/kernel/skas/include/skas.h
+++ b/arch/um/kernel/skas/include/skas.h
@@ -6,9 +6,11 @@
6#ifndef __SKAS_H 6#ifndef __SKAS_H
7#define __SKAS_H 7#define __SKAS_H
8 8
9#include "mm_id.h"
9#include "sysdep/ptrace.h" 10#include "sysdep/ptrace.h"
10 11
11extern int userspace_pid[]; 12extern int userspace_pid[];
13extern int proc_mm, ptrace_faultinfo;
12 14
13extern void switch_threads(void *me, void *next); 15extern void switch_threads(void *me, void *next);
14extern void thread_wait(void *sw, void *fb); 16extern void thread_wait(void *sw, void *fb);
@@ -22,16 +24,18 @@ extern void new_thread_proc(void *stack, void (*handler)(int sig));
22extern void remove_sigstack(void); 24extern void remove_sigstack(void);
23extern void new_thread_handler(int sig); 25extern void new_thread_handler(int sig);
24extern void handle_syscall(union uml_pt_regs *regs); 26extern void handle_syscall(union uml_pt_regs *regs);
25extern void map(int fd, unsigned long virt, unsigned long len, int r, int w, 27extern int map(struct mm_id * mm_idp, unsigned long virt, unsigned long len,
26 int x, int phys_fd, unsigned long long offset); 28 int r, int w, int x, int phys_fd, unsigned long long offset);
27extern int unmap(int fd, void *addr, unsigned long len); 29extern int unmap(struct mm_id * mm_idp, void *addr, unsigned long len);
28extern int protect(int fd, unsigned long addr, unsigned long len, 30extern int protect(struct mm_id * mm_idp, unsigned long addr,
29 int r, int w, int x); 31 unsigned long len, int r, int w, int x);
30extern void user_signal(int sig, union uml_pt_regs *regs, int pid); 32extern void user_signal(int sig, union uml_pt_regs *regs, int pid);
31extern int new_mm(int from); 33extern int new_mm(int from);
32extern void start_userspace(int cpu); 34extern int start_userspace(unsigned long stub_stack);
35extern int copy_context_skas0(unsigned long stack, int pid);
33extern void get_skas_faultinfo(int pid, struct faultinfo * fi); 36extern void get_skas_faultinfo(int pid, struct faultinfo * fi);
34extern long execute_syscall_skas(void *r); 37extern long execute_syscall_skas(void *r);
38extern unsigned long current_stub_stack(void);
35 39
36#endif 40#endif
37 41
diff --git a/arch/um/kernel/skas/include/stub-data.h b/arch/um/kernel/skas/include/stub-data.h
new file mode 100644
index 0000000000..f6ed92c372
--- /dev/null
+++ b/arch/um/kernel/skas/include/stub-data.h
@@ -0,0 +1,18 @@
1/*
2 * Copyright (C) 2005 Jeff Dike (jdike@karaya.com)
3 * Licensed under the GPL
4 */
5
6#ifndef __STUB_DATA_H
7#define __STUB_DATA_H
8
9#include <sys/time.h>
10
11struct stub_data {
12 long offset;
13 int fd;
14 struct itimerval timer;
15 long err;
16};
17
18#endif
diff --git a/arch/um/kernel/skas/mem.c b/arch/um/kernel/skas/mem.c
index 438db2f434..147466d7ff 100644
--- a/arch/um/kernel/skas/mem.c
+++ b/arch/um/kernel/skas/mem.c
@@ -5,7 +5,9 @@
5 5
6#include "linux/config.h" 6#include "linux/config.h"
7#include "linux/mm.h" 7#include "linux/mm.h"
8#include "asm/pgtable.h"
8#include "mem_user.h" 9#include "mem_user.h"
10#include "skas.h"
9 11
10unsigned long set_task_sizes_skas(int arg, unsigned long *host_size_out, 12unsigned long set_task_sizes_skas(int arg, unsigned long *host_size_out,
11 unsigned long *task_size_out) 13 unsigned long *task_size_out)
@@ -18,7 +20,9 @@ unsigned long set_task_sizes_skas(int arg, unsigned long *host_size_out,
18 *task_size_out = CONFIG_HOST_TASK_SIZE; 20 *task_size_out = CONFIG_HOST_TASK_SIZE;
19#else 21#else
20 *host_size_out = top; 22 *host_size_out = top;
21 *task_size_out = top; 23 if (proc_mm && ptrace_faultinfo)
24 *task_size_out = top;
25 else *task_size_out = CONFIG_STUB_START & PGDIR_MASK;
22#endif 26#endif
23 return(((unsigned long) set_task_sizes_skas) & ~0xffffff); 27 return(((unsigned long) set_task_sizes_skas) & ~0xffffff);
24} 28}
diff --git a/arch/um/kernel/skas/mem_user.c b/arch/um/kernel/skas/mem_user.c
index 1310bf1e88..b0980ff3bd 100644
--- a/arch/um/kernel/skas/mem_user.c
+++ b/arch/um/kernel/skas/mem_user.c
@@ -3,100 +3,171 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include <signal.h>
6#include <errno.h> 7#include <errno.h>
7#include <sys/mman.h> 8#include <sys/mman.h>
9#include <sys/wait.h>
10#include <asm/page.h>
11#include <asm/unistd.h>
8#include "mem_user.h" 12#include "mem_user.h"
9#include "mem.h" 13#include "mem.h"
14#include "mm_id.h"
10#include "user.h" 15#include "user.h"
11#include "os.h" 16#include "os.h"
12#include "proc_mm.h" 17#include "proc_mm.h"
13 18#include "ptrace_user.h"
14void map(int fd, unsigned long virt, unsigned long len, int r, int w, 19#include "user_util.h"
15 int x, int phys_fd, unsigned long long offset) 20#include "kern_util.h"
21#include "task.h"
22#include "registers.h"
23#include "uml-config.h"
24#include "sysdep/ptrace.h"
25#include "sysdep/stub.h"
26#include "skas.h"
27
28extern unsigned long syscall_stub, __syscall_stub_start;
29
30extern void wait_stub_done(int pid, int sig, char * fname);
31
32static long run_syscall_stub(struct mm_id * mm_idp, int syscall,
33 unsigned long *args)
16{ 34{
17 struct proc_mm_op map; 35 int n, pid = mm_idp->u.pid;
18 int prot, n; 36 unsigned long regs[MAX_REG_NR];
19 37
20 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) | 38 get_safe_registers(regs);
21 (x ? PROT_EXEC : 0); 39 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
22 40 ((unsigned long) &syscall_stub -
23 map = ((struct proc_mm_op) { .op = MM_MMAP, 41 (unsigned long) &__syscall_stub_start);
24 .u = 42 /* XXX Don't have a define for starting a syscall */
25 { .mmap = 43 regs[REGS_SYSCALL_NR] = syscall;
26 { .addr = virt, 44 regs[REGS_SYSCALL_ARG1] = args[0];
27 .len = len, 45 regs[REGS_SYSCALL_ARG2] = args[1];
28 .prot = prot, 46 regs[REGS_SYSCALL_ARG3] = args[2];
29 .flags = MAP_SHARED | 47 regs[REGS_SYSCALL_ARG4] = args[3];
30 MAP_FIXED, 48 regs[REGS_SYSCALL_ARG5] = args[4];
31 .fd = phys_fd, 49 regs[REGS_SYSCALL_ARG6] = args[5];
32 .offset = offset 50 n = ptrace_setregs(pid, regs);
33 } } } ); 51 if(n < 0){
34 n = os_write_file(fd, &map, sizeof(map)); 52 printk("run_syscall_stub : PTRACE_SETREGS failed, "
35 if(n != sizeof(map)) 53 "errno = %d\n", n);
36 printk("map : /proc/mm map failed, err = %d\n", -n); 54 return(n);
55 }
56
57 wait_stub_done(pid, 0, "run_syscall_stub");
58
59 return(*((unsigned long *) mm_idp->stack));
37} 60}
38 61
39int unmap(int fd, void *addr, unsigned long len) 62int map(struct mm_id *mm_idp, unsigned long virt, unsigned long len,
63 int r, int w, int x, int phys_fd, unsigned long long offset)
40{ 64{
41 struct proc_mm_op unmap; 65 int prot, n;
42 int n; 66
43 67 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) |
44 unmap = ((struct proc_mm_op) { .op = MM_MUNMAP, 68 (x ? PROT_EXEC : 0);
45 .u = 69
46 { .munmap = 70 if(proc_mm){
47 { .addr = (unsigned long) addr, 71 struct proc_mm_op map;
48 .len = len } } } ); 72 int fd = mm_idp->u.mm_fd;
49 n = os_write_file(fd, &unmap, sizeof(unmap)); 73 map = ((struct proc_mm_op) { .op = MM_MMAP,
50 if(n != sizeof(unmap)) { 74 .u =
51 if(n < 0) 75 { .mmap =
52 return(n); 76 { .addr = virt,
53 else if(n > 0) 77 .len = len,
54 return(-EIO); 78 .prot = prot,
55 } 79 .flags = MAP_SHARED |
56 80 MAP_FIXED,
57 return(0); 81 .fd = phys_fd,
82 .offset= offset
83 } } } );
84 n = os_write_file(fd, &map, sizeof(map));
85 if(n != sizeof(map))
86 printk("map : /proc/mm map failed, err = %d\n", -n);
87 }
88 else {
89 long res;
90 unsigned long args[] = { virt, len, prot,
91 MAP_SHARED | MAP_FIXED, phys_fd,
92 MMAP_OFFSET(offset) };
93
94 res = run_syscall_stub(mm_idp, STUB_MMAP_NR, args);
95 if((void *) res == MAP_FAILED)
96 printk("mmap stub failed, errno = %d\n", res);
97 }
98
99 return 0;
58} 100}
59 101
60int protect(int fd, unsigned long addr, unsigned long len, int r, int w, 102int unmap(struct mm_id *mm_idp, void *addr, unsigned long len)
61 int x, int must_succeed)
62{ 103{
63 struct proc_mm_op protect; 104 int n;
64 int prot, n; 105
65 106 if(proc_mm){
66 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) | 107 struct proc_mm_op unmap;
67 (x ? PROT_EXEC : 0); 108 int fd = mm_idp->u.mm_fd;
68 109 unmap = ((struct proc_mm_op) { .op = MM_MUNMAP,
69 protect = ((struct proc_mm_op) { .op = MM_MPROTECT, 110 .u =
70 .u = 111 { .munmap =
71 { .mprotect = 112 { .addr =
72 { .addr = (unsigned long) addr, 113 (unsigned long) addr,
73 .len = len, 114 .len = len } } } );
74 .prot = prot } } } ); 115 n = os_write_file(fd, &unmap, sizeof(unmap));
75 116 if(n != sizeof(unmap)) {
76 n = os_write_file(fd, &protect, sizeof(protect)); 117 if(n < 0)
77 if(n != sizeof(protect)) { 118 return(n);
78 if(n == 0) return(0); 119 else if(n > 0)
79 120 return(-EIO);
80 if(must_succeed) 121 }
81 panic("protect failed, err = %d", -n); 122 }
82 123 else {
83 return(-EIO); 124 int res;
84 } 125 unsigned long args[] = { (unsigned long) addr, len, 0, 0, 0,
126 0 };
127
128 res = run_syscall_stub(mm_idp, __NR_munmap, args);
129 if(res < 0)
130 printk("munmap stub failed, errno = %d\n", res);
131 }
132
133 return(0);
134}
85 135
86 return(0); 136int protect(struct mm_id *mm_idp, unsigned long addr, unsigned long len,
137 int r, int w, int x)
138{
139 struct proc_mm_op protect;
140 int prot, n;
141
142 prot = (r ? PROT_READ : 0) | (w ? PROT_WRITE : 0) |
143 (x ? PROT_EXEC : 0);
144
145 if(proc_mm){
146 int fd = mm_idp->u.mm_fd;
147 protect = ((struct proc_mm_op) { .op = MM_MPROTECT,
148 .u =
149 { .mprotect =
150 { .addr =
151 (unsigned long) addr,
152 .len = len,
153 .prot = prot } } } );
154
155 n = os_write_file(fd, &protect, sizeof(protect));
156 if(n != sizeof(protect))
157 panic("protect failed, err = %d", -n);
158 }
159 else {
160 int res;
161 unsigned long args[] = { addr, len, prot, 0, 0, 0 };
162
163 res = run_syscall_stub(mm_idp, __NR_mprotect, args);
164 if(res < 0)
165 panic("mprotect stub failed, errno = %d\n", res);
166 }
167
168 return(0);
87} 169}
88 170
89void before_mem_skas(unsigned long unused) 171void before_mem_skas(unsigned long unused)
90{ 172{
91} 173}
92
93/*
94 * Overrides for Emacs so that we follow Linus's tabbing style.
95 * Emacs will notice this stuff at the end of the file and automatically
96 * adjust the settings for this buffer only. This must remain at the end
97 * of the file.
98 * ---------------------------------------------------------------------------
99 * Local variables:
100 * c-file-style: "linux"
101 * End:
102 */
diff --git a/arch/um/kernel/skas/mmu.c b/arch/um/kernel/skas/mmu.c
index 6cb9a6d028..d232daa42c 100644
--- a/arch/um/kernel/skas/mmu.c
+++ b/arch/um/kernel/skas/mmu.c
@@ -3,46 +3,143 @@
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
6#include "linux/config.h"
6#include "linux/sched.h" 7#include "linux/sched.h"
7#include "linux/list.h" 8#include "linux/list.h"
8#include "linux/spinlock.h" 9#include "linux/spinlock.h"
9#include "linux/slab.h" 10#include "linux/slab.h"
11#include "linux/errno.h"
12#include "linux/mm.h"
10#include "asm/current.h" 13#include "asm/current.h"
11#include "asm/segment.h" 14#include "asm/segment.h"
12#include "asm/mmu.h" 15#include "asm/mmu.h"
16#include "asm/pgalloc.h"
17#include "asm/pgtable.h"
13#include "os.h" 18#include "os.h"
14#include "skas.h" 19#include "skas.h"
15 20
21extern int __syscall_stub_start;
22
23static int init_stub_pte(struct mm_struct *mm, unsigned long proc,
24 unsigned long kernel)
25{
26 pgd_t *pgd;
27 pud_t *pud;
28 pmd_t *pmd;
29 pte_t *pte;
30
31 spin_lock(&mm->page_table_lock);
32 pgd = pgd_offset(mm, proc);
33 pud = pud_alloc(mm, pgd, proc);
34 if (!pud)
35 goto out;
36
37 pmd = pmd_alloc(mm, pud, proc);
38 if (!pmd)
39 goto out_pmd;
40
41 pte = pte_alloc_map(mm, pmd, proc);
42 if (!pte)
43 goto out_pte;
44
45 /* There's an interaction between the skas0 stub pages, stack
46 * randomization, and the BUG at the end of exit_mmap. exit_mmap
47 * checks that the number of page tables freed is the same as had
48 * been allocated. If the stack is on the last page table page,
49 * then the stack pte page will be freed, and if not, it won't. To
50 * avoid having to know where the stack is, or if the process mapped
51 * something at the top of its address space for some other reason,
52 * we set TASK_SIZE to end at the start of the last page table.
53 * This keeps exit_mmap off the last page, but introduces a leak
54 * of that page. So, we hang onto it here and free it in
55 * destroy_context_skas.
56 */
57
58 mm->context.skas.last_page_table = pmd_page_kernel(*pmd);
59
60 *pte = mk_pte(virt_to_page(kernel), __pgprot(_PAGE_PRESENT));
61 *pte = pte_mkexec(*pte);
62 *pte = pte_wrprotect(*pte);
63 spin_unlock(&mm->page_table_lock);
64 return(0);
65
66 out_pmd:
67 pud_free(pud);
68 out_pte:
69 pmd_free(pmd);
70 out:
71 spin_unlock(&mm->page_table_lock);
72 return(-ENOMEM);
73}
74
16int init_new_context_skas(struct task_struct *task, struct mm_struct *mm) 75int init_new_context_skas(struct task_struct *task, struct mm_struct *mm)
17{ 76{
18 int from; 77 struct mm_struct *cur_mm = current->mm;
78 struct mm_id *cur_mm_id = &cur_mm->context.skas.id;
79 struct mm_id *mm_id = &mm->context.skas.id;
80 unsigned long stack;
81 int from, ret;
19 82
20 if((current->mm != NULL) && (current->mm != &init_mm)) 83 if(proc_mm){
21 from = current->mm->context.skas.mm_fd; 84 if((cur_mm != NULL) && (cur_mm != &init_mm))
22 else from = -1; 85 from = cur_mm->context.skas.id.u.mm_fd;
86 else from = -1;
23 87
24 mm->context.skas.mm_fd = new_mm(from); 88 ret = new_mm(from);
25 if(mm->context.skas.mm_fd < 0){ 89 if(ret < 0){
26 printk("init_new_context_skas - new_mm failed, errno = %d\n", 90 printk("init_new_context_skas - new_mm failed, "
27 mm->context.skas.mm_fd); 91 "errno = %d\n", ret);
28 return(mm->context.skas.mm_fd); 92 return ret;
93 }
94 mm_id->u.mm_fd = ret;
29 } 95 }
96 else {
97 /* This zeros the entry that pgd_alloc didn't, needed since
98 * we are about to reinitialize it, and want mm.nr_ptes to
99 * be accurate.
100 */
101 mm->pgd[USER_PTRS_PER_PGD] = __pgd(0);
30 102
31 return(0); 103 ret = init_stub_pte(mm, CONFIG_STUB_CODE,
104 (unsigned long) &__syscall_stub_start);
105 if(ret)
106 goto out;
107
108 ret = -ENOMEM;
109 stack = get_zeroed_page(GFP_KERNEL);
110 if(stack == 0)
111 goto out;
112 mm_id->stack = stack;
113
114 ret = init_stub_pte(mm, CONFIG_STUB_DATA, stack);
115 if(ret)
116 goto out_free;
117
118 mm->nr_ptes--;
119
120 if((cur_mm != NULL) && (cur_mm != &init_mm))
121 mm_id->u.pid = copy_context_skas0(stack,
122 cur_mm_id->u.pid);
123 else mm_id->u.pid = start_userspace(stack);
124 }
125
126 return 0;
127
128 out_free:
129 free_page(mm_id->stack);
130 out:
131 return ret;
32} 132}
33 133
34void destroy_context_skas(struct mm_struct *mm) 134void destroy_context_skas(struct mm_struct *mm)
35{ 135{
36 os_close_file(mm->context.skas.mm_fd); 136 struct mmu_context_skas *mmu = &mm->context.skas;
37}
38 137
39/* 138 if(proc_mm)
40 * Overrides for Emacs so that we follow Linus's tabbing style. 139 os_close_file(mmu->id.u.mm_fd);
41 * Emacs will notice this stuff at the end of the file and automatically 140 else {
42 * adjust the settings for this buffer only. This must remain at the end 141 os_kill_ptraced_process(mmu->id.u.pid, 1);
43 * of the file. 142 free_page(mmu->id.stack);
44 * --------------------------------------------------------------------------- 143 free_page(mmu->last_page_table);
45 * Local variables: 144 }
46 * c-file-style: "linux" 145}
47 * End:
48 */
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index 773cd2b525..ba671dab88 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) 2 * Copyright (C) 2002- 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL 3 * Licensed under the GPL
4 */ 4 */
5 5
@@ -13,7 +13,9 @@
13#include <sys/wait.h> 13#include <sys/wait.h>
14#include <sys/mman.h> 14#include <sys/mman.h>
15#include <sys/user.h> 15#include <sys/user.h>
16#include <sys/time.h>
16#include <asm/unistd.h> 17#include <asm/unistd.h>
18#include <asm/types.h>
17#include "user.h" 19#include "user.h"
18#include "ptrace_user.h" 20#include "ptrace_user.h"
19#include "time_user.h" 21#include "time_user.h"
@@ -21,13 +23,18 @@
21#include "user_util.h" 23#include "user_util.h"
22#include "kern_util.h" 24#include "kern_util.h"
23#include "skas.h" 25#include "skas.h"
26#include "stub-data.h"
27#include "mm_id.h"
24#include "sysdep/sigcontext.h" 28#include "sysdep/sigcontext.h"
29#include "sysdep/stub.h"
25#include "os.h" 30#include "os.h"
26#include "proc_mm.h" 31#include "proc_mm.h"
27#include "skas_ptrace.h" 32#include "skas_ptrace.h"
28#include "chan_user.h" 33#include "chan_user.h"
29#include "signal_user.h" 34#include "signal_user.h"
30#include "registers.h" 35#include "registers.h"
36#include "mem.h"
37#include "uml-config.h"
31#include "process.h" 38#include "process.h"
32 39
33int is_skas_winch(int pid, int fd, void *data) 40int is_skas_winch(int pid, int fd, void *data)
@@ -39,20 +46,55 @@ int is_skas_winch(int pid, int fd, void *data)
39 return(1); 46 return(1);
40} 47}
41 48
42void get_skas_faultinfo(int pid, struct faultinfo * fi) 49void wait_stub_done(int pid, int sig, char * fname)
43{ 50{
44 int err; 51 int n, status, err;
45 52
46 err = ptrace(PTRACE_FAULTINFO, pid, 0, fi); 53 do {
47 if(err) 54 if ( sig != -1 ) {
48 panic("get_skas_faultinfo - PTRACE_FAULTINFO failed, " 55 err = ptrace(PTRACE_CONT, pid, 0, sig);
49 "errno = %d\n", errno); 56 if(err)
57 panic("%s : continue failed, errno = %d\n",
58 fname, errno);
59 }
60 sig = 0;
61
62 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
63 } while((n >= 0) && WIFSTOPPED(status) &&
64 (WSTOPSIG(status) == SIGVTALRM));
65
66 if((n < 0) || !WIFSTOPPED(status) ||
67 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status != SIGTRAP))){
68 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
69 "pid = %d, n = %d, errno = %d, status = 0x%x\n",
70 fname, pid, n, errno, status);
71 }
72}
50 73
51 /* Special handling for i386, which has different structs */ 74void get_skas_faultinfo(int pid, struct faultinfo * fi)
52 if (sizeof(struct ptrace_faultinfo) < sizeof(struct faultinfo)) 75{
53 memset((char *)fi + sizeof(struct ptrace_faultinfo), 0, 76 int err;
54 sizeof(struct faultinfo) - 77
55 sizeof(struct ptrace_faultinfo)); 78 if(ptrace_faultinfo){
79 err = ptrace(PTRACE_FAULTINFO, pid, 0, fi);
80 if(err)
81 panic("get_skas_faultinfo - PTRACE_FAULTINFO failed, "
82 "errno = %d\n", errno);
83
84 /* Special handling for i386, which has different structs */
85 if (sizeof(struct ptrace_faultinfo) < sizeof(struct faultinfo))
86 memset((char *)fi + sizeof(struct ptrace_faultinfo), 0,
87 sizeof(struct faultinfo) -
88 sizeof(struct ptrace_faultinfo));
89 }
90 else {
91 wait_stub_done(pid, SIGSEGV, "get_skas_faultinfo");
92
93 /* faultinfo is prepared by the stub-segv-handler at start of
94 * the stub stack page. We just have to copy it.
95 */
96 memcpy(fi, (void *)current_stub_stack(), sizeof(*fi));
97 }
56} 98}
57 99
58static void handle_segv(int pid, union uml_pt_regs * regs) 100static void handle_segv(int pid, union uml_pt_regs * regs)
@@ -91,11 +133,56 @@ static void handle_trap(int pid, union uml_pt_regs *regs, int local_using_sysemu
91 handle_syscall(regs); 133 handle_syscall(regs);
92} 134}
93 135
94static int userspace_tramp(void *arg) 136extern int __syscall_stub_start;
137
138static int userspace_tramp(void *stack)
95{ 139{
96 init_new_thread_signals(0); 140 void *addr;
97 enable_timer(); 141
98 ptrace(PTRACE_TRACEME, 0, 0, 0); 142 ptrace(PTRACE_TRACEME, 0, 0, 0);
143
144 init_new_thread_signals(1);
145 enable_timer();
146
147 if(!proc_mm){
148 /* This has a pte, but it can't be mapped in with the usual
149 * tlb_flush mechanism because this is part of that mechanism
150 */
151 int fd;
152 __u64 offset;
153
154 fd = phys_mapping(to_phys(&__syscall_stub_start), &offset);
155 addr = mmap64((void *) UML_CONFIG_STUB_CODE, page_size(),
156 PROT_EXEC, MAP_FIXED | MAP_PRIVATE, fd, offset);
157 if(addr == MAP_FAILED){
158 printk("mapping mmap stub failed, errno = %d\n",
159 errno);
160 exit(1);
161 }
162
163 if(stack != NULL){
164 fd = phys_mapping(to_phys(stack), &offset);
165 addr = mmap((void *) UML_CONFIG_STUB_DATA, page_size(),
166 PROT_READ | PROT_WRITE,
167 MAP_FIXED | MAP_SHARED, fd, offset);
168 if(addr == MAP_FAILED){
169 printk("mapping segfault stack failed, "
170 "errno = %d\n", errno);
171 exit(1);
172 }
173 }
174 }
175 if(!ptrace_faultinfo && (stack != NULL)){
176 unsigned long v = UML_CONFIG_STUB_CODE +
177 (unsigned long) stub_segv_handler -
178 (unsigned long) &__syscall_stub_start;
179
180 set_sigstack((void *) UML_CONFIG_STUB_DATA, page_size());
181 set_handler(SIGSEGV, (void *) v, SA_ONSTACK,
182 SIGIO, SIGWINCH, SIGALRM, SIGVTALRM,
183 SIGUSR1, -1);
184 }
185
99 os_stop_process(os_getpid()); 186 os_stop_process(os_getpid());
100 return(0); 187 return(0);
101} 188}
@@ -105,11 +192,11 @@ static int userspace_tramp(void *arg)
105#define NR_CPUS 1 192#define NR_CPUS 1
106int userspace_pid[NR_CPUS]; 193int userspace_pid[NR_CPUS];
107 194
108void start_userspace(int cpu) 195int start_userspace(unsigned long stub_stack)
109{ 196{
110 void *stack; 197 void *stack;
111 unsigned long sp; 198 unsigned long sp;
112 int pid, status, n; 199 int pid, status, n, flags;
113 200
114 stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, 201 stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,
115 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); 202 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
@@ -117,8 +204,9 @@ void start_userspace(int cpu)
117 panic("start_userspace : mmap failed, errno = %d", errno); 204 panic("start_userspace : mmap failed, errno = %d", errno);
118 sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *); 205 sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *);
119 206
120 pid = clone(userspace_tramp, (void *) sp, 207 flags = CLONE_FILES | SIGCHLD;
121 CLONE_FILES | CLONE_VM | SIGCHLD, NULL); 208 if(proc_mm) flags |= CLONE_VM;
209 pid = clone(userspace_tramp, (void *) sp, flags, (void *) stub_stack);
122 if(pid < 0) 210 if(pid < 0)
123 panic("start_userspace : clone failed, errno = %d", errno); 211 panic("start_userspace : clone failed, errno = %d", errno);
124 212
@@ -140,7 +228,7 @@ void start_userspace(int cpu)
140 if(munmap(stack, PAGE_SIZE) < 0) 228 if(munmap(stack, PAGE_SIZE) < 0)
141 panic("start_userspace : munmap failed, errno = %d\n", errno); 229 panic("start_userspace : munmap failed, errno = %d\n", errno);
142 230
143 userspace_pid[cpu] = pid; 231 return(pid);
144} 232}
145 233
146void userspace(union uml_pt_regs *regs) 234void userspace(union uml_pt_regs *regs)
@@ -174,7 +262,9 @@ void userspace(union uml_pt_regs *regs)
174 if(WIFSTOPPED(status)){ 262 if(WIFSTOPPED(status)){
175 switch(WSTOPSIG(status)){ 263 switch(WSTOPSIG(status)){
176 case SIGSEGV: 264 case SIGSEGV:
177 handle_segv(pid, regs); 265 if(PTRACE_FULL_FAULTINFO || !ptrace_faultinfo)
266 user_signal(SIGSEGV, regs, pid);
267 else handle_segv(pid, regs);
178 break; 268 break;
179 case SIGTRAP + 0x80: 269 case SIGTRAP + 0x80:
180 handle_trap(pid, regs, local_using_sysemu); 270 handle_trap(pid, regs, local_using_sysemu);
@@ -194,6 +284,7 @@ void userspace(union uml_pt_regs *regs)
194 printk("userspace - child stopped with signal " 284 printk("userspace - child stopped with signal "
195 "%d\n", WSTOPSIG(status)); 285 "%d\n", WSTOPSIG(status));
196 } 286 }
287 pid = userspace_pid[0];
197 interrupt_end(); 288 interrupt_end();
198 289
199 /* Avoid -ERESTARTSYS handling in host */ 290 /* Avoid -ERESTARTSYS handling in host */
@@ -207,6 +298,67 @@ void userspace(union uml_pt_regs *regs)
207#define INIT_JMP_HALT 3 298#define INIT_JMP_HALT 3
208#define INIT_JMP_REBOOT 4 299#define INIT_JMP_REBOOT 4
209 300
301
302int copy_context_skas0(unsigned long new_stack, int pid)
303{
304 int err;
305 unsigned long regs[MAX_REG_NR];
306 unsigned long current_stack = current_stub_stack();
307 struct stub_data *data = (struct stub_data *) current_stack;
308 struct stub_data *child_data = (struct stub_data *) new_stack;
309 __u64 new_offset;
310 int new_fd = phys_mapping(to_phys((void *)new_stack), &new_offset);
311
312 /* prepare offset and fd of child's stack as argument for parent's
313 * and child's mmap2 calls
314 */
315 *data = ((struct stub_data) { .offset = MMAP_OFFSET(new_offset),
316 .fd = new_fd,
317 .timer = ((struct itimerval)
318 { { 0, 1000000 / hz() },
319 { 0, 1000000 / hz() }})});
320 get_safe_registers(regs);
321
322 /* Set parent's instruction pointer to start of clone-stub */
323 regs[REGS_IP_INDEX] = UML_CONFIG_STUB_CODE +
324 (unsigned long) stub_clone_handler -
325 (unsigned long) &__syscall_stub_start;
326 regs[REGS_SP_INDEX] = UML_CONFIG_STUB_DATA + PAGE_SIZE -
327 sizeof(void *);
328 err = ptrace_setregs(pid, regs);
329 if(err < 0)
330 panic("copy_context_skas0 : PTRACE_SETREGS failed, "
331 "pid = %d, errno = %d\n", pid, errno);
332
333 /* set a well known return code for detection of child write failure */
334 child_data->err = 12345678;
335
336 /* Wait, until parent has finished its work: read child's pid from
337 * parent's stack, and check, if bad result.
338 */
339 wait_stub_done(pid, 0, "copy_context_skas0");
340
341 pid = data->err;
342 if(pid < 0)
343 panic("copy_context_skas0 - stub-parent reports error %d\n",
344 pid);
345
346 /* Wait, until child has finished too: read child's result from
347 * child's stack and check it.
348 */
349 wait_stub_done(pid, -1, "copy_context_skas0");
350 if (child_data->err != UML_CONFIG_STUB_DATA)
351 panic("copy_context_skas0 - stub-child reports error %d\n",
352 child_data->err);
353
354 if (ptrace(PTRACE_OLDSETOPTIONS, pid, NULL,
355 (void *)PTRACE_O_TRACESYSGOOD) < 0)
356 panic("copy_context_skas0 : PTRACE_SETOPTIONS failed, "
357 "errno = %d\n", errno);
358
359 return pid;
360}
361
210void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr, 362void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
211 void (*handler)(int)) 363 void (*handler)(int))
212{ 364{
@@ -334,21 +486,19 @@ void reboot_skas(void)
334 siglongjmp(initial_jmpbuf, INIT_JMP_REBOOT); 486 siglongjmp(initial_jmpbuf, INIT_JMP_REBOOT);
335} 487}
336 488
337void switch_mm_skas(int mm_fd) 489void switch_mm_skas(struct mm_id *mm_idp)
338{ 490{
339 int err; 491 int err;
340 492
341#warning need cpu pid in switch_mm_skas 493#warning need cpu pid in switch_mm_skas
342 err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0, mm_fd); 494 if(proc_mm){
343 if(err) 495 err = ptrace(PTRACE_SWITCH_MM, userspace_pid[0], 0,
344 panic("switch_mm_skas - PTRACE_SWITCH_MM failed, errno = %d\n", 496 mm_idp->u.mm_fd);
345 errno); 497 if(err)
346} 498 panic("switch_mm_skas - PTRACE_SWITCH_MM failed, "
347 499 "errno = %d\n", errno);
348void kill_off_processes_skas(void) 500 }
349{ 501 else userspace_pid[0] = mm_idp->u.pid;
350#warning need to loop over userspace_pids in kill_off_processes_skas
351 os_kill_ptraced_process(userspace_pid[0], 1);
352} 502}
353 503
354/* 504/*
diff --git a/arch/um/kernel/skas/process_kern.c b/arch/um/kernel/skas/process_kern.c
index 0a7b8aa55d..cbabab104a 100644
--- a/arch/um/kernel/skas/process_kern.c
+++ b/arch/um/kernel/skas/process_kern.c
@@ -175,9 +175,12 @@ static int start_kernel_proc(void *unused)
175 return(0); 175 return(0);
176} 176}
177 177
178extern int userspace_pid[];
179
178int start_uml_skas(void) 180int start_uml_skas(void)
179{ 181{
180 start_userspace(0); 182 if(proc_mm)
183 userspace_pid[0] = start_userspace(0);
181 184
182 init_new_thread_signals(1); 185 init_new_thread_signals(1);
183 186
@@ -199,3 +202,31 @@ int thread_pid_skas(struct task_struct *task)
199#warning Need to look up userspace_pid by cpu 202#warning Need to look up userspace_pid by cpu
200 return(userspace_pid[0]); 203 return(userspace_pid[0]);
201} 204}
205
206void kill_off_processes_skas(void)
207{
208 if(proc_mm)
209#warning need to loop over userspace_pids in kill_off_processes_skas
210 os_kill_ptraced_process(userspace_pid[0], 1);
211 else {
212 struct task_struct *p;
213 int pid, me;
214
215 me = os_getpid();
216 for_each_process(p){
217 if(p->mm == NULL)
218 continue;
219
220 pid = p->mm->context.skas.id.u.pid;
221 os_kill_ptraced_process(pid, 1);
222 }
223 }
224}
225
226unsigned long current_stub_stack(void)
227{
228 if(current->mm == NULL)
229 return(0);
230
231 return(current->mm->context.skas.id.stack);
232}
diff --git a/arch/um/kernel/skas/tlb.c b/arch/um/kernel/skas/tlb.c
index b8c5e71763..6230999c67 100644
--- a/arch/um/kernel/skas/tlb.c
+++ b/arch/um/kernel/skas/tlb.c
@@ -6,6 +6,7 @@
6 6
7#include "linux/stddef.h" 7#include "linux/stddef.h"
8#include "linux/sched.h" 8#include "linux/sched.h"
9#include "linux/config.h"
9#include "linux/mm.h" 10#include "linux/mm.h"
10#include "asm/page.h" 11#include "asm/page.h"
11#include "asm/pgtable.h" 12#include "asm/pgtable.h"
@@ -17,7 +18,7 @@
17#include "os.h" 18#include "os.h"
18#include "tlb.h" 19#include "tlb.h"
19 20
20static void do_ops(int fd, struct host_vm_op *ops, int last) 21static void do_ops(union mm_context *mmu, struct host_vm_op *ops, int last)
21{ 22{
22 struct host_vm_op *op; 23 struct host_vm_op *op;
23 int i; 24 int i;
@@ -26,18 +27,18 @@ static void do_ops(int fd, struct host_vm_op *ops, int last)
26 op = &ops[i]; 27 op = &ops[i];
27 switch(op->type){ 28 switch(op->type){
28 case MMAP: 29 case MMAP:
29 map(fd, op->u.mmap.addr, op->u.mmap.len, 30 map(&mmu->skas.id, op->u.mmap.addr, op->u.mmap.len,
30 op->u.mmap.r, op->u.mmap.w, op->u.mmap.x, 31 op->u.mmap.r, op->u.mmap.w, op->u.mmap.x,
31 op->u.mmap.fd, op->u.mmap.offset); 32 op->u.mmap.fd, op->u.mmap.offset);
32 break; 33 break;
33 case MUNMAP: 34 case MUNMAP:
34 unmap(fd, (void *) op->u.munmap.addr, 35 unmap(&mmu->skas.id, (void *) op->u.munmap.addr,
35 op->u.munmap.len); 36 op->u.munmap.len);
36 break; 37 break;
37 case MPROTECT: 38 case MPROTECT:
38 protect(fd, op->u.mprotect.addr, op->u.mprotect.len, 39 protect(&mmu->skas.id, op->u.mprotect.addr,
39 op->u.mprotect.r, op->u.mprotect.w, 40 op->u.mprotect.len, op->u.mprotect.r,
40 op->u.mprotect.x); 41 op->u.mprotect.w, op->u.mprotect.x);
41 break; 42 break;
42 default: 43 default:
43 printk("Unknown op type %d in do_ops\n", op->type); 44 printk("Unknown op type %d in do_ops\n", op->type);
@@ -46,12 +47,15 @@ static void do_ops(int fd, struct host_vm_op *ops, int last)
46 } 47 }
47} 48}
48 49
50extern int proc_mm;
51
49static void fix_range(struct mm_struct *mm, unsigned long start_addr, 52static void fix_range(struct mm_struct *mm, unsigned long start_addr,
50 unsigned long end_addr, int force) 53 unsigned long end_addr, int force)
51{ 54{
52 int fd = mm->context.skas.mm_fd; 55 if(!proc_mm && (end_addr > CONFIG_STUB_START))
56 end_addr = CONFIG_STUB_START;
53 57
54 fix_range_common(mm, start_addr, end_addr, force, fd, do_ops); 58 fix_range_common(mm, start_addr, end_addr, force, do_ops);
55} 59}
56 60
57void __flush_tlb_one_skas(unsigned long addr) 61void __flush_tlb_one_skas(unsigned long addr)
@@ -69,17 +73,20 @@ void flush_tlb_range_skas(struct vm_area_struct *vma, unsigned long start,
69 73
70void flush_tlb_mm_skas(struct mm_struct *mm) 74void flush_tlb_mm_skas(struct mm_struct *mm)
71{ 75{
76 unsigned long end;
77
72 /* Don't bother flushing if this address space is about to be 78 /* Don't bother flushing if this address space is about to be
73 * destroyed. 79 * destroyed.
74 */ 80 */
75 if(atomic_read(&mm->mm_users) == 0) 81 if(atomic_read(&mm->mm_users) == 0)
76 return; 82 return;
77 83
78 fix_range(mm, 0, host_task_size, 0); 84 end = proc_mm ? task_size : CONFIG_STUB_START;
79 flush_tlb_kernel_range_common(start_vm, end_vm); 85 fix_range(mm, 0, end, 0);
80} 86}
81 87
82void force_flush_all_skas(void) 88void force_flush_all_skas(void)
83{ 89{
84 fix_range(current->mm, 0, host_task_size, 1); 90 unsigned long end = proc_mm ? task_size : CONFIG_STUB_START;
91 fix_range(current->mm, 0, end, 1);
85} 92}
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index f829b309b6..c40b611e3d 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -48,6 +48,13 @@ void enable_timer(void)
48 set_interval(ITIMER_VIRTUAL); 48 set_interval(ITIMER_VIRTUAL);
49} 49}
50 50
51void prepare_timer(void * ptr)
52{
53 int usec = 1000000/hz();
54 *(struct itimerval *)ptr = ((struct itimerval) { { 0, usec },
55 { 0, usec }});
56}
57
51void disable_timer(void) 58void disable_timer(void)
52{ 59{
53 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }}); 60 struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }});
diff --git a/arch/um/kernel/tlb.c b/arch/um/kernel/tlb.c
index eda477edfd..83ec8d4747 100644
--- a/arch/um/kernel/tlb.c
+++ b/arch/um/kernel/tlb.c
@@ -18,13 +18,15 @@
18#define ADD_ROUND(n, inc) (((n) + (inc)) & ~((inc) - 1)) 18#define ADD_ROUND(n, inc) (((n) + (inc)) & ~((inc) - 1))
19 19
20void fix_range_common(struct mm_struct *mm, unsigned long start_addr, 20void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
21 unsigned long end_addr, int force, int data, 21 unsigned long end_addr, int force,
22 void (*do_ops)(int, struct host_vm_op *, int)) 22 void (*do_ops)(union mm_context *, struct host_vm_op *,
23 int))
23{ 24{
24 pgd_t *npgd; 25 pgd_t *npgd;
25 pud_t *npud; 26 pud_t *npud;
26 pmd_t *npmd; 27 pmd_t *npmd;
27 pte_t *npte; 28 pte_t *npte;
29 union mm_context *mmu = &mm->context;
28 unsigned long addr, end; 30 unsigned long addr, end;
29 int r, w, x; 31 int r, w, x;
30 struct host_vm_op ops[16]; 32 struct host_vm_op ops[16];
@@ -40,7 +42,7 @@ void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
40 end = end_addr; 42 end = end_addr;
41 if(force || pgd_newpage(*npgd)){ 43 if(force || pgd_newpage(*npgd)){
42 op_index = add_munmap(addr, end - addr, ops, 44 op_index = add_munmap(addr, end - addr, ops,
43 op_index, last_op, data, 45 op_index, last_op, mmu,
44 do_ops); 46 do_ops);
45 pgd_mkuptodate(*npgd); 47 pgd_mkuptodate(*npgd);
46 } 48 }
@@ -55,7 +57,7 @@ void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
55 end = end_addr; 57 end = end_addr;
56 if(force || pud_newpage(*npud)){ 58 if(force || pud_newpage(*npud)){
57 op_index = add_munmap(addr, end - addr, ops, 59 op_index = add_munmap(addr, end - addr, ops,
58 op_index, last_op, data, 60 op_index, last_op, mmu,
59 do_ops); 61 do_ops);
60 pud_mkuptodate(*npud); 62 pud_mkuptodate(*npud);
61 } 63 }
@@ -70,7 +72,7 @@ void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
70 end = end_addr; 72 end = end_addr;
71 if(force || pmd_newpage(*npmd)){ 73 if(force || pmd_newpage(*npmd)){
72 op_index = add_munmap(addr, end - addr, ops, 74 op_index = add_munmap(addr, end - addr, ops,
73 op_index, last_op, data, 75 op_index, last_op, mmu,
74 do_ops); 76 do_ops);
75 pmd_mkuptodate(*npmd); 77 pmd_mkuptodate(*npmd);
76 } 78 }
@@ -93,21 +95,21 @@ void fix_range_common(struct mm_struct *mm, unsigned long start_addr,
93 op_index = add_mmap(addr, 95 op_index = add_mmap(addr,
94 pte_val(*npte) & PAGE_MASK, 96 pte_val(*npte) & PAGE_MASK,
95 PAGE_SIZE, r, w, x, ops, 97 PAGE_SIZE, r, w, x, ops,
96 op_index, last_op, data, 98 op_index, last_op, mmu,
97 do_ops); 99 do_ops);
98 else op_index = add_munmap(addr, PAGE_SIZE, ops, 100 else op_index = add_munmap(addr, PAGE_SIZE, ops,
99 op_index, last_op, data, 101 op_index, last_op, mmu,
100 do_ops); 102 do_ops);
101 } 103 }
102 else if(pte_newprot(*npte)) 104 else if(pte_newprot(*npte))
103 op_index = add_mprotect(addr, PAGE_SIZE, r, w, x, ops, 105 op_index = add_mprotect(addr, PAGE_SIZE, r, w, x, ops,
104 op_index, last_op, data, 106 op_index, last_op, mmu,
105 do_ops); 107 do_ops);
106 108
107 *npte = pte_mkuptodate(*npte); 109 *npte = pte_mkuptodate(*npte);
108 addr += PAGE_SIZE; 110 addr += PAGE_SIZE;
109 } 111 }
110 (*do_ops)(data, ops, op_index); 112 (*do_ops)(mmu, ops, op_index);
111} 113}
112 114
113int flush_tlb_kernel_range_common(unsigned long start, unsigned long end) 115int flush_tlb_kernel_range_common(unsigned long start, unsigned long end)
@@ -195,51 +197,6 @@ int flush_tlb_kernel_range_common(unsigned long start, unsigned long end)
195 return(updated); 197 return(updated);
196} 198}
197 199
198void flush_tlb_page(struct vm_area_struct *vma, unsigned long address)
199{
200 address &= PAGE_MASK;
201 flush_tlb_range(vma, address, address + PAGE_SIZE);
202}
203
204void flush_tlb_all(void)
205{
206 flush_tlb_mm(current->mm);
207}
208
209void flush_tlb_kernel_range(unsigned long start, unsigned long end)
210{
211 CHOOSE_MODE_PROC(flush_tlb_kernel_range_tt,
212 flush_tlb_kernel_range_common, start, end);
213}
214
215void flush_tlb_kernel_vm(void)
216{
217 CHOOSE_MODE(flush_tlb_kernel_vm_tt(),
218 flush_tlb_kernel_range_common(start_vm, end_vm));
219}
220
221void __flush_tlb_one(unsigned long addr)
222{
223 CHOOSE_MODE_PROC(__flush_tlb_one_tt, __flush_tlb_one_skas, addr);
224}
225
226void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
227 unsigned long end)
228{
229 CHOOSE_MODE_PROC(flush_tlb_range_tt, flush_tlb_range_skas, vma, start,
230 end);
231}
232
233void flush_tlb_mm(struct mm_struct *mm)
234{
235 CHOOSE_MODE_PROC(flush_tlb_mm_tt, flush_tlb_mm_skas, mm);
236}
237
238void force_flush_all(void)
239{
240 CHOOSE_MODE(force_flush_all_tt(), force_flush_all_skas());
241}
242
243pgd_t *pgd_offset_proc(struct mm_struct *mm, unsigned long address) 200pgd_t *pgd_offset_proc(struct mm_struct *mm, unsigned long address)
244{ 201{
245 return(pgd_offset(mm, address)); 202 return(pgd_offset(mm, address));
@@ -270,9 +227,9 @@ pte_t *addr_pte(struct task_struct *task, unsigned long addr)
270} 227}
271 228
272int add_mmap(unsigned long virt, unsigned long phys, unsigned long len, 229int add_mmap(unsigned long virt, unsigned long phys, unsigned long len,
273 int r, int w, int x, struct host_vm_op *ops, int index, 230 int r, int w, int x, struct host_vm_op *ops, int index,
274 int last_filled, int data, 231 int last_filled, union mm_context *mmu,
275 void (*do_ops)(int, struct host_vm_op *, int)) 232 void (*do_ops)(union mm_context *, struct host_vm_op *, int))
276{ 233{
277 __u64 offset; 234 __u64 offset;
278 struct host_vm_op *last; 235 struct host_vm_op *last;
@@ -292,7 +249,7 @@ int add_mmap(unsigned long virt, unsigned long phys, unsigned long len,
292 } 249 }
293 250
294 if(index == last_filled){ 251 if(index == last_filled){
295 (*do_ops)(data, ops, last_filled); 252 (*do_ops)(mmu, ops, last_filled);
296 index = -1; 253 index = -1;
297 } 254 }
298 255
@@ -310,8 +267,8 @@ int add_mmap(unsigned long virt, unsigned long phys, unsigned long len,
310} 267}
311 268
312int add_munmap(unsigned long addr, unsigned long len, struct host_vm_op *ops, 269int add_munmap(unsigned long addr, unsigned long len, struct host_vm_op *ops,
313 int index, int last_filled, int data, 270 int index, int last_filled, union mm_context *mmu,
314 void (*do_ops)(int, struct host_vm_op *, int)) 271 void (*do_ops)(union mm_context *, struct host_vm_op *, int))
315{ 272{
316 struct host_vm_op *last; 273 struct host_vm_op *last;
317 274
@@ -325,7 +282,7 @@ int add_munmap(unsigned long addr, unsigned long len, struct host_vm_op *ops,
325 } 282 }
326 283
327 if(index == last_filled){ 284 if(index == last_filled){
328 (*do_ops)(data, ops, last_filled); 285 (*do_ops)(mmu, ops, last_filled);
329 index = -1; 286 index = -1;
330 } 287 }
331 288
@@ -337,8 +294,9 @@ int add_munmap(unsigned long addr, unsigned long len, struct host_vm_op *ops,
337} 294}
338 295
339int add_mprotect(unsigned long addr, unsigned long len, int r, int w, int x, 296int add_mprotect(unsigned long addr, unsigned long len, int r, int w, int x,
340 struct host_vm_op *ops, int index, int last_filled, int data, 297 struct host_vm_op *ops, int index, int last_filled,
341 void (*do_ops)(int, struct host_vm_op *, int)) 298 union mm_context *mmu,
299 void (*do_ops)(union mm_context *, struct host_vm_op *, int))
342{ 300{
343 struct host_vm_op *last; 301 struct host_vm_op *last;
344 302
@@ -354,7 +312,7 @@ int add_mprotect(unsigned long addr, unsigned long len, int r, int w, int x,
354 } 312 }
355 313
356 if(index == last_filled){ 314 if(index == last_filled){
357 (*do_ops)(data, ops, last_filled); 315 (*do_ops)(mmu, ops, last_filled);
358 index = -1; 316 index = -1;
359 } 317 }
360 318
@@ -367,3 +325,49 @@ int add_mprotect(unsigned long addr, unsigned long len, int r, int w, int x,
367 .x = x } } }); 325 .x = x } } });
368 return(index); 326 return(index);
369} 327}
328
329void flush_tlb_page(struct vm_area_struct *vma, unsigned long address)
330{
331 address &= PAGE_MASK;
332 flush_tlb_range(vma, address, address + PAGE_SIZE);
333}
334
335void flush_tlb_all(void)
336{
337 flush_tlb_mm(current->mm);
338}
339
340void flush_tlb_kernel_range(unsigned long start, unsigned long end)
341{
342 CHOOSE_MODE_PROC(flush_tlb_kernel_range_tt,
343 flush_tlb_kernel_range_common, start, end);
344}
345
346void flush_tlb_kernel_vm(void)
347{
348 CHOOSE_MODE(flush_tlb_kernel_vm_tt(),
349 flush_tlb_kernel_range_common(start_vm, end_vm));
350}
351
352void __flush_tlb_one(unsigned long addr)
353{
354 CHOOSE_MODE_PROC(__flush_tlb_one_tt, __flush_tlb_one_skas, addr);
355}
356
357void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
358 unsigned long end)
359{
360 CHOOSE_MODE_PROC(flush_tlb_range_tt, flush_tlb_range_skas, vma, start,
361 end);
362}
363
364void flush_tlb_mm(struct mm_struct *mm)
365{
366 CHOOSE_MODE_PROC(flush_tlb_mm_tt, flush_tlb_mm_skas, mm);
367}
368
369void force_flush_all(void)
370{
371 CHOOSE_MODE(force_flush_all_tt(), force_flush_all_skas());
372}
373
diff --git a/arch/um/kernel/tt/tlb.c b/arch/um/kernel/tt/tlb.c
index 203216ad86..2eefb43bc9 100644
--- a/arch/um/kernel/tt/tlb.c
+++ b/arch/um/kernel/tt/tlb.c
@@ -17,7 +17,7 @@
17#include "os.h" 17#include "os.h"
18#include "tlb.h" 18#include "tlb.h"
19 19
20static void do_ops(int unused, struct host_vm_op *ops, int last) 20static void do_ops(union mm_context *mmu, struct host_vm_op *ops, int last)
21{ 21{
22 struct host_vm_op *op; 22 struct host_vm_op *op;
23 int i; 23 int i;
@@ -55,7 +55,7 @@ static void fix_range(struct mm_struct *mm, unsigned long start_addr,
55 panic("fix_range fixing wrong address space, current = 0x%p", 55 panic("fix_range fixing wrong address space, current = 0x%p",
56 current); 56 current);
57 57
58 fix_range_common(mm, start_addr, end_addr, force, 0, do_ops); 58 fix_range_common(mm, start_addr, end_addr, force, do_ops);
59} 59}
60 60
61atomic_t vmchange_seq = ATOMIC_INIT(1); 61atomic_t vmchange_seq = ATOMIC_INIT(1);
diff --git a/arch/um/kernel/uml.lds.S b/arch/um/kernel/uml.lds.S
index 61dfd4fef7..163476a8cb 100644
--- a/arch/um/kernel/uml.lds.S
+++ b/arch/um/kernel/uml.lds.S
@@ -30,6 +30,7 @@ SECTIONS
30 _einittext = .; 30 _einittext = .;
31 } 31 }
32 . = ALIGN(4096); 32 . = ALIGN(4096);
33
33 .text : 34 .text :
34 { 35 {
35 *(.text) 36 *(.text)
@@ -39,6 +40,12 @@ SECTIONS
39 /* .gnu.warning sections are handled specially by elf32.em. */ 40 /* .gnu.warning sections are handled specially by elf32.em. */
40 *(.gnu.warning) 41 *(.gnu.warning)
41 *(.gnu.linkonce.t*) 42 *(.gnu.linkonce.t*)
43
44 . = ALIGN(4096);
45 __syscall_stub_start = .;
46 *(.__syscall_stub*)
47 __syscall_stub_end = .;
48 . = ALIGN(4096);
42 } 49 }
43 50
44 #include "asm/common.lds.S" 51 #include "asm/common.lds.S"
diff --git a/arch/um/os-Linux/sys-i386/registers.c b/arch/um/os-Linux/sys-i386/registers.c
index 9a0ad094d9..3125d32072 100644
--- a/arch/um/os-Linux/sys-i386/registers.c
+++ b/arch/um/os-Linux/sys-i386/registers.c
@@ -121,6 +121,11 @@ void init_registers(int pid)
121 err); 121 err);
122} 122}
123 123
124void get_safe_registers(unsigned long *regs)
125{
126 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
127}
128
124/* 129/*
125 * Overrides for Emacs so that we follow Linus's tabbing style. 130 * Overrides for Emacs so that we follow Linus's tabbing style.
126 * Emacs will notice this stuff at the end of the file and automatically 131 * Emacs will notice this stuff at the end of the file and automatically
diff --git a/arch/um/os-Linux/sys-x86_64/registers.c b/arch/um/os-Linux/sys-x86_64/registers.c
index 6286c974bb..44438d15c3 100644
--- a/arch/um/os-Linux/sys-x86_64/registers.c
+++ b/arch/um/os-Linux/sys-x86_64/registers.c
@@ -69,6 +69,11 @@ void init_registers(int pid)
69 err); 69 err);
70} 70}
71 71
72void get_safe_registers(unsigned long *regs)
73{
74 memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
75}
76
72/* 77/*
73 * Overrides for Emacs so that we follow Linus's tabbing style. 78 * Overrides for Emacs so that we follow Linus's tabbing style.
74 * Emacs will notice this stuff at the end of the file and automatically 79 * Emacs will notice this stuff at the end of the file and automatically
diff --git a/arch/um/scripts/Makefile.rules b/arch/um/scripts/Makefile.rules
index 7459d09c23..17f305b6ba 100644
--- a/arch/um/scripts/Makefile.rules
+++ b/arch/um/scripts/Makefile.rules
@@ -16,6 +16,11 @@ define unprofile
16endef 16endef
17 17
18 18
19# The stubs and unmap.o can't try to call mcount or update basic block data
20define unprofile
21 $(patsubst -pg,,$(patsubst -fprofile-arcs -ftest-coverage,,$(1)))
22endef
23
19quiet_cmd_make_link = SYMLINK $@ 24quiet_cmd_make_link = SYMLINK $@
20cmd_make_link = ln -sf $(srctree)/arch/$(SUBARCH)/$($(notdir $@)-dir)/$(notdir $@) $@ 25cmd_make_link = ln -sf $(srctree)/arch/$(SUBARCH)/$($(notdir $@)-dir)/$(notdir $@) $@
21 26
diff --git a/arch/um/sys-i386/Makefile b/arch/um/sys-i386/Makefile
index 095bcdb0b9..77c3c4d29f 100644
--- a/arch/um/sys-i386/Makefile
+++ b/arch/um/sys-i386/Makefile
@@ -1,6 +1,6 @@
1obj-y = bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \ 1obj-y = bitops.o bugs.o checksum.o delay.o fault.o ksyms.o ldt.o ptrace.o \
2 ptrace_user.o semaphore.o signal.o sigcontext.o syscalls.o sysrq.o \ 2 ptrace_user.o semaphore.o signal.o sigcontext.o stub.o stub_segv.o \
3 sys_call_table.o 3 syscalls.o sysrq.o sys_call_table.o
4 4
5obj-$(CONFIG_HIGHMEM) += highmem.o 5obj-$(CONFIG_HIGHMEM) += highmem.o
6obj-$(CONFIG_MODULES) += module.o 6obj-$(CONFIG_MODULES) += module.o
@@ -16,6 +16,14 @@ semaphore.c-dir = kernel
16highmem.c-dir = mm 16highmem.c-dir = mm
17module.c-dir = kernel 17module.c-dir = kernel
18 18
19STUB_CFLAGS = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS))
20
21# _cflags works with kernel files, not with userspace ones, but c_flags does,
22# why ask why?
23$(obj)/stub_segv.o : c_flags = $(STUB_CFLAGS)
24
25$(obj)/stub.o : a_flags = $(STUB_CFLAGS)
26
19subdir- := util 27subdir- := util
20 28
21include arch/um/scripts/Makefile.unmap 29include arch/um/scripts/Makefile.unmap
diff --git a/arch/um/sys-i386/stub.S b/arch/um/sys-i386/stub.S
new file mode 100644
index 0000000000..2f2c70a8f0
--- /dev/null
+++ b/arch/um/sys-i386/stub.S
@@ -0,0 +1,8 @@
1#include "uml-config.h"
2
3 .globl syscall_stub
4.section .__syscall_stub, "x"
5syscall_stub:
6 int $0x80
7 mov %eax, UML_CONFIG_STUB_DATA
8 int3
diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c
new file mode 100644
index 0000000000..b251442ad0
--- /dev/null
+++ b/arch/um/sys-i386/stub_segv.c
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#include <signal.h>
7#include <asm/sigcontext.h>
8#include <asm/unistd.h>
9#include "uml-config.h"
10#include "sysdep/sigcontext.h"
11#include "sysdep/faultinfo.h"
12
13void __attribute__ ((__section__ (".__syscall_stub")))
14stub_segv_handler(int sig)
15{
16 struct sigcontext *sc = (struct sigcontext *) (&sig + 1);
17
18 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA),
19 sc);
20
21 __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid));
22 __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;"
23 "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1));
24 /* Pop the frame pointer and return address since we need to leave
25 * the stack in its original form when we do the sigreturn here, by
26 * hand.
27 */
28 __asm__("popl %%eax ; popl %%eax ; popl %%eax ; movl %0, %%eax ; "
29 "int $0x80" : : "g" (__NR_sigreturn));
30}
diff --git a/arch/um/sys-x86_64/Makefile b/arch/um/sys-x86_64/Makefile
index 2bc6f68490..7488206ce6 100644
--- a/arch/um/sys-x86_64/Makefile
+++ b/arch/um/sys-x86_64/Makefile
@@ -6,8 +6,8 @@
6 6
7#XXX: why into lib-y? 7#XXX: why into lib-y?
8lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \ 8lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \
9 ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \ 9 ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o stub.o \
10 syscalls.o sysrq.o thunk.o syscall_table.o 10 stub_segv.o syscalls.o syscall_table.o sysrq.o thunk.o
11 11
12obj-y := ksyms.o 12obj-y := ksyms.o
13obj-$(CONFIG_MODULES) += module.o um_module.o 13obj-$(CONFIG_MODULES) += module.o um_module.o
@@ -28,6 +28,14 @@ semaphore.c-dir = kernel
28thunk.S-dir = lib 28thunk.S-dir = lib
29module.c-dir = kernel 29module.c-dir = kernel
30 30
31STUB_CFLAGS = -Wp,-MD,$(depfile) $(call unprofile,$(USER_CFLAGS))
32
33# _cflags works with kernel files, not with userspace ones, but c_flags does,
34# why ask why?
35$(obj)/stub_segv.o : c_flags = $(STUB_CFLAGS)
36
37$(obj)/stub.o : a_flags = $(STUB_CFLAGS)
38
31subdir- := util 39subdir- := util
32 40
33include arch/um/scripts/Makefile.unmap 41include arch/um/scripts/Makefile.unmap
diff --git a/arch/um/sys-x86_64/stub.S b/arch/um/sys-x86_64/stub.S
new file mode 100644
index 0000000000..31c1492571
--- /dev/null
+++ b/arch/um/sys-x86_64/stub.S
@@ -0,0 +1,15 @@
1#include "uml-config.h"
2
3 .globl syscall_stub
4.section .__syscall_stub, "x"
5syscall_stub:
6 syscall
7 /* We don't have 64-bit constants, so this constructs the address
8 * we need.
9 */
10 movq $(UML_CONFIG_STUB_DATA >> 32), %rbx
11 salq $32, %rbx
12 movq $(UML_CONFIG_STUB_DATA & 0xffffffff), %rcx
13 or %rcx, %rbx
14 movq %rax, (%rbx)
15 int3
diff --git a/arch/um/sys-x86_64/stub_segv.c b/arch/um/sys-x86_64/stub_segv.c
new file mode 100644
index 0000000000..161d1fe9c0
--- /dev/null
+++ b/arch/um/sys-x86_64/stub_segv.c
@@ -0,0 +1,31 @@
1/*
2 * Copyright (C) 2004 Jeff Dike (jdike@addtoit.com)
3 * Licensed under the GPL
4 */
5
6#include <signal.h>
7#include <linux/compiler.h>
8#include <asm/unistd.h>
9#include "uml-config.h"
10#include "sysdep/sigcontext.h"
11#include "sysdep/faultinfo.h"
12
13void __attribute__ ((__section__ (".__syscall_stub")))
14stub_segv_handler(int sig)
15{
16 struct ucontext *uc;
17
18 __asm__("movq %%rdx, %0" : "=g" (uc) :);
19 GET_FAULTINFO_FROM_SC(*((struct faultinfo *) UML_CONFIG_STUB_DATA),
20 &uc->uc_mcontext);
21
22 __asm__("movq %0, %%rax ; syscall": : "g" (__NR_getpid));
23 __asm__("movq %%rax, %%rdi ; movq %0, %%rax ; movq %1, %%rsi ;"
24 "syscall": : "g" (__NR_kill), "g" (SIGUSR1));
25 /* Two popqs to restore the stack to the state just before entering
26 * the handler, one pops the return address, the other pops the frame
27 * pointer.
28 */
29 __asm__("popq %%rax ; popq %%rax ; movq %0, %%rax ; syscall" : : "g"
30 (__NR_rt_sigreturn));
31}
diff --git a/arch/v850/Kconfig b/arch/v850/Kconfig
index 27febd6ffa..89c053b6c2 100644
--- a/arch/v850/Kconfig
+++ b/arch/v850/Kconfig
@@ -250,6 +250,8 @@ source "fs/Kconfig.binfmt"
250 250
251endmenu 251endmenu
252 252
253source "net/Kconfig"
254
253############################################################################# 255#############################################################################
254 256
255source "drivers/base/Kconfig" 257source "drivers/base/Kconfig"
@@ -283,7 +285,7 @@ source "drivers/ieee1394/Kconfig"
283 285
284source "drivers/message/i2o/Kconfig" 286source "drivers/message/i2o/Kconfig"
285 287
286source "net/Kconfig" 288source "drivers/net/Kconfig"
287 289
288source "drivers/isdn/Kconfig" 290source "drivers/isdn/Kconfig"
289 291
diff --git a/arch/v850/kernel/vmlinux.lds.S b/arch/v850/kernel/vmlinux.lds.S
index bbd3429bcf..c366a8b326 100644
--- a/arch/v850/kernel/vmlinux.lds.S
+++ b/arch/v850/kernel/vmlinux.lds.S
@@ -1,8 +1,8 @@
1/* 1/*
2 * arch/v850/vmlinux.lds.S -- kernel linker script for v850 platforms 2 * arch/v850/vmlinux.lds.S -- kernel linker script for v850 platforms
3 * 3 *
4 * Copyright (C) 2002,03,04 NEC Electronics Corporation 4 * Copyright (C) 2002,03,04,05 NEC Electronics Corporation
5 * Copyright (C) 2002,03,04 Miles Bader <miles@gnu.org> 5 * Copyright (C) 2002,03,04,05 Miles Bader <miles@gnu.org>
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General 7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this 8 * Public License. See the file COPYING in the main directory of this
@@ -61,6 +61,7 @@
61 *(__kcrctab_gpl) \ 61 *(__kcrctab_gpl) \
62 ___stop___kcrctab_gpl = .; \ 62 ___stop___kcrctab_gpl = .; \
63 /* Built-in module parameters */ \ 63 /* Built-in module parameters */ \
64 . = ALIGN (4) ; \
64 ___start___param = .; \ 65 ___start___param = .; \
65 *(__param) \ 66 *(__param) \
66 ___stop___param = .; 67 ___stop___param = .;
diff --git a/arch/v850/lib/checksum.c b/arch/v850/lib/checksum.c
index d308b724c0..fa58726330 100644
--- a/arch/v850/lib/checksum.c
+++ b/arch/v850/lib/checksum.c
@@ -138,7 +138,8 @@ unsigned int csum_partial_copy(const unsigned char *src, unsigned char *dst,
138 * Copy from userspace and compute checksum. If we catch an exception 138 * Copy from userspace and compute checksum. If we catch an exception
139 * then zero the rest of the buffer. 139 * then zero the rest of the buffer.
140 */ 140 */
141unsigned int csum_partial_copy_from_user (const unsigned char *src, unsigned char *dst, 141unsigned int csum_partial_copy_from_user (const unsigned char *src,
142 unsigned char *dst,
142 int len, unsigned int sum, 143 int len, unsigned int sum,
143 int *err_ptr) 144 int *err_ptr)
144{ 145{
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index d09437b5c4..4b8326177c 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -515,6 +515,8 @@ config UID16
515 515
516endmenu 516endmenu
517 517
518source "net/Kconfig"
519
518source drivers/Kconfig 520source drivers/Kconfig
519 521
520source "drivers/firmware/Kconfig" 522source "drivers/firmware/Kconfig"
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 8a73794f9b..4289156976 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -65,7 +65,9 @@ CFLAGS += $(call cc-option,-mno-sse -mno-mmx -mno-sse2 -mno-3dnow,)
65head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o 65head-y := arch/x86_64/kernel/head.o arch/x86_64/kernel/head64.o arch/x86_64/kernel/init_task.o
66 66
67libs-y += arch/x86_64/lib/ 67libs-y += arch/x86_64/lib/
68core-y += arch/x86_64/kernel/ arch/x86_64/mm/ 68core-y += arch/x86_64/kernel/ \
69 arch/x86_64/mm/ \
70 arch/x86_64/crypto/
69core-$(CONFIG_IA32_EMULATION) += arch/x86_64/ia32/ 71core-$(CONFIG_IA32_EMULATION) += arch/x86_64/ia32/
70drivers-$(CONFIG_PCI) += arch/x86_64/pci/ 72drivers-$(CONFIG_PCI) += arch/x86_64/pci/
71drivers-$(CONFIG_OPROFILE) += arch/x86_64/oprofile/ 73drivers-$(CONFIG_OPROFILE) += arch/x86_64/oprofile/
diff --git a/arch/x86_64/crypto/Makefile b/arch/x86_64/crypto/Makefile
new file mode 100644
index 0000000000..426d20f4b7
--- /dev/null
+++ b/arch/x86_64/crypto/Makefile
@@ -0,0 +1,9 @@
1#
2# x86_64/crypto/Makefile
3#
4# Arch-specific CryptoAPI modules.
5#
6
7obj-$(CONFIG_CRYPTO_AES_X86_64) += aes-x86_64.o
8
9aes-x86_64-y := aes-x86_64-asm.o aes.o
diff --git a/arch/x86_64/crypto/aes-x86_64-asm.S b/arch/x86_64/crypto/aes-x86_64-asm.S
new file mode 100644
index 0000000000..483cbb23ab
--- /dev/null
+++ b/arch/x86_64/crypto/aes-x86_64-asm.S
@@ -0,0 +1,186 @@
1/* AES (Rijndael) implementation (FIPS PUB 197) for x86_64
2 *
3 * Copyright (C) 2005 Andreas Steinmetz, <ast@domdv.de>
4 *
5 * License:
6 * This code can be distributed under the terms of the GNU General Public
7 * License (GPL) Version 2 provided that the above header down to and
8 * including this sentence is retained in full.
9 */
10
11.extern aes_ft_tab
12.extern aes_it_tab
13.extern aes_fl_tab
14.extern aes_il_tab
15
16.text
17
18#define R1 %rax
19#define R1E %eax
20#define R1X %ax
21#define R1H %ah
22#define R1L %al
23#define R2 %rbx
24#define R2E %ebx
25#define R2X %bx
26#define R2H %bh
27#define R2L %bl
28#define R3 %rcx
29#define R3E %ecx
30#define R3X %cx
31#define R3H %ch
32#define R3L %cl
33#define R4 %rdx
34#define R4E %edx
35#define R4X %dx
36#define R4H %dh
37#define R4L %dl
38#define R5 %rsi
39#define R5E %esi
40#define R6 %rdi
41#define R6E %edi
42#define R7 %rbp
43#define R7E %ebp
44#define R8 %r8
45#define R9 %r9
46#define R10 %r10
47#define R11 %r11
48
49#define prologue(FUNC,BASE,B128,B192,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11) \
50 .global FUNC; \
51 .type FUNC,@function; \
52 .align 8; \
53FUNC: movq r1,r2; \
54 movq r3,r4; \
55 leaq BASE+52(r8),r9; \
56 movq r10,r11; \
57 movl (r7),r5 ## E; \
58 movl 4(r7),r1 ## E; \
59 movl 8(r7),r6 ## E; \
60 movl 12(r7),r7 ## E; \
61 movl (r8),r10 ## E; \
62 xorl -48(r9),r5 ## E; \
63 xorl -44(r9),r1 ## E; \
64 xorl -40(r9),r6 ## E; \
65 xorl -36(r9),r7 ## E; \
66 cmpl $24,r10 ## E; \
67 jb B128; \
68 leaq 32(r9),r9; \
69 je B192; \
70 leaq 32(r9),r9;
71
72#define epilogue(r1,r2,r3,r4,r5,r6,r7,r8,r9) \
73 movq r1,r2; \
74 movq r3,r4; \
75 movl r5 ## E,(r9); \
76 movl r6 ## E,4(r9); \
77 movl r7 ## E,8(r9); \
78 movl r8 ## E,12(r9); \
79 ret;
80
81#define round(TAB,OFFSET,r1,r2,r3,r4,r5,r6,r7,r8,ra,rb,rc,rd) \
82 movzbl r2 ## H,r5 ## E; \
83 movzbl r2 ## L,r6 ## E; \
84 movl TAB+1024(,r5,4),r5 ## E;\
85 movw r4 ## X,r2 ## X; \
86 movl TAB(,r6,4),r6 ## E; \
87 roll $16,r2 ## E; \
88 shrl $16,r4 ## E; \
89 movzbl r4 ## H,r7 ## E; \
90 movzbl r4 ## L,r4 ## E; \
91 xorl OFFSET(r8),ra ## E; \
92 xorl OFFSET+4(r8),rb ## E; \
93 xorl TAB+3072(,r7,4),r5 ## E;\
94 xorl TAB+2048(,r4,4),r6 ## E;\
95 movzbl r1 ## L,r7 ## E; \
96 movzbl r1 ## H,r4 ## E; \
97 movl TAB+1024(,r4,4),r4 ## E;\
98 movw r3 ## X,r1 ## X; \
99 roll $16,r1 ## E; \
100 shrl $16,r3 ## E; \
101 xorl TAB(,r7,4),r5 ## E; \
102 movzbl r3 ## H,r7 ## E; \
103 movzbl r3 ## L,r3 ## E; \
104 xorl TAB+3072(,r7,4),r4 ## E;\
105 xorl TAB+2048(,r3,4),r5 ## E;\
106 movzbl r1 ## H,r7 ## E; \
107 movzbl r1 ## L,r3 ## E; \
108 shrl $16,r1 ## E; \
109 xorl TAB+3072(,r7,4),r6 ## E;\
110 movl TAB+2048(,r3,4),r3 ## E;\
111 movzbl r1 ## H,r7 ## E; \
112 movzbl r1 ## L,r1 ## E; \
113 xorl TAB+1024(,r7,4),r6 ## E;\
114 xorl TAB(,r1,4),r3 ## E; \
115 movzbl r2 ## H,r1 ## E; \
116 movzbl r2 ## L,r7 ## E; \
117 shrl $16,r2 ## E; \
118 xorl TAB+3072(,r1,4),r3 ## E;\
119 xorl TAB+2048(,r7,4),r4 ## E;\
120 movzbl r2 ## H,r1 ## E; \
121 movzbl r2 ## L,r2 ## E; \
122 xorl OFFSET+8(r8),rc ## E; \
123 xorl OFFSET+12(r8),rd ## E; \
124 xorl TAB+1024(,r1,4),r3 ## E;\
125 xorl TAB(,r2,4),r4 ## E;
126
127#define move_regs(r1,r2,r3,r4) \
128 movl r3 ## E,r1 ## E; \
129 movl r4 ## E,r2 ## E;
130
131#define entry(FUNC,BASE,B128,B192) \
132 prologue(FUNC,BASE,B128,B192,R2,R8,R7,R9,R1,R3,R4,R6,R10,R5,R11)
133
134#define return epilogue(R8,R2,R9,R7,R5,R6,R3,R4,R11)
135
136#define encrypt_round(TAB,OFFSET) \
137 round(TAB,OFFSET,R1,R2,R3,R4,R5,R6,R7,R10,R5,R6,R3,R4) \
138 move_regs(R1,R2,R5,R6)
139
140#define encrypt_final(TAB,OFFSET) \
141 round(TAB,OFFSET,R1,R2,R3,R4,R5,R6,R7,R10,R5,R6,R3,R4)
142
143#define decrypt_round(TAB,OFFSET) \
144 round(TAB,OFFSET,R2,R1,R4,R3,R6,R5,R7,R10,R5,R6,R3,R4) \
145 move_regs(R1,R2,R5,R6)
146
147#define decrypt_final(TAB,OFFSET) \
148 round(TAB,OFFSET,R2,R1,R4,R3,R6,R5,R7,R10,R5,R6,R3,R4)
149
150/* void aes_encrypt(void *ctx, u8 *out, const u8 *in) */
151
152 entry(aes_encrypt,0,enc128,enc192)
153 encrypt_round(aes_ft_tab,-96)
154 encrypt_round(aes_ft_tab,-80)
155enc192: encrypt_round(aes_ft_tab,-64)
156 encrypt_round(aes_ft_tab,-48)
157enc128: encrypt_round(aes_ft_tab,-32)
158 encrypt_round(aes_ft_tab,-16)
159 encrypt_round(aes_ft_tab, 0)
160 encrypt_round(aes_ft_tab, 16)
161 encrypt_round(aes_ft_tab, 32)
162 encrypt_round(aes_ft_tab, 48)
163 encrypt_round(aes_ft_tab, 64)
164 encrypt_round(aes_ft_tab, 80)
165 encrypt_round(aes_ft_tab, 96)
166 encrypt_final(aes_fl_tab,112)
167 return
168
169/* void aes_decrypt(void *ctx, u8 *out, const u8 *in) */
170
171 entry(aes_decrypt,240,dec128,dec192)
172 decrypt_round(aes_it_tab,-96)
173 decrypt_round(aes_it_tab,-80)
174dec192: decrypt_round(aes_it_tab,-64)
175 decrypt_round(aes_it_tab,-48)
176dec128: decrypt_round(aes_it_tab,-32)
177 decrypt_round(aes_it_tab,-16)
178 decrypt_round(aes_it_tab, 0)
179 decrypt_round(aes_it_tab, 16)
180 decrypt_round(aes_it_tab, 32)
181 decrypt_round(aes_it_tab, 48)
182 decrypt_round(aes_it_tab, 64)
183 decrypt_round(aes_it_tab, 80)
184 decrypt_round(aes_it_tab, 96)
185 decrypt_final(aes_il_tab,112)
186 return
diff --git a/arch/x86_64/crypto/aes.c b/arch/x86_64/crypto/aes.c
new file mode 100644
index 0000000000..2b5c4010ce
--- /dev/null
+++ b/arch/x86_64/crypto/aes.c
@@ -0,0 +1,324 @@
1/*
2 * Cryptographic API.
3 *
4 * AES Cipher Algorithm.
5 *
6 * Based on Brian Gladman's code.
7 *
8 * Linux developers:
9 * Alexander Kjeldaas <astor@fast.no>
10 * Herbert Valerio Riedel <hvr@hvrlab.org>
11 * Kyle McMartin <kyle@debian.org>
12 * Adam J. Richter <adam@yggdrasil.com> (conversion to 2.5 API).
13 * Andreas Steinmetz <ast@domdv.de> (adapted to x86_64 assembler)
14 *
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
19 *
20 * ---------------------------------------------------------------------------
21 * Copyright (c) 2002, Dr Brian Gladman <brg@gladman.me.uk>, Worcester, UK.
22 * All rights reserved.
23 *
24 * LICENSE TERMS
25 *
26 * The free distribution and use of this software in both source and binary
27 * form is allowed (with or without changes) provided that:
28 *
29 * 1. distributions of this source code include the above copyright
30 * notice, this list of conditions and the following disclaimer;
31 *
32 * 2. distributions in binary form include the above copyright
33 * notice, this list of conditions and the following disclaimer
34 * in the documentation and/or other associated materials;
35 *
36 * 3. the copyright holder's name is not used to endorse products
37 * built using this software without specific written permission.
38 *
39 * ALTERNATIVELY, provided that this notice is retained in full, this product
40 * may be distributed under the terms of the GNU General Public License (GPL),
41 * in which case the provisions of the GPL apply INSTEAD OF those given above.
42 *
43 * DISCLAIMER
44 *
45 * This software is provided 'as is' with no explicit or implied warranties
46 * in respect of its properties, including, but not limited to, correctness
47 * and/or fitness for purpose.
48 * ---------------------------------------------------------------------------
49 */
50
51/* Some changes from the Gladman version:
52 s/RIJNDAEL(e_key)/E_KEY/g
53 s/RIJNDAEL(d_key)/D_KEY/g
54*/
55
56#include <asm/byteorder.h>
57#include <linux/bitops.h>
58#include <linux/crypto.h>
59#include <linux/errno.h>
60#include <linux/init.h>
61#include <linux/module.h>
62#include <linux/types.h>
63
64#define AES_MIN_KEY_SIZE 16
65#define AES_MAX_KEY_SIZE 32
66
67#define AES_BLOCK_SIZE 16
68
69/*
70 * #define byte(x, nr) ((unsigned char)((x) >> (nr*8)))
71 */
72static inline u8 byte(const u32 x, const unsigned n)
73{
74 return x >> (n << 3);
75}
76
77#define u32_in(x) le32_to_cpu(*(const __le32 *)(x))
78
79struct aes_ctx
80{
81 u32 key_length;
82 u32 E[60];
83 u32 D[60];
84};
85
86#define E_KEY ctx->E
87#define D_KEY ctx->D
88
89static u8 pow_tab[256] __initdata;
90static u8 log_tab[256] __initdata;
91static u8 sbx_tab[256] __initdata;
92static u8 isb_tab[256] __initdata;
93static u32 rco_tab[10];
94u32 aes_ft_tab[4][256];
95u32 aes_it_tab[4][256];
96
97u32 aes_fl_tab[4][256];
98u32 aes_il_tab[4][256];
99
100static inline u8 f_mult(u8 a, u8 b)
101{
102 u8 aa = log_tab[a], cc = aa + log_tab[b];
103
104 return pow_tab[cc + (cc < aa ? 1 : 0)];
105}
106
107#define ff_mult(a, b) (a && b ? f_mult(a, b) : 0)
108
109#define ls_box(x) \
110 (aes_fl_tab[0][byte(x, 0)] ^ \
111 aes_fl_tab[1][byte(x, 1)] ^ \
112 aes_fl_tab[2][byte(x, 2)] ^ \
113 aes_fl_tab[3][byte(x, 3)])
114
115static void __init gen_tabs(void)
116{
117 u32 i, t;
118 u8 p, q;
119
120 /* log and power tables for GF(2**8) finite field with
121 0x011b as modular polynomial - the simplest primitive
122 root is 0x03, used here to generate the tables */
123
124 for (i = 0, p = 1; i < 256; ++i) {
125 pow_tab[i] = (u8)p;
126 log_tab[p] = (u8)i;
127
128 p ^= (p << 1) ^ (p & 0x80 ? 0x01b : 0);
129 }
130
131 log_tab[1] = 0;
132
133 for (i = 0, p = 1; i < 10; ++i) {
134 rco_tab[i] = p;
135
136 p = (p << 1) ^ (p & 0x80 ? 0x01b : 0);
137 }
138
139 for (i = 0; i < 256; ++i) {
140 p = (i ? pow_tab[255 - log_tab[i]] : 0);
141 q = ((p >> 7) | (p << 1)) ^ ((p >> 6) | (p << 2));
142 p ^= 0x63 ^ q ^ ((q >> 6) | (q << 2));
143 sbx_tab[i] = p;
144 isb_tab[p] = (u8)i;
145 }
146
147 for (i = 0; i < 256; ++i) {
148 p = sbx_tab[i];
149
150 t = p;
151 aes_fl_tab[0][i] = t;
152 aes_fl_tab[1][i] = rol32(t, 8);
153 aes_fl_tab[2][i] = rol32(t, 16);
154 aes_fl_tab[3][i] = rol32(t, 24);
155
156 t = ((u32)ff_mult(2, p)) |
157 ((u32)p << 8) |
158 ((u32)p << 16) | ((u32)ff_mult(3, p) << 24);
159
160 aes_ft_tab[0][i] = t;
161 aes_ft_tab[1][i] = rol32(t, 8);
162 aes_ft_tab[2][i] = rol32(t, 16);
163 aes_ft_tab[3][i] = rol32(t, 24);
164
165 p = isb_tab[i];
166
167 t = p;
168 aes_il_tab[0][i] = t;
169 aes_il_tab[1][i] = rol32(t, 8);
170 aes_il_tab[2][i] = rol32(t, 16);
171 aes_il_tab[3][i] = rol32(t, 24);
172
173 t = ((u32)ff_mult(14, p)) |
174 ((u32)ff_mult(9, p) << 8) |
175 ((u32)ff_mult(13, p) << 16) |
176 ((u32)ff_mult(11, p) << 24);
177
178 aes_it_tab[0][i] = t;
179 aes_it_tab[1][i] = rol32(t, 8);
180 aes_it_tab[2][i] = rol32(t, 16);
181 aes_it_tab[3][i] = rol32(t, 24);
182 }
183}
184
185#define star_x(x) (((x) & 0x7f7f7f7f) << 1) ^ ((((x) & 0x80808080) >> 7) * 0x1b)
186
187#define imix_col(y, x) \
188 u = star_x(x); \
189 v = star_x(u); \
190 w = star_x(v); \
191 t = w ^ (x); \
192 (y) = u ^ v ^ w; \
193 (y) ^= ror32(u ^ t, 8) ^ \
194 ror32(v ^ t, 16) ^ \
195 ror32(t, 24)
196
197/* initialise the key schedule from the user supplied key */
198
199#define loop4(i) \
200{ \
201 t = ror32(t, 8); t = ls_box(t) ^ rco_tab[i]; \
202 t ^= E_KEY[4 * i]; E_KEY[4 * i + 4] = t; \
203 t ^= E_KEY[4 * i + 1]; E_KEY[4 * i + 5] = t; \
204 t ^= E_KEY[4 * i + 2]; E_KEY[4 * i + 6] = t; \
205 t ^= E_KEY[4 * i + 3]; E_KEY[4 * i + 7] = t; \
206}
207
208#define loop6(i) \
209{ \
210 t = ror32(t, 8); t = ls_box(t) ^ rco_tab[i]; \
211 t ^= E_KEY[6 * i]; E_KEY[6 * i + 6] = t; \
212 t ^= E_KEY[6 * i + 1]; E_KEY[6 * i + 7] = t; \
213 t ^= E_KEY[6 * i + 2]; E_KEY[6 * i + 8] = t; \
214 t ^= E_KEY[6 * i + 3]; E_KEY[6 * i + 9] = t; \
215 t ^= E_KEY[6 * i + 4]; E_KEY[6 * i + 10] = t; \
216 t ^= E_KEY[6 * i + 5]; E_KEY[6 * i + 11] = t; \
217}
218
219#define loop8(i) \
220{ \
221 t = ror32(t, 8); ; t = ls_box(t) ^ rco_tab[i]; \
222 t ^= E_KEY[8 * i]; E_KEY[8 * i + 8] = t; \
223 t ^= E_KEY[8 * i + 1]; E_KEY[8 * i + 9] = t; \
224 t ^= E_KEY[8 * i + 2]; E_KEY[8 * i + 10] = t; \
225 t ^= E_KEY[8 * i + 3]; E_KEY[8 * i + 11] = t; \
226 t = E_KEY[8 * i + 4] ^ ls_box(t); \
227 E_KEY[8 * i + 12] = t; \
228 t ^= E_KEY[8 * i + 5]; E_KEY[8 * i + 13] = t; \
229 t ^= E_KEY[8 * i + 6]; E_KEY[8 * i + 14] = t; \
230 t ^= E_KEY[8 * i + 7]; E_KEY[8 * i + 15] = t; \
231}
232
233static int aes_set_key(void *ctx_arg, const u8 *in_key, unsigned int key_len,
234 u32 *flags)
235{
236 struct aes_ctx *ctx = ctx_arg;
237 u32 i, j, t, u, v, w;
238
239 if (key_len != 16 && key_len != 24 && key_len != 32) {
240 *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
241 return -EINVAL;
242 }
243
244 ctx->key_length = key_len;
245
246 D_KEY[key_len + 24] = E_KEY[0] = u32_in(in_key);
247 D_KEY[key_len + 25] = E_KEY[1] = u32_in(in_key + 4);
248 D_KEY[key_len + 26] = E_KEY[2] = u32_in(in_key + 8);
249 D_KEY[key_len + 27] = E_KEY[3] = u32_in(in_key + 12);
250
251 switch (key_len) {
252 case 16:
253 t = E_KEY[3];
254 for (i = 0; i < 10; ++i)
255 loop4(i);
256 break;
257
258 case 24:
259 E_KEY[4] = u32_in(in_key + 16);
260 t = E_KEY[5] = u32_in(in_key + 20);
261 for (i = 0; i < 8; ++i)
262 loop6 (i);
263 break;
264
265 case 32:
266 E_KEY[4] = u32_in(in_key + 16);
267 E_KEY[5] = u32_in(in_key + 20);
268 E_KEY[6] = u32_in(in_key + 24);
269 t = E_KEY[7] = u32_in(in_key + 28);
270 for (i = 0; i < 7; ++i)
271 loop8(i);
272 break;
273 }
274
275 D_KEY[0] = E_KEY[key_len + 24];
276 D_KEY[1] = E_KEY[key_len + 25];
277 D_KEY[2] = E_KEY[key_len + 26];
278 D_KEY[3] = E_KEY[key_len + 27];
279
280 for (i = 4; i < key_len + 24; ++i) {
281 j = key_len + 24 - (i & ~3) + (i & 3);
282 imix_col(D_KEY[j], E_KEY[i]);
283 }
284
285 return 0;
286}
287
288extern void aes_encrypt(void *ctx_arg, u8 *out, const u8 *in);
289extern void aes_decrypt(void *ctx_arg, u8 *out, const u8 *in);
290
291static struct crypto_alg aes_alg = {
292 .cra_name = "aes",
293 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
294 .cra_blocksize = AES_BLOCK_SIZE,
295 .cra_ctxsize = sizeof(struct aes_ctx),
296 .cra_module = THIS_MODULE,
297 .cra_list = LIST_HEAD_INIT(aes_alg.cra_list),
298 .cra_u = {
299 .cipher = {
300 .cia_min_keysize = AES_MIN_KEY_SIZE,
301 .cia_max_keysize = AES_MAX_KEY_SIZE,
302 .cia_setkey = aes_set_key,
303 .cia_encrypt = aes_encrypt,
304 .cia_decrypt = aes_decrypt
305 }
306 }
307};
308
309static int __init aes_init(void)
310{
311 gen_tabs();
312 return crypto_register_alg(&aes_alg);
313}
314
315static void __exit aes_fini(void)
316{
317 crypto_unregister_alg(&aes_alg);
318}
319
320module_init(aes_init);
321module_exit(aes_fini);
322
323MODULE_DESCRIPTION("Rijndael (AES) Cipher Algorithm");
324MODULE_LICENSE("GPL");
diff --git a/arch/x86_64/kernel/kprobes.c b/arch/x86_64/kernel/kprobes.c
index acd2a778eb..5c6dc70514 100644
--- a/arch/x86_64/kernel/kprobes.c
+++ b/arch/x86_64/kernel/kprobes.c
@@ -682,7 +682,7 @@ static struct kprobe trampoline_p = {
682 .pre_handler = trampoline_probe_handler 682 .pre_handler = trampoline_probe_handler
683}; 683};
684 684
685int __init arch_init(void) 685int __init arch_init_kprobes(void)
686{ 686{
687 return register_kprobe(&trampoline_p); 687 return register_kprobe(&trampoline_p);
688} 688}
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index b02d921da4..5fd0322505 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -1076,6 +1076,10 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
1076#ifdef CONFIG_X86_MCE 1076#ifdef CONFIG_X86_MCE
1077 mcheck_init(c); 1077 mcheck_init(c);
1078#endif 1078#endif
1079 if (c == &boot_cpu_data)
1080 mtrr_bp_init();
1081 else
1082 mtrr_ap_init();
1079#ifdef CONFIG_NUMA 1083#ifdef CONFIG_NUMA
1080 if (c != &boot_cpu_data) 1084 if (c != &boot_cpu_data)
1081 numa_add_cpu(c - cpu_data); 1085 numa_add_cpu(c - cpu_data);
diff --git a/arch/x86_64/kernel/suspend.c b/arch/x86_64/kernel/suspend.c
index 6c0f402e3a..0612640d91 100644
--- a/arch/x86_64/kernel/suspend.c
+++ b/arch/x86_64/kernel/suspend.c
@@ -119,6 +119,7 @@ void __restore_processor_state(struct saved_context *ctxt)
119 fix_processor_context(); 119 fix_processor_context();
120 120
121 do_fpu_end(); 121 do_fpu_end();
122 mtrr_ap_init();
122} 123}
123 124
124void restore_processor_state(void) 125void restore_processor_state(void)
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index 73389f51c4..2a94f9b60b 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -56,10 +56,14 @@ SECTIONS
56 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) { 56 .data.cacheline_aligned : AT(ADDR(.data.cacheline_aligned) - LOAD_OFFSET) {
57 *(.data.cacheline_aligned) 57 *(.data.cacheline_aligned)
58 } 58 }
59 . = ALIGN(CONFIG_X86_L1_CACHE_BYTES);
60 .data.read_mostly : AT(ADDR(.data.read_mostly) - LOAD_OFFSET) {
61 *(.data.read_mostly)
62 }
59 63
60#define VSYSCALL_ADDR (-10*1024*1024) 64#define VSYSCALL_ADDR (-10*1024*1024)
61#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.cacheline_aligned) + SIZEOF(.data.cacheline_aligned) + 4095) & ~(4095)) 65#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
62#define VSYSCALL_VIRT_ADDR ((ADDR(.data.cacheline_aligned) + SIZEOF(.data.cacheline_aligned) + 4095) & ~(4095)) 66#define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
63 67
64#define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR) 68#define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
65#define VLOAD(x) (ADDR(x) - VLOAD_OFFSET) 69#define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index c9b5d298e3..2b6257bec4 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -228,6 +228,8 @@ source "fs/Kconfig.binfmt"
228 228
229endmenu 229endmenu
230 230
231source "net/Kconfig"
232
231source "drivers/Kconfig" 233source "drivers/Kconfig"
232 234
233source "fs/Kconfig" 235source "fs/Kconfig"
diff --git a/arch/xtensa/kernel/asm-offsets.c b/arch/xtensa/kernel/asm-offsets.c
index 840cd9a1d3..7cd1d7f8f6 100644
--- a/arch/xtensa/kernel/asm-offsets.c
+++ b/arch/xtensa/kernel/asm-offsets.c
@@ -15,7 +15,6 @@
15#include <asm/processor.h> 15#include <asm/processor.h>
16 16
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/sched.h>
19#include <linux/stddef.h> 18#include <linux/stddef.h>
20#include <linux/thread_info.h> 19#include <linux/thread_info.h>
21#include <linux/ptrace.h> 20#include <linux/ptrace.h>
diff --git a/arch/xtensa/kernel/syscalls.c b/arch/xtensa/kernel/syscalls.c
index abc8ed6c70..f20c6494c5 100644
--- a/arch/xtensa/kernel/syscalls.c
+++ b/arch/xtensa/kernel/syscalls.c
@@ -42,12 +42,9 @@
42#include <asm/mman.h> 42#include <asm/mman.h>
43#include <asm/shmparam.h> 43#include <asm/shmparam.h>
44#include <asm/page.h> 44#include <asm/page.h>
45#include <asm/ipc.h>
46 45
47extern void do_syscall_trace(void); 46extern void do_syscall_trace(void);
48typedef int (*syscall_t)(void *a0,...); 47typedef int (*syscall_t)(void *a0,...);
49extern int (*do_syscalls)(struct pt_regs *regs, syscall_t fun,
50 int narg);
51extern syscall_t sys_call_table[]; 48extern syscall_t sys_call_table[];
52extern unsigned char sys_narg_table[]; 49extern unsigned char sys_narg_table[];
53 50
@@ -72,10 +69,8 @@ int sys_pipe(int __user *userfds)
72/* 69/*
73 * Common code for old and new mmaps. 70 * Common code for old and new mmaps.
74 */ 71 */
75 72long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot,
76static inline long do_mmap2(unsigned long addr, unsigned long len, 73 unsigned long flags, unsigned long fd, unsigned long pgoff)
77 unsigned long prot, unsigned long flags,
78 unsigned long fd, unsigned long pgoff)
79{ 74{
80 int error = -EBADF; 75 int error = -EBADF;
81 struct file * file = NULL; 76 struct file * file = NULL;
@@ -97,29 +92,6 @@ out:
97 return error; 92 return error;
98} 93}
99 94
100unsigned long old_mmap(unsigned long addr, size_t len, int prot,
101 int flags, int fd, off_t offset)
102{
103 return do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
104}
105
106long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
107 unsigned long flags, unsigned long fd, unsigned long pgoff)
108{
109 return do_mmap2(addr, len, prot, flags, fd, pgoff);
110}
111
112int sys_fork(struct pt_regs *regs)
113{
114 return do_fork(SIGCHLD, regs->areg[1], regs, 0, NULL, NULL);
115}
116
117int sys_vfork(struct pt_regs *regs)
118{
119 return do_fork(CLONE_VFORK|CLONE_VM|SIGCHLD, regs->areg[1],
120 regs, 0, NULL, NULL);
121}
122
123int sys_clone(struct pt_regs *regs) 95int sys_clone(struct pt_regs *regs)
124{ 96{
125 unsigned long clone_flags; 97 unsigned long clone_flags;
@@ -162,30 +134,6 @@ int sys_uname(struct old_utsname * name)
162 return -EFAULT; 134 return -EFAULT;
163} 135}
164 136
165int sys_olduname(struct oldold_utsname * name)
166{
167 int error;
168
169 if (!name)
170 return -EFAULT;
171 if (!access_ok(VERIFY_WRITE,name,sizeof(struct oldold_utsname)))
172 return -EFAULT;
173
174 error = __copy_to_user(&name->sysname,&system_utsname.sysname,__OLD_UTS_LEN);
175 error -= __put_user(0,name->sysname+__OLD_UTS_LEN);
176 error -= __copy_to_user(&name->nodename,&system_utsname.nodename,__OLD_UTS_LEN);
177 error -= __put_user(0,name->nodename+__OLD_UTS_LEN);
178 error -= __copy_to_user(&name->release,&system_utsname.release,__OLD_UTS_LEN);
179 error -= __put_user(0,name->release+__OLD_UTS_LEN);
180 error -= __copy_to_user(&name->version,&system_utsname.version,__OLD_UTS_LEN);
181 error -= __put_user(0,name->version+__OLD_UTS_LEN);
182 error -= __copy_to_user(&name->machine,&system_utsname.machine,__OLD_UTS_LEN);
183 error -= __put_user(0,name->machine+__OLD_UTS_LEN);
184
185 return error ? -EFAULT : 0;
186}
187
188
189/* 137/*
190 * Build the string table for the builtin "poor man's strace". 138 * Build the string table for the builtin "poor man's strace".
191 */ 139 */
@@ -319,100 +267,3 @@ void system_call (struct pt_regs *regs)
319 regs->areg[2] = res; 267 regs->areg[2] = res;
320 do_syscall_trace(); 268 do_syscall_trace();
321} 269}
322
323/*
324 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
325 *
326 * This is really horribly ugly.
327 */
328
329int sys_ipc (uint call, int first, int second,
330 int third, void __user *ptr, long fifth)
331{
332 int version, ret;
333
334 version = call >> 16; /* hack for backward compatibility */
335 call &= 0xffff;
336 ret = -ENOSYS;
337
338 switch (call) {
339 case SEMOP:
340 ret = sys_semtimedop (first, (struct sembuf __user *)ptr,
341 second, NULL);
342 break;
343
344 case SEMTIMEDOP:
345 ret = sys_semtimedop (first, (struct sembuf __user *)ptr,
346 second, (const struct timespec *) fifth);
347 break;
348
349 case SEMGET:
350 ret = sys_semget (first, second, third);
351 break;
352
353 case SEMCTL: {
354 union semun fourth;
355
356 if (ptr && !get_user(fourth.__pad, (void *__user *) ptr))
357 ret = sys_semctl (first, second, third, fourth);
358 break;
359 }
360
361 case MSGSND:
362 ret = sys_msgsnd (first, (struct msgbuf __user*) ptr,
363 second, third);
364 break;
365
366 case MSGRCV:
367 switch (version) {
368 case 0: {
369 struct ipc_kludge tmp;
370
371 if (ptr && !copy_from_user(&tmp,
372 (struct ipc_kludge *) ptr,
373 sizeof (tmp)))
374 ret = sys_msgrcv (first, tmp.msgp, second,
375 tmp.msgtyp, third);
376 break;
377 }
378
379 default:
380 ret = sys_msgrcv (first, (struct msgbuf __user *) ptr,
381 second, 0, third);
382 break;
383 }
384 break;
385
386 case MSGGET:
387 ret = sys_msgget ((key_t) first, second);
388 break;
389
390 case MSGCTL:
391 ret = sys_msgctl (first, second, (struct msqid_ds __user*) ptr);
392 break;
393
394 case SHMAT: {
395 ulong raddr;
396 ret = do_shmat (first, (char __user *) ptr, second, &raddr);
397
398 if (!ret)
399 ret = put_user (raddr, (ulong __user *) third);
400
401 break;
402 }
403
404 case SHMDT:
405 ret = sys_shmdt ((char __user *)ptr);
406 break;
407
408 case SHMGET:
409 ret = sys_shmget (first, second, third);
410 break;
411
412 case SHMCTL:
413 ret = sys_shmctl (first, second, (struct shmid_ds __user*) ptr);
414 break;
415 }
416 return ret;
417}
418
diff --git a/arch/xtensa/kernel/syscalls.h b/arch/xtensa/kernel/syscalls.h
index 5b3f75f50f..216c10a315 100644
--- a/arch/xtensa/kernel/syscalls.h
+++ b/arch/xtensa/kernel/syscalls.h
@@ -25,41 +25,40 @@
25 */ 25 */
26 26
27SYSCALL(0, 0) /* 00 */ 27SYSCALL(0, 0) /* 00 */
28
29SYSCALL(sys_exit, 1) 28SYSCALL(sys_exit, 1)
30SYSCALL(sys_fork, 0) 29SYSCALL(sys_ni_syscall, 0)
31SYSCALL(sys_read, 3) 30SYSCALL(sys_read, 3)
32SYSCALL(sys_write, 3) 31SYSCALL(sys_write, 3)
33SYSCALL(sys_open, 3) /* 05 */ 32SYSCALL(sys_open, 3) /* 05 */
34SYSCALL(sys_close, 1) 33SYSCALL(sys_close, 1)
35SYSCALL(sys_waitpid, 3) 34SYSCALL(sys_ni_syscall, 3)
36SYSCALL(sys_creat, 2) 35SYSCALL(sys_creat, 2)
37SYSCALL(sys_link, 2) 36SYSCALL(sys_link, 2)
38SYSCALL(sys_unlink, 1) /* 10 */ 37SYSCALL(sys_unlink, 1) /* 10 */
39SYSCALL(sys_execve, 0) 38SYSCALL(sys_execve, 0)
40SYSCALL(sys_chdir, 1) 39SYSCALL(sys_chdir, 1)
41SYSCALL(sys_time, 1) 40SYSCALL(sys_ni_syscall, 1)
42SYSCALL(sys_mknod, 3) 41SYSCALL(sys_mknod, 3)
43SYSCALL(sys_chmod, 2) /* 15 */ 42SYSCALL(sys_chmod, 2) /* 15 */
44SYSCALL(sys_lchown, 3) 43SYSCALL(sys_lchown, 3)
45SYSCALL(sys_ni_syscall, 0) 44SYSCALL(sys_ni_syscall, 0)
46SYSCALL(sys_stat, 2) 45SYSCALL(sys_newstat, 2)
47SYSCALL(sys_lseek, 3) 46SYSCALL(sys_lseek, 3)
48SYSCALL(sys_getpid, 0) /* 20 */ 47SYSCALL(sys_getpid, 0) /* 20 */
49SYSCALL(sys_mount, 5) 48SYSCALL(sys_mount, 5)
50SYSCALL(sys_oldumount, 1) 49SYSCALL(sys_ni_syscall, 1)
51SYSCALL(sys_setuid, 1) 50SYSCALL(sys_setuid, 1)
52SYSCALL(sys_getuid, 0) 51SYSCALL(sys_getuid, 0)
53SYSCALL(sys_stime, 1) /* 25 */ 52SYSCALL(sys_ni_syscall, 1) /* 25 */
54SYSCALL(sys_ptrace, 4) 53SYSCALL(sys_ptrace, 4)
55SYSCALL(sys_alarm, 1) 54SYSCALL(sys_ni_syscall, 1)
56SYSCALL(sys_fstat, 2) 55SYSCALL(sys_newfstat, 2)
57SYSCALL(sys_pause, 0) 56SYSCALL(sys_ni_syscall, 0)
58SYSCALL(sys_utime, 2) /* 30 */ 57SYSCALL(sys_utime, 2) /* 30 */
59SYSCALL(sys_ni_syscall, 0) 58SYSCALL(sys_ni_syscall, 0)
60SYSCALL(sys_ni_syscall, 0) 59SYSCALL(sys_ni_syscall, 0)
61SYSCALL(sys_access, 2) 60SYSCALL(sys_access, 2)
62SYSCALL(sys_nice, 1) 61SYSCALL(sys_ni_syscall, 1)
63SYSCALL(sys_ni_syscall, 0) /* 35 */ 62SYSCALL(sys_ni_syscall, 0) /* 35 */
64SYSCALL(sys_sync, 0) 63SYSCALL(sys_sync, 0)
65SYSCALL(sys_kill, 2) 64SYSCALL(sys_kill, 2)
@@ -73,7 +72,7 @@ SYSCALL(sys_ni_syscall, 0)
73SYSCALL(sys_brk, 1) /* 45 */ 72SYSCALL(sys_brk, 1) /* 45 */
74SYSCALL(sys_setgid, 1) 73SYSCALL(sys_setgid, 1)
75SYSCALL(sys_getgid, 0) 74SYSCALL(sys_getgid, 0)
76SYSCALL(sys_ni_syscall, 0) /* was signal(2) */ 75SYSCALL(sys_ni_syscall, 0)
77SYSCALL(sys_geteuid, 0) 76SYSCALL(sys_geteuid, 0)
78SYSCALL(sys_getegid, 0) /* 50 */ 77SYSCALL(sys_getegid, 0) /* 50 */
79SYSCALL(sys_acct, 1) 78SYSCALL(sys_acct, 1)
@@ -84,21 +83,21 @@ SYSCALL(sys_fcntl, 3) /* 55 */
84SYSCALL(sys_ni_syscall, 2) 83SYSCALL(sys_ni_syscall, 2)
85SYSCALL(sys_setpgid, 2) 84SYSCALL(sys_setpgid, 2)
86SYSCALL(sys_ni_syscall, 0) 85SYSCALL(sys_ni_syscall, 0)
87SYSCALL(sys_olduname, 1) 86SYSCALL(sys_ni_syscall, 0)
88SYSCALL(sys_umask, 1) /* 60 */ 87SYSCALL(sys_umask, 1) /* 60 */
89SYSCALL(sys_chroot, 1) 88SYSCALL(sys_chroot, 1)
90SYSCALL(sys_ustat, 2) 89SYSCALL(sys_ustat, 2)
91SYSCALL(sys_dup2, 2) 90SYSCALL(sys_dup2, 2)
92SYSCALL(sys_getppid, 0) 91SYSCALL(sys_getppid, 0)
93SYSCALL(sys_getpgrp, 0) /* 65 */ 92SYSCALL(sys_ni_syscall, 0) /* 65 */
94SYSCALL(sys_setsid, 0) 93SYSCALL(sys_setsid, 0)
95SYSCALL(sys_sigaction, 3) 94SYSCALL(sys_sigaction, 3)
96SYSCALL(sys_sgetmask, 0) 95SYSCALL(sys_ni_syscall, 0)
97SYSCALL(sys_ssetmask, 1) 96SYSCALL(sys_ni_syscall, 1)
98SYSCALL(sys_setreuid, 2) /* 70 */ 97SYSCALL(sys_setreuid, 2) /* 70 */
99SYSCALL(sys_setregid, 2) 98SYSCALL(sys_setregid, 2)
100SYSCALL(sys_sigsuspend, 0) 99SYSCALL(sys_sigsuspend, 0)
101SYSCALL(sys_sigpending, 1) 100SYSCALL(sys_ni_syscall, 1)
102SYSCALL(sys_sethostname, 2) 101SYSCALL(sys_sethostname, 2)
103SYSCALL(sys_setrlimit, 2) /* 75 */ 102SYSCALL(sys_setrlimit, 2) /* 75 */
104SYSCALL(sys_getrlimit, 2) 103SYSCALL(sys_getrlimit, 2)
@@ -107,15 +106,15 @@ SYSCALL(sys_gettimeofday, 2)
107SYSCALL(sys_settimeofday, 2) 106SYSCALL(sys_settimeofday, 2)
108SYSCALL(sys_getgroups, 2) /* 80 */ 107SYSCALL(sys_getgroups, 2) /* 80 */
109SYSCALL(sys_setgroups, 2) 108SYSCALL(sys_setgroups, 2)
110SYSCALL(sys_ni_syscall, 0) /* old_select */ 109SYSCALL(sys_ni_syscall, 0)
111SYSCALL(sys_symlink, 2) 110SYSCALL(sys_symlink, 2)
112SYSCALL(sys_lstat, 2) 111SYSCALL(sys_newlstat, 2)
113SYSCALL(sys_readlink, 3) /* 85 */ 112SYSCALL(sys_readlink, 3) /* 85 */
114SYSCALL(sys_uselib, 1) 113SYSCALL(sys_uselib, 1)
115SYSCALL(sys_swapon, 2) 114SYSCALL(sys_swapon, 2)
116SYSCALL(sys_reboot, 3) 115SYSCALL(sys_reboot, 3)
117SYSCALL(old_readdir, 3) 116SYSCALL(sys_ni_syscall, 3)
118SYSCALL(old_mmap, 6) /* 90 */ 117SYSCALL(sys_ni_syscall, 6) /* 90 */
119SYSCALL(sys_munmap, 2) 118SYSCALL(sys_munmap, 2)
120SYSCALL(sys_truncate, 2) 119SYSCALL(sys_truncate, 2)
121SYSCALL(sys_ftruncate, 2) 120SYSCALL(sys_ftruncate, 2)
@@ -127,7 +126,7 @@ SYSCALL(sys_ni_syscall, 0)
127SYSCALL(sys_statfs, 2) 126SYSCALL(sys_statfs, 2)
128SYSCALL(sys_fstatfs, 2) /* 100 */ 127SYSCALL(sys_fstatfs, 2) /* 100 */
129SYSCALL(sys_ni_syscall, 3) 128SYSCALL(sys_ni_syscall, 3)
130SYSCALL(sys_socketcall, 2) 129SYSCALL(sys_ni_syscall, 2)
131SYSCALL(sys_syslog, 3) 130SYSCALL(sys_syslog, 3)
132SYSCALL(sys_setitimer, 3) 131SYSCALL(sys_setitimer, 3)
133SYSCALL(sys_getitimer, 2) /* 105 */ 132SYSCALL(sys_getitimer, 2) /* 105 */
@@ -137,32 +136,32 @@ SYSCALL(sys_newfstat, 2)
137SYSCALL(sys_uname, 1) 136SYSCALL(sys_uname, 1)
138SYSCALL(sys_ni_syscall, 0) /* 110 */ 137SYSCALL(sys_ni_syscall, 0) /* 110 */
139SYSCALL(sys_vhangup, 0) 138SYSCALL(sys_vhangup, 0)
140SYSCALL(sys_ni_syscall, 0) /* was sys_idle() */ 139SYSCALL(sys_ni_syscall, 0)
141SYSCALL(sys_ni_syscall, 0) 140SYSCALL(sys_ni_syscall, 0)
142SYSCALL(sys_wait4, 4) 141SYSCALL(sys_wait4, 4)
143SYSCALL(sys_swapoff, 1) /* 115 */ 142SYSCALL(sys_swapoff, 1) /* 115 */
144SYSCALL(sys_sysinfo, 1) 143SYSCALL(sys_sysinfo, 1)
145SYSCALL(sys_ipc, 5) /* 6 really, but glibc uses only 5) */ 144SYSCALL(sys_ni_syscall, 0)
146SYSCALL(sys_fsync, 1) 145SYSCALL(sys_fsync, 1)
147SYSCALL(sys_sigreturn, 0) 146SYSCALL(sys_sigreturn, 0)
148SYSCALL(sys_clone, 0) /* 120 */ 147SYSCALL(sys_clone, 0) /* 120 */
149SYSCALL(sys_setdomainname, 2) 148SYSCALL(sys_setdomainname, 2)
150SYSCALL(sys_newuname, 1) 149SYSCALL(sys_newuname, 1)
151SYSCALL(sys_ni_syscall, 0) /* sys_modify_ldt */ 150SYSCALL(sys_ni_syscall, 0)
152SYSCALL(sys_adjtimex, 1) 151SYSCALL(sys_adjtimex, 1)
153SYSCALL(sys_mprotect, 3) /* 125 */ 152SYSCALL(sys_mprotect, 3) /* 125 */
154SYSCALL(sys_sigprocmask, 3) 153SYSCALL(sys_ni_syscall, 3)
155SYSCALL(sys_ni_syscall, 2) /* old sys_create_module */ 154SYSCALL(sys_ni_syscall, 2)
156SYSCALL(sys_init_module, 2) 155SYSCALL(sys_init_module, 2)
157SYSCALL(sys_delete_module, 1) 156SYSCALL(sys_delete_module, 1)
158SYSCALL(sys_ni_syscall, 1) /* old sys_get_kernel_sysm */ /* 130 */ 157SYSCALL(sys_ni_syscall, 1) /* 130 */
159SYSCALL(sys_quotactl, 0) 158SYSCALL(sys_quotactl, 0)
160SYSCALL(sys_getpgid, 1) 159SYSCALL(sys_getpgid, 1)
161SYSCALL(sys_fchdir, 1) 160SYSCALL(sys_fchdir, 1)
162SYSCALL(sys_bdflush, 2) 161SYSCALL(sys_bdflush, 2)
163SYSCALL(sys_sysfs, 3) /* 135 */ 162SYSCALL(sys_sysfs, 3) /* 135 */
164SYSCALL(sys_personality, 1) 163SYSCALL(sys_personality, 1)
165SYSCALL(sys_ni_syscall, 0) /* for afs_syscall */ 164SYSCALL(sys_ni_syscall, 0)
166SYSCALL(sys_setfsuid, 1) 165SYSCALL(sys_setfsuid, 1)
167SYSCALL(sys_setfsgid, 1) 166SYSCALL(sys_setfsgid, 1)
168SYSCALL(sys_llseek, 5) /* 140 */ 167SYSCALL(sys_llseek, 5) /* 140 */
@@ -212,7 +211,7 @@ SYSCALL(sys_socket, 3)
212SYSCALL(sys_socketpair, 4) 211SYSCALL(sys_socketpair, 4)
213SYSCALL(sys_setresuid, 3) /* 185 */ 212SYSCALL(sys_setresuid, 3) /* 185 */
214SYSCALL(sys_getresuid, 3) 213SYSCALL(sys_getresuid, 3)
215SYSCALL(sys_ni_syscall, 5) /* old sys_query_module */ 214SYSCALL(sys_ni_syscall, 5)
216SYSCALL(sys_poll, 3) 215SYSCALL(sys_poll, 3)
217SYSCALL(sys_nfsservctl, 3) 216SYSCALL(sys_nfsservctl, 3)
218SYSCALL(sys_setresgid, 3) /* 190 */ 217SYSCALL(sys_setresgid, 3) /* 190 */
@@ -235,7 +234,7 @@ SYSCALL(sys_sigaltstack, 0)
235SYSCALL(sys_sendfile, 4) 234SYSCALL(sys_sendfile, 4)
236SYSCALL(sys_ni_syscall, 0) 235SYSCALL(sys_ni_syscall, 0)
237SYSCALL(sys_ni_syscall, 0) 236SYSCALL(sys_ni_syscall, 0)
238SYSCALL(sys_mmap2, 6) /* 210 */ 237SYSCALL(sys_mmap, 6) /* 210 */
239SYSCALL(sys_truncate64, 2) 238SYSCALL(sys_truncate64, 2)
240SYSCALL(sys_ftruncate64, 2) 239SYSCALL(sys_ftruncate64, 2)
241SYSCALL(sys_stat64, 2) 240SYSCALL(sys_stat64, 2)
@@ -245,4 +244,4 @@ SYSCALL(sys_pivot_root, 2)
245SYSCALL(sys_mincore, 3) 244SYSCALL(sys_mincore, 3)
246SYSCALL(sys_madvise, 3) 245SYSCALL(sys_madvise, 3)
247SYSCALL(sys_getdents64, 3) 246SYSCALL(sys_getdents64, 3)
248SYSCALL(sys_vfork, 0) /* 220 */ 247SYSCALL(sys_ni_syscall, 0) /* 220 */
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index 804246e743..225d64d73f 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -29,6 +29,7 @@
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/stringify.h> 30#include <linux/stringify.h>
31#include <linux/kallsyms.h> 31#include <linux/kallsyms.h>
32#include <linux/delay.h>
32 33
33#include <asm/ptrace.h> 34#include <asm/ptrace.h>
34#include <asm/timex.h> 35#include <asm/timex.h>
@@ -488,8 +489,7 @@ void die(const char * str, struct pt_regs * regs, long err)
488 489
489 if (panic_on_oops) { 490 if (panic_on_oops) {
490 printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n"); 491 printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n");
491 set_current_state(TASK_UNINTERRUPTIBLE); 492 ssleep(5);
492 schedule_timeout(5 * HZ);
493 panic("Fatal exception"); 493 panic("Fatal exception");
494 } 494 }
495 do_exit(err); 495 do_exit(err);
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index 476b2b53cd..5ed71dfc81 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -90,10 +90,10 @@ SECTIONS
90 *(.literal .text) 90 *(.literal .text)
91 *(.srom.text) 91 *(.srom.text)
92 VMLINUX_SYMBOL(__sched_text_start) = .; 92 VMLINUX_SYMBOL(__sched_text_start) = .;
93 *(.sched.text.literal .sched.text) 93 *(.sched.literal .sched.text)
94 VMLINUX_SYMBOL(__sched_text_end) = .; 94 VMLINUX_SYMBOL(__sched_text_end) = .;
95 VMLINUX_SYMBOL(__lock_text_start) = .; 95 VMLINUX_SYMBOL(__lock_text_start) = .;
96 *(.spinlock.text.literal .spinlock.text) 96 *(.spinlock.literal .spinlock.text)
97 VMLINUX_SYMBOL(__lock_text_end) = .; 97 VMLINUX_SYMBOL(__lock_text_end) = .;
98 98
99 } 99 }
@@ -164,7 +164,7 @@ SECTIONS
164 __init_begin = .; 164 __init_begin = .;
165 .init.text : { 165 .init.text : {
166 _sinittext = .; 166 _sinittext = .;
167 *(.init.text.literal) *(.init.text) 167 *(.init.literal) *(.init.text)
168 _einittext = .; 168 _einittext = .;
169 } 169 }
170 170